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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/layers/vue.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Layer detector for Vue / Nuxt projects.\n */\nimport type { LayerDetector, ArchLayerMatch } from '../types';\nimport picomatch from 'picomatch';\n\nconst LAYER_PATTERNS: Array<[string, string, number]> = [\n // API layer (Nuxt server routes, API handlers)\n ['api', '**/server/api/**', 0.95],\n ['api', '**/server/routes/**', 0.9],\n ['api', '**/server/middleware/**', 0.85],\n ['api', '**/api/**/*.ts', 0.8],\n ['api', '**/api/**/*.js', 0.8],\n\n // Service layer (composables, stores, utils with business logic)\n ['service', '**/composables/**', 0.9],\n ['service', '**/stores/**', 0.9],\n ['service', '**/store/**', 0.9],\n ['service', '**/services/**', 0.9],\n ['service', '**/use*.ts', 0.8],\n\n // Data layer (server-side data access, plugins for data)\n ['data', '**/server/models/**', 0.9],\n ['data', '**/server/db/**', 0.9],\n ['data', '**/prisma/**', 0.85],\n ['data', '**/drizzle/**', 0.85],\n ['data', '**/models/**', 0.8],\n\n // UI layer (pages, components, layouts)\n ['ui', '**/pages/**', 0.95],\n ['ui', '**/components/**', 0.9],\n ['ui', '**/layouts/**', 0.9],\n ['ui', '**/*.vue', 0.75],\n ['ui', '**/views/**', 0.85],\n\n // Shared / infrastructure\n ['shared', '**/plugins/**', 0.8],\n ['shared', '**/utils/**', 0.85],\n ['shared', '**/helpers/**', 0.8],\n ['shared', '**/types/**', 0.8],\n ['shared', '**/config/**', 0.8],\n ['shared', '**/middleware/**', 0.8],\n ['shared', '**/assets/**', 0.75],\n];\n\nexport const vueLayerDetector: LayerDetector = {\n language: 'vue',\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('.vue') && !file.endsWith('.ts') && !file.endsWith('.js')) 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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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 elm_exports = {};
|
|
30
|
+
__export(elm_exports, {
|
|
31
|
+
elmParser: () => elmParser
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(elm_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
const elmParser = {
|
|
37
|
+
name: "elm",
|
|
38
|
+
manifestFiles: ["elm.json"],
|
|
39
|
+
language: "elm",
|
|
40
|
+
canParse(manifestPath) {
|
|
41
|
+
return path.basename(manifestPath) === "elm.json";
|
|
42
|
+
},
|
|
43
|
+
async parse(manifestPath, projectRoot) {
|
|
44
|
+
let content;
|
|
45
|
+
try {
|
|
46
|
+
content = fs.readFileSync(manifestPath, "utf8");
|
|
47
|
+
} catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
let parsed;
|
|
51
|
+
try {
|
|
52
|
+
parsed = JSON.parse(content);
|
|
53
|
+
} catch {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\/g, "/") || ".";
|
|
57
|
+
const relManifest = path.relative(projectRoot, manifestPath).replace(/\\/g, "/");
|
|
58
|
+
const type = parsed["type"];
|
|
59
|
+
const externalDeps = [];
|
|
60
|
+
if (type === "application") {
|
|
61
|
+
const deps = parsed["dependencies"];
|
|
62
|
+
if (deps?.direct) {
|
|
63
|
+
externalDeps.push(...Object.keys(deps.direct));
|
|
64
|
+
}
|
|
65
|
+
} else if (type === "package") {
|
|
66
|
+
const deps = parsed["dependencies"];
|
|
67
|
+
if (deps) {
|
|
68
|
+
externalDeps.push(...Object.keys(deps));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const name = parsed["name"] ?? path.basename(path.dirname(manifestPath));
|
|
72
|
+
const version = parsed["version"];
|
|
73
|
+
return [{
|
|
74
|
+
id: `pkg:elm:${relDir}`,
|
|
75
|
+
name,
|
|
76
|
+
path: relDir,
|
|
77
|
+
source: "manifest",
|
|
78
|
+
language: "elm",
|
|
79
|
+
manifestPath: relManifest,
|
|
80
|
+
version,
|
|
81
|
+
externalDeps,
|
|
82
|
+
metadata: { type: type ?? "unknown" },
|
|
83
|
+
updatedAt: Date.now()
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
elmParser
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=elm.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/manifest/elm.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Elm elm.json manifest parser.\n * Handles both application and package elm.json files.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ManifestParser, ArchPackage } from '../types';\n\nexport const elmParser: ManifestParser = {\n name: 'elm',\n manifestFiles: ['elm.json'],\n language: 'elm',\n\n canParse(manifestPath: string): boolean {\n return path.basename(manifestPath) === 'elm.json';\n },\n\n async parse(manifestPath: string, projectRoot: string): Promise<ArchPackage[]> {\n let content: string;\n try {\n content = fs.readFileSync(manifestPath, 'utf8');\n } catch {\n return [];\n }\n\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(content);\n } catch {\n return [];\n }\n\n const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\\\/g, '/') || '.';\n const relManifest = path.relative(projectRoot, manifestPath).replace(/\\\\/g, '/');\n\n const type = parsed['type'] as string | undefined;\n const externalDeps: string[] = [];\n\n if (type === 'application') {\n // Application: dependencies are in dependencies.direct and dependencies.indirect\n const deps = parsed['dependencies'] as Record<string, Record<string, string>> | undefined;\n if (deps?.direct) {\n externalDeps.push(...Object.keys(deps.direct));\n }\n } else if (type === 'package') {\n // Package: dependencies are a flat object\n const deps = parsed['dependencies'] as Record<string, string> | undefined;\n if (deps) {\n externalDeps.push(...Object.keys(deps));\n }\n }\n\n // Package name: for packages it's in \"name\", for applications use directory name\n const name = (parsed['name'] as string) ?? path.basename(path.dirname(manifestPath));\n const version = parsed['version'] as string | undefined;\n\n return [{\n id: `pkg:elm:${relDir}`,\n name,\n path: relDir,\n source: 'manifest',\n language: 'elm',\n manifestPath: relManifest,\n version,\n externalDeps,\n metadata: { type: type ?? 'unknown' },\n updatedAt: Date.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,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA,UAAU,EAAE,MAAM,QAAQ,UAAU;AAAA,MACpC,WAAW,KAAK,IAAI;AAAA,IACtB,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -43,6 +43,9 @@ var import_python = require("./python");
|
|
|
43
43
|
var import_maven = require("./maven");
|
|
44
44
|
var import_gradle = require("./gradle");
|
|
45
45
|
var import_csproj = require("./csproj");
|
|
46
|
+
var import_scala = require("./scala");
|
|
47
|
+
var import_ocaml = require("./ocaml");
|
|
48
|
+
var import_elm = require("./elm");
|
|
46
49
|
const MANIFEST_PARSERS = [
|
|
47
50
|
import_npm.npmParser,
|
|
48
51
|
import_go.goParser,
|
|
@@ -50,7 +53,10 @@ const MANIFEST_PARSERS = [
|
|
|
50
53
|
import_python.pythonParser,
|
|
51
54
|
import_maven.mavenParser,
|
|
52
55
|
import_gradle.gradleParser,
|
|
53
|
-
import_csproj.csprojParser
|
|
56
|
+
import_csproj.csprojParser,
|
|
57
|
+
import_scala.sbtParser,
|
|
58
|
+
import_ocaml.ocamlParser,
|
|
59
|
+
import_elm.elmParser
|
|
54
60
|
];
|
|
55
61
|
const MANIFEST_FILENAMES = new Set(
|
|
56
62
|
MANIFEST_PARSERS.flatMap((p) => p.manifestFiles)
|
|
@@ -67,7 +73,12 @@ const SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
67
73
|
"vendor",
|
|
68
74
|
".cache",
|
|
69
75
|
"coverage",
|
|
70
|
-
".nyc_output"
|
|
76
|
+
".nyc_output",
|
|
77
|
+
"_build",
|
|
78
|
+
"_opam",
|
|
79
|
+
"elm-stuff",
|
|
80
|
+
"zig-cache",
|
|
81
|
+
"zig-out"
|
|
71
82
|
]);
|
|
72
83
|
function getAllManifestParsers() {
|
|
73
84
|
return MANIFEST_PARSERS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/architecture/manifest/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Manifest Parser Registry\n *\n * Discovers and dispatches manifest parsers. Each parser handles one or more\n * manifest file types. The registry walks the project looking for manifest files\n * and assigns them to the correct parser.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ManifestParser, ArchPackage } from '../types';\nimport { npmParser } from './npm';\nimport { goParser } from './go';\nimport { cargoParser } from './cargo';\nimport { pythonParser } from './python';\nimport { mavenParser } from './maven';\nimport { gradleParser } from './gradle';\nimport { csprojParser } from './csproj';\n\n// All registered manifest parsers, in priority order\nconst MANIFEST_PARSERS: ManifestParser[] = [\n npmParser,\n goParser,\n cargoParser,\n pythonParser,\n mavenParser,\n gradleParser,\n csprojParser,\n];\n\n// All manifest filenames we care about (for fast lookup during directory walk)\nconst MANIFEST_FILENAMES = new Set(\n MANIFEST_PARSERS.flatMap(p => p.manifestFiles)\n);\n\n// Directories to never descend into when scanning for manifests\nconst SKIP_DIRS = new Set([\n 'node_modules', '.git', 'dist', 'build', 'target', '.gradle', '__pycache__',\n '.kirograph', 'vendor', '.cache', 'coverage', '.nyc_output',\n]);\n\nexport function getAllManifestParsers(): ManifestParser[] {\n return MANIFEST_PARSERS;\n}\n\nexport function getManifestParser(name: string): ManifestParser | undefined {\n return MANIFEST_PARSERS.find(p => p.name === name);\n}\n\nexport function registerManifestParser(parser: ManifestParser): void {\n const idx = MANIFEST_PARSERS.findIndex(p => p.name === parser.name);\n if (idx >= 0) MANIFEST_PARSERS[idx] = parser;\n else MANIFEST_PARSERS.push(parser);\n}\n\n/**\n * Walk projectRoot looking for manifest files, parse each, deduplicate, and\n * return all detected packages. Packages from manifests take priority; the\n * deduplication ensures that a workspace root pom.xml and a sub-module\n * pom.xml don't produce overlapping directory mappings.\n */\nexport async function parseAllManifests(projectRoot: string): Promise<ArchPackage[]> {\n const manifestPaths = _findManifests(projectRoot);\n const all: ArchPackage[] = [];\n const seenIds = new Set<string>();\n\n for (const manifestPath of manifestPaths) {\n const parser = MANIFEST_PARSERS.find(p => p.canParse(manifestPath));\n if (!parser) continue;\n try {\n const pkgs = await parser.parse(manifestPath, projectRoot);\n for (const pkg of pkgs) {\n if (!seenIds.has(pkg.id)) {\n seenIds.add(pkg.id);\n all.push(pkg);\n }\n }\n } catch {\n // Ignore parse errors for individual manifests\n }\n }\n\n return all;\n}\n\nfunction _findManifests(dir: string, results: string[] = []): string[] {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return results;\n }\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) {\n _findManifests(path.join(dir, entry.name), results);\n }\n } else if (entry.isFile()) {\n // Check exact filename or extension match\n if (MANIFEST_FILENAMES.has(entry.name) || entry.name.endsWith('.csproj')) {\n results.push(path.join(dir, entry.name));\n }\n }\n }\n\n return results;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAoB;AACpB,WAAsB;AAEtB,iBAA0B;AAC1B,gBAAyB;AACzB,mBAA4B;AAC5B,oBAA6B;AAC7B,mBAA4B;AAC5B,oBAA6B;AAC7B,oBAA6B;
|
|
4
|
+
"sourcesContent": ["/**\n * Manifest Parser Registry\n *\n * Discovers and dispatches manifest parsers. Each parser handles one or more\n * manifest file types. The registry walks the project looking for manifest files\n * and assigns them to the correct parser.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ManifestParser, ArchPackage } from '../types';\nimport { npmParser } from './npm';\nimport { goParser } from './go';\nimport { cargoParser } from './cargo';\nimport { pythonParser } from './python';\nimport { mavenParser } from './maven';\nimport { gradleParser } from './gradle';\nimport { csprojParser } from './csproj';\nimport { sbtParser } from './scala';\nimport { ocamlParser } from './ocaml';\nimport { elmParser } from './elm';\n\n// All registered manifest parsers, in priority order\nconst MANIFEST_PARSERS: ManifestParser[] = [\n npmParser,\n goParser,\n cargoParser,\n pythonParser,\n mavenParser,\n gradleParser,\n csprojParser,\n sbtParser,\n ocamlParser,\n elmParser,\n];\n\n// All manifest filenames we care about (for fast lookup during directory walk)\nconst MANIFEST_FILENAMES = new Set(\n MANIFEST_PARSERS.flatMap(p => p.manifestFiles)\n);\n\n// Directories to never descend into when scanning for manifests\nconst SKIP_DIRS = new Set([\n 'node_modules', '.git', 'dist', 'build', 'target', '.gradle', '__pycache__',\n '.kirograph', 'vendor', '.cache', 'coverage', '.nyc_output', '_build', '_opam',\n 'elm-stuff', 'zig-cache', 'zig-out',\n]);\n\nexport function getAllManifestParsers(): ManifestParser[] {\n return MANIFEST_PARSERS;\n}\n\nexport function getManifestParser(name: string): ManifestParser | undefined {\n return MANIFEST_PARSERS.find(p => p.name === name);\n}\n\nexport function registerManifestParser(parser: ManifestParser): void {\n const idx = MANIFEST_PARSERS.findIndex(p => p.name === parser.name);\n if (idx >= 0) MANIFEST_PARSERS[idx] = parser;\n else MANIFEST_PARSERS.push(parser);\n}\n\n/**\n * Walk projectRoot looking for manifest files, parse each, deduplicate, and\n * return all detected packages. Packages from manifests take priority; the\n * deduplication ensures that a workspace root pom.xml and a sub-module\n * pom.xml don't produce overlapping directory mappings.\n */\nexport async function parseAllManifests(projectRoot: string): Promise<ArchPackage[]> {\n const manifestPaths = _findManifests(projectRoot);\n const all: ArchPackage[] = [];\n const seenIds = new Set<string>();\n\n for (const manifestPath of manifestPaths) {\n const parser = MANIFEST_PARSERS.find(p => p.canParse(manifestPath));\n if (!parser) continue;\n try {\n const pkgs = await parser.parse(manifestPath, projectRoot);\n for (const pkg of pkgs) {\n if (!seenIds.has(pkg.id)) {\n seenIds.add(pkg.id);\n all.push(pkg);\n }\n }\n } catch {\n // Ignore parse errors for individual manifests\n }\n }\n\n return all;\n}\n\nfunction _findManifests(dir: string, results: string[] = []): string[] {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return results;\n }\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) {\n _findManifests(path.join(dir, entry.name), results);\n }\n } else if (entry.isFile()) {\n // Check exact filename or extension match\n if (MANIFEST_FILENAMES.has(entry.name) || entry.name.endsWith('.csproj')) {\n results.push(path.join(dir, entry.name));\n }\n }\n }\n\n return results;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAoB;AACpB,WAAsB;AAEtB,iBAA0B;AAC1B,gBAAyB;AACzB,mBAA4B;AAC5B,oBAA6B;AAC7B,mBAA4B;AAC5B,oBAA6B;AAC7B,oBAA6B;AAC7B,mBAA0B;AAC1B,mBAA4B;AAC5B,iBAA0B;AAG1B,MAAM,mBAAqC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,qBAAqB,IAAI;AAAA,EAC7B,iBAAiB,QAAQ,OAAK,EAAE,aAAa;AAC/C;AAGA,MAAM,YAAY,oBAAI,IAAI;AAAA,EACxB;AAAA,EAAgB;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAS;AAAA,EAAU;AAAA,EAAW;AAAA,EAC9D;AAAA,EAAc;AAAA,EAAU;AAAA,EAAU;AAAA,EAAY;AAAA,EAAe;AAAA,EAAU;AAAA,EACvE;AAAA,EAAa;AAAA,EAAa;AAC5B,CAAC;AAEM,SAAS,wBAA0C;AACxD,SAAO;AACT;AAEO,SAAS,kBAAkB,MAA0C;AAC1E,SAAO,iBAAiB,KAAK,OAAK,EAAE,SAAS,IAAI;AACnD;AAEO,SAAS,uBAAuB,QAA8B;AACnE,QAAM,MAAM,iBAAiB,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
|
|
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
|
+
ocamlParser: () => ocamlParser
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ocaml_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
const ocamlParser = {
|
|
37
|
+
name: "ocaml",
|
|
38
|
+
manifestFiles: ["dune-project"],
|
|
39
|
+
language: "ocaml",
|
|
40
|
+
canParse(manifestPath) {
|
|
41
|
+
const base = path.basename(manifestPath);
|
|
42
|
+
return base === "dune-project" || base.endsWith(".opam");
|
|
43
|
+
},
|
|
44
|
+
async parse(manifestPath, projectRoot) {
|
|
45
|
+
let content;
|
|
46
|
+
try {
|
|
47
|
+
content = fs.readFileSync(manifestPath, "utf8");
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\/g, "/") || ".";
|
|
52
|
+
const relManifest = path.relative(projectRoot, manifestPath).replace(/\\/g, "/");
|
|
53
|
+
const base = path.basename(manifestPath);
|
|
54
|
+
if (base === "dune-project") {
|
|
55
|
+
return parseDuneProject(content, relDir, relManifest, projectRoot, manifestPath);
|
|
56
|
+
}
|
|
57
|
+
return parseOpam(content, base, relDir, relManifest);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function parseDuneProject(content, relDir, relManifest, projectRoot, manifestPath) {
|
|
61
|
+
const packages = [];
|
|
62
|
+
const nameMatch = content.match(/\(name\s+([^\s)]+)\)/);
|
|
63
|
+
const name = nameMatch ? nameMatch[1] : path.basename(path.dirname(manifestPath));
|
|
64
|
+
const versionMatch = content.match(/\(version\s+([^\s)]+)\)/);
|
|
65
|
+
const version = versionMatch ? versionMatch[1] : void 0;
|
|
66
|
+
const externalDeps = [];
|
|
67
|
+
const dependsMatch = content.match(/\(depends([\s\S]*?)\)(?:\s*\(|$)/);
|
|
68
|
+
if (dependsMatch) {
|
|
69
|
+
const depPattern = /\(([a-zA-Z0-9_-]+)[\s)]/g;
|
|
70
|
+
const bareDep = /^\s+([a-zA-Z0-9_-]+)\s*$/gm;
|
|
71
|
+
let m;
|
|
72
|
+
while ((m = depPattern.exec(dependsMatch[1])) !== null) {
|
|
73
|
+
if (m[1] !== "and" && m[1] !== "or") externalDeps.push(m[1]);
|
|
74
|
+
}
|
|
75
|
+
while ((m = bareDep.exec(dependsMatch[1])) !== null) {
|
|
76
|
+
externalDeps.push(m[1]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
packages.push({
|
|
80
|
+
id: `pkg:ocaml:${relDir}`,
|
|
81
|
+
name,
|
|
82
|
+
path: relDir,
|
|
83
|
+
source: "manifest",
|
|
84
|
+
language: "ocaml",
|
|
85
|
+
manifestPath: relManifest,
|
|
86
|
+
version,
|
|
87
|
+
externalDeps,
|
|
88
|
+
updatedAt: Date.now()
|
|
89
|
+
});
|
|
90
|
+
const duneDir = path.dirname(path.join(projectRoot, relManifest));
|
|
91
|
+
const subDirs = findDuneLibraries(duneDir, projectRoot);
|
|
92
|
+
for (const sub of subDirs) {
|
|
93
|
+
if (sub.path !== relDir) {
|
|
94
|
+
packages.push({
|
|
95
|
+
id: `pkg:ocaml:${sub.path}`,
|
|
96
|
+
name: sub.name,
|
|
97
|
+
path: sub.path,
|
|
98
|
+
source: "manifest",
|
|
99
|
+
language: "ocaml",
|
|
100
|
+
manifestPath: relManifest,
|
|
101
|
+
updatedAt: Date.now()
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return packages;
|
|
106
|
+
}
|
|
107
|
+
function parseOpam(content, filename, relDir, relManifest) {
|
|
108
|
+
const name = filename.replace(".opam", "");
|
|
109
|
+
const versionMatch = content.match(/^version:\s*"([^"]+)"/m);
|
|
110
|
+
const version = versionMatch ? versionMatch[1] : void 0;
|
|
111
|
+
const externalDeps = [];
|
|
112
|
+
const dependsMatch = content.match(/^depends:\s*\[([\s\S]*?)\]/m);
|
|
113
|
+
if (dependsMatch) {
|
|
114
|
+
const depPattern = /"([a-zA-Z0-9_-]+)"/g;
|
|
115
|
+
let m;
|
|
116
|
+
while ((m = depPattern.exec(dependsMatch[1])) !== null) {
|
|
117
|
+
externalDeps.push(m[1]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return [{
|
|
121
|
+
id: `pkg:ocaml:${relDir}:${name}`,
|
|
122
|
+
name,
|
|
123
|
+
path: relDir,
|
|
124
|
+
source: "manifest",
|
|
125
|
+
language: "ocaml",
|
|
126
|
+
manifestPath: relManifest,
|
|
127
|
+
version,
|
|
128
|
+
externalDeps,
|
|
129
|
+
updatedAt: Date.now()
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
function findDuneLibraries(dir, projectRoot) {
|
|
133
|
+
const results = [];
|
|
134
|
+
const skipDirs = /* @__PURE__ */ new Set(["_build", ".git", "node_modules", "_opam"]);
|
|
135
|
+
function walk(currentDir) {
|
|
136
|
+
let entries;
|
|
137
|
+
try {
|
|
138
|
+
entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
139
|
+
} catch {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
for (const entry of entries) {
|
|
143
|
+
if (entry.isDirectory() && !skipDirs.has(entry.name)) {
|
|
144
|
+
walk(path.join(currentDir, entry.name));
|
|
145
|
+
} else if (entry.isFile() && entry.name === "dune") {
|
|
146
|
+
const dunePath = path.join(currentDir, "dune");
|
|
147
|
+
try {
|
|
148
|
+
const duneContent = fs.readFileSync(dunePath, "utf8");
|
|
149
|
+
const libMatch = duneContent.match(/\(library[\s\S]*?\(name\s+([^\s)]+)\)/);
|
|
150
|
+
if (libMatch) {
|
|
151
|
+
const relPath = path.relative(projectRoot, currentDir).replace(/\\/g, "/");
|
|
152
|
+
results.push({ name: libMatch[1], path: relPath });
|
|
153
|
+
}
|
|
154
|
+
} catch {
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
walk(dir);
|
|
160
|
+
return results;
|
|
161
|
+
}
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
164
|
+
ocamlParser
|
|
165
|
+
});
|
|
166
|
+
//# sourceMappingURL=ocaml.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/manifest/ocaml.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * OCaml manifest parser.\n * Handles dune-project and .opam files.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ManifestParser, ArchPackage } from '../types';\n\nexport const ocamlParser: ManifestParser = {\n name: 'ocaml',\n manifestFiles: ['dune-project'],\n language: 'ocaml',\n\n canParse(manifestPath: string): boolean {\n const base = path.basename(manifestPath);\n return base === 'dune-project' || base.endsWith('.opam');\n },\n\n async parse(manifestPath: string, projectRoot: string): Promise<ArchPackage[]> {\n let content: string;\n try {\n content = fs.readFileSync(manifestPath, 'utf8');\n } catch {\n return [];\n }\n\n const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\\\/g, '/') || '.';\n const relManifest = path.relative(projectRoot, manifestPath).replace(/\\\\/g, '/');\n const base = path.basename(manifestPath);\n\n if (base === 'dune-project') {\n return parseDuneProject(content, relDir, relManifest, projectRoot, manifestPath);\n }\n\n // .opam file\n return parseOpam(content, base, relDir, relManifest);\n },\n};\n\nfunction parseDuneProject(\n content: string,\n relDir: string,\n relManifest: string,\n projectRoot: string,\n manifestPath: string\n): ArchPackage[] {\n const packages: ArchPackage[] = [];\n\n // Extract project name: (name my-project)\n const nameMatch = content.match(/\\(name\\s+([^\\s)]+)\\)/);\n const name = nameMatch ? nameMatch[1]! : path.basename(path.dirname(manifestPath));\n\n // Extract version: (version 1.0.0)\n const versionMatch = content.match(/\\(version\\s+([^\\s)]+)\\)/);\n const version = versionMatch ? versionMatch[1] : undefined;\n\n // Extract dependencies from (depends ...) block\n const externalDeps: string[] = [];\n const dependsMatch = content.match(/\\(depends([\\s\\S]*?)\\)(?:\\s*\\(|$)/);\n if (dependsMatch) {\n // Each dep is either a bare name or (name (>= version))\n const depPattern = /\\(([a-zA-Z0-9_-]+)[\\s)]/g;\n const bareDep = /^\\s+([a-zA-Z0-9_-]+)\\s*$/gm;\n let m: RegExpExecArray | null;\n while ((m = depPattern.exec(dependsMatch[1])) !== null) {\n if (m[1] !== 'and' && m[1] !== 'or') externalDeps.push(m[1]);\n }\n while ((m = bareDep.exec(dependsMatch[1])) !== null) {\n externalDeps.push(m[1]);\n }\n }\n\n packages.push({\n id: `pkg:ocaml:${relDir}`,\n name,\n path: relDir,\n source: 'manifest',\n language: 'ocaml',\n manifestPath: relManifest,\n version,\n externalDeps,\n updatedAt: Date.now(),\n });\n\n // Look for sub-libraries defined in dune files\n const duneDir = path.dirname(path.join(projectRoot, relManifest));\n const subDirs = findDuneLibraries(duneDir, projectRoot);\n for (const sub of subDirs) {\n if (sub.path !== relDir) {\n packages.push({\n id: `pkg:ocaml:${sub.path}`,\n name: sub.name,\n path: sub.path,\n source: 'manifest',\n language: 'ocaml',\n manifestPath: relManifest,\n updatedAt: Date.now(),\n });\n }\n }\n\n return packages;\n}\n\nfunction parseOpam(content: string, filename: string, relDir: string, relManifest: string): ArchPackage[] {\n const name = filename.replace('.opam', '');\n const versionMatch = content.match(/^version:\\s*\"([^\"]+)\"/m);\n const version = versionMatch ? versionMatch[1] : undefined;\n\n const externalDeps: string[] = [];\n const dependsMatch = content.match(/^depends:\\s*\\[([\\s\\S]*?)\\]/m);\n if (dependsMatch) {\n const depPattern = /\"([a-zA-Z0-9_-]+)\"/g;\n let m: RegExpExecArray | null;\n while ((m = depPattern.exec(dependsMatch[1])) !== null) {\n externalDeps.push(m[1]);\n }\n }\n\n return [{\n id: `pkg:ocaml:${relDir}:${name}`,\n name,\n path: relDir,\n source: 'manifest',\n language: 'ocaml',\n manifestPath: relManifest,\n version,\n externalDeps,\n updatedAt: Date.now(),\n }];\n}\n\nfunction findDuneLibraries(dir: string, projectRoot: string): Array<{ name: string; path: string }> {\n const results: Array<{ name: string; path: string }> = [];\n const skipDirs = new Set(['_build', '.git', 'node_modules', '_opam']);\n\n function walk(currentDir: string): void {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(currentDir, { withFileTypes: true });\n } catch {\n return;\n }\n\n for (const entry of entries) {\n if (entry.isDirectory() && !skipDirs.has(entry.name)) {\n walk(path.join(currentDir, entry.name));\n } else if (entry.isFile() && entry.name === 'dune') {\n const dunePath = path.join(currentDir, 'dune');\n try {\n const duneContent = fs.readFileSync(dunePath, 'utf8');\n const libMatch = duneContent.match(/\\(library[\\s\\S]*?\\(name\\s+([^\\s)]+)\\)/);\n if (libMatch) {\n const relPath = path.relative(projectRoot, currentDir).replace(/\\\\/g, '/');\n results.push({ name: libMatch[1]!, path: relPath });\n }\n } catch { /* ignore */ }\n }\n }\n }\n\n walk(dir);\n return results;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AAGf,MAAM,cAA8B;AAAA,EACzC,MAAM;AAAA,EACN,eAAe,CAAC,cAAc;AAAA,EAC9B,UAAU;AAAA,EAEV,SAAS,cAA+B;AACtC,UAAM,OAAO,KAAK,SAAS,YAAY;AACvC,WAAO,SAAS,kBAAkB,KAAK,SAAS,OAAO;AAAA,EACzD;AAAA,EAEA,MAAM,MAAM,cAAsB,aAA6C;AAC7E,QAAI;AACJ,QAAI;AACF,gBAAU,GAAG,aAAa,cAAc,MAAM;AAAA,IAChD,QAAQ;AACN,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,SAAS,KAAK,SAAS,aAAa,KAAK,QAAQ,YAAY,CAAC,EAAE,QAAQ,OAAO,GAAG,KAAK;AAC7F,UAAM,cAAc,KAAK,SAAS,aAAa,YAAY,EAAE,QAAQ,OAAO,GAAG;AAC/E,UAAM,OAAO,KAAK,SAAS,YAAY;AAEvC,QAAI,SAAS,gBAAgB;AAC3B,aAAO,iBAAiB,SAAS,QAAQ,aAAa,aAAa,YAAY;AAAA,IACjF;AAGA,WAAO,U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C,YAAI;AACF,gBAAM,cAAc,GAAG,aAAa,UAAU,MAAM;AACpD,gBAAM,WAAW,YAAY,MAAM,uCAAuC;AAC1E,cAAI,UAAU;AACZ,kBAAM,UAAU,KAAK,SAAS,aAAa,UAAU,EAAE,QAAQ,OAAO,GAAG;AACzE,oBAAQ,KAAK,EAAE,MAAM,SAAS,CAAC,GAAI,MAAM,QAAQ,CAAC;AAAA,UACpD;AAAA,QACF,QAAQ;AAAA,QAAe;AAAA,MACzB;AAAA,IACF;AAAA,EACF;AAEA,OAAK,GAAG;AACR,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
sbtParser: () => sbtParser
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(scala_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
const sbtParser = {
|
|
37
|
+
name: "sbt",
|
|
38
|
+
manifestFiles: ["build.sbt"],
|
|
39
|
+
language: "scala",
|
|
40
|
+
canParse(manifestPath) {
|
|
41
|
+
return path.basename(manifestPath) === "build.sbt";
|
|
42
|
+
},
|
|
43
|
+
async parse(manifestPath, projectRoot) {
|
|
44
|
+
let content;
|
|
45
|
+
try {
|
|
46
|
+
content = fs.readFileSync(manifestPath, "utf8");
|
|
47
|
+
} catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\/g, "/") || ".";
|
|
51
|
+
const relManifest = path.relative(projectRoot, manifestPath).replace(/\\/g, "/");
|
|
52
|
+
const packages = [];
|
|
53
|
+
const nameMatch = content.match(/name\s*:=\s*"([^"]+)"/);
|
|
54
|
+
const versionMatch = content.match(/version\s*:=\s*"([^"]+)"/);
|
|
55
|
+
const name = nameMatch ? nameMatch[1] : path.basename(path.dirname(manifestPath));
|
|
56
|
+
const version = versionMatch ? versionMatch[1] : void 0;
|
|
57
|
+
const externalDeps = [];
|
|
58
|
+
const depPattern = /"([^"]+)"\s*%%?\s*"([^"]+)"\s*%\s*"([^"]+)"/g;
|
|
59
|
+
let depMatch;
|
|
60
|
+
while ((depMatch = depPattern.exec(content)) !== null) {
|
|
61
|
+
externalDeps.push(`${depMatch[1]}:${depMatch[2]}`);
|
|
62
|
+
}
|
|
63
|
+
const subProjectPattern = /lazy\s+val\s+(\w+)\s*=\s*(?:\(?\s*project\s*(?:\.in\s*\(\s*file\s*\(\s*"([^"]+)"\s*\))?|project\s+in\s+file\s*\(\s*"([^"]+)"\s*\))/g;
|
|
64
|
+
let subMatch;
|
|
65
|
+
const subProjects = [];
|
|
66
|
+
while ((subMatch = subProjectPattern.exec(content)) !== null) {
|
|
67
|
+
const subName = subMatch[1];
|
|
68
|
+
const subDir = subMatch[2] || subMatch[3] || subName;
|
|
69
|
+
subProjects.push({ name: subName, dir: subDir });
|
|
70
|
+
}
|
|
71
|
+
if (subProjects.length > 0) {
|
|
72
|
+
for (const sub of subProjects) {
|
|
73
|
+
const subPath = relDir === "." ? sub.dir : `${relDir}/${sub.dir}`;
|
|
74
|
+
packages.push({
|
|
75
|
+
id: `pkg:sbt:${subPath}`,
|
|
76
|
+
name: sub.name,
|
|
77
|
+
path: subPath,
|
|
78
|
+
source: "manifest",
|
|
79
|
+
language: "scala",
|
|
80
|
+
manifestPath: relManifest,
|
|
81
|
+
version,
|
|
82
|
+
updatedAt: Date.now()
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
packages.push({
|
|
86
|
+
id: `pkg:sbt:${relDir}`,
|
|
87
|
+
name,
|
|
88
|
+
path: relDir,
|
|
89
|
+
source: "manifest",
|
|
90
|
+
language: "scala",
|
|
91
|
+
manifestPath: relManifest,
|
|
92
|
+
version,
|
|
93
|
+
externalDeps,
|
|
94
|
+
metadata: { subProjects: subProjects.map((s) => s.name) },
|
|
95
|
+
updatedAt: Date.now()
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
packages.push({
|
|
99
|
+
id: `pkg:sbt:${relDir}`,
|
|
100
|
+
name,
|
|
101
|
+
path: relDir,
|
|
102
|
+
source: "manifest",
|
|
103
|
+
language: "scala",
|
|
104
|
+
manifestPath: relManifest,
|
|
105
|
+
version,
|
|
106
|
+
externalDeps,
|
|
107
|
+
updatedAt: Date.now()
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return packages;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
sbtParser
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=scala.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/architecture/manifest/scala.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Scala build.sbt manifest parser.\n * Handles single-project and multi-module SBT builds.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ManifestParser, ArchPackage } from '../types';\n\nexport const sbtParser: ManifestParser = {\n name: 'sbt',\n manifestFiles: ['build.sbt'],\n language: 'scala',\n\n canParse(manifestPath: string): boolean {\n return path.basename(manifestPath) === 'build.sbt';\n },\n\n async parse(manifestPath: string, projectRoot: string): Promise<ArchPackage[]> {\n let content: string;\n try {\n content = fs.readFileSync(manifestPath, 'utf8');\n } catch {\n return [];\n }\n\n const relDir = path.relative(projectRoot, path.dirname(manifestPath)).replace(/\\\\/g, '/') || '.';\n const relManifest = path.relative(projectRoot, manifestPath).replace(/\\\\/g, '/');\n const packages: ArchPackage[] = [];\n\n // Extract project name\n const nameMatch = content.match(/name\\s*:=\\s*\"([^\"]+)\"/);\n const versionMatch = content.match(/version\\s*:=\\s*\"([^\"]+)\"/);\n const name = nameMatch ? nameMatch[1] : path.basename(path.dirname(manifestPath));\n const version = versionMatch ? versionMatch[1] : undefined;\n\n // Extract library dependencies\n const externalDeps: string[] = [];\n const depPattern = /\"([^\"]+)\"\\s*%%?\\s*\"([^\"]+)\"\\s*%\\s*\"([^\"]+)\"/g;\n let depMatch: RegExpExecArray | null;\n while ((depMatch = depPattern.exec(content)) !== null) {\n externalDeps.push(`${depMatch[1]}:${depMatch[2]}`);\n }\n\n // Detect sub-projects (lazy val xxx = project.in(file(\"yyy\")))\n const subProjectPattern = /lazy\\s+val\\s+(\\w+)\\s*=\\s*(?:\\(?\\s*project\\s*(?:\\.in\\s*\\(\\s*file\\s*\\(\\s*\"([^\"]+)\"\\s*\\))?|project\\s+in\\s+file\\s*\\(\\s*\"([^\"]+)\"\\s*\\))/g;\n let subMatch: RegExpExecArray | null;\n const subProjects: Array<{ name: string; dir: string }> = [];\n\n while ((subMatch = subProjectPattern.exec(content)) !== null) {\n const subName = subMatch[1];\n const subDir = subMatch[2] || subMatch[3] || subName;\n subProjects.push({ name: subName!, dir: subDir! });\n }\n\n if (subProjects.length > 0) {\n // Multi-module project: create a package per sub-project\n for (const sub of subProjects) {\n const subPath = relDir === '.' ? sub.dir : `${relDir}/${sub.dir}`;\n packages.push({\n id: `pkg:sbt:${subPath}`,\n name: sub.name,\n path: subPath,\n source: 'manifest',\n language: 'scala',\n manifestPath: relManifest,\n version,\n updatedAt: Date.now(),\n });\n }\n // Also add the root project\n packages.push({\n id: `pkg:sbt:${relDir}`,\n name: name!,\n path: relDir,\n source: 'manifest',\n language: 'scala',\n manifestPath: relManifest,\n version,\n externalDeps,\n metadata: { subProjects: subProjects.map(s => s.name) },\n updatedAt: Date.now(),\n });\n } else {\n // Single project\n packages.push({\n id: `pkg:sbt:${relDir}`,\n name: name!,\n path: relDir,\n source: 'manifest',\n language: 'scala',\n manifestPath: relManifest,\n version,\n externalDeps,\n updatedAt: Date.now(),\n });\n }\n\n return packages;\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AAGf,MAAM,YAA4B;AAAA,EACvC,MAAM;AAAA,EACN,eAAe,CAAC,WAAW;AAAA,EAC3B,UAAU;AAAA,EAEV,SAAS,cAA+B;AACtC,WAAO,KAAK,SAAS,YAAY,MAA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;AAAA,UACN,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,cAAc;AAAA,UACd;AAAA,UACA,WAAW,KAAK,IAAI;AAAA,QACtB,CAAC;AAAA,MACH;AAEA,eAAS,KAAK;AAAA,QACZ,IAAI,WAAW,MAAM;AAAA,QACrB;AAAA,QACA,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA,UAAU,EAAE,aAAa,YAAY,IAAI,OAAK,EAAE,IAAI,EAAE;AAAA,QACtD,WAAW,KAAK,IAAI;AAAA,MACtB,CAAC;AAAA,IACH,OAAO;AAEL,eAAS,KAAK;AAAA,QACZ,IAAI,WAAW,MAAM;AAAA,QACrB;AAAA,QACA,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QACA,WAAW,KAAK,IAAI;AAAA,MACtB,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -50,7 +50,27 @@ const FILE_PATTERNS = [
|
|
|
50
50
|
"**/*.kt",
|
|
51
51
|
"**/*.dart",
|
|
52
52
|
"**/*.ex",
|
|
53
|
-
"**/*.exs"
|
|
53
|
+
"**/*.exs",
|
|
54
|
+
"**/*.scala",
|
|
55
|
+
"**/*.sc",
|
|
56
|
+
"**/*.lua",
|
|
57
|
+
"**/*.zig",
|
|
58
|
+
"**/*.sh",
|
|
59
|
+
"**/*.bash",
|
|
60
|
+
"**/*.ml",
|
|
61
|
+
"**/*.mli",
|
|
62
|
+
"**/*.elm",
|
|
63
|
+
"**/*.sol",
|
|
64
|
+
"**/*.vue",
|
|
65
|
+
"**/*.m",
|
|
66
|
+
"**/*.yaml",
|
|
67
|
+
"**/*.yml",
|
|
68
|
+
"**/*.tf",
|
|
69
|
+
"**/*.tfvars",
|
|
70
|
+
"**/*.css",
|
|
71
|
+
"**/*.scss",
|
|
72
|
+
"**/*.sass",
|
|
73
|
+
"**/*.html"
|
|
54
74
|
];
|
|
55
75
|
const HOOKS = [
|
|
56
76
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/hooks.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { logWarn } from '../../errors';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst FILE_PATTERNS = [\n '**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx',\n '**/*.py', '**/*.go', '**/*.rs', '**/*.java',\n '**/*.cs', '**/*.rb', '**/*.php', '**/*.swift',\n '**/*.kt', '**/*.dart',\n '**/*.ex', '**/*.exs',\n];\n\nconst HOOKS: Array<{ filename: string; hook: object }> = [\n {\n filename: 'kirograph-mark-dirty-on-save.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Save',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are saved. Sync is deferred to agent idle.',\n when: { type: 'fileEdited', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-mark-dirty-on-create.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Create',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are created.',\n when: { type: 'fileCreated', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-on-delete.json',\n hook: {\n name: 'KiroGraph Sync on Delete',\n version: '1.0.0',\n description: 'Remove deleted files from the KiroGraph index immediately.',\n when: { type: 'fileDeleted', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-if-dirty.json',\n hook: {\n name: 'KiroGraph Deferred Sync',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent is idle and a dirty marker is present. Batches multiple rapid saves into one sync.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty --quiet 2>/dev/null || true' },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\nfunction migrateOnIdleHooks(hooksDir: string): void {\n if (!fs.existsSync(hooksDir)) return;\n let files: string[];\n try {\n files = fs.readdirSync(hooksDir).filter(f => f.endsWith('.json'));\n } catch {\n return;\n }\n for (const file of files) {\n const filePath = path.join(hooksDir, file);\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, 'utf8');\n } catch {\n logWarn(`KiroGraph installer: could not read hook file ${filePath}`);\n continue;\n }\n let obj: any;\n try {\n obj = JSON.parse(raw);\n } catch {\n logWarn(`KiroGraph installer: could not parse hook file ${filePath}`);\n continue;\n }\n if (obj?.when?.type === 'onIdle') {\n obj.when.type = 'agentStop';\n try {\n fs.writeFileSync(filePath, JSON.stringify(obj, null, 2) + '\\n');\n } catch {\n logWarn(`KiroGraph installer: could not write migrated hook file ${filePath}`);\n }\n }\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function writeHooks(kiroDir: string): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n migrateOnIdleHooks(hooksDir);\n\n const oldHooks = ['kirograph-sync-on-save.json', 'kirograph-sync-on-create.json'];\n for (const old of oldHooks) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const { filename, hook } of HOOKS) {\n writeJson(path.join(hooksDir, filename), hook);\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AACtB,oBAAwB;AAIxB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EAAW;AAAA,EAAY;AAAA,EAAW;AAAA,EAClC;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACjC;AAAA,EAAW;AAAA,EAAW;AAAA,EAAY;AAAA,EAClC;AAAA,EAAW;AAAA,EACX;AAAA,EAAW;
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { logWarn } from '../../errors';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst FILE_PATTERNS = [\n '**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx',\n '**/*.py', '**/*.go', '**/*.rs', '**/*.java',\n '**/*.cs', '**/*.rb', '**/*.php', '**/*.swift',\n '**/*.kt', '**/*.dart',\n '**/*.ex', '**/*.exs',\n '**/*.scala', '**/*.sc', '**/*.lua', '**/*.zig',\n '**/*.sh', '**/*.bash', '**/*.ml', '**/*.mli',\n '**/*.elm', '**/*.sol', '**/*.vue', '**/*.m',\n '**/*.yaml', '**/*.yml',\n '**/*.tf', '**/*.tfvars',\n '**/*.css', '**/*.scss', '**/*.sass',\n '**/*.html',\n];\n\nconst HOOKS: Array<{ filename: string; hook: object }> = [\n {\n filename: 'kirograph-mark-dirty-on-save.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Save',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are saved. Sync is deferred to agent idle.',\n when: { type: 'fileEdited', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-mark-dirty-on-create.json',\n hook: {\n name: 'KiroGraph Mark Dirty on Create',\n version: '1.0.0',\n description: 'Mark the KiroGraph index as dirty when source files are created.',\n when: { type: 'fileCreated', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph mark-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-on-delete.json',\n hook: {\n name: 'KiroGraph Sync on Delete',\n version: '1.0.0',\n description: 'Remove deleted files from the KiroGraph index immediately.',\n when: { type: 'fileDeleted', patterns: FILE_PATTERNS },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty 2>/dev/null || true' },\n },\n },\n {\n filename: 'kirograph-sync-if-dirty.json',\n hook: {\n name: 'KiroGraph Deferred Sync',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent is idle and a dirty marker is present. Batches multiple rapid saves into one sync.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph sync-if-dirty --quiet 2>/dev/null || true' },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\nfunction migrateOnIdleHooks(hooksDir: string): void {\n if (!fs.existsSync(hooksDir)) return;\n let files: string[];\n try {\n files = fs.readdirSync(hooksDir).filter(f => f.endsWith('.json'));\n } catch {\n return;\n }\n for (const file of files) {\n const filePath = path.join(hooksDir, file);\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, 'utf8');\n } catch {\n logWarn(`KiroGraph installer: could not read hook file ${filePath}`);\n continue;\n }\n let obj: any;\n try {\n obj = JSON.parse(raw);\n } catch {\n logWarn(`KiroGraph installer: could not parse hook file ${filePath}`);\n continue;\n }\n if (obj?.when?.type === 'onIdle') {\n obj.when.type = 'agentStop';\n try {\n fs.writeFileSync(filePath, JSON.stringify(obj, null, 2) + '\\n');\n } catch {\n logWarn(`KiroGraph installer: could not write migrated hook file ${filePath}`);\n }\n }\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function writeHooks(kiroDir: string): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n migrateOnIdleHooks(hooksDir);\n\n const oldHooks = ['kirograph-sync-on-save.json', 'kirograph-sync-on-create.json'];\n for (const old of oldHooks) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const { filename, hook } of HOOKS) {\n writeJson(path.join(hooksDir, filename), hook);\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AACpB,WAAsB;AACtB,oBAAwB;AAIxB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EAAW;AAAA,EAAY;AAAA,EAAW;AAAA,EAClC;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACj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AK,OAAO;AACtC,cAAU,KAAK,KAAK,UAAU,QAAQ,GAAG,IAAI;AAAA,EAC/C;AAEA,UAAQ,IAAI,uCAAkC,QAAQ,EAAE;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/bin/kirograph.js
CHANGED
|
@@ -56,7 +56,7 @@ process.on("uncaughtException", (err) => {
|
|
|
56
56
|
process.exit(1);
|
|
57
57
|
});
|
|
58
58
|
const program = new import_commander.Command();
|
|
59
|
-
program.name("kirograph").description("Semantic code knowledge graph for Kiro").version("0.
|
|
59
|
+
program.name("kirograph").description("Semantic code knowledge graph for Kiro").version("0.13.0").addHelpCommand(true).hook("preAction", (thisCommand) => {
|
|
60
60
|
const name = thisCommand.name();
|
|
61
61
|
if (name === "init") (0, import_banner.printBanner)();
|
|
62
62
|
});
|