@cydm/happy-elves 0.1.0-beta.267 → 0.1.0-beta.270
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.
|
@@ -9,6 +9,7 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
9
9
|
const projectKey = await resolveMemoryProjectKey(client, flags, machineId);
|
|
10
10
|
const result = await client.memory({ machineId, action: "overview", projectKey, mode: parseMemoryMode(flags.mode) ?? "readonly" });
|
|
11
11
|
if (!wantsJson(flags)) {
|
|
12
|
+
printMemoryProject(projectKey);
|
|
12
13
|
const files = result.overview?.files ?? [];
|
|
13
14
|
if (files.length === 0)
|
|
14
15
|
console.log("No memory files.");
|
|
@@ -17,7 +18,7 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
17
18
|
console.log(`${file.layer} ${file.path} ${file.lineCount} lines ${file.updatedAt}`);
|
|
18
19
|
return true;
|
|
19
20
|
}
|
|
20
|
-
ok(`memory.${action}`, result);
|
|
21
|
+
ok(`memory.${action}`, withMemoryProject(result, projectKey));
|
|
21
22
|
return true;
|
|
22
23
|
}
|
|
23
24
|
if (action === "save" || action === "write") {
|
|
@@ -43,7 +44,8 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
43
44
|
...(typeof flags.date === "string" ? { date: flags.date } : {}),
|
|
44
45
|
},
|
|
45
46
|
});
|
|
46
|
-
|
|
47
|
+
printMemoryProjectIfHuman(flags, projectKey);
|
|
48
|
+
ok("memory.save", withMemoryProject(result, projectKey));
|
|
47
49
|
return true;
|
|
48
50
|
}
|
|
49
51
|
if (action === "read") {
|
|
@@ -52,10 +54,11 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
52
54
|
const path = typeof flags.path === "string" ? flags.path : requirePositional(positional[0], "path");
|
|
53
55
|
const result = await client.memory({ machineId, action: "read", projectKey, path });
|
|
54
56
|
if (!wantsJson(flags)) {
|
|
57
|
+
printMemoryProject(projectKey);
|
|
55
58
|
console.log(result.content ?? "");
|
|
56
59
|
return true;
|
|
57
60
|
}
|
|
58
|
-
ok("memory.read", result);
|
|
61
|
+
ok("memory.read", withMemoryProject(result, projectKey));
|
|
59
62
|
return true;
|
|
60
63
|
}
|
|
61
64
|
if (action === "search") {
|
|
@@ -67,6 +70,7 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
67
70
|
throw new CliError("Invalid --limit", "INVALID_ARGUMENT");
|
|
68
71
|
const result = await client.memory({ machineId, action: "search", projectKey, query, limit });
|
|
69
72
|
if (!wantsJson(flags)) {
|
|
73
|
+
printMemoryProject(projectKey);
|
|
70
74
|
const results = result.results ?? [];
|
|
71
75
|
if (results.length === 0)
|
|
72
76
|
console.log("No matching memory.");
|
|
@@ -80,7 +84,7 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
80
84
|
}
|
|
81
85
|
return true;
|
|
82
86
|
}
|
|
83
|
-
ok("memory.search", result);
|
|
87
|
+
ok("memory.search", withMemoryProject(result, projectKey));
|
|
84
88
|
return true;
|
|
85
89
|
}
|
|
86
90
|
if (action === "promote") {
|
|
@@ -101,17 +105,33 @@ export async function handleMemory({ domain, action, positional, flags }) {
|
|
|
101
105
|
...(typeof flags.title === "string" ? { title: flags.title } : {}),
|
|
102
106
|
},
|
|
103
107
|
});
|
|
104
|
-
|
|
108
|
+
printMemoryProjectIfHuman(flags, projectKey);
|
|
109
|
+
ok("memory.promote", withMemoryProject(result, projectKey));
|
|
105
110
|
return true;
|
|
106
111
|
}
|
|
107
112
|
if (action === "reindex" || action === "sync") {
|
|
108
113
|
const machineId = await resolveMemoryMachineId(client, flags);
|
|
109
114
|
const projectKey = await resolveMemoryProjectKey(client, flags, machineId);
|
|
110
|
-
|
|
115
|
+
const result = await client.memory({ machineId, action, projectKey, mode: parseMemoryMode(flags.mode) ?? "readonly" });
|
|
116
|
+
printMemoryProjectIfHuman(flags, projectKey);
|
|
117
|
+
ok(`memory.${action}`, withMemoryProject(result, projectKey));
|
|
111
118
|
return true;
|
|
112
119
|
}
|
|
113
120
|
return false;
|
|
114
121
|
}
|
|
122
|
+
function withMemoryProject(result, projectKey) {
|
|
123
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
124
|
+
return { ...result, projectKey };
|
|
125
|
+
}
|
|
126
|
+
return { result, projectKey };
|
|
127
|
+
}
|
|
128
|
+
function printMemoryProjectIfHuman(flags, projectKey) {
|
|
129
|
+
if (!wantsJson(flags))
|
|
130
|
+
printMemoryProject(projectKey);
|
|
131
|
+
}
|
|
132
|
+
function printMemoryProject(projectKey) {
|
|
133
|
+
console.error(`Memory project: ${projectKey}`);
|
|
134
|
+
}
|
|
115
135
|
async function resolveMemoryMachineId(client, flags) {
|
|
116
136
|
if (typeof flags.machine === "string" && flags.machine.length > 0)
|
|
117
137
|
return flags.machine;
|
package/apps/cli/package.json
CHANGED
package/apps/daemon/package.json
CHANGED