@membank/cli 0.14.0 → 0.14.2
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 +17 -1
- package/dist/index.mjs +10 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -157,14 +157,30 @@ membank config show
|
|
|
157
157
|
|
|
158
158
|
### `membank synthesize`
|
|
159
159
|
|
|
160
|
-
View memory synthesis
|
|
160
|
+
View and manage memory synthesis.
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
|
+
membank synthesize run # trigger a synthesis run for a scope
|
|
163
164
|
membank synthesize show # current synthesis for global scope
|
|
164
165
|
membank synthesize show --scope <s> # synthesis for a specific project scope
|
|
165
166
|
membank synthesize status # all scopes and their synthesis state
|
|
166
167
|
```
|
|
167
168
|
|
|
169
|
+
Options for `run` and `show`: `--scope <scope>`
|
|
170
|
+
|
|
171
|
+
### `membank activity`
|
|
172
|
+
|
|
173
|
+
List activity events for the current project.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
membank activity
|
|
177
|
+
membank activity --type memory.created
|
|
178
|
+
membank activity --since 2025-01-01
|
|
179
|
+
membank activity --global
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Options: `--type <event_type>` (memory.created|updated|deleted|flagged|queried), `--since <date>`, `--memory-id <id>`, `--limit <n>` (default 50), `--global`, `--scope <hash>`
|
|
183
|
+
|
|
168
184
|
### `membank inject`
|
|
169
185
|
|
|
170
186
|
Output session context formatted for a harness. Called automatically by session hooks — you don't normally run this directly.
|
package/dist/index.mjs
CHANGED
|
@@ -253,12 +253,12 @@ function exportCommand(db, formatter, opts) {
|
|
|
253
253
|
//#endregion
|
|
254
254
|
//#region src/commands/extract.ts
|
|
255
255
|
const ExtractionHarnessSchema = z.enum(["claude-code"]);
|
|
256
|
-
const
|
|
256
|
+
const ClaudeCodeSessionEndInputSchema = z.object({
|
|
257
257
|
session_id: z.string(),
|
|
258
258
|
transcript_path: z.string(),
|
|
259
259
|
cwd: z.string().optional(),
|
|
260
260
|
hook_event_name: z.string().optional(),
|
|
261
|
-
|
|
261
|
+
reason: z.string().optional()
|
|
262
262
|
});
|
|
263
263
|
function parseHookPayload(harness, raw) {
|
|
264
264
|
let parsedJson;
|
|
@@ -271,7 +271,7 @@ function parseHookPayload(harness, raw) {
|
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
if (harness === "claude-code") {
|
|
274
|
-
const parsed =
|
|
274
|
+
const parsed = ClaudeCodeSessionEndInputSchema.safeParse(parsedJson);
|
|
275
275
|
if (!parsed.success) return {
|
|
276
276
|
ok: false,
|
|
277
277
|
reason: `invalid hook payload: ${parsed.error.message}`
|
|
@@ -280,8 +280,7 @@ function parseHookPayload(harness, raw) {
|
|
|
280
280
|
ok: true,
|
|
281
281
|
value: {
|
|
282
282
|
sessionId: parsed.data.session_id,
|
|
283
|
-
transcriptPath: parsed.data.transcript_path
|
|
284
|
-
stopHookActive: parsed.data.stop_hook_active === true
|
|
283
|
+
transcriptPath: parsed.data.transcript_path
|
|
285
284
|
}
|
|
286
285
|
};
|
|
287
286
|
}
|
|
@@ -305,7 +304,6 @@ async function extractCommand(opts) {
|
|
|
305
304
|
const harness = harnessResult.data;
|
|
306
305
|
let sessionId = opts.sessionId;
|
|
307
306
|
let transcriptPath = opts.transcript;
|
|
308
|
-
let stopHookActive = false;
|
|
309
307
|
if (sessionId === void 0 || transcriptPath === void 0) {
|
|
310
308
|
const raw = await readStdin();
|
|
311
309
|
if (raw.trim().length > 0) {
|
|
@@ -316,17 +314,12 @@ async function extractCommand(opts) {
|
|
|
316
314
|
}
|
|
317
315
|
sessionId = sessionId ?? parsed.value.sessionId;
|
|
318
316
|
transcriptPath = transcriptPath ?? parsed.value.transcriptPath;
|
|
319
|
-
stopHookActive = parsed.value.stopHookActive;
|
|
320
317
|
}
|
|
321
318
|
}
|
|
322
319
|
if (sessionId === void 0 || transcriptPath === void 0) {
|
|
323
320
|
process.stderr.write("membank extract: missing session_id or transcript_path (provide via stdin or --session/--transcript).\n");
|
|
324
321
|
return;
|
|
325
322
|
}
|
|
326
|
-
if (stopHookActive) {
|
|
327
|
-
process.stderr.write("membank extract: stop_hook_active=true; skipping to avoid recursion.\n");
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
323
|
try {
|
|
331
324
|
const result = await runExtraction({
|
|
332
325
|
sessionId,
|
|
@@ -1141,7 +1134,7 @@ const writers = {
|
|
|
1141
1134
|
const hooks = MaybeJsonObjectSchema.parse(cfg.hooks) ?? {};
|
|
1142
1135
|
const sessionStartInner = (Array.isArray(hooks.SessionStart) ? hooks.SessionStart : []).flatMap(getHooksArray);
|
|
1143
1136
|
const userPromptSubmitInner = (Array.isArray(hooks.UserPromptSubmit) ? hooks.UserPromptSubmit : []).flatMap(getHooksArray);
|
|
1144
|
-
const
|
|
1137
|
+
const sessionEndInner = (Array.isArray(hooks.SessionEnd) ? hooks.SessionEnd : []).flatMap(getHooksArray);
|
|
1145
1138
|
return {
|
|
1146
1139
|
status: "ready",
|
|
1147
1140
|
configPath: cfgPath,
|
|
@@ -1157,9 +1150,9 @@ const writers = {
|
|
|
1157
1150
|
existingCommand: extractInjectCommand(userPromptSubmitInner) || null
|
|
1158
1151
|
},
|
|
1159
1152
|
{
|
|
1160
|
-
event: "
|
|
1153
|
+
event: "SessionEnd",
|
|
1161
1154
|
command: "npx -y @membank/cli extract --harness claude-code",
|
|
1162
|
-
existingCommand: extractInjectCommand(
|
|
1155
|
+
existingCommand: extractInjectCommand(sessionEndInner) || null
|
|
1163
1156
|
}
|
|
1164
1157
|
]
|
|
1165
1158
|
};
|
|
@@ -1185,8 +1178,8 @@ const writers = {
|
|
|
1185
1178
|
command: "npx -y @membank/cli inject --harness claude-code --event user-prompt-submit"
|
|
1186
1179
|
}]
|
|
1187
1180
|
}];
|
|
1188
|
-
if (events.includes("
|
|
1189
|
-
matcher: "",
|
|
1181
|
+
if (events.includes("SessionEnd")) newHooks.SessionEnd = [...filterOutMembank(Array.isArray(hooks.SessionEnd) ? hooks.SessionEnd : []), {
|
|
1182
|
+
matcher: "clear|resume|logout|prompt_input_exit|other",
|
|
1190
1183
|
hooks: [{
|
|
1191
1184
|
type: "command",
|
|
1192
1185
|
command: "npx -y @membank/cli extract --harness claude-code",
|
|
@@ -1754,7 +1747,7 @@ program.command("inject").description("output session context for harness inject
|
|
|
1754
1747
|
process.exit(2);
|
|
1755
1748
|
}
|
|
1756
1749
|
});
|
|
1757
|
-
program.command("extract").description("(internal) run session-end memory extraction; reads the harness's
|
|
1750
|
+
program.command("extract").description("(internal) run session-end memory extraction; reads the harness's SessionEnd hook payload from stdin").option("--harness <name>", "harness whose session-end hook payload is on stdin (only claude-code is supported today)", "claude-code").option("--session <id>", "session id (otherwise read from stdin)").option("--transcript <path>", "transcript JSONL path (otherwise read from stdin)").action(async (cmdOptions) => {
|
|
1758
1751
|
try {
|
|
1759
1752
|
await extractCommand({
|
|
1760
1753
|
harness: cmdOptions.harness,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@membank/cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"commander": "^14.0.3",
|
|
22
22
|
"ora": "^9.4.0",
|
|
23
23
|
"zod": "^4.4.3",
|
|
24
|
-
"@membank/
|
|
25
|
-
"@membank/
|
|
24
|
+
"@membank/mcp": "0.14.3",
|
|
25
|
+
"@membank/core": "0.12.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^25.6.0",
|