delimit-cli 4.1.31 → 4.1.33
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/bin/delimit-cli.js +40 -0
- package/lib/cross-model-hooks.js +49 -1
- package/package.json +1 -1
package/bin/delimit-cli.js
CHANGED
|
@@ -2540,8 +2540,44 @@ program
|
|
|
2540
2540
|
console.log(chalk.gray(' Tip: point at a spec file: npx delimit-cli scan openapi.yaml'));
|
|
2541
2541
|
}
|
|
2542
2542
|
}
|
|
2543
|
+
// Governance readiness checklist
|
|
2544
|
+
const hasPolicy = fs.existsSync(path.join(target, '.delimit', 'policies.yml'));
|
|
2545
|
+
const hasWorkflow = fs.existsSync(path.join(target, '.github', 'workflows', 'api-governance.yml'));
|
|
2546
|
+
const hasGitHooks = fs.existsSync(path.join(target, '.git', 'hooks', 'pre-commit')) &&
|
|
2547
|
+
(() => { try { return fs.readFileSync(path.join(target, '.git', 'hooks', 'pre-commit'), 'utf-8').includes('delimit'); } catch { return false; } })();
|
|
2548
|
+
const hasMcp = fs.existsSync(path.join(os.homedir(), '.mcp.json')) &&
|
|
2549
|
+
(() => { try { return fs.readFileSync(path.join(os.homedir(), '.mcp.json'), 'utf-8').includes('delimit'); } catch { return false; } })();
|
|
2550
|
+
const hasSpecs = found.length > 0;
|
|
2551
|
+
|
|
2552
|
+
const checks = [
|
|
2553
|
+
{ name: 'API spec', done: hasSpecs, fix: 'Add an openapi.yaml to your project' },
|
|
2554
|
+
{ name: 'Policy', done: hasPolicy, fix: 'npx delimit-cli init' },
|
|
2555
|
+
{ name: 'CI gate', done: hasWorkflow, fix: 'npx delimit-cli ci' },
|
|
2556
|
+
{ name: 'Git hooks', done: hasGitHooks, fix: 'npx delimit-cli hooks install' },
|
|
2557
|
+
{ name: 'MCP tools', done: hasMcp, fix: 'npx delimit-cli setup' },
|
|
2558
|
+
];
|
|
2559
|
+
const score = checks.filter(c => c.done).length;
|
|
2560
|
+
|
|
2561
|
+
console.log(chalk.bold(`\n Governance Readiness: ${score}/${checks.length}\n`));
|
|
2562
|
+
for (const c of checks) {
|
|
2563
|
+
if (c.done) {
|
|
2564
|
+
console.log(` ${chalk.green('●')} ${c.name}`);
|
|
2565
|
+
} else {
|
|
2566
|
+
console.log(` ${chalk.gray('○')} ${c.name} ${chalk.gray('—')} ${chalk.yellow(c.fix)}`);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
console.log('');
|
|
2570
|
+
|
|
2543
2571
|
// Interactive next step picker
|
|
2544
2572
|
try {
|
|
2573
|
+
// Pre-select the first missing item
|
|
2574
|
+
const firstMissing = checks.find(c => !c.done);
|
|
2575
|
+
const defaultChoice = firstMissing ?
|
|
2576
|
+
(firstMissing.name === 'Policy' ? 'init' :
|
|
2577
|
+
firstMissing.name === 'CI gate' ? 'ci' :
|
|
2578
|
+
firstMissing.name === 'Git hooks' ? 'hooks' :
|
|
2579
|
+
firstMissing.name === 'MCP tools' ? 'setup' : 'init') : 'exit';
|
|
2580
|
+
|
|
2545
2581
|
const { next } = await inquirer.prompt([{
|
|
2546
2582
|
type: 'list',
|
|
2547
2583
|
name: 'next',
|
|
@@ -2549,15 +2585,19 @@ program
|
|
|
2549
2585
|
choices: [
|
|
2550
2586
|
{ name: 'Set up governance for this project', value: 'init' },
|
|
2551
2587
|
{ name: 'Add CI gate (GitHub Action)', value: 'ci' },
|
|
2588
|
+
{ name: 'Install git hooks', value: 'hooks' },
|
|
2552
2589
|
{ name: 'Configure AI assistants (Claude, Codex, Gemini)', value: 'setup' },
|
|
2553
2590
|
{ name: 'Run a breaking change demo', value: 'try' },
|
|
2554
2591
|
{ name: 'Exit', value: 'exit' },
|
|
2555
2592
|
],
|
|
2593
|
+
default: defaultChoice,
|
|
2556
2594
|
}]);
|
|
2557
2595
|
if (next === 'init') {
|
|
2558
2596
|
execSync('npx delimit-cli init', { stdio: 'inherit' });
|
|
2559
2597
|
} else if (next === 'ci') {
|
|
2560
2598
|
execSync('npx delimit-cli ci', { stdio: 'inherit' });
|
|
2599
|
+
} else if (next === 'hooks') {
|
|
2600
|
+
execSync('npx delimit-cli hooks install', { stdio: 'inherit' });
|
|
2561
2601
|
} else if (next === 'setup') {
|
|
2562
2602
|
execSync('npx delimit-cli setup', { stdio: 'inherit' });
|
|
2563
2603
|
} else if (next === 'try') {
|
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.33",
|
|
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": [
|