kibi-cli 0.12.7 → 0.12.8
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/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +14 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +10 -4
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +11 -7
- package/dist/public/skills/kibi-usage/SKILL.md +7 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/package.json +2 -8
- package/src/public/skills/kibi-usage/SKILL.md +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAiFA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,SAAS,EAAE,CAAC;AAI1B,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;CAClB;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAiFA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,SAAS,EAAE,CAAC;AAI1B,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;CAClB;AA8bD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0W/B"}
|
package/dist/commands/check.js
CHANGED
|
@@ -98,6 +98,9 @@ function buildManifestLookup(stagedFiles) {
|
|
|
98
98
|
manifestResults.push({
|
|
99
99
|
entity: entry.entity,
|
|
100
100
|
relationships: entry.relationships,
|
|
101
|
+
...(entry.sourceFile !== undefined
|
|
102
|
+
? { sourceFile: entry.sourceFile }
|
|
103
|
+
: {}),
|
|
101
104
|
});
|
|
102
105
|
const authoredSymbolResult = {
|
|
103
106
|
entity: entry.entity,
|
|
@@ -440,8 +443,11 @@ export async function checkCommand(options) {
|
|
|
440
443
|
}
|
|
441
444
|
}
|
|
442
445
|
const markdownResults = markdownFiles.map((file) => extractFromMarkdownString(file.content ?? "", file.path));
|
|
446
|
+
const stagedSourceFilePaths = new Set(sourceFiles.map((file) => file.path));
|
|
447
|
+
const scopedManifestResults = manifestResults.filter((result) => result.sourceFile !== undefined &&
|
|
448
|
+
stagedSourceFilePaths.has(result.sourceFile));
|
|
443
449
|
const stagedEntityResults = [
|
|
444
|
-
...
|
|
450
|
+
...scopedManifestResults,
|
|
445
451
|
...markdownResults,
|
|
446
452
|
];
|
|
447
453
|
const stagedKibiEvidence = buildStagedKibiImpactEvidence({
|
|
@@ -464,6 +470,13 @@ export async function checkCommand(options) {
|
|
|
464
470
|
sourceContentByFile,
|
|
465
471
|
}));
|
|
466
472
|
if (allSymbols.length === 0 && stagedEntityResults.length === 0) {
|
|
473
|
+
if (stagedKibiDiagnostics.length > 0) {
|
|
474
|
+
console.log(formatStagedKibiDiagnostics(stagedKibiDiagnostics));
|
|
475
|
+
if (options.dryRun) {
|
|
476
|
+
return { exitCode: 0 };
|
|
477
|
+
}
|
|
478
|
+
return { exitCode: 1 };
|
|
479
|
+
}
|
|
467
480
|
console.log("No exported symbols or staged entities found in staged files.");
|
|
468
481
|
return { exitCode: 0 };
|
|
469
482
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0ErD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0ErD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAmCD,wBAAsB,eAAe,CAEnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAqEvD;AAGD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,kBAAkB,EAAE,qBAAqB,EAAE,GAC1C,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CA+K7D"}
|
|
@@ -91,7 +91,8 @@ function isQueryFailedError(error) {
|
|
|
91
91
|
}
|
|
92
92
|
async function tryResetPrologProcess(prolog) {
|
|
93
93
|
const maybe = prolog;
|
|
94
|
-
if (typeof maybe.terminate !== "function" ||
|
|
94
|
+
if (typeof maybe.terminate !== "function" ||
|
|
95
|
+
typeof maybe.start !== "function") {
|
|
95
96
|
return false;
|
|
96
97
|
}
|
|
97
98
|
try {
|
|
@@ -169,6 +170,7 @@ prolog, results, entityIds) {
|
|
|
169
170
|
}
|
|
170
171
|
return { entityCount, kbModified };
|
|
171
172
|
}
|
|
173
|
+
// implements REQ-core-persistence
|
|
172
174
|
export async function persistRelationships(prolog, results, shardRelationships) {
|
|
173
175
|
let relCount = 0;
|
|
174
176
|
let kbModified = false;
|
|
@@ -271,7 +273,9 @@ export async function persistRelationships(prolog, results, shardRelationships)
|
|
|
271
273
|
// If every pending relationship fails with generic query errors, attempt one
|
|
272
274
|
// best-effort Prolog restart before the next retry pass to recover from a
|
|
273
275
|
// potentially poisoned interactive session.
|
|
274
|
-
if (allLookLikeSessionFailures &&
|
|
276
|
+
if (allLookLikeSessionFailures &&
|
|
277
|
+
!resetAttempted &&
|
|
278
|
+
pass + 1 < retryCount) {
|
|
275
279
|
resetAttempted = true;
|
|
276
280
|
await tryResetPrologProcess(prolog);
|
|
277
281
|
}
|
|
@@ -295,8 +299,10 @@ export async function persistRelationships(prolog, results, shardRelationships)
|
|
|
295
299
|
const missingIds = new Set();
|
|
296
300
|
for (const { error } of missingEntities) {
|
|
297
301
|
const match = error.match(/does not exist: (.+)$/);
|
|
298
|
-
|
|
299
|
-
|
|
302
|
+
const missingId = match?.[1];
|
|
303
|
+
if (missingId !== undefined) {
|
|
304
|
+
missingIds.add(missingId.trim());
|
|
305
|
+
}
|
|
300
306
|
}
|
|
301
307
|
const idList = [...missingIds].sort().join(", ");
|
|
302
308
|
console.warn(`\nTip: ${missingEntities.length} relationship(s) reference ${missingIds.size} missing entity/ies: ${idList}.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;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S,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,cAAc,CACyC;IAC/D,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,aAAa,CAA6B;gBAEtC,OAAO,GAAE,aAAkB;IAKjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAuCd,YAAY;IA2CpB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAyK1D,eAAe,IAAI,IAAI;IAIvB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,kBAAkB;YAIZ,YAAY;IA2C1B,OAAO,CAAC,WAAW;IAsGnB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,cAAc;IA6DtB,SAAS,IAAI,OAAO;IAMpB,MAAM,IAAI,MAAM;IAIV,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAwCjC"}
|
package/dist/prolog.js
CHANGED
|
@@ -133,6 +133,7 @@ export class PrologProcess {
|
|
|
133
133
|
this.outputBuffer = "";
|
|
134
134
|
this.errorBuffer = "";
|
|
135
135
|
}
|
|
136
|
+
// implements REQ-core-prolog-process-management
|
|
136
137
|
async query(goal) {
|
|
137
138
|
const isSingleGoal = typeof goal === "string";
|
|
138
139
|
const goalKey = isSingleGoal ? goal : null;
|
|
@@ -242,8 +243,7 @@ export class PrologProcess {
|
|
|
242
243
|
}
|
|
243
244
|
// Check errorBuffer first — Prolog catch/3 writes ERROR to stderr
|
|
244
245
|
// then fail to stdout. If stderr has the real error, surface it.
|
|
245
|
-
const errorMessage = this.errorBuffer.length > 0 &&
|
|
246
|
-
this.errorBuffer.includes("ERROR")
|
|
246
|
+
const errorMessage = this.errorBuffer.length > 0 && this.errorBuffer.includes("ERROR")
|
|
247
247
|
? this.translateError(this.errorBuffer)
|
|
248
248
|
: "Query failed";
|
|
249
249
|
resolve({
|
|
@@ -441,14 +441,17 @@ export class PrologProcess {
|
|
|
441
441
|
}
|
|
442
442
|
return bindings;
|
|
443
443
|
}
|
|
444
|
+
// implements REQ-core-prolog-process-management
|
|
444
445
|
translateError(errorText) {
|
|
445
446
|
// SWI-Prolog print_message/2 formats errors as human-readable messages,
|
|
446
447
|
// not raw Prolog terms. Match the actual output format.
|
|
447
|
-
if (errorText.includes(
|
|
448
|
+
if (errorText.includes("does not exist") &&
|
|
449
|
+
/entity [`'"].+?[`'"]/.test(errorText)) {
|
|
448
450
|
// SWI-Prolog doubles single quotes in formatted messages: ''REQ-TEST''
|
|
449
451
|
const entityIdMatch = errorText.match(/entity [`'"]+(.+?)[`'"]+ does not exist/);
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
+
const matchedEntityId = entityIdMatch?.[1];
|
|
453
|
+
const entityId = matchedEntityId !== undefined
|
|
454
|
+
? matchedEntityId.replace(/^`?'+|'+`?$/g, "")
|
|
452
455
|
: "unknown";
|
|
453
456
|
if (errorText.includes("Target entity does not exist")) {
|
|
454
457
|
return `Target entity does not exist: ${entityId}`;
|
|
@@ -460,8 +463,9 @@ export class PrologProcess {
|
|
|
460
463
|
}
|
|
461
464
|
if (errorText.includes("Type error: `relationship' expected")) {
|
|
462
465
|
const relMatch = errorText.match(/\(Invalid relationship: ([^)]+)\)/);
|
|
463
|
-
|
|
464
|
-
|
|
466
|
+
const invalidRelationship = relMatch?.[1];
|
|
467
|
+
if (invalidRelationship !== undefined) {
|
|
468
|
+
return `Invalid relationship: ${invalidRelationship.trim()}`;
|
|
465
469
|
}
|
|
466
470
|
return "Invalid relationship type or direction";
|
|
467
471
|
}
|
|
@@ -170,6 +170,12 @@ Anti-example: do not create a `flag` named `BUG-123` to track a defect. Create a
|
|
|
170
170
|
|
|
171
171
|
Always confirm or create endpoint entities before linking them. Query target IDs with `kb_query` first. If an endpoint does not exist, create it with `kb_upsert` before creating the relationship. Creating relationships to non-existent entities produces dangling references that `kb_check` will flag.
|
|
172
172
|
|
|
173
|
+
For `kb_upsert`, keep relationship rows anchored to the entity you are upserting: each row's `from` must equal the upserted entity ID. If you need a `SYM -> REQ` link, upsert the symbol endpoint first, then link that symbol to the requirement.
|
|
174
|
+
|
|
175
|
+
Keep symbol payloads minimal: include only the fields needed to identify the symbol, its status, and its source traceability. Put extra prose, examples, or audit notes in docs or evidence files instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
|
|
176
|
+
|
|
177
|
+
When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create the missing endpoints, reduce the payload to the minimum required fields, and retry once. If it still fails, report the blocker instead of looping.
|
|
178
|
+
|
|
173
179
|
## Sequential Upserts
|
|
174
180
|
|
|
175
181
|
Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering. This is especially important when creating chains of related entities.
|
|
@@ -200,6 +206,7 @@ Call `kb_status` when you suspect the branch KB is stale or when switching conte
|
|
|
200
206
|
| Missing `kb_check` | Undetected dangling refs and violations | Run targeted checks during work, full check at completion |
|
|
201
207
|
| Tags as multi-ID lookup | Tags are metadata, not identifiers | Use `kb_query` with explicit `id` values |
|
|
202
208
|
| `relates_to` for strict modeling | Loses contradiction safety | Use `constrains` and `requires_property` instead |
|
|
209
|
+
| `status: implemented` on requirements | Not a valid lifecycle status | Use a valid status such as `closed`, add an `implemented` tag, and link evidence instead |
|
|
203
210
|
|
|
204
211
|
Before/after for reversed direction:
|
|
205
212
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temp-kb.d.ts","sourceRoot":"","sources":["../../src/traceability/temp-kb.ts"],"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AgB,iBAAiB,CAE/B,OAAO,EAAE,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,aAAa,GACpD,IAAI,CAEN;AA4ID,iBAAe,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAG1B,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA6C7E;AAGD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAkBrE;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BlE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kibi CLI for knowledge base management",
|
|
6
6
|
"engines": {
|
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
"bin": {
|
|
12
12
|
"kibi": "bin/kibi"
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist",
|
|
16
|
-
"bin",
|
|
17
|
-
"schema",
|
|
18
|
-
"src/schemas",
|
|
19
|
-
"src/public"
|
|
20
|
-
],
|
|
14
|
+
"files": ["dist", "bin", "schema", "src/schemas", "src/public"],
|
|
21
15
|
"scripts": {
|
|
22
16
|
"build": "tsc -p tsconfig.json && mkdir -p dist/public/skills && cp -r src/public/skills/. dist/public/skills/",
|
|
23
17
|
"prepack": "npm run build"
|
|
@@ -170,6 +170,12 @@ Anti-example: do not create a `flag` named `BUG-123` to track a defect. Create a
|
|
|
170
170
|
|
|
171
171
|
Always confirm or create endpoint entities before linking them. Query target IDs with `kb_query` first. If an endpoint does not exist, create it with `kb_upsert` before creating the relationship. Creating relationships to non-existent entities produces dangling references that `kb_check` will flag.
|
|
172
172
|
|
|
173
|
+
For `kb_upsert`, keep relationship rows anchored to the entity you are upserting: each row's `from` must equal the upserted entity ID. If you need a `SYM -> REQ` link, upsert the symbol endpoint first, then link that symbol to the requirement.
|
|
174
|
+
|
|
175
|
+
Keep symbol payloads minimal: include only the fields needed to identify the symbol, its status, and its source traceability. Put extra prose, examples, or audit notes in docs or evidence files instead of custom `kb_upsert.properties`; strict `kb_upsert.properties` rejects unknown fields.
|
|
176
|
+
|
|
177
|
+
When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create the missing endpoints, reduce the payload to the minimum required fields, and retry once. If it still fails, report the blocker instead of looping.
|
|
178
|
+
|
|
173
179
|
## Sequential Upserts
|
|
174
180
|
|
|
175
181
|
Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering. This is especially important when creating chains of related entities.
|
|
@@ -200,6 +206,7 @@ Call `kb_status` when you suspect the branch KB is stale or when switching conte
|
|
|
200
206
|
| Missing `kb_check` | Undetected dangling refs and violations | Run targeted checks during work, full check at completion |
|
|
201
207
|
| Tags as multi-ID lookup | Tags are metadata, not identifiers | Use `kb_query` with explicit `id` values |
|
|
202
208
|
| `relates_to` for strict modeling | Loses contradiction safety | Use `constrains` and `requires_property` instead |
|
|
209
|
+
| `status: implemented` on requirements | Not a valid lifecycle status | Use a valid status such as `closed`, add an `implemented` tag, and link evidence instead |
|
|
203
210
|
|
|
204
211
|
Before/after for reversed direction:
|
|
205
212
|
|