kirograph 0.12.2 → 0.13.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 +56 -2
- package/dist/architecture/layers/index.js +9 -1
- package/dist/architecture/layers/index.js.map +2 -2
- package/dist/architecture/layers/ocaml.js +105 -0
- package/dist/architecture/layers/ocaml.js.map +7 -0
- package/dist/architecture/layers/scala.js +120 -0
- package/dist/architecture/layers/scala.js.map +7 -0
- package/dist/architecture/layers/solidity.js +105 -0
- package/dist/architecture/layers/solidity.js.map +7 -0
- package/dist/architecture/layers/vue.js +111 -0
- package/dist/architecture/layers/vue.js.map +7 -0
- package/dist/architecture/manifest/elm.js +91 -0
- package/dist/architecture/manifest/elm.js.map +7 -0
- package/dist/architecture/manifest/index.js +13 -2
- package/dist/architecture/manifest/index.js.map +2 -2
- package/dist/architecture/manifest/ocaml.js +166 -0
- package/dist/architecture/manifest/ocaml.js.map +7 -0
- package/dist/architecture/manifest/scala.js +117 -0
- package/dist/architecture/manifest/scala.js.map +7 -0
- package/dist/bin/installer/hooks.js +21 -1
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/kirograph.js +1 -1
- package/dist/extraction/extractor.js +65 -2
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +22 -0
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.js +39 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/wasm/tree-sitter-hcl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scss.wasm +0 -0
- package/dist/frameworks/amplify.js +175 -0
- package/dist/frameworks/amplify.js.map +7 -0
- package/dist/frameworks/angular.js +132 -0
- package/dist/frameworks/angular.js.map +7 -0
- package/dist/frameworks/ansible.js +151 -0
- package/dist/frameworks/ansible.js.map +7 -0
- package/dist/frameworks/cloudformation.js +148 -0
- package/dist/frameworks/cloudformation.js.map +7 -0
- package/dist/frameworks/docker.js +149 -0
- package/dist/frameworks/docker.js.map +7 -0
- package/dist/frameworks/iac.js +401 -0
- package/dist/frameworks/iac.js.map +7 -0
- package/dist/frameworks/index.js +81 -3
- package/dist/frameworks/index.js.map +3 -3
- package/dist/frameworks/kubernetes.js +176 -0
- package/dist/frameworks/kubernetes.js.map +7 -0
- package/dist/frameworks/pulumi.js +93 -0
- package/dist/frameworks/pulumi.js.map +7 -0
- package/dist/frameworks/scala.js +124 -0
- package/dist/frameworks/scala.js.map +7 -0
- package/dist/frameworks/solidity.js +93 -0
- package/dist/frameworks/solidity.js.map +7 -0
- package/dist/frameworks/terraform.js +278 -0
- package/dist/frameworks/terraform.js.map +7 -0
- package/dist/frameworks/vue.js +163 -0
- package/dist/frameworks/vue.js.map +7 -0
- package/dist/graph/queries.js +1 -1
- package/dist/graph/queries.js.map +1 -1
- package/dist/types.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1114,6 +1114,8 @@ Architecture analysis runs as a dedicated phase during `kirograph index`. Progre
|
|
|
1114
1114
|
|
|
1115
1115
|
## Supported Languages
|
|
1116
1116
|
|
|
1117
|
+
### General-purpose
|
|
1118
|
+
|
|
1117
1119
|
| Language | Extensions |
|
|
1118
1120
|
|----------|-----------|
|
|
1119
1121
|
| TypeScript | `.ts` |
|
|
@@ -1132,14 +1134,50 @@ Architecture analysis runs as a dedicated phase during `kirograph index`. Progre
|
|
|
1132
1134
|
| Swift | `.swift` |
|
|
1133
1135
|
| Kotlin | `.kt` |
|
|
1134
1136
|
| Dart | `.dart` |
|
|
1137
|
+
| Scala | `.scala`, `.sc`, `.sbt` |
|
|
1138
|
+
| Lua | `.lua` |
|
|
1139
|
+
| Zig | `.zig`, `.zon` |
|
|
1140
|
+
| Bash | `.sh`, `.bash`, `.zsh` |
|
|
1141
|
+
| OCaml | `.ml`, `.mli` |
|
|
1142
|
+
| Elm | `.elm` |
|
|
1143
|
+
| Objective-C | `.m` |
|
|
1144
|
+
|
|
1145
|
+
### Frontend & UI
|
|
1146
|
+
|
|
1147
|
+
| Language | Extensions |
|
|
1148
|
+
|----------|-----------|
|
|
1149
|
+
| React / React Native | `.tsx`, `.jsx` (via TypeScript/JSX grammars) |
|
|
1150
|
+
| Next.js | `.tsx`, `.jsx` (via TypeScript/JSX grammars) |
|
|
1151
|
+
| Angular | `.ts`, `.html` (via TypeScript/HTML grammars) |
|
|
1135
1152
|
| Svelte | `.svelte` |
|
|
1136
|
-
|
|
|
1153
|
+
| Vue | `.vue` |
|
|
1154
|
+
| HTML | `.html`, `.htm` |
|
|
1155
|
+
| CSS | `.css` |
|
|
1156
|
+
| SCSS / Sass | `.scss`, `.sass` |
|
|
1157
|
+
|
|
1158
|
+
### Domain-specific
|
|
1159
|
+
|
|
1160
|
+
| Language | Domain | Extensions |
|
|
1161
|
+
|----------|--------|-----------|
|
|
1162
|
+
| Solidity | Blockchain / Web3 | `.sol` |
|
|
1163
|
+
| Elixir | Distributed systems / Real-time | `.ex`, `.exs` |
|
|
1164
|
+
|
|
1165
|
+
### Configuration & Infrastructure
|
|
1166
|
+
|
|
1167
|
+
| Language | Extensions |
|
|
1168
|
+
|----------|-----------|
|
|
1169
|
+
| YAML | `.yaml`, `.yml` |
|
|
1170
|
+
| HCL (Terraform) | `.tf`, `.tfvars` |
|
|
1137
1171
|
|
|
1138
1172
|
## Framework Detection
|
|
1139
1173
|
|
|
1140
1174
|
KiroGraph automatically detects frameworks and enriches the graph with framework-specific semantics (routes, components, lifecycle methods):
|
|
1141
1175
|
|
|
1142
|
-
|
|
1176
|
+
### Web Frameworks
|
|
1177
|
+
|
|
1178
|
+
**JavaScript / TypeScript:** React, Next.js, React Native, Angular, Svelte, SvelteKit, Express, Fastify, Koa
|
|
1179
|
+
|
|
1180
|
+
**Vue:** Vue, Nuxt
|
|
1143
1181
|
|
|
1144
1182
|
**Python:** Django, Flask, FastAPI
|
|
1145
1183
|
|
|
@@ -1147,6 +1185,8 @@ KiroGraph automatically detects frameworks and enriches the graph with framework
|
|
|
1147
1185
|
|
|
1148
1186
|
**Java:** Spring, Spring Boot, Spring MVC
|
|
1149
1187
|
|
|
1188
|
+
**Scala:** Play, Akka HTTP, http4s
|
|
1189
|
+
|
|
1150
1190
|
**Go:** generic Go resolver
|
|
1151
1191
|
|
|
1152
1192
|
**Rust:** generic Rust resolver
|
|
@@ -1159,6 +1199,20 @@ KiroGraph automatically detects frameworks and enriches the graph with framework
|
|
|
1159
1199
|
|
|
1160
1200
|
**Elixir:** Phoenix
|
|
1161
1201
|
|
|
1202
|
+
**Solidity:** Hardhat, Foundry, Truffle (OpenZeppelin patterns)
|
|
1203
|
+
|
|
1204
|
+
### Infrastructure as Code
|
|
1205
|
+
|
|
1206
|
+
AWS CDK, SST, Serverless Framework, AWS SAM, Terraform / OpenTofu, Pulumi, CloudFormation, AWS Amplify Gen 2
|
|
1207
|
+
|
|
1208
|
+
### Containers & Orchestration
|
|
1209
|
+
|
|
1210
|
+
Kubernetes, Helm, Docker Compose
|
|
1211
|
+
|
|
1212
|
+
### Configuration Management
|
|
1213
|
+
|
|
1214
|
+
Ansible
|
|
1215
|
+
|
|
1162
1216
|
Detected frameworks are stored in config and used to improve symbol extraction and resolution.
|
|
1163
1217
|
|
|
1164
1218
|
## Requirements
|
|
@@ -32,6 +32,10 @@ var import_ruby = require("./ruby");
|
|
|
32
32
|
var import_rust = require("./rust");
|
|
33
33
|
var import_csharp = require("./csharp");
|
|
34
34
|
var import_elixir = require("./elixir");
|
|
35
|
+
var import_scala = require("./scala");
|
|
36
|
+
var import_vue = require("./vue");
|
|
37
|
+
var import_solidity = require("./solidity");
|
|
38
|
+
var import_ocaml = require("./ocaml");
|
|
35
39
|
const LAYER_DETECTORS = [
|
|
36
40
|
import_typescript.typescriptLayerDetector,
|
|
37
41
|
import_python.pythonLayerDetector,
|
|
@@ -40,7 +44,11 @@ const LAYER_DETECTORS = [
|
|
|
40
44
|
import_ruby.rubyLayerDetector,
|
|
41
45
|
import_rust.rustLayerDetector,
|
|
42
46
|
import_csharp.csharpLayerDetector,
|
|
43
|
-
import_elixir.elixirLayerDetector
|
|
47
|
+
import_elixir.elixirLayerDetector,
|
|
48
|
+
import_scala.scalaLayerDetector,
|
|
49
|
+
import_vue.vueLayerDetector,
|
|
50
|
+
import_solidity.solidityLayerDetector,
|
|
51
|
+
import_ocaml.ocamlLayerDetector
|
|
44
52
|
];
|
|
45
53
|
function getAllLayerDetectors() {
|
|
46
54
|
return LAYER_DETECTORS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/architecture/layers/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Layer Detector Registry\n *\n * Dispatches layer detection to language-specific detectors.\n * Config-defined layers always win over auto-detection.\n */\nimport type { LayerDetector, ArchLayerMatch, ArchLayer } from '../types';\nimport { typescriptLayerDetector } from './typescript';\nimport { pythonLayerDetector } from './python';\nimport { goLayerDetector } from './go';\nimport { javaLayerDetector } from './java';\nimport { rubyLayerDetector } from './ruby';\nimport { rustLayerDetector } from './rust';\nimport { csharpLayerDetector } from './csharp';\nimport { elixirLayerDetector } from './elixir';\n\nconst LAYER_DETECTORS: LayerDetector[] = [\n typescriptLayerDetector,\n pythonLayerDetector,\n goLayerDetector,\n javaLayerDetector,\n rubyLayerDetector,\n rustLayerDetector,\n csharpLayerDetector,\n elixirLayerDetector,\n];\n\nexport function getAllLayerDetectors(): LayerDetector[] {\n return LAYER_DETECTORS;\n}\n\nexport function registerLayerDetector(detector: LayerDetector): void {\n const idx = LAYER_DETECTORS.findIndex(d => d.language === detector.language && d.framework === detector.framework);\n if (idx >= 0) LAYER_DETECTORS[idx] = detector;\n else LAYER_DETECTORS.push(detector);\n}\n\nexport interface FileLayerAssignment {\n filePath: string;\n layerName: string;\n confidence: number;\n matchedPattern: string;\n}\n\n/**\n * Run all language-specific layer detectors against the file list.\n * Each file gets at most one layer assignment (highest confidence wins).\n * Config-defined layers (confidence=1.0) always beat auto-detected ones.\n *\n * @param files - relative file paths (from project root)\n * @param projectRoot - absolute project root path\n * @param configLayers - user-defined layer\u2192glob overrides from config\n */\nexport async function detectAllLayers(\n files: string[],\n projectRoot: string,\n configLayers?: Record<string, string[]>\n): Promise<FileLayerAssignment[]> {\n // Collect all matches from all detectors\n const allMatches: ArchLayerMatch[] = [];\n for (const detector of LAYER_DETECTORS) {\n const matches = await detector.detect(files, projectRoot, configLayers);\n allMatches.push(...matches);\n }\n\n // Per file, keep the highest-confidence match\n const best = new Map<string, ArchLayerMatch>();\n for (const match of allMatches) {\n const existing = best.get(match.filePath);\n if (!existing || match.confidence > existing.confidence) {\n best.set(match.filePath, match);\n }\n }\n\n return [...best.values()].map(m => ({\n filePath: m.filePath,\n layerName: m.layerName,\n confidence: m.confidence,\n matchedPattern: m.matchedPattern,\n }));\n}\n\n/**\n * From a list of FileLayerAssignment, derive the unique ArchLayer records.\n */\nexport function buildArchLayers(\n assignments: FileLayerAssignment[],\n configLayers?: Record<string, string[]>\n): ArchLayer[] {\n const layerMap = new Map<string, ArchLayer>();\n\n for (const a of assignments) {\n if (!layerMap.has(a.layerName)) {\n const isConfig = configLayers && a.layerName in configLayers;\n layerMap.set(a.layerName, {\n id: `layer:${a.layerName}`,\n name: a.layerName,\n source: isConfig ? 'config' : 'auto',\n patterns: [],\n updatedAt: Date.now(),\n });\n }\n const layer = layerMap.get(a.layerName)!;\n if (!layer.patterns.includes(a.matchedPattern)) {\n layer.patterns.push(a.matchedPattern);\n }\n }\n\n return [...layerMap.values()];\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,wBAAwC;AACxC,oBAAoC;AACpC,gBAAgC;AAChC,kBAAkC;AAClC,kBAAkC;AAClC,kBAAkC;AAClC,oBAAoC;AACpC,oBAAoC;
|
|
4
|
+
"sourcesContent": ["/**\n * Layer Detector Registry\n *\n * Dispatches layer detection to language-specific detectors.\n * Config-defined layers always win over auto-detection.\n */\nimport type { LayerDetector, ArchLayerMatch, ArchLayer } from '../types';\nimport { typescriptLayerDetector } from './typescript';\nimport { pythonLayerDetector } from './python';\nimport { goLayerDetector } from './go';\nimport { javaLayerDetector } from './java';\nimport { rubyLayerDetector } from './ruby';\nimport { rustLayerDetector } from './rust';\nimport { csharpLayerDetector } from './csharp';\nimport { elixirLayerDetector } from './elixir';\nimport { scalaLayerDetector } from './scala';\nimport { vueLayerDetector } from './vue';\nimport { solidityLayerDetector } from './solidity';\nimport { ocamlLayerDetector } from './ocaml';\n\nconst LAYER_DETECTORS: LayerDetector[] = [\n typescriptLayerDetector,\n pythonLayerDetector,\n goLayerDetector,\n javaLayerDetector,\n rubyLayerDetector,\n rustLayerDetector,\n csharpLayerDetector,\n elixirLayerDetector,\n scalaLayerDetector,\n vueLayerDetector,\n solidityLayerDetector,\n ocamlLayerDetector,\n];\n\nexport function getAllLayerDetectors(): LayerDetector[] {\n return LAYER_DETECTORS;\n}\n\nexport function registerLayerDetector(detector: LayerDetector): void {\n const idx = LAYER_DETECTORS.findIndex(d => d.language === detector.language && d.framework === detector.framework);\n if (idx >= 0) LAYER_DETECTORS[idx] = detector;\n else LAYER_DETECTORS.push(detector);\n}\n\nexport interface FileLayerAssignment {\n filePath: string;\n layerName: string;\n confidence: number;\n matchedPattern: string;\n}\n\n/**\n * Run all language-specific layer detectors against the file list.\n * Each file gets at most one layer assignment (highest confidence wins).\n * Config-defined layers (confidence=1.0) always beat auto-detected ones.\n *\n * @param files - relative file paths (from project root)\n * @param projectRoot - absolute project root path\n * @param configLayers - user-defined layer\u2192glob overrides from config\n */\nexport async function detectAllLayers(\n files: string[],\n projectRoot: string,\n configLayers?: Record<string, string[]>\n): Promise<FileLayerAssignment[]> {\n // Collect all matches from all detectors\n const allMatches: ArchLayerMatch[] = [];\n for (const detector of LAYER_DETECTORS) {\n const matches = await detector.detect(files, projectRoot, configLayers);\n allMatches.push(...matches);\n }\n\n // Per file, keep the highest-confidence match\n const best = new Map<string, ArchLayerMatch>();\n for (const match of allMatches) {\n const existing = best.get(match.filePath);\n if (!existing || match.confidence > existing.confidence) {\n best.set(match.filePath, match);\n }\n }\n\n return [...best.values()].map(m => ({\n filePath: m.filePath,\n layerName: m.layerName,\n confidence: m.confidence,\n matchedPattern: m.matchedPattern,\n }));\n}\n\n/**\n * From a list of FileLayerAssignment, derive the unique ArchLayer records.\n */\nexport function buildArchLayers(\n assignments: FileLayerAssignment[],\n configLayers?: Record<string, string[]>\n): ArchLayer[] {\n const layerMap = new Map<string, ArchLayer>();\n\n for (const a of assignments) {\n if (!layerMap.has(a.layerName)) {\n const isConfig = configLayers && a.layerName in configLayers;\n layerMap.set(a.layerName, {\n id: `layer:${a.layerName}`,\n name: a.layerName,\n source: isConfig ? 'config' : 'auto',\n patterns: [],\n updatedAt: Date.now(),\n });\n }\n const layer = layerMap.get(a.layerName)!;\n if (!layer.patterns.includes(a.matchedPattern)) {\n layer.patterns.push(a.matchedPattern);\n }\n }\n\n return [...layerMap.values()];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,wBAAwC;AACxC,oBAAoC;AACpC,gBAAgC;AAChC,kBAAkC;AAClC,kBAAkC;AAClC,kBAAkC;AAClC,oBAAoC;AACpC,oBAAoC;AACpC,mBAAmC;AACnC,iBAAiC;AACjC,sBAAsC;AACtC,mBAAmC;AAEnC,MAAM,kBAAmC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,uBAAwC;AACtD,SAAO;AACT;AAEO,SAAS,sBAAsB,UAA+B;AACnE,QAAM,MAAM,gBAAgB,UAAU,OAAK,EAAE,aAAa,SAAS,YAAY,EAAE,cAAc,SAAS,SAAS;AACjH,MAAI,OAAO,EAAG,iBAAgB,GAAG,IAAI;AAAA,MAChC,iBAAgB,KAAK,QAAQ;AACpC;AAkBA,eAAsB,gBACpB,OACA,aACA,cACgC;AAEhC,QAAM,aAA+B,CAAC;AACtC,aAAW,YAAY,iBAAiB;AACtC,UAAM,UAAU,MAAM,SAAS,OAAO,OAAO,aAAa,YAAY;AACtE,eAAW,KAAK,GAAG,OAAO;AAAA,EAC5B;AAGA,QAAM,OAAO,oBAAI,IAA4B;AAC7C,aAAW,SAAS,YAAY;AAC9B,UAAM,WAAW,KAAK,IAAI,MAAM,QAAQ;AACxC,QAAI,CAAC,YAAY,MAAM,aAAa,SAAS,YAAY;AACvD,WAAK,IAAI,MAAM,UAAU,KAAK;AAAA,IAChC;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,QAAM;AAAA,IAClC,UAAU,EAAE;AAAA,IACZ,WAAW,EAAE;AAAA,IACb,YAAY,EAAE;AAAA,IACd,gBAAgB,EAAE;AAAA,EACpB,EAAE;AACJ;AAKO,SAAS,gBACd,aACA,cACa;AACb,QAAM,WAAW,oBAAI,IAAuB;AAE5C,aAAW,KAAK,aAAa;AAC3B,QAAI,CAAC,SAAS,IAAI,EAAE,SAAS,GAAG;AAC9B,YAAM,WAAW,gBAAgB,EAAE,aAAa;AAChD,eAAS,IAAI,EAAE,WAAW;AAAA,QACxB,IAAI,SAAS,EAAE,SAAS;AAAA,QACxB,MAAM,EAAE;AAAA,QACR,QAAQ,WAAW,WAAW;AAAA,QAC9B,UAAU,CAAC;AAAA,QACX,WAAW,KAAK,IAAI;AAAA,MACtB,CAAC;AAAA,IACH;AACA,UAAM,QAAQ,SAAS,IAAI,EAAE,SAAS;AACtC,QAAI,CAAC,MAAM,SAAS,SAAS,EAAE,cAAc,GAAG;AAC9C,YAAM,SAAS,KAAK,EAAE,cAAc;AAAA,IACtC;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,SAAS,OAAO,CAAC;AAC9B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ocaml_exports = {};
|
|
30
|
+
__export(ocaml_exports, {
|
|
31
|
+
ocamlLayerDetector: () => ocamlLayerDetector
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ocaml_exports);
|
|
34
|
+
var import_picomatch = __toESM(require("picomatch"));
|
|
35
|
+
const LAYER_PATTERNS = [
|
|
36
|
+
// API layer (HTTP handlers, CLI entry points)
|
|
37
|
+
["api", "**/bin/**", 0.85],
|
|
38
|
+
["api", "**/handler/**", 0.9],
|
|
39
|
+
["api", "**/handlers/**", 0.9],
|
|
40
|
+
["api", "**/routes/**", 0.9],
|
|
41
|
+
["api", "**/server/**", 0.85],
|
|
42
|
+
["api", "**/*_handler.ml", 0.9],
|
|
43
|
+
// Service layer (domain logic)
|
|
44
|
+
["service", "**/domain/**", 0.9],
|
|
45
|
+
["service", "**/service/**", 0.9],
|
|
46
|
+
["service", "**/services/**", 0.9],
|
|
47
|
+
["service", "**/core/**", 0.85],
|
|
48
|
+
["service", "**/logic/**", 0.85],
|
|
49
|
+
// Data layer (persistence, models)
|
|
50
|
+
["data", "**/db/**", 0.9],
|
|
51
|
+
["data", "**/database/**", 0.9],
|
|
52
|
+
["data", "**/models/**", 0.85],
|
|
53
|
+
["data", "**/repo/**", 0.9],
|
|
54
|
+
["data", "**/storage/**", 0.85],
|
|
55
|
+
["data", "**/migrations/**", 0.85],
|
|
56
|
+
// Shared / library layer
|
|
57
|
+
["shared", "**/lib/**", 0.8],
|
|
58
|
+
["shared", "**/utils/**", 0.85],
|
|
59
|
+
["shared", "**/common/**", 0.8],
|
|
60
|
+
["shared", "**/config/**", 0.8],
|
|
61
|
+
["shared", "**/middleware/**", 0.8]
|
|
62
|
+
];
|
|
63
|
+
const ocamlLayerDetector = {
|
|
64
|
+
language: "ocaml",
|
|
65
|
+
async detect(files, _projectRoot, configLayers) {
|
|
66
|
+
const results = [];
|
|
67
|
+
const configMatchers = _buildConfigMatchers(configLayers ?? {});
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
if (!file.endsWith(".ml") && !file.endsWith(".mli")) continue;
|
|
70
|
+
const configMatch = _matchConfig(file, configMatchers);
|
|
71
|
+
if (configMatch) {
|
|
72
|
+
results.push({ ...configMatch, filePath: file });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
let best = null;
|
|
76
|
+
for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {
|
|
77
|
+
if ((0, import_picomatch.default)(pattern)(file)) {
|
|
78
|
+
if (!best || confidence > best.confidence) {
|
|
79
|
+
best = { layerName, filePath: file, confidence, matchedPattern: pattern };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (best) results.push(best);
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function _buildConfigMatchers(configLayers) {
|
|
89
|
+
return Object.entries(configLayers).flatMap(
|
|
90
|
+
([layerName, patterns]) => patterns.map(
|
|
91
|
+
(pattern) => [layerName, (0, import_picomatch.default)(pattern), pattern]
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function _matchConfig(file, matchers) {
|
|
96
|
+
for (const [layerName, matcher, pattern] of matchers) {
|
|
97
|
+
if (matcher(file)) return { layerName, confidence: 1, matchedPattern: `config:${pattern}` };
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
ocamlLayerDetector
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=ocaml.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/layers/ocaml.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Layer detector for OCaml projects (Dune-based).\n */\nimport type { LayerDetector, ArchLayerMatch } from '../types';\nimport picomatch from 'picomatch';\n\nconst LAYER_PATTERNS: Array<[string, string, number]> = [\n // API layer (HTTP handlers, CLI entry points)\n ['api', '**/bin/**', 0.85],\n ['api', '**/handler/**', 0.9],\n ['api', '**/handlers/**', 0.9],\n ['api', '**/routes/**', 0.9],\n ['api', '**/server/**', 0.85],\n ['api', '**/*_handler.ml', 0.9],\n\n // Service layer (domain logic)\n ['service', '**/domain/**', 0.9],\n ['service', '**/service/**', 0.9],\n ['service', '**/services/**', 0.9],\n ['service', '**/core/**', 0.85],\n ['service', '**/logic/**', 0.85],\n\n // Data layer (persistence, models)\n ['data', '**/db/**', 0.9],\n ['data', '**/database/**', 0.9],\n ['data', '**/models/**', 0.85],\n ['data', '**/repo/**', 0.9],\n ['data', '**/storage/**', 0.85],\n ['data', '**/migrations/**', 0.85],\n\n // Shared / library layer\n ['shared', '**/lib/**', 0.8],\n ['shared', '**/utils/**', 0.85],\n ['shared', '**/common/**', 0.8],\n ['shared', '**/config/**', 0.8],\n ['shared', '**/middleware/**', 0.8],\n];\n\nexport const ocamlLayerDetector: LayerDetector = {\n language: 'ocaml',\n\n async detect(files: string[], _projectRoot: string, configLayers?: Record<string, string[]>): Promise<ArchLayerMatch[]> {\n const results: ArchLayerMatch[] = [];\n const configMatchers = _buildConfigMatchers(configLayers ?? {});\n\n for (const file of files) {\n if (!file.endsWith('.ml') && !file.endsWith('.mli')) continue;\n\n const configMatch = _matchConfig(file, configMatchers);\n if (configMatch) { results.push({ ...configMatch, filePath: file }); continue; }\n\n let best: ArchLayerMatch | null = null;\n for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {\n if (picomatch(pattern)(file)) {\n if (!best || confidence > best.confidence) {\n best = { layerName, filePath: file, confidence, matchedPattern: pattern };\n }\n }\n }\n if (best) results.push(best);\n }\n return results;\n },\n};\n\nfunction _buildConfigMatchers(configLayers: Record<string, string[]>): Array<[string, ReturnType<typeof picomatch>, string]> {\n return Object.entries(configLayers).flatMap(([layerName, patterns]) =>\n patterns.map((pattern): [string, ReturnType<typeof picomatch>, string] =>\n [layerName, picomatch(pattern), pattern]\n )\n );\n}\n\nfunction _matchConfig(file: string, matchers: Array<[string, ReturnType<typeof picomatch>, string]>): Omit<ArchLayerMatch, 'filePath'> | null {\n for (const [layerName, matcher, pattern] of matchers) {\n if (matcher(file)) return { layerName, confidence: 1.0, matchedPattern: `config:${pattern}` };\n }\n return null;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,uBAAsB;AAEtB,MAAM,iBAAkD;AAAA;AAAA,EAEtD,CAAC,OAAO,aAAa,IAAI;AAAA,EACzB,CAAC,OAAO,iBAAiB,GAAG;AAAA,EAC5B,CAAC,OAAO,kBAAkB,GAAG;AAAA,EAC7B,CAAC,OAAO,gBAAgB,GAAG;AAAA,EAC3B,CAAC,OAAO,gBAAgB,IAAI;AAAA,EAC5B,CAAC,OAAO,mBAAmB,GAAG;AAAA;AAAA,EAG9B,CAAC,WAAW,gBAAgB,GAAG;AAAA,EAC/B,CAAC,WAAW,iBAAiB,GAAG;AAAA,EAChC,CAAC,WAAW,kBAAkB,GAAG;AAAA,EACjC,CAAC,WAAW,cAAc,IAAI;AAAA,EAC9B,CAAC,WAAW,eAAe,IAAI;AAAA;AAAA,EAG/B,CAAC,QAAQ,YAAY,GAAG;AAAA,EACxB,CAAC,QAAQ,kBAAkB,GAAG;AAAA,EAC9B,CAAC,QAAQ,gBAAgB,IAAI;AAAA,EAC7B,CAAC,QAAQ,cAAc,GAAG;AAAA,EAC1B,CAAC,QAAQ,iBAAiB,IAAI;AAAA,EAC9B,CAAC,QAAQ,oBAAoB,IAAI;AAAA;AAAA,EAGjC,CAAC,UAAU,aAAa,GAAG;AAAA,EAC3B,CAAC,UAAU,eAAe,IAAI;AAAA,EAC9B,CAAC,UAAU,gBAAgB,GAAG;AAAA,EAC9B,CAAC,UAAU,gBAAgB,GAAG;AAAA,EAC9B,CAAC,UAAU,oBAAoB,GAAG;AACpC;AAEO,MAAM,qBAAoC;AAAA,EAC/C,UAAU;AAAA,EAEV,MAAM,OAAO,OAAiB,cAAsB,cAAoE;AACtH,UAAM,UAA4B,CAAC;AACnC,UAAM,iBAAiB,qBAAqB,gBAAgB,CAAC,CAAC;AAE9D,eAAW,QAAQ,OAAO;AACxB,UAAI,CAAC,KAAK,SAAS,KAAK,KAAK,CAAC,KAAK,SAAS,MAAM,EAAG;AAErD,YAAM,cAAc,aAAa,MAAM,cAAc;AACrD,UAAI,aAAa;AAAE,gBAAQ,KAAK,EAAE,GAAG,aAAa,UAAU,KAAK,CAAC;AAAG;AAAA,MAAU;AAE/E,UAAI,OAA8B;AAClC,iBAAW,CAAC,WAAW,SAAS,UAAU,KAAK,gBAAgB;AAC7D,gBAAI,iBAAAA,SAAU,OAAO,EAAE,IAAI,GAAG;AAC5B,cAAI,CAAC,QAAQ,aAAa,KAAK,YAAY;AACzC,mBAAO,EAAE,WAAW,UAAU,MAAM,YAAY,gBAAgB,QAAQ;AAAA,UAC1E;AAAA,QACF;AAAA,MACF;AACA,UAAI,KAAM,SAAQ,KAAK,IAAI;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,qBAAqB,cAA+F;AAC3H,SAAO,OAAO,QAAQ,YAAY,EAAE;AAAA,IAAQ,CAAC,CAAC,WAAW,QAAQ,MAC/D,SAAS;AAAA,MAAI,CAAC,YACZ,CAAC,eAAW,iBAAAA,SAAU,OAAO,GAAG,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEA,SAAS,aAAa,MAAc,UAA0G;AAC5I,aAAW,CAAC,WAAW,SAAS,OAAO,KAAK,UAAU;AACpD,QAAI,QAAQ,IAAI,EAAG,QAAO,EAAE,WAAW,YAAY,GAAK,gBAAgB,UAAU,OAAO,GAAG;AAAA,EAC9F;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["picomatch"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var scala_exports = {};
|
|
30
|
+
__export(scala_exports, {
|
|
31
|
+
scalaLayerDetector: () => scalaLayerDetector
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(scala_exports);
|
|
34
|
+
var import_picomatch = __toESM(require("picomatch"));
|
|
35
|
+
const LAYER_PATTERNS = [
|
|
36
|
+
// API layer (Play controllers, Akka HTTP routes)
|
|
37
|
+
["api", "**/controllers/**", 0.95],
|
|
38
|
+
["api", "**/*Controller.scala", 0.9],
|
|
39
|
+
["api", "**/routes/**", 0.9],
|
|
40
|
+
["api", "**/*Routes.scala", 0.9],
|
|
41
|
+
["api", "**/*Router.scala", 0.85],
|
|
42
|
+
["api", "**/api/**", 0.8],
|
|
43
|
+
["api", "**/http/**", 0.85],
|
|
44
|
+
["api", "**/endpoints/**", 0.9],
|
|
45
|
+
// Service layer
|
|
46
|
+
["service", "**/services/**", 0.9],
|
|
47
|
+
["service", "**/service/**", 0.9],
|
|
48
|
+
["service", "**/*Service.scala", 0.9],
|
|
49
|
+
["service", "**/domain/**", 0.8],
|
|
50
|
+
["service", "**/usecases/**", 0.85],
|
|
51
|
+
["service", "**/actors/**", 0.85],
|
|
52
|
+
["service", "**/*Actor.scala", 0.85],
|
|
53
|
+
// Data layer
|
|
54
|
+
["data", "**/models/**", 0.85],
|
|
55
|
+
["data", "**/*Model.scala", 0.85],
|
|
56
|
+
["data", "**/repositories/**", 0.9],
|
|
57
|
+
["data", "**/*Repository.scala", 0.9],
|
|
58
|
+
["data", "**/*Repo.scala", 0.9],
|
|
59
|
+
["data", "**/dao/**", 0.9],
|
|
60
|
+
["data", "**/*DAO.scala", 0.9],
|
|
61
|
+
["data", "**/persistence/**", 0.85],
|
|
62
|
+
["data", "**/db/**", 0.85],
|
|
63
|
+
["data", "**/slick/**", 0.85],
|
|
64
|
+
["data", "**/evolutions/**", 0.85],
|
|
65
|
+
// UI layer (Play views/templates)
|
|
66
|
+
["ui", "**/views/**", 0.85],
|
|
67
|
+
["ui", "**/*.scala.html", 0.9],
|
|
68
|
+
["ui", "**/templates/**", 0.8],
|
|
69
|
+
// Shared / infrastructure
|
|
70
|
+
["shared", "**/util/**", 0.85],
|
|
71
|
+
["shared", "**/utils/**", 0.85],
|
|
72
|
+
["shared", "**/common/**", 0.8],
|
|
73
|
+
["shared", "**/config/**", 0.8],
|
|
74
|
+
["shared", "**/modules/**", 0.75],
|
|
75
|
+
["shared", "**/filters/**", 0.8],
|
|
76
|
+
["shared", "**/middleware/**", 0.85]
|
|
77
|
+
];
|
|
78
|
+
const scalaLayerDetector = {
|
|
79
|
+
language: "scala",
|
|
80
|
+
async detect(files, _projectRoot, configLayers) {
|
|
81
|
+
const results = [];
|
|
82
|
+
const configMatchers = _buildConfigMatchers(configLayers ?? {});
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
if (!file.endsWith(".scala") && !file.endsWith(".sc")) continue;
|
|
85
|
+
const configMatch = _matchConfig(file, configMatchers);
|
|
86
|
+
if (configMatch) {
|
|
87
|
+
results.push({ ...configMatch, filePath: file });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
let best = null;
|
|
91
|
+
for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {
|
|
92
|
+
if ((0, import_picomatch.default)(pattern)(file)) {
|
|
93
|
+
if (!best || confidence > best.confidence) {
|
|
94
|
+
best = { layerName, filePath: file, confidence, matchedPattern: pattern };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (best) results.push(best);
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
function _buildConfigMatchers(configLayers) {
|
|
104
|
+
return Object.entries(configLayers).flatMap(
|
|
105
|
+
([layerName, patterns]) => patterns.map(
|
|
106
|
+
(pattern) => [layerName, (0, import_picomatch.default)(pattern), pattern]
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function _matchConfig(file, matchers) {
|
|
111
|
+
for (const [layerName, matcher, pattern] of matchers) {
|
|
112
|
+
if (matcher(file)) return { layerName, confidence: 1, matchedPattern: `config:${pattern}` };
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
117
|
+
0 && (module.exports = {
|
|
118
|
+
scalaLayerDetector
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=scala.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/layers/scala.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Layer detector for Scala projects (Play, Akka, general SBT).\n */\nimport type { LayerDetector, ArchLayerMatch } from '../types';\nimport picomatch from 'picomatch';\n\nconst LAYER_PATTERNS: Array<[string, string, number]> = [\n // API layer (Play controllers, Akka HTTP routes)\n ['api', '**/controllers/**', 0.95],\n ['api', '**/*Controller.scala', 0.9],\n ['api', '**/routes/**', 0.9],\n ['api', '**/*Routes.scala', 0.9],\n ['api', '**/*Router.scala', 0.85],\n ['api', '**/api/**', 0.8],\n ['api', '**/http/**', 0.85],\n ['api', '**/endpoints/**', 0.9],\n\n // Service layer\n ['service', '**/services/**', 0.9],\n ['service', '**/service/**', 0.9],\n ['service', '**/*Service.scala', 0.9],\n ['service', '**/domain/**', 0.8],\n ['service', '**/usecases/**', 0.85],\n ['service', '**/actors/**', 0.85],\n ['service', '**/*Actor.scala', 0.85],\n\n // Data layer\n ['data', '**/models/**', 0.85],\n ['data', '**/*Model.scala', 0.85],\n ['data', '**/repositories/**', 0.9],\n ['data', '**/*Repository.scala', 0.9],\n ['data', '**/*Repo.scala', 0.9],\n ['data', '**/dao/**', 0.9],\n ['data', '**/*DAO.scala', 0.9],\n ['data', '**/persistence/**', 0.85],\n ['data', '**/db/**', 0.85],\n ['data', '**/slick/**', 0.85],\n ['data', '**/evolutions/**', 0.85],\n\n // UI layer (Play views/templates)\n ['ui', '**/views/**', 0.85],\n ['ui', '**/*.scala.html', 0.9],\n ['ui', '**/templates/**', 0.8],\n\n // Shared / infrastructure\n ['shared', '**/util/**', 0.85],\n ['shared', '**/utils/**', 0.85],\n ['shared', '**/common/**', 0.8],\n ['shared', '**/config/**', 0.8],\n ['shared', '**/modules/**', 0.75],\n ['shared', '**/filters/**', 0.8],\n ['shared', '**/middleware/**', 0.85],\n];\n\nexport const scalaLayerDetector: LayerDetector = {\n language: 'scala',\n\n async detect(files: string[], _projectRoot: string, configLayers?: Record<string, string[]>): Promise<ArchLayerMatch[]> {\n const results: ArchLayerMatch[] = [];\n const configMatchers = _buildConfigMatchers(configLayers ?? {});\n\n for (const file of files) {\n if (!file.endsWith('.scala') && !file.endsWith('.sc')) continue;\n\n const configMatch = _matchConfig(file, configMatchers);\n if (configMatch) { results.push({ ...configMatch, filePath: file }); continue; }\n\n let best: ArchLayerMatch | null = null;\n for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {\n if (picomatch(pattern)(file)) {\n if (!best || confidence > best.confidence) {\n best = { layerName, filePath: file, confidence, matchedPattern: pattern };\n }\n }\n }\n if (best) results.push(best);\n }\n return results;\n },\n};\n\nfunction _buildConfigMatchers(configLayers: Record<string, string[]>): Array<[string, ReturnType<typeof picomatch>, string]> {\n return Object.entries(configLayers).flatMap(([layerName, patterns]) =>\n patterns.map((pattern): [string, ReturnType<typeof picomatch>, string] =>\n [layerName, picomatch(pattern), pattern]\n )\n );\n}\n\nfunction _matchConfig(file: string, matchers: Array<[string, ReturnType<typeof picomatch>, string]>): Omit<ArchLayerMatch, 'filePath'> | null {\n for (const [layerName, matcher, pattern] of matchers) {\n if (matcher(file)) return { layerName, confidence: 1.0, matchedPattern: `config:${pattern}` };\n }\n return null;\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["picomatch"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var solidity_exports = {};
|
|
30
|
+
__export(solidity_exports, {
|
|
31
|
+
solidityLayerDetector: () => solidityLayerDetector
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(solidity_exports);
|
|
34
|
+
var import_picomatch = __toESM(require("picomatch"));
|
|
35
|
+
const LAYER_PATTERNS = [
|
|
36
|
+
// Core contracts (business logic)
|
|
37
|
+
["service", "**/contracts/**", 0.85],
|
|
38
|
+
["service", "**/src/**/*.sol", 0.8],
|
|
39
|
+
// Interfaces (API surface)
|
|
40
|
+
["api", "**/interfaces/**", 0.95],
|
|
41
|
+
["api", "**/contracts/interfaces/**", 0.95],
|
|
42
|
+
["api", "**/src/interfaces/**", 0.95],
|
|
43
|
+
["api", "**/IInterface*.sol", 0.85],
|
|
44
|
+
["api", "**/I[A-Z]*.sol", 0.8],
|
|
45
|
+
// Libraries (shared utilities)
|
|
46
|
+
["shared", "**/libraries/**", 0.9],
|
|
47
|
+
["shared", "**/contracts/libraries/**", 0.9],
|
|
48
|
+
["shared", "**/contracts/utils/**", 0.85],
|
|
49
|
+
["shared", "**/contracts/lib/**", 0.85],
|
|
50
|
+
["shared", "**/lib/**", 0.8],
|
|
51
|
+
// Data layer (storage, models)
|
|
52
|
+
["data", "**/contracts/storage/**", 0.9],
|
|
53
|
+
["data", "**/contracts/models/**", 0.85],
|
|
54
|
+
["data", "**/migrations/**", 0.9],
|
|
55
|
+
["data", "**/deploy/**", 0.8],
|
|
56
|
+
["data", "**/script/**", 0.8],
|
|
57
|
+
// Test layer (not a standard arch layer but useful for classification)
|
|
58
|
+
["shared", "**/test/**", 0.75],
|
|
59
|
+
["shared", "**/tests/**", 0.75],
|
|
60
|
+
["shared", "**/mocks/**", 0.8],
|
|
61
|
+
["shared", "**/contracts/mocks/**", 0.85]
|
|
62
|
+
];
|
|
63
|
+
const solidityLayerDetector = {
|
|
64
|
+
language: "solidity",
|
|
65
|
+
async detect(files, _projectRoot, configLayers) {
|
|
66
|
+
const results = [];
|
|
67
|
+
const configMatchers = _buildConfigMatchers(configLayers ?? {});
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
if (!file.endsWith(".sol")) continue;
|
|
70
|
+
const configMatch = _matchConfig(file, configMatchers);
|
|
71
|
+
if (configMatch) {
|
|
72
|
+
results.push({ ...configMatch, filePath: file });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
let best = null;
|
|
76
|
+
for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {
|
|
77
|
+
if ((0, import_picomatch.default)(pattern)(file)) {
|
|
78
|
+
if (!best || confidence > best.confidence) {
|
|
79
|
+
best = { layerName, filePath: file, confidence, matchedPattern: pattern };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (best) results.push(best);
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function _buildConfigMatchers(configLayers) {
|
|
89
|
+
return Object.entries(configLayers).flatMap(
|
|
90
|
+
([layerName, patterns]) => patterns.map(
|
|
91
|
+
(pattern) => [layerName, (0, import_picomatch.default)(pattern), pattern]
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function _matchConfig(file, matchers) {
|
|
96
|
+
for (const [layerName, matcher, pattern] of matchers) {
|
|
97
|
+
if (matcher(file)) return { layerName, confidence: 1, matchedPattern: `config:${pattern}` };
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
solidityLayerDetector
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=solidity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/layers/solidity.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Layer detector for Solidity projects (Hardhat, Foundry, Truffle).\n */\nimport type { LayerDetector, ArchLayerMatch } from '../types';\nimport picomatch from 'picomatch';\n\nconst LAYER_PATTERNS: Array<[string, string, number]> = [\n // Core contracts (business logic)\n ['service', '**/contracts/**', 0.85],\n ['service', '**/src/**/*.sol', 0.8],\n\n // Interfaces (API surface)\n ['api', '**/interfaces/**', 0.95],\n ['api', '**/contracts/interfaces/**', 0.95],\n ['api', '**/src/interfaces/**', 0.95],\n ['api', '**/IInterface*.sol', 0.85],\n ['api', '**/I[A-Z]*.sol', 0.8],\n\n // Libraries (shared utilities)\n ['shared', '**/libraries/**', 0.9],\n ['shared', '**/contracts/libraries/**', 0.9],\n ['shared', '**/contracts/utils/**', 0.85],\n ['shared', '**/contracts/lib/**', 0.85],\n ['shared', '**/lib/**', 0.8],\n\n // Data layer (storage, models)\n ['data', '**/contracts/storage/**', 0.9],\n ['data', '**/contracts/models/**', 0.85],\n ['data', '**/migrations/**', 0.9],\n ['data', '**/deploy/**', 0.8],\n ['data', '**/script/**', 0.8],\n\n // Test layer (not a standard arch layer but useful for classification)\n ['shared', '**/test/**', 0.75],\n ['shared', '**/tests/**', 0.75],\n ['shared', '**/mocks/**', 0.8],\n ['shared', '**/contracts/mocks/**', 0.85],\n];\n\nexport const solidityLayerDetector: LayerDetector = {\n language: 'solidity',\n\n async detect(files: string[], _projectRoot: string, configLayers?: Record<string, string[]>): Promise<ArchLayerMatch[]> {\n const results: ArchLayerMatch[] = [];\n const configMatchers = _buildConfigMatchers(configLayers ?? {});\n\n for (const file of files) {\n if (!file.endsWith('.sol')) continue;\n\n const configMatch = _matchConfig(file, configMatchers);\n if (configMatch) { results.push({ ...configMatch, filePath: file }); continue; }\n\n let best: ArchLayerMatch | null = null;\n for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {\n if (picomatch(pattern)(file)) {\n if (!best || confidence > best.confidence) {\n best = { layerName, filePath: file, confidence, matchedPattern: pattern };\n }\n }\n }\n if (best) results.push(best);\n }\n return results;\n },\n};\n\nfunction _buildConfigMatchers(configLayers: Record<string, string[]>): Array<[string, ReturnType<typeof picomatch>, string]> {\n return Object.entries(configLayers).flatMap(([layerName, patterns]) =>\n patterns.map((pattern): [string, ReturnType<typeof picomatch>, string] =>\n [layerName, picomatch(pattern), pattern]\n )\n );\n}\n\nfunction _matchConfig(file: string, matchers: Array<[string, ReturnType<typeof picomatch>, string]>): Omit<ArchLayerMatch, 'filePath'> | null {\n for (const [layerName, matcher, pattern] of matchers) {\n if (matcher(file)) return { layerName, confidence: 1.0, matchedPattern: `config:${pattern}` };\n }\n return null;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,uBAAsB;AAEtB,MAAM,iBAAkD;AAAA;AAAA,EAEtD,CAAC,WAAW,mBAAmB,IAAI;AAAA,EACnC,CAAC,WAAW,mBAAmB,GAAG;AAAA;AAAA,EAGlC,CAAC,OAAO,oBAAoB,IAAI;AAAA,EAChC,CAAC,OAAO,8BAA8B,IAAI;AAAA,EAC1C,CAAC,OAAO,wBAAwB,IAAI;AAAA,EACpC,CAAC,OAAO,sBAAsB,IAAI;AAAA,EAClC,CAAC,OAAO,kBAAkB,GAAG;AAAA;AAAA,EAG7B,CAAC,UAAU,mBAAmB,GAAG;AAAA,EACjC,CAAC,UAAU,6BAA6B,GAAG;AAAA,EAC3C,CAAC,UAAU,yBAAyB,IAAI;AAAA,EACxC,CAAC,UAAU,uBAAuB,IAAI;AAAA,EACtC,CAAC,UAAU,aAAa,GAAG;AAAA;AAAA,EAG3B,CAAC,QAAQ,2BAA2B,GAAG;AAAA,EACvC,CAAC,QAAQ,0BAA0B,IAAI;AAAA,EACvC,CAAC,QAAQ,oBAAoB,GAAG;AAAA,EAChC,CAAC,QAAQ,gBAAgB,GAAG;AAAA,EAC5B,CAAC,QAAQ,gBAAgB,GAAG;AAAA;AAAA,EAG5B,CAAC,UAAU,cAAc,IAAI;AAAA,EAC7B,CAAC,UAAU,eAAe,IAAI;AAAA,EAC9B,CAAC,UAAU,eAAe,GAAG;AAAA,EAC7B,CAAC,UAAU,yBAAyB,IAAI;AAC1C;AAEO,MAAM,wBAAuC;AAAA,EAClD,UAAU;AAAA,EAEV,MAAM,OAAO,OAAiB,cAAsB,cAAoE;AACtH,UAAM,UAA4B,CAAC;AACnC,UAAM,iBAAiB,qBAAqB,gBAAgB,CAAC,CAAC;AAE9D,eAAW,QAAQ,OAAO;AACxB,UAAI,CAAC,KAAK,SAAS,MAAM,EAAG;AAE5B,YAAM,cAAc,aAAa,MAAM,cAAc;AACrD,UAAI,aAAa;AAAE,gBAAQ,KAAK,EAAE,GAAG,aAAa,UAAU,KAAK,CAAC;AAAG;AAAA,MAAU;AAE/E,UAAI,OAA8B;AAClC,iBAAW,CAAC,WAAW,SAAS,UAAU,KAAK,gBAAgB;AAC7D,gBAAI,iBAAAA,SAAU,OAAO,EAAE,IAAI,GAAG;AAC5B,cAAI,CAAC,QAAQ,aAAa,KAAK,YAAY;AACzC,mBAAO,EAAE,WAAW,UAAU,MAAM,YAAY,gBAAgB,QAAQ;AAAA,UAC1E;AAAA,QACF;AAAA,MACF;AACA,UAAI,KAAM,SAAQ,KAAK,IAAI;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,qBAAqB,cAA+F;AAC3H,SAAO,OAAO,QAAQ,YAAY,EAAE;AAAA,IAAQ,CAAC,CAAC,WAAW,QAAQ,MAC/D,SAAS;AAAA,MAAI,CAAC,YACZ,CAAC,eAAW,iBAAAA,SAAU,OAAO,GAAG,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEA,SAAS,aAAa,MAAc,UAA0G;AAC5I,aAAW,CAAC,WAAW,SAAS,OAAO,KAAK,UAAU;AACpD,QAAI,QAAQ,IAAI,EAAG,QAAO,EAAE,WAAW,YAAY,GAAK,gBAAgB,UAAU,OAAO,GAAG;AAAA,EAC9F;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["picomatch"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var vue_exports = {};
|
|
30
|
+
__export(vue_exports, {
|
|
31
|
+
vueLayerDetector: () => vueLayerDetector
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(vue_exports);
|
|
34
|
+
var import_picomatch = __toESM(require("picomatch"));
|
|
35
|
+
const LAYER_PATTERNS = [
|
|
36
|
+
// API layer (Nuxt server routes, API handlers)
|
|
37
|
+
["api", "**/server/api/**", 0.95],
|
|
38
|
+
["api", "**/server/routes/**", 0.9],
|
|
39
|
+
["api", "**/server/middleware/**", 0.85],
|
|
40
|
+
["api", "**/api/**/*.ts", 0.8],
|
|
41
|
+
["api", "**/api/**/*.js", 0.8],
|
|
42
|
+
// Service layer (composables, stores, utils with business logic)
|
|
43
|
+
["service", "**/composables/**", 0.9],
|
|
44
|
+
["service", "**/stores/**", 0.9],
|
|
45
|
+
["service", "**/store/**", 0.9],
|
|
46
|
+
["service", "**/services/**", 0.9],
|
|
47
|
+
["service", "**/use*.ts", 0.8],
|
|
48
|
+
// Data layer (server-side data access, plugins for data)
|
|
49
|
+
["data", "**/server/models/**", 0.9],
|
|
50
|
+
["data", "**/server/db/**", 0.9],
|
|
51
|
+
["data", "**/prisma/**", 0.85],
|
|
52
|
+
["data", "**/drizzle/**", 0.85],
|
|
53
|
+
["data", "**/models/**", 0.8],
|
|
54
|
+
// UI layer (pages, components, layouts)
|
|
55
|
+
["ui", "**/pages/**", 0.95],
|
|
56
|
+
["ui", "**/components/**", 0.9],
|
|
57
|
+
["ui", "**/layouts/**", 0.9],
|
|
58
|
+
["ui", "**/*.vue", 0.75],
|
|
59
|
+
["ui", "**/views/**", 0.85],
|
|
60
|
+
// Shared / infrastructure
|
|
61
|
+
["shared", "**/plugins/**", 0.8],
|
|
62
|
+
["shared", "**/utils/**", 0.85],
|
|
63
|
+
["shared", "**/helpers/**", 0.8],
|
|
64
|
+
["shared", "**/types/**", 0.8],
|
|
65
|
+
["shared", "**/config/**", 0.8],
|
|
66
|
+
["shared", "**/middleware/**", 0.8],
|
|
67
|
+
["shared", "**/assets/**", 0.75]
|
|
68
|
+
];
|
|
69
|
+
const vueLayerDetector = {
|
|
70
|
+
language: "vue",
|
|
71
|
+
async detect(files, _projectRoot, configLayers) {
|
|
72
|
+
const results = [];
|
|
73
|
+
const configMatchers = _buildConfigMatchers(configLayers ?? {});
|
|
74
|
+
for (const file of files) {
|
|
75
|
+
if (!file.endsWith(".vue") && !file.endsWith(".ts") && !file.endsWith(".js")) continue;
|
|
76
|
+
const configMatch = _matchConfig(file, configMatchers);
|
|
77
|
+
if (configMatch) {
|
|
78
|
+
results.push({ ...configMatch, filePath: file });
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
let best = null;
|
|
82
|
+
for (const [layerName, pattern, confidence] of LAYER_PATTERNS) {
|
|
83
|
+
if ((0, import_picomatch.default)(pattern)(file)) {
|
|
84
|
+
if (!best || confidence > best.confidence) {
|
|
85
|
+
best = { layerName, filePath: file, confidence, matchedPattern: pattern };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (best) results.push(best);
|
|
90
|
+
}
|
|
91
|
+
return results;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
function _buildConfigMatchers(configLayers) {
|
|
95
|
+
return Object.entries(configLayers).flatMap(
|
|
96
|
+
([layerName, patterns]) => patterns.map(
|
|
97
|
+
(pattern) => [layerName, (0, import_picomatch.default)(pattern), pattern]
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function _matchConfig(file, matchers) {
|
|
102
|
+
for (const [layerName, matcher, pattern] of matchers) {
|
|
103
|
+
if (matcher(file)) return { layerName, confidence: 1, matchedPattern: `config:${pattern}` };
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
108
|
+
0 && (module.exports = {
|
|
109
|
+
vueLayerDetector
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=vue.js.map
|