delimit-cli 4.1.31 → 4.1.32
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/lib/cross-model-hooks.js +49 -1
- package/package.json +1 -1
package/lib/cross-model-hooks.js
CHANGED
|
@@ -530,6 +530,54 @@ fi
|
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
+
// --- Stop hook: session handoff on exit ---
|
|
534
|
+
if (hookConfig.session_start) { // If session-start is enabled, also add session-end
|
|
535
|
+
if (!config.hooks.Stop) {
|
|
536
|
+
config.hooks.Stop = [];
|
|
537
|
+
}
|
|
538
|
+
const home = getHome();
|
|
539
|
+
const hooksDir = path.join(home, '.claude', 'hooks');
|
|
540
|
+
fs.mkdirSync(hooksDir, { recursive: true });
|
|
541
|
+
const stopScript = path.join(hooksDir, 'delimit-stop');
|
|
542
|
+
const delimitHome = path.join(home, '.delimit');
|
|
543
|
+
const stopContent = '#!/bin/bash\n' + `
|
|
544
|
+
# Delimit Stop — session handoff on exit
|
|
545
|
+
# Preserves context for next session across all AI assistants
|
|
546
|
+
DELIMIT_HOME="\${DELIMIT_HOME:-${delimitHome}}"
|
|
547
|
+
LEDGER_DIR="$DELIMIT_HOME/ledger"
|
|
548
|
+
|
|
549
|
+
# Push ledger changes so other models pick them up
|
|
550
|
+
if [ -d "$LEDGER_DIR/.git" ]; then
|
|
551
|
+
cd "$LEDGER_DIR"
|
|
552
|
+
git add -A 2>/dev/null
|
|
553
|
+
git commit -m "session handoff $(date -u +%Y-%m-%dT%H:%M:%SZ)" --no-verify 2>/dev/null
|
|
554
|
+
git push origin main 2>/dev/null &
|
|
555
|
+
fi
|
|
556
|
+
|
|
557
|
+
# Save session timestamp
|
|
558
|
+
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$DELIMIT_HOME/.last_session_end"
|
|
559
|
+
echo "[Delimit] Session context saved."
|
|
560
|
+
`;
|
|
561
|
+
fs.writeFileSync(stopScript, stopContent);
|
|
562
|
+
fs.chmodSync(stopScript, '755');
|
|
563
|
+
|
|
564
|
+
const existingStop = config.hooks.Stop.find(group => {
|
|
565
|
+
const cmds = (group.hooks || []).map(h => h.command || '');
|
|
566
|
+
return cmds.some(c => c.includes('delimit'));
|
|
567
|
+
});
|
|
568
|
+
if (!existingStop) {
|
|
569
|
+
config.hooks.Stop.push({
|
|
570
|
+
matcher: '',
|
|
571
|
+
hooks: [{
|
|
572
|
+
type: 'command',
|
|
573
|
+
command: stopScript,
|
|
574
|
+
timeout: 10,
|
|
575
|
+
}],
|
|
576
|
+
});
|
|
577
|
+
changes.push('Stop');
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
533
581
|
// Write hooks to all target settings files
|
|
534
582
|
const configJson = JSON.stringify(config, null, 2);
|
|
535
583
|
for (const target of writeTargets) {
|
|
@@ -686,7 +734,7 @@ function removeClaudeHooks() {
|
|
|
686
734
|
|
|
687
735
|
let changed = false;
|
|
688
736
|
|
|
689
|
-
for (const event of ['SessionStart', 'PreToolUse', 'PostToolUse']) {
|
|
737
|
+
for (const event of ['SessionStart', 'PreToolUse', 'PostToolUse', 'Stop']) {
|
|
690
738
|
if (Array.isArray(config.hooks[event])) {
|
|
691
739
|
const before = config.hooks[event].length;
|
|
692
740
|
config.hooks[event] = config.hooks[event].filter(h => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "delimit-cli",
|
|
3
3
|
"mcpName": "io.github.delimit-ai/delimit-mcp-server",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.32",
|
|
5
5
|
"description": "Unify Claude Code, Codex, Cursor, and Gemini CLI with persistent context, governance, and multi-model debate.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|