kibi-cli 2.0.0 → 2.1.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-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +25 -1
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/commands/check-generated.d.ts +7 -0
- package/dist/commands/check-generated.d.ts.map +1 -0
- package/dist/commands/check-generated.js +192 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +3 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +122 -1
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +3 -1
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +13 -7
- package/dist/commands/proof-explain.d.ts +10 -0
- package/dist/commands/proof-explain.d.ts.map +1 -0
- package/dist/commands/proof-explain.js +45 -0
- package/dist/commands/proof-impact.d.ts +7 -0
- package/dist/commands/proof-impact.d.ts.map +1 -0
- package/dist/commands/proof-impact.js +39 -0
- package/dist/commands/proof-migrate-legacy.js +1 -1
- package/dist/commands/proof-prune.js +1 -1
- package/dist/commands/prove.js +4 -4
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +17 -2
- package/dist/commands/sync/manifest.d.ts +1 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +18 -16
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +6 -0
- package/dist/engine.d.ts +3 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +134 -61
- package/dist/env/bootstrap.d.ts +84 -0
- package/dist/env/bootstrap.d.ts.map +1 -0
- package/dist/env/bootstrap.js +310 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +1 -1
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +19 -0
- package/dist/extractors/symbols-coordinator.d.ts +8 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +40 -0
- package/dist/extractors/symbols-ts.d.ts +8 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +33 -503
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +4 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +4 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +30 -3
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +9 -87
- package/dist/operations/planning/compile-intent.d.ts +49 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +63 -3
- package/dist/operations/proof/baseline-diff.d.ts +41 -0
- package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
- package/dist/operations/proof/baseline-diff.js +153 -0
- package/dist/operations/proof/explain.d.ts +75 -0
- package/dist/operations/proof/explain.d.ts.map +1 -0
- package/dist/operations/proof/explain.js +294 -0
- package/dist/operations/proof/impact.d.ts +45 -0
- package/dist/operations/proof/impact.d.ts.map +1 -0
- package/dist/operations/proof/impact.js +118 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -3
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +21 -17
- package/dist/operations/proof/prune-receipts.js +1 -1
- package/dist/operations/proof/receipt-document.js +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
- package/dist/operations/semantic-advisor/types.d.ts +1 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/compose-ontology-packs.d.ts +51 -0
- package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
- package/dist/plugins/compose-ontology-packs.js +257 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +42 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +211 -0
- package/dist/plugins/external-allowlist.d.ts +10 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +16 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +33 -0
- package/dist/plugins/load-plugin.d.ts +19 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +59 -0
- package/dist/plugins/project-config.d.ts +28 -0
- package/dist/plugins/project-config.d.ts.map +1 -0
- package/dist/plugins/project-config.js +90 -0
- package/dist/plugins/registry.d.ts +93 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +338 -0
- package/dist/plugins/resolve-package.d.ts +47 -0
- package/dist/plugins/resolve-package.d.ts.map +1 -0
- package/dist/plugins/resolve-package.js +262 -0
- package/dist/plugins/source-analysis-service.d.ts +44 -0
- package/dist/plugins/source-analysis-service.d.ts.map +1 -0
- package/dist/plugins/source-analysis-service.js +232 -0
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +1 -1
- package/dist/prolog/store-lock.d.ts +1 -1
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/proof/inspect.js +1 -1
- package/dist/proof/producers/playwright-case-id.js +2 -2
- package/dist/proof/producers/playwright-reporter.js +4 -4
- package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -1
- package/dist/public/impact/analyzer.d.ts +1 -1
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +6 -4
- package/dist/public/operations/catalog.d.ts +4 -1
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +1 -1
- package/dist/public/operations/check-helpers.d.ts +1 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +1 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +35 -12
- package/dist/public/operations/discovery-entities.d.ts +12 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +34 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +23 -18
- package/dist/public/operations/prolog-json.d.ts +1 -1
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +7 -7
- package/dist/public/operations/runtime-types.d.ts +16 -1
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- 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 +1 -1
- package/dist/public/operations/specs/discovery.d.ts +3 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +3 -0
- package/dist/public/operations/specs/proof.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts +1 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +2 -2
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +54 -4
- 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 +5 -0
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +4 -4
- package/dist/public/skills/kibi-usage/SKILL.md +4 -1
- package/dist/public/skills/kibi-usage/resources/proof.md +45 -0
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.js +38 -5
- package/dist/report/html-report.css +1239 -281
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +18 -0
- package/dist/traceability/symbol-extract.d.ts +24 -7
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +64 -208
- 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 +14 -11
- package/src/public/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/operations/check-executor.ts +1 -1
- package/src/public/operations/check-helpers.ts +2 -2
- package/src/public/operations/contracts.ts +40 -12
- package/src/public/operations/discovery-entities.ts +46 -0
- package/src/public/operations/discovery-executors.ts +39 -26
- package/src/public/operations/prolog-json.ts +13 -5
- package/src/public/operations/runtime-types.ts +21 -2
- package/src/public/operations/specs/check-rules.generated.ts +2 -1
- package/src/public/operations/specs/discovery.ts +3 -0
- package/src/public/operations/specs/proof.ts +1 -1
- package/src/public/operations/specs/reporting.ts +2 -2
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/symbol-repair-plan.ts +3 -4
- package/src/public/operations/types.ts +5 -0
- package/src/public/proof-fingerprint.ts +1 -1
- package/src/public/proof-protocol-types.d.ts +1 -1
- package/src/public/proof-protocol.ts +4 -4
- package/src/public/skills/kibi-usage/SKILL.md +4 -1
- package/src/public/skills/kibi-usage/resources/proof.md +45 -0
- package/src/public/symbol-granularity.generated.ts +45 -12
- package/src/public/symbol-granularity.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-proof.d.ts","sourceRoot":"","sources":["../src/cli-register-proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"cli-register-proof.d.ts","sourceRoot":"","sources":["../src/cli-register-proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6J3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withExitCode } from "./cli-command.js";
|
|
2
|
-
// implements REQ-kibi-
|
|
2
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
3
3
|
export function registerProofCommand(program) {
|
|
4
4
|
program
|
|
5
5
|
.command("prove")
|
|
@@ -50,6 +50,30 @@ export function registerProofCommand(program) {
|
|
|
50
50
|
process.stdout.write(renderInspection(result));
|
|
51
51
|
return undefined;
|
|
52
52
|
}));
|
|
53
|
+
proof
|
|
54
|
+
.command("explain")
|
|
55
|
+
.description("Project one requirement or symbol proof, labeling required_proofs, executable_for, and covered_by separately")
|
|
56
|
+
.argument("[id]", "Requirement (REQ-*) or symbol (SYM-*) ID")
|
|
57
|
+
.option("--requirement <id>", "Explain a requirement ID")
|
|
58
|
+
.option("--symbol <id>", "Explain a symbol ID")
|
|
59
|
+
.option("--json", "Emit structured JSON", false)
|
|
60
|
+
.action(withExitCode(async (id, options) => {
|
|
61
|
+
return await (await import("./commands/proof-explain.js")).proofExplainCommand({
|
|
62
|
+
...(id === undefined ? {} : { id }),
|
|
63
|
+
...(options.requirement === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: { requirement: options.requirement }),
|
|
66
|
+
...(options.symbol === undefined ? {} : { symbol: options.symbol }),
|
|
67
|
+
json: options.json === true,
|
|
68
|
+
});
|
|
69
|
+
}));
|
|
70
|
+
proof
|
|
71
|
+
.command("impact")
|
|
72
|
+
.description("Compare current proof state to HEAD:proof/baseline.json")
|
|
73
|
+
.option("--json", "Emit structured JSON", false)
|
|
74
|
+
.action(withExitCode(async (options) => {
|
|
75
|
+
return await (await import("./commands/proof-impact.js")).proofImpactCommand({ json: options.json === true });
|
|
76
|
+
}));
|
|
53
77
|
proof
|
|
54
78
|
.command("prune")
|
|
55
79
|
.description("Shrink each test's proof_receipts history to its newest entries (re-proving the same snapshot appends duplicates; prune removes the superseded ones)")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2LhE"}
|
|
@@ -6,6 +6,12 @@ async function runJsonInvocation(invocation) {
|
|
|
6
6
|
}
|
|
7
7
|
// implements REQ-kibi-operation-interface-parity
|
|
8
8
|
export function registerReportingCommands(program) {
|
|
9
|
+
program
|
|
10
|
+
.command("check-generated")
|
|
11
|
+
.description("Compare generated symbol manifests with the staged Git snapshot")
|
|
12
|
+
.requiredOption("--staged", "Use the exact Git index bytes")
|
|
13
|
+
.option("--changed-only", "Skip regeneration when staged paths cannot affect symbols")
|
|
14
|
+
.action(withExitCode(async (options) => (await import("./commands/check-generated.js")).checkGeneratedManifests(options)));
|
|
9
15
|
program
|
|
10
16
|
.command("find-gaps [type]")
|
|
11
17
|
.alias("gaps")
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMtD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUrD;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAIT;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7D;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAGD,wBAAsB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMtD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUrD;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAIT;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7D;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAGD,wBAAsB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAe3C;AAED,wBAAsB,kBAAkB,CACtC,YAAY,UAAoD,EAChE,KAAK,cAAO,GACX,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
package/dist/cli.js
CHANGED
|
@@ -26,6 +26,7 @@ import { registerMaintenanceCommands } from "./cli-register-maintenance.js";
|
|
|
26
26
|
import { registerProofCommand } from "./cli-register-proof.js";
|
|
27
27
|
import { registerReportingCommands } from "./cli-register-reporting.js";
|
|
28
28
|
import { registerSkillsCommands } from "./cli-register-skills.js";
|
|
29
|
+
import { bootstrapKibiEnvironment } from "./env/bootstrap.js";
|
|
29
30
|
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
30
31
|
export function packageVersion(value) {
|
|
31
32
|
if (value !== null &&
|
|
@@ -61,6 +62,7 @@ export function buildProgram() {
|
|
|
61
62
|
}
|
|
62
63
|
// implements REQ-kibi-operation-interface-parity
|
|
63
64
|
export async function main() {
|
|
65
|
+
bootstrapKibiEnvironment();
|
|
64
66
|
let exitCode = process.exitCode ?? 0;
|
|
65
67
|
try {
|
|
66
68
|
await buildProgram().parseAsync(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-generated.d.ts","sourceRoot":"","sources":["../../src/commands/check-generated.ts"],"names":[],"mappings":"AA2HA,2EAA2E;AAE3E,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,OAAO,CAAC;CAClB,GACL,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAwH/B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { load as parseYAML } from "js-yaml";
|
|
6
|
+
import { refreshManifestCoordinates } from "./sync/manifest.js";
|
|
7
|
+
const MANIFESTS = [".kb/symbols.yaml", ".kb/symbol-coordinates.yaml"];
|
|
8
|
+
const MAX_GIT_OUTPUT = 256 * 1024 * 1024;
|
|
9
|
+
function git(args, input) {
|
|
10
|
+
const result = spawnSync("git", args, {
|
|
11
|
+
input,
|
|
12
|
+
maxBuffer: MAX_GIT_OUTPUT,
|
|
13
|
+
encoding: "buffer",
|
|
14
|
+
});
|
|
15
|
+
if (result.error || result.status !== 0) {
|
|
16
|
+
throw new Error(`git ${args.join(" ")} failed: ${result.error?.message ?? result.stderr.toString("utf8").trim()}`);
|
|
17
|
+
}
|
|
18
|
+
return result.stdout;
|
|
19
|
+
}
|
|
20
|
+
function indexTree() {
|
|
21
|
+
return git(["write-tree"]).toString("utf8").trim();
|
|
22
|
+
}
|
|
23
|
+
function treeBlobs(tree) {
|
|
24
|
+
const entries = git(["ls-tree", "-r", "-z", "--full-tree", tree]);
|
|
25
|
+
const blobs = new Map();
|
|
26
|
+
const nonRegularPaths = new Set();
|
|
27
|
+
for (const record of entries.toString("utf8").split("\0")) {
|
|
28
|
+
if (!record)
|
|
29
|
+
continue;
|
|
30
|
+
const match = /^(\d{6}) (\w+) ([a-f0-9]+)\t(.+)$/.exec(record);
|
|
31
|
+
if (!match)
|
|
32
|
+
throw new Error("Could not parse staged Git tree");
|
|
33
|
+
const [, mode, type, oid, file] = match;
|
|
34
|
+
if (file === undefined || oid === undefined)
|
|
35
|
+
throw new Error("Could not parse staged Git tree");
|
|
36
|
+
if (mode === "100644" || mode === "100755") {
|
|
37
|
+
if (type !== "blob")
|
|
38
|
+
throw new Error(`Unexpected Git object for ${file}`);
|
|
39
|
+
blobs.set(file, oid);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
nonRegularPaths.add(file);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return { blobs, nonRegularPaths };
|
|
46
|
+
}
|
|
47
|
+
function readBlobs(oids) {
|
|
48
|
+
if (oids.length === 0)
|
|
49
|
+
return new Map();
|
|
50
|
+
const response = git(["cat-file", "--batch"], Buffer.from(`${oids.join("\n")}\n`));
|
|
51
|
+
const contents = new Map();
|
|
52
|
+
let offset = 0;
|
|
53
|
+
for (const oid of oids) {
|
|
54
|
+
const end = response.indexOf(10, offset);
|
|
55
|
+
if (end < 0)
|
|
56
|
+
throw new Error("Incomplete Git blob response");
|
|
57
|
+
const header = response.subarray(offset, end).toString("utf8");
|
|
58
|
+
const match = /^([a-f0-9]+) blob (\d+)$/.exec(header);
|
|
59
|
+
if (!match || match[1] !== oid)
|
|
60
|
+
throw new Error(`Invalid Git blob response for ${oid}`);
|
|
61
|
+
const size = Number(match[2]);
|
|
62
|
+
const start = end + 1;
|
|
63
|
+
const finish = start + size;
|
|
64
|
+
if (!Number.isSafeInteger(size) ||
|
|
65
|
+
finish >= response.length ||
|
|
66
|
+
response[finish] !== 10) {
|
|
67
|
+
throw new Error(`Incomplete Git blob ${oid}`);
|
|
68
|
+
}
|
|
69
|
+
contents.set(oid, response.subarray(start, finish));
|
|
70
|
+
offset = finish + 1;
|
|
71
|
+
}
|
|
72
|
+
return contents;
|
|
73
|
+
}
|
|
74
|
+
function sourcePaths(symbols) {
|
|
75
|
+
const parsed = parseYAML(symbols.toString("utf8"));
|
|
76
|
+
if (!parsed ||
|
|
77
|
+
typeof parsed !== "object" ||
|
|
78
|
+
!("symbols" in parsed) ||
|
|
79
|
+
!Array.isArray(parsed.symbols)) {
|
|
80
|
+
throw new Error("Staged .kb/symbols.yaml has no symbols array");
|
|
81
|
+
}
|
|
82
|
+
const sources = new Set();
|
|
83
|
+
for (const symbol of parsed.symbols) {
|
|
84
|
+
const source = symbol?.sourceFile;
|
|
85
|
+
if (typeof source !== "string")
|
|
86
|
+
continue;
|
|
87
|
+
const normalized = path.posix.normalize(source.replaceAll("\\", "/"));
|
|
88
|
+
if (normalized === "." ||
|
|
89
|
+
path.posix.isAbsolute(normalized) ||
|
|
90
|
+
/^[A-Za-z]:/.test(normalized) ||
|
|
91
|
+
normalized.split("/").includes("..")) {
|
|
92
|
+
throw new Error(`Symbol source must be a repository-relative path: ${source}`);
|
|
93
|
+
}
|
|
94
|
+
sources.add(normalized);
|
|
95
|
+
}
|
|
96
|
+
return { paths: [...sources], symbolCount: parsed.symbols.length };
|
|
97
|
+
}
|
|
98
|
+
/** Compare generated artifacts for exactly one captured Git index tree. */
|
|
99
|
+
// implements REQ-cli-check
|
|
100
|
+
export async function checkGeneratedManifests(options = {}) {
|
|
101
|
+
let snapshotDir;
|
|
102
|
+
try {
|
|
103
|
+
const tree = indexTree();
|
|
104
|
+
const { blobs, nonRegularPaths } = treeBlobs(tree);
|
|
105
|
+
const symbolsOid = blobs.get(MANIFESTS[0]);
|
|
106
|
+
if (!symbolsOid)
|
|
107
|
+
throw new Error("Staged .kb/symbols.yaml is missing or is not a regular file");
|
|
108
|
+
const initial = readBlobs([symbolsOid]);
|
|
109
|
+
const symbols = initial.get(symbolsOid);
|
|
110
|
+
if (!symbols)
|
|
111
|
+
throw new Error("Could not read staged .kb/symbols.yaml");
|
|
112
|
+
const { paths: sources, symbolCount } = sourcePaths(symbols);
|
|
113
|
+
// Plain sync does not publish coordinate artifacts for a freshly
|
|
114
|
+
// initialized, empty symbols manifest. The first commit must remain usable.
|
|
115
|
+
if (symbolCount === 0) {
|
|
116
|
+
if (indexTree() !== tree)
|
|
117
|
+
throw new Error("Git index changed during generated-manifest analysis; retry the commit");
|
|
118
|
+
console.log("kibi: staged symbols manifest is empty; no coordinates to refresh.");
|
|
119
|
+
return { exitCode: 0 };
|
|
120
|
+
}
|
|
121
|
+
const nonRegularEntries = [...nonRegularPaths];
|
|
122
|
+
const nonRegular = sources.find((source) => nonRegularEntries.some((entry) => source === entry || source.startsWith(`${entry}/`)));
|
|
123
|
+
if (nonRegular)
|
|
124
|
+
throw new Error(`Staged symbol source is not a regular file: ${nonRegular}`);
|
|
125
|
+
if (options.changedOnly) {
|
|
126
|
+
const changed = new Set(git(["diff", "--cached", "--name-only", "--no-renames", "-z"])
|
|
127
|
+
.toString("utf8")
|
|
128
|
+
.split("\0")
|
|
129
|
+
.filter(Boolean));
|
|
130
|
+
if (![...MANIFESTS, ...sources].some((file) => changed.has(file))) {
|
|
131
|
+
if (indexTree() !== tree)
|
|
132
|
+
throw new Error("Git index changed during generated-manifest analysis; retry the commit");
|
|
133
|
+
console.log("kibi: no staged symbol sources or generated manifests changed.");
|
|
134
|
+
return { exitCode: 0 };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const files = [...MANIFESTS, ...sources];
|
|
138
|
+
const objectIds = [
|
|
139
|
+
...new Set(files
|
|
140
|
+
.map((file) => blobs.get(file))
|
|
141
|
+
.filter((oid) => !!oid)),
|
|
142
|
+
];
|
|
143
|
+
const content = readBlobs(objectIds);
|
|
144
|
+
snapshotDir = mkdtempSync(path.join(tmpdir(), "kibi-generated-check-"));
|
|
145
|
+
for (const file of files) {
|
|
146
|
+
const oid = blobs.get(file);
|
|
147
|
+
if (!oid)
|
|
148
|
+
continue;
|
|
149
|
+
const target = path.join(snapshotDir, file);
|
|
150
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
151
|
+
const bytes = content.get(oid);
|
|
152
|
+
if (!bytes)
|
|
153
|
+
throw new Error(`Could not read staged blob for ${file}`);
|
|
154
|
+
writeFileSync(target, bytes);
|
|
155
|
+
}
|
|
156
|
+
await refreshManifestCoordinates(path.join(snapshotDir, MANIFESTS[0]), snapshotDir, {
|
|
157
|
+
refreshSymbolCoordinates: true,
|
|
158
|
+
quiet: true,
|
|
159
|
+
});
|
|
160
|
+
const snapshot = snapshotDir;
|
|
161
|
+
const drift = MANIFESTS.filter((file) => {
|
|
162
|
+
const generatedPath = path.join(snapshot, file);
|
|
163
|
+
const expected = existsSync(generatedPath)
|
|
164
|
+
? readFileSync(generatedPath)
|
|
165
|
+
: undefined;
|
|
166
|
+
const oid = blobs.get(file);
|
|
167
|
+
const staged = oid ? content.get(oid) : undefined;
|
|
168
|
+
return expected === undefined
|
|
169
|
+
? staged !== undefined
|
|
170
|
+
: staged === undefined || !expected.equals(staged);
|
|
171
|
+
});
|
|
172
|
+
// An index mutation invalidates every comparison, even if the manifests
|
|
173
|
+
// themselves were untouched. Git will commit the later index state.
|
|
174
|
+
if (indexTree() !== tree)
|
|
175
|
+
throw new Error("Git index changed during generated-manifest analysis; retry the commit");
|
|
176
|
+
if (drift.length > 0) {
|
|
177
|
+
console.error(`kibi: generated manifest drift in staged snapshot: ${drift.join(", ")}`);
|
|
178
|
+
console.error("Run kibi sync --refresh-symbol-coordinates, review the diff, then stage only the intended hunks with git add -p (or git add <path> when the whole file is intended).");
|
|
179
|
+
return { exitCode: 1 };
|
|
180
|
+
}
|
|
181
|
+
console.log("kibi: staged generated manifests are current.");
|
|
182
|
+
return { exitCode: 0 };
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
console.error(`kibi: generated manifest check failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
186
|
+
return { exitCode: 1 };
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
if (snapshotDir)
|
|
190
|
+
rmSync(snapshotDir, { recursive: true, force: true });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAifD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAC3B,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAMpB;AAGD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAib/B;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAoDtB;AAID,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB;AACD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA+DtB;AAID,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAmGtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAyCtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAgDtB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA0BtB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA+BtB"}
|
package/dist/commands/check.js
CHANGED
|
@@ -32,7 +32,7 @@ import { collectStagedKibiDiagnostics, } from "../traceability/staged-diagnostic
|
|
|
32
32
|
import { analyzeStagedFileCoverage, } from "../traceability/staged-file-coverage.js";
|
|
33
33
|
import { classifyKibiImpactEvidence, isBehaviorSourceEdit, parseKibiImpactOverride, } from "../traceability/staged-impact-contract.js";
|
|
34
34
|
import { assessStagedSymbolsManifest, collectStagedAuthoredSymbolsManifestEvidence, } from "../traceability/staged-symbols-manifest.js";
|
|
35
|
-
import { createManifestLookupSentinelKey,
|
|
35
|
+
import { createManifestLookupSentinelKey, extractSymbolsFromStagedFileAsync, } from "../traceability/symbol-extract.js";
|
|
36
36
|
import { cleanupTempKb, consultOverlay, createOverlayFacts, createTempKb, projectStagedEntities, } from "../traceability/temp-kb.js";
|
|
37
37
|
import { formatViolations as formatStagedViolations, validateStagedSymbols, } from "../traceability/validate.js";
|
|
38
38
|
import { resolveBranchAttachment } from "../utils/branch-resolver.js";
|
|
@@ -486,7 +486,8 @@ export async function checkCommand(options) {
|
|
|
486
486
|
if (f.content !== undefined) {
|
|
487
487
|
sourceContentByFile.set(f.path, f.content);
|
|
488
488
|
}
|
|
489
|
-
|
|
489
|
+
// Maintenance path: builtin-only (no CapabilityRegistry / workspaceRoot).
|
|
490
|
+
const symbols = await extractSymbolsFromStagedFileAsync(f, manifestLookup, {});
|
|
490
491
|
symbolsByFile.set(f.path, symbols);
|
|
491
492
|
if (symbols?.length) {
|
|
492
493
|
allSymbols.push(...symbols);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AA6DA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,aAAa,CACjC,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAwF/B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,GAAE,MAAM,OAAO,CAAC;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,CACT,GACxC,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;;;;;;;;;MAkE3C;AAkGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGzE;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAepB"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -20,9 +20,22 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
20
20
|
import { createRequire } from "node:module";
|
|
21
21
|
import * as path from "node:path";
|
|
22
22
|
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { bootstrapKibiEnvironment, secretSourceFromBootstrap, } from "../env/bootstrap.js";
|
|
24
|
+
import { describeConfiguredCapabilityPlugins, readProjectKibiConfig, } from "../plugins/project-config.js";
|
|
23
25
|
import { buildMigrationPlan, migrationAction, } from "../public/operations/migration-plan.js";
|
|
24
26
|
import { readKbManifestStatus } from "../utils/kb-manifest.js";
|
|
25
27
|
import { planLegacyStorageMigration } from "./legacy-storage-migration.js";
|
|
28
|
+
/**
|
|
29
|
+
* First-party plugin diagnostics known without importing the package.
|
|
30
|
+
* Generic third-party plugins report package/capability/mode/declared only.
|
|
31
|
+
*/
|
|
32
|
+
// implements REQ-kibi-env-bootstrap, REQ-capability-plugin-configuration-v1
|
|
33
|
+
const FIRST_PARTY_PLUGIN_SECRETS = {
|
|
34
|
+
"kibi-plugin-jev": ["TYPESAFE_API_KEY"],
|
|
35
|
+
};
|
|
36
|
+
/** Static Jev defaults — must stay aligned with kibi-plugin-jev (no import). */
|
|
37
|
+
const JEV_DEFAULT_MODEL = "jev-latest";
|
|
38
|
+
const JEV_MAX_TIMEOUT_MS = 120_000;
|
|
26
39
|
// implements REQ-003
|
|
27
40
|
export async function doctorCommand(options = {}) {
|
|
28
41
|
const checks = [
|
|
@@ -58,8 +71,15 @@ export async function doctorCommand(options = {}) {
|
|
|
58
71
|
name: "post-rewrite hook",
|
|
59
72
|
check: checkPostRewriteHook,
|
|
60
73
|
},
|
|
74
|
+
{
|
|
75
|
+
name: "Capability plugins",
|
|
76
|
+
check: checkCapabilityPlugins,
|
|
77
|
+
},
|
|
61
78
|
];
|
|
62
|
-
const results =
|
|
79
|
+
const results = [];
|
|
80
|
+
for (const { name, check } of checks) {
|
|
81
|
+
results.push({ name, ...(await check()) });
|
|
82
|
+
}
|
|
63
83
|
const allPassed = results.every((result) => result.passed);
|
|
64
84
|
const runtime = await runtimeProvenance();
|
|
65
85
|
const packageActions = await packageMigrationActions(runtime);
|
|
@@ -329,6 +349,107 @@ function checkSWIProlog() {
|
|
|
329
349
|
};
|
|
330
350
|
}
|
|
331
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Read-only view of package.json plugin activation.
|
|
354
|
+
* Does not import or execute plugin packages (no loadPluginPackage / dynamic import).
|
|
355
|
+
*/
|
|
356
|
+
// implements REQ-capability-plugin-configuration-v1, REQ-kibi-env-bootstrap
|
|
357
|
+
function checkCapabilityPlugins() {
|
|
358
|
+
try {
|
|
359
|
+
const bootstrap = bootstrapKibiEnvironment();
|
|
360
|
+
const workspaceRoot = bootstrap.workspaceRoot;
|
|
361
|
+
const rows = describeConfiguredCapabilityPlugins(workspaceRoot);
|
|
362
|
+
if (rows.length === 0) {
|
|
363
|
+
return {
|
|
364
|
+
passed: true,
|
|
365
|
+
message: "None configured; builtin providers only",
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
const parts = rows.map((row) => `${row.package} ${row.capability} ${row.mode} declared=${row.declared ? "yes" : "no"}`);
|
|
369
|
+
if (rows.some((row) => !row.declared)) {
|
|
370
|
+
return {
|
|
371
|
+
passed: false,
|
|
372
|
+
message: parts.join("; "),
|
|
373
|
+
remediation: "Add the configured plugin package to dependencies, devDependencies, or optionalDependencies, or remove the kibi.plugins activation entry.",
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
const config = readProjectKibiConfig(workspaceRoot);
|
|
377
|
+
const packages = [
|
|
378
|
+
...new Set((config.plugins ?? []).map((plugin) => plugin.package)),
|
|
379
|
+
];
|
|
380
|
+
const missingSecrets = [];
|
|
381
|
+
const legacySecrets = [];
|
|
382
|
+
for (const packageName of packages) {
|
|
383
|
+
const secrets = FIRST_PARTY_PLUGIN_SECRETS[packageName] ?? [];
|
|
384
|
+
for (const secret of secrets) {
|
|
385
|
+
const source = formatSecretSourcePart(secret, bootstrap);
|
|
386
|
+
parts.push(`${secret}=${source}`);
|
|
387
|
+
if (source === "missing")
|
|
388
|
+
missingSecrets.push(secret);
|
|
389
|
+
if (source === "legacy_env")
|
|
390
|
+
legacySecrets.push(secret);
|
|
391
|
+
}
|
|
392
|
+
if (packageName === "kibi-plugin-jev") {
|
|
393
|
+
parts.push(...formatJevStaticConfigParts());
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const message = parts.join("; ");
|
|
397
|
+
if (missingSecrets.length > 0) {
|
|
398
|
+
const jevMissing = missingSecrets.includes("TYPESAFE_API_KEY");
|
|
399
|
+
return {
|
|
400
|
+
passed: false,
|
|
401
|
+
message,
|
|
402
|
+
remediation: jevMissing
|
|
403
|
+
? "Set `TYPESAFE_API_KEY` in `~/.config/kibi/env` (user-wide) or `<workspace>/.env.kibi` (project override), then restart long-running Kibi MCP/host processes."
|
|
404
|
+
: `Set missing plugin secret(s) (${missingSecrets.join(", ")}) in ~/.config/kibi/env or <workspace>/.env.kibi, then restart long-running Kibi MCP/host processes.`,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
if (legacySecrets.length > 0) {
|
|
408
|
+
return {
|
|
409
|
+
passed: true,
|
|
410
|
+
message,
|
|
411
|
+
remediation: `Migrate ${legacySecrets.join(", ")} from legacy \`.env\` to \`~/.config/kibi/env\` or \`<workspace>/.env.kibi\`, then restart long-running Kibi MCP/host processes.`,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
passed: true,
|
|
416
|
+
message,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
421
|
+
return {
|
|
422
|
+
passed: false,
|
|
423
|
+
message,
|
|
424
|
+
remediation: "Fix package.json kibi.plugins, then restart long-running Kibi MCP or client processes.",
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function formatSecretSourcePart(secret, bootstrap) {
|
|
429
|
+
return secretSourceFromBootstrap(secret, bootstrap);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Static first-party Jev diagnostics — mirrors plugin resolve helpers without importing.
|
|
433
|
+
*/
|
|
434
|
+
// implements REQ-kibi-env-bootstrap, REQ-capability-plugin-configuration-v1
|
|
435
|
+
function formatJevStaticConfigParts(env = process.env) {
|
|
436
|
+
const model = env.KIBI_JEV_MODEL?.trim() || JEV_DEFAULT_MODEL;
|
|
437
|
+
const raw = env.KIBI_JEV_TIMEOUT_MS;
|
|
438
|
+
if (raw === undefined || raw.trim() === "") {
|
|
439
|
+
return [`jev.model=${model}`, "jev.timeoutMs=default"];
|
|
440
|
+
}
|
|
441
|
+
const trimmed = raw.trim();
|
|
442
|
+
if (!/^[1-9]\d*$/.test(trimmed)) {
|
|
443
|
+
return [`jev.model=${model}`, "jev.timeoutMs=invalid"];
|
|
444
|
+
}
|
|
445
|
+
const timeoutMs = Number(trimmed);
|
|
446
|
+
if (!Number.isSafeInteger(timeoutMs) ||
|
|
447
|
+
timeoutMs < 1 ||
|
|
448
|
+
timeoutMs > JEV_MAX_TIMEOUT_MS) {
|
|
449
|
+
return [`jev.model=${model}`, "jev.timeoutMs=invalid"];
|
|
450
|
+
}
|
|
451
|
+
return [`jev.model=${model}`, `jev.timeoutMs=${String(timeoutMs)}`];
|
|
452
|
+
}
|
|
332
453
|
function checkKbDirectory() {
|
|
333
454
|
const kbDir = path.join(process.cwd(), ".kb");
|
|
334
455
|
if (!existsSync(kbDir)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/commands/engine.ts"],"names":[],"mappings":"AAkCA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BzD;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWvD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AAEH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/commands/engine.ts"],"names":[],"mappings":"AAkCA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BzD;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWvD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AAEH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB3D;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
|
package/dist/commands/engine.js
CHANGED
|
@@ -96,7 +96,9 @@ export async function engineJanitorCommand(options) {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
for (const finding of findings) {
|
|
99
|
-
const holder = "pid" in finding && finding.pid !== undefined
|
|
99
|
+
const holder = "pid" in finding && finding.pid !== undefined
|
|
100
|
+
? ` pid=${finding.pid}`
|
|
101
|
+
: "";
|
|
100
102
|
const workspace = finding.kind === "store-lock" && finding.workspaceRoot !== undefined
|
|
101
103
|
? ` workspace=${finding.workspaceRoot}`
|
|
102
104
|
: "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"AAuIA,wBAAsB,gBAAgB,CACpC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,IAAI,CAUN;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA6BjD;AAkDD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAU3D;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAYf;AASD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAkCnE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAiBpD"}
|
|
@@ -61,13 +61,17 @@ old_ref=$1
|
|
|
61
61
|
new_ref=$2
|
|
62
62
|
branch_flag=$3
|
|
63
63
|
|
|
64
|
+
# File checkouts never refresh the KB; skip binary resolution so sandboxed
|
|
65
|
+
# test workspaces without an installed kibi CLI can restore tracked files.
|
|
66
|
+
if [ "$branch_flag" != "1" ]; then
|
|
67
|
+
exit 0
|
|
68
|
+
fi
|
|
69
|
+
|
|
64
70
|
${KIBI_BIN_RESOLVER}
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"$KIBI_BIN" sync
|
|
70
|
-
fi
|
|
72
|
+
# Branch stores are derived from the checked-out tracked sources. Never copy
|
|
73
|
+
# the old branch's compiled store during checkout.
|
|
74
|
+
"$KIBI_BIN" sync
|
|
71
75
|
`;
|
|
72
76
|
const POST_MERGE_HOOK = `#!/bin/sh
|
|
73
77
|
# post-merge hook for kibi
|
|
@@ -102,13 +106,14 @@ const PRE_COMMIT_HOOK = `#!/bin/sh
|
|
|
102
106
|
# Behavior-changing source edits require staged Kibi impact evidence
|
|
103
107
|
# (KB entity docs under .kb/, authored symbols metadata, or refreshed
|
|
104
108
|
# symbol coordinates). Test-only and docs-only edits are exempt.
|
|
105
|
-
#
|
|
106
|
-
#
|
|
109
|
+
# Generated manifests are checked against the exact staged snapshot before
|
|
110
|
+
# traceability validation. The check never stages files on the user's behalf.
|
|
107
111
|
|
|
108
112
|
set -e
|
|
109
113
|
|
|
110
114
|
${KIBI_BIN_RESOLVER}
|
|
111
115
|
|
|
116
|
+
"$KIBI_BIN" check-generated --staged --changed-only
|
|
112
117
|
"$KIBI_BIN" check --staged
|
|
113
118
|
`;
|
|
114
119
|
export async function getCurrentBranch(cwd = process.cwd()) {
|
|
@@ -168,6 +173,7 @@ const CANONICAL_DERIVED_GITIGNORE_ENTRIES = [
|
|
|
168
173
|
".kb/briefs/",
|
|
169
174
|
".kb/migrations/",
|
|
170
175
|
".kb/usage.log",
|
|
176
|
+
".env.kibi",
|
|
171
177
|
];
|
|
172
178
|
/**
|
|
173
179
|
* Pre-canonical Kibi init wrote a blanket `.kb/` fence and then
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ProofExplainOptions = Readonly<{
|
|
2
|
+
id?: string;
|
|
3
|
+
requirement?: string;
|
|
4
|
+
symbol?: string;
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function proofExplainCommand(options: ProofExplainOptions): Promise<{
|
|
8
|
+
exitCode: number;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=proof-explain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-explain.d.ts","sourceRoot":"","sources":["../../src/commands/proof-explain.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAGH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAuC/B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
*/
|
|
10
|
+
import { classifyExplainTarget, executeProofExplain, renderProofExplain, } from "../operations/proof/explain.js";
|
|
11
|
+
import { createCliRuntime } from "../runtime/cli-runtime.js";
|
|
12
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
13
|
+
export async function proofExplainCommand(options) {
|
|
14
|
+
const target = classifyExplainTarget(options.id, {
|
|
15
|
+
...(options.requirement === undefined
|
|
16
|
+
? {}
|
|
17
|
+
: { requirement: options.requirement }),
|
|
18
|
+
...(options.symbol === undefined ? {} : { symbol: options.symbol }),
|
|
19
|
+
});
|
|
20
|
+
const runtime = createCliRuntime();
|
|
21
|
+
const context = await runtime.open({
|
|
22
|
+
name: "kibi_proof_explain",
|
|
23
|
+
effects: [],
|
|
24
|
+
requiresProlog: true,
|
|
25
|
+
execute: async () => undefined,
|
|
26
|
+
}, {});
|
|
27
|
+
let completed = false;
|
|
28
|
+
try {
|
|
29
|
+
const { view } = await executeProofExplain(target, context);
|
|
30
|
+
if (options.json) {
|
|
31
|
+
process.stdout.write(`${JSON.stringify(view, null, 2)}\n`);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
process.stdout.write(renderProofExplain(view));
|
|
35
|
+
}
|
|
36
|
+
completed = true;
|
|
37
|
+
await runtime.afterSuccess({ name: "kibi_proof_explain" }, context);
|
|
38
|
+
return { exitCode: 0 };
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await runtime.close(context, completed
|
|
42
|
+
? { status: "success", result: 0 }
|
|
43
|
+
: { status: "error", error: 1 });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-impact.d.ts","sourceRoot":"","sources":["../../src/commands/proof-impact.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAGH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA8B/B"}
|