UNPKG

@sellable/install

Version:

One-command installer for Sellable MCP in Claude Code, Codex, and Hermes

27 lines (23 loc) • 1.02 kB
#!/usr/bin/env node import { lstatSync, readFileSync } from "node:fs"; import { isAbsolute } from "node:path"; import { bootstrapAgentHost } from "../lib/sellable-agent/host-bootstrap.mjs"; function configPath(argv) { if (argv.length !== 2 || argv[0] !== "--config" || !isAbsolute(argv[1])) { throw new Error("usage: --config /absolute/path"); } const link = lstatSync(argv[1]); if (link.isSymbolicLink() || !link.isFile() || (link.mode & 0o777) !== 0o600 || link.uid !== 0 || link.gid !== 0) { throw new Error("host bootstrap config rejected"); } return argv[1]; } try { if (process.getuid?.() !== 0 || process.getgid?.() !== 0) throw new Error("host bootstrap requires root"); const pathValue = configPath(process.argv.slice(2)); const result = bootstrapAgentHost({ config: JSON.parse(readFileSync(pathValue, "utf8")) }); process.stdout.write(`${JSON.stringify(result.receipt)}\n`); } catch { process.stderr.write("sellable-agent host bootstrap failed closed\n"); process.exitCode = 1; }