kibi-cli 2.24.0 → 2.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-errors.d.ts +14 -0
- package/dist/cli-errors.d.ts.map +1 -1
- package/dist/cli-errors.js +31 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +28 -0
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +115 -4
- package/dist/commands/sync/cache.d.ts +30 -0
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +61 -0
- package/dist/commands/sync/extraction.d.ts +6 -0
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +4 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +27 -1
- package/dist/firm-decision-edit.d.ts +30 -0
- package/dist/firm-decision-edit.d.ts.map +1 -0
- package/dist/firm-decision-edit.js +90 -0
- package/dist/operations/bootstrap/claim-restatement.d.ts +37 -0
- package/dist/operations/bootstrap/claim-restatement.d.ts.map +1 -0
- package/dist/operations/bootstrap/claim-restatement.js +83 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +23 -12
- package/dist/operations/bootstrap/intent-claims.d.ts +5 -2
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/intent-claims.js +44 -4
- package/dist/operations/migration/requirement-status.d.ts +41 -2
- package/dist/operations/migration/requirement-status.d.ts.map +1 -1
- package/dist/operations/migration/requirement-status.js +75 -7
- package/dist/operations/migration/schema6.d.ts +9 -5
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +82 -13
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts +36 -0
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts.map +1 -0
- package/dist/operations/migration/symbol-coordinates-refresh.js +99 -0
- package/dist/operations/mutation/firm-decision-guard.d.ts +10 -0
- package/dist/operations/mutation/firm-decision-guard.d.ts.map +1 -0
- package/dist/operations/mutation/firm-decision-guard.js +71 -0
- package/dist/operations/mutation/source-authoring.d.ts +9 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +20 -0
- package/dist/operations/mutation/stored-entity.d.ts +5 -0
- package/dist/operations/mutation/stored-entity.d.ts.map +1 -1
- package/dist/operations/mutation/uncompiled-source.d.ts +43 -0
- package/dist/operations/mutation/uncompiled-source.d.ts.map +1 -0
- package/dist/operations/mutation/uncompiled-source.js +115 -0
- package/dist/operations/mutation/upsert.d.ts +6 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +34 -5
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +13 -3
- package/dist/public/impact/diagnostics.js +1 -1
- package/dist/public/impact/unowned-files.d.ts +31 -0
- package/dist/public/impact/unowned-files.d.ts.map +1 -0
- package/dist/public/impact/unowned-files.js +171 -0
- package/dist/public/operations/catalog.d.ts +3 -3
- package/dist/public/operations/decision-firmness.d.ts +11 -1
- package/dist/public/operations/decision-firmness.d.ts.map +1 -1
- package/dist/public/operations/decision-firmness.js +78 -5
- package/dist/public/operations/discovery-entities.d.ts +11 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +28 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +13 -1
- package/dist/public/operations/result-envelope.d.ts +2 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +1 -0
- package/dist/public/operations/source-relationship-parity.d.ts.map +1 -1
- package/dist/public/operations/source-relationship-parity.js +22 -7
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +2 -1
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +1 -1
- package/dist/public/operations/specs/upsert.d.ts +1 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/dist/public/skills/kibi-usage/SKILL.md +18 -7
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -1
- package/dist/traceability/git-change-snapshot.js +44 -3
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-migration.d.ts +13 -0
- package/dist/traceability/staged-migration.d.ts.map +1 -0
- package/dist/traceability/staged-migration.js +59 -0
- package/dist/traceability/staged-symbols-manifest.d.ts +11 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +50 -16
- package/dist/utils/rule-registry.generated.d.ts +5 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +6 -0
- package/package.json +2 -2
- package/src/public/impact/analyzer.ts +21 -7
- package/src/public/impact/diagnostics.ts +1 -1
- package/src/public/impact/unowned-files.ts +229 -0
- package/src/public/operations/decision-firmness.ts +110 -13
- package/src/public/operations/discovery-entities.ts +36 -0
- package/src/public/operations/discovery-executors.ts +17 -1
- package/src/public/operations/result-envelope.ts +3 -0
- package/src/public/operations/source-relationship-parity.ts +22 -7
- package/src/public/operations/specs/check-rules.generated.ts +2 -1
- package/src/public/operations/specs/check.ts +1 -1
- package/src/public/operations/specs/mutation-schemas.ts +1 -1
- package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/src/public/skills/kibi-usage/SKILL.md +18 -7
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
+
import { execFileSync } from "node:child_process";
|
|
18
19
|
import path from "node:path";
|
|
19
20
|
import { MIN_WHY_CHANGED_WORDS, WHY_THIS_CHANGED_HEADING, carriesFirmness, effectiveFirmness, firmnessIsImplicit, firmnessRef, supersedeAcknowledgement, whyThisChangedWords, } from "../../decision-firmness.js";
|
|
21
|
+
import { firmEditGuidance, unapprovedFirmEdit, } from "../../firm-decision-edit.js";
|
|
20
22
|
import { listLaneMarkdownFiles, readText, } from "../../operations/migration/kb-sources.js";
|
|
21
23
|
import { readAllShards } from "../../relationships/shards.js";
|
|
22
24
|
import { readKbManifest } from "../../utils/kb-manifest.js";
|
|
@@ -27,6 +29,9 @@ export const DECISION_FIRM_UNREFERENCED_RULE = "decision-firm-unreferenced";
|
|
|
27
29
|
/** Only a firm decision may supersede a firm decision (blocking). */
|
|
28
30
|
// implements REQ-kb-decision-firmness
|
|
29
31
|
export const DECISION_FIRM_SUPERSEDED_RULE = "decision-firm-superseded";
|
|
32
|
+
/** A firm decision's claim must not change in place without new human words (blocking). */
|
|
33
|
+
// implements REQ-kb-firm-decision-edit
|
|
34
|
+
export const DECISION_FIRM_EDITED_RULE = "decision-firm-edited";
|
|
30
35
|
/** A supersede must say why under "Why this changed" (blocking). */
|
|
31
36
|
// implements REQ-kb-decision-firmness
|
|
32
37
|
export const SUPERSEDES_REASON_MISSING_RULE = "supersedes-reason-missing";
|
|
@@ -37,6 +42,7 @@ export const SUPERSEDES_REASON_ACKNOWLEDGED_RULE = "supersedes-reason-acknowledg
|
|
|
37
42
|
export const DECISION_FIRMNESS_RULES = [
|
|
38
43
|
DECISION_FIRM_UNREFERENCED_RULE,
|
|
39
44
|
DECISION_FIRM_SUPERSEDED_RULE,
|
|
45
|
+
DECISION_FIRM_EDITED_RULE,
|
|
40
46
|
SUPERSEDES_REASON_MISSING_RULE,
|
|
41
47
|
SUPERSEDES_REASON_ACKNOWLEDGED_RULE,
|
|
42
48
|
];
|
|
@@ -265,15 +271,82 @@ export function evaluateDecisionFirmness(entities, edges, rules = new Set(DECISI
|
|
|
265
271
|
}
|
|
266
272
|
return findings;
|
|
267
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* The decision files whose working copy differs from HEAD, with a reader for
|
|
276
|
+
* their committed content; undefined outside a Git checkout or before the
|
|
277
|
+
* first commit, where there is nothing to compare against.
|
|
278
|
+
*/
|
|
279
|
+
function committedDecisionChanges(workspaceRoot) {
|
|
280
|
+
try {
|
|
281
|
+
const listed = execFileSync("git", ["-C", workspaceRoot, "diff", "--name-only", "--relative", "-z", "HEAD"], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, stdio: "pipe" });
|
|
282
|
+
const changed = new Set(listed.split("\0").filter((name) => name !== ""));
|
|
283
|
+
const read = (relativePath) => {
|
|
284
|
+
try {
|
|
285
|
+
return execFileSync("git", ["-C", workspaceRoot, "show", `HEAD:./${relativePath}`], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, stdio: "pipe" });
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
return { changed, read };
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Current firm requirements and ADRs whose claim changed since HEAD without
|
|
299
|
+
* citing new human words: an in-place edit that bypassed kb_upsert's guard.
|
|
300
|
+
* A decision new since HEAD, or one that was not firm there, is not judged.
|
|
301
|
+
*/
|
|
302
|
+
// implements REQ-kb-firm-decision-edit
|
|
303
|
+
export function evaluateFirmDecisionEdits(entities, edges, changed, readCommitted) {
|
|
304
|
+
const superseded = supersededIds(edges);
|
|
305
|
+
const findings = [];
|
|
306
|
+
for (const entity of [...entities].sort((left, right) => left.id.localeCompare(right.id))) {
|
|
307
|
+
if (!changed.has(entity.path))
|
|
308
|
+
continue;
|
|
309
|
+
if (!isCurrentAuthoredEntity(entity, superseded))
|
|
310
|
+
continue;
|
|
311
|
+
const committed = readCommitted(entity.path);
|
|
312
|
+
if (committed === null)
|
|
313
|
+
continue;
|
|
314
|
+
const before = readAuthoredEntity(committed, entity.path);
|
|
315
|
+
if (before === null || before.type !== entity.type)
|
|
316
|
+
continue;
|
|
317
|
+
const fields = unapprovedFirmEdit(before, entity);
|
|
318
|
+
if (fields.length === 0)
|
|
319
|
+
continue;
|
|
320
|
+
findings.push({
|
|
321
|
+
rule: DECISION_FIRM_EDITED_RULE,
|
|
322
|
+
entityId: entity.id,
|
|
323
|
+
description: `${entity.id} is a firm decision whose ${fields.join(", ")} changed since HEAD without citing new human words`,
|
|
324
|
+
suggestion: `${firmEditGuidance(entity.type)}. To undo the edit, restore ${entity.path} from HEAD`,
|
|
325
|
+
source: entity.path,
|
|
326
|
+
evidence: { type: entity.type, changed: fields },
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
return findings;
|
|
330
|
+
}
|
|
268
331
|
/** Read the authored decisions once and evaluate the selected rules. */
|
|
269
|
-
// implements REQ-kb-decision-firmness
|
|
332
|
+
// implements REQ-kb-decision-firmness, REQ-kb-firm-decision-edit
|
|
270
333
|
export function collectDecisionFirmnessViolations(rules, workspaceRoot) {
|
|
271
334
|
if (!DECISION_FIRMNESS_RULES.some((rule) => rules.has(rule)))
|
|
272
335
|
return [];
|
|
273
336
|
const entities = listDecisionEntities(workspaceRoot);
|
|
274
337
|
const manifest = readKbManifest(workspaceRoot);
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
338
|
+
const edges = authoredSupersedes(workspaceRoot, entities);
|
|
339
|
+
const committed = rules.has(DECISION_FIRM_EDITED_RULE)
|
|
340
|
+
? committedDecisionChanges(workspaceRoot)
|
|
341
|
+
: undefined;
|
|
342
|
+
const edited = committed
|
|
343
|
+
? evaluateFirmDecisionEdits(entities, edges, committed.changed, committed.read)
|
|
344
|
+
: [];
|
|
345
|
+
return [
|
|
346
|
+
...edited,
|
|
347
|
+
...evaluateDecisionFirmness(entities, edges, rules, new Set(manifest?.supersedesReasonAcknowledged ?? []), {
|
|
348
|
+
schemaVersion: manifest?.schemaVersion ?? null,
|
|
349
|
+
firmSupersedeAcknowledged: new Set(manifest?.firmSupersedeAcknowledged ?? []),
|
|
350
|
+
}),
|
|
351
|
+
];
|
|
279
352
|
}
|
|
@@ -59,6 +59,17 @@ export declare function queryEntityChunks(readChunk: (input: PrologEntityQueryIn
|
|
|
59
59
|
export declare function queryEntitiesViaQuery(prolog: Pick<PrologPort, "query">, input: PrologEntityQueryInput, signal?: AbortSignal): Promise<PrologEntityQueryResult>;
|
|
60
60
|
/** Every entity id, without materializing entity properties. */
|
|
61
61
|
export declare function loadEntityIds(prolog: Pick<PrologPort, "query">): Promise<string[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Id, title and semantic text of every current requirement (open,
|
|
64
|
+
* in_progress, closed and the legacy active/approved statuses, not superseded),
|
|
65
|
+
* in id order. Projected rows only: semantic inventories and other large
|
|
66
|
+
* properties stay in the store.
|
|
67
|
+
*/
|
|
68
|
+
export declare function loadCurrentRequirementTexts(prolog: Pick<PrologPort, "query">): Promise<{
|
|
69
|
+
id: string;
|
|
70
|
+
title: string;
|
|
71
|
+
semanticText: string;
|
|
72
|
+
}[]>;
|
|
62
73
|
/**
|
|
63
74
|
* Properties a projected entity row keeps: what intent ranking, result
|
|
64
75
|
* summaries and the search answer layer read. Large structured properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-entities.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-entities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,EAGX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAA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AAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAyBhE;AAED;;;;;GAKG;AAEH,eAAO,MAAM,eAAe,yTAwBlB,CAAC;AAEX,6EAA6E;AAE7E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAG1C,wBAAgB,cAAc,CAC5B,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,IAAI,GAAE,SAAS,MAAM,EAAoB,GACxC,MAAM,CAIR;AAED;;;GAGG;AAEH,wBAAsB,cAAc,CAClC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,IAAI,GAAE,SAAS,MAAM,EAAoB,GACxC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAgBpC;AAED;;;;GAIG;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAE3D,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAcnB;AAGD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAC3C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAQ3B"}
|
|
@@ -273,6 +273,34 @@ export async function loadEntityIds(prolog) {
|
|
|
273
273
|
}
|
|
274
274
|
return parseAtomList(result.bindings.Ids ?? "[]").map(normalizeEntityId);
|
|
275
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Id, title and semantic text of every current requirement (open,
|
|
278
|
+
* in_progress, closed and the legacy active/approved statuses, not superseded),
|
|
279
|
+
* in id order. Projected rows only: semantic inventories and other large
|
|
280
|
+
* properties stay in the store.
|
|
281
|
+
*/
|
|
282
|
+
// implements REQ-bootstrap-claim-restatement
|
|
283
|
+
export async function loadCurrentRequirementTexts(prolog) {
|
|
284
|
+
const result = await prolog.query("findall(R, kb:current_req(R), Ids)");
|
|
285
|
+
if (!result.success) {
|
|
286
|
+
throw new Error(`Current requirement enumeration failed: ${result.error ?? "Unknown error"}`);
|
|
287
|
+
}
|
|
288
|
+
const ids = parseAtomList(result.bindings.Ids ?? "[]").map(normalizeEntityId);
|
|
289
|
+
const rows = await loadEntityRows(prolog, ids, [
|
|
290
|
+
"id",
|
|
291
|
+
"title",
|
|
292
|
+
"semantic_text",
|
|
293
|
+
]);
|
|
294
|
+
return rows
|
|
295
|
+
.filter((row) => row.type === "req")
|
|
296
|
+
.map((row) => ({
|
|
297
|
+
id: String(row.id ?? ""),
|
|
298
|
+
title: typeof row.title === "string" ? row.title : "",
|
|
299
|
+
semanticText: typeof row.semantic_text === "string" ? row.semantic_text : "",
|
|
300
|
+
}))
|
|
301
|
+
.filter((row) => row.id !== "")
|
|
302
|
+
.sort((left, right) => left.id < right.id ? -1 : left.id > right.id ? 1 : 0);
|
|
303
|
+
}
|
|
276
304
|
/**
|
|
277
305
|
* Properties a projected entity row keeps: what intent ranking, result
|
|
278
306
|
* summaries and the search answer layer read. Large structured properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,wBAAwB,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AC;QACzB,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;KACpC,CAAC;IACF,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,QAAQ,CACjD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,EAAE,CAAC;QACJ,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACzD,CAAC;CACH,CAAC;AAqaF,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAmFxC;AA4HD,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAoIzC;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAgWzC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { compilerFingerprintReason } from "../../commands/sync/cache.js";
|
|
3
|
+
import { compilerFingerprintReason, sourceExtractionFailureReasons, } from "../../commands/sync/cache.js";
|
|
4
4
|
import { effectiveFirmness } from "../../decision-firmness.js";
|
|
5
5
|
import { EngineClient } from "../../engine.js";
|
|
6
6
|
import { executeIntentSearch, questionPaths, validateIntentSearchInput, } from "../../intent-search.js";
|
|
@@ -788,6 +788,12 @@ export async function executeStatus(_input, context) {
|
|
|
788
788
|
// A stale-lock takeover heals itself; report it without making the KB stale.
|
|
789
789
|
const takeoverNotice = storeLockTakeoverReason(store.path);
|
|
790
790
|
const compilerReason = compilerFingerprintReason(store.path);
|
|
791
|
+
// implements REQ-kibi-uncompiled-source-visibility
|
|
792
|
+
// A source the last sync could not extract is missing from the store
|
|
793
|
+
// even when every compiled file is current.
|
|
794
|
+
const extractionReasons = store.state === "healthy"
|
|
795
|
+
? sourceExtractionFailureReasons(context.workspaceRoot, store.path)
|
|
796
|
+
: [];
|
|
791
797
|
const engineReason = engineStatus
|
|
792
798
|
? {
|
|
793
799
|
code: engineStatus.errorCode ?? "engine_status_unavailable",
|
|
@@ -811,6 +817,7 @@ export async function executeStatus(_input, context) {
|
|
|
811
817
|
...(storeReason ? [storeReason] : []),
|
|
812
818
|
...(lockReason ? [lockReason] : []),
|
|
813
819
|
...(compilerReason ? [compilerReason] : []),
|
|
820
|
+
...extractionReasons,
|
|
814
821
|
...(engineReason ? [engineReason] : []),
|
|
815
822
|
].sort((left, right) => String(left.path ?? "").localeCompare(String(right.path ?? "")));
|
|
816
823
|
const enrichedPayload = {
|
|
@@ -818,6 +825,11 @@ export async function executeStatus(_input, context) {
|
|
|
818
825
|
// Source hashes can all match while the compilation itself is lossy, so
|
|
819
826
|
// a compiler contract change alone makes the store stale.
|
|
820
827
|
...(compilerReason ? { syncState: "stale", dirty: true } : {}),
|
|
828
|
+
// An authored source sync cannot extract leaves its entities out of
|
|
829
|
+
// the store, so the KB is not current until the file is fixed.
|
|
830
|
+
...(extractionReasons.length > 0
|
|
831
|
+
? { syncState: "stale", dirty: true }
|
|
832
|
+
: {}),
|
|
821
833
|
// A missing or empty store has no stale file to report, yet nothing in
|
|
822
834
|
// it is current: the authored sources were never compiled. (A missing
|
|
823
835
|
// store without authored sources, and an unreadable or incomplete one,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { KibiResult, OperationEffect, OperationName } from "./types.js";
|
|
2
|
+
export { codedErrorOf } from "../../cli-errors.js";
|
|
3
|
+
export type { CodedErrorFields } from "../../cli-errors.js";
|
|
2
4
|
export declare const KIBI_PROTOCOL_VERSION: 1;
|
|
3
5
|
export declare function failedEffectStatus(effect: OperationEffect, failure: Record<string, unknown>): KibiResult["effects"][number];
|
|
4
6
|
export declare function resultVersion(spec: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-envelope.d.ts","sourceRoot":"","sources":["../../../src/public/operations/result-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7E,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAkEhD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAS/B;AAoFD,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC,GAAG,MAAM,CAET;AAYD,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE;IACJ,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC,EACD,IAAI,EAAE,CAAC,EACP,OAAO,GAAE,OAAO,CACd,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,aAAa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C,IAAI,CAKN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MIGRATION_PLAN_REFUSED } from "../../operations/planning/migration-refusal.js";
|
|
2
|
+
export { codedErrorOf } from "../../cli-errors.js";
|
|
2
3
|
export const KIBI_PROTOCOL_VERSION = 1;
|
|
3
4
|
function record(value) {
|
|
4
5
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-relationship-parity.d.ts","sourceRoot":"","sources":["../../../src/public/operations/source-relationship-parity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-relationship-parity.d.ts","sourceRoot":"","sources":["../../../src/public/operations/source-relationship-parity.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC,CAAC,CAAC;AAaH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,SAAS,wBAAwB,EAAE,EAC7C,QAAQ,EAAE,SAAS,wBAAwB,EAAE,GAC5C,SAAS,EAAE,CAwDb;AAuCD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,wBAAwB,EAAE,CAmB5B;AA6BD,wBAAsB,yCAAyC,CAC7D,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAwEtB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { sourceExtractionRemediation } from "../../commands/sync/cache.js";
|
|
3
4
|
import { discoverSourceFiles } from "../../commands/sync/discovery.js";
|
|
4
5
|
import { processExtractions } from "../../commands/sync/extraction.js";
|
|
5
6
|
import { findUntrackedDocumentMatches } from "../../commands/sync/untracked-targets.js";
|
|
@@ -156,14 +157,28 @@ export async function collectSourceRelationshipParityViolations(workspaceRoot, p
|
|
|
156
157
|
];
|
|
157
158
|
}
|
|
158
159
|
const extraction = await processExtractions(discovery.markdownFiles, discovery.manifestFiles, true, workspaceRoot);
|
|
160
|
+
// implements REQ-kibi-uncompiled-source-visibility
|
|
161
|
+
// A source sync cannot extract is missing from the compiled KB with every
|
|
162
|
+
// entity and relationship it declares: one blocking finding per file names
|
|
163
|
+
// it, the extraction error and the fix.
|
|
159
164
|
if (extraction.errors.length > 0) {
|
|
160
|
-
return extraction.errors.map(({ file, message }) =>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
return extraction.errors.map(({ file, message }) => {
|
|
166
|
+
const relative = path
|
|
167
|
+
.relative(workspaceRoot, file)
|
|
168
|
+
.replaceAll(path.sep, "/");
|
|
169
|
+
return {
|
|
170
|
+
rule: "source-relationship-parity",
|
|
171
|
+
entityId: relative,
|
|
172
|
+
source: relative,
|
|
173
|
+
description: `${relative} cannot be compiled, so the entities and relationships it declares are missing from the KB: ${message}`,
|
|
174
|
+
suggestion: `${sourceExtractionRemediation(relative, message)} Then rerun kb_check.`,
|
|
175
|
+
evidence: {
|
|
176
|
+
direction: "source_extraction",
|
|
177
|
+
file: relative,
|
|
178
|
+
error: message,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
});
|
|
167
182
|
}
|
|
168
183
|
const authored = extraction.results.flatMap(({ entity, relationships }) => relationships.map((relationship) => authoredRelationship(relationship, entity.source)));
|
|
169
184
|
for (const relationship of readAllShards(path.join(workspaceRoot, ".kb"))) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every selectable kb_check rule name, registry order. */
|
|
2
2
|
export declare const SELECTABLE_RULE_NAMES: readonly string[];
|
|
3
3
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
4
|
-
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
4
|
+
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, decision-firm-edited, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
5
5
|
//# sourceMappingURL=check-rules.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAsDlD,CAAC;AAGF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,srCACgpC,CAAC"}
|
|
@@ -57,6 +57,7 @@ export const SELECTABLE_RULE_NAMES = [
|
|
|
57
57
|
"entity-context-acknowledged",
|
|
58
58
|
"decision-firm-unreferenced",
|
|
59
59
|
"decision-firm-superseded",
|
|
60
|
+
"decision-firm-edited",
|
|
60
61
|
"supersedes-reason-missing",
|
|
61
62
|
"supersedes-reason-acknowledged",
|
|
62
63
|
"policy-ownership",
|
|
@@ -64,4 +65,4 @@ export const SELECTABLE_RULE_NAMES = [
|
|
|
64
65
|
];
|
|
65
66
|
// implements REQ-006
|
|
66
67
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
67
|
-
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
68
|
+
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, decision-firm-edited, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers";
|
|
@@ -12,7 +12,7 @@ export declare const checkSpec: {
|
|
|
12
12
|
readonly type: "string";
|
|
13
13
|
readonly enum: readonly string[];
|
|
14
14
|
};
|
|
15
|
-
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
15
|
+
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, symbol-granularity, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, decision-firm-edited, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
16
16
|
};
|
|
17
17
|
readonly sourceFiles: {
|
|
18
18
|
readonly type: "array";
|
|
@@ -31,7 +31,7 @@ export declare const checkSpec: {
|
|
|
31
31
|
};
|
|
32
32
|
readonly includeImpactDiagnostics: {
|
|
33
33
|
readonly type: "boolean";
|
|
34
|
-
readonly description: "When true, include changed-file impact diagnostics such as symbol_granularity_violation and
|
|
34
|
+
readonly description: "When true, include changed-file impact diagnostics such as symbol_granularity_violation, symbol_semantic_review_needed and source_file_unowned in structured output.";
|
|
35
35
|
};
|
|
36
36
|
readonly maxDiagnostics: {
|
|
37
37
|
readonly type: "integer";
|
|
@@ -30,7 +30,7 @@ export const checkSpec = {
|
|
|
30
30
|
},
|
|
31
31
|
includeImpactDiagnostics: {
|
|
32
32
|
type: "boolean",
|
|
33
|
-
description: "When true, include changed-file impact diagnostics such as symbol_granularity_violation and
|
|
33
|
+
description: "When true, include changed-file impact diagnostics such as symbol_granularity_violation, symbol_semantic_review_needed and source_file_unowned in structured output.",
|
|
34
34
|
},
|
|
35
35
|
maxDiagnostics: {
|
|
36
36
|
type: "integer",
|
|
@@ -121,7 +121,7 @@ export declare const ENTITY_PROPERTIES_SCHEMA: {
|
|
|
121
121
|
readonly firmness: {
|
|
122
122
|
readonly type: "string";
|
|
123
123
|
readonly enum: readonly ["firm", "default", "exploratory"];
|
|
124
|
-
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words);
|
|
124
|
+
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); its title, meaning or firmness changes only with new human words (a new origin.ref) or by supersede. default = delegated or agent choice; exploratory = flagged guess. Absent = default if an agent wrote it, else firm.";
|
|
125
125
|
};
|
|
126
126
|
readonly rationale: {
|
|
127
127
|
readonly type: "string";
|
|
@@ -105,7 +105,7 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
105
105
|
firmness: {
|
|
106
106
|
type: "string",
|
|
107
107
|
enum: ["firm", "default", "exploratory"],
|
|
108
|
-
description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words);
|
|
108
|
+
description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); its title, meaning or firmness changes only with new human words (a new origin.ref) or by supersede. default = delegated or agent choice; exploratory = flagged guess. Absent = default if an agent wrote it, else firm.",
|
|
109
109
|
},
|
|
110
110
|
rationale: {
|
|
111
111
|
type: "string",
|
|
@@ -138,7 +138,7 @@ export declare const upsertSpec: {
|
|
|
138
138
|
readonly firmness: {
|
|
139
139
|
readonly type: "string";
|
|
140
140
|
readonly enum: readonly ["firm", "default", "exploratory"];
|
|
141
|
-
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words);
|
|
141
|
+
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); its title, meaning or firmness changes only with new human words (a new origin.ref) or by supersede. default = delegated or agent choice; exploratory = flagged guess. Absent = default if an agent wrote it, else firm.";
|
|
142
142
|
};
|
|
143
143
|
readonly rationale: {
|
|
144
144
|
readonly type: "string";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: kibi-bootstrap
|
|
3
3
|
name: kibi-bootstrap
|
|
4
4
|
description: "Use for any Kibi bootstrap or onboarding task: seeding a new or thin knowledge base; reviewing a bootstrap or onboarding plan, preview, or evidence; judging approval readiness or coverage; diagnosing a blocked, partial, or failed bootstrap or its repair; applying an approved bootstrap plan; or asking the human which knowledge sources hold intent. Covers kb_status first, source interview, cited intent claims, read-only kb_plan_bootstrap preview, explicit approval, exact-plan kb_apply_plan, and repair-safe close-out."
|
|
5
|
-
version: 3.
|
|
5
|
+
version: 3.14.0
|
|
6
6
|
kibiCompatibility: ">=1.0.0"
|
|
7
7
|
tags:
|
|
8
8
|
- kibi
|
|
@@ -24,7 +24,7 @@ Make `kb_status` your first tool call on every bootstrap task. This includes rev
|
|
|
24
24
|
- **Review a supplied plan or preview, or judge approval readiness or coverage:** call `kb_status`, then run your own read-only `kb_plan_bootstrap` preview. Compare it with the supplied one: hash, candidates, citations, `suppressedCandidates`, `sourceOnlySignals`, and diagnostics. Report what is ready, what is missing or uncited, and any conflicts for the human. Do not apply. End with `kb_status`.
|
|
25
25
|
- **Blocked, partial, failed, or repair:** never conclude from `kb_status` alone. Run a read-only `kb_plan_bootstrap` preview and report its eligibility and next-action fields (for example `planEligible`, `nextAction`). If it names operator-only repair such as `doctor`, report it and stop. Read `resources/branch-lifecycle.md` before migration or repair. End with `kb_status`.
|
|
26
26
|
- **New or thin knowledge base, or apply an approved plan:** follow the procedure below.
|
|
27
|
-
- **Knowledge base already seeded** (`activationMode: attached_seeded_handoff`): follow the same procedure. Kibi generates no discovered candidates here, but it still plans the intent claims you declare, deduplicated against the existing KB:
|
|
27
|
+
- **Knowledge base already seeded** (`activationMode: attached_seeded_handoff`): follow the same procedure. Kibi generates no discovered candidates here, but it still plans the intent claims you declare, deduplicated against the existing KB: a claim whose entity exists, or whose statement or excerpt restates a current requirement (same words once case and punctuation are ignored), is counted as already in the KB with the matched id, and a plan of the rest is `ready` and applies with `kb_apply_plan` after approval. A diagnostic saying a claim "closely restates" a requirement means that claim is still planned: show both to the human before approval, and drop the claim or link the two with `restates` or `supersedes`. Never fall back to one `kb_compile_intent` plus one write per claim while such a plan exists. Use `kb_compile_intent` only for claims the plan could not write (`sourceOnlySignals`, `suppressed_by_activation`, `invalid_write`), and `kb_search`/`kb_query` for existing knowledge.
|
|
28
28
|
|
|
29
29
|
## Goal
|
|
30
30
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: kibi-usage
|
|
3
3
|
name: Kibi Usage
|
|
4
4
|
description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.19.0
|
|
6
6
|
kibiCompatibility: ">=1.0.0"
|
|
7
7
|
tags:
|
|
8
8
|
- kibi
|
|
@@ -112,9 +112,11 @@ it is a pointer to the knowledge, never proof. Each line answers one question:
|
|
|
112
112
|
A file already shown this session gets only the one-line `Kibi: this edit to
|
|
113
113
|
<path> is inside <symbol>` update; the facts and tests from its first snippet
|
|
114
114
|
still apply. `Kibi: no symbol in <path> is linked to a requirement yet` means
|
|
115
|
-
the file is unowned
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
the file is unowned, not that no rule covers it. When the note names
|
|
116
|
+
requirements whose titles share the path's words, `kb_query` each one and
|
|
117
|
+
treat a match as the governing rule; otherwise find it with `kb_search` and
|
|
118
|
+
`sourceLocations`. Link the symbol that implements it (for markup, the
|
|
119
|
+
component that renders it) with `implements` through `kb_upsert`. Without a readable manifest (`Kibi: the hook could not read
|
|
118
120
|
.kb/symbols.yaml`) snippets are off for this session; `kb_query({sourceFile})`
|
|
119
121
|
still answers and `kibi sync` regenerates the manifest. The search tip and the
|
|
120
122
|
`.kb/` note appear once per session and need no action.
|
|
@@ -136,7 +138,11 @@ still answers and `kibi sync` regenerates the manifest. The search tip and the
|
|
|
136
138
|
2. Resolve genuine ambiguity with the human; use `kb_model` for deterministic
|
|
137
139
|
interpretation and typed facts.
|
|
138
140
|
3. Create endpoints before relationships and upsert small batches sequentially.
|
|
139
|
-
Keep the canonical `REQ-* -> SCEN-* -> TEST-*` chain.
|
|
141
|
+
Keep the canonical `REQ-* -> SCEN-* -> TEST-*` chain. Recording the
|
|
142
|
+
behavior a change adds (a requirement with a scenario, and an `implements`
|
|
143
|
+
link from the symbol) is part of finishing that change, not a separate
|
|
144
|
+
request: do it without asking. Ask only when the change conflicts with a
|
|
145
|
+
recorded rule.
|
|
140
146
|
4. Author tracked Markdown/YAML/manifests and relationship shards through Kibi;
|
|
141
147
|
Kibi never Git-stages or commits those files. Do not read or edit `.kb`
|
|
142
148
|
directly.
|
|
@@ -368,7 +374,11 @@ Search answers, `kb_query` rows and hook snippets show it (snippets label only
|
|
|
368
374
|
wrote it (`origin.kind: agent`): rules people wrote, imported or carried
|
|
369
375
|
over from before origins existed are theirs. `kb_check` blocks an explicit
|
|
370
376
|
`firmness: firm` without `origin.ref` to their words, and a replacement of
|
|
371
|
-
a firm decision that is not itself firm.
|
|
377
|
+
a firm decision that is not itself firm. Never edit a firm decision's
|
|
378
|
+
title, statement or (ADR) body in place, by `kb_upsert` or on disk:
|
|
379
|
+
`kb_upsert` refuses it and `kb_check` reports `decision-firm-edited`
|
|
380
|
+
unless the edit cites new human words in `origin.ref`. Context sections,
|
|
381
|
+
tags, status and links stay editable.
|
|
372
382
|
- `default`: a delegated or agent choice (`firmness: default`, or an
|
|
373
383
|
agent-written decision without `firmness`). Follow it; supersede it only on
|
|
374
384
|
evidence that it is wrong (a failing test, a measured cost, a constraint it
|
|
@@ -381,7 +391,8 @@ conflict a person has to decide. Name the rule (id and what it requires) and
|
|
|
381
391
|
ask whether to change it; do not implement the request and do not supersede
|
|
382
392
|
the rule. Go ahead only when the person has said to change that rule, in this
|
|
383
393
|
task or in reply: then supersede it with `firmness: firm` and `origin.ref` to
|
|
384
|
-
their words,
|
|
394
|
+
their words (or, for a correction they asked for in place, update it with
|
|
395
|
+
`origin.ref` to those words), and say in the final answer which rule changed.
|
|
385
396
|
|
|
386
397
|
Set `firmness` from what a human actually said: only their stated rule is
|
|
387
398
|
`firm` (with `origin.ref`); "do whatever" or your own pick is `default`; a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-change-snapshot.d.ts","sourceRoot":"","sources":["../../src/traceability/git-change-snapshot.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAKzB,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,CAAC;AAGpE,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF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EACZ,IAAI,EAAE,MAAM,GACX,iBAAiB,CAyBnB"}
|
|
@@ -509,6 +509,45 @@ function isKnowledgeRelocation(from, to) {
|
|
|
509
509
|
return (ENTITY_LANES.includes(lane) &&
|
|
510
510
|
`/${from}`.includes(`/${lane}/`));
|
|
511
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Relocations into `.kb/` that Git's similarity detection missed: a deleted
|
|
514
|
+
* knowledge file and an added canonical file with the same file name, paired
|
|
515
|
+
* only when the pairing is unambiguous. A small file that a migration both
|
|
516
|
+
* moves and rewrites (a symbols manifest that gains a header and
|
|
517
|
+
* legacy-link marks, a requirement that gains origin and tags) can fall
|
|
518
|
+
* under Git's similarity threshold although it is the same file.
|
|
519
|
+
*/
|
|
520
|
+
// implements REQ-cli-migration-first-commit
|
|
521
|
+
function unpairedKnowledgeRelocations(root, baseTree, headTree, detected) {
|
|
522
|
+
const rows = parseNameStatus(runGit(root, [
|
|
523
|
+
"diff",
|
|
524
|
+
"--name-status",
|
|
525
|
+
"-z",
|
|
526
|
+
"--no-renames",
|
|
527
|
+
"--diff-filter=AD",
|
|
528
|
+
baseTree,
|
|
529
|
+
headTree,
|
|
530
|
+
]));
|
|
531
|
+
const paired = new Set(detected.flatMap((rename) => [rename.from, rename.to]));
|
|
532
|
+
const deleted = rows
|
|
533
|
+
.filter((row) => row.status === "D" && !paired.has(row.path))
|
|
534
|
+
.map((row) => row.path);
|
|
535
|
+
const added = rows
|
|
536
|
+
.filter((row) => row.status === "A" && !paired.has(row.path))
|
|
537
|
+
.map((row) => row.path);
|
|
538
|
+
const candidates = (to) => deleted.filter((from) => path.posix.basename(from) === path.posix.basename(to) &&
|
|
539
|
+
isKnowledgeRelocation(from, to));
|
|
540
|
+
const relocations = [];
|
|
541
|
+
for (const to of added) {
|
|
542
|
+
const [from, ...others] = candidates(to);
|
|
543
|
+
if (from === undefined || others.length > 0)
|
|
544
|
+
continue;
|
|
545
|
+
if (added.filter((other) => candidates(other).includes(from)).length !== 1)
|
|
546
|
+
continue;
|
|
547
|
+
relocations.push({ from, to });
|
|
548
|
+
}
|
|
549
|
+
return relocations;
|
|
550
|
+
}
|
|
512
551
|
/**
|
|
513
552
|
* For a staged snapshot, the tree a commit that relocates knowledge files
|
|
514
553
|
* into `.kb/` is judged against: `baseTree` with each relocated file's
|
|
@@ -524,9 +563,11 @@ export function renameResolutionBase(root, baseTree, headTree) {
|
|
|
524
563
|
const zero = "0".repeat(baseTree.length);
|
|
525
564
|
const renames = [];
|
|
526
565
|
const entries = [];
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
566
|
+
const detected = renamedPaths(root, baseTree, headTree).filter((rename) => isKnowledgeRelocation(rename.from, rename.to));
|
|
567
|
+
for (const rename of [
|
|
568
|
+
...detected,
|
|
569
|
+
...unpairedKnowledgeRelocations(root, baseTree, headTree, detected),
|
|
570
|
+
]) {
|
|
530
571
|
const source = readTreeEntry(root, baseTree, rename.from);
|
|
531
572
|
if (source?.type !== "blob")
|
|
532
573
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { QualityDiagnostic } from "../public/impact/types.js";
|
|
2
2
|
import { type KibiImpactEvidence } from "./evidence-model.js";
|
|
3
|
-
export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "symbol_semantic_review_needed" | "multi_requirement_symbol_review" | "duplicate_symbol_coordinate_review" | "component_mixed_purpose_review" | "broad_requirement_review" | "requirement_status_review" | "strict_fact_modeling_review" | "logical_coverage_review" | "kibi_impact_override_missing_rationale" | "entity_id_style_review";
|
|
3
|
+
export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "symbol_semantic_review_needed" | "source_file_unowned" | "multi_requirement_symbol_review" | "duplicate_symbol_coordinate_review" | "component_mixed_purpose_review" | "broad_requirement_review" | "requirement_status_review" | "strict_fact_modeling_review" | "logical_coverage_review" | "kibi_impact_override_missing_rationale" | "entity_id_style_review";
|
|
4
4
|
export interface KibiImpactDiagnostic extends QualityDiagnostic {
|
|
5
5
|
/** Stable staged-enforcement diagnostic identifier. */
|
|
6
6
|
id: KibiImpactDiagnosticId;
|