@stackmemoryai/stackmemory 0.5.1 → 0.5.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/dist/cli/commands/config.js +81 -0
- package/dist/cli/commands/config.js.map +2 -2
- package/dist/cli/commands/decision.js +262 -0
- package/dist/cli/commands/decision.js.map +7 -0
- package/dist/cli/commands/handoff.js +87 -24
- package/dist/cli/commands/handoff.js.map +3 -3
- package/dist/cli/commands/service.js +684 -0
- package/dist/cli/commands/service.js.map +7 -0
- package/dist/cli/commands/sweep.js +311 -0
- package/dist/cli/commands/sweep.js.map +7 -0
- package/dist/cli/index.js +98 -4
- package/dist/cli/index.js.map +2 -2
- package/dist/core/config/storage-config.js +111 -0
- package/dist/core/config/storage-config.js.map +7 -0
- package/dist/core/session/enhanced-handoff.js +654 -0
- package/dist/core/session/enhanced-handoff.js.map +7 -0
- package/dist/daemon/session-daemon.js +308 -0
- package/dist/daemon/session-daemon.js.map +7 -0
- package/dist/skills/repo-ingestion-skill.js +54 -10
- package/dist/skills/repo-ingestion-skill.js.map +2 -2
- package/package.json +4 -1
- package/scripts/archive/check-all-duplicates.ts +2 -2
- package/scripts/archive/merge-linear-duplicates.ts +6 -4
- package/scripts/install-claude-hooks-auto.js +72 -15
- package/scripts/measure-handoff-impact.mjs +395 -0
- package/scripts/measure-handoff-impact.ts +450 -0
- package/templates/claude-hooks/on-startup.js +200 -19
- package/templates/services/com.stackmemory.guardian.plist +59 -0
- package/templates/services/stackmemory-guardian.service +41 -0
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { execSync, execFileSync } from "child_process";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
existsSync,
|
|
5
|
+
readFileSync,
|
|
6
|
+
writeFileSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
readdirSync,
|
|
9
|
+
unlinkSync
|
|
10
|
+
} from "fs";
|
|
4
11
|
import { join } from "path";
|
|
5
12
|
import Database from "better-sqlite3";
|
|
6
13
|
import { z } from "zod";
|
|
7
14
|
import { FrameManager } from "../../core/context/frame-manager.js";
|
|
8
15
|
import { LinearTaskManager } from "../../features/tasks/linear-task-manager.js";
|
|
9
16
|
import { logger } from "../../core/monitoring/logger.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
import { EnhancedHandoffGenerator } from "../../core/session/enhanced-handoff.js";
|
|
18
|
+
const MAX_HANDOFF_VERSIONS = 10;
|
|
19
|
+
function saveVersionedHandoff(projectRoot, branch, content) {
|
|
20
|
+
const handoffsDir = join(projectRoot, ".stackmemory", "handoffs");
|
|
21
|
+
if (!existsSync(handoffsDir)) {
|
|
22
|
+
mkdirSync(handoffsDir, { recursive: true });
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
const now = /* @__PURE__ */ new Date();
|
|
25
|
+
const timestamp = now.toISOString().slice(0, 16).replace(/[T:]/g, "-");
|
|
26
|
+
const safeBranch = branch.replace(/[^a-zA-Z0-9-]/g, "-").slice(0, 30);
|
|
27
|
+
const filename = `${timestamp}-${safeBranch}.md`;
|
|
28
|
+
const versionedPath = join(handoffsDir, filename);
|
|
29
|
+
writeFileSync(versionedPath, content);
|
|
30
|
+
try {
|
|
31
|
+
const files = readdirSync(handoffsDir).filter((f) => f.endsWith(".md")).sort().reverse();
|
|
32
|
+
for (const oldFile of files.slice(MAX_HANDOFF_VERSIONS)) {
|
|
33
|
+
unlinkSync(join(handoffsDir, oldFile));
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
return versionedPath;
|
|
21
38
|
}
|
|
39
|
+
const CommitMessageSchema = z.string().min(1, "Commit message cannot be empty").max(200, "Commit message too long").regex(
|
|
40
|
+
/^[a-zA-Z0-9\s\-_.,:()\/\[\]]+$/,
|
|
41
|
+
"Commit message contains invalid characters"
|
|
42
|
+
).refine(
|
|
43
|
+
(msg) => !msg.includes("\n"),
|
|
44
|
+
"Commit message cannot contain newlines"
|
|
45
|
+
).refine(
|
|
46
|
+
(msg) => !msg.includes('"'),
|
|
47
|
+
"Commit message cannot contain double quotes"
|
|
48
|
+
).refine(
|
|
49
|
+
(msg) => !msg.includes("`"),
|
|
50
|
+
"Commit message cannot contain backticks"
|
|
51
|
+
);
|
|
22
52
|
function createHandoffCommand() {
|
|
23
53
|
const cmd = new Command("handoff");
|
|
24
54
|
cmd.description("Session handoff for continuity between Claude sessions");
|
|
25
|
-
cmd.command("capture", { isDefault: true }).description("Commit current work and generate a handoff prompt").option("-m, --message <message>", "Custom commit message").option("--no-commit", "Skip git commit").option("--copy", "Copy the handoff prompt to clipboard").action(async (options) => {
|
|
55
|
+
cmd.command("capture", { isDefault: true }).description("Commit current work and generate a handoff prompt").option("-m, --message <message>", "Custom commit message").option("--no-commit", "Skip git commit").option("--copy", "Copy the handoff prompt to clipboard").option("--basic", "Use basic handoff format instead of enhanced").action(async (options) => {
|
|
26
56
|
try {
|
|
27
57
|
const projectRoot = process.cwd();
|
|
28
58
|
const dbPath = join(projectRoot, ".stackmemory", "context.db");
|
|
@@ -34,7 +64,7 @@ function createHandoffCommand() {
|
|
|
34
64
|
cwd: projectRoot
|
|
35
65
|
});
|
|
36
66
|
hasChanges = gitStatus.trim().length > 0;
|
|
37
|
-
} catch
|
|
67
|
+
} catch {
|
|
38
68
|
console.log("\u26A0\uFE0F Not in a git repository");
|
|
39
69
|
}
|
|
40
70
|
if (hasChanges && options.commit !== false) {
|
|
@@ -48,7 +78,10 @@ function createHandoffCommand() {
|
|
|
48
78
|
try {
|
|
49
79
|
commitMessage = CommitMessageSchema.parse(commitMessage);
|
|
50
80
|
} catch (validationError) {
|
|
51
|
-
console.error(
|
|
81
|
+
console.error(
|
|
82
|
+
"\u274C Invalid commit message:",
|
|
83
|
+
validationError.message
|
|
84
|
+
);
|
|
52
85
|
return;
|
|
53
86
|
}
|
|
54
87
|
execFileSync("git", ["commit", "-m", commitMessage], {
|
|
@@ -139,7 +172,7 @@ function createHandoffCommand() {
|
|
|
139
172
|
}
|
|
140
173
|
let gitInfo = "";
|
|
141
174
|
try {
|
|
142
|
-
const
|
|
175
|
+
const branch2 = execSync("git rev-parse --abbrev-ref HEAD", {
|
|
143
176
|
encoding: "utf-8",
|
|
144
177
|
cwd: projectRoot
|
|
145
178
|
}).trim();
|
|
@@ -149,10 +182,10 @@ function createHandoffCommand() {
|
|
|
149
182
|
}).trim();
|
|
150
183
|
gitInfo = `
|
|
151
184
|
Git Status:
|
|
152
|
-
Branch: ${
|
|
185
|
+
Branch: ${branch2}
|
|
153
186
|
Last commit: ${lastCommit}
|
|
154
187
|
`;
|
|
155
|
-
} catch
|
|
188
|
+
} catch {
|
|
156
189
|
}
|
|
157
190
|
let notes = "";
|
|
158
191
|
const notesPath = join(projectRoot, ".stackmemory", "handoff.md");
|
|
@@ -165,8 +198,10 @@ ${handoffNotes}
|
|
|
165
198
|
`;
|
|
166
199
|
}
|
|
167
200
|
}
|
|
168
|
-
|
|
169
|
-
|
|
201
|
+
let handoffPrompt;
|
|
202
|
+
if (options.basic) {
|
|
203
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
204
|
+
handoffPrompt = `# Session Handoff - ${timestamp}
|
|
170
205
|
|
|
171
206
|
## Project: ${projectRoot.split("/").pop()}
|
|
172
207
|
|
|
@@ -192,12 +227,34 @@ ${notes}
|
|
|
192
227
|
---
|
|
193
228
|
Generated by stackmemory handoff at ${timestamp}
|
|
194
229
|
`;
|
|
230
|
+
} else {
|
|
231
|
+
const enhancedGenerator = new EnhancedHandoffGenerator(projectRoot);
|
|
232
|
+
const enhancedHandoff = await enhancedGenerator.generate();
|
|
233
|
+
handoffPrompt = enhancedGenerator.toMarkdown(enhancedHandoff);
|
|
234
|
+
console.log(`Estimated tokens: ~${enhancedHandoff.estimatedTokens}`);
|
|
235
|
+
}
|
|
195
236
|
const handoffPath = join(
|
|
196
237
|
projectRoot,
|
|
197
238
|
".stackmemory",
|
|
198
239
|
"last-handoff.md"
|
|
199
240
|
);
|
|
200
241
|
writeFileSync(handoffPath, handoffPrompt);
|
|
242
|
+
let branch = "unknown";
|
|
243
|
+
try {
|
|
244
|
+
branch = execSync("git rev-parse --abbrev-ref HEAD", {
|
|
245
|
+
encoding: "utf-8",
|
|
246
|
+
cwd: projectRoot
|
|
247
|
+
}).trim();
|
|
248
|
+
} catch {
|
|
249
|
+
}
|
|
250
|
+
const versionedPath = saveVersionedHandoff(
|
|
251
|
+
projectRoot,
|
|
252
|
+
branch,
|
|
253
|
+
handoffPrompt
|
|
254
|
+
);
|
|
255
|
+
console.log(
|
|
256
|
+
`Versioned: ${versionedPath.split("/").slice(-2).join("/")}`
|
|
257
|
+
);
|
|
201
258
|
console.log("\n" + "=".repeat(60));
|
|
202
259
|
console.log(handoffPrompt);
|
|
203
260
|
console.log("=".repeat(60));
|
|
@@ -220,7 +277,7 @@ Generated by stackmemory handoff at ${timestamp}
|
|
|
220
277
|
});
|
|
221
278
|
}
|
|
222
279
|
console.log("\n\u2705 Handoff prompt copied to clipboard!");
|
|
223
|
-
} catch
|
|
280
|
+
} catch {
|
|
224
281
|
console.log("\n\u26A0\uFE0F Could not copy to clipboard");
|
|
225
282
|
}
|
|
226
283
|
}
|
|
@@ -274,7 +331,7 @@ Generated by stackmemory handoff at ${timestamp}
|
|
|
274
331
|
console.log("\n\u26A0\uFE0F Current uncommitted changes:");
|
|
275
332
|
console.log(gitStatus);
|
|
276
333
|
}
|
|
277
|
-
} catch
|
|
334
|
+
} catch {
|
|
278
335
|
}
|
|
279
336
|
if (options.copy !== false) {
|
|
280
337
|
try {
|
|
@@ -295,7 +352,7 @@ Generated by stackmemory handoff at ${timestamp}
|
|
|
295
352
|
});
|
|
296
353
|
}
|
|
297
354
|
console.log("\n\u2705 Handoff prompt copied to clipboard!");
|
|
298
|
-
} catch
|
|
355
|
+
} catch {
|
|
299
356
|
console.log("\n\u26A0\uFE0F Could not copy to clipboard");
|
|
300
357
|
}
|
|
301
358
|
}
|
|
@@ -323,7 +380,10 @@ Generated by stackmemory handoff at ${timestamp}
|
|
|
323
380
|
console.log("\u{1F6E1}\uFE0F StackMemory Auto-Handoff");
|
|
324
381
|
console.log("\u2500".repeat(50));
|
|
325
382
|
if (options.command) {
|
|
326
|
-
const commandSchema = z.string().min(1, "Command cannot be empty").max(200, "Command too long").regex(
|
|
383
|
+
const commandSchema = z.string().min(1, "Command cannot be empty").max(200, "Command too long").regex(
|
|
384
|
+
/^[a-zA-Z0-9\s\-_./:]+$/,
|
|
385
|
+
"Command contains invalid characters"
|
|
386
|
+
).refine((cmd2) => !cmd2.includes(";"), 'Command cannot contain ";"').refine((cmd2) => !cmd2.includes("&"), 'Command cannot contain "&"').refine((cmd2) => !cmd2.includes("|"), 'Command cannot contain "|"').refine((cmd2) => !cmd2.includes("$"), 'Command cannot contain "$"').refine((cmd2) => !cmd2.includes("`"), 'Command cannot contain "`"');
|
|
327
387
|
try {
|
|
328
388
|
const validatedCommand = commandSchema.parse(options.command);
|
|
329
389
|
console.log(`Wrapping command: ${validatedCommand}`);
|
|
@@ -338,7 +398,10 @@ Generated by stackmemory handoff at ${timestamp}
|
|
|
338
398
|
console.error(` ${err.message}`);
|
|
339
399
|
});
|
|
340
400
|
} else {
|
|
341
|
-
console.error(
|
|
401
|
+
console.error(
|
|
402
|
+
"\u274C Failed to execute command:",
|
|
403
|
+
validationError.message
|
|
404
|
+
);
|
|
342
405
|
}
|
|
343
406
|
return;
|
|
344
407
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/commands/handoff.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Handoff command - Commits work and generates a prompt for the next session\n */\n\nimport { Command } from 'commander';\nimport { execSync, execFileSync } from 'child_process';\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\nimport Database from 'better-sqlite3';\nimport shellEscape from 'shell-escape';\nimport { z } from 'zod';\nimport { FrameManager } from '../../core/context/frame-manager.js';\nimport { LinearTaskManager } from '../../features/tasks/linear-task-manager.js';\nimport { logger } from '../../core/monitoring/logger.js';\n\n// Input validation schemas \nconst CommitMessageSchema = z.string()\n .min(1, 'Commit message cannot be empty')\n .max(200, 'Commit message too long')\n .regex(/^[a-zA-Z0-9\\s\\-_.,:()\\/\\[\\]]+$/, 'Commit message contains invalid characters')\n .refine(msg => !msg.includes('\\n'), 'Commit message cannot contain newlines')\n .refine(msg => !msg.includes('\"'), 'Commit message cannot contain double quotes')\n .refine(msg => !msg.includes('`'), 'Commit message cannot contain backticks');\n// Type-safe environment variable access\nfunction getEnv(key: string, defaultValue?: string): string {\n const value = process.env[key];\n if (value === undefined) {\n if (defaultValue !== undefined) return defaultValue;\n throw new Error(`Environment variable ${key} is required`);\n }\n return value;\n}\n\nfunction getOptionalEnv(key: string): string | undefined {\n return process.env[key];\n}\n\nexport function createHandoffCommand(): Command {\n const cmd = new Command('handoff');\n\n cmd.description('Session handoff for continuity between Claude sessions');\n\n // Default action - capture handoff\n cmd\n .command('capture', { isDefault: true })\n .description('Commit current work and generate a handoff prompt')\n .option('-m, --message <message>', 'Custom commit message')\n .option('--no-commit', 'Skip git commit')\n .option('--copy', 'Copy the handoff prompt to clipboard')\n .action(async (options) => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n // 1. Check git status\n let gitStatus = '';\n let hasChanges = false;\n\n try {\n gitStatus = execSync('git status --short', {\n encoding: 'utf-8',\n cwd: projectRoot,\n });\n hasChanges = gitStatus.trim().length > 0;\n } catch (err: unknown) {\n console.log('\u26A0\uFE0F Not in a git repository');\n }\n\n // 2. Commit if there are changes and not skipped\n if (hasChanges && options.commit !== false) {\n try {\n // Get current branch\n const currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n // Stage all changes\n execSync('git add -A', { cwd: projectRoot });\n\n // Generate or use custom commit message\n let commitMessage =\n options.message ||\n `chore: handoff checkpoint on ${currentBranch}`;\n \n // Validate commit message\n try {\n commitMessage = CommitMessageSchema.parse(commitMessage);\n } catch (validationError) {\n console.error('\u274C Invalid commit message:', (validationError as Error).message);\n return;\n }\n\n // Commit using execFileSync for safety\n execFileSync('git', ['commit', '-m', commitMessage], { \n cwd: projectRoot,\n stdio: 'inherit'\n });\n\n console.log(`\u2705 Committed changes: \"${commitMessage}\"`);\n console.log(` Branch: ${currentBranch}`);\n } catch (err: unknown) {\n console.error(\n '\u274C Failed to commit changes:',\n (err as Error).message\n );\n }\n } else if (!hasChanges) {\n console.log('\u2139\uFE0F No changes to commit');\n }\n\n // 3. Gather context for handoff prompt\n let contextSummary = '';\n let tasksSummary = '';\n let recentWork = '';\n\n if (existsSync(dbPath)) {\n const db = new Database(dbPath);\n\n // Get recent context\n const frameManager = new FrameManager(db, 'cli-project');\n const activeFrames = frameManager.getActiveFramePath();\n\n if (activeFrames.length > 0) {\n contextSummary = 'Active context frames:\\n';\n activeFrames.forEach((frame) => {\n contextSummary += ` - ${frame.name} [${frame.type}]\\n`;\n });\n }\n\n // Get task status\n const taskStore = new LinearTaskManager(projectRoot, db);\n const activeTasks = taskStore.getActiveTasks();\n\n const inProgress = activeTasks.filter(\n (t: any) => t.status === 'in_progress'\n );\n const todo = activeTasks.filter((t: any) => t.status === 'pending');\n const recentlyCompleted = activeTasks\n .filter((t: any) => t.status === 'completed' && t.completed_at)\n .sort(\n (a: any, b: any) => (b.completed_at || 0) - (a.completed_at || 0)\n )\n .slice(0, 3);\n\n if (inProgress.length > 0 || todo.length > 0) {\n tasksSummary = '\\nTasks:\\n';\n\n if (inProgress.length > 0) {\n tasksSummary += 'In Progress:\\n';\n inProgress.forEach((t: any) => {\n const externalId = t.external_refs?.linear?.id;\n tasksSummary += ` - ${t.title}${externalId ? ` [${externalId}]` : ''}\\n`;\n });\n }\n\n if (todo.length > 0) {\n tasksSummary += 'TODO:\\n';\n todo.slice(0, 5).forEach((t: any) => {\n const externalId = t.external_refs?.linear?.id;\n tasksSummary += ` - ${t.title}${externalId ? ` [${externalId}]` : ''}\\n`;\n });\n if (todo.length > 5) {\n tasksSummary += ` ... and ${todo.length - 5} more\\n`;\n }\n }\n }\n\n if (recentlyCompleted.length > 0) {\n recentWork = '\\nRecently Completed:\\n';\n recentlyCompleted.forEach((t: any) => {\n recentWork += ` \u2713 ${t.title}\\n`;\n });\n }\n\n // Get recent events\n const recentEvents = db\n .prepare(\n `\n SELECT event_type as type, payload as data, datetime(ts, 'unixepoch') as time\n FROM events\n ORDER BY ts DESC\n LIMIT 5\n `\n )\n .all() as any[];\n\n if (recentEvents.length > 0) {\n recentWork += '\\nRecent Activity:\\n';\n recentEvents.forEach((event) => {\n const data = JSON.parse(event.data);\n recentWork += ` - ${event.type}: ${data.message || data.name || 'activity'}\\n`;\n });\n }\n\n db.close();\n }\n\n // 4. Get current git info\n let gitInfo = '';\n try {\n const branch = execSync('git rev-parse --abbrev-ref HEAD', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n const lastCommit = execSync('git log -1 --oneline', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n gitInfo = `\\nGit Status:\\n Branch: ${branch}\\n Last commit: ${lastCommit}\\n`;\n } catch (err: unknown) {\n // Ignore git errors\n }\n\n // 5. Check for any blockers or notes\n let notes = '';\n const notesPath = join(projectRoot, '.stackmemory', 'handoff.md');\n if (existsSync(notesPath)) {\n const handoffNotes = readFileSync(notesPath, 'utf-8');\n if (handoffNotes.trim()) {\n notes = `\\nNotes from previous handoff:\\n${handoffNotes}\\n`;\n }\n }\n\n // 6. Generate the handoff prompt\n const timestamp = new Date().toISOString();\n const handoffPrompt = `# Session Handoff - ${timestamp}\n\n## Project: ${projectRoot.split('/').pop()}\n\n${gitInfo}\n${contextSummary}\n${tasksSummary}\n${recentWork}\n${notes}\n\n## Continue from here:\n\n1. Run \\`stackmemory status\\` to check the current state\n2. Review any in-progress tasks above\n3. Check for any uncommitted changes with \\`git status\\`\n4. Resume work on the active context\n\n## Quick Commands:\n- \\`stackmemory context load --recent\\` - Load recent context\n- \\`stackmemory task list --state in_progress\\` - Show in-progress tasks\n- \\`stackmemory linear sync\\` - Sync with Linear if configured\n- \\`stackmemory log recent\\` - View recent activity\n\n---\nGenerated by stackmemory handoff at ${timestamp}\n`;\n\n // 7. Save handoff prompt\n const handoffPath = join(\n projectRoot,\n '.stackmemory',\n 'last-handoff.md'\n );\n writeFileSync(handoffPath, handoffPrompt);\n\n // 8. Display the prompt\n console.log('\\n' + '='.repeat(60));\n console.log(handoffPrompt);\n console.log('='.repeat(60));\n\n // 9. Copy to clipboard if requested\n if (options.copy) {\n try {\n // Use execFileSync with predefined commands for safety\n if (process.platform === 'darwin') {\n execFileSync('pbcopy', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else if (process.platform === 'win32') {\n execFileSync('clip', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else {\n execFileSync('xclip', ['-selection', 'clipboard'], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n }\n\n console.log('\\n\u2705 Handoff prompt copied to clipboard!');\n } catch (err: unknown) {\n console.log('\\n\u26A0\uFE0F Could not copy to clipboard');\n }\n }\n\n console.log(`\\n\uD83D\uDCBE Handoff saved to: ${handoffPath}`);\n console.log('\uD83D\uDCCB Use this prompt when starting your next session');\n } catch (error: unknown) {\n logger.error('Handoff command failed', error as Error);\n console.error('\u274C Handoff failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n // Restore command\n cmd\n .command('restore')\n .description('Restore context from last handoff')\n .option('--no-copy', 'Do not copy prompt to clipboard')\n .action(async (options) => {\n try {\n const projectRoot = process.cwd();\n const handoffPath = join(\n projectRoot,\n '.stackmemory',\n 'last-handoff.md'\n );\n const metaPath = join(\n process.env['HOME'] || '~',\n '.stackmemory',\n 'handoffs',\n 'last-handoff-meta.json'\n );\n\n if (!existsSync(handoffPath)) {\n console.log('\u274C No handoff found in this project');\n console.log('\uD83D\uDCA1 Run \"stackmemory handoff\" to create one');\n return;\n }\n\n // Read handoff prompt\n const handoffPrompt = readFileSync(handoffPath, 'utf-8');\n\n // Display the prompt\n console.log('\\n' + '='.repeat(60));\n console.log('\uD83D\uDCCB RESTORED HANDOFF');\n console.log('='.repeat(60));\n console.log(handoffPrompt);\n console.log('='.repeat(60));\n\n // Check for metadata\n if (existsSync(metaPath)) {\n const metadata = JSON.parse(readFileSync(metaPath, 'utf-8'));\n console.log('\\n\uD83D\uDCCA Session Metadata:');\n console.log(` Timestamp: ${metadata.timestamp}`);\n console.log(` Reason: ${metadata.reason}`);\n console.log(` Duration: ${metadata.session_duration}s`);\n console.log(` Command: ${metadata.command}`);\n }\n\n // Check current git status\n try {\n const gitStatus = execSync('git status --short', {\n encoding: 'utf-8',\n }).trim();\n if (gitStatus) {\n console.log('\\n\u26A0\uFE0F Current uncommitted changes:');\n console.log(gitStatus);\n }\n } catch (err: unknown) {\n // Not a git repo\n }\n\n // Copy to clipboard unless disabled\n if (options.copy !== false) {\n try {\n // Use execFileSync with predefined commands for safety\n if (process.platform === 'darwin') {\n execFileSync('pbcopy', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else if (process.platform === 'win32') {\n execFileSync('clip', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else {\n execFileSync('xclip', ['-selection', 'clipboard'], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n }\n\n console.log('\\n\u2705 Handoff prompt copied to clipboard!');\n } catch (err: unknown) {\n console.log('\\n\u26A0\uFE0F Could not copy to clipboard');\n }\n }\n\n console.log('\\n\uD83D\uDE80 Ready to continue where you left off!');\n } catch (error: unknown) {\n logger.error('Handoff restore failed', error as Error);\n console.error('\u274C Restore failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n // Auto command - enable auto-capture\n cmd\n .command('auto')\n .description('Enable auto-capture on session termination')\n .option('--command <command>', 'Command to wrap with auto-handoff')\n .action(async (options) => {\n const scriptPath = join(\n __dirname,\n '..',\n '..',\n '..',\n 'scripts',\n 'stackmemory-auto-handoff.sh'\n );\n\n if (!existsSync(scriptPath)) {\n console.error('\u274C Auto-handoff script not found');\n console.log('\uD83D\uDCE6 Please ensure StackMemory is properly installed');\n return;\n }\n\n console.log('\uD83D\uDEE1\uFE0F StackMemory Auto-Handoff');\n console.log('\u2500'.repeat(50));\n\n if (options.command) {\n // Validate and wrap specific command \n const commandSchema = z.string()\n .min(1, 'Command cannot be empty')\n .max(200, 'Command too long')\n .regex(/^[a-zA-Z0-9\\s\\-_./:]+$/, 'Command contains invalid characters')\n .refine(cmd => !cmd.includes(';'), 'Command cannot contain \";\"')\n .refine(cmd => !cmd.includes('&'), 'Command cannot contain \"&\"')\n .refine(cmd => !cmd.includes('|'), 'Command cannot contain \"|\"')\n .refine(cmd => !cmd.includes('$'), 'Command cannot contain \"$\"')\n .refine(cmd => !cmd.includes('`'), 'Command cannot contain \"`\"');\n \n try {\n const validatedCommand = commandSchema.parse(options.command);\n console.log(`Wrapping command: ${validatedCommand}`);\n execFileSync(scriptPath, [validatedCommand], {\n stdio: 'inherit',\n env: { ...process.env, AUTO_CAPTURE_ON_EXIT: 'true' },\n });\n } catch (validationError) {\n if (validationError instanceof z.ZodError) {\n console.error('\u274C Invalid command:');\n validationError.errors.forEach(err => {\n console.error(` ${err.message}`);\n });\n } else {\n console.error('\u274C Failed to execute command:', (validationError as Error).message);\n }\n return;\n }\n } else {\n // Interactive mode\n console.log('To enable auto-handoff for your current session:');\n console.log('');\n console.log(' For bash/zsh:');\n console.log(` source <(${scriptPath} --shell)`);\n console.log('');\n console.log(' Or wrap a command:');\n console.log(` ${scriptPath} claude`);\n console.log(` ${scriptPath} npm run dev`);\n console.log('');\n console.log(' Add to your shell profile for permanent setup:');\n console.log(\n ` echo 'alias claude=\"${scriptPath} claude\"' >> ~/.bashrc`\n );\n }\n });\n\n return cmd;\n}\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,eAAe;AACxB,SAAS,UAAU,oBAAoB;AACvC,
|
|
6
|
-
"names": ["cmd"]
|
|
4
|
+
"sourcesContent": ["/**\n * Handoff command - Commits work and generates a prompt for the next session\n */\n\nimport { Command } from 'commander';\nimport { execSync, execFileSync } from 'child_process';\nimport {\n existsSync,\n readFileSync,\n writeFileSync,\n mkdirSync,\n readdirSync,\n unlinkSync,\n} from 'fs';\nimport { join } from 'path';\nimport Database from 'better-sqlite3';\nimport { z } from 'zod';\nimport { FrameManager } from '../../core/context/frame-manager.js';\nimport { LinearTaskManager } from '../../features/tasks/linear-task-manager.js';\nimport { logger } from '../../core/monitoring/logger.js';\nimport { EnhancedHandoffGenerator } from '../../core/session/enhanced-handoff.js';\n\n// Handoff versioning - keep last N handoffs\nconst MAX_HANDOFF_VERSIONS = 10;\n\nfunction saveVersionedHandoff(\n projectRoot: string,\n branch: string,\n content: string\n): string {\n const handoffsDir = join(projectRoot, '.stackmemory', 'handoffs');\n if (!existsSync(handoffsDir)) {\n mkdirSync(handoffsDir, { recursive: true });\n }\n\n // Generate versioned filename: YYYY-MM-DD-HH-mm-branch.md\n const now = new Date();\n const timestamp = now.toISOString().slice(0, 16).replace(/[T:]/g, '-');\n const safeBranch = branch.replace(/[^a-zA-Z0-9-]/g, '-').slice(0, 30);\n const filename = `${timestamp}-${safeBranch}.md`;\n const versionedPath = join(handoffsDir, filename);\n\n // Save versioned handoff\n writeFileSync(versionedPath, content);\n\n // Clean up old handoffs (keep last N)\n try {\n const files = readdirSync(handoffsDir)\n .filter((f) => f.endsWith('.md'))\n .sort()\n .reverse();\n\n for (const oldFile of files.slice(MAX_HANDOFF_VERSIONS)) {\n unlinkSync(join(handoffsDir, oldFile));\n }\n } catch {\n // Cleanup failed, not critical\n }\n\n return versionedPath;\n}\n\n// Input validation schemas\nconst CommitMessageSchema = z\n .string()\n .min(1, 'Commit message cannot be empty')\n .max(200, 'Commit message too long')\n .regex(\n /^[a-zA-Z0-9\\s\\-_.,:()\\/\\[\\]]+$/,\n 'Commit message contains invalid characters'\n )\n .refine(\n (msg) => !msg.includes('\\n'),\n 'Commit message cannot contain newlines'\n )\n .refine(\n (msg) => !msg.includes('\"'),\n 'Commit message cannot contain double quotes'\n )\n .refine(\n (msg) => !msg.includes('`'),\n 'Commit message cannot contain backticks'\n );\n\nexport function createHandoffCommand(): Command {\n const cmd = new Command('handoff');\n\n cmd.description('Session handoff for continuity between Claude sessions');\n\n // Default action - capture handoff\n cmd\n .command('capture', { isDefault: true })\n .description('Commit current work and generate a handoff prompt')\n .option('-m, --message <message>', 'Custom commit message')\n .option('--no-commit', 'Skip git commit')\n .option('--copy', 'Copy the handoff prompt to clipboard')\n .option('--basic', 'Use basic handoff format instead of enhanced')\n .action(async (options) => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n // 1. Check git status\n let gitStatus = '';\n let hasChanges = false;\n\n try {\n gitStatus = execSync('git status --short', {\n encoding: 'utf-8',\n cwd: projectRoot,\n });\n hasChanges = gitStatus.trim().length > 0;\n } catch {\n console.log('\u26A0\uFE0F Not in a git repository');\n }\n\n // 2. Commit if there are changes and not skipped\n if (hasChanges && options.commit !== false) {\n try {\n // Get current branch\n const currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n // Stage all changes\n execSync('git add -A', { cwd: projectRoot });\n\n // Generate or use custom commit message\n let commitMessage =\n options.message ||\n `chore: handoff checkpoint on ${currentBranch}`;\n\n // Validate commit message\n try {\n commitMessage = CommitMessageSchema.parse(commitMessage);\n } catch (validationError) {\n console.error(\n '\u274C Invalid commit message:',\n (validationError as Error).message\n );\n return;\n }\n\n // Commit using execFileSync for safety\n execFileSync('git', ['commit', '-m', commitMessage], {\n cwd: projectRoot,\n stdio: 'inherit',\n });\n\n console.log(`\u2705 Committed changes: \"${commitMessage}\"`);\n console.log(` Branch: ${currentBranch}`);\n } catch (err: unknown) {\n console.error(\n '\u274C Failed to commit changes:',\n (err as Error).message\n );\n }\n } else if (!hasChanges) {\n console.log('\u2139\uFE0F No changes to commit');\n }\n\n // 3. Gather context for handoff prompt\n let contextSummary = '';\n let tasksSummary = '';\n let recentWork = '';\n\n if (existsSync(dbPath)) {\n const db = new Database(dbPath);\n\n // Get recent context\n const frameManager = new FrameManager(db, 'cli-project');\n const activeFrames = frameManager.getActiveFramePath();\n\n if (activeFrames.length > 0) {\n contextSummary = 'Active context frames:\\n';\n activeFrames.forEach((frame) => {\n contextSummary += ` - ${frame.name} [${frame.type}]\\n`;\n });\n }\n\n // Get task status\n const taskStore = new LinearTaskManager(projectRoot, db);\n const activeTasks = taskStore.getActiveTasks();\n\n const inProgress = activeTasks.filter(\n (t: any) => t.status === 'in_progress'\n );\n const todo = activeTasks.filter((t: any) => t.status === 'pending');\n const recentlyCompleted = activeTasks\n .filter((t: any) => t.status === 'completed' && t.completed_at)\n .sort(\n (a: any, b: any) => (b.completed_at || 0) - (a.completed_at || 0)\n )\n .slice(0, 3);\n\n if (inProgress.length > 0 || todo.length > 0) {\n tasksSummary = '\\nTasks:\\n';\n\n if (inProgress.length > 0) {\n tasksSummary += 'In Progress:\\n';\n inProgress.forEach((t: any) => {\n const externalId = t.external_refs?.linear?.id;\n tasksSummary += ` - ${t.title}${externalId ? ` [${externalId}]` : ''}\\n`;\n });\n }\n\n if (todo.length > 0) {\n tasksSummary += 'TODO:\\n';\n todo.slice(0, 5).forEach((t: any) => {\n const externalId = t.external_refs?.linear?.id;\n tasksSummary += ` - ${t.title}${externalId ? ` [${externalId}]` : ''}\\n`;\n });\n if (todo.length > 5) {\n tasksSummary += ` ... and ${todo.length - 5} more\\n`;\n }\n }\n }\n\n if (recentlyCompleted.length > 0) {\n recentWork = '\\nRecently Completed:\\n';\n recentlyCompleted.forEach((t: any) => {\n recentWork += ` \u2713 ${t.title}\\n`;\n });\n }\n\n // Get recent events\n const recentEvents = db\n .prepare(\n `\n SELECT event_type as type, payload as data, datetime(ts, 'unixepoch') as time\n FROM events\n ORDER BY ts DESC\n LIMIT 5\n `\n )\n .all() as any[];\n\n if (recentEvents.length > 0) {\n recentWork += '\\nRecent Activity:\\n';\n recentEvents.forEach((event) => {\n const data = JSON.parse(event.data);\n recentWork += ` - ${event.type}: ${data.message || data.name || 'activity'}\\n`;\n });\n }\n\n db.close();\n }\n\n // 4. Get current git info\n let gitInfo = '';\n try {\n const branch = execSync('git rev-parse --abbrev-ref HEAD', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n const lastCommit = execSync('git log -1 --oneline', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n\n gitInfo = `\\nGit Status:\\n Branch: ${branch}\\n Last commit: ${lastCommit}\\n`;\n } catch {\n // Ignore git errors\n }\n\n // 5. Check for any blockers or notes\n let notes = '';\n const notesPath = join(projectRoot, '.stackmemory', 'handoff.md');\n if (existsSync(notesPath)) {\n const handoffNotes = readFileSync(notesPath, 'utf-8');\n if (handoffNotes.trim()) {\n notes = `\\nNotes from previous handoff:\\n${handoffNotes}\\n`;\n }\n }\n\n // 6. Generate the handoff prompt\n let handoffPrompt: string;\n\n if (options.basic) {\n // Use basic handoff format\n const timestamp = new Date().toISOString();\n handoffPrompt = `# Session Handoff - ${timestamp}\n\n## Project: ${projectRoot.split('/').pop()}\n\n${gitInfo}\n${contextSummary}\n${tasksSummary}\n${recentWork}\n${notes}\n\n## Continue from here:\n\n1. Run \\`stackmemory status\\` to check the current state\n2. Review any in-progress tasks above\n3. Check for any uncommitted changes with \\`git status\\`\n4. Resume work on the active context\n\n## Quick Commands:\n- \\`stackmemory context load --recent\\` - Load recent context\n- \\`stackmemory task list --state in_progress\\` - Show in-progress tasks\n- \\`stackmemory linear sync\\` - Sync with Linear if configured\n- \\`stackmemory log recent\\` - View recent activity\n\n---\nGenerated by stackmemory handoff at ${timestamp}\n`;\n } else {\n // Use high-efficacy enhanced handoff generator (default)\n const enhancedGenerator = new EnhancedHandoffGenerator(projectRoot);\n const enhancedHandoff = await enhancedGenerator.generate();\n handoffPrompt = enhancedGenerator.toMarkdown(enhancedHandoff);\n console.log(`Estimated tokens: ~${enhancedHandoff.estimatedTokens}`);\n }\n\n // 7. Save handoff prompt (both latest and versioned)\n const handoffPath = join(\n projectRoot,\n '.stackmemory',\n 'last-handoff.md'\n );\n writeFileSync(handoffPath, handoffPrompt);\n\n // Save versioned copy\n let branch = 'unknown';\n try {\n branch = execSync('git rev-parse --abbrev-ref HEAD', {\n encoding: 'utf-8',\n cwd: projectRoot,\n }).trim();\n } catch {\n // Not a git repo\n }\n const versionedPath = saveVersionedHandoff(\n projectRoot,\n branch,\n handoffPrompt\n );\n console.log(\n `Versioned: ${versionedPath.split('/').slice(-2).join('/')}`\n );\n\n // 8. Display the prompt\n console.log('\\n' + '='.repeat(60));\n console.log(handoffPrompt);\n console.log('='.repeat(60));\n\n // 9. Copy to clipboard if requested\n if (options.copy) {\n try {\n // Use execFileSync with predefined commands for safety\n if (process.platform === 'darwin') {\n execFileSync('pbcopy', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else if (process.platform === 'win32') {\n execFileSync('clip', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else {\n execFileSync('xclip', ['-selection', 'clipboard'], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n }\n\n console.log('\\n\u2705 Handoff prompt copied to clipboard!');\n } catch {\n console.log('\\n\u26A0\uFE0F Could not copy to clipboard');\n }\n }\n\n console.log(`\\n\uD83D\uDCBE Handoff saved to: ${handoffPath}`);\n console.log('\uD83D\uDCCB Use this prompt when starting your next session');\n } catch (error: unknown) {\n logger.error('Handoff command failed', error as Error);\n console.error('\u274C Handoff failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n // Restore command\n cmd\n .command('restore')\n .description('Restore context from last handoff')\n .option('--no-copy', 'Do not copy prompt to clipboard')\n .action(async (options) => {\n try {\n const projectRoot = process.cwd();\n const handoffPath = join(\n projectRoot,\n '.stackmemory',\n 'last-handoff.md'\n );\n const metaPath = join(\n process.env['HOME'] || '~',\n '.stackmemory',\n 'handoffs',\n 'last-handoff-meta.json'\n );\n\n if (!existsSync(handoffPath)) {\n console.log('\u274C No handoff found in this project');\n console.log('\uD83D\uDCA1 Run \"stackmemory handoff\" to create one');\n return;\n }\n\n // Read handoff prompt\n const handoffPrompt = readFileSync(handoffPath, 'utf-8');\n\n // Display the prompt\n console.log('\\n' + '='.repeat(60));\n console.log('\uD83D\uDCCB RESTORED HANDOFF');\n console.log('='.repeat(60));\n console.log(handoffPrompt);\n console.log('='.repeat(60));\n\n // Check for metadata\n if (existsSync(metaPath)) {\n const metadata = JSON.parse(readFileSync(metaPath, 'utf-8'));\n console.log('\\n\uD83D\uDCCA Session Metadata:');\n console.log(` Timestamp: ${metadata.timestamp}`);\n console.log(` Reason: ${metadata.reason}`);\n console.log(` Duration: ${metadata.session_duration}s`);\n console.log(` Command: ${metadata.command}`);\n }\n\n // Check current git status\n try {\n const gitStatus = execSync('git status --short', {\n encoding: 'utf-8',\n }).trim();\n if (gitStatus) {\n console.log('\\n\u26A0\uFE0F Current uncommitted changes:');\n console.log(gitStatus);\n }\n } catch {\n // Not a git repo\n }\n\n // Copy to clipboard unless disabled\n if (options.copy !== false) {\n try {\n // Use execFileSync with predefined commands for safety\n if (process.platform === 'darwin') {\n execFileSync('pbcopy', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else if (process.platform === 'win32') {\n execFileSync('clip', [], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n } else {\n execFileSync('xclip', ['-selection', 'clipboard'], {\n input: handoffPrompt,\n cwd: projectRoot,\n });\n }\n\n console.log('\\n\u2705 Handoff prompt copied to clipboard!');\n } catch {\n console.log('\\n\u26A0\uFE0F Could not copy to clipboard');\n }\n }\n\n console.log('\\n\uD83D\uDE80 Ready to continue where you left off!');\n } catch (error: unknown) {\n logger.error('Handoff restore failed', error as Error);\n console.error('\u274C Restore failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n // Auto command - enable auto-capture\n cmd\n .command('auto')\n .description('Enable auto-capture on session termination')\n .option('--command <command>', 'Command to wrap with auto-handoff')\n .action(async (options) => {\n const scriptPath = join(\n __dirname,\n '..',\n '..',\n '..',\n 'scripts',\n 'stackmemory-auto-handoff.sh'\n );\n\n if (!existsSync(scriptPath)) {\n console.error('\u274C Auto-handoff script not found');\n console.log('\uD83D\uDCE6 Please ensure StackMemory is properly installed');\n return;\n }\n\n console.log('\uD83D\uDEE1\uFE0F StackMemory Auto-Handoff');\n console.log('\u2500'.repeat(50));\n\n if (options.command) {\n // Validate and wrap specific command\n const commandSchema = z\n .string()\n .min(1, 'Command cannot be empty')\n .max(200, 'Command too long')\n .regex(\n /^[a-zA-Z0-9\\s\\-_./:]+$/,\n 'Command contains invalid characters'\n )\n .refine((cmd) => !cmd.includes(';'), 'Command cannot contain \";\"')\n .refine((cmd) => !cmd.includes('&'), 'Command cannot contain \"&\"')\n .refine((cmd) => !cmd.includes('|'), 'Command cannot contain \"|\"')\n .refine((cmd) => !cmd.includes('$'), 'Command cannot contain \"$\"')\n .refine((cmd) => !cmd.includes('`'), 'Command cannot contain \"`\"');\n\n try {\n const validatedCommand = commandSchema.parse(options.command);\n console.log(`Wrapping command: ${validatedCommand}`);\n execFileSync(scriptPath, [validatedCommand], {\n stdio: 'inherit',\n env: { ...process.env, AUTO_CAPTURE_ON_EXIT: 'true' },\n });\n } catch (validationError) {\n if (validationError instanceof z.ZodError) {\n console.error('\u274C Invalid command:');\n validationError.errors.forEach((err) => {\n console.error(` ${err.message}`);\n });\n } else {\n console.error(\n '\u274C Failed to execute command:',\n (validationError as Error).message\n );\n }\n return;\n }\n } else {\n // Interactive mode\n console.log('To enable auto-handoff for your current session:');\n console.log('');\n console.log(' For bash/zsh:');\n console.log(` source <(${scriptPath} --shell)`);\n console.log('');\n console.log(' Or wrap a command:');\n console.log(` ${scriptPath} claude`);\n console.log(` ${scriptPath} npm run dev`);\n console.log('');\n console.log(' Add to your shell profile for permanent setup:');\n console.log(\n ` echo 'alias claude=\"${scriptPath} claude\"' >> ~/.bashrc`\n );\n }\n });\n\n return cmd;\n}\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,eAAe;AACxB,SAAS,UAAU,oBAAoB;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,OAAO,cAAc;AACrB,SAAS,SAAS;AAClB,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,SAAS,gCAAgC;AAGzC,MAAM,uBAAuB;AAE7B,SAAS,qBACP,aACA,QACA,SACQ;AACR,QAAM,cAAc,KAAK,aAAa,gBAAgB,UAAU;AAChE,MAAI,CAAC,WAAW,WAAW,GAAG;AAC5B,cAAU,aAAa,EAAE,WAAW,KAAK,CAAC;AAAA,EAC5C;AAGA,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,YAAY,IAAI,YAAY,EAAE,MAAM,GAAG,EAAE,EAAE,QAAQ,SAAS,GAAG;AACrE,QAAM,aAAa,OAAO,QAAQ,kBAAkB,GAAG,EAAE,MAAM,GAAG,EAAE;AACpE,QAAM,WAAW,GAAG,SAAS,IAAI,UAAU;AAC3C,QAAM,gBAAgB,KAAK,aAAa,QAAQ;AAGhD,gBAAc,eAAe,OAAO;AAGpC,MAAI;AACF,UAAM,QAAQ,YAAY,WAAW,EAClC,OAAO,CAAC,MAAM,EAAE,SAAS,KAAK,CAAC,EAC/B,KAAK,EACL,QAAQ;AAEX,eAAW,WAAW,MAAM,MAAM,oBAAoB,GAAG;AACvD,iBAAW,KAAK,aAAa,OAAO,CAAC;AAAA,IACvC;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;AAGA,MAAM,sBAAsB,EACzB,OA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