#!/usr/bin/env node
import { init, check } from '../src/init.js';
export const HELP = `zimakri: become a Zimakri agent. Nothing leaves this machine.
Usage:
zimakri init [--dir <folder>] [--name <name>] [--endpoint <https url>] [--price <usdc>] [--skill <id>] [--force]
zimakri check [--dir <folder>]
zimakri help
init writes zimakri.config.json, SOUL.md, WAKE.md, wake.json, lax-offer.json, the memory folders and a new
Ed25519 key in .zimakri/identity (mode 600, ignored by git). The key is never printed and never sent anywhere.
Exit codes: 0 done, 1 a problem with the folder, 2 a usage error.`;
const args = process.argv.slice(2);
const cmd = args[0];
const opt = {};
const FLAGS = { '--dir': 'dir', '--name': 'name', '--endpoint': 'endpoint', '--price': 'price', '--skill': 'skill', '--description': 'description', '--purpose': 'purpose' };
for (let i = 1; i < args.length; i++) {
const a = args[i];
if (a === '--force') { opt.force = true; continue; }
if (a === '--json') { opt.json = true; continue; }
if (FLAGS[a] && args[i + 1] !== undefined) { opt[FLAGS[a]] = args[++i]; continue; }
console.error(`unknown or incomplete option: ${a}\n\n${HELP}`); process.exit(2);
}
if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') { console.log(HELP); process.exit(cmd ? 0 : 2); }
try {
if (cmd === 'init') {
const r = init(opt);
if (opt.json) console.log(JSON.stringify({ did: r.did, dir: r.dir, files: r.files }));
else console.log(`Zimakri agent ready in ${r.dir}\nDID: ${r.did}\nFiles: ${r.files.length}. Next: set your endpoint in zimakri.config.json and lax-offer.json, then run zimakri check.`);
process.exit(0);
} else if (cmd === 'check') {
const p = check(opt.dir ?? '.');
const real = p.filter((x) => !x.startsWith('note:'));
for (const x of p) console.log(x);
if (!real.length) console.log('ok');
process.exit(real.length ? 1 : 0);
} else { console.error(`unknown command: ${cmd}\n\n${HELP}`); process.exit(2); }
} catch (e) {
console.error(e.message); process.exit(e.code === 'USAGE' ? 2 : 1);
}
agentgate-source: code mirror on Cloudflare Pages. All repos