Files
supermemoryai__claude-super…/scripts/build.js
Sreeram Sreedhar 2556183965 feat: reasoned per-turn memory recall with auto-approve
Re-introduces the reasoned recall feature (previously reverted in #64),
source files only — generated plugin/scripts/*.cjs are intentionally not
included and must be produced by the build step.

- recall-hook (UserPromptSubmit): injects a per-turn directive so Claude
  decides whether recalling saved memory helps the current message.
- recall-approve (PreToolUse): auto-approves only the supermemory-search
  tool call (narrow allow-list, rejects shell-laced commands).
- settings: recallDirective override + getRecallConfig.
- build/hooks wiring and version bump to 0.0.8.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 23:13:17 -07:00

56 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
const esbuild = require('esbuild');
const fs = require('node:fs');
const path = require('node:path');
const ROOT = path.join(__dirname, '..');
const SRC = path.join(ROOT, 'src');
const OUT = path.join(ROOT, 'plugin', 'scripts');
const hooks = [
'context-hook',
'recall-hook',
'recall-approve',
'summary-hook',
'search-memory',
'add-memory',
'save-project-memory',
'status',
];
async function build() {
console.log('Building hooks...\n');
fs.mkdirSync(OUT, { recursive: true });
for (const hook of hooks) {
const entry = path.join(SRC, `${hook}.js`);
const out = path.join(OUT, `${hook}.cjs`);
try {
await esbuild.build({
entryPoints: [entry],
bundle: true,
platform: 'node',
target: 'node18',
format: 'cjs',
outfile: out,
minify: true,
banner: { js: '#!/usr/bin/env node' },
loader: { '.html': 'text' },
});
fs.chmodSync(out, 0o755);
const stats = fs.statSync(out);
console.log(` ${hook}.cjs (${(stats.size / 1024).toFixed(1)} KB)`);
} catch (err) {
console.error(`Failed to build ${hook}:`, err.message);
process.exit(1);
}
}
console.log('\nBuild complete!');
}
build();