diff --git a/.claude/skills/release-skills/SKILL.md b/.claude/skills/release-skills/SKILL.md index b11a47c..c83bab8 100644 --- a/.claude/skills/release-skills/SKILL.md +++ b/.claude/skills/release-skills/SKILL.md @@ -7,6 +7,16 @@ description: Universal release workflow. Auto-detects version files and changelo Universal release workflow supporting any project type with multi-language changelog. +## User Input Tools + +When this skill prompts the user, follow this tool-selection rule (priority order): + +1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. +2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. +3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. + +Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. + ## Quick Start Just run `/release-skills` - auto-detects your project configuration. diff --git a/CLAUDE.md b/CLAUDE.md index fc0122c..6af7317 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -46,16 +46,32 @@ Execute: `${BUN_X} skills//scripts/main.ts [options]` | Rule | Description | |------|-------------| | **Load project skills first** | Project skills override system/user-level skills with same name | -| **Default image generation** | Use `skills/baoyu-imagine/SKILL.md` unless user specifies otherwise | +| **Default image generation** | Use whatever image backend is available in the current runtime; if multiple are available, ask the user which to use. See `## Image Generation Tools` below. | Priority: project `skills/` → `$HOME/.baoyu-skills/` → system-level. +## Skill Self-Containment + +Each skill under `skills/` (and `.claude/skills/`) is distributed and consumed independently — the folder may be extracted, copied into another project, or loaded without the rest of this repo. Therefore: + +- **Never link from `SKILL.md` or its `references/` to files outside the skill's own directory.** This includes `docs/`, sibling skills, and the repo root. Relative paths like `../../docs/foo.md` break when the skill is used standalone. +- **Inline any shared convention** (e.g., user-input rules, image-generation backend selection) directly in the skill rather than referencing an out-of-skill doc. +- Shared docs under `docs/` exist for **repo-author guidance only** — they may be referenced from `CLAUDE.md` and `docs/creating-skills.md`, but NOT from any `SKILL.md`. This applies to `docs/user-input-tools.md`, `docs/image-generation-tools.md`, `docs/image-generation.md`, and any other `docs/` file. + +## User Input Tools + +Skills that prompt users for choices MUST declare the tool-selection convention **inline** in exactly one place per `SKILL.md` — a `## User Input Tools` section near the top. Do NOT link out to [docs/user-input-tools.md](docs/user-input-tools.md); that doc is the author-side canonical source — copy its body into each SKILL.md. Concrete `AskUserQuestion` mentions elsewhere in a skill are treated as examples — other runtimes substitute their local equivalent under the rule. + +## Image Generation Tools + +Skills that render images MUST declare the backend-selection convention **inline** in exactly one place per `SKILL.md` — a `## Image Generation Tools` section near the top (after `## User Input Tools`). Do NOT link out to [docs/image-generation-tools.md](docs/image-generation-tools.md); that doc is the author-side canonical source — copy its body into each SKILL.md. Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) elsewhere in a skill are treated as examples — other runtimes substitute their local equivalent under the rule. The rule is stateless: use whatever backend is available; if multiple, ask the user once; if none, ask how to proceed. Every rendered image's full prompt must be written to a standalone `prompts/NN-*.md` file before any backend is invoked. Backend skills (`baoyu-imagine`, `baoyu-image-gen`, `baoyu-danger-gemini-web`) are exempt — they render directly rather than selecting a backend. + ## Deprecated Skills | Skill | Note | |-------|------| -| `baoyu-image-gen` | Migrated to `baoyu-imagine`. Do NOT add to `.claude-plugin/marketplace.json`. Do NOT update README for this skill. | -| `baoyu-xhs-images` | Migrated to `baoyu-image-cards`. Do NOT add to `.claude-plugin/marketplace.json`. Do NOT update README for this skill. | +| `baoyu-image-gen` | Superseded by `baoyu-imagine`. Not in `.claude-plugin/marketplace.json`. Kept functional — sync any cross-cutting changes with `baoyu-imagine`. | +| `baoyu-xhs-images` | Superseded by `baoyu-image-cards`. Not in `.claude-plugin/marketplace.json`. Kept functional — sync any cross-cutting changes with `baoyu-image-cards`. Do NOT update README for this skill. | ## Release Process @@ -77,7 +93,9 @@ All skills MUST use `baoyu-` prefix. Details: [docs/creating-skills.md](docs/cre | Topic | File | |-------|------| -| Image generation guidelines | [docs/image-generation.md](docs/image-generation.md) | +| Image generation output guidelines | [docs/image-generation.md](docs/image-generation.md) | +| Image generation backend selection | [docs/image-generation-tools.md](docs/image-generation-tools.md) | +| User input tool convention | [docs/user-input-tools.md](docs/user-input-tools.md) | | Chrome profile platform paths | [docs/chrome-profile.md](docs/chrome-profile.md) | | Comic style maintenance | [docs/comic-style-maintenance.md](docs/comic-style-maintenance.md) | | ClawHub/OpenClaw publishing | [docs/publishing.md](docs/publishing.md) | diff --git a/docs/creating-skills.md b/docs/creating-skills.md index e09d4f8..f1b06ea 100644 --- a/docs/creating-skills.md +++ b/docs/creating-skills.md @@ -127,7 +127,7 @@ test -f "$HOME/.baoyu-skills//EXTEND.md" && echo "user" | Result | Action | |--------|--------| | Found | Read, parse, display summary | -| Not found | Ask user with AskUserQuestion | +| Not found | Ask user via the runtime's user-input tool (see [user-input-tools.md](user-input-tools.md)) | ``` End of SKILL.md should include: @@ -135,3 +135,41 @@ End of SKILL.md should include: ## Extension Support Custom configurations via EXTEND.md. See **Step 1.1** for paths and supported options. ``` + +## User Input Tools Section (Required) + +Every SKILL.md that prompts the user for choices MUST include exactly one `## User Input Tools` section near the top (right after the intro, before the main workflow). The rule must be **inlined** — do NOT link to `docs/user-input-tools.md` (skills are self-contained; see [CLAUDE.md → Skill Self-Containment](../CLAUDE.md)). The author-side canonical reference lives at [user-input-tools.md](user-input-tools.md); copy its body into each new SKILL.md. + +Standard snippet (copy verbatim): + +```markdown +## User Input Tools + +When this skill prompts the user, follow this tool-selection rule (priority order): + +1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. +2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. +3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. + +Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. +``` + +## Image Generation Tools Section (Required for image-gen skills) + +Every SKILL.md that renders images — whether by calling an image-generation API directly or by delegating to another skill — MUST include exactly one `## Image Generation Tools` section near the top (after `## User Input Tools`, before the main workflow). The rule must be **inlined** — do NOT link to `docs/image-generation-tools.md` (skills are self-contained; see [CLAUDE.md → Skill Self-Containment](../CLAUDE.md)). The author-side canonical reference lives at [image-generation-tools.md](image-generation-tools.md); copy its body into each new SKILL.md. + +Standard snippet (copy verbatim): + +```markdown +## Image Generation Tools + +When this skill needs to render an image: + +- **Use whatever image-generation tool or skill is available** in the current runtime — e.g., Codex `imagegen`, Hermes `image_generate`, `baoyu-imagine`, or any equivalent the user has installed. +- **If multiple are available**, ask the user **once** at the start which to use (batch with any other initial questions). +- **If none are available**, tell the user and ask how to proceed. + +**Prompt file requirement (hard)**: write each image's full, final prompt to a standalone file under `prompts/` (naming: `NN-{type}-[slug].md`) BEFORE invoking any backend. The backend receives the prompt file (or its content); the file is the reproducibility record and lets you switch backends without regenerating prompts. + +Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) above are examples — substitute the local equivalents under the same rule. +``` diff --git a/docs/image-generation-tools.md b/docs/image-generation-tools.md new file mode 100644 index 0000000..750a558 --- /dev/null +++ b/docs/image-generation-tools.md @@ -0,0 +1,27 @@ +# Image Generation Tools + +Skills in this repo are loaded by multiple agent runtimes (Claude Code, Codex, Hermes, other agents, bare CLI). Each runtime exposes a different image-generation capability — some have a runtime-native tool (Codex `imagegen`, Hermes `image_generate`), others rely on an installed skill (`baoyu-imagine`, or user-defined). This document defines the canonical **backend-selection rule** every skill that renders images follows so skills stay portable. + +## The Rule + +When a skill needs to render an image: + +- **Use whatever image-generation tool or skill is available** in the current runtime — e.g., Codex `imagegen`, Hermes `image_generate`, `baoyu-imagine`, or any equivalent the user has installed. +- **If multiple are available**, ask the user **once** at the start which to use (batch with any other initial questions). +- **If none are available**, tell the user and ask how to proceed. + +No explicit priority between runtime-native tools and repo skills — treat them equivalently and let the user decide when there's a choice. No persisted preference mechanism; the question is cheap, and the rule is stateless. + +## Prompt File Requirement (hard) + +Regardless of which backend is chosen, every skill that renders images MUST write each image's full, final prompt to a standalone file under `prompts/` (naming: `NN-{type}-[slug].md`) BEFORE invoking any backend. The backend receives the prompt file (or its content); the file is the reproducibility record and allows switching backends without regenerating prompts. + +## How Skills Declare This + +Each `SKILL.md` that renders images includes **exactly one** `## Image Generation Tools` section (near the top, after `## User Input Tools` and before the main workflow) that **inlines** this rule. Skills are self-contained and cannot link to `docs/` — each skill folder must ship the rule inside its own `SKILL.md`. See [CLAUDE.md → Skill Self-Containment](../CLAUDE.md). + +Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) in this document and in SKILL.md are **examples** — agents in other runtimes apply the rule above and substitute the local equivalent. Skill-specific parameters for these backends are illustrative; runtimes without those knobs can omit them. + +## Backend Skills Are Exempt + +Skills that **are themselves** image-generation backends — currently `baoyu-imagine`, `baoyu-image-gen` (deprecated), and `baoyu-danger-gemini-web` — do NOT include a `## Image Generation Tools` section. They render directly via their own provider integrations and have no need to "select a backend." The rule applies only to consumer skills that delegate rendering to whatever backend the runtime exposes. diff --git a/docs/image-generation.md b/docs/image-generation.md index 6ebd58e..91551f2 100644 --- a/docs/image-generation.md +++ b/docs/image-generation.md @@ -1,30 +1,31 @@ # Image Generation Guidelines -Skills that require image generation MUST delegate to available image generation skills. +Skills that require image generation MUST delegate to available image generation tools (runtime-native tools or installed skills). + +**Backend selection convention**: see [image-generation-tools.md](image-generation-tools.md) for the runtime-neutral rule. Short version: use whatever backend is available; if multiple, ask the user once; if none, ask how to proceed. This document covers output conventions (naming, paths) that apply regardless of which backend is selected. ## Skill Selection -**Default**: `skills/baoyu-imagine/SKILL.md` (unless user specifies otherwise). - -1. Read skill's SKILL.md for parameters and capabilities -2. If user requests different skill, check `skills/` for alternatives -3. Only ask user when multiple viable options exist +1. Follow the rule in [image-generation-tools.md](image-generation-tools.md): use whatever backend is available; ask only on ambiguity. +2. Read the chosen backend's documentation for parameters and capabilities. +3. If user requests a specific backend, honor it. ## Generation Flow Template ```markdown ### Step N: Generate Images -**Skill Selection**: -1. Check available skills (`baoyu-imagine` default, or `baoyu-danger-gemini-web`) -2. Read selected skill's SKILL.md for parameters -3. If multiple skills available, ask user to choose +**Backend Selection**: +1. Detect available image-generation tools/skills (runtime-native + installed) +2. If one available → use it. If multiple → ask user once. If none → ask how to proceed. +3. Read the chosen backend's docs for parameters **Generation Flow**: -1. Call skill with prompt, output path, and skill-specific parameters -2. Generate sequentially by default (batch parallel only when user has multiple prompts) -3. Output progress: "Generated X/N" -4. On failure, auto-retry once before reporting error +1. Write the full prompt to `prompts/NN-{type}-[slug].md` BEFORE invoking the backend +2. Call backend with the prompt (or prompt file), output path, and parameters +3. Generate sequentially by default (batch parallel only when backend supports it and user has multiple prompts) +4. Output progress: "Generated X/N" +5. On failure, auto-retry once before reporting error ``` **Batch Parallel** (`baoyu-imagine` only): concurrent workers with per-provider throttling via `batch.max_workers` in EXTEND.md. diff --git a/docs/user-input-tools.md b/docs/user-input-tools.md new file mode 100644 index 0000000..9d3b27b --- /dev/null +++ b/docs/user-input-tools.md @@ -0,0 +1,17 @@ +# User Input Tools + +Skills in this repo are loaded by multiple agent runtimes (Claude Code, other agents, bare CLI). Each runtime exposes a different API for asking the user questions. This document defines the canonical **tool-selection rule** every skill follows so skills stay portable. + +## Tool Selection (priority order) + +1. **Prefer built-in user-input tools** if the current agent runtime exposes one — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. +2. **Fallback to plain text**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. +3. **Batching rule**: + - If the tool supports **multiple questions per call** (e.g., `AskUserQuestion`): **Combine all applicable questions into a single call. Do NOT split into separate calls.** + - If the tool supports **only one question per call** (e.g., single-prompt `clarify`): ask **one question per call, in priority order**. + +## How Skills Declare This + +Each `SKILL.md` that uses interactive user input includes **exactly one** `## User Input Tools` section (typically near the top, right after the intro) that **inlines** this rule. Do NOT link here from a SKILL.md — skills are self-contained (see [CLAUDE.md → Skill Self-Containment](../CLAUDE.md)). This document is the author-side canonical source; copy its body into each SKILL.md. The rule then governs every user-input interaction in that skill and its `references/` files. + +Specific mentions of a concrete tool (e.g., `AskUserQuestion`) elsewhere in a skill are **concrete examples** — agents in other runtimes apply the rule above and substitute the local equivalent. Tool-specific parameters (e.g., `header:`, `multiSelect:`) are illustrative; runtimes without those knobs can omit them. diff --git a/skills/baoyu-article-illustrator/SKILL.md b/skills/baoyu-article-illustrator/SKILL.md index a16dd08..977015f 100644 --- a/skills/baoyu-article-illustrator/SKILL.md +++ b/skills/baoyu-article-illustrator/SKILL.md @@ -11,6 +11,34 @@ metadata: Analyze articles, identify illustration positions, generate images with Type × Style × Palette consistency. +## User Input Tools + +When this skill prompts the user, follow this tool-selection rule (priority order): + +1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. +2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. +3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. + +Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. + +## Image Generation Tools + +When this skill needs to render an image: + +- **Use whatever image-generation tool or skill is available** in the current runtime — e.g., Codex `imagegen`, Hermes `image_generate`, `baoyu-imagine`, or any equivalent the user has installed. +- **If multiple are available**, ask the user **once** at the start which to use (batch with any other initial questions). +- **If none are available**, tell the user and ask how to proceed. + +**Prompt file requirement (hard)**: write each image's full, final prompt to a standalone file under `prompts/` (naming: `NN-{type}-[slug].md`) BEFORE invoking any backend. The backend receives the prompt file (or its content); the file is the reproducibility record and lets you switch backends without regenerating prompts. + +Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) above are examples — substitute the local equivalents under the same rule. + +## Reference Images + +Users may supply reference images via `--ref ` or by providing file paths / pasting images in conversation. Refs guide style, palette, composition, or subject for specific illustrations. + +Full detection, storage, and processing rules are in [references/workflow.md](references/workflow.md) (Step 1.0 saves to `references/NN-ref-{slug}.{ext}`; Step 5.3 processes per-illustration usage `direct | style | palette`). When the chosen backend supports batch input, `direct`-usage entries in each prompt file's `references:` frontmatter should be propagated into its batch payload so backends can pass them through (e.g. `baoyu-imagine` accepts `ref` per task). + ## Three Dimensions | Dimension | Controls | Examples | @@ -53,20 +81,13 @@ See [references/styles.md](references/styles.md) for Core Styles, full gallery, **1.5 Load Preferences (EXTEND.md) ⛔ BLOCKING** -```bash -# macOS, Linux, WSL, Git Bash -test -f .baoyu-skills/baoyu-article-illustrator/EXTEND.md && echo "project" -test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "xdg" -test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "user" -``` +Check EXTEND.md in priority order — the first one found wins: -```powershell -# PowerShell (Windows) -if (Test-Path .baoyu-skills/baoyu-article-illustrator/EXTEND.md) { "project" } -$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" } -if (Test-Path "$xdg/baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "xdg" } -if (Test-Path "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "user" } -``` +| Priority | Path | Scope | +|----------|------|-------| +| 1 | `.baoyu-skills/baoyu-article-illustrator/EXTEND.md` | Project | +| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-article-illustrator/EXTEND.md` | XDG | +| 3 | `$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md` | User home | | Result | Action | |--------|--------| @@ -118,18 +139,18 @@ Full template: [references/workflow.md](references/workflow.md#step-4-generate-o ### Step 5: Generate Images -⛔ **BLOCKING: Prompt files MUST be saved before ANY image generation.** - -**Execution strategy**: When multiple illustrations have saved prompt files and the task is now plain generation, prefer `baoyu-imagine` batch mode (`build-batch.ts` → `--batchfile`) over spawning subagents. Use subagents only when each image still needs separate prompt iteration or creative exploration. +⛔ **BLOCKING: Prompt files MUST be saved before ANY image generation.** This is a hard requirement regardless of which backend is chosen — the prompt file is the reproducibility record. 1. For each illustration, create a prompt file per [references/prompt-construction.md](references/prompt-construction.md) 2. Save to `prompts/NN-{type}-{slug}.md` with YAML frontmatter 3. Prompts **MUST** use type-specific templates with structured sections (ZONES / LABELS / COLORS / STYLE / ASPECT) 4. LABELS **MUST** include article-specific data: actual numbers, terms, metrics, quotes 5. **DO NOT** pass ad-hoc inline prompts to `--prompt` without saving prompt files first -6. Select generation skill, process references (`direct`/`style`/`palette`) -7. Apply watermark if EXTEND.md enabled -8. Generate from saved prompt files; retry once on failure +6. Select the backend via the `## Image Generation Tools` rule at the top: use whatever is available; if multiple, ask the user once. Do this once per session before any generation. +7. **Execution strategy**: When multiple illustrations have saved prompt files and the task is now plain generation, prefer the chosen backend's batch interface (if it offers one) over spawning subagents. Use subagents only when each image still needs separate prompt iteration or creative exploration. If the backend has no batch interface, generate sequentially. +8. Process references (`direct`/`style`/`palette`) per prompt frontmatter +9. Apply watermark if EXTEND.md enabled +10. Generate from saved prompt files; retry once on failure Full procedures: [references/workflow.md](references/workflow.md#step-5-generate-images) diff --git a/skills/baoyu-article-illustrator/references/workflow.md b/skills/baoyu-article-illustrator/references/workflow.md index 6090ee9..b96b8f5 100644 --- a/skills/baoyu-article-illustrator/references/workflow.md +++ b/skills/baoyu-article-illustrator/references/workflow.md @@ -331,7 +331,7 @@ Prompt Files: **DO NOT** pass ad-hoc inline text to `--prompt` without first saving prompt files. The generation command should either use `--promptfiles prompts/NN-{type}-{slug}.md` or read the saved file content for `--prompt`. **Execution choice**: -- If multiple illustrations already have saved prompt files and the task is now plain generation, prefer `baoyu-imagine` batch mode (`build-batch.ts` -> `main.ts --batchfile`) +- If multiple illustrations already have saved prompt files and the task is now plain generation, prefer the chosen backend's batch interface (if it offers one); otherwise generate sequentially - Use subagents only when each illustration still needs separate prompt rewriting, style exploration, or other per-image reasoning before generation **CRITICAL - References in Frontmatter**: diff --git a/skills/baoyu-article-illustrator/scripts/build-batch.test.ts b/skills/baoyu-article-illustrator/scripts/build-batch.test.ts deleted file mode 100644 index 3efe432..0000000 --- a/skills/baoyu-article-illustrator/scripts/build-batch.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -import assert from "node:assert/strict"; -import fs from "node:fs/promises"; -import os from "node:os"; -import path from "node:path"; -import { execFile } from "node:child_process"; -import { promisify } from "node:util"; -import test from "node:test"; - -const execFileAsync = promisify(execFile); -const repoRoot = path.resolve(import.meta.dirname, "..", "..", ".."); -const scriptPath = path.join(repoRoot, "skills", "baoyu-article-illustrator", "scripts", "build-batch.ts"); - -async function makeFixture(): Promise<{ - root: string; - outlinePath: string; - promptsDir: string; - outputPath: string; -}> { - const root = await fs.mkdtemp(path.join(os.tmpdir(), "baoyu-article-illustrator-build-batch-")); - const outlinePath = path.join(root, "outline.md"); - const promptsDir = path.join(root, "prompts"); - const outputPath = path.join(root, "batch.json"); - - await fs.mkdir(promptsDir, { recursive: true }); - await fs.writeFile( - outlinePath, - `## Illustration 1 -**Position**: demo -**Purpose**: demo -**Visual Content**: demo -**Filename**: 01-demo.png -`, - ); - await fs.writeFile(path.join(promptsDir, "01-demo.md"), "A demo prompt\n"); - - return { root, outlinePath, promptsDir, outputPath }; -} - -async function runBuildBatch(args: string[]): Promise { - await execFileAsync(process.execPath, ["--import", "tsx", scriptPath, ...args], { - cwd: repoRoot, - }); -} - -test("build-batch omits default model so baoyu-imagine can resolve env or EXTEND defaults", async () => { - const fixture = await makeFixture(); - - await runBuildBatch([ - "--outline", - fixture.outlinePath, - "--prompts", - fixture.promptsDir, - "--output", - fixture.outputPath, - ]); - - const batch = JSON.parse(await fs.readFile(fixture.outputPath, "utf8")) as { - tasks: Array>; - }; - - assert.equal(batch.tasks.length, 1); - assert.equal(batch.tasks[0]?.provider, "replicate"); - assert.equal(Object.hasOwn(batch.tasks[0]!, "model"), false); -}); - -test("build-batch preserves explicit model overrides", async () => { - const fixture = await makeFixture(); - - await runBuildBatch([ - "--outline", - fixture.outlinePath, - "--prompts", - fixture.promptsDir, - "--output", - fixture.outputPath, - "--model", - "acme/custom-model", - ]); - - const batch = JSON.parse(await fs.readFile(fixture.outputPath, "utf8")) as { - tasks: Array>; - }; - - assert.equal(batch.tasks[0]?.model, "acme/custom-model"); -}); diff --git a/skills/baoyu-comic/SKILL.md b/skills/baoyu-comic/SKILL.md index 10d330e..c525e01 100644 --- a/skills/baoyu-comic/SKILL.md +++ b/skills/baoyu-comic/SKILL.md @@ -15,14 +15,60 @@ metadata: Create original knowledge comics with flexible art style × tone combinations. -## Usage +## User Input Tools -```bash -/baoyu-comic posts/turing-story/source.md -/baoyu-comic article.md --art manga --tone warm -/baoyu-comic # then paste content +When this skill prompts the user, follow this tool-selection rule (priority order): + +1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. +2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. +3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. + +Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. + +## Image Generation Tools + +When this skill needs to render an image: + +- **Use whatever image-generation tool or skill is available** in the current runtime — e.g., Codex `imagegen`, Hermes `image_generate`, `baoyu-imagine`, or any equivalent the user has installed. +- **If multiple are available**, ask the user **once** at the start which to use (batch with any other initial questions). +- **If none are available**, tell the user and ask how to proceed. + +**Prompt file requirement (hard)**: write each image's full, final prompt to a standalone file under `prompts/` (naming: `NN-{type}-[slug].md`) BEFORE invoking any backend. The backend receives the prompt file (or its content); the file is the reproducibility record and lets you switch backends without regenerating prompts. + +Concrete tool names (`imagegen`, `image_generate`, `baoyu-imagine`) above are examples — substitute the local equivalents under the same rule. + +## Reference Images + +Users may supply reference images to guide art style, palette, scene composition, or subject. This is **separate from** the auto-generated character sheet (Step 7.1) — both can coexist: user refs guide the look, the character sheet anchors recurring character identity. + +**Intake**: Accept via `--ref ` or when the user provides file paths / pastes images in conversation. +- File path(s) → copy to `refs/NN-ref-{slug}.{ext}` alongside the comic output +- Pasted image with no path → ask the user for the path (per the User Input Tools rule above), or extract style traits verbally as a text fallback +- No reference → skip this section + +**Usage modes** (per reference): + +| Usage | Effect | +|-------|--------| +| `direct` | Pass the file to the backend as a reference image on every page (or selected pages) | +| `style` | Extract style traits (line treatment, texture, mood) and append to every page's prompt body | +| `palette` | Extract hex colors and append to every page's prompt body | + +**Record in each page's prompt frontmatter** when refs exist: + +```yaml +references: + - ref_id: 01 + filename: 01-ref-scene.png + usage: direct ``` +**At generation time**: +- Verify each referenced file exists on disk +- If `usage: direct` AND the chosen backend accepts multiple reference images → pass both the character sheet (Step 7.2) and the user refs via the backend's ref parameter; compress images first per Step 7.1's guidance to avoid payload failures +- If the backend accepts only one ref → prefer the character sheet for pages with recurring characters; embed user-ref traits in the prompt body instead +- For `style`/`palette` usage → embed extracted traits in every page's prompt text (applies regardless of backend capability) + ## Options ### Visual Dimensions @@ -34,6 +80,7 @@ Create original knowledge comics with flexible art style × tone combinations. | `--layout` | standard (default), cinematic, dense, splash, mixed, webtoon, four-panel | Panel arrangement | | `--aspect` | 3:4 (default, portrait), 4:3 (landscape), 16:9 (widescreen) | Page aspect ratio | | `--lang` | auto (default), zh, en, ja, etc. | Output language | +| `--ref ` | File paths | Reference images applied to every page for style / palette / scene guidance. See [Reference Images](#reference-images) above. | ### Partial Workflow Options @@ -46,72 +93,23 @@ Create original knowledge comics with flexible art style × tone combinations. Details: [references/partial-workflows.md](references/partial-workflows.md) -### Art Styles (画风) +### Art, Tone & Preset Catalogue -| Style | 中文 | Description | -|-------|------|-------------| -| `ligne-claire` | 清线 | Uniform lines, flat colors, European comic tradition (Tintin, Logicomix) | -| `manga` | 日漫 | Large eyes, manga conventions, expressive emotions | -| `realistic` | 写实 | Digital painting, realistic proportions, sophisticated | -| `ink-brush` | 水墨 | Chinese brush strokes, ink wash effects | -| `chalk` | 粉笔 | Chalkboard aesthetic, hand-drawn warmth | -| `minimalist` | 极简 | Clean black line art, limited spot color, stick-figure characters | +- **Art styles** (6): `ligne-claire`, `manga`, `realistic`, `ink-brush`, `chalk`, `minimalist`. Full definitions at `references/art-styles/