@yasaswy.nagavolu/agents 0.26.17 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +9 -0
  2. package/bin/cli.js +26 -9
  3. package/content/hooks/conclusion-scribe/conclusion-scribe.env.example +3 -1
  4. package/content/manifest.json +24 -3
  5. package/content/proxy/grilling_format_gate.py +16 -38
  6. package/content/skills/README.md +4 -0
  7. package/content/skills/graphic-novel-pipeline/SKILL.md +104 -0
  8. package/content/skills/graphic-novel-pipeline/scripts/build_review.py +105 -0
  9. package/content/skills/graphic-novel-pipeline/scripts/compile_prompts.py +356 -0
  10. package/content/skills/graphic-novel-pipeline/scripts/framing.py +74 -0
  11. package/content/skills/graphic-novel-pipeline/scripts/generate_all.py +355 -0
  12. package/content/skills/graphic-novel-pipeline/scripts/generate_art_gemini.py +161 -0
  13. package/content/skills/graphic-novel-pipeline/scripts/generate_art_meshy.py +255 -0
  14. package/content/skills/graphic-novel-pipeline/scripts/gn_common.py +203 -0
  15. package/content/skills/graphic-novel-pipeline/scripts/ledger_template.md +25 -0
  16. package/content/skills/graphic-novel-pipeline/scripts/naming.py +75 -0
  17. package/content/skills/graphic-novel-pipeline/scripts/new_version.py +70 -0
  18. package/content/skills/graphic-novel-pipeline/scripts/notext.py +93 -0
  19. package/content/skills/graphic-novel-pipeline/scripts/pipeline.py +347 -0
  20. package/content/skills/graphic-novel-pipeline/scripts/post_process.py +199 -0
  21. package/content/skills/graphic-novel-pipeline/scripts/sheets.py +266 -0
  22. package/content/skills/graphic-novel-pipeline/scripts/spend_guard.py +174 -0
  23. package/content/skills/graphic-novel-pipeline/scripts/theme.py +215 -0
  24. package/content/skills/graphic-novel-pipeline/templates/continuity.json +65 -0
  25. package/content/skills/graphic-novel-pipeline/templates/project.json +182 -0
  26. package/content/skills/graphic-novel-pipeline/templates/theme.json +65 -0
  27. package/content/skills/graphic-novel-pipeline/tests/_util.py +28 -0
  28. package/content/skills/graphic-novel-pipeline/tests/test_approve.py +86 -0
  29. package/content/skills/graphic-novel-pipeline/tests/test_framing.py +79 -0
  30. package/content/skills/graphic-novel-pipeline/tests/test_mark_flag.py +82 -0
  31. package/content/skills/graphic-novel-pipeline/tests/test_naming.py +126 -0
  32. package/content/skills/graphic-novel-pipeline/tests/test_notext.py +83 -0
  33. package/content/skills/graphic-novel-pipeline/tests/test_panel_refs.py +205 -0
  34. package/content/skills/graphic-novel-pipeline/tests/test_props_world.py +115 -0
  35. package/content/skills/graphic-novel-pipeline/tests/test_quantise.py +74 -0
  36. package/content/skills/graphic-novel-pipeline/tests/test_roles.py +89 -0
  37. package/content/skills/graphic-novel-pipeline/tests/test_sheets.py +189 -0
  38. package/content/skills/graphic-novel-pipeline/tests/test_spend_refs.py +400 -0
  39. package/content/skills/mattpocock-grilling/SKILL.md +3 -3
  40. package/lib/codex-compatibility.json +48 -0
  41. package/lib/codex-global-config.js +270 -0
  42. package/lib/codex-hook-adapter.js +22 -0
  43. package/lib/codex-lifecycle.js +77 -0
  44. package/lib/codex-toml.js +88 -0
  45. package/lib/codex-trust.js +37 -0
  46. package/lib/codex.js +182 -0
  47. package/lib/deployment.js +64 -0
  48. package/lib/discovery.js +28 -0
  49. package/lib/manifest.js +20 -1
  50. package/lib/prepack.js +5 -2
  51. package/lib/shared-instructions.js +167 -0
  52. package/lib/update.js +2 -1
  53. package/package.json +1 -1
package/README.md CHANGED
@@ -3,6 +3,15 @@
3
3
  CLI for installing the yasaswy.nagavolu agent/skill/hook bundle (Claude
4
4
  agents, skills, hooks, and supporting tooling).
5
5
 
6
+ The install, update, uninstall, and doctor commands target Claude Code and
7
+ Codex by default. Codex skills live in `~/.agents/skills`; Codex instructions,
8
+ hooks, agents, MCP servers, and the deployment ledger live under `~/.codex`.
9
+ Use `--runtime claude` or `--runtime codex` to select one runtime. `--codex-dir`
10
+ sets Codex's configuration home (or set `CODEX_HOME`). A custom
11
+ `--target-dir` keeps the legacy Claude-only behavior; use `--runtime both`
12
+ with both `--target-dir` and `--codex-dir` to install into isolated homes.
13
+ Codex reports unsupported Claude-only artifacts in its compatibility report.
14
+
6
15
  `install` opens an interactive checkbox menu of purpose-based bundles when
7
16
  run in a terminal, or installs one bundle non-interactively via
8
17
  `--bundle <key> --yes`. Every installed file's hash is recorded in a ledger
package/bin/cli.js CHANGED
@@ -86,6 +86,11 @@ Usage:
86
86
  agents-cli runner <sub> [flags] Install and manage a self-hosted GitLab CI runner (see "Flags for runner")
87
87
  agents-cli --help Show this help
88
88
 
89
+ Runtime deployment:
90
+ --runtime <both|claude|codex> Default both; explicit --target-dir alone keeps legacy single-Claude behavior
91
+ --codex-dir <path> Override Codex configuration/instructions target; skills go to sibling .agents/skills
92
+ --runtime both with --target-dir requires --codex-dir. Both runtimes are attempted independently.
93
+
89
94
  Flags for install:
90
95
  --bundle <key> Bundle to install non-interactively — run "install" with no flags to list keys
91
96
  --yes Required with --bundle: confirms the non-interactive install
@@ -525,13 +530,13 @@ function fetchLatestVersion(pkgName, { timeoutMs = 1500 } = {}) {
525
530
  });
526
531
  }
527
532
 
528
- async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets, profile }) {
533
+ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets, profile, captureSelection = false }) {
529
534
  const { manifest, manifestPath } = loadManifest(PACKAGE_ROOT);
530
535
  const repoRoot = path.dirname(manifestPath);
531
536
  const candidateBundles = advanced ? advancedMenuBundles(manifest, profile) : basicMenuBundles(manifest, profile);
532
537
  if (!candidateBundles.length) {
533
538
  console.log('No bundles are defined yet.');
534
- return 0;
539
+ return captureSelection ? { exitCode: 0, bundleKeys: [] } : 0;
535
540
  }
536
541
 
537
542
  const rows = candidateBundles.map((b) => describeBundleRow(b, manifest));
@@ -554,11 +559,11 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
554
559
  const selectedKeys = await pickBundles(rows, { details, header, subheader });
555
560
  if (selectedKeys === null) {
556
561
  console.log('Cancelled — nothing installed.');
557
- return 0;
562
+ return captureSelection ? { exitCode: 0, bundleKeys: [] } : 0;
558
563
  }
559
564
  if (selectedKeys.length === 0) {
560
565
  console.log('Nothing selected — nothing installed.');
561
- return 0;
566
+ return captureSelection ? { exitCode: 0, bundleKeys: [] } : 0;
562
567
  }
563
568
 
564
569
  const plan = planSelection(manifest, selectedKeys);
@@ -595,7 +600,7 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
595
600
  try {
596
601
  const result = installOneBundle({ bundleKey: bundle.key, bundleTitle: bundle.title, targetDir, targetConfig, itemPaths });
597
602
  installedBundles.push(bundle);
598
- installedResults.push({ bundle, result });
603
+ installedResults.push({ bundle, result, itemPaths });
599
604
  } catch (err) {
600
605
  if (err instanceof InstallError || err instanceof ManifestError || err instanceof LedgerError || err instanceof WiringError) {
601
606
  console.error(err.message);
@@ -619,10 +624,10 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
619
624
 
620
625
  printFinalSummary({ installed: installedResults, skipped, targetBase: targetDir || defaultTargetBase() });
621
626
 
622
- return 0;
627
+ return captureSelection ? { exitCode: 0, bundleKeys: installedBundles.map(bundle => bundle.key), bundleSelections: installedResults.map(({ bundle, itemPaths }) => ({ bundleKey: bundle.key, ...(itemPaths ? { itemPaths } : {}) })) } : 0;
623
628
  }
624
629
 
625
- async function runInstall(argv) {
630
+ async function runInstall(argv, { captureSelection = false } = {}) {
626
631
  let args;
627
632
  try {
628
633
  args = parseInstallArgs(argv);
@@ -642,6 +647,7 @@ async function runInstall(argv) {
642
647
  targetConfig: args.targetConfig,
643
648
  noSecrets: args.noSecrets,
644
649
  profile: args.profile,
650
+ captureSelection,
645
651
  });
646
652
  }
647
653
 
@@ -1436,8 +1442,19 @@ function runDoctor(argv) {
1436
1442
  }
1437
1443
  }
1438
1444
 
1439
- async function main(argv) {
1445
+ async function main(argv, { captureSelection = false } = {}) {
1440
1446
  const [command, ...rest] = argv;
1447
+ if (['install','update','uninstall','doctor'].includes(command)) {
1448
+ const parsed = require('../lib/deployment').parseDeploymentArgs(rest);
1449
+ if (parsed.runtime !== 'claude') return require('../lib/deployment').runDeployment({command,argv:rest,packageRoot:PACKAGE_ROOT,cliVersion:pkg.version,runPrimary:async args=>{
1450
+ if(!args.includes('--json'))return main([command,...args,'--runtime','claude'],{captureSelection:true});
1451
+ const lines=[],original=console.log;
1452
+ console.log=(...values)=>lines.push(values.map(String).join(' '));
1453
+ try{const primary=await main([command,...args,'--runtime','claude'],{captureSelection:true});const exitCode=typeof primary==='number'?primary:primary.exitCode;const output=lines.join('\n');let result={exitCode};if(typeof primary==='object')result={...primary,...result};try{result.json=JSON.parse(output);}catch{if(output)result.json={output};}return result;}
1454
+ finally{console.log=original;}
1455
+ }});
1456
+ rest.splice(0,rest.length,...parsed.args);
1457
+ }
1441
1458
 
1442
1459
  if (command === '--version' || command === '-v') {
1443
1460
  console.log(pkg.version);
@@ -1450,7 +1467,7 @@ async function main(argv) {
1450
1467
  }
1451
1468
 
1452
1469
  if (command === 'install') {
1453
- return withProjectHookStep(rest, runInstall);
1470
+ return withProjectHookStep(rest, args => runInstall(args, { captureSelection }));
1454
1471
  }
1455
1472
 
1456
1473
  if (command === 'uninstall') {
@@ -6,7 +6,9 @@
6
6
  # NOTE: repos under a scanned root (default C:\dev, override via the
7
7
  # SCRIBE_HOOK_ROOTS env var) auto-discover from their gitlab.com git remote
8
8
  # with zero config -- PROJECT_MAP below is only needed as an override, or as
9
- # a fallback for repos that live outside the scanned root(s):
9
+ # a fallback for repos that live outside the scanned root(s).
10
+ # Hub pattern: a code repo whose issues/PRD live in a workspace hub project maps its
11
+ # short name to the hub slug (e.g. comic_1=comicprez%2Fcomicprez) so notes land there:
10
12
  PROJECT_MAP=my-project=mygroup%2Fmy-repo;other-repo=mygroup%2Fother-repo
11
13
 
12
14
  # GitLab auth — EITHER an inline token OR a path to a .env containing GITLAB_TOKEN=...
@@ -1577,7 +1577,9 @@
1577
1577
  "manager": "uv",
1578
1578
  "locked": true
1579
1579
  },
1580
- "exclude": ["tests/"]
1580
+ "exclude": [
1581
+ "tests/"
1582
+ ]
1581
1583
  },
1582
1584
  {
1583
1585
  "path": "proxy/edit_videos_intent_hook.py",
@@ -1629,7 +1631,9 @@
1629
1631
  "path": "mods/handoff",
1630
1632
  "targetPath": "mods/handoff",
1631
1633
  "kind": "mod",
1632
- "exclude": ["tests/"],
1634
+ "exclude": [
1635
+ "tests/"
1636
+ ],
1633
1637
  "wiring": {
1634
1638
  "env": "CLAUDE_CODE_PLUGIN_DIRS",
1635
1639
  "keybindings": {
@@ -1656,7 +1660,9 @@
1656
1660
  "path": "mods/model-routing",
1657
1661
  "targetPath": "mods/model-routing",
1658
1662
  "kind": "mod",
1659
- "exclude": ["tests/"],
1663
+ "exclude": [
1664
+ "tests/"
1665
+ ],
1660
1666
  "wiring": {
1661
1667
  "env": "CLAUDE_CODE_PLUGIN_DIRS"
1662
1668
  }
@@ -1892,6 +1898,21 @@
1892
1898
  "validationHint": "starts with glpat-; optional, skip if you do not install runners"
1893
1899
  }
1894
1900
  ]
1901
+ },
1902
+ {
1903
+ "key": "self-discovered",
1904
+ "title": "New maintainer artifacts",
1905
+ "summary": "Automatically discovered skills, agents and hook assets",
1906
+ "profile": "self",
1907
+ "advanced": false,
1908
+ "items": [
1909
+ {
1910
+ "path": "skills/graphic-novel-pipeline",
1911
+ "kind": "skill"
1912
+ }
1913
+ ],
1914
+ "deps": [],
1915
+ "secrets": []
1895
1916
  }
1896
1917
  ],
1897
1918
  "internal": [
@@ -3,11 +3,10 @@
3
3
  grilling_format_gate.py — deterministic format enforcement for the
4
4
  mattpocock-grilling skill's Q&A delivery.
5
5
 
6
- mattpocock-grilling's own SKILL.md says to deliver each round's question(s)
7
- via the interactive AskUserQuestion tool, not as prose — but that's advisory
8
- text an LLM can silently drop mid-session (e.g. after a compaction, or once
9
- the novelty of the instruction wears off). This hook is the mechanical
10
- backstop, in three parts driven by `hook_event_name`:
6
+ mattpocock-grilling uses ordinary conversational prose for focused,
7
+ open-ended questions. AskUserQuestion is reserved for genuinely discrete
8
+ multi-choice decisions. This hook prevents prose question walls, in three
9
+ parts driven by `hook_event_name`:
11
10
 
12
11
  1. UserPromptSubmit — if the prompt matches a grill trigger phrase ("grill
13
12
  me", "stress-test", "poke holes", ...), write a session-scoped flag file
@@ -17,10 +16,9 @@ backstop, in three parts driven by `hook_event_name`:
17
16
  skill, write/refresh the same flag. Always allows (no decision emitted).
18
17
  3. Stop — if the flag is active and not expired: look at every assistant
19
18
  message since the last genuine user turn (a real typed prompt, not a
20
- tool_result echoed back with role "user"). If that segment contains an
21
- AskUserQuestion tool_use, the format was followed — allow. If instead the
22
- assistant's final text block ends a line in "?" (a prose question), block
23
- the Stop event and tell the model to re-deliver it through AskUserQuestion.
19
+ tool_result echoed back with role "user"). Allow one focused prose
20
+ question, and block a prose response containing multiple questions so the
21
+ model asks one at a time. Structured AskUserQuestion calls remain allowed.
24
22
  The skill's own completion phrase ("shared understanding") always clears
25
23
  the flag and allows. A block counter caps retries at 3 so a stubborn model
26
24
  can never be trapped in a permanent Stop loop.
@@ -63,10 +61,9 @@ GRILL_PHRASES = (
63
61
  COMPLETION_PHRASE = "shared understanding"
64
62
 
65
63
  BLOCK_REASON = (
66
- "Grilling in progress: deliver this round's question(s) via the "
67
- "AskUserQuestion tool (2-4 concrete options, your recommended pick "
68
- "first and labeled), not as prose. Re-ask the frontier through "
69
- "AskUserQuestion."
64
+ "Grilling in progress: ask one focused question at a time and wait for "
65
+ "the answer. Do not present a question wall. Use AskUserQuestion only "
66
+ "for a genuinely discrete choice with 2-4 concrete options."
70
67
  )
71
68
 
72
69
 
@@ -186,20 +183,6 @@ def _assistant_text(msg: dict) -> str:
186
183
  return ""
187
184
 
188
185
 
189
- def _segment_has_ask_user_question(entries: list, boundary_idx: int) -> bool:
190
- for entry in entries[boundary_idx + 1:]:
191
- msg = entry.get("message") or {}
192
- if msg.get("role") != "assistant":
193
- continue
194
- content = msg.get("content")
195
- if not isinstance(content, list):
196
- continue
197
- for item in content:
198
- if isinstance(item, dict) and item.get("type") == "tool_use" and item.get("name") == "AskUserQuestion":
199
- return True
200
- return False
201
-
202
-
203
186
  def _final_assistant_text(entries: list) -> str:
204
187
  last = ""
205
188
  for entry in entries:
@@ -212,11 +195,8 @@ def _final_assistant_text(entries: list) -> str:
212
195
  return last
213
196
 
214
197
 
215
- def _posed_prose_question(text: str) -> bool:
216
- for line in text.splitlines():
217
- if line.strip().endswith("?"):
218
- return True
219
- return False
198
+ def _prose_question_count(text: str) -> int:
199
+ return text.count("?")
220
200
 
221
201
 
222
202
  def _block(reason: str) -> None:
@@ -251,10 +231,7 @@ def _handle_stop(data: dict) -> None:
251
231
  boundary_idx = idx
252
232
  break
253
233
 
254
- if _segment_has_ask_user_question(entries, boundary_idx):
255
- return # correct format was used -> allow
256
-
257
- final_text = _final_assistant_text(entries)
234
+ final_text = _final_assistant_text(entries[boundary_idx + 1:])
258
235
  if not final_text:
259
236
  return
260
237
 
@@ -262,8 +239,9 @@ def _handle_stop(data: dict) -> None:
262
239
  path.unlink(missing_ok=True)
263
240
  return # grilling session concluded -> never block a completion turn
264
241
 
265
- if not _posed_prose_question(final_text):
266
- return # no question posed at all -> nothing to enforce here
242
+ question_count = _prose_question_count(final_text)
243
+ if question_count < 2:
244
+ return # one focused prose question is conversational grilling
267
245
 
268
246
  blocks = flag.get("blocks", 0)
269
247
  blocks = blocks + 1 if isinstance(blocks, int) else 1
@@ -7,6 +7,7 @@ Global Claude Code skills. Installed to `~/.claude/skills/` — each subdirector
7
7
  | Name | Prompt / Invocation | Type |
8
8
  |------|---------------------|------|
9
9
  | `disk-cleanup` | "clean up the disk space" · "free up disk space" · "C: drive full" · "low on disk space" | Skill |
10
+ | `graphic-novel-pipeline` | `/graphic-novel-pipeline` · "start a new graphic novel" · "plan the panels" · "generate the images" · "graphic novel status" | Skill |
10
11
  | `launch-litellm` | "start litellm" · "litellm is down" · "restart litellm" · "is litellm up" · any council/web-search/visual-check connection failure | Skill |
11
12
  | `low-ram-advisor` | no slash command · started in code by any free-RAM check · "free up RAM" · "what can I close" | Skill |
12
13
  | `make-space` | "make space" · "make-space" · "disk critically low" · "free up space" · "we are out of space" | Skill |
@@ -35,6 +36,9 @@ Non-blocking, suggest-only RAM triage, the memory analogue of `make-space`. Any
35
36
  ### make-space
36
37
  One-call disk reclamation meant to run in a single background subagent so the calling chat only receives a compact JSON report. Thin layer over `disk-cleanup`: deletes only allowlisted regenerable data (package caches, gradle caches, recycle bin, Temp older than 1 day with `Temp\claude` excluded) behind a code-enforced path guard with a hard denylist and `.git` protection; judgment items and removable worktrees are reported, never deleted. `-DryRun` previews; `-RemoveWorktrees` removes only audit-clean worktrees after user approval.
37
38
 
39
+ ### graphic-novel-pipeline
40
+ Repeatable audio/text to graphic-novel pipeline (S0 source to S10 publish) driven by a per-project `project.json` and a single-source `style/continuity.json`. `pipeline.py` dispatches `status | plan | style | compile | generate | curate | layout | export | publish`. Code enforces the rules: `generate_all.py` refuses without approved G0/G1/G2 gates and an explicit spend cap, calls Meshy only (Google is disabled until the founder enables it), spends monthly credits first from a credits ledger, and appends every paid call to a spend log. The look is a swappable theme file of colour roles; `post_process.py` (S6b) quantises, snaps, grains and drains in code with no credits. A `PAUSE` file stops every paid call. `compile_prompts.py` builds prompts from briefs plus continuity data and lints for forbidden terms, unknown characters and missing clothing. The 12 core colour roles can be extended per project with `extra_roles` in continuity; character `props` and `world_facts` enter a prompt only when the panel brief names them; `post.quantise.strength` and `skip_lightness` soften the palette snap. Keys are read through `gn_common.env_value` and never printed. `plan`, `layout`, `export`, `publish` have no generic script yet.
41
+
38
42
  ### launch-litellm
39
43
  Brings the LiteLLM proxy (`127.0.0.1:4000`) up in a **visible** window that survives the
40
44
  calling shell. Never launches the supervisor directly: a process spawned from an agent/CI
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: graphic-novel-pipeline
3
+ description: Run or continue an audio-or-text to graphic-novel pipeline (book arc, chapter plans with a review and feedback loop, swappable theme file with colour roles, image prompts, Meshy generation with spend cap and credits ledger, deterministic post-process, curation, page layout variants, exports for tablet, print, phone and web). Use when the user says "start a new graphic novel", "turn this audio/text into a graphic novel", "plan the book arc", "plan the panels", "review the plan", "record my feedback", "new plan version", "change the theme", "keep the characters and colours consistent", "compile prompts", "generate the images", "post-process the images", "curate the images", "build the pages", "export the novel", "publish checklist", "graphic novel status", "meshy credits", "pause generation", or invokes /graphic-novel-pipeline.
4
+ ---
5
+
6
+ # graphic-novel-pipeline
7
+
8
+ WHAT: one repeatable pipeline per project. Mechanics live in `scripts/`; paths, gates and state
9
+ in the project's `project.json`; invariants in `style/continuity.json`; the look in `style/themes/<id>.json`.
10
+ Project docs: `docs/architecture.md`, `docs/repo-layout.md`, `docs/how-to-use.md`, `docs/style-research.md`.
11
+
12
+ ## Stages
13
+
14
+ ```yaml
15
+ stages:
16
+ S2_concept: {out: concept/}
17
+ S3a_book_arc: {out: plan/book_arc.json, gate: G0}
18
+ S3b_chapter_parts: {out: plan/versions/<novel>_ch<N>_parts.vK.json, gate: G1 per part, chapter, book}
19
+ S4_art_direction: {out: continuity.json + themes/<id>.json, gate: G2 (+ spend cap)}
20
+ S5_compile: {out: prompts/manifest.json + lint}
21
+ S6_generate: {out: art/ch<N>/<id>.png, spend_log, ledger, needs: G0, G2, cap, part approved}
22
+ S6b_post_process: {out: art/_post/<theme>/<realm>/ch<N>/<id>.png, code only, no credits}
23
+ S7_curate: {out: contact sheet, art/panels.json}
24
+ S8a_page_templates: {out: style/templates/}
25
+ S8_layout_variants: {out: pages/<variant>/, fonts and grid, gate: G3}
26
+ S9_export: {out: dist/ (EPUB3 fixed, PDF, CBZ, print PDF, web)}
27
+ S10_publish: {out: checklist, gate: G4}
28
+ ```
29
+
30
+ Layout variants and theme swaps are free to re-render; new model art costs credits.
31
+
32
+ ## Commands
33
+
34
+ Run: `python ~/.claude/skills/graphic-novel-pipeline/scripts/pipeline.py [--root DIR] <command> [args]`
35
+
36
+ | Command | Does | Gate to ask |
37
+ |---|---|---|
38
+ | `status` | Stages, gates, routes, pause, images, credits, spend | none |
39
+ | `plan` | Dispatch writers: concept, book arc, first chapter plan | G0 |
40
+ | `review` | `ledger` new feedback file; `version` next plan vK; `page` review HTML; `approve` record a gate | G1 |
41
+ | `style` | Validate continuity roles and the theme file (`--theme ID`, `--layout`) | G2 |
42
+ | `compile` | Briefs + continuity + theme -> manifest + lint (`--write` saves) | none |
43
+ | `generate` | Manifest -> images; dry run unless `--yes-spend` | G2 (cap) |
44
+ | `post` | S6b: quantise (soft with `strength`), pixel snap, grain, drain, QA (Pillow; no credits) | none |
45
+ | `curate` | Contact sheets, panel manifest, print-dpi check | none |
46
+ | `credits` | Show or set the Meshy credits ledger | none |
47
+ | `pause`, `resume` | Create or delete the `PAUSE` file | none |
48
+ | `layout`, `export`, `publish` | No generic script: dispatch a worker with the project's builders | G3, none, G4 |
49
+
50
+ ## Gates
51
+
52
+ | Gate | Ask the founder | Recorded as |
53
+ |---|---|---|
54
+ | G0 | Do the six chapters tell one story? | `review approve --arc` |
55
+ | G1 | Do this part, then chapter, then book tell it right? | `review approve --part/--chapter/--book` (sheets part: `--part <letter>-ch<N>-preprod`) |
56
+ | G2 | Art direction and theme right? Spend at most N images? | `review approve --art-direction` + `--max-images N` |
57
+ | G3 | Which layout variant and typography? | `stages.S8_layout_variants.gate_status` |
58
+ | G4 | Release checklist complete? | `stages.S10_publish.gate_status` |
59
+
60
+ Route: Meshy only. Google has `enabled: false` and is refused. A credit error stops the run.
61
+
62
+ Spend checks (`spend_guard.py`, before every Meshy call): `spend.cap_credits_run`, `spend.cap_credits_total` (0 = no spend) and `spend.reserve_floor_credits` (dashboard total after the call stays at or above it). Model per image: `--ai-model`, else manifest entry `ai_model`, else `routes.meshy.model`. A manifest entry with `refs` (at most 5: anchor first, then sheets; project-relative paths, URLs or data URIs) is made by Meshy image-to-image. Exit codes: 3 PAUSE, 4 credit guard refused, 5 references rejected, 6 price surprise.
63
+
64
+ ## Hard rules
65
+
66
+ - Never generate without G0, G2, an explicit spend cap and an approved part. `generate_all.py` refuses.
67
+ - Never call a route whose `enabled` flag is false. Never print or log a key (`gn_common.env_value` only).
68
+ - Pause = create `PAUSE`; resume = delete it. Every paid call checks it first (exit 3, no retry). Run paid jobs in the background; never rely on messages to stop a run.
69
+ - Roles, not values: plan and briefs name colour roles (`cloth_a`), never a hex or a style word. Hex and style live only in the theme file. Value order, panel count, grid, text units, identity, shot, placement and realm do not change on a theme swap.
70
+ - The model cannot lock a palette, halftone or pixel grid: do that in S6b code, never in the prompt.
71
+ - Awareness realm = the duty image drained by code (one ink, texture off). The awareness mark is one RGBA silhouette of the protagonist drawn in layout, partly outside the frame, only on panels flagged `awareness_mark: mark`. The prompt never mentions it and no corner is reserved.
72
+ - Text is lettered in layout, never by the image model: one unit, 25 words at most. Naming: with `continuity.naming` = `{policy: roles_only, novels: [], forbidden_names: [...]}` no text unit, brief or compiled prompt holds a personal name or a capitalised cast first name (`compile` and `style` lint it); write a role, a pronoun or direct address. Default policy is `free`. No-text lint (`notext.py`, run by `compile` on every panel and sheet prompt): a quoted string, a `Caption:` / `Thought bubble:` / `Speech:` label, a currency sign, a digit (ratios, degrees and unit counts excepted), a writable-object word (list, bill, label, note, calendar, book ...), a letter tag such as `clothes A`, or a cloud count above the plan's `clouds` is a lint error; describe blank or scribbled surfaces instead, and list a one-off exception in `continuity.notext_allow`.
73
+ - Record every founder comment in a ledger first; change a plan only as a new version; every version carries `book_thesis` and `continuity_facts`.
74
+ - Ask the founder at each gate. Never move or delete project files from this skill. Browsers headless only.
75
+
76
+ ## Schema keys
77
+
78
+ | Key | File | Rule |
79
+ |---|---|---|
80
+ | `extra_roles` | continuity | Role ids beyond the 12 core roles; each ranked in `value_order`; the theme palette must hold every one. `role_sharing` is optional and informational |
81
+ | `characters.<ref>.clothing` | continuity | Always listed in every prompt of the character |
82
+ | `characters.<ref>.props` | continuity | `{item, role}` list; listed only when the panel names the item in `props_in_panel` |
83
+ | `props_in_panel` | panel `characters[]` entry | List of prop items for this panel; an unknown item is a lint error |
84
+ | `world_facts` | continuity, or plan (plan wins) | `id -> {kind: place\|object\|rule, text}`; id is not a character ref or continuity key; text holds no hex or style word |
85
+ | `framing`, `scene_framing` | panel, continuity | `scene_framing` = `{policy: pose_first\|free, sentence, pose_words?, distance_words?}`. Under `pose_first` every panel needs `framing`: one sentence with the pose, place, camera distance and angle; with characters it needs a pose word. Compile opens the scene with `framing` then `sentence` (a scene, not a sheet) |
86
+ | `continuity_refs` | panel | A world fact id here injects its `text`; `continuity_facts` keys may be character refs or world fact ids |
87
+ | `awareness_mark` | panel, continuity, theme | Panel: `none` or `mark`, required; layout only, the prompt is identical; retired `awareness_head*` fields are a lint error. Continuity `awareness_mark` and theme `layout_assets.awareness_mark`: colour role, asset, anchor `top_left` or `top_middle`, `height_frac_of_panel`, `overhang_frac`, `gutter_margin_frac` >= overhang |
88
+ | `cast_sheet_plan.preprod`, `preprod_ch<N>` | plan/cast.json | One block per chapter: `{novel, chapter, anchor, sheet_dir?, units[]}`; each unit `{id, item, cast_id, sheet, views[], ai_model, refs[], layout, person?, props_in_panel?}` compiles to a `kind: sheet` manifest entry (`part_key` `<letter>-ch<N>-preprod`, `out_path` `<art>/<sheet_dir>/<id>.png`, `refs`, `ai_model`); `sheet_dir` is `_sheets` (default) or a folder under it; `refs` are `anchor` or `unit:<id>` of an earlier unit of the same block, at most 5 |
89
+ | `cast_sheet_plan.preprod.panel_refs` | plan/cast.json | `{default_model, models: {model: [panel ids]}, by_cast: {cast id: unit id}, no_sheet: [cast ids], extra: {panel id: [unit ids or `panel:<panel id>`]}, anchor_in_panels?: bool}`; `panel:<id>` is the image of another panel of the chapter (`<art>/ch<N>/<id>.png`), not checked on disk at compile; compile adds `refs` (anchor, then by_cast sheets of the panel's cast, then extras; at most 5) and `ai_model` to each panel; `anchor_in_panels: false` drops the anchor from panels (use it when the anchor is a scene: image-to-image copies its layout) and a panel left with no sheet is a lint error; a cast id in neither `by_cast` nor `no_sheet` is a lint error. `generate` refuses a run (exit 2, no spend) when a local ref is neither on disk nor made by an earlier entry of the run; the dry run reports it |
90
+ | `post.quantise.strength` | theme | 0..1 blend toward the palette snap; default 1 (full snap) |
91
+ | `post.quantise.skip_lightness` | theme | `[lo, hi]` luma % left unsnapped; default null |
92
+
93
+ ## Scripts
94
+
95
+ | File | Purpose |
96
+ |---|---|
97
+ | `pipeline.py`, `gn_common.py`, `theme.py` | Dispatcher, root and keys and ledgers, theme validation and colour maths |
98
+ | `compile_prompts.py`, `sheets.py`, `naming.py`, `framing.py`, `notext.py`, `post_process.py` | Brief to prompt with lint; character sheet entries from the cast file; roles-only naming lint; pose-first scene framing lint; no-text prompt lint; S6b post-process and QA (skips sheets) |
99
+ | `generate_all.py`, `generate_art_meshy.py`, `generate_art_gemini.py` | Gated generation; Meshy and (disabled) Google |
100
+ | `new_version.py`, `build_review.py`, `ledger_template.md` | Plan versions, review page, feedback ledger |
101
+ | `tests/test_*.py` | Plain python, no runner: `python tests/test_roles.py` (also `test_quantise.py`, `test_props_world.py`, `test_mark_flag.py`, `test_naming.py`, `test_sheets.py`, `test_approve.py`, `test_panel_refs.py`, `test_framing.py`) |
102
+
103
+ New project: copy `templates/project.json`, `continuity.json`, `theme.json` into the new root, then
104
+ `status`, `plan`, `review` until a part is approved, `style`, `compile`, `credits`, `generate`, `post`, `curate`.
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env python3
2
+ """Build a static review page for one plan version (no network, no browser).
3
+
4
+ python build_review.py [--root PROJECT_ROOT] --novel novel_b --chapter 1 [--ledger FILE] [--out FILE]
5
+
6
+ Shows: thesis, continuity facts, a "what changed since last version" box, every part and panel
7
+ with its approval state, and the open decisions and feedback rows from the ledger.
8
+ Default output: plan/review/<novel>_ch<N>_v<K>.html.
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import html
14
+ import json
15
+ import sys
16
+ from pathlib import Path
17
+
18
+ import gn_common
19
+
20
+ e = html.escape
21
+
22
+
23
+ def ledger_rows(path: Path) -> list[list[str]]:
24
+ rows = []
25
+ for line in path.read_text(encoding="utf-8").splitlines():
26
+ if line.startswith("| F") or line.startswith("| D"):
27
+ rows.append([c.strip() for c in line.strip().strip("|").split("|")])
28
+ return rows
29
+
30
+
31
+ def text_of(p: dict) -> str:
32
+ t = p.get("text")
33
+ if isinstance(t, list):
34
+ t = t[0] if t else None
35
+ if isinstance(t, dict):
36
+ return f"{t.get('type', '')}: {t.get('words', '')}"
37
+ return p.get("caption", "")
38
+
39
+
40
+ def main() -> int:
41
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
42
+ ap.add_argument("--root")
43
+ ap.add_argument("--novel", required=True)
44
+ ap.add_argument("--chapter", type=int, required=True)
45
+ ap.add_argument("--ledger", help="feedback ledger (relative to root); default is the plan's source_ledger")
46
+ ap.add_argument("--out")
47
+ args = ap.parse_args()
48
+ root = gn_common.set_root(args.root)
49
+ plan_path = gn_common.current_plan(args.novel, args.chapter)
50
+ if plan_path is None:
51
+ gn_common.die(f"no plan found for {args.novel} chapter {args.chapter}", 2)
52
+ data = json.loads(plan_path.read_text(encoding="utf-8"))
53
+ project = gn_common.load_project()
54
+ approvals = project.get("approvals", {})
55
+ version = data.get("version", "draft")
56
+
57
+ ledger_rel = args.ledger or data.get("source_ledger")
58
+ rows = ledger_rows(root / ledger_rel) if ledger_rel and (root / ledger_rel).is_file() else []
59
+
60
+ parts_html = []
61
+ for part in data.get("parts", []):
62
+ key = gn_common.part_key(args.novel, args.chapter, part.get("id"))
63
+ state = approvals.get("parts", {}).get(key, "pending")
64
+ panels = "".join(
65
+ f"<tr><td>{e(str(p.get('id')))}</td><td>{e(p.get('shot', ''))}</td><td>{e(p.get('action', ''))}</td>"
66
+ f"<td>{e(text_of(p))}</td><td>{e(str(p.get('awareness_mark') or ''))}</td>"
67
+ f"<td>{e(str(p.get('saturation', '')))}</td></tr>"
68
+ for p in part.get("panels", [])
69
+ )
70
+ parts_html.append(
71
+ f"<section><h3>{e(str(part.get('id')))}: {e(part.get('title', ''))} <span class=st>{e(state)}</span></h3>"
72
+ f"<p>{e(part.get('intent', ''))}</p><p><b>Takeaway:</b> {e(part.get('takeaway', ''))}</p>"
73
+ f"<table><tr><th>Panel</th><th>Shot</th><th>Action</th><th>Text</th><th>Mark</th><th>Saturation</th></tr>{panels}</table></section>"
74
+ )
75
+
76
+ changes = "".join(f"<li>{e(c)}</li>" for c in data.get("changes_from_previous", [])) or "<li>first version</li>"
77
+ facts = "".join(
78
+ f"<li><b>{e(ref)}</b>: {e('; '.join(items) if isinstance(items, list) else str(items))}</li>"
79
+ for ref, items in (data.get("continuity_facts") or {}).items()
80
+ ) or "<li>none recorded</li>"
81
+ open_rows = "".join(
82
+ "<tr>" + "".join(f"<td>{e(c)}</td>" for c in r) + "</tr>"
83
+ for r in rows if r[0].startswith("D") or (len(r) >= 6 and r[-1].lower() not in ("done", "decided"))
84
+ )
85
+ page = f"""<!doctype html><meta charset=utf-8><title>{e(args.novel)} chapter {args.chapter} plan v{e(str(version))}</title>
86
+ <style>body{{font:16px/1.5 system-ui;background:#0c0e26;color:#e9e9f6;max-width:70rem;margin:2rem auto;padding:0 1rem}}
87
+ section,.box{{background:#161a3d;border:1px solid #2b3068;border-radius:8px;padding:1rem 1.2rem;margin:1rem 0}}
88
+ .changed{{border-color:#ffd98a}}table{{border-collapse:collapse;width:100%}}td,th{{border:1px solid #2b3068;padding:.35rem .5rem;text-align:left;vertical-align:top}}
89
+ .st{{font-size:.8rem;color:#ffd98a;border:1px solid #ffd98a;border-radius:4px;padding:0 .4rem}}</style>
90
+ <h1>{e(args.novel)} chapter {args.chapter}: {e(data.get('title', ''))}, plan version {e(str(version))}</h1>
91
+ <p>File: {e(plan_path.relative_to(root).as_posix())}. Status: {e(str(data.get('status', '')))}. No images are generated until a part is approved.</p>
92
+ <div class=box><b>Book thesis:</b> {e(str(data.get('book_thesis', '')))}</div>
93
+ <div class="box changed"><b>What changed since the last version</b><ul>{changes}</ul></div>
94
+ <div class=box><b>Continuity facts</b><ul>{facts}</ul></div>
95
+ {''.join(parts_html)}
96
+ <div class=box><b>Open decisions and feedback not yet closed</b><table>{open_rows or '<tr><td>none</td></tr>'}</table></div>"""
97
+ out = Path(args.out) if args.out else gn_common.path_of("plan") / "review" / f"{args.novel}_ch{args.chapter}_v{version}.html"
98
+ out.parent.mkdir(parents=True, exist_ok=True)
99
+ out.write_text(page, encoding="utf-8")
100
+ print(f"wrote {out.relative_to(root).as_posix() if out.is_relative_to(root) else out}")
101
+ return 0
102
+
103
+
104
+ if __name__ == "__main__":
105
+ sys.exit(main())