kibi-cli 2.28.0 → 2.28.1
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/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +6 -7
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +3 -5
- package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
- package/dist/extractors/symbol-coordinates.js +3 -5
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +3 -4
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +4 -4
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +4 -3
- package/dist/operations/mutation/validation.js +11 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
- package/dist/plugins/approved-source-analyzers.generated.js +6 -6
- package/dist/utils/repo-relative-path.d.ts +7 -0
- package/dist/utils/repo-relative-path.d.ts.map +1 -1
- package/dist/utils/repo-relative-path.js +26 -0
- package/package.json +4 -4
- package/schema/entities.pl +2 -1
- package/schema/validation.pl +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EAML,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/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,OAAO,CAAC,IAAI,CAAC,CA0Mf;AAED;;;;;;;;GAQG;AAEH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,0BAA0B,CAExC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAOT;AAED,wBAAgB,8BAA8B,CAE5C,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,OAAO,CAST"}
|
|
@@ -21,6 +21,7 @@ import { dump as dumpYAML, load as parseYAML } from "js-yaml";
|
|
|
21
21
|
import { isSeq, parseDocument } from "yaml";
|
|
22
22
|
import { coarseCoordinateSpan, coordinateIdentityHash, coordinateSourceHash, parseCoordinateArtifact, writeCoordinateArtifact, } from "../../extractors/symbol-coordinates.js";
|
|
23
23
|
import { enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
24
|
+
import { resolveWorkspaceSourceAbsolute } from "../../utils/repo-relative-path.js";
|
|
24
25
|
import { COARSE_GRANULARITY_REASONS, COARSE_GRANULARITY_REASONS_PARENTHESIZED, isCoarseGranularityReason, } from "../../public/symbol-granularity.js";
|
|
25
26
|
import { resolveSymbolsManifestPaths } from "../../utils/manifest-paths.js";
|
|
26
27
|
import { blockifySymbolManifest } from "../../utils/symbol-manifest-layout.js";
|
|
@@ -98,10 +99,8 @@ function extractedCoordinates(entry) {
|
|
|
98
99
|
: null;
|
|
99
100
|
}
|
|
100
101
|
function readSourceText(sourceFile, workspaceRoot, deps) {
|
|
101
|
-
const absolute =
|
|
102
|
-
|
|
103
|
-
: path.resolve(workspaceRoot, sourceFile);
|
|
104
|
-
if (!deps.existsSync(absolute))
|
|
102
|
+
const absolute = resolveWorkspaceSourceAbsolute(workspaceRoot, sourceFile);
|
|
103
|
+
if (absolute === null || !deps.existsSync(absolute))
|
|
105
104
|
return null;
|
|
106
105
|
try {
|
|
107
106
|
const content = deps.readFileSync(absolute, "utf8");
|
|
@@ -357,9 +356,9 @@ sourceFile, workspaceRoot, deps) {
|
|
|
357
356
|
const resolved = resolveDeps(deps);
|
|
358
357
|
if (!sourceFile)
|
|
359
358
|
return false;
|
|
360
|
-
const absolute =
|
|
361
|
-
|
|
362
|
-
|
|
359
|
+
const absolute = resolveWorkspaceSourceAbsolute(workspaceRoot, sourceFile);
|
|
360
|
+
if (absolute === null)
|
|
361
|
+
return false;
|
|
363
362
|
// Non-JS/TS files also undergo coordinate extraction through the text
|
|
364
363
|
// heuristic. A miss there must be reported just like an AST extraction miss.
|
|
365
364
|
return resolved.existsSync(absolute);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,4BAA4B,CAAC;AAYpC,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;IAC5B,MA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U,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAsFD;;;;GAIG;AAEH,wBAAgB,4BAA4B,CAC1C,eAAe,EAAE,oBAAoB,EAAE,EACvC,QAAQ,EAAE,MAAM,GACf,gBAAgB,EAAE,CA+DpB;AAYD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,gBAAgB,EAAE,CAmBpB;AAED,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,oBAAoB,EAAE,CAmBxB;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAKxE;AA0ED,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,MAAM,EACpB,eAAe,CAAC,EAAE,MAAM,GACvB,oBAAoB,EAAE,CAaxB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAqED;;;;GAIG;AAEH,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAGhE,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,qBAAqB,EAAE,CAwBzB"}
|
|
@@ -21,7 +21,7 @@ import * as path from "node:path";
|
|
|
21
21
|
import { load as parseYAML } from "js-yaml";
|
|
22
22
|
import { normalizeEntityOrigin, } from "../public/entity-origin.js";
|
|
23
23
|
import { DEFAULT_COORDINATES_PATH } from "../utils/manifest-paths.js";
|
|
24
|
-
import { normalizeRepoRelativePath } from "../utils/repo-relative-path.js";
|
|
24
|
+
import { normalizeRepoRelativePath, resolveWorkspaceSourceAbsolute, } from "../utils/repo-relative-path.js";
|
|
25
25
|
import { mergeCoordinatesWithManifest, parseCoordinateArtifact, } from "./symbol-coordinates.js";
|
|
26
26
|
const VALID_RELATIONSHIP_TYPES = new Set([
|
|
27
27
|
"depends_on",
|
|
@@ -314,10 +314,8 @@ function sourceTextResolver(manifestPath) {
|
|
|
314
314
|
return (sourceFile) => {
|
|
315
315
|
let resolved = null;
|
|
316
316
|
for (const base of bases) {
|
|
317
|
-
const absolute =
|
|
318
|
-
|
|
319
|
-
: path.resolve(base, sourceFile);
|
|
320
|
-
if (!existsSync(absolute))
|
|
317
|
+
const absolute = resolveWorkspaceSourceAbsolute(base, sourceFile);
|
|
318
|
+
if (absolute === null || !existsSync(absolute))
|
|
321
319
|
continue;
|
|
322
320
|
try {
|
|
323
321
|
const content = readFileSync(absolute, "utf8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-coordinates.d.ts","sourceRoot":"","sources":["../../src/extractors/symbol-coordinates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbol-coordinates.d.ts","sourceRoot":"","sources":["../../src/extractors/symbol-coordinates.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;GAIG;AAEH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,4EAA4E;AAE5E,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAA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,QAAQ,EAAE,4BAA4B,GACrC,MAAM,CAIR;AAED,+EAA+E;AAE/E,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,mFAAmF;AAEnF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,uBAAuB,CA4BzB;AAMD;;;GAGG;AAEH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,uBAAuB,CAyBlC;AAmCD;;;;GAIG;AAEH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GACd,wBAAwB,CAiE1B;AAED;;;;;GAKG;AAEH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAClD,MAAM,CAkCR;AAED,+EAA+E;AAE/E,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAC/C,MAAM,CAuBR;AAED;;;GAGG;AAEH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,yBAAyB,CAU3B;AAuDD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,oBAAoB,EAAE,EACrC,kBAAkB,EACd,wBAAwB,GACxB,yBAAyB,GACzB,IAAI,EACR,OAAO,GAAE;IACP,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CAC/D,GACL,oBAAoB,EAAE,CAqExB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import * as path from "node:path";
|
|
4
3
|
import { dump as dumpYAML, load as parseYAML } from "js-yaml";
|
|
4
|
+
import { resolveWorkspaceSourceAbsolute } from "../utils/repo-relative-path.js";
|
|
5
5
|
/**
|
|
6
6
|
* Format version of the generated coordinate artifact. Version 2 binds every
|
|
7
7
|
* record to the extraction identity that produced it so stale coordinates can
|
|
@@ -299,10 +299,8 @@ function manifestSourceFile(record) {
|
|
|
299
299
|
return undefined;
|
|
300
300
|
}
|
|
301
301
|
function defaultResolveSourceText(sourceFile) {
|
|
302
|
-
const absolute =
|
|
303
|
-
|
|
304
|
-
: path.resolve(process.cwd(), sourceFile);
|
|
305
|
-
if (!existsSync(absolute))
|
|
302
|
+
const absolute = resolveWorkspaceSourceAbsolute(process.cwd(), sourceFile);
|
|
303
|
+
if (absolute === null || !existsSync(absolute))
|
|
306
304
|
return null;
|
|
307
305
|
try {
|
|
308
306
|
const content = readFileSync(absolute, "utf8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-coordinator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AASnF,OAAO,EACL,KAAK,mBAAmB,EAExB,kCAAkC,EACnC,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,MAAM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,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,GAC1C,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAClC,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,GACjC,oBAAoB,CAAC;AA8DxB;;;GAGG;AAEH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAO/B;AA+CD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,mBAAmB,EAAE,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,GAC1C,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA6FhC"}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import * as fs from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import { createMaintenanceSourceAnalysisService } from "../plugins/maintenance-source-analysis.js";
|
|
21
|
+
import { resolveWorkspaceSourceAbsolute } from "../utils/repo-relative-path.js";
|
|
21
22
|
import { createSourceAnalysisService, } from "../plugins/source-analysis-service.js";
|
|
22
23
|
import { extensionLanguage, isTsJsSourcePath, } from "../plugins/source-classification.js";
|
|
23
24
|
import { createTsMorphSourceAnalysisProvider, enrichSymbolCoordinatesWithTsMorph, } from "./symbols-ts.js";
|
|
@@ -230,10 +231,8 @@ function enrichWithRegexHeuristic(entry, absolutePath) {
|
|
|
230
231
|
function resolveSourcePath(sourceFile, workspaceRoot) {
|
|
231
232
|
if (!sourceFile)
|
|
232
233
|
return null;
|
|
233
|
-
const absolutePath =
|
|
234
|
-
|
|
235
|
-
: path.resolve(workspaceRoot, sourceFile);
|
|
236
|
-
if (!fs.existsSync(absolutePath))
|
|
234
|
+
const absolutePath = resolveWorkspaceSourceAbsolute(workspaceRoot, sourceFile);
|
|
235
|
+
if (absolutePath === null || !fs.existsSync(absolutePath))
|
|
237
236
|
return null;
|
|
238
237
|
return { absolutePath };
|
|
239
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-granularity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-granularity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAajF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA0BpD;;;;GAIG;AAEH,eAAO,MAAM,4BAA4B,iCAAiC,CAAC;AA+B3E,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,EACzB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAC3E,OAAO,CAAC,IAAI,CAAC,CAmDf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
1
|
import { collectGranularityCandidates } from "kibi-plugin-builtin";
|
|
3
2
|
import { InputError } from "../../cli-errors.js";
|
|
3
|
+
import { resolveWorkspaceSourceAbsolute } from "../../utils/repo-relative-path.js";
|
|
4
4
|
import { ALLOWED_GRANULARITY_REASONS_PROSE, coarseLinkBehavioralNames, getBehavioralSymbolNames, getNonBehavioralSymbolNames, inferSymbolRole, isAllowedGranularityReason, isTraceabilityRelationshipType, } from "../../public/symbol-granularity.js";
|
|
5
5
|
function candidate(name, kind) {
|
|
6
6
|
return { name, kind, role: inferSymbolRole(kind) };
|
|
@@ -66,9 +66,9 @@ export async function validateSymbolGranularity(payload, relationships, context,
|
|
|
66
66
|
const fs = context.fs;
|
|
67
67
|
if (fs === undefined)
|
|
68
68
|
return;
|
|
69
|
-
const sourcePath =
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const sourcePath = resolveWorkspaceSourceAbsolute(context.workspaceRoot, entity.sourceFile);
|
|
70
|
+
if (sourcePath === null)
|
|
71
|
+
return;
|
|
72
72
|
let content;
|
|
73
73
|
try {
|
|
74
74
|
const stat = await fs.stat(sourcePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-refresh.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"symbol-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-refresh.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAiBjF,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,WAAW,GACX,SAAS,GACT,WAAW,CAAC;AAGhB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,0BAA0B,CAAC;CACnD,CAAC;AAGF,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAgB,KACtB,OAAO,CAAC,aAAa,CAAC,CAAC;AAqD5B,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,IAAI,CAMN;AAiPD,4EAA4E;AAC5E,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,yEAAyE;AAEzE,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED;;;GAGG;AAEH,wBAAsB,mCAAmC,CACvD,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAOxB;AAGD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAAG,SAAS,GACzC,IAAI,CAEN"}
|
|
@@ -6,6 +6,7 @@ import { CoordinateArtifactError, coarseCoordinateSpan, coordinateIdentityHash,
|
|
|
6
6
|
import { enrichSymbolCoordinates } from "../../public/extractors/symbols-coordinator.js";
|
|
7
7
|
import { isCoarseGranularityReason } from "../../public/symbol-granularity.js";
|
|
8
8
|
import { CANONICAL_ENTITY_PATHS } from "../../utils/kb-paths.js";
|
|
9
|
+
import { resolveWorkspaceSourceAbsolute } from "../../utils/repo-relative-path.js";
|
|
9
10
|
import { withSymbolCompilerLock } from "./symbol-compiler-lock.js";
|
|
10
11
|
function record(value) {
|
|
11
12
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29,9 +30,9 @@ function artifactPathFor(manifest) {
|
|
|
29
30
|
return path.join(path.dirname(manifest), "symbol-coordinates.yaml");
|
|
30
31
|
}
|
|
31
32
|
function sourceTextFor(sourceFile, workspaceRoot) {
|
|
32
|
-
const absolute =
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const absolute = resolveWorkspaceSourceAbsolute(workspaceRoot, sourceFile);
|
|
34
|
+
if (absolute === null)
|
|
35
|
+
return null;
|
|
35
36
|
try {
|
|
36
37
|
return readFileSync(absolute, "utf8");
|
|
37
38
|
}
|
|
@@ -228,6 +228,9 @@ export { isAllowedGranularityReason };
|
|
|
228
228
|
* artifact, but the engine never merges coordinates for KB-internal paths —
|
|
229
229
|
* coverage then reports missing_symbol_coordinates forever with no signal.
|
|
230
230
|
* Reject the configuration at upsert time instead.
|
|
231
|
+
*
|
|
232
|
+
* Also reject absolute paths and `..` escapes so coordinate refresh cannot be
|
|
233
|
+
* used as a workspace-escape oracle against files outside the repository.
|
|
231
234
|
*/
|
|
232
235
|
function validateSymbolSourceFile(entity) {
|
|
233
236
|
if (entity.type !== "symbol")
|
|
@@ -239,6 +242,14 @@ function validateSymbolSourceFile(entity) {
|
|
|
239
242
|
if (normalized === ".kb" || normalized.startsWith(".kb/")) {
|
|
240
243
|
throw new Error(`Entity validation failed: symbol sourceFile must point at a real code file in the workspace, not into the knowledge base ('${sourceFile}'). Coordinates for .kb/ paths are never merged into the engine, so coverage would report missing_symbol_coordinates permanently. Point the symbol at the implementing or verifying code file instead.`);
|
|
241
244
|
}
|
|
245
|
+
// Lexical confinement (no workspace root needed): absolute paths and `..`
|
|
246
|
+
// segments are never valid authored sourceFile values.
|
|
247
|
+
if (normalized.startsWith("/") ||
|
|
248
|
+
/^[A-Za-z]:\//.test(normalized) ||
|
|
249
|
+
normalized.startsWith("//") ||
|
|
250
|
+
normalized.split("/").includes("..")) {
|
|
251
|
+
throw new Error(`Entity validation failed: symbol sourceFile must be a workspace-relative path ('${sourceFile}'). Absolute paths and '..' escapes are rejected so coordinate refresh cannot read files outside the repository.`);
|
|
252
|
+
}
|
|
242
253
|
}
|
|
243
254
|
/**
|
|
244
255
|
* proof_exempt parks a current requirement outside E2E-proof scope. Without a
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const qualifiedSourceAnalyzers: readonly [{
|
|
2
2
|
readonly packageName: "kibi-plugin-treesitter";
|
|
3
|
-
readonly version: "2.0.
|
|
3
|
+
readonly version: "2.0.1";
|
|
4
4
|
readonly files: {
|
|
5
|
-
readonly "SBOM.spdx.json": "
|
|
5
|
+
readonly "SBOM.spdx.json": "8e7136ff7d28e8acb32e864baa9f4e69eee02620550ed7f0551c115759de8561";
|
|
6
6
|
readonly "THIRD_PARTY_NOTICES.md": "0b1ede96cb261dab73fd1ec8c51d7bb5b2492eed0502f6c10ed071736daa263c";
|
|
7
7
|
readonly "assets/queries/bash.scm": "6ca535e8fe652b51203ac272831881dab001f7ac508e50551bc2cdc4a15d7b6c";
|
|
8
8
|
readonly "assets/queries/c.scm": "774ca67cfe23b0e0d1d3a4f01788049a822beb1311feee72b20a595a37be1e28";
|
|
@@ -32,13 +32,13 @@ export declare const qualifiedSourceAnalyzers: readonly [{
|
|
|
32
32
|
readonly "assets/tree-sitter-ruby.wasm": "09a96427d7c72f0613ed470cd9812223fc4a91d6a9c025c0235cc6bd59ff96f4";
|
|
33
33
|
readonly "assets/tree-sitter-rust.wasm": "f65f354215611fd94ad34134b3427eb3d58cbb745df7b6509ba722184db73d57";
|
|
34
34
|
readonly "assets/tree-sitter-terraform.release.wasm": "59dbcbb0f08eb78b78f37510834559a48ce5c9d4866c978d62c6390796461cb5";
|
|
35
|
-
readonly "catalog.json": "
|
|
36
|
-
readonly "dist/analysis-worker.js": "
|
|
35
|
+
readonly "catalog.json": "af91adedf93039b54471c99fdd4bbf10a2f3ce716324be6935a6dbdd4aee2d0b";
|
|
36
|
+
readonly "dist/analysis-worker.js": "7e87c177a5893e7edd5b6fb2b2798aadf22831c092af96026a2de130034116f5";
|
|
37
37
|
readonly "dist/catalog.js": "460243c48cb6a03b8c7971273729d8a1134955186978b6c0d04182c71960ebff";
|
|
38
38
|
readonly "dist/extractor.js": "1d8cd819e7ec8fcc291a44e5ffe4ccfe77099301677913fcfe0d92e7ce971f33";
|
|
39
39
|
readonly "dist/index.js": "adc03d77d94c0133b3188950b35f79db19e447cf7bfa1f7e1cf1f5c97a582a44";
|
|
40
40
|
readonly "dist/performance-timing.js": "56cce530f627c8fd079e8ec070322f84378ae50c40a6765d88b418850692940b";
|
|
41
|
-
readonly "integrity.json": "
|
|
41
|
+
readonly "integrity.json": "d203e1e7b1e25264a56ce85a1d99b4b09ddcb093ffd4a21d591045dc3deeff3f";
|
|
42
42
|
readonly "licenses/tree-sitter-bash-MIT.txt": "49bf33cf78ef5897e4e161ce1517df7de1ae5042a65b6bcfd44401e0fc606559";
|
|
43
43
|
readonly "licenses/tree-sitter-c-MIT.txt": "2e0110e07abef7c2548b26ec9d6969775617ca539a0dc8dbeeb14d6452c711d1";
|
|
44
44
|
readonly "licenses/tree-sitter-c-sharp-MIT.txt": "778fb7d63b8c1844da315648c02f325c4713a6f4a5d19644fd413421422776d3";
|
|
@@ -51,7 +51,7 @@ export declare const qualifiedSourceAnalyzers: readonly [{
|
|
|
51
51
|
readonly "licenses/tree-sitter-ruby-MIT.txt": "9c99b99e93d3c6461bef9f6bac45d17b8bf014172625c24f76319bbd235a7b80";
|
|
52
52
|
readonly "licenses/tree-sitter-rust-MIT.txt": "31d5b6f4243d5c7c6e1c4ebbbb9f6407bd1457a08bcc4f706521710341acba36";
|
|
53
53
|
readonly "licenses/web-tree-sitter-MIT.txt": "c5cfb43042b6b72045f4ba997834d0a7786d2793d91680868b5815b39f14fc78";
|
|
54
|
-
readonly "package.json": "
|
|
54
|
+
readonly "package.json": "094ab574489d2d0994b12acdf5d70a227f7b37cf8a9b40965d7ee5c440b5aae0";
|
|
55
55
|
};
|
|
56
56
|
readonly dependencies: readonly [{
|
|
57
57
|
readonly packageName: "web-tree-sitter";
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
export const qualifiedSourceAnalyzers = [
|
|
5
5
|
{
|
|
6
6
|
packageName: "kibi-plugin-treesitter",
|
|
7
|
-
version: "2.0.
|
|
7
|
+
version: "2.0.1",
|
|
8
8
|
files: {
|
|
9
|
-
"SBOM.spdx.json": "
|
|
9
|
+
"SBOM.spdx.json": "8e7136ff7d28e8acb32e864baa9f4e69eee02620550ed7f0551c115759de8561",
|
|
10
10
|
"THIRD_PARTY_NOTICES.md": "0b1ede96cb261dab73fd1ec8c51d7bb5b2492eed0502f6c10ed071736daa263c",
|
|
11
11
|
"assets/queries/bash.scm": "6ca535e8fe652b51203ac272831881dab001f7ac508e50551bc2cdc4a15d7b6c",
|
|
12
12
|
"assets/queries/c.scm": "774ca67cfe23b0e0d1d3a4f01788049a822beb1311feee72b20a595a37be1e28",
|
|
@@ -36,13 +36,13 @@ export const qualifiedSourceAnalyzers = [
|
|
|
36
36
|
"assets/tree-sitter-ruby.wasm": "09a96427d7c72f0613ed470cd9812223fc4a91d6a9c025c0235cc6bd59ff96f4",
|
|
37
37
|
"assets/tree-sitter-rust.wasm": "f65f354215611fd94ad34134b3427eb3d58cbb745df7b6509ba722184db73d57",
|
|
38
38
|
"assets/tree-sitter-terraform.release.wasm": "59dbcbb0f08eb78b78f37510834559a48ce5c9d4866c978d62c6390796461cb5",
|
|
39
|
-
"catalog.json": "
|
|
40
|
-
"dist/analysis-worker.js": "
|
|
39
|
+
"catalog.json": "af91adedf93039b54471c99fdd4bbf10a2f3ce716324be6935a6dbdd4aee2d0b",
|
|
40
|
+
"dist/analysis-worker.js": "7e87c177a5893e7edd5b6fb2b2798aadf22831c092af96026a2de130034116f5",
|
|
41
41
|
"dist/catalog.js": "460243c48cb6a03b8c7971273729d8a1134955186978b6c0d04182c71960ebff",
|
|
42
42
|
"dist/extractor.js": "1d8cd819e7ec8fcc291a44e5ffe4ccfe77099301677913fcfe0d92e7ce971f33",
|
|
43
43
|
"dist/index.js": "adc03d77d94c0133b3188950b35f79db19e447cf7bfa1f7e1cf1f5c97a582a44",
|
|
44
44
|
"dist/performance-timing.js": "56cce530f627c8fd079e8ec070322f84378ae50c40a6765d88b418850692940b",
|
|
45
|
-
"integrity.json": "
|
|
45
|
+
"integrity.json": "d203e1e7b1e25264a56ce85a1d99b4b09ddcb093ffd4a21d591045dc3deeff3f",
|
|
46
46
|
"licenses/tree-sitter-bash-MIT.txt": "49bf33cf78ef5897e4e161ce1517df7de1ae5042a65b6bcfd44401e0fc606559",
|
|
47
47
|
"licenses/tree-sitter-c-MIT.txt": "2e0110e07abef7c2548b26ec9d6969775617ca539a0dc8dbeeb14d6452c711d1",
|
|
48
48
|
"licenses/tree-sitter-c-sharp-MIT.txt": "778fb7d63b8c1844da315648c02f325c4713a6f4a5d19644fd413421422776d3",
|
|
@@ -55,7 +55,7 @@ export const qualifiedSourceAnalyzers = [
|
|
|
55
55
|
"licenses/tree-sitter-ruby-MIT.txt": "9c99b99e93d3c6461bef9f6bac45d17b8bf014172625c24f76319bbd235a7b80",
|
|
56
56
|
"licenses/tree-sitter-rust-MIT.txt": "31d5b6f4243d5c7c6e1c4ebbbb9f6407bd1457a08bcc4f706521710341acba36",
|
|
57
57
|
"licenses/web-tree-sitter-MIT.txt": "c5cfb43042b6b72045f4ba997834d0a7786d2793d91680868b5815b39f14fc78",
|
|
58
|
-
"package.json": "
|
|
58
|
+
"package.json": "094ab574489d2d0994b12acdf5d70a227f7b37cf8a9b40965d7ee5c440b5aae0",
|
|
59
59
|
},
|
|
60
60
|
dependencies: [
|
|
61
61
|
{
|
|
@@ -15,4 +15,11 @@
|
|
|
15
15
|
* (the workspace snapshot), the caller compares it in NFC.
|
|
16
16
|
*/
|
|
17
17
|
export declare function normalizeRepoRelativePath(workspaceRoot: string, candidate: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a recorded source path to an absolute path that is lexically (and,
|
|
20
|
+
* when the file exists, via realpath) confined under `workspaceRoot`.
|
|
21
|
+
* Returns null for escapes, empty input, or symlink targets outside the root.
|
|
22
|
+
* Callers must treat null as "do not read".
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveWorkspaceSourceAbsolute(workspaceRoot: string, sourceFile: string): string | null;
|
|
18
25
|
//# sourceMappingURL=repo-relative-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-relative-path.d.ts","sourceRoot":"","sources":["../../src/utils/repo-relative-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repo-relative-path.d.ts","sourceRoot":"","sources":["../../src/utils/repo-relative-path.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAsBf;AAED;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAcf"}
|
|
@@ -15,6 +15,7 @@
|
|
|
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
17
|
*/
|
|
18
|
+
import { realpathSync } from "node:fs";
|
|
18
19
|
import path from "node:path";
|
|
19
20
|
/**
|
|
20
21
|
* Canonical repository-relative form of a recorded path, as proof freshness
|
|
@@ -56,3 +57,28 @@ export function normalizeRepoRelativePath(workspaceRoot, candidate) {
|
|
|
56
57
|
}
|
|
57
58
|
return normalized;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a recorded source path to an absolute path that is lexically (and,
|
|
62
|
+
* when the file exists, via realpath) confined under `workspaceRoot`.
|
|
63
|
+
* Returns null for escapes, empty input, or symlink targets outside the root.
|
|
64
|
+
* Callers must treat null as "do not read".
|
|
65
|
+
*/
|
|
66
|
+
// implements REQ-symbol-sourcefile-workspace-confinement
|
|
67
|
+
export function resolveWorkspaceSourceAbsolute(workspaceRoot, sourceFile) {
|
|
68
|
+
const relative = normalizeRepoRelativePath(workspaceRoot, sourceFile);
|
|
69
|
+
if (relative === null)
|
|
70
|
+
return null;
|
|
71
|
+
const absolute = path.resolve(workspaceRoot, relative);
|
|
72
|
+
try {
|
|
73
|
+
const realRoot = realpathSync.native(path.resolve(workspaceRoot));
|
|
74
|
+
const realFile = realpathSync.native(absolute);
|
|
75
|
+
const confined = path.relative(realRoot, realFile);
|
|
76
|
+
if (confined.startsWith("..") || path.isAbsolute(confined))
|
|
77
|
+
return null;
|
|
78
|
+
return realFile;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Missing path: lexical confinement from normalizeRepoRelativePath is enough.
|
|
82
|
+
return absolute;
|
|
83
|
+
}
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-cli",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kibi CLI for knowledge base management",
|
|
6
6
|
"engines": {
|
|
@@ -235,13 +235,13 @@
|
|
|
235
235
|
"fast-glob": "^3.2.12",
|
|
236
236
|
"gray-matter": "^4.0.3",
|
|
237
237
|
"js-yaml": "^4.1.0",
|
|
238
|
-
"kibi-core": "^0.22.
|
|
239
|
-
"kibi-plugin-builtin": "^0.5.
|
|
238
|
+
"kibi-core": "^0.22.4",
|
|
239
|
+
"kibi-plugin-builtin": "^0.5.3",
|
|
240
240
|
"kibi-plugin-sdk": "^0.5.0",
|
|
241
241
|
"kibi-swipl": "^1.0.1",
|
|
242
242
|
"saxes": "^6.0.0",
|
|
243
243
|
"ignore": "^5.3.0",
|
|
244
|
-
"yaml": "^2.9.
|
|
244
|
+
"yaml": "^2.9.1"
|
|
245
245
|
},
|
|
246
246
|
"devDependencies": {
|
|
247
247
|
"@types/node": "latest",
|
package/schema/entities.pl
CHANGED
|
@@ -29,7 +29,8 @@ entity_property(_, priority, atom).
|
|
|
29
29
|
entity_property(_, severity, atom).
|
|
30
30
|
entity_property(_, links, list).
|
|
31
31
|
entity_property(_, text_ref, uri).
|
|
32
|
-
|
|
32
|
+
% Workspace-relative source paths only (no absolute / .. escapes).
|
|
33
|
+
entity_property(_, sourceFile, workspace_relpath).
|
|
33
34
|
% Provenance of any authored entity: a JSON object (kind, ref, approved_by,
|
|
34
35
|
% recorded_at) naming who authored it and on what authority.
|
|
35
36
|
entity_property(_, origin, list_or_json).
|
package/schema/validation.pl
CHANGED
|
@@ -50,11 +50,26 @@ check_kind(datetime, V) :- string(V). % accept ISO strings for now
|
|
|
50
50
|
check_kind(list, V) :- is_list(V).
|
|
51
51
|
check_kind(list_or_json, V) :- is_list(V) ; string(V) ; atom(V).
|
|
52
52
|
check_kind(uri, V) :- string(V).
|
|
53
|
+
% Non-empty workspace-relative path: reject absolute forms and `..` segments.
|
|
54
|
+
check_kind(workspace_relpath, V) :-
|
|
55
|
+
string(V),
|
|
56
|
+
string_length(V, Len),
|
|
57
|
+
Len > 0,
|
|
58
|
+
\+ workspace_relpath_absolute(V),
|
|
59
|
+
split_string(V, "/\\", "", Parts),
|
|
60
|
+
\+ member("..", Parts).
|
|
53
61
|
check_kind(integer, V) :- integer(V).
|
|
54
62
|
check_kind(number, V) :- number(V).
|
|
55
63
|
check_kind(boolean, true).
|
|
56
64
|
check_kind(boolean, false).
|
|
57
65
|
|
|
66
|
+
workspace_relpath_absolute(V) :- sub_string(V, 0, 1, _, "/").
|
|
67
|
+
workspace_relpath_absolute(V) :-
|
|
68
|
+
string_length(V, Len),
|
|
69
|
+
Len >= 2,
|
|
70
|
+
sub_string(V, 1, 1, _, ":").
|
|
71
|
+
workspace_relpath_absolute(V) :- sub_string(V, 0, 2, _, "\\\\").
|
|
72
|
+
|
|
58
73
|
% Fallback false
|
|
59
74
|
check_kind(_, _) :- fail.
|
|
60
75
|
|