codemap-ai 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -1290,7 +1290,7 @@ program.command("serve").description("Start the web visualization server").argum
|
|
|
1290
1290
|
process.exit(1);
|
|
1291
1291
|
}
|
|
1292
1292
|
console.log(chalk.blue.bold("\n CodeMap Visualization Server\n"));
|
|
1293
|
-
const { startServer } = await import("./server-
|
|
1293
|
+
const { startServer } = await import("./server-3W7ZN3LX.js");
|
|
1294
1294
|
startServer(dbPath, parseInt(options.port, 10));
|
|
1295
1295
|
});
|
|
1296
1296
|
program.command("mcp-server").description("Start the MCP server for Claude Code integration").option("-p, --path <path>", "Project root path", ".").action(async (options) => {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
// src/web/server.ts
|
|
8
8
|
import express from "express";
|
|
9
9
|
import { join } from "path";
|
|
10
|
+
import { existsSync } from "fs";
|
|
10
11
|
import { fileURLToPath } from "url";
|
|
11
12
|
import { dirname } from "path";
|
|
12
13
|
var __filename = fileURLToPath(import.meta.url);
|
|
@@ -14,7 +15,22 @@ var __dirname = dirname(__filename);
|
|
|
14
15
|
function startServer(dbPath, port = 3333) {
|
|
15
16
|
const app = express();
|
|
16
17
|
const storage = new GraphStorage(dbPath);
|
|
17
|
-
|
|
18
|
+
const possiblePaths = [
|
|
19
|
+
join(__dirname, "../../web"),
|
|
20
|
+
// Development: from dist/
|
|
21
|
+
join(__dirname, "../web"),
|
|
22
|
+
// Installed: from dist/
|
|
23
|
+
join(__dirname, "../../../web")
|
|
24
|
+
// NPX: deeper nesting
|
|
25
|
+
];
|
|
26
|
+
let webDir = possiblePaths[0];
|
|
27
|
+
for (const p of possiblePaths) {
|
|
28
|
+
if (existsSync(join(p, "index.html"))) {
|
|
29
|
+
webDir = p;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
app.use(express.static(webDir));
|
|
18
34
|
app.get("/api/graph", (req, res) => {
|
|
19
35
|
try {
|
|
20
36
|
const graph = storage.exportForVisualization();
|
|
@@ -84,4 +100,4 @@ function startServer(dbPath, port = 3333) {
|
|
|
84
100
|
export {
|
|
85
101
|
startServer
|
|
86
102
|
};
|
|
87
|
-
//# sourceMappingURL=server-
|
|
103
|
+
//# sourceMappingURL=server-3W7ZN3LX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/web/server.ts"],"sourcesContent":["/**\n * Web server for visualization\n */\n\nimport express from \"express\";\nimport { join } from \"path\";\nimport { existsSync } from \"fs\";\nimport { GraphStorage } from \"../graph/storage.js\";\nimport { fileURLToPath } from \"url\";\nimport { dirname } from \"path\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport function startServer(dbPath: string, port: number = 3333): void {\n const app = express();\n const storage = new GraphStorage(dbPath);\n\n // Find the web directory - try multiple possible locations\n const possiblePaths = [\n join(__dirname, \"../../web\"), // Development: from dist/\n join(__dirname, \"../web\"), // Installed: from dist/\n join(__dirname, \"../../../web\"), // NPX: deeper nesting\n ];\n\n let webDir = possiblePaths[0];\n for (const p of possiblePaths) {\n if (existsSync(join(p, \"index.html\"))) {\n webDir = p;\n break;\n }\n }\n\n // Serve static files\n app.use(express.static(webDir));\n\n // API endpoints\n app.get(\"/api/graph\", (req, res) => {\n try {\n const graph = storage.exportForVisualization();\n res.json(graph);\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/stats\", (req, res) => {\n try {\n const stats = storage.getStats();\n const rootPath = storage.getMeta(\"rootPath\");\n const analyzedAt = storage.getMeta(\"analyzedAt\");\n res.json({ ...stats, rootPath, analyzedAt });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/search\", (req, res) => {\n try {\n const query = req.query.q as string;\n if (!query) {\n res.json([]);\n return;\n }\n const nodes = storage.searchNodes(query);\n res.json(nodes.slice(0, 50));\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/node/:id\", (req, res) => {\n try {\n const node = storage.getNode(decodeURIComponent(req.params.id));\n if (!node) {\n res.status(404).json({ error: \"Node not found\" });\n return;\n }\n\n const edgesFrom = storage.getEdgesFrom(node.id);\n const edgesTo = storage.getEdgesTo(node.id);\n\n res.json({ node, edgesFrom, edgesTo });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/file/:path(*)\", (req, res) => {\n try {\n const filePath = decodeURIComponent(req.params.path);\n const nodes = storage.getNodesByFile(filePath);\n const deps = storage.getFileDependencies(filePath);\n res.json({ nodes, dependencies: deps });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.listen(port, () => {\n console.log(`\\n CodeMap visualization server running at:`);\n console.log(` http://localhost:${port}\\n`);\n });\n\n // Cleanup on exit\n process.on(\"SIGINT\", () => {\n storage.close();\n process.exit(0);\n });\n}\n"],"mappings":";;;;;;;AAIA,OAAO,aAAa;AACpB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAExB,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AAE7B,SAAS,YAAY,QAAgB,OAAe,MAAY;AACrE,QAAM,MAAM,QAAQ;AACpB,QAAM,UAAU,IAAI,aAAa,MAAM;AAGvC,QAAM,gBAAgB;AAAA,IACpB,KAAK,WAAW,WAAW;AAAA;AAAA,IAC3B,KAAK,WAAW,QAAQ;AAAA;AAAA,IACxB,KAAK,WAAW,cAAc;AAAA;AAAA,EAChC;AAEA,MAAI,SAAS,cAAc,CAAC;AAC5B,aAAW,KAAK,eAAe;AAC7B,QAAI,WAAW,KAAK,GAAG,YAAY,CAAC,GAAG;AACrC,eAAS;AACT;AAAA,IACF;AAAA,EACF;AAGA,MAAI,IAAI,QAAQ,OAAO,MAAM,CA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AM,UAAU,QAAQ,WAAW,KAAK,EAAE;AAE1C,UAAI,KAAK,EAAE,MAAM,WAAW,QAAQ,CAAC;AAAA,IACvC,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,OAAO,KAAK,EAAE,CAAC;AAAA,IAC/C;AAAA,EACF,CAAC;AAED,MAAI,IAAI,sBAAsB,CAAC,KAAK,QAAQ;AAC1C,QAAI;AACF,YAAM,WAAW,mBAAmB,IAAI,OAAO,IAAI;AACnD,YAAM,QAAQ,QAAQ,eAAe,QAAQ;AAC7C,YAAM,OAAO,QAAQ,oBAAoB,QAAQ;AACjD,UAAI,KAAK,EAAE,OAAO,cAAc,KAAK,CAAC;AAAA,IACxC,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,OAAO,KAAK,EAAE,CAAC;AAAA,IAC/C;AAAA,EACF,CAAC;AAED,MAAI,OAAO,MAAM,MAAM;AACrB,YAAQ,IAAI;AAAA,2CAA8C;AAC1D,YAAQ,IAAI,sBAAsB,IAAI;AAAA,CAAI;AAAA,EAC5C,CAAC;AAGD,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,MAAM;AACd,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/web/server.ts"],"sourcesContent":["/**\n * Web server for visualization\n */\n\nimport express from \"express\";\nimport { join, resolve } from \"path\";\nimport { GraphStorage } from \"../graph/storage.js\";\nimport { fileURLToPath } from \"url\";\nimport { dirname } from \"path\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport function startServer(dbPath: string, port: number = 3333): void {\n const app = express();\n const storage = new GraphStorage(dbPath);\n\n // Serve static files\n app.use(express.static(join(__dirname, \"../../web\")));\n\n // API endpoints\n app.get(\"/api/graph\", (req, res) => {\n try {\n const graph = storage.exportForVisualization();\n res.json(graph);\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/stats\", (req, res) => {\n try {\n const stats = storage.getStats();\n const rootPath = storage.getMeta(\"rootPath\");\n const analyzedAt = storage.getMeta(\"analyzedAt\");\n res.json({ ...stats, rootPath, analyzedAt });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/search\", (req, res) => {\n try {\n const query = req.query.q as string;\n if (!query) {\n res.json([]);\n return;\n }\n const nodes = storage.searchNodes(query);\n res.json(nodes.slice(0, 50));\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/node/:id\", (req, res) => {\n try {\n const node = storage.getNode(decodeURIComponent(req.params.id));\n if (!node) {\n res.status(404).json({ error: \"Node not found\" });\n return;\n }\n\n const edgesFrom = storage.getEdgesFrom(node.id);\n const edgesTo = storage.getEdgesTo(node.id);\n\n res.json({ node, edgesFrom, edgesTo });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.get(\"/api/file/:path(*)\", (req, res) => {\n try {\n const filePath = decodeURIComponent(req.params.path);\n const nodes = storage.getNodesByFile(filePath);\n const deps = storage.getFileDependencies(filePath);\n res.json({ nodes, dependencies: deps });\n } catch (error) {\n res.status(500).json({ error: String(error) });\n }\n });\n\n app.listen(port, () => {\n console.log(`\\n CodeMap visualization server running at:`);\n console.log(` http://localhost:${port}\\n`);\n });\n\n // Cleanup on exit\n process.on(\"SIGINT\", () => {\n storage.close();\n process.exit(0);\n });\n}\n"],"mappings":";;;;;;;AAIA,OAAO,aAAa;AACpB,SAAS,YAAqB;AAE9B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAExB,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AAE7B,SAAS,YAAY,QAAgB,OAAe,MAAY;AACrE,QAAM,MAAM,QAAQ;AACpB,QAAM,UAAU,IAAI,aAAa,MAAM;AAGvC,MAA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