@agentic-sdlc-kit/contracts 0.9.1 → 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 +2 -2
- 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 +4 -4
- package/dist/secret-guard/finding.d.ts +10 -10
- 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/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/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
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { z } from 'zod';
|
|
6
|
+
import { BaselineEntrySchema, EngineeringRuleSchema } from './rule.js';
|
|
7
|
+
export const CommitRefSchema = z.object({
|
|
8
|
+
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
9
|
+
author: z.string(),
|
|
10
|
+
date: z.string().min(1),
|
|
11
|
+
subject: z.string(),
|
|
12
|
+
});
|
|
13
|
+
export const RuleExplanationSchema = z.object({
|
|
14
|
+
schemaVersion: z.literal(1),
|
|
15
|
+
ruleId: z.string().min(1),
|
|
16
|
+
file: z.string().min(1),
|
|
17
|
+
rule: EngineeringRuleSchema,
|
|
18
|
+
// Null when the rule file has no committed history (uncommitted, or not a git repository).
|
|
19
|
+
introducedIn: CommitRefSchema.nullable(),
|
|
20
|
+
lastChangedIn: CommitRefSchema.nullable(),
|
|
21
|
+
// Repository files the rule's scope matches now.
|
|
22
|
+
matchedFiles: z.number().int().nonnegative(),
|
|
23
|
+
});
|
|
24
|
+
export const BaselineChangeSchema = z.object({
|
|
25
|
+
before: BaselineEntrySchema,
|
|
26
|
+
after: BaselineEntrySchema,
|
|
27
|
+
});
|
|
28
|
+
export const BaselineDiffSchema = z.object({
|
|
29
|
+
schemaVersion: z.literal(1),
|
|
30
|
+
// Added entries loosen the gate and need an explicit --accept.
|
|
31
|
+
added: z.array(BaselineEntrySchema),
|
|
32
|
+
// Removed entries tighten the gate.
|
|
33
|
+
removed: z.array(BaselineEntrySchema),
|
|
34
|
+
changed: z.array(BaselineChangeSchema),
|
|
35
|
+
accepted: z.boolean(),
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=cli-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-output.js","sourceRoot":"","sources":["../../src/constitution/cli-output.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,qBAAqB;IAC3B,2FAA2F;IAC3F,YAAY,EAAE,eAAe,CAAC,QAAQ,EAAE;IACxC,aAAa,EAAE,eAAe,CAAC,QAAQ,EAAE;IACzC,iDAAiD;IACjD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC7C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,mBAAmB;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,+DAA+D;IAC/D,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACnC,oCAAoC;IACpC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constitution/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constitution/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RULE_OUTCOMES: readonly ["passed", "violations", "adapter-unavailable", "adapter-error", "timed-out", "not-evaluated"];
|
|
3
|
+
export declare const RuleOutcomeSchema: z.ZodEnum<["passed", "violations", "adapter-unavailable", "adapter-error", "timed-out", "not-evaluated"]>;
|
|
4
|
+
export type RuleOutcome = z.infer<typeof RuleOutcomeSchema>;
|
|
5
|
+
export declare const RuleViolationSchema: z.ZodObject<{
|
|
6
|
+
ruleId: z.ZodString;
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
fingerprint: z.ZodString;
|
|
9
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
message: string;
|
|
14
|
+
ruleId: string;
|
|
15
|
+
fingerprint: string;
|
|
16
|
+
line?: number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
path: string;
|
|
19
|
+
message: string;
|
|
20
|
+
ruleId: string;
|
|
21
|
+
fingerprint: string;
|
|
22
|
+
line?: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type RuleViolation = z.infer<typeof RuleViolationSchema>;
|
|
25
|
+
export declare const RuleResultSchema: z.ZodEffects<z.ZodObject<{
|
|
26
|
+
ruleId: z.ZodString;
|
|
27
|
+
mode: z.ZodEnum<["off", "shadow", "advisory", "blocking"]>;
|
|
28
|
+
outcome: z.ZodEnum<["passed", "violations", "adapter-unavailable", "adapter-error", "timed-out", "not-evaluated"]>;
|
|
29
|
+
violations: z.ZodArray<z.ZodObject<{
|
|
30
|
+
ruleId: z.ZodString;
|
|
31
|
+
path: z.ZodString;
|
|
32
|
+
fingerprint: z.ZodString;
|
|
33
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
message: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
path: string;
|
|
37
|
+
message: string;
|
|
38
|
+
ruleId: string;
|
|
39
|
+
fingerprint: string;
|
|
40
|
+
line?: number | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
path: string;
|
|
43
|
+
message: string;
|
|
44
|
+
ruleId: string;
|
|
45
|
+
fingerprint: string;
|
|
46
|
+
line?: number | undefined;
|
|
47
|
+
}>, "many">;
|
|
48
|
+
baselined: z.ZodNumber;
|
|
49
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
ruleId: string;
|
|
52
|
+
mode: "off" | "shadow" | "advisory" | "blocking";
|
|
53
|
+
violations: {
|
|
54
|
+
path: string;
|
|
55
|
+
message: string;
|
|
56
|
+
ruleId: string;
|
|
57
|
+
fingerprint: string;
|
|
58
|
+
line?: number | undefined;
|
|
59
|
+
}[];
|
|
60
|
+
outcome: "passed" | "violations" | "adapter-unavailable" | "adapter-error" | "timed-out" | "not-evaluated";
|
|
61
|
+
baselined: number;
|
|
62
|
+
detail?: string | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
ruleId: string;
|
|
65
|
+
mode: "off" | "shadow" | "advisory" | "blocking";
|
|
66
|
+
violations: {
|
|
67
|
+
path: string;
|
|
68
|
+
message: string;
|
|
69
|
+
ruleId: string;
|
|
70
|
+
fingerprint: string;
|
|
71
|
+
line?: number | undefined;
|
|
72
|
+
}[];
|
|
73
|
+
outcome: "passed" | "violations" | "adapter-unavailable" | "adapter-error" | "timed-out" | "not-evaluated";
|
|
74
|
+
baselined: number;
|
|
75
|
+
detail?: string | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
ruleId: string;
|
|
78
|
+
mode: "off" | "shadow" | "advisory" | "blocking";
|
|
79
|
+
violations: {
|
|
80
|
+
path: string;
|
|
81
|
+
message: string;
|
|
82
|
+
ruleId: string;
|
|
83
|
+
fingerprint: string;
|
|
84
|
+
line?: number | undefined;
|
|
85
|
+
}[];
|
|
86
|
+
outcome: "passed" | "violations" | "adapter-unavailable" | "adapter-error" | "timed-out" | "not-evaluated";
|
|
87
|
+
baselined: number;
|
|
88
|
+
detail?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
ruleId: string;
|
|
91
|
+
mode: "off" | "shadow" | "advisory" | "blocking";
|
|
92
|
+
violations: {
|
|
93
|
+
path: string;
|
|
94
|
+
message: string;
|
|
95
|
+
ruleId: string;
|
|
96
|
+
fingerprint: string;
|
|
97
|
+
line?: number | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
outcome: "passed" | "violations" | "adapter-unavailable" | "adapter-error" | "timed-out" | "not-evaluated";
|
|
100
|
+
baselined: number;
|
|
101
|
+
detail?: string | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
export type RuleResult = z.infer<typeof RuleResultSchema>;
|
|
104
|
+
export declare const GateStatusSchema: z.ZodEnum<["passed", "failed", "blocked"]>;
|
|
105
|
+
export type GateStatus = z.infer<typeof GateStatusSchema>;
|
|
106
|
+
/**
|
|
107
|
+
* Gate roll-up over blocking rules only. New violations fail the gate. Any
|
|
108
|
+
* other non-passing outcome from a blocking rule blocks it: the rule could not
|
|
109
|
+
* be verified, which is not the same as clean.
|
|
110
|
+
*/
|
|
111
|
+
export declare function rollupRuleGate(results: ReadonlyArray<RuleResult>): GateStatus;
|
|
112
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/constitution/result.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa,yGAOhB,CAAC;AACX,eAAO,MAAM,iBAAiB,2GAAwB,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAM9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBzB,CAAC;AACL,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB,4CAA0C,CAAC;AACxE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,UAAU,CAK7E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
import { z } from 'zod';
|
|
10
|
+
import { EnforcementModeSchema } from './rule.js';
|
|
11
|
+
export const RULE_OUTCOMES = [
|
|
12
|
+
'passed',
|
|
13
|
+
'violations',
|
|
14
|
+
'adapter-unavailable',
|
|
15
|
+
'adapter-error',
|
|
16
|
+
'timed-out',
|
|
17
|
+
'not-evaluated',
|
|
18
|
+
];
|
|
19
|
+
export const RuleOutcomeSchema = z.enum(RULE_OUTCOMES);
|
|
20
|
+
export const RuleViolationSchema = z.object({
|
|
21
|
+
ruleId: z.string().min(1),
|
|
22
|
+
path: z.string().min(1),
|
|
23
|
+
fingerprint: z.string().regex(/^[0-9a-f]{64}$/, 'fingerprint must be sha256 hex'),
|
|
24
|
+
line: z.number().int().positive().optional(),
|
|
25
|
+
message: z.string().min(1),
|
|
26
|
+
});
|
|
27
|
+
export const RuleResultSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
ruleId: z.string().min(1),
|
|
30
|
+
mode: EnforcementModeSchema,
|
|
31
|
+
outcome: RuleOutcomeSchema,
|
|
32
|
+
// New violations only. Violations accepted by the baseline are counted.
|
|
33
|
+
violations: z.array(RuleViolationSchema),
|
|
34
|
+
baselined: z.number().int().nonnegative(),
|
|
35
|
+
detail: z.string().optional(),
|
|
36
|
+
})
|
|
37
|
+
.superRefine((result, ctx) => {
|
|
38
|
+
if (result.outcome === 'violations' && result.violations.length === 0) {
|
|
39
|
+
ctx.addIssue({
|
|
40
|
+
code: z.ZodIssueCode.custom,
|
|
41
|
+
message: 'a violations outcome must list at least one violation',
|
|
42
|
+
path: ['violations'],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (result.outcome !== 'violations' && result.violations.length > 0) {
|
|
46
|
+
ctx.addIssue({
|
|
47
|
+
code: z.ZodIssueCode.custom,
|
|
48
|
+
message: `outcome ${result.outcome} cannot carry violations`,
|
|
49
|
+
path: ['violations'],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export const GateStatusSchema = z.enum(['passed', 'failed', 'blocked']);
|
|
54
|
+
/**
|
|
55
|
+
* Gate roll-up over blocking rules only. New violations fail the gate. Any
|
|
56
|
+
* other non-passing outcome from a blocking rule blocks it: the rule could not
|
|
57
|
+
* be verified, which is not the same as clean.
|
|
58
|
+
*/
|
|
59
|
+
export function rollupRuleGate(results) {
|
|
60
|
+
const blocking = results.filter((r) => r.mode === 'blocking');
|
|
61
|
+
if (blocking.some((r) => r.outcome === 'violations'))
|
|
62
|
+
return 'failed';
|
|
63
|
+
if (blocking.some((r) => r.outcome !== 'passed'))
|
|
64
|
+
return 'blocked';
|
|
65
|
+
return 'passed';
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/constitution/result.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,gEAAgE;AAChE,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,sEAAsE;AACtE,2BAA2B;AAE3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EA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