@getgavel/cli 0.1.10 → 0.1.12

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 +11 -3
  2. package/dist/gavel.js +236 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,6 +31,7 @@ gavel search "onboarding copy" # before you ask
31
31
  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
+ gavel find "nudge a decision" # the API's routes for what you want, and who may call each
34
35
  gavel help # every command
35
36
  gavel act --help # one command's usage
36
37
  ```
@@ -41,8 +42,9 @@ gavel act --help # one command's usage
41
42
  ## For your person
42
43
 
43
44
  Once your person lets you, their personal agent, do what they can in Gavel (Settings › Agents,
44
- "Can do what you can in Gavel"), you act as them: on their decisions, settings, trusts, agents and
45
- Blockers.
45
+ "Can do what you can in Gavel"), you act as them: on their decisions, settings, trusts, agents,
46
+ Blockers and workspace, as far as their role goes. What stays theirs by hand (a key, connecting a
47
+ service, an Owner) comes back as a to-do to ask them.
46
48
 
47
49
  ```sh
48
50
  gavel my-queue # their queue
@@ -51,6 +53,8 @@ gavel boomerang D-12 # forward-mine, rese
51
53
  gavel set-my-day --day-start 09:00 --day-end 18:00 # their day, alerts, reports and trusts
52
54
  gavel move-agent-mine <agent id> --under <agent id> # their agents: edit, pause, archive…
53
55
  gavel my-blockers # what's stuck; nudge-mine, reassign
56
+ gavel invite-person --email gia@acme.com # their workspace: roles, areas, boards…
57
+ gavel answer-mine <requestId> "The second" --their-words "tell Ada the second" # their view; ask-mine too
54
58
  gavel call GET /v1/me --for-person true # any route, as you or as them
55
59
  ```
56
60
 
@@ -59,7 +63,11 @@ gavel call GET /v1/me --for-person true # any route, as you
59
63
  A job with `permissions: id-token: write` needs no pasted token: the command trades GitHub's token
60
64
  for the run's own, once a person has let the repository's runs ask under one of their agents
61
65
  (Settings › Agents). `gavel actions-env` writes it, masked, as `GAVEL_TOKEN` for the job's later
62
- steps, for an agent there that speaks MCP.
66
+ steps, for an agent there that speaks MCP. Name the run by its task with `GAVEL_AGENT` (or `--as`):
67
+ a run of the same task later comes back as the same agent. Without one, Gavel names it by the
68
+ workflow and run number.
69
+
70
+ Each command ends, on stderr, with what's waiting for you in Gavel when something is.
63
71
 
64
72
  ## Your Claude Code or Codex chat, in Gavel
65
73
 
package/dist/gavel.js CHANGED
@@ -110,6 +110,8 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
110
110
  gavel call <GET|POST|PUT|PATCH|DELETE> </v1/path> [--query <name=value>] [--body <file.json>]
111
111
  [--for-person true] any route of the API as you, or as your person with
112
112
  --for-person: MCP's do_action, the answer as it comes
113
+ gavel find (<words> | --query <words>) [--limit <n>]
114
+ the API's routes for what you want to do, who may call each
113
115
  gavel me
114
116
  gavel my-queue [--view mine|asked|decided] [--before <time>] [--limit <n>]
115
117
  your person's queue, what they asked, or their Decided
@@ -171,13 +173,49 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
171
173
  gavel nudge-mine <D-12> its decider, for them: once a day, when it blocks them
172
174
  gavel reassign <D-12> (--to-person <email> | --to-agent <id>) [--note <words>]
173
175
  a stuck decision to someone else, for them: an Admin's
176
+ gavel workspace-settings its name, triage person, depth and untrusted areas
177
+ gavel edit-workspace [--name <name>] [--triage-person <person id>|none] [--sub-agent-depth <n>]
178
+ [--never-trusted <area id,area id>|none]
179
+ Admins and Owners; only what you give changes
180
+ gavel workspace-people everyone, with their role
181
+ gavel set-role <person id> --role owner|admin|member
182
+ as far as their role goes; an Owner's stays theirs by hand
183
+ gavel invitations the open ones
184
+ gavel invite-person --email <email> [--role admin|member]
185
+ gavel email-invitation-again <invitation id>
186
+ gavel take-back-invitation <invitation id>
187
+ gavel invite-link the link, and who it lets in
188
+ gavel reset-invite-link Admins and Owners: the old one stops letting anyone in
189
+ gavel set-invite-link-rule --mode off|anyone|domains [--domains <a.com,b.com>]
190
+ Owners: who it lets in
191
+ gavel workspace-areas the areas, their owners and code paths
192
+ gavel add-area --slug <slug> --name <name> [--description <words>] [--owner <email or id>]
193
+ [--code-paths <a/,b/>] Admins and Owners
194
+ gavel edit-area <area id> [--slug <slug>] [--name <name>] [--description <words>]
195
+ [--owner <email or id>|none] [--code-paths <a/,b/>]
196
+ gavel area-suggestions [--fresh true] what CODEOWNERS suggests, to confirm or dismiss
197
+ gavel confirm-area-suggestion <suggestion id>
198
+ gavel dismiss-area-suggestion <suggestion id>
199
+ gavel linear-teams the Linear teams a board can show
200
+ gavel add-linear-board <team id>
201
+ gavel remove-linear-board <team id> Linear keeps its issues
202
+ gavel workspace-logo the logo, and the ones its connections offer
203
+ gavel set-workspace-logo slack|github|linear|none
204
+ gavel workspace-connections what's connected, never a key; keys stay your person's
205
+ gavel ask-mine --file decision.json --their-words <words>
206
+ ask as your person, only on their word
207
+ gavel withdraw-mine <D-12> [--reason <words>]
208
+ take back one your person asked, while it isn't decided
209
+ gavel my-requests the Ask someone requests waiting on your person's view
210
+ gavel answer-mine <requestId> (<response> | --response <words>) --their-words <words>
211
+ their view, only on their word
174
212
 
175
213
  --as <name> on a fleet token, which chat you are (the name you go by,
176
214
  e.g. worker 35 or the task you're on; keep using the same one)
177
215
 
178
216
  gavel <command> --help shows one command's usage. A command refuses a flag or a word it doesn't
179
217
  take, and a flag given twice (but --option, --code, --label and --query), with its usage.
180
- The commands from my-queue to reassign act for your person, as them, once they've let you
218
+ The commands from my-queue to answer-mine act for your person, as them, once they've let you
181
219
  (Settings › Agents); each goes with X-Gavel-For-Person.
182
220
  A text argument or --file of "-" is read from stdin.
183
221
  Environment: GAVEL_TOKEN (required, but a GitHub Actions job with id-token: write trades GitHub's
@@ -221,6 +259,7 @@ const FLAGS = {
221
259
  "start-cloud-agent": ["name", "repo", "task", "branch", "open-pr", "machine", "agent"],
222
260
  "move-agent": ["under"],
223
261
  call: ["query", "body", "for-person"],
262
+ find: ["query", "limit"],
224
263
  me: [],
225
264
  "my-queue": ["view", "before", "limit"],
226
265
  "decide-mine": ["option", "text", "note", "their-words"],
@@ -259,6 +298,33 @@ const FLAGS = {
259
298
  "my-blockers": [],
260
299
  "nudge-mine": [],
261
300
  reassign: ["to-person", "to-agent", "note"],
301
+ "workspace-settings": [],
302
+ "edit-workspace": ["name", "triage-person", "sub-agent-depth", "never-trusted"],
303
+ "workspace-people": [],
304
+ "set-role": ["role"],
305
+ invitations: [],
306
+ "invite-person": ["email", "role"],
307
+ "email-invitation-again": [],
308
+ "take-back-invitation": [],
309
+ "invite-link": [],
310
+ "reset-invite-link": [],
311
+ "set-invite-link-rule": ["mode", "domains"],
312
+ "workspace-areas": [],
313
+ "add-area": ["slug", "name", "description", "owner", "code-paths"],
314
+ "edit-area": ["slug", "name", "description", "owner", "code-paths"],
315
+ "area-suggestions": ["fresh"],
316
+ "confirm-area-suggestion": [],
317
+ "dismiss-area-suggestion": [],
318
+ "linear-teams": [],
319
+ "add-linear-board": [],
320
+ "remove-linear-board": [],
321
+ "workspace-logo": [],
322
+ "set-workspace-logo": [],
323
+ "workspace-connections": [],
324
+ "ask-mine": ["file", "their-words"],
325
+ "withdraw-mine": ["reason"],
326
+ "my-requests": [],
327
+ "answer-mine": ["response", "their-words"],
262
328
  };
263
329
  // Your person's own actions, sent as them (X-Gavel-For-Person) once they've let you act for them
264
330
  // (D-911): the MCP tools' names.
@@ -300,6 +366,33 @@ const FOR_PERSON = [
300
366
  "my-blockers",
301
367
  "nudge-mine",
302
368
  "reassign",
369
+ "workspace-settings",
370
+ "edit-workspace",
371
+ "workspace-people",
372
+ "set-role",
373
+ "invitations",
374
+ "invite-person",
375
+ "email-invitation-again",
376
+ "take-back-invitation",
377
+ "invite-link",
378
+ "reset-invite-link",
379
+ "set-invite-link-rule",
380
+ "workspace-areas",
381
+ "add-area",
382
+ "edit-area",
383
+ "area-suggestions",
384
+ "confirm-area-suggestion",
385
+ "dismiss-area-suggestion",
386
+ "linear-teams",
387
+ "add-linear-board",
388
+ "remove-linear-board",
389
+ "workspace-logo",
390
+ "set-workspace-logo",
391
+ "workspace-connections",
392
+ "ask-mine",
393
+ "withdraw-mine",
394
+ "my-requests",
395
+ "answer-mine",
303
396
  ];
304
397
  const isCommand = (name) => Object.hasOwn(FLAGS, name);
305
398
  // A command's own entries in USAGE: each line naming it, with the lines indented under it.
@@ -597,6 +690,127 @@ function personRequest(command, p, f, options) {
597
690
  case "reassign":
598
691
  upTo(1);
599
692
  return asThem("POST", `/v1/decisions/${ref(p[0])}/reassign`, { toPerson: f["to-person"], toAgentId: f["to-agent"], note: f.note });
693
+ case "workspace-settings":
694
+ upTo(0);
695
+ return asThem("GET", "/v1/workspace");
696
+ case "edit-workspace": {
697
+ upTo(0);
698
+ const depth = f["sub-agent-depth"];
699
+ if (depth !== undefined && !/^\d+$/.test(depth))
700
+ throw new UsageError("--sub-agent-depth is a number");
701
+ const untrusted = f["never-trusted"];
702
+ const body = compact({
703
+ name: f.name,
704
+ triagePersonId: orNone("triage-person"),
705
+ subAgentMaxDepth: depth === undefined ? undefined : Number(depth),
706
+ neverTrustableAreaIds: untrusted === undefined ? undefined : untrusted === "none" ? [] : list(untrusted),
707
+ });
708
+ if (!Object.keys(body).length)
709
+ throw new UsageError("edit-workspace needs something to change");
710
+ return asThem("PATCH", "/v1/workspace", body);
711
+ }
712
+ case "workspace-people":
713
+ upTo(0);
714
+ return asThem("GET", "/v1/workspace/people");
715
+ case "set-role":
716
+ upTo(1);
717
+ return asThem("PATCH", `/v1/workspace/people/${id("the person's id")}`, { role: need(f.role, "--role") });
718
+ case "invitations":
719
+ upTo(0);
720
+ return asThem("GET", "/v1/workspace/invitations");
721
+ case "invite-person":
722
+ upTo(0);
723
+ return asThem("POST", "/v1/workspace/invitations", { email: need(f.email, "--email"), role: f.role });
724
+ case "email-invitation-again":
725
+ upTo(1);
726
+ return asThem("POST", `/v1/workspace/invitations/${id("the invitation's id")}/email`);
727
+ case "take-back-invitation":
728
+ upTo(1);
729
+ return asThem("DELETE", `/v1/workspace/invitations/${id("the invitation's id")}`);
730
+ case "invite-link":
731
+ upTo(0);
732
+ return asThem("GET", "/v1/workspace/invite-link");
733
+ case "reset-invite-link":
734
+ upTo(0);
735
+ return asThem("POST", "/v1/workspace/invite-link/reset");
736
+ case "set-invite-link-rule":
737
+ upTo(0);
738
+ return asThem("PUT", "/v1/workspace/invite-link/rule", { mode: need(f.mode, "--mode"), domains: f.domains === undefined ? undefined : list(f.domains) });
739
+ case "workspace-areas":
740
+ upTo(0);
741
+ return asThem("GET", "/v1/areas");
742
+ case "add-area":
743
+ upTo(0);
744
+ return asThem("POST", "/v1/areas", {
745
+ slug: need(f.slug, "--slug"),
746
+ name: need(f.name, "--name"),
747
+ description: f.description && readText(f.description),
748
+ ownerPerson: f.owner,
749
+ codePaths: f["code-paths"] === undefined ? undefined : list(f["code-paths"]),
750
+ });
751
+ case "edit-area": {
752
+ upTo(1);
753
+ const area = id("the area's id");
754
+ const body = compact({
755
+ slug: f.slug,
756
+ name: f.name,
757
+ description: f.description && readText(f.description),
758
+ ownerPerson: orNone("owner"),
759
+ codePaths: f["code-paths"] === undefined ? undefined : list(f["code-paths"]),
760
+ });
761
+ if (!Object.keys(body).length)
762
+ throw new UsageError("edit-area needs something to change");
763
+ return asThem("PATCH", `/v1/areas/${area}`, body);
764
+ }
765
+ case "area-suggestions":
766
+ upTo(0);
767
+ return asThem("GET", `/v1/areas/suggestions${yesNo("fresh") ? "?fresh=1" : ""}`);
768
+ case "confirm-area-suggestion":
769
+ upTo(1);
770
+ return asThem("POST", `/v1/areas/suggestions/${id("the suggestion's id")}/confirm`);
771
+ case "dismiss-area-suggestion":
772
+ upTo(1);
773
+ return asThem("POST", `/v1/areas/suggestions/${id("the suggestion's id")}/dismiss`);
774
+ case "linear-teams":
775
+ upTo(0);
776
+ return asThem("GET", "/v1/board/teams");
777
+ case "add-linear-board":
778
+ upTo(1);
779
+ return asThem("POST", "/v1/board/boards", { teamId: need(p[0], "the team's id") });
780
+ case "remove-linear-board":
781
+ upTo(1);
782
+ return asThem("DELETE", `/v1/board/boards/${id("the team's id")}`);
783
+ case "workspace-logo":
784
+ upTo(0);
785
+ return asThem("GET", "/v1/workspace/logo");
786
+ case "set-workspace-logo": {
787
+ upTo(1);
788
+ const source = need(p[0], "slack, github, linear or none");
789
+ if (!["slack", "github", "linear", "none"].includes(source))
790
+ throw new UsageError("set-workspace-logo takes slack, github, linear or none");
791
+ return asThem("PUT", "/v1/workspace/logo", { source: source === "none" ? null : source });
792
+ }
793
+ case "workspace-connections":
794
+ upTo(0);
795
+ return asThem("GET", "/v1/connections");
796
+ case "ask-mine": {
797
+ upTo(0);
798
+ const decision = readJson(need(f.file, "--file decision.json"));
799
+ if (!decision || typeof decision !== "object" || Array.isArray(decision))
800
+ throw new UsageError("--file holds one decision, as MCP ask's input");
801
+ return asThem("POST", "/v1/decisions", { ...decision, theirWords: theirWords() });
802
+ }
803
+ case "withdraw-mine":
804
+ upTo(1);
805
+ return asThem("POST", `/v1/decisions/${ref(p[0])}/withdraw`, { reason: f.reason && readText(f.reason) });
806
+ case "my-requests":
807
+ upTo(0);
808
+ return asThem("GET", "/v1/requests");
809
+ case "answer-mine":
810
+ return asThem("POST", `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/answer`, {
811
+ response: words("response", p.slice(1), "the response"),
812
+ theirWords: theirWords(),
813
+ });
600
814
  default:
601
815
  throw new UsageError(`unknown command "${command}"`);
602
816
  }
@@ -863,6 +1077,14 @@ export function toRequest(argv) {
863
1077
  agentId: f.agent,
864
1078
  }),
865
1079
  };
1080
+ case "find": {
1081
+ const q = words("query", p, "what you want to do, in words");
1082
+ const limit = f.limit;
1083
+ if (limit !== undefined && !/^\d+$/.test(limit))
1084
+ throw new UsageError("--limit is a number");
1085
+ const query = new URLSearchParams({ q, ...(limit ? { limit } : {}) });
1086
+ return { method: "GET", path: `/v1/actions?${query}` };
1087
+ }
866
1088
  case "move-agent":
867
1089
  upTo(1);
868
1090
  return { method: "PATCH", path: `/v1/agents/${encodeURIComponent(need(p[0], "the agent's id"))}`, body: { parentAgentId: need(f.under, "--under") } };
@@ -1215,7 +1437,8 @@ async function upload(token, as, { file, contentType }) {
1215
1437
  return 0;
1216
1438
  }
1217
1439
  // One line per thing that should wake the chat: refs and Gavel's own words only, never a message's
1218
- // text, so the line itself is never someone else's instructions.
1440
+ // text, so the line itself is never someone else's instructions. A kind newer than this command
1441
+ // still wakes it, with a line that sends it to the inbox.
1219
1442
  export function wakeLine(item) {
1220
1443
  switch (item.kind) {
1221
1444
  case "message":
@@ -1232,6 +1455,10 @@ export function wakeLine(item) {
1232
1455
  : "GAVEL_WAKE clash in your folders: see gavel inbox, and wait for the agent above to say who gets it";
1233
1456
  case "chat":
1234
1457
  return "GAVEL_WAKE chat: your person wrote to you in Gavel: read it with gavel chat";
1458
+ case "health":
1459
+ return "GAVEL_WAKE health: Gavel's chat self-check: see gavel inbox";
1460
+ default:
1461
+ return "GAVEL_WAKE something new: see gavel inbox";
1235
1462
  }
1236
1463
  }
1237
1464
  const backoff = (failures) => Math.min(30_000, 1000 * 2 ** Math.min(failures - 1, 5));
@@ -1245,7 +1472,7 @@ async function watch(token, as) {
1245
1472
  for (;;) {
1246
1473
  let res;
1247
1474
  try {
1248
- res = await fetch(`${base}/v1/inbox/watch?watch=${id}&timeout=50${start ? "&start=true" : ""}`, {
1475
+ res = await fetch(`${base}/v1/inbox/watch?watch=${id}&timeout=50&kinds=health${start ? "&start=true" : ""}`, {
1249
1476
  headers: { authorization: `Bearer ${token}`, accept: "application/json", ...agentHeader(as) },
1250
1477
  });
1251
1478
  }
@@ -1375,6 +1602,7 @@ async function main(argvIn) {
1375
1602
  headers: {
1376
1603
  authorization: `Bearer ${token}`,
1377
1604
  accept: "application/json",
1605
+ "x-gavel-waiting": "1",
1378
1606
  ...agentHeader(as),
1379
1607
  ...(request.forPerson ? { "x-gavel-for-person": "true" } : {}),
1380
1608
  ...(request.body !== undefined ? { "content-type": "application/json" } : {}),
@@ -1394,6 +1622,11 @@ async function main(argvIn) {
1394
1622
  return 1;
1395
1623
  }
1396
1624
  console.log(out);
1625
+ // What's waiting for you (the server's own words), on stderr so stdout stays the answer's JSON. A
1626
+ // failed call's stderr stays its error alone.
1627
+ const waiting = res.headers.get("x-gavel-waiting");
1628
+ if (waiting)
1629
+ console.error(waiting);
1397
1630
  return 0;
1398
1631
  }
1399
1632
  main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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",