kibi-cli 2.2.0 → 2.4.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-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +2 -2
- 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 +5 -1
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +6 -1
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +7 -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/merge-driver.d.ts +31 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +268 -0
- 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/bootstrap/candidates.js +1 -1
- package/dist/operations/bootstrap/discovery.js +1 -1
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +21 -5
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +3 -0
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +7 -1
- package/dist/operations/bootstrap/intent-claims.d.ts +17 -0
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -0
- package/dist/operations/bootstrap/intent-claims.js +95 -0
- package/dist/operations/bootstrap/presentation.d.ts +2 -0
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +60 -1
- package/dist/operations/bootstrap/types.d.ts +28 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/bootstrap/types.js +16 -0
- 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/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +4 -1
- 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/diagnostic-usage.d.ts +14 -0
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +55 -1
- 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 +117 -1
- 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/bootstrap.d.ts +73 -1
- package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
- package/dist/public/operations/specs/bootstrap.js +66 -1
- 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/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +3 -1
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +47 -11
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -1
- package/dist/public/skills/kibi-usage/SKILL.md +14 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +5 -0
- package/dist/public/telemetry-acceptance.d.ts +8 -0
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +10 -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/diagnostic-usage.ts +59 -1
- 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/bootstrap.ts +78 -4
- package/src/public/operations/specs/impact-review-preparation.ts +46 -0
- package/src/public/operations/symbol-repair-plan.ts +3 -1
- package/src/public/operations/types.ts +1 -0
- package/src/public/skills/kibi-bootstrap/SKILL.md +47 -11
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +6 -1
- package/src/public/skills/kibi-usage/SKILL.md +14 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +5 -0
- package/src/public/telemetry-acceptance.ts +9 -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
|
@@ -17,42 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as fs from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
|
+
import { createMaintenanceSourceAnalysisService } from "../plugins/maintenance-source-analysis.js";
|
|
20
21
|
import { createSourceAnalysisService, } from "../plugins/source-analysis-service.js";
|
|
22
|
+
import { extensionLanguage, isTsJsSourcePath, } from "../plugins/source-classification.js";
|
|
21
23
|
import { createTsMorphSourceAnalysisProvider, enrichSymbolCoordinatesWithTsMorph, } from "./symbols-ts.js";
|
|
22
|
-
const TS_JS_EXTENSIONS = new Set([
|
|
23
|
-
".ts",
|
|
24
|
-
".tsx",
|
|
25
|
-
".js",
|
|
26
|
-
".jsx",
|
|
27
|
-
".mts",
|
|
28
|
-
".cts",
|
|
29
|
-
".mjs",
|
|
30
|
-
".cjs",
|
|
31
|
-
]);
|
|
32
|
-
const SOURCE_LANGUAGE_EXTENSIONS = {
|
|
33
|
-
".c": "c",
|
|
34
|
-
".cc": "cpp",
|
|
35
|
-
".cjs": "javascript",
|
|
36
|
-
".cpp": "cpp",
|
|
37
|
-
".cs": "csharp",
|
|
38
|
-
".cts": "typescript",
|
|
39
|
-
".go": "go",
|
|
40
|
-
".h": "c",
|
|
41
|
-
".hpp": "cpp",
|
|
42
|
-
".java": "java",
|
|
43
|
-
".js": "javascript",
|
|
44
|
-
".jsx": "javascript",
|
|
45
|
-
".kt": "kotlin",
|
|
46
|
-
".mjs": "javascript",
|
|
47
|
-
".mts": "typescript",
|
|
48
|
-
".php": "php",
|
|
49
|
-
".py": "python",
|
|
50
|
-
".rb": "ruby",
|
|
51
|
-
".rs": "rust",
|
|
52
|
-
".swift": "swift",
|
|
53
|
-
".ts": "typescript",
|
|
54
|
-
".tsx": "typescript",
|
|
55
|
-
};
|
|
56
24
|
const DEFAULT_SOURCE_ANALYSIS_PROVIDERS = [
|
|
57
25
|
createTsMorphSourceAnalysisProvider(),
|
|
58
26
|
];
|
|
@@ -114,10 +82,40 @@ export async function analyzeSourceTextWithRegistry(filePath, content, registry)
|
|
|
114
82
|
return analyzeSourceText(filePath, content);
|
|
115
83
|
}
|
|
116
84
|
}
|
|
85
|
+
function isCoordinateOnlyDecoratorPartial(analysis) {
|
|
86
|
+
if (analysis.status !== "partial" ||
|
|
87
|
+
analysis.language !== "python" ||
|
|
88
|
+
analysis.module.analysisMode !== "parser" ||
|
|
89
|
+
analysis.providerId !== "kibi-plugin-treesitter.tree-sitter.v2" ||
|
|
90
|
+
analysis.stamp?.pluginId !== "kibi-plugin-treesitter" ||
|
|
91
|
+
analysis.diagnostics.length === 0 ||
|
|
92
|
+
analysis.uncoveredRanges.length !== analysis.diagnostics.length)
|
|
93
|
+
return false;
|
|
94
|
+
return (analysis.diagnostics.every((diagnostic) => {
|
|
95
|
+
if (diagnostic.code !== "TREESITTER_DECORATOR_EXPANSION_UNAVAILABLE" ||
|
|
96
|
+
diagnostic.range === undefined)
|
|
97
|
+
return false;
|
|
98
|
+
const range = diagnostic.range;
|
|
99
|
+
return analysis.uncoveredRanges.some((uncovered) => uncovered.reason === "decorator-may-alter-or-create-declarations" &&
|
|
100
|
+
uncovered.startLine === range.startLine &&
|
|
101
|
+
uncovered.startColumn === range.startColumn &&
|
|
102
|
+
uncovered.endLine === range.endLine &&
|
|
103
|
+
uncovered.endColumn === range.endColumn);
|
|
104
|
+
}) &&
|
|
105
|
+
analysis.uncoveredRanges.every((uncovered) => uncovered.reason === "decorator-may-alter-or-create-declarations" &&
|
|
106
|
+
analysis.diagnostics.some(({ range }) => range !== undefined &&
|
|
107
|
+
uncovered.startLine === range.startLine &&
|
|
108
|
+
uncovered.startColumn === range.startColumn &&
|
|
109
|
+
uncovered.endLine === range.endLine &&
|
|
110
|
+
uncovered.endColumn === range.endColumn)));
|
|
111
|
+
}
|
|
117
112
|
export async function enrichSymbolCoordinates(entries, workspaceRoot, deps) {
|
|
118
113
|
// implements REQ-vscode-traceability
|
|
119
114
|
const enrichTsCoordinates = deps?.enrichTsCoordinates ?? enrichSymbolCoordinatesWithTsMorph;
|
|
120
115
|
const output = entries.map((entry) => withoutGeneratedCoordinates(entry));
|
|
116
|
+
const service = deps?.sourceAnalysisService ??
|
|
117
|
+
createMaintenanceSourceAnalysisService(workspaceRoot);
|
|
118
|
+
const analyses = new Map();
|
|
121
119
|
const tsIndices = [];
|
|
122
120
|
const tsEntries = [];
|
|
123
121
|
for (let index = 0; index < output.length; index++) {
|
|
@@ -125,15 +123,54 @@ export async function enrichSymbolCoordinates(entries, workspaceRoot, deps) {
|
|
|
125
123
|
if (!entry)
|
|
126
124
|
continue;
|
|
127
125
|
const resolved = resolveSourcePath(entry.sourceFile, workspaceRoot);
|
|
128
|
-
if (!resolved)
|
|
126
|
+
if (!resolved || !fs.statSync(resolved.absolutePath).isFile())
|
|
129
127
|
continue;
|
|
130
128
|
const ext = path.extname(resolved.absolutePath).toLowerCase();
|
|
131
|
-
if (
|
|
129
|
+
if (isTsJsSourcePath(resolved.absolutePath)) {
|
|
132
130
|
tsIndices.push(index);
|
|
133
131
|
tsEntries.push(entry);
|
|
134
132
|
continue;
|
|
135
133
|
}
|
|
136
|
-
|
|
134
|
+
const logicalPath = path
|
|
135
|
+
.relative(workspaceRoot, resolved.absolutePath)
|
|
136
|
+
.replaceAll("\\", "/");
|
|
137
|
+
let analysis = analyses.get(logicalPath);
|
|
138
|
+
const firstAnalysis = analysis === undefined;
|
|
139
|
+
if (!analysis) {
|
|
140
|
+
analysis = await service.analyzeTextV2(logicalPath, fs.readFileSync(resolved.absolutePath, "utf8"));
|
|
141
|
+
analyses.set(logicalPath, analysis);
|
|
142
|
+
}
|
|
143
|
+
const coordinateOnlyPartial = deps?.allowPythonDecoratorCoordinates === true &&
|
|
144
|
+
isCoordinateOnlyDecoratorPartial(analysis);
|
|
145
|
+
if (analysis.status === "failed" ||
|
|
146
|
+
(analysis.status === "partial" && !coordinateOnlyPartial))
|
|
147
|
+
throw new Error(`Cannot refresh incomplete source analysis for ${logicalPath}: ${analysis.diagnostics.map((d) => d.message).join("; ")}`);
|
|
148
|
+
if (coordinateOnlyPartial && firstAnalysis) {
|
|
149
|
+
await deps?.verifyPythonDecoratorCoordinates?.(logicalPath, analysis);
|
|
150
|
+
console.warn(`[kibi] Coordinate-only refresh for ${logicalPath}; source analysis remains partial: ${analysis.diagnostics.map((diagnostic) => diagnostic.message).join("; ")}`);
|
|
151
|
+
}
|
|
152
|
+
if (analysis.status === "unsupported") {
|
|
153
|
+
// Preserve the legacy coarse heuristic until the file-level migration;
|
|
154
|
+
// it is never exposed as parser-backed symbol evidence.
|
|
155
|
+
output[index] = enrichWithRegexHeuristic(entry, resolved.absolutePath);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const exact = analysis.symbols.filter((symbol) => (symbol.qualifiedName ?? symbol.name) === entry.title);
|
|
159
|
+
const candidates = exact.length
|
|
160
|
+
? exact
|
|
161
|
+
: analysis.symbols.filter((symbol) => symbol.name === entry.title);
|
|
162
|
+
if (candidates.length !== 1)
|
|
163
|
+
continue;
|
|
164
|
+
const symbol = candidates[0];
|
|
165
|
+
if (!symbol)
|
|
166
|
+
continue;
|
|
167
|
+
output[index] = {
|
|
168
|
+
...entry,
|
|
169
|
+
sourceLine: symbol.startLine,
|
|
170
|
+
sourceColumn: symbol.startColumn,
|
|
171
|
+
sourceEndLine: symbol.endLine,
|
|
172
|
+
sourceEndColumn: symbol.endColumn,
|
|
173
|
+
};
|
|
137
174
|
}
|
|
138
175
|
if (tsEntries.length > 0) {
|
|
139
176
|
const enrichedTs = await enrichTsCoordinates(tsEntries, workspaceRoot);
|
|
@@ -218,8 +255,7 @@ function createFallbackAnalysis(filePath, fallbackReason) {
|
|
|
218
255
|
};
|
|
219
256
|
}
|
|
220
257
|
function detectSourceLanguage(filePath) {
|
|
221
|
-
return (
|
|
222
|
-
"unknown");
|
|
258
|
+
return extensionLanguage(filePath);
|
|
223
259
|
}
|
|
224
260
|
function inferModuleTitle(filePath) {
|
|
225
261
|
const extension = path.extname(filePath);
|
|
@@ -91,7 +91,7 @@ function providerCandidate(item, existingIds, minConfidence) {
|
|
|
91
91
|
},
|
|
92
92
|
];
|
|
93
93
|
}
|
|
94
|
-
// implements REQ-
|
|
94
|
+
// implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
|
|
95
95
|
// implements REQ-KIBI-BOOTSTRAP-PLAN
|
|
96
96
|
export function buildBootstrapCandidates(evidence, existingIds, minConfidence, includeGenericMarkdown) {
|
|
97
97
|
const candidates = [];
|
|
@@ -63,7 +63,7 @@ function frameworks(evidence) {
|
|
|
63
63
|
: [])),
|
|
64
64
|
].sort();
|
|
65
65
|
}
|
|
66
|
-
// implements REQ-
|
|
66
|
+
// implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
|
|
67
67
|
// implements REQ-KIBI-BOOTSTRAP-PLAN
|
|
68
68
|
export async function discoverBootstrap(context) {
|
|
69
69
|
const scan = await scanEvidence(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAMjF,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA2BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CACnE,CAiDA;AA+GD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CA4E9B"}
|
|
@@ -5,7 +5,8 @@ import { executeStatus } from "../../public/operations/discovery-executors.js";
|
|
|
5
5
|
import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
|
|
6
6
|
import { buildBootstrapCandidates } from "./candidates.js";
|
|
7
7
|
import { discoverBootstrap } from "./discovery.js";
|
|
8
|
-
import {
|
|
8
|
+
import { buildIntentClaimCandidates } from "./intent-claims.js";
|
|
9
|
+
import { normalizeBootstrapContext, presentBootstrap } from "./presentation.js";
|
|
9
10
|
export function filterSourceOnlySignals(signals, entityTypes) {
|
|
10
11
|
return entityTypes && entityTypes.length > 0
|
|
11
12
|
? signals.filter((signal) => entityTypes.includes(signal.kind))
|
|
@@ -164,7 +165,7 @@ async function expectedSnapshots(context, evidencePaths) {
|
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
|
-
// implements REQ-
|
|
168
|
+
// implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
|
|
168
169
|
// implements REQ-KIBI-BOOTSTRAP-PLAN
|
|
169
170
|
export async function executePlanBootstrap(args, context) {
|
|
170
171
|
const includeGenericMarkdown = args.includeGenericMarkdown ?? true;
|
|
@@ -182,8 +183,18 @@ export async function executePlanBootstrap(args, context) {
|
|
|
182
183
|
const built = discovery.activation.allowCandidateGeneration
|
|
183
184
|
? buildBootstrapCandidates(discovery.evidence, existingIds, minConfidence, includeGenericMarkdown)
|
|
184
185
|
: { candidates: [], sourceOnlySignals: [] };
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
// Intent harvested from declared knowledge sources joins the repository
|
|
187
|
+
// evidence under the same activation policy, filters, and selection.
|
|
188
|
+
const claimed = discovery.activation.allowCandidateGeneration
|
|
189
|
+
? buildIntentClaimCandidates(normalizeBootstrapContext(args.bootstrapContext), existingIds, minConfidence)
|
|
190
|
+
: {
|
|
191
|
+
candidates: [],
|
|
192
|
+
sourceOnlySignals: [],
|
|
193
|
+
suppressed: [],
|
|
194
|
+
diagnostics: [],
|
|
195
|
+
};
|
|
196
|
+
const filteredSignals = filterSourceOnlySignals([...built.sourceOnlySignals, ...claimed.sourceOnlySignals], args.entityTypes);
|
|
197
|
+
const selected = selectBootstrapCandidates([...built.candidates, ...claimed.candidates].filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
|
|
187
198
|
const ignored = discovery.ignoredSources.map((sourcePath) => ({
|
|
188
199
|
candidateId: "",
|
|
189
200
|
reason: "ignored_source",
|
|
@@ -201,8 +212,13 @@ export async function executePlanBootstrap(args, context) {
|
|
|
201
212
|
: {}),
|
|
202
213
|
candidates: selected.candidates,
|
|
203
214
|
sourceOnlySignals: filteredSignals,
|
|
204
|
-
suppressedCandidates: [
|
|
215
|
+
suppressedCandidates: [
|
|
216
|
+
...selected.suppressed,
|
|
217
|
+
...claimed.suppressed,
|
|
218
|
+
...ignored,
|
|
219
|
+
],
|
|
205
220
|
expected,
|
|
206
221
|
bindingDiagnostics,
|
|
222
|
+
contextDiagnostics: claimed.diagnostics,
|
|
207
223
|
});
|
|
208
224
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAuE9C"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
function relative(root, target) {
|
|
3
|
+
// Intent claims cite tickets and URLs, which are not workspace paths.
|
|
4
|
+
if (!path.isAbsolute(target))
|
|
5
|
+
return target;
|
|
3
6
|
const value = path.relative(root, target);
|
|
4
7
|
return value.startsWith("..") || path.isAbsolute(value)
|
|
5
8
|
? target.split(path.sep).join("/")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAwFpB,wBAAgB,UAAU,CACxB,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,MAAM,GAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiEnC;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAChE,CA0BA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { buildActions } from "./guidance-actions.js";
|
|
3
3
|
function relative(root, target) {
|
|
4
|
+
// Intent claims cite tickets and URLs, which are not workspace paths.
|
|
5
|
+
if (!path.isAbsolute(target))
|
|
6
|
+
return target;
|
|
4
7
|
const value = path.relative(root, target);
|
|
5
8
|
return value.startsWith("..") || path.isAbsolute(value)
|
|
6
9
|
? target.split(path.sep).join("/")
|
|
@@ -28,6 +31,8 @@ function prompt(root, activation, declared, candidates, signals, warnings) {
|
|
|
28
31
|
bullets.push(`- Summary: ${declared.projectSummary}`);
|
|
29
32
|
if (declared.sourceOfTruthPaths.length > 0)
|
|
30
33
|
bullets.push(`- Source of truth: ${summary(declared.sourceOfTruthPaths)}.`);
|
|
34
|
+
if (declared.knowledgeSources)
|
|
35
|
+
bullets.push(`- Knowledge sources: ${summary(declared.knowledgeSources.map((source) => `${source.title} (${source.authority})`))}; ${declared.intentClaims?.length ?? 0} cited intent claim(s).`);
|
|
31
36
|
if (candidates.length > 0) {
|
|
32
37
|
const formatted = Object.entries(counts(candidates))
|
|
33
38
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
@@ -81,7 +86,8 @@ export function confidence(activation, declared, candidates, signals, promptBloc
|
|
|
81
86
|
declared.sourceOfTruthPaths.length +
|
|
82
87
|
declared.sourceOfTruthNotes.length +
|
|
83
88
|
declared.priorityRoots.length +
|
|
84
|
-
declared.verificationAnchors.length
|
|
89
|
+
declared.verificationAnchors.length +
|
|
90
|
+
(declared.knowledgeSources?.length ?? 0) >
|
|
85
91
|
0) {
|
|
86
92
|
score += 0.08;
|
|
87
93
|
reasons.push("Declared bootstrap context grounds the output.");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BootstrapDeclaredContext, Candidate, SourceOnlySignal } from "./types.js";
|
|
2
|
+
export type IntentClaimBuildResult = {
|
|
3
|
+
readonly candidates: readonly Candidate[];
|
|
4
|
+
readonly sourceOnlySignals: readonly SourceOnlySignal[];
|
|
5
|
+
readonly suppressed: readonly Readonly<Record<string, unknown>>[];
|
|
6
|
+
readonly diagnostics: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Turn intent the agent harvested from declared knowledge sources into cited
|
|
10
|
+
* bootstrap candidates. Kibi never contacts those sources: it only records
|
|
11
|
+
* what the agent read, binds it into the plan hash through the declared
|
|
12
|
+
* context, and keeps the citation on every candidate it produces. A claim the
|
|
13
|
+
* strict modeler cannot ground stays an explicit authoring follow-up instead
|
|
14
|
+
* of becoming unverifiable knowledge.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildIntentClaimCandidates(declared: BootstrapDeclaredContext, existingIds: ReadonlySet<string>, minConfidence: number): IntentClaimBuildResult;
|
|
17
|
+
//# sourceMappingURL=intent-claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/intent-claims.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EAGxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAcF;;;;;;;GAOG;AAEH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAgFxB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
|
|
2
|
+
import { confidenceBand, strictPlan } from "./candidate-helpers.js";
|
|
3
|
+
import { claimFor } from "./requirement-claims.js";
|
|
4
|
+
/** How much a claim is trusted follows the authority the human assigned. */
|
|
5
|
+
const AUTHORITY_CONFIDENCE = {
|
|
6
|
+
authoritative: 0.9,
|
|
7
|
+
supporting: 0.82,
|
|
8
|
+
};
|
|
9
|
+
function citation(source, claim) {
|
|
10
|
+
return [
|
|
11
|
+
`intent_claim:${source.id}:${claim.reference}`,
|
|
12
|
+
`knowledge_source:${source.kind}:${source.locator}`,
|
|
13
|
+
`source_authority:${source.authority}`,
|
|
14
|
+
...(source.connector ? [`connector:${source.connector}`] : []),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Turn intent the agent harvested from declared knowledge sources into cited
|
|
19
|
+
* bootstrap candidates. Kibi never contacts those sources: it only records
|
|
20
|
+
* what the agent read, binds it into the plan hash through the declared
|
|
21
|
+
* context, and keeps the citation on every candidate it produces. A claim the
|
|
22
|
+
* strict modeler cannot ground stays an explicit authoring follow-up instead
|
|
23
|
+
* of becoming unverifiable knowledge.
|
|
24
|
+
*/
|
|
25
|
+
// implements REQ-kibi-bootstrap-knowledge-sources
|
|
26
|
+
export function buildIntentClaimCandidates(declared, existingIds, minConfidence) {
|
|
27
|
+
const sources = new Map((declared.knowledgeSources ?? []).map((source) => [source.id, source]));
|
|
28
|
+
const candidates = [];
|
|
29
|
+
const sourceOnlySignals = [];
|
|
30
|
+
const suppressed = [];
|
|
31
|
+
const diagnostics = [];
|
|
32
|
+
for (const claim of declared.intentClaims ?? []) {
|
|
33
|
+
const source = sources.get(claim.sourceId);
|
|
34
|
+
if (!source) {
|
|
35
|
+
diagnostics.push(`Intent claim cites an undeclared knowledge source "${claim.sourceId}" (${claim.reference}); declare it in knowledgeSources or drop the claim.`);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (source.authority === "stale") {
|
|
39
|
+
suppressed.push({
|
|
40
|
+
candidateId: "",
|
|
41
|
+
reason: "stale_knowledge_source",
|
|
42
|
+
sourcePath: claim.reference,
|
|
43
|
+
entityType: "req",
|
|
44
|
+
statement: claim.statement,
|
|
45
|
+
sourceId: source.id,
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const confidence = AUTHORITY_CONFIDENCE[source.authority];
|
|
50
|
+
const evidence = citation(source, claim);
|
|
51
|
+
const provenance = `${source.id}:${claim.reference}`;
|
|
52
|
+
const modeled = claimFor(claim.statement, `knowledge-source:${source.id}`, confidence, provenance);
|
|
53
|
+
const writeSet = modeled
|
|
54
|
+
? buildStrictWriteSet({ claim: modeled, statement: claim.statement })
|
|
55
|
+
: null;
|
|
56
|
+
if (writeSet?.isStrict &&
|
|
57
|
+
confidence >= minConfidence &&
|
|
58
|
+
!existingIds.has(writeSet.req.id)) {
|
|
59
|
+
candidates.push({
|
|
60
|
+
candidateId: `claim:${source.id}:${writeSet.req.id.toLowerCase()}`,
|
|
61
|
+
entityType: "req",
|
|
62
|
+
title: claim.statement,
|
|
63
|
+
sourceKind: "intent_claim",
|
|
64
|
+
sourcePath: claim.reference,
|
|
65
|
+
confidence,
|
|
66
|
+
confidenceBand: confidenceBand(confidence),
|
|
67
|
+
evidence,
|
|
68
|
+
relationships: writeSet.relationships.map(({ type, from, to }) => ({
|
|
69
|
+
type,
|
|
70
|
+
from,
|
|
71
|
+
to,
|
|
72
|
+
})),
|
|
73
|
+
applyPlan: strictPlan(writeSet),
|
|
74
|
+
});
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (writeSet?.isStrict && existingIds.has(writeSet.req.id)) {
|
|
78
|
+
suppressed.push({
|
|
79
|
+
candidateId: `claim:${source.id}:${writeSet.req.id.toLowerCase()}`,
|
|
80
|
+
reason: "entity_exists",
|
|
81
|
+
sourcePath: claim.reference,
|
|
82
|
+
entityType: "req",
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
sourceOnlySignals.push({
|
|
87
|
+
kind: "req",
|
|
88
|
+
title: `Author requirement from ${source.title} ${claim.reference}: ${claim.statement}`,
|
|
89
|
+
sourcePath: claim.reference,
|
|
90
|
+
confidence,
|
|
91
|
+
evidence,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return { candidates, sourceOnlySignals, suppressed, diagnostics };
|
|
95
|
+
}
|
|
@@ -11,5 +11,7 @@ export declare function presentBootstrap(input: {
|
|
|
11
11
|
readonly suppressedCandidates: readonly Readonly<Record<string, unknown>>[];
|
|
12
12
|
readonly expected: BootstrapPlanV1["expected"];
|
|
13
13
|
readonly bindingDiagnostics?: readonly string[];
|
|
14
|
+
/** Advisory findings about declared context; they never block apply. */
|
|
15
|
+
readonly contextDiagnostics?: readonly string[];
|
|
14
16
|
}): PlanBootstrapResult;
|
|
15
17
|
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/presentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/presentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,wBAAwB,EAGxB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAwEpB,wBAAgB,yBAAyB,CACvC,KAAK,CAAC,EAAE,gBAAgB,GACvB,wBAAwB,CAa1B;AAiBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,oBAAoB,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5E,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IAC/C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,wEAAwE;IACxE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD,GAAG,mBAAmB,CA+KtB"}
|
|
@@ -1,18 +1,74 @@
|
|
|
1
1
|
import { buildGuidance } from "./guidance.js";
|
|
2
|
-
import { bootstrapPlanHash } from "./types.js";
|
|
2
|
+
import { KNOWLEDGE_SOURCE_AUTHORITIES, KNOWLEDGE_SOURCE_KINDS, bootstrapPlanHash, } from "./types.js";
|
|
3
3
|
function strings(values) {
|
|
4
4
|
return [
|
|
5
5
|
...new Set((values ?? []).map((value) => value.trim()).filter(Boolean)),
|
|
6
6
|
];
|
|
7
7
|
}
|
|
8
|
+
function knowledgeSources(values) {
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
const result = [];
|
|
11
|
+
for (const value of values ?? []) {
|
|
12
|
+
const id = value.id?.trim();
|
|
13
|
+
const title = value.title?.trim();
|
|
14
|
+
const locator = value.locator?.trim();
|
|
15
|
+
if (!id ||
|
|
16
|
+
!title ||
|
|
17
|
+
!locator ||
|
|
18
|
+
seen.has(id) ||
|
|
19
|
+
!KNOWLEDGE_SOURCE_KINDS.includes(value.kind) ||
|
|
20
|
+
!KNOWLEDGE_SOURCE_AUTHORITIES.includes(value.authority))
|
|
21
|
+
continue;
|
|
22
|
+
seen.add(id);
|
|
23
|
+
const connector = value.connector?.trim();
|
|
24
|
+
const notes = value.notes?.trim();
|
|
25
|
+
result.push({
|
|
26
|
+
id,
|
|
27
|
+
kind: value.kind,
|
|
28
|
+
title,
|
|
29
|
+
locator,
|
|
30
|
+
authority: value.authority,
|
|
31
|
+
...(connector ? { connector } : {}),
|
|
32
|
+
...(notes ? { notes } : {}),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function intentClaims(values) {
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
const result = [];
|
|
40
|
+
for (const value of values ?? []) {
|
|
41
|
+
const statement = value.statement?.trim().replace(/\s+/g, " ");
|
|
42
|
+
const sourceId = value.sourceId?.trim();
|
|
43
|
+
const reference = value.reference?.trim();
|
|
44
|
+
if (!statement || !sourceId || !reference)
|
|
45
|
+
continue;
|
|
46
|
+
const key = `${sourceId}\u0000${reference}\u0000${statement}`;
|
|
47
|
+
if (seen.has(key))
|
|
48
|
+
continue;
|
|
49
|
+
seen.add(key);
|
|
50
|
+
const excerpt = value.excerpt?.trim();
|
|
51
|
+
result.push({
|
|
52
|
+
statement,
|
|
53
|
+
sourceId,
|
|
54
|
+
reference,
|
|
55
|
+
...(excerpt ? { excerpt } : {}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
8
60
|
export function normalizeBootstrapContext(input) {
|
|
9
61
|
const projectSummary = input?.projectSummary?.trim();
|
|
62
|
+
const sources = knowledgeSources(input?.knowledgeSources);
|
|
63
|
+
const claims = intentClaims(input?.intentClaims);
|
|
10
64
|
return {
|
|
11
65
|
...(projectSummary ? { projectSummary } : {}),
|
|
12
66
|
sourceOfTruthPaths: strings(input?.sourceOfTruthPaths),
|
|
13
67
|
sourceOfTruthNotes: strings(input?.sourceOfTruthNotes),
|
|
14
68
|
priorityRoots: strings(input?.priorityRoots),
|
|
15
69
|
verificationAnchors: strings(input?.verificationAnchors),
|
|
70
|
+
...(sources.length > 0 ? { knowledgeSources: sources } : {}),
|
|
71
|
+
...(claims.length > 0 ? { intentClaims: claims } : {}),
|
|
16
72
|
};
|
|
17
73
|
}
|
|
18
74
|
function payoff(candidates) {
|
|
@@ -99,6 +155,8 @@ export function presentBootstrap(input) {
|
|
|
99
155
|
if (status === "needs_context") {
|
|
100
156
|
if (!declaredContext.projectSummary)
|
|
101
157
|
contextQuestions.push("What is the one-sentence purpose of this repository?");
|
|
158
|
+
if (!declaredContext.knowledgeSources)
|
|
159
|
+
contextQuestions.push("Which knowledge sources outside the code (issue trackers, wikis, specs, decision logs) describe product intent, and which of them are authoritative?");
|
|
102
160
|
if (declaredContext.sourceOfTruthPaths.length === 0)
|
|
103
161
|
contextQuestions.push("Which repository paths are authoritative for product intent?");
|
|
104
162
|
if (input.sourceOnlySignals.length > 0)
|
|
@@ -112,6 +170,7 @@ export function presentBootstrap(input) {
|
|
|
112
170
|
...(input.migrationWarning ? [input.migrationWarning] : []),
|
|
113
171
|
...input.discoverySummary.scanWarnings,
|
|
114
172
|
...bindingDiagnostics,
|
|
173
|
+
...strings(input.contextDiagnostics),
|
|
115
174
|
];
|
|
116
175
|
const planBody = {
|
|
117
176
|
version: "kibi.bootstrap-plan.v1",
|
|
@@ -6,12 +6,38 @@ export declare function bootstrapEmptyKbSnapshotId(input: {
|
|
|
6
6
|
readonly workspaceSnapshot: string;
|
|
7
7
|
readonly sourceHashes: Readonly<Record<string, string | null>>;
|
|
8
8
|
}): string;
|
|
9
|
+
export declare const KNOWLEDGE_SOURCE_KINDS: readonly ["issue_tracker", "wiki", "specification", "design", "decision_log", "support", "chat", "repository_docs", "other"];
|
|
10
|
+
export declare const KNOWLEDGE_SOURCE_AUTHORITIES: readonly ["authoritative", "supporting", "stale"];
|
|
11
|
+
/**
|
|
12
|
+
* A knowledge source the agent and human agreed on during the bootstrap
|
|
13
|
+
* interview: an issue tracker, wiki, spec, or other place where product intent
|
|
14
|
+
* lives outside the code. Kibi never reads it; the agent does, through the
|
|
15
|
+
* connectors it has, and cites it from intent claims.
|
|
16
|
+
*/
|
|
17
|
+
export type BootstrapKnowledgeSource = {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly kind: (typeof KNOWLEDGE_SOURCE_KINDS)[number];
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly locator: string;
|
|
22
|
+
readonly authority: (typeof KNOWLEDGE_SOURCE_AUTHORITIES)[number];
|
|
23
|
+
readonly connector?: string;
|
|
24
|
+
readonly notes?: string;
|
|
25
|
+
};
|
|
26
|
+
/** One statement of intent the agent harvested from a declared source. */
|
|
27
|
+
export type BootstrapIntentClaim = {
|
|
28
|
+
readonly statement: string;
|
|
29
|
+
readonly sourceId: string;
|
|
30
|
+
readonly reference: string;
|
|
31
|
+
readonly excerpt?: string;
|
|
32
|
+
};
|
|
9
33
|
export type BootstrapContext = {
|
|
10
34
|
readonly projectSummary?: string;
|
|
11
35
|
readonly sourceOfTruthPaths?: readonly string[];
|
|
12
36
|
readonly sourceOfTruthNotes?: readonly string[];
|
|
13
37
|
readonly priorityRoots?: readonly string[];
|
|
14
38
|
readonly verificationAnchors?: readonly string[];
|
|
39
|
+
readonly knowledgeSources?: readonly BootstrapKnowledgeSource[];
|
|
40
|
+
readonly intentClaims?: readonly BootstrapIntentClaim[];
|
|
15
41
|
};
|
|
16
42
|
export type PlanBootstrapArgs = {
|
|
17
43
|
readonly includeGenericMarkdown?: boolean;
|
|
@@ -38,6 +64,8 @@ export type BootstrapDeclaredContext = {
|
|
|
38
64
|
readonly sourceOfTruthNotes: readonly string[];
|
|
39
65
|
readonly priorityRoots: readonly string[];
|
|
40
66
|
readonly verificationAnchors: readonly string[];
|
|
67
|
+
readonly knowledgeSources?: readonly BootstrapKnowledgeSource[];
|
|
68
|
+
readonly intentClaims?: readonly BootstrapIntentClaim[];
|
|
41
69
|
};
|
|
42
70
|
export type ActivationState = "root_uninitialized" | "root_partial" | "vendored_only" | "root_active_thin" | "root_active_seeded";
|
|
43
71
|
export type ActivationMode = "cold_start_bootstrap" | "repair_bootstrap" | "attached_thin_bootstrap" | "attached_thin_handoff" | "attached_seeded_handoff" | "vendored_blocked";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,MAAM,CAGR;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAChE,GAAG,MAAM,CAWT;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,MAAM,CAGR;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,M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,EAAE,CAAC;IAC5E,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC7B,eAAe,CAAC,0BAA0B,CAAC,GAAG;IAC5C,QAAQ,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;CACxD,CAAC"}
|
|
@@ -15,6 +15,22 @@ export function bootstrapEmptyKbSnapshotId(input) {
|
|
|
15
15
|
}))
|
|
16
16
|
.digest("hex")}`;
|
|
17
17
|
}
|
|
18
|
+
export const KNOWLEDGE_SOURCE_KINDS = [
|
|
19
|
+
"issue_tracker",
|
|
20
|
+
"wiki",
|
|
21
|
+
"specification",
|
|
22
|
+
"design",
|
|
23
|
+
"decision_log",
|
|
24
|
+
"support",
|
|
25
|
+
"chat",
|
|
26
|
+
"repository_docs",
|
|
27
|
+
"other",
|
|
28
|
+
];
|
|
29
|
+
export const KNOWLEDGE_SOURCE_AUTHORITIES = [
|
|
30
|
+
"authoritative",
|
|
31
|
+
"supporting",
|
|
32
|
+
"stale",
|
|
33
|
+
];
|
|
18
34
|
export const BOOTSTRAP_PROVIDER_ORDER = [
|
|
19
35
|
"typed_kibi_docs",
|
|
20
36
|
"generic_repo_docs",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePredicateToken, normalizeSubjectKey, singularize, slug, } from "./predicate-utils.js";
|
|
2
2
|
// implements REQ-mcp-suggest-predicates
|
|
3
3
|
export function inferPermissionRuleArgs(text) {
|
|
4
|
-
const prohibition = text.match(/^(?<actor>[a-z][a-z\s_-]*?)\s+(?:must\s+not|cannot|can't|is\s+forbidden\s+to)\s+(?<action>[a-z][a-z_-]*)\s+(?<resource>.+?)\.?$/i);
|
|
4
|
+
const prohibition = text.match(/^(?<actor>[a-z][a-z\s_-]*?)\s+(?:must\s+not|must\s+never|never|cannot|can't|is\s+forbidden\s+to)\s+(?<action>[a-z][a-z_-]*)\s+(?<resource>.+?)\.?$/i);
|
|
5
5
|
if (prohibition?.groups) {
|
|
6
6
|
return [
|
|
7
7
|
singularize(slug(prohibition.groups.actor ?? "actor")),
|