@cortexmemory/cli 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 +325 -0
- package/dist/commands/conversations.d.ts +16 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +421 -0
- package/dist/commands/conversations.js.map +1 -0
- package/dist/commands/convex.d.ts +17 -0
- package/dist/commands/convex.d.ts.map +1 -0
- package/dist/commands/convex.js +442 -0
- package/dist/commands/convex.js.map +1 -0
- package/dist/commands/db.d.ts +16 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +371 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/dev.d.ts +16 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +558 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/facts.d.ts +17 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +386 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/memory.d.ts +18 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +486 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/setup.d.ts +14 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +494 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/spaces.d.ts +18 -0
- package/dist/commands/spaces.d.ts.map +1 -0
- package/dist/commands/spaces.js +553 -0
- package/dist/commands/spaces.js.map +1 -0
- package/dist/commands/users.d.ts +18 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +486 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/__tests__/config.test.d.ts +5 -0
- package/dist/utils/__tests__/config.test.d.ts.map +1 -0
- package/dist/utils/__tests__/config.test.js +127 -0
- package/dist/utils/__tests__/config.test.js.map +1 -0
- package/dist/utils/__tests__/formatting.test.d.ts +5 -0
- package/dist/utils/__tests__/formatting.test.d.ts.map +1 -0
- package/dist/utils/__tests__/formatting.test.js +132 -0
- package/dist/utils/__tests__/formatting.test.js.map +1 -0
- package/dist/utils/__tests__/validation.test.d.ts +5 -0
- package/dist/utils/__tests__/validation.test.d.ts.map +1 -0
- package/dist/utils/__tests__/validation.test.js +207 -0
- package/dist/utils/__tests__/validation.test.js.map +1 -0
- package/dist/utils/client.d.ts +42 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +108 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/config.d.ts +67 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +261 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/formatting.d.ts +81 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +239 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/validation.d.ts +83 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +243 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +72 -0
- package/templates/.cortexrc.template +15 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Commands
|
|
3
|
+
*
|
|
4
|
+
* Commands for managing memories:
|
|
5
|
+
* - clear: Clear memories for a user or space
|
|
6
|
+
* - list: List memories
|
|
7
|
+
* - search: Search memories
|
|
8
|
+
* - delete: Delete a specific memory
|
|
9
|
+
* - export: Export memories
|
|
10
|
+
* - stats: Show memory statistics
|
|
11
|
+
*/
|
|
12
|
+
import ora from "ora";
|
|
13
|
+
import { createClient, withClient } from "../utils/client.js";
|
|
14
|
+
import { resolveConfig } from "../utils/config.js";
|
|
15
|
+
import { formatOutput, printSuccess, printError, printWarning, printSection, formatCount, formatTimestamp, formatRelativeTime, } from "../utils/formatting.js";
|
|
16
|
+
import { validateMemorySpaceId, validateUserId, validateMemoryId, validateSearchQuery, validateLimit, validateFilePath, requireConfirmation, } from "../utils/validation.js";
|
|
17
|
+
import { writeFile } from "fs/promises";
|
|
18
|
+
/**
|
|
19
|
+
* Register memory commands
|
|
20
|
+
*/
|
|
21
|
+
export function registerMemoryCommands(program, config) {
|
|
22
|
+
const memory = program
|
|
23
|
+
.command("memory")
|
|
24
|
+
.description("Manage memories (vector store)");
|
|
25
|
+
// memory list
|
|
26
|
+
memory
|
|
27
|
+
.command("list")
|
|
28
|
+
.description("List memories in a memory space")
|
|
29
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
30
|
+
.option("-u, --user <id>", "Filter by user ID")
|
|
31
|
+
.option("-l, --limit <number>", "Maximum number of results", "50")
|
|
32
|
+
.option("-f, --format <format>", "Output format: table, json, csv")
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const globalOpts = program.opts();
|
|
35
|
+
const resolved = resolveConfig(config, globalOpts);
|
|
36
|
+
const format = (options.format ?? resolved.format);
|
|
37
|
+
const spinner = ora("Loading memories...").start();
|
|
38
|
+
try {
|
|
39
|
+
validateMemorySpaceId(options.space);
|
|
40
|
+
if (options.user) {
|
|
41
|
+
validateUserId(options.user);
|
|
42
|
+
}
|
|
43
|
+
const limit = validateLimit(parseInt(options.limit, 10));
|
|
44
|
+
await withClient(config, globalOpts, async (client) => {
|
|
45
|
+
const memories = await client.memory.list({
|
|
46
|
+
memorySpaceId: options.space,
|
|
47
|
+
userId: options.user,
|
|
48
|
+
limit,
|
|
49
|
+
});
|
|
50
|
+
spinner.stop();
|
|
51
|
+
if (memories.length === 0) {
|
|
52
|
+
printWarning("No memories found");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Format memories for display
|
|
56
|
+
const displayData = memories.map((m) => {
|
|
57
|
+
// Handle both MemoryEntry and EnrichedMemory types
|
|
58
|
+
const memory = "memory" in m ? m.memory : m;
|
|
59
|
+
return {
|
|
60
|
+
id: memory.memoryId,
|
|
61
|
+
content: memory.content.length > 50
|
|
62
|
+
? memory.content.substring(0, 47) + "..."
|
|
63
|
+
: memory.content,
|
|
64
|
+
type: memory.contentType,
|
|
65
|
+
source: memory.sourceType,
|
|
66
|
+
user: memory.userId ?? "-",
|
|
67
|
+
importance: memory.importance,
|
|
68
|
+
created: formatRelativeTime(memory.createdAt),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
console.log(formatOutput(displayData, format, {
|
|
72
|
+
title: `Memories in ${options.space}`,
|
|
73
|
+
headers: [
|
|
74
|
+
"id",
|
|
75
|
+
"content",
|
|
76
|
+
"type",
|
|
77
|
+
"source",
|
|
78
|
+
"user",
|
|
79
|
+
"importance",
|
|
80
|
+
"created",
|
|
81
|
+
],
|
|
82
|
+
}));
|
|
83
|
+
printSuccess(`Found ${formatCount(memories.length, "memory", "memories")}`);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
spinner.stop();
|
|
88
|
+
printError(error instanceof Error ? error.message : "Failed to list memories");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// memory search
|
|
93
|
+
memory
|
|
94
|
+
.command("search <query>")
|
|
95
|
+
.description("Search memories by content")
|
|
96
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
97
|
+
.option("-u, --user <id>", "Filter by user ID")
|
|
98
|
+
.option("-l, --limit <number>", "Maximum number of results", "20")
|
|
99
|
+
.option("-f, --format <format>", "Output format: table, json, csv")
|
|
100
|
+
.action(async (query, options) => {
|
|
101
|
+
const globalOpts = program.opts();
|
|
102
|
+
const resolved = resolveConfig(config, globalOpts);
|
|
103
|
+
const format = (options.format ?? resolved.format);
|
|
104
|
+
const spinner = ora("Searching memories...").start();
|
|
105
|
+
try {
|
|
106
|
+
validateSearchQuery(query);
|
|
107
|
+
validateMemorySpaceId(options.space);
|
|
108
|
+
if (options.user) {
|
|
109
|
+
validateUserId(options.user);
|
|
110
|
+
}
|
|
111
|
+
const limit = validateLimit(parseInt(options.limit, 10));
|
|
112
|
+
await withClient(config, globalOpts, async (client) => {
|
|
113
|
+
const memories = await client.memory.search(options.space, query, {
|
|
114
|
+
userId: options.user,
|
|
115
|
+
limit,
|
|
116
|
+
});
|
|
117
|
+
spinner.stop();
|
|
118
|
+
if (memories.length === 0) {
|
|
119
|
+
printWarning("No memories found matching your query");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Format memories for display
|
|
123
|
+
const displayData = memories.map((m) => {
|
|
124
|
+
const memory = "memory" in m ? m.memory : m;
|
|
125
|
+
return {
|
|
126
|
+
id: memory.memoryId,
|
|
127
|
+
content: memory.content.length > 60
|
|
128
|
+
? memory.content.substring(0, 57) + "..."
|
|
129
|
+
: memory.content,
|
|
130
|
+
type: memory.contentType,
|
|
131
|
+
source: memory.sourceType,
|
|
132
|
+
user: memory.userId ?? "-",
|
|
133
|
+
importance: memory.importance,
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
console.log(formatOutput(displayData, format, {
|
|
137
|
+
title: `Search results for "${query}"`,
|
|
138
|
+
headers: [
|
|
139
|
+
"id",
|
|
140
|
+
"content",
|
|
141
|
+
"type",
|
|
142
|
+
"source",
|
|
143
|
+
"user",
|
|
144
|
+
"importance",
|
|
145
|
+
],
|
|
146
|
+
}));
|
|
147
|
+
printSuccess(`Found ${formatCount(memories.length, "memory", "memories")}`);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
spinner.stop();
|
|
152
|
+
printError(error instanceof Error ? error.message : "Search failed");
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// memory delete
|
|
157
|
+
memory
|
|
158
|
+
.command("delete <memoryId>")
|
|
159
|
+
.description("Delete a specific memory")
|
|
160
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
161
|
+
.option("--cascade", "Also delete associated facts", false)
|
|
162
|
+
.option("-y, --yes", "Skip confirmation prompt", false)
|
|
163
|
+
.action(async (memoryId, options) => {
|
|
164
|
+
const globalOpts = program.opts();
|
|
165
|
+
try {
|
|
166
|
+
validateMemoryId(memoryId);
|
|
167
|
+
validateMemorySpaceId(options.space);
|
|
168
|
+
if (!options.yes) {
|
|
169
|
+
const confirmed = await requireConfirmation(`Delete memory ${memoryId} from space ${options.space}?`, config);
|
|
170
|
+
if (!confirmed) {
|
|
171
|
+
printWarning("Operation cancelled");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const spinner = ora("Deleting memory...").start();
|
|
176
|
+
await withClient(config, globalOpts, async (client) => {
|
|
177
|
+
const result = await client.memory.delete(options.space, memoryId, {
|
|
178
|
+
cascadeDeleteFacts: options.cascade,
|
|
179
|
+
});
|
|
180
|
+
spinner.stop();
|
|
181
|
+
if (result.deleted) {
|
|
182
|
+
printSuccess(`Deleted memory ${memoryId}`);
|
|
183
|
+
if (result.factsDeleted && result.factsDeleted > 0) {
|
|
184
|
+
printSuccess(`Also deleted ${formatCount(result.factsDeleted, "associated fact")}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
printError("Memory not found or could not be deleted");
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
printError(error instanceof Error ? error.message : "Delete failed");
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
// memory clear
|
|
198
|
+
memory
|
|
199
|
+
.command("clear")
|
|
200
|
+
.description("Clear multiple memories")
|
|
201
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
202
|
+
.option("-u, --user <id>", "Only clear memories for this user")
|
|
203
|
+
.option("--source <type>", "Only clear memories of this source type")
|
|
204
|
+
.option("-y, --yes", "Skip confirmation prompt", false)
|
|
205
|
+
.action(async (options) => {
|
|
206
|
+
const globalOpts = program.opts();
|
|
207
|
+
try {
|
|
208
|
+
validateMemorySpaceId(options.space);
|
|
209
|
+
if (options.user) {
|
|
210
|
+
validateUserId(options.user);
|
|
211
|
+
}
|
|
212
|
+
// Count memories first
|
|
213
|
+
const client = createClient(config, globalOpts);
|
|
214
|
+
const count = await client.memory.count({
|
|
215
|
+
memorySpaceId: options.space,
|
|
216
|
+
userId: options.user,
|
|
217
|
+
sourceType: options.source,
|
|
218
|
+
});
|
|
219
|
+
if (count === 0) {
|
|
220
|
+
printWarning("No memories found to delete");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (!options.yes) {
|
|
224
|
+
const scope = options.user
|
|
225
|
+
? `for user ${options.user} in space ${options.space}`
|
|
226
|
+
: `in space ${options.space}`;
|
|
227
|
+
const confirmed = await requireConfirmation(`Delete ${formatCount(count, "memory", "memories")} ${scope}? This cannot be undone.`, config);
|
|
228
|
+
if (!confirmed) {
|
|
229
|
+
printWarning("Operation cancelled");
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const spinner = ora(`Deleting ${count} memories...`).start();
|
|
234
|
+
await withClient(config, globalOpts, async (cortex) => {
|
|
235
|
+
const result = await cortex.memory.deleteMany({
|
|
236
|
+
memorySpaceId: options.space,
|
|
237
|
+
userId: options.user,
|
|
238
|
+
sourceType: options.source,
|
|
239
|
+
});
|
|
240
|
+
spinner.stop();
|
|
241
|
+
printSuccess(`Deleted ${formatCount(result.deleted, "memory", "memories")}`);
|
|
242
|
+
if (result.factsDeleted && result.factsDeleted > 0) {
|
|
243
|
+
printSuccess(`Also deleted ${formatCount(result.factsDeleted, "associated fact")}`);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
printError(error instanceof Error ? error.message : "Clear failed");
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
// memory export
|
|
253
|
+
memory
|
|
254
|
+
.command("export")
|
|
255
|
+
.description("Export memories to a file")
|
|
256
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
257
|
+
.option("-u, --user <id>", "Only export memories for this user")
|
|
258
|
+
.option("-o, --output <file>", "Output file path", "memories-export.json")
|
|
259
|
+
.option("--include-facts", "Include associated facts", false)
|
|
260
|
+
.option("-f, --format <format>", "Export format: json, csv", "json")
|
|
261
|
+
.action(async (options) => {
|
|
262
|
+
const globalOpts = program.opts();
|
|
263
|
+
const spinner = ora("Exporting memories...").start();
|
|
264
|
+
try {
|
|
265
|
+
validateMemorySpaceId(options.space);
|
|
266
|
+
if (options.user) {
|
|
267
|
+
validateUserId(options.user);
|
|
268
|
+
}
|
|
269
|
+
validateFilePath(options.output);
|
|
270
|
+
await withClient(config, globalOpts, async (client) => {
|
|
271
|
+
const result = await client.memory.export({
|
|
272
|
+
memorySpaceId: options.space,
|
|
273
|
+
userId: options.user,
|
|
274
|
+
format: options.format,
|
|
275
|
+
includeFacts: options.includeFacts,
|
|
276
|
+
});
|
|
277
|
+
await writeFile(options.output, result.data, "utf-8");
|
|
278
|
+
spinner.stop();
|
|
279
|
+
printSuccess(`Exported ${formatCount(result.count, "memory", "memories")} to ${options.output}`);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
spinner.stop();
|
|
284
|
+
printError(error instanceof Error ? error.message : "Export failed");
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
// memory stats
|
|
289
|
+
memory
|
|
290
|
+
.command("stats")
|
|
291
|
+
.description("Show memory statistics for a space")
|
|
292
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
293
|
+
.option("-f, --format <format>", "Output format: table, json")
|
|
294
|
+
.action(async (options) => {
|
|
295
|
+
const globalOpts = program.opts();
|
|
296
|
+
const resolved = resolveConfig(config, globalOpts);
|
|
297
|
+
const format = (options.format ?? resolved.format);
|
|
298
|
+
const spinner = ora("Loading statistics...").start();
|
|
299
|
+
try {
|
|
300
|
+
validateMemorySpaceId(options.space);
|
|
301
|
+
await withClient(config, globalOpts, async (client) => {
|
|
302
|
+
// Get counts
|
|
303
|
+
const [totalCount, conversationCount, systemCount, toolCount] = await Promise.all([
|
|
304
|
+
client.memory.count({ memorySpaceId: options.space }),
|
|
305
|
+
client.memory.count({
|
|
306
|
+
memorySpaceId: options.space,
|
|
307
|
+
sourceType: "conversation",
|
|
308
|
+
}),
|
|
309
|
+
client.memory.count({
|
|
310
|
+
memorySpaceId: options.space,
|
|
311
|
+
sourceType: "system",
|
|
312
|
+
}),
|
|
313
|
+
client.memory.count({
|
|
314
|
+
memorySpaceId: options.space,
|
|
315
|
+
sourceType: "tool",
|
|
316
|
+
}),
|
|
317
|
+
]);
|
|
318
|
+
// Get recent memories
|
|
319
|
+
const recentMemories = await client.memory.list({
|
|
320
|
+
memorySpaceId: options.space,
|
|
321
|
+
limit: 5,
|
|
322
|
+
});
|
|
323
|
+
spinner.stop();
|
|
324
|
+
if (format === "json") {
|
|
325
|
+
console.log(formatOutput({
|
|
326
|
+
memorySpaceId: options.space,
|
|
327
|
+
total: totalCount,
|
|
328
|
+
bySource: {
|
|
329
|
+
conversation: conversationCount,
|
|
330
|
+
system: systemCount,
|
|
331
|
+
tool: toolCount,
|
|
332
|
+
},
|
|
333
|
+
recentCount: recentMemories.length,
|
|
334
|
+
}, "json"));
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
printSection(`Memory Statistics for ${options.space}`, {
|
|
338
|
+
"Total Memories": totalCount,
|
|
339
|
+
"From Conversations": conversationCount,
|
|
340
|
+
"From System": systemCount,
|
|
341
|
+
"From Tools": toolCount,
|
|
342
|
+
});
|
|
343
|
+
if (recentMemories.length > 0) {
|
|
344
|
+
const lastMemory = "memory" in recentMemories[0]
|
|
345
|
+
? recentMemories[0].memory
|
|
346
|
+
: recentMemories[0];
|
|
347
|
+
console.log(` Last Activity: ${formatTimestamp(lastMemory.createdAt)}`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
spinner.stop();
|
|
354
|
+
printError(error instanceof Error ? error.message : "Failed to load statistics");
|
|
355
|
+
process.exit(1);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
// memory get
|
|
359
|
+
memory
|
|
360
|
+
.command("get <memoryId>")
|
|
361
|
+
.description("Get details of a specific memory")
|
|
362
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
363
|
+
.option("--include-conversation", "Include source conversation", false)
|
|
364
|
+
.option("-f, --format <format>", "Output format: table, json")
|
|
365
|
+
.action(async (memoryId, options) => {
|
|
366
|
+
const globalOpts = program.opts();
|
|
367
|
+
const resolved = resolveConfig(config, globalOpts);
|
|
368
|
+
const format = (options.format ?? resolved.format);
|
|
369
|
+
const spinner = ora("Loading memory...").start();
|
|
370
|
+
try {
|
|
371
|
+
validateMemoryId(memoryId);
|
|
372
|
+
validateMemorySpaceId(options.space);
|
|
373
|
+
await withClient(config, globalOpts, async (client) => {
|
|
374
|
+
const result = await client.memory.get(options.space, memoryId, {
|
|
375
|
+
includeConversation: options.includeConversation,
|
|
376
|
+
});
|
|
377
|
+
spinner.stop();
|
|
378
|
+
if (!result) {
|
|
379
|
+
printError("Memory not found");
|
|
380
|
+
process.exit(1);
|
|
381
|
+
}
|
|
382
|
+
if (format === "json") {
|
|
383
|
+
console.log(formatOutput(result, "json"));
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
// Handle both MemoryEntry and EnrichedMemory types
|
|
387
|
+
const memory = "memory" in result ? result.memory : result;
|
|
388
|
+
printSection(`Memory: ${memory.memoryId}`, {
|
|
389
|
+
Content: memory.content,
|
|
390
|
+
"Content Type": memory.contentType,
|
|
391
|
+
"Source Type": memory.sourceType,
|
|
392
|
+
"User ID": memory.userId ?? "-",
|
|
393
|
+
Importance: memory.importance,
|
|
394
|
+
Version: memory.version,
|
|
395
|
+
Created: formatTimestamp(memory.createdAt),
|
|
396
|
+
Updated: formatTimestamp(memory.updatedAt),
|
|
397
|
+
"Access Count": memory.accessCount,
|
|
398
|
+
Tags: memory.tags.length > 0 ? memory.tags.join(", ") : "-",
|
|
399
|
+
});
|
|
400
|
+
// Show enriched data if available
|
|
401
|
+
if ("memory" in result && result.sourceMessages) {
|
|
402
|
+
console.log("\n Source Messages:");
|
|
403
|
+
for (const msg of result.sourceMessages) {
|
|
404
|
+
console.log(` [${msg.role}]: ${msg.content.substring(0, 100)}...`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if ("memory" in result && result.facts && result.facts.length > 0) {
|
|
408
|
+
console.log(`\n Related Facts: ${result.facts.length}`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
catch (error) {
|
|
414
|
+
spinner.stop();
|
|
415
|
+
printError(error instanceof Error ? error.message : "Failed to get memory");
|
|
416
|
+
process.exit(1);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
// memory archive
|
|
420
|
+
memory
|
|
421
|
+
.command("archive <memoryId>")
|
|
422
|
+
.description("Archive a memory (soft delete)")
|
|
423
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
424
|
+
.option("-y, --yes", "Skip confirmation prompt", false)
|
|
425
|
+
.action(async (memoryId, options) => {
|
|
426
|
+
const globalOpts = program.opts();
|
|
427
|
+
try {
|
|
428
|
+
validateMemoryId(memoryId);
|
|
429
|
+
validateMemorySpaceId(options.space);
|
|
430
|
+
if (!options.yes) {
|
|
431
|
+
const confirmed = await requireConfirmation(`Archive memory ${memoryId}? It can be restored later.`, config);
|
|
432
|
+
if (!confirmed) {
|
|
433
|
+
printWarning("Operation cancelled");
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const spinner = ora("Archiving memory...").start();
|
|
438
|
+
await withClient(config, globalOpts, async (client) => {
|
|
439
|
+
const result = await client.memory.archive(options.space, memoryId);
|
|
440
|
+
spinner.stop();
|
|
441
|
+
if (result.archived) {
|
|
442
|
+
printSuccess(`Archived memory ${memoryId}`);
|
|
443
|
+
if (result.factsArchived && result.factsArchived > 0) {
|
|
444
|
+
printSuccess(`Also archived ${formatCount(result.factsArchived, "associated fact")}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
printError("Memory not found or could not be archived");
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
catch (error) {
|
|
453
|
+
printError(error instanceof Error ? error.message : "Archive failed");
|
|
454
|
+
process.exit(1);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
// memory restore
|
|
458
|
+
memory
|
|
459
|
+
.command("restore <memoryId>")
|
|
460
|
+
.description("Restore an archived memory")
|
|
461
|
+
.requiredOption("-s, --space <id>", "Memory space ID")
|
|
462
|
+
.action(async (memoryId, options) => {
|
|
463
|
+
const globalOpts = program.opts();
|
|
464
|
+
const spinner = ora("Restoring memory...").start();
|
|
465
|
+
try {
|
|
466
|
+
validateMemoryId(memoryId);
|
|
467
|
+
validateMemorySpaceId(options.space);
|
|
468
|
+
await withClient(config, globalOpts, async (client) => {
|
|
469
|
+
const result = await client.memory.restoreFromArchive(options.space, memoryId);
|
|
470
|
+
spinner.stop();
|
|
471
|
+
if (result.restored) {
|
|
472
|
+
printSuccess(`Restored memory ${memoryId}`);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
printError("Memory not found or could not be restored");
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
catch (error) {
|
|
480
|
+
spinner.stop();
|
|
481
|
+
printError(error instanceof Error ? error.message : "Restore failed");
|
|
482
|
+
process.exit(1);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAgB,EAChB,MAAiB;IAEjB,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,gCAAgC,CAAC,CAAC;IAEjD,cAAc;IACd,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,iCAAiC,CAAC;SAC9C,cAAc,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;SACrD,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;SAC9C,MAAM,CAAC,sBAAsB,EAAE,2BAA2B,EAAE,IAAI,CAAC;SACjE,MAAM,CAAC,uBAAuB,EAAE,iCAAiC,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACnD,M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CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,UAAU,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup and Configuration Commands
|
|
3
|
+
*
|
|
4
|
+
* Commands for setting up and configuring the CLI:
|
|
5
|
+
* - setup: Interactive setup wizard
|
|
6
|
+
* - config: Configuration management
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
import type { CLIConfig } from "../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Register setup and config commands
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerSetupCommands(program: Command, _config: CLIConfig): void;
|
|
14
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,SAAS,EAAkC,MAAM,aAAa,CAAC;AAsB7E;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,GACjB,IAAI,CAwWN"}
|