@agentic-sdlc-kit/contracts 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/improvement/config.d.ts +24 -0
- package/dist/improvement/config.d.ts.map +1 -0
- package/dist/improvement/config.js +23 -0
- package/dist/improvement/config.js.map +1 -0
- package/dist/improvement/finding.d.ts +96 -0
- package/dist/improvement/finding.d.ts.map +1 -0
- package/dist/improvement/finding.js +40 -0
- package/dist/improvement/finding.js.map +1 -0
- package/dist/improvement/index.d.ts +6 -0
- package/dist/improvement/index.d.ts.map +1 -0
- package/dist/improvement/index.js +13 -0
- package/dist/improvement/index.js.map +1 -0
- package/dist/improvement/issue.d.ts +54 -0
- package/dist/improvement/issue.d.ts.map +1 -0
- package/dist/improvement/issue.js +23 -0
- package/dist/improvement/issue.js.map +1 -0
- package/dist/improvement/kit-feedback.d.ts +46 -0
- package/dist/improvement/kit-feedback.d.ts.map +1 -0
- package/dist/improvement/kit-feedback.js +52 -0
- package/dist/improvement/kit-feedback.js.map +1 -0
- package/dist/improvement/review.d.ts +36 -0
- package/dist/improvement/review.d.ts.map +1 -0
- package/dist/improvement/review.js +35 -0
- package/dist/improvement/review.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/secret-guard/detection-rule.d.ts.map +1 -1
- package/dist/secret-guard/detection-rule.js +11 -0
- package/dist/secret-guard/detection-rule.js.map +1 -1
- package/package.json +1 -1
- package/src/improvement/config.ts +26 -0
- package/src/improvement/finding.ts +49 -0
- package/src/improvement/index.ts +12 -0
- package/src/improvement/issue.ts +32 -0
- package/src/improvement/kit-feedback.ts +58 -0
- package/src/improvement/review.ts +40 -0
- package/src/index.ts +3 -0
- package/src/secret-guard/detection-rule.ts +11 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ImprovementConfigSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodLiteral<1>;
|
|
4
|
+
kitFeedback: z.ZodDefault<z.ZodObject<{
|
|
5
|
+
capture: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
capture: boolean;
|
|
8
|
+
}, {
|
|
9
|
+
capture?: boolean | undefined;
|
|
10
|
+
}>>;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
version: 1;
|
|
13
|
+
kitFeedback: {
|
|
14
|
+
capture: boolean;
|
|
15
|
+
};
|
|
16
|
+
}, {
|
|
17
|
+
version: 1;
|
|
18
|
+
kitFeedback?: {
|
|
19
|
+
capture?: boolean | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type ImprovementConfig = z.infer<typeof ImprovementConfigSchema>;
|
|
23
|
+
export declare const DEFAULT_IMPROVEMENT_CONFIG: ImprovementConfig;
|
|
24
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/improvement/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;EAYzB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,0BAA0B,EAAE,iBAGxC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/config.ts
|
|
2
|
+
//
|
|
3
|
+
// `.ai-kit/improvement.yml` (ADR-0028, ADR-0008). Unknown keys are errors, never ignored.
|
|
4
|
+
// Every capability that records or sends anything is off unless the user turns it on.
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const ImprovementConfigSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
kitFeedback: z
|
|
10
|
+
.object({
|
|
11
|
+
// Opt-in: record sanitized kit failures locally. Recording never sends anything;
|
|
12
|
+
// submission is a separate, explicit command run by the user.
|
|
13
|
+
capture: z.boolean().default(false),
|
|
14
|
+
})
|
|
15
|
+
.strict()
|
|
16
|
+
.default({}),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
export const DEFAULT_IMPROVEMENT_CONFIG = {
|
|
20
|
+
version: 1,
|
|
21
|
+
kitFeedback: { capture: false },
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/improvement/config.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,0FAA0F;AAC1F,sFAAsF;AAEtF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,iFAAiF;QACjF,8DAA8D;QAC9D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;KACpC,CAAC;SACD,MAAM,EAAE;SACR,OAAO,CAAC,EAAE,CAAC;CACf,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;CAChC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FINDING_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const FindingSeveritySchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
4
|
+
export type FindingSeverity = z.infer<typeof FindingSeveritySchema>;
|
|
5
|
+
export declare const RuleIdSchema: z.ZodString;
|
|
6
|
+
export declare const RepoPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
export declare const FindingSchema: z.ZodObject<{
|
|
8
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
9
|
+
rule: z.ZodString;
|
|
10
|
+
severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
11
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
12
|
+
line: z.ZodNumber;
|
|
13
|
+
column: z.ZodNumber;
|
|
14
|
+
fingerprint: z.ZodString;
|
|
15
|
+
}, "strict", z.ZodTypeAny, {
|
|
16
|
+
path: string;
|
|
17
|
+
schemaVersion: 1;
|
|
18
|
+
line: number;
|
|
19
|
+
fingerprint: string;
|
|
20
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
21
|
+
column: number;
|
|
22
|
+
rule: string;
|
|
23
|
+
}, {
|
|
24
|
+
path: string;
|
|
25
|
+
schemaVersion: 1;
|
|
26
|
+
line: number;
|
|
27
|
+
fingerprint: string;
|
|
28
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
29
|
+
column: number;
|
|
30
|
+
rule: string;
|
|
31
|
+
}>;
|
|
32
|
+
export type Finding = z.infer<typeof FindingSchema>;
|
|
33
|
+
export declare const ScanReportSchema: z.ZodObject<{
|
|
34
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
35
|
+
mode: z.ZodString;
|
|
36
|
+
scannedFiles: z.ZodNumber;
|
|
37
|
+
skippedFiles: z.ZodNumber;
|
|
38
|
+
ignoredGlobs: z.ZodNumber;
|
|
39
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
40
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
41
|
+
rule: z.ZodString;
|
|
42
|
+
severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
43
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
44
|
+
line: z.ZodNumber;
|
|
45
|
+
column: z.ZodNumber;
|
|
46
|
+
fingerprint: z.ZodString;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
path: string;
|
|
49
|
+
schemaVersion: 1;
|
|
50
|
+
line: number;
|
|
51
|
+
fingerprint: string;
|
|
52
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
53
|
+
column: number;
|
|
54
|
+
rule: string;
|
|
55
|
+
}, {
|
|
56
|
+
path: string;
|
|
57
|
+
schemaVersion: 1;
|
|
58
|
+
line: number;
|
|
59
|
+
fingerprint: string;
|
|
60
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
61
|
+
column: number;
|
|
62
|
+
rule: string;
|
|
63
|
+
}>, "many">;
|
|
64
|
+
}, "strict", z.ZodTypeAny, {
|
|
65
|
+
schemaVersion: 1;
|
|
66
|
+
mode: string;
|
|
67
|
+
findings: {
|
|
68
|
+
path: string;
|
|
69
|
+
schemaVersion: 1;
|
|
70
|
+
line: number;
|
|
71
|
+
fingerprint: string;
|
|
72
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
73
|
+
column: number;
|
|
74
|
+
rule: string;
|
|
75
|
+
}[];
|
|
76
|
+
scannedFiles: number;
|
|
77
|
+
skippedFiles: number;
|
|
78
|
+
ignoredGlobs: number;
|
|
79
|
+
}, {
|
|
80
|
+
schemaVersion: 1;
|
|
81
|
+
mode: string;
|
|
82
|
+
findings: {
|
|
83
|
+
path: string;
|
|
84
|
+
schemaVersion: 1;
|
|
85
|
+
line: number;
|
|
86
|
+
fingerprint: string;
|
|
87
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
88
|
+
column: number;
|
|
89
|
+
rule: string;
|
|
90
|
+
}[];
|
|
91
|
+
scannedFiles: number;
|
|
92
|
+
skippedFiles: number;
|
|
93
|
+
ignoredGlobs: number;
|
|
94
|
+
}>;
|
|
95
|
+
export type ScanReport = z.infer<typeof ScanReportSchema>;
|
|
96
|
+
//# sourceMappingURL=finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.d.ts","sourceRoot":"","sources":["../../src/improvement/finding.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AAGjD,eAAO,MAAM,qBAAqB,kDAAgD,CAAC;AACnF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,YAAY,aAA2C,CAAC;AAGrE,eAAO,MAAM,cAAc,2CAKvB,CAAC;AAEL,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAUf,CAAC;AACZ,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASlB,CAAC;AACZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/finding.ts
|
|
2
|
+
//
|
|
3
|
+
// A finding is one deterministic observation about a repository: a rule matched at a location.
|
|
4
|
+
// INVARIANT: a finding never carries the matched value. Only the rule, the location and a
|
|
5
|
+
// fingerprint are stored, so findings, reports, issues and logs cannot leak the data they describe.
|
|
6
|
+
// The fingerprint is derived from rule, path, line and column, never from the value.
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export const FINDING_SCHEMA_VERSION = 1;
|
|
9
|
+
// Same ladder as the secret-guard finding contract, so PII and secret findings share one scale.
|
|
10
|
+
export const FindingSeveritySchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
11
|
+
export const RuleIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/);
|
|
12
|
+
// Repository-relative path, forward slashes, never absolute.
|
|
13
|
+
export const RepoPathSchema = z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.refine((p) => !p.startsWith('/') && !p.includes('\\'), {
|
|
17
|
+
message: 'path must be repository-relative with forward slashes',
|
|
18
|
+
});
|
|
19
|
+
export const FindingSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
22
|
+
rule: RuleIdSchema,
|
|
23
|
+
severity: FindingSeveritySchema,
|
|
24
|
+
path: RepoPathSchema,
|
|
25
|
+
line: z.number().int().positive(),
|
|
26
|
+
column: z.number().int().positive(),
|
|
27
|
+
fingerprint: z.string().regex(/^[0-9a-f]{16}$/),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
export const ScanReportSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
33
|
+
mode: z.string().min(1),
|
|
34
|
+
scannedFiles: z.number().int().nonnegative(),
|
|
35
|
+
skippedFiles: z.number().int().nonnegative(),
|
|
36
|
+
ignoredGlobs: z.number().int().nonnegative(),
|
|
37
|
+
findings: z.array(FindingSchema),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
//# sourceMappingURL=finding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.js","sourceRoot":"","sources":["../../src/improvement/finding.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,+FAA+F;AAC/F,0FAA0F;AAC1F,oGAAoG;AACpG,qFAAqF;AAErF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAU,CAAC;AAEjD,gGAAgG;AAChG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CA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AM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC5C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC5C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CACjC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/improvement/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/index.ts
|
|
2
|
+
// Continuous-improvement contracts (ADR-0028).
|
|
3
|
+
// finding deterministic findings for the "project" target (never sent upstream)
|
|
4
|
+
// issue findings grouped by rule and path: one group, one project issue
|
|
5
|
+
// kit-feedback allowlisted records about the kit itself (the "kit" target)
|
|
6
|
+
// config .ai-kit/improvement.yml
|
|
7
|
+
// review focused AI review requests, served by ci-agent's gated workflow
|
|
8
|
+
export * from './finding.js';
|
|
9
|
+
export * from './issue.js';
|
|
10
|
+
export * from './kit-feedback.js';
|
|
11
|
+
export * from './config.js';
|
|
12
|
+
export * from './review.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/improvement/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,+CAA+C;AAC/C,wFAAwF;AACxF,kFAAkF;AAClF,8EAA8E;AAC9E,0CAA0C;AAC1C,kFAAkF;AAClF,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const IssueKeySchema: z.ZodString;
|
|
3
|
+
export declare const FindingLocationSchema: z.ZodObject<{
|
|
4
|
+
line: z.ZodNumber;
|
|
5
|
+
column: z.ZodNumber;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
line: number;
|
|
8
|
+
column: number;
|
|
9
|
+
}, {
|
|
10
|
+
line: number;
|
|
11
|
+
column: number;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const FindingGroupSchema: z.ZodObject<{
|
|
14
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
15
|
+
key: z.ZodString;
|
|
16
|
+
rule: z.ZodString;
|
|
17
|
+
severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
18
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
19
|
+
count: z.ZodNumber;
|
|
20
|
+
locations: z.ZodArray<z.ZodObject<{
|
|
21
|
+
line: z.ZodNumber;
|
|
22
|
+
column: z.ZodNumber;
|
|
23
|
+
}, "strict", z.ZodTypeAny, {
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
}, {
|
|
27
|
+
line: number;
|
|
28
|
+
column: number;
|
|
29
|
+
}>, "many">;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
path: string;
|
|
32
|
+
schemaVersion: 1;
|
|
33
|
+
count: number;
|
|
34
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
35
|
+
key: string;
|
|
36
|
+
rule: string;
|
|
37
|
+
locations: {
|
|
38
|
+
line: number;
|
|
39
|
+
column: number;
|
|
40
|
+
}[];
|
|
41
|
+
}, {
|
|
42
|
+
path: string;
|
|
43
|
+
schemaVersion: 1;
|
|
44
|
+
count: number;
|
|
45
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
46
|
+
key: string;
|
|
47
|
+
rule: string;
|
|
48
|
+
locations: {
|
|
49
|
+
line: number;
|
|
50
|
+
column: number;
|
|
51
|
+
}[];
|
|
52
|
+
}>;
|
|
53
|
+
export type FindingGroup = z.infer<typeof FindingGroupSchema>;
|
|
54
|
+
//# sourceMappingURL=issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/improvement/issue.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,cAAc,aAAqC,CAAC;AAEjE,eAAO,MAAM,qBAAqB;;;;;;;;;EAEvB,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/issue.ts
|
|
2
|
+
//
|
|
3
|
+
// Project-target issues (ADR-0028 §8). Findings of one rule in one file form one group, and one
|
|
4
|
+
// group is one GitHub issue. The key is derived from rule and path only, so it survives line moves
|
|
5
|
+
// and never carries the matched value; it is the duplicate-detection token in the issue body.
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { FINDING_SCHEMA_VERSION, FindingSeveritySchema, RepoPathSchema, RuleIdSchema, } from './finding.js';
|
|
8
|
+
export const IssueKeySchema = z.string().regex(/^[0-9a-f]{16}$/);
|
|
9
|
+
export const FindingLocationSchema = z
|
|
10
|
+
.object({ line: z.number().int().positive(), column: z.number().int().positive() })
|
|
11
|
+
.strict();
|
|
12
|
+
export const FindingGroupSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
15
|
+
key: IssueKeySchema,
|
|
16
|
+
rule: RuleIdSchema,
|
|
17
|
+
severity: FindingSeveritySchema,
|
|
18
|
+
path: RepoPathSchema,
|
|
19
|
+
count: z.number().int().positive(),
|
|
20
|
+
locations: z.array(FindingLocationSchema).min(1),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
//# sourceMappingURL=issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue.js","sourceRoot":"","sources":["../../src/improvement/issue.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,gGAAgG;AAChG,mGAAmG;AACnG,8FAA8F;AAE9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;KAClF,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAChD,GAAG,EAAE,cAAc;IACnB,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,qBAAqB;IAC/B,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACjD,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const KIT_FEEDBACK_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const KIT_FEEDBACK_ERROR_CODES: readonly ["ENOENT", "EACCES", "EPERM", "EEXIST", "ENOTDIR", "EISDIR", "ENOTEMPTY", "EMFILE", "EPIPE", "ETIMEDOUT", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "ERR_MODULE_NOT_FOUND", "ERR_INVALID_ARG_TYPE"];
|
|
4
|
+
export declare const KitFeedbackErrorCodeSchema: z.ZodEnum<["ENOENT", "EACCES", "EPERM", "EEXIST", "ENOTDIR", "EISDIR", "ENOTEMPTY", "EMFILE", "EPIPE", "ETIMEDOUT", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "ERR_MODULE_NOT_FOUND", "ERR_INVALID_ARG_TYPE"]>;
|
|
5
|
+
export type KitFeedbackErrorCode = z.infer<typeof KitFeedbackErrorCodeSchema>;
|
|
6
|
+
export declare const KIT_FEEDBACK_TEXT_MAX = 240;
|
|
7
|
+
export declare const KIT_FEEDBACK_TEXT_PATTERN: RegExp;
|
|
8
|
+
export declare const KitFeedbackSchema: z.ZodObject<{
|
|
9
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
kitVersion: z.ZodString;
|
|
12
|
+
command: z.ZodString;
|
|
13
|
+
failure: z.ZodEnum<["runtime-error", "internal-error"]>;
|
|
14
|
+
exitCode: z.ZodNumber;
|
|
15
|
+
errorCode: z.ZodOptional<z.ZodEnum<["ENOENT", "EACCES", "EPERM", "EEXIST", "ENOTDIR", "EISDIR", "ENOTEMPTY", "EMFILE", "EPIPE", "ETIMEDOUT", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "ERR_MODULE_NOT_FOUND", "ERR_INVALID_ARG_TYPE"]>>;
|
|
16
|
+
errorText: z.ZodOptional<z.ZodString>;
|
|
17
|
+
os: z.ZodEnum<["linux", "darwin", "win32", "other"]>;
|
|
18
|
+
nodeMajor: z.ZodNumber;
|
|
19
|
+
occurrences: z.ZodNumber;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
schemaVersion: 1;
|
|
22
|
+
command: string;
|
|
23
|
+
key: string;
|
|
24
|
+
failure: "runtime-error" | "internal-error";
|
|
25
|
+
kitVersion: string;
|
|
26
|
+
exitCode: number;
|
|
27
|
+
os: "other" | "linux" | "darwin" | "win32";
|
|
28
|
+
nodeMajor: number;
|
|
29
|
+
occurrences: number;
|
|
30
|
+
errorCode?: "ENOENT" | "EACCES" | "EPERM" | "EEXIST" | "ENOTDIR" | "EISDIR" | "ENOTEMPTY" | "EMFILE" | "EPIPE" | "ETIMEDOUT" | "ECONNREFUSED" | "ECONNRESET" | "ENOTFOUND" | "ERR_MODULE_NOT_FOUND" | "ERR_INVALID_ARG_TYPE" | undefined;
|
|
31
|
+
errorText?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
schemaVersion: 1;
|
|
34
|
+
command: string;
|
|
35
|
+
key: string;
|
|
36
|
+
failure: "runtime-error" | "internal-error";
|
|
37
|
+
kitVersion: string;
|
|
38
|
+
exitCode: number;
|
|
39
|
+
os: "other" | "linux" | "darwin" | "win32";
|
|
40
|
+
nodeMajor: number;
|
|
41
|
+
occurrences: number;
|
|
42
|
+
errorCode?: "ENOENT" | "EACCES" | "EPERM" | "EEXIST" | "ENOTDIR" | "EISDIR" | "ENOTEMPTY" | "EMFILE" | "EPIPE" | "ETIMEDOUT" | "ECONNREFUSED" | "ECONNRESET" | "ENOTFOUND" | "ERR_MODULE_NOT_FOUND" | "ERR_INVALID_ARG_TYPE" | undefined;
|
|
43
|
+
errorText?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export type KitFeedback = z.infer<typeof KitFeedbackSchema>;
|
|
46
|
+
//# sourceMappingURL=kit-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-feedback.d.ts","sourceRoot":"","sources":["../../src/improvement/kit-feedback.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B,EAAG,CAAU,CAAC;AAGtD,eAAO,MAAM,wBAAwB,+MAgB3B,CAAC;AACX,eAAO,MAAM,0BAA0B,iNAAmC,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,yBAAyB,QAA+B,CAAC;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/kit-feedback.ts
|
|
2
|
+
//
|
|
3
|
+
// Upstream kit feedback (ADR-0028, "kit" target). A record about a failure of the kit itself,
|
|
4
|
+
// drafted inside a user's installation and submitted upstream only by that user.
|
|
5
|
+
//
|
|
6
|
+
// INVARIANT: the record is an allowlist. Every field is kit-owned or an enumeration. The only text
|
|
7
|
+
// field, `errorText`, is scrubbed before it is stored and must match a character set that cannot
|
|
8
|
+
// hold a path, an email, a quoted string or an identifier with underscores. Nothing about the
|
|
9
|
+
// user's project, repository or identity can be represented.
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export const KIT_FEEDBACK_SCHEMA_VERSION = 1;
|
|
12
|
+
// Generic Node error codes. They describe the failure class, never the user's project.
|
|
13
|
+
export const KIT_FEEDBACK_ERROR_CODES = [
|
|
14
|
+
'ENOENT',
|
|
15
|
+
'EACCES',
|
|
16
|
+
'EPERM',
|
|
17
|
+
'EEXIST',
|
|
18
|
+
'ENOTDIR',
|
|
19
|
+
'EISDIR',
|
|
20
|
+
'ENOTEMPTY',
|
|
21
|
+
'EMFILE',
|
|
22
|
+
'EPIPE',
|
|
23
|
+
'ETIMEDOUT',
|
|
24
|
+
'ECONNREFUSED',
|
|
25
|
+
'ECONNRESET',
|
|
26
|
+
'ENOTFOUND',
|
|
27
|
+
'ERR_MODULE_NOT_FOUND',
|
|
28
|
+
'ERR_INVALID_ARG_TYPE',
|
|
29
|
+
];
|
|
30
|
+
export const KitFeedbackErrorCodeSchema = z.enum(KIT_FEEDBACK_ERROR_CODES);
|
|
31
|
+
export const KIT_FEEDBACK_TEXT_MAX = 240;
|
|
32
|
+
// No `/`, `\`, `@`, quotes, backticks or underscores: a surviving path, email, quoted name or
|
|
33
|
+
// snake_case identifier fails validation even if the scrubber missed it.
|
|
34
|
+
export const KIT_FEEDBACK_TEXT_PATTERN = /^[A-Za-z0-9 .,:;!?()<>-]*$/;
|
|
35
|
+
export const KitFeedbackSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
schemaVersion: z.literal(KIT_FEEDBACK_SCHEMA_VERSION),
|
|
38
|
+
// Derived from kit-level fields only, so two users with the same bug share a key and no key
|
|
39
|
+
// identifies a user or an installation.
|
|
40
|
+
key: z.string().regex(/^[0-9a-f]{16}$/),
|
|
41
|
+
kitVersion: z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),
|
|
42
|
+
command: z.string().regex(/^[a-z][a-z-]{0,31}$/),
|
|
43
|
+
failure: z.enum(['runtime-error', 'internal-error']),
|
|
44
|
+
exitCode: z.number().int().min(0).max(255),
|
|
45
|
+
errorCode: KitFeedbackErrorCodeSchema.optional(),
|
|
46
|
+
errorText: z.string().max(KIT_FEEDBACK_TEXT_MAX).regex(KIT_FEEDBACK_TEXT_PATTERN).optional(),
|
|
47
|
+
os: z.enum(['linux', 'darwin', 'win32', 'other']),
|
|
48
|
+
nodeMajor: z.number().int().positive(),
|
|
49
|
+
occurrences: z.number().int().positive(),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
//# sourceMappingURL=kit-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-feedback.js","sourceRoot":"","sources":["../../src/improvement/kit-feedback.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,8FAA8F;AAC9F,iFAAiF;AACjF,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,8FAA8F;AAC9F,6DAA6D;AAE7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAU,CAAC;AAEtD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,OAAO;IACP,WAAW;IACX,cAAc;IACd,YAAY;IACZ,WAAW;IACX,sBAAsB;IACtB,sBAAsB;CACd,CAAC;AACX,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAG3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,8FAA8F;AAC9F,yEAAyE;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;IACrD,4FAA4F;IAC5F,wCAAwC;IACxC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC;IACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1C,SAAS,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAChD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,QAAQ,EAAE;IAC5F,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const REVIEW_KINDS: readonly ["correctness", "security", "testing", "architecture", "performance", "maintainability", "documentation", "custom"];
|
|
3
|
+
export declare const ReviewKindSchema: z.ZodEnum<["correctness", "security", "testing", "architecture", "performance", "maintainability", "documentation", "custom"]>;
|
|
4
|
+
export type ReviewKind = z.infer<typeof ReviewKindSchema>;
|
|
5
|
+
export declare const REVIEW_INSTRUCTION_MAX = 500;
|
|
6
|
+
export declare const ReviewRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
7
|
+
pr: z.ZodNumber;
|
|
8
|
+
kind: z.ZodEnum<["correctness", "security", "testing", "architecture", "performance", "maintainability", "documentation", "custom"]>;
|
|
9
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
12
|
+
pr: number;
|
|
13
|
+
instruction?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
16
|
+
pr: number;
|
|
17
|
+
instruction?: string | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
20
|
+
pr: number;
|
|
21
|
+
instruction?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
24
|
+
pr: number;
|
|
25
|
+
instruction?: string | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
28
|
+
pr: number;
|
|
29
|
+
instruction?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
kind: "custom" | "architecture" | "security" | "performance" | "testing" | "documentation" | "correctness" | "maintainability";
|
|
32
|
+
pr: number;
|
|
33
|
+
instruction?: string | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
export type ReviewRequest = z.infer<typeof ReviewRequestSchema>;
|
|
36
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/improvement/review.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY,8HASf,CAAC;AACX,eAAO,MAAM,gBAAgB,gIAAuB,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc5B,CAAC;AACL,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/review.ts
|
|
2
|
+
//
|
|
3
|
+
// A focused AI review request (ADR-0028 §4, P2.4). The kit has no review engine of its own: it asks
|
|
4
|
+
// ci-agent's gated `ai-review.yml` workflow for one review with one responsibility. The kinds must
|
|
5
|
+
// match tools/ci-agent/src/review/request.ts and the workflow's `kind` choices; a test keeps all
|
|
6
|
+
// three in step.
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export const REVIEW_KINDS = [
|
|
9
|
+
'correctness',
|
|
10
|
+
'security',
|
|
11
|
+
'testing',
|
|
12
|
+
'architecture',
|
|
13
|
+
'performance',
|
|
14
|
+
'maintainability',
|
|
15
|
+
'documentation',
|
|
16
|
+
'custom',
|
|
17
|
+
];
|
|
18
|
+
export const ReviewKindSchema = z.enum(REVIEW_KINDS);
|
|
19
|
+
export const REVIEW_INSTRUCTION_MAX = 500;
|
|
20
|
+
export const ReviewRequestSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
pr: z.number().int().positive(),
|
|
23
|
+
kind: ReviewKindSchema,
|
|
24
|
+
instruction: z.string().trim().min(1).max(REVIEW_INSTRUCTION_MAX).optional(),
|
|
25
|
+
})
|
|
26
|
+
.strict()
|
|
27
|
+
.refine((r) => r.kind !== 'custom' || r.instruction !== undefined, {
|
|
28
|
+
message: 'a custom review needs an instruction',
|
|
29
|
+
path: ['instruction'],
|
|
30
|
+
})
|
|
31
|
+
.refine((r) => r.kind === 'custom' || r.instruction === undefined, {
|
|
32
|
+
message: 'only a custom review takes an instruction',
|
|
33
|
+
path: ['instruction'],
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -51,4 +51,6 @@ export * from './context/index.js';
|
|
|
51
51
|
export * from './benchmark/index.js';
|
|
52
52
|
// Per-run execution isolation (roadmap Phase 8, #49):
|
|
53
53
|
export * from './execution/index.js';
|
|
54
|
+
// Continuous improvement findings (deterministic scanners; no matched values):
|
|
55
|
+
export * from './improvement/index.js';
|
|
54
56
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,qEAAqE;AACrE,sEAAsE;AACtE,8DAA8D;AAC9D,sCAAsC;AAEtC,cAAc;AACd,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,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AAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC,cAAc;AACd,cAAc,wBAAwB,CAAC;AAEvC,mCAAmC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AAExC,uBAAuB;AACvB,cAAc,oBAAoB,CAAC;AAEnC,wBAAwB;AACxB,cAAc,qBAAqB,CAAC;AAEpC,sCAAsC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC,yBAAyB;AACzB,cAAc,sBAAsB,CAAC;AAErC,0BAA0B;AAC1B,cAAc,uBAAuB,CAAC;AAEtC,kCAAkC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAErC,oDAAoD;AACpD,cAAc,kBAAkB,CAAC;AAEjC,6CAA6C;AAC7C,cAAc,yBAAyB,CAAC;AAExC,0DAA0D;AAC1D,cAAc,oBAAoB,CAAC;AAEnC,iDAAiD;AACjD,cAAc,oBAAoB,CAAC;AAEnC,qDAAqD;AACrD,cAAc,sBAAsB,CAAC;AAErC,sDAAsD;AACtD,cAAc,sBAAsB,CAAC;AAErC,+EAA+E;AAC/E,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detection-rule.d.ts","sourceRoot":"","sources":["../../src/secret-guard/detection-rule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"detection-rule.d.ts","sourceRoot":"","sources":["../../src/secret-guard/detection-rule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,aAAa,CAoHhE,CAAC"}
|
|
@@ -149,5 +149,16 @@ export const BUILTIN_DETECTION_RULES = [
|
|
|
149
149
|
severity: 'critical',
|
|
150
150
|
enabled: true,
|
|
151
151
|
},
|
|
152
|
+
{
|
|
153
|
+
// The generic rule only catches quoted assignments of 32+ characters, so an env-style
|
|
154
|
+
// ANTHROPIC_API_KEY=sk-ant-... line needs its own rule. Kind stays generic-api-key so the
|
|
155
|
+
// SecretKind contract does not change.
|
|
156
|
+
id: 'anthropic-api-key',
|
|
157
|
+
name: 'Anthropic API Key',
|
|
158
|
+
kind: 'generic-api-key',
|
|
159
|
+
pattern: '\\bsk-ant-[A-Za-z0-9_-]{20,}',
|
|
160
|
+
severity: 'critical',
|
|
161
|
+
enabled: true,
|
|
162
|
+
},
|
|
152
163
|
];
|
|
153
164
|
//# sourceMappingURL=detection-rule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detection-rule.js","sourceRoot":"","sources":["../../src/secret-guard/detection-rule.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AAEzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,EAAE,GAAG,CAAC,IAAY,EAAU,EAAE,CAClC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,C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,EAAE,WAAW;QACf,IAAI,EAAE,oCAAoC;QAC1C,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;KACd;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iEAAiE;QACvE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;KACd;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,IAAI,EAAE,8CAA8C;QACpD,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;KACd;IACD;QACE,sFAAsF;QACtF,0FAA0F;QAC1F,uCAAuC;QACvC,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,8BAA8B;QACvC,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;KACd;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/config.ts
|
|
2
|
+
//
|
|
3
|
+
// `.ai-kit/improvement.yml` (ADR-0028, ADR-0008). Unknown keys are errors, never ignored.
|
|
4
|
+
// Every capability that records or sends anything is off unless the user turns it on.
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export const ImprovementConfigSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
version: z.literal(1),
|
|
11
|
+
kitFeedback: z
|
|
12
|
+
.object({
|
|
13
|
+
// Opt-in: record sanitized kit failures locally. Recording never sends anything;
|
|
14
|
+
// submission is a separate, explicit command run by the user.
|
|
15
|
+
capture: z.boolean().default(false),
|
|
16
|
+
})
|
|
17
|
+
.strict()
|
|
18
|
+
.default({}),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
export type ImprovementConfig = z.infer<typeof ImprovementConfigSchema>;
|
|
22
|
+
|
|
23
|
+
export const DEFAULT_IMPROVEMENT_CONFIG: ImprovementConfig = {
|
|
24
|
+
version: 1,
|
|
25
|
+
kitFeedback: { capture: false },
|
|
26
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/finding.ts
|
|
2
|
+
//
|
|
3
|
+
// A finding is one deterministic observation about a repository: a rule matched at a location.
|
|
4
|
+
// INVARIANT: a finding never carries the matched value. Only the rule, the location and a
|
|
5
|
+
// fingerprint are stored, so findings, reports, issues and logs cannot leak the data they describe.
|
|
6
|
+
// The fingerprint is derived from rule, path, line and column, never from the value.
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
export const FINDING_SCHEMA_VERSION = 1 as const;
|
|
11
|
+
|
|
12
|
+
// Same ladder as the secret-guard finding contract, so PII and secret findings share one scale.
|
|
13
|
+
export const FindingSeveritySchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
14
|
+
export type FindingSeverity = z.infer<typeof FindingSeveritySchema>;
|
|
15
|
+
|
|
16
|
+
export const RuleIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/);
|
|
17
|
+
|
|
18
|
+
// Repository-relative path, forward slashes, never absolute.
|
|
19
|
+
export const RepoPathSchema = z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.refine((p) => !p.startsWith('/') && !p.includes('\\'), {
|
|
23
|
+
message: 'path must be repository-relative with forward slashes',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const FindingSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
29
|
+
rule: RuleIdSchema,
|
|
30
|
+
severity: FindingSeveritySchema,
|
|
31
|
+
path: RepoPathSchema,
|
|
32
|
+
line: z.number().int().positive(),
|
|
33
|
+
column: z.number().int().positive(),
|
|
34
|
+
fingerprint: z.string().regex(/^[0-9a-f]{16}$/),
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
export type Finding = z.infer<typeof FindingSchema>;
|
|
38
|
+
|
|
39
|
+
export const ScanReportSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
42
|
+
mode: z.string().min(1),
|
|
43
|
+
scannedFiles: z.number().int().nonnegative(),
|
|
44
|
+
skippedFiles: z.number().int().nonnegative(),
|
|
45
|
+
ignoredGlobs: z.number().int().nonnegative(),
|
|
46
|
+
findings: z.array(FindingSchema),
|
|
47
|
+
})
|
|
48
|
+
.strict();
|
|
49
|
+
export type ScanReport = z.infer<typeof ScanReportSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/index.ts
|
|
2
|
+
// Continuous-improvement contracts (ADR-0028).
|
|
3
|
+
// finding deterministic findings for the "project" target (never sent upstream)
|
|
4
|
+
// issue findings grouped by rule and path: one group, one project issue
|
|
5
|
+
// kit-feedback allowlisted records about the kit itself (the "kit" target)
|
|
6
|
+
// config .ai-kit/improvement.yml
|
|
7
|
+
// review focused AI review requests, served by ci-agent's gated workflow
|
|
8
|
+
export * from './finding.js';
|
|
9
|
+
export * from './issue.js';
|
|
10
|
+
export * from './kit-feedback.js';
|
|
11
|
+
export * from './config.js';
|
|
12
|
+
export * from './review.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/issue.ts
|
|
2
|
+
//
|
|
3
|
+
// Project-target issues (ADR-0028 §8). Findings of one rule in one file form one group, and one
|
|
4
|
+
// group is one GitHub issue. The key is derived from rule and path only, so it survives line moves
|
|
5
|
+
// and never carries the matched value; it is the duplicate-detection token in the issue body.
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import {
|
|
9
|
+
FINDING_SCHEMA_VERSION,
|
|
10
|
+
FindingSeveritySchema,
|
|
11
|
+
RepoPathSchema,
|
|
12
|
+
RuleIdSchema,
|
|
13
|
+
} from './finding.js';
|
|
14
|
+
|
|
15
|
+
export const IssueKeySchema = z.string().regex(/^[0-9a-f]{16}$/);
|
|
16
|
+
|
|
17
|
+
export const FindingLocationSchema = z
|
|
18
|
+
.object({ line: z.number().int().positive(), column: z.number().int().positive() })
|
|
19
|
+
.strict();
|
|
20
|
+
|
|
21
|
+
export const FindingGroupSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
schemaVersion: z.literal(FINDING_SCHEMA_VERSION),
|
|
24
|
+
key: IssueKeySchema,
|
|
25
|
+
rule: RuleIdSchema,
|
|
26
|
+
severity: FindingSeveritySchema,
|
|
27
|
+
path: RepoPathSchema,
|
|
28
|
+
count: z.number().int().positive(),
|
|
29
|
+
locations: z.array(FindingLocationSchema).min(1),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
export type FindingGroup = z.infer<typeof FindingGroupSchema>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/kit-feedback.ts
|
|
2
|
+
//
|
|
3
|
+
// Upstream kit feedback (ADR-0028, "kit" target). A record about a failure of the kit itself,
|
|
4
|
+
// drafted inside a user's installation and submitted upstream only by that user.
|
|
5
|
+
//
|
|
6
|
+
// INVARIANT: the record is an allowlist. Every field is kit-owned or an enumeration. The only text
|
|
7
|
+
// field, `errorText`, is scrubbed before it is stored and must match a character set that cannot
|
|
8
|
+
// hold a path, an email, a quoted string or an identifier with underscores. Nothing about the
|
|
9
|
+
// user's project, repository or identity can be represented.
|
|
10
|
+
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
|
|
13
|
+
export const KIT_FEEDBACK_SCHEMA_VERSION = 1 as const;
|
|
14
|
+
|
|
15
|
+
// Generic Node error codes. They describe the failure class, never the user's project.
|
|
16
|
+
export const KIT_FEEDBACK_ERROR_CODES = [
|
|
17
|
+
'ENOENT',
|
|
18
|
+
'EACCES',
|
|
19
|
+
'EPERM',
|
|
20
|
+
'EEXIST',
|
|
21
|
+
'ENOTDIR',
|
|
22
|
+
'EISDIR',
|
|
23
|
+
'ENOTEMPTY',
|
|
24
|
+
'EMFILE',
|
|
25
|
+
'EPIPE',
|
|
26
|
+
'ETIMEDOUT',
|
|
27
|
+
'ECONNREFUSED',
|
|
28
|
+
'ECONNRESET',
|
|
29
|
+
'ENOTFOUND',
|
|
30
|
+
'ERR_MODULE_NOT_FOUND',
|
|
31
|
+
'ERR_INVALID_ARG_TYPE',
|
|
32
|
+
] as const;
|
|
33
|
+
export const KitFeedbackErrorCodeSchema = z.enum(KIT_FEEDBACK_ERROR_CODES);
|
|
34
|
+
export type KitFeedbackErrorCode = z.infer<typeof KitFeedbackErrorCodeSchema>;
|
|
35
|
+
|
|
36
|
+
export const KIT_FEEDBACK_TEXT_MAX = 240;
|
|
37
|
+
// No `/`, `\`, `@`, quotes, backticks or underscores: a surviving path, email, quoted name or
|
|
38
|
+
// snake_case identifier fails validation even if the scrubber missed it.
|
|
39
|
+
export const KIT_FEEDBACK_TEXT_PATTERN = /^[A-Za-z0-9 .,:;!?()<>-]*$/;
|
|
40
|
+
|
|
41
|
+
export const KitFeedbackSchema = z
|
|
42
|
+
.object({
|
|
43
|
+
schemaVersion: z.literal(KIT_FEEDBACK_SCHEMA_VERSION),
|
|
44
|
+
// Derived from kit-level fields only, so two users with the same bug share a key and no key
|
|
45
|
+
// identifies a user or an installation.
|
|
46
|
+
key: z.string().regex(/^[0-9a-f]{16}$/),
|
|
47
|
+
kitVersion: z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),
|
|
48
|
+
command: z.string().regex(/^[a-z][a-z-]{0,31}$/),
|
|
49
|
+
failure: z.enum(['runtime-error', 'internal-error']),
|
|
50
|
+
exitCode: z.number().int().min(0).max(255),
|
|
51
|
+
errorCode: KitFeedbackErrorCodeSchema.optional(),
|
|
52
|
+
errorText: z.string().max(KIT_FEEDBACK_TEXT_MAX).regex(KIT_FEEDBACK_TEXT_PATTERN).optional(),
|
|
53
|
+
os: z.enum(['linux', 'darwin', 'win32', 'other']),
|
|
54
|
+
nodeMajor: z.number().int().positive(),
|
|
55
|
+
occurrences: z.number().int().positive(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
export type KitFeedback = z.infer<typeof KitFeedbackSchema>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// packages/contracts/src/improvement/review.ts
|
|
2
|
+
//
|
|
3
|
+
// A focused AI review request (ADR-0028 §4, P2.4). The kit has no review engine of its own: it asks
|
|
4
|
+
// ci-agent's gated `ai-review.yml` workflow for one review with one responsibility. The kinds must
|
|
5
|
+
// match tools/ci-agent/src/review/request.ts and the workflow's `kind` choices; a test keeps all
|
|
6
|
+
// three in step.
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
export const REVIEW_KINDS = [
|
|
11
|
+
'correctness',
|
|
12
|
+
'security',
|
|
13
|
+
'testing',
|
|
14
|
+
'architecture',
|
|
15
|
+
'performance',
|
|
16
|
+
'maintainability',
|
|
17
|
+
'documentation',
|
|
18
|
+
'custom',
|
|
19
|
+
] as const;
|
|
20
|
+
export const ReviewKindSchema = z.enum(REVIEW_KINDS);
|
|
21
|
+
export type ReviewKind = z.infer<typeof ReviewKindSchema>;
|
|
22
|
+
|
|
23
|
+
export const REVIEW_INSTRUCTION_MAX = 500;
|
|
24
|
+
|
|
25
|
+
export const ReviewRequestSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
pr: z.number().int().positive(),
|
|
28
|
+
kind: ReviewKindSchema,
|
|
29
|
+
instruction: z.string().trim().min(1).max(REVIEW_INSTRUCTION_MAX).optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
.refine((r) => r.kind !== 'custom' || r.instruction !== undefined, {
|
|
33
|
+
message: 'a custom review needs an instruction',
|
|
34
|
+
path: ['instruction'],
|
|
35
|
+
})
|
|
36
|
+
.refine((r) => r.kind === 'custom' || r.instruction === undefined, {
|
|
37
|
+
message: 'only a custom review takes an instruction',
|
|
38
|
+
path: ['instruction'],
|
|
39
|
+
});
|
|
40
|
+
export type ReviewRequest = z.infer<typeof ReviewRequestSchema>;
|
package/src/index.ts
CHANGED
|
@@ -67,3 +67,6 @@ export * from './benchmark/index.js';
|
|
|
67
67
|
|
|
68
68
|
// Per-run execution isolation (roadmap Phase 8, #49):
|
|
69
69
|
export * from './execution/index.js';
|
|
70
|
+
|
|
71
|
+
// Continuous improvement findings (deterministic scanners; no matched values):
|
|
72
|
+
export * from './improvement/index.js';
|
|
@@ -165,4 +165,15 @@ export const BUILTIN_DETECTION_RULES: ReadonlyArray<DetectionRule> = [
|
|
|
165
165
|
severity: 'critical',
|
|
166
166
|
enabled: true,
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
// The generic rule only catches quoted assignments of 32+ characters, so an env-style
|
|
170
|
+
// ANTHROPIC_API_KEY=sk-ant-... line needs its own rule. Kind stays generic-api-key so the
|
|
171
|
+
// SecretKind contract does not change.
|
|
172
|
+
id: 'anthropic-api-key',
|
|
173
|
+
name: 'Anthropic API Key',
|
|
174
|
+
kind: 'generic-api-key',
|
|
175
|
+
pattern: '\\bsk-ant-[A-Za-z0-9_-]{20,}',
|
|
176
|
+
severity: 'critical',
|
|
177
|
+
enabled: true,
|
|
178
|
+
},
|
|
168
179
|
];
|