CLI help/--help/unknown-command now fetch https://toolgate.scribase.com/v1/catalog (no key needed, 1.5s timeout) and compute tool/free counts live instead of only printing a hardcoded number; falls back to the last-known 23 tools/18 free if the catalog is unreachable. README.md, SKILL.md, package.json and plugin manifests already matched the live catalog (23 tools, 18 free, 20 capabilities) going into this pass; no "27 tools" stale mentions found in the GitHub or Rithub toolgate/ railyard repo descriptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.2 KiB
JavaScript
Executable File
35 lines
1.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
import { parseArgs } from "../src/args.mjs";
|
|
import { loadConfig } from "../src/config.mjs";
|
|
import { fail } from "../src/format.mjs";
|
|
import { balance, mcp, signup, usage } from "../src/commands/account.mjs";
|
|
import { call } from "../src/commands/call.mjs";
|
|
import { describe, search, tools } from "../src/commands/catalog.mjs";
|
|
import { help } from "../src/commands/help.mjs";
|
|
|
|
const COMMANDS = { tools, list: tools, search, describe, call, signup, balance, usage, mcp, help };
|
|
|
|
async function main(argv) {
|
|
const [name = "help", ...rest] = argv;
|
|
const cfg = loadConfig();
|
|
if (name === "--help" || name === "-h") return help(cfg);
|
|
if (name === "--version" || name === "-v") {
|
|
const { createRequire } = await import("node:module");
|
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
return console.log(pkg.version);
|
|
}
|
|
const cmd = COMMANDS[name];
|
|
if (!cmd) {
|
|
process.stderr.write(`unknown command "${name}"\n\n`);
|
|
await help(cfg);
|
|
process.exitCode = 2;
|
|
return;
|
|
}
|
|
await cmd(cfg, parseArgs(rest));
|
|
}
|
|
|
|
main(process.argv.slice(2)).catch((err) => {
|
|
fail(err);
|
|
process.exitCode = err.status === 402 ? 3 : 1;
|
|
});
|