@agentic-sdlc-kit/contracts 0.8.0 → 1.0.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/agent/events.d.ts +18 -18
- package/dist/agent/execution.d.ts +22 -22
- package/dist/agent-tools/index.d.ts +85 -0
- package/dist/agent-tools/index.d.ts.map +1 -0
- package/dist/agent-tools/index.js +60 -0
- package/dist/agent-tools/index.js.map +1 -0
- package/dist/application/application-context.d.ts +194 -60
- package/dist/application/application-context.d.ts.map +1 -1
- package/dist/application/application-persistence.d.ts +276 -114
- package/dist/application/application-persistence.d.ts.map +1 -1
- package/dist/application/application-state.d.ts +18 -18
- package/dist/architecture/api-contract.d.ts +18 -18
- package/dist/architecture/architecture-options.d.ts +6 -6
- package/dist/architecture/component-map.d.ts +6 -6
- package/dist/architecture/data-model.d.ts +6 -6
- package/dist/architecture/operational-design.d.ts +6 -6
- package/dist/benchmark/bench.d.ts +330 -0
- package/dist/benchmark/bench.d.ts.map +1 -0
- package/dist/benchmark/bench.js +69 -0
- package/dist/benchmark/bench.js.map +1 -0
- package/dist/benchmark/index.d.ts +2 -0
- package/dist/benchmark/index.d.ts.map +1 -0
- package/dist/benchmark/index.js +2 -0
- package/dist/benchmark/index.js.map +1 -0
- package/dist/constitution/cli-output.d.ts +706 -0
- package/dist/constitution/cli-output.d.ts.map +1 -0
- package/dist/constitution/cli-output.js +37 -0
- package/dist/constitution/cli-output.js.map +1 -0
- package/dist/constitution/index.d.ts +4 -0
- package/dist/constitution/index.d.ts.map +1 -0
- package/dist/constitution/index.js +4 -0
- package/dist/constitution/index.js.map +1 -0
- package/dist/constitution/result.d.ts +112 -0
- package/dist/constitution/result.d.ts.map +1 -0
- package/dist/constitution/result.js +67 -0
- package/dist/constitution/result.js.map +1 -0
- package/dist/constitution/rule.d.ts +488 -0
- package/dist/constitution/rule.d.ts.map +1 -0
- package/dist/constitution/rule.js +164 -0
- package/dist/constitution/rule.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/project-context.d.ts +275 -0
- package/dist/context/project-context.d.ts.map +1 -0
- package/dist/context/project-context.js +56 -0
- package/dist/context/project-context.js.map +1 -0
- package/dist/evaluation/benchmark.d.ts +12 -12
- package/dist/evaluation/metrics.d.ts +4 -4
- package/dist/evolution/improvement-hypothesis.d.ts +10 -10
- package/dist/execution/execution-profile.d.ts +130 -0
- package/dist/execution/execution-profile.d.ts.map +1 -0
- package/dist/execution/execution-profile.js +44 -0
- package/dist/execution/execution-profile.js.map +1 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +2 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/install-plan.d.ts +16 -16
- package/dist/installer/ownership-manifest.d.ts +10 -2
- package/dist/installer/ownership-manifest.d.ts.map +1 -1
- package/dist/installer/ownership-manifest.js +4 -0
- package/dist/installer/ownership-manifest.js.map +1 -1
- package/dist/installer/package-manifest.d.ts +6 -6
- package/dist/learning/engineering-lesson.d.ts +14 -14
- package/dist/learning/engineering-memory.d.ts +20 -2
- package/dist/learning/engineering-memory.d.ts.map +1 -1
- package/dist/learning/engineering-memory.js +2 -0
- package/dist/learning/engineering-memory.js.map +1 -1
- package/dist/learning/experience-episode.d.ts +14 -14
- package/dist/learning/experience.d.ts +8 -8
- package/dist/learning/index.d.ts +1 -0
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +1 -0
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/learning-event.d.ts +78 -0
- package/dist/learning/learning-event.d.ts.map +1 -0
- package/dist/learning/learning-event.js +37 -0
- package/dist/learning/learning-event.js.map +1 -0
- package/dist/learning/memory.d.ts +2 -2
- package/dist/maintenance/bug-fix-workflow.d.ts +4 -4
- package/dist/maintenance/bug-report.d.ts +6 -6
- package/dist/maintenance/refactor-contract.d.ts +8 -8
- package/dist/maintenance/refactor-workflow.d.ts +4 -4
- package/dist/observer/event-schema.d.ts +6 -6
- package/dist/observer/journal.d.ts +10 -10
- package/dist/observer/journal.d.ts.map +1 -1
- package/dist/observer/journal.js +7 -0
- package/dist/observer/journal.js.map +1 -1
- package/dist/observer/run-summary.d.ts +12 -12
- package/dist/onboard/index.d.ts +2 -0
- package/dist/onboard/index.d.ts.map +1 -0
- package/dist/onboard/index.js +2 -0
- package/dist/onboard/index.js.map +1 -0
- package/dist/onboard/onboard-report.d.ts +349 -0
- package/dist/onboard/onboard-report.d.ts.map +1 -0
- package/dist/onboard/onboard-report.js +96 -0
- package/dist/onboard/onboard-report.js.map +1 -0
- package/dist/patterns/pattern.d.ts +2 -2
- package/dist/planning/task.d.ts +36 -36
- package/dist/policy/policy.d.ts +8 -8
- package/dist/product/product-brief.d.ts +6 -6
- package/dist/product/requirements.d.ts +48 -48
- package/dist/project/project-profile.d.ts +113 -2
- package/dist/project/project-profile.d.ts.map +1 -1
- package/dist/project/project-profile.js +17 -2
- package/dist/project/project-profile.js.map +1 -1
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -0
- package/dist/routing/index.js.map +1 -1
- package/dist/routing/measured-routing.d.ts +41 -0
- package/dist/routing/measured-routing.d.ts.map +1 -0
- package/dist/routing/measured-routing.js +24 -0
- package/dist/routing/measured-routing.js.map +1 -0
- package/dist/routing/routing-policy.d.ts +20 -20
- package/dist/routing/routing-request.d.ts +2 -2
- package/dist/runtime-guard/action-classification.d.ts +2 -2
- package/dist/runtime-guard/audit-event.d.ts +8 -8
- package/dist/runtime-guard/policy-schema.d.ts +4 -4
- package/dist/scaffolding/scaffold-contract.d.ts +59 -59
- package/dist/scaffolding/template-manifest.d.ts +15 -15
- package/dist/secret-guard/detection-rule.d.ts +5 -5
- package/dist/secret-guard/detection-rule.d.ts.map +1 -1
- package/dist/secret-guard/detection-rule.js +44 -0
- package/dist/secret-guard/detection-rule.js.map +1 -1
- package/dist/secret-guard/finding.d.ts +12 -12
- package/dist/secret-guard/finding.d.ts.map +1 -1
- package/dist/secret-guard/finding.js +2 -0
- package/dist/secret-guard/finding.js.map +1 -1
- package/dist/secret-guard/scanner-failure.d.ts +4 -4
- package/dist/specification/specification.d.ts +8 -8
- package/dist/stack-pack/manifest.d.ts +33 -4
- package/dist/stack-pack/manifest.d.ts.map +1 -1
- package/dist/stack-pack/manifest.js +22 -2
- package/dist/stack-pack/manifest.js.map +1 -1
- package/dist/verification/index.d.ts +1 -0
- package/dist/verification/index.d.ts.map +1 -1
- package/dist/verification/index.js +1 -0
- package/dist/verification/index.js.map +1 -1
- package/dist/verification/report.d.ts +118 -12
- package/dist/verification/report.d.ts.map +1 -1
- package/dist/verification/report.js +4 -0
- package/dist/verification/report.js.map +1 -1
- package/dist/verification/strength.d.ts +270 -0
- package/dist/verification/strength.d.ts.map +1 -0
- package/dist/verification/strength.js +168 -0
- package/dist/verification/strength.js.map +1 -0
- package/dist/workflow/next-action.d.ts +67 -6
- package/dist/workflow/next-action.d.ts.map +1 -1
- package/dist/workflow/next-action.js +23 -0
- package/dist/workflow/next-action.js.map +1 -1
- package/dist/workflow/workflow.d.ts +9 -8
- package/dist/workflow/workflow.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/agent-tools/index.ts +81 -0
- package/src/benchmark/bench.ts +83 -0
- package/src/benchmark/index.ts +1 -0
- package/src/constitution/cli-output.ts +44 -0
- package/src/constitution/index.ts +3 -0
- package/src/constitution/result.test.ts +69 -0
- package/src/constitution/result.ts +74 -0
- package/src/constitution/rule-origin.test.ts +36 -0
- package/src/constitution/rule-path.test.ts +15 -0
- package/src/constitution/rule.test.ts +209 -0
- package/src/constitution/rule.ts +192 -0
- package/src/context/index.ts +1 -0
- package/src/context/project-context.ts +63 -0
- package/src/execution/execution-profile.ts +50 -0
- package/src/execution/index.ts +1 -0
- package/src/index.ts +16 -0
- package/src/installer/ownership-manifest.ts +4 -0
- package/src/learning/engineering-memory.ts +2 -0
- package/src/learning/index.ts +1 -0
- package/src/learning/learning-event.ts +42 -0
- package/src/observer/journal.ts +7 -0
- package/src/onboard/index.ts +1 -0
- package/src/onboard/onboard-report.test.ts +92 -0
- package/src/onboard/onboard-report.ts +115 -0
- package/src/project/project-profile.ts +19 -2
- package/src/routing/index.ts +1 -0
- package/src/routing/measured-routing.ts +27 -0
- package/src/secret-guard/detection-rule.ts +53 -0
- package/src/secret-guard/finding.ts +2 -0
- package/src/stack-pack/manifest.test.ts +45 -0
- package/src/stack-pack/manifest.ts +24 -2
- package/src/verification/index.ts +1 -0
- package/src/verification/report.ts +4 -0
- package/src/verification/strength.test.ts +160 -0
- package/src/verification/strength.ts +189 -0
- package/src/workflow/next-action.test.ts +25 -0
- package/src/workflow/next-action.ts +25 -0
- package/src/workflow/workflow.ts +1 -0
|
@@ -13,13 +13,13 @@ export declare const LessonRefSchema: z.ZodObject<{
|
|
|
13
13
|
summary: z.ZodString;
|
|
14
14
|
advisory: z.ZodLiteral<true>;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
lessonId: string;
|
|
17
16
|
summary: string;
|
|
18
17
|
advisory: true;
|
|
19
|
-
}, {
|
|
20
18
|
lessonId: string;
|
|
19
|
+
}, {
|
|
21
20
|
summary: string;
|
|
22
21
|
advisory: true;
|
|
22
|
+
lessonId: string;
|
|
23
23
|
}>;
|
|
24
24
|
export type LessonRef = z.infer<typeof LessonRefSchema>;
|
|
25
25
|
/**
|
|
@@ -41,6 +41,32 @@ export declare const NextActionConstraintsSchema: z.ZodObject<{
|
|
|
41
41
|
maxOutputBytes: number;
|
|
42
42
|
}>;
|
|
43
43
|
export type NextActionConstraints = z.infer<typeof NextActionConstraintsSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Feedback for an attempt the evidence gate rejected. Its text is fixed
|
|
46
|
+
* guidance chosen by the kit, never stored or captured output, so it is
|
|
47
|
+
* safe to place in an agent's instructions.
|
|
48
|
+
*/
|
|
49
|
+
export declare const RecoveryHintSchema: z.ZodObject<{
|
|
50
|
+
classification: z.ZodEnum<["assertion", "compilation", "dependency", "discovery", "environment", "timeout", "unclassified"]>;
|
|
51
|
+
action: z.ZodLiteral<"feedback">;
|
|
52
|
+
reason: z.ZodString;
|
|
53
|
+
/** The failed attempt this hint reports, counted within the current phase (1-based). */
|
|
54
|
+
attempt: z.ZodNumber;
|
|
55
|
+
maxAttempts: z.ZodNumber;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
58
|
+
action: "feedback";
|
|
59
|
+
reason: string;
|
|
60
|
+
attempt: number;
|
|
61
|
+
maxAttempts: number;
|
|
62
|
+
}, {
|
|
63
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
64
|
+
action: "feedback";
|
|
65
|
+
reason: string;
|
|
66
|
+
attempt: number;
|
|
67
|
+
maxAttempts: number;
|
|
68
|
+
}>;
|
|
69
|
+
export type RecoveryHint = z.infer<typeof RecoveryHintSchema>;
|
|
44
70
|
export declare const NextActionSchema: z.ZodObject<{
|
|
45
71
|
schemaVersion: z.ZodLiteral<1>;
|
|
46
72
|
/** The feature run this action belongs to (one run per feature id). */
|
|
@@ -67,14 +93,35 @@ export declare const NextActionSchema: z.ZodObject<{
|
|
|
67
93
|
summary: z.ZodString;
|
|
68
94
|
advisory: z.ZodLiteral<true>;
|
|
69
95
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
lessonId: string;
|
|
71
96
|
summary: string;
|
|
72
97
|
advisory: true;
|
|
73
|
-
}, {
|
|
74
98
|
lessonId: string;
|
|
99
|
+
}, {
|
|
75
100
|
summary: string;
|
|
76
101
|
advisory: true;
|
|
102
|
+
lessonId: string;
|
|
77
103
|
}>, "many">;
|
|
104
|
+
/** Present only when the last attempt was rejected and feedback is still offered. */
|
|
105
|
+
recoveryHint: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
classification: z.ZodEnum<["assertion", "compilation", "dependency", "discovery", "environment", "timeout", "unclassified"]>;
|
|
107
|
+
action: z.ZodLiteral<"feedback">;
|
|
108
|
+
reason: z.ZodString;
|
|
109
|
+
/** The failed attempt this hint reports, counted within the current phase (1-based). */
|
|
110
|
+
attempt: z.ZodNumber;
|
|
111
|
+
maxAttempts: z.ZodNumber;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
114
|
+
action: "feedback";
|
|
115
|
+
reason: string;
|
|
116
|
+
attempt: number;
|
|
117
|
+
maxAttempts: number;
|
|
118
|
+
}, {
|
|
119
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
120
|
+
action: "feedback";
|
|
121
|
+
reason: string;
|
|
122
|
+
attempt: number;
|
|
123
|
+
maxAttempts: number;
|
|
124
|
+
}>>;
|
|
78
125
|
constraints: z.ZodObject<{
|
|
79
126
|
/** Phase verification timeout (default 60_000 ms, runTddPhase). */
|
|
80
127
|
timeoutMs: z.ZodNumber;
|
|
@@ -96,9 +143,9 @@ export declare const NextActionSchema: z.ZodObject<{
|
|
|
96
143
|
nextInvocation: string;
|
|
97
144
|
blockingQuestions: string[];
|
|
98
145
|
advisoryLessons: {
|
|
99
|
-
lessonId: string;
|
|
100
146
|
summary: string;
|
|
101
147
|
advisory: true;
|
|
148
|
+
lessonId: string;
|
|
102
149
|
}[];
|
|
103
150
|
constraints: {
|
|
104
151
|
timeoutMs: number;
|
|
@@ -106,6 +153,13 @@ export declare const NextActionSchema: z.ZodObject<{
|
|
|
106
153
|
};
|
|
107
154
|
taskId?: string | undefined;
|
|
108
155
|
phase?: "refactor" | "red" | "green" | undefined;
|
|
156
|
+
recoveryHint?: {
|
|
157
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
158
|
+
action: "feedback";
|
|
159
|
+
reason: string;
|
|
160
|
+
attempt: number;
|
|
161
|
+
maxAttempts: number;
|
|
162
|
+
} | undefined;
|
|
109
163
|
}, {
|
|
110
164
|
status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
|
|
111
165
|
schemaVersion: 1;
|
|
@@ -115,9 +169,9 @@ export declare const NextActionSchema: z.ZodObject<{
|
|
|
115
169
|
nextInvocation: string;
|
|
116
170
|
blockingQuestions: string[];
|
|
117
171
|
advisoryLessons: {
|
|
118
|
-
lessonId: string;
|
|
119
172
|
summary: string;
|
|
120
173
|
advisory: true;
|
|
174
|
+
lessonId: string;
|
|
121
175
|
}[];
|
|
122
176
|
constraints: {
|
|
123
177
|
timeoutMs: number;
|
|
@@ -125,6 +179,13 @@ export declare const NextActionSchema: z.ZodObject<{
|
|
|
125
179
|
};
|
|
126
180
|
taskId?: string | undefined;
|
|
127
181
|
phase?: "refactor" | "red" | "green" | undefined;
|
|
182
|
+
recoveryHint?: {
|
|
183
|
+
classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
|
|
184
|
+
action: "feedback";
|
|
185
|
+
reason: string;
|
|
186
|
+
attempt: number;
|
|
187
|
+
maxAttempts: number;
|
|
188
|
+
} | undefined;
|
|
128
189
|
}>;
|
|
129
190
|
export type NextAction = z.infer<typeof NextActionSchema>;
|
|
130
191
|
//# sourceMappingURL=next-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-action.d.ts","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,eAAO,MAAM,wBA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,kBAAkB;;;;IAY7B,wFAAwF;;;;;;;;;;;;;;;EAGxF,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;IAE3B,uEAAuE;;;IAGvE,oEAAoE;;IAEpE,sEAAsE;;;IAGtE;;;;OAIG;;IAEH,oEAAoE;;IAEpE,iFAAiF;;IAEjF,uEAAuE;;;;;;;;;;;;;;IAEvE,qFAAqF;;;;;QA5BrF,wFAAwF;;;;;;;;;;;;;;;;;QAxBxF,mEAAmE;;QAEnE,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDxE,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -65,6 +65,27 @@ export const NextActionConstraintsSchema = z.object({
|
|
|
65
65
|
/** Output capture bound (default 10 MiB, ProcessVerificationRunner). */
|
|
66
66
|
maxOutputBytes: z.number().int().positive(),
|
|
67
67
|
});
|
|
68
|
+
/**
|
|
69
|
+
* Feedback for an attempt the evidence gate rejected. Its text is fixed
|
|
70
|
+
* guidance chosen by the kit, never stored or captured output, so it is
|
|
71
|
+
* safe to place in an agent's instructions.
|
|
72
|
+
*/
|
|
73
|
+
export const RecoveryHintSchema = z.object({
|
|
74
|
+
classification: z.enum([
|
|
75
|
+
'assertion',
|
|
76
|
+
'compilation',
|
|
77
|
+
'dependency',
|
|
78
|
+
'discovery',
|
|
79
|
+
'environment',
|
|
80
|
+
'timeout',
|
|
81
|
+
'unclassified',
|
|
82
|
+
]),
|
|
83
|
+
action: z.literal('feedback'),
|
|
84
|
+
reason: z.string().min(1),
|
|
85
|
+
/** The failed attempt this hint reports, counted within the current phase (1-based). */
|
|
86
|
+
attempt: z.number().int().positive(),
|
|
87
|
+
maxAttempts: z.number().int().positive(),
|
|
88
|
+
});
|
|
68
89
|
export const NextActionSchema = z.object({
|
|
69
90
|
schemaVersion: z.literal(NEXT_ACTION_SCHEMA_VERSION),
|
|
70
91
|
/** The feature run this action belongs to (one run per feature id). */
|
|
@@ -87,6 +108,8 @@ export const NextActionSchema = z.object({
|
|
|
87
108
|
blockingQuestions: z.array(z.string()),
|
|
88
109
|
/** Advisory lessons (ADVISORY ONLY — never authority; ADR-0021 §4). */
|
|
89
110
|
advisoryLessons: z.array(LessonRefSchema),
|
|
111
|
+
/** Present only when the last attempt was rejected and feedback is still offered. */
|
|
112
|
+
recoveryHint: RecoveryHintSchema.optional(),
|
|
90
113
|
constraints: NextActionConstraintsSchema,
|
|
91
114
|
});
|
|
92
115
|
//# sourceMappingURL=next-action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-action.js","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,0DAA0D;AAC1D,EAAE;AACF,gCAAgC;AAChC,yEAAyE;AACzE,6DAA6D;AAC7D,oEAAoE;AACpE,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,iBAAiB;AACjB,sEAAsE;AACtE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,yDAAyD;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,wDAAwD;IACxD,eAAe;IACf,mEAAmE;IACnE,UAAU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AAC,CAAC,MAAM,EAAE,CAAC;IACxC,oEAAoE;IACpE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,iFAAiF;IACjF,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtC,uEAAuE;IACvE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACzC,WAAW,EAAE,2BAA2B;CACzC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"next-action.js","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,0DAA0D;AAC1D,EAAE;AACF,gCAAgC;AAChC,yEAAyE;AACzE,6DAA6D;AAC7D,oEAAoE;AACpE,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,iBAAiB;AACjB,sEAAsE;AACtE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,yDAAyD;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,wDAAwD;IACxD,eAAe;IACf,mEAAmE;IACnE,UAAU;IACV,8DAA8D;IAC9D,YAAY;IACZ,2EAA2E;IAC3E,eAAe;IACf,iFAAiF;IACjF,gBAAgB;IAChB,sEAAsE;IACtE,eAAe;CAChB,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAA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AE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,oBAAoB;IAC5B,oEAAoE;IACpE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,sEAAsE;IACtE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtD,cAAc,EAAE,wBAAwB;IACxC;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,oEAAoE;IACpE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,iFAAiF;IACjF,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtC,uEAAuE;IACvE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACzC,qFAAqF;IACrF,YAAY,EAAE,kBAAkB,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAAE,2BAA2B;CACzC,CAAC,CAAC"}
|
|
@@ -12,11 +12,11 @@ export declare const TaskHistoryEntrySchema: z.ZodObject<{
|
|
|
12
12
|
status: z.ZodEnum<["passed", "failed", "skipped", "blocked"]>;
|
|
13
13
|
evidence: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
status: "passed" | "failed" | "
|
|
15
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
16
16
|
taskId: string;
|
|
17
17
|
evidence?: string[] | undefined;
|
|
18
18
|
}, {
|
|
19
|
-
status: "passed" | "failed" | "
|
|
19
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
20
20
|
taskId: string;
|
|
21
21
|
evidence?: string[] | undefined;
|
|
22
22
|
}>;
|
|
@@ -31,20 +31,20 @@ export declare const WorkflowStateSchema: z.ZodObject<{
|
|
|
31
31
|
status: z.ZodEnum<["passed", "failed", "skipped", "blocked"]>;
|
|
32
32
|
evidence: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
status: "passed" | "failed" | "
|
|
34
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
35
35
|
taskId: string;
|
|
36
36
|
evidence?: string[] | undefined;
|
|
37
37
|
}, {
|
|
38
|
-
status: "passed" | "failed" | "
|
|
38
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
39
39
|
taskId: string;
|
|
40
40
|
evidence?: string[] | undefined;
|
|
41
41
|
}>, "many">;
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
|
|
44
|
-
runId: string;
|
|
45
44
|
mode: "app" | "feature" | "fix" | "refactor";
|
|
45
|
+
runId: string;
|
|
46
46
|
taskHistory: {
|
|
47
|
-
status: "passed" | "failed" | "
|
|
47
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
48
48
|
taskId: string;
|
|
49
49
|
evidence?: string[] | undefined;
|
|
50
50
|
}[];
|
|
@@ -52,10 +52,10 @@ export declare const WorkflowStateSchema: z.ZodObject<{
|
|
|
52
52
|
currentTaskId?: string | undefined;
|
|
53
53
|
}, {
|
|
54
54
|
status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
|
|
55
|
-
runId: string;
|
|
56
55
|
mode: "app" | "feature" | "fix" | "refactor";
|
|
56
|
+
runId: string;
|
|
57
57
|
taskHistory: {
|
|
58
|
-
status: "passed" | "failed" | "
|
|
58
|
+
status: "passed" | "failed" | "blocked" | "skipped";
|
|
59
59
|
taskId: string;
|
|
60
60
|
evidence?: string[] | undefined;
|
|
61
61
|
}[];
|
|
@@ -63,6 +63,7 @@ export declare const WorkflowStateSchema: z.ZodObject<{
|
|
|
63
63
|
currentTaskId?: string | undefined;
|
|
64
64
|
}>;
|
|
65
65
|
export type WorkflowState = z.infer<typeof WorkflowStateSchema>;
|
|
66
|
+
export type WorkflowRun = WorkflowState;
|
|
66
67
|
export type TaskHistoryEntry = z.infer<typeof TaskHistoryEntrySchema>;
|
|
67
68
|
export type { RunId, TaskId, CheckStatus };
|
|
68
69
|
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/workflow/workflow.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,kBAAkB,kDAAgD,CAAC;AAChF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,yEAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,wBAAwB,6DAA2D,CAAC;AACjG,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/workflow/workflow.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,kBAAkB,kDAAgD,CAAC;AAChF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,yEAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,wBAAwB,6DAA2D,CAAC;AACjG,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AACxC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-sdlc-kit/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Shared contracts (types + zod schemas) for the Agentic SDLC Kit. Depends on nothing.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/shubhamtaywade82/agentic-sdlc-kit.git",
|
|
8
|
+
"directory": "packages/contracts"
|
|
9
|
+
},
|
|
5
10
|
"license": "MIT",
|
|
6
11
|
"sideEffects": false,
|
|
7
12
|
"type": "module",
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// packages/contracts/src/agent-tools/index.ts
|
|
2
|
+
//
|
|
3
|
+
// Typed tool surface for an agent host (item 4). A host calls these tools
|
|
4
|
+
// instead of shelling out. Each input schema is strict: an unrecognized key is
|
|
5
|
+
// an error, so no tool can carry a command. A phase runs only the verification
|
|
6
|
+
// command the plan declares for its task.
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
export const AGENT_TOOL_NAMES = [
|
|
11
|
+
'kit_next',
|
|
12
|
+
'kit_phase',
|
|
13
|
+
'kit_status',
|
|
14
|
+
'kit_rules_resolve',
|
|
15
|
+
'kit_rules_evaluate',
|
|
16
|
+
'kit_project_context',
|
|
17
|
+
'kit_rules_explain',
|
|
18
|
+
'kit_adr_search',
|
|
19
|
+
'kit_patterns_search',
|
|
20
|
+
'kit_verification_status',
|
|
21
|
+
'kit_learning_record',
|
|
22
|
+
] as const;
|
|
23
|
+
export type AgentToolName = (typeof AGENT_TOOL_NAMES)[number];
|
|
24
|
+
|
|
25
|
+
export const KitNextInputSchema = z.object({ featureId: z.string().min(1) }).strict();
|
|
26
|
+
export type KitNextInput = z.infer<typeof KitNextInputSchema>;
|
|
27
|
+
|
|
28
|
+
export const KitPhaseInputSchema = z
|
|
29
|
+
.object({
|
|
30
|
+
featureId: z.string().min(1),
|
|
31
|
+
taskId: z.string().min(1),
|
|
32
|
+
phase: z.enum(['red', 'green', 'refactor']),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export type KitPhaseInput = z.infer<typeof KitPhaseInputSchema>;
|
|
36
|
+
|
|
37
|
+
export const KitStatusInputSchema = z.object({ featureId: z.string().min(1) }).strict();
|
|
38
|
+
export type KitStatusInput = z.infer<typeof KitStatusInputSchema>;
|
|
39
|
+
|
|
40
|
+
// Read-only engineering-constitution tools (ADR-0023). Neither tool writes
|
|
41
|
+
// state or accepts a command. `stacks` defaults to the project profile.
|
|
42
|
+
const RepoFileSchema = z.string().min(1).max(1024);
|
|
43
|
+
|
|
44
|
+
export const KitRulesResolveInputSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
files: z.array(RepoFileSchema).min(1),
|
|
47
|
+
stacks: z.array(z.string().min(1)).optional(),
|
|
48
|
+
})
|
|
49
|
+
.strict();
|
|
50
|
+
export type KitRulesResolveInput = z.infer<typeof KitRulesResolveInputSchema>;
|
|
51
|
+
|
|
52
|
+
export const KitRulesEvaluateInputSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
files: z.array(RepoFileSchema).optional(),
|
|
55
|
+
stacks: z.array(z.string().min(1)).optional(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
export type KitRulesEvaluateInput = z.infer<typeof KitRulesEvaluateInputSchema>;
|
|
59
|
+
|
|
60
|
+
// Read-only context tools (platform roadmap Phase 3). None writes state, runs a
|
|
61
|
+
// command, or accepts a path outside the repository.
|
|
62
|
+
export const KitProjectContextInputSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
files: z.array(RepoFileSchema).optional(),
|
|
65
|
+
stacks: z.array(z.string().min(1)).optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
export type KitProjectContextInput = z.infer<typeof KitProjectContextInputSchema>;
|
|
69
|
+
|
|
70
|
+
export const KitRulesExplainInputSchema = z
|
|
71
|
+
.object({ ruleId: z.string().regex(/^[A-Z][A-Z0-9]*(-[A-Z0-9]+)*-\d{3}$/, 'rule id') })
|
|
72
|
+
.strict();
|
|
73
|
+
export type KitRulesExplainInput = z.infer<typeof KitRulesExplainInputSchema>;
|
|
74
|
+
|
|
75
|
+
export const KitSearchInputSchema = z.object({ query: z.string().max(200).optional() }).strict();
|
|
76
|
+
export type KitSearchInput = z.infer<typeof KitSearchInputSchema>;
|
|
77
|
+
|
|
78
|
+
export const KitVerificationStatusInputSchema = z.object({}).strict();
|
|
79
|
+
|
|
80
|
+
// Submits one privacy-safe learning event. The strict learning event schema refuses free text.
|
|
81
|
+
export { LearningEventSchema as KitLearningRecordInputSchema } from '../learning/learning-event.js';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// packages/contracts/src/benchmark/bench.ts
|
|
2
|
+
//
|
|
3
|
+
// The agent regression benchmark (platform roadmap Phase 5, issue #46). A suite pins a runner and a
|
|
4
|
+
// set of tasks; each task pins a repository commit, a ticket, deterministic acceptance commands and
|
|
5
|
+
// a budget. Results separate infrastructure failures from agent failures.
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { isRepoRelativePath } from '../constitution/rule.js';
|
|
9
|
+
|
|
10
|
+
export const BENCH_SCHEMA_VERSION = 1 as const;
|
|
11
|
+
|
|
12
|
+
const KEBAB = /^[a-z][a-z0-9-]*$/;
|
|
13
|
+
const argv = z.array(z.string().min(1)).min(1);
|
|
14
|
+
|
|
15
|
+
export const BenchSuiteSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
schemaVersion: z.literal(BENCH_SCHEMA_VERSION),
|
|
18
|
+
name: z.string().regex(KEBAB),
|
|
19
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
20
|
+
// The agent runner, run in each task's disposable worktree. Argv only: no shell.
|
|
21
|
+
runner: z.object({ argv, timeoutMs: z.number().int().min(1000).max(3_600_000) }).strict(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
export type BenchSuite = z.infer<typeof BenchSuiteSchema>;
|
|
25
|
+
|
|
26
|
+
export const BenchTaskSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
schemaVersion: z.literal(BENCH_SCHEMA_VERSION),
|
|
29
|
+
id: z.string().regex(KEBAB),
|
|
30
|
+
title: z.string().min(1).max(200),
|
|
31
|
+
// Tasks marked holdout are never used to tune prompts or skills. Reports keep them apart.
|
|
32
|
+
split: z.enum(['tune', 'holdout']),
|
|
33
|
+
// A git repository inside the suite directory: no traversal, so a suite is self-contained.
|
|
34
|
+
repository: z.string().min(1).refine(isRepoRelativePath, 'repository must be a relative path, without traversal'),
|
|
35
|
+
commit: z.string().regex(/^[0-9a-f]{40}$/, 'commit must be a full sha'),
|
|
36
|
+
ticket: z.string().min(1).max(4000),
|
|
37
|
+
// Deterministic checks, run in the worktree after the runner. Every one must exit 0.
|
|
38
|
+
acceptance: z.array(argv).min(1),
|
|
39
|
+
budget: z.object({ timeoutMs: z.number().int().min(1000).max(3_600_000) }).strict(),
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
42
|
+
export type BenchTask = z.infer<typeof BenchTaskSchema>;
|
|
43
|
+
|
|
44
|
+
export const BenchOutcomeSchema = z.enum(['success', 'agent_failed', 'infra_error']);
|
|
45
|
+
export type BenchOutcome = z.infer<typeof BenchOutcomeSchema>;
|
|
46
|
+
|
|
47
|
+
export const BenchRunSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
task: z.string().min(1),
|
|
50
|
+
split: z.enum(['tune', 'holdout']),
|
|
51
|
+
outcome: BenchOutcomeSchema,
|
|
52
|
+
durationMs: z.number().int().nonnegative(),
|
|
53
|
+
reason: z.string().min(1),
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
export type BenchRun = z.infer<typeof BenchRunSchema>;
|
|
57
|
+
|
|
58
|
+
export const BenchSummarySchema = z
|
|
59
|
+
.object({
|
|
60
|
+
runs: z.number().int().nonnegative(),
|
|
61
|
+
successes: z.number().int().nonnegative(),
|
|
62
|
+
agentFailures: z.number().int().nonnegative(),
|
|
63
|
+
infraErrors: z.number().int().nonnegative(),
|
|
64
|
+
// Infrastructure errors are excluded from the rate: a broken environment is not a model result.
|
|
65
|
+
successRate: z.number().min(0).max(1).nullable(),
|
|
66
|
+
// Wilson 95% interval over the scored runs; null when there are none.
|
|
67
|
+
interval95: z.object({ low: z.number(), high: z.number() }).nullable(),
|
|
68
|
+
medianDurationMs: z.number().nonnegative().nullable(),
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
71
|
+
export type BenchSummary = z.infer<typeof BenchSummarySchema>;
|
|
72
|
+
|
|
73
|
+
export const BenchReportSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
schemaVersion: z.literal(BENCH_SCHEMA_VERSION),
|
|
76
|
+
suite: z.object({ name: z.string(), version: z.string() }).strict(),
|
|
77
|
+
generatedAt: z.string().datetime(),
|
|
78
|
+
runs: z.array(BenchRunSchema),
|
|
79
|
+
tune: BenchSummarySchema,
|
|
80
|
+
holdout: BenchSummarySchema,
|
|
81
|
+
})
|
|
82
|
+
.strict();
|
|
83
|
+
export type BenchReport = z.infer<typeof BenchReportSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './bench.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// packages/contracts/src/constitution/cli-output.ts
|
|
2
|
+
//
|
|
3
|
+
// JSON output contracts for `kit rules explain` and `kit rules baseline`
|
|
4
|
+
// (ADR-0023, platform roadmap Phase 1). The CLI and MCP share these shapes.
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { BaselineEntrySchema, EngineeringRuleSchema } from './rule.js';
|
|
8
|
+
|
|
9
|
+
export const CommitRefSchema = z.object({
|
|
10
|
+
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
11
|
+
author: z.string(),
|
|
12
|
+
date: z.string().min(1),
|
|
13
|
+
subject: z.string(),
|
|
14
|
+
});
|
|
15
|
+
export type CommitRef = z.infer<typeof CommitRefSchema>;
|
|
16
|
+
|
|
17
|
+
export const RuleExplanationSchema = z.object({
|
|
18
|
+
schemaVersion: z.literal(1),
|
|
19
|
+
ruleId: z.string().min(1),
|
|
20
|
+
file: z.string().min(1),
|
|
21
|
+
rule: EngineeringRuleSchema,
|
|
22
|
+
// Null when the rule file has no committed history (uncommitted, or not a git repository).
|
|
23
|
+
introducedIn: CommitRefSchema.nullable(),
|
|
24
|
+
lastChangedIn: CommitRefSchema.nullable(),
|
|
25
|
+
// Repository files the rule's scope matches now.
|
|
26
|
+
matchedFiles: z.number().int().nonnegative(),
|
|
27
|
+
});
|
|
28
|
+
export type RuleExplanation = z.infer<typeof RuleExplanationSchema>;
|
|
29
|
+
|
|
30
|
+
export const BaselineChangeSchema = z.object({
|
|
31
|
+
before: BaselineEntrySchema,
|
|
32
|
+
after: BaselineEntrySchema,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const BaselineDiffSchema = z.object({
|
|
36
|
+
schemaVersion: z.literal(1),
|
|
37
|
+
// Added entries loosen the gate and need an explicit --accept.
|
|
38
|
+
added: z.array(BaselineEntrySchema),
|
|
39
|
+
// Removed entries tighten the gate.
|
|
40
|
+
removed: z.array(BaselineEntrySchema),
|
|
41
|
+
changed: z.array(BaselineChangeSchema),
|
|
42
|
+
accepted: z.boolean(),
|
|
43
|
+
});
|
|
44
|
+
export type BaselineDiff = z.infer<typeof BaselineDiffSchema>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// packages/contracts/src/constitution/result.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { rollupRuleGate, RuleResultSchema, type RuleResult } from './result.js';
|
|
4
|
+
|
|
5
|
+
const FP = 'b'.repeat(64);
|
|
6
|
+
const violation = { ruleId: 'ARCH-CORE-001', path: 'a.ts', fingerprint: FP, message: 'x' };
|
|
7
|
+
|
|
8
|
+
function result(overrides: Partial<RuleResult> = {}): RuleResult {
|
|
9
|
+
return { ruleId: 'ARCH-CORE-001', mode: 'blocking', outcome: 'passed', violations: [], baselined: 0, ...overrides };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('RuleResultSchema', () => {
|
|
13
|
+
it('accepts a passed result with baselined occurrences', () => {
|
|
14
|
+
expect(RuleResultSchema.safeParse(result({ baselined: 3 })).success).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('rejects a passed result that lists violations', () => {
|
|
18
|
+
expect(RuleResultSchema.safeParse(result({ violations: [violation] })).success).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('rejects a violations outcome with no violations', () => {
|
|
22
|
+
expect(RuleResultSchema.safeParse(result({ outcome: 'violations' })).success).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it.each(['adapter-unavailable', 'adapter-error', 'timed-out', 'not-evaluated'] as const)(
|
|
26
|
+
'accepts %s with no violations',
|
|
27
|
+
(outcome) => {
|
|
28
|
+
expect(RuleResultSchema.safeParse(result({ outcome, detail: 'why' })).success).toBe(true);
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
it('rejects an unknown outcome', () => {
|
|
33
|
+
expect(RuleResultSchema.safeParse(result({ outcome: 'skipped' as never })).success).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('rollupRuleGate', () => {
|
|
38
|
+
it('is passed for no results and for passing blocking rules', () => {
|
|
39
|
+
expect(rollupRuleGate([])).toBe('passed');
|
|
40
|
+
expect(rollupRuleGate([result()])).toBe('passed');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('fails when a blocking rule has new violations', () => {
|
|
44
|
+
expect(rollupRuleGate([result({ outcome: 'violations', violations: [violation] })])).toBe('failed');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it.each(['adapter-unavailable', 'adapter-error', 'timed-out', 'not-evaluated'] as const)(
|
|
48
|
+
'blocks when a blocking rule is %s (a broken checker is not a pass)',
|
|
49
|
+
(outcome) => {
|
|
50
|
+
expect(rollupRuleGate([result({ outcome })])).toBe('blocked');
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
it('violations beat blocked when both occur', () => {
|
|
55
|
+
const results = [
|
|
56
|
+
result({ ruleId: 'A-001', outcome: 'adapter-error' }),
|
|
57
|
+
result({ ruleId: 'B-001', outcome: 'violations', violations: [violation] }),
|
|
58
|
+
];
|
|
59
|
+
expect(rollupRuleGate(results)).toBe('failed');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('never gates on shadow or advisory outcomes', () => {
|
|
63
|
+
const results = [
|
|
64
|
+
result({ mode: 'shadow', outcome: 'violations', violations: [violation] }),
|
|
65
|
+
result({ mode: 'advisory', outcome: 'adapter-unavailable' }),
|
|
66
|
+
];
|
|
67
|
+
expect(rollupRuleGate(results)).toBe('passed');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// packages/contracts/src/constitution/result.ts
|
|
2
|
+
//
|
|
3
|
+
// Outcome of evaluating one engineering rule (ADR-0023 §2, §5).
|
|
4
|
+
//
|
|
5
|
+
// Invariant: a broken or absent checker is never a pass. Only `passed`
|
|
6
|
+
// means the checker ran and found no new violations. A blocking rule with
|
|
7
|
+
// any other outcome blocks the gate; advisory and shadow outcomes are
|
|
8
|
+
// reported but never gate.
|
|
9
|
+
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { EnforcementModeSchema } from './rule.js';
|
|
12
|
+
|
|
13
|
+
export const RULE_OUTCOMES = [
|
|
14
|
+
'passed',
|
|
15
|
+
'violations',
|
|
16
|
+
'adapter-unavailable',
|
|
17
|
+
'adapter-error',
|
|
18
|
+
'timed-out',
|
|
19
|
+
'not-evaluated',
|
|
20
|
+
] as const;
|
|
21
|
+
export const RuleOutcomeSchema = z.enum(RULE_OUTCOMES);
|
|
22
|
+
export type RuleOutcome = z.infer<typeof RuleOutcomeSchema>;
|
|
23
|
+
|
|
24
|
+
export const RuleViolationSchema = z.object({
|
|
25
|
+
ruleId: z.string().min(1),
|
|
26
|
+
path: z.string().min(1),
|
|
27
|
+
fingerprint: z.string().regex(/^[0-9a-f]{64}$/, 'fingerprint must be sha256 hex'),
|
|
28
|
+
line: z.number().int().positive().optional(),
|
|
29
|
+
message: z.string().min(1),
|
|
30
|
+
});
|
|
31
|
+
export type RuleViolation = z.infer<typeof RuleViolationSchema>;
|
|
32
|
+
|
|
33
|
+
export const RuleResultSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
ruleId: z.string().min(1),
|
|
36
|
+
mode: EnforcementModeSchema,
|
|
37
|
+
outcome: RuleOutcomeSchema,
|
|
38
|
+
// New violations only. Violations accepted by the baseline are counted.
|
|
39
|
+
violations: z.array(RuleViolationSchema),
|
|
40
|
+
baselined: z.number().int().nonnegative(),
|
|
41
|
+
detail: z.string().optional(),
|
|
42
|
+
})
|
|
43
|
+
.superRefine((result, ctx) => {
|
|
44
|
+
if (result.outcome === 'violations' && result.violations.length === 0) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: z.ZodIssueCode.custom,
|
|
47
|
+
message: 'a violations outcome must list at least one violation',
|
|
48
|
+
path: ['violations'],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (result.outcome !== 'violations' && result.violations.length > 0) {
|
|
52
|
+
ctx.addIssue({
|
|
53
|
+
code: z.ZodIssueCode.custom,
|
|
54
|
+
message: `outcome ${result.outcome} cannot carry violations`,
|
|
55
|
+
path: ['violations'],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export type RuleResult = z.infer<typeof RuleResultSchema>;
|
|
60
|
+
|
|
61
|
+
export const GateStatusSchema = z.enum(['passed', 'failed', 'blocked']);
|
|
62
|
+
export type GateStatus = z.infer<typeof GateStatusSchema>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Gate roll-up over blocking rules only. New violations fail the gate. Any
|
|
66
|
+
* other non-passing outcome from a blocking rule blocks it: the rule could not
|
|
67
|
+
* be verified, which is not the same as clean.
|
|
68
|
+
*/
|
|
69
|
+
export function rollupRuleGate(results: ReadonlyArray<RuleResult>): GateStatus {
|
|
70
|
+
const blocking = results.filter((r) => r.mode === 'blocking');
|
|
71
|
+
if (blocking.some((r) => r.outcome === 'violations')) return 'failed';
|
|
72
|
+
if (blocking.some((r) => r.outcome !== 'passed')) return 'blocked';
|
|
73
|
+
return 'passed';
|
|
74
|
+
}
|