kibi-cli 2.18.0 → 2.20.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-operation-metadata.d.ts +2 -2
- package/dist/cli-operation-metadata.js +2 -2
- package/dist/cli-register-maintenance.js +1 -1
- package/dist/commands/doctor.js +11 -5
- package/dist/commands/engine.d.ts +2 -1
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +6 -1
- package/dist/commands/sync/manifest.d.ts +10 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +27 -0
- package/dist/commands/sync/untracked-targets.d.ts +17 -0
- package/dist/commands/sync/untracked-targets.d.ts.map +1 -1
- package/dist/commands/sync/untracked-targets.js +43 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +51 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +33 -22
- package/dist/intent-search.d.ts +7 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +66 -4
- package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applicability.js +10 -4
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +16 -5
- package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-4.js +3 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-inference-1.js +34 -7
- package/dist/operations/modeling/predicate-score-3.js +1 -1
- package/dist/operations/modeling/predicate-types.d.ts +6 -0
- 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 +111 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +5 -12
- package/dist/operations/mutation/types.d.ts +26 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +8 -2
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +116 -4
- package/dist/operations/mutation/warnings.d.ts +10 -0
- package/dist/operations/mutation/warnings.d.ts.map +1 -1
- package/dist/operations/mutation/warnings.js +26 -0
- package/dist/operations/mutation/what-if.d.ts +25 -0
- package/dist/operations/mutation/what-if.d.ts.map +1 -0
- package/dist/operations/mutation/what-if.js +59 -0
- package/dist/operations/planning/compile-intent.d.ts +15 -20
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +64 -53
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +8 -7
- package/dist/prolog/janitor.d.ts +26 -2
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +55 -3
- package/dist/prolog/store-lock.d.ts +47 -3
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/prolog/store-lock.js +148 -11
- package/dist/proof/inspect.d.ts +1 -1
- package/dist/proof/inspect.d.ts.map +1 -1
- package/dist/proof/inspect.js +9 -2
- package/dist/public/operations/catalog.d.ts +97 -4
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts +2 -2
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +35 -0
- package/dist/public/operations/check-format-shared.d.ts +16 -0
- package/dist/public/operations/check-format-shared.d.ts.map +1 -1
- package/dist/public/operations/check-format-shared.js +19 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +11 -4
- package/dist/public/operations/discovery-executors.d.ts +39 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +368 -3
- package/dist/public/operations/specs/composite.d.ts +1 -1
- package/dist/public/operations/specs/composite.js +1 -1
- package/dist/public/operations/specs/discovery.d.ts +52 -3
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +58 -3
- package/dist/public/operations/specs/upsert.d.ts +44 -0
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +14 -0
- package/dist/public/skills/kibi-usage/SKILL.md +44 -1
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -2
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +7 -2
- package/dist/search-answer.d.ts +25 -3
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +96 -8
- package/dist/utils/branch-store.d.ts.map +1 -1
- package/dist/utils/branch-store.js +4 -2
- package/dist/utils/content-freshness.d.ts.map +1 -1
- package/dist/utils/content-freshness.js +12 -2
- package/dist/utils/symbol-manifest-layout.d.ts +9 -0
- package/dist/utils/symbol-manifest-layout.d.ts.map +1 -0
- package/dist/utils/symbol-manifest-layout.js +18 -0
- package/package.json +3 -3
- package/src/public/operations/check-executor.ts +44 -1
- package/src/public/operations/check-format-shared.ts +35 -1
- package/src/public/operations/contracts.ts +15 -4
- package/src/public/operations/discovery-executors.ts +484 -2
- package/src/public/operations/specs/composite.ts +1 -1
- package/src/public/operations/specs/discovery.ts +70 -3
- package/src/public/operations/specs/upsert.ts +15 -0
- package/src/public/skills/kibi-usage/SKILL.md +44 -1
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -2
|
@@ -26,6 +26,7 @@ import type { Violation } from "../check-types.js";
|
|
|
26
26
|
import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
|
|
27
27
|
import {
|
|
28
28
|
type CheckDiagnostic,
|
|
29
|
+
type CheckEvaluated,
|
|
29
30
|
type CheckStructuredContent,
|
|
30
31
|
buildStructuredContent,
|
|
31
32
|
buildSummary,
|
|
@@ -70,7 +71,7 @@ export type CheckInput = {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
export type CheckPayload = CheckStructuredContent;
|
|
73
|
-
export type { CheckDiagnostic, CheckStructuredContent };
|
|
74
|
+
export type { CheckDiagnostic, CheckEvaluated, CheckStructuredContent };
|
|
74
75
|
export {
|
|
75
76
|
buildStructuredContent,
|
|
76
77
|
buildSummary,
|
|
@@ -90,6 +91,38 @@ export type CheckExecutionOptions = {
|
|
|
90
91
|
readonly branchStoreAttached?: boolean;
|
|
91
92
|
};
|
|
92
93
|
|
|
94
|
+
// implements REQ-search-answer-hygiene
|
|
95
|
+
/**
|
|
96
|
+
* What this run evaluated: the rules that ran, in registry order, and for
|
|
97
|
+
* `domain-contradictions` the number of requirement fact pairs the rule
|
|
98
|
+
* compared, read from the engine after the rules ran on the same store. A
|
|
99
|
+
* count the engine cannot give (an older engine) is left out rather than
|
|
100
|
+
* reported as zero.
|
|
101
|
+
*/
|
|
102
|
+
async function describeEvaluation(
|
|
103
|
+
prolog: PrologPort,
|
|
104
|
+
rules: ReadonlySet<string>,
|
|
105
|
+
): Promise<CheckEvaluated> {
|
|
106
|
+
const evaluated: {
|
|
107
|
+
rules: string[];
|
|
108
|
+
domainContradictions?: { factPairsExamined: number };
|
|
109
|
+
} = {
|
|
110
|
+
rules: [...rules],
|
|
111
|
+
};
|
|
112
|
+
if (!rules.has("domain-contradictions")) return evaluated;
|
|
113
|
+
try {
|
|
114
|
+
const result = await prolog.query(
|
|
115
|
+
"kb_domain_contradiction_pairs_examined(Count)",
|
|
116
|
+
);
|
|
117
|
+
const count = Number(result.bindings.Count);
|
|
118
|
+
if (result.success && Number.isInteger(count) && count >= 0)
|
|
119
|
+
evaluated.domainContradictions = { factPairsExamined: count };
|
|
120
|
+
} catch {
|
|
121
|
+
// An engine without the predicate leaves the count out.
|
|
122
|
+
}
|
|
123
|
+
return evaluated;
|
|
124
|
+
}
|
|
125
|
+
|
|
93
126
|
function requireProlog(context: OperationContext): PrologPort {
|
|
94
127
|
if (context.prolog === undefined) {
|
|
95
128
|
throw new Error("Check operation requires a Prolog runtime");
|
|
@@ -226,12 +259,15 @@ export async function executeCheck(
|
|
|
226
259
|
[],
|
|
227
260
|
statusPlan,
|
|
228
261
|
);
|
|
262
|
+
// Every store-backed rule was skipped: only this one was evaluated.
|
|
263
|
+
const evaluated = { rules: [BRANCH_STORE_NOT_COMPILED_RULE] };
|
|
229
264
|
return {
|
|
230
265
|
content: [
|
|
231
266
|
{
|
|
232
267
|
type: "text",
|
|
233
268
|
text: buildSummary({
|
|
234
269
|
violations,
|
|
270
|
+
evaluated,
|
|
235
271
|
impactResult,
|
|
236
272
|
qualityDiagnostics: [],
|
|
237
273
|
}),
|
|
@@ -239,6 +275,7 @@ export async function executeCheck(
|
|
|
239
275
|
],
|
|
240
276
|
structuredContent: buildStructuredContent({
|
|
241
277
|
violations,
|
|
278
|
+
evaluated,
|
|
242
279
|
diagnostics: [
|
|
243
280
|
{
|
|
244
281
|
category: "SYNC_ERROR",
|
|
@@ -283,12 +320,14 @@ export async function executeCheck(
|
|
|
283
320
|
>[],
|
|
284
321
|
statusPlan,
|
|
285
322
|
);
|
|
323
|
+
const evaluated = { rules: [] };
|
|
286
324
|
return {
|
|
287
325
|
content: [
|
|
288
326
|
{
|
|
289
327
|
type: "text",
|
|
290
328
|
text: buildSummary({
|
|
291
329
|
violations: [],
|
|
330
|
+
evaluated,
|
|
292
331
|
impactResult,
|
|
293
332
|
qualityDiagnostics,
|
|
294
333
|
}),
|
|
@@ -296,6 +335,7 @@ export async function executeCheck(
|
|
|
296
335
|
],
|
|
297
336
|
structuredContent: buildStructuredContent({
|
|
298
337
|
violations: [],
|
|
338
|
+
evaluated,
|
|
299
339
|
diagnostics: [],
|
|
300
340
|
qualityDiagnostics,
|
|
301
341
|
impactResult,
|
|
@@ -351,6 +391,7 @@ export async function executeCheck(
|
|
|
351
391
|
...checkPolicyFindings,
|
|
352
392
|
]);
|
|
353
393
|
const violations: Violation[] = partitioned.violations;
|
|
394
|
+
const evaluated = await describeEvaluation(prolog, rulesAllowlist);
|
|
354
395
|
|
|
355
396
|
const diagnostics: CheckDiagnostic[] = violations.map((v) => ({
|
|
356
397
|
category: "SYNC_ERROR",
|
|
@@ -396,6 +437,7 @@ export async function executeCheck(
|
|
|
396
437
|
type: "text",
|
|
397
438
|
text: buildSummary({
|
|
398
439
|
violations,
|
|
440
|
+
evaluated,
|
|
399
441
|
impactResult,
|
|
400
442
|
qualityDiagnostics,
|
|
401
443
|
}),
|
|
@@ -403,6 +445,7 @@ export async function executeCheck(
|
|
|
403
445
|
],
|
|
404
446
|
structuredContent: buildStructuredContent({
|
|
405
447
|
violations,
|
|
448
|
+
evaluated,
|
|
406
449
|
diagnostics,
|
|
407
450
|
qualityDiagnostics,
|
|
408
451
|
impactResult,
|
|
@@ -29,10 +29,22 @@ export interface CheckDiagnostic {
|
|
|
29
29
|
readonly suggestion?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* What a check run evaluated, so "no violations" can be told apart from
|
|
34
|
+
* "nothing evaluated": the rules that ran, and for `domain-contradictions`
|
|
35
|
+
* how many pairs of requirement facts it compared.
|
|
36
|
+
*/
|
|
37
|
+
// implements REQ-search-answer-hygiene
|
|
38
|
+
export interface CheckEvaluated {
|
|
39
|
+
readonly rules: readonly string[];
|
|
40
|
+
readonly domainContradictions?: Readonly<{ factPairsExamined: number }>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// implements REQ-mcp-tool-check, REQ-search-answer-hygiene
|
|
33
44
|
export interface CheckStructuredContent {
|
|
34
45
|
readonly violations: readonly Violation[];
|
|
35
46
|
readonly count: number;
|
|
47
|
+
readonly evaluated: CheckEvaluated;
|
|
36
48
|
readonly diagnostics: readonly CheckDiagnostic[];
|
|
37
49
|
readonly qualityDiagnostics?: readonly QualityDiagnostic[];
|
|
38
50
|
readonly impactDiagnostics?: ChangedFileImpactResult["impactDiagnostics"];
|
|
@@ -139,6 +151,7 @@ export function formatViolationText(violations: readonly Violation[]): string {
|
|
|
139
151
|
// implements REQ-mcp-tool-check
|
|
140
152
|
export function buildStructuredContent(input: {
|
|
141
153
|
violations: readonly Violation[];
|
|
154
|
+
evaluated: CheckEvaluated;
|
|
142
155
|
diagnostics: readonly CheckDiagnostic[];
|
|
143
156
|
qualityDiagnostics?: readonly QualityDiagnostic[];
|
|
144
157
|
impactResult: ChangedFileImpactResult | undefined;
|
|
@@ -148,6 +161,12 @@ export function buildStructuredContent(input: {
|
|
|
148
161
|
return {
|
|
149
162
|
violations: [...input.violations],
|
|
150
163
|
count: input.violations.length,
|
|
164
|
+
evaluated: {
|
|
165
|
+
rules: [...input.evaluated.rules],
|
|
166
|
+
...(input.evaluated.domainContradictions !== undefined
|
|
167
|
+
? { domainContradictions: input.evaluated.domainContradictions }
|
|
168
|
+
: {}),
|
|
169
|
+
},
|
|
151
170
|
diagnostics: formatDiagnostics(input.diagnostics),
|
|
152
171
|
...(qualityDiagnostics.length > 0
|
|
153
172
|
? { qualityDiagnostics: [...qualityDiagnostics] }
|
|
@@ -168,12 +187,27 @@ export function buildStructuredContent(input: {
|
|
|
168
187
|
}
|
|
169
188
|
|
|
170
189
|
// implements REQ-mcp-tool-check
|
|
190
|
+
// implements REQ-search-answer-hygiene
|
|
191
|
+
/** One line saying what the check evaluated, so a clean result is readable. */
|
|
192
|
+
export function formatEvaluatedText(evaluated: CheckEvaluated): string {
|
|
193
|
+
const rules =
|
|
194
|
+
evaluated.rules.length === 0
|
|
195
|
+
? "Evaluated no rules"
|
|
196
|
+
: `Evaluated ${evaluated.rules.length} rule${evaluated.rules.length === 1 ? "" : "s"}`;
|
|
197
|
+
const pairs = evaluated.domainContradictions;
|
|
198
|
+
if (pairs === undefined) return `${rules}.`;
|
|
199
|
+
return `${rules}; domain-contradictions compared ${pairs.factPairsExamined} fact pair${pairs.factPairsExamined === 1 ? "" : "s"}${pairs.factPairsExamined === 0 ? " (no two current requirements constrain the same subject or predicate case)" : ""}.`;
|
|
200
|
+
}
|
|
201
|
+
|
|
171
202
|
export function buildSummary(input: {
|
|
172
203
|
readonly violations: readonly Violation[];
|
|
204
|
+
readonly evaluated?: CheckEvaluated;
|
|
173
205
|
readonly impactResult: ChangedFileImpactResult | undefined;
|
|
174
206
|
readonly qualityDiagnostics: readonly QualityDiagnostic[];
|
|
175
207
|
}): string {
|
|
176
208
|
const sections = [formatViolationText(input.violations)];
|
|
209
|
+
if (input.evaluated !== undefined)
|
|
210
|
+
sections.push(formatEvaluatedText(input.evaluated));
|
|
177
211
|
if (input.impactResult !== undefined) {
|
|
178
212
|
sections.push(formatImpactText(input.impactResult));
|
|
179
213
|
}
|
|
@@ -441,14 +441,15 @@ const BASE_DATA_SCHEMAS: Readonly<
|
|
|
441
441
|
sourceType: stringValue,
|
|
442
442
|
}),
|
|
443
443
|
kb_skills_read: objectData({ content: stringValue }, ["content"]),
|
|
444
|
-
kb_query: objectData(
|
|
445
|
-
|
|
446
|
-
"count",
|
|
447
|
-
|
|
444
|
+
kb_query: objectData(
|
|
445
|
+
{ entities: recordArray, count: integerValue, factQuery: recordValue },
|
|
446
|
+
["entities", "count"],
|
|
447
|
+
),
|
|
448
448
|
kb_search: objectData(
|
|
449
449
|
{
|
|
450
450
|
results: valueArray,
|
|
451
451
|
count: integerValue,
|
|
452
|
+
returned: integerValue,
|
|
452
453
|
truncated: booleanValue,
|
|
453
454
|
queryAnalysis: recordValue,
|
|
454
455
|
answer: recordValue,
|
|
@@ -573,6 +574,11 @@ const BASE_DATA_SCHEMAS: Readonly<
|
|
|
573
574
|
recommendedPredicateSchema: { type: ["object", "null"] },
|
|
574
575
|
applyPlan: recordArray,
|
|
575
576
|
relationshipPlan: { type: ["object", "null"] },
|
|
577
|
+
plan: {
|
|
578
|
+
type: ["object", "null"],
|
|
579
|
+
description:
|
|
580
|
+
"With requirementId and a complete candidate: the hash-bound kibi.compile-plan.v1 that writes the predicate fact and links requires_predicate in one kb_apply_plan call (approvedPlanHash = plan.planHash). Its contradictionAnalysis is the what-if over the current KB plus the plan; a conflict leaves the plan blocked. Null when no plan applies.",
|
|
581
|
+
},
|
|
576
582
|
relationshipTarget: {
|
|
577
583
|
type: ["string", "null"],
|
|
578
584
|
description:
|
|
@@ -629,6 +635,8 @@ const BASE_DATA_SCHEMAS: Readonly<
|
|
|
629
635
|
warnings: valueArray,
|
|
630
636
|
semanticAdvisor: nullableJsonSchema(recordValue),
|
|
631
637
|
normalizedPreview: nullableJsonSchema(recordValue),
|
|
638
|
+
stagedFacts: stringArray,
|
|
639
|
+
whatIf: recordValue,
|
|
632
640
|
}),
|
|
633
641
|
kb_upsert: {
|
|
634
642
|
description:
|
|
@@ -653,6 +661,8 @@ const BASE_DATA_SCHEMAS: Readonly<
|
|
|
653
661
|
warnings: valueArray,
|
|
654
662
|
semanticAdvisor: nullableJsonSchema(recordValue),
|
|
655
663
|
normalizedPreview: nullableJsonSchema(recordValue),
|
|
664
|
+
stagedFacts: stringArray,
|
|
665
|
+
whatIf: recordValue,
|
|
656
666
|
dryRun: { const: true },
|
|
657
667
|
skippedEffects: stringArray,
|
|
658
668
|
},
|
|
@@ -683,6 +693,7 @@ const BASE_DATA_SCHEMAS: Readonly<
|
|
|
683
693
|
objectData({
|
|
684
694
|
violations: valueArray,
|
|
685
695
|
count: integerValue,
|
|
696
|
+
evaluated: recordValue,
|
|
686
697
|
diagnostics: recordArray,
|
|
687
698
|
qualityDiagnostics: recordArray,
|
|
688
699
|
impactDiagnostics: recordArray,
|