clawdie-ai/scripts/hostd-cli.ts
Clawdie AI 2160e7859e feat(phase4): just front door + safety rules + bugfix (Sam & Claude)
Rewrites justfile with 8 groups, 35+ recipes with docstrings.

Creates 8 CLI helper scripts (jail-status, hostd-cli, system-health,

agent-status, agent-task, agent-task-status, agent-logs, jail-provision).

Adds 4 hostd safety rules to safety.yaml (destroy, rollback, zfs-destroy, pf).

Fixes task_create empty assigned_to bug in controlplane-tools.ts.

Build: pass | Tests: not run (Linux)
2026-04-14 01:28:31 +02:00

35 lines
945 B
TypeScript

import { hostd } from '../src/hostd/client.js';
const [op, paramsRaw] = process.argv.slice(2);
if (!op) {
console.error('Usage: hostd-cli.ts <op> [json-params]');
console.error('Example: hostd-cli.ts bastille-list');
console.error(' hostd-cli.ts bastille-start \'{"jail": "db"}\'');
process.exit(1);
}
let params: Record<string, string | number | boolean> = {};
if (paramsRaw) {
try {
params = JSON.parse(paramsRaw);
} catch {
console.error('Invalid JSON params:', paramsRaw);
process.exit(1);
}
}
try {
const result = await hostd(op, params);
if (result.ok) {
console.log(result.output || 'ok');
} else {
console.error('FAIL:', result.error || result.output || 'unknown error');
process.exit(1);
}
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
console.error('hostd error:', msg);
console.error('Is the hostd daemon running?');
process.exit(1);
}