@nxuss/lemma 1.32.0 → 1.33.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/README.md +14 -2
- package/dist/cjs/language-core/contracts/CapabilityMatrix.d.ts +10 -0
- package/dist/cjs/language-core/contracts/CapabilityMatrix.d.ts.map +1 -0
- package/dist/cjs/language-core/contracts/CapabilityMatrix.js +70 -0
- package/dist/cjs/language-core/contracts/CapabilityMatrix.js.map +1 -0
- package/dist/cjs/language-core/detection/detectProjectType.d.ts +17 -0
- package/dist/cjs/language-core/detection/detectProjectType.d.ts.map +1 -0
- package/dist/cjs/language-core/detection/detectProjectType.js +186 -0
- package/dist/cjs/language-core/detection/detectProjectType.js.map +1 -0
- package/dist/cjs/language-core/registry/adapterRegistry.d.ts +11 -0
- package/dist/cjs/language-core/registry/adapterRegistry.d.ts.map +1 -0
- package/dist/cjs/language-core/registry/adapterRegistry.js +45 -0
- package/dist/cjs/language-core/registry/adapterRegistry.js.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetDependencyGraph.d.ts +24 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetDependencyGraph.d.ts.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetDependencyGraph.js +199 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetDependencyGraph.js.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetLanguageAdapter.d.ts +37 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetLanguageAdapter.d.ts.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetLanguageAdapter.js +51 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetLanguageAdapter.js.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetPatchValidator.d.ts +25 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetPatchValidator.d.ts.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetPatchValidator.js +241 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetPatchValidator.js.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetSymbolGraph.d.ts +18 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetSymbolGraph.d.ts.map +1 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetSymbolGraph.js +214 -0
- package/dist/cjs/languages/adapters/dotnet/DotNetSymbolGraph.js.map +1 -0
- package/dist/cjs/languages/csharp/csharpSymbols.d.ts +33 -0
- package/dist/cjs/languages/csharp/csharpSymbols.d.ts.map +1 -0
- package/dist/cjs/languages/csharp/csharpSymbols.js +274 -0
- package/dist/cjs/languages/csharp/csharpSymbols.js.map +1 -0
- package/dist/cjs/mcp/cognitiveMap.d.ts +39 -10
- package/dist/cjs/mcp/cognitiveMap.d.ts.map +1 -1
- package/dist/cjs/mcp/cognitiveMap.js +488 -31
- package/dist/cjs/mcp/cognitiveMap.js.map +1 -1
- package/dist/cjs/mcp/index.js +6 -0
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/mcp/tools/analysis.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/analysis.js +9 -0
- package/dist/cjs/mcp/tools/analysis.js.map +1 -1
- package/dist/cjs/mcp/tools/codenav.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/codenav.js +45 -76
- package/dist/cjs/mcp/tools/codenav.js.map +1 -1
- package/dist/cjs/mcp/tools/context-tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/context-tools.js +28 -0
- package/dist/cjs/mcp/tools/context-tools.js.map +1 -1
- package/dist/cjs/mcp/tools/depgraph.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/depgraph.js +15 -0
- package/dist/cjs/mcp/tools/depgraph.js.map +1 -1
- package/dist/cjs/mcp/tools/dev-utils.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/dev-utils.js +6 -0
- package/dist/cjs/mcp/tools/dev-utils.js.map +1 -1
- package/dist/cjs/mcp/tools/devtools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/devtools.js +51 -39
- package/dist/cjs/mcp/tools/devtools.js.map +1 -1
- package/dist/cjs/mcp/tools/memory.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/memory.js +10 -0
- package/dist/cjs/mcp/tools/memory.js.map +1 -1
- package/dist/cjs/mcp/tools/misc.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/misc.js +11 -0
- package/dist/cjs/mcp/tools/misc.js.map +1 -1
- package/dist/cjs/mcp/tools/refactor.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/refactor.js +9 -0
- package/dist/cjs/mcp/tools/refactor.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts +1 -0
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +44 -7
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts +11 -0
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +8 -0
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/utils/SearchCache.d.ts +2 -2
- package/dist/cjs/utils/SearchCache.d.ts.map +1 -1
- package/dist/cjs/utils/SearchCache.js +6 -6
- package/dist/cjs/utils/SearchCache.js.map +1 -1
- package/dist/cjs/utils/WorkspaceSearch.d.ts +3 -1
- package/dist/cjs/utils/WorkspaceSearch.d.ts.map +1 -1
- package/dist/cjs/utils/WorkspaceSearch.js +5 -2
- package/dist/cjs/utils/WorkspaceSearch.js.map +1 -1
- package/dist/esm/language-core/contracts/CapabilityMatrix.d.ts +10 -0
- package/dist/esm/language-core/contracts/CapabilityMatrix.d.ts.map +1 -0
- package/dist/esm/language-core/contracts/CapabilityMatrix.js +66 -0
- package/dist/esm/language-core/contracts/CapabilityMatrix.js.map +1 -0
- package/dist/esm/language-core/detection/detectProjectType.d.ts +17 -0
- package/dist/esm/language-core/detection/detectProjectType.d.ts.map +1 -0
- package/dist/esm/language-core/detection/detectProjectType.js +150 -0
- package/dist/esm/language-core/detection/detectProjectType.js.map +1 -0
- package/dist/esm/language-core/registry/adapterRegistry.d.ts +11 -0
- package/dist/esm/language-core/registry/adapterRegistry.d.ts.map +1 -0
- package/dist/esm/language-core/registry/adapterRegistry.js +41 -0
- package/dist/esm/language-core/registry/adapterRegistry.js.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetDependencyGraph.d.ts +24 -0
- package/dist/esm/languages/adapters/dotnet/DotNetDependencyGraph.d.ts.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetDependencyGraph.js +162 -0
- package/dist/esm/languages/adapters/dotnet/DotNetDependencyGraph.js.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetLanguageAdapter.d.ts +37 -0
- package/dist/esm/languages/adapters/dotnet/DotNetLanguageAdapter.d.ts.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetLanguageAdapter.js +44 -0
- package/dist/esm/languages/adapters/dotnet/DotNetLanguageAdapter.js.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetPatchValidator.d.ts +25 -0
- package/dist/esm/languages/adapters/dotnet/DotNetPatchValidator.d.ts.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetPatchValidator.js +201 -0
- package/dist/esm/languages/adapters/dotnet/DotNetPatchValidator.js.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetSymbolGraph.d.ts +18 -0
- package/dist/esm/languages/adapters/dotnet/DotNetSymbolGraph.d.ts.map +1 -0
- package/dist/esm/languages/adapters/dotnet/DotNetSymbolGraph.js +175 -0
- package/dist/esm/languages/adapters/dotnet/DotNetSymbolGraph.js.map +1 -0
- package/dist/esm/languages/csharp/csharpSymbols.d.ts +33 -0
- package/dist/esm/languages/csharp/csharpSymbols.d.ts.map +1 -0
- package/dist/esm/languages/csharp/csharpSymbols.js +268 -0
- package/dist/esm/languages/csharp/csharpSymbols.js.map +1 -0
- package/dist/esm/mcp/cognitiveMap.d.ts +39 -10
- package/dist/esm/mcp/cognitiveMap.d.ts.map +1 -1
- package/dist/esm/mcp/cognitiveMap.js +442 -25
- package/dist/esm/mcp/cognitiveMap.js.map +1 -1
- package/dist/esm/mcp/index.js +6 -0
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/tools/analysis.d.ts.map +1 -1
- package/dist/esm/mcp/tools/analysis.js +9 -0
- package/dist/esm/mcp/tools/analysis.js.map +1 -1
- package/dist/esm/mcp/tools/codenav.d.ts.map +1 -1
- package/dist/esm/mcp/tools/codenav.js +46 -77
- package/dist/esm/mcp/tools/codenav.js.map +1 -1
- package/dist/esm/mcp/tools/context-tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools/context-tools.js +28 -0
- package/dist/esm/mcp/tools/context-tools.js.map +1 -1
- package/dist/esm/mcp/tools/depgraph.d.ts.map +1 -1
- package/dist/esm/mcp/tools/depgraph.js +15 -0
- package/dist/esm/mcp/tools/depgraph.js.map +1 -1
- package/dist/esm/mcp/tools/dev-utils.d.ts.map +1 -1
- package/dist/esm/mcp/tools/dev-utils.js +6 -0
- package/dist/esm/mcp/tools/dev-utils.js.map +1 -1
- package/dist/esm/mcp/tools/devtools.d.ts.map +1 -1
- package/dist/esm/mcp/tools/devtools.js +51 -39
- package/dist/esm/mcp/tools/devtools.js.map +1 -1
- package/dist/esm/mcp/tools/memory.d.ts.map +1 -1
- package/dist/esm/mcp/tools/memory.js +10 -0
- package/dist/esm/mcp/tools/memory.js.map +1 -1
- package/dist/esm/mcp/tools/misc.d.ts.map +1 -1
- package/dist/esm/mcp/tools/misc.js +11 -0
- package/dist/esm/mcp/tools/misc.js.map +1 -1
- package/dist/esm/mcp/tools/refactor.d.ts.map +1 -1
- package/dist/esm/mcp/tools/refactor.js +9 -0
- package/dist/esm/mcp/tools/refactor.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts +1 -0
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +45 -9
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts +11 -0
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +8 -0
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/utils/SearchCache.d.ts +2 -2
- package/dist/esm/utils/SearchCache.d.ts.map +1 -1
- package/dist/esm/utils/SearchCache.js +6 -6
- package/dist/esm/utils/SearchCache.js.map +1 -1
- package/dist/esm/utils/WorkspaceSearch.d.ts +3 -1
- package/dist/esm/utils/WorkspaceSearch.d.ts.map +1 -1
- package/dist/esm/utils/WorkspaceSearch.js +5 -2
- package/dist/esm/utils/WorkspaceSearch.js.map +1 -1
- package/mcp-server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,15 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
35
35
|
>
|
|
36
36
|
> **🆕 v1.22.0 — Lemma auto-activates in every LLM client.** `npm i -g @nxuss/lemma` registers the skill in your **user** catalog (auto-loads in every `muse` session, any project) and `lemma init` wires each project for Muse, Claude Code, Cursor, Codex, Windsurf, Kiro and OpenCode. Health check: `lemma doctor`.
|
|
37
37
|
>
|
|
38
|
+
> **🆕 v1.33.0 — C# (.NET) support, honestly labeled.** New per-project language detection
|
|
39
|
+
> (`.csproj/.sln`, target frameworks, mixed repos) and a read-only `capability_matrix` tool so clients
|
|
40
|
+
> stop guessing what works outside TypeScript. `get_ast_hologram` and `get_symbol_surgical_context` now
|
|
41
|
+
> serve C# (zero-dependency parser), `depgraph` gives using-based graphs with explicit `unresolved`
|
|
42
|
+
> externals, and `validate_patch_sandbox` runs `dotnet build` on a temp project copy — or says `NOT a
|
|
43
|
+
> build` when there's no SDK. `refactor`, `surgical_ast_insert`, `type_coverage_report`, `entropy_score`
|
|
44
|
+
> and `affected_tests` return `support level: fallback` on C# targets instead of faking it: nothing is
|
|
45
|
+
> modified. No new runtime dependencies. See the [changelog](CHANGELOG.md).
|
|
46
|
+
>
|
|
38
47
|
> **🆕 v1.32.0 — what a command can see and reach.** `run_workspace_command` no longer hands the
|
|
39
48
|
> child the host's whole environment (tokens, API keys, the license key): it gets a short allowlist,
|
|
40
49
|
> extendable via `mcp.commandEnv.allow`. `cat`, `ls`, `grep`, `find`, `sed`… must keep their paths
|
|
@@ -209,6 +218,9 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
209
218
|
read and workspace search, before anything leaves your machine.
|
|
210
219
|
- **Zero-token static intelligence** — dependency graphs, entropy/coupling/risk scores, and an AST
|
|
211
220
|
symbol index, computed locally with the TypeScript Compiler API. No LLM calls, no tokens.
|
|
221
|
+
C# projects get the same treatment where it's real: symbol holograms and surgical context via a
|
|
222
|
+
zero-dependency parser, using-based dependency graphs, and `dotnet build` patch validation —
|
|
223
|
+
everything else reports `fallback` instead of pretending (see `capability_matrix`).
|
|
212
224
|
- **Command output distillation** — a failing `npm test`/`tsc` run is parsed by deterministic
|
|
213
225
|
per-format rules (jest, tsc, eslint) down to the failures that matter; the full output is never
|
|
214
226
|
lost, just stored and retrievable on demand.
|
|
@@ -216,7 +228,7 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
216
228
|
compiler-verified AST location instead of asking the model to output a full-file rewrite.
|
|
217
229
|
- **Infrastructure Command Center** — 22 free tools for Jenkins, OKD/OpenShift, and Terraform:
|
|
218
230
|
discover, connect, deploy, diagnose, and detect drift, all via MCP.
|
|
219
|
-
- **Scoped tool surface** — of the
|
|
231
|
+
- **Scoped tool surface** — of the 111 registered tools, only the ones your project shows evidence
|
|
220
232
|
of needing are advertised to the model each turn; the rest stay one `lemma_toolbox` call away.
|
|
221
233
|
|
|
222
234
|
See [`CHANGELOG.md`](CHANGELOG.md) for the full, per-version history.
|
|
@@ -225,7 +237,7 @@ See [`CHANGELOG.md`](CHANGELOG.md) for the full, per-version history.
|
|
|
225
237
|
|
|
226
238
|
## 💎 Free vs Pro
|
|
227
239
|
|
|
228
|
-
|
|
240
|
+
61 of the 111 registered tools work with no license; 50 require Pro. Enforced by one allowlist in
|
|
229
241
|
code (`FREE_TOOLS` in `src/mcp/tools.ts`, including all 22 infrastructure tools), not by narrative.
|
|
230
242
|
A session without a license doesn't even advertise the Pro tools — they stay registered and
|
|
231
243
|
discoverable via `lemma_toolbox`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProjectLanguage } from "../detection/detectProjectType";
|
|
2
|
+
export type SupportLevel = "full" | "partial" | "fallback" | "unsupported";
|
|
3
|
+
export type CapabilityMatrix = Record<string, SupportLevel>;
|
|
4
|
+
/**
|
|
5
|
+
* Honest support table. Levels are upgraded by later phases as each capability
|
|
6
|
+
* actually lands (F2: csharp read-only; F3: validate) — never ahead of the code.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCapabilityMatrix(language: ProjectLanguage): CapabilityMatrix;
|
|
9
|
+
export declare const FALLBACK_MESSAGE: string;
|
|
10
|
+
//# sourceMappingURL=CapabilityMatrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapabilityMatrix.d.ts","sourceRoot":"","sources":["../../../../src/language-core/contracts/CapabilityMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAsC5D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,GACxB,gBAAgB,CAoBlB;AAED,eAAO,MAAM,gBAAgB,QAEoD,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FALLBACK_MESSAGE = void 0;
|
|
4
|
+
exports.getCapabilityMatrix = getCapabilityMatrix;
|
|
5
|
+
const UNIVERSAL_FULL = [
|
|
6
|
+
"read_workspace_file",
|
|
7
|
+
"write_workspace_file",
|
|
8
|
+
"create_workspace_file",
|
|
9
|
+
"list_workspace_dir",
|
|
10
|
+
"search_workspace",
|
|
11
|
+
"smart_file_slice",
|
|
12
|
+
"run_workspace_command",
|
|
13
|
+
"output_region",
|
|
14
|
+
"apply_workspace_patch",
|
|
15
|
+
"search_memory",
|
|
16
|
+
"get_memory",
|
|
17
|
+
"store_memory",
|
|
18
|
+
"cognitive_map",
|
|
19
|
+
"file_intent_index",
|
|
20
|
+
"get_project_onboarding",
|
|
21
|
+
];
|
|
22
|
+
const TS_SEMANTIC_FULL = [
|
|
23
|
+
"get_ast_hologram",
|
|
24
|
+
"get_symbol_surgical_context",
|
|
25
|
+
"imports_skeleton_resolver",
|
|
26
|
+
"ast_flow_visualizer",
|
|
27
|
+
"surgical_ast_insert",
|
|
28
|
+
"validate_patch_sandbox",
|
|
29
|
+
"depgraph",
|
|
30
|
+
"affected_tests",
|
|
31
|
+
"refactor",
|
|
32
|
+
"refactor_rename",
|
|
33
|
+
"refactor_move",
|
|
34
|
+
"type_coverage_report",
|
|
35
|
+
"entropy_score",
|
|
36
|
+
"dead_export_necromancer",
|
|
37
|
+
"coupling_radar",
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Honest support table. Levels are upgraded by later phases as each capability
|
|
41
|
+
* actually lands (F2: csharp read-only; F3: validate) — never ahead of the code.
|
|
42
|
+
*/
|
|
43
|
+
function getCapabilityMatrix(language) {
|
|
44
|
+
const matrix = {};
|
|
45
|
+
for (const tool of UNIVERSAL_FULL)
|
|
46
|
+
matrix[tool] = "full";
|
|
47
|
+
if (language === "typescript") {
|
|
48
|
+
for (const tool of TS_SEMANTIC_FULL)
|
|
49
|
+
matrix[tool] = "full";
|
|
50
|
+
return matrix;
|
|
51
|
+
}
|
|
52
|
+
if (language === "csharp") {
|
|
53
|
+
// Upgraded as capabilities land (F2: read-only tools via the dotnet adapter).
|
|
54
|
+
matrix.get_ast_hologram = "full";
|
|
55
|
+
matrix.get_symbol_surgical_context = "full";
|
|
56
|
+
matrix.depgraph = "partial";
|
|
57
|
+
matrix.validate_patch_sandbox = "partial";
|
|
58
|
+
for (const tool of TS_SEMANTIC_FULL) {
|
|
59
|
+
if (matrix[tool] === undefined)
|
|
60
|
+
matrix[tool] = "fallback";
|
|
61
|
+
}
|
|
62
|
+
return matrix;
|
|
63
|
+
}
|
|
64
|
+
for (const tool of TS_SEMANTIC_FULL)
|
|
65
|
+
matrix[tool] = "fallback";
|
|
66
|
+
return matrix;
|
|
67
|
+
}
|
|
68
|
+
exports.FALLBACK_MESSAGE = "This semantic tool is TypeScript-only today (support level: fallback). Nothing was modified. " +
|
|
69
|
+
"See capability_matrix for the current support level of your project language.";
|
|
70
|
+
//# sourceMappingURL=CapabilityMatrix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapabilityMatrix.js","sourceRoot":"","sources":["../../../../src/language-core/contracts/CapabilityMatrix.ts"],"names":[],"mappings":";;;AA8CA,kDAsBC;AA9DD,MAAM,cAAc,GAAG;IACrB,qBAAqB;IACrB,sBAAsB;IACtB,uBAAuB;IACvB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,uBAAuB;IACvB,eAAe;IACf,YAAY;IACZ,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,wBAAwB;CAChB,CAAC;AAEX,MAAM,gBAAgB,GAAG;IACvB,kBAAkB;IAClB,6BAA6B;IAC7B,2BAA2B;IAC3B,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;IACxB,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,iBAAiB;IACjB,eAAe;IACf,sBAAsB;IACtB,eAAe;IACf,yBAAyB;IACzB,gBAAgB;CACR,CAAC;AAEX;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,QAAyB;IAEzB,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,cAAc;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACzD,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,gBAAgB;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,8EAA8E;QAC9E,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC;QACjC,MAAM,CAAC,2BAA2B,GAAG,MAAM,CAAC;QAC5C,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC5B,MAAM,CAAC,sBAAsB,GAAG,SAAS,CAAC;QAC1C,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;YACpC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;QAC5D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,gBAAgB;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IAC/D,OAAO,MAAM,CAAC;AAChB,CAAC;AAEY,QAAA,gBAAgB,GAC3B,+FAA+F;IAC/F,+EAA+E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ProjectLanguage = "typescript" | "csharp" | "python" | "go" | "rust" | "unknown";
|
|
2
|
+
export interface ProjectDetection {
|
|
3
|
+
/** Primary language (most file evidence; ties break toward typescript). */
|
|
4
|
+
language: ProjectLanguage;
|
|
5
|
+
/** Every language with evidence in this repo (mixed repos report both). */
|
|
6
|
+
languages: ProjectLanguage[];
|
|
7
|
+
/** Human-readable evidence, capped (paths relative to root). */
|
|
8
|
+
evidence: string[];
|
|
9
|
+
/** Detected frameworks/TFMs, e.g. ["net8.0", "react"]. */
|
|
10
|
+
frameworks: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Detect the project language from repo evidence (never from user declaration).
|
|
14
|
+
* Name-only scan + capped csproj reads: no content indexing, no LLM, no tokens.
|
|
15
|
+
*/
|
|
16
|
+
export declare function detectProjectType(root?: string): ProjectDetection;
|
|
17
|
+
//# sourceMappingURL=detectProjectType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectProjectType.d.ts","sourceRoot":"","sources":["../../../../src/language-core/detection/detectProjectType.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,QAAQ,EAAE,eAAe,CAAC;IAC1B,2EAA2E;IAC3E,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAsDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,MAAsB,GAC3B,gBAAgB,CAkFlB"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.detectProjectType = detectProjectType;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const MAX_SCAN_FILES = 200;
|
|
40
|
+
const MAX_EVIDENCE = 10;
|
|
41
|
+
const SKIP_DIRS = new Set([
|
|
42
|
+
"node_modules",
|
|
43
|
+
".git",
|
|
44
|
+
"dist",
|
|
45
|
+
"build",
|
|
46
|
+
"bin",
|
|
47
|
+
"obj",
|
|
48
|
+
".lemma",
|
|
49
|
+
"coverage",
|
|
50
|
+
]);
|
|
51
|
+
function listFiles(root) {
|
|
52
|
+
const out = [];
|
|
53
|
+
const walk = (rel, depth) => {
|
|
54
|
+
if (depth > 3 || out.length >= MAX_SCAN_FILES)
|
|
55
|
+
return;
|
|
56
|
+
let entries;
|
|
57
|
+
try {
|
|
58
|
+
entries = fs.readdirSync(path.join(root, rel), { withFileTypes: true });
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
for (const e of entries) {
|
|
64
|
+
if (SKIP_DIRS.has(e.name))
|
|
65
|
+
continue;
|
|
66
|
+
const r = rel ? `${rel}/${e.name}` : e.name;
|
|
67
|
+
if (e.isDirectory())
|
|
68
|
+
walk(r, depth + 1);
|
|
69
|
+
else {
|
|
70
|
+
out.push(r);
|
|
71
|
+
if (out.length >= MAX_SCAN_FILES)
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
walk("", 0);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
function readCapped(abs, maxBytes = 100000) {
|
|
80
|
+
try {
|
|
81
|
+
const st = fs.statSync(abs);
|
|
82
|
+
if (!st.isFile() || st.size > maxBytes)
|
|
83
|
+
return null;
|
|
84
|
+
return fs.readFileSync(abs, "utf8");
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function pushEvidence(evidence, item) {
|
|
91
|
+
if (evidence.length < MAX_EVIDENCE && !evidence.includes(item))
|
|
92
|
+
evidence.push(item);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Detect the project language from repo evidence (never from user declaration).
|
|
96
|
+
* Name-only scan + capped csproj reads: no content indexing, no LLM, no tokens.
|
|
97
|
+
*/
|
|
98
|
+
function detectProjectType(root = process.cwd()) {
|
|
99
|
+
const resolved = path.resolve(root);
|
|
100
|
+
const counts = {
|
|
101
|
+
typescript: 0,
|
|
102
|
+
csharp: 0,
|
|
103
|
+
python: 0,
|
|
104
|
+
go: 0,
|
|
105
|
+
rust: 0,
|
|
106
|
+
};
|
|
107
|
+
const evidence = [];
|
|
108
|
+
const frameworks = [];
|
|
109
|
+
const pushFramework = (f) => {
|
|
110
|
+
const norm = f.trim().toLowerCase();
|
|
111
|
+
if (norm && !frameworks.includes(norm))
|
|
112
|
+
frameworks.push(norm);
|
|
113
|
+
};
|
|
114
|
+
let files;
|
|
115
|
+
try {
|
|
116
|
+
files = listFiles(resolved);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
files = [];
|
|
120
|
+
}
|
|
121
|
+
for (const rel of files) {
|
|
122
|
+
const lower = rel.toLowerCase();
|
|
123
|
+
if (lower.endsWith("tsconfig.json") || lower === "package.json") {
|
|
124
|
+
counts.typescript += 3;
|
|
125
|
+
pushEvidence(evidence, rel);
|
|
126
|
+
}
|
|
127
|
+
else if (/\.(ts|tsx|js|jsx|mjs|cjs)$/.test(lower)) {
|
|
128
|
+
counts.typescript += 1;
|
|
129
|
+
}
|
|
130
|
+
else if (lower.endsWith(".csproj")) {
|
|
131
|
+
counts.csharp += 3;
|
|
132
|
+
pushEvidence(evidence, rel);
|
|
133
|
+
const content = readCapped(path.join(resolved, rel));
|
|
134
|
+
if (content) {
|
|
135
|
+
const tfm = content.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i);
|
|
136
|
+
if (tfm)
|
|
137
|
+
pushFramework(tfm[1]);
|
|
138
|
+
const tfms = content.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i);
|
|
139
|
+
if (tfms)
|
|
140
|
+
tfms[1].split(";").forEach(pushFramework);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (lower.endsWith(".sln")) {
|
|
144
|
+
counts.csharp += 2;
|
|
145
|
+
pushEvidence(evidence, rel);
|
|
146
|
+
}
|
|
147
|
+
else if (lower.endsWith(".cs")) {
|
|
148
|
+
counts.csharp += 1;
|
|
149
|
+
}
|
|
150
|
+
else if (lower === "pyproject.toml" ||
|
|
151
|
+
lower === "setup.py" ||
|
|
152
|
+
lower.endsWith(".py")) {
|
|
153
|
+
counts.python += lower.endsWith(".py") ? 1 : 3;
|
|
154
|
+
if (!lower.endsWith(".py"))
|
|
155
|
+
pushEvidence(evidence, rel);
|
|
156
|
+
}
|
|
157
|
+
else if (lower === "go.mod" || lower.endsWith(".go")) {
|
|
158
|
+
counts.go += lower.endsWith(".go") ? 1 : 3;
|
|
159
|
+
if (!lower.endsWith(".go"))
|
|
160
|
+
pushEvidence(evidence, rel);
|
|
161
|
+
}
|
|
162
|
+
else if (lower === "cargo.toml" || lower.endsWith(".rs")) {
|
|
163
|
+
counts.rust += lower.endsWith(".rs") ? 1 : 3;
|
|
164
|
+
if (!lower.endsWith(".rs"))
|
|
165
|
+
pushEvidence(evidence, rel);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const order = [
|
|
169
|
+
"typescript",
|
|
170
|
+
"csharp",
|
|
171
|
+
"python",
|
|
172
|
+
"go",
|
|
173
|
+
"rust",
|
|
174
|
+
];
|
|
175
|
+
const ranked = order
|
|
176
|
+
.filter((l) => counts[l] > 0)
|
|
177
|
+
.sort((a, b) => counts[b] - counts[a]);
|
|
178
|
+
// Tie-break toward typescript preserves pre-detection behavior for TS repos.
|
|
179
|
+
return {
|
|
180
|
+
language: ranked[0] ?? "unknown",
|
|
181
|
+
languages: ranked,
|
|
182
|
+
evidence,
|
|
183
|
+
frameworks,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=detectProjectType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectProjectType.js","sourceRoot":"","sources":["../../../../src/language-core/detection/detectProjectType.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,8CAoFC;AAlKD,uCAAyB;AACzB,2CAA6B;AAqB7B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IAC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KACP,CAAC;IACF,MAAM,MAAM,GAAG,KAAK;SACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,6EAA6E;IAC7E,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS;QAChC,SAAS,EAAE,MAAM;QACjB,QAAQ;QACR,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type AdapterId = "typescript" | "dotnet";
|
|
2
|
+
/**
|
|
3
|
+
* File-aware routing. Returns "dotnet" only for C# files inside a repo with
|
|
4
|
+
* C# evidence; "typescript" for TS/JS files; null when nothing applies.
|
|
5
|
+
* Callers fall through to the legacy TypeScript path on anything but "dotnet",
|
|
6
|
+
* so TypeScript behavior is structurally unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveAdapterForFile(root: string, filePath: string): AdapterId | null;
|
|
9
|
+
/** Directory/repo-level routing (used by dir-scoped tools like hologram). */
|
|
10
|
+
export declare function resolveAdapterForProject(root: string): AdapterId | null;
|
|
11
|
+
//# sourceMappingURL=adapterRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapterRegistry.d.ts","sourceRoot":"","sources":["../../../../src/language-core/registry/adapterRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;AAKhD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,SAAS,GAAG,IAAI,CAalB;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CASvE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAdapterForFile = resolveAdapterForFile;
|
|
4
|
+
exports.resolveAdapterForProject = resolveAdapterForProject;
|
|
5
|
+
const detectProjectType_1 = require("../detection/detectProjectType");
|
|
6
|
+
const TS_EXT = /\.(ts|tsx|js|jsx|mjs|cjs)$/i;
|
|
7
|
+
const CS_EXT = /\.(cs|csproj|sln)$/i;
|
|
8
|
+
/**
|
|
9
|
+
* File-aware routing. Returns "dotnet" only for C# files inside a repo with
|
|
10
|
+
* C# evidence; "typescript" for TS/JS files; null when nothing applies.
|
|
11
|
+
* Callers fall through to the legacy TypeScript path on anything but "dotnet",
|
|
12
|
+
* so TypeScript behavior is structurally unchanged.
|
|
13
|
+
*/
|
|
14
|
+
function resolveAdapterForFile(root, filePath) {
|
|
15
|
+
const lower = (filePath || "").toLowerCase();
|
|
16
|
+
if (CS_EXT.test(lower)) {
|
|
17
|
+
try {
|
|
18
|
+
const det = (0, detectProjectType_1.detectProjectType)(root);
|
|
19
|
+
if (det.languages.includes("csharp"))
|
|
20
|
+
return "dotnet";
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// detection failed — fall through to legacy path
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (TS_EXT.test(lower))
|
|
28
|
+
return "typescript";
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/** Directory/repo-level routing (used by dir-scoped tools like hologram). */
|
|
32
|
+
function resolveAdapterForProject(root) {
|
|
33
|
+
try {
|
|
34
|
+
const det = (0, detectProjectType_1.detectProjectType)(root);
|
|
35
|
+
if (det.language === "csharp")
|
|
36
|
+
return "dotnet";
|
|
37
|
+
if (det.language === "typescript")
|
|
38
|
+
return "typescript";
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// fall through
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=adapterRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapterRegistry.js","sourceRoot":"","sources":["../../../../src/language-core/registry/adapterRegistry.ts"],"names":[],"mappings":";;AAaA,sDAgBC;AAGD,4DASC;AAzCD,sEAAmE;AAInE,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAC7C,MAAM,MAAM,GAAG,qBAAqB,CAAC;AAErC;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,IAAY,EACZ,QAAgB;IAEhB,MAAM,KAAK,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAA,qCAAiB,EAAC,IAAI,CAAC,CAAC;YACpC,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,OAAO,QAAQ,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,iDAAiD;QACnD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC5C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6EAA6E;AAC7E,SAAgB,wBAAwB,CAAC,IAAY;IACnD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,qCAAiB,EAAC,IAAI,CAAC,CAAC;QACpC,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC/C,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY;YAAE,OAAO,YAAY,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface DotNetFileNode {
|
|
2
|
+
file: string;
|
|
3
|
+
namespaces: string[];
|
|
4
|
+
usings: string[];
|
|
5
|
+
/** Resolved edges: { via: using, to: file } */
|
|
6
|
+
resolved: Array<{
|
|
7
|
+
via: string;
|
|
8
|
+
to: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** Usings with no in-repo declaration (System.*, xunit, …) — capped. */
|
|
11
|
+
unresolved: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function buildDotNetGraphMap(root: string): Map<string, DotNetFileNode>;
|
|
14
|
+
export interface DotNetGraphOptions {
|
|
15
|
+
reverse?: boolean;
|
|
16
|
+
depth?: number;
|
|
17
|
+
format?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Using-based .NET dependency view. PARTIAL by design: namespace resolution is
|
|
21
|
+
* lexical (no Roslyn), external packages surface as `unresolved`, never as edges.
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatDotNetDepGraph(root: string, targetRel: string, opts?: DotNetGraphOptions): string;
|
|
24
|
+
//# sourceMappingURL=DotNetDependencyGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotNetDependencyGraph.d.ts","sourceRoot":"","sources":["../../../../../src/languages/adapters/dotnet/DotNetDependencyGraph.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,+CAA+C;IAC/C,QAAQ,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C,wEAAwE;IACxE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AA+BD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CA+C7E;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,kBAAuB,GAC5B,MAAM,CAuDR"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.buildDotNetGraphMap = buildDotNetGraphMap;
|
|
37
|
+
exports.formatDotNetDepGraph = formatDotNetDepGraph;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const csharpSymbols_1 = require("../../csharp/csharpSymbols");
|
|
41
|
+
const MAX_FILES = 500;
|
|
42
|
+
function listCsFiles(root) {
|
|
43
|
+
const out = [];
|
|
44
|
+
const walk = (dir, rel) => {
|
|
45
|
+
if (out.length >= MAX_FILES)
|
|
46
|
+
return;
|
|
47
|
+
let entries;
|
|
48
|
+
try {
|
|
49
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
for (const e of entries) {
|
|
55
|
+
if (["node_modules", ".git", "bin", "obj", "dist", ".lemma"].includes(e.name))
|
|
56
|
+
continue;
|
|
57
|
+
const r = rel ? `${rel}/${e.name}` : e.name;
|
|
58
|
+
if (e.isDirectory())
|
|
59
|
+
walk(path.join(dir, e.name), r);
|
|
60
|
+
else if (e.name.toLowerCase().endsWith(".cs")) {
|
|
61
|
+
out.push(r);
|
|
62
|
+
if (out.length >= MAX_FILES)
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
walk(root, "");
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
function buildDotNetGraphMap(root) {
|
|
71
|
+
const files = listCsFiles(root);
|
|
72
|
+
const map = new Map();
|
|
73
|
+
const nsToFiles = new Map();
|
|
74
|
+
const parsed = new Map();
|
|
75
|
+
for (const rel of files) {
|
|
76
|
+
let content;
|
|
77
|
+
try {
|
|
78
|
+
content = fs.readFileSync(path.join(root, rel), "utf8");
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const syms = (0, csharpSymbols_1.parseCSharpFile)(content);
|
|
84
|
+
parsed.set(rel, syms);
|
|
85
|
+
for (const ns of syms.namespaces) {
|
|
86
|
+
const list = nsToFiles.get(ns) ?? [];
|
|
87
|
+
list.push(rel);
|
|
88
|
+
nsToFiles.set(ns, list);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const [rel, syms] of parsed) {
|
|
92
|
+
const node = {
|
|
93
|
+
file: rel,
|
|
94
|
+
namespaces: syms.namespaces,
|
|
95
|
+
usings: syms.usings,
|
|
96
|
+
resolved: [],
|
|
97
|
+
unresolved: [],
|
|
98
|
+
};
|
|
99
|
+
for (const using of syms.usings) {
|
|
100
|
+
const targets = (nsToFiles.get(using) ?? []).filter((f) => f !== rel);
|
|
101
|
+
if (targets.length > 0) {
|
|
102
|
+
for (const to of targets) {
|
|
103
|
+
if (!node.resolved.some((r) => r.to === to && r.via === using))
|
|
104
|
+
node.resolved.push({ via: using, to });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else if (!node.unresolved.includes(using) &&
|
|
108
|
+
node.unresolved.length < 20) {
|
|
109
|
+
node.unresolved.push(using);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
map.set(rel, node);
|
|
113
|
+
}
|
|
114
|
+
return map;
|
|
115
|
+
}
|
|
116
|
+
function bfs(map, start, direction, maxDepth) {
|
|
117
|
+
const seen = new Map([[start, 0]]);
|
|
118
|
+
const queue = [start];
|
|
119
|
+
while (queue.length > 0) {
|
|
120
|
+
const cur = queue.shift();
|
|
121
|
+
const d = seen.get(cur);
|
|
122
|
+
if (d >= maxDepth)
|
|
123
|
+
continue;
|
|
124
|
+
const next = [];
|
|
125
|
+
if (direction === "forward") {
|
|
126
|
+
const node = map.get(cur);
|
|
127
|
+
if (node)
|
|
128
|
+
for (const r of node.resolved)
|
|
129
|
+
next.push(r.to);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
for (const [file, node] of map) {
|
|
133
|
+
if (node.resolved.some((r) => r.to === cur))
|
|
134
|
+
next.push(file);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (const n of next) {
|
|
138
|
+
if (!seen.has(n)) {
|
|
139
|
+
seen.set(n, d + 1);
|
|
140
|
+
queue.push(n);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return seen;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Using-based .NET dependency view. PARTIAL by design: namespace resolution is
|
|
148
|
+
* lexical (no Roslyn), external packages surface as `unresolved`, never as edges.
|
|
149
|
+
*/
|
|
150
|
+
function formatDotNetDepGraph(root, targetRel, opts = {}) {
|
|
151
|
+
const map = buildDotNetGraphMap(root);
|
|
152
|
+
const node = map.get(targetRel);
|
|
153
|
+
if (!node) {
|
|
154
|
+
return `File not found in .NET workspace graph: ${targetRel}\nCheck path is correct and has a .cs extension.`;
|
|
155
|
+
}
|
|
156
|
+
const depth = Math.min(Math.max(opts.depth ?? 1, 1), 5);
|
|
157
|
+
const reverse = opts.reverse !== false;
|
|
158
|
+
const forward = bfs(map, targetRel, "forward", depth);
|
|
159
|
+
const backward = reverse
|
|
160
|
+
? bfs(map, targetRel, "backward", depth)
|
|
161
|
+
: new Map();
|
|
162
|
+
if (opts.format === "json") {
|
|
163
|
+
return JSON.stringify({
|
|
164
|
+
target: targetRel,
|
|
165
|
+
language: "dotnet",
|
|
166
|
+
partial: true,
|
|
167
|
+
dependsOn: [...forward.keys()].filter((f) => f !== targetRel),
|
|
168
|
+
dependedOnBy: [...backward.keys()].filter((f) => f !== targetRel),
|
|
169
|
+
unresolvedUsings: node.unresolved,
|
|
170
|
+
}, null, 2);
|
|
171
|
+
}
|
|
172
|
+
const lines = [
|
|
173
|
+
`### .NET dependency graph for \`${targetRel}\` (partial: using-based, depth ${depth})`,
|
|
174
|
+
`\nDepends on (${forward.size - 1}):`,
|
|
175
|
+
];
|
|
176
|
+
for (const [file, d] of [...forward.entries()]
|
|
177
|
+
.filter(([f]) => f !== targetRel)
|
|
178
|
+
.sort((a, b) => a[1] - b[1])) {
|
|
179
|
+
const via = map
|
|
180
|
+
.get(targetRel)
|
|
181
|
+
?.resolved.filter((r) => r.to === file)
|
|
182
|
+
.map((r) => r.via)
|
|
183
|
+
.join(", ");
|
|
184
|
+
lines.push(` - ${file} (depth ${d}${via ? ` via ${via}` : ""})`);
|
|
185
|
+
}
|
|
186
|
+
if (reverse) {
|
|
187
|
+
lines.push(`\nDepended on by (${backward.size - 1}):`);
|
|
188
|
+
for (const [file, d] of [...backward.entries()]
|
|
189
|
+
.filter(([f]) => f !== targetRel)
|
|
190
|
+
.sort((a, b) => a[1] - b[1])) {
|
|
191
|
+
lines.push(` - ${file} (depth ${d})`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (node.unresolved.length > 0) {
|
|
195
|
+
lines.push(`\nUnresolved usings (external packages / framework, not edges): ${node.unresolved.join(", ")}`);
|
|
196
|
+
}
|
|
197
|
+
return lines.join("\n");
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=DotNetDependencyGraph.js.map
|