From 234ea1e7ffbc242338fca2b97c65ef02a677d13a Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 22 Jul 2025 20:02:02 +0000 Subject: [PATCH] fix: handle boolean memory-key flag in post-edit hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/cli/simple-commands/hooks.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cli/simple-commands/hooks.js b/src/cli/simple-commands/hooks.js index 6698fd78d6..5b2a9e6316 100644 --- a/src/cli/simple-commands/hooks.js +++ b/src/cli/simple-commands/hooks.js @@ -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, {