delimit-cli 3.9.5 → 3.10.0
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-setup.js +113 -2
- package/package.json +1 -1
package/bin/delimit-setup.js
CHANGED
|
@@ -397,8 +397,119 @@ Run full governance compliance checks. Verify security, policy compliance, evide
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
// Step 6:
|
|
401
|
-
step(6, '
|
|
400
|
+
// Step 6: Governance wrapping (shims)
|
|
401
|
+
step(6, 'Governance wrapping...');
|
|
402
|
+
log('');
|
|
403
|
+
log(` Delimit can wrap your AI assistants with a governance layer:`);
|
|
404
|
+
log('');
|
|
405
|
+
log(` ${blue(' ____ ________ ______ _____________')}`);
|
|
406
|
+
log(` ${blue(' / __ \\\\/ ____/ / / _/ |/ / _/_ __/')}`);
|
|
407
|
+
log(` ${blue(' / / / / __/ / / / // /|_/ // / / / ')}`);
|
|
408
|
+
log(` ${blue(' / /_/ / /___/ /____/ // / / // / / / ')}`);
|
|
409
|
+
log(` ${blue('/_____/_____/_____/___/_/ /_/___/ /_/ ')}`);
|
|
410
|
+
log('');
|
|
411
|
+
log(` ${dim('[Delimit]')} Executing governance check...`);
|
|
412
|
+
log(` ${dim('[Delimit]')} Mode: advisory`);
|
|
413
|
+
log(` ${dim('[Delimit]')} ${green('✓ GOVERNANCE ACTIVE')}`);
|
|
414
|
+
log('');
|
|
415
|
+
log(` ${dim('This shows before each AI session (<1 second).')}`);
|
|
416
|
+
log(` ${dim('Adds ~/.delimit/shims to your shell PATH.')}`);
|
|
417
|
+
log(` ${dim('Disable anytime: delimit shims disable')}`);
|
|
418
|
+
log('');
|
|
419
|
+
|
|
420
|
+
// Check if shims already installed
|
|
421
|
+
const shimsDir = path.join(DELIMIT_HOME, 'shims');
|
|
422
|
+
const shimsInstalled = fs.existsSync(shimsDir) && fs.readdirSync(shimsDir).length > 0;
|
|
423
|
+
|
|
424
|
+
if (shimsInstalled) {
|
|
425
|
+
log(` ${green('✓')} Governance wrapping already enabled`);
|
|
426
|
+
} else {
|
|
427
|
+
// Default YES prompt — non-interactive mode auto-accepts
|
|
428
|
+
const inquirer = (() => { try { return require('inquirer'); } catch { return null; } })();
|
|
429
|
+
let enableShims = true;
|
|
430
|
+
|
|
431
|
+
if (inquirer && process.stdin.isTTY) {
|
|
432
|
+
try {
|
|
433
|
+
const answer = await inquirer.prompt([{
|
|
434
|
+
type: 'confirm',
|
|
435
|
+
name: 'enable',
|
|
436
|
+
message: 'Enable governance wrapping?',
|
|
437
|
+
default: true,
|
|
438
|
+
}]);
|
|
439
|
+
enableShims = answer.enable;
|
|
440
|
+
} catch {
|
|
441
|
+
enableShims = true; // Default yes if prompt fails
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (enableShims) {
|
|
446
|
+
// Create shims
|
|
447
|
+
fs.mkdirSync(shimsDir, { recursive: true });
|
|
448
|
+
|
|
449
|
+
const shimTemplate = (toolName, displayName) => `#!/bin/sh
|
|
450
|
+
# Delimit Governance Shim for ${displayName}
|
|
451
|
+
PURPLE='\\033[35m'; MAGENTA='\\033[91m'; ORANGE='\\033[33m'; GREEN='\\033[32m'
|
|
452
|
+
WHITE='\\033[97m'; BOLD='\\033[1m'; DIM='\\033[2m'; RESET='\\033[0m'
|
|
453
|
+
if [ "$DELIMIT_WRAPPED" = "true" ] || [ ! -t 1 ]; then
|
|
454
|
+
for c in /usr/bin/${toolName} /usr/local/bin/${toolName} $HOME/.local/bin/${toolName}; do
|
|
455
|
+
[ -x "$c" ] && exec "$c" "$@"
|
|
456
|
+
done
|
|
457
|
+
fi
|
|
458
|
+
DELIMIT_HOME="\${DELIMIT_HOME:-$HOME/.delimit}"
|
|
459
|
+
TOOL_COUNT="0"
|
|
460
|
+
[ -f "$DELIMIT_HOME/server/ai/server.py" ] && TOOL_COUNT=$(grep -c '@mcp.tool' "$DELIMIT_HOME/server/ai/server.py" 2>/dev/null || echo "0")
|
|
461
|
+
echo ""
|
|
462
|
+
printf " \${PURPLE}\${BOLD} ____ ________ ______ _____________\${RESET}\\n"
|
|
463
|
+
printf " \${PURPLE}\${BOLD} / __ \\\\/ ____/ / / _/ |/ / _/_ __/\${RESET}\\n"
|
|
464
|
+
printf " \${MAGENTA}\${BOLD} / / / / __/ / / / // /|_/ // / / / \${RESET}\\n"
|
|
465
|
+
printf " \${MAGENTA}\${BOLD} / /_/ / /___/ /____/ // / / // / / / \${RESET}\\n"
|
|
466
|
+
printf " \${ORANGE}\${BOLD}/_____/_____/_____/___/_/ /_/___/ /_/ \${RESET}\\n"
|
|
467
|
+
printf " \${DIM}delimit.ai\${RESET}\\n"
|
|
468
|
+
echo ""
|
|
469
|
+
printf " \${PURPLE}\${BOLD}[Delimit]\${RESET} \${DIM}Executing governance check...\${RESET}\\n"
|
|
470
|
+
sleep 0.1
|
|
471
|
+
printf " \${PURPLE}\${BOLD}[Delimit]\${RESET} \${ORANGE}Mode: advisory\${RESET}\\n"
|
|
472
|
+
printf " \${PURPLE}\${BOLD}[Delimit]\${RESET} \${DIM}MCP server: \${WHITE}\${TOOL_COUNT} tools\${RESET}\\n"
|
|
473
|
+
printf " \${MAGENTA}\${BOLD}[Delimit]\${RESET} \${MAGENTA}═══════════════════════════════════════════\${RESET}\\n"
|
|
474
|
+
printf " \${MAGENTA}\${BOLD}[Delimit]\${RESET} \${PURPLE}<\${MAGENTA}/\${ORANGE}>\${RESET} \${BOLD}GOVERNANCE ACTIVE: ${displayName.toUpperCase()}\${RESET}\\n"
|
|
475
|
+
printf " \${MAGENTA}\${BOLD}[Delimit]\${RESET} \${MAGENTA}═══════════════════════════════════════════\${RESET}\\n"
|
|
476
|
+
sleep 0.08
|
|
477
|
+
printf " \${GREEN}\${BOLD}[Delimit]\${RESET} \${GREEN}✓ Allowed\${RESET}\\n"
|
|
478
|
+
echo ""
|
|
479
|
+
for c in /usr/bin/${toolName} /usr/local/bin/${toolName} $HOME/.local/bin/${toolName}; do
|
|
480
|
+
[ -x "$c" ] && exec "$c" "$@"
|
|
481
|
+
done
|
|
482
|
+
echo "[Delimit] ${toolName} not found" >&2; exit 127
|
|
483
|
+
`;
|
|
484
|
+
|
|
485
|
+
for (const [tool, display] of [['claude', 'Claude'], ['codex', 'Codex'], ['gemini', 'Gemini CLI']]) {
|
|
486
|
+
const shimPath = path.join(shimsDir, tool);
|
|
487
|
+
fs.writeFileSync(shimPath, shimTemplate(tool, display));
|
|
488
|
+
fs.chmodSync(shimPath, '755');
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Add to PATH in shell rc files
|
|
492
|
+
const pathLine = `export PATH="${shimsDir}:$PATH" # Delimit governance wrapping`;
|
|
493
|
+
for (const rc of ['.bashrc', '.zshrc']) {
|
|
494
|
+
const rcPath = path.join(os.homedir(), rc);
|
|
495
|
+
if (fs.existsSync(rcPath)) {
|
|
496
|
+
const content = fs.readFileSync(rcPath, 'utf-8');
|
|
497
|
+
if (!content.includes('.delimit/shims')) {
|
|
498
|
+
fs.appendFileSync(rcPath, `\n# Delimit governance wrapping\n${pathLine}\n`);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
log(` ${green('✓')} Governance wrapping enabled`);
|
|
504
|
+
log(` ${dim(' Restart your terminal or run: source ~/.bashrc')}`);
|
|
505
|
+
} else {
|
|
506
|
+
log(` ${dim(' Skipped. Enable later: delimit shims enable')}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
log('');
|
|
510
|
+
|
|
511
|
+
// Step 7: Done
|
|
512
|
+
step(7, 'Done!');
|
|
402
513
|
log('');
|
|
403
514
|
log(` ${green('Delimit is installed.')} Your AI now has persistent memory and governance.`);
|
|
404
515
|
log('');
|
package/package.json
CHANGED