kibi-cli 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-json-command.d.ts +1 -2
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +88 -44
- package/dist/cli-operation-loader.d.ts +3 -0
- package/dist/cli-operation-loader.d.ts.map +1 -0
- package/dist/cli-operation-loader.js +58 -0
- package/dist/cli-operation-metadata.d.ts +82 -0
- package/dist/cli-operation-metadata.d.ts.map +1 -0
- package/dist/cli-operation-metadata.js +106 -0
- package/dist/cli-protocol.d.ts +1 -1
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +4 -3
- package/dist/cli-register-foundation.d.ts.map +1 -1
- package/dist/cli-register-foundation.js +14 -17
- package/dist/cli-register-json.d.ts +3 -0
- package/dist/cli-register-json.d.ts.map +1 -0
- package/dist/cli-register-json.js +35 -0
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +41 -8
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +18 -14
- package/dist/cli-register-skills.d.ts.map +1 -1
- package/dist/cli-register-skills.js +8 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -2
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +30 -12
- package/dist/commands/coverage.d.ts +5 -0
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +6 -1
- package/dist/commands/discovery-shared.d.ts +2 -1
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +35 -13
- package/dist/commands/discovery-table.d.ts.map +1 -1
- package/dist/commands/discovery-table.js +96 -5
- package/dist/commands/engine.d.ts +8 -0
- package/dist/commands/engine.d.ts.map +1 -0
- package/dist/commands/engine.js +100 -0
- package/dist/commands/gaps.js +1 -1
- package/dist/commands/graph.js +1 -1
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +3 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +3 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +2 -1
- package/dist/commands/sync/cache.d.ts +12 -0
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +38 -1
- package/dist/commands/sync/persistence.d.ts +10 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +276 -43
- package/dist/commands/sync/staging.d.ts +10 -1
- package/dist/commands/sync/staging.d.ts.map +1 -1
- package/dist/commands/sync/staging.js +84 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +521 -27
- package/dist/commands/usage-metrics.d.ts +66 -2
- package/dist/commands/usage-metrics.d.ts.map +1 -1
- package/dist/commands/usage-metrics.js +34 -24
- package/dist/commands/usage-remediation.d.ts +9 -0
- package/dist/commands/usage-remediation.d.ts.map +1 -0
- package/dist/commands/usage-remediation.js +52 -0
- package/dist/engine-daemon.d.ts +3 -0
- package/dist/engine-daemon.d.ts.map +1 -0
- package/dist/engine-daemon.js +34 -0
- package/dist/engine.d.ts +63 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1256 -0
- package/dist/extractors/markdown.d.ts +8 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +69 -2
- package/dist/extractors/relationships.d.ts +2 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +15 -17
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +14 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +27 -2
- package/dist/operations/modeling/predicate-applyplan.d.ts +1 -1
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +18 -6
- package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-inference.js +5 -17
- package/dist/operations/modeling/predicate-loader.js +1 -1
- package/dist/operations/modeling/predicate-types.d.ts +9 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +35 -11
- package/dist/operations/mutation/audit.js +1 -1
- package/dist/operations/mutation/contradictions.d.ts +1 -1
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +23 -18
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +6 -3
- package/dist/operations/mutation/upsert.d.ts +3 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +51 -12
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +18 -2
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +8 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +76 -61
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +7 -7
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +18 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.js +167 -0
- package/dist/operations/semantic-advisor/shared.d.ts +8 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +37 -3
- package/dist/operations/semantic-advisor/types.d.ts +5 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +9 -2
- package/dist/prolog.d.ts +14 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +279 -69
- package/dist/public/diagnostic-usage.d.ts +17 -0
- package/dist/public/diagnostic-usage.d.ts.map +1 -0
- package/dist/public/diagnostic-usage.js +152 -0
- package/dist/public/distribution-parity.d.ts +90 -0
- package/dist/public/distribution-parity.d.ts.map +1 -0
- package/dist/public/distribution-parity.js +367 -0
- package/dist/public/impact/full-kb-quality.d.ts +2 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +53 -1
- package/dist/public/impact-diagnostics.d.ts +2 -0
- package/dist/public/impact-diagnostics.d.ts.map +1 -1
- package/dist/public/impact-diagnostics.js +1 -0
- package/dist/public/operations/catalog.d.ts +151 -6
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +4 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +3 -2
- package/dist/public/operations/discovery-executors.d.ts +6 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +58 -5
- package/dist/public/operations/index.d.ts +4 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +4 -0
- package/dist/public/operations/legacy-migration-plan.d.ts +113 -0
- package/dist/public/operations/legacy-migration-plan.d.ts.map +1 -0
- package/dist/public/operations/legacy-migration-plan.js +409 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +90 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +14 -4
- package/dist/public/operations/repair-plan.d.ts +184 -0
- package/dist/public/operations/repair-plan.d.ts.map +1 -0
- package/dist/public/operations/repair-plan.js +397 -0
- package/dist/public/operations/runtime-types.d.ts +38 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.js +2 -2
- package/dist/public/operations/specs/discovery.d.ts +1 -1
- package/dist/public/operations/specs/discovery.js +1 -1
- package/dist/public/operations/specs/modeling.d.ts +19 -1
- package/dist/public/operations/specs/modeling.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.js +16 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +96 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +40 -1
- package/dist/public/operations/specs/reporting.d.ts +42 -1
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +70 -6
- package/dist/public/operations/specs/semantic.js +1 -1
- package/dist/public/operations/specs/upsert.d.ts +96 -1
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/workspace-snapshot.d.ts +10 -0
- package/dist/public/operations/workspace-snapshot.d.ts.map +1 -0
- package/dist/public/operations/workspace-snapshot.js +20 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +43 -1
- package/dist/public/skills/init-kibi/SKILL.md +2 -2
- package/dist/public/skills/kibi-freshness/SKILL.md +2 -2
- package/dist/public/skills/kibi-traceability/SKILL.md +8 -2
- package/dist/public/skills/kibi-usage/SKILL.md +12 -6
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +1 -1
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/dist/public/skills/kibi-usage/resources/workflows.md +19 -2
- package/dist/public/telemetry-acceptance.d.ts +89 -0
- package/dist/public/telemetry-acceptance.d.ts.map +1 -0
- package/dist/public/telemetry-acceptance.js +597 -0
- package/dist/public/telemetry-remediation.d.ts +33 -0
- package/dist/public/telemetry-remediation.d.ts.map +1 -0
- package/dist/public/telemetry-remediation.js +257 -0
- package/dist/public/verification-receipt.d.ts +75 -0
- package/dist/public/verification-receipt.d.ts.map +1 -0
- package/dist/public/verification-receipt.js +129 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +33 -37
- package/dist/schemas/entity.schema.json +96 -2
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +36 -3
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/rule-registry.d.ts +2 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/package.json +36 -4
- package/src/public/diagnostic-usage.ts +206 -0
- package/src/public/distribution-parity.ts +580 -0
- package/src/public/impact/full-kb-quality.ts +74 -1
- package/src/public/impact-diagnostics.ts +16 -0
- package/src/public/operations/check-executor.ts +4 -0
- package/src/public/operations/discovery-entities.ts +3 -2
- package/src/public/operations/discovery-executors.ts +68 -5
- package/src/public/operations/index.ts +4 -0
- package/src/public/operations/legacy-migration-plan.ts +688 -0
- package/src/public/operations/node-ports.ts +109 -0
- package/src/public/operations/prolog-json.ts +15 -3
- package/src/public/operations/repair-plan.ts +562 -0
- package/src/public/operations/runtime-types.ts +47 -0
- package/src/public/operations/specs/check.ts +2 -2
- package/src/public/operations/specs/discovery.ts +1 -1
- package/src/public/operations/specs/modeling.ts +19 -1
- package/src/public/operations/specs/mutation-schemas.ts +47 -1
- package/src/public/operations/specs/reporting.ts +91 -6
- package/src/public/operations/specs/semantic.ts +1 -1
- package/src/public/operations/workspace-snapshot.ts +28 -0
- package/src/public/schemas/entity.ts +44 -1
- package/src/public/skills/init-kibi/SKILL.md +2 -2
- package/src/public/skills/kibi-freshness/SKILL.md +2 -2
- package/src/public/skills/kibi-traceability/SKILL.md +8 -2
- package/src/public/skills/kibi-usage/SKILL.md +12 -6
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/src/public/skills/kibi-usage/resources/logic-ir.md +1 -1
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/src/public/skills/kibi-usage/resources/workflows.md +19 -2
- package/src/public/telemetry-acceptance.ts +859 -0
- package/src/public/telemetry-remediation.ts +462 -0
- package/src/public/verification-receipt.ts +170 -0
- package/src/schemas/entity.schema.json +96 -2
|
@@ -1,28 +1,61 @@
|
|
|
1
1
|
import { withExitCode } from "./cli-command.js";
|
|
2
|
-
import { branchEnsureCommand } from "./commands/branch.js";
|
|
3
|
-
import { doctorCommand } from "./commands/doctor.js";
|
|
4
|
-
import { gcCommand } from "./commands/gc.js";
|
|
5
|
-
import { usageMetricsCommand } from "./commands/usage-metrics.js";
|
|
6
2
|
// implements REQ-kibi-operation-interface-parity
|
|
7
3
|
export function registerMaintenanceCommands(program) {
|
|
4
|
+
const engine = program
|
|
5
|
+
.command("engine")
|
|
6
|
+
.description("Manage the per-workspace Kibi engine");
|
|
7
|
+
engine
|
|
8
|
+
.command("status")
|
|
9
|
+
.description("Show engine and journaled storage status")
|
|
10
|
+
.action(async () => (await import("./commands/engine.js")).engineStatusCommand());
|
|
11
|
+
engine
|
|
12
|
+
.command("stop")
|
|
13
|
+
.description("Stop the current workspace engine")
|
|
14
|
+
.action(async () => (await import("./commands/engine.js")).engineStopCommand());
|
|
15
|
+
const storage = program
|
|
16
|
+
.command("storage")
|
|
17
|
+
.description("Inspect and maintain journaled Kibi storage");
|
|
18
|
+
storage
|
|
19
|
+
.command("status")
|
|
20
|
+
.description("Show journaled storage status")
|
|
21
|
+
.action(async () => (await import("./commands/engine.js")).storageStatusCommand());
|
|
22
|
+
storage
|
|
23
|
+
.command("compact")
|
|
24
|
+
.description("Compact RDF journals into binary snapshots")
|
|
25
|
+
.action(async () => (await import("./commands/engine.js")).storageCompactCommand());
|
|
26
|
+
storage
|
|
27
|
+
.command("export")
|
|
28
|
+
.description("Export legacy RDF/XML and audit files")
|
|
29
|
+
.requiredOption("--output <directory>", "Export destination directory")
|
|
30
|
+
.action(async (options) => (await import("./commands/engine.js")).storageExportCommand(options));
|
|
8
31
|
program
|
|
9
32
|
.command("gc")
|
|
10
33
|
.description("Garbage collect stale branch KBs")
|
|
11
34
|
.option("--dry-run", "Preview without deleting (default)", true)
|
|
12
35
|
.option("--force", "Actually delete stale branches")
|
|
13
36
|
.action(async (options) => {
|
|
14
|
-
await
|
|
37
|
+
await (await import("./commands/gc.js")).gcCommand({
|
|
38
|
+
dryRun: !options.force,
|
|
39
|
+
force: options.force,
|
|
40
|
+
});
|
|
15
41
|
});
|
|
16
42
|
program
|
|
17
43
|
.command("doctor")
|
|
18
44
|
.description("Diagnose KB setup and configuration")
|
|
19
|
-
.action(withExitCode(async () => doctorCommand()));
|
|
45
|
+
.action(withExitCode(async () => (await import("./commands/doctor.js")).doctorCommand()));
|
|
20
46
|
program
|
|
21
47
|
.command("usage-metrics")
|
|
22
48
|
.description("Report usage and quality metrics from .kb/usage.log")
|
|
23
49
|
.option("--format <format>", "Output format: json|table", "table")
|
|
24
50
|
.option("--limit <n>", "Limit top zero-result source files", "10")
|
|
25
|
-
.
|
|
51
|
+
.option("--require-acceptance", "Exit non-zero unless the telemetry acceptance report passes")
|
|
52
|
+
.action(withExitCode(async (options) => (await import("./commands/usage-metrics.js")).usageMetricsCommand(options)));
|
|
53
|
+
program
|
|
54
|
+
.command("usage-remediation")
|
|
55
|
+
.description("Enumerate exact diagnostic events and report-level evidence gaps requiring repair")
|
|
56
|
+
.option("--format <format>", "Output format: json|table", "table")
|
|
57
|
+
.option("--limit <n>", "Limit rendered table rows", "50")
|
|
58
|
+
.action(withExitCode(async (options) => (await import("./commands/usage-remediation.js")).usageRemediationCommand(options)));
|
|
26
59
|
program
|
|
27
60
|
.command("branch")
|
|
28
61
|
.description("Manage branch KBs")
|
|
@@ -30,7 +63,7 @@ export function registerMaintenanceCommands(program) {
|
|
|
30
63
|
.option("--from <branch>", "Source branch to copy KB from")
|
|
31
64
|
.action(async (action, options) => {
|
|
32
65
|
if (action === "ensure") {
|
|
33
|
-
await branchEnsureCommand(options);
|
|
66
|
+
await (await import("./commands/branch.js")).branchEnsureCommand(options);
|
|
34
67
|
}
|
|
35
68
|
});
|
|
36
69
|
}
|
|
@@ -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;
|
|
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,CAgJhE"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { withExitCode } from "./cli-command.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { getSpec } from "./public/operations/index.js";
|
|
2
|
+
import { getCliOperationMetadata } from "./cli-operation-metadata.js";
|
|
3
|
+
async function runJsonInvocation(invocation) {
|
|
4
|
+
const executor = await import("./cli-json-command.js");
|
|
5
|
+
await executor.runJsonInvocation(invocation);
|
|
6
|
+
}
|
|
8
7
|
// implements REQ-kibi-operation-interface-parity
|
|
9
8
|
export function registerReportingCommands(program) {
|
|
10
9
|
program
|
|
11
10
|
.command("find-gaps [type]")
|
|
12
11
|
.alias("gaps")
|
|
13
|
-
.description(
|
|
12
|
+
.description(getCliOperationMetadata("kb_find_gaps").description)
|
|
14
13
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
15
14
|
.option("--missing-rel <rels>", "Comma-separated missing relationship filters")
|
|
16
15
|
.option("--present-rel <rels>", "Comma-separated present relationship filters")
|
|
@@ -29,11 +28,11 @@ export function registerReportingCommands(program) {
|
|
|
29
28
|
});
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
await gapsCommand(type, options);
|
|
31
|
+
await (await import("./commands/gaps.js")).gapsCommand(type, options);
|
|
33
32
|
});
|
|
34
33
|
program
|
|
35
34
|
.command("coverage")
|
|
36
|
-
.description(
|
|
35
|
+
.description(getCliOperationMetadata("kb_coverage").description)
|
|
37
36
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
38
37
|
.option("--by <group>", "Coverage mode: req|symbol|type", "req")
|
|
39
38
|
.option("--tag <tags>", "Comma-separated tag filter")
|
|
@@ -41,6 +40,11 @@ export function registerReportingCommands(program) {
|
|
|
41
40
|
.option("--no-include-transitive", "Disable transitive symbol coverage")
|
|
42
41
|
.option("--limit <n>", "Limit results", "100")
|
|
43
42
|
.option("--offset <n>", "Skip results", "0")
|
|
43
|
+
.option("--include-migration-preview", "Include one read-only legacy semantic migration preview batch", false)
|
|
44
|
+
.option("--migration-limit <n>", "Maximum migration preview batches (1-10)", "1")
|
|
45
|
+
.option("--migration-offset <n>", "Skip ready semantic-inventory migration batches", "0")
|
|
46
|
+
.option("--migration-predicate-limit <n>", "Maximum ranked predicate schemas per proposition", "5")
|
|
47
|
+
.option("--migration-predicate-min-score <score>", "Minimum predicate schema rank score", "0.35")
|
|
44
48
|
.option("--format <format>", "Output format: json|table", "table")
|
|
45
49
|
.action(async (options, command) => {
|
|
46
50
|
if (options.input !== undefined) {
|
|
@@ -51,11 +55,11 @@ export function registerReportingCommands(program) {
|
|
|
51
55
|
});
|
|
52
56
|
return;
|
|
53
57
|
}
|
|
54
|
-
await coverageCommand(options);
|
|
58
|
+
await (await import("./commands/coverage.js")).coverageCommand(options);
|
|
55
59
|
});
|
|
56
60
|
program
|
|
57
61
|
.command("graph")
|
|
58
|
-
.description(
|
|
62
|
+
.description(getCliOperationMetadata("kb_graph").description)
|
|
59
63
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
60
64
|
.option("--from <ids>", "Comma-separated seed IDs")
|
|
61
65
|
.option("--relationships <rels>", "Comma-separated relationship filter")
|
|
@@ -74,11 +78,11 @@ export function registerReportingCommands(program) {
|
|
|
74
78
|
});
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
|
-
await graphCommand(options);
|
|
81
|
+
await (await import("./commands/graph.js")).graphCommand(options);
|
|
78
82
|
});
|
|
79
83
|
program
|
|
80
84
|
.command("check")
|
|
81
|
-
.description(
|
|
85
|
+
.description(getCliOperationMetadata("kb_check").description)
|
|
82
86
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
83
87
|
.option("--fix", "Suggest fixes for violations")
|
|
84
88
|
.option("--kb-path <dir>", "Path to KB directory (overrides branch resolution)")
|
|
@@ -96,6 +100,6 @@ export function registerReportingCommands(program) {
|
|
|
96
100
|
});
|
|
97
101
|
return undefined;
|
|
98
102
|
}
|
|
99
|
-
return checkCommand(options);
|
|
103
|
+
return (await import("./commands/check.js")).checkCommand(options);
|
|
100
104
|
}));
|
|
101
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-skills.d.ts","sourceRoot":"","sources":["../src/cli-register-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-register-skills.d.ts","sourceRoot":"","sources":["../src/cli-register-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+F7D"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { withExitCode } from "./cli-command.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
async function runJsonInvocation(invocation) {
|
|
3
|
+
const executor = await import("./cli-json-command.js");
|
|
4
|
+
await executor.runJsonInvocation(invocation);
|
|
5
|
+
}
|
|
4
6
|
// implements REQ-kibi-operation-interface-parity
|
|
5
7
|
export function registerSkillsCommands(program) {
|
|
6
8
|
const skillsProgram = program
|
|
@@ -20,7 +22,7 @@ export function registerSkillsCommands(program) {
|
|
|
20
22
|
});
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
await skillsListCommand(options);
|
|
25
|
+
await (await import("./commands/skills.js")).skillsListCommand(options);
|
|
24
26
|
});
|
|
25
27
|
skillsProgram
|
|
26
28
|
.command("load")
|
|
@@ -38,7 +40,7 @@ export function registerSkillsCommands(program) {
|
|
|
38
40
|
});
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
|
-
await skillsLoadCommand(id ?? "", options);
|
|
43
|
+
await (await import("./commands/skills.js")).skillsLoadCommand(id ?? "", options);
|
|
42
44
|
});
|
|
43
45
|
skillsProgram
|
|
44
46
|
.command("read")
|
|
@@ -60,12 +62,12 @@ export function registerSkillsCommands(program) {
|
|
|
60
62
|
});
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
63
|
-
await skillsReadCommand(id ?? "", resource ?? "", options);
|
|
65
|
+
await (await import("./commands/skills.js")).skillsReadCommand(id ?? "", resource ?? "", options);
|
|
64
66
|
});
|
|
65
67
|
skillsProgram
|
|
66
68
|
.command("validate")
|
|
67
69
|
.description("Validate a bundled markdown skill path")
|
|
68
70
|
.argument("<path>", "Skill bundle directory or SKILL.md path")
|
|
69
71
|
.option("--format <format>", "Output format: json|table", "table")
|
|
70
|
-
.action(withExitCode(async (pathLike, options) => skillsValidateCommand(pathLike, options)));
|
|
72
|
+
.action(withExitCode(async (pathLike, options) => (await import("./commands/skills.js")).skillsValidateCommand(pathLike, options)));
|
|
71
73
|
}
|
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;AAOpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmBtD,wBAAgB,YAAY,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmBtD,wBAAgB,YAAY,IAAI,OAAO,CAgBtC;AAGD,wBAAsB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAgB3C"}
|
package/dist/cli.js
CHANGED
|
@@ -20,8 +20,8 @@ import { readFileSync } from "node:fs";
|
|
|
20
20
|
import { resolve } from "node:path";
|
|
21
21
|
import { pathToFileURL } from "node:url";
|
|
22
22
|
import { Command } from "commander";
|
|
23
|
-
import { registerJsonOnlyCommands } from "./cli-json-command.js";
|
|
24
23
|
import { registerFoundationCommands } from "./cli-register-foundation.js";
|
|
24
|
+
import { registerJsonOnlyCommands } from "./cli-register-json.js";
|
|
25
25
|
import { registerMaintenanceCommands } from "./cli-register-maintenance.js";
|
|
26
26
|
import { registerReportingCommands } from "./cli-register-reporting.js";
|
|
27
27
|
import { registerSkillsCommands } from "./cli-register-skills.js";
|
|
@@ -40,7 +40,8 @@ export function buildProgram() {
|
|
|
40
40
|
const program = new Command()
|
|
41
41
|
.name("kibi")
|
|
42
42
|
.description("Prolog-based project knowledge base")
|
|
43
|
-
.version(packageVersion(packageJson))
|
|
43
|
+
.version(packageVersion(packageJson))
|
|
44
|
+
.option("--diagnostic-mode", "Append diagnostic usage evidence for public JSON operations");
|
|
44
45
|
registerFoundationCommands(program);
|
|
45
46
|
registerReportingCommands(program);
|
|
46
47
|
registerMaintenanceCommands(program);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregated-checks.d.ts","sourceRoot":"","sources":["../../src/commands/aggregated-checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregated-checks.d.ts","sourceRoot":"","sources":["../../src/commands/aggregated-checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAW5C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,EACpC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAClC,UAAU,UAAQ,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAwDtB"}
|
|
@@ -50,6 +50,7 @@ export async function runAggregatedChecks(prolog, rulesAllowlist, requireAdr = f
|
|
|
50
50
|
description: v.description,
|
|
51
51
|
...(v.suggestion ? { suggestion: v.suggestion } : {}),
|
|
52
52
|
...(v.source ? { source: v.source } : {}),
|
|
53
|
+
...(v.evidence ? { evidence: v.evidence } : {}),
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAmFA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,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;AA2bD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqX/B"}
|
package/dist/commands/check.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { existsSync } from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
|
+
import { EngineClient } from "../engine.js";
|
|
20
21
|
import { getBranchOverride, isCliTraceOrDebugEnabled } from "../env.js";
|
|
21
22
|
import { extractFromManifest, extractFromManifestString, } from "../extractors/manifest.js";
|
|
22
23
|
import { extractFromMarkdownString, } from "../extractors/markdown.js";
|
|
@@ -360,7 +361,9 @@ function buildStagedKibiImpactEvidence(options) {
|
|
|
360
361
|
// implements REQ-006
|
|
361
362
|
export async function checkCommand(options) {
|
|
362
363
|
let prolog = null;
|
|
364
|
+
let engine = null;
|
|
363
365
|
let attached = false;
|
|
366
|
+
let resolvedBranch = "develop";
|
|
364
367
|
try {
|
|
365
368
|
let resolvedKbPath = "";
|
|
366
369
|
if (options.kbPath) {
|
|
@@ -379,6 +382,7 @@ export async function checkCommand(options) {
|
|
|
379
382
|
}
|
|
380
383
|
if (!branch)
|
|
381
384
|
branch = envBranch || "develop";
|
|
385
|
+
resolvedBranch = branch;
|
|
382
386
|
// fallback to main if develop isn't present? keep path consistent
|
|
383
387
|
resolvedKbPath = path.join(process.cwd(), ".kb/branches", branch || "main");
|
|
384
388
|
}
|
|
@@ -564,20 +568,33 @@ export async function checkCommand(options) {
|
|
|
564
568
|
return { exitCode: 1 };
|
|
565
569
|
}
|
|
566
570
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
571
|
+
// The active branch is hosted by the journaled engine. Keep the explicit
|
|
572
|
+
// --kb-path escape hatch on the one-shot path for alternate/staged stores,
|
|
573
|
+
// but never compete with the branch daemon for its RDF lock.
|
|
574
|
+
if (options.kbPath === undefined) {
|
|
575
|
+
engine = new EngineClient({
|
|
576
|
+
workspaceRoot: process.cwd(),
|
|
577
|
+
branch: resolvedBranch,
|
|
578
|
+
timeout: 120_000,
|
|
579
|
+
});
|
|
580
|
+
await engine.start();
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
prolog = new PrologProcess({ timeout: 120000 });
|
|
584
|
+
await prolog.start();
|
|
585
|
+
const kbPathEscaped = escapeAtom(resolvedKbPath);
|
|
586
|
+
const attachResult = await prolog.query(`kb_attach('${kbPathEscaped}')`);
|
|
587
|
+
if (!attachResult.success) {
|
|
588
|
+
await prolog.terminate();
|
|
589
|
+
console.error(`Error: Failed to attach KB: ${attachResult.error}`);
|
|
590
|
+
return { exitCode: 1 };
|
|
591
|
+
}
|
|
592
|
+
attached = true;
|
|
575
593
|
}
|
|
576
|
-
|
|
577
|
-
if (!
|
|
578
|
-
throw new Error("Prolog
|
|
594
|
+
const activeProlog = engine ?? prolog;
|
|
595
|
+
if (!activeProlog) {
|
|
596
|
+
throw new Error("Prolog runtime not initialized");
|
|
579
597
|
}
|
|
580
|
-
const activeProlog = prolog;
|
|
581
598
|
const rules = options.rules
|
|
582
599
|
?.split(",")
|
|
583
600
|
.map((rule) => rule.trim())
|
|
@@ -637,6 +654,7 @@ export async function checkCommand(options) {
|
|
|
637
654
|
return { exitCode: 1 };
|
|
638
655
|
}
|
|
639
656
|
finally {
|
|
657
|
+
await engine?.terminate();
|
|
640
658
|
await safeCleanupProlog(prolog);
|
|
641
659
|
}
|
|
642
660
|
}
|
|
@@ -5,6 +5,11 @@ interface CoverageOptions {
|
|
|
5
5
|
includeTransitive?: boolean;
|
|
6
6
|
limit?: string;
|
|
7
7
|
offset?: string;
|
|
8
|
+
includeMigrationPreview?: boolean;
|
|
9
|
+
migrationLimit?: string;
|
|
10
|
+
migrationOffset?: string;
|
|
11
|
+
migrationPredicateLimit?: string;
|
|
12
|
+
migrationPredicateMinScore?: string;
|
|
8
13
|
format?: "json" | "table";
|
|
9
14
|
}
|
|
10
15
|
export declare function coverageCommand(options: CoverageOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/commands/coverage.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/commands/coverage.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { coverageSpec } from "../public/operations/
|
|
1
|
+
import { coverageSpec } from "../public/operations/specs/reporting.js";
|
|
2
2
|
import { executeReportingSpec, printDiscoveryResult, } from "./discovery-shared.js";
|
|
3
3
|
// implements REQ-002, REQ-003
|
|
4
4
|
export async function coverageCommand(options) {
|
|
@@ -14,6 +14,11 @@ export async function coverageCommand(options) {
|
|
|
14
14
|
includeTransitive: options.includeTransitive ?? true,
|
|
15
15
|
limit: Number.parseInt(options.limit || "100", 10),
|
|
16
16
|
offset: Number.parseInt(options.offset || "0", 10),
|
|
17
|
+
includeMigrationPreview: options.includeMigrationPreview ?? false,
|
|
18
|
+
migrationLimit: Number.parseInt(options.migrationLimit || "1", 10),
|
|
19
|
+
migrationOffset: Number.parseInt(options.migrationOffset || "0", 10),
|
|
20
|
+
migrationPredicateLimit: Number.parseInt(options.migrationPredicateLimit || "5", 10),
|
|
21
|
+
migrationPredicateMinScore: Number.parseFloat(options.migrationPredicateMinScore || "0.35"),
|
|
17
22
|
});
|
|
18
23
|
printDiscoveryResult(options.format, result.structuredContent, result.content[0]?.text ?? "Coverage summary unavailable.");
|
|
19
24
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PrologProcess, resolveKbPlPath } from "../prolog.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type RuntimeOptions } from "../public/operations/runtime-types.js";
|
|
3
|
+
import type { OperationSpec } from "../public/operations/types.js";
|
|
3
4
|
export { renderCoverageTable } from "./discovery-table.js";
|
|
4
5
|
export interface DiscoveryCommandOptions {
|
|
5
6
|
format?: "json" | "table";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-shared.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery-shared.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,aAAa,CAAC;IAC3D,WAAW,EAAE,OAAO,eAAe,CAAC;CACrC;AAGD,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EACxD,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,cAAmB,6EAG7B;AAGD,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,EAC/C,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAsDZ;AAID,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAS5D;AAGD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CAGR;AAGD,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CAwBZ;AAGD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,EACpC,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,MAAM,GACnB,IAAI,CAQN"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { EngineClient } from "../engine.js";
|
|
2
3
|
import { getBranchOverride } from "../env.js";
|
|
3
4
|
import { PrologProcess, resolveKbPlPath } from "../prolog.js";
|
|
4
5
|
import { escapeAtom } from "../prolog/codec.js";
|
|
5
|
-
import { executeOperation, } from "../public/operations/
|
|
6
|
+
import { executeOperation, } from "../public/operations/runtime-types.js";
|
|
6
7
|
import { createCliRuntime } from "../runtime/cli-runtime.js";
|
|
7
8
|
import { safeCleanupProlog } from "../utils/prolog-cleanup.js";
|
|
8
9
|
import { renderDiscoveryTable } from "./discovery-table.js";
|
|
@@ -14,30 +15,51 @@ export async function executeReportingSpec(spec, input, options = {}) {
|
|
|
14
15
|
}
|
|
15
16
|
// implements REQ-003
|
|
16
17
|
export async function withAttachedBranchProlog(callback, deps) {
|
|
18
|
+
const usesEngine = deps?.createProlog === undefined;
|
|
17
19
|
const createProlog = deps?.createProlog ?? ((opts) => new PrologProcess(opts));
|
|
18
20
|
let prolog = null;
|
|
21
|
+
let engine = null;
|
|
19
22
|
let attached = false;
|
|
23
|
+
let branchName;
|
|
20
24
|
try {
|
|
21
|
-
prolog = createProlog({ timeout: 120000 });
|
|
22
|
-
await prolog.start();
|
|
23
|
-
await prolog.query("set_prolog_flag(answer_write_options, [max_depth(0), spacing(next_argument)])");
|
|
24
|
-
let branch;
|
|
25
25
|
try {
|
|
26
|
-
|
|
26
|
+
branchName =
|
|
27
|
+
getBranchOverride() || (await getCurrentBranch(process.cwd()));
|
|
27
28
|
}
|
|
28
29
|
catch {
|
|
29
|
-
|
|
30
|
+
branchName = getBranchOverride() || "main";
|
|
31
|
+
}
|
|
32
|
+
if (usesEngine) {
|
|
33
|
+
engine = new EngineClient({
|
|
34
|
+
workspaceRoot: process.cwd(),
|
|
35
|
+
branch: branchName,
|
|
36
|
+
timeout: 120_000,
|
|
37
|
+
});
|
|
38
|
+
await engine.start();
|
|
39
|
+
prolog = engine;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
prolog = createProlog({ timeout: 120000 });
|
|
43
|
+
await prolog.start();
|
|
30
44
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
await prolog.query("set_prolog_flag(answer_write_options, [max_depth(0), spacing(next_argument)])");
|
|
46
|
+
if (!usesEngine) {
|
|
47
|
+
const kbPath = path.join(process.cwd(), ".kb/branches", branchName);
|
|
48
|
+
const attachResult = await prolog.query(`kb_attach('${escapeAtom(kbPath)}')`);
|
|
49
|
+
if (!attachResult.success) {
|
|
50
|
+
throw new Error(`Failed to attach KB: ${attachResult.error || "Unknown error"}`);
|
|
51
|
+
}
|
|
52
|
+
attached = true;
|
|
35
53
|
}
|
|
36
|
-
attached = true;
|
|
37
54
|
return await callback(prolog);
|
|
38
55
|
}
|
|
39
56
|
finally {
|
|
40
|
-
|
|
57
|
+
if (usesEngine) {
|
|
58
|
+
await engine?.terminate();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
await safeCleanupProlog(prolog);
|
|
62
|
+
}
|
|
41
63
|
}
|
|
42
64
|
}
|
|
43
65
|
// implements REQ-003
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,
|
|
1
|
+
{"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,CA4ER"}
|
|
@@ -101,12 +101,14 @@ export function renderCoverageTable(payload) {
|
|
|
101
101
|
"Priority",
|
|
102
102
|
"Coverage",
|
|
103
103
|
"Depth",
|
|
104
|
+
"Proof",
|
|
104
105
|
"Scen",
|
|
105
106
|
"Tests",
|
|
106
107
|
"Symbols",
|
|
107
|
-
"
|
|
108
|
+
"Structural gaps",
|
|
109
|
+
"Proof gaps",
|
|
108
110
|
],
|
|
109
|
-
colWidths: [20, 12, 12, 18,
|
|
111
|
+
colWidths: [20, 12, 12, 18, 36, 12, 8, 8, 10, 24, 36],
|
|
110
112
|
wordWrap: true,
|
|
111
113
|
})
|
|
112
114
|
: new Table({
|
|
@@ -123,23 +125,112 @@ export function renderCoverageTable(payload) {
|
|
|
123
125
|
stringifyCell(item.priority),
|
|
124
126
|
stringifyCell(item.coverageStatus),
|
|
125
127
|
stringifyCell(item.coverageDepth),
|
|
128
|
+
stringifyCell(item.proofStatus),
|
|
126
129
|
stringifyCell(item.scenarioCount),
|
|
127
130
|
stringifyCell(item.testCount),
|
|
128
131
|
stringifyCell(item.transitiveSymbolCount),
|
|
129
132
|
joinCells(item.gaps),
|
|
133
|
+
joinCells(item.proofGaps),
|
|
130
134
|
]);
|
|
131
135
|
}
|
|
132
136
|
else {
|
|
133
137
|
table.push([
|
|
134
138
|
stringifyCell(item.id),
|
|
135
|
-
stringifyCell(item.type),
|
|
139
|
+
stringifyCell(item.traceabilityRole ?? item.type),
|
|
136
140
|
stringifyCell(item.coverageStatus),
|
|
137
|
-
`req=${stringifyCell(item.directRequirementCount)}
|
|
141
|
+
`req=${stringifyCell(item.directRequirementCount)} covered=${stringifyCell(item.testCount)} executable=${stringifyCell(item.executableTestCount)} count=${stringifyCell(item.count)}`,
|
|
138
142
|
joinCells(item.gaps),
|
|
139
143
|
]);
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
|
|
146
|
+
const sections = [summaryTable.toString(), table.toString()];
|
|
147
|
+
const repairPlan = fieldsFrom(payload.repairPlan);
|
|
148
|
+
if (typeof repairPlan.version === "string") {
|
|
149
|
+
sections.push(renderRepairPlanTable(repairPlan));
|
|
150
|
+
}
|
|
151
|
+
const legacyMigrationPlan = fieldsFrom(payload.legacyMigrationPlan);
|
|
152
|
+
if (typeof legacyMigrationPlan.version === "string") {
|
|
153
|
+
sections.push(renderLegacyMigrationPlanTable(legacyMigrationPlan));
|
|
154
|
+
}
|
|
155
|
+
return sections.join("\n\n");
|
|
156
|
+
}
|
|
157
|
+
function renderLegacyMigrationPlanTable(plan) {
|
|
158
|
+
const scope = fieldsFrom(plan.scope);
|
|
159
|
+
const summary = fieldsFrom(plan.summary);
|
|
160
|
+
const batches = Array.isArray(plan.batches) ? plan.batches : [];
|
|
161
|
+
const summaryTable = new Table({
|
|
162
|
+
head: ["Legacy migration preview", "Value"],
|
|
163
|
+
colWidths: [28, 72],
|
|
164
|
+
wordWrap: true,
|
|
165
|
+
});
|
|
166
|
+
summaryTable.push(["Plan ID", stringifyCell(plan.planId)], ["Status", stringifyCell(plan.status)], ["Repair scope complete", stringifyCell(scope.repairPlanComplete)], ["Candidate requirements", stringifyCell(scope.candidateRequirements)], ["Selected requirements", stringifyCell(scope.selectedRequirements)], ["Next offset", stringifyCell(scope.nextOffset)], ["Propositions", stringifyCell(summary.propositionCount)], ["Unresolved", stringifyCell(summary.unresolvedPropositionCount)]);
|
|
167
|
+
const batchTable = new Table({
|
|
168
|
+
head: [
|
|
169
|
+
"Requirement",
|
|
170
|
+
"State",
|
|
171
|
+
"Source binding",
|
|
172
|
+
"Claims",
|
|
173
|
+
"Predicate candidates",
|
|
174
|
+
"Diagnostics",
|
|
175
|
+
],
|
|
176
|
+
colWidths: [24, 18, 18, 10, 20, 46],
|
|
177
|
+
wordWrap: true,
|
|
178
|
+
});
|
|
179
|
+
for (const rawBatch of batches) {
|
|
180
|
+
const batch = fieldsFrom(rawBatch);
|
|
181
|
+
const sourceBinding = fieldsFrom(batch.sourceBinding);
|
|
182
|
+
const propositions = Array.isArray(batch.propositions)
|
|
183
|
+
? batch.propositions
|
|
184
|
+
: [];
|
|
185
|
+
const candidateCount = propositions.reduce((count, proposition) => {
|
|
186
|
+
const candidates = fieldsFrom(proposition).predicateCandidates;
|
|
187
|
+
return count + (Array.isArray(candidates) ? candidates.length : 0);
|
|
188
|
+
}, 0);
|
|
189
|
+
batchTable.push([
|
|
190
|
+
stringifyCell(batch.requirementId),
|
|
191
|
+
stringifyCell(batch.state),
|
|
192
|
+
stringifyCell(sourceBinding.status),
|
|
193
|
+
propositions.length,
|
|
194
|
+
candidateCount,
|
|
195
|
+
joinCells(batch.diagnostics),
|
|
196
|
+
]);
|
|
197
|
+
}
|
|
198
|
+
return [summaryTable.toString(), batchTable.toString()].join("\n\n");
|
|
199
|
+
}
|
|
200
|
+
function renderRepairPlanTable(repairPlan) {
|
|
201
|
+
const scope = fieldsFrom(repairPlan.scope);
|
|
202
|
+
const summary = fieldsFrom(repairPlan.summary);
|
|
203
|
+
const batches = Array.isArray(repairPlan.batches) ? repairPlan.batches : [];
|
|
204
|
+
const displayedBatches = batches.slice(0, 25);
|
|
205
|
+
const summaryTable = new Table({
|
|
206
|
+
head: ["Repair plan", "Value"],
|
|
207
|
+
colWidths: [24, 72],
|
|
208
|
+
wordWrap: true,
|
|
209
|
+
});
|
|
210
|
+
summaryTable.push(["Plan ID", stringifyCell(repairPlan.planId)], ["Status", stringifyCell(repairPlan.status)], ["Complete scope", stringifyCell(scope.complete)], ["Requirements", stringifyCell(summary.requirementCount)], ["Repairs", stringifyCell(summary.repairCount)], ["Batches", stringifyCell(summary.batchCount)]);
|
|
211
|
+
const batchTable = new Table({
|
|
212
|
+
head: ["Order", "Requirement", "Phase", "State", "Depends on", "Gaps"],
|
|
213
|
+
colWidths: [8, 24, 24, 10, 28, 32],
|
|
214
|
+
wordWrap: true,
|
|
215
|
+
});
|
|
216
|
+
for (const rawBatch of displayedBatches) {
|
|
217
|
+
const batch = fieldsFrom(rawBatch);
|
|
218
|
+
const repairs = Array.isArray(batch.repairs) ? batch.repairs : [];
|
|
219
|
+
batchTable.push([
|
|
220
|
+
stringifyCell(batch.order),
|
|
221
|
+
stringifyCell(batch.requirementId),
|
|
222
|
+
stringifyCell(batch.phase),
|
|
223
|
+
stringifyCell(batch.state),
|
|
224
|
+
joinCells(batch.dependsOn),
|
|
225
|
+
repairs
|
|
226
|
+
.map((repair) => stringifyCell(fieldsFrom(repair).gap))
|
|
227
|
+
.join(", ") || "-",
|
|
228
|
+
]);
|
|
229
|
+
}
|
|
230
|
+
const suffix = displayedBatches.length < batches.length
|
|
231
|
+
? `\nShowing ${displayedBatches.length} of ${batches.length} repair batches; use --format json for the complete plan.`
|
|
232
|
+
: "";
|
|
233
|
+
return [summaryTable.toString(), batchTable.toString()].join("\n\n") + suffix;
|
|
143
234
|
}
|
|
144
235
|
function renderGraphTable(payload) {
|
|
145
236
|
const nodes = Array.isArray(payload.nodes) ? payload.nodes : [];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function engineStatusCommand(): Promise<void>;
|
|
2
|
+
export declare function engineStopCommand(): Promise<void>;
|
|
3
|
+
export declare function storageStatusCommand(): Promise<void>;
|
|
4
|
+
export declare function storageCompactCommand(): Promise<void>;
|
|
5
|
+
export declare function storageExportCommand(options: {
|
|
6
|
+
output: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/commands/engine.ts"],"names":[],"mappings":"AAwCA,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,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3D;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
|