kibi-cli 2.2.0 → 2.3.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/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +3 -0
- package/dist/cli-operation-metadata.d.ts +4 -0
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +5 -0
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +4 -0
- package/dist/commands/check-diff.d.ts +5 -0
- package/dist/commands/check-diff.d.ts.map +1 -0
- package/dist/commands/check-diff.js +62 -0
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +41 -18
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +210 -73
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +63 -29
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +9 -2
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +3 -1
- package/dist/engine.d.ts +15 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +252 -52
- package/dist/extractors/symbols-coordinator.d.ts +7 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +75 -39
- package/dist/operations/modeling/predicate-inference-1.js +1 -1
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +175 -53
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +5 -7
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +5 -9
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +1 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +7 -1
- package/dist/performance-trace.d.ts +17 -0
- package/dist/performance-trace.d.ts.map +1 -0
- package/dist/performance-trace.js +134 -0
- package/dist/plugins/approved-source-analyzers.d.ts +13 -0
- package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.js +77 -0
- package/dist/plugins/approved-source-analyzers.js +3 -0
- package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
- package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
- package/dist/plugins/maintenance-source-analysis.js +191 -0
- package/dist/plugins/registry.d.ts +2 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +6 -1
- package/dist/plugins/source-analysis-service.d.ts +36 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +184 -27
- package/dist/plugins/source-change-analysis.d.ts +15 -0
- package/dist/plugins/source-change-analysis.d.ts.map +1 -0
- package/dist/plugins/source-change-analysis.js +54 -0
- package/dist/plugins/source-classification.d.ts +41 -0
- package/dist/plugins/source-classification.d.ts.map +1 -0
- package/dist/plugins/source-classification.js +490 -0
- package/dist/prolog/swipl-resolver.d.ts +88 -0
- package/dist/prolog/swipl-resolver.d.ts.map +1 -0
- package/dist/prolog/swipl-resolver.js +446 -0
- package/dist/prolog.d.ts +15 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +67 -6
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +56 -5
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +3 -1
- package/dist/public/impact/manifest.d.ts.map +1 -1
- package/dist/public/impact/manifest.js +15 -1
- package/dist/public/impact/source-changes.d.ts.map +1 -1
- package/dist/public/impact/source-changes.js +35 -27
- package/dist/public/impact/types.d.ts +2 -0
- package/dist/public/impact/types.d.ts.map +1 -1
- package/dist/public/operations/catalog.d.ts +44 -0
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +2 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +309 -8
- package/dist/public/operations/impact-review-preparation.d.ts +14 -0
- package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/impact-review-preparation.js +379 -0
- package/dist/public/operations/index.d.ts +2 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +2 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +1 -35
- package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
- package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
- package/dist/public/operations/proof-receipt-projection.js +36 -0
- package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
- package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/specs/impact-review-preparation.js +43 -0
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/dist/traceability/analysis-gate.d.ts +39 -0
- package/dist/traceability/analysis-gate.d.ts.map +1 -0
- package/dist/traceability/analysis-gate.js +51 -0
- package/dist/traceability/git-change-snapshot.d.ts +27 -0
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
- package/dist/traceability/git-change-snapshot.js +411 -0
- package/dist/traceability/git-staged.d.ts +5 -1
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +16 -11
- package/dist/traceability/impact-evaluator.d.ts +54 -0
- package/dist/traceability/impact-evaluator.d.ts.map +1 -0
- package/dist/traceability/impact-evaluator.js +270 -0
- package/dist/traceability/impact-git-tree.d.ts +12 -0
- package/dist/traceability/impact-git-tree.d.ts.map +1 -0
- package/dist/traceability/impact-git-tree.js +46 -0
- package/dist/traceability/impact-knowledge.d.ts +16 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -0
- package/dist/traceability/impact-knowledge.js +165 -0
- package/dist/traceability/impact-policy.d.ts +15 -0
- package/dist/traceability/impact-policy.d.ts.map +1 -0
- package/dist/traceability/impact-policy.js +48 -0
- package/dist/traceability/impact-policy.v1.schema.json +48 -0
- package/dist/traceability/impact-pr-diff.d.ts +5 -0
- package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
- package/dist/traceability/impact-pr-diff.js +83 -0
- package/dist/traceability/impact-record-validation.d.ts +9 -0
- package/dist/traceability/impact-record-validation.d.ts.map +1 -0
- package/dist/traceability/impact-record-validation.js +113 -0
- package/dist/traceability/impact-review.d.ts +148 -0
- package/dist/traceability/impact-review.d.ts.map +1 -0
- package/dist/traceability/impact-review.js +494 -0
- package/dist/traceability/impact-review.schema.json +365 -0
- package/dist/traceability/impact-side-evidence.d.ts +13 -0
- package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
- package/dist/traceability/impact-side-evidence.js +240 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
- package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
- package/dist/traceability/snapshot-knowledge.d.ts +4 -0
- package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
- package/dist/traceability/snapshot-knowledge.js +98 -0
- package/dist/traceability/staged-file-coverage.d.ts +23 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.js +2 -16
- package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +17 -6
- package/dist/traceability/symbol-extract.d.ts +3 -5
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +49 -34
- package/dist/traceability/temp-kb.d.ts +1 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +49 -13
- package/dist/traceability/trusted-pr-event.d.ts +13 -0
- package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
- package/dist/traceability/trusted-pr-event.js +105 -0
- package/dist/utils/canonical-path.d.ts +3 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +33 -0
- package/package.json +14 -5
- package/src/public/impact/analyzer.ts +88 -5
- package/src/public/impact/diagnostics.ts +7 -5
- package/src/public/impact/manifest.ts +14 -1
- package/src/public/impact/source-changes.ts +39 -34
- package/src/public/impact/types.ts +5 -0
- package/src/public/operations/catalog.ts +2 -0
- package/src/public/operations/contracts.ts +385 -9
- package/src/public/operations/impact-review-preparation.ts +548 -0
- package/src/public/operations/index.ts +2 -0
- package/src/public/operations/node-ports.ts +1 -39
- package/src/public/operations/proof-receipt-projection.ts +39 -0
- package/src/public/operations/specs/impact-review-preparation.ts +46 -0
- package/src/public/operations/types.ts +1 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/src/traceability/impact-policy.v1.schema.json +48 -0
- package/src/traceability/impact-review.schema.json +365 -0
- package/templates/github/kibi-badge.yml +0 -4
- package/templates/github/kibi-report.yml +0 -4
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createMaintenanceSourceAnalysisService, fingerprintMaintenanceSourceSet, readSnapshotSourceConfig, } from "../../plugins/maintenance-source-analysis.js";
|
|
3
|
+
import { analyzeSourceChanges } from "../../plugins/source-change-analysis.js";
|
|
4
|
+
import { analysisObligation } from "../../traceability/analysis-gate.js";
|
|
5
|
+
import { captureDiffSnapshot, captureStagedSnapshot, } from "../../traceability/git-change-snapshot.js";
|
|
6
|
+
import { fingerprintImpactEvaluator, prepareImpactReview, } from "../../traceability/impact-evaluator.js";
|
|
7
|
+
import { IMPACT_EVALUATOR_VERSION, IMPACT_REVIEW_VERSION, canonicalJson, } from "../../traceability/impact-review.js";
|
|
8
|
+
import impactReviewRecordSchema from "../../traceability/impact-review.schema.json" with {
|
|
9
|
+
type: "json"
|
|
10
|
+
};
|
|
11
|
+
import { readSnapshotKnowledge } from "../../traceability/snapshot-knowledge.js";
|
|
12
|
+
const FULL_COMMIT_OID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
13
|
+
const SEMANTIC_RELATIONSHIPS = new Set([
|
|
14
|
+
"constrains",
|
|
15
|
+
"depends_on",
|
|
16
|
+
"requires_predicate",
|
|
17
|
+
"requires_property",
|
|
18
|
+
"requires_rule",
|
|
19
|
+
"specified_by",
|
|
20
|
+
"supersedes",
|
|
21
|
+
"validates",
|
|
22
|
+
"verified_by",
|
|
23
|
+
]);
|
|
24
|
+
function compareText(left, right) {
|
|
25
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
26
|
+
}
|
|
27
|
+
function gitText(root, args) {
|
|
28
|
+
return execFileSync("git", [...args], {
|
|
29
|
+
cwd: root,
|
|
30
|
+
encoding: "utf8",
|
|
31
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
32
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
33
|
+
}).trim();
|
|
34
|
+
}
|
|
35
|
+
function resolveCommit(root, oid) {
|
|
36
|
+
return gitText(root, [
|
|
37
|
+
"rev-parse",
|
|
38
|
+
"--verify",
|
|
39
|
+
"--end-of-options",
|
|
40
|
+
`${oid}^{commit}`,
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
function treeForCommit(root, oid) {
|
|
44
|
+
return gitText(root, [
|
|
45
|
+
"rev-parse",
|
|
46
|
+
"--verify",
|
|
47
|
+
"--end-of-options",
|
|
48
|
+
`${oid}^{tree}`,
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
function assertExplicitDiffUnchanged(root, input, snapshot) {
|
|
52
|
+
const baseCommit = resolveCommit(root, input.baseCommit);
|
|
53
|
+
const headCommit = resolveCommit(root, input.headCommit);
|
|
54
|
+
if (baseCommit !== input.baseCommit ||
|
|
55
|
+
headCommit !== input.headCommit ||
|
|
56
|
+
snapshot.headCommit !== baseCommit ||
|
|
57
|
+
treeForCommit(root, baseCommit) !== snapshot.baseTree ||
|
|
58
|
+
treeForCommit(root, headCommit) !== snapshot.headTree)
|
|
59
|
+
throw new Error("Selected diff commit or tree identity changed during impact review preparation");
|
|
60
|
+
}
|
|
61
|
+
function snapshotIdentity(scope, snapshot) {
|
|
62
|
+
return {
|
|
63
|
+
kind: scope.kind,
|
|
64
|
+
baseCommit: scope.kind === "diff" ? scope.baseCommit : snapshot.headCommit,
|
|
65
|
+
baseTree: snapshot.baseTree,
|
|
66
|
+
headCommit: scope.kind === "diff" ? scope.headCommit : null,
|
|
67
|
+
headTree: snapshot.headTree,
|
|
68
|
+
headTreeSource: scope.kind === "diff" ? "commit" : "index",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function plainEntity(entity) {
|
|
72
|
+
return Object.fromEntries(Object.entries(entity)
|
|
73
|
+
.filter(([key]) => !["created_at", "updated_at", "proof_receipts"].includes(key))
|
|
74
|
+
.sort(([left], [right]) => compareText(left, right)));
|
|
75
|
+
}
|
|
76
|
+
function entityMap(snapshot, tree) {
|
|
77
|
+
return new Map(readSnapshotKnowledge(snapshot.readGit, tree, snapshot.readBlobs).map((row) => [
|
|
78
|
+
row.entity.id,
|
|
79
|
+
{
|
|
80
|
+
entity: row.entity,
|
|
81
|
+
relationships: row.relationships.map(({ type, from, to }) => ({
|
|
82
|
+
type,
|
|
83
|
+
from,
|
|
84
|
+
to,
|
|
85
|
+
})),
|
|
86
|
+
...(row.sourceFile ? { sourceFile: row.sourceFile } : {}),
|
|
87
|
+
},
|
|
88
|
+
]));
|
|
89
|
+
}
|
|
90
|
+
function requirementContext(id, rows, entities, allRows) {
|
|
91
|
+
const row = rows.get(id);
|
|
92
|
+
const binding = entities.get(id);
|
|
93
|
+
if (!row || !binding) {
|
|
94
|
+
return {
|
|
95
|
+
id,
|
|
96
|
+
state: "absent",
|
|
97
|
+
entityFingerprint: null,
|
|
98
|
+
artifactPath: null,
|
|
99
|
+
sourcePath: null,
|
|
100
|
+
relationships: [],
|
|
101
|
+
relatedEntities: [],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const relationships = [...allRows.entries()]
|
|
105
|
+
.flatMap(([ownerId, candidate]) => candidate.relationships
|
|
106
|
+
.filter((relationship) => SEMANTIC_RELATIONSHIPS.has(relationship.type) &&
|
|
107
|
+
(relationship.from === id || relationship.to === id))
|
|
108
|
+
.map((relationship) => ({ ownerId, ...relationship })))
|
|
109
|
+
.sort((left, right) => compareText(canonicalJson(left), canonicalJson(right)));
|
|
110
|
+
const relatedIds = [
|
|
111
|
+
...new Set(relationships
|
|
112
|
+
.flatMap(({ from, to }) => [from, to])
|
|
113
|
+
.filter((relatedId) => relatedId !== id)),
|
|
114
|
+
].sort();
|
|
115
|
+
return {
|
|
116
|
+
id,
|
|
117
|
+
state: "present",
|
|
118
|
+
entityFingerprint: binding.fingerprint,
|
|
119
|
+
artifactPath: binding.artifactPath,
|
|
120
|
+
sourcePath: binding.sourcePath ?? row.sourceFile ?? null,
|
|
121
|
+
entity: plainEntity(row.entity),
|
|
122
|
+
relationships: relationships.map(({ ownerId: _ownerId, ...edge }) => edge),
|
|
123
|
+
relatedEntities: relatedIds.flatMap((relatedId) => {
|
|
124
|
+
const related = allRows.get(relatedId);
|
|
125
|
+
if (!related)
|
|
126
|
+
return [];
|
|
127
|
+
const relatedBinding = entities.get(relatedId);
|
|
128
|
+
return [
|
|
129
|
+
{
|
|
130
|
+
id: relatedId,
|
|
131
|
+
type: related.entity.type ?? null,
|
|
132
|
+
entityFingerprint: relatedBinding?.fingerprint ?? null,
|
|
133
|
+
artifactPath: relatedBinding?.artifactPath ?? null,
|
|
134
|
+
sourcePath: relatedBinding?.sourcePath ?? related.sourceFile ?? null,
|
|
135
|
+
entity: plainEntity(related.entity),
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
}),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function requirementScopes(prepared, snapshot) {
|
|
142
|
+
const before = entityMap(snapshot, snapshot.baseTree);
|
|
143
|
+
const after = entityMap(snapshot, snapshot.headTree);
|
|
144
|
+
return [...prepared.scopedRequirementIdsByPath.entries()]
|
|
145
|
+
.sort(([left], [right]) => compareText(left, right))
|
|
146
|
+
.map(([path, requirementIds]) => ({
|
|
147
|
+
path,
|
|
148
|
+
requirementIds: [...requirementIds].sort(),
|
|
149
|
+
before: [...requirementIds]
|
|
150
|
+
.sort()
|
|
151
|
+
.map((id) => requirementContext(id, before, prepared.baseEntities, before)),
|
|
152
|
+
after: [...requirementIds]
|
|
153
|
+
.sort()
|
|
154
|
+
.map((id) => requirementContext(id, after, prepared.headEntities, after)),
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
function residualReviewObligations(prepared) {
|
|
158
|
+
const obligations = [];
|
|
159
|
+
for (const file of prepared.files) {
|
|
160
|
+
for (const side of ["before", "after"]) {
|
|
161
|
+
const analysis = file[side]?.analysis;
|
|
162
|
+
if (!analysis)
|
|
163
|
+
continue;
|
|
164
|
+
const obligation = analysisObligation(side, analysis, file.newHunkRanges);
|
|
165
|
+
if (obligation.kind === "unsupported_review") {
|
|
166
|
+
obligations.push({
|
|
167
|
+
path: file.path,
|
|
168
|
+
side,
|
|
169
|
+
status: analysis.status,
|
|
170
|
+
diagnosticCodes: [...analysis.diagnosticCodes].sort(),
|
|
171
|
+
kind: "unsupported_review",
|
|
172
|
+
wholeFile: true,
|
|
173
|
+
pending: true,
|
|
174
|
+
});
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (obligation.kind !== "partial_review")
|
|
178
|
+
continue;
|
|
179
|
+
const limitationClasses = new Set();
|
|
180
|
+
for (const code of analysis.diagnosticCodes) {
|
|
181
|
+
const allowed = prepared.policy.allowedPartial.find((entry) => entry.providerId === analysis.providerId &&
|
|
182
|
+
entry.providerFingerprint === analysis.providerFingerprint &&
|
|
183
|
+
entry.diagnosticCode === code);
|
|
184
|
+
if (allowed)
|
|
185
|
+
limitationClasses.add(allowed.limitationClass);
|
|
186
|
+
}
|
|
187
|
+
const limitationClass = [...limitationClasses][0];
|
|
188
|
+
if (limitationClasses.size !== 1 || limitationClass === undefined)
|
|
189
|
+
throw new Error(`Partial review obligation is not covered by the trusted policy: ${file.path} (${side})`);
|
|
190
|
+
obligations.push({
|
|
191
|
+
path: file.path,
|
|
192
|
+
side,
|
|
193
|
+
status: analysis.status,
|
|
194
|
+
diagnosticCodes: [...analysis.diagnosticCodes].sort(),
|
|
195
|
+
kind: "partial_review",
|
|
196
|
+
limitationClass,
|
|
197
|
+
ranges: obligation.ranges.map((range) => ({ ...range })),
|
|
198
|
+
pending: true,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return obligations.sort((left, right) => compareText(`${left.path}\0${left.side}`, `${right.path}\0${right.side}`));
|
|
203
|
+
}
|
|
204
|
+
function cloneRecordSchema() {
|
|
205
|
+
return JSON.parse(JSON.stringify(impactReviewRecordSchema));
|
|
206
|
+
}
|
|
207
|
+
function cloneRecordTemplateSchema() {
|
|
208
|
+
const schema = cloneRecordSchema();
|
|
209
|
+
schema.$id = "urn:kibi:impact-review-authoring-record-template:v1";
|
|
210
|
+
const properties = schema.properties;
|
|
211
|
+
properties.reviewedAt = { type: "null" };
|
|
212
|
+
const definitions = schema.$defs;
|
|
213
|
+
const reviewer = definitions.reviewer;
|
|
214
|
+
reviewer.properties.id = { type: "null" };
|
|
215
|
+
const file = definitions.file;
|
|
216
|
+
file.properties.analysisReviews = {
|
|
217
|
+
anyOf: [file.properties.analysisReviews, { type: "null" }],
|
|
218
|
+
};
|
|
219
|
+
file.properties.decision = {
|
|
220
|
+
anyOf: [file.properties.decision, { type: "null" }],
|
|
221
|
+
};
|
|
222
|
+
return schema;
|
|
223
|
+
}
|
|
224
|
+
function authoringContract(prepared) {
|
|
225
|
+
const recordHeaders = {
|
|
226
|
+
contractVersion: IMPACT_REVIEW_VERSION,
|
|
227
|
+
policy: {
|
|
228
|
+
id: prepared.policy.id,
|
|
229
|
+
version: prepared.policy.version,
|
|
230
|
+
fingerprint: prepared.policyFingerprint,
|
|
231
|
+
},
|
|
232
|
+
evaluator: {
|
|
233
|
+
contractVersion: IMPACT_EVALUATOR_VERSION,
|
|
234
|
+
fingerprint: prepared.evaluatorFingerprint,
|
|
235
|
+
},
|
|
236
|
+
scope: {
|
|
237
|
+
fingerprint: prepared.scopeFingerprint,
|
|
238
|
+
knowledgeFingerprint: prepared.knowledgeFingerprint,
|
|
239
|
+
providerSetFingerprint: prepared.providerSetFingerprint,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
return {
|
|
243
|
+
templateVersion: "kibi.impact-review-authoring-template.v1",
|
|
244
|
+
isValidImpactReviewRecord: false,
|
|
245
|
+
instructions: "This template is reviewer input only. Author every decision, required analysis review, rationale, reviewer id, and reviewedAt before strict record validation. It is not an approval, signature, or proof receipt.",
|
|
246
|
+
authoredFields: [
|
|
247
|
+
"files[].decision",
|
|
248
|
+
"files[].analysisReviews",
|
|
249
|
+
"reviewer.id",
|
|
250
|
+
"reviewedAt",
|
|
251
|
+
],
|
|
252
|
+
recordSchema: cloneRecordSchema(),
|
|
253
|
+
decisionSchema: { $ref: "urn:kibi:impact-review:v1#/$defs/decision" },
|
|
254
|
+
analysisReviewSchema: {
|
|
255
|
+
oneOf: [
|
|
256
|
+
{ $ref: "urn:kibi:impact-review:v1#/$defs/unsupportedReview" },
|
|
257
|
+
{ $ref: "urn:kibi:impact-review:v1#/$defs/partialReview" },
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
templateSchema: {
|
|
261
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
262
|
+
$id: "urn:kibi:impact-review-authoring-template:v1",
|
|
263
|
+
type: "object",
|
|
264
|
+
additionalProperties: false,
|
|
265
|
+
required: ["templateVersion", "isValidImpactReviewRecord", "record"],
|
|
266
|
+
properties: {
|
|
267
|
+
templateVersion: {
|
|
268
|
+
const: "kibi.impact-review-authoring-template.v1",
|
|
269
|
+
},
|
|
270
|
+
isValidImpactReviewRecord: { const: false },
|
|
271
|
+
record: cloneRecordTemplateSchema(),
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
recordTemplate: {
|
|
275
|
+
templateVersion: "kibi.impact-review-authoring-template.v1",
|
|
276
|
+
isValidImpactReviewRecord: false,
|
|
277
|
+
record: {
|
|
278
|
+
...recordHeaders,
|
|
279
|
+
reviewer: { id: null, source: "self-claimed-local" },
|
|
280
|
+
reviewedAt: null,
|
|
281
|
+
files: prepared.files
|
|
282
|
+
.slice()
|
|
283
|
+
.sort((left, right) => compareText(left.path, right.path))
|
|
284
|
+
.map((file) => ({
|
|
285
|
+
...withoutAnalysisReviews(file),
|
|
286
|
+
analysisReviews: null,
|
|
287
|
+
decision: null,
|
|
288
|
+
})),
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function withoutAnalysisReviews(file) {
|
|
294
|
+
const { analysisReviews: _analysisReviews, ...evidence } = file;
|
|
295
|
+
return evidence;
|
|
296
|
+
}
|
|
297
|
+
function completeFileEvidence(prepared) {
|
|
298
|
+
return prepared.files
|
|
299
|
+
.slice()
|
|
300
|
+
.sort((left, right) => compareText(left.path, right.path))
|
|
301
|
+
.map((file) => withoutAnalysisReviews(file));
|
|
302
|
+
}
|
|
303
|
+
function buildPreparation(scope, snapshot, prepared) {
|
|
304
|
+
return {
|
|
305
|
+
preparationVersion: "kibi.impact-review-preparation.v1",
|
|
306
|
+
status: "ready_for_authoring",
|
|
307
|
+
snapshot: snapshotIdentity(scope, snapshot),
|
|
308
|
+
recordHeaders: {
|
|
309
|
+
contractVersion: IMPACT_REVIEW_VERSION,
|
|
310
|
+
policy: {
|
|
311
|
+
id: prepared.policy.id,
|
|
312
|
+
version: prepared.policy.version,
|
|
313
|
+
fingerprint: prepared.policyFingerprint,
|
|
314
|
+
},
|
|
315
|
+
evaluator: {
|
|
316
|
+
contractVersion: IMPACT_EVALUATOR_VERSION,
|
|
317
|
+
fingerprint: prepared.evaluatorFingerprint,
|
|
318
|
+
},
|
|
319
|
+
scope: {
|
|
320
|
+
fingerprint: prepared.scopeFingerprint,
|
|
321
|
+
knowledgeFingerprint: prepared.knowledgeFingerprint,
|
|
322
|
+
providerSetFingerprint: prepared.providerSetFingerprint,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
files: completeFileEvidence(prepared),
|
|
326
|
+
requirementScopes: requirementScopes(prepared, snapshot),
|
|
327
|
+
residualReviewObligations: residualReviewObligations(prepared),
|
|
328
|
+
authorship: authoringContract(prepared),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function validateDiffInput(scope) {
|
|
332
|
+
if (scope.kind === "diff" &&
|
|
333
|
+
(!FULL_COMMIT_OID.test(scope.baseCommit) ||
|
|
334
|
+
!FULL_COMMIT_OID.test(scope.headCommit)))
|
|
335
|
+
throw new Error("Diff scope requires full lowercase hexadecimal baseCommit and headCommit object IDs");
|
|
336
|
+
}
|
|
337
|
+
export async function executePrepareImpactReview(input, context) {
|
|
338
|
+
validateDiffInput(input.scope);
|
|
339
|
+
const workspaceRoot = context.workspaceRoot;
|
|
340
|
+
const snapshot = input.scope.kind === "staged"
|
|
341
|
+
? captureStagedSnapshot(workspaceRoot)
|
|
342
|
+
: captureDiffSnapshot(workspaceRoot, input.scope.baseCommit, input.scope.headCommit);
|
|
343
|
+
if (input.scope.kind === "diff")
|
|
344
|
+
assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
|
|
345
|
+
const trustedConfig = readSnapshotSourceConfig(snapshot, snapshot.baseTree);
|
|
346
|
+
const providerSetFingerprint = fingerprintMaintenanceSourceSet(workspaceRoot, trustedConfig);
|
|
347
|
+
const evaluatorFingerprint = fingerprintImpactEvaluator();
|
|
348
|
+
const service = createMaintenanceSourceAnalysisService(workspaceRoot, trustedConfig);
|
|
349
|
+
const analyses = await analyzeSourceChanges(snapshot.inventory, service);
|
|
350
|
+
const prepared = prepareImpactReview(snapshot, {
|
|
351
|
+
providerSetFingerprint,
|
|
352
|
+
evaluatorFingerprint,
|
|
353
|
+
analyses,
|
|
354
|
+
});
|
|
355
|
+
// Build all KB-derived context before the final snapshot/closure checks.
|
|
356
|
+
// Projection can be substantial, so checking only before it could return
|
|
357
|
+
// evidence for a workspace or evaluator closure that changed mid-projection.
|
|
358
|
+
const data = buildPreparation(input.scope, snapshot, prepared);
|
|
359
|
+
snapshot.assertUnchanged();
|
|
360
|
+
if (input.scope.kind === "diff")
|
|
361
|
+
assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
|
|
362
|
+
const finalProviderFingerprint = fingerprintMaintenanceSourceSet(workspaceRoot, trustedConfig);
|
|
363
|
+
const finalEvaluatorFingerprint = fingerprintImpactEvaluator();
|
|
364
|
+
if (finalProviderFingerprint !== providerSetFingerprint ||
|
|
365
|
+
finalEvaluatorFingerprint !== evaluatorFingerprint)
|
|
366
|
+
throw new Error("Trusted source-provider or impact-evaluator closure changed during impact review preparation");
|
|
367
|
+
snapshot.assertUnchanged();
|
|
368
|
+
if (input.scope.kind === "diff")
|
|
369
|
+
assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
|
|
370
|
+
return {
|
|
371
|
+
content: [
|
|
372
|
+
{
|
|
373
|
+
type: "text",
|
|
374
|
+
text: `Prepared complete ${input.scope.kind} impact-review authoring inputs; every review decision remains unauthored.`,
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
structuredContent: data,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./catalog.js";
|
|
2
2
|
export * from "./check-executor.js";
|
|
3
|
+
export * from "./impact-review-preparation.js";
|
|
3
4
|
export * from "./discovery-entities.js";
|
|
4
5
|
export * from "./discovery-executors.js";
|
|
5
6
|
export * from "./runtime-types.js";
|
|
@@ -10,6 +11,7 @@ export * from "./migration-plan.js";
|
|
|
10
11
|
export * from "./symbol-repair-plan.js";
|
|
11
12
|
export * from "./specs/bootstrap.js";
|
|
12
13
|
export * from "./specs/check.js";
|
|
14
|
+
export * from "./specs/impact-review-preparation.js";
|
|
13
15
|
export * from "./specs/discovery.js";
|
|
14
16
|
export * from "./specs/modeling.js";
|
|
15
17
|
export * from "./specs/planning.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,mBAAmB,qCAAqC,CAAC;AACzD,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,mBAAmB,qCAAqC,CAAC;AACzD,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./catalog.js";
|
|
2
2
|
export * from "./check-executor.js";
|
|
3
|
+
export * from "./impact-review-preparation.js";
|
|
3
4
|
export * from "./discovery-entities.js";
|
|
4
5
|
export * from "./discovery-executors.js";
|
|
5
6
|
export * from "./runtime-types.js";
|
|
@@ -10,6 +11,7 @@ export * from "./migration-plan.js";
|
|
|
10
11
|
export * from "./symbol-repair-plan.js";
|
|
11
12
|
export * from "./specs/bootstrap.js";
|
|
12
13
|
export * from "./specs/check.js";
|
|
14
|
+
export * from "./specs/impact-review-preparation.js";
|
|
13
15
|
export * from "./specs/discovery.js";
|
|
14
16
|
export * from "./specs/modeling.js";
|
|
15
17
|
export * from "./specs/planning.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../../src/public/operations/node-ports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../../src/public/operations/node-ports.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/E,KAAK,kBAAkB,GAAG,cAAc,GAAG;IACzC,QAAQ,CAAC,IAAI,EAAE,CACb,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,KACjE,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AAEF,KAAK,WAAW,GAAG,OAAO,GAAG;IAC3B,QAAQ,CAAC,YAAY,EAAE,CACrB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,KACrB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AA2JF,eAAO,MAAM,cAAc,EAAE,kBAoB5B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAiBrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAEzB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import fg from "fast-glob";
|
|
8
8
|
import { createRepoIgnorePolicy } from "../ignore-policy.js";
|
|
9
|
+
import { snapshotFileContent } from "./proof-receipt-projection.js";
|
|
9
10
|
const execFileAsync = promisify(execFile);
|
|
10
11
|
const SNAPSHOT_EXCLUDED_PREFIXES = [
|
|
11
12
|
".changeset/",
|
|
@@ -36,41 +37,6 @@ const ALWAYS_IGNORED_GLOBS = [
|
|
|
36
37
|
function includedSnapshotPath(relativePath) {
|
|
37
38
|
return !SNAPSHOT_EXCLUDED_PREFIXES.some((prefix) => relativePath === prefix.slice(0, -1) || relativePath.startsWith(prefix));
|
|
38
39
|
}
|
|
39
|
-
function withoutProofReceiptFrontmatter(content) {
|
|
40
|
-
const lines = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
41
|
-
if (lines[0]?.trim() !== "---")
|
|
42
|
-
return content;
|
|
43
|
-
let inFrontmatter = true;
|
|
44
|
-
let skippingReceipts = false;
|
|
45
|
-
const retained = [];
|
|
46
|
-
for (const [index, line] of lines.entries()) {
|
|
47
|
-
const trimmed = line.trim();
|
|
48
|
-
if (index > 0 && inFrontmatter && trimmed === "---") {
|
|
49
|
-
inFrontmatter = false;
|
|
50
|
-
skippingReceipts = false;
|
|
51
|
-
retained.push(line);
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (inFrontmatter && /^proof_receipts\s*:/.test(line)) {
|
|
55
|
-
skippingReceipts = true;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (inFrontmatter &&
|
|
59
|
-
skippingReceipts &&
|
|
60
|
-
/^[A-Za-z_][A-Za-z0-9_-]*\s*:/.test(line)) {
|
|
61
|
-
skippingReceipts = false;
|
|
62
|
-
}
|
|
63
|
-
if (!skippingReceipts)
|
|
64
|
-
retained.push(line);
|
|
65
|
-
}
|
|
66
|
-
return retained.join("");
|
|
67
|
-
}
|
|
68
|
-
function snapshotFileContent(relativePath, content) {
|
|
69
|
-
if (relativePath.endsWith(".md")) {
|
|
70
|
-
return Buffer.from(withoutProofReceiptFrontmatter(content.toString("utf8")));
|
|
71
|
-
}
|
|
72
|
-
return content;
|
|
73
|
-
}
|
|
74
40
|
/**
|
|
75
41
|
* A tracked markdown file whose only change is proof-receipt frontmatter
|
|
76
42
|
* cannot alter the snapshot hash (receipts are stripped before hashing), so it
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Remove only the top-level proof-receipt frontmatter block, byte-for-byte otherwise. */
|
|
2
|
+
export declare function withoutProofReceiptFrontmatter(content: string): string;
|
|
3
|
+
/** Match the workspace proof snapshot's markdown receipt projection exactly. */
|
|
4
|
+
export declare function snapshotFileContent(relativePath: string, content: Buffer): Buffer;
|
|
5
|
+
//# sourceMappingURL=proof-receipt-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-receipt-projection.d.ts","sourceRoot":"","sources":["../../../src/public/operations/proof-receipt-projection.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA4BtE;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,CAGR"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Remove only the top-level proof-receipt frontmatter block, byte-for-byte otherwise. */
|
|
2
|
+
export function withoutProofReceiptFrontmatter(content) {
|
|
3
|
+
const lines = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
4
|
+
if (lines[0]?.trim() !== "---")
|
|
5
|
+
return content;
|
|
6
|
+
let inFrontmatter = true;
|
|
7
|
+
let skippingReceipts = false;
|
|
8
|
+
const retained = [];
|
|
9
|
+
for (const [index, line] of lines.entries()) {
|
|
10
|
+
const trimmed = line.trim();
|
|
11
|
+
if (index > 0 && inFrontmatter && trimmed === "---") {
|
|
12
|
+
inFrontmatter = false;
|
|
13
|
+
skippingReceipts = false;
|
|
14
|
+
retained.push(line);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (inFrontmatter && /^proof_receipts\s*:/.test(line)) {
|
|
18
|
+
skippingReceipts = true;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (inFrontmatter &&
|
|
22
|
+
skippingReceipts &&
|
|
23
|
+
/^[A-Za-z_][A-Za-z0-9_-]*\s*:/.test(line)) {
|
|
24
|
+
skippingReceipts = false;
|
|
25
|
+
}
|
|
26
|
+
if (!skippingReceipts)
|
|
27
|
+
retained.push(line);
|
|
28
|
+
}
|
|
29
|
+
return retained.join("");
|
|
30
|
+
}
|
|
31
|
+
/** Match the workspace proof snapshot's markdown receipt projection exactly. */
|
|
32
|
+
export function snapshotFileContent(relativePath, content) {
|
|
33
|
+
if (!relativePath.endsWith(".md"))
|
|
34
|
+
return content;
|
|
35
|
+
return Buffer.from(withoutProofReceiptFrontmatter(content.toString("utf8")));
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { executePrepareImpactReview } from "../impact-review-preparation.js";
|
|
2
|
+
export declare const prepareImpactReviewSpec: {
|
|
3
|
+
readonly name: "kb_prepare_impact_review";
|
|
4
|
+
readonly cliName: "prepare-impact-review";
|
|
5
|
+
readonly description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.";
|
|
6
|
+
readonly businessInputSchema: {
|
|
7
|
+
readonly type: "object";
|
|
8
|
+
readonly additionalProperties: false;
|
|
9
|
+
readonly required: readonly ["scope"];
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly scope: {
|
|
12
|
+
readonly oneOf: readonly [{
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly additionalProperties: false;
|
|
15
|
+
readonly required: readonly ["kind"];
|
|
16
|
+
readonly properties: {
|
|
17
|
+
readonly kind: {
|
|
18
|
+
readonly const: "staged";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly additionalProperties: false;
|
|
24
|
+
readonly required: readonly ["kind", "baseCommit", "headCommit"];
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly kind: {
|
|
27
|
+
readonly const: "diff";
|
|
28
|
+
};
|
|
29
|
+
readonly baseCommit: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly pattern: "^(?:[a-f0-9]{40}|[a-f0-9]{64})$";
|
|
32
|
+
};
|
|
33
|
+
readonly headCommit: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly pattern: "^(?:[a-f0-9]{40}|[a-f0-9]{64})$";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly requiresProlog: false;
|
|
43
|
+
readonly effects: readonly ["workspace-read", "kb-read"];
|
|
44
|
+
readonly agentVisibleStructuredData: true;
|
|
45
|
+
readonly execute: typeof executePrepareImpactReview;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=impact-review-preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact-review-preparation.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/impact-review-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAG7E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { executePrepareImpactReview } from "../impact-review-preparation.js";
|
|
2
|
+
export const prepareImpactReviewSpec = {
|
|
3
|
+
name: "kb_prepare_impact_review",
|
|
4
|
+
cliName: "prepare-impact-review",
|
|
5
|
+
description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.",
|
|
6
|
+
businessInputSchema: {
|
|
7
|
+
type: "object",
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ["scope"],
|
|
10
|
+
properties: {
|
|
11
|
+
scope: {
|
|
12
|
+
oneOf: [
|
|
13
|
+
{
|
|
14
|
+
type: "object",
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
required: ["kind"],
|
|
17
|
+
properties: { kind: { const: "staged" } },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "object",
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
required: ["kind", "baseCommit", "headCommit"],
|
|
23
|
+
properties: {
|
|
24
|
+
kind: { const: "diff" },
|
|
25
|
+
baseCommit: {
|
|
26
|
+
type: "string",
|
|
27
|
+
pattern: "^(?:[a-f0-9]{40}|[a-f0-9]{64})$",
|
|
28
|
+
},
|
|
29
|
+
headCommit: {
|
|
30
|
+
type: "string",
|
|
31
|
+
pattern: "^(?:[a-f0-9]{40}|[a-f0-9]{64})$",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
requiresProlog: false,
|
|
40
|
+
effects: ["workspace-read", "kb-read"],
|
|
41
|
+
agentVisibleStructuredData: true,
|
|
42
|
+
execute: executePrepareImpactReview,
|
|
43
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OperationContext } from "./runtime-types.js";
|
|
2
2
|
export type { OperationContext };
|
|
3
|
-
export type OperationName = "kb_query" | "kb_search" | "kb_status" | "kb_skills_list" | "kb_skills_load" | "kb_skills_read" | "kb_find_gaps" | "kb_coverage" | "kb_graph" | "kb_sparql_remote" | "kb_semantic_advisor" | "kb_upsert" | "kb_validate_upsert" | "kb_delete" | "kb_check" | "kb_model_requirement" | "kb_suggest_predicates" | "kb_plan_bootstrap" | "kb_compile_intent" | "kb_apply_plan" | "kb_ingest_proof";
|
|
3
|
+
export type OperationName = "kb_query" | "kb_search" | "kb_status" | "kb_skills_list" | "kb_skills_load" | "kb_skills_read" | "kb_find_gaps" | "kb_coverage" | "kb_graph" | "kb_sparql_remote" | "kb_semantic_advisor" | "kb_upsert" | "kb_validate_upsert" | "kb_delete" | "kb_check" | "kb_prepare_impact_review" | "kb_model_requirement" | "kb_suggest_predicates" | "kb_plan_bootstrap" | "kb_compile_intent" | "kb_apply_plan" | "kb_ingest_proof";
|
|
4
4
|
export type OperationEffect = "local-read" | "kb-read" | "workspace-read" | "network-read" | "kb-write" | "workspace-write";
|
|
5
5
|
export type OperationEffectDeclaration = Readonly<{
|
|
6
6
|
kind: OperationEffect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/public/operations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,CAAC;AACjC,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,WAAW,GACX,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,UAAU,GACV,kBAAkB,GAClB,qBAAqB,GACrB,WAAW,GACX,oBAAoB,GACpB,WAAW,GACX,UAAU,GACV,sBAAsB,GACtB,uBAAuB,GACvB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,GACf,iBAAiB,CAAC;AAEtB,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,UAAU,GACV,iBAAiB,CAAC;AAEtB,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,IAAI,EAAE,eAAe,CA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AAE,SAAS,eAAe,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,uEAAuE;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACjE,sEAAsE;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,wDAAwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE;QAChB,cAAc,CACZ,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;KAChC,CAAC,gBAAgB,CAAC,CAAC;CACrB;AAED,6EAA6E;AAC7E,MAAM,MAAM,qBAAqB,CAC/B,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACrC,CAAC,GAAG,OAAO,IACT,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IACxB,QAAQ,CAAC,eAAe,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAChE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC1D,CAAC"}
|
|
@@ -23,6 +23,7 @@ per operation. Effects are authoritative for mutability and adapter annotations.
|
|
|
23
23
|
| `kb_upsert` | `upsert` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_upsert.v1 | yes | unsafe | no | yes |
|
|
24
24
|
| `kb_delete` | `delete` | --input JSON | write | yes | kb-write, workspace-write | peer; capability-selected | kibi.kb_delete.v1 | yes | unsafe | no | yes |
|
|
25
25
|
| `kb_check` | `check` | --input JSON or flags | read | yes | kb-read, workspace-read | peer; capability-selected | kibi.kb_check.v1 | no | safe | no | yes |
|
|
26
|
+
| `kb_prepare_impact_review` | `prepare-impact-review` | --input JSON | read | no | workspace-read, kb-read | peer; capability-selected | kibi.kb_prepare_impact_review.v1 | no | safe | no | yes |
|
|
26
27
|
| `kb_sparql_remote` | `sparql-remote` | --input JSON | read | no | network-read | peer; capability-selected | kibi.kb_sparql_remote.v1 | no | safe | yes | yes |
|
|
27
28
|
| `kb_compile_intent` | `compile-intent` | --input JSON | read | yes | kb-read, workspace-read | peer; capability-selected | kibi.kb_compile_intent.v1 | no | safe | no | yes |
|
|
28
29
|
| `kb_apply_plan` | `apply-plan` | --input JSON | write | yes | kb-read, kb-write, workspace-read, workspace-write | peer; capability-selected | kibi.kb_apply_plan.v1 | yes | unsafe | no | yes |
|