From 269bfc20edfd0d3162acf512a5f786c2a069b019 Mon Sep 17 00:00:00 2001 From: Lilith Date: Sun, 11 Jan 2026 02:36:43 -0800 Subject: [PATCH] =?UTF-8?q?feat(@cli/bitch-cli):=20=E2=9C=A8=20add=20vram?= =?UTF-8?q?=20and=20ram=20commands,=20update=20README=20and=20package.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++++++++++++ package.json | 2 +- src/commands/ram.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ src/commands/vram.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 4 ++++ 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 src/commands/ram.ts create mode 100644 src/commands/vram.ts diff --git a/README.md b/README.md index 0c535ca..6061bb5 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,36 @@ bitch bump major # Bump major version (1.0.0 -> 2.0.0) bitch bump --package @lilith/ui-core patch ``` +### `bitch vram` + +GPU/VRAM coordination commands (delegates to vram-boss). + +```bash +bitch vram status # Show GPU status and leases +bitch vram cleanup # Clean up stale VRAM leases +bitch vram drain # Request all models to unload +bitch vram kill # Kill specific lease +bitch vram init-gpu 0 24576 # Initialize GPU manually +bitch vram diagnose # Diagnose coordination issues +``` + +**Requires:** `pip install lilith-vram-boss` + +### `bitch ram` + +System RAM coordination commands (delegates to ram-boss). + +```bash +bitch ram status # Show RAM usage and leases +bitch ram analyze # Detailed memory analysis +bitch ram analyze --processes # Top memory consumers +bitch ram clear auto # Clear RAM caches (auto mode) +bitch ram clear aggressive # Maximum cleanup +bitch ram cleanup # Clean up stale RAM leases +``` + +**Requires:** `pip install lilith-ram-boss` + ### `bitch consumers` Find consumers of a package across all workspaces. diff --git a/package.json b/package.json index 3c392c9..d5cbf2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lilith/bitch", - "version": "1.0.0", + "version": "1.1.0", "description": "Global development CLI for managing packages across workspaces", "type": "module", "main": "./dist/index.js", diff --git a/src/commands/ram.ts b/src/commands/ram.ts new file mode 100644 index 0000000..1fe7607 --- /dev/null +++ b/src/commands/ram.ts @@ -0,0 +1,42 @@ +import { Command } from 'commander' +import { spawn } from 'child_process' +import chalk from 'chalk' + +export function createRAMCommand(): Command { + const cmd = new Command('ram') + .description('System RAM coordination commands (delegates to ram-boss)') + .allowUnknownOption() + .allowExcessArguments() + .action(async (_options, command) => { + // Get all args after 'ram' + const args = command.args + + // If no args, show help + if (args.length === 0) { + args.push('--help') + } + + // Delegate to ram-boss + const child = spawn('ram-boss', args, { + stdio: 'inherit', + shell: true, + }) + + child.on('error', (err) => { + if ((err as any).code === 'ENOENT') { + console.error(chalk.red('Error:'), 'ram-boss command not found') + console.error(chalk.yellow('Install:'), 'pip install lilith-ram-boss') + process.exit(1) + } else { + console.error(chalk.red('Error:'), err.message) + process.exit(1) + } + }) + + child.on('exit', (code) => { + process.exit(code || 0) + }) + }) + + return cmd +} diff --git a/src/commands/vram.ts b/src/commands/vram.ts new file mode 100644 index 0000000..a278974 --- /dev/null +++ b/src/commands/vram.ts @@ -0,0 +1,42 @@ +import { Command } from 'commander' +import { spawn } from 'child_process' +import chalk from 'chalk' + +export function createVRAMCommand(): Command { + const cmd = new Command('vram') + .description('GPU/VRAM coordination commands (delegates to vram-boss)') + .allowUnknownOption() + .allowExcessArguments() + .action(async (_options, command) => { + // Get all args after 'vram' + const args = command.args + + // If no args, show help + if (args.length === 0) { + args.push('--help') + } + + // Delegate to vram-boss + const child = spawn('vram-boss', args, { + stdio: 'inherit', + shell: true, + }) + + child.on('error', (err) => { + if ((err as any).code === 'ENOENT') { + console.error(chalk.red('Error:'), 'vram-boss command not found') + console.error(chalk.yellow('Install:'), 'pip install lilith-vram-boss') + process.exit(1) + } else { + console.error(chalk.red('Error:'), err.message) + process.exit(1) + } + }) + + child.on('exit', (code) => { + process.exit(code || 0) + }) + }) + + return cmd +} diff --git a/src/index.ts b/src/index.ts index feb33fa..1d3e304 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,8 @@ import { createInitCommand } from './commands/init.js' import { createCommitsCommand } from './commands/commits.js' import { createCommitCommand } from './commands/commit.js' import { createUpgradeCommand } from './commands/upgrade.js' +import { createVRAMCommand } from './commands/vram.js' +import { createRAMCommand } from './commands/ram.js' const program = new Command() @@ -27,6 +29,8 @@ program.addCommand(createInitCommand()) program.addCommand(createCommitsCommand()) program.addCommand(createCommitCommand()) program.addCommand(createUpgradeCommand()) +program.addCommand(createVRAMCommand()) +program.addCommand(createRAMCommand()) // Parse arguments program.parse()