fix: handle boolean memory-key flag in post-edit hook

When --memory-key is passed without a value, it's parsed as boolean true.
This caused SQLite binding errors. Now generates a default key based on
filename and timestamp when the flag is passed without a value.

Fixes: SQLite3 can only bind numbers, strings, bigints, buffers, and null

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rUvandClaude committed 2025-07-22 20:02:02 +00:00
1 parent b3b52761da
commit 234ea1e7ff
1 file changed
+11 -2
+11 -2
View File
@@ -438,7 +438,16 @@ async function postTaskCommand(subArgs, flags) {
async function postEditCommand(subArgs, flags) {
const options = flags;
const file = options.file || 'unknown-file';
const memoryKey = options['memory-key'] || options.memoryKey;
let memoryKey = options['memory-key'] || options.memoryKey;
// Handle case where memory-key is passed as a boolean flag without value
if (memoryKey === true) {
// Generate a default memory key based on the file path and timestamp
const path = await import('path');
const basename = path.basename(file);
memoryKey = `edit:${basename}:${Date.now()}`;
}
const format = options.format || false;
const updateMemory = options['update-memory'] || false;
const trainNeural = options['train-neural'] || false;
@@ -566,7 +575,7 @@ async function postEditCommand(subArgs, flags) {
metadata: { hookType: 'post-edit', file, formatted: formatResult?.attempted || false },
});
if (memoryKey) {
if (memoryKey && typeof memoryKey === 'string') {
await store.store(
memoryKey,
{