Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

3.0 KB
Raw Blame
/**
 * Add `comic-structure` category to the manuscript-completeness prompt.
 *
 * The prompt previously had five finding categories (missing-content, arc-gap,
 * character-gap, pacing, continuity) — all narrative-level. Comic scripts have
 * a structural failure mode that none of them catch: pages where an author or AI
 * stage dumps all scene content into the page-level description instead of
 * breaking it into panel definitions. The image generator and letterer work
 * panel-by-panel, so such pages cannot be rendered.
 *
 * The new `comic-structure` category surfaces these pages as `high`-severity
 * findings and requires the suggestion to be a full panel-by-panel rewrite of
 * the malformed page (directly substitutable via the find-and-replace fix path).
 *
 * `scripts/setup-data.js` only copies *missing* prompts, so existing installs
 * keep their old template until this migration rewrites it. Customization-safe:
 * only installs whose copy still hashes to the known pre-change shipped version
 * are auto-updated; customized prompts are left intact and warned about.
 *
 * Strategy: hash-driven prompt-replace via `./_lib.js`. Idempotent.
 */

import { makePromptReplaceMigration } from './_lib.js';

// Pre-change shipped hash (five-category, anchorQuote findings from migration
// 056), plus this migration's own six-category output ('1ee5ac…') as an
// accepted-old entry — migration 066 (replacementStrategy) further updated the
// file, so a copy still at the 057 body is auto-upgradable to the current shape.
export const ACCEPTED_OLD_MD5 = {
  'pipeline-manuscript-completeness.md': ['4f2b95778aed85f5fc461d71eb461b79', '1ee5ac936fbf1d365e0eaea99bcf1e77', 'cec8faeb75dfff74e41b8221145c2e92'],
};

// Current shipped hash — migrations 066 (replacementStrategy contract) and 083
// (with-edits replace field) further updated this file, so this hash reflects
// the post-083 body. The idempotent-rerun and drift-catch tests require it to
// match the live data.reference body, not 057's own output.
export const NEW_SHIPPED_MD5 = {
  'pipeline-manuscript-completeness.md': 'a08a7aaea9b57dcf12311505150672cd',
};

const { applyMigration, up } = makePromptReplaceMigration({
  accepted: ACCEPTED_OLD_MD5,
  current: NEW_SHIPPED_MD5,
  label: 'manuscript-completeness comic-structure category prompt',
  customizedHint: (filename) =>
    `   To add comic-structure detection manually, diff:\n` +
    `     data.reference/prompts/stages/${filename}\n` +
    `   against your current:\n` +
    `     data/prompts/stages/${filename}\n` +
    `   and add the comic-structure category to "What to look for" and the output contract.`,
  skipFooter: (count) =>
    `⚠️  ${count} prompt(s) could not be auto-updated because they were\n` +
    `   customized. Editorial review still works, but comic-script pages\n` +
    `   that lack proper panel definitions won't be flagged as structural\n` +
    `   issues until you merge the change.\n` +
    `   See data.reference/prompts/stages/pipeline-manuscript-completeness.md.`,
});

export { applyMigration };
export default { up };