breakaway 1.2.1-main.10 → 1.2.1-main.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "1.2.1-main.10",
3
+ "version": "1.2.1-main.12",
4
4
  "description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -79,7 +79,7 @@ export const FIX_PROBLEMS = ['conflicts', 'failing', 'review'];
79
79
 
80
80
  /**
81
81
  * The request behind `npx breakaway github fix <n>` and `github review <n>` (BRK-81): the pull request page's "Fix with an
82
- * agent" and "Safe to merge?" buttons (`POST github/pulls/<n>/fix` and `/review`). It names the checkout's repository
82
+ * agent" and "Safe to merge?" or "Review with an agent" buttons (`POST github/pulls/<n>/fix` and `/review`). It names the checkout's repository
83
83
  * like `github` does. Returns an error message instead when the number or `problem` can't be right.
84
84
  * @param {'fix' | 'review'} action
85
85
  * @param {string | number | undefined} number
@@ -96,11 +96,40 @@ export function pullAgentRequest(action, number, { repo = null, problem, note, f
96
96
  ...(repo ? { repo } : {}),
97
97
  ...(problem ? { problem } : {}),
98
98
  ...(typeof note === 'string' && note.trim() ? { note } : {}),
99
- ...forceFields(force, by),
99
+ // Review with an agent is the owner's, so a review always says who asks (BRK-111); a fix only when forcing.
100
+ ...(action === 'review' ? { ...(force ? { force: true } : {}), ...(by ? { by } : {}) } : forceFields(force, by)),
100
101
  };
101
102
  return { request: ['POST', `github/pulls/${n}/${action}`, body] };
102
103
  }
103
104
 
105
+ export const REVIEW_VERDICTS = ['ready', 'follow-up', 'changes'];
106
+
107
+ /**
108
+ * `npx breakaway review <ID> --verdict ready|follow-up|changes "<note>"` (BRK-111): an agent's answer on the pull
109
+ * request that closes its task. The board adds it to the task as a comment and keeps it for the pull request page.
110
+ * `pr` picks the pull request when the task has several open.
111
+ * @param {string | undefined} ref
112
+ * @param {string | undefined} verdict
113
+ * @param {string | undefined} note
114
+ * @param {{ by?: string, pr?: string | number }} [options]
115
+ */
116
+ export function reviewRequest(ref, verdict, note, { by, pr } = {}) {
117
+ if (!ref) return { error: 'say which task: npx breakaway review <task> --verdict ready "<note>"' };
118
+ if (!REVIEW_VERDICTS.includes(String(verdict)))
119
+ return { error: `say the verdict: --verdict ${REVIEW_VERDICTS.join('|')}` };
120
+ const text = String(note ?? '').trim();
121
+ if (!text) return { error: 'say what you found: the note is the review (Markdown)' };
122
+ const n = pr === undefined ? null : String(pr).replace(/^#/u, '');
123
+ if (n !== null && !/^[1-9]\d{0,8}$/u.test(n)) return { error: '--pr is a pull request number' };
124
+ return {
125
+ request: [
126
+ 'POST',
127
+ `tasks/${encodeURIComponent(ref)}/review`,
128
+ { verdict, note: text, ...(by ? { by } : {}), ...(n ? { pr: Number(n) } : {}) },
129
+ ],
130
+ };
131
+ }
132
+
104
133
  /**
105
134
  * Force start on a request that starts an agent (BRK-107): `force`, and who is asking, so the board can refuse an
106
135
  * agent's name (only the owner forces a start). Nothing when it isn't forced.
@@ -145,12 +174,13 @@ export function generalAgentSummary({ task, run, waiting, forceable }) {
145
174
  * What the CLI says about an answer to those requests: which task and agent took the pull request, or who already has it.
146
175
  * @param {'fix' | 'review'} action
147
176
  * @param {string | number} number
148
- * @param {{ task: { wid?: string, short?: string }, run?: { url?: string, agent?: string } | null, already?: string | null }} answer
177
+ * @param {{ task: { wid?: string, short?: string }, run?: { url?: string, agent?: string, kind?: string } | null, already?: string | null }} answer
149
178
  */
150
179
  export function pullAgentSummary(action, number, { task, run, already }) {
151
180
  const id = task.wid ?? task.short;
152
181
  if (!run) return `${id} already has it: ${already}.`;
153
- const what = action === 'fix' ? `fixing #${number}` : `testing #${number}`;
182
+ const what =
183
+ action === 'fix' ? `fixing #${number}` : run.kind === 'pr-review' ? `reviewing #${number}` : `testing #${number}`;
154
184
  return `Started ${run.agent ? `${run.agent}, ` : 'an agent '}${what} on ${id}${run.url ? `: ${run.url}` : ''}`;
155
185
  }
156
186
 
package/scripts/tasks.mjs CHANGED
@@ -51,6 +51,7 @@ import {
51
51
  ideaTask,
52
52
  pullAgentRequest,
53
53
  pullAgentSummary,
54
+ reviewRequest,
54
55
  staleCliWarning,
55
56
  unknownSubcommand,
56
57
  } from './tasks/cli.js';
@@ -145,7 +146,9 @@ Reading (list, next, claim, and add work in this checkout's repos
145
146
  routines run <slug> run one now: makes a RUN task and starts an agent on it [--note <text>] [--force]
146
147
  horizon close close now: finished tasks go to the archive, next becomes now, later becomes next [--dry-run]
147
148
  github fix <n> start an agent on a pull request's conflicts, failing checks, or review comments (owner) [--problem conflicts|failing|review] [--note <text>] [--repo <slug>] [--force]
148
- github review <n> start an agent that tests a Dependabot pull request, as Safe to merge? does (owner) [--note <text>] [--repo <slug>] [--force]
149
+ github review <n> start an agent that reviews a pull request that can merge as it stands, on the task it closes, as
150
+ Review with an agent does; on a Dependabot one it tests the update, as Safe to merge? does
151
+ (owner) [--note <text>] [--repo <slug>] [--force]
149
152
  github the checkout's repository on GitHub: open pull requests, checks, reviews, CI, deploys, alerts [--sync] [--repo <slug>]
150
153
  hook session|wait the Claude Code session hooks a repository's .claude/settings.json runs (npx breakaway hook session)
151
154
  health the server's state
@@ -157,6 +160,8 @@ Working
157
160
  refuses another repository's task unless --repo names it
158
161
  release <ref> give it back [--force]
159
162
  comment <ref> <text> add a comment (signed with your agent name); note is the same command
163
+ review <ref> --verdict ready|follow-up|changes <note> your review of the pull request that closes the task you
164
+ hold: a comment on it, and the review on the pull request's page (the note is Markdown) [--pr <n>]
160
165
  done <ref> finish it [--note <text>] [--pr <url>]
161
166
  add <description> new task; gets the next work ID for its project
162
167
  --project <p> --tag <t>… --priority H|M|L --horizon now|next|later
@@ -1076,6 +1081,12 @@ const commands = {
1076
1081
  unmarkSession(task);
1077
1082
  print(task, (t) => `Released ${ref(t)}.`);
1078
1083
  },
1084
+ async review() {
1085
+ const built = reviewRequest(args[0], opts.verdict, args.slice(1).join(' '), { by: agent(), pr: opts.pr });
1086
+ if (built.error || !built.request) fail(built.error ?? 'bad request');
1087
+ const { review, task } = await call(...built.request);
1088
+ print({ review, task }, (r) => `Left your review of #${r.review.pr} on ${ref(r.task)}: ${r.review.label}.`);
1089
+ },
1079
1090
  // The board's `annotate` route is the comments route's alias; using it keeps this working on a board that hasn't deployed /comments yet.
1080
1091
  async comment() {
1081
1092
  const text = args.slice(1).join(' ');
@@ -4,5 +4,5 @@
4
4
  * and how to update it. scripts/tasks/version.test.js fails when the copied files change and this doesn't:
5
5
  * so it lives in the board's package (CLD-135) and the CLI imports it from here.
6
6
  */
7
- export const CLI_VERSION = 52;
8
- export const CLI_FINGERPRINT = 'b1542857a107623b';
7
+ export const CLI_VERSION = 53;
8
+ export const CLI_FINGERPRINT = '2254d8fb27cd3d52';