@claude-flow/cli 3.0.0-alpha.1 → 3.0.0-alpha.11
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/.agentic-flow/intelligence.json +4 -3
- package/.claude-flow/agents/store.json +16 -0
- package/.claude-flow/daemon-state.json +123 -0
- package/.claude-flow/daemon-test.log +0 -0
- package/.claude-flow/daemon.log +0 -0
- package/.claude-flow/daemon2.log +0 -0
- package/.claude-flow/daemon3.log +0 -0
- package/.claude-flow/hive-mind/state.json +51 -0
- package/.claude-flow/metrics/codebase-map.json +11 -0
- package/.claude-flow/metrics/consolidation.json +6 -0
- package/.claude-flow/metrics/performance.json +3 -3
- package/.claude-flow/metrics/security-audit.json +10 -0
- package/.claude-flow/metrics/task-metrics.json +3 -3
- package/.claude-flow/metrics/test-gaps.json +6 -0
- package/agents/architect.yaml +11 -0
- package/agents/coder.yaml +11 -0
- package/agents/reviewer.yaml +10 -0
- package/agents/security-architect.yaml +10 -0
- package/agents/tester.yaml +10 -0
- package/bin/cli.js +0 -0
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +43 -27
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +288 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/config.js +2 -2
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +545 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +10 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +294 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +252 -35
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.js +1 -1
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +9 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +31 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/mcp.js +1 -1
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +234 -168
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +1 -1
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +224 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +262 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +10 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +280 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/process.d.ts.map +1 -1
- package/dist/src/commands/process.js +95 -20
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +261 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/start.js +2 -2
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +26 -2
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +6 -6
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +5 -0
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +1 -1
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +22 -12
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +2 -2
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +15 -1
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +5 -0
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +350 -14
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +262 -15
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +80 -15
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +4 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +4 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +157 -9
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/session-tools.js +315 -0
- package/dist/src/mcp-tools/session-tools.js.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +37 -2
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/task-tools.js +302 -0
- package/dist/src/mcp-tools/task-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/output.d.ts +16 -0
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +42 -0
- package/dist/src/output.js.map +1 -1
- package/dist/src/services/index.d.ts +7 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +6 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +153 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +567 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/scripts/publish.sh +46 -0
- package/src/commands/agent.ts +43 -29
- package/src/commands/claims.ts +317 -0
- package/src/commands/config.ts +2 -2
- package/src/commands/daemon.ts +621 -0
- package/src/commands/deployment.ts +323 -0
- package/src/commands/embeddings.ts +332 -0
- package/src/commands/hive-mind.ts +229 -63
- package/src/commands/hooks.ts +1 -1
- package/src/commands/index.ts +31 -1
- package/src/commands/mcp.ts +1 -1
- package/src/commands/memory.ts +279 -181
- package/src/commands/migrate.ts +1 -1
- package/src/commands/neural.ts +253 -0
- package/src/commands/performance.ts +292 -0
- package/src/commands/plugins.ts +316 -0
- package/src/commands/process.ts +98 -20
- package/src/commands/providers.ts +259 -0
- package/src/commands/security.ts +288 -0
- package/src/commands/start.ts +2 -2
- package/src/commands/status.ts +33 -2
- package/src/commands/swarm.ts +6 -6
- package/src/index.ts +52 -4
- package/src/init/executor.ts +6 -0
- package/src/init/helpers-generator.ts +1 -1
- package/src/init/settings-generator.ts +22 -12
- package/src/init/types.ts +3 -3
- package/src/mcp-client.ts +15 -1
- package/src/mcp-server.ts +6 -0
- package/src/mcp-tools/agent-tools.ts +388 -14
- package/src/mcp-tools/config-tools.ts +297 -15
- package/src/mcp-tools/hive-mind-tools.ts +521 -0
- package/src/mcp-tools/hooks-tools.ts +84 -15
- package/src/mcp-tools/index.ts +4 -0
- package/src/mcp-tools/memory-tools.ts +190 -9
- package/src/mcp-tools/session-tools.ts +359 -0
- package/src/mcp-tools/swarm-tools.ts +38 -2
- package/src/mcp-tools/task-tools.ts +347 -0
- package/src/mcp-tools/workflow-tools.ts +573 -0
- package/src/output.ts +47 -1
- package/src/services/index.ts +15 -0
- package/src/services/worker-daemon.ts +726 -0
- package/tmp.json +0 -0
package/src/commands/memory.ts
CHANGED
|
@@ -105,26 +105,39 @@ const storeCommand: Command = {
|
|
|
105
105
|
output.writeln(output.dim(' Indexing with HNSW (M=16, ef=200)...'));
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
{ property: 'Key', val: key },
|
|
116
|
-
{ property: 'Namespace', val: namespace },
|
|
117
|
-
{ property: 'Size', val: `${storeData.size} bytes` },
|
|
118
|
-
{ property: 'TTL', val: ttl ? `${ttl}s` : 'None' },
|
|
119
|
-
{ property: 'Tags', val: tags.length > 0 ? tags.join(', ') : 'None' },
|
|
120
|
-
{ property: 'Vector', val: asVector ? 'Yes' : 'No' }
|
|
121
|
-
]
|
|
122
|
-
});
|
|
108
|
+
// Call MCP memory/store tool for real persistence
|
|
109
|
+
try {
|
|
110
|
+
const result = await callMCPTool('memory/store', {
|
|
111
|
+
key,
|
|
112
|
+
value,
|
|
113
|
+
metadata: { namespace, tags, ttl, asVector, size: storeData.size }
|
|
114
|
+
});
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
output.writeln();
|
|
117
|
+
output.printTable({
|
|
118
|
+
columns: [
|
|
119
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
120
|
+
{ key: 'val', header: 'Value', width: 40 }
|
|
121
|
+
],
|
|
122
|
+
data: [
|
|
123
|
+
{ property: 'Key', val: key },
|
|
124
|
+
{ property: 'Namespace', val: namespace },
|
|
125
|
+
{ property: 'Size', val: `${storeData.size} bytes` },
|
|
126
|
+
{ property: 'TTL', val: ttl ? `${ttl}s` : 'None' },
|
|
127
|
+
{ property: 'Tags', val: tags.length > 0 ? tags.join(', ') : 'None' },
|
|
128
|
+
{ property: 'Vector', val: asVector ? 'Yes' : 'No' },
|
|
129
|
+
{ property: 'Total Entries', val: String((result as { totalEntries?: number }).totalEntries || 1) }
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
output.writeln();
|
|
134
|
+
output.printSuccess('Data stored successfully');
|
|
126
135
|
|
|
127
|
-
|
|
136
|
+
return { success: true, data: { ...storeData, ...(result as Record<string, unknown>) } };
|
|
137
|
+
} catch (error) {
|
|
138
|
+
output.printError(`Failed to store: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
139
|
+
return { success: false, exitCode: 1 };
|
|
140
|
+
}
|
|
128
141
|
}
|
|
129
142
|
};
|
|
130
143
|
|
|
@@ -157,41 +170,62 @@ const retrieveCommand: Command = {
|
|
|
157
170
|
return { success: false, exitCode: 1 };
|
|
158
171
|
}
|
|
159
172
|
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
key
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
storedAt
|
|
167
|
-
accessCount
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
// Call MCP memory/retrieve tool for real data
|
|
174
|
+
try {
|
|
175
|
+
const result = await callMCPTool('memory/retrieve', { key }) as {
|
|
176
|
+
key: string;
|
|
177
|
+
value: unknown;
|
|
178
|
+
metadata?: Record<string, unknown>;
|
|
179
|
+
storedAt?: string;
|
|
180
|
+
accessCount?: number;
|
|
181
|
+
found: boolean;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
if (!result.found) {
|
|
185
|
+
output.printWarning(`Key not found: ${key}`);
|
|
186
|
+
return { success: false, exitCode: 1, data: { key, found: false } };
|
|
171
187
|
}
|
|
172
|
-
};
|
|
173
188
|
|
|
174
|
-
|
|
175
|
-
|
|
189
|
+
const data = {
|
|
190
|
+
key: result.key,
|
|
191
|
+
namespace,
|
|
192
|
+
value: result.value,
|
|
193
|
+
metadata: {
|
|
194
|
+
storedAt: result.storedAt || 'Unknown',
|
|
195
|
+
accessCount: result.accessCount || 0,
|
|
196
|
+
lastAccessed: new Date().toISOString(),
|
|
197
|
+
...(result.metadata || {})
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
if (ctx.flags.format === 'json') {
|
|
202
|
+
output.printJson(data);
|
|
203
|
+
return { success: true, data };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const metaTags = (result.metadata?.tags as string[]) || [];
|
|
207
|
+
const metaSize = (result.metadata?.size as number) || String(data.value).length;
|
|
208
|
+
|
|
209
|
+
output.writeln();
|
|
210
|
+
output.printBox(
|
|
211
|
+
[
|
|
212
|
+
`Namespace: ${namespace}`,
|
|
213
|
+
`Key: ${data.key}`,
|
|
214
|
+
`Size: ${metaSize} bytes`,
|
|
215
|
+
`Access Count: ${data.metadata.accessCount}`,
|
|
216
|
+
`Tags: ${metaTags.length > 0 ? metaTags.join(', ') : 'None'}`,
|
|
217
|
+
'',
|
|
218
|
+
output.bold('Value:'),
|
|
219
|
+
typeof data.value === 'string' ? data.value : JSON.stringify(data.value, null, 2)
|
|
220
|
+
].join('\n'),
|
|
221
|
+
'Memory Entry'
|
|
222
|
+
);
|
|
223
|
+
|
|
176
224
|
return { success: true, data };
|
|
225
|
+
} catch (error) {
|
|
226
|
+
output.printError(`Failed to retrieve: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
227
|
+
return { success: false, exitCode: 1 };
|
|
177
228
|
}
|
|
178
|
-
|
|
179
|
-
output.writeln();
|
|
180
|
-
output.printBox(
|
|
181
|
-
[
|
|
182
|
-
`Namespace: ${data.namespace}`,
|
|
183
|
-
`Key: ${data.key}`,
|
|
184
|
-
`Size: ${data.metadata.size} bytes`,
|
|
185
|
-
`Access Count: ${data.metadata.accessCount}`,
|
|
186
|
-
`Tags: ${data.metadata.tags.join(', ')}`,
|
|
187
|
-
'',
|
|
188
|
-
output.bold('Value:'),
|
|
189
|
-
data.value
|
|
190
|
-
].join('\n'),
|
|
191
|
-
'Memory Entry'
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
return { success: true, data };
|
|
195
229
|
}
|
|
196
230
|
};
|
|
197
231
|
|
|
@@ -254,37 +288,56 @@ const searchCommand: Command = {
|
|
|
254
288
|
output.printInfo(`Searching: "${query}" (${searchType})`);
|
|
255
289
|
output.writeln();
|
|
256
290
|
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
291
|
+
// Call MCP memory/search tool for real results
|
|
292
|
+
try {
|
|
293
|
+
const searchResult = await callMCPTool('memory/search', { query, limit }) as {
|
|
294
|
+
query: string;
|
|
295
|
+
results: Array<{ key: string; value: unknown; score: number; storedAt: string }>;
|
|
296
|
+
total: number;
|
|
297
|
+
searchTime: string;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const results = searchResult.results.map(r => ({
|
|
301
|
+
key: r.key,
|
|
302
|
+
score: r.score,
|
|
303
|
+
namespace: namespace || 'default',
|
|
304
|
+
preview: typeof r.value === 'string'
|
|
305
|
+
? r.value.substring(0, 40) + (r.value.length > 40 ? '...' : '')
|
|
306
|
+
: JSON.stringify(r.value).substring(0, 40)
|
|
307
|
+
}));
|
|
264
308
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
309
|
+
if (ctx.flags.format === 'json') {
|
|
310
|
+
output.printJson({ query, searchType, results, searchTime: searchResult.searchTime });
|
|
311
|
+
return { success: true, data: results };
|
|
312
|
+
}
|
|
269
313
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
314
|
+
// Performance stats
|
|
315
|
+
output.writeln(output.dim(` Search time: ${searchResult.searchTime}`));
|
|
316
|
+
output.writeln();
|
|
273
317
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
{
|
|
277
|
-
|
|
278
|
-
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
279
|
-
{ key: 'preview', header: 'Preview', width: 35 }
|
|
280
|
-
],
|
|
281
|
-
data: results
|
|
282
|
-
});
|
|
318
|
+
if (results.length === 0) {
|
|
319
|
+
output.printWarning('No results found');
|
|
320
|
+
return { success: true, data: [] };
|
|
321
|
+
}
|
|
283
322
|
|
|
284
|
-
|
|
285
|
-
|
|
323
|
+
output.printTable({
|
|
324
|
+
columns: [
|
|
325
|
+
{ key: 'key', header: 'Key', width: 20 },
|
|
326
|
+
{ key: 'score', header: 'Score', width: 8, align: 'right', format: (v) => Number(v).toFixed(2) },
|
|
327
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
328
|
+
{ key: 'preview', header: 'Preview', width: 35 }
|
|
329
|
+
],
|
|
330
|
+
data: results
|
|
331
|
+
});
|
|
286
332
|
|
|
287
|
-
|
|
333
|
+
output.writeln();
|
|
334
|
+
output.printInfo(`Found ${results.length} results`);
|
|
335
|
+
|
|
336
|
+
return { success: true, data: results };
|
|
337
|
+
} catch (error) {
|
|
338
|
+
output.printError(`Search failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
339
|
+
return { success: false, exitCode: 1 };
|
|
340
|
+
}
|
|
288
341
|
}
|
|
289
342
|
};
|
|
290
343
|
|
|
@@ -318,42 +371,77 @@ const listCommand: Command = {
|
|
|
318
371
|
const namespace = ctx.flags.namespace as string;
|
|
319
372
|
const limit = ctx.flags.limit as number;
|
|
320
373
|
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
374
|
+
// Call MCP memory/list tool for real entries
|
|
375
|
+
try {
|
|
376
|
+
const listResult = await callMCPTool('memory/list', { limit, offset: 0 }) as {
|
|
377
|
+
entries: Array<{ key: string; storedAt: string; accessCount: number; preview: string }>;
|
|
378
|
+
total: number;
|
|
379
|
+
limit: number;
|
|
380
|
+
offset: number;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// Format entries for display
|
|
384
|
+
const entries = listResult.entries.map(e => ({
|
|
385
|
+
key: e.key,
|
|
386
|
+
namespace: namespace || 'default',
|
|
387
|
+
size: e.preview.length + ' B',
|
|
388
|
+
accessCount: e.accessCount,
|
|
389
|
+
updated: formatRelativeTime(e.storedAt)
|
|
390
|
+
}));
|
|
334
391
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
392
|
+
if (ctx.flags.format === 'json') {
|
|
393
|
+
output.printJson(entries);
|
|
394
|
+
return { success: true, data: entries };
|
|
395
|
+
}
|
|
338
396
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
343
|
-
{ key: 'size', header: 'Size', width: 10, align: 'right' },
|
|
344
|
-
{ key: 'tags', header: 'Tags', width: 12 },
|
|
345
|
-
{ key: 'updated', header: 'Updated', width: 10 }
|
|
346
|
-
],
|
|
347
|
-
data: entries
|
|
348
|
-
});
|
|
397
|
+
output.writeln();
|
|
398
|
+
output.writeln(output.bold('Memory Entries'));
|
|
399
|
+
output.writeln();
|
|
349
400
|
|
|
350
|
-
|
|
351
|
-
|
|
401
|
+
if (entries.length === 0) {
|
|
402
|
+
output.printWarning('No entries found');
|
|
403
|
+
return { success: true, data: [] };
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
output.printTable({
|
|
407
|
+
columns: [
|
|
408
|
+
{ key: 'key', header: 'Key', width: 25 },
|
|
409
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
410
|
+
{ key: 'size', header: 'Size', width: 10, align: 'right' },
|
|
411
|
+
{ key: 'accessCount', header: 'Accessed', width: 10, align: 'right' },
|
|
412
|
+
{ key: 'updated', header: 'Updated', width: 12 }
|
|
413
|
+
],
|
|
414
|
+
data: entries
|
|
415
|
+
});
|
|
352
416
|
|
|
353
|
-
|
|
417
|
+
output.writeln();
|
|
418
|
+
output.printInfo(`Showing ${entries.length} of ${listResult.total} entries`);
|
|
419
|
+
|
|
420
|
+
return { success: true, data: entries };
|
|
421
|
+
} catch (error) {
|
|
422
|
+
output.printError(`Failed to list: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
423
|
+
return { success: false, exitCode: 1 };
|
|
424
|
+
}
|
|
354
425
|
}
|
|
355
426
|
};
|
|
356
427
|
|
|
428
|
+
// Helper function to format relative time
|
|
429
|
+
function formatRelativeTime(isoDate: string): string {
|
|
430
|
+
const now = Date.now();
|
|
431
|
+
const date = new Date(isoDate).getTime();
|
|
432
|
+
const diff = now - date;
|
|
433
|
+
|
|
434
|
+
const seconds = Math.floor(diff / 1000);
|
|
435
|
+
const minutes = Math.floor(seconds / 60);
|
|
436
|
+
const hours = Math.floor(minutes / 60);
|
|
437
|
+
const days = Math.floor(hours / 24);
|
|
438
|
+
|
|
439
|
+
if (days > 0) return `${days}d ago`;
|
|
440
|
+
if (hours > 0) return `${hours}h ago`;
|
|
441
|
+
if (minutes > 0) return `${minutes}m ago`;
|
|
442
|
+
return 'just now';
|
|
443
|
+
}
|
|
444
|
+
|
|
357
445
|
// Delete command
|
|
358
446
|
const deleteCommand: Command = {
|
|
359
447
|
name: 'delete',
|
|
@@ -389,10 +477,27 @@ const deleteCommand: Command = {
|
|
|
389
477
|
}
|
|
390
478
|
}
|
|
391
479
|
|
|
392
|
-
|
|
393
|
-
|
|
480
|
+
// Call MCP memory/delete tool
|
|
481
|
+
try {
|
|
482
|
+
const result = await callMCPTool('memory/delete', { key }) as {
|
|
483
|
+
success: boolean;
|
|
484
|
+
key: string;
|
|
485
|
+
deleted: boolean;
|
|
486
|
+
remainingEntries: number;
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
if (result.deleted) {
|
|
490
|
+
output.printSuccess(`Deleted ${key}`);
|
|
491
|
+
output.printInfo(`Remaining entries: ${result.remainingEntries}`);
|
|
492
|
+
} else {
|
|
493
|
+
output.printWarning(`Key not found: ${key}`);
|
|
494
|
+
}
|
|
394
495
|
|
|
395
|
-
|
|
496
|
+
return { success: result.deleted, data: result };
|
|
497
|
+
} catch (error) {
|
|
498
|
+
output.printError(`Failed to delete: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
499
|
+
return { success: false, exitCode: 1 };
|
|
500
|
+
}
|
|
396
501
|
}
|
|
397
502
|
};
|
|
398
503
|
|
|
@@ -401,86 +506,79 @@ const statsCommand: Command = {
|
|
|
401
506
|
name: 'stats',
|
|
402
507
|
description: 'Show memory statistics',
|
|
403
508
|
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
output.printJson(stats);
|
|
432
|
-
return { success: true, data: stats };
|
|
433
|
-
}
|
|
509
|
+
// Call MCP memory/stats tool for real statistics
|
|
510
|
+
try {
|
|
511
|
+
const statsResult = await callMCPTool('memory/stats', {}) as {
|
|
512
|
+
totalEntries: number;
|
|
513
|
+
totalSize: string;
|
|
514
|
+
version: string;
|
|
515
|
+
backend: string;
|
|
516
|
+
location: string;
|
|
517
|
+
oldestEntry: string | null;
|
|
518
|
+
newestEntry: string | null;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
const stats = {
|
|
522
|
+
backend: statsResult.backend,
|
|
523
|
+
entries: {
|
|
524
|
+
total: statsResult.totalEntries,
|
|
525
|
+
vectors: 0, // Would need vector backend support
|
|
526
|
+
text: statsResult.totalEntries
|
|
527
|
+
},
|
|
528
|
+
storage: {
|
|
529
|
+
total: statsResult.totalSize,
|
|
530
|
+
location: statsResult.location
|
|
531
|
+
},
|
|
532
|
+
version: statsResult.version,
|
|
533
|
+
oldestEntry: statsResult.oldestEntry,
|
|
534
|
+
newestEntry: statsResult.newestEntry
|
|
535
|
+
};
|
|
434
536
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
537
|
+
if (ctx.flags.format === 'json') {
|
|
538
|
+
output.printJson(stats);
|
|
539
|
+
return { success: true, data: stats };
|
|
540
|
+
}
|
|
438
541
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
{ key: 'metric', header: 'Metric', width: 20 },
|
|
443
|
-
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
444
|
-
],
|
|
445
|
-
data: [
|
|
446
|
-
{ metric: 'Backend', value: stats.backend },
|
|
447
|
-
{ metric: 'Total Entries', value: stats.entries.total.toLocaleString() },
|
|
448
|
-
{ metric: 'Vector Entries', value: stats.entries.vectors.toLocaleString() },
|
|
449
|
-
{ metric: 'Text Entries', value: stats.entries.text.toLocaleString() },
|
|
450
|
-
{ metric: 'Total Storage', value: stats.storage.total }
|
|
451
|
-
]
|
|
452
|
-
});
|
|
542
|
+
output.writeln();
|
|
543
|
+
output.writeln(output.bold('Memory Statistics'));
|
|
544
|
+
output.writeln();
|
|
453
545
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
546
|
+
output.writeln(output.bold('Overview'));
|
|
547
|
+
output.printTable({
|
|
548
|
+
columns: [
|
|
549
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
550
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
551
|
+
],
|
|
552
|
+
data: [
|
|
553
|
+
{ metric: 'Backend', value: stats.backend },
|
|
554
|
+
{ metric: 'Version', value: stats.version },
|
|
555
|
+
{ metric: 'Total Entries', value: stats.entries.total.toLocaleString() },
|
|
556
|
+
{ metric: 'Total Storage', value: stats.storage.total },
|
|
557
|
+
{ metric: 'Location', value: stats.storage.location }
|
|
558
|
+
]
|
|
559
|
+
});
|
|
468
560
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
561
|
+
output.writeln();
|
|
562
|
+
output.writeln(output.bold('Timeline'));
|
|
563
|
+
output.printTable({
|
|
564
|
+
columns: [
|
|
565
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
566
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
567
|
+
],
|
|
568
|
+
data: [
|
|
569
|
+
{ metric: 'Oldest Entry', value: stats.oldestEntry || 'N/A' },
|
|
570
|
+
{ metric: 'Newest Entry', value: stats.newestEntry || 'N/A' }
|
|
571
|
+
]
|
|
572
|
+
});
|
|
479
573
|
|
|
480
|
-
|
|
481
|
-
|
|
574
|
+
output.writeln();
|
|
575
|
+
output.printInfo('V3 Performance: 150x-12,500x faster search with HNSW indexing');
|
|
482
576
|
|
|
483
|
-
|
|
577
|
+
return { success: true, data: stats };
|
|
578
|
+
} catch (error) {
|
|
579
|
+
output.printError(`Failed to get stats: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
580
|
+
return { success: false, exitCode: 1 };
|
|
581
|
+
}
|
|
484
582
|
}
|
|
485
583
|
};
|
|
486
584
|
|
package/src/commands/migrate.ts
CHANGED
|
@@ -145,7 +145,7 @@ const runCommand: Command = {
|
|
|
145
145
|
output.writeln(output.dim(` ${step.description}`));
|
|
146
146
|
|
|
147
147
|
if (!dryRun) {
|
|
148
|
-
//
|
|
148
|
+
// Execute migration step
|
|
149
149
|
output.writeln(output.dim(` ${output.success('[OK]')} Completed`));
|
|
150
150
|
} else {
|
|
151
151
|
output.writeln(output.dim(` Would migrate: ${step.source} -> ${step.dest}`));
|