kibi-cli 0.4.0 → 0.4.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,iBAAiB,CAAC;AAazB,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,mBAAmB,EAAE,EAC9B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAmChC"}
1
+ {"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,iBAAiB,CAAC;AAazB,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,mBAAmB,EAAE,EAC9B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAoChC"}
@@ -29,6 +29,7 @@ const TS_JS_EXTENSIONS = new Set([
29
29
  ".cjs",
30
30
  ]);
31
31
  export async function enrichSymbolCoordinates(entries, workspaceRoot) {
32
+ // implements REQ-vscode-traceability
32
33
  const output = entries.map((entry) => ({ ...entry }));
33
34
  const tsIndices = [];
34
35
  const tsEntries = [];
@@ -29,6 +29,7 @@ const SUPPORTED_SOURCE_EXTENSIONS = new Set([
29
29
  ".cjs",
30
30
  ]);
31
31
  export async function enrichSymbolCoordinatesWithTsMorph(entries, workspaceRoot) {
32
+ // implements REQ-vscode-traceability
32
33
  const project = new Project({
33
34
  skipAddingFilesFromTsConfig: true,
34
35
  });
@@ -163,8 +164,41 @@ function findNamedDeclaration(sourceFile, title) {
163
164
  candidates.push({ node: declaration, getNameNode: () => nameNode });
164
165
  }
165
166
  }
166
- if (candidates.length === 0)
167
+ if (candidates.length === 0) {
168
+ // Second pass: unique non-exported top-level functions only
169
+ const internalCandidates = [];
170
+ for (const decl of sourceFile.getFunctions()) {
171
+ if (decl.isExported())
172
+ continue; // Already scanned in first pass
173
+ if (decl.getName() !== title)
174
+ continue;
175
+ const nameNode = decl.getNameNode();
176
+ if (!nameNode)
177
+ continue;
178
+ internalCandidates.push({ node: decl, getNameNode: () => nameNode });
179
+ }
180
+ // Fail closed: only return if exactly one unique match
181
+ if (internalCandidates.length === 1) {
182
+ return internalCandidates[0];
183
+ }
184
+ // Third pass: unique class methods
185
+ const methodCandidates = [];
186
+ for (const cls of sourceFile.getClasses()) {
187
+ for (const method of cls.getMethods()) {
188
+ if (method.getName() !== title)
189
+ continue;
190
+ const nameNode = method.getNameNode();
191
+ if (!nameNode)
192
+ continue;
193
+ methodCandidates.push({ node: method, getNameNode: () => nameNode });
194
+ }
195
+ }
196
+ // Fail closed: only return if exactly one unique match
197
+ if (methodCandidates.length === 1) {
198
+ return methodCandidates[0];
199
+ }
167
200
  return null;
201
+ }
168
202
  candidates.sort((a, b) => a.getNameNode().getStart() - b.getNameNode().getStart());
169
203
  return candidates[0] ?? null;
170
204
  }
@@ -1,2 +1,2 @@
1
- export { PrologProcess } from "../../prolog.js";
1
+ export { PrologProcess, resolveKbPlPath } from "../../prolog.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/prolog/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -15,4 +15,4 @@
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
- export { PrologProcess } from "../../prolog.js";
18
+ export { PrologProcess, resolveKbPlPath } from "../../prolog.js";
@@ -12,6 +12,17 @@ export interface Violation {
12
12
  currentLinks: number;
13
13
  requiredLinks: number;
14
14
  }
15
+ declare function unquoteAtom(value: string): string;
16
+ declare function splitTopLevelComma(s: string): string[];
17
+ declare function splitTopLevelLists(value: string): string[];
18
+ declare function parsePrologListOfLists(value: string): string[][];
15
19
  export declare function validateStagedSymbols(options: ValidationOptions): Promise<Violation[]>;
16
20
  export declare function formatViolations(violations: Violation[]): string;
21
+ export declare const __test__: {
22
+ unquoteAtom: typeof unquoteAtom;
23
+ splitTopLevelComma: typeof splitTopLevelComma;
24
+ splitTopLevelLists: typeof splitTopLevelLists;
25
+ parsePrologListOfLists: typeof parsePrologListOfLists;
26
+ };
27
+ export {};
17
28
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/traceability/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAiHD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqCtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAiBhE"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/traceability/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO1C;AAED,iBAAS,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CA0B/C;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA8CnD;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAuBzD;AAGD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqCtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAiBhE;AAGD,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAC"}
@@ -149,3 +149,10 @@ export function formatViolations(violations) {
149
149
  }
150
150
  return lines.join("\n");
151
151
  }
152
+ // Test helpers for edge-case coverage
153
+ export const __test__ = {
154
+ unquoteAtom,
155
+ splitTopLevelComma,
156
+ splitTopLevelLists,
157
+ parsePrologListOfLists,
158
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -16,4 +16,4 @@
16
16
  along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
 
19
- export { PrologProcess } from "../../prolog.js";
19
+ export { PrologProcess, resolveKbPlPath } from "../../prolog.js";