@momentiq/dark-factory-cli 2.17.0 → 3.0.0

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 (136) hide show
  1. package/dist/adapters/codex-sdk.d.ts +30 -5
  2. package/dist/adapters/codex-sdk.d.ts.map +1 -1
  3. package/dist/adapters/codex-sdk.js +50 -15
  4. package/dist/adapters/codex-sdk.js.map +1 -1
  5. package/dist/adapters/cursor-sdk.d.ts.map +1 -1
  6. package/dist/adapters/cursor-sdk.js +14 -2
  7. package/dist/adapters/cursor-sdk.js.map +1 -1
  8. package/dist/adapters/index.d.ts +1 -0
  9. package/dist/adapters/index.d.ts.map +1 -1
  10. package/dist/adapters/index.js +6 -0
  11. package/dist/adapters/index.js.map +1 -1
  12. package/dist/adapters/mode-scope.d.ts +86 -0
  13. package/dist/adapters/mode-scope.d.ts.map +1 -0
  14. package/dist/adapters/mode-scope.js +456 -0
  15. package/dist/adapters/mode-scope.js.map +1 -0
  16. package/dist/branch-protection/audit_branch_protection.py +80 -2
  17. package/dist/cli.d.ts +5 -0
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +31 -1
  20. package/dist/cli.js.map +1 -1
  21. package/dist/commands/mode.d.ts +2 -0
  22. package/dist/commands/mode.d.ts.map +1 -0
  23. package/dist/commands/mode.js +235 -0
  24. package/dist/commands/mode.js.map +1 -0
  25. package/dist/commands/objectives.d.ts +27 -3
  26. package/dist/commands/objectives.d.ts.map +1 -1
  27. package/dist/commands/objectives.js +347 -53
  28. package/dist/commands/objectives.js.map +1 -1
  29. package/dist/commands/onboard.d.ts.map +1 -1
  30. package/dist/commands/onboard.js +3 -1
  31. package/dist/commands/onboard.js.map +1 -1
  32. package/dist/cycle-doc-validator/validate_cycle_doc.py +128 -11
  33. package/dist/doctor.d.ts.map +1 -1
  34. package/dist/doctor.js +15 -7
  35. package/dist/doctor.js.map +1 -1
  36. package/dist/evidence/index.d.ts +1 -0
  37. package/dist/evidence/index.d.ts.map +1 -1
  38. package/dist/evidence/index.js +5 -0
  39. package/dist/evidence/index.js.map +1 -1
  40. package/dist/evidence/ui-visual/embed.d.ts +65 -0
  41. package/dist/evidence/ui-visual/embed.d.ts.map +1 -0
  42. package/dist/evidence/ui-visual/embed.js +176 -0
  43. package/dist/evidence/ui-visual/embed.js.map +1 -0
  44. package/dist/evidence/ui-visual/index.d.ts +2 -0
  45. package/dist/evidence/ui-visual/index.d.ts.map +1 -0
  46. package/dist/evidence/ui-visual/index.js +6 -0
  47. package/dist/evidence/ui-visual/index.js.map +1 -0
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/mcp/cycle-doc/parser.d.ts +3 -3
  53. package/dist/mcp/cycle-doc/parser.d.ts.map +1 -1
  54. package/dist/mcp/cycle-doc/parser.js +2 -2
  55. package/dist/mcp/cycle-doc/parser.js.map +1 -1
  56. package/dist/mcp/tools/doctor.d.ts +5 -0
  57. package/dist/mcp/tools/doctor.d.ts.map +1 -1
  58. package/dist/mcp/tools/doctor.js +10 -1
  59. package/dist/mcp/tools/doctor.js.map +1 -1
  60. package/dist/mcp/tools/review-bypass.d.ts +5 -0
  61. package/dist/mcp/tools/review-bypass.d.ts.map +1 -1
  62. package/dist/mcp/tools/review-bypass.js +9 -1
  63. package/dist/mcp/tools/review-bypass.js.map +1 -1
  64. package/dist/mode/apply.d.ts +8 -0
  65. package/dist/mode/apply.d.ts.map +1 -0
  66. package/dist/mode/apply.js +118 -0
  67. package/dist/mode/apply.js.map +1 -0
  68. package/dist/mode/context.d.ts +50 -0
  69. package/dist/mode/context.d.ts.map +1 -0
  70. package/dist/mode/context.js +127 -0
  71. package/dist/mode/context.js.map +1 -0
  72. package/dist/mode/critic-registration.d.ts +66 -0
  73. package/dist/mode/critic-registration.d.ts.map +1 -0
  74. package/dist/mode/critic-registration.js +279 -0
  75. package/dist/mode/critic-registration.js.map +1 -0
  76. package/dist/mode/guard.d.ts +15 -0
  77. package/dist/mode/guard.d.ts.map +1 -0
  78. package/dist/mode/guard.js +160 -0
  79. package/dist/mode/guard.js.map +1 -0
  80. package/dist/mode/init.d.ts +17 -0
  81. package/dist/mode/init.d.ts.map +1 -0
  82. package/dist/mode/init.js +147 -0
  83. package/dist/mode/init.js.map +1 -0
  84. package/dist/mode/loadConfig.d.ts +34 -0
  85. package/dist/mode/loadConfig.d.ts.map +1 -0
  86. package/dist/mode/loadConfig.js +38 -0
  87. package/dist/mode/loadConfig.js.map +1 -0
  88. package/dist/mode/prompts/designer-baseline.md +47 -0
  89. package/dist/mode/resolve.d.ts +24 -0
  90. package/dist/mode/resolve.d.ts.map +1 -0
  91. package/dist/mode/resolve.js +65 -0
  92. package/dist/mode/resolve.js.map +1 -0
  93. package/dist/mode/scope-policy.d.ts +41 -0
  94. package/dist/mode/scope-policy.d.ts.map +1 -0
  95. package/dist/mode/scope-policy.js +97 -0
  96. package/dist/mode/scope-policy.js.map +1 -0
  97. package/dist/mode/status.d.ts +14 -0
  98. package/dist/mode/status.d.ts.map +1 -0
  99. package/dist/mode/status.js +13 -0
  100. package/dist/mode/status.js.map +1 -0
  101. package/dist/onboard/seeders/design-md.d.ts +3 -0
  102. package/dist/onboard/seeders/design-md.d.ts.map +1 -0
  103. package/dist/onboard/seeders/design-md.js +138 -0
  104. package/dist/onboard/seeders/design-md.js.map +1 -0
  105. package/dist/onboard/seeders/index.d.ts +8 -0
  106. package/dist/onboard/seeders/index.d.ts.map +1 -1
  107. package/dist/onboard/seeders/index.js +3 -0
  108. package/dist/onboard/seeders/index.js.map +1 -1
  109. package/dist/onboard/validate.d.ts +36 -1
  110. package/dist/onboard/validate.d.ts.map +1 -1
  111. package/dist/onboard/validate.js +136 -42
  112. package/dist/onboard/validate.js.map +1 -1
  113. package/dist/skills/config.d.ts +2 -110
  114. package/dist/skills/config.d.ts.map +1 -1
  115. package/dist/skills/config.js +20 -58
  116. package/dist/skills/config.js.map +1 -1
  117. package/dist/skills/index.d.ts +1 -1
  118. package/dist/skills/index.d.ts.map +1 -1
  119. package/dist/skills/index.js +1 -1
  120. package/dist/skills/index.js.map +1 -1
  121. package/dist/skills/install.d.ts.map +1 -1
  122. package/dist/skills/install.js +7 -0
  123. package/dist/skills/install.js.map +1 -1
  124. package/package.json +3 -3
  125. package/skills/designer-brief/SKILL.md.tmpl +74 -0
  126. package/skills/designer-brief/skill.json +17 -0
  127. package/skills/designer-build/SKILL.md.tmpl +63 -0
  128. package/skills/designer-build/skill.json +17 -0
  129. package/skills/designer-handoff/SKILL.md.tmpl +64 -0
  130. package/skills/designer-handoff/skill.json +17 -0
  131. package/skills/designer-ship/SKILL.md.tmpl +77 -0
  132. package/skills/designer-ship/skill.json +17 -0
  133. package/skills/objectives/SKILL.md.tmpl +34 -6
  134. package/skills/verify/producer/ui-visual-surfaces.ts +261 -0
  135. package/skills/verify/producer/ui-visual.config.ts +22 -0
  136. package/skills/verify/producer/ui-visual.producer.spec.ts +137 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/mode/init.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8CAA8C;AAC9C,EAAE;AACF,sBAAsB;AACtB,8EAA8E;AAC9E,mEAAmE;AACnE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EACL,YAAY,EACZ,sBAAsB,GAEvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAS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QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvF,MAAM,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,KAAK,CAAC;IAEnD,sEAAsE;IACtE,sBAAsB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAE7C,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACrC,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,QAAQ;QACR,UAAU;QACV,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,EAAE;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type DarkFactoryConfig } from "@momentiq/dark-factory-schemas";
2
+ export declare const MODE_CONFIG_FILENAME = "darkfactory.yaml";
3
+ export interface LoadedModeConfig {
4
+ /**
5
+ * Absolute path to `darkfactory.yaml`, whether or not the file exists
6
+ * (`resolve`d against `repoRoot`, matching the skills-side loader).
7
+ */
8
+ readonly configPath: string;
9
+ /**
10
+ * Raw file text. `""` when the file is missing OR exists but is empty — so
11
+ * `text === ""` alone does NOT distinguish those two; a caller that needs
12
+ * the distinction checks the path on disk. `df mode init` appends to this
13
+ * verbatim so hand-maintained comments/formatting survive.
14
+ */
15
+ readonly text: string;
16
+ /**
17
+ * Canonically-parsed config. `{}` (defaults everywhere) when the file is
18
+ * missing, empty, or comment-only. Throws when the file exists with content
19
+ * that `parseDarkFactoryConfig` rejects — a mode command must fail closed on
20
+ * a malformed config rather than operate on a silently-defaulted one.
21
+ */
22
+ readonly config: DarkFactoryConfig;
23
+ }
24
+ /**
25
+ * Load `darkfactory.yaml` from `repoRoot` for the `df mode …` commands.
26
+ *
27
+ * A missing file, an empty file, and a comment/whitespace-only file all
28
+ * resolve to the empty config (`{}`) — the same defaulted-everywhere case the
29
+ * canonical parser treats `parseDarkFactoryConfig({})` as. Any other content
30
+ * is YAML-parsed then handed to `parseDarkFactoryConfig`, which throws a
31
+ * `SchemaError` naming the offending path on an invalid shape.
32
+ */
33
+ export declare function loadModeConfig(repoRoot: string): LoadedModeConfig;
34
+ //# sourceMappingURL=loadConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../../src/mode/loadConfig.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAQjE"}
@@ -0,0 +1,38 @@
1
+ // Cycle 27 — shared `darkfactory.yaml` loader for the `df mode …` surface.
2
+ //
3
+ // `df mode status` and `df mode init` both performed the same
4
+ // read → parseYaml → parseDarkFactoryConfig ritual inline. This module is the
5
+ // single home for that ritual so there is ONE place that decides how the mode
6
+ // commands turn the file on disk into a typed config.
7
+ //
8
+ // It delegates shape validation to the canonical `parseDarkFactoryConfig`
9
+ // (@momentiq/dark-factory-schemas) — the exact same parser `skills/config.ts`
10
+ // (via `loadDarkFactoryConfig`) and `df doctor` (`checkDarkFactoryConfig`) use.
11
+ // There is no second interpretation of `darkfactory.yaml`; the two loaders
12
+ // differ only in ergonomics (this one returns the raw `text` so `df mode init`
13
+ // can APPEND to the consumer's file without re-serializing it; the skills
14
+ // loader adds an `isDefault` flag + a friendly error wrapper).
15
+ import { existsSync, readFileSync } from "node:fs";
16
+ import { resolve } from "node:path";
17
+ import { parse as parseYaml } from "yaml";
18
+ import { parseDarkFactoryConfig, } from "@momentiq/dark-factory-schemas";
19
+ export const MODE_CONFIG_FILENAME = "darkfactory.yaml";
20
+ /**
21
+ * Load `darkfactory.yaml` from `repoRoot` for the `df mode …` commands.
22
+ *
23
+ * A missing file, an empty file, and a comment/whitespace-only file all
24
+ * resolve to the empty config (`{}`) — the same defaulted-everywhere case the
25
+ * canonical parser treats `parseDarkFactoryConfig({})` as. Any other content
26
+ * is YAML-parsed then handed to `parseDarkFactoryConfig`, which throws a
27
+ * `SchemaError` naming the offending path on an invalid shape.
28
+ */
29
+ export function loadModeConfig(repoRoot) {
30
+ const configPath = resolve(repoRoot, MODE_CONFIG_FILENAME);
31
+ const text = existsSync(configPath) ? readFileSync(configPath, "utf8") : "";
32
+ // Only YAML-parse when there is real content: the parser returns null for a
33
+ // comment/whitespace-only file, so `?? {}` folds that into the empty config.
34
+ const raw = text.trim().length > 0 ? parseYaml(text) : {};
35
+ const config = parseDarkFactoryConfig(raw ?? {});
36
+ return { configPath, text, config };
37
+ }
38
+ //# sourceMappingURL=loadConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../../src/mode/loadConfig.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,8DAA8D;AAC9D,8EAA8E;AAC9E,8EAA8E;AAC9E,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,+DAA+D;AAE/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EACL,sBAAsB,GAEvB,MAAM,gCAAgC,CAAC;AAExC,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAwBvD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,GAAG,GAAY,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACjD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,47 @@
1
+ <!-- DF-PROFILE: baseline -->
2
+ # Designer Mode — session doctrine (baseline)
3
+
4
+ You are working with a **non-technical operator** — a designer, PM, or founder
5
+ describing product intent. You own every technical decision; they own every
6
+ product decision. Their trust in this session depends on the rules below.
7
+
8
+ ## Language
9
+
10
+ - Speak plain product language. Never show code, diffs, stack traces, file
11
+ trees, or git/terminal vocabulary unless the operator explicitly asks.
12
+ - Translate progress and problems into outcomes: what changed, what they'll
13
+ see, what happens next. Never paste raw errors — say what went wrong in one
14
+ sentence and what you're doing about it.
15
+
16
+ ## Questions
17
+
18
+ - Ask ONLY product or visual questions ("Should the banner stay visible while
19
+ scrolling?"), never technical ones (frameworks, files, state, APIs — decide
20
+ those yourself, following the repo's existing conventions).
21
+ - Prefer multiple choice with 2–3 concrete options plus "you decide". One
22
+ question at a time. If you can make a reasonable call, make it and say so.
23
+
24
+ ## Design doctrine
25
+
26
+ - `DESIGN.md` at the repo root is the design source of truth: take every
27
+ color, font, and spacing value from its tokens; follow its do's and don'ts.
28
+ - Reuse existing components before creating anything new — extend, don't fork.
29
+ - Never remove accessibility affordances (focus rings, labels, contrast).
30
+
31
+ ## Verification
32
+
33
+ - Show, don't tell: run the dev server and present before/after screenshots
34
+ for every visual change. Iterate until the operator says it looks right.
35
+
36
+ ## Guardrails
37
+
38
+ - When a tool call is denied by the mode guard, do NOT retry or work around
39
+ it. Explain in one plain sentence, then offer to package the request for an
40
+ engineer (a handoff) — framed as progress, not rejection.
41
+ - Never bypass, weaken, or ask the operator to bypass any gate.
42
+
43
+ ## Shipping
44
+
45
+ - Branches, PRs, reviews, and merges are invisible plumbing: run them
46
+ yourself and report status plainly ("It's in review with our automated
47
+ checks — I'll tell you when it's live.").
@@ -0,0 +1,24 @@
1
+ import { type DarkFactoryConfig, type ModeConfig } from "@momentiq/dark-factory-schemas";
2
+ /**
3
+ * Pure precedence resolver. The CLI arg map can contain `mode` as a string
4
+ * (the value), `true` (bare `--mode` with no value), or be absent. The env
5
+ * map is `process.env` shape. Whitespace-trimmed; empty strings fall
6
+ * through. Returns `undefined` when no mode is selected.
7
+ */
8
+ export declare function resolveMode(args: {
9
+ mode?: string | boolean | undefined;
10
+ }, env: {
11
+ DF_MODE?: string | undefined;
12
+ }): string | undefined;
13
+ /**
14
+ * The result of applying a resolved mode name against the loaded
15
+ * darkfactory.yaml. Unlike the profile axis there is no back-compat
16
+ * pass-through: a mode name is meaningless without its guardrail catalog,
17
+ * so both "no catalog" and "name not in catalog" fail loudly.
18
+ */
19
+ export interface ResolvedMode {
20
+ modeName: string;
21
+ mode: ModeConfig;
22
+ }
23
+ export declare function resolveModeWithConfig(config: DarkFactoryConfig, modeName: string): ResolvedMode;
24
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/mode/resolve.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,gCAAgC,CAAC;AAcxC;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,EAC7C,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACpC,MAAM,GAAG,SAAS,CAYpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,GACf,YAAY,CAyBd"}
@@ -0,0 +1,65 @@
1
+ // Cycle 27 Phase A — `DF_MODE` / `--mode` operator-axis resolution.
2
+ //
3
+ // Selects an OPERATOR mode (Designer Mode first) from the `modes` catalog in
4
+ // darkfactory.yaml. This is deliberately a SEPARATE axis from the critic-fleet
5
+ // profile selector (`--profile` / `AGENT_REVIEW_PROFILE` / policy/profile.ts):
6
+ // a mode says who is driving the session and which guardrails apply; a profile
7
+ // says which critic fleet reviews the commit. Neither reads the other's inputs.
8
+ //
9
+ // Selection precedence (highest → lowest):
10
+ // 1. CLI `--mode <name>` flag.
11
+ // 2. `DF_MODE` env var.
12
+ // 3. No mode — unlike profiles there is NO default: an unmoded session is
13
+ // the normal engineer path, so absence must stay meaningful.
14
+ import { MODE_NAME_RE, } from "@momentiq/dark-factory-schemas";
15
+ function assertSlug(value, source) {
16
+ if (!MODE_NAME_RE.test(value)) {
17
+ // JSON.stringify renders the hostile value safely escaped (newlines,
18
+ // backticks, quotes) — never raw, and never inside a copyable command.
19
+ throw new Error(`df mode: invalid mode name ${JSON.stringify(value)} from ${source} — ` +
20
+ `mode names are lowercase slugs matching ${MODE_NAME_RE.source}.`);
21
+ }
22
+ return value;
23
+ }
24
+ /**
25
+ * Pure precedence resolver. The CLI arg map can contain `mode` as a string
26
+ * (the value), `true` (bare `--mode` with no value), or be absent. The env
27
+ * map is `process.env` shape. Whitespace-trimmed; empty strings fall
28
+ * through. Returns `undefined` when no mode is selected.
29
+ */
30
+ export function resolveMode(args, env) {
31
+ const flagRaw = args.mode;
32
+ if (typeof flagRaw === "string") {
33
+ const trimmed = flagRaw.trim();
34
+ if (trimmed.length > 0)
35
+ return assertSlug(trimmed, "--mode");
36
+ }
37
+ const envRaw = env.DF_MODE;
38
+ if (typeof envRaw === "string") {
39
+ const trimmed = envRaw.trim();
40
+ if (trimmed.length > 0)
41
+ return assertSlug(trimmed, "DF_MODE");
42
+ }
43
+ return undefined;
44
+ }
45
+ export function resolveModeWithConfig(config, modeName) {
46
+ // Callers reach here via resolveMode (slug-validated), but this function is
47
+ // exported — re-assert so no path interpolates an unvalidated name.
48
+ if (!MODE_NAME_RE.test(modeName)) {
49
+ throw new Error(`df mode: invalid mode name ${JSON.stringify(modeName)} — ` +
50
+ `mode names are lowercase slugs matching ${MODE_NAME_RE.source}.`);
51
+ }
52
+ if (!config.modes) {
53
+ throw new Error(`df mode: no \`modes\` catalog in darkfactory.yaml — mode "${modeName}" ` +
54
+ `cannot be resolved. Run \`df mode init <name>\` (e.g. \`df mode init designer\`) to seed one.`);
55
+ }
56
+ const mode = config.modes[modeName];
57
+ if (!mode) {
58
+ const available = Object.keys(config.modes);
59
+ throw new Error(`df mode: unknown mode "${modeName}". ` +
60
+ `Available modes: ${available.length > 0 ? available.join(", ") : "(none)"}. ` +
61
+ `Set via --mode <name> or DF_MODE=<name>; no mode is the default.`);
62
+ }
63
+ return { modeName, mode };
64
+ }
65
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/mode/resolve.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,EAAE;AACF,2CAA2C;AAC3C,iCAAiC;AACjC,0BAA0B;AAC1B,4EAA4E;AAC5E,kEA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AAC,KAAK;YACzD,2CAA2C,YAAY,CAAC,MAAM,GAAG,CACpE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,6DAA6D,QAAQ,IAAI;YACvE,+FAA+F,CAClG,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,KAAK;YACrC,oBAAoB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI;YAC9E,kEAAkE,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ModeConfig } from "@momentiq/dark-factory-schemas";
2
+ /**
3
+ * Bounded glob matcher for mode-catalog patterns. Supports exactly the
4
+ * forms the catalog uses — `**` (any depth, including none, across
5
+ * separators), `*` (any run within a segment), literal text — via safe
6
+ * regex translation. Deliberately NOT a general glob engine and NOT a new
7
+ * dependency: catalog patterns are repo-author-controlled.
8
+ */
9
+ export declare function globMatch(pattern: string, path: string): boolean;
10
+ export declare const DEPENDENCY_MANIFESTS: readonly string[];
11
+ /**
12
+ * The rule that fired for a single repo-relative path against a mode
13
+ * catalog. `allow` means the path is within the mode's permitted surface;
14
+ * every other kind is a scope violation, in precedence order.
15
+ */
16
+ export type ModePathClassification = {
17
+ kind: "allow";
18
+ } | {
19
+ kind: "protected";
20
+ } | {
21
+ kind: "dependency";
22
+ } | {
23
+ kind: "out-of-scope";
24
+ };
25
+ /**
26
+ * Classify ONE repo-relative, forward-slash path against a mode catalog.
27
+ * Pure and total. Precedence (highest → lowest), matching spec §4.3 /
28
+ * §4.4:
29
+ * 1. `protectedPaths` — ALWAYS wins over writeScopes on overlap.
30
+ * 2. dependency manifest under `dependencyPolicy: "none"`.
31
+ * 3. `writeScopes` membership — only enforced when the mode declares at
32
+ * least one write scope (an empty/absent writeScopes list means "no
33
+ * scope narrowing", so nothing is out-of-scope on that axis).
34
+ *
35
+ * The caller supplies an already-relativized path (no leading `/`, no
36
+ * `..`); path canonicalization / repo-escape rejection is the caller's
37
+ * concern (the guard relativizes tool-call paths; the critic reads
38
+ * git-relative diff paths, which are already repo-relative).
39
+ */
40
+ export declare function classifyModePath(path: string, mode: ModeConfig): ModePathClassification;
41
+ //# sourceMappingURL=scope-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-policy.d.ts","sourceRoot":"","sources":["../../src/mode/scope-policy.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BhE;AAMD,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAOjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,sBAAsB,CAcvF"}
@@ -0,0 +1,97 @@
1
+ // Cycle 27 Phase C — shared operator-mode scope-policy core.
2
+ //
3
+ // Single source of truth for the catalog scope decision that BOTH
4
+ // enforcement layers consume (spec §4.4 frames them as ONE policy, so
5
+ // they must not drift):
6
+ // - Layer 2 (`mode/guard.ts` PreToolUse hook) — per-tool-call, live in
7
+ // the session, dual-register deny messages.
8
+ // - Layer 4 (`adapters/mode-scope.ts` CI/pre-push critic) — per-diff,
9
+ // tamper-proof, `blocker` findings.
10
+ //
11
+ // The precedence is invariant across both: `protectedPaths` ALWAYS wins
12
+ // over `writeScopes` on overlap, then dependency-manifest edits under
13
+ // `dependencyPolicy: "none"`, then writeScopes membership. Extracting the
14
+ // classifier here means a change to that precedence lands in one place and
15
+ // is enforced identically at both layers.
16
+ /**
17
+ * Bounded glob matcher for mode-catalog patterns. Supports exactly the
18
+ * forms the catalog uses — `**` (any depth, including none, across
19
+ * separators), `*` (any run within a segment), literal text — via safe
20
+ * regex translation. Deliberately NOT a general glob engine and NOT a new
21
+ * dependency: catalog patterns are repo-author-controlled.
22
+ */
23
+ export function globMatch(pattern, path) {
24
+ let re = "";
25
+ for (let i = 0; i < pattern.length; i++) {
26
+ const ch = pattern[i];
27
+ if (ch === "*") {
28
+ if (pattern[i + 1] === "*") {
29
+ // `**` = any depth. Two shapes: a `**/` prefix/interior swallows its
30
+ // slash (`(?:.*/)?`) so `**/x` also matches a root-level `x`; a trailing
31
+ // `**` becomes `.*`, so `a/**` → `^a/.*$` matches everything UNDER `a/`
32
+ // at any depth (the paths classified here are files, never a bare dir).
33
+ const next = pattern[i + 2];
34
+ if (next === "/") {
35
+ re += "(?:.*/)?";
36
+ i += 2;
37
+ }
38
+ else {
39
+ re += ".*";
40
+ i += 1;
41
+ }
42
+ }
43
+ else {
44
+ re += "[^/]*";
45
+ }
46
+ }
47
+ else if ("\\^$.|?+()[]{}".includes(ch)) {
48
+ re += `\\${ch}`;
49
+ }
50
+ else {
51
+ re += ch;
52
+ }
53
+ }
54
+ return new RegExp(`^${re}$`).test(path);
55
+ }
56
+ // Manifest/lockfile basenames that a `dependencyPolicy: "none"` mode may
57
+ // not touch. Basename match (a nested `apps/web/package.json` is still a
58
+ // dependency manifest). Kept in lockstep with the guard's Bash dependency
59
+ // denylist by construction — both live in this module's consumers.
60
+ export const DEPENDENCY_MANIFESTS = [
61
+ "package.json",
62
+ "package-lock.json",
63
+ "npm-shrinkwrap.json",
64
+ "pnpm-lock.yaml",
65
+ "yarn.lock",
66
+ "bun.lockb",
67
+ ];
68
+ /**
69
+ * Classify ONE repo-relative, forward-slash path against a mode catalog.
70
+ * Pure and total. Precedence (highest → lowest), matching spec §4.3 /
71
+ * §4.4:
72
+ * 1. `protectedPaths` — ALWAYS wins over writeScopes on overlap.
73
+ * 2. dependency manifest under `dependencyPolicy: "none"`.
74
+ * 3. `writeScopes` membership — only enforced when the mode declares at
75
+ * least one write scope (an empty/absent writeScopes list means "no
76
+ * scope narrowing", so nothing is out-of-scope on that axis).
77
+ *
78
+ * The caller supplies an already-relativized path (no leading `/`, no
79
+ * `..`); path canonicalization / repo-escape rejection is the caller's
80
+ * concern (the guard relativizes tool-call paths; the critic reads
81
+ * git-relative diff paths, which are already repo-relative).
82
+ */
83
+ export function classifyModePath(path, mode) {
84
+ const basename = path.split("/").pop() ?? path;
85
+ if ((mode.protectedPaths ?? []).some((p) => globMatch(p, path))) {
86
+ return { kind: "protected" };
87
+ }
88
+ if (mode.dependencyPolicy === "none" && DEPENDENCY_MANIFESTS.includes(basename)) {
89
+ return { kind: "dependency" };
90
+ }
91
+ const scopes = mode.writeScopes ?? [];
92
+ if (scopes.length > 0 && !scopes.some((p) => globMatch(p, path))) {
93
+ return { kind: "out-of-scope" };
94
+ }
95
+ return { kind: "allow" };
96
+ }
97
+ //# sourceMappingURL=scope-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-policy.js","sourceRoot":"","sources":["../../src/mode/scope-policy.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,wBAAwB;AACxB,yEAAyE;AACzE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;AAC1E,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,cAAc;IACd,mBAAmB;IACnB,qBAAqB;IACrB,gBAAgB;IAChB,WAAW;IACX,WAAW;CACZ,CAAC;AAaF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAgB;IAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC;IAE/C,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;QAChE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;IACD,IAAI,IAAI,CAAC,gBAAgB,KAAK,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAChC,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;IACtC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAClC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type ModeConfig } from "@momentiq/dark-factory-schemas";
2
+ export type ModeStatusResult = {
3
+ active: false;
4
+ } | {
5
+ active: true;
6
+ modeName: string;
7
+ mode: ModeConfig;
8
+ };
9
+ export declare function modeStatus(repoRoot: string, args: {
10
+ mode?: string | boolean | undefined;
11
+ }, env: {
12
+ DF_MODE?: string | undefined;
13
+ }): ModeStatusResult;
14
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/mode/status.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAKjE,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GACjB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,EAC7C,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACpC,gBAAgB,CAOlB"}
@@ -0,0 +1,13 @@
1
+ // Cycle 27 Phase A — `df mode status`: report the session's active operator
2
+ // mode. "No mode" is the normal engineer path, not an error.
3
+ import { loadModeConfig } from "./loadConfig.js";
4
+ import { resolveMode, resolveModeWithConfig } from "./resolve.js";
5
+ export function modeStatus(repoRoot, args, env) {
6
+ const modeName = resolveMode(args, env);
7
+ if (!modeName)
8
+ return { active: false };
9
+ const { config } = loadModeConfig(repoRoot);
10
+ const resolved = resolveModeWithConfig(config, modeName);
11
+ return { active: true, modeName: resolved.modeName, mode: resolved.mode };
12
+ }
13
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/mode/status.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6DAA6D;AAI7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAMlE,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,IAA6C,EAC7C,GAAqC;IAErC,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAExC,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Seeder } from "./index.js";
2
+ export declare const designMdSeeder: Seeder;
3
+ //# sourceMappingURL=design-md.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-md.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/design-md.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,YAAY,CAAC;AAoGtD,eAAO,MAAM,cAAc,EAAE,MA0B5B,CAAC"}
@@ -0,0 +1,138 @@
1
+ // packages/cli/src/onboard/seeders/design-md.ts
2
+ //
3
+ // DESIGN.md seeder — cycle 27 Phase A.
4
+ //
5
+ // Every DF-onboarded repo carries a DESIGN.md (Google Labs open DESIGN.md
6
+ // spec, Apr 2026): machine-readable design tokens as a YAML frontmatter
7
+ // block + human-readable design intent underneath — the design-side sibling
8
+ // of AGENTS.md. Deterministic emitter:
9
+ //
10
+ // - UI repo (react/next/vue/svelte/angular/... in `analysis.dependencies`)
11
+ // → full skeleton with token placeholders + a reuse-existing-components
12
+ // mandate (the guidance Designer Mode's persona and the chief-designer
13
+ // critic bind to).
14
+ // - No UI dependencies → minimal declaration that the repo currently has
15
+ // no UI surface, so agents don't invent one; the skeleton upgrades when
16
+ // a UI lands.
17
+ // - Repo already has a DESIGN.md → explicit `skip` plan (observability in
18
+ // the onboard dry-run rendering), never overwrite.
19
+ const UI_DEPENDENCY_NAMES = new Set([
20
+ "react",
21
+ "react-dom",
22
+ "next",
23
+ "vue",
24
+ "nuxt",
25
+ "svelte",
26
+ "@sveltejs/kit",
27
+ "solid-js",
28
+ "preact",
29
+ "astro",
30
+ "@angular/core",
31
+ ]);
32
+ function hasUiSurface(input) {
33
+ const deps = input.analysis
34
+ .dependencies;
35
+ if (!Array.isArray(deps))
36
+ return false;
37
+ return deps.some((d) => UI_DEPENDENCY_NAMES.has(d.name));
38
+ }
39
+ function repoName(input) {
40
+ const name = input.analysis.repo?.name;
41
+ return name && name.length > 0 ? name : "this repo";
42
+ }
43
+ const TOKEN_FRONTMATTER = `---
44
+ # DESIGN.md — machine-readable design tokens (Google Labs DESIGN.md spec).
45
+ # Replace the placeholder values below with your product's real tokens;
46
+ # agents treat this block as the single source of design truth.
47
+ colors:
48
+ primary: "#4f46e5"
49
+ surface: "#ffffff"
50
+ text: "#111827"
51
+ muted: "#6b7280"
52
+ typography:
53
+ body:
54
+ family: "system-ui"
55
+ size: "16px"
56
+ lineHeight: 1.5
57
+ heading:
58
+ family: "system-ui"
59
+ weight: 600
60
+ spacing:
61
+ unit: "4px"
62
+ scale: [4, 8, 12, 16, 24, 32, 48]
63
+ components:
64
+ policy: "reuse existing components before creating new ones"
65
+ ---
66
+ `;
67
+ function uiBody(name) {
68
+ return `${TOKEN_FRONTMATTER}
69
+ # ${name} — Design System
70
+
71
+ Seeded by \`df onboard\` (cycle 27). This file is the design-side sibling of
72
+ AGENTS.md: coding agents read it before generating or changing UI, and the
73
+ design-lens critics review against it. Keep it truthful — placeholder tokens
74
+ that don't match the product are worse than none.
75
+
76
+ ## Design Philosophy
77
+
78
+ Describe, in a few sentences, what the product should feel like and why.
79
+ Agents use this to make the thousand small calls tokens can't encode.
80
+
81
+ ## Visual Theme & Atmosphere
82
+
83
+ Describe density, tone, motion, and imagery expectations.
84
+
85
+ ## Do's and Don'ts
86
+
87
+ - DO reuse existing components before creating new ones — extend, don't fork.
88
+ - DO take every color, font, and spacing value from the tokens above.
89
+ - DON'T introduce new colors, fonts, or spacing values outside the tokens.
90
+ - DON'T remove accessibility affordances (focus rings, labels, contrast).
91
+ `;
92
+ }
93
+ function noUiBody(name) {
94
+ return `${TOKEN_FRONTMATTER}
95
+ # ${name} — Design System
96
+
97
+ Seeded by \`df onboard\` (cycle 27). ${name} currently exposes **no UI
98
+ surface** — no UI framework was detected among its dependencies. Agents must
99
+ not invent one. If a UI lands later, replace the placeholder tokens above
100
+ with real values and expand the sections below.
101
+
102
+ ## Design Philosophy
103
+
104
+ (No UI surface yet.)
105
+
106
+ ## Do's and Don'ts
107
+
108
+ - DON'T scaffold UI components in this repo without an approved plan.
109
+ - DO update this file in the same PR that introduces any UI surface.
110
+ `;
111
+ }
112
+ export const designMdSeeder = {
113
+ name: "design-md",
114
+ async seed(input) {
115
+ if (input.designMdExists) {
116
+ return [
117
+ {
118
+ path: "DESIGN.md",
119
+ action: "skip",
120
+ rationale: "DESIGN.md already present at repo root — df never overwrites a hand-maintained design doctrine file.",
121
+ },
122
+ ];
123
+ }
124
+ const name = repoName(input);
125
+ const ui = hasUiSurface(input);
126
+ return [
127
+ {
128
+ path: "DESIGN.md",
129
+ action: "emit",
130
+ rationale: ui
131
+ ? "UI dependencies detected — seed the Google Labs DESIGN.md skeleton (token frontmatter + design intent) so agents and design-lens critics share one design source of truth."
132
+ : "No UI dependencies detected — seed a minimal DESIGN.md declaring the absence of a UI surface so agents don't invent one.",
133
+ tailored_content: ui ? uiBody(name) : noUiBody(name),
134
+ },
135
+ ];
136
+ },
137
+ };
138
+ //# sourceMappingURL=design-md.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-md.js","sourceRoot":"","sources":["../../../src/onboard/seeders/design-md.ts"],"names":[],"mappings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B,IAAI;;uCAE+B,IAAI;;;;;;;;;;;;;CAa1C,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,IAAI,EAAE,WAAW;IACjB,KAAK,CAAC,IAAI,CAAC,KAAkB;QAC3B,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,OAAO;gBACL;oBACE,IAAI,EAAE,WAAW;oBACjB,MAAM,EAAE,MAAM;oBACd,SAAS,EACP,sGAAsG;iBACzG;aACF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,MAAM,EAAE,MAAM;gBACd,SAAS,EAAE,EAAE;oBACX,CAAC,CAAC,4KAA4K;oBAC9K,CAAC,CAAC,0HAA0H;gBAC9H,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;aACrD;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { FilePlan } from "../scaffold-schema.js";
2
2
  import type { RepoAnalysis } from "../schema.js";
3
+ import { designMdSeeder } from "./design-md.js";
3
4
  export type { FilePlan } from "../scaffold-schema.js";
4
5
  /**
5
6
  * Input to a Phase C seeder.
@@ -23,6 +24,12 @@ export interface SeederInput {
23
24
  readonly existingRunbooks?: readonly string[];
24
25
  readonly now: Date;
25
26
  readonly profile?: "local" | "cloud";
27
+ /**
28
+ * True when the target repo already has a root DESIGN.md (cycle 27 —
29
+ * the design-md seeder must skip rather than overwrite). Populated by
30
+ * `cmdOnboard`; optional so prose-seeder unit tests need not set it.
31
+ */
32
+ readonly designMdExists?: boolean;
26
33
  }
27
34
  export interface Seeder {
28
35
  readonly name: string;
@@ -39,6 +46,7 @@ export { adrSeeder } from "./adr.js";
39
46
  export { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
40
47
  export { runbookSeeder } from "./runbook.js";
41
48
  export { agentReviewConfigSeeder } from "./agent-review-config.js";
49
+ export { designMdSeeder };
42
50
  /**
43
51
  * The canonical seeder set wired into `cmdOnboard` (Task 4.5). Order is
44
52
  * presentation-only — `runSeeders` runs them concurrently.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAcrB;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;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ACzB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAcrB;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAMhD,CAAC"}
@@ -2,6 +2,7 @@ import { adrSeeder } from "./adr.js";
2
2
  import { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
3
3
  import { runbookSeeder } from "./runbook.js";
4
4
  import { agentReviewConfigSeeder } from "./agent-review-config.js";
5
+ import { designMdSeeder } from "./design-md.js";
5
6
  /**
6
7
  * Run every seeder in parallel, isolating individual failures to stderr so a
7
8
  * single broken seeder does NOT block the rest of the merge. Phase C seeders
@@ -24,6 +25,7 @@ export { adrSeeder } from "./adr.js";
24
25
  export { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
25
26
  export { runbookSeeder } from "./runbook.js";
26
27
  export { agentReviewConfigSeeder } from "./agent-review-config.js";
28
+ export { designMdSeeder };
27
29
  /**
28
30
  * The canonical seeder set wired into `cmdOnboard` (Task 4.5). Order is
29
31
  * presentation-only — `runSeeders` runs them concurrently.
@@ -33,5 +35,6 @@ export const ALL_SEEDERS_DEFAULT = [
33
35
  cycle1BootstrapSeeder,
34
36
  runbookSeeder,
35
37
  agentReviewConfigSeeder,
38
+ designMdSeeder,
36
39
  ];
37
40
  //# sourceMappingURL=index.js.map