UNPKG

braiin

Version:

Behavioral Reasoning AI for Intelligent Navigation

50 lines (47 loc) 1.85 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const node_fs_1 = require("node:fs"); const node_os_1 = require("node:os"); const node_path_1 = require("node:path"); const SKILL_SOURCE = (0, node_path_1.join)(__dirname, '..', 'skill', 'SKILL.md'); const usage = () => { console.log(`braiin — CLI Usage: npx braiin init-skill [--global] Install the Claude Code usage skill Options: --global Install into ~/.claude/skills (all projects) instead of ./.claude/skills (current project only) -h, --help Show this help `); }; const initSkill = (global) => { if (!(0, node_fs_1.existsSync)(SKILL_SOURCE)) { console.error(`braiin: bundled skill not found at ${SKILL_SOURCE}`); process.exit(1); } const base = global ? (0, node_path_1.join)((0, node_os_1.homedir)(), '.claude') : (0, node_path_1.join)(process.cwd(), '.claude'); const destDir = (0, node_path_1.join)(base, 'skills', 'braiin'); const dest = (0, node_path_1.join)(destDir, 'SKILL.md'); (0, node_fs_1.mkdirSync)(destDir, { recursive: true }); (0, node_fs_1.copyFileSync)(SKILL_SOURCE, dest); const scope = global ? 'globally (~/.claude/skills)' : 'in this project (./.claude/skills)'; console.log(`✓ braiin skill installed ${scope}`); console.log(` ${dest}`); console.log('Reload Claude Code to pick it up. Re-run after upgrading braiin to refresh it.'); }; const main = () => { const [command, ...rest] = process.argv.slice(2); if (!command || command === '-h' || command === '--help') { usage(); return; } if (command === 'init-skill') { initSkill(rest.includes('--global')); return; } console.error(`braiin: unknown command "${command}"\n`); usage(); process.exit(1); }; main();