|
| 1 | +/** |
| 2 | + * CWQE Phase 12 — cross-issue prose continuity (#2177). |
| 3 | + * |
| 4 | + * `pipeline-prose.md` gained a "Continuity with neighboring issues" block that |
| 5 | + * conditionally renders the previous issue's closing prose tail |
| 6 | + * (`{{#priorIssueProseTail}}`) and the next issue's opening beats |
| 7 | + * (`{{#nextIssueBeats}}`), gated by `{{#hasNeighborContinuity}}` — so chapter |
| 8 | + * boundaries flow and the narrative voice carries across issues. |
| 9 | + * |
| 10 | + * `scripts/setup-data.js` only copies *missing* prompt files, so existing |
| 11 | + * installs keep their old `pipeline-prose.md` until this migration rewrites it. |
| 12 | + * `pipeline-prose.md` already has a migration lineage (003/027/054/127/166) — |
| 13 | + * per the drift-cross-sync convention those earlier migrations were resynced in |
| 14 | + * this same change: the previous current hash moved into their `ACCEPTED_OLD_MD5` |
| 15 | + * and their `NEW_SHIPPED_MD5` bumped to the post-168 hash, so their drift-catch |
| 16 | + * tests stay in lock-step with the live sample. The drift baseline in |
| 17 | + * `setup-data-drift.test.js` was updated to match the merged sweep. |
| 18 | + * |
| 19 | + * Customization-safe: only installs whose copy still hashes to the prior shipped |
| 20 | + * version are auto-updated; customized prompts are left intact and warned about. |
| 21 | + * |
| 22 | + * Strategy: hash-driven prompt-replace via `./_lib.js`. Idempotent. |
| 23 | + */ |
| 24 | + |
| 25 | +import { makePromptReplaceMigration } from './_lib.js'; |
| 26 | + |
| 27 | +// Pre-change shipped hash (the current shipped body before #2177 — post-166). |
| 28 | +export const ACCEPTED_OLD_MD5 = { |
| 29 | + 'pipeline-prose.md': ['430d38ed2da59e0d4212e65edc499a74'], |
| 30 | +}; |
| 31 | + |
| 32 | +// Post-change shipped hash (neighbor-continuity block added). |
| 33 | +export const NEW_SHIPPED_MD5 = { |
| 34 | + 'pipeline-prose.md': '4cb3ef48309f3673570cf80e4d544b54', |
| 35 | +}; |
| 36 | + |
| 37 | +const { applyMigration, up } = makePromptReplaceMigration({ |
| 38 | + accepted: ACCEPTED_OLD_MD5, |
| 39 | + current: NEW_SHIPPED_MD5, |
| 40 | + label: 'cross-issue prose continuity', |
| 41 | + customizedHint: (filename) => |
| 42 | + ` To upgrade it manually, diff:\n` + |
| 43 | + ` data.reference/prompts/stages/${filename}\n` + |
| 44 | + ` against your current:\n` + |
| 45 | + ` data/prompts/stages/${filename}\n` + |
| 46 | + ` and add the "Continuity with neighboring issues" block (the\n` + |
| 47 | + ` {{#hasNeighborContinuity}} / {{#priorIssueProseTail}} / {{#nextIssueBeats}}\n` + |
| 48 | + ` sections).`, |
| 49 | + skipFooter: (count) => |
| 50 | + `⚠️ ${count} prose prompt(s) could not be auto-updated because they were\n` + |
| 51 | + ` customized. Prose generation still works, but drafts will miss the\n` + |
| 52 | + ` cross-issue continuity context (previous issue's closing prose + next\n` + |
| 53 | + ` issue's opening beats) until you merge it from\n` + |
| 54 | + ` data.reference/prompts/stages/pipeline-prose.md.`, |
| 55 | +}); |
| 56 | + |
| 57 | +export { applyMigration }; |
| 58 | +export default { up }; |
0 commit comments