kibi-cli 2.25.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/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/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 +32 -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 +1 -1
- 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.d.ts +1 -1
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/dist/public/skills/kibi-usage/SKILL.md +11 -5
- 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/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/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.ts +1 -1
- package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/src/public/skills/kibi-usage/SKILL.md +11 -5
|
@@ -413,6 +413,42 @@ export async function loadEntityIds(
|
|
|
413
413
|
return parseAtomList(result.bindings.Ids ?? "[]").map(normalizeEntityId);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Id, title and semantic text of every current requirement (open,
|
|
418
|
+
* in_progress, closed and the legacy active/approved statuses, not superseded),
|
|
419
|
+
* in id order. Projected rows only: semantic inventories and other large
|
|
420
|
+
* properties stay in the store.
|
|
421
|
+
*/
|
|
422
|
+
// implements REQ-bootstrap-claim-restatement
|
|
423
|
+
export async function loadCurrentRequirementTexts(
|
|
424
|
+
prolog: Pick<PrologPort, "query">,
|
|
425
|
+
): Promise<{ id: string; title: string; semanticText: string }[]> {
|
|
426
|
+
const result = await prolog.query("findall(R, kb:current_req(R), Ids)");
|
|
427
|
+
if (!result.success) {
|
|
428
|
+
throw new Error(
|
|
429
|
+
`Current requirement enumeration failed: ${result.error ?? "Unknown error"}`,
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
const ids = parseAtomList(result.bindings.Ids ?? "[]").map(normalizeEntityId);
|
|
433
|
+
const rows = await loadEntityRows(prolog, ids, [
|
|
434
|
+
"id",
|
|
435
|
+
"title",
|
|
436
|
+
"semantic_text",
|
|
437
|
+
]);
|
|
438
|
+
return rows
|
|
439
|
+
.filter((row) => row.type === "req")
|
|
440
|
+
.map((row) => ({
|
|
441
|
+
id: String(row.id ?? ""),
|
|
442
|
+
title: typeof row.title === "string" ? row.title : "",
|
|
443
|
+
semanticText:
|
|
444
|
+
typeof row.semantic_text === "string" ? row.semantic_text : "",
|
|
445
|
+
}))
|
|
446
|
+
.filter((row) => row.id !== "")
|
|
447
|
+
.sort((left, right) =>
|
|
448
|
+
left.id < right.id ? -1 : left.id > right.id ? 1 : 0,
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
416
452
|
/**
|
|
417
453
|
* Properties a projected entity row keeps: what intent ranking, result
|
|
418
454
|
* summaries and the search answer layer read. Large structured properties
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
compilerFingerprintReason,
|
|
5
|
+
sourceExtractionFailureReasons,
|
|
6
|
+
} from "../../commands/sync/cache.js";
|
|
4
7
|
import { effectiveFirmness } from "../../decision-firmness.js";
|
|
5
8
|
import { EngineClient } from "../../engine.js";
|
|
6
9
|
import {
|
|
@@ -1175,6 +1178,13 @@ export async function executeStatus(
|
|
|
1175
1178
|
// A stale-lock takeover heals itself; report it without making the KB stale.
|
|
1176
1179
|
const takeoverNotice = storeLockTakeoverReason(store.path);
|
|
1177
1180
|
const compilerReason = compilerFingerprintReason(store.path);
|
|
1181
|
+
// implements REQ-kibi-uncompiled-source-visibility
|
|
1182
|
+
// A source the last sync could not extract is missing from the store
|
|
1183
|
+
// even when every compiled file is current.
|
|
1184
|
+
const extractionReasons =
|
|
1185
|
+
store.state === "healthy"
|
|
1186
|
+
? sourceExtractionFailureReasons(context.workspaceRoot, store.path)
|
|
1187
|
+
: [];
|
|
1178
1188
|
const engineReason = engineStatus
|
|
1179
1189
|
? {
|
|
1180
1190
|
code: engineStatus.errorCode ?? "engine_status_unavailable",
|
|
@@ -1199,6 +1209,7 @@ export async function executeStatus(
|
|
|
1199
1209
|
...(storeReason ? [storeReason] : []),
|
|
1200
1210
|
...(lockReason ? [lockReason] : []),
|
|
1201
1211
|
...(compilerReason ? [compilerReason] : []),
|
|
1212
|
+
...extractionReasons,
|
|
1202
1213
|
...(engineReason ? [engineReason] : []),
|
|
1203
1214
|
].sort((left, right) =>
|
|
1204
1215
|
String(left.path ?? "").localeCompare(String(right.path ?? "")),
|
|
@@ -1208,6 +1219,11 @@ export async function executeStatus(
|
|
|
1208
1219
|
// Source hashes can all match while the compilation itself is lossy, so
|
|
1209
1220
|
// a compiler contract change alone makes the store stale.
|
|
1210
1221
|
...(compilerReason ? { syncState: "stale", dirty: true } : {}),
|
|
1222
|
+
// An authored source sync cannot extract leaves its entities out of
|
|
1223
|
+
// the store, so the KB is not current until the file is fixed.
|
|
1224
|
+
...(extractionReasons.length > 0
|
|
1225
|
+
? { syncState: "stale", dirty: true }
|
|
1226
|
+
: {}),
|
|
1211
1227
|
// A missing or empty store has no stale file to report, yet nothing in
|
|
1212
1228
|
// it is current: the authored sources were never compiled. (A missing
|
|
1213
1229
|
// store without authored sources, and an unreadable or incomplete one,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { MIGRATION_PLAN_REFUSED } from "../../operations/planning/migration-refusal.js";
|
|
2
2
|
import type { KibiResult, OperationEffect, OperationName } from "./types.js";
|
|
3
3
|
|
|
4
|
+
export { codedErrorOf } from "../../cli-errors.js";
|
|
5
|
+
export type { CodedErrorFields } from "../../cli-errors.js";
|
|
6
|
+
|
|
4
7
|
export const KIBI_PROTOCOL_VERSION = 1 as const;
|
|
5
8
|
|
|
6
9
|
function record(value: unknown): value is Record<string, unknown> {
|
|
@@ -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";
|
|
@@ -210,14 +211,28 @@ export async function collectSourceRelationshipParityViolations(
|
|
|
210
211
|
true,
|
|
211
212
|
workspaceRoot,
|
|
212
213
|
);
|
|
214
|
+
// implements REQ-kibi-uncompiled-source-visibility
|
|
215
|
+
// A source sync cannot extract is missing from the compiled KB with every
|
|
216
|
+
// entity and relationship it declares: one blocking finding per file names
|
|
217
|
+
// it, the extraction error and the fix.
|
|
213
218
|
if (extraction.errors.length > 0) {
|
|
214
|
-
return extraction.errors.map(({ file, message }) =>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
return extraction.errors.map(({ file, message }) => {
|
|
220
|
+
const relative = path
|
|
221
|
+
.relative(workspaceRoot, file)
|
|
222
|
+
.replaceAll(path.sep, "/");
|
|
223
|
+
return {
|
|
224
|
+
rule: "source-relationship-parity",
|
|
225
|
+
entityId: relative,
|
|
226
|
+
source: relative,
|
|
227
|
+
description: `${relative} cannot be compiled, so the entities and relationships it declares are missing from the KB: ${message}`,
|
|
228
|
+
suggestion: `${sourceExtractionRemediation(relative, message)} Then rerun kb_check.`,
|
|
229
|
+
evidence: {
|
|
230
|
+
direction: "source_extraction",
|
|
231
|
+
file: relative,
|
|
232
|
+
error: message,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
});
|
|
221
236
|
}
|
|
222
237
|
|
|
223
238
|
const authored: RelationshipParityRecord[] = extraction.results.flatMap(
|
|
@@ -40,7 +40,7 @@ export const checkSpec = {
|
|
|
40
40
|
includeImpactDiagnostics: {
|
|
41
41
|
type: "boolean",
|
|
42
42
|
description:
|
|
43
|
-
"When true, include changed-file impact diagnostics such as symbol_granularity_violation and
|
|
43
|
+
"When true, include changed-file impact diagnostics such as symbol_granularity_violation, symbol_semantic_review_needed and source_file_unowned in structured output.",
|
|
44
44
|
},
|
|
45
45
|
maxDiagnostics: {
|
|
46
46
|
type: "integer",
|
|
@@ -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.
|