@getgavel/cli 0.1.0 → 0.1.3

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/gavel.js +42 -7
  2. package/package.json +6 -1
package/dist/gavel.js CHANGED
@@ -16,6 +16,7 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
16
16
  gavel search <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
@@ -23,8 +24,9 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
23
24
  gavel answer <requestId> <response> answer an Ask someone
24
25
  gavel act <D-12> <note> what you did with the answer
25
26
  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)
27
+ gavel status <text> [--folders <a,b>] [--state working|blocked|idle] [--issue <MA-482>] [--waiting-on <email>]
28
+ what you're doing now, in plain words ("" clears it);
29
+ --waiting-on names the person you're blocked on
28
30
  gavel message (--to-agent <id> | --to-person <email>) <text> [--decision <D-12>]
29
31
  start a conversation with another agent
30
32
  gavel message --conversation <C-12> <text>
@@ -49,7 +51,10 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
49
51
  gavel agents you and your sub-agents
50
52
  gavel invite --name <name> [--description <words>] [--permissions ask,answer]
51
53
  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
54
+ [--machine <worker>] [--agent <agent id>]
55
+ a Cursor cloud agent under you, for a task; --machine runs it on
56
+ your person's own machine (My Machines), --agent starts an
57
+ agent under you as itself (no --name), its old tokens ended
53
58
  gavel me
54
59
 
55
60
  --as <name> on a fleet token, which chat you are (the name you go by,
@@ -160,6 +165,8 @@ export function toRequest(argv) {
160
165
  return { method: "POST", path: "/v1/decisions", body: readJson(need(f.file, "--file decision.json")) };
161
166
  case "revise":
162
167
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/revise`, body: readJson(need(f.file, "--file decision.json")) };
168
+ case "todo":
169
+ return { method: "POST", path: "/v1/todos", body: readJson(need(f.file, "--file todo.json")) };
163
170
  case "get":
164
171
  return { method: "GET", path: `/v1/decisions/${ref(p[0])}` };
165
172
  case "wait":
@@ -178,7 +185,7 @@ export function toRequest(argv) {
178
185
  if (!p.length)
179
186
  throw new UsageError('missing what you\'re doing now (or "" to clear it)');
180
187
  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 }) };
188
+ return { method: "PATCH", path: "/v1/agents/me/status", body: compact({ text: readText(p.join(" ")) || null, folders, state: f.state, linearIssue: f.issue, waitingOn: f["waiting-on"] }) };
182
189
  }
183
190
  case "message": {
184
191
  const text = readText(need(p.join(" "), "what to say"));
@@ -246,11 +253,13 @@ export function toRequest(argv) {
246
253
  method: "POST",
247
254
  path: "/v1/cloud-agents",
248
255
  body: compact({
249
- name: need(f.name, "--name"),
256
+ name: f.agent ? f.name : need(f.name, "--name"),
250
257
  repo: need(f.repo, "--repo"),
251
258
  task: readText(need(f.task, "--task")),
252
259
  branch: f.branch,
253
260
  openPullRequest: f["open-pr"] === undefined ? undefined : f["open-pr"] === "true",
261
+ machine: f.machine,
262
+ agentId: f.agent,
254
263
  }),
255
264
  };
256
265
  case "me":
@@ -282,6 +291,15 @@ function tracked(file, cwd) {
282
291
  return false;
283
292
  }
284
293
  }
294
+ function runs(command) {
295
+ try {
296
+ execFileSync(command, ["--version"], { stdio: "ignore" });
297
+ return true;
298
+ }
299
+ catch {
300
+ return false;
301
+ }
302
+ }
285
303
  function writePrivate(path, text) {
286
304
  mkdirSync(dirname(path), { recursive: true });
287
305
  writeFileSync(path, text, { mode: 0o600 });
@@ -391,7 +409,13 @@ export function writeSetup(setup, opts) {
391
409
  catch {
392
410
  // none there yet
393
411
  }
394
- run(words[0], words.slice(1));
412
+ try {
413
+ run(words[0], words.slice(1));
414
+ }
415
+ catch {
416
+ // Its error would carry the command line, the token in it.
417
+ throw new Error(`claude mcp add ${setup.server} failed`);
418
+ }
395
419
  done.push(`ran claude mcp add ${setup.server} (scope ${words[words.length - 1]})`);
396
420
  break;
397
421
  }
@@ -495,6 +519,10 @@ async function pair(argv) {
495
519
  const harness = (flags.harness ?? detectHarness(process.env));
496
520
  if (!HARNESSES.includes(harness))
497
521
  throw new UsageError(`--harness is one of ${HARNESSES.join(", ")}`);
522
+ if (harness === "claude-code" && !runs("claude")) {
523
+ 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.");
524
+ return 1;
525
+ }
498
526
  const base = (process.env.GAVEL_API_URL ?? "https://api.getgavel.ai").replace(/\/+$/, "");
499
527
  const res = await fetch(`${base}/v1/pair`, {
500
528
  method: "POST",
@@ -507,7 +535,14 @@ async function pair(argv) {
507
535
  return 1;
508
536
  }
509
537
  const opts = { cwd: process.cwd(), home: homedir() };
510
- const done = writeSetup(body.setup, opts);
538
+ let done;
539
+ try {
540
+ done = writeSetup(body.setup, opts);
541
+ }
542
+ catch (err) {
543
+ console.error(`gavel: ${err instanceof Error ? err.message : String(err)}. That used the code: get a new one (New code) and pair again.`);
544
+ return 1;
545
+ }
511
546
  if (body.legacy && body.legacy.server !== body.setup.server)
512
547
  done.push(...(await dropLegacy(body.setup, body.legacy, { ...opts, apiUrl: base })));
513
548
  console.log(JSON.stringify({ paired: true, kind: body.kind, agent: body.agent, harness, done, then: body.then }, null, 2));
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
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"