Compare commits

...

20 Commits

Author SHA1 Message Date
dc9ec367a0 remove workflows that were test workflows
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/cron/ci Pipeline failed
2025-09-10 22:38:37 -04:00
799ee18dc2 cleanup locations. make treasure bold. try to add some flair to the images 2025-09-10 22:38:06 -04:00
277a3ba718 improve overall dungeon cohesiveness
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/cron/ci Pipeline was successful
2025-09-08 22:42:42 -04:00
Madison Grubb
a3c54b1c82 use sharp and improve prompting
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/cron/ci Pipeline was successful
2025-09-05 16:48:35 -04:00
Madison Grubb
be7534be8d smaller image, larger image would crash comfyui 2025-09-05 13:32:49 -04:00
Madison Grubb
23fae22735 make titles always uppercase. cleanup copy footer
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-05 13:21:06 -04:00
Madison Grubb
d436284476 improve gen
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-05 13:18:24 -04:00
Madison Grubb
800c9c488c lower cfg to 2.
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-05 09:49:54 -04:00
Madison Grubb
27dfed05ac improve image gen prompting. increase cfg from 1->3 to make prompt follow more aggressively
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/cron/ci Pipeline was successful
2025-09-04 23:09:57 -04:00
Madison Grubb
714d0351ea fix png compression 2025-09-04 23:02:28 -04:00
Madison Grubb
f0e9ebccb9 cleanup console logs a little bit
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:59:37 -04:00
Madison Grubb
fad007ab1f increase encounter count by 3
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:54:52 -04:00
Madison Grubb
438943b032 cleanup template more for imagen
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:52:23 -04:00
Madison Grubb
50e240f314 fix name of file
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:48:57 -04:00
Madison Grubb
df08a6bf42 add png compression to save space
Some checks failed
ci/woodpecker/push/ci Pipeline failed
2025-09-04 22:48:11 -04:00
Madison Grubb
f51a5a6e0c shrink image more. improve prompts
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:38:03 -04:00
Madison Grubb
1e1bee6d05 add env var for comfyui in ci
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 22:18:14 -04:00
Madison Grubb
1e1d745e55 rework to allow for image gen
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
2025-09-04 16:52:13 -04:00
af315783e0 cleanup everything lol
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/cron/ci Pipeline was successful
2025-09-01 16:53:37 -04:00
15ce02eec1 revamp release uploads 2025-09-01 15:38:55 -04:00
12 changed files with 1211 additions and 326 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.pdf
*.png
.env
node_modules/**

View File

@@ -30,6 +30,8 @@ steps:
from_secret: OLLAMA_API_URL
OLLAMA_API_KEY:
from_secret: OLLAMA_API_KEY
COMFYUI_URL:
from_secret: COMFYUI_URL
commands:
- npm ci
- npm start
@@ -45,16 +47,32 @@ steps:
commands:
- pdf=$(ls *.pdf | head -n1)
- tag=$(date +%F)
# Create the release (ignore error if it already exists)
- |
curl -s -o /dev/null -w "%{http_code}" -X POST \
echo "Creating release for tag $tag..."
create_resp=$(curl -s -w "%{http_code}" -o /tmp/create.json -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$tag\", \"name\": \"$tag\", \"draft\": false, \"prerelease\": false}" \
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases || true
# Upload the PDF as a release asset
- |
curl -X POST \
-d "{\"tag_name\":\"$tag\",\"name\":\"$tag\"}" \
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases)
echo "Create release HTTP status: $create_resp"
echo "Fetching release ID..."
release_id=$(curl -s \
-H "Authorization: token $GITEA_TOKEN" \
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/tags/$tag |
awk -F: '/"id"[ ]*:/ {gsub(/[^0-9]/,"",$2); print $2; exit}')
echo "Release ID = $release_id"
echo "Checking if asset $pdf already exists..."
assets=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/$release_id/assets)
echo "Assets response: $assets"
if echo "$assets" | grep -q "\"name\":\"$pdf\""; then
echo "Asset $pdf already uploaded, skipping."
exit 0
fi
echo "Uploading $pdf to release $release_id..."
upload_resp=$(curl -s -w "%{http_code}" -o /tmp/upload.json -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$pdf" \
"https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/$tag/assets"
https://git.keligrubb.com/api/v1/repos/keligrubb/scrollsmith/releases/$release_id/assets)
echo "Upload HTTP status: $upload_resp"
echo "Upload response: $(cat /tmp/upload.json)"

View File

@@ -22,12 +22,13 @@ Scrollsmith is a Node.js tool for generating Dungeons & Dragons one-page dungeon
- Node.js 22+
- Ollama server running and accessible
- Nextcloud (optional) for PDF uploads
- Gitea Releases (optional) for PDF uploads
- `.env` file with:
```env
OLLAMA_API_URL=http://localhost:3000/api/chat/completions
OLLAMA_API_KEY=your_api_key_here
COMFYUI_URL=http://192.168.1.124:8188
````
---
@@ -63,7 +64,7 @@ Optional: update the map path in `index.js` if you have a local dungeon map.
* Three-column layout:
* Column 1: Map, Adventure Hooks, Rumors
* Column 2: Keyed Rooms
* Column 2: Rooms
* Column 3: Encounters, Treasure, NPCs
---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,76 +1,28 @@
const OLLAMA_API_URL = process.env.OLLAMA_API_URL;
const OLLAMA_API_KEY = process.env.OLLAMA_API_KEY;
import { callOllama } from "./ollamaClient.js";
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// --- Utility: strip markdown artifacts ---
// Utility: strip markdown artifacts and clean up extra whitespace
function cleanText(str) {
if (!str) return "";
return str
.replace(/^#+\s*/gm, "") // remove headers
.replace(/\*\*(.*?)\*\*/g, "$1") // remove bold
.replace(/[*_`]/g, "") // remove stray formatting
.replace(/\s+/g, " ") // normalize whitespace
.replace(/^#+\s*/gm, "")
.replace(/\*\*(.*?)\*\*/g, "$1") // Removes bolding
.replace(/[*_`]/g, "") // Removes other markdown
.replace(/\s+/g, " ")
.trim();
}
async function callOllama(prompt, model = "gemma3n:e4b", retries = 5, stepName = "unknown") {
for (let attempt = 1; attempt <= retries; attempt++) {
try {
const promptCharCount = prompt.length;
const promptWordCount = prompt.split(/\s+/).length;
console.log(`\n📤 [${stepName}] Sending prompt (attempt ${attempt}/${retries})`);
console.log(` Prompt: ${promptCharCount} chars, ~${promptWordCount} words`);
const response = await fetch(OLLAMA_API_URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${OLLAMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model,
messages: [{ role: "user", content: prompt }],
}),
});
if (!response.ok) throw new Error(`Ollama request failed: ${response.status} ${response.statusText}`);
const data = await response.json();
const rawText = data.choices?.[0]?.message?.content;
if (!rawText) throw new Error("No response from Ollama");
const cleaned = cleanText(rawText);
console.log(`✅ [${stepName}] Received: ${rawText.length} chars, ~${rawText.split(/\s+/).length} words`);
console.log(`--- Raw output ---\n${rawText}\n`);
console.log(`--- Cleaned output ---\n${cleaned}\n`);
return cleaned;
} catch (err) {
console.warn(`⚠️ [${stepName}] Attempt ${attempt} failed: ${err.message}`);
if (attempt === retries) throw err;
const delay = 1000 * Math.pow(2, attempt) + Math.random() * 500;
console.log(` Retrying in ${Math.round(delay / 1000)}s...`);
await sleep(delay);
}
}
}
function parseList(raw) {
return raw
.split(/\n|(?=\d+[).]\s)/g)
.map(line => cleanText(line.replace(/^\d+[).\s-]*/, "")))
.split(/\n?\d+[).]\s+/)
.map(line => cleanText(line))
.filter(Boolean);
}
function parseObjects(raw, type = "rooms") {
return raw
.split("\n")
.map(line => cleanText(line.replace(/^\d+[).\s-]*/, "")))
let cleanedRaw = raw.replace(/Intermediate Rooms:/i, "").replace(/Climax Room:/i, "").trim();
return cleanedRaw
.split(/\n?\d+[).]\s+/)
.map(entry => cleanText(entry))
.filter(Boolean)
.map(entry => {
const [name, ...descParts] = entry.split(/[-–—:]/);
@@ -83,11 +35,9 @@ function parseObjects(raw, type = "rooms") {
}
export async function generateDungeon() {
console.log("🏗️ Starting compact dungeon generation with debug logs...\n");
// --- Step 1: Titles ---
const titles10Raw = await callOllama(
`Generate 10 short, punchy dungeon titles (max 5 words each), numbered as a plain text list.
// Step 1: Titles
const generatedTitlesRaw = await callOllama(
`Generate 50 short, punchy dungeon titles (max 5 words each), numbered as a plain text list.
Each title should come from a different style or theme. Make the set varied and evocative. For example:
- OSR / classic tabletop: gritty, mysterious, old-school
@@ -97,111 +47,100 @@ Each title should come from a different style or theme. Make the set varied and
- Weird fantasy: uncanny, surreal, unsettling
- Whimsical: fun, quirky, playful
Avoid repeating materials or adjectives. Do not include explanations, markdown, or preambles. Only the 10 numbered titles.`,
Avoid repeating materials or adjectives. Absolutely do not use the words "Obsidian" or "Clockwork" in any title. Do not include explanations, markdown, or preambles. Do not include the style or theme in parenthesis. Only the 50 numbered titles.`,
undefined, 5, "Step 1: Titles"
);
const titles10 = parseList(titles10Raw, 30);
console.log("🔹 Parsed titles10:", titles10);
const generatedTitles = parseList(generatedTitlesRaw);
console.log("Generated Titles:", generatedTitles);
const title = generatedTitles[Math.floor(Math.random() * generatedTitles.length)];
console.log("Selected title:", title);
// --- Step 2: Narrow to 5 ---
const titles5Raw = await callOllama(
`Here are 10 dungeon titles:
${titles10.join("\n")}
Select the 3 most interesting titles from the above list and create 2 additional unique titles.
Output exactly 5 titles as a numbered list, plain text only. No explanations.`,
undefined, 5, "Step 2: Narrow Titles"
// Step 2: Core Concepts
const coreConceptsRaw = await callOllama(
`For a dungeon titled "${title}", generate three core concepts: a central conflict, a primary faction, and a major environmental hazard or dynamic element.
Output as a numbered list with bolded headings. Plain text only. Absolutely do not use the word "Obsidian" or "obsidian" anywhere in the output.
Example:
1. **Central Conflict:** The dungeon's power source is failing, causing reality to warp.
2. **Primary Faction:** A group of rival cultists trying to seize control of the power source.
3. **Dynamic Element:** Zones of temporal distortion that cause random, brief time shifts.`,
undefined, 5, "Step 2: Core Concepts"
);
const titles5 = parseList(titles5Raw, 30);
console.log("🔹 Parsed titles5:", titles5);
const coreConcepts = coreConceptsRaw;
console.log("Core Concepts:", coreConcepts);
// --- Step 3: Final title ---
const bestTitleRaw = await callOllama(
`From the following 5 dungeon titles, select the one that sounds the most fun to play.
Output only the title, no explanation, no numbering, no extra text:
${titles5.join("\n")}`,
undefined, 5, "Step 3: Final Title"
// Step 3: Flavor Text & Hooks
const flavorHooksRaw = await callOllama(
`Based on the title "${title}" and these core concepts:
${coreConcepts}
Write a single evocative paragraph describing the location. Maximum 2 sentences. Maximum 100 words. Then, generate 3 short adventure hooks or rumors.
The hooks should reference the central conflict, faction, and dynamic element.
Output two sections labeled "Description:" and "Hooks & Rumors:". Use a numbered list for the hooks. Plain text only. Absolutely do not use the word "Obsidian" or "obsidian" anywhere in the output.`,
undefined, 5, "Step 3: Flavor & Hooks"
);
const title = cleanText(bestTitleRaw.split("\n")[0]);
console.log("🔹 Selected title:", title);
const [flavorSection, hooksSection] = flavorHooksRaw.split(/Hooks & Rumors[:\n]/i);
const flavor = cleanText(flavorSection.replace(/Description[:\n]*/i, ""));
const hooksRumors = parseList(hooksSection || "");
console.log("Flavor Text:", flavor);
console.log("Hooks & Rumors:", hooksRumors);
// --- Step 4: Flavor text ---
const flavorRaw = await callOllama(
`Write a single evocative paragraph describing the dungeon titled "${title}".
Do not include hooks, NPCs, treasure, or instructions. Output plain text only, one paragraph.`,
undefined, 5, "Step 4: Flavor"
// Step 4: Key Rooms
const keyRoomsRaw = await callOllama(
`Based on the title "${title}", description "${flavor}", and these core concepts:
${coreConcepts}
Generate two key rooms that define the dungeon's narrative arc.
1. **Entrance Room:** Give it a name and a description that sets the tone and introduces the environmental hazard.
2. **Climax Room:** Give it a name and a description that includes the primary faction and the central conflict.
Output as two numbered items, plain text only. Do not use bolded headings. Do not include any intro or other text. Only the numbered list. Absolutely do not use the word "Obsidian" or "obsidian" anywhere in the output.`,
undefined, 5, "Step 4: Key Rooms"
);
const flavor = flavorRaw;
console.log("🔹 Flavor text:", flavor);
const [entranceSection, climaxSection] = keyRoomsRaw.split(/\n?2[).] /); // Split on "2. " to separate the two rooms
const entranceRoom = parseObjects(entranceSection, "rooms")[0];
const climaxRoom = parseObjects(`1. ${climaxSection}`, "rooms")[0]; // Prepend "1. " to make parsing consistent
console.log("Entrance Room:", entranceRoom);
console.log("Climax Room:", climaxRoom);
// --- Step 5: Hooks & Rumors ---
const hooksRumorsRaw = await callOllama(
`Based only on this dungeon flavor:
// Step 5: Main Content (Locations, Encounters, NPCs, Treasures)
const mainContentRaw = await callOllama(
`Based on the following dungeon elements and the need for narrative flow:
Title: "${title}"
Description: "${flavor}"
Core Concepts:
${coreConcepts}
Entrance Room: ${JSON.stringify(entranceRoom)}
Climax Room: ${JSON.stringify(climaxRoom)}
${flavor}
Generate 3 adventure hooks (one sentence each) and 3 rumors (one sentence each).
Output numbered lists only, plain text. Maximum 120 characters per item. No explanations or extra text.
Format as:
Hooks:
1. ...
2. ...
3. ...
Rumors:
1. ...
2. ...
3. ...`
,
undefined, 5, "Step 5: Hooks & Rumors"
Generate the rest of the dungeon's content to fill the space between the entrance and the climax.
- **Strictly 3 Locations:** Each with a name and a short description (max 20 words). The description must be a single sentence. It should contain an environmental feature, a puzzle, or an element that connects to the core concepts or the final room.
- **Strictly 4 Encounters:** Name and details. At least two encounters must be directly tied to the primary faction.
- **Strictly 3 NPCs:** Proper name and a trait. One NPC should be a member of the primary faction, one should be a potential ally, and one should be a rival.
- **Strictly 3 Treasures:** Name and a description that includes a danger or side-effect. Each treasure should be thematically tied to a specific encounter or room.
Output as four separate numbered lists. Label the lists as "Locations:", "Encounters:", "NPCs:", and "Treasures:". Do not use any bolding, preambles, or extra text. Absolutely do not use the word "Obsidian" or "obsidian" anywhere in the output.`,
undefined, 5, "Step 5: Main Content"
);
const [hooksSection, rumorsSection] = hooksRumorsRaw.split(/Rumors[:\n]/i);
const hooks = parseList(hooksSection.replace(/Hooks[:\n]*/i, ""), 120);
const rumors = parseList(rumorsSection || "", 120);
console.log("🔹 Hooks:", hooks);
console.log("🔹 Rumors:", rumors);
const [intermediateRoomsSection, encountersSection, npcsSection, treasureSection] = mainContentRaw.split(/Encounters:|NPCs:|Treasures?:/i);
const intermediateRooms = parseObjects(intermediateRoomsSection.replace(/Locations:/i, ""), "rooms");
const rooms = [entranceRoom, ...intermediateRooms, climaxRoom];
const encounters = parseObjects(encountersSection || "", "encounters");
const npcs = parseObjects(npcsSection || "", "npcs");
const treasure = parseList(treasureSection || "");
console.log("Rooms:", rooms);
console.log("Encounters:", encounters);
console.log("NPCs:", npcs);
console.log("Treasure:", treasure);
// --- Step 6: Rooms & Encounters ---
const roomsEncountersRaw = await callOllama(
`Using the flavor, hooks, and rumors:
// Step 6: Player Choices and Consequences
const plotResolutionsRaw = await callOllama(
`Based on all of the following elements, suggest 3 possible, non-conflicting story climaxes or plot resolutions for adventurers exploring this location. Each resolution must provide a meaningful choice with a tangible consequence, directly related to the Central Conflict, the Primary Faction, or the NPCs.
Flavor:
${flavor}
Dungeon Elements:
${JSON.stringify({ title, flavor, hooksRumors, rooms, encounters, treasure, npcs, coreConcepts }, null, 2)}
Hooks:
${hooks.join("\n")}
Rumors:
${rumors.join("\n")}
Generate 5 rooms (name + short description) and 3 encounters (name + details).
Output two numbered lists, labeled "Rooms:" and "Encounters:". Plain text only. No extra explanation.`,
undefined, 5, "Step 6: Rooms & Encounters"
Start each item with phrases like "The adventurers could" or "The PCs might". Deepen the narrative texture and allow for roleplay and tactical creativity. Keep each item short (max 2 sentences). Output as a numbered list, plain text only. Absolutely do not use the word "Obsidian" or "obsidian" anywhere in the output.`,
undefined, 5, "Step 6: Plot Resolutions"
);
const [roomsSection, encountersSection] = roomsEncountersRaw.split(/Encounters[:\n]/i);
const rooms = parseObjects(roomsSection.replace(/Rooms[:\n]*/i, ""), "rooms", 120);
const encounters = parseObjects(encountersSection || "", "encounters", 120);
console.log("🔹 Rooms:", rooms);
console.log("🔹 Encounters:", encounters);
const plotResolutions = parseList(plotResolutionsRaw);
console.log("Plot Resolutions:", plotResolutions);
// --- Step 7: Treasure & NPCs ---
const treasureNpcsRaw = await callOllama(
`Based only on these rooms and encounters:
${JSON.stringify({ rooms, encounters }, null, 2)}
Generate 3 treasures and 3 NPCs (name + trait, max 2 sentences each).
Output numbered lists labeled "Treasure:" and "NPCs:". Plain text only, no extra text.`,
undefined, 5, "Step 7: Treasure & NPCs"
);
const [treasureSection, npcsSection] = treasureNpcsRaw.split(/NPCs[:\n]/i);
const treasure = parseList(treasureSection.replace(/Treasure[:\n]*/i, ""), 120);
const npcs = parseObjects(npcsSection || "", "npcs", 120);
console.log("🔹 Treasure:", treasure);
console.log("🔹 NPCs:", npcs);
console.log("\n🎉 Dungeon generation complete!");
return { title, flavor, map: "map.png", hooks, rumors, rooms, encounters, treasure, npcs };
console.log("\nDungeon generation complete!");
return { title, flavor, map: "map.png", hooksRumors, rooms, encounters, treasure, npcs, plotResolutions };
}

View File

@@ -4,36 +4,32 @@ function pickRandom(arr) {
export function dungeonTemplate(data) {
const bodyFonts = [
"'Libre Baskerville', serif",
"'Cardo', serif",
"'Lora', serif",
"'Merriweather', serif",
"'Fraunces', serif",
"'Source Serif 4', serif",
"'Lora', serif"
"'Libre Baskerville', serif",
"'Source Serif 4', serif"
];
const headingFonts = [
"'Cinzel Decorative', cursive",
"'MedievalSharp', cursive",
"'Metamorphous', cursive",
"'Playfair Display', serif",
"'Alegreya Sans SC', sans-serif"
"'New Rocker', system-ui",
"'UnifrakturCook', cursive",
"'IM Fell DW Pica', serif",
"'Cinzel', serif",
"'Cormorant Garamond', serif",
"'Playfair Display', serif"
];
const tableFonts = [
"'Alegreya Sans', sans-serif",
"'Cabin', sans-serif",
"'IBM Plex Sans', sans-serif",
"'Cormorant Garamond', serif",
"'Special Elite', monospace"
"'Cormorant Garamond', serif"
];
const quoteFonts = [
"'Walter Turncoat', cursive",
"'Uncial Antiqua', serif",
"'Beth Ellen', cursive",
"'Pinyon Script', cursive",
"'Dela Gothic One', sans-serif"
"'Playfair Display', serif",
"'Libre Baskerville', serif",
"'Merriweather', serif"
];
const bodyFont = pickRandom(bodyFonts);
@@ -45,103 +41,189 @@ export function dungeonTemplate(data) {
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>${data.title}</title>
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville&family=Lora&family=Cinzel+Decorative&family=MedievalSharp&family=Alegreya+Sans+SC&family=Alegreya+Sans&family=Cabin&family=Walter+Turncoat&display=swap" rel="stylesheet">
<style>
@page { size: A4 landscape; margin: 0; }
<meta charset="UTF-8">
<title>${data.title}</title>
<link
href="https://fonts.googleapis.com/css2?family=Cinzel+Decorative&family=UnifrakturCook&family=New+Rocker&family=Metamorphous&family=Playfair+Display&family=Alegreya+Sans&family=Cabin&family=IBM+Plex+Sans&family=Cormorant+Garamond&family=Lora&family=Merriweather&family=Libre+Baskerville&family=Source+Serif+4&family=Walter+Turncoat&family=Uncial+Antiqua&family=Beth+Ellen&family=Pinyon+Script&display=swap"
rel="stylesheet">
<style>
@page {
size: A4 landscape;
margin: 0;
}
body {
margin: 0; padding: 1cm;
background: #d6c5a3;
margin: 0;
padding: 0;
font-family: ${bodyFont};
color: #2b2118;
font-size: 0.8em;
line-height: 1.3em;
color: #1a1a1a;
font-size: 0.7em;
line-height: 1.25em;
}
.content-page {
height: 100vh;
box-sizing: border-box;
padding: 1.5cm;
page-break-after: always;
overflow: hidden;
break-inside: avoid;
}
h1 {
font-family: ${headingFont};
text-align: center;
text-transform: uppercase;
font-size: 2em;
margin: 0.2em 0 0.3em;
color: #3e1f0e;
border-bottom: 2px solid #3e1f0e;
color: #1a1a1a;
border-bottom: 2px solid #1a1a1a;
padding-bottom: 0.2em;
letter-spacing: 0.1em;
}
.flavor {
text-align: center;
font-style: italic;
font-family: ${quoteFont};
margin: 0.4em 0 1em;
font-size: 0.95em;
margin: 0.4em 0 0.8em;
font-size: 0.9em;
}
.columns {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 0.8cm;
gap: 0.5cm;
align-items: start;
}
.col {
display: flex; flex-direction: column;
gap: 0.4em;
display: flex;
flex-direction: column;
gap: 0.15em;
}
h2 {
font-family: ${headingFont};
font-size: 1em;
font-size: 1.0em;
margin: 0.3em 0 0.1em;
color: #3e1f0e;
border-bottom: 1px solid #3e1f0e;
color: #1a1a1a;
border-bottom: 1px solid #1a1a1a;
padding-bottom: 0.1em;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.map img { max-width: 100%; border: 2px solid #3e1f0e; border-radius: 0.2cm; }
.room h3 { margin: 0.2em 0 0.05em; font-size: 0.95em; font-weight: bold; }
.room p { text-align: justify; word-wrap: break-word; margin: 0.1em 0 0.3em; }
ul { padding-left: 1em; margin: 0.1em 0 0.4em; }
li { margin-bottom: 0.2em; }
table { width: 100%; border-collapse: collapse; font-family: ${tableFont}; font-size: 0.8em; }
th, td { border: 1px solid #3e1f0e; padding: 0.2em; text-align: left; vertical-align: top; }
th { background: #d9c6a5; }
table tr:hover { background: rgba(62,31,14,0.05); }
footer {
text-align: center; font-size: 0.7em; color: #5a4632; margin-top: 0.5em; font-style: italic;
.room h3 {
margin: 0.2em 0 0.05em;
font-size: 0.95em;
font-weight: bold;
}
</style>
.room p {
text-align: justify;
word-wrap: break-word;
margin: 0.1em 0 0.3em;
}
ul {
padding-left: 1em;
margin: 0.1em 0 0.3em;
}
li {
margin-bottom: 0.2em;
}
table {
width: 100%;
border-collapse: collapse;
font-family: ${tableFont};
font-size: 0.8em;
}
th,
td {
border: 1px solid #1a1a1a;
padding: 0.2em;
text-align: left;
vertical-align: top;
}
th {
background: #e0e0e0;
}
table tr:hover {
background: rgba(0, 0, 0, 0.05);
}
.map-page {
height: 210mm;
width: 297mm;
box-sizing: border-box;
padding: 1.5cm;
position: relative;
display: block;
}
.map-image-container {
position: absolute;
top: 1.5cm;
left: 1.5cm;
right: 1.5cm;
bottom: 3cm;
display: flex;
align-items: center;
justify-content: center;
}
.map-page img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
.map-page footer {
position: absolute;
bottom: 1.5cm;
left: 1.5cm;
right: 1.5cm;
text-align: center;
font-size: 0.65em;
color: #555;
font-style: italic;
}
</style>
</head>
<body>
<h1>${data.title}</h1>
<p class="flavor">${data.flavor}</p>
<div class="columns">
<div class="content-page">
<h1>${data.title}</h1>
<p class="flavor">${data.flavor}</p>
<div class="columns">
<div class="col">
<h2>Map</h2>
<div class="map"><img src="file://${data.map}" alt="Dungeon Map"></div>
<h2>Adventure Hooks</h2>
<ul>${data.hooks.map(h => `<li>${h}</li>`).join("")}</ul>
<h2>Rumors</h2>
<ul>${data.rumors.map(r => `<li>${r}</li>`).join("")}</ul>
<h2>Adventure Hooks & Rumors</h2>
<ul>${data.hooksRumors.map(item => `<li>${item}</li>`).join("")}</ul>
<h2>Locations</h2>
${data.rooms.map((room, i) => `<div class="room">
<h3>${i + 1}. ${room.name}</h3>
<p>${room.description}</p>
</div>`).join("")}
</div>
<div class="col">
<h2>Keyed Rooms</h2>
${data.rooms.map((room, i) => `<div class="room"><h3>${i + 1}. ${room.name}</h3><p>${room.description}</p></div>`).join("")}
</div>
<div class="col">
<h2>Encounters</h2>
<table><tr><th>Name</th><th>Details</th></tr>
${data.encounters.map(e => `<tr><td>${e.name}</td><td>${e.details}</td></tr>`).join("")}
<table>
<tr>
<th>Name</th>
<th>Details</th>
</tr>
${data.encounters.map(e => `<tr>
<td>${e.name}</td>
<td>${e.details}</td>
</tr>`).join("")}
</table>
<h2>Treasure</h2>
<ul>${data.treasure.map(t => `<li>${t}</li>`).join("")}</ul>
<ul>${data.treasure.map(t => {
const [name, ...descParts] = t.split(/[-–—:]/);
const description = descParts.join(" ").trim();
return `<li><b>${name.trim()}</b>: ${description}</li>`;
}).join("")}</ul>
</div>
<div class="col">
<h2>NPCs</h2>
<ul>${data.npcs.map(n => `<li><b>${n.name}</b>: ${n.trait}</li>`).join("")}</ul>
<h2>Plot Resolutions</h2>
<ul>${data.plotResolutions.map(p => `<li>${p}</li>`).join("")}</ul>
</div>
</div>
</div>
<div class="map-page">
<div class="map-image-container">
<img src="${data.map}" alt="Dungeon Map">
</div>
<footer>Scrollsmith • © ${new Date().getFullYear()}</footer>
</div>
</div>
<footer>Generated with Scrollsmith • © ${new Date().getFullYear()}</footer>
</body>
</html>
`;

View File

@@ -1,12 +1,20 @@
import puppeteer from "puppeteer";
import { dungeonTemplate } from "./dungeonTemplate.js";
export async function generateDungeonPDF(data, outputPath = "dungeon.pdf") {
import fs from 'fs/promises';
export async function generatePDF(data, outputPath = "dungeon.pdf") {
const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
// Convert image to base64
const imageBuffer = await fs.readFile(data.map);
const base64Image = `data:image/png;base64,${imageBuffer.toString("base64")}`;
data.map = base64Image;
const html = dungeonTemplate(data);
await page.setContent(html, { waitUntil: "networkidle0" });
@@ -15,6 +23,7 @@ export async function generateDungeonPDF(data, outputPath = "dungeon.pdf") {
format: "A4",
landscape: true,
printBackground: true,
preferCSSPageSize: true
});
await browser.close();

249
imageGenerator.js Normal file
View File

@@ -0,0 +1,249 @@
import sharp from 'sharp';
import path from "path";
import { mkdir, writeFile } from "fs/promises";
import { fileURLToPath } from "url";
import { callOllama } from "./ollamaClient.js";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const COMFYUI_URL = process.env.COMFYUI_URL || "http://localhost:8188";
// Drawing style prefix
const STYLE_PREFIX = `clean line art, minimalist sketch, concept art, black and white line drawing, lots of white space, sparse shading, simple black hatching, very low detail`;
const ACCENT_COLORS = ["red", "blue", "yellow", "green", "purple", "orange"];
function selectRandomAccentColor() {
return ACCENT_COLORS[Math.floor(Math.random() * ACCENT_COLORS.length)];
}
async function upscaleImage(inputPath, outputPath, width, height) {
try {
await sharp(inputPath)
.resize(width, height, { kernel: 'lanczos3' })
.blur(0.3)
.sharpen({
sigma: 1,
flat: 1,
jagged: 2,
})
.png({
compressionLevel: 9,
adaptiveFiltering: true,
palette: true
})
.toFile(outputPath);
console.log(`Upscaled + compressed PNG saved: ${outputPath}`);
return outputPath;
} catch (err) {
console.error("Error during upscaling:", err.message);
return null;
}
}
// 1. Generate engineered visual prompt
async function generateVisualPrompt(flavor) {
const rawPrompt = await callOllama(
`You are a prompt engineer specializing in visual prompts for AI image generation. Your goal is to translate fantasy flavor text into a sparse, minimalist scene description.
Your output must be a simple list of visual tags describing only the most essential elements of the scene. Focus on the core subject and mood.
Rules:
- Describe a sparse scene with a single focal point or landscape.
- Use only 3-5 key descriptive phrases or tags.
- The entire output should be very short, 20-50 words maximum.
- Do NOT repeat wording from the input.
- Describe only the visual elements of the image. Focus on colors, shapes, textures, and spatial relationships.
- Exclude any references to style, medium, camera effects, sounds, hypothetical scenarios, or physical sensations.
- Avoid describing fine details; focus on large forms and the overall impression.
- Do NOT include phrases like “an image of” or “a scene showing”.
- Do NOT include the word "Obsidian" or "obsidian" at all.
Input:
${flavor}
Output:`,
"gemma3n:e4b", 3, "Generate Visual Prompt"
);
const accentColor = selectRandomAccentColor();
return `${STYLE_PREFIX}, on white paper, monochrome with a single accent of ${accentColor}, ${rawPrompt.trim().replace(/\n/g, " ")}`;
}
// 2. Save image buffer
async function saveImage(buffer, filename) {
const filepath = path.join(__dirname, filename);
await mkdir(__dirname, { recursive: true });
await writeFile(filepath, buffer);
console.log(`Saved image: ${filepath}`);
return filepath;
}
// 3. Build workflow payload
function buildComfyWorkflow(promptText, negativeText = "") {
return {
"3": {
"inputs": {
"seed": Math.floor(Math.random() * 100000),
"steps": 4,
"cfg": 1,
"sampler_name": "euler",
"scheduler": "simple",
"denoise": 1,
"model": ["4", 0],
"positive": ["6", 0],
"negative": ["7", 0],
"latent_image": ["5", 0]
},
"class_type": "KSampler"
},
"4": {
"inputs": {
"unet_name": "flux1-schnell-fp8.safetensors",
"weight_dtype": "fp8_e4m3fn"
},
"class_type": "UNETLoader"
},
"5": {
"inputs": {
"width": 728,
"height": 512,
"batch_size": 1
},
"class_type": "EmptyLatentImage"
},
"6": {
"inputs": {
"text": promptText,
"clip": ["10", 0]
},
"class_type": "CLIPTextEncode"
},
"7": {
"inputs": {
"text": negativeText,
"clip": ["10", 0]
},
"class_type": "CLIPTextEncode"
},
"10": {
"inputs": {
"clip_name1": "clip_l.safetensors",
"clip_name2": "t5xxl_fp8_e4m3fn.safetensors",
"type": "flux"
},
"class_type": "DualCLIPLoader"
},
"11": {
"inputs": {
"vae_name": "ae.safetensors"
},
"class_type": "VAELoader"
},
"8": {
"inputs": {
"samples": ["3", 0],
"vae": ["11", 0]
},
"class_type": "VAEDecode"
},
"9": {
"inputs": {
"filename_prefix": "ComfyUI_Flux",
"images": ["8", 0]
},
"class_type": "SaveImage"
}
};
}
// 4a. Wait for ComfyUI to finish image generation
async function waitForImage(promptId, timeout = 900000) {
const start = Date.now();
while (Date.now() - start < timeout) {
const res = await fetch(`${COMFYUI_URL}/history`);
const data = await res.json();
const historyEntry = data[promptId];
if (historyEntry?.outputs) {
const images = Object.values(historyEntry.outputs).flatMap(o => o.images || []);
if (images.length > 0) return images.map(i => i.filename);
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
throw new Error("Timed out waiting for ComfyUI image result.");
}
// 4b. Download image from ComfyUI server
async function downloadImage(filename, localFilename) {
const url = `${COMFYUI_URL}/view?filename=${filename}`;
const res = await fetch(url);
if (!res.ok) throw new Error(`Failed to fetch image: ${res.statusText}`);
const buffer = Buffer.from(await res.arrayBuffer());
return await saveImage(buffer, localFilename);
}
// 4c. Submit prompt and handle full image pipeline
async function generateImageViaComfyUI(prompt, filename) {
const negativePrompt = `heavy shading, deep blacks, dark, gritty, shadow-filled, chiaroscuro, scratchy lines, photorealism, hyper-realistic, high detail, 3D render, CGI, polished, smooth shading, detailed textures, noisy, cluttered, blurry, text, logo, signature, watermark, artist name, branding, ugly, deformed, unnatural patterns, perfect curves, repetitive textures`;
const workflow = buildComfyWorkflow(prompt, negativePrompt);
try {
console.log("Submitting prompt to ComfyUI...");
const res = await fetch(`${COMFYUI_URL}/prompt`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ prompt: workflow })
});
if (!res.ok) {
throw new Error(`ComfyUI error: ${res.statusText}`);
}
const { prompt_id } = await res.json();
console.log("Waiting for image result...");
const filenames = await waitForImage(prompt_id);
if (filenames.length === 0) throw new Error("No image generated");
const comfyFilename = filenames[0];
console.log("Downloading image...");
const filepath = await downloadImage(comfyFilename, filename);
return filepath;
} catch (err) {
console.error("Error generating image:", err.message);
return null;
}
}
// 5. Main export
export async function generateDungeonImages({ flavor }) {
console.log("Generating dungeon image...");
const finalPrompt = await generateVisualPrompt(flavor);
console.log("Engineered visual prompt:\n", finalPrompt);
const baseFilename = `dungeon.png`;
const upscaledFilename = `dungeon_upscaled.png`;
const filepath = await generateImageViaComfyUI(finalPrompt, baseFilename);
if (!filepath) {
throw new Error("Failed to generate dungeon image.");
}
// Upscale 2x (half of A4 at 300dpi)
const upscaledPath = await upscaleImage(filepath, upscaledFilename, 1456, 1024);
if (!upscaledPath) {
throw new Error("Failed to upscale dungeon image.");
}
return upscaledPath;
}

View File

@@ -1,6 +1,7 @@
import 'dotenv/config';
import { generateDungeonPDF } from "./generateDungeon.js";
import { generateDungeon } from "./dungeonGenerator.js";
import { generateDungeonImages } from "./imageGenerator.js";
import { generatePDF } from "./generatePDF.js";
// Utility to create a filesystem-safe filename from the dungeon title
function slugify(text) {
@@ -12,17 +13,19 @@ function slugify(text) {
(async () => {
try {
// Generate dungeon JSON from Ollama
// Generate the dungeon data
const dungeonData = await generateDungeon();
// Optional: replace the map placeholder with your local map path
// dungeonData.map = "/absolute/path/to/dungeon-map.png";
// Generate dungeon map image (uses dungeonData.flavor)
const mapPath = await generateDungeonImages(dungeonData);
// Generate a safe filename based on the dungeon's title
dungeonData.map = mapPath;
// Generate PDF filename based on the title
const filename = `${slugify(dungeonData.title)}.pdf`;
// Generate PDF
await generateDungeonPDF(dungeonData, filename);
// Generate the PDF using full dungeon data (including map)
await generatePDF(dungeonData, filename);
console.log(`Dungeon PDF successfully generated: ${filename}`);
} catch (err) {

78
ollamaClient.js Normal file
View File

@@ -0,0 +1,78 @@
const OLLAMA_API_URL = process.env.OLLAMA_API_URL;
const OLLAMA_API_KEY = process.env.OLLAMA_API_KEY;
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// Utility: strip markdown artifacts
function cleanText(str) {
return str
.replace(/^#+\s*/gm, "") // remove headers
.replace(/\*\*(.*?)\*\*/g, "$1") // remove bold
.replace(/[*_`]/g, "") // remove stray formatting
.replace(/\s+/g, " ") // normalize whitespace
.trim();
}
export async function callOllama(prompt, model = "gemma3n:e4b", retries = 5, stepName = "unknown") {
const isUsingOpenWebUI = !!OLLAMA_API_KEY;
for (let attempt = 1; attempt <= retries; attempt++) {
try {
const promptCharCount = prompt.length;
const promptWordCount = prompt.split(/\s+/).length;
console.log(`\n[${stepName}] Sending prompt (attempt ${attempt}/${retries})`);
console.log(`Prompt: ${promptCharCount} chars, ~${promptWordCount} words`);
const headers = { "Content-Type": "application/json" };
if (isUsingOpenWebUI) {
headers["Authorization"] = `Bearer ${OLLAMA_API_KEY}`;
}
const body = isUsingOpenWebUI
? {
model,
messages: [{ role: "user", content: prompt }],
}
: {
model,
messages: [{ role: "user", content: prompt }],
stream: false,
};
const response = await fetch(OLLAMA_API_URL, {
method: "POST",
headers,
body: JSON.stringify(body),
});
if (!response.ok) throw new Error(`Ollama request failed: ${response.status} ${response.statusText}`);
const data = await response.json();
const rawText = isUsingOpenWebUI
? data.choices?.[0]?.message?.content
: data.message?.content;
if (!rawText) throw new Error("No response from Ollama");
const cleaned = cleanText(rawText);
console.log(`[${stepName}] Received: ${rawText.length} chars, ~${rawText.split(/\s+/).length} words`);
// console.log(`Raw output:\n${rawText}\n`);
// console.log(`Cleaned output:\n${cleaned}\n`);
return cleaned;
} catch (err) {
console.warn(`[${stepName}] Attempt ${attempt} failed: ${err.message}`);
if (attempt === retries) throw err;
const delay = 1000 * Math.pow(2, attempt) + Math.random() * 500;
console.log(`Retrying in ${Math.round(delay / 1000)}s...`);
await sleep(delay);
}
}
}

578
package-lock.json generated
View File

@@ -1,16 +1,17 @@
{
"name": "auto-dm",
"name": "scrollsmith",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "auto-dm",
"name": "scrollsmith",
"version": "1.0.0",
"license": "SEE LICENSE IN README.md",
"dependencies": {
"dotenv": "^17.2.1",
"puppeteer": "^24.17.1"
"puppeteer": "^24.17.1",
"sharp": "^0.34.3"
},
"devDependencies": {
"@eslint/js": "^9.34.0",
@@ -41,10 +42,20 @@
"node": ">=6.9.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.5.0.tgz",
"integrity": "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.8.0.tgz",
"integrity": "sha512-MJQFqrZgcW0UNYLGOuQpey/oTN59vyWwplvCGZztn1cKz9agZPPYpJB7h2OMmuu7VLqkvEjN8feFZJmxNF9D+Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -206,33 +217,19 @@
}
},
"node_modules/@humanfs/node": {
"version": "0.16.6",
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz",
"integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==",
"version": "0.16.7",
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz",
"integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@humanfs/core": "^0.19.1",
"@humanwhocodes/retry": "^0.3.0"
"@humanwhocodes/retry": "^0.4.0"
},
"engines": {
"node": ">=18.18.0"
}
},
"node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz",
"integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=18.18"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
@@ -261,6 +258,424 @@
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@img/sharp-darwin-arm64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.3.tgz",
"integrity": "sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-darwin-arm64": "1.2.0"
}
},
"node_modules/@img/sharp-darwin-x64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.3.tgz",
"integrity": "sha512-yHpJYynROAj12TA6qil58hmPmAwxKKC7reUqtGLzsOHfP7/rniNGTL8tjWX6L3CTV4+5P4ypcS7Pp+7OB+8ihA==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-darwin-x64": "1.2.0"
}
},
"node_modules/@img/sharp-libvips-darwin-arm64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.0.tgz",
"integrity": "sha512-sBZmpwmxqwlqG9ueWFXtockhsxefaV6O84BMOrhtg/YqbTaRdqDE7hxraVE3y6gVM4eExmfzW4a8el9ArLeEiQ==",
"cpu": [
"arm64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"darwin"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-darwin-x64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.0.tgz",
"integrity": "sha512-M64XVuL94OgiNHa5/m2YvEQI5q2cl9d/wk0qFTDVXcYzi43lxuiFTftMR1tOnFQovVXNZJ5TURSDK2pNe9Yzqg==",
"cpu": [
"x64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"darwin"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linux-arm": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz",
"integrity": "sha512-mWd2uWvDtL/nvIzThLq3fr2nnGfyr/XMXlq8ZJ9WMR6PXijHlC3ksp0IpuhK6bougvQrchUAfzRLnbsen0Cqvw==",
"cpu": [
"arm"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linux-arm64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.0.tgz",
"integrity": "sha512-RXwd0CgG+uPRX5YYrkzKyalt2OJYRiJQ8ED/fi1tq9WQW2jsQIn0tqrlR5l5dr/rjqq6AHAxURhj2DVjyQWSOA==",
"cpu": [
"arm64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linux-ppc64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.0.tgz",
"integrity": "sha512-Xod/7KaDDHkYu2phxxfeEPXfVXFKx70EAFZ0qyUdOjCcxbjqyJOEUpDe6RIyaunGxT34Anf9ue/wuWOqBW2WcQ==",
"cpu": [
"ppc64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linux-s390x": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.0.tgz",
"integrity": "sha512-eMKfzDxLGT8mnmPJTNMcjfO33fLiTDsrMlUVcp6b96ETbnJmd4uvZxVJSKPQfS+odwfVaGifhsB07J1LynFehw==",
"cpu": [
"s390x"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linux-x64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.0.tgz",
"integrity": "sha512-ZW3FPWIc7K1sH9E3nxIGB3y3dZkpJlMnkk7z5tu1nSkBoCgw2nSRTFHI5pB/3CQaJM0pdzMF3paf9ckKMSE9Tg==",
"cpu": [
"x64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linuxmusl-arm64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.0.tgz",
"integrity": "sha512-UG+LqQJbf5VJ8NWJ5Z3tdIe/HXjuIdo4JeVNADXBFuG7z9zjoegpzzGIyV5zQKi4zaJjnAd2+g2nna8TZvuW9Q==",
"cpu": [
"arm64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-libvips-linuxmusl-x64": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.0.tgz",
"integrity": "sha512-SRYOLR7CXPgNze8akZwjoGBoN1ThNZoqpOgfnOxmWsklTGVfJiGJoC/Lod7aNMGA1jSsKWM1+HRX43OP6p9+6Q==",
"cpu": [
"x64"
],
"license": "LGPL-3.0-or-later",
"optional": true,
"os": [
"linux"
],
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-linux-arm": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.3.tgz",
"integrity": "sha512-oBK9l+h6KBN0i3dC8rYntLiVfW8D8wH+NPNT3O/WBHeW0OQWCjfWksLUaPidsrDKpJgXp3G3/hkmhptAW0I3+A==",
"cpu": [
"arm"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-arm": "1.2.0"
}
},
"node_modules/@img/sharp-linux-arm64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.3.tgz",
"integrity": "sha512-QdrKe3EvQrqwkDrtuTIjI0bu6YEJHTgEeqdzI3uWJOH6G1O8Nl1iEeVYRGdj1h5I21CqxSvQp1Yv7xeU3ZewbA==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-arm64": "1.2.0"
}
},
"node_modules/@img/sharp-linux-ppc64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.3.tgz",
"integrity": "sha512-GLtbLQMCNC5nxuImPR2+RgrviwKwVql28FWZIW1zWruy6zLgA5/x2ZXk3mxj58X/tszVF69KK0Is83V8YgWhLA==",
"cpu": [
"ppc64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-ppc64": "1.2.0"
}
},
"node_modules/@img/sharp-linux-s390x": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.3.tgz",
"integrity": "sha512-3gahT+A6c4cdc2edhsLHmIOXMb17ltffJlxR0aC2VPZfwKoTGZec6u5GrFgdR7ciJSsHT27BD3TIuGcuRT0KmQ==",
"cpu": [
"s390x"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-s390x": "1.2.0"
}
},
"node_modules/@img/sharp-linux-x64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.3.tgz",
"integrity": "sha512-8kYso8d806ypnSq3/Ly0QEw90V5ZoHh10yH0HnrzOCr6DKAPI6QVHvwleqMkVQ0m+fc7EH8ah0BB0QPuWY6zJQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linux-x64": "1.2.0"
}
},
"node_modules/@img/sharp-linuxmusl-arm64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.3.tgz",
"integrity": "sha512-vAjbHDlr4izEiXM1OTggpCcPg9tn4YriK5vAjowJsHwdBIdx0fYRsURkxLG2RLm9gyBq66gwtWI8Gx0/ov+JKQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linuxmusl-arm64": "1.2.0"
}
},
"node_modules/@img/sharp-linuxmusl-x64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.3.tgz",
"integrity": "sha512-gCWUn9547K5bwvOn9l5XGAEjVTTRji4aPTqLzGXHvIr6bIDZKNTA34seMPgM0WmSf+RYBH411VavCejp3PkOeQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-libvips-linuxmusl-x64": "1.2.0"
}
},
"node_modules/@img/sharp-wasm32": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.3.tgz",
"integrity": "sha512-+CyRcpagHMGteySaWos8IbnXcHgfDn7pO2fiC2slJxvNq9gDipYBN42/RagzctVRKgxATmfqOSulgZv5e1RdMg==",
"cpu": [
"wasm32"
],
"license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",
"optional": true,
"dependencies": {
"@emnapi/runtime": "^1.4.4"
},
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-win32-arm64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.3.tgz",
"integrity": "sha512-MjnHPnbqMXNC2UgeLJtX4XqoVHHlZNd+nPt1kRPmj63wURegwBhZlApELdtxM2OIZDRv/DFtLcNhVbd1z8GYXQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0 AND LGPL-3.0-or-later",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-win32-ia32": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.3.tgz",
"integrity": "sha512-xuCdhH44WxuXgOM714hn4amodJMZl3OEvf0GVTm0BEyMeA2to+8HEdRPShH0SLYptJY1uBw+SCFP9WVQi1Q/cw==",
"cpu": [
"ia32"
],
"license": "Apache-2.0 AND LGPL-3.0-or-later",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@img/sharp-win32-x64": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.3.tgz",
"integrity": "sha512-OWwz05d++TxzLEv4VnsTz5CmZ6mI6S05sfQGEMrNrQcOEERbX46332IvE7pO/EUiw7jUrrS40z/M7kPyjfl04g==",
"cpu": [
"x64"
],
"license": "Apache-2.0 AND LGPL-3.0-or-later",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/@puppeteer/browsers": {
"version": "2.10.8",
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.10.8.tgz",
@@ -434,9 +849,9 @@
"optional": true
},
"node_modules/bare-fs": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.2.1.tgz",
"integrity": "sha512-mELROzV0IhqilFgsl1gyp48pnZsaV9xhQapHLDsvn4d4ZTfbFhcghQezl7FTEDNBcGqLUnNI3lUlm6ecrLWdFA==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.2.3.tgz",
"integrity": "sha512-1aGs5pRVLToMQ79elP+7cc0u0s/wXAzfBv/7hDloT7WFggLqECCas5qqPky7WHCFdsBH5WDq6sD4fAoz5sJbtA==",
"license": "Apache-2.0",
"optional": true,
"dependencies": {
@@ -580,6 +995,19 @@
"node": ">=12"
}
},
"node_modules/color": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1",
"color-string": "^1.9.0"
},
"engines": {
"node": ">=12.5.0"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -598,6 +1026,16 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"license": "MIT"
},
"node_modules/color-string": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"license": "MIT",
"dependencies": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -693,6 +1131,15 @@
"node": ">= 14"
}
},
"node_modules/detect-libc": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz",
"integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==",
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/devtools-protocol": {
"version": "0.0.1475386",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1475386.tgz",
@@ -700,9 +1147,9 @@
"license": "BSD-3-Clause"
},
"node_modules/dotenv": {
"version": "17.2.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz",
"integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==",
"version": "17.2.2",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.2.tgz",
"integrity": "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
@@ -1616,9 +2063,9 @@
}
},
"node_modules/puppeteer": {
"version": "24.17.1",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.17.1.tgz",
"integrity": "sha512-KIuX0w+0um4TUbm55yFl2WIsbgjya2BHIgW9ylTuhavtwjXCOM7lMo9oLR1jQnCxrFvm9h/Yeb+zfs4nlgntPg==",
"version": "24.18.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.18.0.tgz",
"integrity": "sha512-Ke8oL/87GhzKIM2Ag6Yj49t5xbGc4rspGIuSuFLFCQBtYzWqCSanvqoCu08WkI78rbqcwnHjxiTH6oDlYFrjrw==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
@@ -1626,7 +2073,7 @@
"chromium-bidi": "8.0.0",
"cosmiconfig": "^9.0.0",
"devtools-protocol": "0.0.1475386",
"puppeteer-core": "24.17.1",
"puppeteer-core": "24.18.0",
"typed-query-selector": "^2.12.0"
},
"bin": {
@@ -1637,9 +2084,9 @@
}
},
"node_modules/puppeteer-core": {
"version": "24.17.1",
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.17.1.tgz",
"integrity": "sha512-Msh/kf9k1XFN0wuKiT4/npMmMWOT7kPBEUw01gWvRoKOOoz3It9TEmWjnt4Gl4eO+p73VMrvR+wfa0dm9rfxjw==",
"version": "24.18.0",
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.18.0.tgz",
"integrity": "sha512-As0BvfXxek2MbV0m7iqBmQKFnfSrzSvTM4zGipjd4cL+9f2Ccgut6RvHlc8+qBieKHqCMFy9BSI4QyveoYXTug==",
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "2.10.8",
@@ -1683,6 +2130,48 @@
"node": ">=10"
}
},
"node_modules/sharp": {
"version": "0.34.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.3.tgz",
"integrity": "sha512-eX2IQ6nFohW4DbvHIOLRB3MHFpYqaqvXd3Tp5e/T/dSH83fxaNJQRvDMhASmkNTsNTVF2/OOopzRCt7xokgPfg==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"color": "^4.2.3",
"detect-libc": "^2.0.4",
"semver": "^7.7.2"
},
"engines": {
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
},
"optionalDependencies": {
"@img/sharp-darwin-arm64": "0.34.3",
"@img/sharp-darwin-x64": "0.34.3",
"@img/sharp-libvips-darwin-arm64": "1.2.0",
"@img/sharp-libvips-darwin-x64": "1.2.0",
"@img/sharp-libvips-linux-arm": "1.2.0",
"@img/sharp-libvips-linux-arm64": "1.2.0",
"@img/sharp-libvips-linux-ppc64": "1.2.0",
"@img/sharp-libvips-linux-s390x": "1.2.0",
"@img/sharp-libvips-linux-x64": "1.2.0",
"@img/sharp-libvips-linuxmusl-arm64": "1.2.0",
"@img/sharp-libvips-linuxmusl-x64": "1.2.0",
"@img/sharp-linux-arm": "0.34.3",
"@img/sharp-linux-arm64": "0.34.3",
"@img/sharp-linux-ppc64": "0.34.3",
"@img/sharp-linux-s390x": "0.34.3",
"@img/sharp-linux-x64": "0.34.3",
"@img/sharp-linuxmusl-arm64": "0.34.3",
"@img/sharp-linuxmusl-x64": "0.34.3",
"@img/sharp-wasm32": "0.34.3",
"@img/sharp-win32-arm64": "0.34.3",
"@img/sharp-win32-ia32": "0.34.3",
"@img/sharp-win32-x64": "0.34.3"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -1706,6 +2195,21 @@
"node": ">=8"
}
},
"node_modules/simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
"license": "MIT",
"dependencies": {
"is-arrayish": "^0.3.1"
}
},
"node_modules/simple-swizzle/node_modules/is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
"license": "MIT"
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",

View File

@@ -1,5 +1,5 @@
{
"name": "auto-dm",
"name": "scrollsmith",
"version": "1.0.0",
"main": "index.js",
"type": "module",
@@ -13,7 +13,8 @@
"description": "",
"dependencies": {
"dotenv": "^17.2.1",
"puppeteer": "^24.17.1"
"puppeteer": "^24.17.1",
"sharp": "^0.34.3"
},
"devDependencies": {
"@eslint/js": "^9.34.0",