@diegonogueiradev_/mcp-graph 1.0.0 → 2.0.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/LICENSE +21 -0
- package/README.md +240 -0
- package/dist/api/middleware/error-handler.d.ts +3 -0
- package/dist/api/middleware/error-handler.d.ts.map +1 -0
- package/dist/api/middleware/error-handler.js +35 -0
- package/dist/api/middleware/error-handler.js.map +1 -0
- package/dist/api/middleware/validate.d.ts +5 -0
- package/dist/api/middleware/validate.d.ts.map +1 -0
- package/dist/api/middleware/validate.js +23 -0
- package/dist/api/middleware/validate.js.map +1 -0
- package/dist/api/router.d.ts +11 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +41 -0
- package/dist/api/router.js.map +1 -0
- package/dist/api/routes/capture.d.ts +3 -0
- package/dist/api/routes/capture.d.ts.map +1 -0
- package/dist/api/routes/capture.js +31 -0
- package/dist/api/routes/capture.js.map +1 -0
- package/dist/api/routes/context.d.ts +4 -0
- package/dist/api/routes/context.d.ts.map +1 -0
- package/dist/api/routes/context.js +25 -0
- package/dist/api/routes/context.js.map +1 -0
- package/dist/api/routes/docs-cache.d.ts +4 -0
- package/dist/api/routes/docs-cache.d.ts.map +1 -0
- package/dist/api/routes/docs-cache.js +79 -0
- package/dist/api/routes/docs-cache.js.map +1 -0
- package/dist/api/routes/edges.d.ts +4 -0
- package/dist/api/routes/edges.d.ts.map +1 -0
- package/dist/api/routes/edges.js +50 -0
- package/dist/api/routes/edges.js.map +1 -0
- package/dist/api/routes/events.d.ts +4 -0
- package/dist/api/routes/events.d.ts.map +1 -0
- package/dist/api/routes/events.js +37 -0
- package/dist/api/routes/events.js.map +1 -0
- package/dist/api/routes/graph.d.ts +4 -0
- package/dist/api/routes/graph.d.ts.map +1 -0
- package/dist/api/routes/graph.js +39 -0
- package/dist/api/routes/graph.js.map +1 -0
- package/dist/api/routes/import.d.ts +4 -0
- package/dist/api/routes/import.d.ts.map +1 -0
- package/dist/api/routes/import.js +92 -0
- package/dist/api/routes/import.js.map +1 -0
- package/dist/api/routes/insights.d.ts +4 -0
- package/dist/api/routes/insights.d.ts.map +1 -0
- package/dist/api/routes/insights.js +40 -0
- package/dist/api/routes/insights.js.map +1 -0
- package/dist/api/routes/integrations.d.ts +4 -0
- package/dist/api/routes/integrations.d.ts.map +1 -0
- package/dist/api/routes/integrations.js +56 -0
- package/dist/api/routes/integrations.js.map +1 -0
- package/dist/api/routes/nodes.d.ts +4 -0
- package/dist/api/routes/nodes.d.ts.map +1 -0
- package/dist/api/routes/nodes.js +123 -0
- package/dist/api/routes/nodes.js.map +1 -0
- package/dist/api/routes/project.d.ts +4 -0
- package/dist/api/routes/project.d.ts.map +1 -0
- package/dist/api/routes/project.js +33 -0
- package/dist/api/routes/project.js.map +1 -0
- package/dist/api/routes/search.d.ts +4 -0
- package/dist/api/routes/search.d.ts.map +1 -0
- package/dist/api/routes/search.js +25 -0
- package/dist/api/routes/search.js.map +1 -0
- package/dist/api/routes/skills.d.ts +3 -0
- package/dist/api/routes/skills.d.ts.map +1 -0
- package/dist/api/routes/skills.js +16 -0
- package/dist/api/routes/skills.js.map +1 -0
- package/dist/api/routes/stats.d.ts +4 -0
- package/dist/api/routes/stats.d.ts.map +1 -0
- package/dist/api/routes/stats.js +14 -0
- package/dist/api/routes/stats.js.map +1 -0
- package/dist/cli/commands/import-cmd.d.ts +3 -0
- package/dist/cli/commands/import-cmd.d.ts.map +1 -0
- package/dist/cli/commands/import-cmd.js +38 -0
- package/dist/cli/commands/import-cmd.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +55 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +3 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +18 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +3 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +39 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +17 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/capture/content-extractor.d.ts +21 -0
- package/dist/core/capture/content-extractor.d.ts.map +1 -0
- package/dist/core/capture/content-extractor.js +74 -0
- package/dist/core/capture/content-extractor.js.map +1 -0
- package/dist/core/capture/web-capture.d.ts +20 -0
- package/dist/core/capture/web-capture.d.ts.map +1 -0
- package/dist/core/capture/web-capture.js +51 -0
- package/dist/core/capture/web-capture.js.map +1 -0
- package/dist/core/config/config-loader.d.ts +3 -0
- package/dist/core/config/config-loader.d.ts.map +1 -0
- package/dist/core/config/config-loader.js +43 -0
- package/dist/core/config/config-loader.js.map +1 -0
- package/dist/core/config/config-schema.d.ts +11 -0
- package/dist/core/config/config-schema.d.ts.map +1 -0
- package/dist/core/config/config-schema.js +12 -0
- package/dist/core/config/config-schema.js.map +1 -0
- package/dist/core/docs/docs-cache-store.d.ts +24 -0
- package/dist/core/docs/docs-cache-store.d.ts.map +1 -0
- package/dist/core/docs/docs-cache-store.js +61 -0
- package/dist/core/docs/docs-cache-store.js.map +1 -0
- package/dist/core/docs/docs-syncer.d.ts +13 -0
- package/dist/core/docs/docs-syncer.d.ts.map +1 -0
- package/dist/core/docs/docs-syncer.js +38 -0
- package/dist/core/docs/docs-syncer.js.map +1 -0
- package/dist/core/events/event-bus.d.ts +26 -0
- package/dist/core/events/event-bus.d.ts.map +1 -0
- package/dist/core/events/event-bus.js +47 -0
- package/dist/core/events/event-bus.js.map +1 -0
- package/dist/core/events/event-types.d.ts +57 -0
- package/dist/core/events/event-types.d.ts.map +1 -0
- package/dist/core/events/event-types.js +2 -0
- package/dist/core/events/event-types.js.map +1 -0
- package/dist/core/graph/mermaid-export.d.ts +9 -0
- package/dist/core/graph/mermaid-export.d.ts.map +1 -0
- package/dist/core/graph/mermaid-export.js +80 -0
- package/dist/core/graph/mermaid-export.js.map +1 -0
- package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
- package/dist/core/importer/prd-to-graph.js +7 -0
- package/dist/core/importer/prd-to-graph.js.map +1 -1
- package/dist/core/insights/bottleneck-detector.d.ts +31 -0
- package/dist/core/insights/bottleneck-detector.d.ts.map +1 -0
- package/dist/core/insights/bottleneck-detector.js +69 -0
- package/dist/core/insights/bottleneck-detector.js.map +1 -0
- package/dist/core/insights/metrics-calculator.d.ts +31 -0
- package/dist/core/insights/metrics-calculator.d.ts.map +1 -0
- package/dist/core/insights/metrics-calculator.js +78 -0
- package/dist/core/insights/metrics-calculator.js.map +1 -0
- package/dist/core/insights/skill-recommender.d.ts +21 -0
- package/dist/core/insights/skill-recommender.d.ts.map +1 -0
- package/dist/core/insights/skill-recommender.js +129 -0
- package/dist/core/insights/skill-recommender.js.map +1 -0
- package/dist/core/integrations/serena-reader.d.ts +18 -0
- package/dist/core/integrations/serena-reader.d.ts.map +1 -0
- package/dist/core/integrations/serena-reader.js +50 -0
- package/dist/core/integrations/serena-reader.js.map +1 -0
- package/dist/core/integrations/tool-status.d.ts +18 -0
- package/dist/core/integrations/tool-status.d.ts.map +1 -0
- package/dist/core/integrations/tool-status.js +92 -0
- package/dist/core/integrations/tool-status.js.map +1 -0
- package/dist/core/parser/file-reader.d.ts +13 -0
- package/dist/core/parser/file-reader.d.ts.map +1 -0
- package/dist/core/parser/file-reader.js +52 -0
- package/dist/core/parser/file-reader.js.map +1 -0
- package/dist/core/parser/read-html.d.ts +7 -0
- package/dist/core/parser/read-html.d.ts.map +1 -0
- package/dist/core/parser/read-html.js +51 -0
- package/dist/core/parser/read-html.js.map +1 -0
- package/dist/core/parser/read-pdf.d.ts +10 -0
- package/dist/core/parser/read-pdf.d.ts.map +1 -0
- package/dist/core/parser/read-pdf.js +16 -0
- package/dist/core/parser/read-pdf.js.map +1 -0
- package/dist/core/planner/next-task.d.ts.map +1 -1
- package/dist/core/planner/next-task.js +4 -1
- package/dist/core/planner/next-task.js.map +1 -1
- package/dist/core/search/fts-search.d.ts.map +1 -1
- package/dist/core/search/fts-search.js +6 -1
- package/dist/core/search/fts-search.js.map +1 -1
- package/dist/core/store/migrations.d.ts.map +1 -1
- package/dist/core/store/migrations.js +38 -0
- package/dist/core/store/migrations.js.map +1 -1
- package/dist/core/store/sqlite-store.d.ts +7 -0
- package/dist/core/store/sqlite-store.d.ts.map +1 -1
- package/dist/core/store/sqlite-store.js +28 -3
- package/dist/core/store/sqlite-store.js.map +1 -1
- package/dist/core/utils/logger.d.ts +1 -0
- package/dist/core/utils/logger.d.ts.map +1 -1
- package/dist/core/utils/logger.js +5 -0
- package/dist/core/utils/logger.js.map +1 -1
- package/dist/mcp/init-project.d.ts.map +1 -1
- package/dist/mcp/init-project.js +12 -16
- package/dist/mcp/init-project.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +17 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stdio.js +0 -0
- package/dist/mcp/tools/export-mermaid.d.ts +4 -0
- package/dist/mcp/tools/export-mermaid.d.ts.map +1 -0
- package/dist/mcp/tools/export-mermaid.js +27 -0
- package/dist/mcp/tools/export-mermaid.js.map +1 -0
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +2 -0
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/web/dashboard/dist/assets/code-graph-tab-jvBo8Q9t.js +1 -0
- package/dist/web/dashboard/dist/assets/constants-CLJl-f3f.js +1 -0
- package/dist/web/dashboard/dist/assets/graph-tab-BoKfDlvO.js +1 -0
- package/dist/web/dashboard/dist/assets/graph-utils-BZV40eAE.css +1 -0
- package/dist/web/dashboard/dist/assets/graph-utils-uGOH4eMw.js +23 -0
- package/dist/web/dashboard/dist/assets/index-DM_LGeRr.css +1 -0
- package/dist/web/dashboard/dist/assets/index-DrHbgcp5.js +53 -0
- package/dist/web/dashboard/dist/assets/insights-tab-D7sHV2xV.js +1 -0
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-C_Uq1Qte.js +1 -0
- package/dist/web/dashboard/dist/index.html +13 -0
- package/dist/web/public/css/styles.css +646 -0
- package/dist/web/public/index.html +209 -0
- package/dist/web/public/js/api-client.js +85 -0
- package/dist/web/public/js/app.js +112 -0
- package/dist/web/public/js/capture-form.js +196 -0
- package/dist/web/public/js/filters.js +94 -0
- package/dist/web/public/js/force-graph-renderer.js +498 -0
- package/dist/web/public/js/graph-renderer.js +62 -0
- package/dist/web/public/js/import-form.js +105 -0
- package/dist/web/public/js/node-detail.js +106 -0
- package/dist/web/public/js/tabs/code-graph-tab.js +66 -0
- package/dist/web/public/js/tabs/graph-tab.js +238 -0
- package/dist/web/public/js/tabs/insights-tab.js +236 -0
- package/dist/web/public/js/tabs/knowledge-tab.js +201 -0
- package/dist/web/public/js/tabs/prd-backlog-tab.js +167 -0
- package/dist/web/public/vendor/force-graph.min.js +5 -0
- package/dist/web/public/vendor/mermaid.min.js +2843 -0
- package/package.json +22 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../../src/api/routes/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAa3D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Router } from "express";
|
|
2
|
+
import { scanSkills } from "../../core/insights/skill-recommender.js";
|
|
3
|
+
export function createSkillsRouter(basePath) {
|
|
4
|
+
const router = Router();
|
|
5
|
+
router.get("/", async (_req, res, next) => {
|
|
6
|
+
try {
|
|
7
|
+
const skills = await scanSkills(basePath);
|
|
8
|
+
res.json(skills);
|
|
9
|
+
}
|
|
10
|
+
catch (err) {
|
|
11
|
+
next(err);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return router;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../../src/api/routes/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC1C,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/api/routes/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAY5D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Router } from "express";
|
|
2
|
+
export function createStatsRouter(store) {
|
|
3
|
+
const router = Router();
|
|
4
|
+
router.get("/", (_req, res, next) => {
|
|
5
|
+
try {
|
|
6
|
+
res.json(store.getStats());
|
|
7
|
+
}
|
|
8
|
+
catch (err) {
|
|
9
|
+
next(err);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return router;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/api/routes/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,MAAM,UAAU,iBAAiB,CAAC,KAAkB;IAClD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-cmd.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/import-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,aAAa,IAAI,OAAO,CA+BvC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { SqliteStore } from "../../core/store/sqlite-store.js";
|
|
4
|
+
import { readFileContent } from "../../core/parser/file-reader.js";
|
|
5
|
+
import { extractEntities } from "../../core/parser/extract.js";
|
|
6
|
+
import { convertToGraph } from "../../core/importer/prd-to-graph.js";
|
|
7
|
+
import { logger } from "../../core/utils/logger.js";
|
|
8
|
+
export function importCommand() {
|
|
9
|
+
return new Command("import")
|
|
10
|
+
.description("Import a PRD file into the graph")
|
|
11
|
+
.argument("<file>", "Path to PRD file (.md, .txt, .pdf, .html)")
|
|
12
|
+
.option("-d, --dir <dir>", "Project directory", process.cwd())
|
|
13
|
+
.action(async (file, opts) => {
|
|
14
|
+
const filePath = path.resolve(file);
|
|
15
|
+
const store = SqliteStore.open(opts.dir);
|
|
16
|
+
if (!store.getProject()) {
|
|
17
|
+
store.initProject(path.basename(opts.dir));
|
|
18
|
+
logger.info("Project initialized", { name: path.basename(opts.dir) });
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const result = await readFileContent(filePath);
|
|
22
|
+
const entities = extractEntities(result.text);
|
|
23
|
+
const graph = convertToGraph(entities, filePath);
|
|
24
|
+
store.bulkInsert(graph.nodes, graph.edges);
|
|
25
|
+
store.createSnapshot();
|
|
26
|
+
console.log(`Imported: ${graph.nodes.length} nodes, ${graph.edges.length} edges`);
|
|
27
|
+
console.log(`Source: ${filePath}`);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
console.error(`Import failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
store.close();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=import-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-cmd.js","sourceRoot":"","sources":["../../../src/cli/commands/import-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,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CAAC,GAAG,CAAC,WAAW,QAAQ,EAAE,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,WAAW,IAAI,OAAO,CAoDrC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { SqliteStore } from "../../core/store/sqlite-store.js";
|
|
5
|
+
import { logger } from "../../core/utils/logger.js";
|
|
6
|
+
export function initCommand() {
|
|
7
|
+
return new Command("init")
|
|
8
|
+
.description("Initialize mcp-graph in the current project")
|
|
9
|
+
.option("-d, --dir <dir>", "Project directory", process.cwd())
|
|
10
|
+
.option("-n, --name <name>", "Project name")
|
|
11
|
+
.action((opts) => {
|
|
12
|
+
const dir = path.resolve(opts.dir);
|
|
13
|
+
const projectName = opts.name ?? path.basename(dir);
|
|
14
|
+
// Initialize store (creates .mcp-graph/graph.db)
|
|
15
|
+
const store = SqliteStore.open(dir);
|
|
16
|
+
store.initProject(projectName);
|
|
17
|
+
console.log(`Graph initialized: ${projectName}`);
|
|
18
|
+
// Generate .mcp.json if it doesn't exist
|
|
19
|
+
const mcpConfigPath = path.join(dir, ".mcp.json");
|
|
20
|
+
if (!existsSync(mcpConfigPath)) {
|
|
21
|
+
const mcpConfig = {
|
|
22
|
+
mcpServers: {
|
|
23
|
+
"mcp-graph": {
|
|
24
|
+
command: "npx",
|
|
25
|
+
args: ["@diegonogueiradev_/mcp-graph"],
|
|
26
|
+
cwd: dir,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2) + "\n");
|
|
31
|
+
console.log("Created .mcp.json");
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(".mcp.json already exists");
|
|
35
|
+
}
|
|
36
|
+
// Detect Serena
|
|
37
|
+
const serenaDir = path.join(dir, ".serena");
|
|
38
|
+
if (existsSync(serenaDir)) {
|
|
39
|
+
logger.info("Serena detected", { path: serenaDir });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
logger.debug("Serena not found, code intelligence unavailable");
|
|
43
|
+
}
|
|
44
|
+
// Detect GitNexus
|
|
45
|
+
const hasGitnexus = existsSync(path.join(dir, ".gitnexus"));
|
|
46
|
+
if (hasGitnexus) {
|
|
47
|
+
logger.info("GitNexus detected", { path: path.join(dir, ".gitnexus") });
|
|
48
|
+
}
|
|
49
|
+
console.log(`\nDashboard: mcp-graph serve --port 3000`);
|
|
50
|
+
console.log(`Import PRD: mcp-graph import <file.md>`);
|
|
51
|
+
console.log(`Stats: mcp-graph stats`);
|
|
52
|
+
store.close();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAa,M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CAAC;QACnC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAC1C,CAAC;QAED,gBAAgB;QAChB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAClE,CAAC;QAED,kBAAkB;QAClB,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;QAC5D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAEtC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,YAAY,IAAI,OAAO,CAiBtC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export function serveCommand() {
|
|
3
|
+
return new Command("serve")
|
|
4
|
+
.description("Start the mcp-graph dashboard + API server")
|
|
5
|
+
.option("-p, --port <port>", "Port to listen on", "3000")
|
|
6
|
+
.action(async (opts) => {
|
|
7
|
+
const port = parseInt(opts.port, 10);
|
|
8
|
+
if (isNaN(port) || port < 1 || port > 65535) {
|
|
9
|
+
console.error("Error: Invalid port number");
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
// CLI flag overrides config — set env var so server picks it up
|
|
13
|
+
process.env.MCP_PORT = String(port);
|
|
14
|
+
// Dynamic import — server module starts Express on import
|
|
15
|
+
await import("../../mcp/server.js");
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/cli/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,4CAA4C,CAAC;SACzD,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,CAAC;SACxD,MAAM,CAAC,KAAK,EAAE,IAAsB,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,gEAAgE;QAChE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAEpC,0DAA0D;QAC1D,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,YAAY,IAAI,OAAO,CAkCtC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { SqliteStore } from "../../core/store/sqlite-store.js";
|
|
3
|
+
export function statsCommand() {
|
|
4
|
+
return new Command("stats")
|
|
5
|
+
.description("Show graph statistics")
|
|
6
|
+
.option("-d, --dir <dir>", "Project directory", process.cwd())
|
|
7
|
+
.option("--json", "Output as JSON")
|
|
8
|
+
.action((opts) => {
|
|
9
|
+
const store = SqliteStore.open(opts.dir);
|
|
10
|
+
try {
|
|
11
|
+
const stats = store.getStats();
|
|
12
|
+
const project = store.getProject();
|
|
13
|
+
if (opts.json) {
|
|
14
|
+
console.log(JSON.stringify({ project: project?.name, ...stats }, null, 2));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.log(`Project: ${project?.name ?? "(not initialized)"}`);
|
|
18
|
+
console.log(`Total nodes: ${stats.totalNodes}`);
|
|
19
|
+
console.log(`By type:`);
|
|
20
|
+
for (const [type, count] of Object.entries(stats.byType ?? {})) {
|
|
21
|
+
console.log(` ${type}: ${count}`);
|
|
22
|
+
}
|
|
23
|
+
console.log(`By status:`);
|
|
24
|
+
for (const [status, count] of Object.entries(stats.byStatus ?? {})) {
|
|
25
|
+
console.log(` ${status}: ${count}`);
|
|
26
|
+
}
|
|
27
|
+
console.log(`Total edges: ${stats.totalEdges}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
store.close();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,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;oBAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;gBACrC,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1B,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;oBACnE,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,KAAK,KAAK,EAAE,CAAC,CAAC;gBACvC,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { serveCommand } from "./commands/serve.js";
|
|
4
|
+
import { importCommand } from "./commands/import-cmd.js";
|
|
5
|
+
import { statsCommand } from "./commands/stats.js";
|
|
6
|
+
import { initCommand } from "./commands/init.js";
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program
|
|
9
|
+
.name("mcp-graph")
|
|
10
|
+
.description("Local-first PRD to task graph — transforms text into executable structure")
|
|
11
|
+
.version("1.0.0");
|
|
12
|
+
program.addCommand(serveCommand());
|
|
13
|
+
program.addCommand(importCommand());
|
|
14
|
+
program.addCommand(statsCommand());
|
|
15
|
+
program.addCommand(initCommand());
|
|
16
|
+
program.parse();
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,2EAA2E,CAAC;KACxF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AACpC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAElC,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ExtractionOptions {
|
|
2
|
+
/** CSS selector to extract content from (defaults to full body) */
|
|
3
|
+
selector?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ExtractionResult {
|
|
6
|
+
/** Extracted text in markdown format */
|
|
7
|
+
text: string;
|
|
8
|
+
/** Page title (from h1 or <title>) */
|
|
9
|
+
title: string | null;
|
|
10
|
+
/** Meta description if available */
|
|
11
|
+
description: string | null;
|
|
12
|
+
/** Word count of extracted text */
|
|
13
|
+
wordCount: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extract structured text content from raw HTML.
|
|
17
|
+
* Converts headings to markdown, strips non-content elements,
|
|
18
|
+
* and normalizes whitespace.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractContent(html: string, options?: ExtractionOptions): Promise<ExtractionResult>;
|
|
21
|
+
//# sourceMappingURL=content-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-extractor.d.ts","sourceRoot":"","sources":["../../../src/core/capture/content-extractor.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oCAAoC;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAWD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAqE3B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { logger } from "../utils/logger.js";
|
|
2
|
+
const HEADING_MAP = {
|
|
3
|
+
h1: "#",
|
|
4
|
+
h2: "##",
|
|
5
|
+
h3: "###",
|
|
6
|
+
h4: "####",
|
|
7
|
+
h5: "#####",
|
|
8
|
+
h6: "######",
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Extract structured text content from raw HTML.
|
|
12
|
+
* Converts headings to markdown, strips non-content elements,
|
|
13
|
+
* and normalizes whitespace.
|
|
14
|
+
*/
|
|
15
|
+
export async function extractContent(html, options) {
|
|
16
|
+
if (!html.trim()) {
|
|
17
|
+
return { text: "", title: null, description: null, wordCount: 0 };
|
|
18
|
+
}
|
|
19
|
+
const { load } = await import("cheerio");
|
|
20
|
+
logger.info("Extracting content from HTML", { sizeChars: html.length, selector: options?.selector });
|
|
21
|
+
const $ = load(html);
|
|
22
|
+
// Extract metadata before stripping
|
|
23
|
+
const titleTag = $("title").first().text().trim() || null;
|
|
24
|
+
const h1Text = $("h1").first().text().trim() || null;
|
|
25
|
+
const title = h1Text ?? titleTag;
|
|
26
|
+
const description = $('meta[name="description"]').attr("content") ?? null;
|
|
27
|
+
// Remove non-content elements
|
|
28
|
+
$("script, style, nav, footer, header, noscript, iframe, svg").remove();
|
|
29
|
+
// Scope to selector if provided — extract scoped HTML and reload
|
|
30
|
+
let scopedHtml;
|
|
31
|
+
if (options?.selector) {
|
|
32
|
+
const selected = $(options.selector);
|
|
33
|
+
if (selected.length > 0) {
|
|
34
|
+
scopedHtml = selected.html() ?? "";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
logger.info("Selector matched nothing, falling back to body", { selector: options.selector });
|
|
38
|
+
scopedHtml = $("body").length ? ($("body").html() ?? "") : $.html();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
scopedHtml = $("body").length ? ($("body").html() ?? "") : $.html();
|
|
43
|
+
}
|
|
44
|
+
// Reload scoped content for transformation
|
|
45
|
+
const $scoped = load(scopedHtml);
|
|
46
|
+
// Convert headings to markdown
|
|
47
|
+
for (const [tag, prefix] of Object.entries(HEADING_MAP)) {
|
|
48
|
+
$scoped(tag).each(function () {
|
|
49
|
+
const el = $scoped(this);
|
|
50
|
+
const text = el.text().trim();
|
|
51
|
+
el.replaceWith(`\n\n${prefix} ${text}\n\n`);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Convert list items to markdown bullets
|
|
55
|
+
$scoped("li").each(function () {
|
|
56
|
+
const el = $scoped(this);
|
|
57
|
+
const text = el.text().trim();
|
|
58
|
+
el.replaceWith(`\n- ${text}`);
|
|
59
|
+
});
|
|
60
|
+
// Add line breaks for block elements
|
|
61
|
+
$scoped("p, div, section, article, blockquote, pre, br, tr").each(function () {
|
|
62
|
+
$scoped(this).prepend("\n");
|
|
63
|
+
$scoped(this).append("\n");
|
|
64
|
+
});
|
|
65
|
+
const rawText = $scoped.root().text();
|
|
66
|
+
const text = rawText
|
|
67
|
+
.replace(/[ \t]+/g, " ")
|
|
68
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
69
|
+
.trim();
|
|
70
|
+
const wordCount = text ? text.split(/\s+/).length : 0;
|
|
71
|
+
logger.info("Content extracted", { textLength: text.length, wordCount });
|
|
72
|
+
return { text, title, description, wordCount };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=content-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-extractor.js","sourceRoot":"","sources":["../../../src/core/capture/content-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAkB5C,MAAM,WAAW,GAA2B;IAC1C,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,QAAQ;CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,OAA2B;IAE3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpE,CAAC;IAED,MAAM,EAAE,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I,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;IAEV,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtD,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAEzE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ExtractionResult } from "./content-extractor.js";
|
|
2
|
+
export interface CaptureOptions {
|
|
3
|
+
/** CSS selector to scope extraction */
|
|
4
|
+
selector?: string;
|
|
5
|
+
/** Navigation timeout in ms (default 30000) */
|
|
6
|
+
timeout?: number;
|
|
7
|
+
/** Wait for this selector before extracting */
|
|
8
|
+
waitForSelector?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CaptureResult extends ExtractionResult {
|
|
11
|
+
/** The URL that was captured */
|
|
12
|
+
url: string;
|
|
13
|
+
/** Timestamp of capture */
|
|
14
|
+
capturedAt: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Capture a web page using Playwright headless browser and extract structured content.
|
|
18
|
+
*/
|
|
19
|
+
export declare function captureWebPage(url: string, options?: CaptureOptions): Promise<CaptureResult>;
|
|
20
|
+
//# sourceMappingURL=web-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-capture.d.ts","sourceRoot":"","sources":["../../../src/core/capture/web-capture.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAsDxB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { logger } from "../utils/logger.js";
|
|
2
|
+
import { extractContent } from "./content-extractor.js";
|
|
3
|
+
/**
|
|
4
|
+
* Capture a web page using Playwright headless browser and extract structured content.
|
|
5
|
+
*/
|
|
6
|
+
export async function captureWebPage(url, options) {
|
|
7
|
+
if (!url) {
|
|
8
|
+
throw new Error("URL is required");
|
|
9
|
+
}
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = new URL(url);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
16
|
+
}
|
|
17
|
+
if (!["http:", "https:"].includes(parsed.protocol)) {
|
|
18
|
+
throw new Error(`Only HTTP and HTTPS URLs are supported, got: ${parsed.protocol}`);
|
|
19
|
+
}
|
|
20
|
+
const timeout = options?.timeout ?? 30_000;
|
|
21
|
+
logger.info("Capturing web page", { url, timeout, selector: options?.selector });
|
|
22
|
+
// Dynamic import — Playwright may not be installed
|
|
23
|
+
let chromium;
|
|
24
|
+
try {
|
|
25
|
+
const pw = await import("playwright");
|
|
26
|
+
chromium = pw.chromium;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
throw new Error("Playwright is not installed. Run 'npx playwright install chromium' to enable web capture.");
|
|
30
|
+
}
|
|
31
|
+
const browser = await chromium.launch({ headless: true });
|
|
32
|
+
try {
|
|
33
|
+
const page = await browser.newPage();
|
|
34
|
+
await page.goto(url, { timeout, waitUntil: "domcontentloaded" });
|
|
35
|
+
if (options?.waitForSelector) {
|
|
36
|
+
await page.waitForSelector(options.waitForSelector, { timeout });
|
|
37
|
+
}
|
|
38
|
+
const html = await page.content();
|
|
39
|
+
const extraction = await extractContent(html, { selector: options?.selector });
|
|
40
|
+
logger.info("Web page captured", { url, wordCount: extraction.wordCount });
|
|
41
|
+
return {
|
|
42
|
+
...extraction,
|
|
43
|
+
url,
|
|
44
|
+
capturedAt: new Date().toISOString(),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
await browser.close();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=web-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-capture.js","sourceRoot":"","sources":["../../../src/core/capture/web-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAyB,MAAM,wBAAwB,CAAC;AAkB/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,OAAwB;IAExB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,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,QAAQ,EAAE,CAAC,CAAC;QAE/E,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;QAE3E,OAAO;YACL,GAAG,UAAU;YACb,GAAG;YACH,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKvE,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAuC5D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ConfigSchema } from "./config-schema.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
5
|
+
const CONFIG_FILENAME = "mcp-graph.config.json";
|
|
6
|
+
export function loadConfig(basePath) {
|
|
7
|
+
const resolvedBase = basePath ?? process.cwd();
|
|
8
|
+
const configPath = path.join(resolvedBase, CONFIG_FILENAME);
|
|
9
|
+
let fileConfig = {};
|
|
10
|
+
if (existsSync(configPath)) {
|
|
11
|
+
try {
|
|
12
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
13
|
+
fileConfig = JSON.parse(raw);
|
|
14
|
+
logger.info(`Config loaded from ${configPath}`);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
logger.error(`Failed to parse config at ${configPath}`, {
|
|
18
|
+
error: err instanceof Error ? err.message : String(err),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
logger.info("No config file found, using defaults");
|
|
24
|
+
}
|
|
25
|
+
// Env var overrides
|
|
26
|
+
if (process.env.MCP_PORT) {
|
|
27
|
+
const envPort = parseInt(process.env.MCP_PORT, 10);
|
|
28
|
+
if (!isNaN(envPort)) {
|
|
29
|
+
fileConfig.port = envPort;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (process.env.GITNEXUS_PORT) {
|
|
33
|
+
const envGitnexusPort = parseInt(process.env.GITNEXUS_PORT, 10);
|
|
34
|
+
if (!isNaN(envGitnexusPort)) {
|
|
35
|
+
const integrations = (fileConfig.integrations ?? {});
|
|
36
|
+
integrations.gitnexusPort = envGitnexusPort;
|
|
37
|
+
fileConfig.integrations = integrations;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const config = ConfigSchema.parse(fileConfig);
|
|
41
|
+
return config;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../../src/core/config/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,MAAM,UAAU,UAAU,CAAC,QAAiB;IAC1C,MAAM,YAAY,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAE5D,IAAI,UAAU,GAA4B,EAAE,CAAC;IAE7C,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,IAA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AC,UAAU,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
export declare const ConfigSchema: z.ZodObject<{
|
|
3
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
dbPath: z.ZodDefault<z.ZodString>;
|
|
5
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
6
|
+
integrations: z.ZodDefault<z.ZodObject<{
|
|
7
|
+
gitnexusPort: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type McpGraphConfig = z.infer<typeof ConfigSchema>;
|
|
11
|
+
//# sourceMappingURL=config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../../src/core/config/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,eAAO,MAAM,YAAY;;;;;;;iBASvB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
export const ConfigSchema = z.object({
|
|
3
|
+
port: z.number().int().min(1).max(65535).default(3000),
|
|
4
|
+
dbPath: z.string().default(".mcp-graph"),
|
|
5
|
+
basePath: z.string().optional(),
|
|
6
|
+
integrations: z
|
|
7
|
+
.object({
|
|
8
|
+
gitnexusPort: z.number().int().min(1).max(65535).default(3737),
|
|
9
|
+
})
|
|
10
|
+
.default({ gitnexusPort: 3737 }),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../../src/core/config/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;IACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,YAAY,EAAE,CAAC;SACZ,MAAM,CAAC;QACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;KAC/D,CAAC;SACD,OAAO,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
export interface CachedDoc {
|
|
3
|
+
id: number;
|
|
4
|
+
libId: string;
|
|
5
|
+
libName: string;
|
|
6
|
+
version: string | null;
|
|
7
|
+
content: string;
|
|
8
|
+
fetchedAt: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class DocsCacheStore {
|
|
11
|
+
private db;
|
|
12
|
+
constructor(db: Database.Database);
|
|
13
|
+
upsertDoc(doc: {
|
|
14
|
+
libId: string;
|
|
15
|
+
libName: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}): CachedDoc;
|
|
19
|
+
getDoc(libId: string): CachedDoc | null;
|
|
20
|
+
searchDocs(query: string, limit?: number): CachedDoc[];
|
|
21
|
+
listCached(): CachedDoc[];
|
|
22
|
+
getStaleLibs(maxAgeMs: number): CachedDoc[];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=docs-cache-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-cache-store.d.ts","sourceRoot":"","sources":["../../../src/core/docs/docs-cache-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAsBD,qBAAa,cAAc;IACzB,OAAO,CAAC,EAAE,CAAoB;gBAElB,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAIjC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,SAAS;IAmBb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAOvC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,SAAS,EAAE;IAa1D,UAAU,IAAI,SAAS,EAAE;IAOzB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE;CAO5C"}
|