@weavelogic/knowledge-graph-agent 0.1.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/README.md +264 -0
- package/dist/cli/bin.d.ts +8 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/claude.d.ts +11 -0
- package/dist/cli/commands/claude.d.ts.map +1 -0
- package/dist/cli/commands/claude.js +102 -0
- package/dist/cli/commands/claude.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +11 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +108 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +11 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +122 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +80 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/search.d.ts +11 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +80 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +11 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +84 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +11 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +76 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +45 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/database.d.ts +121 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +470 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/graph.d.ts +109 -0
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/core/graph.js +343 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/security.d.ts +62 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js +31 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/types.d.ts +232 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +37 -0
- package/dist/core/types.js.map +1 -0
- package/dist/generators/claude-md.d.ts +33 -0
- package/dist/generators/claude-md.d.ts.map +1 -0
- package/dist/generators/claude-md.js +410 -0
- package/dist/generators/claude-md.js.map +1 -0
- package/dist/generators/docs-init.d.ts +20 -0
- package/dist/generators/docs-init.d.ts.map +1 -0
- package/dist/generators/docs-init.js +625 -0
- package/dist/generators/docs-init.js.map +1 -0
- package/dist/generators/graph-generator.d.ts +41 -0
- package/dist/generators/graph-generator.d.ts.map +1 -0
- package/dist/generators/graph-generator.js +266 -0
- package/dist/generators/graph-generator.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/claude-flow.d.ts +62 -0
- package/dist/integrations/claude-flow.d.ts.map +1 -0
- package/dist/integrations/claude-flow.js +243 -0
- package/dist/integrations/claude-flow.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
class ClaudeFlowIntegration {
|
|
2
|
+
config;
|
|
3
|
+
constructor(config) {
|
|
4
|
+
this.config = {
|
|
5
|
+
namespace: config.namespace,
|
|
6
|
+
defaultTTL: config.defaultTTL || 0,
|
|
7
|
+
syncOnChange: config.syncOnChange ?? true
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Sync all nodes to claude-flow memory
|
|
12
|
+
*/
|
|
13
|
+
async syncToMemory(db) {
|
|
14
|
+
const result = {
|
|
15
|
+
synced: 0,
|
|
16
|
+
failed: 0,
|
|
17
|
+
errors: []
|
|
18
|
+
};
|
|
19
|
+
const nodes = db.getAllNodes();
|
|
20
|
+
const entries = [];
|
|
21
|
+
for (const node of nodes) {
|
|
22
|
+
try {
|
|
23
|
+
const entry = this.nodeToMemoryEntry(node);
|
|
24
|
+
entries.push({
|
|
25
|
+
key: `node/${node.id}`,
|
|
26
|
+
value: entry,
|
|
27
|
+
namespace: this.config.namespace,
|
|
28
|
+
ttl: this.config.defaultTTL
|
|
29
|
+
});
|
|
30
|
+
} catch (error) {
|
|
31
|
+
result.failed++;
|
|
32
|
+
result.errors.push({
|
|
33
|
+
key: node.id,
|
|
34
|
+
error: String(error)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const stats = db.getStats();
|
|
39
|
+
entries.push({
|
|
40
|
+
key: "stats",
|
|
41
|
+
value: stats,
|
|
42
|
+
namespace: this.config.namespace
|
|
43
|
+
});
|
|
44
|
+
entries.push({
|
|
45
|
+
key: "metadata",
|
|
46
|
+
value: {
|
|
47
|
+
lastSync: (/* @__PURE__ */ new Date()).toISOString(),
|
|
48
|
+
nodeCount: nodes.length,
|
|
49
|
+
version: db.getMetadata("version")
|
|
50
|
+
},
|
|
51
|
+
namespace: this.config.namespace
|
|
52
|
+
});
|
|
53
|
+
entries.push({
|
|
54
|
+
key: "index/nodes",
|
|
55
|
+
value: nodes.map((n) => ({
|
|
56
|
+
id: n.id,
|
|
57
|
+
title: n.title,
|
|
58
|
+
type: n.type,
|
|
59
|
+
path: n.path
|
|
60
|
+
})),
|
|
61
|
+
namespace: this.config.namespace
|
|
62
|
+
});
|
|
63
|
+
const tagIndex = this.buildTagIndex(nodes);
|
|
64
|
+
entries.push({
|
|
65
|
+
key: "index/tags",
|
|
66
|
+
value: tagIndex,
|
|
67
|
+
namespace: this.config.namespace
|
|
68
|
+
});
|
|
69
|
+
result.synced = entries.length;
|
|
70
|
+
console.log(`
|
|
71
|
+
[Claude-Flow Sync] Would sync ${entries.length} entries to namespace: ${this.config.namespace}`);
|
|
72
|
+
console.log("\nTo sync, run these MCP commands:");
|
|
73
|
+
for (const entry of entries.slice(0, 5)) {
|
|
74
|
+
console.log(`mcp__claude-flow__memory_usage { action: "store", key: "${entry.key}", namespace: "${this.config.namespace}", value: "..." }`);
|
|
75
|
+
}
|
|
76
|
+
if (entries.length > 5) {
|
|
77
|
+
console.log(`... and ${entries.length - 5} more entries`);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sync a single node to memory
|
|
83
|
+
*/
|
|
84
|
+
async syncNode(node) {
|
|
85
|
+
try {
|
|
86
|
+
const entry = this.nodeToMemoryEntry(node);
|
|
87
|
+
console.log(`
|
|
88
|
+
[Claude-Flow Sync] Syncing node: ${node.id}`);
|
|
89
|
+
console.log(`mcp__claude-flow__memory_usage {`);
|
|
90
|
+
console.log(` action: "store",`);
|
|
91
|
+
console.log(` key: "node/${node.id}",`);
|
|
92
|
+
console.log(` namespace: "${this.config.namespace}",`);
|
|
93
|
+
console.log(` value: ${JSON.stringify(entry, null, 2)}`);
|
|
94
|
+
console.log(`}`);
|
|
95
|
+
return true;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error(`Failed to sync node ${node.id}: ${error}`);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Generate memory retrieval commands
|
|
103
|
+
*/
|
|
104
|
+
generateRetrievalCommands() {
|
|
105
|
+
return [
|
|
106
|
+
`// Get graph stats`,
|
|
107
|
+
`mcp__claude-flow__memory_usage { action: "retrieve", key: "stats", namespace: "${this.config.namespace}" }`,
|
|
108
|
+
``,
|
|
109
|
+
`// Get node index`,
|
|
110
|
+
`mcp__claude-flow__memory_usage { action: "retrieve", key: "index/nodes", namespace: "${this.config.namespace}" }`,
|
|
111
|
+
``,
|
|
112
|
+
`// Get specific node`,
|
|
113
|
+
`mcp__claude-flow__memory_usage { action: "retrieve", key: "node/<node-id>", namespace: "${this.config.namespace}" }`,
|
|
114
|
+
``,
|
|
115
|
+
`// Search by pattern`,
|
|
116
|
+
`mcp__claude-flow__memory_search { pattern: "node/*", namespace: "${this.config.namespace}" }`
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generate hook commands for automatic sync
|
|
121
|
+
*/
|
|
122
|
+
generateHookCommands() {
|
|
123
|
+
return [
|
|
124
|
+
`# Pre-task hook to restore graph context`,
|
|
125
|
+
`npx claude-flow@alpha hooks session-restore --session-id "kg-${this.config.namespace}"`,
|
|
126
|
+
``,
|
|
127
|
+
`# Post-edit hook to sync changes`,
|
|
128
|
+
`npx claude-flow@alpha hooks post-edit --file "<file>" --memory-key "kg/${this.config.namespace}/changes"`,
|
|
129
|
+
``,
|
|
130
|
+
`# Session end hook to persist`,
|
|
131
|
+
`npx claude-flow@alpha hooks session-end --export-metrics true`
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Convert node to memory entry format
|
|
136
|
+
*/
|
|
137
|
+
nodeToMemoryEntry(node) {
|
|
138
|
+
const summary = this.extractSummary(node.content);
|
|
139
|
+
return {
|
|
140
|
+
id: node.id,
|
|
141
|
+
title: node.title,
|
|
142
|
+
type: node.type,
|
|
143
|
+
status: node.status,
|
|
144
|
+
path: node.path,
|
|
145
|
+
tags: node.tags,
|
|
146
|
+
outgoingLinks: node.outgoingLinks.map((l) => l.target),
|
|
147
|
+
incomingLinks: node.incomingLinks.map((l) => l.target),
|
|
148
|
+
summary,
|
|
149
|
+
lastModified: node.lastModified.toISOString()
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Extract summary from content
|
|
154
|
+
*/
|
|
155
|
+
extractSummary(content, maxLength = 200) {
|
|
156
|
+
const lines = content.split("\n");
|
|
157
|
+
let summary = "";
|
|
158
|
+
for (const line of lines) {
|
|
159
|
+
const trimmed = line.trim();
|
|
160
|
+
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith("```")) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (trimmed === "---") {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
summary = trimmed;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
if (summary.length > maxLength) {
|
|
170
|
+
summary = summary.slice(0, maxLength - 3) + "...";
|
|
171
|
+
}
|
|
172
|
+
return summary;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Build tag index from nodes
|
|
176
|
+
*/
|
|
177
|
+
buildTagIndex(nodes) {
|
|
178
|
+
const index = {};
|
|
179
|
+
for (const node of nodes) {
|
|
180
|
+
for (const tag of node.tags) {
|
|
181
|
+
if (!index[tag]) {
|
|
182
|
+
index[tag] = [];
|
|
183
|
+
}
|
|
184
|
+
index[tag].push(node.id);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return index;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function createClaudeFlowIntegration(config) {
|
|
191
|
+
return new ClaudeFlowIntegration(config);
|
|
192
|
+
}
|
|
193
|
+
function generateMcpConfig(namespace) {
|
|
194
|
+
return `## Claude-Flow MCP Configuration
|
|
195
|
+
|
|
196
|
+
Add this to your Claude Code configuration:
|
|
197
|
+
|
|
198
|
+
\`\`\`bash
|
|
199
|
+
claude mcp add claude-flow npx claude-flow@alpha mcp start
|
|
200
|
+
\`\`\`
|
|
201
|
+
|
|
202
|
+
### Memory Namespace
|
|
203
|
+
|
|
204
|
+
The knowledge graph uses namespace: \`${namespace}\`
|
|
205
|
+
|
|
206
|
+
### Available Operations
|
|
207
|
+
|
|
208
|
+
\`\`\`javascript
|
|
209
|
+
// Store knowledge
|
|
210
|
+
mcp__claude-flow__memory_usage {
|
|
211
|
+
action: "store",
|
|
212
|
+
key: "node/<id>",
|
|
213
|
+
namespace: "${namespace}",
|
|
214
|
+
value: { ... }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Retrieve knowledge
|
|
218
|
+
mcp__claude-flow__memory_usage {
|
|
219
|
+
action: "retrieve",
|
|
220
|
+
key: "node/<id>",
|
|
221
|
+
namespace: "${namespace}"
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Search knowledge
|
|
225
|
+
mcp__claude-flow__memory_search {
|
|
226
|
+
pattern: "node/*",
|
|
227
|
+
namespace: "${namespace}"
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// List all keys
|
|
231
|
+
mcp__claude-flow__memory_usage {
|
|
232
|
+
action: "list",
|
|
233
|
+
namespace: "${namespace}"
|
|
234
|
+
}
|
|
235
|
+
\`\`\`
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
export {
|
|
239
|
+
ClaudeFlowIntegration,
|
|
240
|
+
createClaudeFlowIntegration,
|
|
241
|
+
generateMcpConfig
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=claude-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-flow.js","sources":["../../src/integrations/claude-flow.ts"],"sourcesContent":["/**\n * Claude-Flow Integration\n *\n * Integrates knowledge graph with claude-flow memory and coordination.\n */\n\nimport type {\n KnowledgeNode,\n GraphStats,\n MemoryEntry,\n SyncResult,\n} from '../core/types.js';\nimport { KnowledgeGraphDatabase } from '../core/database.js';\n\n/**\n * Claude-Flow client configuration\n */\nexport interface ClaudeFlowConfig {\n namespace: string;\n defaultTTL?: number;\n syncOnChange?: boolean;\n}\n\n/**\n * Memory entry for knowledge graph node\n */\ninterface NodeMemoryEntry {\n id: string;\n title: string;\n type: string;\n status: string;\n path: string;\n tags: string[];\n outgoingLinks: string[];\n incomingLinks: string[];\n summary?: string;\n lastModified: string;\n}\n\n/**\n * Claude-Flow Knowledge Graph Integration\n *\n * Syncs knowledge graph data with claude-flow memory for\n * cross-session persistence and agent coordination.\n */\nexport class ClaudeFlowIntegration {\n private config: Required<ClaudeFlowConfig>;\n\n constructor(config: ClaudeFlowConfig) {\n this.config = {\n namespace: config.namespace,\n defaultTTL: config.defaultTTL || 0,\n syncOnChange: config.syncOnChange ?? true,\n };\n }\n\n /**\n * Sync all nodes to claude-flow memory\n */\n async syncToMemory(db: KnowledgeGraphDatabase): Promise<SyncResult> {\n const result: SyncResult = {\n synced: 0,\n failed: 0,\n errors: [],\n };\n\n const nodes = db.getAllNodes();\n const entries: MemoryEntry[] = [];\n\n // Convert nodes to memory entries\n for (const node of nodes) {\n try {\n const entry = this.nodeToMemoryEntry(node);\n entries.push({\n key: `node/${node.id}`,\n value: entry,\n namespace: this.config.namespace,\n ttl: this.config.defaultTTL,\n });\n } catch (error) {\n result.failed++;\n result.errors.push({\n key: node.id,\n error: String(error),\n });\n }\n }\n\n // Store graph stats\n const stats = db.getStats();\n entries.push({\n key: 'stats',\n value: stats,\n namespace: this.config.namespace,\n });\n\n // Store metadata\n entries.push({\n key: 'metadata',\n value: {\n lastSync: new Date().toISOString(),\n nodeCount: nodes.length,\n version: db.getMetadata('version'),\n },\n namespace: this.config.namespace,\n });\n\n // Store index of all node IDs for quick lookup\n entries.push({\n key: 'index/nodes',\n value: nodes.map(n => ({\n id: n.id,\n title: n.title,\n type: n.type,\n path: n.path,\n })),\n namespace: this.config.namespace,\n });\n\n // Store tag index\n const tagIndex = this.buildTagIndex(nodes);\n entries.push({\n key: 'index/tags',\n value: tagIndex,\n namespace: this.config.namespace,\n });\n\n // Log what would be synced (MCP call would happen here)\n result.synced = entries.length;\n\n // Generate MCP commands for actual sync\n console.log(`\\n[Claude-Flow Sync] Would sync ${entries.length} entries to namespace: ${this.config.namespace}`);\n console.log('\\nTo sync, run these MCP commands:');\n\n for (const entry of entries.slice(0, 5)) {\n console.log(`mcp__claude-flow__memory_usage { action: \"store\", key: \"${entry.key}\", namespace: \"${this.config.namespace}\", value: \"...\" }`);\n }\n\n if (entries.length > 5) {\n console.log(`... and ${entries.length - 5} more entries`);\n }\n\n return result;\n }\n\n /**\n * Sync a single node to memory\n */\n async syncNode(node: KnowledgeNode): Promise<boolean> {\n try {\n const entry = this.nodeToMemoryEntry(node);\n\n // Generate MCP command\n console.log(`\\n[Claude-Flow Sync] Syncing node: ${node.id}`);\n console.log(`mcp__claude-flow__memory_usage {`);\n console.log(` action: \"store\",`);\n console.log(` key: \"node/${node.id}\",`);\n console.log(` namespace: \"${this.config.namespace}\",`);\n console.log(` value: ${JSON.stringify(entry, null, 2)}`);\n console.log(`}`);\n\n return true;\n } catch (error) {\n console.error(`Failed to sync node ${node.id}: ${error}`);\n return false;\n }\n }\n\n /**\n * Generate memory retrieval commands\n */\n generateRetrievalCommands(): string[] {\n return [\n `// Get graph stats`,\n `mcp__claude-flow__memory_usage { action: \"retrieve\", key: \"stats\", namespace: \"${this.config.namespace}\" }`,\n ``,\n `// Get node index`,\n `mcp__claude-flow__memory_usage { action: \"retrieve\", key: \"index/nodes\", namespace: \"${this.config.namespace}\" }`,\n ``,\n `// Get specific node`,\n `mcp__claude-flow__memory_usage { action: \"retrieve\", key: \"node/<node-id>\", namespace: \"${this.config.namespace}\" }`,\n ``,\n `// Search by pattern`,\n `mcp__claude-flow__memory_search { pattern: \"node/*\", namespace: \"${this.config.namespace}\" }`,\n ];\n }\n\n /**\n * Generate hook commands for automatic sync\n */\n generateHookCommands(): string[] {\n return [\n `# Pre-task hook to restore graph context`,\n `npx claude-flow@alpha hooks session-restore --session-id \"kg-${this.config.namespace}\"`,\n ``,\n `# Post-edit hook to sync changes`,\n `npx claude-flow@alpha hooks post-edit --file \"<file>\" --memory-key \"kg/${this.config.namespace}/changes\"`,\n ``,\n `# Session end hook to persist`,\n `npx claude-flow@alpha hooks session-end --export-metrics true`,\n ];\n }\n\n /**\n * Convert node to memory entry format\n */\n private nodeToMemoryEntry(node: KnowledgeNode): NodeMemoryEntry {\n // Extract first paragraph as summary\n const summary = this.extractSummary(node.content);\n\n return {\n id: node.id,\n title: node.title,\n type: node.type,\n status: node.status,\n path: node.path,\n tags: node.tags,\n outgoingLinks: node.outgoingLinks.map(l => l.target),\n incomingLinks: node.incomingLinks.map(l => l.target),\n summary,\n lastModified: node.lastModified.toISOString(),\n };\n }\n\n /**\n * Extract summary from content\n */\n private extractSummary(content: string, maxLength = 200): string {\n // Skip frontmatter and headers\n const lines = content.split('\\n');\n let summary = '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n\n // Skip empty lines, headers, and code blocks\n if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith('```')) {\n continue;\n }\n\n // Skip frontmatter markers\n if (trimmed === '---') {\n continue;\n }\n\n summary = trimmed;\n break;\n }\n\n // Truncate if needed\n if (summary.length > maxLength) {\n summary = summary.slice(0, maxLength - 3) + '...';\n }\n\n return summary;\n }\n\n /**\n * Build tag index from nodes\n */\n private buildTagIndex(nodes: KnowledgeNode[]): Record<string, string[]> {\n const index: Record<string, string[]> = {};\n\n for (const node of nodes) {\n for (const tag of node.tags) {\n if (!index[tag]) {\n index[tag] = [];\n }\n index[tag].push(node.id);\n }\n }\n\n return index;\n }\n}\n\n/**\n * Create claude-flow integration instance\n */\nexport function createClaudeFlowIntegration(\n config: ClaudeFlowConfig\n): ClaudeFlowIntegration {\n return new ClaudeFlowIntegration(config);\n}\n\n/**\n * Generate MCP configuration for CLAUDE.md\n */\nexport function generateMcpConfig(namespace: string): string {\n return `## Claude-Flow MCP Configuration\n\nAdd this to your Claude Code configuration:\n\n\\`\\`\\`bash\nclaude mcp add claude-flow npx claude-flow@alpha mcp start\n\\`\\`\\`\n\n### Memory Namespace\n\nThe knowledge graph uses namespace: \\`${namespace}\\`\n\n### Available Operations\n\n\\`\\`\\`javascript\n// Store knowledge\nmcp__claude-flow__memory_usage {\n action: \"store\",\n key: \"node/<id>\",\n namespace: \"${namespace}\",\n value: { ... }\n}\n\n// Retrieve knowledge\nmcp__claude-flow__memory_usage {\n action: \"retrieve\",\n key: \"node/<id>\",\n namespace: \"${namespace}\"\n}\n\n// Search knowledge\nmcp__claude-flow__memory_search {\n pattern: \"node/*\",\n namespace: \"${namespace}\"\n}\n\n// List all keys\nmcp__claude-flow__memory_usage {\n action: \"list\",\n namespace: \"${namespace}\"\n}\n\\`\\`\\`\n`;\n}\n"],"names":[],"mappings":"AA6CO,MAAM,sBAAsB;AAAA,EACzB;AAAA,EAER,YAAY,QAA0B;AACpC,SAAK,SAAS;AAAA,MACZ,WAAW,OAAO;AAAA,MAClB,YAAY,OAAO,cAAc;AAAA,MACjC,cAAc,OAAO,gBAAgB;AAAA,IAAA;AAAA,EAEzC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,IAAiD;AAClE,UAAM,SAAqB;AAAA,MACzB,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,QAAQ,CAAA;AAAA,IAAC;AAGX,UAAM,QAAQ,GAAG,YAAA;AACjB,UAAM,UAAyB,CAAA;AAG/B,eAAW,QAAQ,OAAO;AACxB,UAAI;AACF,cAAM,QAAQ,KAAK,kBAAkB,IAAI;AACzC,gBAAQ,KAAK;AAAA,UACX,KAAK,QAAQ,KAAK,EAAE;AAAA,UACpB,OAAO;AAAA,UACP,WAAW,KAAK,OAAO;AAAA,UACvB,KAAK,KAAK,OAAO;AAAA,QAAA,CAClB;AAAA,MACH,SAAS,OAAO;AACd,eAAO;AACP,eAAO,OAAO,KAAK;AAAA,UACjB,KAAK,KAAK;AAAA,UACV,OAAO,OAAO,KAAK;AAAA,QAAA,CACpB;AAAA,MACH;AAAA,IACF;AAGA,UAAM,QAAQ,GAAG,SAAA;AACjB,YAAQ,KAAK;AAAA,MACX,KAAK;AAAA,MACL,OAAO;AAAA,MACP,WAAW,KAAK,OAAO;AAAA,IAAA,CACxB;AAGD,YAAQ,KAAK;AAAA,MACX,KAAK;AAAA,MACL,OAAO;AAAA,QACL,WAAU,oBAAI,KAAA,GAAO,YAAA;AAAA,QACrB,WAAW,MAAM;AAAA,QACjB,SAAS,GAAG,YAAY,SAAS;AAAA,MAAA;AAAA,MAEnC,WA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AAC,WAAW,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,KAAK,GAAG;AACpE;AAAA,MACF;AAGA,UAAI,YAAY,OAAO;AACrB;AAAA,MACF;AAEA,gBAAU;AACV;AAAA,IACF;AAGA,QAAI,QAAQ,SAAS,WAAW;AAC9B,gBAAU,QAAQ,MAAM,GAAG,YAAY,CAAC,IAAI;AAAA,IAC9C;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKQ,cAAc,OAAkD;AACtE,UAAM,QAAkC,CAAA;AAExC,eAAW,QAAQ,OAAO;AACxB,iBAAW,OAAO,KAAK,MAAM;AAC3B,YAAI,CAAC,MAAM,GAAG,GAAG;AACf,gBAAM,GAAG,IAAI,CAAA;AAAA,QACf;AACA,cAAM,GAAG,EAAE,KAAK,KAAK,EAAE;AAAA,MACzB;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAKO,SAAS,4BACd,QACuB;AACvB,SAAO,IAAI,sBAAsB,MAAM;AACzC;AAKO,SAAS,kBAAkB,WAA2B;AAC3D,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAU+B,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBASjC,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAQT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAMT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAMT,SAAS;AAAA;AAAA;AAAA;AAIzB;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@weavelogic/knowledge-graph-agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Knowledge graph agent for Claude Code - generates knowledge graphs, initializes docs, and integrates with claude-flow",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"kg": "dist/cli/bin.js",
|
|
10
|
+
"knowledge-graph": "dist/cli/bin.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "tsx src/cli/bin.ts",
|
|
14
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
15
|
+
"build:tsc": "tsc",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"test:watch": "vitest --watch",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"lint": "eslint src --ext .ts",
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"knowledge-graph",
|
|
25
|
+
"claude",
|
|
26
|
+
"claude-flow",
|
|
27
|
+
"claude-code",
|
|
28
|
+
"obsidian",
|
|
29
|
+
"docs",
|
|
30
|
+
"weave-nn",
|
|
31
|
+
"mcp"
|
|
32
|
+
],
|
|
33
|
+
"author": "Weave-NN",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@anthropic-ai/sdk": "^0.32.0",
|
|
37
|
+
"better-sqlite3": "^11.7.0",
|
|
38
|
+
"chalk": "^5.3.0",
|
|
39
|
+
"commander": "^14.0.1",
|
|
40
|
+
"cosmiconfig": "^9.0.0",
|
|
41
|
+
"fast-glob": "^3.3.3",
|
|
42
|
+
"gray-matter": "^4.0.3",
|
|
43
|
+
"handlebars": "^4.7.8",
|
|
44
|
+
"ignore": "^7.0.5",
|
|
45
|
+
"inquirer": "^12.3.0",
|
|
46
|
+
"js-yaml": "^4.1.0",
|
|
47
|
+
"ora": "^8.1.1",
|
|
48
|
+
"simple-git": "^3.28.0",
|
|
49
|
+
"zod": "^3.23.8"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
53
|
+
"@types/inquirer": "^9.0.7",
|
|
54
|
+
"@types/js-yaml": "^4.0.9",
|
|
55
|
+
"@types/node": "^22.10.2",
|
|
56
|
+
"tsx": "^4.19.2",
|
|
57
|
+
"typescript": "^5.7.2",
|
|
58
|
+
"vite": "^6.3.0",
|
|
59
|
+
"vite-plugin-dts": "^4.5.4",
|
|
60
|
+
"vitest": "^3.0.0"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=20.0.0"
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"dist",
|
|
67
|
+
"templates",
|
|
68
|
+
"README.md"
|
|
69
|
+
],
|
|
70
|
+
"repository": {
|
|
71
|
+
"type": "git",
|
|
72
|
+
"url": "https://github.com/weavelogic/knowledge-graph-agent"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|