scriveno 2.0.5

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 (239) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +222 -0
  3. package/agents/continuity-checker.md +85 -0
  4. package/agents/drafter.md +248 -0
  5. package/agents/plan-checker.md +209 -0
  6. package/agents/researcher.md +114 -0
  7. package/agents/translator.md +204 -0
  8. package/agents/voice-checker.md +154 -0
  9. package/bin/install.js +1620 -0
  10. package/commands/scr/add-note.md +51 -0
  11. package/commands/scr/add-unit.md +101 -0
  12. package/commands/scr/art-direction.md +225 -0
  13. package/commands/scr/autopilot-publish.md +210 -0
  14. package/commands/scr/autopilot-translate.md +237 -0
  15. package/commands/scr/autopilot.md +200 -0
  16. package/commands/scr/back-matter.md +630 -0
  17. package/commands/scr/back-translate.md +197 -0
  18. package/commands/scr/beta-reader.md +97 -0
  19. package/commands/scr/blurb.md +149 -0
  20. package/commands/scr/book-proposal.md +210 -0
  21. package/commands/scr/build-ebook.md +448 -0
  22. package/commands/scr/build-poetry-submission.md +202 -0
  23. package/commands/scr/build-print.md +598 -0
  24. package/commands/scr/build-smashwords.md +171 -0
  25. package/commands/scr/build-world.md +158 -0
  26. package/commands/scr/cast-list.md +104 -0
  27. package/commands/scr/chapter-header.md +158 -0
  28. package/commands/scr/character-arc.md +108 -0
  29. package/commands/scr/character-ref.md +160 -0
  30. package/commands/scr/character-sheet.md +143 -0
  31. package/commands/scr/character-touch.md +157 -0
  32. package/commands/scr/character-voice-sample.md +111 -0
  33. package/commands/scr/check-notes.md +50 -0
  34. package/commands/scr/cleanup.md +159 -0
  35. package/commands/scr/compare.md +112 -0
  36. package/commands/scr/complete-draft.md +49 -0
  37. package/commands/scr/continuity-check.md +129 -0
  38. package/commands/scr/copy-edit.md +118 -0
  39. package/commands/scr/cover-art.md +382 -0
  40. package/commands/scr/cultural-adaptation.md +177 -0
  41. package/commands/scr/demo.md +93 -0
  42. package/commands/scr/dialogue-audit.md +143 -0
  43. package/commands/scr/discuss.md +118 -0
  44. package/commands/scr/discussion-questions.md +129 -0
  45. package/commands/scr/do.md +68 -0
  46. package/commands/scr/draft.md +97 -0
  47. package/commands/scr/editor-review.md +466 -0
  48. package/commands/scr/export.md +942 -0
  49. package/commands/scr/fast.md +65 -0
  50. package/commands/scr/front-matter.md +696 -0
  51. package/commands/scr/health.md +113 -0
  52. package/commands/scr/help.md +121 -0
  53. package/commands/scr/history.md +92 -0
  54. package/commands/scr/illustrate-scene.md +211 -0
  55. package/commands/scr/import.md +95 -0
  56. package/commands/scr/insert-unit.md +108 -0
  57. package/commands/scr/line-edit.md +146 -0
  58. package/commands/scr/manager.md +77 -0
  59. package/commands/scr/manuscript-stats.md +139 -0
  60. package/commands/scr/map-illustration.md +213 -0
  61. package/commands/scr/map-manuscript.md +134 -0
  62. package/commands/scr/merge-units.md +136 -0
  63. package/commands/scr/multi-publish.md +344 -0
  64. package/commands/scr/new-character.md +167 -0
  65. package/commands/scr/new-revision.md +50 -0
  66. package/commands/scr/new-work.md +148 -0
  67. package/commands/scr/next.md +125 -0
  68. package/commands/scr/originality-check.md +170 -0
  69. package/commands/scr/outline.md +131 -0
  70. package/commands/scr/pacing-analysis.md +170 -0
  71. package/commands/scr/panel-layout.md +225 -0
  72. package/commands/scr/pause-work.md +88 -0
  73. package/commands/scr/plan.md +112 -0
  74. package/commands/scr/plant-seed.md +57 -0
  75. package/commands/scr/plot-graph.md +199 -0
  76. package/commands/scr/polish.md +141 -0
  77. package/commands/scr/profile-writer.md +154 -0
  78. package/commands/scr/progress.md +51 -0
  79. package/commands/scr/publish.md +455 -0
  80. package/commands/scr/query-letter.md +183 -0
  81. package/commands/scr/quick-write.md +82 -0
  82. package/commands/scr/relationship-map.md +129 -0
  83. package/commands/scr/remove-unit.md +120 -0
  84. package/commands/scr/reorder-units.md +126 -0
  85. package/commands/scr/resume-work.md +97 -0
  86. package/commands/scr/sacred/annotation-layer.md +105 -0
  87. package/commands/scr/sacred/chronology.md +121 -0
  88. package/commands/scr/sacred/concordance.md +88 -0
  89. package/commands/scr/sacred/cross-reference.md +97 -0
  90. package/commands/scr/sacred/doctrinal-check.md +129 -0
  91. package/commands/scr/sacred/genealogy.md +107 -0
  92. package/commands/scr/sacred/source-tracking.md +101 -0
  93. package/commands/scr/sacred/verse-numbering.md +103 -0
  94. package/commands/scr/sacred-numbering-format.md +103 -0
  95. package/commands/scr/save.md +109 -0
  96. package/commands/scr/scan.md +291 -0
  97. package/commands/scr/sensitivity-review.md +169 -0
  98. package/commands/scr/series-bible.md +127 -0
  99. package/commands/scr/session-report.md +80 -0
  100. package/commands/scr/settings.md +58 -0
  101. package/commands/scr/split-unit.md +123 -0
  102. package/commands/scr/spread-layout.md +187 -0
  103. package/commands/scr/storyboard.md +262 -0
  104. package/commands/scr/subject-touch.md +168 -0
  105. package/commands/scr/submit.md +50 -0
  106. package/commands/scr/subplot-map.md +147 -0
  107. package/commands/scr/sync.md +116 -0
  108. package/commands/scr/synopsis.md +137 -0
  109. package/commands/scr/theme-tracker.md +128 -0
  110. package/commands/scr/thread.md +83 -0
  111. package/commands/scr/timeline.md +141 -0
  112. package/commands/scr/track.md +564 -0
  113. package/commands/scr/translate.md +260 -0
  114. package/commands/scr/translation-glossary.md +298 -0
  115. package/commands/scr/translation-memory.md +310 -0
  116. package/commands/scr/troubleshoot.md +59 -0
  117. package/commands/scr/undo.md +106 -0
  118. package/commands/scr/validate.md +133 -0
  119. package/commands/scr/versions.md +94 -0
  120. package/commands/scr/voice-check.md +133 -0
  121. package/commands/scr/voice-test.md +68 -0
  122. package/data/CONSTRAINTS.json +1606 -0
  123. package/data/demo/.manuscript/BRIEF.md +37 -0
  124. package/data/demo/.manuscript/CHARACTERS.md +90 -0
  125. package/data/demo/.manuscript/OUTLINE.md +46 -0
  126. package/data/demo/.manuscript/PLOT-GRAPH.md +75 -0
  127. package/data/demo/.manuscript/STATE.md +44 -0
  128. package/data/demo/.manuscript/STYLE-GUIDE.md +119 -0
  129. package/data/demo/.manuscript/THEMES.md +51 -0
  130. package/data/demo/.manuscript/WORK.md +51 -0
  131. package/data/demo/.manuscript/config.json +59 -0
  132. package/data/demo/.manuscript/drafts/body/1-the-letter-DRAFT.md +51 -0
  133. package/data/demo/.manuscript/drafts/body/2-the-workshop-DRAFT.md +51 -0
  134. package/data/demo/.manuscript/drafts/body/3-the-pier-DRAFT.md +45 -0
  135. package/data/demo/.manuscript/drafts/body/4-the-clock-DRAFT.md +59 -0
  136. package/data/demo/.manuscript/plans/5-the-reunion-PLAN.md +52 -0
  137. package/data/demo/.manuscript/reviews/2-the-workshop-REVIEW.md +61 -0
  138. package/data/export-templates/scriveno-academic.latex +184 -0
  139. package/data/export-templates/scriveno-acm.latex +67 -0
  140. package/data/export-templates/scriveno-apa7.latex +83 -0
  141. package/data/export-templates/scriveno-book.typst +175 -0
  142. package/data/export-templates/scriveno-chapbook.typst +121 -0
  143. package/data/export-templates/scriveno-elsevier.latex +76 -0
  144. package/data/export-templates/scriveno-epub.css +386 -0
  145. package/data/export-templates/scriveno-fixed-layout-epub.css +76 -0
  146. package/data/export-templates/scriveno-fixed-layout.opf +23 -0
  147. package/data/export-templates/scriveno-ieee.latex +77 -0
  148. package/data/export-templates/scriveno-lncs.latex +79 -0
  149. package/data/export-templates/scriveno-picturebook.typst +113 -0
  150. package/data/export-templates/scriveno-poetry-submission-styles.md +45 -0
  151. package/data/export-templates/scriveno-poetry-submission.docx +0 -0
  152. package/data/export-templates/scriveno-smashwords-styles.md +45 -0
  153. package/data/export-templates/scriveno-smashwords.docx +0 -0
  154. package/data/export-templates/scriveno-stageplay.typst +129 -0
  155. package/data/proof/creative-context/README.md +79 -0
  156. package/data/proof/voice-dna/GUIDED-SAMPLE.md +19 -0
  157. package/data/proof/voice-dna/README.md +45 -0
  158. package/data/proof/voice-dna/STYLE-GUIDE-EXCERPT.md +43 -0
  159. package/data/proof/voice-dna/UNGUIDED-SAMPLE.md +11 -0
  160. package/data/proof/watchmaker-flow/README.md +78 -0
  161. package/docs/architecture.md +425 -0
  162. package/docs/command-reference.md +2384 -0
  163. package/docs/configuration.md +228 -0
  164. package/docs/context-protocol.md +81 -0
  165. package/docs/contributing.md +430 -0
  166. package/docs/creative-context.md +158 -0
  167. package/docs/development.md +152 -0
  168. package/docs/drafter-quality.md +127 -0
  169. package/docs/getting-started.md +198 -0
  170. package/docs/history-protocol.md +96 -0
  171. package/docs/proof-artifacts.md +56 -0
  172. package/docs/publishing.md +296 -0
  173. package/docs/release-notes.md +457 -0
  174. package/docs/runtime-support.md +77 -0
  175. package/docs/sacred-texts.md +296 -0
  176. package/docs/shipped-assets.md +129 -0
  177. package/docs/testing.md +156 -0
  178. package/docs/translation.md +343 -0
  179. package/docs/voice-dna.md +297 -0
  180. package/docs/work-types.md +339 -0
  181. package/lib/architectural-profiles.js +134 -0
  182. package/package.json +54 -0
  183. package/templates/BRIEF.md +51 -0
  184. package/templates/CHARACTERS.md +64 -0
  185. package/templates/CONTEXT.md +56 -0
  186. package/templates/OUTLINE.md +36 -0
  187. package/templates/RECORD.md +68 -0
  188. package/templates/STATE.md +50 -0
  189. package/templates/STYLE-GUIDE.md +121 -0
  190. package/templates/THEMES.md +36 -0
  191. package/templates/WORK.md +67 -0
  192. package/templates/WORLD.md +62 -0
  193. package/templates/WRITING-RULES.md +156 -0
  194. package/templates/academic/ARGUMENT-MAP.md +40 -0
  195. package/templates/academic/CONCEPTS.md +34 -0
  196. package/templates/academic/CONTEXT.md +29 -0
  197. package/templates/academic/PROPOSAL.md +37 -0
  198. package/templates/academic/QUESTIONS.md +24 -0
  199. package/templates/config.json +72 -0
  200. package/templates/pitfalls/comic.md +54 -0
  201. package/templates/pitfalls/commentary.md +62 -0
  202. package/templates/pitfalls/memoir.md +48 -0
  203. package/templates/pitfalls/novel.md +53 -0
  204. package/templates/pitfalls/poetry_collection.md +63 -0
  205. package/templates/pitfalls/research_paper.md +66 -0
  206. package/templates/pitfalls/runbook.md +64 -0
  207. package/templates/pitfalls/screenplay.md +54 -0
  208. package/templates/platforms/README.md +16 -0
  209. package/templates/platforms/apple/manifest.yaml +20 -0
  210. package/templates/platforms/bn/manifest.yaml +20 -0
  211. package/templates/platforms/d2d/manifest.yaml +20 -0
  212. package/templates/platforms/google/manifest.yaml +20 -0
  213. package/templates/platforms/ingram/manifest.yaml +44 -0
  214. package/templates/platforms/kdp/manifest.yaml +42 -0
  215. package/templates/platforms/kobo/manifest.yaml +20 -0
  216. package/templates/platforms/smashwords/manifest.yaml +26 -0
  217. package/templates/sacred/COSMOLOGY.md +88 -0
  218. package/templates/sacred/DOCTRINES.md +45 -0
  219. package/templates/sacred/FIGURES.md +69 -0
  220. package/templates/sacred/FRAMEWORK.md +98 -0
  221. package/templates/sacred/LINEAGES.md +52 -0
  222. package/templates/sacred/README.md +20 -0
  223. package/templates/sacred/THEOLOGICAL-ARC.md +69 -0
  224. package/templates/sacred/catholic/manifest.yaml +93 -0
  225. package/templates/sacred/islamic-hafs/manifest.yaml +134 -0
  226. package/templates/sacred/islamic-warsh/manifest.yaml +134 -0
  227. package/templates/sacred/jewish/manifest.yaml +56 -0
  228. package/templates/sacred/orthodox/manifest.yaml +98 -0
  229. package/templates/sacred/pali/manifest.yaml +20 -0
  230. package/templates/sacred/protestant/manifest.yaml +86 -0
  231. package/templates/sacred/sanskrit/manifest.yaml +20 -0
  232. package/templates/sacred/tewahedo/manifest.yaml +106 -0
  233. package/templates/sacred/tibetan/manifest.yaml +20 -0
  234. package/templates/technical/AUDIENCE.md +26 -0
  235. package/templates/technical/DEPENDENCIES.md +19 -0
  236. package/templates/technical/DOC-BRIEF.md +45 -0
  237. package/templates/technical/PROCEDURES.md +37 -0
  238. package/templates/technical/REFERENCES.md +36 -0
  239. package/templates/technical/SYSTEM.md +25 -0
@@ -0,0 +1,448 @@
1
+ ---
2
+ description: Build a publication-ready EPUB from the manuscript for a target platform.
3
+ argument-hint: "[--platform <platform>] [--fixed-layout] [--skip-validate]"
4
+ ---
5
+
6
+ # /scr:build-ebook -- EPUB Build Pipeline
7
+
8
+ Assemble the manuscript and produce an accessible EPUB for the selected publishing platform. Includes validate gate, scaffold-exclusion, accessibility (EAA-compliant lang tags, alt text, semantic nav), and platform-aware Pandoc invocation.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /scr:build-ebook [--platform <platform>] [--fixed-layout] [--skip-validate]
14
+ ```
15
+
16
+ **Platform values:** `kdp | ingram | apple | bn | d2d | kobo | google | smashwords` (default: kdp)
17
+
18
+ **Flags:**
19
+ `--fixed-layout` Produce a fixed-layout EPUB (for picture books and illustrated books). Uses `data/export-templates/scriveno-fixed-layout-epub.css` and generates an OPF stub. Work type `picture_book` auto-enables this flag.
20
+
21
+ ## Instruction
22
+
23
+ You are a **manuscript build specialist** for EPUB output.
24
+
25
+ ---
26
+
27
+ ### STEP 1: LOAD CONTEXT
28
+
29
+ Load the following project files:
30
+
31
+ - `.manuscript/config.json` -- to get `work_type`, title, author, language, and project settings
32
+ - Scriveno's installed/shared `CONSTRAINTS.json` (global `~/.scriveno/data/CONSTRAINTS.json` or project `.scriveno/data/CONSTRAINTS.json`) -- to check `exports` section for format availability by work type group
33
+
34
+ **Check format availability:**
35
+
36
+ Look up `build_ebook` in `CONSTRAINTS.json` under the `exports` section. Find the current work type's group in `CONSTRAINTS.json` under `work_type_groups`. Check if the group is in the `build_ebook.available` list.
37
+
38
+ Available for: `["prose", "visual", "poetry", "interactive", "sacred"]`
39
+
40
+ If the work type group is **not available**:
41
+ > This command is not available for [work_type] projects. The EPUB build is available for: prose, visual, poetry, interactive, and sacred work types.
42
+
43
+ Then **stop**.
44
+
45
+ **Auto-detect fixed-layout:**
46
+ If `work_type` is `picture_book` and `--fixed-layout` was not passed, treat `--fixed-layout` as enabled automatically.
47
+
48
+ ---
49
+
50
+ ### STEP 1.5: VALIDATE MANUSCRIPT
51
+
52
+ **Check for scaffold markers in `.manuscript/drafts/`.**
53
+
54
+ Scan all `.md` files in `.manuscript/drafts/` for:
55
+ - Lines containing `[Fill in` (covers `[Fill in:]`, `[Fill in or delete:]`)
56
+ - Lines containing `[Delete if not applicable:]`
57
+ - Lines containing `Alternate 1:` or `Alternate 2:`
58
+ - Files with more than one `# ` (top-level H1) heading
59
+
60
+ **Note:** `{{VAR}}` tokens are NOT scaffold markers and must not be flagged. They are writer content placeholders, out of scope for this gate.
61
+
62
+ **If `--skip-validate` was passed:**
63
+
64
+ > **Warning: Validate gate skipped (`--skip-validate`). Your manuscript may contain
65
+ > unresolved scaffold markers. Run `/scr:validate` to check before submitting.**
66
+
67
+ Proceed to STEP 2.
68
+
69
+ **If markers are found** (and `--skip-validate` was not passed):
70
+
71
+ > **Build blocked: unresolved scaffold markers found.**
72
+ >
73
+ > [list each as: `path/to/file.md:LINE_NUMBER: marker text`]
74
+ >
75
+ > **Fix:** Run `/scr:cleanup --apply` to remove scaffold markers, or manually
76
+ > edit the listed files, then re-run this build command.
77
+
78
+ Then **stop** -- do not proceed to STEP 2.
79
+
80
+ If no markers found: proceed to STEP 2.
81
+
82
+ ---
83
+
84
+ ### STEP 1.6: FRONT-MATTER GATE
85
+
86
+ **1.6a -- Scaffold exclusion**
87
+
88
+ Check if `.manuscript/front-matter/` exists.
89
+
90
+ If the directory does not exist:
91
+ > **Note:** No front matter found -- run `/scr:front-matter` first if you want publication front matter included.
92
+
93
+ Proceed to 1.6b.
94
+
95
+ If the directory exists, scan all `.md` files in `.manuscript/front-matter/`. For each file, check the first 10 lines for a YAML block containing `scaffold: true`. Build a scaffold exclusion list of the paths of all files where `scaffold: true` is found.
96
+
97
+ If any files were added to the scaffold exclusion list, note them for the assembly step (STEP 3b) and show:
98
+ > **Note:** [N] scaffold front-matter element(s) will be excluded from this export:
99
+ > - `.manuscript/front-matter/12-preface.md` (scaffold: true -- edit and set scaffold: false to include)
100
+ >
101
+ > To include a scaffold element, open the file and change `scaffold: true` to `scaffold: false`.
102
+
103
+ If no scaffold files were found, show no note.
104
+
105
+ **1.6b -- GENERATE element auto-refresh**
106
+
107
+ If `.manuscript/front-matter/` does not exist, skip auto-refresh and proceed to STEP 2.
108
+
109
+ If `.manuscript/WORK.md` does not exist, skip auto-refresh and proceed to STEP 2.
110
+
111
+ Compare the modification timestamp of `.manuscript/WORK.md` against each of the following GENERATE front-matter files:
112
+ - `.manuscript/front-matter/01-half-title.md`
113
+ - `.manuscript/front-matter/03-title-page.md`
114
+ - `.manuscript/front-matter/04-copyright.md`
115
+ - `.manuscript/front-matter/07-toc.md`
116
+
117
+ To compare timestamps, use the appropriate command for the platform:
118
+ - macOS: `stat -f %m <file>`
119
+ - Linux: `stat -c %Y <file>`
120
+ - Windows: `(Get-Item '<file>').LastWriteTimeUtc.Ticks`
121
+ - If timestamp comparison is not possible, assume WORK.md is newer and regenerate.
122
+
123
+ If WORK.md is newer than ANY of those 4 files, or if ANY of those 4 files do not exist:
124
+ Re-run the GENERATE step from `/scr:front-matter` for elements 1, 3, 4, and 7 only (half-title, title page, copyright page, TOC) using current WORK.md metadata. Regenerate all four even if only one triggered the condition. Do NOT regenerate scaffold elements (5, 6, 11, 12, 13) or any other elements.
125
+
126
+ If WORK.md is not newer than all 4 files and all 4 files exist: skip regeneration silently.
127
+
128
+ Proceed to STEP 2.
129
+
130
+ ---
131
+
132
+ ### STEP 1.7: TRADITION LOADING
133
+
134
+ Read top-level `tradition` from `.manuscript/config.json`. For older projects only, if top-level `tradition` is absent and `sacred.tradition` exists, use `sacred.tradition` as a legacy fallback.
135
+
136
+ If absent or null: skip this step silently and proceed to STEP 1.8.
137
+
138
+ Validate the tradition slug against the accepted list:
139
+ `catholic`, `orthodox`, `tewahedo`, `protestant`, `jewish`, `islamic-hafs`, `islamic-warsh`, `pali`, `tibetan`, `sanskrit`
140
+
141
+ If the value is not in this list:
142
+ > **Unknown tradition "{tradition}". Valid values: catholic, orthodox, tewahedo, protestant, jewish, islamic-hafs, islamic-warsh, pali, tibetan, sanskrit**
143
+
144
+ Then **stop**.
145
+
146
+ If present and valid, load `templates/sacred/{tradition}/manifest.yaml`.
147
+
148
+ Apply tradition data to `.manuscript/output/metadata.yaml` (before STEP 3f writes the file):
149
+ - Set `lang:` to the tradition's primary language tag:
150
+ - `arabic` script -> `ar`
151
+ - `hebrew` script -> `he`
152
+ - `ethiopic` script -> `am` (Amharic, primary Ge'ez liturgical language)
153
+ - `tibetan` script -> `bo`
154
+ - `devanagari` script -> `sa` (Sanskrit)
155
+ - `latin` script -> use the project language from config.json (default `en`)
156
+ - Set `font-family:` to the first entry in the manifest's `font_stack`.
157
+
158
+ If `rtl: true` in the manifest, add `--metadata dir=rtl` to the Pandoc invocation in STEP 4.
159
+
160
+ If `approval_block.required: true` in the manifest, show after the build completes:
161
+ > **Note:** This tradition requires an approval block ("{{approval_block.label}}") before publication. Scope: {{approval_block.scope}}.
162
+
163
+ Proceed to STEP 1.8.
164
+
165
+ ---
166
+
167
+ ### STEP 1.8: VALIDATE PLATFORM
168
+
169
+ **Resolve the platform slug:**
170
+
171
+ - If `--platform` was passed, use that value.
172
+ - If `--platform` was not passed and top-level `platform` is set in `.manuscript/config.json`, use that value.
173
+ - If neither is set, default to `kdp`.
174
+
175
+ **Validate the platform slug:**
176
+
177
+ Check that the slug is one of the following allowed values:
178
+ `kdp`, `ingram`, `apple`, `bn`, `d2d`, `kobo`, `google`, `smashwords`
179
+
180
+ If the platform slug is invalid:
181
+ > **Platform "{slug}" is not recognised.**
182
+ >
183
+ > Valid EPUB platforms: kdp, ingram, apple, bn, d2d, kobo, google, smashwords
184
+ >
185
+ > Example: `/scr:build-ebook --platform kdp`
186
+
187
+ Then **stop**.
188
+
189
+ **Load manifest for selected platform:**
190
+
191
+ Load `templates/platforms/{platform}/manifest.yaml`.
192
+
193
+ If the manifest is missing:
194
+ > **Platform manifest missing: `templates/platforms/{platform}/manifest.yaml`.**
195
+ > Re-install Scriveno or restore the platform profile before building.
196
+
197
+ Then **stop**.
198
+
199
+ Read `label`, `formats_accepted`, `epub_variant`, and `metadata_shape` from the manifest.
200
+
201
+ If `formats_accepted` does not include `epub`:
202
+ > **{PLATFORM} does not accept EPUB output.**
203
+ >
204
+ > Choose a platform whose manifest includes `epub` in `formats_accepted`.
205
+
206
+ Then **stop**.
207
+
208
+ Carry the selected platform label and `epub_variant` forward to the metadata and final report.
209
+
210
+ Proceed to STEP 2.
211
+
212
+ ---
213
+
214
+ ### STEP 2: CHECK PREREQUISITES
215
+
216
+ Check for Pandoc:
217
+
218
+ ```bash
219
+ command -v pandoc >/dev/null 2>&1
220
+ ```
221
+
222
+ If Pandoc is not found:
223
+
224
+ > **Pandoc is required for EPUB build but is not installed.**
225
+ >
226
+ > **Install Pandoc:**
227
+ > - macOS: `brew install pandoc`
228
+ > - Linux: `sudo apt install pandoc`
229
+ > - Windows: `choco install pandoc`
230
+ > - Or download from https://pandoc.org/installing.html
231
+ >
232
+ > After installing, run this build command again.
233
+
234
+ Then **stop** -- do not attempt the build without the required tool.
235
+
236
+ Check for the EPUB stylesheet:
237
+
238
+ If `data/export-templates/scriveno-epub.css` does not exist:
239
+
240
+ > **EPUB stylesheet is missing at `data/export-templates/scriveno-epub.css`.**
241
+ > This file is required for properly styled EPUB output.
242
+ > Re-install Scriveno or restore the file from the repository.
243
+
244
+ Then **stop** -- do not attempt the build without the stylesheet.
245
+
246
+ If `--fixed-layout` was passed (or auto-enabled):
247
+
248
+ If `data/export-templates/scriveno-fixed-layout-epub.css` does not exist:
249
+ > **Fixed-layout EPUB stylesheet is missing at `data/export-templates/scriveno-fixed-layout-epub.css`.**
250
+ > Re-install Scriveno or restore the file from the repository.
251
+
252
+ Then **stop**.
253
+
254
+ If `data/export-templates/scriveno-fixed-layout.opf` does not exist:
255
+ > **Fixed-layout OPF stub is missing at `data/export-templates/scriveno-fixed-layout.opf`.**
256
+ > Re-install Scriveno or restore the file from the repository.
257
+
258
+ Then **stop**.
259
+
260
+ ---
261
+
262
+ ### STEP 3: ASSEMBLE MANUSCRIPT
263
+
264
+ This step builds the complete manuscript from its component files.
265
+
266
+ **3a. Read OUTLINE.md for document order:**
267
+
268
+ Read `.manuscript/OUTLINE.md` and parse the scene/chapter list. Extract the ordered list of body units (scenes, chapters, sections) with their file paths in `.manuscript/drafts/body/`.
269
+
270
+ **3b. Scan front matter:**
271
+
272
+ Read all files in `.manuscript/front-matter/` directory. Sort by numeric prefix to maintain Chicago Manual of Style order:
273
+
274
+ ```
275
+ 01-half-title.md
276
+ 02-series-title.md
277
+ 03-title-page.md
278
+ 04-copyright.md
279
+ ...
280
+ ```
281
+
282
+ **Scaffold exclusion:** Omit any files whose path appears in the scaffold exclusion list from STEP 1.6a. These files have `scaffold: true` in their frontmatter and are not yet ready for publication.
283
+
284
+ If no front matter files exist:
285
+ > **Note:** No front matter found. Consider running `/scr:front-matter` to generate title page, copyright, and other publishing elements.
286
+
287
+ Proceed with body content only.
288
+
289
+ **3c. Read body drafts:**
290
+
291
+ For each unit listed in OUTLINE.md, look for the corresponding draft file in `.manuscript/drafts/body/`. Read in OUTLINE.md order.
292
+
293
+ For any unit listed in OUTLINE.md that has no draft file:
294
+ > **Warning:** Missing draft for "[unit name]" -- skipping. Expected file: `.manuscript/drafts/body/[filename]`
295
+
296
+ **3d. Scan back matter:**
297
+
298
+ Read all files in `.manuscript/back-matter/` directory. Sort alphabetically. If no back matter exists, proceed without -- back matter is optional.
299
+
300
+ **3e. Concatenate and write:**
301
+
302
+ Assemble the full manuscript in this order:
303
+ 1. Front matter files (sorted by numeric prefix)
304
+ 2. Body draft files (ordered by OUTLINE.md)
305
+ 3. Back matter files (sorted alphabetically)
306
+
307
+ Insert `\newpage` page break markers between major sections.
308
+
309
+ Create output directory and write assembled file:
310
+
311
+ ```bash
312
+ mkdir -p .manuscript/output
313
+ ```
314
+
315
+ Write assembled content to `.manuscript/output/assembled-manuscript.md`.
316
+
317
+ **3f. Generate metadata.yaml:**
318
+
319
+ Read `.manuscript/config.json` and `.manuscript/WORK.md` (if it exists) to generate Pandoc metadata:
320
+
321
+ ```yaml
322
+ ---
323
+ title: "[title from config.json]"
324
+ subtitle: "[subtitle if available]"
325
+ author:
326
+ - name: "[author from config.json]"
327
+ lang: "[language from config.json, default en-US]"
328
+ publisher-platform: "[selected platform label]"
329
+ epub-variant: "[epub_variant from platform manifest]"
330
+ rights: "Copyright [year] [author]. All rights reserved."
331
+ date: "[current year]"
332
+ description: "[description if available]"
333
+ ---
334
+ ```
335
+
336
+ Write to `.manuscript/output/metadata.yaml`.
337
+
338
+ ---
339
+
340
+ ### STEP 4: BUILD EPUB
341
+
342
+ **4a -- Accessibility pre-check:**
343
+
344
+ Before invoking Pandoc, verify:
345
+
346
+ - All images referenced in the assembled manuscript have alt text in their Markdown syntax (`![alt text](path)`). For any image missing alt text, add a placeholder: `![Illustration: [describe the image]](path)`.
347
+ - The project language (`lang`) is set -- if absent from config.json, default to `en`.
348
+
349
+ **4b -- Pandoc invocation:**
350
+
351
+ **If `--fixed-layout` is enabled:**
352
+
353
+ First, copy the OPF stub for reference:
354
+ ```bash
355
+ cp data/export-templates/scriveno-fixed-layout.opf .manuscript/output/fixed-layout.opf
356
+ ```
357
+
358
+ Invoke Pandoc with the fixed-layout stylesheet:
359
+ ```bash
360
+ pandoc .manuscript/output/assembled-manuscript.md \
361
+ -o .manuscript/output/ebook-fixed-layout.epub \
362
+ --metadata-file=.manuscript/output/metadata.yaml \
363
+ --epub-cover-image=.manuscript/build/ebook-cover.jpg \
364
+ --css=data/export-templates/scriveno-fixed-layout-epub.css \
365
+ --toc \
366
+ --toc-depth=2 \
367
+ --split-level=0
368
+ ```
369
+
370
+ Note: `--split-level=0` keeps facing pages together as single spine items.
371
+
372
+ After build, show:
373
+ > **Note:** Fixed-layout EPUB generated. Merge the OPF metadata from `.manuscript/output/fixed-layout.opf` into the EPUB's `package.opf` before submitting to Apple Books.
374
+
375
+ Then proceed to STEP 5 (skip the standard Pandoc invocation below).
376
+
377
+ **If `--fixed-layout` is NOT enabled:** use the standard Pandoc invocation:
378
+
379
+ ```bash
380
+ pandoc .manuscript/output/assembled-manuscript.md \
381
+ -o .manuscript/output/ebook.epub \
382
+ --metadata-file=.manuscript/output/metadata.yaml \
383
+ --epub-cover-image=.manuscript/build/ebook-cover.jpg \
384
+ --css=data/export-templates/scriveno-epub.css \
385
+ --toc \
386
+ --toc-depth=2 \
387
+ --split-level=1
388
+ ```
389
+
390
+ If `.manuscript/build/ebook-cover.jpg` does not exist, check `.manuscript/build/ebook-cover.png`. If neither exists, omit the `--epub-cover-image` flag and note:
391
+ > **Note:** No ebook cover found at `.manuscript/build/ebook-cover.jpg` or `.png`. EPUB will be generated without a cover. To add a cover, place your front-cover-only RGB file at `.manuscript/build/ebook-cover.jpg` (or `.png`) and re-run this build command.
392
+
393
+ **4c -- Semantic nav note:**
394
+
395
+ The `--toc` flag causes Pandoc to emit an `epub:type="toc"` nav document (EPUB3 semantic navigation). This satisfies EU EAA June 2025 requirement for machine-readable navigation.
396
+
397
+ ---
398
+
399
+ ### STEP 5: REPORT
400
+
401
+ If `--fixed-layout` is active:
402
+
403
+ Show:
404
+ ```
405
+ OK EPUB built -> .manuscript/output/ebook-fixed-layout.epub ({file_size})
406
+ Platform: {selected platform label}
407
+ ```
408
+
409
+ Get file size with:
410
+ ```bash
411
+ ls -lh .manuscript/output/ebook-fixed-layout.epub | awk '{print $5}'
412
+ ```
413
+
414
+ Otherwise:
415
+
416
+ Show:
417
+ ```
418
+ OK EPUB built -> .manuscript/output/ebook.epub ({file_size})
419
+ Platform: {selected platform label}
420
+ ```
421
+
422
+ Get file size with:
423
+ ```bash
424
+ ls -lh .manuscript/output/ebook.epub | awk '{print $5}'
425
+ ```
426
+
427
+ ## Response Contract
428
+
429
+ Every writer-facing response must end with one to four next-command suggestions. Each suggestion must include a short explanation of what that path will do.
430
+
431
+ Use this format:
432
+
433
+ ```markdown
434
+ Next commands:
435
+ - `/scr:...`: One short sentence explaining what this path will do.
436
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
437
+ ```
438
+
439
+ If exactly one path is clearly best, provide one suggestion. If two, three, or four useful paths exist, show them as alternatives. Do not force a linear path when the writer has a real choice.
440
+
441
+ If the writer seems unsure or no specific next command is obvious, include this default option:
442
+
443
+ ```markdown
444
+ Next commands:
445
+ - `/scr:next`: Inspect the project state and choose the right next step.
446
+ ```
447
+
448
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.
@@ -0,0 +1,202 @@
1
+ ---
2
+ description: Build a poetry submission manuscript DOCX with one poem per page, title page, and TOC.
3
+ argument-hint: "[--skip-validate]"
4
+ ---
5
+
6
+ # /scr:build-poetry-submission -- Poetry Submission DOCX Build Pipeline
7
+
8
+ Assemble the manuscript and produce a submission-ready DOCX: one poem per page, 12pt Times New Roman or Garamond, title page (title + author + contact info), and auto-generated table of contents. Follows conventions from leading literary journals and the Academy of American Poets contest guidelines.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /scr:build-poetry-submission [--skip-validate]
14
+ ```
15
+
16
+ **Flags:**
17
+ `--skip-validate` Skip the scaffold marker pre-flight check (not recommended).
18
+
19
+ ## Instruction
20
+
21
+ You are a **manuscript build specialist** for poetry submission DOCX output.
22
+
23
+ ---
24
+
25
+ ### STEP 1: LOAD CONTEXT
26
+
27
+ Load the following project files:
28
+
29
+ - `.manuscript/config.json` -- to get `work_type`, title, author, language, contact info
30
+ - Scriveno's installed/shared `CONSTRAINTS.json` -- to check `commands.build-poetry-submission.available` list: `["poetry"]`
31
+
32
+ If work type group is not in the available list:
33
+ > This command is available for poetry work types only (poetry_collection, single_poem, song_lyric). Prose writers should use `/scr:build-print` or `/scr:build-smashwords` instead.
34
+
35
+ Then **stop**.
36
+
37
+ ---
38
+
39
+ ### STEP 1.5: VALIDATE MANUSCRIPT
40
+
41
+ **Check for scaffold markers in `.manuscript/drafts/`.**
42
+
43
+ Scan all `.md` files for `[Fill in`, `[Delete if not applicable:]`, `Alternate 1:`, `Alternate 2:`, and multiple `# ` H1 headings.
44
+
45
+ **If `--skip-validate` was passed:**
46
+ > **Warning: Validate gate skipped (`--skip-validate`).**
47
+
48
+ Proceed to STEP 2.
49
+
50
+ **If markers are found:**
51
+ > **Build blocked: unresolved scaffold markers found.**
52
+ > [list each as: `path/to/file.md:LINE_NUMBER: marker text`]
53
+ > **Fix:** Run `/scr:cleanup --apply`, then re-run.
54
+
55
+ Then **stop**.
56
+
57
+ ---
58
+
59
+ ### STEP 2: CHECK PREREQUISITES
60
+
61
+ Check for Pandoc:
62
+ ```bash
63
+ command -v pandoc >/dev/null 2>&1
64
+ ```
65
+
66
+ If not found:
67
+ > **Pandoc is required for poetry submission DOCX build but is not installed.**
68
+ > - macOS: `brew install pandoc`
69
+ > - Linux: `sudo apt install pandoc`
70
+ > - Windows: `choco install pandoc`
71
+
72
+ Then **stop**.
73
+
74
+ Check that the reference document exists:
75
+
76
+ If `data/export-templates/scriveno-poetry-submission.docx` does not exist:
77
+ > **Poetry submission reference document missing at `data/export-templates/scriveno-poetry-submission.docx`.**
78
+ > Re-install Scriveno or restore the file from the repository.
79
+
80
+ Then **stop**.
81
+
82
+ ---
83
+
84
+ ### STEP 3: ASSEMBLE MANUSCRIPT
85
+
86
+ **3a. Generate title page:**
87
+
88
+ Read from `.manuscript/config.json`: `title`, `author`, contact fields (`email`, `address`, `phone` if present).
89
+
90
+ Write `.manuscript/output/poetry-title-page.md`:
91
+
92
+ ```markdown
93
+ # [TITLE]
94
+
95
+ [Author Name]
96
+
97
+ [Email] | [Address] | [Phone]
98
+
99
+ [N poems] | approx. [word_count] words
100
+
101
+ \newpage
102
+ ```
103
+
104
+ (This title page will be prepended before the body content.)
105
+
106
+ **3b. Assemble body with per-poem page breaks:**
107
+
108
+ Read `.manuscript/OUTLINE.md`. For each poem unit in order:
109
+ - Read the corresponding `.manuscript/drafts/body/[poem-file]-DRAFT.md`
110
+ - Append `\newpage` after each poem's content
111
+
112
+ This ensures one poem per page in the output DOCX.
113
+
114
+ **3c. Concatenate:**
115
+
116
+ Full assembly order:
117
+ 1. Poetry title page (`poetry-title-page.md`)
118
+ 2. Body poems in OUTLINE.md order, each followed by `\newpage`
119
+
120
+ Write to `.manuscript/output/assembled-poetry.md`.
121
+
122
+ **3d. Generate metadata.yaml:**
123
+
124
+ ```yaml
125
+ ---
126
+ title: "[title from config.json]"
127
+ author:
128
+ - name: "[author from config.json]"
129
+ lang: "[language from config.json, default en]"
130
+ ---
131
+ ```
132
+
133
+ Write to `.manuscript/output/poetry-metadata.yaml`.
134
+
135
+ ---
136
+
137
+ ### STEP 4: BUILD POETRY SUBMISSION DOCX
138
+
139
+ Count the number of poem units parsed from OUTLINE.md in STEP 3b. Per the `scriveno-poetry-submission-styles.md` style guide, a TOC is required for collections of 5 or more poems only.
140
+
141
+ If poem count >= 5, include `--toc --toc-depth=2`:
142
+
143
+ ```bash
144
+ pandoc .manuscript/output/assembled-poetry.md \
145
+ -o .manuscript/output/poetry-submission.docx \
146
+ --reference-doc=data/export-templates/scriveno-poetry-submission.docx \
147
+ --metadata-file=.manuscript/output/poetry-metadata.yaml \
148
+ --toc \
149
+ --toc-depth=2
150
+ ```
151
+
152
+ If poem count < 5, omit `--toc` and `--toc-depth`:
153
+
154
+ ```bash
155
+ pandoc .manuscript/output/assembled-poetry.md \
156
+ -o .manuscript/output/poetry-submission.docx \
157
+ --reference-doc=data/export-templates/scriveno-poetry-submission.docx \
158
+ --metadata-file=.manuscript/output/poetry-metadata.yaml
159
+ ```
160
+
161
+ **Format applied by reference doc:**
162
+ - 12pt Times New Roman body text (Normal style)
163
+ - 1-inch margins all sides
164
+ - Single-spaced within poems; blank line between stanzas
165
+ - Auto-generated TOC field (poem titles become TOC entries via Heading 2 style) -- only emitted for collections of 5+ poems
166
+
167
+ ---
168
+
169
+ ### STEP 5: REPORT
170
+
171
+ Show:
172
+ ```
173
+ OK Poetry submission DOCX built -> .manuscript/output/poetry-submission.docx ({file_size})
174
+ ```
175
+
176
+ Get file size with:
177
+ ```bash
178
+ ls -lh .manuscript/output/poetry-submission.docx | awk '{print $5}'
179
+ ```
180
+
181
+ ## Response Contract
182
+
183
+ Every writer-facing response must end with one to four next-command suggestions. Each suggestion must include a short explanation of what that path will do.
184
+
185
+ Use this format:
186
+
187
+ ```markdown
188
+ Next commands:
189
+ - `/scr:...`: One short sentence explaining what this path will do.
190
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
191
+ ```
192
+
193
+ If exactly one path is clearly best, provide one suggestion. If two, three, or four useful paths exist, show them as alternatives. Do not force a linear path when the writer has a real choice.
194
+
195
+ If the writer seems unsure or no specific next command is obvious, include this default option:
196
+
197
+ ```markdown
198
+ Next commands:
199
+ - `/scr:next`: Inspect the project state and choose the right next step.
200
+ ```
201
+
202
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.