@great-arrow/cli 0.1.56 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +90 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9402,7 +9402,7 @@ function isNodeError(value) {
9402
9402
 
9403
9403
  // src/lib/version.ts
9404
9404
  var CLI_PACKAGE_NAME = "@great-arrow/cli";
9405
- var CLI_VERSION = "0.1.56";
9405
+ var CLI_VERSION = "0.1.57";
9406
9406
  var GAD_INSTALL_VERSION = "2026.08.08";
9407
9407
  var GAD_INSTALL_MIN_VERSION = "2026.06.22";
9408
9408
  var GAD_INSTALL_HEADER = "X-GAD-Install-Version";
@@ -19469,6 +19469,94 @@ function discoverCommand() {
19469
19469
  });
19470
19470
  }
19471
19471
 
19472
+ // src/lib/call-args.ts
19473
+ var AUTH_ERROR_CODES = /* @__PURE__ */ new Set([
19474
+ "unauthorized",
19475
+ "forbidden",
19476
+ "insufficient_scope",
19477
+ "auth_required"
19478
+ ]);
19479
+ function parseCallArgs(raw) {
19480
+ if (raw === void 0 || raw.trim() === "") return {};
19481
+ let parsed;
19482
+ try {
19483
+ parsed = JSON.parse(raw);
19484
+ } catch {
19485
+ throw new CliError(
19486
+ "--args is not valid JSON.",
19487
+ 3 /* VALIDATION_ERROR */,
19488
+ `Pass an object, e.g. --args '{"query":"pricing"}'.`
19489
+ );
19490
+ }
19491
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
19492
+ throw new CliError(
19493
+ "--args must be a JSON object.",
19494
+ 3 /* VALIDATION_ERROR */,
19495
+ `Pass an object, e.g. --args '{"query":"pricing"}'.`
19496
+ );
19497
+ }
19498
+ return parsed;
19499
+ }
19500
+ function callFailure(result) {
19501
+ if (typeof result !== "object" || result === null) return null;
19502
+ const record = result;
19503
+ const message = typeof record.message === "string" ? record.message : "";
19504
+ if (typeof record.error === "string" && record.error.trim() !== "") {
19505
+ return {
19506
+ code: record.error,
19507
+ message: message || `Request failed: ${record.error}`
19508
+ };
19509
+ }
19510
+ if (typeof record.error === "object" && record.error !== null) {
19511
+ const inner = record.error;
19512
+ const code = typeof inner.code === "string" ? inner.code : "error";
19513
+ const innerMessage = typeof inner.message === "string" ? inner.message : message;
19514
+ return { code, message: innerMessage || `Request failed: ${code}` };
19515
+ }
19516
+ if (record.ok === false || record.isError === true) {
19517
+ return {
19518
+ code: "error",
19519
+ message: message || "The tool reported a failure."
19520
+ };
19521
+ }
19522
+ return null;
19523
+ }
19524
+ function gadCallArgs(tool, args) {
19525
+ return { tool_name: tool, args };
19526
+ }
19527
+
19528
+ // src/commands/call.ts
19529
+ function callCommand() {
19530
+ return new Command("call").description("Call any Great Arrow tool by name (see 'gad discover')").argument("<tool>", "Tool name, e.g. memory_search").option("--args <json>", "Tool arguments as a JSON object").option("--json", "Output as JSON").action(async (tool, opts, command) => {
19531
+ const g = globalOutputOpts(command);
19532
+ const args = parseCallArgs(opts.args);
19533
+ const auth = await resolveAuth();
19534
+ const client = new GadClient({
19535
+ token: auth.token,
19536
+ getToken: auth.getToken,
19537
+ apiUrl: auth.apiUrl
19538
+ });
19539
+ const result = await client.mcpCall("gad_call", gadCallArgs(tool, args));
19540
+ const failure = callFailure(result);
19541
+ if (failure) {
19542
+ throw new CliError(
19543
+ `${tool}: ${failure.message}`,
19544
+ AUTH_ERROR_CODES.has(failure.code) ? 1 /* AUTH_ERROR */ : 3 /* VALIDATION_ERROR */,
19545
+ failure.code === "unknown_tool" ? `Find the exact name with 'gad discover' or 'gad call tools_discover --args '{"query":"..."}''.` : void 0
19546
+ );
19547
+ }
19548
+ if (typeof result === "string") {
19549
+ process.stdout.write(result.endsWith("\n") ? result : `${result}
19550
+ `);
19551
+ return;
19552
+ }
19553
+ process.stdout.write(
19554
+ `${g.json ? JSON.stringify(result) : JSON.stringify(result, null, 2)}
19555
+ `
19556
+ );
19557
+ });
19558
+ }
19559
+
19472
19560
  // src/lib/completions.ts
19473
19561
  var COMMANDS = [
19474
19562
  "login",
@@ -23111,6 +23199,7 @@ program2.addCommand(workspace_default);
23111
23199
  program2.addCommand(todo_default);
23112
23200
  program2.addCommand(nextCommand());
23113
23201
  program2.addCommand(discoverCommand());
23202
+ program2.addCommand(callCommand());
23114
23203
  program2.addCommand(claim_default);
23115
23204
  program2.addCommand(work_default());
23116
23205
  program2.addCommand(worktree_default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-arrow/cli",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "GreatArrow.ai CLI tool",
5
5
  "type": "module",
6
6
  "bin": {