code-kg 0.1.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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -0
  3. package/dist/cli/index.d.ts +14 -0
  4. package/dist/cli/index.js +68 -0
  5. package/dist/cli/index.js.map +1 -0
  6. package/dist/codekg-config.d.ts +14 -0
  7. package/dist/codekg-config.js +81 -0
  8. package/dist/codekg-config.js.map +1 -0
  9. package/dist/commands/graph.d.ts +7 -0
  10. package/dist/commands/graph.js +49 -0
  11. package/dist/commands/graph.js.map +1 -0
  12. package/dist/commands/init.d.ts +6 -0
  13. package/dist/commands/init.js +13 -0
  14. package/dist/commands/init.js.map +1 -0
  15. package/dist/commands/insights.d.ts +7 -0
  16. package/dist/commands/insights.js +31 -0
  17. package/dist/commands/insights.js.map +1 -0
  18. package/dist/commands/path.d.ts +7 -0
  19. package/dist/commands/path.js +47 -0
  20. package/dist/commands/path.js.map +1 -0
  21. package/dist/commands/reindex.d.ts +6 -0
  22. package/dist/commands/reindex.js +13 -0
  23. package/dist/commands/reindex.js.map +1 -0
  24. package/dist/commands/run.d.ts +6 -0
  25. package/dist/commands/run.js +20 -0
  26. package/dist/commands/run.js.map +1 -0
  27. package/dist/commands/serve.d.ts +8 -0
  28. package/dist/commands/serve.js +25 -0
  29. package/dist/commands/serve.js.map +1 -0
  30. package/dist/config/defaults.d.ts +6 -0
  31. package/dist/config/defaults.js +30 -0
  32. package/dist/config/defaults.js.map +1 -0
  33. package/dist/index.d.ts +52 -0
  34. package/dist/index.js +602 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/indexer/babel-fallback.d.ts +7 -0
  37. package/dist/indexer/babel-fallback.js +583 -0
  38. package/dist/indexer/babel-fallback.js.map +1 -0
  39. package/dist/indexer/file-discovery.d.ts +6 -0
  40. package/dist/indexer/file-discovery.js +106 -0
  41. package/dist/indexer/file-discovery.js.map +1 -0
  42. package/dist/indexer/indexer.d.ts +90 -0
  43. package/dist/indexer/indexer.js +620 -0
  44. package/dist/indexer/indexer.js.map +1 -0
  45. package/dist/indexer/metrics.d.ts +39 -0
  46. package/dist/indexer/metrics.js +147 -0
  47. package/dist/indexer/metrics.js.map +1 -0
  48. package/dist/indexer/structure-detector.d.ts +16 -0
  49. package/dist/indexer/structure-detector.js +159 -0
  50. package/dist/indexer/structure-detector.js.map +1 -0
  51. package/dist/indexer/ts-parser.d.ts +86 -0
  52. package/dist/indexer/ts-parser.js +437 -0
  53. package/dist/indexer/ts-parser.js.map +1 -0
  54. package/dist/model/edge.d.ts +21 -0
  55. package/dist/model/edge.js +25 -0
  56. package/dist/model/edge.js.map +1 -0
  57. package/dist/model/graph.d.ts +10 -0
  58. package/dist/model/graph.js +20 -0
  59. package/dist/model/graph.js.map +1 -0
  60. package/dist/model/node.d.ts +24 -0
  61. package/dist/model/node.js +22 -0
  62. package/dist/model/node.js.map +1 -0
  63. package/dist/query/query-dsl.d.ts +17 -0
  64. package/dist/query/query-dsl.js +75 -0
  65. package/dist/query/query-dsl.js.map +1 -0
  66. package/dist/query/query-engine.d.ts +32 -0
  67. package/dist/query/query-engine.js +126 -0
  68. package/dist/query/query-engine.js.map +1 -0
  69. package/dist/server/api.d.ts +19 -0
  70. package/dist/server/api.js +29 -0
  71. package/dist/server/api.js.map +1 -0
  72. package/dist/server/app.d.ts +7 -0
  73. package/dist/server/app.js +509 -0
  74. package/dist/server/app.js.map +1 -0
  75. package/dist/server/graph-controller.d.ts +147 -0
  76. package/dist/server/graph-controller.js +186 -0
  77. package/dist/server/graph-controller.js.map +1 -0
  78. package/dist/server/routes.d.ts +3 -0
  79. package/dist/server/routes.js +19 -0
  80. package/dist/server/routes.js.map +1 -0
  81. package/dist/server/ui.d.ts +1 -0
  82. package/dist/server/ui.js +1165 -0
  83. package/dist/server/ui.js.map +1 -0
  84. package/dist/store/sqlite-store.d.ts +83 -0
  85. package/dist/store/sqlite-store.js +647 -0
  86. package/dist/store/sqlite-store.js.map +1 -0
  87. package/dist/utils/ids.d.ts +2 -0
  88. package/dist/utils/ids.js +9 -0
  89. package/dist/utils/ids.js.map +1 -0
  90. package/dist/utils/path.d.ts +3 -0
  91. package/dist/utils/path.js +21 -0
  92. package/dist/utils/path.js.map +1 -0
  93. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 code-kg contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # code-kg
2
+
3
+ Local code knowledge graph CLI for TypeScript/JavaScript projects.
4
+
5
+ - Builds a local graph in SQLite
6
+ - Serves an interactive 3D graph UI
7
+ - Exposes deterministic JSON APIs for graph exploration and insights
8
+
9
+ ## Privacy
10
+
11
+ `code-kg` runs locally and does not send code to external services by default.
12
+
13
+ ## Quick Start (npx)
14
+
15
+ ```bash
16
+ npx code-kg
17
+ ```
18
+
19
+ This will:
20
+ 1. Index the current directory
21
+ 2. Start the local server on port `4783`
22
+ 3. Print the local UI URL
23
+
24
+ ## Explicit Commands
25
+
26
+ ```bash
27
+ # index project
28
+ npx code-kg init --path .
29
+
30
+ # re-index project
31
+ npx code-kg reindex --path .
32
+
33
+ # serve graph UI/API
34
+ npx code-kg serve --path . --port 4783
35
+
36
+ # one command flow
37
+ npx code-kg run --path . --port 4783 --open
38
+ ```
39
+
40
+ ## Dev Dependency Workflow
41
+
42
+ ```bash
43
+ npm i -D code-kg
44
+ ```
45
+
46
+ Example `package.json` scripts:
47
+
48
+ ```json
49
+ {
50
+ "scripts": {
51
+ "codekg": "codekg",
52
+ "codekg:run": "codekg run --path . --port 4783",
53
+ "codekg:insights": "codekg insights --path . --format json --output .codekg/insights.json"
54
+ }
55
+ }
56
+ ```
57
+
58
+ ## CLI JSON Outputs
59
+
60
+ ```bash
61
+ # ranked insights
62
+ npx code-kg insights --path . --limit 10 --format json
63
+
64
+ # filtered graph
65
+ npx code-kg graph \
66
+ --path . \
67
+ --view symbolGraph \
68
+ --node-types Function,Class \
69
+ --edge-types CALLS,REFERENCES \
70
+ --format json
71
+
72
+ # shortest directed path
73
+ npx code-kg path \
74
+ --path . \
75
+ --from file:src/index.ts \
76
+ --to file:src/server/app.ts \
77
+ --max-depth 12 \
78
+ --format json
79
+ ```
80
+
81
+ ## API Endpoints
82
+
83
+ - `GET /api/meta`
84
+ - `GET /api/search?q=...`
85
+ - `GET /api/node/:id`
86
+ - `GET /api/graph?view=fileDeps|symbolGraph|all&nodeTypes=...&edgeTypes=...&q=...&limit=...`
87
+ - `GET /api/subgraph?seed=<nodeId>&depth=2&direction=both`
88
+ - `GET /api/path?from=<nodeId>&to=<nodeId>&maxDepth=12&edgeTypes=...`
89
+ - `GET /api/routes`
90
+ - `GET /api/cycles`
91
+ - `POST /api/query`
92
+ - `POST /api/llm/query` (optional stub)
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ npm install
98
+ npm run build
99
+ npm test
100
+ ```
@@ -0,0 +1,14 @@
1
+ import { Command } from "commander";
2
+ import type { GraphCommandOptions, IndexCommandOptions, InsightsCommandOptions, PathCommandOptions, RunCommandOptions, ServeCommandOptions } from "../index";
3
+ export interface CliDependencies {
4
+ runInit: (options: IndexCommandOptions) => Promise<unknown>;
5
+ runReindex: (options: IndexCommandOptions) => Promise<unknown>;
6
+ runServe: (options: ServeCommandOptions) => Promise<unknown>;
7
+ runDefault: (options: RunCommandOptions) => Promise<unknown>;
8
+ runInsights: (options: InsightsCommandOptions) => Promise<unknown>;
9
+ runGraphQuery: (options: GraphCommandOptions) => Promise<unknown>;
10
+ runPathQuery: (options: PathCommandOptions) => Promise<unknown>;
11
+ writeJsonOutput: (value: unknown, outputPath?: string) => Promise<void>;
12
+ }
13
+ export declare function buildCli(overrides?: Partial<CliDependencies>): Command;
14
+ export declare function runCli(argv?: string[], overrides?: Partial<CliDependencies>): Promise<void>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildCli = buildCli;
7
+ exports.runCli = runCli;
8
+ const node_process_1 = __importDefault(require("node:process"));
9
+ const commander_1 = require("commander");
10
+ const graph_1 = require("../commands/graph");
11
+ const init_1 = require("../commands/init");
12
+ const insights_1 = require("../commands/insights");
13
+ const path_1 = require("../commands/path");
14
+ const reindex_1 = require("../commands/reindex");
15
+ const run_1 = require("../commands/run");
16
+ const serve_1 = require("../commands/serve");
17
+ const index_1 = require("../index");
18
+ const serve_2 = require("../commands/serve");
19
+ function buildCli(overrides = {}) {
20
+ const dependencies = {
21
+ runInit: overrides.runInit ?? index_1.runInit,
22
+ runReindex: overrides.runReindex ?? index_1.runReindex,
23
+ runServe: overrides.runServe ?? index_1.runServe,
24
+ runDefault: overrides.runDefault ?? index_1.runDefault,
25
+ runInsights: overrides.runInsights ?? index_1.runInsights,
26
+ runGraphQuery: overrides.runGraphQuery ?? index_1.runGraphQuery,
27
+ runPathQuery: overrides.runPathQuery ?? index_1.runPathQuery,
28
+ writeJsonOutput: overrides.writeJsonOutput ?? index_1.writeJsonOutput,
29
+ };
30
+ const program = new commander_1.Command();
31
+ program.name("codekg").description("Code Knowledge Graph CLI").showHelpAfterError();
32
+ (0, run_1.registerRunCommand)(program, { runDefault: dependencies.runDefault });
33
+ (0, init_1.registerInitCommand)(program, { runInit: dependencies.runInit });
34
+ (0, reindex_1.registerReindexCommand)(program, { runReindex: dependencies.runReindex });
35
+ (0, serve_1.registerServeCommand)(program, { runServe: dependencies.runServe });
36
+ (0, insights_1.registerInsightsCommand)(program, {
37
+ runInsights: dependencies.runInsights,
38
+ writeJsonOutput: dependencies.writeJsonOutput,
39
+ });
40
+ (0, graph_1.registerGraphCommand)(program, {
41
+ runGraphQuery: dependencies.runGraphQuery,
42
+ writeJsonOutput: dependencies.writeJsonOutput,
43
+ });
44
+ (0, path_1.registerPathCommand)(program, {
45
+ runPathQuery: dependencies.runPathQuery,
46
+ writeJsonOutput: dependencies.writeJsonOutput,
47
+ });
48
+ return program;
49
+ }
50
+ async function runCli(argv = node_process_1.default.argv, overrides = {}) {
51
+ if (argv.length <= 2) {
52
+ const dependencies = {
53
+ runInit: overrides.runInit ?? index_1.runInit,
54
+ runReindex: overrides.runReindex ?? index_1.runReindex,
55
+ runServe: overrides.runServe ?? index_1.runServe,
56
+ runDefault: overrides.runDefault ?? index_1.runDefault,
57
+ runInsights: overrides.runInsights ?? index_1.runInsights,
58
+ runGraphQuery: overrides.runGraphQuery ?? index_1.runGraphQuery,
59
+ runPathQuery: overrides.runPathQuery ?? index_1.runPathQuery,
60
+ writeJsonOutput: overrides.writeJsonOutput ?? index_1.writeJsonOutput,
61
+ };
62
+ await dependencies.runDefault({ path: ".", port: serve_2.DEFAULT_SERVE_PORT, open: false });
63
+ return;
64
+ }
65
+ const cli = buildCli(overrides);
66
+ await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OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const CODEKG_CONFIG_FILENAME = "codekg.config.json";
2
+ export declare const DEFAULT_DB_PATH = ".codekg/codekg.db";
3
+ export interface CodekgConfig {
4
+ dbPath: string;
5
+ }
6
+ export interface LoadedCodekgConfig {
7
+ projectRoot: string;
8
+ configPath: string;
9
+ config: CodekgConfig;
10
+ resolvedDbPath: string;
11
+ }
12
+ export declare function resolveDbPath(projectRoot: string, dbPath: string): string;
13
+ export declare function ensureDbDirectory(dbPath: string): Promise<void>;
14
+ export declare function loadOrCreateCodekgConfig(projectPath?: string): Promise<LoadedCodekgConfig>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_DB_PATH = exports.CODEKG_CONFIG_FILENAME = void 0;
7
+ exports.resolveDbPath = resolveDbPath;
8
+ exports.ensureDbDirectory = ensureDbDirectory;
9
+ exports.loadOrCreateCodekgConfig = loadOrCreateCodekgConfig;
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ exports.CODEKG_CONFIG_FILENAME = "codekg.config.json";
13
+ exports.DEFAULT_DB_PATH = ".codekg/codekg.db";
14
+ function hasNonEmptyString(value) {
15
+ return typeof value === "string" && value.trim().length > 0;
16
+ }
17
+ function normalizeConfig(rawConfig) {
18
+ return {
19
+ dbPath: hasNonEmptyString(rawConfig?.dbPath) ? rawConfig.dbPath : exports.DEFAULT_DB_PATH,
20
+ };
21
+ }
22
+ function resolveConfigPath(projectRoot) {
23
+ return node_path_1.default.join(projectRoot, exports.CODEKG_CONFIG_FILENAME);
24
+ }
25
+ function resolveRoot(projectPath) {
26
+ return node_path_1.default.resolve(projectPath);
27
+ }
28
+ async function readConfig(configPath) {
29
+ const rawConfig = await node_fs_1.promises.readFile(configPath, "utf8");
30
+ const parsed = JSON.parse(rawConfig);
31
+ if (!parsed || typeof parsed !== "object") {
32
+ return {};
33
+ }
34
+ return parsed;
35
+ }
36
+ async function writeConfig(configPath, config) {
37
+ await node_fs_1.promises.writeFile(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
38
+ }
39
+ function resolveDbPath(projectRoot, dbPath) {
40
+ return node_path_1.default.isAbsolute(dbPath) ? dbPath : node_path_1.default.resolve(projectRoot, dbPath);
41
+ }
42
+ async function ensureDbDirectory(dbPath) {
43
+ await node_fs_1.promises.mkdir(node_path_1.default.dirname(dbPath), { recursive: true });
44
+ }
45
+ async function loadOrCreateCodekgConfig(projectPath = ".") {
46
+ const projectRoot = resolveRoot(projectPath);
47
+ const configPath = resolveConfigPath(projectRoot);
48
+ let parsedConfig;
49
+ let shouldWriteDefaults = false;
50
+ try {
51
+ parsedConfig = await readConfig(configPath);
52
+ }
53
+ catch (error) {
54
+ const maybeNodeError = error;
55
+ if (maybeNodeError.code === "ENOENT") {
56
+ parsedConfig = undefined;
57
+ shouldWriteDefaults = true;
58
+ }
59
+ else if (error instanceof SyntaxError) {
60
+ throw new Error(`Invalid JSON in ${configPath}: ${error.message}`);
61
+ }
62
+ else {
63
+ throw error;
64
+ }
65
+ }
66
+ const config = normalizeConfig(parsedConfig);
67
+ if (!hasNonEmptyString(parsedConfig?.dbPath)) {
68
+ shouldWriteDefaults = true;
69
+ }
70
+ if (shouldWriteDefaults) {
71
+ await node_fs_1.promises.mkdir(projectRoot, { recursive: true });
72
+ await writeConfig(configPath, config);
73
+ }
74
+ return {
75
+ projectRoot,
76
+ configPath,
77
+ config,
78
+ resolvedDbPath: resolveDbPath(projectRoot, config.dbPath),
79
+ };
80
+ }
81
+ //# sourceMappingURL=codekg-config.js.map
@@ -0,0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I,CAAC,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC;QAC7C,mBAAmB,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,kBAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,WAAW;QACX,UAAU;QACV,MAAM;QACN,cAAc,EAAE,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;KAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from "commander";
2
+ import type { GraphCommandOptions } from "../index";
3
+ export interface GraphCommandDependencies {
4
+ runGraphQuery: (options: GraphCommandOptions) => Promise<unknown>;
5
+ writeJsonOutput: (value: unknown, outputPath?: string) => Promise<void>;
6
+ }
7
+ export declare function registerGraphCommand(program: Command, dependencies: GraphCommandDependencies): Command;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerGraphCommand = registerGraphCommand;
4
+ const commander_1 = require("commander");
5
+ function parseLimit(value) {
6
+ const parsed = Number.parseInt(value, 10);
7
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 50000) {
8
+ throw new commander_1.InvalidArgumentError(`Invalid limit \"${value}\". Use a value between 1 and 50000.`);
9
+ }
10
+ return parsed;
11
+ }
12
+ function parseCsvList(value) {
13
+ if (!value) {
14
+ return undefined;
15
+ }
16
+ const list = value
17
+ .split(",")
18
+ .map((entry) => entry.trim())
19
+ .filter((entry) => entry.length > 0);
20
+ return list.length > 0 ? list : undefined;
21
+ }
22
+ function registerGraphCommand(program, dependencies) {
23
+ return program
24
+ .command("graph")
25
+ .description("Output graph data as JSON with optional filters.")
26
+ .option("--path <path>", "Project root path", ".")
27
+ .option("--view <view>", "Graph view (fileDeps, symbolGraph, all)", "fileDeps")
28
+ .option("--node-types <types>", "Comma-separated node type filter")
29
+ .option("--edge-types <types>", "Comma-separated edge type filter")
30
+ .option("--q <query>", "Text filter over node id/type/name/path")
31
+ .option("--limit <n>", "Limit returned nodes", parseLimit)
32
+ .option("--format <format>", "Output format (json)", "json")
33
+ .option("--output <file>", "Write JSON to a file instead of stdout")
34
+ .action(async (options) => {
35
+ if (options.format !== "json") {
36
+ throw new commander_1.InvalidArgumentError(`Unsupported format \"${options.format}\". Use json.`);
37
+ }
38
+ const result = await dependencies.runGraphQuery({
39
+ path: options.path,
40
+ view: options.view,
41
+ nodeTypes: parseCsvList(options.nodeTypes),
42
+ edgeTypes: parseCsvList(options.edgeTypes),
43
+ q: options.q,
44
+ limit: options.limit,
45
+ });
46
+ await dependencies.writeJsonOutput(result, options.output);
47
+ });
48
+ }
49
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":";;AA2BA,oDAyCC;AApED,yCAA0D;AAQ1D,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,KAAK,EAAE,CAAC;QAC9D,MAAM,IAAI,gCAAoB,CAAC,mBAAmB,KAAK,sCAAsC,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,KAAyB;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,KAAK;SACf,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EA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AO,CAAC,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from "commander";
2
+ import type { IndexCommandOptions } from "../index";
3
+ export interface InitCommandDependencies {
4
+ runInit: (options: IndexCommandOptions) => Promise<unknown>;
5
+ }
6
+ export declare function registerInitCommand(program: Command, dependencies: InitCommandDependencies): Command;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerInitCommand = registerInitCommand;
4
+ function registerInitCommand(program, dependencies) {
5
+ return program
6
+ .command("init")
7
+ .description("Index project files and persist the graph to SQLite.")
8
+ .option("--path <path>", "Project root path to index", ".")
9
+ .action(async (options) => {
10
+ await dependencies.runInit({ path: options.path });
11
+ });
12
+ }
13
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;AAOA,kDAWC;AAXD,SAAgB,mBAAmB,CACjC,OAAgB,EAChB,YAAqC;IAErC,OAAO,OAAO;SACX,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,GAAG,CAAC;SAC1D,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;QAC1C,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from "commander";
2
+ import type { InsightsCommandOptions } from "../index";
3
+ export interface InsightsCommandDependencies {
4
+ runInsights: (options: InsightsCommandOptions) => Promise<unknown>;
5
+ writeJsonOutput: (value: unknown, outputPath?: string) => Promise<void>;
6
+ }
7
+ export declare function registerInsightsCommand(program: Command, dependencies: InsightsCommandDependencies): Command;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerInsightsCommand = registerInsightsCommand;
4
+ const commander_1 = require("commander");
5
+ function parseLimit(value) {
6
+ const parsed = Number.parseInt(value, 10);
7
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 1000) {
8
+ throw new commander_1.InvalidArgumentError(`Invalid limit \"${value}\". Use a value between 1 and 1000.`);
9
+ }
10
+ return parsed;
11
+ }
12
+ function registerInsightsCommand(program, dependencies) {
13
+ return program
14
+ .command("insights")
15
+ .description("Output ranked refactor insights as JSON.")
16
+ .option("--path <path>", "Project root path", ".")
17
+ .option("--limit <n>", "Maximum hotspots to return", parseLimit, 5)
18
+ .option("--format <format>", "Output format (json)", "json")
19
+ .option("--output <file>", "Write JSON to a file instead of stdout")
20
+ .action(async (options) => {
21
+ if (options.format !== "json") {
22
+ throw new commander_1.InvalidArgumentError(`Unsupported format \"${options.format}\". Use json.`);
23
+ }
24
+ const result = await dependencies.runInsights({
25
+ path: options.path,
26
+ limit: options.limit,
27
+ });
28
+ await dependencies.writeJsonOutput(result, options.output);
29
+ });
30
+ }
31
+ //# sourceMappingURL=insights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.js","sourceRoot":"","sources":["../../src/commands/insights.ts"],"names":[],"mappings":";;AAgBA,0DAqBC;AArCD,yCAA0D;AAQ1D,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,IAAI,EAAE,CAAC;QAC7D,MAAM,IAAI,gCAAoB,CAAC,mBAAmB,KAAK,qCAAqC,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,uBAAuB,CACrC,OAAgB,EAChB,YAAyC;IAEzC,OAAO,OAAO;SACX,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CAAC,eAAe,EAAE,mBAAmB,EAAE,GAAG,CAAC;SACjD,MAAM,CAAC,aAAa,EAAE,4BAA4B,EAAE,UAAU,EAAE,CAAC,CAAC;SAClE,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,CAAC;SAC3D,MAAM,CAAC,iBAAiB,EAAE,wCAAwC,CAAC;SACnE,MAAM,CAAC,KAAK,EAAE,OAAyE,EAAE,EAAE;QAC1F,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC9B,MAAM,IAAI,gCAAoB,CAAC,wBAAwB,OAAO,CAAC,MAAM,eAAe,CAAC,CAAC;QACxF,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC;YAC5C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from "commander";
2
+ import type { PathCommandOptions } from "../index";
3
+ export interface PathCommandDependencies {
4
+ runPathQuery: (options: PathCommandOptions) => Promise<unknown>;
5
+ writeJsonOutput: (value: unknown, outputPath?: string) => Promise<void>;
6
+ }
7
+ export declare function registerPathCommand(program: Command, dependencies: PathCommandDependencies): Command;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerPathCommand = registerPathCommand;
4
+ const commander_1 = require("commander");
5
+ function parseMaxDepth(value) {
6
+ const parsed = Number.parseInt(value, 10);
7
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 128) {
8
+ throw new commander_1.InvalidArgumentError(`Invalid max depth \"${value}\". Use a value between 1 and 128.`);
9
+ }
10
+ return parsed;
11
+ }
12
+ function parseCsvList(value) {
13
+ if (!value) {
14
+ return undefined;
15
+ }
16
+ const list = value
17
+ .split(",")
18
+ .map((entry) => entry.trim())
19
+ .filter((entry) => entry.length > 0);
20
+ return list.length > 0 ? list : undefined;
21
+ }
22
+ function registerPathCommand(program, dependencies) {
23
+ return program
24
+ .command("path")
25
+ .description("Find the shortest directed path between two nodes and output JSON.")
26
+ .requiredOption("--from <nodeId>", "Source node id")
27
+ .requiredOption("--to <nodeId>", "Target node id")
28
+ .option("--path <path>", "Project root path", ".")
29
+ .option("--max-depth <n>", "BFS depth bound", parseMaxDepth, 12)
30
+ .option("--edge-types <types>", "Comma-separated allowed edge types")
31
+ .option("--format <format>", "Output format (json)", "json")
32
+ .option("--output <file>", "Write JSON to a file instead of stdout")
33
+ .action(async (options) => {
34
+ if (options.format !== "json") {
35
+ throw new commander_1.InvalidArgumentError(`Unsupported format \"${options.format}\". Use json.`);
36
+ }
37
+ const result = await dependencies.runPathQuery({
38
+ path: options.path,
39
+ from: options.from,
40
+ to: options.to,
41
+ maxDepth: options.maxDepth,
42
+ edgeTypes: parseCsvList(options.edgeTypes),
43
+ });
44
+ await dependencies.writeJsonOutput(result, options.output);
45
+ });
46
+ }
47
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/commands/path.ts"],"names":[],"mappings":";;AA2BA,kDAsCC;AAjED,yCAA0D;AAQ1D,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CA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9B,MAAM,IAAI,gCAAoB,CAAC,wBAAwB,OAAO,CAAC,MAAM,eAAe,CAAC,CAAC;QACxF,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC;YAC7C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC;SAC3C,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from "commander";
2
+ import type { IndexCommandOptions } from "../index";
3
+ export interface ReindexCommandDependencies {
4
+ runReindex: (options: IndexCommandOptions) => Promise<unknown>;
5
+ }
6
+ export declare function registerReindexCommand(program: Command, dependencies: ReindexCommandDependencies): Command;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerReindexCommand = registerReindexCommand;
4
+ function registerReindexCommand(program, dependencies) {
5
+ return program
6
+ .command("reindex")
7
+ .description("Re-run indexing and overwrite persisted graph data.")
8
+ .option("--path <path>", "Project root path to index", ".")
9
+ .action(async (options) => {
10
+ await dependencies.runReindex({ path: options.path });
11
+ });
12
+ }
13
+ //# sourceMappingURL=reindex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reindex.js","sourceRoot":"","sources":["../../src/commands/reindex.ts"],"names":[],"mappings":";;AAOA,wDAWC;AAXD,SAAgB,sBAAsB,CACpC,OAAgB,EAChB,YAAwC;IAExC,OAAO,OAAO;SACX,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,GAAG,CAAC;SAC1D,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;QAC1C,MAAM,YAAY,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from "commander";
2
+ import type { RunCommandOptions } from "../index";
3
+ export interface RunCommandDependencies {
4
+ runDefault: (options: RunCommandOptions) => Promise<unknown>;
5
+ }
6
+ export declare function registerRunCommand(program: Command, dependencies: RunCommandDependencies): Command;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerRunCommand = registerRunCommand;
4
+ const serve_1 = require("./serve");
5
+ function registerRunCommand(program, dependencies) {
6
+ return program
7
+ .command("run")
8
+ .description("Index the project and start the local UI/API server in one command.")
9
+ .option("--path <path>", "Project root path to index", ".")
10
+ .option("--port <port>", "HTTP port", serve_1.parsePort, serve_1.DEFAULT_SERVE_PORT)
11
+ .option("--open", "Open the UI in the default browser", false)
12
+ .action(async (options) => {
13
+ await dependencies.runDefault({
14
+ path: options.path,
15
+ port: options.port,
16
+ open: options.open,
17
+ });
18
+ });
19
+ }
20
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;AAQA,gDAiBC;AAvBD,mCAAwD;AAMxD,SAAgB,kBAAkB,CAChC,OAAgB,EAChB,YAAoC;IAEpC,OAAO,OAAO;SACX,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,GAAG,CAAC;SAC1D,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,iBAAS,EAAE,0BAAkB,CAAC;SACnE,MAAM,CAAC,QAAQ,EAAE,oCAAoC,EAAE,KAAK,CAAC;SAC7D,MAAM,CAAC,KAAK,EAAE,OAAsD,EAAE,EAAE;QACvE,MAAM,YAAY,CAAC,UAAU,CAAC;YAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Command } from "commander";
2
+ import type { ServeCommandOptions } from "../index";
3
+ export declare const DEFAULT_SERVE_PORT = 4783;
4
+ export interface ServeCommandDependencies {
5
+ runServe: (options: ServeCommandOptions) => Promise<unknown>;
6
+ }
7
+ export declare function parsePort(value: string): number;
8
+ export declare function registerServeCommand(program: Command, dependencies: ServeCommandDependencies): Command;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SERVE_PORT = void 0;
4
+ exports.parsePort = parsePort;
5
+ exports.registerServeCommand = registerServeCommand;
6
+ const commander_1 = require("commander");
7
+ exports.DEFAULT_SERVE_PORT = 4783;
8
+ function parsePort(value) {
9
+ const parsed = Number.parseInt(value, 10);
10
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
11
+ throw new commander_1.InvalidArgumentError(`Invalid port "${value}". Use a value between 1 and 65535.`);
12
+ }
13
+ return parsed;
14
+ }
15
+ function registerServeCommand(program, dependencies) {
16
+ return program
17
+ .command("serve")
18
+ .description("Start the API server using the persisted SQLite graph database.")
19
+ .option("--port <port>", "HTTP port", parsePort, exports.DEFAULT_SERVE_PORT)
20
+ .option("--path <path>", "Project root path that contains codekg.config.json", ".")
21
+ .action(async (options) => {
22
+ await dependencies.runServe({ path: options.path, port: options.port });
23
+ });
24
+ }
25
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":";;;AASA,8BAOC;AAED,oDAYC;AA9BD,yCAA0D;AAG7C,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAMvC,SAAgB,SAAS,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,KAAK,EAAE,CAAC;QAC9D,MAAM,IAAI,gCAAoB,CAAC,iBAAiB,KAAK,qCAAqC,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,oBAAoB,CAClC,OAAgB,EAChB,YAAsC;IAEtC,OAAO,OAAO;SACX,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,0BAAkB,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,oDAAoD,EAAE,GAAG,CAAC;SAClF,MAAM,CAAC,KAAK,EAAE,OAAuC,EAAE,EAAE;QACxD,MAAM,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { EdgeType } from "../model/edge";
2
+ import { NodeType } from "../model/node";
3
+ export declare const DEFAULT_CLI_NAME = "codekg";
4
+ export declare const DEFAULT_GRAPH_OUTPUT = "codekg.graph.json";
5
+ export declare const DEFAULT_NODE_TYPES: ReadonlyArray<NodeType>;
6
+ export declare const DEFAULT_EDGE_TYPES: ReadonlyArray<EdgeType>;