kirograph 1.0.0 → 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/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/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/vulns.js +16 -1
- 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/steering.js +9 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/kirograph.js +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +2 -2
- package/dist/extraction/extractor.js +46 -41
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/notebook.js +15 -7
- package/dist/extraction/notebook.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 +17 -3
- package/dist/security/manifest/adapter.js.map +3 -3
- 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 +1 -1
- package/dist/security/pipeline.js.map +2 -2
- package/dist/security/reachability.js +54 -5
- package/dist/security/reachability.js.map +3 -3
- 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/osv-adapter.js +45 -1
- package/dist/security/vuln/osv-adapter.js.map +2 -2
- 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 +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
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 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,kEAA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