kirograph 0.14.1 → 0.16.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/LICENSE +21 -0
- package/README.md +239 -20
- package/dist/assets/logo.png +0 -0
- package/dist/bin/commands/docs.js +357 -0
- package/dist/bin/commands/docs.js.map +7 -0
- package/dist/bin/commands/help.js +3 -0
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/uninit.js +10 -13
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +53 -23
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/hooks.js +20 -1
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.js +14 -4
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/prompts.js +37 -6
- package/dist/bin/installer/prompts.js.map +2 -2
- package/dist/bin/installer/steering.js +40 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.js +72 -0
- package/dist/bin/installer/targets/aider.js.map +7 -0
- package/dist/bin/installer/targets/amp.js +91 -0
- package/dist/bin/installer/targets/amp.js.map +7 -0
- package/dist/bin/installer/targets/antigravity.js +109 -0
- package/dist/bin/installer/targets/antigravity.js.map +7 -0
- package/dist/bin/installer/targets/augment.js +81 -0
- package/dist/bin/installer/targets/augment.js.map +7 -0
- package/dist/bin/installer/targets/claude.js +1 -1
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.js +91 -0
- package/dist/bin/installer/targets/cline.js.map +7 -0
- package/dist/bin/installer/targets/codex.js +1 -1
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.js +107 -0
- package/dist/bin/installer/targets/continue.js.map +7 -0
- package/dist/bin/installer/targets/copilot.js +123 -0
- package/dist/bin/installer/targets/copilot.js.map +7 -0
- package/dist/bin/installer/targets/cursor.js +143 -0
- package/dist/bin/installer/targets/cursor.js.map +7 -0
- package/dist/bin/installer/targets/devin.js +148 -0
- package/dist/bin/installer/targets/devin.js.map +7 -0
- package/dist/bin/installer/targets/gemini-cli.js +126 -0
- package/dist/bin/installer/targets/gemini-cli.js.map +7 -0
- package/dist/bin/installer/targets/generic.js +120 -0
- package/dist/bin/installer/targets/generic.js.map +7 -0
- package/dist/bin/installer/targets/goose.js +72 -0
- package/dist/bin/installer/targets/goose.js.map +7 -0
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/junie.js +105 -0
- package/dist/bin/installer/targets/junie.js.map +7 -0
- package/dist/bin/installer/targets/kilo.js +122 -0
- package/dist/bin/installer/targets/kilo.js.map +7 -0
- package/dist/bin/installer/targets/kiro.js +3 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.js +135 -0
- package/dist/bin/installer/targets/opencode.js.map +7 -0
- package/dist/bin/installer/targets/openhands.js +90 -0
- package/dist/bin/installer/targets/openhands.js.map +7 -0
- package/dist/bin/installer/targets/replit.js +72 -0
- package/dist/bin/installer/targets/replit.js.map +7 -0
- package/dist/bin/installer/targets/roo.js +96 -0
- package/dist/bin/installer/targets/roo.js.map +7 -0
- package/dist/bin/installer/targets/tabnine.js +82 -0
- package/dist/bin/installer/targets/tabnine.js.map +7 -0
- package/dist/bin/installer/targets/trae.js +84 -0
- package/dist/bin/installer/targets/trae.js.map +7 -0
- package/dist/bin/installer/targets/warp.js +97 -0
- package/dist/bin/installer/targets/warp.js.map +7 -0
- package/dist/bin/installer/targets/windsurf.js +141 -0
- package/dist/bin/installer/targets/windsurf.js.map +7 -0
- package/dist/bin/kirograph.js +5 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/compression/naive-cost.js +33 -0
- package/dist/compression/naive-cost.js.map +2 -2
- package/dist/compression/tracker.js +27 -4
- package/dist/compression/tracker.js.map +2 -2
- package/dist/compression/types.js.map +1 -1
- package/dist/config.js +66 -1
- package/dist/config.js.map +2 -2
- package/dist/core/pipeline.js +23 -0
- package/dist/core/pipeline.js.map +2 -2
- package/dist/db/database.js +28 -0
- package/dist/db/database.js.map +2 -2
- package/dist/db/docs-schema.sql +50 -0
- package/dist/docs/formats/asciidoc.js +108 -0
- package/dist/docs/formats/asciidoc.js.map +7 -0
- package/dist/docs/formats/html.js +100 -0
- package/dist/docs/formats/html.js.map +7 -0
- package/dist/docs/formats/index.js +81 -0
- package/dist/docs/formats/index.js.map +7 -0
- package/dist/docs/formats/markdown.js +146 -0
- package/dist/docs/formats/markdown.js.map +7 -0
- package/dist/docs/formats/openapi.js +228 -0
- package/dist/docs/formats/openapi.js.map +7 -0
- package/dist/docs/formats/org.js +117 -0
- package/dist/docs/formats/org.js.map +7 -0
- package/dist/docs/formats/plaintext.js +119 -0
- package/dist/docs/formats/plaintext.js.map +7 -0
- package/dist/docs/formats/rdoc.js +105 -0
- package/dist/docs/formats/rdoc.js.map +7 -0
- package/dist/docs/formats/rst.js +121 -0
- package/dist/docs/formats/rst.js.map +7 -0
- package/dist/docs/indexer.js +340 -0
- package/dist/docs/indexer.js.map +7 -0
- package/dist/docs/linker.js +151 -0
- package/dist/docs/linker.js.map +7 -0
- package/dist/docs/lint.js +92 -0
- package/dist/docs/lint.js.map +7 -0
- package/dist/docs/queries.js +295 -0
- package/dist/docs/queries.js.map +7 -0
- package/dist/docs/section-id.js +57 -0
- package/dist/docs/section-id.js.map +7 -0
- package/dist/docs/summarizer.js +55 -0
- package/dist/docs/summarizer.js.map +7 -0
- package/dist/docs/types.js +17 -0
- package/dist/docs/types.js.map +7 -0
- package/dist/docs/vectors.js +217 -0
- package/dist/docs/vectors.js.map +7 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/mcp/tool-names.js +10 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +476 -3
- package/dist/mcp/tools.js.map +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var section_id_exports = {};
|
|
20
|
+
__export(section_id_exports, {
|
|
21
|
+
buildAncestorChain: () => buildAncestorChain,
|
|
22
|
+
generateSectionId: () => generateSectionId,
|
|
23
|
+
parseSectionId: () => parseSectionId,
|
|
24
|
+
slugify: () => slugify
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(section_id_exports);
|
|
27
|
+
function slugify(title) {
|
|
28
|
+
return title.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "") || "untitled";
|
|
29
|
+
}
|
|
30
|
+
function buildAncestorChain(parentSlugs, currentSlug) {
|
|
31
|
+
return [...parentSlugs, currentSlug].join("/");
|
|
32
|
+
}
|
|
33
|
+
function generateSectionId(filePath, ancestorSlugs, title, level) {
|
|
34
|
+
const slug = slugify(title);
|
|
35
|
+
const chain = buildAncestorChain(ancestorSlugs, slug);
|
|
36
|
+
return `${filePath}::${chain}#${level}`;
|
|
37
|
+
}
|
|
38
|
+
function parseSectionId(id) {
|
|
39
|
+
const doubleColonIdx = id.indexOf("::");
|
|
40
|
+
if (doubleColonIdx === -1) return null;
|
|
41
|
+
const filePath = id.slice(0, doubleColonIdx);
|
|
42
|
+
const rest = id.slice(doubleColonIdx + 2);
|
|
43
|
+
const hashIdx = rest.lastIndexOf("#");
|
|
44
|
+
if (hashIdx === -1) return null;
|
|
45
|
+
const ancestorChain = rest.slice(0, hashIdx);
|
|
46
|
+
const level = parseInt(rest.slice(hashIdx + 1), 10);
|
|
47
|
+
if (isNaN(level) || level < 0) return null;
|
|
48
|
+
return { filePath, ancestorChain, level };
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
buildAncestorChain,
|
|
53
|
+
generateSectionId,
|
|
54
|
+
parseSectionId,
|
|
55
|
+
slugify
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=section-id.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/docs/section-id.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Stable Section ID Generation\n *\n * Format: {file_path}::{ancestor-chain/slug}#{level}\n *\n * IDs remain stable across re-indexing when:\n * - file path doesn't change\n * - heading text doesn't change\n * - heading level doesn't change\n * - parent heading chain doesn't change\n */\n\n/**\n * Convert a heading title to a URL-safe slug.\n * Matches common Markdown anchor generation (GitHub-style).\n */\nexport function slugify(title: string): string {\n return title\n .toLowerCase()\n .trim()\n // Remove special characters except spaces and hyphens\n .replace(/[^\\w\\s-]/g, '')\n // Replace whitespace with hyphens\n .replace(/\\s+/g, '-')\n // Collapse multiple hyphens\n .replace(/-+/g, '-')\n // Trim leading/trailing hyphens\n .replace(/^-+|-+$/g, '')\n // Fallback for empty result\n || 'untitled';\n}\n\n/**\n * Build the ancestor chain string from parent slugs.\n * Example: ['installation', 'prerequisites'] \u2192 'installation/prerequisites'\n */\nexport function buildAncestorChain(parentSlugs: string[], currentSlug: string): string {\n return [...parentSlugs, currentSlug].join('/');\n}\n\n/**\n * Generate a stable section ID.\n *\n * @param filePath - Relative path to the doc file\n * @param ancestorSlugs - Slugified titles of all ancestor headings (root \u2192 parent)\n * @param title - The heading title of this section\n * @param level - The heading level (1\u20136)\n * @returns Stable section ID string\n *\n * @example\n * generateSectionId('docs/install.md', [], 'Installation', 1)\n * // \u2192 'docs/install.md::installation#1'\n *\n * generateSectionId('docs/install.md', ['installation'], 'Prerequisites', 2)\n * // \u2192 'docs/install.md::installation/prerequisites#2'\n */\nexport function generateSectionId(\n filePath: string,\n ancestorSlugs: string[],\n title: string,\n level: number,\n): string {\n const slug = slugify(title);\n const chain = buildAncestorChain(ancestorSlugs, slug);\n return `${filePath}::${chain}#${level}`;\n}\n\n/**\n * Parse a section ID back into its components.\n * Returns null if the ID is malformed.\n */\nexport function parseSectionId(id: string): {\n filePath: string;\n ancestorChain: string;\n level: number;\n} | null {\n const doubleColonIdx = id.indexOf('::');\n if (doubleColonIdx === -1) return null;\n\n const filePath = id.slice(0, doubleColonIdx);\n const rest = id.slice(doubleColonIdx + 2);\n\n const hashIdx = rest.lastIndexOf('#');\n if (hashIdx === -1) return null;\n\n const ancestorChain = rest.slice(0, hashIdx);\n const level = parseInt(rest.slice(hashIdx + 1), 10);\n\n if (isNaN(level) || level < 0) return null;\n\n return { filePath, ancestorChain, level };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,QAAQ,OAAuB;AAC7C,SAAO,MACJ,YAAY,EACZ,KAAK,EAEL,QAAQ,aAAa,EAAE,EAEvB,QAAQ,QAAQ,GAAG,EAEnB,QAAQ,OAAO,GAAG,EAElB,QAAQ,YAAY,EAAE,KAEpB;AACP;AAMO,SAAS,mBAAmB,aAAuB,aAA6B;AACrF,SAAO,CAAC,GAAG,aAAa,WAAW,EAAE,KAAK,GAAG;AAC/C;AAkBO,SAAS,kBACd,UACA,eACA,OACA,OACQ;AACR,QAAM,OAAO,QAAQ,KAAK;AAC1B,QAAM,QAAQ,mBAAmB,eAAe,IAAI;AACpD,SAAO,GAAG,QAAQ,KAAK,KAAK,IAAI,KAAK;AACvC;AAMO,SAAS,eAAe,IAItB;AACP,QAAM,iBAAiB,GAAG,QAAQ,IAAI;AACtC,MAAI,mBAAmB,GAAI,QAAO;AAElC,QAAM,WAAW,GAAG,MAAM,GAAG,cAAc;AAC3C,QAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAExC,QAAM,UAAU,KAAK,YAAY,GAAG;AACpC,MAAI,YAAY,GAAI,QAAO;AAE3B,QAAM,gBAAgB,KAAK,MAAM,GAAG,OAAO;AAC3C,QAAM,QAAQ,SAAS,KAAK,MAAM,UAAU,CAAC,GAAG,EAAE;AAElD,MAAI,MAAM,KAAK,KAAK,QAAQ,EAAG,QAAO;AAEtC,SAAO,EAAE,UAAU,eAAe,MAAM;AAC1C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var summarizer_exports = {};
|
|
20
|
+
__export(summarizer_exports, {
|
|
21
|
+
summarizeSection: () => summarizeSection
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(summarizer_exports);
|
|
24
|
+
function summarizeSection(content, title, strategy) {
|
|
25
|
+
if (strategy === "off") return null;
|
|
26
|
+
return extractFirstSentence(content, title);
|
|
27
|
+
}
|
|
28
|
+
function extractFirstSentence(content, title) {
|
|
29
|
+
const lines = content.split("\n");
|
|
30
|
+
const bodyLines = lines.filter((l) => {
|
|
31
|
+
const trimmed = l.trim();
|
|
32
|
+
if (trimmed === "") return false;
|
|
33
|
+
if (trimmed.startsWith("#") || trimmed.startsWith("=") || trimmed.startsWith("*")) {
|
|
34
|
+
if (/^[#=*]+\s/.test(trimmed)) return false;
|
|
35
|
+
}
|
|
36
|
+
if (trimmed.startsWith("```") || trimmed.startsWith("~~~")) return false;
|
|
37
|
+
if (/^[=-]+\s*$/.test(trimmed)) return false;
|
|
38
|
+
if (/^<\/?(?:h[1-6]|div|section|article|nav|header|footer)[^>]*>$/i.test(trimmed)) return false;
|
|
39
|
+
if (trimmed.toLowerCase() === title.toLowerCase()) return false;
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
if (bodyLines.length === 0) return null;
|
|
43
|
+
const firstLine = bodyLines[0].trim();
|
|
44
|
+
const cleaned = firstLine.replace(/^[-*•]\s+/, "").replace(/^\d+\.\s+/, "");
|
|
45
|
+
const sentenceEnd = cleaned.search(/[.!?]\s|[.!?]$/);
|
|
46
|
+
if (sentenceEnd > 0 && sentenceEnd < 200) {
|
|
47
|
+
return cleaned.slice(0, sentenceEnd + 1).trim();
|
|
48
|
+
}
|
|
49
|
+
return cleaned.length > 200 ? cleaned.slice(0, 200) + "\u2026" : cleaned;
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
summarizeSection
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=summarizer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/docs/summarizer.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Documentation Section Summarizer\n *\n * Strategies:\n * - 'first-sentence': Extract the first meaningful sentence from section content\n * - 'embedding': Use the embedding model to score sentences by relevance to heading (future)\n * - 'off': No summary, return null\n */\n\n/**\n * Extract a summary from section content based on the configured strategy.\n */\nexport function summarizeSection(\n content: string,\n title: string,\n strategy: 'embedding' | 'first-sentence' | 'off',\n): string | null {\n if (strategy === 'off') return null;\n\n // For now, both 'embedding' and 'first-sentence' use first-sentence extraction.\n // The 'embedding' strategy will be enhanced when vector scoring is integrated.\n return extractFirstSentence(content, title);\n}\n\n/**\n * Extract the first meaningful sentence from section content.\n * Skips the heading line itself, code blocks, and empty lines.\n */\nfunction extractFirstSentence(content: string, title: string): string | null {\n const lines = content.split('\\n');\n const bodyLines = lines.filter(l => {\n const trimmed = l.trim();\n if (trimmed === '') return false;\n // Skip heading markers\n if (trimmed.startsWith('#') || trimmed.startsWith('=') || trimmed.startsWith('*')) {\n // But only if it looks like a heading (starts with marker + space)\n if (/^[#=*]+\\s/.test(trimmed)) return false;\n }\n // Skip code fence markers\n if (trimmed.startsWith('```') || trimmed.startsWith('~~~')) return false;\n // Skip setext underlines\n if (/^[=-]+\\s*$/.test(trimmed)) return false;\n // Skip HTML tags that are likely structural\n if (/^<\\/?(?:h[1-6]|div|section|article|nav|header|footer)[^>]*>$/i.test(trimmed)) return false;\n // Skip lines that are just the title repeated\n if (trimmed.toLowerCase() === title.toLowerCase()) return false;\n return true;\n });\n\n if (bodyLines.length === 0) return null;\n\n // Take first non-empty line, truncate at sentence boundary\n const firstLine = bodyLines[0].trim();\n\n // Strip leading list markers (-, *, 1.)\n const cleaned = firstLine.replace(/^[-*\u2022]\\s+/, '').replace(/^\\d+\\.\\s+/, '');\n\n const sentenceEnd = cleaned.search(/[.!?]\\s|[.!?]$/);\n if (sentenceEnd > 0 && sentenceEnd < 200) {\n return cleaned.slice(0, sentenceEnd + 1).trim();\n }\n\n // No sentence boundary \u2014 take the whole first line (truncated)\n return cleaned.length > 200 ? cleaned.slice(0, 200) + '\u2026' : cleaned;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,iBACd,SACA,OACA,UACe;AACf,MAAI,aAAa,MAAO,QAAO;AAI/B,SAAO,qBAAqB,SAAS,KAAK;AAC5C;AAMA,SAAS,qBAAqB,SAAiB,OAA8B;AAC3E,QAAM,QAAQ,QAAQ,MAAM,IAAI;AAChC,QAAM,YAAY,MAAM,OAAO,OAAK;AAClC,UAAM,UAAU,EAAE,KAAK;AACvB,QAAI,YAAY,GAAI,QAAO;AAE3B,QAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,GAAG;AAEjF,UAAI,YAAY,KAAK,OAAO,EAAG,QAAO;AAAA,IACxC;AAEA,QAAI,QAAQ,WAAW,KAAK,KAAK,QAAQ,WAAW,KAAK,EAAG,QAAO;AAEnE,QAAI,aAAa,KAAK,OAAO,EAAG,QAAO;AAEvC,QAAI,gEAAgE,KAAK,OAAO,EAAG,QAAO;AAE1F,QAAI,QAAQ,YAAY,MAAM,MAAM,YAAY,EAAG,QAAO;AAC1D,WAAO;AAAA,EACT,CAAC;AAED,MAAI,UAAU,WAAW,EAAG,QAAO;AAGnC,QAAM,YAAY,UAAU,CAAC,EAAE,KAAK;AAGpC,QAAM,UAAU,UAAU,QAAQ,aAAa,EAAE,EAAE,QAAQ,aAAa,EAAE;AAE1E,QAAM,cAAc,QAAQ,OAAO,gBAAgB;AACnD,MAAI,cAAc,KAAK,cAAc,KAAK;AACxC,WAAO,QAAQ,MAAM,GAAG,cAAc,CAAC,EAAE,KAAK;AAAA,EAChD;AAGA,SAAO,QAAQ,SAAS,MAAM,QAAQ,MAAM,GAAG,GAAG,IAAI,WAAM;AAC9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/docs/types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Documentation Module \u2014 Type Definitions\n *\n * These types model the documentation layer: sections extracted from\n * doc files, cross-references to code symbols, and search results.\n * All populated only when enableDocs=true in config.\n */\n\n// \u2500\u2500 Section \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 interface DocSection {\n id: string; // stable section ID (file_path::ancestor-chain/slug#level)\n filePath: string; // relative path to doc file\n title: string; // heading text\n level: number; // heading depth (1\u20136, 0 for root/document-level)\n parentId: string | null; // parent section ID (null for top-level)\n summary: string | null; // one-line summary (extractive or first-sentence)\n byteStart: number; // byte offset in original file\n byteEnd: number; // byte offset end\n contentHash: string; // SHA-256 of section content (drift detection)\n tags: string[]; // extracted tags/refs (code refs, links, etc.)\n position: number; // ordering among siblings\n updatedAt: number; // timestamp\n}\n\n// \u2500\u2500 Code Reference \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 type DocRefType = 'mentions' | 'documents' | 'example' | 'configures';\n\nexport interface DocCodeRef {\n sectionId: string;\n qualifiedName: string; // stable across reindex\n refType: DocRefType;\n confidence: number; // 0.0\u20131.0\n}\n\n// \u2500\u2500 Parser Output \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 interface ParsedSection {\n title: string;\n level: number;\n byteStart: number;\n byteEnd: number;\n content: string; // raw content of the section (for hashing + summarization)\n children: ParsedSection[];\n}\n\nexport interface ParseResult {\n sections: ParsedSection[];\n format: string; // 'markdown' | 'rst' | 'asciidoc' | 'rdoc' | 'org' | 'html' | 'plaintext' | 'openapi'\n}\n\n// \u2500\u2500 Format Parser Interface \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 interface DocFormatParser {\n /** Unique name for this parser (e.g. 'markdown', 'rst') */\n name: string;\n /** File extensions this parser handles (e.g. ['.md', '.mdx']) */\n extensions: string[];\n /** Parse a file's content into a section hierarchy */\n parse(content: string, filePath: string): ParseResult;\n}\n\n// \u2500\u2500 Search \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 interface DocSearchResult {\n section: DocSection;\n score: number;\n matchType: 'fts' | 'semantic' | 'exact';\n}\n\n// \u2500\u2500 Index Result \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 interface DocIndexResult {\n filesIndexed: number;\n sectionsCreated: number;\n sectionsUpdated: number;\n sectionsRemoved: number;\n codeRefsCreated: number;\n errors: string[];\n duration: number;\n}\n\n// \u2500\u2500 TOC Entry \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 interface DocTocEntry {\n id: string;\n title: string;\n level: number;\n filePath: string;\n summary: string | null;\n children?: DocTocEntry[];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
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 vectors_exports = {};
|
|
30
|
+
__export(vectors_exports, {
|
|
31
|
+
DocsVectorManager: () => DocsVectorManager
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(vectors_exports);
|
|
34
|
+
var import_errors = require("../errors");
|
|
35
|
+
const MAX_TOKEN_CHARS = 2e3;
|
|
36
|
+
let transformers = null;
|
|
37
|
+
let pipeline = null;
|
|
38
|
+
let pipelineModel = null;
|
|
39
|
+
async function getTransformers() {
|
|
40
|
+
if (!transformers) {
|
|
41
|
+
transformers = await import("@huggingface/transformers");
|
|
42
|
+
}
|
|
43
|
+
return transformers;
|
|
44
|
+
}
|
|
45
|
+
async function getPipeline(modelName, cacheDir) {
|
|
46
|
+
if (pipeline && pipelineModel === modelName) return pipeline;
|
|
47
|
+
const tf = await getTransformers();
|
|
48
|
+
pipeline = await tf.pipeline("feature-extraction", modelName, {
|
|
49
|
+
cache_dir: cacheDir,
|
|
50
|
+
dtype: "fp32"
|
|
51
|
+
});
|
|
52
|
+
pipelineModel = modelName;
|
|
53
|
+
return pipeline;
|
|
54
|
+
}
|
|
55
|
+
function sectionToText(section) {
|
|
56
|
+
const parts = [section.title];
|
|
57
|
+
if (section.summary) parts.push(section.summary);
|
|
58
|
+
const text = parts.join(": ");
|
|
59
|
+
return text.length > MAX_TOKEN_CHARS ? text.slice(0, MAX_TOKEN_CHARS) : text;
|
|
60
|
+
}
|
|
61
|
+
function cosine(a, b) {
|
|
62
|
+
let dot = 0, na = 0, nb = 0;
|
|
63
|
+
for (let i = 0; i < a.length; i++) {
|
|
64
|
+
dot += a[i] * b[i];
|
|
65
|
+
na += a[i] * a[i];
|
|
66
|
+
nb += b[i] * b[i];
|
|
67
|
+
}
|
|
68
|
+
const denom = Math.sqrt(na) * Math.sqrt(nb);
|
|
69
|
+
return denom === 0 ? 0 : dot / denom;
|
|
70
|
+
}
|
|
71
|
+
class DocsVectorManager {
|
|
72
|
+
constructor(config, db) {
|
|
73
|
+
this.config = config;
|
|
74
|
+
this.db = db;
|
|
75
|
+
this.modelName = config.embeddingModel ?? "nomic-ai/nomic-embed-text-v1.5";
|
|
76
|
+
const { homedir } = require("os");
|
|
77
|
+
const path = require("path");
|
|
78
|
+
this.cacheDir = path.join(homedir(), ".kirograph", "models");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if embeddings are enabled in config.
|
|
82
|
+
*/
|
|
83
|
+
isEnabled() {
|
|
84
|
+
return !!this.config.enableEmbeddings;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Embed a single doc section and store in doc_vectors.
|
|
88
|
+
*/
|
|
89
|
+
async embedSection(section) {
|
|
90
|
+
if (!this.isEnabled()) return;
|
|
91
|
+
try {
|
|
92
|
+
const text = sectionToText(section);
|
|
93
|
+
const embedding = await this.embed(text);
|
|
94
|
+
if (embedding) {
|
|
95
|
+
const buffer = Buffer.from(embedding.buffer);
|
|
96
|
+
this.db.run(
|
|
97
|
+
"INSERT OR REPLACE INTO doc_vectors (section_id, embedding, model, created_at) VALUES (?, ?, ?, ?)",
|
|
98
|
+
[section.id, buffer, this.modelName, Date.now()]
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
} catch (err) {
|
|
102
|
+
(0, import_errors.logWarn)(`Failed to embed doc section ${section.id}: ${err}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Embed multiple sections in batch.
|
|
107
|
+
*/
|
|
108
|
+
async embedBatch(sections) {
|
|
109
|
+
if (!this.isEnabled()) return 0;
|
|
110
|
+
let embedded = 0;
|
|
111
|
+
for (const section of sections) {
|
|
112
|
+
try {
|
|
113
|
+
await this.embedSection(section);
|
|
114
|
+
embedded++;
|
|
115
|
+
} catch (err) {
|
|
116
|
+
(0, import_errors.logWarn)(`Failed to embed doc section ${section.id}: ${err}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return embedded;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Vector search over doc sections.
|
|
123
|
+
* Returns scored sections sorted by cosine similarity.
|
|
124
|
+
* Falls back to empty results if embeddings are disabled.
|
|
125
|
+
*/
|
|
126
|
+
async search(query, limit = 10) {
|
|
127
|
+
if (!this.isEnabled()) return [];
|
|
128
|
+
try {
|
|
129
|
+
const queryEmbedding = await this.embed(query);
|
|
130
|
+
if (!queryEmbedding) return [];
|
|
131
|
+
const allVectors = this.db.all(
|
|
132
|
+
"SELECT section_id, embedding FROM doc_vectors WHERE model = ?",
|
|
133
|
+
[this.modelName]
|
|
134
|
+
);
|
|
135
|
+
if (allVectors.length === 0) return [];
|
|
136
|
+
const scored = [];
|
|
137
|
+
for (const { section_id, embedding } of allVectors) {
|
|
138
|
+
const vec = new Float32Array(
|
|
139
|
+
embedding.buffer,
|
|
140
|
+
embedding.byteOffset,
|
|
141
|
+
embedding.byteLength / 4
|
|
142
|
+
);
|
|
143
|
+
const score = cosine(queryEmbedding, vec);
|
|
144
|
+
scored.push({ sectionId: section_id, score });
|
|
145
|
+
}
|
|
146
|
+
scored.sort((a, b) => b.score - a.score);
|
|
147
|
+
return scored.slice(0, limit);
|
|
148
|
+
} catch (err) {
|
|
149
|
+
(0, import_errors.logError)("Docs vector search failed", { error: err });
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Check if there are vectors with a mismatched model.
|
|
155
|
+
*/
|
|
156
|
+
hasModelMismatch() {
|
|
157
|
+
const mismatch = this.db.get(
|
|
158
|
+
"SELECT COUNT(*) as cnt FROM doc_vectors WHERE model != ?",
|
|
159
|
+
[this.modelName]
|
|
160
|
+
)?.cnt ?? 0;
|
|
161
|
+
return mismatch > 0;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get vector stats.
|
|
165
|
+
*/
|
|
166
|
+
getStats() {
|
|
167
|
+
const total = this.db.get("SELECT COUNT(*) as cnt FROM doc_vectors")?.cnt ?? 0;
|
|
168
|
+
const currentModel = this.db.get(
|
|
169
|
+
"SELECT COUNT(*) as cnt FROM doc_vectors WHERE model = ?",
|
|
170
|
+
[this.modelName]
|
|
171
|
+
)?.cnt ?? 0;
|
|
172
|
+
return { total, currentModel, mismatch: total - currentModel };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Re-embed all doc sections with the current model.
|
|
176
|
+
*/
|
|
177
|
+
async reembed(batchSize = 32) {
|
|
178
|
+
this.db.run("DELETE FROM doc_vectors");
|
|
179
|
+
const rows = this.db.all("SELECT * FROM doc_sections ORDER BY file_path, position");
|
|
180
|
+
const sections = rows.map((row) => ({
|
|
181
|
+
id: row.id,
|
|
182
|
+
filePath: row.file_path,
|
|
183
|
+
title: row.title,
|
|
184
|
+
level: row.level,
|
|
185
|
+
parentId: row.parent_id ?? null,
|
|
186
|
+
summary: row.summary ?? null,
|
|
187
|
+
byteStart: row.byte_start,
|
|
188
|
+
byteEnd: row.byte_end,
|
|
189
|
+
contentHash: row.content_hash,
|
|
190
|
+
tags: row.tags ? JSON.parse(row.tags) : [],
|
|
191
|
+
position: row.position,
|
|
192
|
+
updatedAt: row.updated_at
|
|
193
|
+
}));
|
|
194
|
+
let embedded = 0;
|
|
195
|
+
for (let i = 0; i < sections.length; i += batchSize) {
|
|
196
|
+
const batch = sections.slice(i, i + batchSize);
|
|
197
|
+
embedded += await this.embedBatch(batch);
|
|
198
|
+
}
|
|
199
|
+
return embedded;
|
|
200
|
+
}
|
|
201
|
+
// ── Private ────────────────────────────────────────────────────────────────
|
|
202
|
+
async embed(text) {
|
|
203
|
+
try {
|
|
204
|
+
const pipe = await getPipeline(this.modelName, this.cacheDir);
|
|
205
|
+
const output = await pipe(text, { pooling: "mean", normalize: true });
|
|
206
|
+
return output.data;
|
|
207
|
+
} catch (err) {
|
|
208
|
+
(0, import_errors.logDebug)(`Doc embedding failed: ${err}`);
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
214
|
+
0 && (module.exports = {
|
|
215
|
+
DocsVectorManager
|
|
216
|
+
});
|
|
217
|
+
//# sourceMappingURL=vectors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/docs/vectors.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Docs \u2014 Vector embedding and search\n *\n * Reuses the same embedding model and pipeline as the memory module,\n * but operates on doc_vectors table independently.\n */\n\nimport type { KiroGraphConfig } from '../config';\nimport type { DocSection, DocSearchResult } from './types';\nimport { logDebug, logWarn, logError } from '../errors';\n\nconst MAX_TOKEN_CHARS = 2000;\n\n// \u2500\u2500 Embedder (reuses the same pipeline as memory/code vectors) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nlet transformers: typeof import('@huggingface/transformers') | null = null;\nlet pipeline: any = null;\nlet pipelineModel: string | null = null;\n\nasync function getTransformers() {\n if (!transformers) {\n transformers = await import('@huggingface/transformers');\n }\n return transformers;\n}\n\nasync function getPipeline(modelName: string, cacheDir: string) {\n if (pipeline && pipelineModel === modelName) return pipeline;\n\n const tf = await getTransformers();\n pipeline = await tf.pipeline('feature-extraction', modelName, {\n cache_dir: cacheDir,\n dtype: 'fp32',\n } as any);\n pipelineModel = modelName;\n return pipeline;\n}\n\n/**\n * Build searchable text from a doc section.\n * Uses title + summary for embedding (concise, semantically rich).\n */\nfunction sectionToText(section: DocSection): string {\n const parts = [section.title];\n if (section.summary) parts.push(section.summary);\n const text = parts.join(': ');\n return text.length > MAX_TOKEN_CHARS ? text.slice(0, MAX_TOKEN_CHARS) : text;\n}\n\n/** Cosine similarity between two Float32Arrays */\nfunction cosine(a: Float32Array, b: Float32Array): number {\n let dot = 0, na = 0, nb = 0;\n for (let i = 0; i < a.length; i++) {\n dot += a[i] * b[i];\n na += a[i] * a[i];\n nb += b[i] * b[i];\n }\n const denom = Math.sqrt(na) * Math.sqrt(nb);\n return denom === 0 ? 0 : dot / denom;\n}\n\n// \u2500\u2500 DocsVectorManager \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 class DocsVectorManager {\n private config: KiroGraphConfig;\n private db: any; // raw SQLite handle\n private modelName: string;\n private cacheDir: string;\n\n constructor(config: KiroGraphConfig, db: any) {\n this.config = config;\n this.db = db;\n this.modelName = config.embeddingModel ?? 'nomic-ai/nomic-embed-text-v1.5';\n\n const { homedir } = require('os');\n const path = require('path');\n this.cacheDir = path.join(homedir(), '.kirograph', 'models');\n }\n\n /**\n * Check if embeddings are enabled in config.\n */\n isEnabled(): boolean {\n return !!this.config.enableEmbeddings;\n }\n\n /**\n * Embed a single doc section and store in doc_vectors.\n */\n async embedSection(section: DocSection): Promise<void> {\n if (!this.isEnabled()) return;\n\n try {\n const text = sectionToText(section);\n const embedding = await this.embed(text);\n if (embedding) {\n const buffer = Buffer.from(embedding.buffer);\n this.db.run(\n 'INSERT OR REPLACE INTO doc_vectors (section_id, embedding, model, created_at) VALUES (?, ?, ?, ?)',\n [section.id, buffer, this.modelName, Date.now()],\n );\n }\n } catch (err) {\n logWarn(`Failed to embed doc section ${section.id}: ${err}`);\n }\n }\n\n /**\n * Embed multiple sections in batch.\n */\n async embedBatch(sections: DocSection[]): Promise<number> {\n if (!this.isEnabled()) return 0;\n\n let embedded = 0;\n for (const section of sections) {\n try {\n await this.embedSection(section);\n embedded++;\n } catch (err) {\n logWarn(`Failed to embed doc section ${section.id}: ${err}`);\n }\n }\n return embedded;\n }\n\n /**\n * Vector search over doc sections.\n * Returns scored sections sorted by cosine similarity.\n * Falls back to empty results if embeddings are disabled.\n */\n async search(query: string, limit = 10): Promise<Array<{ sectionId: string; score: number }>> {\n if (!this.isEnabled()) return [];\n\n try {\n const queryEmbedding = await this.embed(query);\n if (!queryEmbedding) return [];\n\n // Get all doc vectors with matching model\n const allVectors = this.db.all(\n 'SELECT section_id, embedding FROM doc_vectors WHERE model = ?',\n [this.modelName],\n ) as Array<{ section_id: string; embedding: Buffer }>;\n\n if (allVectors.length === 0) return [];\n\n // Compute cosine similarity for each\n const scored: Array<{ sectionId: string; score: number }> = [];\n for (const { section_id, embedding } of allVectors) {\n const vec = new Float32Array(\n embedding.buffer,\n embedding.byteOffset,\n embedding.byteLength / 4,\n );\n const score = cosine(queryEmbedding, vec);\n scored.push({ sectionId: section_id, score });\n }\n\n // Sort by score descending, take top N\n scored.sort((a, b) => b.score - a.score);\n return scored.slice(0, limit);\n } catch (err) {\n logError('Docs vector search failed', { error: err });\n return [];\n }\n }\n\n /**\n * Check if there are vectors with a mismatched model.\n */\n hasModelMismatch(): boolean {\n const mismatch = this.db.get(\n 'SELECT COUNT(*) as cnt FROM doc_vectors WHERE model != ?',\n [this.modelName],\n )?.cnt ?? 0;\n return mismatch > 0;\n }\n\n /**\n * Get vector stats.\n */\n getStats(): { total: number; currentModel: number; mismatch: number } {\n const total = this.db.get('SELECT COUNT(*) as cnt FROM doc_vectors')?.cnt ?? 0;\n const currentModel = this.db.get(\n 'SELECT COUNT(*) as cnt FROM doc_vectors WHERE model = ?',\n [this.modelName],\n )?.cnt ?? 0;\n return { total, currentModel, mismatch: total - currentModel };\n }\n\n /**\n * Re-embed all doc sections with the current model.\n */\n async reembed(batchSize = 32): Promise<number> {\n // Delete all existing doc vectors\n this.db.run('DELETE FROM doc_vectors');\n\n // Get all sections\n const rows = this.db.all('SELECT * FROM doc_sections ORDER BY file_path, position') as any[];\n const sections: DocSection[] = rows.map((row: any) => ({\n id: row.id,\n filePath: row.file_path,\n title: row.title,\n level: row.level,\n parentId: row.parent_id ?? null,\n summary: row.summary ?? null,\n byteStart: row.byte_start,\n byteEnd: row.byte_end,\n contentHash: row.content_hash,\n tags: row.tags ? JSON.parse(row.tags) : [],\n position: row.position,\n updatedAt: row.updated_at,\n }));\n\n let embedded = 0;\n for (let i = 0; i < sections.length; i += batchSize) {\n const batch = sections.slice(i, i + batchSize);\n embedded += await this.embedBatch(batch);\n }\n\n return embedded;\n }\n\n // \u2500\u2500 Private \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\n private async embed(text: string): Promise<Float32Array | null> {\n try {\n const pipe = await getPipeline(this.modelName, this.cacheDir);\n const output = await pipe(text, { pooling: 'mean', normalize: true });\n return output.data as Float32Array;\n } catch (err) {\n logDebug(`Doc embedding failed: ${err}`);\n return null;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,oBAA4C;AAE5C,MAAM,kBAAkB;AAIxB,IAAI,eAAkE;AACtE,IAAI,WAAgB;AACpB,IAAI,gBAA+B;AAEnC,eAAe,kBAAkB;AAC/B,MAAI,CAAC,cAAc;AACjB,mBAAe,MAAM,OAAO,2BAA2B;AAAA,EACzD;AACA,SAAO;AACT;AAEA,eAAe,YAAY,WAAmB,UAAkB;AAC9D,MAAI,YAAY,kBAAkB,UAAW,QAAO;AAEpD,QAAM,KAAK,MAAM,gBAAgB;AACjC,aAAW,MAAM,GAAG,SAAS,sBAAsB,WAAW;AAAA,IAC5D,WAAW;AAAA,IACX,OAAO;AAAA,EACT,CAAQ;AACR,kBAAgB;AAChB,SAAO;AACT;AAMA,SAAS,cAAc,SAA6B;AAClD,QAAM,QAAQ,CAAC,QAAQ,KAAK;AAC5B,MAAI,QAAQ,QAAS,OAAM,KAAK,QAAQ,OAAO;AAC/C,QAAM,OAAO,MAAM,KAAK,IAAI;AAC5B,SAAO,KAAK,SAAS,kBAAkB,KAAK,MAAM,GAAG,eAAe,IAAI;AAC1E;AAGA,SAAS,OAAO,GAAiB,GAAyB;AACxD,MAAI,MAAM,GAAG,KAAK,GAAG,KAAK;AAC1B,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,WAAO,EAAE,CAAC,IAAI,EAAE,CAAC;AACjB,UAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAChB,UAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAAA,EAClB;AACA,QAAM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KA,MAAM,QAAQ,YAAY,IAAqB;AAE7C,SAAK,GAAG,IAAI,yBAAyB;AAGrC,UAAM,OAAO,KAAK,GAAG,IAAI,yDAAyD;AAClF,UAAM,WAAyB,KAAK,IAAI,CAAC,SAAc;AAAA,MACrD,IAAI,IAAI;AAAA,MACR,UAAU,IAAI;AAAA,MACd,OAAO,IAAI;AAAA,MACX,OAAO,IAAI;AAAA,MACX,UAAU,IAAI,aAAa;AAAA,MAC3B,SAAS,IAAI,WAAW;AAAA,MACxB,WAAW,IAAI;AAAA,MACf,SAAS,IAAI;AAAA,MACb,aAAa,IAAI;AAAA,MACjB,MAAM,IAAI,OAAO,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC;AAAA,MACzC,UAAU,IAAI;AAAA,MACd,WAAW,IAAI;AAAA,IACjB,EAAE;AAEF,QAAI,WAAW;AACf,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK,WAAW;AACnD,YAAM,QAAQ,SAAS,MAAM,GAAG,IAAI,SAAS;AAC7C,kBAAY,MAAM,KAAK,WAAW,KAAK;AAAA,IACzC;AAEA,WAAO;AAAA,EACT;AAAA;AAAA,EAIA,MAAc,MAAM,MAA4C;AAC9D,QAAI;AACF,YAAM,OAAO,MAAM,YAAY,KAAK,WAAW,KAAK,QAAQ;AAC5D,YAAM,SAAS,MAAM,KAAK,MAAM,EAAE,SAAS,QAAQ,WAAW,KAAK,CAAC;AACpE,aAAO,OAAO;AAAA,IAChB,SAAS,KAAK;AACZ,kCAAS,yBAAyB,GAAG,EAAE;AACvC,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph \u2014 Semantic code knowledge graph for Kiro\n *\n * Pure facade. Every method delegates to a focused sub-system.\n * No business logic lives here.\n */\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { GraphDatabase } from './db/database';\nimport { validatePathWithinRoot, validateProjectPath } from './utils';\nimport { loadConfig, createDefaultConfig, saveConfig } from './config';\nimport type { KiroGraphConfig } from './config';\nimport { GraphQueryManager } from './graph/queries';\nimport { ReferenceResolver } from './resolution/index';\nimport { VectorManager } from './vectors/index';\nimport { ContextBuilder } from './context/index';\nimport { ArchitectureAnalyzer } from './architecture/index';\nimport { LockManager } from './core/lock-manager';\nimport { IndexPipeline } from './core/pipeline';\nimport { buildFileTree } from './core/file-tree';\nimport { SnapshotManager } from './core/snapshot';\nimport { Searcher } from './search/searcher';\nimport type { FileTreeNode, FileTree } from './core/file-tree';\nimport type { GraphSnapshot, GraphDiff } from './core/snapshot';\n\nexport type { GraphSnapshot, GraphDiff };\nimport type {\n Node, Edge, NodeKind, IndexResult, IndexProgress, SyncResult, TaskContext,\n SearchResult, SearchOptions, NodeContext, NodeMetrics,\n} from './types';\nimport type { ArchitectureResult } from './architecture/types';\n\nexport type { FileTreeNode, FileTree };\n\nconst KIROGRAPH_DIR = '.kirograph';\n\nexport default class KiroGraph {\n private readonly db: GraphDatabase;\n private readonly config: KiroGraphConfig;\n private readonly projectRoot: string;\n private readonly queryManager: GraphQueryManager;\n private readonly resolver: ReferenceResolver;\n private readonly vectors: VectorManager;\n private readonly contextBuilder: ContextBuilder;\n private readonly arch: ArchitectureAnalyzer;\n private readonly lock: LockManager;\n private readonly pipeline: IndexPipeline;\n private readonly searcher: Searcher;\n\n private constructor(projectRoot: string, db: GraphDatabase, config: KiroGraphConfig) {\n this.projectRoot = projectRoot;\n this.db = db;\n this.config = config;\n this.queryManager = new GraphQueryManager(db);\n this.resolver = new ReferenceResolver(db, config);\n this.vectors = new VectorManager(db, config, projectRoot);\n this.contextBuilder = new ContextBuilder(db, this.resolver, this.vectors, projectRoot);\n this.arch = new ArchitectureAnalyzer(db, config, projectRoot);\n this.lock = new LockManager(projectRoot);\n this.pipeline = new IndexPipeline(db, this.vectors, this.resolver, this.arch, this.lock, config, projectRoot);\n this.searcher = new Searcher(db);\n }\n\n // \u2500\u2500 Factory \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\n static async init(\n projectRoot: string,\n config?: Partial<KiroGraphConfig>,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n fs.mkdirSync(path.join(resolved, KIROGRAPH_DIR), { recursive: true });\n const cfg = { ...createDefaultConfig(resolved), ...config };\n await saveConfig(resolved, cfg);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static async open(\n projectRoot: string,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n if (!fs.existsSync(path.join(resolved, KIROGRAPH_DIR))) {\n throw new Error(`KiroGraph not initialized at ${resolved}. Run: kirograph init`);\n }\n const cfg = await loadConfig(resolved);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static isInitialized(projectRoot: string): boolean {\n return fs.existsSync(path.join(path.resolve(projectRoot), KIROGRAPH_DIR));\n }\n\n // \u2500\u2500 Lock / dirty marker \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\n unlockForce(): void { this.lock.forceRelease(); }\n markDirty(): void { this.lock.markDirty(); }\n clearDirty(): void { this.lock.clearDirty(); }\n isDirty(): boolean { return this.lock.isDirty(); }\n isIndexLocked(): boolean { return this.lock.isLocked(); }\n\n async syncIfDirty(): Promise<SyncResult | null> {\n if (!this.isDirty()) return null;\n return this.sync();\n }\n\n /**\n * Returns the number of files that have changed on disk but are not yet\n * reflected in the index. Used by the MCP status tool to warn the agent\n * when the index may be stale.\n */\n async getPendingSyncCount(): Promise<number> {\n try {\n const { getChangedFiles, scanDirectory } = await Promise.resolve().then(() => require('./sync/index.js'));\n const gitChanged = await getChangedFiles(this.projectRoot, this.config);\n const hasGitChanges =\n gitChanged.added.length > 0 ||\n gitChanged.modified.length > 0 ||\n gitChanged.removed.length > 0;\n\n if (hasGitChanges) {\n return gitChanged.added.length + gitChanged.modified.length + gitChanged.removed.length;\n }\n\n // Fallback: compare indexed set vs current filesystem set\n const indexed = new Set(this.db.getAllFiles().map((f: { path: string }) => f.path));\n const current = new Set(\n (await scanDirectory(this.projectRoot, this.config))\n .map(f => require('path').relative(this.projectRoot, f).replace(/\\\\/g, '/'))\n );\n let pending = 0;\n for (const p of indexed) { if (!current.has(p)) pending++; }\n for (const p of current) { if (!indexed.has(p)) pending++; }\n return pending;\n } catch {\n return 0;\n }\n }\n\n // \u2500\u2500 Indexing \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\n async indexAll(opts?: { onProgress?: (p: IndexProgress) => void; force?: boolean; signal?: AbortSignal }): Promise<IndexResult> {\n return this.pipeline.indexAll(opts);\n }\n\n async sync(changedFilesOrOpts?: string[] | { files?: string[]; onProgress?: (p: IndexProgress) => void }): Promise<SyncResult> {\n if (Array.isArray(changedFilesOrOpts)) {\n return this.pipeline.sync({ changedFiles: changedFilesOrOpts });\n }\n return this.pipeline.sync({\n changedFiles: changedFilesOrOpts?.files,\n onProgress: changedFilesOrOpts?.onProgress,\n });\n }\n\n // \u2500\u2500 Symbol search \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\n searchNodes(query: string, kindOrOpts?: NodeKind | SearchOptions, limit = 20): SearchResult[] {\n return this.searcher.search(query, kindOrOpts, limit);\n }\n\n // \u2500\u2500 Graph queries \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\n async getCallers(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallers(nodeId, limit); }\n async getCallees(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallees(nodeId, limit); }\n async getImpactRadius(nodeId: string, depth = 2): Promise<Node[]> { return this.queryManager.getImpactRadius(nodeId, depth); }\n getAllNodes(): Node[] { return this.db.getAllNodes(); }\n getAllEdges(): Edge[] { return this.db.getAllEdges(); }\n findDeadCode(limit = 50): Node[] { return this.db.findDeadCode(limit); }\n findCircularDependencies(): string[][] { return this.db.findCircularDependencies(); }\n async findPath(fromId: string, toId: string, maxDepth = 10): Promise<Node[]> { return this.queryManager.findPath(fromId, toId, maxDepth); }\n getTypeHierarchy(nodeId: string, direction: 'up' | 'down' | 'both' = 'both'): Node[] { return this.db.getTypeHierarchy(nodeId, direction); }\n getNode(id: string): Node | null { return this.db.getNode(id); }\n getNodeContext(nodeId: string): NodeContext | null { return this.db.getNodeContext(nodeId); }\n getNodeMetrics(nodeId: string): NodeMetrics { return this.db.getNodeMetrics(nodeId); }\n\n getNodeSource(node: Node): string | null {\n const absPath = validatePathWithinRoot(path.join(this.projectRoot, node.filePath), this.projectRoot);\n if (!absPath) return null;\n try {\n return fs.readFileSync(absPath, 'utf8').split('\\n').slice(node.startLine - 1, node.endLine).join('\\n');\n } catch { return null; }\n }\n\n // \u2500\u2500 Context building \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\n async buildContext(task: string, opts?: { maxNodes?: number; includeCode?: boolean }): Promise<TaskContext> {\n return this.contextBuilder.buildTaskContext(task, opts);\n }\n\n // \u2500\u2500 File browsing \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\n getFiles(opts?: { filterPath?: string; pattern?: string; maxDepth?: number }): FileTree {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const picomatch = opts?.pattern ? require('picomatch')(opts.pattern) : null;\n const filtered = this.db.getAllFiles().filter(f => {\n if (opts?.filterPath && !f.path.startsWith(opts.filterPath)) return false;\n if (picomatch && !picomatch(f.path)) return false;\n return true;\n });\n return buildFileTree(filtered, opts?.maxDepth);\n }\n\n getAffectedTests(changedFiles: string[], opts?: { depth?: number; testPattern?: string }): string[] {\n return this.queryManager.getAffectedTests(changedFiles, opts);\n }\n\n // \u2500\u2500 Graph insights \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\n findHotspots(limit = 20): Array<Node & { degree: number; inDegree: number; outDegree: number }> {\n return this.db.findHotspots(limit);\n }\n\n findSurprisingConnections(limit = 20): Array<{ source: Node; target: Node; kind: string; score: number }> {\n return this.db.findSurprisingConnections(limit);\n }\n\n // \u2500\u2500 Snapshots \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\n createSnapshotManager(): SnapshotManager {\n return new SnapshotManager(this.db, this.projectRoot);\n }\n\n // \u2500\u2500 Stats \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\n async getStats() {\n const stats = this.db.getStats();\n const vecIndexCount = await this.vectors.vecIndexCount();\n const embeddingCount = vecIndexCount > 0 ? vecIndexCount : stats.embeddingCount;\n const EMBEDDABLE = ['function', 'method', 'class', 'interface', 'type_alias', 'component', 'module'];\n const embeddableNodeCount = EMBEDDABLE.reduce((sum, k) => sum + (stats.nodesByKind[k] ?? 0), 0);\n const pendingFiles = await this.getPendingSyncCount();\n const syncRunning = this.isIndexLocked();\n return {\n ...stats,\n embeddingCount,\n embeddableNodeCount,\n embeddingsEnabled: this.config.enableEmbeddings ?? false,\n embeddingModel: this.config.embeddingModel,\n useVecIndex: this.config.useVecIndex ?? false,\n semanticEngine: this.config.semanticEngine ?? 'cosine',\n vecIndexCount,\n engineFallback: this.vectors.getEngineFallback(),\n frameworks: this.config.frameworkHints ?? [],\n architectureEnabled: this.config.enableArchitecture ?? false,\n ...(this.config.enableArchitecture ? { architectureStats: this.db.getArchStats() } : {}),\n pendingFiles,\n syncRunning,\n syncWarningThreshold: this.config.syncWarningThreshold ?? 10,\n };\n }\n\n getEngineFallback(): string | null { return this.vectors.getEngineFallback(); }\n\n // \u2500\u2500 Architecture API \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\n getArchitecture(): ArchitectureResult & {\n filePackages: Record<string, string[]>;\n fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>>;\n } {\n const base = this.db.getArchitectureResult();\n\n const filePackages: Record<string, string[]> = {};\n for (const { filePath, packageId } of this.db.getArchFilePackages()) {\n if (!filePackages[filePath]) filePackages[filePath] = [];\n filePackages[filePath].push(packageId);\n }\n\n const fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>> = {};\n for (const row of this.db.getArchFileLayers()) {\n if (!fileLayers[row.filePath]) fileLayers[row.filePath] = [];\n fileLayers[row.filePath].push({ layerId: row.layerId, confidence: row.confidence, matchedPattern: row.matchedPattern });\n }\n\n return { ...base, filePackages, fileLayers };\n }\n\n isArchitectureEnabled(): boolean { return this.config.enableArchitecture ?? false; }\n\n // \u2500\u2500 Misc \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\n getProjectRoot(): string { return this.projectRoot; }\n\n close(): void {\n this.vectors.close();\n this.lock.release();\n this.db.close();\n }\n}\n\n// \u2500\u2500 Module-level 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\n\n/** Walk up directories to find the nearest .kirograph/ folder. */\nexport function findNearestKiroGraphRoot(startPath: string): string | null {\n let current = path.resolve(startPath);\n while (true) {\n if (fs.existsSync(path.join(current, KIROGRAPH_DIR))) return current;\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,WAAsB;AACtB,SAAoB;AACpB,sBAA8B;AAC9B,mBAA4D;AAC5D,oBAA4D;AAE5D,qBAAkC;AAClC,wBAAkC;AAClC,qBAA8B;AAC9B,qBAA+B;AAC/B,0BAAqC;AACrC,0BAA4B;AAC5B,sBAA8B;AAC9B,uBAA8B;AAC9B,sBAAgC;AAChC,sBAAyB;AAazB,MAAM,gBAAgB;AAEtB,MAAO,UAAwB;AAAA,EAarB,YAAY,aAAqB,IAAmB,QAAyB;AACnF,SAAK,cAAc;AACnB,SAAK,KAAK;AACV,SAAK,SAAS;AACd,SAAK,eAAe,IAAI,iCAAkB,EAAE;AAC5C,SAAK,WAAW,IAAI,oCAAkB,IAAI,MAAM;AAChD,SAAK,UAAU,IAAI,6BAAc,IAAI,QAAQ,WAAW;AACxD,SAAK,iBAAiB,IAAI,8BAAe,IAAI,KAAK,UAAU,KAAK,SAAS,WAAW;AACrF,SAAK,OAAO,IAAI,yCAAqB,IAAI,QAAQ,WAAW;AAC5D,SAAK,OAAO,IAAI,gCAAY,WAAW;AACvC,SAAK,WAAW,IAAI,8BAAc,IAAI,KAAK,SAAS,KAAK,UAAU,KA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C;AACvD,mBAAa,QAAQ,EAAE,KAAK,SAAS;AAAA,IACvC;AAEA,UAAM,aAAqG,CAAC;AAC5G,eAAW,OAAO,KAAK,GAAG,kBAAkB,GAAG;AAC7C,UAAI,CAAC,WAAW,IAAI,QAAQ,EAAG,YAAW,IAAI,QAAQ,IAAI,CAAC;AAC3D,iBAAW,IAAI,QAAQ,EAAE,KAAK,EAAE,SAAS,IAAI,SAAS,YAAY,IAAI,YAAY,gBAAgB,IAAI,eAAe,CAAC;AAAA,IACxH;AAEA,WAAO,EAAE,GAAG,MAAM,cAAc,WAAW;AAAA,EAC7C;AAAA,EAEA,wBAAiC;AAAE,WAAO,KAAK,OAAO,sBAAsB;AAAA,EAAO;AAAA;AAAA,EAInF,iBAAyB;AAAE,WAAO,KAAK;AAAA,EAAa;AAAA,EAEpD,QAAc;AACZ,SAAK,QAAQ,MAAM;AACnB,SAAK,KAAK,QAAQ;AAClB,SAAK,GAAG,MAAM;AAAA,EAChB;AACF;AAKO,SAAS,yBAAyB,WAAkC;AACzE,MAAI,UAAU,KAAK,QAAQ,SAAS;AACpC,SAAO,MAAM;AACX,QAAI,GAAG,WAAW,KAAK,KAAK,SAAS,aAAa,CAAC,EAAG,QAAO;AAC7D,UAAM,SAAS,KAAK,QAAQ,OAAO;AACnC,QAAI,WAAW,QAAS,QAAO;AAC/B,cAAU;AAAA,EACZ;AACF;",
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph \u2014 Semantic code knowledge graph for Kiro\n *\n * Pure facade. Every method delegates to a focused sub-system.\n * No business logic lives here.\n */\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { GraphDatabase } from './db/database';\nimport { validatePathWithinRoot, validateProjectPath } from './utils';\nimport { loadConfig, createDefaultConfig, saveConfig } from './config';\nimport type { KiroGraphConfig } from './config';\nimport { GraphQueryManager } from './graph/queries';\nimport { ReferenceResolver } from './resolution/index';\nimport { VectorManager } from './vectors/index';\nimport { ContextBuilder } from './context/index';\nimport { ArchitectureAnalyzer } from './architecture/index';\nimport { LockManager } from './core/lock-manager';\nimport { IndexPipeline } from './core/pipeline';\nimport { buildFileTree } from './core/file-tree';\nimport { SnapshotManager } from './core/snapshot';\nimport { Searcher } from './search/searcher';\nimport type { FileTreeNode, FileTree } from './core/file-tree';\nimport type { GraphSnapshot, GraphDiff } from './core/snapshot';\n\nexport type { GraphSnapshot, GraphDiff };\nimport type {\n Node, Edge, NodeKind, IndexResult, IndexProgress, SyncResult, TaskContext,\n SearchResult, SearchOptions, NodeContext, NodeMetrics,\n} from './types';\nimport type { ArchitectureResult } from './architecture/types';\n\nexport type { FileTreeNode, FileTree };\n\nconst KIROGRAPH_DIR = '.kirograph';\n\nexport default class KiroGraph {\n private readonly db: GraphDatabase;\n private readonly config: KiroGraphConfig;\n private readonly projectRoot: string;\n private readonly queryManager: GraphQueryManager;\n private readonly resolver: ReferenceResolver;\n private readonly vectors: VectorManager;\n private readonly contextBuilder: ContextBuilder;\n private readonly arch: ArchitectureAnalyzer;\n private readonly lock: LockManager;\n private readonly pipeline: IndexPipeline;\n private readonly searcher: Searcher;\n\n private constructor(projectRoot: string, db: GraphDatabase, config: KiroGraphConfig) {\n this.projectRoot = projectRoot;\n this.db = db;\n this.config = config;\n this.queryManager = new GraphQueryManager(db);\n this.resolver = new ReferenceResolver(db, config);\n this.vectors = new VectorManager(db, config, projectRoot);\n this.contextBuilder = new ContextBuilder(db, this.resolver, this.vectors, projectRoot);\n this.arch = new ArchitectureAnalyzer(db, config, projectRoot);\n this.lock = new LockManager(projectRoot);\n this.pipeline = new IndexPipeline(db, this.vectors, this.resolver, this.arch, this.lock, config, projectRoot);\n this.searcher = new Searcher(db);\n }\n\n // \u2500\u2500 Factory \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\n static async init(\n projectRoot: string,\n config?: Partial<KiroGraphConfig>,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n fs.mkdirSync(path.join(resolved, KIROGRAPH_DIR), { recursive: true });\n const cfg = { ...createDefaultConfig(resolved), ...config };\n await saveConfig(resolved, cfg);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static async open(\n projectRoot: string,\n onModelProgress?: (file: string, loaded: number, total: number, done: boolean) => void,\n ): Promise<KiroGraph> {\n const resolved = path.resolve(projectRoot);\n validateProjectPath(resolved);\n if (!fs.existsSync(path.join(resolved, KIROGRAPH_DIR))) {\n throw new Error(`KiroGraph not initialized at ${resolved}. Run: kirograph init`);\n }\n const cfg = await loadConfig(resolved);\n const db = new GraphDatabase(resolved);\n const kg = new KiroGraph(resolved, db, cfg);\n await kg.vectors.initialize(onModelProgress);\n return kg;\n }\n\n static isInitialized(projectRoot: string): boolean {\n return fs.existsSync(path.join(path.resolve(projectRoot), KIROGRAPH_DIR));\n }\n\n // \u2500\u2500 Lock / dirty marker \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\n unlockForce(): void { this.lock.forceRelease(); }\n markDirty(): void { this.lock.markDirty(); }\n clearDirty(): void { this.lock.clearDirty(); }\n isDirty(): boolean { return this.lock.isDirty(); }\n isIndexLocked(): boolean { return this.lock.isLocked(); }\n\n async syncIfDirty(): Promise<SyncResult | null> {\n if (!this.isDirty()) return null;\n return this.sync();\n }\n\n /**\n * Returns the number of files that have changed on disk but are not yet\n * reflected in the index. Used by the MCP status tool to warn the agent\n * when the index may be stale.\n */\n async getPendingSyncCount(): Promise<number> {\n try {\n const { getChangedFiles, scanDirectory } = await Promise.resolve().then(() => require('./sync/index.js'));\n const gitChanged = await getChangedFiles(this.projectRoot, this.config);\n const hasGitChanges =\n gitChanged.added.length > 0 ||\n gitChanged.modified.length > 0 ||\n gitChanged.removed.length > 0;\n\n if (hasGitChanges) {\n return gitChanged.added.length + gitChanged.modified.length + gitChanged.removed.length;\n }\n\n // Fallback: compare indexed set vs current filesystem set\n const indexed = new Set(this.db.getAllFiles().map((f: { path: string }) => f.path));\n const current = new Set(\n (await scanDirectory(this.projectRoot, this.config))\n .map(f => require('path').relative(this.projectRoot, f).replace(/\\\\/g, '/'))\n );\n let pending = 0;\n for (const p of indexed) { if (!current.has(p)) pending++; }\n for (const p of current) { if (!indexed.has(p)) pending++; }\n return pending;\n } catch {\n return 0;\n }\n }\n\n // \u2500\u2500 Indexing \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\n async indexAll(opts?: { onProgress?: (p: IndexProgress) => void; force?: boolean; signal?: AbortSignal }): Promise<IndexResult> {\n return this.pipeline.indexAll(opts);\n }\n\n async sync(changedFilesOrOpts?: string[] | { files?: string[]; onProgress?: (p: IndexProgress) => void }): Promise<SyncResult> {\n if (Array.isArray(changedFilesOrOpts)) {\n return this.pipeline.sync({ changedFiles: changedFilesOrOpts });\n }\n return this.pipeline.sync({\n changedFiles: changedFilesOrOpts?.files,\n onProgress: changedFilesOrOpts?.onProgress,\n });\n }\n\n // \u2500\u2500 Symbol search \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\n searchNodes(query: string, kindOrOpts?: NodeKind | SearchOptions, limit = 20): SearchResult[] {\n return this.searcher.search(query, kindOrOpts, limit);\n }\n\n // \u2500\u2500 Graph queries \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\n async getCallers(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallers(nodeId, limit); }\n async getCallees(nodeId: string, limit = 30): Promise<Node[]> { return this.queryManager.getCallees(nodeId, limit); }\n async getImpactRadius(nodeId: string, depth = 2): Promise<Node[]> { return this.queryManager.getImpactRadius(nodeId, depth); }\n getAllNodes(): Node[] { return this.db.getAllNodes(); }\n getAllEdges(): Edge[] { return this.db.getAllEdges(); }\n findDeadCode(limit = 50): Node[] { return this.db.findDeadCode(limit); }\n findCircularDependencies(): string[][] { return this.db.findCircularDependencies(); }\n async findPath(fromId: string, toId: string, maxDepth = 10): Promise<Node[]> { return this.queryManager.findPath(fromId, toId, maxDepth); }\n getTypeHierarchy(nodeId: string, direction: 'up' | 'down' | 'both' = 'both'): Node[] { return this.db.getTypeHierarchy(nodeId, direction); }\n getNode(id: string): Node | null { return this.db.getNode(id); }\n getNodeContext(nodeId: string): NodeContext | null { return this.db.getNodeContext(nodeId); }\n getNodeMetrics(nodeId: string): NodeMetrics { return this.db.getNodeMetrics(nodeId); }\n\n getNodeSource(node: Node): string | null {\n const absPath = validatePathWithinRoot(path.join(this.projectRoot, node.filePath), this.projectRoot);\n if (!absPath) return null;\n try {\n return fs.readFileSync(absPath, 'utf8').split('\\n').slice(node.startLine - 1, node.endLine).join('\\n');\n } catch { return null; }\n }\n\n // \u2500\u2500 Context building \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\n async buildContext(task: string, opts?: { maxNodes?: number; includeCode?: boolean }): Promise<TaskContext> {\n return this.contextBuilder.buildTaskContext(task, opts);\n }\n\n // \u2500\u2500 File browsing \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\n getFiles(opts?: { filterPath?: string; pattern?: string; maxDepth?: number }): FileTree {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const picomatch = opts?.pattern ? require('picomatch')(opts.pattern) : null;\n const filtered = this.db.getAllFiles().filter(f => {\n if (opts?.filterPath && !f.path.startsWith(opts.filterPath)) return false;\n if (picomatch && !picomatch(f.path)) return false;\n return true;\n });\n return buildFileTree(filtered, opts?.maxDepth);\n }\n\n getAffectedTests(changedFiles: string[], opts?: { depth?: number; testPattern?: string }): string[] {\n return this.queryManager.getAffectedTests(changedFiles, opts);\n }\n\n // \u2500\u2500 Graph insights \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\n findHotspots(limit = 20): Array<Node & { degree: number; inDegree: number; outDegree: number }> {\n return this.db.findHotspots(limit);\n }\n\n findSurprisingConnections(limit = 20): Array<{ source: Node; target: Node; kind: string; score: number }> {\n return this.db.findSurprisingConnections(limit);\n }\n\n // \u2500\u2500 Snapshots \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\n createSnapshotManager(): SnapshotManager {\n return new SnapshotManager(this.db, this.projectRoot);\n }\n\n // \u2500\u2500 Stats \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\n async getStats() {\n const stats = this.db.getStats();\n const vecIndexCount = await this.vectors.vecIndexCount();\n const embeddingCount = vecIndexCount > 0 ? vecIndexCount : stats.embeddingCount;\n const EMBEDDABLE = ['function', 'method', 'class', 'interface', 'type_alias', 'component', 'module'];\n const embeddableNodeCount = EMBEDDABLE.reduce((sum, k) => sum + (stats.nodesByKind[k] ?? 0), 0);\n const pendingFiles = await this.getPendingSyncCount();\n const syncRunning = this.isIndexLocked();\n return {\n ...stats,\n embeddingCount,\n embeddableNodeCount,\n embeddingsEnabled: this.config.enableEmbeddings ?? false,\n embeddingModel: this.config.embeddingModel,\n useVecIndex: this.config.useVecIndex ?? false,\n semanticEngine: this.config.semanticEngine ?? 'cosine',\n vecIndexCount,\n engineFallback: this.vectors.getEngineFallback(),\n frameworks: this.config.frameworkHints ?? [],\n architectureEnabled: this.config.enableArchitecture ?? false,\n ...(this.config.enableArchitecture ? { architectureStats: this.db.getArchStats() } : {}),\n pendingFiles,\n syncRunning,\n syncWarningThreshold: this.config.syncWarningThreshold ?? 10,\n };\n }\n\n getEngineFallback(): string | null { return this.vectors.getEngineFallback(); }\n\n // \u2500\u2500 Architecture API \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\n getArchitecture(): ArchitectureResult & {\n filePackages: Record<string, string[]>;\n fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>>;\n } {\n const base = this.db.getArchitectureResult();\n\n const filePackages: Record<string, string[]> = {};\n for (const { filePath, packageId } of this.db.getArchFilePackages()) {\n if (!filePackages[filePath]) filePackages[filePath] = [];\n filePackages[filePath].push(packageId);\n }\n\n const fileLayers: Record<string, Array<{ layerId: string; confidence: number; matchedPattern: string }>> = {};\n for (const row of this.db.getArchFileLayers()) {\n if (!fileLayers[row.filePath]) fileLayers[row.filePath] = [];\n fileLayers[row.filePath].push({ layerId: row.layerId, confidence: row.confidence, matchedPattern: row.matchedPattern });\n }\n\n return { ...base, filePackages, fileLayers };\n }\n\n isArchitectureEnabled(): boolean { return this.config.enableArchitecture ?? false; }\n\n // \u2500\u2500 Misc \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\n getProjectRoot(): string { return this.projectRoot; }\n\n getDatabase(): GraphDatabase { return this.db; }\n\n close(): void {\n this.vectors.close();\n this.lock.release();\n this.db.close();\n }\n}\n\n// \u2500\u2500 Module-level 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\n\n/** Walk up directories to find the nearest .kirograph/ folder. */\nexport function findNearestKiroGraphRoot(startPath: string): string | null {\n let current = path.resolve(startPath);\n while (true) {\n if (fs.existsSync(path.join(current, KIROGRAPH_DIR))) return current;\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,WAAsB;AACtB,SAAoB;AACpB,sBAA8B;AAC9B,mBAA4D;AAC5D,oBAA4D;AAE5D,qBAAkC;AAClC,wBAAkC;AAClC,qBAA8B;AAC9B,qBAA+B;AAC/B,0BAAqC;AACrC,0BAA4B;AAC5B,sBAA8B;AAC9B,uBAA8B;AAC9B,sBAAgC;AAChC,sBAAyB;AAazB,MAAM,gBAAgB;AAEtB,MAAO,UAAwB;AAAA,EAarB,YAAY,aAAqB,IAAmB,QAAyB;AACnF,SAAK,cAAc;AACnB,SAAK,KAAK;AACV,SAAK,SAAS;AACd,SAAK,eAAe,IAAI,iCAAkB,EAAE;AAC5C,SAAK,WAAW,IAAI,oCAAkB,IAAI,MAAM;AAChD,SAAK,UAAU,IAAI,6BAAc,IAAI,QAAQ,WAAW;AACxD,SAAK,iBAAiB,IAAI,8BAAe,IAAI,KAAK,UAAU,KAAK,SAAS,WAAW;AACrF,SAAK,OAAO,IAAI,yCAAqB,IAAI,QAAQ,WAAW;AAC5D,SAAK,OAAO,IAAI,gCAAY,WAAW;AACvC,SAAK,WAAW,IAAI,8BAAc,IAAI,KAAK,SAAS,KAAK,UAAU,KAAK,MAAM,KAAK,MAAM,QAAQ,WAAW;AAC5G,SAAK,WAAW,IAAI,yBAAS,EAAE;AAAA,EACjC;AAAA;AAAA,EAIA,aAAa,KACX,aACA,QACA,iBACoB;AACpB,UAAM,WAAW,KAAK,QAAQ,WAAW;AACzC,0CAAoB,QAAQ;AAC5B,OAAG,UAAU,KAAK,KAAK,UAAU,aAAa,GAAG,EAAE,WAAW,KAAK,CAAC;AACpE,UAAM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,YAAY,gBAAgB,IAAI,eAAe,CAAC;AAAA,IACxH;AAEA,WAAO,EAAE,GAAG,MAAM,cAAc,WAAW;AAAA,EAC7C;AAAA,EAEA,wBAAiC;AAAE,WAAO,KAAK,OAAO,sBAAsB;AAAA,EAAO;AAAA;AAAA,EAInF,iBAAyB;AAAE,WAAO,KAAK;AAAA,EAAa;AAAA,EAEpD,cAA6B;AAAE,WAAO,KAAK;AAAA,EAAI;AAAA,EAE/C,QAAc;AACZ,SAAK,QAAQ,MAAM;AACnB,SAAK,KAAK,QAAQ;AAClB,SAAK,GAAG,MAAM;AAAA,EAChB;AACF;AAKO,SAAS,yBAAyB,WAAkC;AACzE,MAAI,UAAU,KAAK,QAAQ,SAAS;AACpC,SAAO,MAAM;AACX,QAAI,GAAG,WAAW,KAAK,KAAK,SAAS,aAAa,CAAC,EAAG,QAAO;AAC7D,UAAM,SAAS,KAAK,QAAQ,OAAO;AACnC,QAAI,WAAW,QAAS,QAAO;AAC/B,cAAU;AAAA,EACZ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/mcp/tool-names.js
CHANGED
|
@@ -41,7 +41,16 @@ const KIROGRAPH_TOOL_NAMES = [
|
|
|
41
41
|
"kirograph_diff",
|
|
42
42
|
"kirograph_type_hierarchy",
|
|
43
43
|
"kirograph_exec",
|
|
44
|
-
"kirograph_gain"
|
|
44
|
+
"kirograph_gain",
|
|
45
|
+
"kirograph_mem_search",
|
|
46
|
+
"kirograph_mem_store",
|
|
47
|
+
"kirograph_mem_timeline",
|
|
48
|
+
"kirograph_mem_status",
|
|
49
|
+
"kirograph_docs_toc",
|
|
50
|
+
"kirograph_docs_search",
|
|
51
|
+
"kirograph_docs_section",
|
|
52
|
+
"kirograph_docs_outline",
|
|
53
|
+
"kirograph_docs_refs"
|
|
45
54
|
];
|
|
46
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
56
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mcp/tool-names.ts"],
|
|
4
|
-
"sourcesContent": ["export const KIROGRAPH_TOOL_NAMES = [\n 'kirograph_search',\n 'kirograph_context',\n 'kirograph_callers',\n 'kirograph_callees',\n 'kirograph_impact',\n 'kirograph_node',\n 'kirograph_status',\n 'kirograph_files',\n 'kirograph_dead_code',\n 'kirograph_circular_deps',\n 'kirograph_path',\n 'kirograph_architecture',\n 'kirograph_coupling',\n 'kirograph_package',\n 'kirograph_hotspots',\n 'kirograph_surprising',\n 'kirograph_diff',\n 'kirograph_type_hierarchy',\n 'kirograph_exec',\n 'kirograph_gain',\n];\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
4
|
+
"sourcesContent": ["export const KIROGRAPH_TOOL_NAMES = [\n 'kirograph_search',\n 'kirograph_context',\n 'kirograph_callers',\n 'kirograph_callees',\n 'kirograph_impact',\n 'kirograph_node',\n 'kirograph_status',\n 'kirograph_files',\n 'kirograph_dead_code',\n 'kirograph_circular_deps',\n 'kirograph_path',\n 'kirograph_architecture',\n 'kirograph_coupling',\n 'kirograph_package',\n 'kirograph_hotspots',\n 'kirograph_surprising',\n 'kirograph_diff',\n 'kirograph_type_hierarchy',\n 'kirograph_exec',\n 'kirograph_gain',\n 'kirograph_mem_search',\n 'kirograph_mem_store',\n 'kirograph_mem_timeline',\n 'kirograph_mem_status',\n 'kirograph_docs_toc',\n 'kirograph_docs_search',\n 'kirograph_docs_section',\n 'kirograph_docs_outline',\n 'kirograph_docs_refs',\n];\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|