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,5 +1,5 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
|
-
import {
|
|
2
|
+
import type { OperationName } from "./public/operations/types.js";
|
|
3
3
|
export type JsonInvocation = {
|
|
4
4
|
readonly operationName: OperationName;
|
|
5
5
|
readonly inputPath: string;
|
|
@@ -10,5 +10,4 @@ export type JsonInvocation = {
|
|
|
10
10
|
}[];
|
|
11
11
|
};
|
|
12
12
|
export declare function runJsonInvocation(invocation: JsonInvocation): Promise<void>;
|
|
13
|
-
export declare function registerJsonOnlyCommands(program: Command): void;
|
|
14
13
|
//# sourceMappingURL=cli-json-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KACpC,EAAE,CAAC;CACL,CAAC;AA0CF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,IAAI,CAAC,CAyGf"}
|
package/dist/cli-json-command.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { InputError } from "./cli-errors.js";
|
|
2
2
|
import { loadInput } from "./cli-input.js";
|
|
3
|
+
import { loadOperationSpec } from "./cli-operation-loader.js";
|
|
3
4
|
import { executeOperation as executeProtocolOperation } from "./cli-protocol.js";
|
|
4
|
-
import {
|
|
5
|
+
import { prepareOperationInput } from "./cli-validate.js";
|
|
6
|
+
import { appendCliDiagnosticUsage } from "./public/diagnostic-usage.js";
|
|
5
7
|
import { createCliRuntime } from "./runtime/cli-runtime.js";
|
|
6
8
|
function writeInputError(error) {
|
|
7
9
|
process.stderr.write(`Error [${error.code}]: ${error.detail}\n`);
|
|
@@ -21,11 +23,42 @@ function findInputConflicts(invocation) {
|
|
|
21
23
|
.map(({ name }) => name);
|
|
22
24
|
return [...positionalConflicts, ...optionConflicts];
|
|
23
25
|
}
|
|
26
|
+
function diagnosticModeEnabled(command) {
|
|
27
|
+
return (process.env.KIBI_CLI_DIAGNOSTIC_MODE === "1" ||
|
|
28
|
+
process.argv.includes("--diagnostic-mode") ||
|
|
29
|
+
command.optsWithGlobals().diagnosticMode === true);
|
|
30
|
+
}
|
|
31
|
+
function structuredResult(stdout) {
|
|
32
|
+
if (stdout === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(stdout);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
24
41
|
// implements REQ-kibi-operation-interface-parity
|
|
25
42
|
export async function runJsonInvocation(invocation) {
|
|
43
|
+
const startedAt = new Date();
|
|
44
|
+
const diagnostic = diagnosticModeEnabled(invocation.command);
|
|
45
|
+
const workspaceRoot = process.cwd();
|
|
46
|
+
const spec = await loadOperationSpec(invocation.operationName);
|
|
26
47
|
const conflicts = findInputConflicts(invocation);
|
|
27
48
|
if (conflicts.length > 0) {
|
|
28
|
-
|
|
49
|
+
const error = new InputError("CONFLICTING_INPUT", `--input cannot be combined with: ${conflicts.join(", ")}`);
|
|
50
|
+
if (diagnostic) {
|
|
51
|
+
appendCliDiagnosticUsage({
|
|
52
|
+
workspaceRoot,
|
|
53
|
+
tool: invocation.operationName,
|
|
54
|
+
businessArgs: {},
|
|
55
|
+
telemetry: null,
|
|
56
|
+
startedAt,
|
|
57
|
+
status: "error",
|
|
58
|
+
error: error.detail,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
writeInputError(error);
|
|
29
62
|
return;
|
|
30
63
|
}
|
|
31
64
|
let input;
|
|
@@ -37,23 +70,66 @@ export async function runJsonInvocation(invocation) {
|
|
|
37
70
|
}
|
|
38
71
|
catch (error) {
|
|
39
72
|
if (error instanceof InputError) {
|
|
73
|
+
if (diagnostic) {
|
|
74
|
+
appendCliDiagnosticUsage({
|
|
75
|
+
workspaceRoot,
|
|
76
|
+
tool: invocation.operationName,
|
|
77
|
+
businessArgs: {},
|
|
78
|
+
telemetry: null,
|
|
79
|
+
startedAt,
|
|
80
|
+
status: "error",
|
|
81
|
+
error: error.detail,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
40
84
|
writeInputError(error);
|
|
41
85
|
return;
|
|
42
86
|
}
|
|
43
87
|
throw error;
|
|
44
88
|
}
|
|
45
|
-
const
|
|
46
|
-
const
|
|
89
|
+
const prepared = prepareOperationInput(input, spec.businessInputSchema);
|
|
90
|
+
const businessArgs = prepared.valid ? prepared.businessInput : {};
|
|
91
|
+
const telemetry = prepared.valid ? (prepared.telemetry ?? null) : null;
|
|
47
92
|
const runtime = createCliRuntime({ workspaceRoot });
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
await
|
|
93
|
+
let result;
|
|
94
|
+
try {
|
|
95
|
+
const context = await runtime.open(spec, { workspaceRoot });
|
|
96
|
+
result = await executeProtocolOperation(invocation.operationName, input, context);
|
|
97
|
+
if (result.exitCode === 0 && spec.effects.includes("kb-write")) {
|
|
98
|
+
await runtime.afterSuccess(spec, context);
|
|
99
|
+
}
|
|
100
|
+
await runtime.close(context, {
|
|
101
|
+
status: "success",
|
|
102
|
+
result,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (diagnostic) {
|
|
107
|
+
appendCliDiagnosticUsage({
|
|
108
|
+
workspaceRoot,
|
|
109
|
+
tool: invocation.operationName,
|
|
110
|
+
businessArgs,
|
|
111
|
+
telemetry,
|
|
112
|
+
startedAt,
|
|
113
|
+
status: "error",
|
|
114
|
+
error: error instanceof Error ? error.message : String(error),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
if (diagnostic) {
|
|
120
|
+
appendCliDiagnosticUsage({
|
|
121
|
+
workspaceRoot,
|
|
122
|
+
tool: invocation.operationName,
|
|
123
|
+
businessArgs,
|
|
124
|
+
telemetry,
|
|
125
|
+
startedAt,
|
|
126
|
+
status: result.exitCode === 0 ? "success" : "error",
|
|
127
|
+
result: structuredResult(result.stdout),
|
|
128
|
+
...(result.exitCode === 0 || result.stderr === undefined
|
|
129
|
+
? {}
|
|
130
|
+
: { error: result.stderr.trim() }),
|
|
131
|
+
});
|
|
52
132
|
}
|
|
53
|
-
await runtime.close(context, {
|
|
54
|
-
status: "success",
|
|
55
|
-
result,
|
|
56
|
-
});
|
|
57
133
|
if (result.stdout !== undefined) {
|
|
58
134
|
process.stdout.write(result.stdout);
|
|
59
135
|
}
|
|
@@ -62,35 +138,3 @@ export async function runJsonInvocation(invocation) {
|
|
|
62
138
|
}
|
|
63
139
|
process.exitCode = result.exitCode;
|
|
64
140
|
}
|
|
65
|
-
const INTEGRATED_OPERATIONS = new Set([
|
|
66
|
-
"kb_query",
|
|
67
|
-
"kb_search",
|
|
68
|
-
"kb_status",
|
|
69
|
-
"kb_find_gaps",
|
|
70
|
-
"kb_coverage",
|
|
71
|
-
"kb_graph",
|
|
72
|
-
"kb_check",
|
|
73
|
-
]);
|
|
74
|
-
// implements REQ-kibi-operation-interface-parity
|
|
75
|
-
export function registerJsonOnlyCommands(program) {
|
|
76
|
-
for (const spec of listSpecs()) {
|
|
77
|
-
if (INTEGRATED_OPERATIONS.has(spec.name)) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
program
|
|
81
|
-
.command(spec.cliName.replaceAll(" ", "-"))
|
|
82
|
-
.description(spec.description)
|
|
83
|
-
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
84
|
-
.action(async (options, command) => {
|
|
85
|
-
if (options.input === undefined) {
|
|
86
|
-
writeInputError(new InputError("MISSING_INPUT", "The --input option is required for this command."));
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
await runJsonInvocation({
|
|
90
|
-
operationName: spec.name,
|
|
91
|
-
inputPath: options.input,
|
|
92
|
-
command,
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-operation-loader.d.ts","sourceRoot":"","sources":["../src/cli-operation-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,8BAA8B,CAAC;AAOtC,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,aAAa,CAAC,CAoDxB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Load only the implementation selected by the client. Importing the public
|
|
2
|
+
// catalog remains useful for introspection and parity tests, but pulling every
|
|
3
|
+
// operation into each short-lived CLI process makes test and shell startup pay
|
|
4
|
+
// for unrelated commands.
|
|
5
|
+
// implements REQ-test-journaled-engine-harness
|
|
6
|
+
export async function loadOperationSpec(name) {
|
|
7
|
+
switch (name) {
|
|
8
|
+
case "kb_skills_list":
|
|
9
|
+
return (await import("./public/operations/specs/skills.js"))
|
|
10
|
+
.skillsListSpec;
|
|
11
|
+
case "kb_skills_load":
|
|
12
|
+
return (await import("./public/operations/specs/skills.js"))
|
|
13
|
+
.skillsLoadSpec;
|
|
14
|
+
case "kb_skills_read":
|
|
15
|
+
return (await import("./public/operations/specs/skills.js"))
|
|
16
|
+
.skillsReadSpec;
|
|
17
|
+
case "kb_query":
|
|
18
|
+
return (await import("./public/operations/specs/discovery.js")).querySpec;
|
|
19
|
+
case "kb_search":
|
|
20
|
+
return (await import("./public/operations/specs/discovery.js"))
|
|
21
|
+
.searchSpec;
|
|
22
|
+
case "kb_status":
|
|
23
|
+
return (await import("./public/operations/specs/discovery.js"))
|
|
24
|
+
.statusSpec;
|
|
25
|
+
case "kb_find_gaps":
|
|
26
|
+
return (await import("./public/operations/specs/reporting.js"))
|
|
27
|
+
.findGapsSpec;
|
|
28
|
+
case "kb_coverage":
|
|
29
|
+
return (await import("./public/operations/specs/reporting.js"))
|
|
30
|
+
.coverageSpec;
|
|
31
|
+
case "kb_graph":
|
|
32
|
+
return (await import("./public/operations/specs/reporting.js")).graphSpec;
|
|
33
|
+
case "kb_sparql_remote":
|
|
34
|
+
return (await import("./public/operations/specs/sparql.js"))
|
|
35
|
+
.sparqlRemoteSpec;
|
|
36
|
+
case "kb_semantic_advisor":
|
|
37
|
+
return (await import("./public/operations/specs/semantic.js"))
|
|
38
|
+
.semanticAdvisorSpec;
|
|
39
|
+
case "kb_model_requirement":
|
|
40
|
+
return (await import("./public/operations/specs/modeling.js"))
|
|
41
|
+
.modelRequirementSpec;
|
|
42
|
+
case "kb_suggest_predicates":
|
|
43
|
+
return (await import("./public/operations/specs/modeling.js"))
|
|
44
|
+
.suggestPredicatesSpec;
|
|
45
|
+
case "kb_autopilot_generate":
|
|
46
|
+
return (await import("./public/operations/specs/autopilot.js"))
|
|
47
|
+
.autopilotGenerateSpec;
|
|
48
|
+
case "kb_validate_upsert":
|
|
49
|
+
return (await import("./public/operations/specs/mutation.js"))
|
|
50
|
+
.validateUpsertSpec;
|
|
51
|
+
case "kb_upsert":
|
|
52
|
+
return (await import("./public/operations/specs/upsert.js")).upsertSpec;
|
|
53
|
+
case "kb_delete":
|
|
54
|
+
return (await import("./public/operations/specs/mutation.js")).deleteSpec;
|
|
55
|
+
case "kb_check":
|
|
56
|
+
return (await import("./public/operations/specs/check.js")).checkSpec;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { OperationName } from "./public/operations/types.js";
|
|
2
|
+
export type CliOperationMetadata = {
|
|
3
|
+
readonly name: OperationName;
|
|
4
|
+
readonly cliName: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const CLI_OPERATION_METADATA: readonly [{
|
|
8
|
+
readonly name: "kb_skills_list";
|
|
9
|
+
readonly cliName: "skills list";
|
|
10
|
+
readonly description: "List bundled Kibi agent skills available for progressive disclosure. Read-only; does not mutate the KB or require Prolog.";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "kb_skills_load";
|
|
13
|
+
readonly cliName: "skills load";
|
|
14
|
+
readonly description: "Load a bundled Kibi agent skill by ID, returning its manifest metadata, Markdown body, declared resources, content hash, and source type. Read-only; does not execute scripts or require Prolog.";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "kb_skills_read";
|
|
17
|
+
readonly cliName: "skills read";
|
|
18
|
+
readonly description: "Read a declared resource from a bundled Kibi agent skill. Resource paths are restricted to the skill manifest; arbitrary file paths are not exposed. Read-only; does not require Prolog.";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "kb_query";
|
|
21
|
+
readonly cliName: "query";
|
|
22
|
+
readonly description: "Read entities from the KB with filters. Use for discovery and lookup before edits. Do not use for writes. No mutation side effects. Tags filter by metadata tags only, not entity IDs.";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "kb_search";
|
|
25
|
+
readonly cliName: "search";
|
|
26
|
+
readonly description: "Search KB entities for discovery using metadata and markdown body text. Use for exploratory lookup before exact follow-up with kb_query. No mutation side effects.";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "kb_status";
|
|
29
|
+
readonly cliName: "status";
|
|
30
|
+
readonly description: "Report current branch, KB snapshot and freshness metadata, plus the deterministic workspace snapshot used to validate execution receipts. Read-only status inspection with no mutation side effects.";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "kb_find_gaps";
|
|
33
|
+
readonly cliName: "find-gaps";
|
|
34
|
+
readonly description: "Run bulk missing/present relationship analysis over KB entities. Use for questions like which requirements lack scenarios or tests. No mutation side effects.";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "kb_coverage";
|
|
37
|
+
readonly cliName: "coverage";
|
|
38
|
+
readonly description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Requirement reports include a deterministic, dependency-ordered, read-only repair plan; optional legacy migration previews reconstruct authored proposition inventories and rank exact schema candidates without producing executable writes. Paginated plans identify incomplete scope. Requirement rows keep coverageStatus separate from proofStatus and require fresh snapshot-bound E2E receipts before proof. No mutation side effects.";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "kb_graph";
|
|
41
|
+
readonly cliName: "graph";
|
|
42
|
+
readonly description: "Run bounded graph traversal from one or more seed IDs across curated relationship types. No mutation side effects.";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "kb_semantic_advisor";
|
|
45
|
+
readonly cliName: "semantic-advisor";
|
|
46
|
+
readonly description: "Analyze requirement prose without mutating the KB and return semantic advisor receipts with modeling suggestions. Use before constructing kb_upsert payloads when prose may contain machine-checkable logic. Suggestions can include strict-property facts, predicate facts, ambiguity observations, or ontology-gap observations; all suggestions are advisory and reviewable.";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "kb_model_requirement";
|
|
49
|
+
readonly cliName: "model-requirement";
|
|
50
|
+
readonly description: "Convert a prose requirement plus optional extracted claim fields into a deterministic strict-lane write set. Read-only modeling returns a sequential applyPlan for later kb_upsert calls. High-confidence claims emit req+fact strict output; lower-confidence claims emit an observation review artifact. Includes migration warnings when legacy schemaVersion metadata is detected.";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "kb_suggest_predicates";
|
|
53
|
+
readonly cliName: "suggest-predicates";
|
|
54
|
+
readonly description: "Suggest ontology predicate schemas for prose requirements before agents write facts. Read-only guidance returns ranked candidates, an applicable predicate-fact plan only when every ordered argument is bound, a separate requires_predicate relationship plan when a requirement ID is supplied, or an explicit ontology-gap observation when no predicate fits.";
|
|
55
|
+
}, {
|
|
56
|
+
readonly name: "kb_autopilot_generate";
|
|
57
|
+
readonly cliName: "autopilot-generate";
|
|
58
|
+
readonly description: "Generate agent-centric bootstrap output for KB population. Read-only analysis that returns activation state, bootstrap guidance, candidate entities with evidence, payoff summary, and exact applyPlan payloads for later kb_upsert calls. No mutation side effects.";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "kb_validate_upsert";
|
|
61
|
+
readonly cliName: "validate-upsert";
|
|
62
|
+
readonly description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing kb_model_requirement, kb_suggest_predicates, ambiguity review, or an ontology-gap observation.";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "kb_upsert";
|
|
65
|
+
readonly cliName: "upsert";
|
|
66
|
+
readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer kb_validate_upsert first because it returns semantic advisor receipts for prose-heavy requirements. Use kb_model_requirement before hand-writing strict property facts from prose, and kb_suggest_predicates before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request. Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates.";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "kb_delete";
|
|
69
|
+
readonly cliName: "delete";
|
|
70
|
+
readonly description: "Delete entities by ID. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. Side effects: mutates and saves KB; skips entities with dependents.";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "kb_check";
|
|
73
|
+
readonly cliName: "check";
|
|
74
|
+
readonly description: "Run KB validation rules and return violations. Use before or after mutations, and after meaningful source edits with impact options to surface symbol granularity and semantic-review diagnostics. Do not use for point lookups. No write side effects. Prefer explicit rules for faster iteration; omit rules for final full validation plus full-KB qualityDiagnostics review, including telemetry acceptance when .kb/usage.log exists.";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "kb_sparql_remote";
|
|
77
|
+
readonly cliName: "sparql-remote";
|
|
78
|
+
readonly description: "Opt-in remote SPARQL query tool for external HTTP(S) RDF endpoints. This does not query Kibi's local RDF store directly, stores no credentials, and depends on network availability.";
|
|
79
|
+
}];
|
|
80
|
+
export declare function getCliOperationMetadata(name: OperationName): CliOperationMetadata;
|
|
81
|
+
export declare function isOperationName(name: string): name is OperationName;
|
|
82
|
+
//# sourceMappingURL=cli-operation-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-operation-metadata.d.ts","sourceRoot":"","sources":["../src/cli-operation-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6GiB,CAAC;AAMrD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,aAAa,GAClB,oBAAoB,CAMtB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,aAAa,CAEnE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Keep CLI registration lightweight. The parity test compares this projection
|
|
2
|
+
// against the authoritative operation catalog so schema metadata cannot drift.
|
|
3
|
+
// implements REQ-test-journaled-engine-harness
|
|
4
|
+
export const CLI_OPERATION_METADATA = [
|
|
5
|
+
{
|
|
6
|
+
name: "kb_skills_list",
|
|
7
|
+
cliName: "skills list",
|
|
8
|
+
description: "List bundled Kibi agent skills available for progressive disclosure. Read-only; does not mutate the KB or require Prolog.",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: "kb_skills_load",
|
|
12
|
+
cliName: "skills load",
|
|
13
|
+
description: "Load a bundled Kibi agent skill by ID, returning its manifest metadata, Markdown body, declared resources, content hash, and source type. Read-only; does not execute scripts or require Prolog.",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "kb_skills_read",
|
|
17
|
+
cliName: "skills read",
|
|
18
|
+
description: "Read a declared resource from a bundled Kibi agent skill. Resource paths are restricted to the skill manifest; arbitrary file paths are not exposed. Read-only; does not require Prolog.",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "kb_query",
|
|
22
|
+
cliName: "query",
|
|
23
|
+
description: "Read entities from the KB with filters. Use for discovery and lookup before edits. Do not use for writes. No mutation side effects. Tags filter by metadata tags only, not entity IDs.",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "kb_search",
|
|
27
|
+
cliName: "search",
|
|
28
|
+
description: "Search KB entities for discovery using metadata and markdown body text. Use for exploratory lookup before exact follow-up with kb_query. No mutation side effects.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "kb_status",
|
|
32
|
+
cliName: "status",
|
|
33
|
+
description: "Report current branch, KB snapshot and freshness metadata, plus the deterministic workspace snapshot used to validate execution receipts. Read-only status inspection with no mutation side effects.",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "kb_find_gaps",
|
|
37
|
+
cliName: "find-gaps",
|
|
38
|
+
description: "Run bulk missing/present relationship analysis over KB entities. Use for questions like which requirements lack scenarios or tests. No mutation side effects.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "kb_coverage",
|
|
42
|
+
cliName: "coverage",
|
|
43
|
+
description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Requirement reports include a deterministic, dependency-ordered, read-only repair plan; optional legacy migration previews reconstruct authored proposition inventories and rank exact schema candidates without producing executable writes. Paginated plans identify incomplete scope. Requirement rows keep coverageStatus separate from proofStatus and require fresh snapshot-bound E2E receipts before proof. No mutation side effects.",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "kb_graph",
|
|
47
|
+
cliName: "graph",
|
|
48
|
+
description: "Run bounded graph traversal from one or more seed IDs across curated relationship types. No mutation side effects.",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "kb_semantic_advisor",
|
|
52
|
+
cliName: "semantic-advisor",
|
|
53
|
+
description: "Analyze requirement prose without mutating the KB and return semantic advisor receipts with modeling suggestions. Use before constructing kb_upsert payloads when prose may contain machine-checkable logic. Suggestions can include strict-property facts, predicate facts, ambiguity observations, or ontology-gap observations; all suggestions are advisory and reviewable.",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "kb_model_requirement",
|
|
57
|
+
cliName: "model-requirement",
|
|
58
|
+
description: "Convert a prose requirement plus optional extracted claim fields into a deterministic strict-lane write set. Read-only modeling returns a sequential applyPlan for later kb_upsert calls. High-confidence claims emit req+fact strict output; lower-confidence claims emit an observation review artifact. Includes migration warnings when legacy schemaVersion metadata is detected.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "kb_suggest_predicates",
|
|
62
|
+
cliName: "suggest-predicates",
|
|
63
|
+
description: "Suggest ontology predicate schemas for prose requirements before agents write facts. Read-only guidance returns ranked candidates, an applicable predicate-fact plan only when every ordered argument is bound, a separate requires_predicate relationship plan when a requirement ID is supplied, or an explicit ontology-gap observation when no predicate fits.",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "kb_autopilot_generate",
|
|
67
|
+
cliName: "autopilot-generate",
|
|
68
|
+
description: "Generate agent-centric bootstrap output for KB population. Read-only analysis that returns activation state, bootstrap guidance, candidate entities with evidence, payoff summary, and exact applyPlan payloads for later kb_upsert calls. No mutation side effects.",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "kb_validate_upsert",
|
|
72
|
+
cliName: "validate-upsert",
|
|
73
|
+
description: "Validate a kb_upsert payload without mutating the KB. Use this read-only preflight before kb_upsert, especially for requirements, because it returns schema/modeling errors plus semantic advisor receipts that identify prose likely needing kb_model_requirement, kb_suggest_predicates, ambiguity review, or an ontology-gap observation.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "kb_upsert",
|
|
77
|
+
cliName: "upsert",
|
|
78
|
+
description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer kb_validate_upsert first because it returns semantic advisor receipts for prose-heavy requirements. Use kb_model_requirement before hand-writing strict property facts from prose, and kb_suggest_predicates before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request. Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "kb_delete",
|
|
82
|
+
cliName: "delete",
|
|
83
|
+
description: "Delete entities by ID. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. Side effects: mutates and saves KB; skips entities with dependents.",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "kb_check",
|
|
87
|
+
cliName: "check",
|
|
88
|
+
description: "Run KB validation rules and return violations. Use before or after mutations, and after meaningful source edits with impact options to surface symbol granularity and semantic-review diagnostics. Do not use for point lookups. No write side effects. Prefer explicit rules for faster iteration; omit rules for final full validation plus full-KB qualityDiagnostics review, including telemetry acceptance when .kb/usage.log exists.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "kb_sparql_remote",
|
|
92
|
+
cliName: "sparql-remote",
|
|
93
|
+
description: "Opt-in remote SPARQL query tool for external HTTP(S) RDF endpoints. This does not query Kibi's local RDF store directly, stores no credentials, and depends on network availability.",
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
const METADATA_BY_NAME = new Map(CLI_OPERATION_METADATA.map((metadata) => [metadata.name, metadata]));
|
|
97
|
+
export function getCliOperationMetadata(name) {
|
|
98
|
+
const metadata = METADATA_BY_NAME.get(name);
|
|
99
|
+
if (metadata === undefined) {
|
|
100
|
+
throw new RangeError(`Unknown Kibi CLI operation: ${name}`);
|
|
101
|
+
}
|
|
102
|
+
return metadata;
|
|
103
|
+
}
|
|
104
|
+
export function isOperationName(name) {
|
|
105
|
+
return METADATA_BY_NAME.has(name);
|
|
106
|
+
}
|
package/dist/cli-protocol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DiagnosticTelemetry } from "./cli-validate.js";
|
|
2
|
-
import type { OperationContext } from "./public/operations/
|
|
2
|
+
import type { OperationContext } from "./public/operations/runtime-types.js";
|
|
3
3
|
export type CliContext = OperationContext & {
|
|
4
4
|
readonly diagnosticTelemetry?: DiagnosticTelemetry;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-protocol.d.ts","sourceRoot":"","sources":["../src/cli-protocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-protocol.d.ts","sourceRoot":"","sources":["../src/cli-protocol.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG;IAC1C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CACpD,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAUF,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAoC5B"}
|
package/dist/cli-protocol.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputError, OperationError } from "./cli-errors.js";
|
|
2
|
+
import { loadOperationSpec } from "./cli-operation-loader.js";
|
|
3
|
+
import { isOperationName } from "./cli-operation-metadata.js";
|
|
2
4
|
import { prepareOperationInput, } from "./cli-validate.js";
|
|
3
|
-
import { listSpecs } from "./public/operations/index.js";
|
|
4
5
|
function errorResult(error) {
|
|
5
6
|
return {
|
|
6
7
|
exitCode: error.exitCode,
|
|
@@ -9,10 +10,10 @@ function errorResult(error) {
|
|
|
9
10
|
}
|
|
10
11
|
// implements REQ-kibi-operation-interface-parity
|
|
11
12
|
export async function executeOperation(catalogName, input, context) {
|
|
12
|
-
|
|
13
|
-
if (spec === undefined) {
|
|
13
|
+
if (!isOperationName(catalogName)) {
|
|
14
14
|
return errorResult(new InputError("UNKNOWN_OPERATION", `Unknown operation '${catalogName}'.`));
|
|
15
15
|
}
|
|
16
|
+
const spec = await loadOperationSpec(catalogName);
|
|
16
17
|
const prepared = prepareOperationInput(input, spec.businessInputSchema);
|
|
17
18
|
if (!prepared.valid) {
|
|
18
19
|
return errorResult(new InputError("VALIDATION_FAILED", prepared.errors.join("; ")));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-foundation.d.ts","sourceRoot":"","sources":["../src/cli-register-foundation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-register-foundation.d.ts","sourceRoot":"","sources":["../src/cli-register-foundation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuHjE"}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import { withExitCode } from "./cli-command.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { statusCommand } from "./commands/status.js";
|
|
8
|
-
import { syncCommand } from "./commands/sync.js";
|
|
9
|
-
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
|
+
}
|
|
10
7
|
// implements REQ-kibi-operation-interface-parity
|
|
11
8
|
export function registerFoundationCommands(program) {
|
|
12
9
|
program
|
|
13
10
|
.command("init")
|
|
14
11
|
.description("Initialize .kb/ directory")
|
|
15
12
|
.option("--no-hooks", "Do not install git hooks (hooks installed by default)")
|
|
16
|
-
.action(withExitCode(async (options) => initCommand(options)));
|
|
13
|
+
.action(withExitCode(async (options) => (await import("./commands/init.js")).initCommand(options)));
|
|
17
14
|
program
|
|
18
15
|
.command("migrate")
|
|
19
16
|
.description("Migrate .kb/config.json to the latest schema version")
|
|
20
17
|
.option("--dry-run", "Preview migration changes without writing files")
|
|
21
18
|
.option("--yes", "Apply migration changes without prompting")
|
|
22
|
-
.action(withExitCode(async (options) => migrateCommand(options)));
|
|
19
|
+
.action(withExitCode(async (options) => (await import("./commands/migrate.js")).migrateCommand(options)));
|
|
23
20
|
program
|
|
24
21
|
.command("sync")
|
|
25
22
|
.description("Sync entities from documents")
|
|
26
23
|
.option("--validate-only", "Perform validation without mutations")
|
|
27
24
|
.option("--refresh-symbol-coordinates", "Refresh generated symbol coordinates")
|
|
28
25
|
.option("--rebuild", "Rebuild branch snapshot from scratch (discards current KB)")
|
|
29
|
-
.action(withExitCode(async (options) => syncCommand(options)));
|
|
26
|
+
.action(withExitCode(async (options) => (await import("./commands/sync.js")).syncCommand(options)));
|
|
30
27
|
program
|
|
31
28
|
.command("query [type]")
|
|
32
29
|
.alias("kb-query")
|
|
33
|
-
.description(
|
|
30
|
+
.description(getCliOperationMetadata("kb_query").description)
|
|
34
31
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
35
32
|
.option("--id <id>", "Query specific entity by ID")
|
|
36
33
|
.option("--tag <tag>", "Filter by tag")
|
|
@@ -49,11 +46,11 @@ export function registerFoundationCommands(program) {
|
|
|
49
46
|
});
|
|
50
47
|
return undefined;
|
|
51
48
|
}
|
|
52
|
-
return queryCommand(type, options);
|
|
49
|
+
return (await import("./commands/query.js")).queryCommand(type, options);
|
|
53
50
|
}));
|
|
54
51
|
program
|
|
55
52
|
.command("search [query]")
|
|
56
|
-
.description(
|
|
53
|
+
.description(getCliOperationMetadata("kb_search").description)
|
|
57
54
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
58
55
|
.option("--type <type>", "Filter by entity type")
|
|
59
56
|
.option("--format <format>", "Output format: json|table", "table")
|
|
@@ -69,11 +66,11 @@ export function registerFoundationCommands(program) {
|
|
|
69
66
|
});
|
|
70
67
|
return;
|
|
71
68
|
}
|
|
72
|
-
await searchCommand(query, options);
|
|
69
|
+
await (await import("./commands/search.js")).searchCommand(query, options);
|
|
73
70
|
});
|
|
74
71
|
program
|
|
75
72
|
.command("status")
|
|
76
|
-
.description(
|
|
73
|
+
.description(getCliOperationMetadata("kb_status").description)
|
|
77
74
|
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
78
75
|
.option("--format <format>", "Output format: json|table", "table")
|
|
79
76
|
.action(async (options, command) => {
|
|
@@ -85,6 +82,6 @@ export function registerFoundationCommands(program) {
|
|
|
85
82
|
});
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
88
|
-
await statusCommand(options);
|
|
85
|
+
await (await import("./commands/status.js")).statusCommand(options);
|
|
89
86
|
});
|
|
90
87
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-register-json.d.ts","sourceRoot":"","sources":["../src/cli-register-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuB/D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CLI_OPERATION_METADATA } from "./cli-operation-metadata.js";
|
|
2
|
+
const INTEGRATED_OPERATIONS = new Set([
|
|
3
|
+
"kb_query",
|
|
4
|
+
"kb_search",
|
|
5
|
+
"kb_status",
|
|
6
|
+
"kb_find_gaps",
|
|
7
|
+
"kb_coverage",
|
|
8
|
+
"kb_graph",
|
|
9
|
+
"kb_check",
|
|
10
|
+
]);
|
|
11
|
+
// implements REQ-kibi-operation-interface-parity
|
|
12
|
+
// implements REQ-test-journaled-engine-harness
|
|
13
|
+
export function registerJsonOnlyCommands(program) {
|
|
14
|
+
for (const metadata of CLI_OPERATION_METADATA) {
|
|
15
|
+
if (INTEGRATED_OPERATIONS.has(metadata.name))
|
|
16
|
+
continue;
|
|
17
|
+
program
|
|
18
|
+
.command(metadata.cliName.replaceAll(" ", "-"))
|
|
19
|
+
.description(metadata.description)
|
|
20
|
+
.option("--input <path>", "JSON input file (use - for stdin)")
|
|
21
|
+
.action(async (options, command) => {
|
|
22
|
+
if (options.input === undefined) {
|
|
23
|
+
process.stderr.write("Error [MISSING_INPUT]: The --input option is required for this command.\n");
|
|
24
|
+
process.exitCode = 2;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const { runJsonInvocation } = await import("./cli-json-command.js");
|
|
28
|
+
await runJsonInvocation({
|
|
29
|
+
operationName: metadata.name,
|
|
30
|
+
inputPath: options.input,
|
|
31
|
+
command,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-register-maintenance.d.ts","sourceRoot":"","sources":["../src/cli-register-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-register-maintenance.d.ts","sourceRoot":"","sources":["../src/cli-register-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0GlE"}
|