kibi-cli 0.2.7 → 0.3.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.js +62 -0
- package/dist/commands/aggregated-checks.js +4 -6
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +26 -24
- package/dist/commands/coverage.d.ts +12 -0
- package/dist/commands/coverage.d.ts.map +1 -0
- package/dist/commands/coverage.js +24 -0
- package/dist/commands/discovery-shared.d.ts +11 -0
- package/dist/commands/discovery-shared.d.ts.map +1 -0
- package/dist/commands/discovery-shared.js +280 -0
- package/dist/commands/doctor.js +8 -8
- package/dist/commands/gaps.d.ts +12 -0
- package/dist/commands/gaps.d.ts.map +1 -0
- package/dist/commands/gaps.js +28 -0
- package/dist/commands/graph.d.ts +13 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +35 -0
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +2 -8
- package/dist/commands/search.d.ts +9 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +38 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +9 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +0 -15
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +0 -2
- package/dist/extractors/manifest.d.ts +2 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +1 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +9 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -2
- package/dist/public/prolog/index.d.ts.map +1 -1
- package/dist/public/prolog/index.js +1 -2
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +1 -3
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -3
- package/dist/search-ranking.d.ts +9 -0
- package/dist/search-ranking.d.ts.map +1 -0
- package/dist/search-ranking.js +143 -0
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +33 -7
- package/dist/traceability/symbol-extract.d.ts +6 -1
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +62 -34
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +4 -3
- package/dist/traceability/validate.d.ts.map +1 -1
- package/dist/traceability/validate.js +8 -7
- package/package.json +10 -2
- package/src/public/extractors/symbols-coordinator.ts +1 -2
- package/src/public/prolog/index.ts +1 -2
- package/src/public/schemas/entity.ts +1 -3
- package/src/public/schemas/relationship.ts +1 -3
package/dist/commands/doctor.js
CHANGED
|
@@ -198,7 +198,7 @@ function checkGitHooks() {
|
|
|
198
198
|
return {
|
|
199
199
|
passed: false,
|
|
200
200
|
message: "Partially installed",
|
|
201
|
-
remediation: "Run: kibi init
|
|
201
|
+
remediation: "Run: kibi init",
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
function checkPreCommitHook() {
|
|
@@ -218,7 +218,7 @@ function checkPreCommitHook() {
|
|
|
218
218
|
return {
|
|
219
219
|
passed: false,
|
|
220
220
|
message: "Not installed",
|
|
221
|
-
remediation: "Run: kibi init
|
|
221
|
+
remediation: "Run: kibi init",
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
try {
|
|
@@ -233,7 +233,7 @@ function checkPreCommitHook() {
|
|
|
233
233
|
return {
|
|
234
234
|
passed: false,
|
|
235
235
|
message: "pre-commit hook installed but does not invoke kibi",
|
|
236
|
-
remediation: "Run: kibi init
|
|
236
|
+
remediation: "Run: kibi init to install recommended hooks",
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
if (preCommitExecutable) {
|
|
@@ -247,7 +247,7 @@ function checkPreCommitHook() {
|
|
|
247
247
|
return {
|
|
248
248
|
passed: true,
|
|
249
249
|
message: "Installed and executable (uses legacy 'kibi check' — consider running 'kibi init' to update hooks to use '--staged')",
|
|
250
|
-
remediation: "Run: kibi init
|
|
250
|
+
remediation: "Run: kibi init to update git hooks to the latest template",
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
return {
|
|
@@ -260,7 +260,7 @@ function checkPreCommitHook() {
|
|
|
260
260
|
return {
|
|
261
261
|
passed: false,
|
|
262
262
|
message: "Unable to check hook permissions or read content",
|
|
263
|
-
remediation: "Run: kibi init
|
|
263
|
+
remediation: "Run: kibi init",
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
}
|
|
@@ -281,7 +281,7 @@ function checkPostRewriteHook() {
|
|
|
281
281
|
return {
|
|
282
282
|
passed: false,
|
|
283
283
|
message: "Not installed",
|
|
284
|
-
remediation: "Run: kibi init
|
|
284
|
+
remediation: "Run: kibi init",
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
try {
|
|
@@ -294,7 +294,7 @@ function checkPostRewriteHook() {
|
|
|
294
294
|
return {
|
|
295
295
|
passed: false,
|
|
296
296
|
message: "post-rewrite hook installed but does not invoke kibi",
|
|
297
|
-
remediation: "Run: kibi init
|
|
297
|
+
remediation: "Run: kibi init to install recommended hooks",
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
300
|
if (postRewriteExecutable) {
|
|
@@ -313,7 +313,7 @@ function checkPostRewriteHook() {
|
|
|
313
313
|
return {
|
|
314
314
|
passed: false,
|
|
315
315
|
message: "Unable to check hook permissions or read content",
|
|
316
|
-
remediation: "Run: kibi init
|
|
316
|
+
remediation: "Run: kibi init",
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface GapsOptions {
|
|
2
|
+
missingRel?: string;
|
|
3
|
+
presentRel?: string;
|
|
4
|
+
tag?: string;
|
|
5
|
+
source?: string;
|
|
6
|
+
limit?: string;
|
|
7
|
+
offset?: string;
|
|
8
|
+
format?: "json" | "table";
|
|
9
|
+
}
|
|
10
|
+
export declare function gapsCommand(type: string | undefined, options: GapsOptions): Promise<void>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=gaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gaps.d.ts","sourceRoot":"","sources":["../../src/commands/gaps.ts"],"names":[],"mappings":"AAQA,UAAU,WAAW;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { escapeAtom } from "../prolog/codec.js";
|
|
2
|
+
import { printDiscoveryResult, resolveCurrentKbPath, runJsonModuleQuery, withPrologProcess, } from "./discovery-shared.js";
|
|
3
|
+
// implements REQ-002, REQ-003
|
|
4
|
+
export async function gapsCommand(type, options) {
|
|
5
|
+
await withPrologProcess(async (prolog) => {
|
|
6
|
+
const kbPath = await resolveCurrentKbPath();
|
|
7
|
+
const missing = csvToPrologList(options.missingRel);
|
|
8
|
+
const present = csvToPrologList(options.presentRel);
|
|
9
|
+
const tags = csvToPrologList(options.tag);
|
|
10
|
+
const source = options.source ? `'${escapeAtom(options.source)}'` : "none";
|
|
11
|
+
const limit = Number.parseInt(options.limit || "100", 10);
|
|
12
|
+
const offset = Number.parseInt(options.offset || "0", 10);
|
|
13
|
+
const typeArg = type ? `'${escapeAtom(type)}'` : "none";
|
|
14
|
+
const result = await runJsonModuleQuery(prolog, "discovery.pl", `discovery:find_gaps_json(${typeArg}, ${missing}, ${present}, ${tags}, ${source}, ${limit}, ${offset}, JsonString)`, "gaps query failed", kbPath);
|
|
15
|
+
printDiscoveryResult(options.format, result, `Found ${result.count ?? 0} gap rows.`);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function csvToPrologList(value) {
|
|
19
|
+
if (!value?.trim()) {
|
|
20
|
+
return "[]";
|
|
21
|
+
}
|
|
22
|
+
return `[${value
|
|
23
|
+
.split(",")
|
|
24
|
+
.map((item) => item.trim())
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.map((item) => `'${escapeAtom(item)}'`)
|
|
27
|
+
.join(",")}]`;
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface GraphOptions {
|
|
2
|
+
from?: string;
|
|
3
|
+
relationships?: string;
|
|
4
|
+
direction?: "outgoing" | "incoming" | "both";
|
|
5
|
+
depth?: string;
|
|
6
|
+
entityTypes?: string;
|
|
7
|
+
maxNodes?: string;
|
|
8
|
+
maxEdges?: string;
|
|
9
|
+
format?: "json" | "table";
|
|
10
|
+
}
|
|
11
|
+
export declare function graphCommand(options: GraphOptions): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAQA,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCvE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { escapeAtom } from "../prolog/codec.js";
|
|
2
|
+
import { printDiscoveryResult, resolveCurrentKbPath, runJsonModuleQuery, withPrologProcess, } from "./discovery-shared.js";
|
|
3
|
+
// implements REQ-002, REQ-003
|
|
4
|
+
export async function graphCommand(options) {
|
|
5
|
+
if (!options.from?.trim()) {
|
|
6
|
+
console.error("Error: --from is required");
|
|
7
|
+
process.exitCode = 1;
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
await withPrologProcess(async (prolog) => {
|
|
11
|
+
const kbPath = await resolveCurrentKbPath();
|
|
12
|
+
const seedIds = csvToPrologList(options.from);
|
|
13
|
+
const relationships = csvToPrologList(options.relationships);
|
|
14
|
+
const direction = options.direction || "outgoing";
|
|
15
|
+
const depth = Number.parseInt(options.depth || "1", 10);
|
|
16
|
+
const entityTypes = csvToPrologList(options.entityTypes);
|
|
17
|
+
const maxNodes = Number.parseInt(options.maxNodes || "200", 10);
|
|
18
|
+
const maxEdges = Number.parseInt(options.maxEdges || "500", 10);
|
|
19
|
+
const result = await runJsonModuleQuery(prolog, "discovery.pl", `discovery:graph_expand_json(${seedIds}, ${relationships}, '${direction}', ${depth}, ${entityTypes}, ${maxNodes}, ${maxEdges}, JsonString)`, "graph query failed", kbPath);
|
|
20
|
+
const nodes = Array.isArray(result.nodes) ? result.nodes.length : 0;
|
|
21
|
+
const edges = Array.isArray(result.edges) ? result.edges.length : 0;
|
|
22
|
+
printDiscoveryResult(options.format, result, `Graph traversal returned ${nodes} nodes and ${edges} edges.`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function csvToPrologList(value) {
|
|
26
|
+
if (!value?.trim()) {
|
|
27
|
+
return "[]";
|
|
28
|
+
}
|
|
29
|
+
return `[${value
|
|
30
|
+
.split(",")
|
|
31
|
+
.map((item) => item.trim())
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.map((item) => `'${escapeAtom(item)}'`)
|
|
34
|
+
.join(",")}]`;
|
|
35
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AA2CA,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AA2CA,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAyKf"}
|
package/dist/commands/query.js
CHANGED
|
@@ -31,7 +31,6 @@ export async function queryCommand(type, options) {
|
|
|
31
31
|
prolog = new PrologProcess({ timeout: 120000 });
|
|
32
32
|
await prolog.start();
|
|
33
33
|
await prolog.query("set_prolog_flag(answer_write_options, [max_depth(0), spacing(next_argument)])");
|
|
34
|
-
// Resolve branch: allow non-git repos to use default "main" for query
|
|
35
34
|
let currentBranch;
|
|
36
35
|
const branchResult = resolveActiveBranch();
|
|
37
36
|
if ("error" in branchResult) {
|
|
@@ -61,12 +60,11 @@ export async function queryCommand(type, options) {
|
|
|
61
60
|
}
|
|
62
61
|
attached = true;
|
|
63
62
|
let results = [];
|
|
64
|
-
// Query relationships mode
|
|
65
63
|
if (options.relationships) {
|
|
66
64
|
const fromId = String(options.relationships);
|
|
67
65
|
const safeFromId = fromId.replace(/'/g, "''");
|
|
68
|
-
|
|
69
|
-
const goal = `findall([Type,From,To], (
|
|
66
|
+
const relTypesList = REL_TYPES.join(", ");
|
|
67
|
+
const goal = `findall([Type,From,To], (member(Type, [${relTypesList}]), kb_relationship(Type, '${safeFromId}', To), From='${safeFromId}'), Results)`;
|
|
70
68
|
const queryResult = await prolog.query(goal);
|
|
71
69
|
if (queryResult.success && queryResult.bindings.Results) {
|
|
72
70
|
const rows = parseListOfLists(queryResult.bindings.Results);
|
|
@@ -85,9 +83,7 @@ export async function queryCommand(type, options) {
|
|
|
85
83
|
REL_TYPES.includes(rel.type));
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
|
-
// Query entities mode
|
|
89
86
|
else if (type || options.source) {
|
|
90
|
-
// Validate type if provided
|
|
91
87
|
if (type && !VALID_ENTITY_TYPES.includes(type)) {
|
|
92
88
|
console.error(`Error: Invalid type '${type}'. Valid types: ${VALID_ENTITY_TYPES.join(", ")}`);
|
|
93
89
|
process.exitCode = 1;
|
|
@@ -95,7 +91,6 @@ export async function queryCommand(type, options) {
|
|
|
95
91
|
}
|
|
96
92
|
let goal;
|
|
97
93
|
if (options.source) {
|
|
98
|
-
// Query by source path (substring match)
|
|
99
94
|
const safeSource = String(options.source).replace(/'/g, "\\'");
|
|
100
95
|
if (type) {
|
|
101
96
|
goal = `findall([Id,'${type}',Props], (kb_entities_by_source('${safeSource}', SourceIds), member(Id, SourceIds), kb_entity(Id, '${type}', Props)), Results)`;
|
|
@@ -141,7 +136,6 @@ export async function queryCommand(type, options) {
|
|
|
141
136
|
process.exitCode = 1;
|
|
142
137
|
return;
|
|
143
138
|
}
|
|
144
|
-
// Apply pagination
|
|
145
139
|
const limit = Number.parseInt(options.limit || "100");
|
|
146
140
|
const offset = Number.parseInt(options.offset || "0");
|
|
147
141
|
const paginated = results.slice(offset, offset + limit);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface SearchOptions {
|
|
2
|
+
type?: string;
|
|
3
|
+
format?: "json" | "table";
|
|
4
|
+
limit?: string;
|
|
5
|
+
offset?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function searchCommand(query: string | undefined, options: SearchOptions): Promise<void>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAYA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { rankEntities } from "../search-ranking.js";
|
|
2
|
+
import { VALID_ENTITY_TYPES, queryEntities, } from "../query/service.js";
|
|
3
|
+
import { printDiscoveryResult, withAttachedBranchProlog, } from "./discovery-shared.js";
|
|
4
|
+
// implements REQ-mcp-search-discovery, REQ-003
|
|
5
|
+
export async function searchCommand(query, options) {
|
|
6
|
+
if (!query?.trim()) {
|
|
7
|
+
console.error("Error: search query is required");
|
|
8
|
+
process.exitCode = 1;
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (options.type && !VALID_ENTITY_TYPES.includes(options.type)) {
|
|
12
|
+
console.error(`Error: invalid type '${options.type}'. Valid types: ${VALID_ENTITY_TYPES.join(", ")}`);
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
await withAttachedBranchProlog(async (prolog) => {
|
|
17
|
+
const limit = Number.parseInt(options.limit || "20", 10);
|
|
18
|
+
const offset = Number.parseInt(options.offset || "0", 10);
|
|
19
|
+
const result = await executeSearch(prolog, query, options.type, limit, offset);
|
|
20
|
+
printDiscoveryResult(options.format, result, buildSearchText(query, result));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function executeSearch(prolog, query, type, limit, offset) {
|
|
24
|
+
const entitiesResult = await queryEntities(prolog, {
|
|
25
|
+
type,
|
|
26
|
+
limit: 100000,
|
|
27
|
+
offset: 0,
|
|
28
|
+
});
|
|
29
|
+
const matches = await rankEntities(entitiesResult.entities, query, process.cwd());
|
|
30
|
+
const paginated = matches.slice(offset, offset + limit);
|
|
31
|
+
return { results: paginated, count: matches.length };
|
|
32
|
+
}
|
|
33
|
+
function buildSearchText(query, result) {
|
|
34
|
+
if (result.count === 0) {
|
|
35
|
+
return `No search results for '${query}'.`;
|
|
36
|
+
}
|
|
37
|
+
return `Found ${result.count} search results for '${query}'. Showing ${result.results.length}: ${result.results.map((match) => match.entity.id).join(", ")}`;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAOA,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { printDiscoveryResult, resolveCurrentKbPath, runJsonModuleQuery, withPrologProcess, } from "./discovery-shared.js";
|
|
2
|
+
// implements REQ-002, REQ-003
|
|
3
|
+
export async function statusCommand(options) {
|
|
4
|
+
await withPrologProcess(async (prolog) => {
|
|
5
|
+
const kbPath = await resolveCurrentKbPath();
|
|
6
|
+
const result = await runJsonModuleQuery(prolog, "status.pl", "status:kb_status_json(JsonString)", "status query failed", kbPath);
|
|
7
|
+
printDiscoveryResult(options.format, result, `Branch ${result.branch} is ${result.syncState} (dirty=${result.dirty})`);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyCjE,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAGD,wBAAsB,WAAW,CAC/B,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyCjE,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAGD,wBAAsB,WAAW,CAC/B,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,WAAW,CAAC,CA4VtB;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -74,10 +74,8 @@ export async function syncCommand(options = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
catch { }
|
|
76
76
|
}
|
|
77
|
-
// Load config
|
|
78
77
|
const config = loadSyncConfig(process.cwd());
|
|
79
78
|
const paths = config.paths;
|
|
80
|
-
// File discovery
|
|
81
79
|
const { markdownFiles, manifestFiles, relationshipsDir } = await discoverSourceFiles(process.cwd(), paths);
|
|
82
80
|
if (process.env.KIBI_DEBUG) {
|
|
83
81
|
try {
|
|
@@ -95,12 +93,10 @@ export async function syncCommand(options = {}) {
|
|
|
95
93
|
const nowMs = Date.now();
|
|
96
94
|
const nextHashes = {};
|
|
97
95
|
const nextSeenAt = {};
|
|
98
|
-
// Extract relationships from shard files
|
|
99
96
|
const shardResults = extractFromRelationshipShards(relationshipsDir);
|
|
100
97
|
const allRelationships = flattenRelationships(shardResults);
|
|
101
98
|
const changedMarkdownFiles = [];
|
|
102
99
|
const changedManifestFiles = [];
|
|
103
|
-
// Detect changed files
|
|
104
100
|
for (const file of sourceFiles) {
|
|
105
101
|
try {
|
|
106
102
|
const key = toCacheKey(file);
|
|
@@ -129,7 +125,6 @@ export async function syncCommand(options = {}) {
|
|
|
129
125
|
}
|
|
130
126
|
const performedFullReindex = changedMarkdownFiles.length === markdownFiles.length &&
|
|
131
127
|
changedManifestFiles.length === manifestFiles.length;
|
|
132
|
-
// Content extraction
|
|
133
128
|
const { results, failedCacheKeys, errors } = await processExtractions(changedMarkdownFiles, changedManifestFiles, validateOnly);
|
|
134
129
|
// Collect INVALID_AUTHORING diagnostics
|
|
135
130
|
for (const err of errors) {
|
|
@@ -160,7 +155,6 @@ export async function syncCommand(options = {}) {
|
|
|
160
155
|
process.exit(0);
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
|
-
// Refresh symbol manifest coordinates
|
|
164
158
|
for (const file of manifestFiles) {
|
|
165
159
|
try {
|
|
166
160
|
await refreshManifestCoordinates(file, process.cwd());
|
|
@@ -170,7 +164,6 @@ export async function syncCommand(options = {}) {
|
|
|
170
164
|
console.warn(`Warning: Failed to refresh symbol coordinates in ${file}: ${message}`);
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
|
-
// Early exit if no changes
|
|
174
167
|
if (results.length === 0 && allRelationships.length === 0 && !rebuild) {
|
|
175
168
|
const evictedHashes = {};
|
|
176
169
|
const evictedSeenAt = {};
|
|
@@ -189,7 +182,6 @@ export async function syncCommand(options = {}) {
|
|
|
189
182
|
console.log("✓ Imported 0 entities, 0 relationships (no changes)");
|
|
190
183
|
process.exit(0);
|
|
191
184
|
}
|
|
192
|
-
// Staging setup
|
|
193
185
|
const livePath = path.join(process.cwd(), `.kb/branches/${currentBranch}`);
|
|
194
186
|
const kbExists = existsSync(livePath);
|
|
195
187
|
if (!kbExists && !rebuild) {
|
|
@@ -197,7 +189,6 @@ export async function syncCommand(options = {}) {
|
|
|
197
189
|
}
|
|
198
190
|
const stagingPath = path.join(process.cwd(), `.kb/branches/${currentBranch}.staging`);
|
|
199
191
|
await prepareStagingEnvironment(stagingPath, livePath, rebuild);
|
|
200
|
-
// Persistence to KB
|
|
201
192
|
try {
|
|
202
193
|
const prolog = new PrologProcess({ timeout: 120000 });
|
|
203
194
|
await prolog.start();
|
|
@@ -207,13 +198,10 @@ export async function syncCommand(options = {}) {
|
|
|
207
198
|
throw new SyncError(`Failed to attach to staging KB: ${attachResult.error || "Unknown error"}`);
|
|
208
199
|
}
|
|
209
200
|
const entityIds = new Set();
|
|
210
|
-
// Track entity counts by type
|
|
211
201
|
for (const { entity } of results) {
|
|
212
202
|
entityCounts[entity.type] = (entityCounts[entity.type] || 0) + 1;
|
|
213
203
|
}
|
|
214
|
-
// Persist entities
|
|
215
204
|
const { entityCount, kbModified: entitiesModified } = await persistEntities(prolog, results, entityIds);
|
|
216
|
-
// Validate and filter dangling relationships after entity IDs are known.
|
|
217
205
|
const validationErrors = validateRelationships(allRelationships, entityIds);
|
|
218
206
|
if (validationErrors.length > 0) {
|
|
219
207
|
console.warn(`Warning: ${validationErrors.length} dangling relationship(s) found`);
|
|
@@ -235,9 +223,7 @@ export async function syncCommand(options = {}) {
|
|
|
235
223
|
}
|
|
236
224
|
await prolog.query("kb_detach");
|
|
237
225
|
await prolog.terminate();
|
|
238
|
-
// Publish staging to live
|
|
239
226
|
atomicPublish(stagingPath, livePath);
|
|
240
|
-
// Update cache
|
|
241
227
|
const evictedHashes = {};
|
|
242
228
|
const evictedSeenAt = {};
|
|
243
229
|
for (const [key, hash] of Object.entries(nextHashes)) {
|
|
@@ -304,5 +290,4 @@ export async function syncCommand(options = {}) {
|
|
|
304
290
|
throw error;
|
|
305
291
|
}
|
|
306
292
|
}
|
|
307
|
-
// Export for use by modules that need these functions
|
|
308
293
|
export { normalizeMarkdownPath } from "./sync/discovery.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,E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js
CHANGED
|
@@ -77,13 +77,11 @@ export function formatSyncSummary(summary) {
|
|
|
77
77
|
}
|
|
78
78
|
lines.push(`Total Relationships: ${summary.relationshipCount}`);
|
|
79
79
|
lines.push("");
|
|
80
|
-
// Status
|
|
81
80
|
lines.push(`Status: ${summary.success ? "✓ Success" : "✗ Failed"}`);
|
|
82
81
|
lines.push(`Published: ${summary.published ? "Yes" : "No"}`);
|
|
83
82
|
if (summary.durationMs !== undefined) {
|
|
84
83
|
lines.push(`Duration: ${summary.durationMs}ms`);
|
|
85
84
|
}
|
|
86
|
-
// Failures
|
|
87
85
|
if (summary.failures.length > 0) {
|
|
88
86
|
lines.push("");
|
|
89
87
|
lines.push(`Failures (${summary.failures.length}):`);
|
|
@@ -20,6 +20,8 @@ export interface ExtractedRelationship {
|
|
|
20
20
|
export interface ExtractionResult {
|
|
21
21
|
entity: ExtractedEntity;
|
|
22
22
|
relationships: ExtractedRelationship[];
|
|
23
|
+
/** The per-symbol source code file, distinct from the manifest file path. */
|
|
24
|
+
sourceFile?: string;
|
|
23
25
|
}
|
|
24
26
|
export declare class ManifestError extends Error {
|
|
25
27
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AAsBA,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,C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,GACjB,MAAM,EAAE,CA8CV;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CA4JtE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASjE"}
|
|
@@ -101,7 +101,7 @@ export function extractFromMarkdown(filePath) {
|
|
|
101
101
|
throw new FrontmatterError(`Failed to read file: ${error instanceof Error ? error.message : String(error)}`, filePath, { classification: "File Read Error" });
|
|
102
102
|
}
|
|
103
103
|
try {
|
|
104
|
-
const { data
|
|
104
|
+
const { data } = matter(content);
|
|
105
105
|
if (content.trim().startsWith("---")) {
|
|
106
106
|
const parts = content.split("---");
|
|
107
107
|
if (parts.length < 3) {
|
|
@@ -136,6 +136,14 @@ export function extractFromMarkdown(filePath) {
|
|
|
136
136
|
const relationships = [];
|
|
137
137
|
if (Array.isArray(data.links)) {
|
|
138
138
|
for (const link of data.links) {
|
|
139
|
+
if (typeof link === "string") {
|
|
140
|
+
relationships.push({
|
|
141
|
+
type: "relates_to",
|
|
142
|
+
from: id,
|
|
143
|
+
to: link,
|
|
144
|
+
});
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
139
147
|
if (link &&
|
|
140
148
|
typeof link === "object" &&
|
|
141
149
|
typeof link.type === "string" &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../../src/public/extractors/symbols-coordinator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../../src/public/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,uBAAuB,EACvB,KAAK,mBAAmB,GACzB,MAAM,yCAAyC,CAAC"}
|
|
@@ -14,6 +14,5 @@
|
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
// Public re-export of symbols coordinator
|
|
17
|
+
*/
|
|
19
18
|
export { enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/prolog/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/prolog/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
// Public export of entity schema
|
|
19
|
-
// Generated from entity.schema.json
|
|
17
|
+
*/
|
|
20
18
|
const entitySchema = {
|
|
21
19
|
$id: "entity.schema.json",
|
|
22
20
|
title: "Entity",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
// Public export of relationship schema
|
|
19
|
-
// Generated from relationship.schema.json
|
|
17
|
+
*/
|
|
20
18
|
const relationshipSchema = {
|
|
21
19
|
$id: "relationship.schema.json",
|
|
22
20
|
title: "Relationship",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SearchMatch {
|
|
2
|
+
entity: Record<string, unknown>;
|
|
3
|
+
score: number;
|
|
4
|
+
reasons: string[];
|
|
5
|
+
snippet?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function rankEntities(entities: Record<string, unknown>[], query: string, workspaceRoot: string): Promise<SearchMatch[]>;
|
|
8
|
+
export declare function loadMarkdownBody(source: string, workspaceRoot: string): Promise<string | null>;
|
|
9
|
+
//# sourceMappingURL=search-ranking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-ranking.d.ts","sourceRoot":"","sources":["../src/search-ranking.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAuBxB;AA2FD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA2BxB"}
|