@momentiq/dark-factory-cli 2.0.0 → 2.2.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 (142) hide show
  1. package/dist/adapters/static-schema-lint.js +1 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +18 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/onboard.d.ts +69 -0
  6. package/dist/commands/onboard.d.ts.map +1 -0
  7. package/dist/commands/onboard.js +323 -0
  8. package/dist/commands/onboard.js.map +1 -0
  9. package/dist/cycle-doc-validator/validate_cycle_doc.py +131 -60
  10. package/dist/doctor.d.ts.map +1 -1
  11. package/dist/doctor.js +20 -0
  12. package/dist/doctor.js.map +1 -1
  13. package/dist/mcp/server.d.ts.map +1 -1
  14. package/dist/mcp/server.js +2 -0
  15. package/dist/mcp/server.js.map +1 -1
  16. package/dist/mcp/tools/onboard.d.ts +6 -0
  17. package/dist/mcp/tools/onboard.d.ts.map +1 -0
  18. package/dist/mcp/tools/onboard.js +115 -0
  19. package/dist/mcp/tools/onboard.js.map +1 -0
  20. package/dist/onboard/analyze.d.ts +7 -0
  21. package/dist/onboard/analyze.d.ts.map +1 -0
  22. package/dist/onboard/analyze.js +86 -0
  23. package/dist/onboard/analyze.js.map +1 -0
  24. package/dist/onboard/analyzer.d.ts +15 -0
  25. package/dist/onboard/analyzer.d.ts.map +1 -0
  26. package/dist/onboard/analyzer.js +52 -0
  27. package/dist/onboard/analyzer.js.map +1 -0
  28. package/dist/onboard/analyzers/ci.d.ts +3 -0
  29. package/dist/onboard/analyzers/ci.d.ts.map +1 -0
  30. package/dist/onboard/analyzers/ci.js +112 -0
  31. package/dist/onboard/analyzers/ci.js.map +1 -0
  32. package/dist/onboard/analyzers/docs.d.ts +3 -0
  33. package/dist/onboard/analyzers/docs.d.ts.map +1 -0
  34. package/dist/onboard/analyzers/docs.js +151 -0
  35. package/dist/onboard/analyzers/docs.js.map +1 -0
  36. package/dist/onboard/analyzers/git.d.ts +3 -0
  37. package/dist/onboard/analyzers/git.d.ts.map +1 -0
  38. package/dist/onboard/analyzers/git.js +87 -0
  39. package/dist/onboard/analyzers/git.js.map +1 -0
  40. package/dist/onboard/analyzers/lockfile.d.ts +3 -0
  41. package/dist/onboard/analyzers/lockfile.d.ts.map +1 -0
  42. package/dist/onboard/analyzers/lockfile.js +285 -0
  43. package/dist/onboard/analyzers/lockfile.js.map +1 -0
  44. package/dist/onboard/analyzers/manifest.d.ts +3 -0
  45. package/dist/onboard/analyzers/manifest.d.ts.map +1 -0
  46. package/dist/onboard/analyzers/manifest.js +228 -0
  47. package/dist/onboard/analyzers/manifest.js.map +1 -0
  48. package/dist/onboard/analyzers/tree.d.ts +3 -0
  49. package/dist/onboard/analyzers/tree.d.ts.map +1 -0
  50. package/dist/onboard/analyzers/tree.js +196 -0
  51. package/dist/onboard/analyzers/tree.js.map +1 -0
  52. package/dist/onboard/apply-plan.d.ts +29 -0
  53. package/dist/onboard/apply-plan.d.ts.map +1 -0
  54. package/dist/onboard/apply-plan.js +80 -0
  55. package/dist/onboard/apply-plan.js.map +1 -0
  56. package/dist/onboard/auto-profile.d.ts +3 -0
  57. package/dist/onboard/auto-profile.d.ts.map +1 -0
  58. package/dist/onboard/auto-profile.js +20 -0
  59. package/dist/onboard/auto-profile.js.map +1 -0
  60. package/dist/onboard/fixtures/replay-git-history.d.ts +20 -0
  61. package/dist/onboard/fixtures/replay-git-history.d.ts.map +1 -0
  62. package/dist/onboard/fixtures/replay-git-history.js +91 -0
  63. package/dist/onboard/fixtures/replay-git-history.js.map +1 -0
  64. package/dist/onboard/generate-plan.d.ts +18 -0
  65. package/dist/onboard/generate-plan.d.ts.map +1 -0
  66. package/dist/onboard/generate-plan.js +68 -0
  67. package/dist/onboard/generate-plan.js.map +1 -0
  68. package/dist/onboard/llm-client.d.ts +45 -0
  69. package/dist/onboard/llm-client.d.ts.map +1 -0
  70. package/dist/onboard/llm-client.js +84 -0
  71. package/dist/onboard/llm-client.js.map +1 -0
  72. package/dist/onboard/prompts/scaffold.md +93 -0
  73. package/dist/onboard/prompts.d.ts +13 -0
  74. package/dist/onboard/prompts.d.ts.map +1 -0
  75. package/dist/onboard/prompts.js +54 -0
  76. package/dist/onboard/prompts.js.map +1 -0
  77. package/dist/onboard/scaffold-schema.d.ts +194 -0
  78. package/dist/onboard/scaffold-schema.d.ts.map +1 -0
  79. package/dist/onboard/scaffold-schema.js +73 -0
  80. package/dist/onboard/scaffold-schema.js.map +1 -0
  81. package/dist/onboard/schema.d.ts +545 -0
  82. package/dist/onboard/schema.d.ts.map +1 -0
  83. package/dist/onboard/schema.js +148 -0
  84. package/dist/onboard/schema.js.map +1 -0
  85. package/dist/onboard/seeders/adr.d.ts +3 -0
  86. package/dist/onboard/seeders/adr.d.ts.map +1 -0
  87. package/dist/onboard/seeders/adr.js +212 -0
  88. package/dist/onboard/seeders/adr.js.map +1 -0
  89. package/dist/onboard/seeders/agent-review-config/cloud.canonical.json +22 -0
  90. package/dist/onboard/seeders/agent-review-config/local.canonical.json +21 -0
  91. package/dist/onboard/seeders/agent-review-config.d.ts +3 -0
  92. package/dist/onboard/seeders/agent-review-config.d.ts.map +1 -0
  93. package/dist/onboard/seeders/agent-review-config.js +38 -0
  94. package/dist/onboard/seeders/agent-review-config.js.map +1 -0
  95. package/dist/onboard/seeders/cycle1-bootstrap.d.ts +3 -0
  96. package/dist/onboard/seeders/cycle1-bootstrap.d.ts.map +1 -0
  97. package/dist/onboard/seeders/cycle1-bootstrap.js +76 -0
  98. package/dist/onboard/seeders/cycle1-bootstrap.js.map +1 -0
  99. package/dist/onboard/seeders/index.d.ts +47 -0
  100. package/dist/onboard/seeders/index.d.ts.map +1 -0
  101. package/dist/onboard/seeders/index.js +37 -0
  102. package/dist/onboard/seeders/index.js.map +1 -0
  103. package/dist/onboard/seeders/runbook.d.ts +13 -0
  104. package/dist/onboard/seeders/runbook.d.ts.map +1 -0
  105. package/dist/onboard/seeders/runbook.js +85 -0
  106. package/dist/onboard/seeders/runbook.js.map +1 -0
  107. package/dist/onboard/seeders/templates/adr.md.tmpl +26 -0
  108. package/dist/onboard/seeders/templates/cycle1-bootstrap.md.tmpl +64 -0
  109. package/dist/onboard/seeders/templates/runbook.md.tmpl +26 -0
  110. package/dist/onboard/template-loader.d.ts +20 -0
  111. package/dist/onboard/template-loader.d.ts.map +1 -0
  112. package/dist/onboard/template-loader.js +143 -0
  113. package/dist/onboard/template-loader.js.map +1 -0
  114. package/dist/onboard/template-ref.d.ts +15 -0
  115. package/dist/onboard/template-ref.d.ts.map +1 -0
  116. package/dist/onboard/template-ref.js +45 -0
  117. package/dist/onboard/template-ref.js.map +1 -0
  118. package/dist/onboard/validate.d.ts +19 -0
  119. package/dist/onboard/validate.d.ts.map +1 -0
  120. package/dist/onboard/validate.js +127 -0
  121. package/dist/onboard/validate.js.map +1 -0
  122. package/dist/onboard/writers/dry-run-renderer.d.ts +6 -0
  123. package/dist/onboard/writers/dry-run-renderer.d.ts.map +1 -0
  124. package/dist/onboard/writers/dry-run-renderer.js +88 -0
  125. package/dist/onboard/writers/dry-run-renderer.js.map +1 -0
  126. package/dist/onboard/writers/emit.d.ts +6 -0
  127. package/dist/onboard/writers/emit.d.ts.map +1 -0
  128. package/dist/onboard/writers/emit.js +29 -0
  129. package/dist/onboard/writers/emit.js.map +1 -0
  130. package/dist/onboard/writers/merge.d.ts +16 -0
  131. package/dist/onboard/writers/merge.d.ts.map +1 -0
  132. package/dist/onboard/writers/merge.js +142 -0
  133. package/dist/onboard/writers/merge.js.map +1 -0
  134. package/dist/onboard/writers/pr-writer.d.ts +44 -0
  135. package/dist/onboard/writers/pr-writer.d.ts.map +1 -0
  136. package/dist/onboard/writers/pr-writer.js +104 -0
  137. package/dist/onboard/writers/pr-writer.js.map +1 -0
  138. package/dist/onboard/writers/skip.d.ts +9 -0
  139. package/dist/onboard/writers/skip.d.ts.map +1 -0
  140. package/dist/onboard/writers/skip.js +9 -0
  141. package/dist/onboard/writers/skip.js.map +1 -0
  142. package/package.json +8 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/onboard/schema.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,+DAA+D;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AAEvD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC;QACf,YAAY;QACZ,YAAY;QACZ,QAAQ;QACR,IAAI;QACJ,MAAM;QACN,MAAM;QACN,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,OAAO;KACR,CAAC;IACF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MA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E;KAC9B,CAAC;IACF,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1C,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Seeder } from "./index.js";
2
+ export declare const adrSeeder: Seeder;
3
+ //# sourceMappingURL=adr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/adr.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAY,MAAM,EAAe,MAAM,YAAY,CAAC;AAmKhE,eAAO,MAAM,SAAS,EAAE,MAkEvB,CAAC"}
@@ -0,0 +1,212 @@
1
+ // packages/cli/src/onboard/seeders/adr.ts
2
+ //
3
+ // ADR seeder — cycle 15 Phase C Task 1.
4
+ //
5
+ // Per-decision deterministic ADR renderer. Consumes the Phase A `RepoAnalysis`
6
+ // `decisions[]` array and emits one ADR markdown file per entry. Filename:
7
+ // `docs/ADR/YYYY-NN-<slug>.md` (per cycle 15 Phase C plan Decision #2):
8
+ // - YYYY: current year (from injected `now`).
9
+ // - NN: auto-incremented from the highest existing ADR with the same year
10
+ // prefix under `docs/ADR/`. Empty target → 01.
11
+ // - <slug>: kebab-cased decision title.
12
+ //
13
+ // Slug collision (same year, same slug already present) → skip entry with
14
+ // `adr_already_exists` rationale (no overwrite). Per-surface rationale +
15
+ // consequences are interpolated from typed bindings.
16
+ //
17
+ // NO LLM here — pure string templating against the Stage A facts. The maintainer
18
+ // expands each rendered ADR by hand after Phase C apply.
19
+ import { readFile } from "node:fs/promises";
20
+ import { fileURLToPath } from "node:url";
21
+ import { dirname, resolve } from "node:path";
22
+ const HERE = dirname(fileURLToPath(import.meta.url));
23
+ // Templates live under `templates/` (plan-aligned). All three prose seeders
24
+ // (adr, cycle1-bootstrap, runbook) share that convention so copy-assets needs
25
+ // to whitelist only one extension+directory pattern at publish time.
26
+ const TEMPLATE_PATH = resolve(HERE, "templates", "adr.md.tmpl");
27
+ const RATIONALE_TEMPLATES = {
28
+ "test-framework": "This repo uses {test_runner_name} (pinned at {test_runner_version} per {evidence_path}) as the test framework. " +
29
+ "New tests should be written against {test_runner_name}'s API; integration tests follow the same harness convention.",
30
+ "deploy-target": "This repo deploys via {target_name} ({command}, configured in {workflow_path}). " +
31
+ "New deploy-affecting changes update the {target_name} configuration; agents should NOT introduce parallel deploy mechanisms.",
32
+ "auth-model": "This repo authenticates users via {auth_provider_name} (per direct dependency surfaced in {evidence_path}). " +
33
+ "New auth-touching code defers to the provider's SDK; do not roll custom auth.",
34
+ stack: "This repo's stack includes {framework_name} (surfaced in {evidence_path}). " +
35
+ "New code follows {framework_name}'s conventions; framework-mismatched code is rejected by the critic.",
36
+ "ci-platform": "CI runs on GitHub Actions ({workflow_count} workflows under .github/workflows/). " +
37
+ "Changes to CI behavior land in the same workflow set; do not introduce a parallel CI substrate.",
38
+ other: "This decision was surfaced from the deterministic repo analysis. See the cited evidence file for the original signal; " +
39
+ "the ADR's prose is a starting point for the maintainer to expand.",
40
+ };
41
+ function slugify(title) {
42
+ return title
43
+ .toLowerCase()
44
+ .replace(/[^a-z0-9]+/g, "-")
45
+ .replace(/^-+|-+$/g, "")
46
+ .slice(0, 60);
47
+ }
48
+ function highestExistingNN(year, existingAdrs) {
49
+ const prefix = `${year}-`;
50
+ let max = 0;
51
+ for (const name of existingAdrs) {
52
+ if (!name.startsWith(prefix))
53
+ continue;
54
+ const nn = parseInt(name.slice(prefix.length, prefix.length + 2), 10);
55
+ if (Number.isInteger(nn) && nn > max)
56
+ max = nn;
57
+ }
58
+ return max;
59
+ }
60
+ function existingSlugs(year, existingAdrs) {
61
+ const prefix = `${year}-`;
62
+ const slugs = new Set();
63
+ for (const name of existingAdrs) {
64
+ if (!name.startsWith(prefix))
65
+ continue;
66
+ // Strip "YYYY-NN-" (8 chars) and the trailing ".md" if present.
67
+ const rest = name.slice(prefix.length + 3);
68
+ const slug = rest.endsWith(".md") ? rest.slice(0, -3) : rest;
69
+ if (slug.length > 0)
70
+ slugs.add(slug);
71
+ }
72
+ return slugs;
73
+ }
74
+ function applyTemplate(template, bindings) {
75
+ return template.replace(/\{([a-z_]+)\}/g, (full, k) => Object.prototype.hasOwnProperty.call(bindings, k) ? bindings[k] : full);
76
+ }
77
+ function bindRationale(d, analysis) {
78
+ const evidence_path = d.evidence[0] ?? "(unknown)";
79
+ switch (d.surface) {
80
+ case "test-framework": {
81
+ // Find the matching dep entry — first dep whose name appears in the title.
82
+ const dep = analysis.dependencies.find((dep) => d.title.toLowerCase().includes(dep.name.toLowerCase()));
83
+ const test_runner_name = dep?.name ?? d.title.split(" ")[0] ?? "the test framework";
84
+ const test_runner_version = dep?.version ?? "(unpinned)";
85
+ return { test_runner_name, test_runner_version, evidence_path };
86
+ }
87
+ case "deploy-target": {
88
+ const ds = analysis.ci.deployStory;
89
+ return {
90
+ target_name: ds?.target ?? "the deploy target",
91
+ command: ds?.command ?? "(see workflow)",
92
+ workflow_path: ds?.workflowPath ?? evidence_path,
93
+ };
94
+ }
95
+ case "auth-model": {
96
+ const dep = analysis.dependencies.find((dep) => d.title.toLowerCase().includes(dep.name.toLowerCase()));
97
+ return { auth_provider_name: dep?.name ?? "the auth provider", evidence_path };
98
+ }
99
+ case "stack": {
100
+ const dep = analysis.dependencies.find((dep) => d.title.toLowerCase().includes(dep.name.toLowerCase()));
101
+ return { framework_name: dep?.name ?? d.title, evidence_path };
102
+ }
103
+ case "ci-platform":
104
+ return {
105
+ workflow_count: String(analysis.ci.workflows.length),
106
+ evidence_path,
107
+ };
108
+ case "other":
109
+ return { evidence_path };
110
+ }
111
+ }
112
+ function bindConsequences(d, analysis) {
113
+ switch (d.surface) {
114
+ case "test-framework": {
115
+ const dep = analysis.dependencies.find((dep) => d.title.toLowerCase().includes(dep.name.toLowerCase()));
116
+ if (!dep)
117
+ return "Future changes to the test-framework choice require a new ADR superseding this one.";
118
+ return (`Repo is pinned to \`${dep.name}@${dep.version}\`; future ${dep.name} upgrades change test-runner semantics ` +
119
+ `(verify CI green on a representative PR before bumping). Cross-stack repos should add per-stack ADRs.`);
120
+ }
121
+ case "deploy-target":
122
+ return ("Deploys are constrained to this target. Switching to a different deploy target (e.g. moving from Helm to Cloud Run) " +
123
+ "requires a new ADR superseding this one, plus a CI workflow migration.");
124
+ case "auth-model":
125
+ return ("Auth-touching code is constrained to this provider's SDK. Changing providers requires a new ADR, a migration plan, " +
126
+ "and a security review.");
127
+ case "stack":
128
+ return ("Stack choice constrains the framework conventions new code follows. The critic enforces stack-consistent patterns; " +
129
+ "introducing a parallel stack requires an ADR and a clear boundary.");
130
+ case "ci-platform":
131
+ return ("CI substrate is fixed. New automation lands in the existing workflow set; introducing a parallel CI " +
132
+ "(e.g. Buildkite alongside Actions) requires an ADR.");
133
+ case "other":
134
+ return "The maintainer should expand this section with the concrete trade-offs and follow-up work this decision implies.";
135
+ }
136
+ }
137
+ function surfaceToScope(surface) {
138
+ switch (surface) {
139
+ case "test-framework":
140
+ return "Test framework choice";
141
+ case "deploy-target":
142
+ return "Deploy target";
143
+ case "auth-model":
144
+ return "Auth model";
145
+ case "stack":
146
+ return "Stack choice";
147
+ case "ci-platform":
148
+ return "CI platform";
149
+ case "other":
150
+ return "Repo-specific decision";
151
+ }
152
+ }
153
+ export const adrSeeder = {
154
+ name: "adr",
155
+ async seed(input) {
156
+ const { analysis, existingAdrs, now } = input;
157
+ if (analysis.decisions.length === 0)
158
+ return [];
159
+ const year = now.getUTCFullYear();
160
+ const date = now.toISOString().slice(0, 10);
161
+ const template = await readFile(TEMPLATE_PATH, "utf8");
162
+ let nn = highestExistingNN(year, existingAdrs);
163
+ const slugsTaken = existingSlugs(year, existingAdrs);
164
+ const deciders = analysis.canonicalName.includes("/")
165
+ ? `@${analysis.canonicalName.split("/")[0]}-maintainers (TBD)`
166
+ : "TBD";
167
+ const out = [];
168
+ for (const decision of analysis.decisions) {
169
+ const slug = slugify(decision.title);
170
+ if (slugsTaken.has(slug)) {
171
+ // SkipFilePlan is .strict() in scaffold-schema and rejects tailored_content
172
+ // (Phase B plan Decision: emit/merge require it, skip rejects it).
173
+ out.push({
174
+ path: `docs/ADR/${year}-${String(nn + 1).padStart(2, "0")}-${slug}.md`,
175
+ action: "skip",
176
+ rationale: `adr_already_exists: docs/ADR/<NN>-${slug}.md already present for ${year}; not overwriting.`,
177
+ });
178
+ continue;
179
+ }
180
+ nn += 1;
181
+ slugsTaken.add(slug);
182
+ const filename = `${year}-${String(nn).padStart(2, "0")}-${slug}.md`;
183
+ const rationaleTemplate = RATIONALE_TEMPLATES[decision.surface];
184
+ const rationaleBindings = bindRationale(decision, analysis);
185
+ const rationale = applyTemplate(rationaleTemplate, rationaleBindings);
186
+ const evidence_bullets = decision.evidence.length > 0
187
+ ? decision.evidence.map((p) => `- \`${p}\``).join("\n")
188
+ : "- (no evidence files recorded — see the maintainer note below)";
189
+ const scope = surfaceToScope(decision.surface);
190
+ const body = applyTemplate(template, {
191
+ year: String(year),
192
+ nn: String(nn).padStart(2, "0"),
193
+ title: decision.title,
194
+ date,
195
+ deciders,
196
+ scope,
197
+ repo_root: analysis.repoRoot,
198
+ evidence_bullets,
199
+ rationale,
200
+ consequences: bindConsequences(decision, analysis),
201
+ });
202
+ out.push({
203
+ path: `docs/ADR/${filename}`,
204
+ action: "emit",
205
+ rationale: `Seeded from RepoAnalysis.decisions[] surface=${decision.surface}`,
206
+ tailored_content: body,
207
+ });
208
+ }
209
+ return out;
210
+ },
211
+ };
212
+ //# sourceMappingURL=adr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr.js","sourceRoot":"","sources":["../../../src/onboard/seeders/adr.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,wCAAwC;AACxC,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,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,EAAE,iBAAiB,CAAC,CAAC;YAEtE,MAAM,gBAAgB,GACpB,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAC1B,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvD,CAAC,CAAC,gEAAgE,CAAC;YAEvE,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE/C,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE;gBACnC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;gBAClB,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;gBAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,IAAI;gBACJ,QAAQ;gBACR,KAAK;gBACL,SAAS,EAAE,QAAQ,CAAC,QAAQ;gBAC5B,gBAAgB;gBAChB,SAAS;gBACT,YAAY,EAAE,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC;aACnD,CAAC,CAAC;YAEH,GAAG,CAAC,IAAI,CAAC;gBACP,IAAI,EAAE,YAAY,QAAQ,EAAE;gBAC5B,MAAM,EAAE,MAAM;gBACd,SAAS,EAAE,gDAAgD,QAAQ,CAAC,OAAO,EAAE;gBAC7E,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAC"}
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": 2,
3
+ "profiles": {
4
+ "cloud": {
5
+ "criticIds": [
6
+ "cursor-local-chief-engineer",
7
+ "codex-local-chief-engineer",
8
+ "gemini-local-chief-engineer",
9
+ "grok-local-chief-engineer"
10
+ ],
11
+ "quorum": 3,
12
+ "modelParamOverrides": {
13
+ "codex-local-chief-engineer": {
14
+ "reasoning_effort": "medium"
15
+ }
16
+ },
17
+ "auth": {
18
+ "codex-local-chief-engineer": "api"
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 2,
3
+ "profiles": {
4
+ "local": {
5
+ "criticIds": [
6
+ "cursor-cli-chief-engineer",
7
+ "codex-local-chief-engineer"
8
+ ],
9
+ "quorum": 2,
10
+ "modelParamOverrides": {
11
+ "codex-local-chief-engineer": {
12
+ "reasoning_effort": "high"
13
+ }
14
+ },
15
+ "auth": {
16
+ "cursor-cli-chief-engineer": "chatgpt",
17
+ "codex-local-chief-engineer": "chatgpt"
18
+ }
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ import type { Seeder } from "./index.js";
2
+ export declare const agentReviewConfigSeeder: Seeder;
3
+ //# sourceMappingURL=agent-review-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-review-config.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/agent-review-config.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,YAAY,CAAC;AAQtD,eAAO,MAAM,uBAAuB,EAAE,MAgBrC,CAAC"}
@@ -0,0 +1,38 @@
1
+ // packages/cli/src/onboard/seeders/agent-review-config.ts
2
+ //
3
+ // 4th Phase C deterministic seeder. Owns the emission of
4
+ // `.agent-review/config.json` as a `FilePlan` entry. Per the cross-phase
5
+ // contract (Phase C plan Task 3.6 / Phase B PR #134 reconciliation),
6
+ // Phase B's LLM scaffold SKIPS this path unconditionally; this seeder is
7
+ // the single producer.
8
+ //
9
+ // The canonical JSON bodies live as production files under
10
+ // `./agent-review-config/{local,cloud}.canonical.json` — they ship inside
11
+ // the published npm package (covered by packages/cli/package.json's
12
+ // `files: ["src/**", ...]` entry). The seeder readFile's them at runtime;
13
+ // the test `readFile`s the same production path so tests reference what
14
+ // actually ships. One source of truth per profile.
15
+ import { readFile } from "node:fs/promises";
16
+ import { fileURLToPath } from "node:url";
17
+ import { dirname, join } from "node:path";
18
+ const CANONICAL_DIR = join(dirname(fileURLToPath(import.meta.url)), "agent-review-config");
19
+ async function loadCanonical(profile) {
20
+ return readFile(join(CANONICAL_DIR, `${profile}.canonical.json`), "utf8");
21
+ }
22
+ export const agentReviewConfigSeeder = {
23
+ name: "agent-review-config",
24
+ async seed(input) {
25
+ const profile = input.profile ?? "local";
26
+ const body = await loadCanonical(profile);
27
+ return [
28
+ {
29
+ path: ".agent-review/config.json",
30
+ action: "emit",
31
+ rationale: `agent-review config emitted for profile=${profile} (cycle 15 D3 row 5 / D7). ` +
32
+ `Phase C deterministic seeder; Phase B does NOT emit this path (cross-phase contract).`,
33
+ tailored_content: body,
34
+ },
35
+ ];
36
+ },
37
+ };
38
+ //# sourceMappingURL=agent-review-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-review-config.js","sourceRoot":"","sources":["../../../src/onboard/seeders/agent-review-config.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,yDAAyD;AACzD,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,uBAAuB;AACvB,EAAE;AACF,2DAA2D;AAC3D,0EAA0E;AAC1E,oEAAoE;AACpE,0EAA0E;AAC1E,wEAAwE;AACxE,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAK1C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAE3F,KAAK,UAAU,aAAa,CAAC,OAA0B;IACrD,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,OAAO,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAW;IAC7C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,CAAC,IAAI,CAAC,KAAkB;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO;YACL;gBACE,IAAI,EAAE,2BAA2B;gBACjC,MAAM,EAAE,MAAM;gBACd,SAAS,EACP,2CAA2C,OAAO,6BAA6B;oBAC/E,uFAAuF;gBACzF,gBAAgB,EAAE,IAAI;aACvB;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Seeder } from "./index.js";
2
+ export declare const cycle1BootstrapSeeder: Seeder;
3
+ //# sourceMappingURL=cycle1-bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cycle1-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/cycle1-bootstrap.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAY,MAAM,EAAe,MAAM,YAAY,CAAC;AAwBhE,eAAO,MAAM,qBAAqB,EAAE,MA2DnC,CAAC"}
@@ -0,0 +1,76 @@
1
+ // packages/cli/src/onboard/seeders/cycle1-bootstrap.ts
2
+ import { readFile } from "node:fs/promises";
3
+ import { basename, dirname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const HERE = dirname(fileURLToPath(import.meta.url));
6
+ const TEMPLATE_PATH = resolve(HERE, "templates", "cycle1-bootstrap.md.tmpl");
7
+ function applyTemplate(template, bindings) {
8
+ return template.replace(/\{([a-z_]+)\}/g, (full, k) => bindings[k] ?? full);
9
+ }
10
+ function repoName(analysis) {
11
+ if (analysis.canonicalName.includes("/")) {
12
+ return analysis.canonicalName.split("/")[1] ?? "unnamed-repo";
13
+ }
14
+ const b = basename(analysis.repoRoot);
15
+ return b || "unnamed-repo";
16
+ }
17
+ function repoOwner(analysis) {
18
+ if (analysis.canonicalName.includes("/")) {
19
+ return analysis.canonicalName.split("/")[0] ?? "tbd";
20
+ }
21
+ return "tbd";
22
+ }
23
+ export const cycle1BootstrapSeeder = {
24
+ name: "cycle1-bootstrap",
25
+ async seed(input) {
26
+ const { analysis, now } = input;
27
+ const template = await readFile(TEMPLATE_PATH, "utf8");
28
+ const name = repoName(analysis);
29
+ const owner = repoOwner(analysis);
30
+ const date = now.toISOString().slice(0, 10);
31
+ const stack_bullets = analysis.stacks.length > 0
32
+ ? analysis.stacks
33
+ .map((s) => `- **${s.language}** @ ${s.versionPin ?? "(unpinned)"} (\`${s.manifestPath}\`)`)
34
+ .join("\n")
35
+ : "- (no manifest-declared stacks detected — likely a docs-only or shell-script repo)";
36
+ const services_bullets = analysis.services.length > 0
37
+ ? analysis.services
38
+ .map((s) => `- **${s.name}** at \`${s.path}\`${s.stack ? ` (${s.stack})` : ""}`)
39
+ .join("\n")
40
+ : "- (no services/ or apps/ directory — single-package repo)";
41
+ const deploy_story_body = analysis.ci.deployStory
42
+ ? `Deploys via **${analysis.ci.deployStory.target}** from \`${analysis.ci.deployStory.workflowPath}\`:\n\n` +
43
+ "```\n" + analysis.ci.deployStory.command + "\n```\n\n" +
44
+ "See the seeded runbook at `docs/runbooks/deploy.md` for the operational walk-through."
45
+ : "(no deploy workflow detected — add one before standing up CD)";
46
+ const present = (b) => (b ? "present" : "missing");
47
+ const df_presence_body = [
48
+ `- \`.husky/\` hooks: **${present(analysis.dfPresence.hooks)}**`,
49
+ `- \`.agent-review/config.json\`: **${present(analysis.dfPresence.configJson)}**`,
50
+ `- \`dark-factory-pr.yml\` workflow: **${present(analysis.dfPresence.prWorkflow)}**`,
51
+ `- \`@momentiq/dark-factory-cli\` pin: ${analysis.dfPresence.cliPin ? `**${analysis.dfPresence.cliPin}**` : "**unset**"}`,
52
+ ].join("\n");
53
+ const agent_context_body = analysis.docs.agentContextSetPresent
54
+ ? "Already present — `df onboard` will only fill gaps, not overwrite existing files."
55
+ : "**MISSING** — `df onboard` is producing the initial set as part of this cycle. " +
56
+ "See the ADRs seeded under `docs/ADR/` for the per-decision context.";
57
+ const body = applyTemplate(template, {
58
+ repo_name: name,
59
+ canonical_name: analysis.canonicalName || `(unknown)/${name}`,
60
+ owner,
61
+ date,
62
+ stack_bullets,
63
+ services_bullets,
64
+ deploy_story_body,
65
+ df_presence_body,
66
+ agent_context_body,
67
+ });
68
+ return [{
69
+ path: `docs/roadmap/cycles/cycle1-${name}-bootstrap.md`,
70
+ action: "emit",
71
+ rationale: "Seeded from RepoAnalysis (services + stacks + deploy story + DF posture)",
72
+ tailored_content: body,
73
+ }];
74
+ },
75
+ };
76
+ //# sourceMappingURL=cycle1-bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cycle1-bootstrap.js","sourceRoot":"","sources":["../../../src/onboard/seeders/cycle1-bootstrap.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,0BAA0B,CAAC,CAAC;AAE7E,SAAS,aAAa,CAAC,QAAgB,EAAE,QAAgC;IACvE,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,QAAsB;IACtC,IAAI,QAAQ,CAAC,aA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WAAW,EAAE;SAC1H,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB;YAC7D,CAAC,CAAC,mFAAmF;YACrF,CAAC,CAAC,iFAAiF;gBACjF,qEAAqE,CAAC;QAE1E,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE;YACnC,SAAS,EAAE,IAAI;YACf,cAAc,EAAE,QAAQ,CAAC,aAAa,IAAI,aAAa,IAAI,EAAE;YAC7D,KAAK;YACL,IAAI;YACJ,aAAa;YACb,gBAAgB;YAChB,iBAAiB;YACjB,gBAAgB;YAChB,kBAAkB;SACnB,CAAC,CAAC;QAEH,OAAO,CAAC;gBACN,IAAI,EAAE,8BAA8B,IAAI,eAAe;gBACvD,MAAM,EAAE,MAAM;gBACd,SAAS,EAAE,0EAA0E;gBACrF,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { FilePlan } from "../scaffold-schema.js";
2
+ import type { RepoAnalysis } from "../schema.js";
3
+ export type { FilePlan } from "../scaffold-schema.js";
4
+ /**
5
+ * Input to a Phase C seeder.
6
+ *
7
+ * - `analysis`: the Phase A `RepoAnalysis` (the deterministic source of truth).
8
+ * - `existingAdrs` / `existingCycleDocs` / `existingRunbooks`: filenames
9
+ * already present in the target tree (basenames, not full paths). Used by
10
+ * seeders to auto-increment numeric prefixes and skip on slug collision.
11
+ * `cmdOnboard` populates these by scanning the target tree before fan-out.
12
+ * - `now`: a wallclock injected so tests can pin the date deterministically.
13
+ * - `profile`: resolved critic profile for the target repo (the
14
+ * `agent-review-config` seeder uses this to pick `local.canonical.json`
15
+ * vs `cloud.canonical.json`). Optional with default "local" so the prose
16
+ * seeders' unit tests need not specify the field; production callers
17
+ * (`cmdOnboard`) always set it explicitly to the resolved profile.
18
+ */
19
+ export interface SeederInput {
20
+ readonly analysis: RepoAnalysis;
21
+ readonly existingAdrs: readonly string[];
22
+ readonly existingCycleDocs?: readonly string[];
23
+ readonly existingRunbooks?: readonly string[];
24
+ readonly now: Date;
25
+ readonly profile?: "local" | "cloud";
26
+ }
27
+ export interface Seeder {
28
+ readonly name: string;
29
+ seed(input: SeederInput): Promise<FilePlan[]>;
30
+ }
31
+ /**
32
+ * Run every seeder in parallel, isolating individual failures to stderr so a
33
+ * single broken seeder does NOT block the rest of the merge. Phase C seeders
34
+ * are non-critical (their outputs augment Phase B's plan) — the orchestrator
35
+ * resolves to `[]` for any seeder that throws and concatenates the survivors.
36
+ */
37
+ export declare function runSeeders(input: SeederInput, seeders: readonly Seeder[]): Promise<FilePlan[]>;
38
+ export { adrSeeder } from "./adr.js";
39
+ export { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
40
+ export { runbookSeeder } from "./runbook.js";
41
+ export { agentReviewConfigSeeder } from "./agent-review-config.js";
42
+ /**
43
+ * The canonical seeder set wired into `cmdOnboard` (Task 4.5). Order is
44
+ * presentation-only — `runSeeders` runs them concurrently.
45
+ */
46
+ export declare const ALL_SEEDERS_DEFAULT: readonly Seeder[];
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAKhD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { adrSeeder } from "./adr.js";
2
+ import { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
3
+ import { runbookSeeder } from "./runbook.js";
4
+ import { agentReviewConfigSeeder } from "./agent-review-config.js";
5
+ /**
6
+ * Run every seeder in parallel, isolating individual failures to stderr so a
7
+ * single broken seeder does NOT block the rest of the merge. Phase C seeders
8
+ * are non-critical (their outputs augment Phase B's plan) — the orchestrator
9
+ * resolves to `[]` for any seeder that throws and concatenates the survivors.
10
+ */
11
+ export async function runSeeders(input, seeders) {
12
+ const results = await Promise.all(seeders.map(async (s) => {
13
+ try {
14
+ return await s.seed(input);
15
+ }
16
+ catch (e) {
17
+ process.stderr.write(`df onboard seeder ${s.name} failed: ${e instanceof Error ? e.message : String(e)}\n`);
18
+ return [];
19
+ }
20
+ }));
21
+ return results.flat();
22
+ }
23
+ export { adrSeeder } from "./adr.js";
24
+ export { cycle1BootstrapSeeder } from "./cycle1-bootstrap.js";
25
+ export { runbookSeeder } from "./runbook.js";
26
+ export { agentReviewConfigSeeder } from "./agent-review-config.js";
27
+ /**
28
+ * The canonical seeder set wired into `cmdOnboard` (Task 4.5). Order is
29
+ * presentation-only — `runSeeders` runs them concurrently.
30
+ */
31
+ export const ALL_SEEDERS_DEFAULT = [
32
+ adrSeeder,
33
+ cycle1BootstrapSeeder,
34
+ runbookSeeder,
35
+ agentReviewConfigSeeder,
36
+ ];
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/onboard/seeders/index.ts"],"names":[],"mappings":"AAiBA,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;AAiCnE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,KAAkB,EAClB,OAA0B;IAE1B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,CAAC,CAAC,IAAI,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACtF,CAAC;YACF,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC;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;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,SAAS;IACT,qBAAqB;IACrB,aAAa;IACb,uBAAuB;CACxB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { FilePlan } from "../scaffold-schema.js";
2
+ import type { RepoAnalysis } from "../schema.js";
3
+ export interface SeederInput {
4
+ analysis: RepoAnalysis;
5
+ existingAdrs: string[];
6
+ now: Date;
7
+ }
8
+ export interface Seeder {
9
+ name: string;
10
+ seed(input: SeederInput): Promise<FilePlan[]>;
11
+ }
12
+ export declare const runbookSeeder: Seeder;
13
+ //# sourceMappingURL=runbook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runbook.d.ts","sourceRoot":"","sources":["../../../src/onboard/seeders/runbook.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,GAAG,EAAE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CAC/C;AAqBD,eAAO,MAAM,aAAa,EAAE,MA4D3B,CAAC"}
@@ -0,0 +1,85 @@
1
+ // packages/cli/src/onboard/seeders/runbook.ts
2
+ //
3
+ // Runbook seeder — cycle 15 Phase C Task 3.
4
+ //
5
+ // Deterministic emitter that produces `docs/runbooks/RUNBOOK-<workflow>.md`
6
+ // files per deploy-pattern CI workflow detected in `analysis.ci.workflows[]`,
7
+ // capped at MAX_RUNBOOKS total. The workflow that produced
8
+ // `analysis.ci.deployStory` gets the verbatim deploy command rendered into
9
+ // its Triggering section (Phase C exit criterion 3 — at least one runbook
10
+ // body contains a verbatim line from a CI workflow's `run:`).
11
+ //
12
+ // `Seeder` / `SeederInput` are declared inline here for Task 3 self-
13
+ // containment; Task 3.5 (seeder orchestrator) will surface them from
14
+ // `./index.ts` and the seeders will import them from there.
15
+ import { readFile } from "node:fs/promises";
16
+ import { dirname, resolve } from "node:path";
17
+ import { fileURLToPath } from "node:url";
18
+ const HERE = dirname(fileURLToPath(import.meta.url));
19
+ // Templates live under `templates/` (plan-aligned, shared with adr + cycle1-bootstrap).
20
+ const TEMPLATE_PATH = resolve(HERE, "templates", "runbook.md.tmpl");
21
+ const DEPLOY_NAME_REGEX = /deploy|release|publish|promote/i;
22
+ const MAX_RUNBOOKS = 5;
23
+ function slugify(s) {
24
+ return s
25
+ .toLowerCase()
26
+ .replace(/[^a-z0-9]+/g, "-")
27
+ .replace(/^-+|-+$/g, "")
28
+ .slice(0, 60);
29
+ }
30
+ function applyTemplate(template, bindings) {
31
+ return template.replace(/\{([a-z_]+)\}/g, (full, k) => bindings[k] ?? full);
32
+ }
33
+ export const runbookSeeder = {
34
+ name: "runbook",
35
+ async seed(input) {
36
+ const { analysis } = input;
37
+ const matching = analysis.ci.workflows.filter((w) => DEPLOY_NAME_REGEX.test(w.name));
38
+ if (matching.length === 0)
39
+ return [];
40
+ const template = await readFile(TEMPLATE_PATH, "utf8");
41
+ const capped = matching.slice(0, MAX_RUNBOOKS);
42
+ const out = [];
43
+ const seenSlugs = new Set();
44
+ for (const w of capped) {
45
+ const slug = slugify(w.name);
46
+ if (seenSlugs.has(slug))
47
+ continue;
48
+ seenSlugs.add(slug);
49
+ const isPrimaryDeploy = analysis.ci.deployStory?.workflowPath === w.path;
50
+ const triggers_note = w.triggers.length > 0
51
+ ? ` — triggered by \`${w.triggers.join("\`, \`")}\``
52
+ : "";
53
+ const triggering_body = isPrimaryDeploy && analysis.ci.deployStory
54
+ ? `The workflow runs the following command (captured verbatim from \`${w.path}\`):\n\n` +
55
+ "```\n" + analysis.ci.deployStory.command + "\n```\n\n" +
56
+ "To trigger manually outside the workflow's normal triggers, use `gh workflow run`."
57
+ : `See the workflow file at \`${w.path}\` for the trigger conditions and steps. ` +
58
+ "Manual trigger: `gh workflow run`.";
59
+ const verifying_body = "After the workflow completes, verify:\n\n" +
60
+ "- Workflow run status is success (`gh run list --workflow=" + w.path + " --limit=1`).\n" +
61
+ "- The deployed surface responds (smoke-test the user-facing endpoint).\n" +
62
+ "- No alert sources have fired (link the dashboard here once it exists).";
63
+ const rollback_body = "Rollback path (TODO: confirm this with the on-call rotation):\n\n" +
64
+ "1. Identify the previous successful run's SHA: `gh run list --workflow=" + w.path + " --status=success --limit=2`.\n" +
65
+ "2. Trigger this workflow against that SHA via `gh workflow run " + w.path + " --ref <sha>` (or the equivalent ref).\n" +
66
+ "3. Confirm the rollback via the Verifying section above.";
67
+ const body = applyTemplate(template, {
68
+ workflow_name: w.name,
69
+ workflow_path: w.path,
70
+ workflow_triggers_note: triggers_note,
71
+ triggering_body,
72
+ verifying_body,
73
+ rollback_body,
74
+ });
75
+ out.push({
76
+ path: `docs/runbooks/RUNBOOK-${slug}.md`,
77
+ action: "emit",
78
+ rationale: `Seeded from CI workflow ${w.path} (matches deploy-pattern heuristic)`,
79
+ tailored_content: body,
80
+ });
81
+ }
82
+ return out;
83
+ },
84
+ };
85
+ //# sourceMappingURL=runbook.js.map