aspectcode 0.2.2 → 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.d.ts +15 -47
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -17
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +14 -24
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -60
- package/dist/config.js.map +1 -1
- package/dist/kbBuilder.d.ts +14 -0
- package/dist/kbBuilder.d.ts.map +1 -0
- package/dist/kbBuilder.js +106 -0
- package/dist/kbBuilder.js.map +1 -0
- package/dist/main.d.ts +4 -5
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +45 -124
- package/dist/main.js.map +1 -1
- package/dist/optimize.d.ts +14 -0
- package/dist/optimize.d.ts.map +1 -0
- package/dist/optimize.js +131 -0
- package/dist/optimize.js.map +1 -0
- package/dist/pipeline.d.ts +15 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +212 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/toolIngestion.d.ts +15 -0
- package/dist/toolIngestion.d.ts.map +1 -0
- package/dist/toolIngestion.js +47 -0
- package/dist/toolIngestion.js.map +1 -0
- package/dist/writer.d.ts +17 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +26 -0
- package/dist/writer.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/analyzer.d.ts +34 -0
- package/node_modules/@aspectcode/core/dist/analysis/analyzer.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/analyzer.js +240 -0
- package/node_modules/@aspectcode/core/dist/analysis/analyzer.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.d.ts +32 -0
- package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.js +133 -0
- package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/importParsers.d.ts +30 -0
- package/node_modules/@aspectcode/core/dist/analysis/importParsers.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/importParsers.js +92 -0
- package/node_modules/@aspectcode/core/dist/analysis/importParsers.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/index.d.ts +9 -0
- package/node_modules/@aspectcode/core/dist/analysis/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/index.js +9 -0
- package/node_modules/@aspectcode/core/dist/analysis/index.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.d.ts +34 -0
- package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.js +240 -0
- package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts +33 -0
- package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/analysis/repo.js +246 -0
- package/node_modules/@aspectcode/core/dist/analysis/repo.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/classifiers.d.ts +24 -0
- package/node_modules/@aspectcode/core/dist/classifiers.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/classifiers.js +119 -0
- package/node_modules/@aspectcode/core/dist/classifiers.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/exclusions.d.ts +26 -0
- package/node_modules/@aspectcode/core/dist/fs/exclusions.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/exclusions.js +130 -0
- package/node_modules/@aspectcode/core/dist/fs/exclusions.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/fingerprint.d.ts +42 -0
- package/node_modules/@aspectcode/core/dist/fs/fingerprint.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/fingerprint.js +125 -0
- package/node_modules/@aspectcode/core/dist/fs/fingerprint.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/index.d.ts +9 -0
- package/node_modules/@aspectcode/core/dist/fs/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/index.js +26 -0
- package/node_modules/@aspectcode/core/dist/fs/index.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/walker.d.ts +23 -0
- package/node_modules/@aspectcode/core/dist/fs/walker.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/fs/walker.js +94 -0
- package/node_modules/@aspectcode/core/dist/fs/walker.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/host.d.ts +38 -0
- package/node_modules/@aspectcode/core/dist/host.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/host.js +110 -0
- package/node_modules/@aspectcode/core/dist/host.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/index.d.ts +23 -0
- package/node_modules/@aspectcode/core/dist/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/index.js +59 -0
- package/node_modules/@aspectcode/core/dist/index.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/model.d.ts +90 -0
- package/node_modules/@aspectcode/core/dist/model.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/model.js +9 -0
- package/node_modules/@aspectcode/core/dist/model.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.d.ts +17 -0
- package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.js +225 -0
- package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.d.ts +30 -0
- package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.js +71 -0
- package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.d.ts +13 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.js +32 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.d.ts +17 -0
- package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.js +182 -0
- package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts +44 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.js +64 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.d.ts +18 -0
- package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.js +139 -0
- package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts +22 -0
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js +240 -0
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/utils.d.ts +7 -0
- package/node_modules/@aspectcode/core/dist/parsers/utils.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/utils.js +11 -0
- package/node_modules/@aspectcode/core/dist/parsers/utils.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/paths.d.ts +27 -0
- package/node_modules/@aspectcode/core/dist/paths.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/paths.js +45 -0
- package/node_modules/@aspectcode/core/dist/paths.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/stats.d.ts +41 -0
- package/node_modules/@aspectcode/core/dist/stats.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/stats.js +88 -0
- package/node_modules/@aspectcode/core/dist/stats.js.map +1 -0
- package/node_modules/@aspectcode/core/package.json +41 -0
- package/node_modules/@aspectcode/core/parsers/c_sharp.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/java.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/javascript.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/python.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/tree-sitter.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/tsx.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/typescript.wasm +0 -0
- package/node_modules/@aspectcode/emitters/dist/emitter.d.ts +72 -0
- package/node_modules/@aspectcode/emitters/dist/emitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/emitter.js +10 -0
- package/node_modules/@aspectcode/emitters/dist/emitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/host.d.ts +31 -0
- package/node_modules/@aspectcode/emitters/dist/host.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/host.js +86 -0
- package/node_modules/@aspectcode/emitters/dist/host.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/index.d.ts +27 -0
- package/node_modules/@aspectcode/emitters/dist/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/index.js +116 -0
- package/node_modules/@aspectcode/emitters/dist/index.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts +15 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js +289 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts +13 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.js +55 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/formats.d.ts +17 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/formats.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/formats.js +23 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/formats.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts +5 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/index.js +12 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/index.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts +9 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js +30 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts +64 -0
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js +504 -0
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.d.ts +24 -0
- package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.js +238 -0
- package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/classifiers.d.ts +8 -0
- package/node_modules/@aspectcode/emitters/dist/kb/classifiers.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/classifiers.js +14 -0
- package/node_modules/@aspectcode/emitters/dist/kb/classifiers.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/constants.d.ts +35 -0
- package/node_modules/@aspectcode/emitters/dist/kb/constants.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/constants.js +38 -0
- package/node_modules/@aspectcode/emitters/dist/kb/constants.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.d.ts +20 -0
- package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.js +155 -0
- package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts +52 -0
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.js +391 -0
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/depData.d.ts +18 -0
- package/node_modules/@aspectcode/emitters/dist/kb/depData.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/depData.js +31 -0
- package/node_modules/@aspectcode/emitters/dist/kb/depData.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/detectors.d.ts +18 -0
- package/node_modules/@aspectcode/emitters/dist/kb/detectors.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/detectors.js +317 -0
- package/node_modules/@aspectcode/emitters/dist/kb/detectors.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.d.ts +33 -0
- package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.js +323 -0
- package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/helpers.d.ts +27 -0
- package/node_modules/@aspectcode/emitters/dist/kb/helpers.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/helpers.js +63 -0
- package/node_modules/@aspectcode/emitters/dist/kb/helpers.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts +27 -0
- package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/index.js +72 -0
- package/node_modules/@aspectcode/emitters/dist/kb/index.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts +21 -0
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js +125 -0
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.d.ts +26 -0
- package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.js +255 -0
- package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/policy.d.ts +12 -0
- package/node_modules/@aspectcode/emitters/dist/kb/policy.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/policy.js +29 -0
- package/node_modules/@aspectcode/emitters/dist/kb/policy.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/symbols.d.ts +43 -0
- package/node_modules/@aspectcode/emitters/dist/kb/symbols.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/kb/symbols.js +343 -0
- package/node_modules/@aspectcode/emitters/dist/kb/symbols.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/manifest.d.ts +37 -0
- package/node_modules/@aspectcode/emitters/dist/manifest.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/manifest.js +50 -0
- package/node_modules/@aspectcode/emitters/dist/manifest.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/report.d.ts +22 -0
- package/node_modules/@aspectcode/emitters/dist/report.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/report.js +3 -0
- package/node_modules/@aspectcode/emitters/dist/report.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts +14 -0
- package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/stableJson.js +40 -0
- package/node_modules/@aspectcode/emitters/dist/stableJson.js.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/transaction.d.ts +29 -0
- package/node_modules/@aspectcode/emitters/dist/transaction.d.ts.map +1 -0
- package/node_modules/@aspectcode/emitters/dist/transaction.js +104 -0
- package/node_modules/@aspectcode/emitters/dist/transaction.js.map +1 -0
- package/node_modules/@aspectcode/emitters/package.json +39 -0
- package/node_modules/@aspectcode/optimizer/dist/agent.d.ts +18 -0
- package/node_modules/@aspectcode/optimizer/dist/agent.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/agent.js +123 -0
- package/node_modules/@aspectcode/optimizer/dist/agent.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts +15 -0
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/index.js +31 -0
- package/node_modules/@aspectcode/optimizer/dist/index.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts +39 -0
- package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/prompts.js +156 -0
- package/node_modules/@aspectcode/optimizer/dist/prompts.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts +20 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js +126 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts +28 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/index.js +142 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/index.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts +19 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js +98 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts +19 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.js +87 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts +93 -0
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/types.js +20 -0
- package/node_modules/@aspectcode/optimizer/dist/types.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/package.json +41 -0
- package/package.json +11 -3
- package/dist/commands/deps.d.ts +0 -11
- package/dist/commands/deps.d.ts.map +0 -1
- package/dist/commands/deps.js +0 -197
- package/dist/commands/deps.js.map +0 -1
- package/dist/commands/generate.d.ts +0 -8
- package/dist/commands/generate.d.ts.map +0 -1
- package/dist/commands/generate.js +0 -162
- package/dist/commands/generate.js.map +0 -1
- package/dist/commands/settings.d.ts +0 -9
- package/dist/commands/settings.d.ts.map +0 -1
- package/dist/commands/settings.js +0 -165
- package/dist/commands/settings.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -6
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -180
- package/dist/commands/watch.js.map +0 -1
- package/dist/connections.d.ts +0 -24
- package/dist/connections.d.ts.map +0 -1
- package/dist/connections.js +0 -89
- package/dist/connections.js.map +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript/JavaScript import and symbol extraction using tree-sitter AST.
|
|
4
|
+
*
|
|
5
|
+
* Pure functions — no vscode dependency, only web-tree-sitter.
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.extractTSJSImports = extractTSJSImports;
|
|
12
|
+
exports.extractTSJSSymbols = extractTSJSSymbols;
|
|
13
|
+
const web_tree_sitter_1 = __importDefault(require("web-tree-sitter"));
|
|
14
|
+
const utils_1 = require("./utils");
|
|
15
|
+
// ── Import extraction ────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* Extract TS/JS import module specifiers from source code.
|
|
18
|
+
*
|
|
19
|
+
* Handles ES `import … from "…"`, CommonJS `require("…")`,
|
|
20
|
+
* and dynamic `import("…")`.
|
|
21
|
+
*/
|
|
22
|
+
function extractTSJSImports(lang, code) {
|
|
23
|
+
const parser = new web_tree_sitter_1.default();
|
|
24
|
+
parser.setLanguage(lang);
|
|
25
|
+
const tree = parser.parse(code);
|
|
26
|
+
const root = tree.rootNode;
|
|
27
|
+
const out = [];
|
|
28
|
+
const walk = (n) => {
|
|
29
|
+
if (n.type === 'import_statement' || n.type === 'import_declaration') {
|
|
30
|
+
const source = n.namedChildren.find((ch) => ch.type === 'string' || ch.type === 'string_literal');
|
|
31
|
+
if (source) {
|
|
32
|
+
const txt = (0, utils_1.textFor)(code, source).trim();
|
|
33
|
+
const m = txt.match(/^['"](.+?)['"]$/);
|
|
34
|
+
if (m)
|
|
35
|
+
out.push(m[1]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (n.type === 'call_expression') {
|
|
39
|
+
const callee = n.child(0);
|
|
40
|
+
if (callee && callee.type === 'identifier' && (0, utils_1.textFor)(code, callee) === 'require') {
|
|
41
|
+
const arg = n.namedChildren.find((ch) => ch.type === 'string' || ch.type === 'string_literal');
|
|
42
|
+
if (arg) {
|
|
43
|
+
const m = (0, utils_1.textFor)(code, arg)
|
|
44
|
+
.trim()
|
|
45
|
+
.match(/^['"](.+?)['"]$/);
|
|
46
|
+
if (m)
|
|
47
|
+
out.push(m[1]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const ch of n.namedChildren) {
|
|
52
|
+
walk(ch);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
walk(root);
|
|
56
|
+
tree.delete();
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
// ── Symbol extraction ────────────────────────────────────────
|
|
60
|
+
/**
|
|
61
|
+
* Extract symbols from TypeScript/JavaScript code.
|
|
62
|
+
*
|
|
63
|
+
* Covers: functions, classes, interfaces, type aliases, const
|
|
64
|
+
* declarations (including arrow functions), and abstract classes.
|
|
65
|
+
*/
|
|
66
|
+
function extractTSJSSymbols(lang, code) {
|
|
67
|
+
const parser = new web_tree_sitter_1.default();
|
|
68
|
+
parser.setLanguage(lang);
|
|
69
|
+
const tree = parser.parse(code);
|
|
70
|
+
const root = tree.rootNode;
|
|
71
|
+
const symbols = [];
|
|
72
|
+
const walk = (n) => {
|
|
73
|
+
if (n.type === 'export_statement') {
|
|
74
|
+
const declaration = n.namedChildren.find((ch) => ch.type === 'function_declaration' ||
|
|
75
|
+
ch.type === 'class_declaration' ||
|
|
76
|
+
ch.type === 'interface_declaration' ||
|
|
77
|
+
ch.type === 'type_alias_declaration' ||
|
|
78
|
+
ch.type === 'lexical_declaration' ||
|
|
79
|
+
ch.type === 'abstract_class_declaration');
|
|
80
|
+
if (declaration) {
|
|
81
|
+
extractDeclaration(declaration, true);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if ([
|
|
85
|
+
'function_declaration',
|
|
86
|
+
'class_declaration',
|
|
87
|
+
'interface_declaration',
|
|
88
|
+
'abstract_class_declaration',
|
|
89
|
+
].includes(n.type)) {
|
|
90
|
+
if (n.parent?.type !== 'export_statement') {
|
|
91
|
+
extractDeclaration(n, false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const ch of n.namedChildren) {
|
|
95
|
+
walk(ch);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const extractDeclaration = (n, exported) => {
|
|
99
|
+
if (n.type === 'function_declaration') {
|
|
100
|
+
const nameNode = n.namedChildren.find((ch) => ch.type === 'identifier');
|
|
101
|
+
const paramsNode = n.namedChildren.find((ch) => ch.type === 'formal_parameters');
|
|
102
|
+
if (nameNode) {
|
|
103
|
+
const name = (0, utils_1.textFor)(code, nameNode);
|
|
104
|
+
const params = paramsNode ? extractTSJSParams(code, paramsNode) : [];
|
|
105
|
+
symbols.push({
|
|
106
|
+
name,
|
|
107
|
+
kind: 'function',
|
|
108
|
+
signature: `function ${name}(${params.join(', ')})`,
|
|
109
|
+
exported,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (n.type === 'class_declaration' || n.type === 'abstract_class_declaration') {
|
|
114
|
+
const nameNode = n.namedChildren.find((ch) => ch.type === 'type_identifier');
|
|
115
|
+
const heritageNode = n.namedChildren.find((ch) => ch.type === 'class_heritage');
|
|
116
|
+
if (nameNode) {
|
|
117
|
+
const name = (0, utils_1.textFor)(code, nameNode);
|
|
118
|
+
let inherits;
|
|
119
|
+
if (heritageNode) {
|
|
120
|
+
const extendsClause = heritageNode.namedChildren.find((ch) => ch.type === 'extends_clause');
|
|
121
|
+
if (extendsClause) {
|
|
122
|
+
const typeId = extendsClause.namedChildren.find((ch) => ch.type === 'type_identifier' || ch.type === 'identifier');
|
|
123
|
+
if (typeId) {
|
|
124
|
+
inherits = (0, utils_1.textFor)(code, typeId);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
symbols.push({
|
|
129
|
+
name,
|
|
130
|
+
kind: 'class',
|
|
131
|
+
signature: inherits ? `class ${name} extends ${inherits}` : `class ${name}`,
|
|
132
|
+
inherits,
|
|
133
|
+
exported,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (n.type === 'interface_declaration') {
|
|
138
|
+
const nameNode = n.namedChildren.find((ch) => ch.type === 'type_identifier');
|
|
139
|
+
const extendsClause = n.namedChildren.find((ch) => ch.type === 'extends_type_clause');
|
|
140
|
+
if (nameNode) {
|
|
141
|
+
const name = (0, utils_1.textFor)(code, nameNode);
|
|
142
|
+
let inherits;
|
|
143
|
+
if (extendsClause) {
|
|
144
|
+
const typeId = extendsClause.namedChildren.find((ch) => ch.type === 'type_identifier' || ch.type === 'generic_type');
|
|
145
|
+
if (typeId) {
|
|
146
|
+
inherits = (0, utils_1.textFor)(code, typeId);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
symbols.push({
|
|
150
|
+
name,
|
|
151
|
+
kind: 'interface',
|
|
152
|
+
signature: inherits ? `interface ${name} extends ${inherits}` : `interface ${name}`,
|
|
153
|
+
inherits,
|
|
154
|
+
exported,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (n.type === 'type_alias_declaration') {
|
|
159
|
+
const nameNode = n.namedChildren.find((ch) => ch.type === 'type_identifier');
|
|
160
|
+
if (nameNode) {
|
|
161
|
+
const name = (0, utils_1.textFor)(code, nameNode);
|
|
162
|
+
symbols.push({
|
|
163
|
+
name,
|
|
164
|
+
kind: 'type',
|
|
165
|
+
signature: `type ${name}`,
|
|
166
|
+
exported,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (n.type === 'lexical_declaration') {
|
|
171
|
+
for (const declarator of n.namedChildren) {
|
|
172
|
+
if (declarator.type === 'variable_declarator') {
|
|
173
|
+
const nameNode = declarator.namedChildren.find((ch) => ch.type === 'identifier');
|
|
174
|
+
if (nameNode) {
|
|
175
|
+
const name = (0, utils_1.textFor)(code, nameNode);
|
|
176
|
+
const arrowFn = declarator.namedChildren.find((ch) => ch.type === 'arrow_function');
|
|
177
|
+
if (arrowFn) {
|
|
178
|
+
const paramsNode = arrowFn.namedChildren.find((ch) => ch.type === 'formal_parameters' || ch.type === 'identifier');
|
|
179
|
+
let params = [];
|
|
180
|
+
if (paramsNode) {
|
|
181
|
+
if (paramsNode.type === 'formal_parameters') {
|
|
182
|
+
params = extractTSJSParams(code, paramsNode);
|
|
183
|
+
}
|
|
184
|
+
else if (paramsNode.type === 'identifier') {
|
|
185
|
+
params = [(0, utils_1.textFor)(code, paramsNode)];
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const paramStr = params.length > 0 ? params.join(', ') : '';
|
|
189
|
+
symbols.push({
|
|
190
|
+
name,
|
|
191
|
+
kind: 'const',
|
|
192
|
+
signature: `const ${name} = (${paramStr}) =>`,
|
|
193
|
+
exported,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
symbols.push({
|
|
198
|
+
name,
|
|
199
|
+
kind: 'const',
|
|
200
|
+
signature: `const ${name}`,
|
|
201
|
+
exported,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
walk(root);
|
|
210
|
+
tree.delete();
|
|
211
|
+
return symbols;
|
|
212
|
+
}
|
|
213
|
+
// ── Helpers ──────────────────────────────────────────────────
|
|
214
|
+
function extractTSJSParams(code, paramsNode) {
|
|
215
|
+
const params = [];
|
|
216
|
+
for (const ch of paramsNode.namedChildren) {
|
|
217
|
+
if (ch.type === 'identifier') {
|
|
218
|
+
params.push((0, utils_1.textFor)(code, ch));
|
|
219
|
+
}
|
|
220
|
+
else if (ch.type === 'required_parameter' || ch.type === 'optional_parameter') {
|
|
221
|
+
const pattern = ch.namedChildren.find((c) => c.type === 'identifier' || c.type === 'object_pattern' || c.type === 'array_pattern');
|
|
222
|
+
if (pattern) {
|
|
223
|
+
if (pattern.type === 'identifier') {
|
|
224
|
+
params.push((0, utils_1.textFor)(code, pattern));
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
params.push('...');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (ch.type === 'rest_pattern') {
|
|
232
|
+
const idNode = ch.namedChildren.find((c) => c.type === 'identifier');
|
|
233
|
+
if (idNode) {
|
|
234
|
+
params.push('...' + (0, utils_1.textFor)(code, idNode));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return params.slice(0, 4);
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=tsJsExtractors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsJsExtractors.js","sourceRoot":"","sources":["../../src/parsers/tsJsExtractors.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAcH,gDA0CC;AAUD,gDA+KC;AA/OD,sEAAqC;AAErC,mCAAkC;AAElC,gEAAgE;AAEhE;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,IAAqB,EAAE,IAAY;IACpE,MAAM,MAAM,GAAG,IAAI,yBAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC3B,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,MAAM,IAAI,GAAG,CAAC,CAAoB,EAAE,EAAE;QACpC,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,IAAI,CAAC,CAAC,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AC5F,CAAC;YACF,IAAI,OAAO,EAAE,CAAC;gBACZ,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAClC,MAAM,CAAC,IAAI,CAAC,IAAA,eAAO,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,EAAE,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;YACrE,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,IAAA,eAAO,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for tree-sitter AST extractors.
|
|
3
|
+
*/
|
|
4
|
+
import Parser from 'web-tree-sitter';
|
|
5
|
+
/** Extract the source text for a syntax node. */
|
|
6
|
+
export declare function textFor(source: string, node: Parser.SyntaxNode): string;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/parsers/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,iDAAiD;AACjD,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utility functions for tree-sitter AST extractors.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.textFor = textFor;
|
|
7
|
+
/** Extract the source text for a syntax node. */
|
|
8
|
+
function textFor(source, node) {
|
|
9
|
+
return source.slice(node.startIndex, node.endIndex);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/parsers/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAKH,0BAEC;AAHD,iDAAiD;AACjD,SAAgB,OAAO,CAAC,MAAc,EAAE,IAAuB;IAC7D,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Posix-path normalization — the single source of truth for path format
|
|
3
|
+
* at the model boundary.
|
|
4
|
+
*
|
|
5
|
+
* Every path stored in AnalysisModel (relativePath, graph node ids, edge
|
|
6
|
+
* source/target, hub file, FileSymbols.file) MUST pass through `toPosix()`
|
|
7
|
+
* before being written into the model. This prevents platform-dependent
|
|
8
|
+
* backslash paths from leaking into JSON output.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Convert any path to forward-slash (posix) form.
|
|
12
|
+
*
|
|
13
|
+
* - Replaces all backslashes with forward slashes
|
|
14
|
+
* - Strips leading `./`
|
|
15
|
+
* - Collapses consecutive slashes
|
|
16
|
+
*
|
|
17
|
+
* Safe to call on paths that are already posix — idempotent.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toPosix(p: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Convert an absolute path to a workspace-relative posix path.
|
|
22
|
+
*
|
|
23
|
+
* If the path starts with `workspaceRoot` the prefix is stripped; otherwise
|
|
24
|
+
* the filename (basename) is returned as a fallback.
|
|
25
|
+
*/
|
|
26
|
+
export declare function makeRelativePath(absPath: string, workspaceRoot: string): string;
|
|
27
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAS/E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Posix-path normalization — the single source of truth for path format
|
|
4
|
+
* at the model boundary.
|
|
5
|
+
*
|
|
6
|
+
* Every path stored in AnalysisModel (relativePath, graph node ids, edge
|
|
7
|
+
* source/target, hub file, FileSymbols.file) MUST pass through `toPosix()`
|
|
8
|
+
* before being written into the model. This prevents platform-dependent
|
|
9
|
+
* backslash paths from leaking into JSON output.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.toPosix = toPosix;
|
|
13
|
+
exports.makeRelativePath = makeRelativePath;
|
|
14
|
+
/**
|
|
15
|
+
* Convert any path to forward-slash (posix) form.
|
|
16
|
+
*
|
|
17
|
+
* - Replaces all backslashes with forward slashes
|
|
18
|
+
* - Strips leading `./`
|
|
19
|
+
* - Collapses consecutive slashes
|
|
20
|
+
*
|
|
21
|
+
* Safe to call on paths that are already posix — idempotent.
|
|
22
|
+
*/
|
|
23
|
+
function toPosix(p) {
|
|
24
|
+
return p
|
|
25
|
+
.replace(/\\/g, '/')
|
|
26
|
+
.replace(/\/\/+/g, '/')
|
|
27
|
+
.replace(/^\.\//, '');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convert an absolute path to a workspace-relative posix path.
|
|
31
|
+
*
|
|
32
|
+
* If the path starts with `workspaceRoot` the prefix is stripped; otherwise
|
|
33
|
+
* the filename (basename) is returned as a fallback.
|
|
34
|
+
*/
|
|
35
|
+
function makeRelativePath(absPath, workspaceRoot) {
|
|
36
|
+
const normalizedAbs = toPosix(absPath);
|
|
37
|
+
const normalizedRoot = toPosix(workspaceRoot).replace(/\/$/, '');
|
|
38
|
+
if (normalizedAbs.startsWith(normalizedRoot)) {
|
|
39
|
+
return normalizedAbs.substring(normalizedRoot.length).replace(/^\//, '');
|
|
40
|
+
}
|
|
41
|
+
// Fallback: return the basename
|
|
42
|
+
const parts = normalizedAbs.split('/');
|
|
43
|
+
return parts[parts.length - 1];
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAWH,0BAKC;AAQD,4CASC;AA/BD;;;;;;;;GAQG;AACH,SAAgB,OAAO,CAAC,CAAS;IAC/B,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAe,EAAE,aAAqB;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjE,IAAI,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7C,OAAO,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,gCAAgC;IAChC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model statistics — derived read-only summaries from an AnalysisModel.
|
|
3
|
+
*
|
|
4
|
+
* Emitters (markdown, HTML, JSON, etc.) should use these helpers instead
|
|
5
|
+
* of re-implementing counting/ranking logic.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalysisModel, GraphEdge, HubMetric } from './model';
|
|
8
|
+
export interface ModelStats {
|
|
9
|
+
/** Total number of analyzed files */
|
|
10
|
+
fileCount: number;
|
|
11
|
+
/** Total lines of code across all files */
|
|
12
|
+
totalLines: number;
|
|
13
|
+
/** Count of files per detected language */
|
|
14
|
+
languageCounts: Record<string, number>;
|
|
15
|
+
/** Number of distinct languages */
|
|
16
|
+
languageCount: number;
|
|
17
|
+
/** Total number of graph edges (dependencies) */
|
|
18
|
+
edgeCount: number;
|
|
19
|
+
/** Number of circular dependency edges */
|
|
20
|
+
circularCount: number;
|
|
21
|
+
/** Number of bidirectional edges */
|
|
22
|
+
bidirectionalCount: number;
|
|
23
|
+
/** Total extracted symbols across all files */
|
|
24
|
+
symbolCount: number;
|
|
25
|
+
/** Top N hub files ranked by total degree (in + out) */
|
|
26
|
+
topHubs: HubMetric[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Compute summary statistics from an AnalysisModel.
|
|
30
|
+
*
|
|
31
|
+
* @param model The analysis model to summarize
|
|
32
|
+
* @param topN How many top hubs to include (default 10)
|
|
33
|
+
*/
|
|
34
|
+
export declare function computeModelStats(model: AnalysisModel, topN?: number): ModelStats;
|
|
35
|
+
/**
|
|
36
|
+
* Derive top-N hub files from graph edges, ranked by total degree.
|
|
37
|
+
*
|
|
38
|
+
* Also used by analysis/repo.ts when building the initial model.
|
|
39
|
+
*/
|
|
40
|
+
export declare function deriveHubs(edges: GraphEdge[], topN?: number): HubMetric[];
|
|
41
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAInE,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,IAAI,SAAK,GACR,UAAU,CA4CZ;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,SAAK,GAAG,SAAS,EAAE,CAsBrE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Model statistics — derived read-only summaries from an AnalysisModel.
|
|
4
|
+
*
|
|
5
|
+
* Emitters (markdown, HTML, JSON, etc.) should use these helpers instead
|
|
6
|
+
* of re-implementing counting/ranking logic.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.computeModelStats = computeModelStats;
|
|
10
|
+
exports.deriveHubs = deriveHubs;
|
|
11
|
+
// ── Public API ───────────────────────────────────────────────
|
|
12
|
+
/**
|
|
13
|
+
* Compute summary statistics from an AnalysisModel.
|
|
14
|
+
*
|
|
15
|
+
* @param model The analysis model to summarize
|
|
16
|
+
* @param topN How many top hubs to include (default 10)
|
|
17
|
+
*/
|
|
18
|
+
function computeModelStats(model, topN = 10) {
|
|
19
|
+
// Language counts & total lines
|
|
20
|
+
const languageCounts = {};
|
|
21
|
+
let totalLines = 0;
|
|
22
|
+
for (const f of model.files) {
|
|
23
|
+
languageCounts[f.language] = (languageCounts[f.language] ?? 0) + 1;
|
|
24
|
+
totalLines += f.lineCount;
|
|
25
|
+
}
|
|
26
|
+
// Edge classification
|
|
27
|
+
let circularCount = 0;
|
|
28
|
+
let bidirectionalCount = 0;
|
|
29
|
+
for (const e of model.graph.edges) {
|
|
30
|
+
if (e.type === 'circular')
|
|
31
|
+
circularCount++;
|
|
32
|
+
if (e.bidirectional)
|
|
33
|
+
bidirectionalCount++;
|
|
34
|
+
}
|
|
35
|
+
// Symbol count
|
|
36
|
+
let symbolCount = 0;
|
|
37
|
+
for (const fs of model.symbols) {
|
|
38
|
+
symbolCount += fs.symbols.length;
|
|
39
|
+
}
|
|
40
|
+
// Hubs — use model.metrics.hubs if populated, otherwise derive from edges
|
|
41
|
+
let topHubs;
|
|
42
|
+
if (model.metrics.hubs.length > 0) {
|
|
43
|
+
topHubs = [...model.metrics.hubs]
|
|
44
|
+
.sort((a, b) => b.inDegree + b.outDegree - (a.inDegree + a.outDegree))
|
|
45
|
+
.slice(0, topN);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
topHubs = deriveHubs(model.graph.edges, topN);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
fileCount: model.files.length,
|
|
52
|
+
totalLines,
|
|
53
|
+
languageCounts,
|
|
54
|
+
languageCount: Object.keys(languageCounts).length,
|
|
55
|
+
edgeCount: model.graph.edges.length,
|
|
56
|
+
circularCount,
|
|
57
|
+
bidirectionalCount,
|
|
58
|
+
symbolCount,
|
|
59
|
+
topHubs,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// ── Hub computation ──────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* Derive top-N hub files from graph edges, ranked by total degree.
|
|
65
|
+
*
|
|
66
|
+
* Also used by analysis/repo.ts when building the initial model.
|
|
67
|
+
*/
|
|
68
|
+
function deriveHubs(edges, topN = 10) {
|
|
69
|
+
const inDeg = new Map();
|
|
70
|
+
const outDeg = new Map();
|
|
71
|
+
for (const e of edges) {
|
|
72
|
+
outDeg.set(e.source, (outDeg.get(e.source) ?? 0) + 1);
|
|
73
|
+
inDeg.set(e.target, (inDeg.get(e.target) ?? 0) + 1);
|
|
74
|
+
}
|
|
75
|
+
const allFiles = new Set([...inDeg.keys(), ...outDeg.keys()]);
|
|
76
|
+
const hubs = [];
|
|
77
|
+
for (const file of allFiles) {
|
|
78
|
+
hubs.push({
|
|
79
|
+
file,
|
|
80
|
+
inDegree: inDeg.get(file) ?? 0,
|
|
81
|
+
outDegree: outDeg.get(file) ?? 0,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return hubs
|
|
85
|
+
.sort((a, b) => b.inDegree + b.outDegree - (a.inDegree + a.outDegree))
|
|
86
|
+
.slice(0, topN);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmCH,8CA+CC;AASD,gCAsBC;AAtFD,gEAAgE;AAEhE;;;;;G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AC;YACR,IAAI;YACJ,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9B,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACjC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI;SACR,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;SACrE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aspectcode/core",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Pure-logic core for Aspect Code — no VS Code dependency",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"parsers"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/asashepard/aspectcode.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "mocha --require ts-node/register 'test/**/*.test.ts'",
|
|
29
|
+
"test:snapshot": "mocha --require ts-node/register 'test/snapshot.test.ts'"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"web-tree-sitter": "^0.21.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/mocha": "^10.0.0",
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"mocha": "^10.4.0",
|
|
38
|
+
"ts-node": "^10.9.2",
|
|
39
|
+
"typescript": "^5.5.4"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emitter interface — the contract for all artifact generators.
|
|
3
|
+
*
|
|
4
|
+
* Each emitter takes an AnalysisModel + options and writes files
|
|
5
|
+
* via the EmitterHost abstraction. Emitters MUST produce deterministic
|
|
6
|
+
* output for the same input (modulo `generatedAt` timestamps).
|
|
7
|
+
*/
|
|
8
|
+
import type { AnalysisModel } from '@aspectcode/core';
|
|
9
|
+
import type { EmitterHost } from './host';
|
|
10
|
+
/** Mode for instruction content generation. */
|
|
11
|
+
export type InstructionsMode = 'safe' | 'permissive' | 'custom' | 'off';
|
|
12
|
+
/** Options passed to every emitter. */
|
|
13
|
+
export interface EmitOptions {
|
|
14
|
+
/** Absolute path to the workspace root. */
|
|
15
|
+
workspaceRoot: string;
|
|
16
|
+
/**
|
|
17
|
+
* Absolute path to the output root where generated artifacts are written.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to `workspaceRoot`.
|
|
20
|
+
*
|
|
21
|
+
* This allows generating into a temp directory (tests/CLI/GitHub Action)
|
|
22
|
+
* without depending on CWD or VS Code workspace filesystem roots.
|
|
23
|
+
*/
|
|
24
|
+
outDir?: string;
|
|
25
|
+
/**
|
|
26
|
+
* ISO-8601 timestamp to embed in outputs.
|
|
27
|
+
* Defaults to `new Date().toISOString()` if omitted.
|
|
28
|
+
* Pass a fixed value in tests for determinism.
|
|
29
|
+
*/
|
|
30
|
+
generatedAt?: string;
|
|
31
|
+
/** Instruction content mode. */
|
|
32
|
+
instructionsMode?: InstructionsMode;
|
|
33
|
+
/** Pre-loaded file contents (avoids re-reading from disk). */
|
|
34
|
+
fileContents?: Map<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to generate the KB file (`kb.md`).
|
|
37
|
+
*
|
|
38
|
+
* Defaults to `false`. When `false`, only instruction files are emitted.
|
|
39
|
+
* Set to `true` to generate the knowledge base.
|
|
40
|
+
*/
|
|
41
|
+
generateKb?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* List of output format IDs to emit instruction files for.
|
|
44
|
+
*
|
|
45
|
+
* When omitted or empty, only `AGENTS.md` is written (the universal target).
|
|
46
|
+
* Supported values: 'agents', 'copilot', 'cursor', 'claudeCode',
|
|
47
|
+
* 'windsurf', 'cline', 'gemini', 'aider', 'amazonq', 'codex'.
|
|
48
|
+
*
|
|
49
|
+
* AGENTS.md is always written regardless of this list.
|
|
50
|
+
*/
|
|
51
|
+
outputFormats?: string[];
|
|
52
|
+
}
|
|
53
|
+
/** Result returned by an emitter after writing artifacts. */
|
|
54
|
+
export interface EmitResult {
|
|
55
|
+
/** Absolute paths of all files written or updated. */
|
|
56
|
+
filesWritten: string[];
|
|
57
|
+
}
|
|
58
|
+
/** A named artifact generator. */
|
|
59
|
+
export interface Emitter {
|
|
60
|
+
/** Human-readable name (e.g. "aspect-kb", "instructions"). */
|
|
61
|
+
readonly name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Generate and write artifacts.
|
|
64
|
+
*
|
|
65
|
+
* @param model The analysis model to consume.
|
|
66
|
+
* @param host File I/O abstraction.
|
|
67
|
+
* @param options Generation options.
|
|
68
|
+
* @returns Paths of all files written.
|
|
69
|
+
*/
|
|
70
|
+
emit(model: AnalysisModel, host: EmitterHost, options: EmitOptions): Promise<EmitResult>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAI1C,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExE,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAID,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAID,kCAAkC;AAClC,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC;CACxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Emitter interface — the contract for all artifact generators.
|
|
4
|
+
*
|
|
5
|
+
* Each emitter takes an AnalysisModel + options and writes files
|
|
6
|
+
* via the EmitterHost abstraction. Emitters MUST produce deterministic
|
|
7
|
+
* output for the same input (modulo `generatedAt` timestamps).
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=emitter.js.map
|