kirograph 0.28.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/architecture/index.js +4 -1
- package/dist/architecture/index.js.map +2 -2
- package/dist/architecture/manifest/index.js +13 -2
- package/dist/architecture/manifest/index.js.map +2 -2
- package/dist/architecture/manifest/python.js +2 -2
- package/dist/architecture/manifest/python.js.map +2 -2
- package/dist/bin/commands/help.js +3 -1
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/install.js +2 -1
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/memory.js +18 -8
- package/dist/bin/commands/memory.js.map +2 -2
- package/dist/bin/commands/reachability.js +7 -2
- package/dist/bin/commands/reachability.js.map +2 -2
- package/dist/bin/commands/status.js +2 -1
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/uninit.js +2 -1
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/vulns.js +26 -6
- package/dist/bin/commands/vulns.js.map +2 -2
- package/dist/bin/commands/wiki.js +56 -0
- package/dist/bin/commands/wiki.js.map +2 -2
- package/dist/bin/installer/common.js +7 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/detect.js +10 -0
- package/dist/bin/installer/detect.js.map +2 -2
- package/dist/bin/installer/hooks.js +13 -8
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/steering.js +9 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.js +1 -1
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/claude.js +1 -1
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/codex.js +1 -1
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/commandcode.js +84 -0
- package/dist/bin/installer/targets/commandcode.js.map +7 -0
- package/dist/bin/installer/targets/copilot.js +1 -1
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.js +2 -2
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.js +1 -1
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.js +1 -1
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/index.js +10 -0
- package/dist/bin/installer/targets/index.js.map +2 -2
- package/dist/bin/installer/targets/opencode.js +1 -1
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.js +1 -1
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +1 -1
- package/dist/bin/kirograph.js.map +1 -1
- package/dist/config.js +25 -1
- package/dist/config.js.map +2 -2
- package/dist/core/pipeline.js +18 -6
- package/dist/core/pipeline.js.map +2 -2
- package/dist/extraction/extractor.js +88 -26
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +38 -3
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/notebook.js +15 -7
- package/dist/extraction/notebook.js.map +2 -2
- package/dist/extraction/wasm/tree-sitter-bash.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-csharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-css.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elisp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elixir.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elm.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-embedded_template.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-embeddedtemplate.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-html.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-json.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-objc.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ocaml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ql.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rescript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-solidity.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-systemrdl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tlaplus.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-toml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vue.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-yaml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-zig.wasm +0 -0
- package/dist/frameworks/index.js +68 -7
- package/dist/frameworks/index.js.map +2 -2
- package/dist/jev/client.js +99 -0
- package/dist/jev/client.js.map +7 -0
- package/dist/jev/types.js +17 -0
- package/dist/jev/types.js.map +7 -0
- package/dist/mcp/handlers/memory.js +14 -8
- package/dist/mcp/handlers/memory.js.map +2 -2
- package/dist/mcp/handlers/security.js +5 -3
- package/dist/mcp/handlers/security.js.map +2 -2
- package/dist/mcp/tools.js +1 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/memory/index.js +13 -1
- package/dist/memory/index.js.map +3 -3
- package/dist/memory/relation-jev.js +59 -0
- package/dist/memory/relation-jev.js.map +7 -0
- package/dist/memory/schema.js +57 -0
- package/dist/memory/schema.js.map +7 -0
- package/dist/security/auth-detection-jev.js +47 -0
- package/dist/security/auth-detection-jev.js.map +7 -0
- package/dist/security/manifest/adapter.js +34 -5
- package/dist/security/manifest/adapter.js.map +3 -3
- package/dist/security/manifest/parser.js +2 -2
- package/dist/security/manifest/parser.js.map +2 -2
- package/dist/security/manifest/plugins/cargo.js +23 -0
- package/dist/security/manifest/plugins/cargo.js.map +2 -2
- package/dist/security/manifest/plugins/composer.js +12 -0
- package/dist/security/manifest/plugins/composer.js.map +2 -2
- package/dist/security/manifest/plugins/gradle.js +12 -0
- package/dist/security/manifest/plugins/gradle.js.map +2 -2
- package/dist/security/manifest/plugins/hex.js +12 -0
- package/dist/security/manifest/plugins/hex.js.map +2 -2
- package/dist/security/manifest/plugins/maven.js +68 -1
- package/dist/security/manifest/plugins/maven.js.map +2 -2
- package/dist/security/manifest/plugins/npm.js +86 -0
- package/dist/security/manifest/plugins/npm.js.map +2 -2
- package/dist/security/manifest/plugins/nuget.js +13 -0
- package/dist/security/manifest/plugins/nuget.js.map +2 -2
- package/dist/security/manifest/plugins/pubspec.js +12 -0
- package/dist/security/manifest/plugins/pubspec.js.map +2 -2
- package/dist/security/manifest/plugins/pyproject.js +12 -0
- package/dist/security/manifest/plugins/pyproject.js.map +2 -2
- package/dist/security/manifest/plugins/rubygems.js +12 -0
- package/dist/security/manifest/plugins/rubygems.js.map +2 -2
- package/dist/security/pipeline.js +5 -2
- package/dist/security/pipeline.js.map +2 -2
- package/dist/security/reachability.js +115 -50
- package/dist/security/reachability.js.map +2 -2
- package/dist/security/types.js.map +1 -1
- package/dist/security/vuln/client.js +45 -1
- package/dist/security/vuln/client.js.map +2 -2
- package/dist/security/vuln/epss-client.js +1 -1
- package/dist/security/vuln/epss-client.js.map +1 -1
- package/dist/security/vuln/osv-adapter.js +144 -32
- package/dist/security/vuln/osv-adapter.js.map +2 -2
- package/dist/sync/index.js +9 -2
- package/dist/sync/index.js.map +2 -2
- package/dist/vectors/libsql-index.js +287 -0
- package/dist/vectors/libsql-index.js.map +7 -0
- package/dist/vectors/turso-index.js +307 -0
- package/dist/vectors/turso-index.js.map +7 -0
- package/dist/wiki/contradiction-jev.js +49 -0
- package/dist/wiki/contradiction-jev.js.map +7 -0
- package/dist/wiki/index.js +13 -0
- package/dist/wiki/index.js.map +2 -2
- package/dist/wiki/ingest.js +2 -0
- package/dist/wiki/ingest.js.map +2 -2
- package/dist/wiki/links.js +53 -0
- package/dist/wiki/links.js.map +7 -0
- package/dist/wiki/lint.js +3 -6
- package/dist/wiki/lint.js.map +2 -2
- package/dist/wiki/rename.js +103 -0
- package/dist/wiki/rename.js.map +7 -0
- package/package.json +3 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wiki/links.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Wiki \u2014 Link graph\n *\n * Read-only queries over the `[[slug]]` cross-reference graph between wiki\n * pages. Shared by lint.ts (broken-link/orphan detection) and the\n * `kirograph wiki links`/`wiki rename` CLI commands.\n */\n\nimport type { WikiDatabase } from './database';\n\nexport const WIKI_LINK_RE = /\\[\\[([^\\]]+)\\]\\]/g;\n\n/** Distinct slugs referenced via `[[slug]]` in `content`, in order of first appearance. */\nexport function extractLinks(content: string): string[] {\n const seen = new Set<string>();\n const re = new RegExp(WIKI_LINK_RE.source, 'g');\n let m: RegExpExecArray | null;\n while ((m = re.exec(content)) !== null) {\n seen.add(m[1].trim());\n }\n return [...seen];\n}\n\nexport interface WikiPageLinks {\n /** Slugs this page links to that exist. */\n outgoing: string[];\n /** Slugs this page links to that don't exist as a page. */\n broken: string[];\n /** Slugs of other pages that link to this one. */\n incoming: string[];\n}\n\n/**\n * Outgoing/broken/incoming `[[slug]]` links for one page.\n * Returns null if the slug isn't a known page.\n */\nexport function getPageLinks(wikiDb: WikiDatabase, slug: string): WikiPageLinks | null {\n const page = wikiDb.getPage(slug);\n if (!page) return null;\n\n const pages = wikiDb.listPages();\n const slugSet = new Set(pages.map(p => p.slug));\n\n const linked = extractLinks(page.content);\n const outgoing = linked.filter(s => slugSet.has(s));\n const broken = linked.filter(s => !slugSet.has(s));\n\n const incoming = pages\n .filter(p => p.slug !== slug && extractLinks(p.content).includes(slug))\n .map(p => p.slug);\n\n return { outgoing, broken, incoming };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,eAAe;AAGrB,SAAS,aAAa,SAA2B;AACtD,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,KAAK,IAAI,OAAO,aAAa,QAAQ,GAAG;AAC9C,MAAI;AACJ,UAAQ,IAAI,GAAG,KAAK,OAAO,OAAO,MAAM;AACtC,SAAK,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC;AAAA,EACtB;AACA,SAAO,CAAC,GAAG,IAAI;AACjB;AAeO,SAAS,aAAa,QAAsB,MAAoC;AACrF,QAAM,OAAO,OAAO,QAAQ,IAAI;AAChC,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,QAAQ,OAAO,UAAU;AAC/B,QAAM,UAAU,IAAI,IAAI,MAAM,IAAI,OAAK,EAAE,IAAI,CAAC;AAE9C,QAAM,SAAS,aAAa,KAAK,OAAO;AACxC,QAAM,WAAW,OAAO,OAAO,OAAK,QAAQ,IAAI,CAAC,CAAC;AAClD,QAAM,SAAS,OAAO,OAAO,OAAK,CAAC,QAAQ,IAAI,CAAC,CAAC;AAEjD,QAAM,WAAW,MACd,OAAO,OAAK,EAAE,SAAS,QAAQ,aAAa,EAAE,OAAO,EAAE,SAAS,IAAI,CAAC,EACrE,IAAI,OAAK,EAAE,IAAI;AAElB,SAAO,EAAE,UAAU,QAAQ,SAAS;AACtC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/wiki/lint.js
CHANGED
|
@@ -21,16 +21,13 @@ __export(lint_exports, {
|
|
|
21
21
|
lintWiki: () => lintWiki
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(lint_exports);
|
|
24
|
-
|
|
24
|
+
var import_links = require("./links");
|
|
25
25
|
function lintWiki(wikiDb) {
|
|
26
26
|
const issues = [];
|
|
27
27
|
const pages = wikiDb.listPages();
|
|
28
28
|
const slugSet = new Set(pages.map((p) => p.slug));
|
|
29
29
|
for (const page of pages) {
|
|
30
|
-
|
|
31
|
-
const re = new RegExp(LINK_RE.source, "g");
|
|
32
|
-
while ((m = re.exec(page.content)) !== null) {
|
|
33
|
-
const linked = m[1].trim();
|
|
30
|
+
for (const linked of (0, import_links.extractLinks)(page.content)) {
|
|
34
31
|
if (!slugSet.has(linked)) {
|
|
35
32
|
issues.push({
|
|
36
33
|
kind: "broken_link",
|
|
@@ -41,7 +38,7 @@ function lintWiki(wikiDb) {
|
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
const hasRelated = /^## Related/m.test(page.content);
|
|
44
|
-
const hasIncoming = pages.some((p) => p.slug !== page.slug && p.content.includes(
|
|
41
|
+
const hasIncoming = pages.some((p) => p.slug !== page.slug && (0, import_links.extractLinks)(p.content).includes(page.slug));
|
|
45
42
|
if (!hasRelated && !hasIncoming && pages.length > 1) {
|
|
46
43
|
issues.push({
|
|
47
44
|
kind: "orphan",
|
package/dist/wiki/lint.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wiki/lint.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Wiki \u2014 Lint\n *\n * Health checks: contradictions (FTS similarity), orphan pages,\n * broken [[slug]] cross-references.\n */\n\nimport * as path from 'path';\nimport type { WikiLintIssue } from './types';\nimport type { WikiDatabase } from './database';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Wiki \u2014 Lint\n *\n * Health checks: contradictions (FTS similarity), orphan pages,\n * broken [[slug]] cross-references.\n */\n\nimport * as path from 'path';\nimport type { WikiLintIssue } from './types';\nimport type { WikiDatabase } from './database';\nimport { extractLinks } from './links';\n\nexport function lintWiki(wikiDb: WikiDatabase): WikiLintIssue[] {\n const issues: WikiLintIssue[] = [];\n const pages = wikiDb.listPages();\n const slugSet = new Set(pages.map(p => p.slug));\n\n for (const page of pages) {\n // Broken [[slug]] links\n for (const linked of extractLinks(page.content)) {\n if (!slugSet.has(linked)) {\n issues.push({\n kind: 'broken_link',\n slug: page.slug,\n detail: `Broken link to [[${linked}]] \u2014 page does not exist`,\n relatedSlug: linked,\n });\n }\n }\n\n // Orphan: no ## Related section and no incoming links from other pages\n const hasRelated = /^## Related/m.test(page.content);\n const hasIncoming = pages.some(p => p.slug !== page.slug && extractLinks(p.content).includes(page.slug));\n if (!hasRelated && !hasIncoming && pages.length > 1) {\n issues.push({\n kind: 'orphan',\n slug: page.slug,\n detail: 'Page has no ## Related section and no incoming links from other pages',\n });\n }\n\n // Stale: ## Sources section present but no date found (can't verify freshness)\n const sourcesMatch = page.content.match(/## Sources\\n([\\s\\S]*?)(?=\\n## |\\n*$)/);\n if (sourcesMatch) {\n const sourcesBlock = sourcesMatch[1];\n const hasDates = /\\d{4}-\\d{2}-\\d{2}/.test(sourcesBlock);\n if (!hasDates) {\n issues.push({\n kind: 'stale',\n slug: page.slug,\n detail: '## Sources section has no dates \u2014 cannot verify freshness',\n });\n }\n }\n\n // Contradictions: FTS similarity with other pages on the same topic\n // Simple heuristic: search for the page title and flag pages with conflicting signals\n const similar = wikiDb.search(page.title, 5);\n for (const { page: other } of similar) {\n if (other.slug === page.slug) continue;\n // Check for negation keywords close to shared terms\n const contradictionSignals = ['instead of', 'not', 'replaced by', 'superseded', 'deprecated'];\n const bothMentionSignal = contradictionSignals.some(\n sig => page.content.toLowerCase().includes(sig) && other.content.toLowerCase().includes(sig)\n );\n if (bothMentionSignal) {\n const key = [page.slug, other.slug].sort().join('|');\n const alreadyReported = issues.some(\n i => i.kind === 'contradiction' && i.detail.includes(other.slug)\n );\n if (!alreadyReported) {\n issues.push({\n kind: 'contradiction',\n slug: page.slug,\n detail: `Possible contradiction with [[${other.slug}]] \u2014 both pages contain negation signals on shared topics`,\n relatedSlug: other.slug,\n });\n }\n }\n }\n }\n\n return issues;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,mBAA6B;AAEtB,SAAS,SAAS,QAAuC;AAC9D,QAAM,SAA0B,CAAC;AACjC,QAAM,QAAQ,OAAO,UAAU;AAC/B,QAAM,UAAU,IAAI,IAAI,MAAM,IAAI,OAAK,EAAE,IAAI,CAAC;AAE9C,aAAW,QAAQ,OAAO;AAExB,eAAW,cAAU,2BAAa,KAAK,OAAO,GAAG;AAC/C,UAAI,CAAC,QAAQ,IAAI,MAAM,GAAG;AACxB,eAAO,KAAK;AAAA,UACV,MAAM;AAAA,UACN,MAAM,KAAK;AAAA,UACX,QAAQ,oBAAoB,MAAM;AAAA,UAClC,aAAa;AAAA,QACf,CAAC;AAAA,MACH;AAAA,IACF;AAGA,UAAM,aAAa,eAAe,KAAK,KAAK,OAAO;AACnD,UAAM,cAAc,MAAM,KAAK,OAAK,EAAE,SAAS,KAAK,YAAQ,2BAAa,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;AACvG,QAAI,CAAC,cAAc,CAAC,eAAe,MAAM,SAAS,GAAG;AACnD,aAAO,KAAK;AAAA,QACV,M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ineProperty;
|
|
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 rename_exports = {};
|
|
30
|
+
__export(rename_exports, {
|
|
31
|
+
renamePage: () => renamePage
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(rename_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var import_ingest = require("./ingest");
|
|
37
|
+
var import_links = require("./links");
|
|
38
|
+
function escapeRegExp(s) {
|
|
39
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
40
|
+
}
|
|
41
|
+
function renamePage(wikiDir, wikiDb, fromSlug, toSlug) {
|
|
42
|
+
if (fromSlug === toSlug) {
|
|
43
|
+
throw new Error("New slug is the same as the current slug");
|
|
44
|
+
}
|
|
45
|
+
const page = wikiDb.getPage(fromSlug);
|
|
46
|
+
if (!page) {
|
|
47
|
+
throw new Error(`Wiki page "${fromSlug}" not found`);
|
|
48
|
+
}
|
|
49
|
+
if (wikiDb.getPage(toSlug)) {
|
|
50
|
+
throw new Error(`Wiki page "${toSlug}" already exists \u2014 pick a different slug or delete it first`);
|
|
51
|
+
}
|
|
52
|
+
const fromPath = path.join(wikiDir, (0, import_ingest.slugToFilePath)(fromSlug));
|
|
53
|
+
const toPath = path.join(wikiDir, (0, import_ingest.slugToFilePath)(toSlug));
|
|
54
|
+
if (!fs.existsSync(fromPath)) {
|
|
55
|
+
throw new Error(`File for "${fromSlug}" not found on disk at ${fromPath} \u2014 run \`kirograph wiki reindex\` to resync`);
|
|
56
|
+
}
|
|
57
|
+
if (fs.existsSync(toPath)) {
|
|
58
|
+
throw new Error(`Target file already exists at ${toPath}`);
|
|
59
|
+
}
|
|
60
|
+
fs.mkdirSync(path.dirname(toPath), { recursive: true });
|
|
61
|
+
fs.renameSync(fromPath, toPath);
|
|
62
|
+
removeIfEmpty(path.dirname(fromPath), wikiDir);
|
|
63
|
+
wikiDb.deletePage(fromSlug);
|
|
64
|
+
wikiDb.upsertPage({
|
|
65
|
+
slug: toSlug,
|
|
66
|
+
title: page.title,
|
|
67
|
+
content: fs.readFileSync(toPath, "utf8"),
|
|
68
|
+
filePath: path.relative(wikiDir, toPath),
|
|
69
|
+
sourceCount: page.sourceCount
|
|
70
|
+
});
|
|
71
|
+
const linkRe = new RegExp(`\\[\\[\\s*${escapeRegExp(fromSlug)}\\s*\\]\\]`, "g");
|
|
72
|
+
const linksUpdated = [];
|
|
73
|
+
for (const p of wikiDb.listPages()) {
|
|
74
|
+
if (!(0, import_links.extractLinks)(p.content).includes(fromSlug)) continue;
|
|
75
|
+
const absPath = path.join(wikiDir, (0, import_ingest.slugToFilePath)(p.slug));
|
|
76
|
+
const current = fs.readFileSync(absPath, "utf8");
|
|
77
|
+
const rewritten = current.replace(linkRe, `[[${toSlug}]]`);
|
|
78
|
+
if (rewritten === current) continue;
|
|
79
|
+
fs.writeFileSync(absPath, rewritten, "utf8");
|
|
80
|
+
wikiDb.upsertPage({
|
|
81
|
+
slug: p.slug,
|
|
82
|
+
title: p.title,
|
|
83
|
+
content: rewritten,
|
|
84
|
+
filePath: p.filePath,
|
|
85
|
+
sourceCount: 0
|
|
86
|
+
});
|
|
87
|
+
if (p.slug !== toSlug) linksUpdated.push(p.slug);
|
|
88
|
+
}
|
|
89
|
+
(0, import_ingest.updateManifest)(wikiDir, wikiDb);
|
|
90
|
+
return { from: fromSlug, to: toSlug, linksUpdated };
|
|
91
|
+
}
|
|
92
|
+
function removeIfEmpty(dir, wikiDir) {
|
|
93
|
+
if (path.resolve(dir) === path.resolve(wikiDir)) return;
|
|
94
|
+
try {
|
|
95
|
+
if (fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
renamePage
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=rename.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wiki/rename.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Wiki \u2014 Rename\n *\n * Renames a page's slug: moves its file on disk and rewrites every\n * `[[oldSlug]]` reference across the wiki (including the page's own\n * content, for hub pages that link to themselves) to `[[newSlug]]`.\n * The IWE-inspired \"rename with automatic link updates\" refactor, ported\n * to the CLI rather than an LSP rename action.\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { WikiDatabase } from './database';\nimport { slugToFilePath, updateManifest } from './ingest';\nimport { extractLinks } from './links';\n\nexport interface RenamePageResult {\n from: string;\n to: string;\n /** Other pages whose [[from]] links were rewritten to [[to]]. */\n linksUpdated: string[];\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function renamePage(\n wikiDir: string,\n wikiDb: WikiDatabase,\n fromSlug: string,\n toSlug: string,\n): RenamePageResult {\n if (fromSlug === toSlug) {\n throw new Error('New slug is the same as the current slug');\n }\n\n const page = wikiDb.getPage(fromSlug);\n if (!page) {\n throw new Error(`Wiki page \"${fromSlug}\" not found`);\n }\n if (wikiDb.getPage(toSlug)) {\n throw new Error(`Wiki page \"${toSlug}\" already exists \u2014 pick a different slug or delete it first`);\n }\n\n const fromPath = path.join(wikiDir, slugToFilePath(fromSlug));\n const toPath = path.join(wikiDir, slugToFilePath(toSlug));\n if (!fs.existsSync(fromPath)) {\n throw new Error(`File for \"${fromSlug}\" not found on disk at ${fromPath} \u2014 run \\`kirograph wiki reindex\\` to resync`);\n }\n if (fs.existsSync(toPath)) {\n throw new Error(`Target file already exists at ${toPath}`);\n }\n\n // Move the file\n fs.mkdirSync(path.dirname(toPath), { recursive: true });\n fs.renameSync(fromPath, toPath);\n removeIfEmpty(path.dirname(fromPath), wikiDir);\n\n // Reindex: drop the old slug, insert the new one under the moved path.\n wikiDb.deletePage(fromSlug);\n wikiDb.upsertPage({\n slug: toSlug,\n title: page.title,\n content: fs.readFileSync(toPath, 'utf8'),\n filePath: path.relative(wikiDir, toPath),\n sourceCount: page.sourceCount,\n });\n\n // Rewrite every [[fromSlug]] reference across the wiki \u2014 including the\n // renamed page's own content, in case it links to itself (hub pages).\n const linkRe = new RegExp(`\\\\[\\\\[\\\\s*${escapeRegExp(fromSlug)}\\\\s*\\\\]\\\\]`, 'g');\n const linksUpdated: string[] = [];\n\n for (const p of wikiDb.listPages()) {\n if (!extractLinks(p.content).includes(fromSlug)) continue;\n\n const absPath = path.join(wikiDir, slugToFilePath(p.slug));\n const current = fs.readFileSync(absPath, 'utf8');\n const rewritten = current.replace(linkRe, `[[${toSlug}]]`);\n if (rewritten === current) continue;\n\n fs.writeFileSync(absPath, rewritten, 'utf8');\n wikiDb.upsertPage({\n slug: p.slug,\n title: p.title,\n content: rewritten,\n filePath: p.filePath,\n sourceCount: 0,\n });\n if (p.slug !== toSlug) linksUpdated.push(p.slug);\n }\n\n updateManifest(wikiDir, wikiDb);\n\n return { from: fromSlug, to: toSlug, linksUpdated };\n}\n\n/** Best-effort cleanup of a now-empty directory left behind by a nested-slug move. Never removes wikiDir itself. */\nfunction removeIfEmpty(dir: string, wikiDir: string): void {\n if (path.resolve(dir) === path.resolve(wikiDir)) return;\n try {\n if (fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);\n } catch {\n // Not empty, doesn't exist, or a permissions issue \u2014 leave it.\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,SAAoB;AACpB,WAAsB;AAEtB,oBAA+C;AAC/C,mBAA6B;AAS7B,SAAS,aAAa,GAAmB;AACvC,SAAO,EAAE,QAAQ,uBAAuB,MAAM;AAChD;AAEO,SAAS,WACd,SACA,QACA,UACA,QACkB;AAClB,MAAI,aAAa,QAAQ;AACvB,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAEA,QAAM,OAAO,OAAO,QAAQ,QAAQ;AACpC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,cAAc,QAAQ,aAAa;AAAA,EACrD;AACA,MAAI,OAAO,QAAQ,MAAM,GAAG;AAC1B,UAAM,IAAI,MAAM,cAAc,MAAM,kEAA6D;AAAA,EACnG;AAEA,QAAM,WAAW,KAAK,KAAK,aAAS,8BAAe,QAAQ,CAAC;AAC5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;AAAA,EACjD;AAEA,oCAAe,SAAS,MAAM;AAE9B,SAAO,EAAE,MAAM,UAAU,IAAI,QAAQ,aAAa;AACpD;AAGA,SAAS,cAAc,KAAa,SAAuB;AACzD,MAAI,KAAK,QAAQ,GAAG,MAAM,KAAK,QAAQ,OAAO,EAAG;AACjD,MAAI;AACF,QAAI,GAAG,YAAY,GAAG,EAAE,WAAW,EAAG,IAAG,UAAU,GAAG;AAAA,EACxD,QAAQ;AAAA,EAER;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirograph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Semantic code knowledge graph for Kiro: fewer tool calls, instant symbol lookups, 100% local.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"test:git": "bash test/git/test.sh",
|
|
26
26
|
"test:graph": "bash test/graph/test.sh",
|
|
27
27
|
"test:health": "bash test/health/test.sh",
|
|
28
|
+
"test:hooks": "bash test/hooks/test.sh",
|
|
28
29
|
"test:insights": "bash test/insights/test.sh",
|
|
29
30
|
"test:mem": "bash test/mem/test.sh",
|
|
30
31
|
"test:patterns": "bash test/patterns/test.sh",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"test:watchmen": "bash test/watchmen/test.sh",
|
|
35
36
|
"test:watchmen:skip-llm": "bash test/watchmen/test.sh --skip-llm",
|
|
36
37
|
"test:wiki": "bash test/wiki/test.sh",
|
|
37
|
-
"test:integration": "bash test/agent/test.sh --no-build && bash test/architecture/test.sh --no-build && bash test/branch/test.sh --no-build && bash test/data/test.sh --no-build && bash test/edit/test.sh --no-build && bash test/git/test.sh --no-build && bash test/graph/test.sh --no-build && bash test/health/test.sh --no-build && bash test/insights/test.sh --no-build && bash test/mem/test.sh --no-build && bash test/patterns/test.sh --no-build && bash test/security/test.sh --no-build && bash test/turboquant/test.sh --no-build && bash test/turbovec/test.sh --no-build && bash test/watchmen/test.sh --no-build --skip-llm && bash test/wiki/test.sh --no-build",
|
|
38
|
+
"test:integration": "bash test/agent/test.sh --no-build && bash test/architecture/test.sh --no-build && bash test/branch/test.sh --no-build && bash test/data/test.sh --no-build && bash test/edit/test.sh --no-build && bash test/git/test.sh --no-build && bash test/graph/test.sh --no-build && bash test/health/test.sh --no-build && bash test/hooks/test.sh --no-build && bash test/insights/test.sh --no-build && bash test/mem/test.sh --no-build && bash test/patterns/test.sh --no-build && bash test/security/test.sh --no-build && bash test/turboquant/test.sh --no-build && bash test/turbovec/test.sh --no-build && bash test/watchmen/test.sh --no-build --skip-llm && bash test/wiki/test.sh --no-build",
|
|
38
39
|
"test:agent:mcp": "bash test/agent/mcp.sh",
|
|
39
40
|
"test:architecture:mcp": "bash test/architecture/mcp.sh",
|
|
40
41
|
"test:branch:mcp": "bash test/branch/mcp.sh",
|