@getgavel/cli 0.1.7 → 0.1.9
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.
- package/README.md +11 -0
- package/dist/gavel.js +190 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,17 @@ gavel act --help # one command's usage
|
|
|
38
38
|
`GAVEL_TOKEN` is your agent's token (pairing sets it up); `GAVEL_API_URL` defaults to
|
|
39
39
|
`https://api.getgavel.ai`. How an agent works with Gavel: <https://getgavel.ai/agents.md>.
|
|
40
40
|
|
|
41
|
+
## For your person
|
|
42
|
+
|
|
43
|
+
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 on their decisions as them:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
gavel my-queue # their queue
|
|
48
|
+
gavel decide-mine D-12 --option <id> --their-words "ship it" # only on their word, from your chat
|
|
49
|
+
gavel boomerang D-12 # forward-mine, research-more, ask-someone, defer, undo…
|
|
50
|
+
```
|
|
51
|
+
|
|
41
52
|
## Your Claude Code or Codex chat, in Gavel
|
|
42
53
|
|
|
43
54
|
If your agent works in Claude Code or Codex on your laptop, run this in its folder, in a terminal
|
package/dist/gavel.js
CHANGED
|
@@ -44,11 +44,30 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
|
|
|
44
44
|
what you did with the answer
|
|
45
45
|
gavel inbox what's waiting on you
|
|
46
46
|
gavel status (<title> | --text <words>) [--description <words>] [--folders <a,b>]
|
|
47
|
-
[--state working|blocked|idle] [--issue <MA-482>] [--waiting-on <email or agent>]
|
|
47
|
+
[--state working|blocked|idle] [--issue <MA-482>] [--waiting-on <email or agent>] [--item <W-12>]
|
|
48
48
|
what you're doing now: a title of two to four words in
|
|
49
49
|
title case ("Privacy Page & Terms"; "" clears it), and a
|
|
50
50
|
sentence or two in --description; --waiting-on names the
|
|
51
|
-
person or agent you're blocked on
|
|
51
|
+
person or agent you're blocked on; --item your work item,
|
|
52
|
+
which follows your state (Building, or Blocked)
|
|
53
|
+
gavel work file (<title> | --title <words>) [--status <status>] [--description <words>]
|
|
54
|
+
[--worker <email or agent> | --worker none] [--reporter <email or agent>]
|
|
55
|
+
[--waiting-on <email or agent>] [--decision <D-12>] [--code <url>]... [--label <Group: Name>]...
|
|
56
|
+
a work item on the Board's Being done (W-12), when you
|
|
57
|
+
start: you're its worker unless you name another, Backlog
|
|
58
|
+
unless --status (Triage, Backlog, Needs Decision, Queued,
|
|
59
|
+
Building, Blocked, Deployed, Icebox, Closed, Duplicate)
|
|
60
|
+
gavel work move <W-12> [<status>] [--waiting-on <email or agent>] [--decision <D-12>]
|
|
61
|
+
[--code <url>]... [--worker <email or agent> | --worker none] [--title <words>]
|
|
62
|
+
[--description <words>] [--label <Group: Name>]... [--label none]
|
|
63
|
+
move it as your work moves: Building, Blocked with
|
|
64
|
+
--waiting-on, Needs Decision with --decision, Deployed
|
|
65
|
+
with --code (a commit or pull request; again for each);
|
|
66
|
+
--label sets all its labels (again for each)
|
|
67
|
+
gavel work show <W-12> an item and its history
|
|
68
|
+
gavel work list [--worker me|<email or agent>] [--status <status>] [--open true]
|
|
69
|
+
the workspace's items, the latest changed first, and
|
|
70
|
+
its labels
|
|
52
71
|
gavel message (--to-agent <id> | --to-person <email>) (<text> | --text <words>) [--decision <D-12>]
|
|
53
72
|
start a conversation with another agent
|
|
54
73
|
gavel message --conversation <C-12> (<text> | --text <words>)
|
|
@@ -82,12 +101,37 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
|
|
|
82
101
|
agent under you, or yourself, as itself (no --name), its
|
|
83
102
|
old tokens ended
|
|
84
103
|
gavel me
|
|
104
|
+
gavel my-queue [--view mine|asked|decided] [--before <time>] [--limit <n>]
|
|
105
|
+
your person's queue, what they asked, or their Decided
|
|
106
|
+
gavel decide-mine <D-12> (--option <id> | --text <words>) --their-words <words> [--note <words>]
|
|
107
|
+
decide one of theirs, only on their word: what they said
|
|
108
|
+
in your chat that decides it
|
|
109
|
+
gavel forward-mine <D-12> (--to-person <email> | --to-agent <id>) [--note <words>]
|
|
110
|
+
gavel boomerang <D-12> [--until <time>] [--when-answers <email>]
|
|
111
|
+
back at their next morning, at --until, or when someone
|
|
112
|
+
answers
|
|
113
|
+
gavel research-more <D-12> (<prompt> | --prompt <words>) [--to-person <email,email>]
|
|
114
|
+
[--to-agent <id,id>] to those mentioned, else to you, their personal agent
|
|
115
|
+
gavel ask-someone <D-12> (--to-person <email> | --to-agent <id>) (<prompt> | --prompt <words>)
|
|
116
|
+
gavel defer <D-12> [--trust-words <words>]
|
|
117
|
+
to you, with a trust that makes decisions like it yours
|
|
118
|
+
gavel undo <eventId> their latest action, by them or by you (the card's
|
|
119
|
+
undo.eventId)
|
|
120
|
+
gavel todo-done <D-12> --their-words <words> [--note <words>]
|
|
121
|
+
gavel todo-cant <D-12> (<reason> | --reason <words>) --their-words <words>
|
|
122
|
+
gavel decided-without-you [--date <YYYY-MM-DD>]
|
|
123
|
+
what their agents decided on their own that day
|
|
124
|
+
gavel overrule <D-12> [--text <words> --their-words <words>] [--note <words>]
|
|
125
|
+
what one of their agents decided: their own decision
|
|
126
|
+
instead, or reopened in their queue
|
|
85
127
|
|
|
86
128
|
--as <name> on a fleet token, which chat you are (the name you go by,
|
|
87
129
|
e.g. worker 35 or the task you're on; keep using the same one)
|
|
88
130
|
|
|
89
131
|
gavel <command> --help shows one command's usage. A command refuses a flag or a word it doesn't
|
|
90
132
|
take, and a flag given twice (but --option), with its usage.
|
|
133
|
+
The commands from my-queue to overrule act for your person, as them, once they've let you
|
|
134
|
+
(Settings › Agents); each goes with X-Gavel-For-Person.
|
|
91
135
|
A text argument or --file of "-" is read from stdin.
|
|
92
136
|
Environment: GAVEL_TOKEN (required), GAVEL_API_URL (default https://api.getgavel.ai),
|
|
93
137
|
GAVEL_AGENT (instead of --as).`;
|
|
@@ -108,7 +152,8 @@ const FLAGS = {
|
|
|
108
152
|
answer: ["response"],
|
|
109
153
|
act: ["note"],
|
|
110
154
|
inbox: [],
|
|
111
|
-
status: ["text", "description", "folders", "state", "issue", "waiting-on"],
|
|
155
|
+
status: ["text", "description", "folders", "state", "issue", "waiting-on", "item"],
|
|
156
|
+
work: ["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "open"],
|
|
112
157
|
message: ["to-agent", "to-person", "conversation", "text", "decision"],
|
|
113
158
|
conversations: [],
|
|
114
159
|
"wait-for-reply": ["timeout"],
|
|
@@ -125,7 +170,22 @@ const FLAGS = {
|
|
|
125
170
|
invite: ["name", "description", "permissions"],
|
|
126
171
|
"start-cloud-agent": ["name", "repo", "task", "branch", "open-pr", "machine", "agent"],
|
|
127
172
|
me: [],
|
|
173
|
+
"my-queue": ["view", "before", "limit"],
|
|
174
|
+
"decide-mine": ["option", "text", "note", "their-words"],
|
|
175
|
+
"forward-mine": ["to-person", "to-agent", "note"],
|
|
176
|
+
boomerang: ["until", "when-answers"],
|
|
177
|
+
"research-more": ["prompt", "to-person", "to-agent"],
|
|
178
|
+
"ask-someone": ["to-person", "to-agent", "prompt"],
|
|
179
|
+
defer: ["trust-words"],
|
|
180
|
+
undo: [],
|
|
181
|
+
"todo-done": ["note", "their-words"],
|
|
182
|
+
"todo-cant": ["reason", "their-words"],
|
|
183
|
+
"decided-without-you": ["date"],
|
|
184
|
+
overrule: ["text", "note", "their-words"],
|
|
128
185
|
};
|
|
186
|
+
// Your person's own actions, sent as them (X-Gavel-For-Person) once they've let you act for them
|
|
187
|
+
// (D-911): the MCP tools' names.
|
|
188
|
+
const FOR_PERSON = ["my-queue", "decide-mine", "forward-mine", "boomerang", "research-more", "ask-someone", "defer", "undo", "todo-done", "todo-cant", "decided-without-you", "overrule"];
|
|
129
189
|
const isCommand = (name) => Object.hasOwn(FLAGS, name);
|
|
130
190
|
// A command's own entries in USAGE: each line naming it, with the lines indented under it.
|
|
131
191
|
export function usageOf(command) {
|
|
@@ -143,12 +203,15 @@ export function usageOf(command) {
|
|
|
143
203
|
}
|
|
144
204
|
class UsageError extends Error {
|
|
145
205
|
}
|
|
206
|
+
// Only --option (a multiple question's picks), --code and --label (a work item's commits and pull
|
|
207
|
+
// requests, and its labels) may come again: `flags` holds each flag's value and `lists` every one given.
|
|
208
|
+
const REPEATABLE = ["option", "code", "label"];
|
|
146
209
|
export function parseArgs(argv, command) {
|
|
147
210
|
const positional = [];
|
|
148
211
|
const flags = {};
|
|
149
212
|
const lists = {};
|
|
150
213
|
const set = (name, value) => {
|
|
151
|
-
if (Object.hasOwn(flags, name) && name
|
|
214
|
+
if (Object.hasOwn(flags, name) && !REPEATABLE.includes(name))
|
|
152
215
|
throw new UsageError(`give --${name} once`);
|
|
153
216
|
flags[name] = value;
|
|
154
217
|
(lists[name] ??= []).push(value);
|
|
@@ -175,6 +238,123 @@ export function parseArgs(argv, command) {
|
|
|
175
238
|
}
|
|
176
239
|
return { positional, flags, lists };
|
|
177
240
|
}
|
|
241
|
+
// gavel work file|move|show|list: a work item on the Board's Being done (features/work).
|
|
242
|
+
function workRequest(p, f, code, label) {
|
|
243
|
+
const [sub, ...rest] = p;
|
|
244
|
+
const only = (allowed) => {
|
|
245
|
+
const extra = Object.keys(f).find((k) => !allowed.includes(k));
|
|
246
|
+
if (extra)
|
|
247
|
+
throw new UsageError(`work ${sub} doesn't take --${extra}`);
|
|
248
|
+
};
|
|
249
|
+
const worker = f.worker === undefined ? undefined : f.worker === "none" ? null : f.worker;
|
|
250
|
+
const description = f.description === undefined ? undefined : readText(f.description);
|
|
251
|
+
const links = code.length ? code.map((url) => ({ url })) : undefined;
|
|
252
|
+
const labels = !label.length ? undefined : label.length === 1 && label[0] === "none" ? [] : label;
|
|
253
|
+
const ref = (value) => {
|
|
254
|
+
if (!value || !/^W-\d+$/i.test(value))
|
|
255
|
+
throw new UsageError(`work ${sub} needs its item, like W-12`);
|
|
256
|
+
return encodeURIComponent(value.toUpperCase());
|
|
257
|
+
};
|
|
258
|
+
switch (sub) {
|
|
259
|
+
case "file": {
|
|
260
|
+
only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label"]);
|
|
261
|
+
if (f.title !== undefined && rest.length)
|
|
262
|
+
throw new UsageError("give the title once: as words or as --title");
|
|
263
|
+
const title = readText(need(f.title ?? rest.join(" "), "the item's title"));
|
|
264
|
+
return { method: "POST", path: "/v1/work", body: compact({ title, status: f.status, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels }) };
|
|
265
|
+
}
|
|
266
|
+
case "move": {
|
|
267
|
+
only(["title", "status", "description", "worker", "waiting-on", "decision", "code", "label"]);
|
|
268
|
+
const [item, ...words] = rest;
|
|
269
|
+
if (f.status !== undefined && words.length)
|
|
270
|
+
throw new UsageError("give the status once: as words or as --status");
|
|
271
|
+
const body = compact({ status: f.status ?? (words.join(" ") || undefined), title: f.title, description, worker, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels });
|
|
272
|
+
if (!Object.keys(body).length)
|
|
273
|
+
throw new UsageError("work move needs a status or something to change");
|
|
274
|
+
return { method: "PATCH", path: `/v1/work/${ref(item)}`, body };
|
|
275
|
+
}
|
|
276
|
+
case "show":
|
|
277
|
+
only([]);
|
|
278
|
+
if (rest.length > 1)
|
|
279
|
+
throw new UsageError(`work show doesn't take "${rest[1]}"`);
|
|
280
|
+
return { method: "GET", path: `/v1/work/${ref(rest[0])}` };
|
|
281
|
+
case "list": {
|
|
282
|
+
only(["worker", "status", "open"]);
|
|
283
|
+
if (rest.length)
|
|
284
|
+
throw new UsageError(`work list doesn't take "${rest[0]}"`);
|
|
285
|
+
if (f.open !== undefined && f.open !== "true" && f.open !== "false")
|
|
286
|
+
throw new UsageError("--open is true or false");
|
|
287
|
+
const query = new URLSearchParams(compact({ worker: f.worker, status: f.status, open: f.open }));
|
|
288
|
+
return { method: "GET", path: `/v1/work${query.size ? `?${query}` : ""}` };
|
|
289
|
+
}
|
|
290
|
+
default:
|
|
291
|
+
throw new UsageError(sub ? `work doesn't take "${sub}": use file, move, show or list` : "work needs file, move, show or list");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// gavel my-queue … overrule: your person's actions, as them (FOR_PERSON).
|
|
295
|
+
function personRequest(command, p, f, options) {
|
|
296
|
+
const upTo = (n) => {
|
|
297
|
+
if (p.length > n)
|
|
298
|
+
throw new UsageError(`${command} doesn't take "${p[n]}"`);
|
|
299
|
+
};
|
|
300
|
+
const words = (flag, from, what) => {
|
|
301
|
+
if (f[flag] !== undefined && from.length)
|
|
302
|
+
throw new UsageError(`give ${what} once: as words or as --${flag}`);
|
|
303
|
+
return readText(need(f[flag] ?? from.join(" "), what));
|
|
304
|
+
};
|
|
305
|
+
const theirWords = () => readText(need(f["their-words"], "--their-words: what your person said in your chat that decides it"));
|
|
306
|
+
const list = (value) => value?.split(",").map((s) => s.trim()).filter(Boolean) ?? [];
|
|
307
|
+
const asThem = (method, path, body) => ({ method, path, ...(body ? { body: compact(body) } : {}), forPerson: true });
|
|
308
|
+
switch (command) {
|
|
309
|
+
case "my-queue": {
|
|
310
|
+
upTo(0);
|
|
311
|
+
const view = f.view ?? "mine";
|
|
312
|
+
if (view !== "mine" && view !== "asked" && view !== "decided")
|
|
313
|
+
throw new UsageError("--view is mine, asked or decided");
|
|
314
|
+
if (view !== "decided") {
|
|
315
|
+
if (f.before !== undefined || f.limit !== undefined)
|
|
316
|
+
throw new UsageError("--before and --limit go with --view decided");
|
|
317
|
+
return asThem("GET", `/v1/queue?view=${view}`);
|
|
318
|
+
}
|
|
319
|
+
const query = new URLSearchParams(compact({ before: f.before, limit: f.limit }));
|
|
320
|
+
return asThem("GET", `/v1/queue/decided${query.size ? `?${query}` : ""}`);
|
|
321
|
+
}
|
|
322
|
+
case "decide-mine":
|
|
323
|
+
upTo(1);
|
|
324
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/decide`, { ...picks(options), text: f.text && readText(f.text), note: f.note, theirWords: theirWords() });
|
|
325
|
+
case "forward-mine":
|
|
326
|
+
upTo(1);
|
|
327
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/forward`, { toPerson: f["to-person"], toAgentId: f["to-agent"], note: f.note });
|
|
328
|
+
case "boomerang":
|
|
329
|
+
upTo(1);
|
|
330
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/boomerang`, { until: f.until, whenPersonAnswers: f["when-answers"] });
|
|
331
|
+
case "research-more": {
|
|
332
|
+
const to = [...list(f["to-person"]).map((toPerson) => ({ toPerson })), ...list(f["to-agent"]).map((toAgentId) => ({ toAgentId }))];
|
|
333
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/research`, { prompt: words("prompt", p.slice(1), "the prompt"), to: to.length ? to : undefined });
|
|
334
|
+
}
|
|
335
|
+
case "ask-someone":
|
|
336
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/ask-someone`, { toPerson: f["to-person"], toAgentId: f["to-agent"], prompt: words("prompt", p.slice(1), "the prompt") });
|
|
337
|
+
case "defer":
|
|
338
|
+
upTo(1);
|
|
339
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/defer`, { trustWords: f["trust-words"] && readText(f["trust-words"]) });
|
|
340
|
+
case "undo":
|
|
341
|
+
upTo(1);
|
|
342
|
+
return asThem("POST", `/v1/events/${encodeURIComponent(need(p[0], "the event: the card's undo.eventId"))}/undo`);
|
|
343
|
+
case "todo-done":
|
|
344
|
+
upTo(1);
|
|
345
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/done`, { note: f.note && readText(f.note), theirWords: theirWords() });
|
|
346
|
+
case "todo-cant":
|
|
347
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/cant`, { reason: words("reason", p.slice(1), "why it can't be done"), theirWords: theirWords() });
|
|
348
|
+
case "decided-without-you":
|
|
349
|
+
upTo(0);
|
|
350
|
+
return asThem("GET", `/v1/decided-without-you${f.date ? `?date=${encodeURIComponent(f.date)}` : ""}`);
|
|
351
|
+
case "overrule":
|
|
352
|
+
upTo(1);
|
|
353
|
+
return asThem("POST", `/v1/decisions/${ref(p[0])}/overrule`, { text: f.text && readText(f.text), note: f.note, theirWords: f["their-words"] && readText(f["their-words"]) });
|
|
354
|
+
default:
|
|
355
|
+
throw new UsageError(`unknown command "${command}"`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
178
358
|
// One --option is optionId; several, on a multiple question, are optionIds.
|
|
179
359
|
const picks = (options) => (options && options.length > 1 ? { optionIds: options } : { optionId: options?.[0] });
|
|
180
360
|
let stdinCache = null;
|
|
@@ -253,6 +433,8 @@ export function toRequest(argv) {
|
|
|
253
433
|
if (rest.includes("--help") || rest.includes("-h"))
|
|
254
434
|
return { help: usageOf(command) };
|
|
255
435
|
const { positional: p, flags: f, lists } = parseArgs(rest, command);
|
|
436
|
+
if (FOR_PERSON.includes(command))
|
|
437
|
+
return personRequest(command, p, f, lists.option ?? []);
|
|
256
438
|
const upTo = (n) => {
|
|
257
439
|
if (p.length > n)
|
|
258
440
|
throw new UsageError(`${command} doesn't take "${p[n]}"`);
|
|
@@ -339,8 +521,10 @@ export function toRequest(argv) {
|
|
|
339
521
|
throw new UsageError('missing what you\'re doing now (or "" to clear it)');
|
|
340
522
|
const folders = f.folders?.split(",").map((s) => s.trim()).filter(Boolean);
|
|
341
523
|
const description = f.description === undefined ? undefined : readText(f.description);
|
|
342
|
-
return { method: "PATCH", path: "/v1/agents/me/status", body: compact({ text: readText(said) || null, description, folders, state: f.state, linearIssue: f.issue, waitingOn: f["waiting-on"] }) };
|
|
524
|
+
return { method: "PATCH", path: "/v1/agents/me/status", body: compact({ text: readText(said) || null, description, folders, state: f.state, linearIssue: f.issue, waitingOn: f["waiting-on"], item: f.item }) };
|
|
343
525
|
}
|
|
526
|
+
case "work":
|
|
527
|
+
return workRequest(p, f, lists.code ?? [], lists.label ?? []);
|
|
344
528
|
case "message": {
|
|
345
529
|
const text = readText(words("text", p, "what to say"));
|
|
346
530
|
if ([f.conversation, f["to-agent"], f["to-person"]].filter(Boolean).length !== 1)
|
|
@@ -856,6 +1040,7 @@ async function main(argvIn) {
|
|
|
856
1040
|
authorization: `Bearer ${token}`,
|
|
857
1041
|
accept: "application/json",
|
|
858
1042
|
...agentHeader(as),
|
|
1043
|
+
...(request.forPerson ? { "x-gavel-for-person": "true" } : {}),
|
|
859
1044
|
...(request.body !== undefined ? { "content-type": "application/json" } : {}),
|
|
860
1045
|
},
|
|
861
1046
|
...(request.body !== undefined ? { body: JSON.stringify(request.body) } : {}),
|
package/package.json
CHANGED