@momentiq/dark-factory-cli 2.1.0 → 2.2.1
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.
- package/dist/adapters/static-schema-lint.js +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/onboard.d.ts +64 -1
- package/dist/commands/onboard.d.ts.map +1 -1
- package/dist/commands/onboard.js +268 -53
- package/dist/commands/onboard.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +20 -0
- package/dist/doctor.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/onboard.d.ts +6 -0
- package/dist/mcp/tools/onboard.d.ts.map +1 -0
- package/dist/mcp/tools/onboard.js +115 -0
- package/dist/mcp/tools/onboard.js.map +1 -0
- package/dist/onboard/analyzers/ci.d.ts.map +1 -1
- package/dist/onboard/analyzers/ci.js +32 -0
- package/dist/onboard/analyzers/ci.js.map +1 -1
- package/dist/onboard/analyzers/lockfile.d.ts.map +1 -1
- package/dist/onboard/analyzers/lockfile.js +154 -74
- package/dist/onboard/analyzers/lockfile.js.map +1 -1
- package/dist/onboard/apply-plan.d.ts +29 -0
- package/dist/onboard/apply-plan.d.ts.map +1 -0
- package/dist/onboard/apply-plan.js +80 -0
- package/dist/onboard/apply-plan.js.map +1 -0
- package/dist/onboard/auto-profile.d.ts +3 -0
- package/dist/onboard/auto-profile.d.ts.map +1 -0
- package/dist/onboard/auto-profile.js +20 -0
- package/dist/onboard/auto-profile.js.map +1 -0
- package/dist/onboard/generate-plan.d.ts +18 -0
- package/dist/onboard/generate-plan.d.ts.map +1 -0
- package/dist/onboard/generate-plan.js +72 -0
- package/dist/onboard/generate-plan.js.map +1 -0
- package/dist/onboard/llm-client.d.ts +45 -0
- package/dist/onboard/llm-client.d.ts.map +1 -0
- package/dist/onboard/llm-client.js +101 -0
- package/dist/onboard/llm-client.js.map +1 -0
- package/dist/onboard/prompts/scaffold.md +93 -0
- package/dist/onboard/prompts.d.ts +13 -0
- package/dist/onboard/prompts.d.ts.map +1 -0
- package/dist/onboard/prompts.js +54 -0
- package/dist/onboard/prompts.js.map +1 -0
- package/dist/onboard/scaffold-schema.d.ts +194 -0
- package/dist/onboard/scaffold-schema.d.ts.map +1 -0
- package/dist/onboard/scaffold-schema.js +73 -0
- package/dist/onboard/scaffold-schema.js.map +1 -0
- package/dist/onboard/schema.d.ts +10 -0
- package/dist/onboard/schema.d.ts.map +1 -1
- package/dist/onboard/schema.js +23 -1
- package/dist/onboard/schema.js.map +1 -1
- package/dist/onboard/seeders/adr.d.ts +3 -0
- package/dist/onboard/seeders/adr.d.ts.map +1 -0
- package/dist/onboard/seeders/adr.js +212 -0
- package/dist/onboard/seeders/adr.js.map +1 -0
- package/dist/onboard/seeders/agent-review-config/cloud.canonical.json +22 -0
- package/dist/onboard/seeders/agent-review-config/local.canonical.json +21 -0
- package/dist/onboard/seeders/agent-review-config.d.ts +3 -0
- package/dist/onboard/seeders/agent-review-config.d.ts.map +1 -0
- package/dist/onboard/seeders/agent-review-config.js +38 -0
- package/dist/onboard/seeders/agent-review-config.js.map +1 -0
- package/dist/onboard/seeders/cycle1-bootstrap.d.ts +3 -0
- package/dist/onboard/seeders/cycle1-bootstrap.d.ts.map +1 -0
- package/dist/onboard/seeders/cycle1-bootstrap.js +76 -0
- package/dist/onboard/seeders/cycle1-bootstrap.js.map +1 -0
- package/dist/onboard/seeders/index.d.ts +47 -0
- package/dist/onboard/seeders/index.d.ts.map +1 -0
- package/dist/onboard/seeders/index.js +37 -0
- package/dist/onboard/seeders/index.js.map +1 -0
- package/dist/onboard/seeders/runbook.d.ts +13 -0
- package/dist/onboard/seeders/runbook.d.ts.map +1 -0
- package/dist/onboard/seeders/runbook.js +144 -0
- package/dist/onboard/seeders/runbook.js.map +1 -0
- package/dist/onboard/seeders/templates/adr.md.tmpl +26 -0
- package/dist/onboard/seeders/templates/cycle1-bootstrap.md.tmpl +64 -0
- package/dist/onboard/seeders/templates/runbook.md.tmpl +26 -0
- package/dist/onboard/template-loader.d.ts +20 -0
- package/dist/onboard/template-loader.d.ts.map +1 -0
- package/dist/onboard/template-loader.js +152 -0
- package/dist/onboard/template-loader.js.map +1 -0
- package/dist/onboard/template-ref.d.ts +15 -0
- package/dist/onboard/template-ref.d.ts.map +1 -0
- package/dist/onboard/template-ref.js +45 -0
- package/dist/onboard/template-ref.js.map +1 -0
- package/dist/onboard/validate.d.ts +19 -0
- package/dist/onboard/validate.d.ts.map +1 -0
- package/dist/onboard/validate.js +127 -0
- package/dist/onboard/validate.js.map +1 -0
- package/dist/onboard/writers/dry-run-renderer.d.ts +6 -0
- package/dist/onboard/writers/dry-run-renderer.d.ts.map +1 -0
- package/dist/onboard/writers/dry-run-renderer.js +88 -0
- package/dist/onboard/writers/dry-run-renderer.js.map +1 -0
- package/dist/onboard/writers/emit.d.ts +6 -0
- package/dist/onboard/writers/emit.d.ts.map +1 -0
- package/dist/onboard/writers/emit.js +29 -0
- package/dist/onboard/writers/emit.js.map +1 -0
- package/dist/onboard/writers/merge.d.ts +16 -0
- package/dist/onboard/writers/merge.d.ts.map +1 -0
- package/dist/onboard/writers/merge.js +142 -0
- package/dist/onboard/writers/merge.js.map +1 -0
- package/dist/onboard/writers/pr-writer.d.ts +44 -0
- package/dist/onboard/writers/pr-writer.d.ts.map +1 -0
- package/dist/onboard/writers/pr-writer.js +104 -0
- package/dist/onboard/writers/pr-writer.js.map +1 -0
- package/dist/onboard/writers/skip.d.ts +9 -0
- package/dist/onboard/writers/skip.d.ts.map +1 -0
- package/dist/onboard/writers/skip.js +9 -0
- package/dist/onboard/writers/skip.js.map +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SCAFFOLD_PLAN_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const SOURCE_ANALYSIS_SCHEMA_VERSION: 1;
|
|
4
|
+
export declare const SCAFFOLD_PLAN_BYTE_BUDGET = 64512;
|
|
5
|
+
export declare const FILE_PLAN_CONTENT_CAP = 16384;
|
|
6
|
+
export declare const SCAFFOLD_PLAN_FILES_CAP = 100;
|
|
7
|
+
export declare const SCAFFOLD_PLAN_SUMMARY_CAP = 800;
|
|
8
|
+
declare const EmitPlan: z.ZodObject<{
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
action: z.ZodLiteral<"emit">;
|
|
11
|
+
rationale: z.ZodString;
|
|
12
|
+
tailored_content: z.ZodString;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
path: string;
|
|
15
|
+
action: "emit";
|
|
16
|
+
rationale: string;
|
|
17
|
+
tailored_content: string;
|
|
18
|
+
}, {
|
|
19
|
+
path: string;
|
|
20
|
+
action: "emit";
|
|
21
|
+
rationale: string;
|
|
22
|
+
tailored_content: string;
|
|
23
|
+
}>;
|
|
24
|
+
declare const MergePlan: z.ZodObject<{
|
|
25
|
+
path: z.ZodString;
|
|
26
|
+
action: z.ZodLiteral<"merge">;
|
|
27
|
+
rationale: z.ZodString;
|
|
28
|
+
tailored_content: z.ZodString;
|
|
29
|
+
}, "strict", z.ZodTypeAny, {
|
|
30
|
+
path: string;
|
|
31
|
+
action: "merge";
|
|
32
|
+
rationale: string;
|
|
33
|
+
tailored_content: string;
|
|
34
|
+
}, {
|
|
35
|
+
path: string;
|
|
36
|
+
action: "merge";
|
|
37
|
+
rationale: string;
|
|
38
|
+
tailored_content: string;
|
|
39
|
+
}>;
|
|
40
|
+
declare const SkipPlan: z.ZodObject<{
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
action: z.ZodLiteral<"skip">;
|
|
43
|
+
rationale: z.ZodString;
|
|
44
|
+
}, "strict", z.ZodTypeAny, {
|
|
45
|
+
path: string;
|
|
46
|
+
action: "skip";
|
|
47
|
+
rationale: string;
|
|
48
|
+
}, {
|
|
49
|
+
path: string;
|
|
50
|
+
action: "skip";
|
|
51
|
+
rationale: string;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const FilePlanSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
54
|
+
path: z.ZodString;
|
|
55
|
+
action: z.ZodLiteral<"emit">;
|
|
56
|
+
rationale: z.ZodString;
|
|
57
|
+
tailored_content: z.ZodString;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
path: string;
|
|
60
|
+
action: "emit";
|
|
61
|
+
rationale: string;
|
|
62
|
+
tailored_content: string;
|
|
63
|
+
}, {
|
|
64
|
+
path: string;
|
|
65
|
+
action: "emit";
|
|
66
|
+
rationale: string;
|
|
67
|
+
tailored_content: string;
|
|
68
|
+
}>, z.ZodObject<{
|
|
69
|
+
path: z.ZodString;
|
|
70
|
+
action: z.ZodLiteral<"merge">;
|
|
71
|
+
rationale: z.ZodString;
|
|
72
|
+
tailored_content: z.ZodString;
|
|
73
|
+
}, "strict", z.ZodTypeAny, {
|
|
74
|
+
path: string;
|
|
75
|
+
action: "merge";
|
|
76
|
+
rationale: string;
|
|
77
|
+
tailored_content: string;
|
|
78
|
+
}, {
|
|
79
|
+
path: string;
|
|
80
|
+
action: "merge";
|
|
81
|
+
rationale: string;
|
|
82
|
+
tailored_content: string;
|
|
83
|
+
}>, z.ZodObject<{
|
|
84
|
+
path: z.ZodString;
|
|
85
|
+
action: z.ZodLiteral<"skip">;
|
|
86
|
+
rationale: z.ZodString;
|
|
87
|
+
}, "strict", z.ZodTypeAny, {
|
|
88
|
+
path: string;
|
|
89
|
+
action: "skip";
|
|
90
|
+
rationale: string;
|
|
91
|
+
}, {
|
|
92
|
+
path: string;
|
|
93
|
+
action: "skip";
|
|
94
|
+
rationale: string;
|
|
95
|
+
}>]>;
|
|
96
|
+
export declare const ScaffoldPlanSchema: z.ZodObject<{
|
|
97
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
98
|
+
sourceAnalysisSchemaVersion: z.ZodLiteral<1>;
|
|
99
|
+
templateRef: z.ZodEffects<z.ZodString, string, string>;
|
|
100
|
+
generatedAtIso: z.ZodString;
|
|
101
|
+
files: z.ZodArray<z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
102
|
+
path: z.ZodString;
|
|
103
|
+
action: z.ZodLiteral<"emit">;
|
|
104
|
+
rationale: z.ZodString;
|
|
105
|
+
tailored_content: z.ZodString;
|
|
106
|
+
}, "strict", z.ZodTypeAny, {
|
|
107
|
+
path: string;
|
|
108
|
+
action: "emit";
|
|
109
|
+
rationale: string;
|
|
110
|
+
tailored_content: string;
|
|
111
|
+
}, {
|
|
112
|
+
path: string;
|
|
113
|
+
action: "emit";
|
|
114
|
+
rationale: string;
|
|
115
|
+
tailored_content: string;
|
|
116
|
+
}>, z.ZodObject<{
|
|
117
|
+
path: z.ZodString;
|
|
118
|
+
action: z.ZodLiteral<"merge">;
|
|
119
|
+
rationale: z.ZodString;
|
|
120
|
+
tailored_content: z.ZodString;
|
|
121
|
+
}, "strict", z.ZodTypeAny, {
|
|
122
|
+
path: string;
|
|
123
|
+
action: "merge";
|
|
124
|
+
rationale: string;
|
|
125
|
+
tailored_content: string;
|
|
126
|
+
}, {
|
|
127
|
+
path: string;
|
|
128
|
+
action: "merge";
|
|
129
|
+
rationale: string;
|
|
130
|
+
tailored_content: string;
|
|
131
|
+
}>, z.ZodObject<{
|
|
132
|
+
path: z.ZodString;
|
|
133
|
+
action: z.ZodLiteral<"skip">;
|
|
134
|
+
rationale: z.ZodString;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
path: string;
|
|
137
|
+
action: "skip";
|
|
138
|
+
rationale: string;
|
|
139
|
+
}, {
|
|
140
|
+
path: string;
|
|
141
|
+
action: "skip";
|
|
142
|
+
rationale: string;
|
|
143
|
+
}>]>, "many">;
|
|
144
|
+
summary: z.ZodString;
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
146
|
+
schemaVersion: 1;
|
|
147
|
+
summary: string;
|
|
148
|
+
files: ({
|
|
149
|
+
path: string;
|
|
150
|
+
action: "emit";
|
|
151
|
+
rationale: string;
|
|
152
|
+
tailored_content: string;
|
|
153
|
+
} | {
|
|
154
|
+
path: string;
|
|
155
|
+
action: "merge";
|
|
156
|
+
rationale: string;
|
|
157
|
+
tailored_content: string;
|
|
158
|
+
} | {
|
|
159
|
+
path: string;
|
|
160
|
+
action: "skip";
|
|
161
|
+
rationale: string;
|
|
162
|
+
})[];
|
|
163
|
+
sourceAnalysisSchemaVersion: 1;
|
|
164
|
+
templateRef: string;
|
|
165
|
+
generatedAtIso: string;
|
|
166
|
+
}, {
|
|
167
|
+
schemaVersion: 1;
|
|
168
|
+
summary: string;
|
|
169
|
+
files: ({
|
|
170
|
+
path: string;
|
|
171
|
+
action: "emit";
|
|
172
|
+
rationale: string;
|
|
173
|
+
tailored_content: string;
|
|
174
|
+
} | {
|
|
175
|
+
path: string;
|
|
176
|
+
action: "merge";
|
|
177
|
+
rationale: string;
|
|
178
|
+
tailored_content: string;
|
|
179
|
+
} | {
|
|
180
|
+
path: string;
|
|
181
|
+
action: "skip";
|
|
182
|
+
rationale: string;
|
|
183
|
+
})[];
|
|
184
|
+
sourceAnalysisSchemaVersion: 1;
|
|
185
|
+
templateRef: string;
|
|
186
|
+
generatedAtIso: string;
|
|
187
|
+
}>;
|
|
188
|
+
export type ScaffoldPlan = z.infer<typeof ScaffoldPlanSchema>;
|
|
189
|
+
export type FilePlan = z.infer<typeof FilePlanSchema>;
|
|
190
|
+
export type EmitFilePlan = z.infer<typeof EmitPlan>;
|
|
191
|
+
export type MergeFilePlan = z.infer<typeof MergePlan>;
|
|
192
|
+
export type SkipFilePlan = z.infer<typeof SkipPlan>;
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=scaffold-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold-schema.d.ts","sourceRoot":"","sources":["../../src/onboard/scaffold-schema.ts"],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15 Phase B).
|
|
4
|
+
//
|
|
5
|
+
// The LLM (Stage B) consumes a RepoAnalysis (Phase A) + a sage-blueprint
|
|
6
|
+
// template directory and emits a ScaffoldPlan: per-file action decisions
|
|
7
|
+
// (emit | merge | skip) with rationale and (for emit/merge) the tailored
|
|
8
|
+
// body content. Discriminated union on `action` makes the LLM tool-call
|
|
9
|
+
// shape unambiguous and Zod-rejects mixed states.
|
|
10
|
+
//
|
|
11
|
+
// Budget contract: serialized ScaffoldPlan ≤ 64 KB; per-file tailored_content
|
|
12
|
+
// ≤ 16 KB; files[] ≤ 100. Per-file cap + files cap together bound the LLM
|
|
13
|
+
// context AND the writer cost.
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { parseTemplateRef, TEMPLATE_REF_SHAPE_RE } from "./template-ref.js";
|
|
16
|
+
export const SCAFFOLD_PLAN_SCHEMA_VERSION = 1;
|
|
17
|
+
export const SOURCE_ANALYSIS_SCHEMA_VERSION = 1;
|
|
18
|
+
export const SCAFFOLD_PLAN_BYTE_BUDGET = 64_512;
|
|
19
|
+
export const FILE_PLAN_CONTENT_CAP = 16_384;
|
|
20
|
+
export const SCAFFOLD_PLAN_FILES_CAP = 100;
|
|
21
|
+
export const SCAFFOLD_PLAN_SUMMARY_CAP = 800;
|
|
22
|
+
const EmitPlan = z.object({
|
|
23
|
+
path: z.string().min(1).max(512),
|
|
24
|
+
action: z.literal("emit"),
|
|
25
|
+
rationale: z.string().min(1).max(800),
|
|
26
|
+
tailored_content: z.string().max(FILE_PLAN_CONTENT_CAP),
|
|
27
|
+
}).strict();
|
|
28
|
+
const MergePlan = z.object({
|
|
29
|
+
path: z.string().min(1).max(512),
|
|
30
|
+
action: z.literal("merge"),
|
|
31
|
+
rationale: z.string().min(1).max(800),
|
|
32
|
+
tailored_content: z.string().max(FILE_PLAN_CONTENT_CAP),
|
|
33
|
+
}).strict();
|
|
34
|
+
const SkipPlan = z.object({
|
|
35
|
+
path: z.string().min(1).max(512),
|
|
36
|
+
action: z.literal("skip"),
|
|
37
|
+
rationale: z.string().min(1).max(800),
|
|
38
|
+
}).strict();
|
|
39
|
+
export const FilePlanSchema = z.discriminatedUnion("action", [
|
|
40
|
+
EmitPlan,
|
|
41
|
+
MergePlan,
|
|
42
|
+
SkipPlan,
|
|
43
|
+
]);
|
|
44
|
+
export const ScaffoldPlanSchema = z.object({
|
|
45
|
+
schemaVersion: z.literal(SCAFFOLD_PLAN_SCHEMA_VERSION),
|
|
46
|
+
sourceAnalysisSchemaVersion: z.literal(SOURCE_ANALYSIS_SCHEMA_VERSION),
|
|
47
|
+
templateRef: z
|
|
48
|
+
.string()
|
|
49
|
+
.regex(TEMPLATE_REF_SHAPE_RE, {
|
|
50
|
+
message: "templateRef must match gh:<owner>/<repo>@<ref> or file:///<abs-path>@<ref>",
|
|
51
|
+
})
|
|
52
|
+
.refine((s) => {
|
|
53
|
+
try {
|
|
54
|
+
parseTemplateRef(s);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}, (s) => {
|
|
61
|
+
try {
|
|
62
|
+
parseTemplateRef(s);
|
|
63
|
+
return { message: "(unreachable — refine should have passed)" };
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
return { message: e instanceof Error ? e.message : String(e) };
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
generatedAtIso: z.string().datetime({ offset: false }),
|
|
70
|
+
files: z.array(FilePlanSchema).max(SCAFFOLD_PLAN_FILES_CAP),
|
|
71
|
+
summary: z.string().max(SCAFFOLD_PLAN_SUMMARY_CAP),
|
|
72
|
+
}).strict();
|
|
73
|
+
//# sourceMappingURL=scaffold-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold-schema.js","sourceRoot":"","sources":["../../src/onboard/scaffold-schema.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,6DAA6D;AA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AAO,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;QAAC,CAAC;QAC7F,OAAO,CAAC,EAAE,CAAC;YAAC,OAAO,EAAE,OAAO,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,CAAC;IAC/E,CAAC,CACF;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC;CACnD,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
package/dist/onboard/schema.d.ts
CHANGED
|
@@ -32,18 +32,21 @@ declare const WorkflowSchema: z.ZodObject<{
|
|
|
32
32
|
triggers: z.ZodArray<z.ZodString, "many">;
|
|
33
33
|
jobs: z.ZodArray<z.ZodString, "many">;
|
|
34
34
|
matrixDimensions: z.ZodArray<z.ZodString, "many">;
|
|
35
|
+
firstRunCommand: z.ZodNullable<z.ZodString>;
|
|
35
36
|
}, "strip", z.ZodTypeAny, {
|
|
36
37
|
path: string;
|
|
37
38
|
name: string;
|
|
38
39
|
triggers: string[];
|
|
39
40
|
jobs: string[];
|
|
40
41
|
matrixDimensions: string[];
|
|
42
|
+
firstRunCommand: string | null;
|
|
41
43
|
}, {
|
|
42
44
|
path: string;
|
|
43
45
|
name: string;
|
|
44
46
|
triggers: string[];
|
|
45
47
|
jobs: string[];
|
|
46
48
|
matrixDimensions: string[];
|
|
49
|
+
firstRunCommand: string | null;
|
|
47
50
|
}>;
|
|
48
51
|
declare const DeployStorySchema: z.ZodObject<{
|
|
49
52
|
workflowPath: z.ZodString;
|
|
@@ -167,18 +170,21 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
|
|
|
167
170
|
triggers: z.ZodArray<z.ZodString, "many">;
|
|
168
171
|
jobs: z.ZodArray<z.ZodString, "many">;
|
|
169
172
|
matrixDimensions: z.ZodArray<z.ZodString, "many">;
|
|
173
|
+
firstRunCommand: z.ZodNullable<z.ZodString>;
|
|
170
174
|
}, "strip", z.ZodTypeAny, {
|
|
171
175
|
path: string;
|
|
172
176
|
name: string;
|
|
173
177
|
triggers: string[];
|
|
174
178
|
jobs: string[];
|
|
175
179
|
matrixDimensions: string[];
|
|
180
|
+
firstRunCommand: string | null;
|
|
176
181
|
}, {
|
|
177
182
|
path: string;
|
|
178
183
|
name: string;
|
|
179
184
|
triggers: string[];
|
|
180
185
|
jobs: string[];
|
|
181
186
|
matrixDimensions: string[];
|
|
187
|
+
firstRunCommand: string | null;
|
|
182
188
|
}>, "many">;
|
|
183
189
|
deployStory: z.ZodNullable<z.ZodObject<{
|
|
184
190
|
workflowPath: z.ZodString;
|
|
@@ -200,6 +206,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
|
|
|
200
206
|
triggers: string[];
|
|
201
207
|
jobs: string[];
|
|
202
208
|
matrixDimensions: string[];
|
|
209
|
+
firstRunCommand: string | null;
|
|
203
210
|
}[];
|
|
204
211
|
deployStory: {
|
|
205
212
|
command: string;
|
|
@@ -213,6 +220,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
|
|
|
213
220
|
triggers: string[];
|
|
214
221
|
jobs: string[];
|
|
215
222
|
matrixDimensions: string[];
|
|
223
|
+
firstRunCommand: string | null;
|
|
216
224
|
}[];
|
|
217
225
|
deployStory: {
|
|
218
226
|
command: string;
|
|
@@ -419,6 +427,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
|
|
|
419
427
|
triggers: string[];
|
|
420
428
|
jobs: string[];
|
|
421
429
|
matrixDimensions: string[];
|
|
430
|
+
firstRunCommand: string | null;
|
|
422
431
|
}[];
|
|
423
432
|
deployStory: {
|
|
424
433
|
command: string;
|
|
@@ -498,6 +507,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
|
|
|
498
507
|
triggers: string[];
|
|
499
508
|
jobs: string[];
|
|
500
509
|
matrixDimensions: string[];
|
|
510
|
+
firstRunCommand: string | null;
|
|
501
511
|
}[];
|
|
502
512
|
deployStory: {
|
|
503
513
|
command: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/onboard/schema.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B,EAAG,CAAU,CAAC;AAEvD,QAAA,MAAM,WAAW;;;;;;;;;;;;EAiBf,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;EAIjB,CAAC;AAEH,QAAA,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/onboard/schema.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B,EAAG,CAAU,CAAC;AAEvD,QAAA,MAAM,WAAW;;;;;;;;;;;;EAiBf,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;EAIjB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;EAiBlB,CAAC;AAEH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;EAarB,CAAC;AAEH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;EAcrB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;EAWlB,CAAC;AAKH,QAAA,MAAM,eAAe;;;;;;;;;EAGnB,CAAC;AAKH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;EAIpB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;EAGvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;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M,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/onboard/schema.js
CHANGED
|
@@ -35,6 +35,17 @@ const WorkflowSchema = z.object({
|
|
|
35
35
|
triggers: z.array(z.string()),
|
|
36
36
|
jobs: z.array(z.string()),
|
|
37
37
|
matrixDimensions: z.array(z.string()),
|
|
38
|
+
// First non-trivial single-line `run:` command in the workflow (>10 chars,
|
|
39
|
+
// not a YAML block scalar marker like `|`/`>`). null when the workflow
|
|
40
|
+
// has only multi-line `run: |` blocks or `uses:`-only steps. Consumed by
|
|
41
|
+
// the runbook seeder's donor fallback (issue #138): on repos whose
|
|
42
|
+
// deploy-named workflows have no single-line `run:`, the seeder appends
|
|
43
|
+
// the first non-deploy-named workflow with a `firstRunCommand` so Phase C
|
|
44
|
+
// metric 4 ("runbook contains verbatim CI run: line") stays satisfiable.
|
|
45
|
+
// The validator's metric-4 candidate-line regex matches the same shape;
|
|
46
|
+
// capturing via parsed-YAML would silently lose the single-vs-multiline
|
|
47
|
+
// distinction (raw-text extraction is intentional — see ci.ts).
|
|
48
|
+
firstRunCommand: z.string().nullable(),
|
|
38
49
|
});
|
|
39
50
|
const DeployStorySchema = z.object({
|
|
40
51
|
workflowPath: z.string(),
|
|
@@ -105,7 +116,13 @@ export const RepoAnalysisSchema = z
|
|
|
105
116
|
services: z.array(ServiceSchema).max(30),
|
|
106
117
|
dependencies: z.array(DependencySchema).max(20),
|
|
107
118
|
ci: z.object({
|
|
108
|
-
|
|
119
|
+
// Bumped 20 → 50 in cycle 15 Phase C to admit sage3c (28 workflows)
|
|
120
|
+
// through the schema; the 16 KB byte-budget canary on
|
|
121
|
+
// `RepoAnalysis` JSON still gates the absolute output size. Workflow
|
|
122
|
+
// entries are small (name + path + jobs + triggers), so 50 fits well
|
|
123
|
+
// inside the budget; the previous 20-cap was an aggressive heuristic
|
|
124
|
+
// that the sage3c reproduction harness empirically outgrew.
|
|
125
|
+
workflows: z.array(WorkflowSchema).max(50),
|
|
109
126
|
deployStory: DeployStorySchema.nullable(),
|
|
110
127
|
}),
|
|
111
128
|
tree: z.object({
|
|
@@ -135,6 +152,11 @@ export const RepoAnalysisSchema = z
|
|
|
135
152
|
prWorkflow: z.boolean(),
|
|
136
153
|
cliPin: z.string().nullable(),
|
|
137
154
|
}),
|
|
155
|
+
// Heuristic decision-surface markers (test-framework / deploy-target /
|
|
156
|
+
// stack / auth-model) aggregated across ALL lockfiles in the repo, not
|
|
157
|
+
// just the root one (see analyzers/lockfile.ts and #137 for the monorepo
|
|
158
|
+
// motivation). Deduped on the `(title, surface)` tuple; each entry's
|
|
159
|
+
// `evidence[]` is the sorted union of source lockfile paths.
|
|
138
160
|
decisions: z.array(DecisionSchema).max(10),
|
|
139
161
|
analyzerErrors: z.array(AnalyzerErrorSchema).default([]),
|
|
140
162
|
})
|
|
@@ -1 +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,CA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
// 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
|