@getgavel/cli 0.1.0 → 0.1.4

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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/gavel.js +189 -59
  3. package/package.json +6 -1
package/README.md CHANGED
@@ -32,6 +32,7 @@ gavel ask --file decision.json # put a decision to your person
32
32
  gavel wait D-12 --timeout 60 # until it's decided
33
33
  gavel watch # one GAVEL_WAKE line per new thing for you; run it in the background
34
34
  gavel help # every command
35
+ gavel act --help # one command's usage
35
36
  ```
36
37
 
37
38
  `GAVEL_TOKEN` is your agent's token (pairing sets it up); `GAVEL_API_URL` defaults to
package/dist/gavel.js CHANGED
@@ -13,21 +13,26 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
13
13
  gavel pair <code> [--harness cursor|claude-code|codex|other] [--machine <name>]
14
14
  redeem your person's pairing code and write your setup
15
15
  (no GAVEL_TOKEN needed; never prints the token)
16
- gavel search <words> [--area <slug>] [--status open|decided|any] [--limit <n>]
16
+ gavel search (<words> | --query <words>) [--area <slug>] [--status open|decided|any] [--limit <n>]
17
17
  gavel ask --file decision.json the decision, as MCP ask's input
18
18
  gavel revise <D-12> --file decision.json a draft the editor sent back, fixed (the whole ask again)
19
+ gavel todo --file todo.json ask a person to do something: title, steps, why (MCP ask_to_do's input)
19
20
  gavel get <D-12>
20
21
  gavel wait <D-12> [--timeout <seconds>] until it's decided (default 60)
21
22
  gavel withdraw <D-12> [--reason <words>] take back what you asked, while it isn't decided
22
23
  gavel attach <D-12> --file context.json a context item, or a list of them
23
- gavel answer <requestId> <response> answer an Ask someone
24
- gavel act <D-12> <note> what you did with the answer
24
+ gavel answer <requestId> (<response> | --response <words>)
25
+ answer an Ask someone
26
+ gavel act <D-12> (<note> | --note <words>)
27
+ what you did with the answer
25
28
  gavel inbox what's waiting on you
26
- gavel status <text> [--folders <a,b>] [--state working|blocked|idle] [--issue <MA-482>]
27
- what you're doing now, in plain words ("" clears it)
28
- gavel message (--to-agent <id> | --to-person <email>) <text> [--decision <D-12>]
29
+ gavel status (<text> | --text <words>) [--folders <a,b>] [--state working|blocked|idle] [--issue <MA-482>]
30
+ [--waiting-on <email>]
31
+ what you're doing now, in plain words ("" clears it);
32
+ --waiting-on names the person you're blocked on
33
+ gavel message (--to-agent <id> | --to-person <email>) (<text> | --text <words>) [--decision <D-12>]
29
34
  start a conversation with another agent
30
- gavel message --conversation <C-12> <text>
35
+ gavel message --conversation <C-12> (<text> | --text <words>)
31
36
  reply in one
32
37
  gavel conversations [<C-12>] yours, or one with its messages (reads it)
33
38
  gavel wait-for-reply <C-12> [--timeout <seconds>]
@@ -38,6 +43,7 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
38
43
  background; one per agent)
39
44
  gavel log --question <q> --outcome <o> --reason <why> [--area <slug>] [--trust <id>] [--file context.json]
40
45
  gavel log-answer --question <q> --answer <what they decided> [--note <their why>] [--area <slug>]
46
+ [--file context.json]
41
47
  what your person answered you in chat, as theirs
42
48
  gavel decide <D-12> (--option <id> | --text <words>) [--note <words>]
43
49
  a multiple question: --option again for each pick,
@@ -45,26 +51,81 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
45
51
  gavel decide-for <D-12> (--option <id> | --text <words>) --reason <why> --trust <id>
46
52
  gavel priority <D-12> now|later [--note <words>]
47
53
  gavel forward <D-12> (--to-person <email> | --to-agent <id>) [--note <words>]
48
- gavel research-result <requestId> <response> [--file context.json]
54
+ gavel research-result <requestId> (<response> | --response <words>) [--file context.json]
49
55
  gavel agents you and your sub-agents
50
56
  gavel invite --name <name> [--description <words>] [--permissions ask,answer]
51
57
  gavel start-cloud-agent --name <task's name> --repo <url> --task <words> [--branch <ref>] [--open-pr true]
52
- a Cursor cloud agent under you, for a task
58
+ [--machine <worker>] [--agent <agent id>]
59
+ a Cursor cloud agent under you, for a task; --machine runs it on
60
+ your person's own machine (My Machines), --agent starts an
61
+ agent under you, or yourself, as itself (no --name), its
62
+ old tokens ended
53
63
  gavel me
54
64
 
55
65
  --as <name> on a fleet token, which chat you are (the name you go by,
56
66
  e.g. worker 35 or the task you're on; keep using the same one)
57
67
 
68
+ gavel <command> --help shows one command's usage. A command refuses a flag or a word it doesn't
69
+ take, and a flag given twice (but --option), with its usage.
58
70
  A text argument or --file of "-" is read from stdin.
59
71
  Environment: GAVEL_TOKEN (required), GAVEL_API_URL (default https://api.getgavel.ai),
60
72
  GAVEL_AGENT (instead of --as).`;
73
+ // What each command takes besides its words, as its usage above names them: anything else is
74
+ // refused with that usage, never dropped.
75
+ const FLAGS = {
76
+ pair: ["harness", "machine"],
77
+ search: ["query", "area", "status", "limit"],
78
+ ask: ["file"],
79
+ revise: ["file"],
80
+ todo: ["file"],
81
+ get: [],
82
+ wait: ["timeout"],
83
+ withdraw: ["reason"],
84
+ attach: ["file"],
85
+ answer: ["response"],
86
+ act: ["note"],
87
+ inbox: [],
88
+ status: ["text", "folders", "state", "issue", "waiting-on"],
89
+ message: ["to-agent", "to-person", "conversation", "text", "decision"],
90
+ conversations: [],
91
+ "wait-for-reply": ["timeout"],
92
+ watch: [],
93
+ log: ["question", "outcome", "reason", "area", "trust", "file"],
94
+ "log-answer": ["question", "answer", "note", "area", "file"],
95
+ decide: ["option", "text", "note"],
96
+ "decide-for": ["option", "text", "reason", "trust"],
97
+ priority: ["note"],
98
+ forward: ["to-person", "to-agent", "note"],
99
+ "research-result": ["response", "file"],
100
+ agents: [],
101
+ invite: ["name", "description", "permissions"],
102
+ "start-cloud-agent": ["name", "repo", "task", "branch", "open-pr", "machine", "agent"],
103
+ me: [],
104
+ };
105
+ const isCommand = (name) => Object.hasOwn(FLAGS, name);
106
+ // A command's own entries in USAGE: each line naming it, with the lines indented under it.
107
+ export function usageOf(command) {
108
+ const out = [];
109
+ let mine = false;
110
+ for (const line of USAGE.split("\n")) {
111
+ if (line.startsWith(" gavel "))
112
+ mine = line === ` gavel ${command}` || line.startsWith(` gavel ${command} `);
113
+ else if (!line.startsWith(" "))
114
+ mine = false;
115
+ if (mine)
116
+ out.push(line);
117
+ }
118
+ return out.join("\n");
119
+ }
61
120
  class UsageError extends Error {
62
121
  }
63
- export function parseArgs(argv) {
122
+ export function parseArgs(argv, command) {
64
123
  const positional = [];
65
124
  const flags = {};
66
125
  const lists = {};
67
126
  const set = (name, value) => {
127
+ if (Object.hasOwn(flags, name) && name !== "option")
128
+ throw new UsageError(`give --${name} once`);
68
129
  flags[name] = value;
69
130
  (lists[name] ??= []).push(value);
70
131
  };
@@ -72,13 +133,16 @@ export function parseArgs(argv) {
72
133
  const arg = argv[i];
73
134
  if (arg.startsWith("--")) {
74
135
  const eq = arg.indexOf("=");
136
+ const name = eq > 0 ? arg.slice(2, eq) : arg.slice(2);
137
+ if (!FLAGS[command].includes(name))
138
+ throw new UsageError(`${command} doesn't take --${name}`);
75
139
  if (eq > 0)
76
- set(arg.slice(2, eq), arg.slice(eq + 1));
140
+ set(name, arg.slice(eq + 1));
77
141
  else {
78
142
  const value = argv[i + 1];
79
143
  if (value === undefined || (value.startsWith("--") && value !== "-"))
80
144
  throw new UsageError(`${arg} needs a value`);
81
- set(arg.slice(2), value);
145
+ set(name, value);
82
146
  i++;
83
147
  }
84
148
  }
@@ -142,57 +206,101 @@ export function agentHeader(name) {
142
206
  const trimmed = name?.trim();
143
207
  return trimmed ? { "x-gavel-agent": encodeURIComponent(trimmed) } : {};
144
208
  }
145
- // A command line → one API request.
146
209
  export function toRequest(argv) {
147
210
  const [command, ...rest] = argv;
148
- const { positional: p, flags: f, lists } = parseArgs(rest);
211
+ if (command === undefined || command === "help" || command === "--help" || command === "-h") {
212
+ if (rest.length > 1)
213
+ throw new UsageError(`help takes one command, not "${rest[1]}"`);
214
+ if (rest[0] === undefined)
215
+ return { help: USAGE };
216
+ if (!isCommand(rest[0]))
217
+ throw new UsageError(`unknown command "${rest[0]}"`);
218
+ return { help: usageOf(rest[0]) };
219
+ }
220
+ if (!isCommand(command))
221
+ throw new UsageError(`unknown command "${command}"`);
222
+ if (rest.includes("--help") || rest.includes("-h"))
223
+ return { help: usageOf(command) };
224
+ const { positional: p, flags: f, lists } = parseArgs(rest, command);
225
+ const upTo = (n) => {
226
+ if (p.length > n)
227
+ throw new UsageError(`${command} doesn't take "${p[n]}"`);
228
+ };
229
+ // A command's words may come as their flag instead (act's --note), never both.
230
+ const words = (flag, from, what) => {
231
+ if (f[flag] !== undefined && from.length)
232
+ throw new UsageError(`give ${what} once: as words or as --${flag}`);
233
+ return need(f[flag] ?? from.join(" "), what);
234
+ };
149
235
  switch (command) {
150
- case undefined:
151
- case "help":
152
- case "--help":
153
- case "-h":
154
- return "help";
236
+ case "pair": {
237
+ const harness = f.harness;
238
+ if (harness !== undefined && !HARNESSES.includes(harness))
239
+ throw new UsageError(`--harness is one of ${HARNESSES.join(", ")}`);
240
+ return { pair: { code: need(p.join(""), "the pairing code (like 4F7K-9QX2)"), harness, machine: f.machine } };
241
+ }
242
+ case "watch":
243
+ upTo(0);
244
+ return { watch: true };
155
245
  case "search": {
156
- const query = new URLSearchParams(compact({ q: need(p.join(" "), "the words to search for"), area: f.area, status: f.status, limit: f.limit }));
246
+ const query = new URLSearchParams(compact({ q: words("query", p, "the words to search for"), area: f.area, status: f.status, limit: f.limit }));
157
247
  return { method: "GET", path: `/v1/search?${query}` };
158
248
  }
159
249
  case "ask":
250
+ upTo(0);
160
251
  return { method: "POST", path: "/v1/decisions", body: readJson(need(f.file, "--file decision.json")) };
161
252
  case "revise":
253
+ upTo(1);
162
254
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/revise`, body: readJson(need(f.file, "--file decision.json")) };
255
+ case "todo":
256
+ upTo(0);
257
+ return { method: "POST", path: "/v1/todos", body: readJson(need(f.file, "--file todo.json")) };
163
258
  case "get":
259
+ upTo(1);
164
260
  return { method: "GET", path: `/v1/decisions/${ref(p[0])}` };
165
261
  case "wait":
262
+ upTo(1);
166
263
  return { method: "GET", path: `/v1/decisions/${ref(p[0])}/wait?timeout=${encodeURIComponent(f.timeout ?? "60")}` };
167
264
  case "withdraw":
265
+ upTo(1);
168
266
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/withdraw`, body: compact({ reason: f.reason && readText(f.reason) }) };
169
267
  case "attach":
268
+ upTo(1);
170
269
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/context`, body: { items: contextList(need(f.file, "--file context.json")) } };
171
270
  case "answer":
172
- return { method: "POST", path: `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/answer`, body: { response: readText(need(p.slice(1).join(" "), "the response")) } };
271
+ return { method: "POST", path: `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/answer`, body: { response: readText(words("response", p.slice(1), "the response")) } };
173
272
  case "act":
174
- return { method: "POST", path: `/v1/decisions/${ref(p[0])}/act`, body: { note: readText(need(p.slice(1).join(" "), "the note")) } };
273
+ return { method: "POST", path: `/v1/decisions/${ref(p[0])}/act`, body: { note: readText(words("note", p.slice(1), "the note")) } };
175
274
  case "inbox":
275
+ upTo(0);
176
276
  return { method: "GET", path: "/v1/inbox" };
177
277
  case "status": {
178
- if (!p.length)
278
+ if (f.text !== undefined && p.length)
279
+ throw new UsageError("give what you're doing once: as words or as --text");
280
+ const said = f.text ?? (p.length ? p.join(" ") : undefined);
281
+ if (said === undefined)
179
282
  throw new UsageError('missing what you\'re doing now (or "" to clear it)');
180
283
  const folders = f.folders?.split(",").map((s) => s.trim()).filter(Boolean);
181
- return { method: "PATCH", path: "/v1/agents/me/status", body: compact({ text: readText(p.join(" ")) || null, folders, state: f.state, linearIssue: f.issue }) };
284
+ return { method: "PATCH", path: "/v1/agents/me/status", body: compact({ text: readText(said) || null, folders, state: f.state, linearIssue: f.issue, waitingOn: f["waiting-on"] }) };
182
285
  }
183
286
  case "message": {
184
- const text = readText(need(p.join(" "), "what to say"));
287
+ const text = readText(words("text", p, "what to say"));
185
288
  if ([f.conversation, f["to-agent"], f["to-person"]].filter(Boolean).length !== 1)
186
289
  throw new UsageError("give --to-agent or --to-person to start a conversation, or --conversation to reply in one");
290
+ if (f.conversation && f.decision !== undefined)
291
+ throw new UsageError("--decision is only for starting a conversation");
187
292
  if (f.conversation)
188
293
  return { method: "POST", path: `/v1/conversations/${encodeURIComponent(f.conversation)}/messages`, body: { text } };
189
294
  return { method: "POST", path: "/v1/conversations", body: compact({ toAgentId: f["to-agent"], toPerson: f["to-person"], text, decision: f.decision }) };
190
295
  }
191
296
  case "conversations":
297
+ upTo(1);
192
298
  return { method: "GET", path: p[0] ? `/v1/conversations/${encodeURIComponent(p[0])}` : "/v1/conversations" };
193
299
  case "wait-for-reply":
300
+ upTo(1);
194
301
  return { method: "GET", path: `/v1/conversations/${encodeURIComponent(need(p[0], "the conversation (C-12)"))}/wait?timeout=${encodeURIComponent(f.timeout ?? "60")}` };
195
302
  case "log":
303
+ upTo(0);
196
304
  return {
197
305
  method: "POST",
198
306
  path: "/v1/decided",
@@ -206,54 +314,65 @@ export function toRequest(argv) {
206
314
  }),
207
315
  };
208
316
  case "log-answer":
317
+ upTo(0);
209
318
  return {
210
319
  method: "POST",
211
320
  path: "/v1/decided/answers",
212
321
  body: compact({ question: need(f.question, "--question"), answer: readText(need(f.answer, "--answer")), note: f.note && readText(f.note), area: f.area, context: contextList(f.file) }),
213
322
  };
214
323
  case "decide":
324
+ upTo(1);
215
325
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/decide`, body: compact({ ...picks(lists.option), text: f.text && readText(f.text), note: f.note }) };
216
326
  case "decide-for":
327
+ upTo(1);
217
328
  return {
218
329
  method: "POST",
219
330
  path: `/v1/decisions/${ref(p[0])}/decide-for`,
220
331
  body: compact({ ...picks(lists.option), text: f.text && readText(f.text), reason: readText(need(f.reason, "--reason")), trustId: need(f.trust, "--trust") }),
221
332
  };
222
333
  case "priority": {
334
+ upTo(2);
223
335
  const priority = need(p[1], "now or later");
224
336
  if (priority !== "now" && priority !== "later")
225
337
  throw new UsageError("the priority is now or later");
226
338
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/priority`, body: compact({ priority, note: f.note }) };
227
339
  }
228
340
  case "forward":
341
+ upTo(1);
229
342
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/forward`, body: compact({ toPerson: f["to-person"], toAgentId: f["to-agent"], note: f.note }) };
230
343
  case "research-result":
231
344
  return {
232
345
  method: "POST",
233
346
  path: `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/research-result`,
234
- body: compact({ response: readText(need(p.slice(1).join(" "), "the response")), context: contextList(f.file) }),
347
+ body: compact({ response: readText(words("response", p.slice(1), "the response")), context: contextList(f.file) }),
235
348
  };
236
349
  case "agents":
350
+ upTo(0);
237
351
  return { method: "GET", path: "/v1/agents" };
238
352
  case "invite":
353
+ upTo(0);
239
354
  return {
240
355
  method: "POST",
241
356
  path: "/v1/sub-agents",
242
357
  body: compact({ name: need(f.name, "--name"), description: f.description, permissions: f.permissions?.split(",").map((s) => s.trim()) }),
243
358
  };
244
359
  case "start-cloud-agent":
360
+ upTo(0);
245
361
  return {
246
362
  method: "POST",
247
363
  path: "/v1/cloud-agents",
248
364
  body: compact({
249
- name: need(f.name, "--name"),
365
+ name: f.agent ? f.name : need(f.name, "--name"),
250
366
  repo: need(f.repo, "--repo"),
251
367
  task: readText(need(f.task, "--task")),
252
368
  branch: f.branch,
253
369
  openPullRequest: f["open-pr"] === undefined ? undefined : f["open-pr"] === "true",
370
+ machine: f.machine,
371
+ agentId: f.agent,
254
372
  }),
255
373
  };
256
374
  case "me":
375
+ upTo(0);
257
376
  return { method: "GET", path: "/v1/me" };
258
377
  default:
259
378
  throw new UsageError(`unknown command "${command}"`);
@@ -282,6 +401,15 @@ function tracked(file, cwd) {
282
401
  return false;
283
402
  }
284
403
  }
404
+ function runs(command) {
405
+ try {
406
+ execFileSync(command, ["--version"], { stdio: "ignore" });
407
+ return true;
408
+ }
409
+ catch {
410
+ return false;
411
+ }
412
+ }
285
413
  function writePrivate(path, text) {
286
414
  mkdirSync(dirname(path), { recursive: true });
287
415
  writeFileSync(path, text, { mode: 0o600 });
@@ -391,7 +519,13 @@ export function writeSetup(setup, opts) {
391
519
  catch {
392
520
  // none there yet
393
521
  }
394
- run(words[0], words.slice(1));
522
+ try {
523
+ run(words[0], words.slice(1));
524
+ }
525
+ catch {
526
+ // Its error would carry the command line, the token in it.
527
+ throw new Error(`claude mcp add ${setup.server} failed`);
528
+ }
395
529
  done.push(`ran claude mcp add ${setup.server} (scope ${words[words.length - 1]})`);
396
530
  break;
397
531
  }
@@ -489,17 +623,17 @@ export async function dropLegacy(setup, legacy, opts) {
489
623
  return [`left the old ${legacy.server} entry in ${old.where}: its token still works (another workspace's or agent's)`];
490
624
  return [`left the old ${legacy.server} entry in ${old.where}: couldn't check its token`];
491
625
  }
492
- async function pair(argv) {
493
- const { positional, flags } = parseArgs(argv);
494
- const code = need(positional.join(""), "the pairing code (like 4F7K-9QX2)");
495
- const harness = (flags.harness ?? detectHarness(process.env));
496
- if (!HARNESSES.includes(harness))
497
- throw new UsageError(`--harness is one of ${HARNESSES.join(", ")}`);
626
+ async function pair(input) {
627
+ const harness = input.harness ?? detectHarness(process.env);
628
+ if (harness === "claude-code" && !runs("claude")) {
629
+ console.error("gavel: Claude Code's claude command isn't on this PATH, so Gavel can't be added to it from here. Run this in Claude Code, or where claude runs; the code still works.");
630
+ return 1;
631
+ }
498
632
  const base = (process.env.GAVEL_API_URL ?? "https://api.getgavel.ai").replace(/\/+$/, "");
499
633
  const res = await fetch(`${base}/v1/pair`, {
500
634
  method: "POST",
501
635
  headers: { "content-type": "application/json", accept: "application/json" },
502
- body: JSON.stringify({ code, harness, machine: flags.machine ?? hostname().split(".")[0] }),
636
+ body: JSON.stringify({ code: input.code, harness, machine: input.machine ?? hostname().split(".")[0] }),
503
637
  });
504
638
  const body = (await res.json().catch(() => ({})));
505
639
  if (!res.ok) {
@@ -507,7 +641,14 @@ async function pair(argv) {
507
641
  return 1;
508
642
  }
509
643
  const opts = { cwd: process.cwd(), home: homedir() };
510
- const done = writeSetup(body.setup, opts);
644
+ let done;
645
+ try {
646
+ done = writeSetup(body.setup, opts);
647
+ }
648
+ catch (err) {
649
+ console.error(`gavel: ${err instanceof Error ? err.message : String(err)}. That used the code: get a new one (New code) and pair again.`);
650
+ return 1;
651
+ }
511
652
  if (body.legacy && body.legacy.server !== body.setup.server)
512
653
  done.push(...(await dropLegacy(body.setup, body.legacy, { ...opts, apiUrl: base })));
513
654
  console.log(JSON.stringify({ paired: true, kind: body.kind, agent: body.agent, harness, done, then: body.then }, null, 2));
@@ -576,45 +717,34 @@ async function watch(token, as) {
576
717
  async function main(argvIn) {
577
718
  let request;
578
719
  let as = null;
579
- if (argvIn[0] === "pair") {
580
- try {
581
- return await pair(argvIn.slice(1));
582
- }
583
- catch (err) {
584
- if (err instanceof UsageError) {
585
- console.error(`gavel: ${err.message}\n\n${USAGE}`);
586
- return 2;
587
- }
588
- console.error(`gavel: ${err instanceof Error ? err.message : String(err)}`);
589
- return 1;
590
- }
591
- }
720
+ let command;
592
721
  try {
593
722
  const taken = takeAs(argvIn);
594
- as = taken.as ?? process.env.GAVEL_AGENT ?? null;
595
- if (taken.argv[0] === "watch") {
596
- const token = process.env.GAVEL_TOKEN;
597
- if (!token)
598
- throw new UsageError("set GAVEL_TOKEN to your agent token (gvl_agent_…)");
599
- return await watch(token, as);
600
- }
723
+ command = taken.argv[0];
601
724
  request = toRequest(taken.argv);
725
+ if ("pair" in request && taken.as !== null)
726
+ throw new UsageError("pair doesn't take --as: a code pairs the agent it was made for");
727
+ as = taken.as ?? process.env.GAVEL_AGENT ?? null;
602
728
  }
603
729
  catch (err) {
604
730
  if (!(err instanceof UsageError))
605
731
  throw err;
606
- console.error(`gavel: ${err.message}\n\n${USAGE}`);
732
+ console.error(`gavel: ${err.message}\n\n${command !== undefined && isCommand(command) ? usageOf(command) : USAGE}`);
607
733
  return 2;
608
734
  }
609
- if (request === "help") {
610
- console.log(USAGE);
735
+ if ("help" in request) {
736
+ console.log(request.help);
611
737
  return 0;
612
738
  }
739
+ if ("pair" in request)
740
+ return pair(request.pair);
613
741
  const token = process.env.GAVEL_TOKEN;
614
742
  if (!token) {
615
743
  console.error("gavel: set GAVEL_TOKEN to your agent token (gvl_agent_…)");
616
744
  return 2;
617
745
  }
746
+ if ("watch" in request)
747
+ return watch(token, as);
618
748
  const base = (process.env.GAVEL_API_URL ?? "https://api.getgavel.ai").replace(/\/+$/, "");
619
749
  const res = await fetch(base + request.path, {
620
750
  method: request.method,
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "The gavel command: an agent's Gavel from a shell (pair, ask, wait, watch and the rest)",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://getgavel.ai/agents",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ntommarello/gavel.git",
10
+ "directory": "cli"
11
+ },
7
12
  "type": "module",
8
13
  "bin": {
9
14
  "gavel": "dist/gavel.js"