@the-vibe-company/armada 0.2.21 → 0.2.22

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 +30 -3
  2. package/dist/armada.js +688 -45
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ Armada runs a fleet of coding agents on one project and keeps every piece of wor
4
4
 
5
5
  It imposes one method: grill the decisions, write a spec, cut it into tickets, let one worker agent ship each ticket as a green pull request, and let a coordinator agent merge. The tracker is the source of truth for progress; Armada adds live telemetry, contention rules and a fleet dashboard on top.
6
6
 
7
- **Status:** early. `armada status`, `armada auth`, `armada doctor`, `armada init`, `armada brief`, `armada claim`, `armada report`, `armada release`, `armada ask`, `armada inbox`, `armada answer` and `armada merge` work; the other commands are being built.
7
+ **Status:** early. `armada status`, `armada auth`, `armada doctor`, `armada init`, `armada brief`, `armada claim`, `armada report`, `armada release`, `armada ask`, `armada inbox`, `armada answer`, `armada merge`, `armada validate`, `armada ask-owner` and `armada done` work; the other commands are being built.
8
8
 
9
9
  ## Install
10
10
 
@@ -114,7 +114,7 @@ armada release --reason "wrong ticket"
114
114
  `armada attach <ticket> <file|url>... [--caption "<text>"] [--for <item>]` keeps visual evidence out of git. It uploads byte-checked PNG, JPEG, WebP or GIF images (at most 2 MB each) and records HTTPS links, then prints private dashboard URLs. An organization member can inspect them in the agent's **Attachments** tab, enlarge images, and follow links. The bytes stay in the app's Postgres and are served only after organization/project access checks; signed-out callers and other organizations receive 403. Worker sessions attach only to their own ticket; coordinators attach to any ticket in their project's cached reading. Refresh the dashboard first if a new ticket is missing there. `--for` stores a free validation reference. Identical content on a ticket is stored once (a later `--for` can bind it to a validation). Each ticket defaults to 20 images/links, the project to 200 MB of image bytes, and evidence is deleted by the next successful project refresh at least 30 days after completion or cancellation; reopening resets that window. Configure these limits in `[policy]` below. Never include credentials or secrets in linked URLs or screenshots.
115
115
 
116
116
  - `claim` re-reads the ticket and refuses it when another worker holds it; if two claims race, the older comment wins and the other withdraws. It assigns the ticket to the Linear key's user, moves it to the team's first started state, sets the `planning` phase label and the runtime label (matched by name, so `conductor` finds `Conductor`), and posts an `Agent claim — runtime · session · branch · started` line. The handle is kept in that comment and on Armada, so a coordinator finds the session either way. Claiming again with the same handle repairs labels and state. It reads every comment and label of the ticket, however many.
117
- - `report <phase>` accepts: planning → awaiting-approval or implementing; awaiting-approval → planning or implementing; implementing → shipping; shipping → implementing or ready-to-merge; ready-to-merge → shipping; blocked from anywhere and back to any phase; the current phase again as a status update. Anything else exits 1 with the reason. The output lists what waits in the worker's inbox.
117
+ - `report <phase>` accepts: planning → awaiting-approval or implementing; awaiting-approval → planning or implementing; implementing → shipping; shipping → implementing or ready-to-merge; ready-to-merge → shipping; planning, implementing or shipping → awaiting-validation (what `armada validate` reports) and back; blocked from anywhere and back to any phase; the current phase again as a status update. Anything else exits 1 with the reason. The output lists what waits in the worker's inbox.
118
118
  - `report`, `ask` and `answer` accept `--message-file -` to read standard input to EOF, including a pipe or a shell heredoc. For example: `printf 'line one\nline two' | bun run armada report implementing --ticket ABC-12 --message-file -`. An explicitly empty or whitespace-only message file or stdin exits 2 before any tracker or database write, with a retry naming `--message` or a non-empty pipe. A `ready-to-merge` report may still omit the message option.
119
119
  - `--plan <text>` or `--plan-file <path|->` posts the plan as its own `## Plan` block under the status line. `--message` becomes optional: its first line is the status, else the plan's first line (cut at 100 characters). `armada status` then shows that one line and `plan: <comment url>`, and the dashboard's status line gets a "plan ↗" link. Only one of `--message-file -` and `--plan-file -` can read standard input.
120
120
  - `claim` and `report` read the ticket back and print where it stands, for example `Now: In Progress · phase implementing · runtime Conductor · profile none`, so a worker can check it without opening Linear. `--json` carries the same as `state`.
@@ -147,6 +147,28 @@ armada answer --note ABC-12 "main moved: bring it in before you ship" # an unso
147
147
  - `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Armada; a ticket id answers that ticket's open questions and plans and also works without it. `--note` records a delivered note as `Agent status: <phase> — note: …`; it accepts a ticket or plan item id and resolves open plans, not questions. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Questions, plans and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. For older clients without heartbeats, no report within `policy.silence_minutes` of an answer shows as silent. With heartbeats, the report reminder uses `policy.quiet_minutes` instead.
148
148
  - The dashboard adds two kinds of request, signed by the person who made them. In "Waiting for you", **Approve** opens an editable approval (`approved` by default); sending it creates an `answer-request`, just like answering a question. Deliver its text, then `armada answer <request id> "<answer>"`, which resolves the request and its question or plan and names the requester on the ticket (answering the item itself also closes a waiting request). A `launch-request` asks to launch a ready ticket on a profile: launch it as usual; the worker's `armada claim` resolves it and posts who asked. To decline one, `armada answer <request id> "<why>"`: it is closed with the reason and nothing is posted on the ticket.
149
149
 
150
+ ## What the owner validates
151
+
152
+ The owner decides only what they asked to: a merge their rule keeps for them, the work of a kind of ticket they want to see first (a design), and a question the coordinator escalates. Each is one item on the dashboard's **Validations** page (with a count in the sidebar), opened from one link, `https://<dashboard>/approve/<id>`, readable on a phone. "Yours to decide" on the overview holds those items only (and a coordinator that stopped answering); the workers' questions, plans and hand-backs stay with the coordinator, in one line: "With the coordinator: n, oldest 4 min".
153
+
154
+ ```sh
155
+ armada merge 34 --reason "CLI only" # coordinator: the rule lets it merge on its own
156
+ armada merge 34 --ask-owner --reason "touches components/timeline" # coordinator: the owner approves it first
157
+ armada validate "Two directions for the card" --attach a.png b.png # worker: show the owner, then stop
158
+ armada validate ABC-12 "Check the empty state" --attach https://preview.example.test # coordinator, any ticket
159
+ armada ask-owner ABC-12 "Ship behind a flag first?" --choices "Behind a flag | On for everyone"
160
+ armada done ABC-12 # coordinator: a design the owner approved
161
+ armada brief ABC-12 --validation none # judge [[policy.validation]] at launch
162
+ armada brief ABC-12 --validation 1 --validation-reason "a mockup of the card"
163
+ ```
164
+
165
+ - `[policy] merge_approval = "<plain words>"` says which merges the owner approves first. Absent, the coordinator merges everything on its own. Present, `armada merge` prints the rule and refuses until the coordinator judges the pull request: `--reason` merges on its own; `--ask-owner --reason` merges nothing, records the pull request (title, files with +/−, CI, the preview deployment of its head: a GitHub deployment, else a green Vercel status) with the ticket's screenshots, posts the approval link on the ticket and prints it. Armada never classifies a pull request: the coordinator judges, Armada records and enforces.
166
+ - A pull request the owner was asked about merges only once they approved that exact head; that head with only the base merged in still counts. A new head needs `--ask-owner` again. The merged comment and the dashboard say how it was decided: `merged on its own (rule: …): <reason>`, `merged on its own (no merge rule)` or `approved by <owner> at <time>`.
167
+ - `[[policy.validation]]` entries name kinds of tickets (`when`) and what their worker shows and waits for (`then`). With entries, every `armada brief` needs the coordinator's judgement: `--validation none` (no reason needed), or the rule numbers with `--validation-reason`; the refusal prints the command to copy. A rule that applies puts one block in the prompt ("This ticket needs the owner's validation: …") and its judgement in the claim.
168
+ - `armada validate` uploads the attachments (as `armada attach` does) and puts the validation on the owner's page. From a worker, for its own ticket: its phase becomes `awaiting-validation` (the label is created on first use) with the link in its status, and it stops. A newer submission replaces the open one. The owner's buttons are Approve and Request changes (with a short text), or the `--choices` given.
169
+ - The owner's decision lands in the coordinator's inbox as a `decision` item, which wakes `armada watch`: the coordinator merges, relays the changes or the choice to the worker, then `armada answer <item> "<what it did>"`. `armada done <ticket>` closes a ticket whose newest validation the owner approved, with no pull request: the design (what was checked, the owner's note, the attachment links) is posted on it, it moves to Done, and its session ends. Building it is a separate ticket.
170
+ - The dashboard's "Request the merge" button is gone: a hand-back is the coordinator's to merge.
171
+
150
172
  ## Merge a finished pull request (coordinator)
151
173
 
152
174
  ```sh
@@ -185,7 +207,7 @@ Try it locally with synthetic data and no key:
185
207
 
186
208
  ```sh
187
209
  cd packages/dashboard
188
- bun run demo:seed # a local PGlite database (Postgres in the process) with the mockup's Acme world (three projects, ten sessions)
210
+ bun run demo:seed # a local PGlite database (Postgres in the process) with the mockup's Acme world (three projects, eleven sessions, and validations for the owner)
189
211
  # bun run demo:seed busy # the same with twenty more sessions reporting every 2 minutes all day (then ARMADA_DASHBOARD_DEMO=busy)
190
212
  ARMADA_DASHBOARD_PASSWORD=off ARMADA_DASHBOARD_DEMO=fleet ARMADA_DATABASE_URL=pglite:.demo/armada bun run dev # http://localhost:4822
191
213
  ```
@@ -407,6 +429,11 @@ not_started_minutes = 10 # a launched worker that has not claimed after
407
429
  plans = "approve" # or "pre-approved": workers post their plan and go on (default "approve")
408
430
  pre_approved_label = "plan-approved" # a ticket with this label is pre-approved (default)
409
431
  approval_label = "needs-plan-approval" # a ticket with this label waits for approval; wins over the other (default)
432
+ merge_approval = "merge on your own, except front-end changes: send me a link to check them first" # default: none, every merge on its own
433
+
434
+ [[policy.validation]] # any number: kinds of tickets whose work the owner validates first
435
+ when = "a design ticket: a mockup, a visual direction or the look of a new screen"
436
+ then = "produce the design, attach it, ask the owner to validate it on Armada, and stop until they decide; never merge or build it on your own"
410
437
 
411
438
  [brief]
412
439
  extra = "docs/worker-conventions.md" # every brief ends with this file under "Project conventions" (default: none)
package/dist/armada.js CHANGED
@@ -1120,7 +1120,9 @@ function parseConfig(text, source = CONFIG_FILE) {
1120
1120
  "approval_label",
1121
1121
  "attachments_per_ticket",
1122
1122
  "attachments_project_mb",
1123
- "attachments_retention_days"
1123
+ "attachments_retention_days",
1124
+ "merge_approval",
1125
+ "validation"
1124
1126
  ]
1125
1127
  ],
1126
1128
  ["brief", briefT, ["extra"]],
@@ -1253,6 +1255,26 @@ function parseConfig(text, source = CONFIG_FILE) {
1253
1255
  const attachmentsPerTicket = quota("attachments_per_ticket", CONFIG_DEFAULTS.attachmentsPerTicket);
1254
1256
  const attachmentsProjectMb = quota("attachments_project_mb", CONFIG_DEFAULTS.attachmentsProjectMb);
1255
1257
  const attachmentsRetentionDays = quota("attachments_retention_days", CONFIG_DEFAULTS.attachmentsRetentionDays);
1258
+ const mergeApproval = policyT.merge_approval === undefined ? null : str(policyT, "policy", "merge_approval") || null;
1259
+ const validations = [];
1260
+ const validationRaw = policyT.validation ?? [];
1261
+ if (!Array.isArray(validationRaw))
1262
+ problems.push(`"policy.validation" must be a list of [[policy.validation]] rules`);
1263
+ else
1264
+ for (const [i, r] of validationRaw.entries()) {
1265
+ const path = `policy.validation[${i + 1}]`;
1266
+ if (!isTable(r)) {
1267
+ problems.push(`"${path}" must be a table`);
1268
+ continue;
1269
+ }
1270
+ for (const key of Object.keys(r))
1271
+ if (key !== "when" && key !== "then")
1272
+ problems.push(`unknown key "${path}.${key}"`);
1273
+ const when = str(r, path, "when");
1274
+ const then = str(r, path, "then");
1275
+ if (when && then)
1276
+ validations.push({ when, show: then });
1277
+ }
1256
1278
  const approvalLabel = str(policyT, "policy", "approval_label", { default: CONFIG_DEFAULTS.approvalLabel });
1257
1279
  if (preApprovedLabel && approvalLabel && routingLabelKey(preApprovedLabel) === routingLabelKey(approvalLabel))
1258
1280
  problems.push(`"policy.pre_approved_label" and "policy.approval_label" must name different labels`);
@@ -1320,7 +1342,9 @@ function parseConfig(text, source = CONFIG_FILE) {
1320
1342
  approvalLabel,
1321
1343
  attachmentsPerTicket,
1322
1344
  attachmentsProjectMb,
1323
- attachmentsRetentionDays
1345
+ attachmentsRetentionDays,
1346
+ mergeApproval,
1347
+ validations
1324
1348
  },
1325
1349
  brief: { extra },
1326
1350
  secrets: { names: secretNames },
@@ -1367,6 +1391,15 @@ coordinator_minutes = 10 # an inbox item open longer than this shows "waiting fo
1367
1391
  # attachments_retention_days = 30
1368
1392
  # pre_approved_label = "plan-approved" # a ticket with this label skips the approval
1369
1393
  # approval_label = "needs-plan-approval" # a ticket with this label waits for it; wins over the other
1394
+ # Which merges need your approval, in plain words; without it the coordinator merges everything on its own.
1395
+ # The coordinator judges it per pull request and sends you one approval link for the others.
1396
+ # merge_approval = "merge on your own, except front-end changes: send me a link to check them first"
1397
+
1398
+ # Kinds of tickets whose work you validate before it goes on: the coordinator judges at launch
1399
+ # which apply, and the worker shows you its work with \`armada validate\` and waits for your decision.
1400
+ # [[policy.validation]]
1401
+ # when = "a design ticket: a mockup, a visual direction or the look of a new screen"
1402
+ # then = "produce the design, attach it, ask the owner to validate it on Armada, and stop until they decide; never merge or build it on your own"
1370
1403
 
1371
1404
  [brief]
1372
1405
  # extra = "docs/worker-conventions.md" # a file every worker brief carries under "Project conventions"
@@ -1556,21 +1589,23 @@ var LABEL_PHASES = [
1556
1589
  "implementing",
1557
1590
  "shipping",
1558
1591
  "blocked",
1559
- "ready-to-merge"
1592
+ "ready-to-merge",
1593
+ "awaiting-validation"
1560
1594
  ];
1561
1595
 
1562
1596
  // ../core/src/fleet.ts
1563
1597
  var MIN = 60000;
1564
- var NEEDS_HUMAN = ["awaiting-approval", "blocked", "ready-to-merge"];
1598
+ var NEEDS_HUMAN = ["awaiting-approval", "awaiting-validation", "blocked", "ready-to-merge"];
1565
1599
  var PHASE_RANK = {
1566
1600
  merged: 0,
1567
1601
  "ready-to-merge": 1,
1568
1602
  shipping: 2,
1569
1603
  implementing: 3,
1570
- "awaiting-approval": 4,
1571
- planning: 5,
1572
- blocked: 6,
1573
- released: 7
1604
+ "awaiting-validation": 4,
1605
+ "awaiting-approval": 5,
1606
+ planning: 6,
1607
+ blocked: 7,
1608
+ released: 8
1574
1609
  };
1575
1610
  var PLAN_HINT = /\b(plan|objective|assumptions|awaiting (?:plan )?approval)\b/i;
1576
1611
  function commentsFor(comments, id) {
@@ -2427,12 +2462,13 @@ function checkAttachment(input) {
2427
2462
 
2428
2463
  // ../core/src/phases.ts
2429
2464
  var TRANSITIONS = {
2430
- planning: ["awaiting-approval", "implementing"],
2465
+ planning: ["awaiting-approval", "implementing", "awaiting-validation"],
2431
2466
  "awaiting-approval": ["planning", "implementing"],
2432
- implementing: ["shipping"],
2433
- shipping: ["implementing", "ready-to-merge"],
2467
+ implementing: ["shipping", "awaiting-validation"],
2468
+ shipping: ["implementing", "ready-to-merge", "awaiting-validation"],
2434
2469
  "ready-to-merge": ["shipping"],
2435
- blocked: ["planning", "awaiting-approval", "implementing", "shipping", "ready-to-merge"]
2470
+ "awaiting-validation": ["planning", "implementing", "shipping"],
2471
+ blocked: ["planning", "awaiting-approval", "implementing", "shipping", "ready-to-merge", "awaiting-validation"]
2436
2472
  };
2437
2473
  var isLabelPhase = (v) => LABEL_PHASES.includes(v);
2438
2474
  function transitionProblem(from, to) {
@@ -2583,6 +2619,96 @@ function chooseProfile(config, input) {
2583
2619
  return { name, profile, source: "requested", rule: null, routed: route?.name ?? null, reason, why };
2584
2620
  }
2585
2621
 
2622
+ // ../core/src/validations.ts
2623
+ var VALIDATION_LIMITS = { what: 4000, reason: 1000, choice: 120, choices: 6, note: 4000, attachments: 20 };
2624
+ var approvalPath = (id) => `/approve/${id}`;
2625
+ var approvalUrl = (appUrl, id) => appUrl ? new URL(approvalPath(id), appUrl).toString() : approvalPath(id);
2626
+ function parseChoices(raw) {
2627
+ if (!raw?.trim())
2628
+ return null;
2629
+ const choices = [...new Set(raw.split("|").map((c) => c.replace(/\s+/g, " ").trim()))].filter(Boolean);
2630
+ return choices.length ? choices : null;
2631
+ }
2632
+ var when = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
2633
+ function decidedLine(d) {
2634
+ const who = `${d.by ?? "the owner"} at ${when(d.at)}`;
2635
+ if (d.outcome === "approved")
2636
+ return `approved by ${who}`;
2637
+ if (d.outcome === "changes")
2638
+ return `changes requested by ${who}`;
2639
+ if (d.outcome === "answered")
2640
+ return `answered "${d.answer ?? ""}" by ${who}`;
2641
+ return `superseded at ${when(d.at)}`;
2642
+ }
2643
+ function mergeApproval(validations, pr, head) {
2644
+ const asked = validations.filter((v) => v.kind === "merge" && v.pr?.number === pr && v.decision?.outcome !== "superseded").sort((a, b) => b.createdAt.localeCompare(a.createdAt) || b.id - a.id)[0];
2645
+ if (!asked?.pr)
2646
+ return { state: "none" };
2647
+ const d = asked.decision;
2648
+ if (!d)
2649
+ return { state: "pending", validation: asked };
2650
+ if (d.outcome !== "approved")
2651
+ return { state: "changes", validation: asked };
2652
+ const approved = asked.pr.headSha;
2653
+ if (head.sha !== approved && !head.sameAs.includes(approved))
2654
+ return { state: "stale", validation: asked };
2655
+ return { state: "approved", validation: asked, decision: d };
2656
+ }
2657
+ function lastValidation(validations, ticket) {
2658
+ return validations.filter((v) => v.ticket === ticket && v.kind === "validation" && v.decision?.outcome !== "superseded").sort((a, b) => b.createdAt.localeCompare(a.createdAt) || b.id - a.id)[0] ?? null;
2659
+ }
2660
+
2661
+ class ValidationChoiceError extends Error {
2662
+ next;
2663
+ name = "ValidationChoiceError";
2664
+ constructor(message, next) {
2665
+ super(message);
2666
+ this.next = next;
2667
+ }
2668
+ }
2669
+ var quoteWord = (s) => /^\w[\w./:@+-]*$/.test(s) ? s : `'${s.replaceAll("'", `'\\''`)}'`;
2670
+ function chooseValidations(rules, input) {
2671
+ const reason = input.reason?.replace(/\s+/g, " ").trim() || null;
2672
+ const requested = input.requested?.trim().toLowerCase() || null;
2673
+ const listed = rules.map((r, k) => ` ${k + 1}. when ${r.when}
2674
+ then ${r.show}`).join(`
2675
+ `);
2676
+ const none = `${input.command} --validation none`;
2677
+ const some = (n) => `${input.command} --validation ${n} --validation-reason ${quoteWord("<why this ticket is one>")}`;
2678
+ if (!rules.length) {
2679
+ if (requested && requested !== "none")
2680
+ throw new ValidationChoiceError("armada.toml has no [[policy.validation]] rule to apply", none.replace(/ --validation none$/, ""));
2681
+ return null;
2682
+ }
2683
+ if (requested === null)
2684
+ throw new ValidationChoiceError(`armada.toml has [[policy.validation]] rules: judge whether ${input.ticket} is one of them
2685
+ ${listed}
2686
+ Most tickets are none: ${none}
2687
+ One applies: ${some("<n>")}`, none);
2688
+ if (requested === "none")
2689
+ return { rules: [], reason };
2690
+ const numbers = requested.split(",").map((n) => n.trim());
2691
+ const picked = numbers.map((n) => Number(n));
2692
+ if (picked.some((n, k) => !/^\d+$/.test(numbers[k] ?? "") || n < 1 || n > rules.length))
2693
+ throw new ValidationChoiceError(`--validation takes none or rule numbers from 1 to ${rules.length}, got "${input.requested}"
2694
+ ${listed}`, none);
2695
+ if (!reason)
2696
+ throw new ValidationChoiceError(`say why ${input.ticket} needs the owner's validation with --validation-reason`, some([...new Set(picked)].join(",")));
2697
+ return {
2698
+ rules: [...new Set(picked)].sort((a, b) => a - b).map((index) => {
2699
+ const r = rules[index - 1];
2700
+ return { index, when: r.when, show: r.show };
2701
+ }),
2702
+ reason
2703
+ };
2704
+ }
2705
+ function validationClaimLine(choice) {
2706
+ if (!choice?.rules.length)
2707
+ return null;
2708
+ const rules = choice.rules.map((r) => `rule ${r.index} (${r.when})`).join(", ");
2709
+ return `Owner validation: ${rules}${choice.reason ? ` — ${choice.reason}` : ""}`;
2710
+ }
2711
+
2586
2712
  // ../core/src/worker.ts
2587
2713
  class Refusal extends Error {
2588
2714
  next;
@@ -2740,9 +2866,11 @@ async function claimTicket(ctx, input) {
2740
2866
  throw err;
2741
2867
  }
2742
2868
  const started = ctx.now().toISOString();
2869
+ const validation = validationClaimLine(input.validation ?? null);
2743
2870
  const body = `Agent status: planning — claimed by ${runtime.name} (${input.handle})
2744
2871
 
2745
- ${claimLine({ runtime: runtime.name, handle: input.handle, branch, started, profile })}`;
2872
+ ${claimLine({ runtime: runtime.name, handle: input.handle, branch, started, profile })}${validation ? `
2873
+ ${validation}` : ""}`;
2746
2874
  const mine = await linear.comment(ticket.uuid, body);
2747
2875
  const after = await linear.readTicket(ticket.id);
2748
2876
  const winner = after ? activeClaimComments(after.comments)[0] : undefined;
@@ -3013,7 +3141,12 @@ var VARIABLES = [
3013
3141
  ];
3014
3142
 
3015
3143
  class BriefError extends Error {
3144
+ next;
3016
3145
  name = "BriefError";
3146
+ constructor(message, next = null) {
3147
+ super(message);
3148
+ this.next = next;
3149
+ }
3017
3150
  }
3018
3151
  function buildBrief(input) {
3019
3152
  const { config, ticket, program } = input;
@@ -3065,7 +3198,11 @@ function buildBrief(input) {
3065
3198
  `armada claim ${ticket.id} --runtime ${runtime} --handle ${handle}`,
3066
3199
  branch ? ` --branch ${branch}` : "",
3067
3200
  choice ? ` --profile ${shellWord(choice.name)}` : "",
3068
- choice?.reason ? ` --reason ${shellWord(choice.reason)}` : ""
3201
+ choice?.reason ? ` --reason ${shellWord(choice.reason)}` : "",
3202
+ ...input.validation?.rules.length ? [
3203
+ ` --validation ${input.validation.rules.map((r) => r.index).join(",")}`,
3204
+ input.validation.reason ? ` --validation-reason ${shellWord(input.validation.reason)}` : ""
3205
+ ] : []
3069
3206
  ].join("");
3070
3207
  const has = (name) => !!input.env[name]?.trim();
3071
3208
  const launch = input.launch ?? null;
@@ -3121,6 +3258,7 @@ function buildBrief(input) {
3121
3258
  notes: ticket.notes.slice(0, MAX_NOTES),
3122
3259
  parallel,
3123
3260
  plans: planRule(config, ticket.labels),
3261
+ validation: input.validation ?? null,
3124
3262
  conventions: extra?.text?.trim() ? { path: extra.path, text: extra.text } : null,
3125
3263
  warnings
3126
3264
  };
@@ -3212,6 +3350,9 @@ ${quote(x.handBack.body)}` : "No hand-back note.", "");
3212
3350
  out.push(`### ${byLine(n)}`, "", quote(n.body), "");
3213
3351
  }
3214
3352
  out.push("## Plan", "", b.plans.rule === "pre-approved" ? `Plans are pre-approved for ${t.id} (${b.plans.why}): post your plan with \`armada report implementing --plan-file -\` and go on.` : `Plans need the coordinator's approval for ${t.id} (${b.plans.why}): post your plan with \`armada report awaiting-approval --plan-file -\` and wait for approval.`, "");
3353
+ const validation = b.validation?.rules ?? [];
3354
+ if (validation.length)
3355
+ out.push("## Owner validation", "", `This ticket needs the owner's validation: ${validation.map((r) => r.show.replace(/[.\s]+$/, "")).join("; ")}.`, "", `The coordinator judged it so${b.validation?.reason ? `: ${b.validation.reason}` : ""}. Submit your work with \`armada validate "<what to check>" --attach <files|urls>\`: your phase becomes \`awaiting-validation\`, the owner sees it on Armada's Validations page, and you stop until the coordinator relays their decision. On "Request changes", revise and submit again.`, "");
3215
3356
  out.push("## Workers in flight", "");
3216
3357
  if (b.parallel.length) {
3217
3358
  out.push("Stay out of their areas. If you must change the same files, say so in a report before you do.", "");
@@ -3275,6 +3416,19 @@ async function loadBrief(config, opts) {
3275
3416
  throw new BriefError(err.message);
3276
3417
  throw err;
3277
3418
  }
3419
+ let validation;
3420
+ try {
3421
+ validation = chooseValidations(config.policy.validations ?? [], {
3422
+ ticket: ticket.id,
3423
+ requested: opts.validation?.requested ?? null,
3424
+ reason: opts.validation?.reason ?? null,
3425
+ command: opts.validation?.command ?? `armada brief ${ticket.id}`
3426
+ });
3427
+ } catch (err) {
3428
+ if (err instanceof ValidationChoiceError)
3429
+ throw new BriefError(`${err.message}`, err.next);
3430
+ throw err;
3431
+ }
3278
3432
  const launch = await launchForBrief(ticket, opts.prompt === true ? opts.launch : undefined);
3279
3433
  const made = launch && "token" in launch ? launch : null;
3280
3434
  const missed = launch && "reason" in launch ? launch : null;
@@ -3293,6 +3447,7 @@ async function loadBrief(config, opts) {
3293
3447
  launch: made,
3294
3448
  noLaunch: missed?.reason ?? null,
3295
3449
  conventions: opts.conventions ?? null,
3450
+ validation,
3296
3451
  now: now()
3297
3452
  });
3298
3453
  return opts.prompt ? brief : { ...brief, launchHint };
@@ -3528,7 +3683,7 @@ function updateDotenv(text, updates) {
3528
3683
  }
3529
3684
 
3530
3685
  // ../core/src/fleet-api.ts
3531
- var WORKER_FLEET_OPS = ["claim", "report", "ask", "release", "heartbeat"];
3686
+ var WORKER_FLEET_OPS = ["claim", "report", "ask", "release", "heartbeat", "validate"];
3532
3687
  var FLEET_OPS = [
3533
3688
  ...WORKER_FLEET_OPS,
3534
3689
  "register",
@@ -3543,6 +3698,8 @@ var FLEET_OPS = [
3543
3698
  "inbox/resolve",
3544
3699
  "answer",
3545
3700
  "merge",
3701
+ "validations",
3702
+ "done",
3546
3703
  "lease/acquire",
3547
3704
  "lease/renew",
3548
3705
  "lease/release"
@@ -3576,6 +3733,9 @@ function fleetClient(o) {
3576
3733
  answer: (a) => call("answer", a),
3577
3734
  resolve: (r) => call("inbox/resolve", r),
3578
3735
  merge: (m) => call("merge", m),
3736
+ validate: (v) => call("validate", v),
3737
+ validations: (q) => call("validations", q),
3738
+ done: (d) => call("done", d),
3579
3739
  acquireLease: (l) => call("lease/acquire", l),
3580
3740
  renewLease: (l) => call("lease/renew", l),
3581
3741
  releaseLease: (l) => call("lease/release", l).then(() => {
@@ -3841,6 +4001,35 @@ async function fetchCommit(opts) {
3841
4001
  return null;
3842
4002
  return { sha: c.oid, tree: c.tree.oid, parents: c.parents.nodes.map((p) => p.oid) };
3843
4003
  }
4004
+ var PREVIEW_QUERY = `
4005
+ query Preview($owner: String!, $name: String!, $oid: GitObjectID!) {
4006
+ repository(owner: $owner, name: $name) {
4007
+ object(oid: $oid) {
4008
+ ... on Commit {
4009
+ deployments(last: 10) { nodes { environment latestStatus { state environmentUrl } } }
4010
+ status { contexts { context state targetUrl } }
4011
+ }
4012
+ }
4013
+ }
4014
+ }`;
4015
+ var https = (url) => {
4016
+ try {
4017
+ return url && new URL(url).protocol === "https:" ? url : null;
4018
+ } catch {
4019
+ return null;
4020
+ }
4021
+ };
4022
+ async function fetchPreview(opts) {
4023
+ const [owner, name] = opts.repository.split("/");
4024
+ const json = await githubQuery(opts, PREVIEW_QUERY, { owner, name, oid: opts.sha });
4025
+ const commit = json.data?.repository?.object;
4026
+ const deployed = (commit?.deployments?.nodes ?? []).filter((d) => d.latestStatus?.state === "SUCCESS" && https(d.latestStatus.environmentUrl)).reverse();
4027
+ const preview = deployed.find((d) => /preview/i.test(d.environment ?? "")) ?? deployed[0];
4028
+ if (preview)
4029
+ return preview.latestStatus?.environmentUrl ?? null;
4030
+ const vercel = commit?.status?.contexts.find((c) => /vercel/i.test(c.context) && c.state === "SUCCESS");
4031
+ return https(vercel?.targetUrl);
4032
+ }
3844
4033
 
3845
4034
  // ../core/src/heartbeat.ts
3846
4035
  async function heartbeatLoop(options) {
@@ -3960,7 +4149,8 @@ var ANSWERABLE = [
3960
4149
  "launch-request",
3961
4150
  "merge-request",
3962
4151
  "release-request",
3963
- "plan-changes"
4152
+ "plan-changes",
4153
+ "decision"
3964
4154
  ];
3965
4155
  async function answerItem(ctx, input) {
3966
4156
  const { config, linear } = ctx;
@@ -3998,7 +4188,7 @@ async function answerItem(ctx, input) {
3998
4188
  }
3999
4189
  if (item?.kind === "launch-request")
4000
4190
  return declineLaunch(ctx, item, text, warnings);
4001
- if (item && ["merge-request", "release-request", "plan-changes"].includes(item.kind)) {
4191
+ if (item && ["merge-request", "release-request", "plan-changes", "decision"].includes(item.kind)) {
4002
4192
  const recorded = await live(ctx, warnings, "resolve the dashboard request", (fleet) => fleet.answer({ text, note: false, ticket: item.ticket, item: item.id }));
4003
4193
  return { ticket: item.ticket ?? `#${item.id}`, url: "", lines: recorded ? [recorded] : [], warnings, inbox: null };
4004
4194
  }
@@ -4897,9 +5087,11 @@ async function lineageOf(ctx, pull, from, run) {
4897
5087
  try {
4898
5088
  const lineage = await (async () => {
4899
5089
  let sha = pull.headSha;
5090
+ const chain = [];
4900
5091
  for (let updates = 0;; updates++) {
5092
+ chain.push(sha);
4901
5093
  if (sha === from)
4902
- return { from, updates, why: null };
5094
+ return { from, updates, why: null, chain };
4903
5095
  if (updates >= MAX_UPDATES)
4904
5096
  return fail(`more than ${MAX_UPDATES} merge commits stand on it`);
4905
5097
  const commit = await ctx.forge.commit(sha);
@@ -5006,7 +5198,8 @@ ${indent(test.output)}`);
5006
5198
  const updatedFrom = updates && l.lineage ? l.lineage.from : null;
5007
5199
  const head = ticket ? updatedFrom ? `handed back at ${updatedFrom}, now ${pull.headSha} with only ${pull.baseRef} merged in (${plural(updates, "merge commit")})` : `handed back at ${pull.headSha}` : updatedFrom ? `head ${pull.headSha}, which is ${updatedFrom} with only ${pull.baseRef} merged in` : `head ${pull.headSha}`;
5008
5200
  lines.unshift(`Checklist passed for ${label(pull, ticket)}: ${head}, ${pull.mergeStateStatus}, checks green, no open review thread.`, ...l.notes);
5009
- return { pull, ticket, sha: pull.headSha, updatedFrom, baseSha: cmp?.baseSha ?? null, lines, hints, warnings };
5201
+ const chain = [pull.headSha, ...l.lineage?.why === null ? l.lineage.chain ?? [l.lineage.from] : []];
5202
+ return { pull, ticket, sha: pull.headSha, updatedFrom, baseSha: cmp?.baseSha ?? null, lines, hints, warnings, chain };
5010
5203
  }
5011
5204
  var indent = (text) => text.trimEnd().split(`
5012
5205
  `).map((l) => ` ${l}`).join(`
@@ -5047,6 +5240,123 @@ async function recheck(ctx, input, run, c) {
5047
5240
  ${problems.map((p) => ` - ${p}`).join(`
5048
5241
  `)}${updatedNote(run, pull)}`, `armada merge ${pull.number} again`);
5049
5242
  }
5243
+ async function ownerDecision(ctx, input, c, dryRun) {
5244
+ const n = c.pull.number;
5245
+ const rule = c.ticket ? ctx.config.policy.mergeApproval ?? null : null;
5246
+ const reason = input.reason?.replace(/\s+/g, " ").trim() || null;
5247
+ const lines = rule ? [`Merge rule (armada.toml [policy] merge_approval): "${rule}"`] : [];
5248
+ let approval = { state: "none" };
5249
+ let unreadable = null;
5250
+ const { fleet, warning } = await ctx.fleet();
5251
+ try {
5252
+ if (fleet)
5253
+ approval = mergeApproval(await fleet.validations({ pr: n }), n, { sha: c.sha, sameAs: c.chain ?? [] });
5254
+ else
5255
+ unreadable = warning ?? "not signed in to Armada";
5256
+ } catch (err) {
5257
+ unreadable = err instanceof Error ? err.message : String(err);
5258
+ }
5259
+ const link = (v) => approvalUrl(ctx.appUrl ?? null, v.id);
5260
+ const judge = `armada merge ${n} --reason "<why it may merge on its own>", or armada merge ${n} --ask-owner --reason "<why the owner must see it>"`;
5261
+ let problem = null;
5262
+ let next = "";
5263
+ let decided = null;
5264
+ if (unreadable && rule) {
5265
+ problem = `the owner's approvals of #${n} could not be read (${unreadable})`;
5266
+ next = `armada merge ${n} again once Armada answers`;
5267
+ } else if (approval.state === "approved")
5268
+ decided = decidedLine(approval.decision);
5269
+ else if (approval.state === "pending") {
5270
+ problem = `the owner has not decided on the merge of #${n} yet (asked ${approval.validation.createdAt}): ${link(approval.validation)}`;
5271
+ next = "armada inbox --wait: the owner's decision arrives there";
5272
+ } else if (approval.state === "changes") {
5273
+ const d = approval.validation.decision;
5274
+ problem = `the owner requested changes on #${n}${d?.note ? `: ${d.note}` : ""}`;
5275
+ next = c.ticket ? `armada answer --note ${c.ticket.id} "<the owner's changes>", once you told its worker; then armada merge ${n} --ask-owner again on its next hand-back` : `armada merge ${n} --ask-owner --reason "<why>" once the changes are made`;
5276
+ } else if (approval.state === "stale") {
5277
+ problem = `the owner approved #${n} at ${approval.validation.pr?.headSha}, but its head is now ${c.sha}: a new head needs a new approval`;
5278
+ next = `armada merge ${n} --ask-owner --reason "<why the owner must see it>"`;
5279
+ } else if (rule && !reason) {
5280
+ problem = `the merge rule asks you to judge #${n}: look at its files and what users will see, and record why`;
5281
+ next = judge;
5282
+ } else if (c.ticket)
5283
+ decided = rule ? `merged on its own (rule: ${rule})${reason ? `: ${reason}` : ""}` : `merged on its own (no merge rule)${reason ? `: ${reason}` : ""}`;
5284
+ if (unreadable && !rule && fleet)
5285
+ c.warnings.push(`the owner's approvals of #${n} could not be read (${unreadable}); none is required without a merge rule`);
5286
+ if (problem) {
5287
+ if (dryRun)
5288
+ return { lines: [...lines, `Not mergeable yet: ${problem}`, `Next: ${next}`], decided: null };
5289
+ throw new Refusal(`#${n}${c.ticket ? ` (${c.ticket.id})` : ""} cannot be merged: ${problem}`, next);
5290
+ }
5291
+ return { lines: decided ? [...lines, `Decided: ${decided}.`] : lines, decided };
5292
+ }
5293
+ async function askOwnerToMerge(ctx, input) {
5294
+ const reason = input.reason.replace(/\s+/g, " ").trim();
5295
+ if (!reason)
5296
+ throw new Refusal("say why the owner must see this merge", `armada merge ${input.pr} --ask-owner --reason "<what in it the owner checks>"`);
5297
+ const { fleet, warning } = await ctx.fleet();
5298
+ if (!fleet)
5299
+ throw new Refusal(`asking the owner needs Armada (${warning ?? "not signed in"}); nothing was asked`, "armada login, then the same command again");
5300
+ const pull = await readSettled(ctx, input.pr);
5301
+ if (pull.state !== "open")
5302
+ throw new Refusal(`#${pull.number} is ${pull.state}: there is nothing to approve`, `gh pr view ${pull.number}`);
5303
+ const ticket = await readTicketFor(ctx, pull, { pr: input.pr, ticket: input.ticket ?? null });
5304
+ if (!ticket)
5305
+ throw new Refusal(`#${pull.number} names no ticket`, `armada merge ${pull.number} --ticket <id> --ask-owner`);
5306
+ const warnings = [...ticket.warnings];
5307
+ let preview = null;
5308
+ try {
5309
+ preview = await ctx.forge.preview?.(pull.headSha) ?? null;
5310
+ } catch (err) {
5311
+ warnings.push(`no preview link: ${err instanceof Error ? err.message : String(err)}`);
5312
+ }
5313
+ const { url } = await fleet.validate({
5314
+ ticket: ticket.id,
5315
+ kind: "merge",
5316
+ what: pull.title || `Pull request #${pull.number}`,
5317
+ reason,
5318
+ choices: null,
5319
+ pr: {
5320
+ number: pull.number,
5321
+ url: pull.url,
5322
+ title: pull.title,
5323
+ headSha: pull.headSha,
5324
+ files: pull.files ?? null,
5325
+ additions: pull.additions ?? null,
5326
+ deletions: pull.deletions ?? null,
5327
+ ci: pull.ci ?? null,
5328
+ preview
5329
+ },
5330
+ attachments: []
5331
+ });
5332
+ await ctx.linear.comment(ticket.uuid, `Owner approval asked for the merge of PR #${pull.number} at ${pull.headSha}: ${reason}
5333
+
5334
+ ${url}`);
5335
+ const rule = ctx.config.policy.mergeApproval;
5336
+ return {
5337
+ merged: false,
5338
+ pr: {
5339
+ number: pull.number,
5340
+ url: pull.url,
5341
+ title: pull.title,
5342
+ base: pull.baseRef,
5343
+ headSha: pull.headSha,
5344
+ mergeCommit: null
5345
+ },
5346
+ ticket: { id: ticket.id, url: ticket.url },
5347
+ lines: [
5348
+ ...rule ? [`Merge rule (armada.toml [policy] merge_approval): "${rule}"`] : [],
5349
+ `Asked the owner to approve the merge of #${pull.number} at ${pull.headSha}${preview ? ` (preview ${preview})` : ""}: ${reason}`,
5350
+ `Approval link, posted on ${ticket.id}: ${url}`,
5351
+ `The owner's decision arrives in your inbox; once approved, armada merge ${pull.number}. A new head needs a new approval.`
5352
+ ],
5353
+ hints: [],
5354
+ workers: [],
5355
+ workersListed: false,
5356
+ archive: null,
5357
+ warnings
5358
+ };
5359
+ }
5050
5360
  async function mergePinned(ctx, pull, sha, ticket) {
5051
5361
  const n = `#${pull.number}`;
5052
5362
  const closeByHand = ticket ? `; if it merged, close ${ticket} by hand` : "";
@@ -5108,7 +5418,7 @@ async function closeTicket(ctx, ticket, merged, c, unlocked) {
5108
5418
  });
5109
5419
  if (!ticket.prs.some((p) => p.url === merged.url))
5110
5420
  await ctx.linear.linkUrl(ticket.uuid, merged.url, merged.title || `Pull request #${merged.number}`);
5111
- await ctx.linear.comment(ticket.uuid, `Agent status: merged — PR #${merged.number} squash-merged into ${merged.baseRef} as ${merged.mergeCommit ?? "unknown"}, head ${merged.headSha}${c.updatedFrom ? `, the handed-back ${c.updatedFrom} updated with ${merged.baseRef}` : ""}${unlocked ? ", merged without lock (--no-lock)" : ""}`);
5421
+ await ctx.linear.comment(ticket.uuid, `Agent status: merged — PR #${merged.number} squash-merged into ${merged.baseRef} as ${merged.mergeCommit ?? "unknown"}, head ${merged.headSha}${c.updatedFrom ? `, the handed-back ${c.updatedFrom} updated with ${merged.baseRef}` : ""}${unlocked ? ", merged without lock (--no-lock)" : ""}${c.decided ? `; ${c.decided}` : ""}`);
5112
5422
  return [
5113
5423
  `${ticket.id}: ${done ? `moved to ${done.name}` : "state unchanged"}, agent and ready labels removed, merged status posted.`
5114
5424
  ];
@@ -5165,7 +5475,8 @@ async function mergePullRequest(ctx, input) {
5165
5475
  const run = { pin: null, updated: new Map, lineages: new Map };
5166
5476
  if (input.dryRun) {
5167
5477
  const c = await checklist(ctx, input, run);
5168
- return outcome(c, false, null, c.lines.concat("Dry run: nothing was merged."), [], null);
5478
+ const owner = await ownerDecision(ctx, input, c, true);
5479
+ return outcome(c, false, null, [...c.lines, ...owner.lines, "Dry run: nothing was merged."], [], null);
5169
5480
  }
5170
5481
  if (!input.wait)
5171
5482
  return locked(ctx, input, run);
@@ -5194,6 +5505,9 @@ async function locked(ctx, input, run) {
5194
5505
  const body = async (renew) => {
5195
5506
  const c = await checklist(ctx, input, run);
5196
5507
  c.warnings.unshift(...early);
5508
+ const owner = await ownerDecision(ctx, input, c, false);
5509
+ c.lines.push(...owner.lines);
5510
+ c.decided = owner.decided;
5197
5511
  await recheck(ctx, input, run, c);
5198
5512
  if (!await renew())
5199
5513
  throw new Refusal("the merge lock could not be renewed (it expired and another coordinator took it, or Armada did not answer); nothing was merged", `armada merge ${input.pr} again`);
@@ -5240,7 +5554,8 @@ async function after(ctx, c, merged, lines) {
5240
5554
  number: merged.number,
5241
5555
  url: merged.url,
5242
5556
  mergeCommit: merged.mergeCommit,
5243
- headSha: merged.headSha
5557
+ headSha: merged.headSha,
5558
+ decision: c.decided ?? null
5244
5559
  })) : null;
5245
5560
  if (live$?.resolved)
5246
5561
  lines.push(`Hand-back resolved in the coordinator's inbox.`);
@@ -5323,7 +5638,7 @@ async function readProjectConfig(p, opts) {
5323
5638
  import { createHash as createHash2 } from "node:crypto";
5324
5639
 
5325
5640
  // ../../skills/armada-coordinator/MERGE.md
5326
- var MERGE_default = "# Merging a pull request\n\nRun `armada merge <pr>` (add `--dry-run` to see the checklist only, `--wait` when main keeps moving, `--no-ticket` for a pull request no ticket owns). It checks everything below, takes the project's merge lock, merges pinned to the handed-back SHA, confirms the merge on GitHub and closes the ticket. Its output lists the workers in flight to tell and the worker session to archive. When a refusal names a rule, fix the cause (usually: ask the worker to bring the default branch in and report again) rather than merging by hand. When you must merge by hand, follow the same steps.\n\n## Main kept moving: `--wait`\n\nWith several workers in flight, main often moves between a green hand-back and its merge. Instead of asking the worker to bring main in, run `armada merge <pr> --wait [--timeout <min>]` (30 minutes by default), in the background where your runtime allows it (Claude Code: `run_in_background`):\n\n- A head behind main that GitHub says merges cleanly is updated with GitHub's \"update branch\": a merge commit on the branch, no force-push. Squash merges make that merge commit harmless. When main does not require heads to be up to date and `[gates] local_commands` is set, it is test-merged instead, as without `--wait`, so a busy main does not restart CI each time.\n- It waits for every required check on the new head, then merges pinned to that head.\n- It holds the project's merge lock only while merging, not while waiting, so two waits never block each other. Signed in with Armada down, it refuses before touching the branch.\n- It stops at once, naming the cause, on a red check, a conflict, any other refused rule, or when GitHub refuses the update (a branch protection rule or ruleset can forbid it) or accepts it without the head moving within 3 minutes: ask the worker to fix it. A refusal after an update says so: the worker pulls the updated branch before pushing again.\n- The updated head still counts as the worker's hand-back, because the only change is main coming in: `armada merge` accepts a head that is the handed-back SHA followed only by merge commits, each bringing in a commit of main, with the tree of a clean merge (checked with git). That holds without `--wait` too, for example after \"Update branch\" on GitHub. The ticket's merged comment names both heads: `head <new>, the handed-back <old> updated with main`.\n\n## No ticket: `--no-ticket`\n\n`armada merge <pr> --no-ticket` merges a pull request no ticket owns: the `armada init` pull request (its output names the command) or the release pull request below. There is no hand-back and nothing is written to Linear; every other check is unchanged, and the merge is pinned to the head it checked. It refuses a branch that names a ticket of the program: that one is merged on its worker's hand-back.\n\nWhen none of the required checks ran on the head (a release pull request opened with the workflow's own token gets no CI run), it passes with a note, on GitHub's own state (`UNSTABLE` included, when nothing failed) and the checks that did run, once the head is a minute old; a younger head, or a head this run updated (its update starts CI), is waited for (`--wait`) or refused.\n\n## Before\n\n1. The worker has handed back: `Agent phase` is `ready-to-merge` and you have the full 40-character head SHA it reported.\n2. `gh pr view <n> --json headRefOid,mergeStateStatus,isDraft,title` shows that SHA (or that SHA with only main merged in), `CLEAN` (or `HAS_HOOKS`), not a draft, and a Commitizen title.\n3. `gh pr checks <n>` shows every required check passing.\n4. The head contains the current default branch: `git merge-base --is-ancestor origin/<default> <sha>`. If not, update it (`--wait`) or ask the worker to bring the default branch in (rebase, or merge it into their branch; never force-push a branch someone else pushed to).\n5. Semantic check: search the default branch for callers of anything the pull request deletes or renames.\n6. A dashboard pull request (one that changes Armada's own dashboard, `packages/dashboard`): compare with /agents and /design. Open each page it changes on its preview or the demo next to `/agents` and `/design`. The header bar, the toolbar, the sections and the rows must match them. A page with a title of its own, another font or its own list style goes back to the worker.\n\n## Merge\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- One merge at a time: `armada merge` holds the project's merge lock. If it refuses because Armada is down, use `--no-lock` only when you are sure no other coordinator merges in the project.\n- Leave out `--delete-branch`: it deletes local worktrees that have the branch checked out, including other agents'. Delete the branch once its worktree is gone.\n- If GitHub answers with a 5xx, check `gh pr view <n> --json state` before retrying.\n\n## After\n\n1. The ticket is Done, its `Agent phase` and `Agent runtime` labels removed, the pull request linked.\n2. Tell every in-flight worker what the merge changes for them: a shared file, a migration, a new check, code they must now reuse or delete.\n3. Archive the merged worker's workspace with the \"Stop and archive\" section of its runtime guide.\n4. Launch the tickets this merge unblocked.\n\n## The release pull request\n\nSome repositories publish through release-please: every merge to the default branch opens or updates one release pull request, and merging it tags the version and publishes it. When the repository's rules (`AGENTS.md`) say to merge it after each merge, do it right after the ticket's merge, without a hand-back: no worker owns it.\n\n- **What it looks like.** Title `chore(main): release <version>`, opened by `github-actions`, label `autorelease: pending`, and a diff that only touches the changelog, the manifest and version fields. It is opened with the workflow's own token, so **no CI check runs on it** (only checks from apps such as Vercel, if any) and `mergeStateStatus` is often `UNSTABLE` (`armada merge --no-ticket` accepts it when none of the required checks ran and nothing failed). Both are expected: the publish job runs the repository's checks again before publishing. Anything else in the diff, or a `DIRTY` state, is not expected: stop and tell the owner.\n- **Find it and its head:**\n\n```sh\ngh pr list --state open --label \"autorelease: pending\" --json number,title,headRefOid,mergeStateStatus\n```\n\n- **Merge it** with `armada merge <n> --no-ticket`: no ticket owns it, and no required check runs on it (see \"No ticket\" above). By hand, pin it to that head, like any merge, and without `--delete-branch`:\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- **Check the publish.** After a minute or two the new version is on the registry, for example `npm view <package> version` for an npm package (the package is named in `AGENTS.md` or the release workflow). If it is not, open the Release run (`gh run list --workflow release.yml --limit 3`), fix the cause and re-run its failed jobs: a later push does not publish a version already tagged.\n- Release-please updates the same pull request on each merge to the default branch; one release pull request can carry several merges.\n";
5641
+ var MERGE_default = "# Merging a pull request\n\nRun `armada merge <pr>` (add `--dry-run` to see the checklist only, `--wait` when main keeps moving, `--no-ticket` for a pull request no ticket owns). It checks everything below, takes the project's merge lock, merges pinned to the handed-back SHA, confirms the merge on GitHub and closes the ticket. Its output lists the workers in flight to tell and the worker session to archive. When a refusal names a rule, fix the cause (usually: ask the worker to bring the default branch in and report again) rather than merging by hand. When you must merge by hand, follow the same steps.\n\n## The owner's merge rule: `--reason` and `--ask-owner`\n\n`[policy] merge_approval` in `armada.toml` says in plain words which merges the owner wants to approve first, for example \"merge on your own, except front-end changes: send me a link to check them first\". Without it you merge everything on your own. With it, `armada merge` prints the rule and you judge each pull request: look at its files and at what users will see, then record why either way.\n\n- It may merge on your own: `armada merge <pr> --reason \"<why>\"`, for example `--reason \"CLI only\"`. The ticket's merged comment and the dashboard say `merged on its own (rule: …): CLI only`.\n- The rule keeps it for the owner: `armada merge <pr> --ask-owner --reason \"<why>\"`, for example `--reason \"touches components/timeline\"`. It merges nothing: it records the pull request as GitHub shows it now (title, files with +/−, CI, the preview deployment of its head) with the ticket's screenshots on the owner's Validations page, posts the approval link (`https://<dashboard>/approve/<id>`) on the ticket and prints it. Send it to the owner. Their decision arrives in your inbox as a `decision` item (it wakes `armada watch`): approved, run `armada merge <pr>`, which records `approved by <owner> at <time>`; changes requested, relay them to the worker.\n- Once the owner was asked about a pull request, `armada merge` refuses it until they approved that exact head; a head that is it with only main merged in still counts. Any other new head needs `--ask-owner` again.\n\n## Main kept moving: `--wait`\n\nWith several workers in flight, main often moves between a green hand-back and its merge. Instead of asking the worker to bring main in, run `armada merge <pr> --wait [--timeout <min>]` (30 minutes by default), in the background where your runtime allows it (Claude Code: `run_in_background`):\n\n- A head behind main that GitHub says merges cleanly is updated with GitHub's \"update branch\": a merge commit on the branch, no force-push. Squash merges make that merge commit harmless. When main does not require heads to be up to date and `[gates] local_commands` is set, it is test-merged instead, as without `--wait`, so a busy main does not restart CI each time.\n- It waits for every required check on the new head, then merges pinned to that head.\n- It holds the project's merge lock only while merging, not while waiting, so two waits never block each other. Signed in with Armada down, it refuses before touching the branch.\n- It stops at once, naming the cause, on a red check, a conflict, any other refused rule, or when GitHub refuses the update (a branch protection rule or ruleset can forbid it) or accepts it without the head moving within 3 minutes: ask the worker to fix it. A refusal after an update says so: the worker pulls the updated branch before pushing again.\n- The updated head still counts as the worker's hand-back, because the only change is main coming in: `armada merge` accepts a head that is the handed-back SHA followed only by merge commits, each bringing in a commit of main, with the tree of a clean merge (checked with git). That holds without `--wait` too, for example after \"Update branch\" on GitHub. The ticket's merged comment names both heads: `head <new>, the handed-back <old> updated with main`.\n\n## No ticket: `--no-ticket`\n\n`armada merge <pr> --no-ticket` merges a pull request no ticket owns: the `armada init` pull request (its output names the command) or the release pull request below. There is no hand-back and nothing is written to Linear; every other check is unchanged, and the merge is pinned to the head it checked. It refuses a branch that names a ticket of the program: that one is merged on its worker's hand-back.\n\nWhen none of the required checks ran on the head (a release pull request opened with the workflow's own token gets no CI run), it passes with a note, on GitHub's own state (`UNSTABLE` included, when nothing failed) and the checks that did run, once the head is a minute old; a younger head, or a head this run updated (its update starts CI), is waited for (`--wait`) or refused.\n\n## Before\n\n1. The worker has handed back: `Agent phase` is `ready-to-merge` and you have the full 40-character head SHA it reported.\n2. `gh pr view <n> --json headRefOid,mergeStateStatus,isDraft,title` shows that SHA (or that SHA with only main merged in), `CLEAN` (or `HAS_HOOKS`), not a draft, and a Commitizen title.\n3. `gh pr checks <n>` shows every required check passing.\n4. The head contains the current default branch: `git merge-base --is-ancestor origin/<default> <sha>`. If not, update it (`--wait`) or ask the worker to bring the default branch in (rebase, or merge it into their branch; never force-push a branch someone else pushed to).\n5. Semantic check: search the default branch for callers of anything the pull request deletes or renames.\n6. A dashboard pull request (one that changes Armada's own dashboard, `packages/dashboard`): compare with /agents and /design. Open each page it changes on its preview or the demo next to `/agents` and `/design`. The header bar, the toolbar, the sections and the rows must match them. A page with a title of its own, another font or its own list style goes back to the worker.\n\n## Merge\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- One merge at a time: `armada merge` holds the project's merge lock. If it refuses because Armada is down, use `--no-lock` only when you are sure no other coordinator merges in the project.\n- Leave out `--delete-branch`: it deletes local worktrees that have the branch checked out, including other agents'. Delete the branch once its worktree is gone.\n- If GitHub answers with a 5xx, check `gh pr view <n> --json state` before retrying.\n\n## After\n\n1. The ticket is Done, its `Agent phase` and `Agent runtime` labels removed, the pull request linked.\n2. Tell every in-flight worker what the merge changes for them: a shared file, a migration, a new check, code they must now reuse or delete.\n3. Archive the merged worker's workspace with the \"Stop and archive\" section of its runtime guide.\n4. Launch the tickets this merge unblocked.\n\n## The release pull request\n\nSome repositories publish through release-please: every merge to the default branch opens or updates one release pull request, and merging it tags the version and publishes it. When the repository's rules (`AGENTS.md`) say to merge it after each merge, do it right after the ticket's merge, without a hand-back: no worker owns it.\n\n- **What it looks like.** Title `chore(main): release <version>`, opened by `github-actions`, label `autorelease: pending`, and a diff that only touches the changelog, the manifest and version fields. It is opened with the workflow's own token, so **no CI check runs on it** (only checks from apps such as Vercel, if any) and `mergeStateStatus` is often `UNSTABLE` (`armada merge --no-ticket` accepts it when none of the required checks ran and nothing failed). Both are expected: the publish job runs the repository's checks again before publishing. Anything else in the diff, or a `DIRTY` state, is not expected: stop and tell the owner.\n- **Find it and its head:**\n\n```sh\ngh pr list --state open --label \"autorelease: pending\" --json number,title,headRefOid,mergeStateStatus\n```\n\n- **Merge it** with `armada merge <n> --no-ticket`: no ticket owns it, and no required check runs on it (see \"No ticket\" above). By hand, pin it to that head, like any merge, and without `--delete-branch`:\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- **Check the publish.** After a minute or two the new version is on the registry, for example `npm view <package> version` for an npm package (the package is named in `AGENTS.md` or the release workflow). If it is not, open the Release run (`gh run list --workflow release.yml --limit 3`), fix the cause and re-run its failed jobs: a later push does not publish a version already tagged.\n- Release-please updates the same pull request on each merge to the default branch; one release pull request can carry several merges.\n";
5327
5642
 
5328
5643
  // ../../skills/armada-coordinator/SKILL.md
5329
5644
  var SKILL_default = `---
@@ -5352,19 +5667,21 @@ A coordinator may start cold, on a laptop or in a fresh cloud session, with noth
5352
5667
  ## Loop
5353
5668
 
5354
5669
  1. **Read the fleet** with \`armada status\` and \`armada inbox\`, never from memory. Done when you can name every ticket in flight and its phase, every ready ticket, every pull request waiting, every silent worker and every pending question, plan or request.
5355
- 2. **Answer what waits for you first.** For each question in \`armada inbox\`: decide it, or escalate it to the owner when it is a product decision and wait for theirs. For each \`plan\` item: read the full plan, approve it or give concrete amendments. Deliver the decision in the worker's session with the runtime guide's *message* section, then record it with \`armada answer <item> "approved"\` or \`armada answer <item> "<amendments and reason>"\`. The worker resumes with \`implementing\` on approval, or returns to \`planning\` and submits a revised plan. \`armada answer\` only records; it never reaches the worker. Decide reversible choices yourself and prefer the option that keeps behaviour observable. When two workers need the same shared resource (a migration slot, a generated file, a version number), set the rule once and tell both. A message the worker did not ask for (main moved, bring it in) takes the same path: deliver it with the runtime guide, then \`armada answer --note <ticket> "<message>"\`. Done when the inbox shows no open question or plan.
5670
+ 2. **Answer what waits for you first.** For each question in \`armada inbox\`: decide it, or escalate it to the owner when it is a product decision: \`armada ask-owner <ticket> "<question>" --choices "<a> | <b>"\` puts it on the owner's Validations page and prints the link to send them; their pick arrives as a \`decision\` item. For each \`plan\` item: read the full plan, approve it or give concrete amendments. Deliver the decision in the worker's session with the runtime guide's *message* section, then record it with \`armada answer <item> "approved"\` or \`armada answer <item> "<amendments and reason>"\`. The worker resumes with \`implementing\` on approval, or returns to \`planning\` and submits a revised plan. \`armada answer\` only records; it never reaches the worker. Decide reversible choices yourself and prefer the option that keeps behaviour observable. When two workers need the same shared resource (a migration slot, a generated file, a version number), set the rule once and tell both. A message the worker did not ask for (main moved, bring it in) takes the same path: deliver it with the runtime guide, then \`armada answer --note <ticket> "<message>"\`. Done when the inbox shows no open question or plan.
5356
5671
  3. **Carry out the owner's dashboard requests.** They are the owner's word, signed with their name; they never reached a worker.
5357
5672
  - \`answer-request\` (it names the question or plan it answers, \`answers #<id>\`): deliver its text in the worker's session with the runtime guide's *message* section, as the owner's answer or plan approval, then \`armada answer <request id> "<the text you delivered>"\`. That resolves the request and its question or plan, and the ticket names who answered. If the item is gone (the worker was released or changed phase), \`armada answer <request id> "<why>"\` closes it.
5358
5673
  - \`launch-request\`: launch the ticket as in step 5. A request may name a label-routed profile or one the owner chose; otherwise choose from the profiles' \`when\` rules. Pass \`--profile\` and \`--reason\` when a choice or override is needed. The worker's \`armada claim\` resolves the request and posts who asked. If the ticket must not start (it collides with work in flight, or its plan changed), decline it: \`armada answer <request id> "<why>"\`, and tell the owner in your report.
5674
+ - \`decision\` (THE-885): the owner decided something you or a worker sent to their Validations page. A merge they approved: \`armada merge <pr>\`. Changes requested: deliver them in the worker's session with the runtime guide. A validation approved: tell the worker; for a design ticket, \`armada done <ticket>\` records the design on the ticket and closes it, then cut the ticket that builds it, blocked by this one. A choice to a question you escalated: deliver it as the answer. Then \`armada answer <item> "<what you did>"\`.
5359
5675
  Done when the inbox shows no open request.
5360
5676
  4. **Check silent workers and workers that never started** with the runtime guide's *status* section. A worker that is still working gets a nudge to report; a worker that died is relaunched or its ticket released. A \`not-started\` entry is a worker launched that has not claimed after \`[policy] not_started_minutes\` (10 by default); it says whether the worker never used its launch token (it never reached its \`armada login\` line: an install that failed, a prompt cut short) or signed in and stopped before its claim. Read its session: a worker stuck on a setup choice gets a message to take the safe option and go on; one that is gone is launched again with a new brief, or its launch revoked on the dashboard's Workers page. The entry clears on the claim.
5361
5677
  5. **Launch ready tickets** that do not collide with work in flight, one at a time:
5362
5678
  - pick the ticket from the frontier in \`armada status\`;
5363
5679
  - run \`armada brief <ticket>\` and resolve its warnings. A matching \`[[conductor.routing]]\` label rule wins. Otherwise, when profiles have \`when\` rules, the brief prints **Choose a profile** and mints no launch token. Read the ticket and its parent spec; match each profile's plain-language rule and prefer the one covering most files the ticket will change. If it spans front end and back end, choose where most of the work is and say so. Run \`armada brief <ticket> --profile <name> --reason "<why>"\`, naming the files or work that justify the choice. Armada never calls a model to classify tickets. Only projects without \`when\` rules fall back to \`default_profile\` (or their only profile). Override a matching label rule only when the labels mislead, with the same reasoned command. Keep \`--profile\` and \`--reason\` on every subsequent \`--prompt\` call; the reason reaches the worker's claim, status and agent page;
5680
+ - judge \`[[policy.validation]]\` when \`armada.toml\` has rules, the same way: each says in plain words which kind of ticket the owner must see first (\`when\`) and what the worker shows (\`then\`). Most tickets are none: \`armada brief <ticket> --validation none\` (no reason needed). When one applies (a design ticket, a new screen's look), \`--validation <n> --validation-reason "<why this ticket is one>"\`: the prompt then tells the worker to submit its work with \`armada validate\` and stop, and the claim records your judgement. The brief refuses until you judge, and prints the command to copy;
5364
5681
  - write the prompt with one launch call: \`armada brief <ticket> --prompt --profile-line > <file>\`, keeping the chosen \`--profile\` and \`--reason\` flags. Stdout is the exact prompt; stderr gives the selected profile, agent, model, effort, runtime and reason for the runtime's launch settings. Human and \`--json\` previews are read-only and create no token or launch row. **The launch message is that \`--prompt\` output, never text cut from either preview**. Cancel a minted launch with \`armada launch revoke <ticket>\` if the runtime launch fails or you change your mind; a worker that has claimed must use \`armada release\` instead. Add what only you know: which parallel workers touch neighbouring code and where the boundary is, and decisions not yet on the ticket. The brief already says whether the plan needs approval (\`[policy] plans\`, or the ticket's label) and ends with the project's conventions (\`[brief] extra\`): put a note every worker needs in that file, not in each prompt;
5365
5682
  - launch it with the runtime guide's *launch* section, passing the profile's values. When the brief's \`Launch:\` line says the prompt carries a one-time token, pass no key: the worker signs in with it. When it says there is none, fix the reason (usually your sign-in) and brief again, rather than pass keys; the token works once, within the hour, so brief right before the launch;
5366
5683
  - check the claim: \`armada status\` shows the ticket in flight, phase \`planning\`, with the handle the runtime returned. Done when every launched ticket is In Progress with a claim.
5367
- 6. **Merge handed-back pull requests** one at a time with \`armada merge <pr>\` (\`--wait\` when main moved since the hand-back, \`--no-ticket\` for a pull request no ticket owns), following [MERGE.md](MERGE.md). Done when the pull request is merged, the ticket is Done with its agent labels removed, and every in-flight worker affected by what landed has been told. When the repository's rules (\`AGENTS.md\`) ask you to ship each merge through its release pull request (release-please's \`chore(main): release …\`), merge that one next, as "The release pull request" in [MERGE.md](MERGE.md) describes.
5684
+ 6. **Merge handed-back pull requests** one at a time with \`armada merge <pr>\`. When \`armada.toml\` has \`[policy] merge_approval\`, judge each pull request against it in plain words: look at its files and what users will see. When it may merge on its own, \`armada merge <pr> --reason "<why>"\` (for example "CLI only"); when the rule keeps it for the owner, \`armada merge <pr> --ask-owner --reason "<why>"\` (for example "touches components/timeline"): it merges nothing, posts the approval link on the ticket and prints it; send it to the owner, and merge once their approval arrives in your inbox. A new head needs a new approval. Either way the merge records how it was decided. Without the rule, merge on your own (\`--wait\` when main moved since the hand-back, \`--no-ticket\` for a pull request no ticket owns), following [MERGE.md](MERGE.md). Done when the pull request is merged, the ticket is Done with its agent labels removed, and every in-flight worker affected by what landed has been told. When the repository's rules (\`AGENTS.md\`) ask you to ship each merge through its release pull request (release-please's \`chore(main): release …\`), merge that one next, as "The release pull request" in [MERGE.md](MERGE.md) describes.
5368
5685
  7. **Turn findings into tickets.** A gap a worker reports or a bug you see becomes a ticket under the right spec, with blocked-by relations, and is launched when ready. No finding lives only in a transcript.
5369
5686
  8. **Report to the owner** in their language (\`tracker.language\` in \`armada.toml\`, or the owner's personal setting): what merged, what runs, what you decided for them, and the one thing they must do, with its exact place (a URL, a setting). Outcomes and numbers, no process narration.
5370
5687
 
@@ -5520,6 +5837,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
5520
5837
  - **Report at each real step** with \`armada report <phase> --message "<what changed, what is next>"\`: the plan, meaningful implementation progress, blockers, tests, shipping and hand-back. The same phase is allowed. Reports are progress, not liveness: \`policy.silence_minutes\` measures missing heartbeats (15 by default); \`policy.quiet_minutes\` is a coordinator-only reminder for a live worker without a report (45 by default). Never post empty reports just to look alive.
5521
5838
  - **Keep going on setup choices.** When setup needs a choice (an install fallback, a retry, a missing tool), pick the safe option, say which in your next report, and keep going: never stop to ask about it. Ask only for product decisions.
5522
5839
  - **Ask instead of guessing** when a choice changes the ticket's outcome: \`armada ask "<question and your recommendation>" --options "<a> | <b>"\`. Your phase becomes \`blocked\` and the question reaches the coordinator's inbox. Then **stop and end your turn**: the answer arrives as a message in this session, not in a command's output. When it arrives, report the phase you resume, for example \`armada report implementing --message "resumed: <the decision>"\`. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
5840
+ - **Show the owner when your brief says so.** A brief with an "Owner validation" block names what the owner must see before the work goes on (a design ticket: the mockup itself). Produce it, then \`armada validate "<what to check>" --attach <files|https-urls>... [--caption "<text>"]\`: the attachments and the question go to the owner's Validations page on Armada, your phase becomes \`awaiting-validation\`, and the command prints the approval link. Then **stop and end your turn**: the coordinator relays the owner's decision in this session. On "Request changes", revise and run \`armada validate\` again (it replaces the open one); on approval, report the phase you resume, or, for a design ticket, stop: the coordinator closes it and building it is another ticket. Never merge or build what the owner has not approved.
5523
5841
  - **The ticket is the source of truth.** Read it, its parent spec and the hand-back comments of its merged blockers in full before planning.
5524
5842
  - Work only in your own branch and worktree. Never touch another agent's checkout, and stop only the processes you started.
5525
5843
  - Never print, commit or log a secret.
@@ -5540,7 +5858,7 @@ If you stop without finishing, run \`armada release --reason "<why>"\` so the ti
5540
5858
 
5541
5859
  ## When a command is missing
5542
5860
 
5543
- This skill is versioned with Armada; an older CLI may lack a command (\`armada --help\` lists them). Do the same step by hand in the tracker, keeping the protocol: exactly one label from the phase group (\`planning\`, \`awaiting-approval\`, \`implementing\`, \`shipping\`, \`blocked\`, \`ready-to-merge\`) and one from the runtime group; a first comment \`Agent claim — runtime: <runtime> · session: <id> · branch: <branch> · started: <ISO date>\`; and every comment starting with \`Agent status: <phase> — <one-line summary>\`.
5861
+ This skill is versioned with Armada; an older CLI may lack a command (\`armada --help\` lists them). Do the same step by hand in the tracker, keeping the protocol: exactly one label from the phase group (\`planning\`, \`awaiting-approval\`, \`implementing\`, \`shipping\`, \`blocked\`, \`ready-to-merge\`, \`awaiting-validation\`) and one from the runtime group; a first comment \`Agent claim — runtime: <runtime> · session: <id> · branch: <branch> · started: <ISO date>\`; and every comment starting with \`Agent status: <phase> — <one-line summary>\`.
5544
5862
  `;
5545
5863
 
5546
5864
  // ../core/src/skills.ts
@@ -6072,8 +6390,132 @@ async function loadStatus(config, opts) {
6072
6390
  now: now()
6073
6391
  });
6074
6392
  }
6393
+
6394
+ // ../core/src/validate.ts
6395
+ var PHASE = "awaiting-validation";
6396
+ async function submitValidation(ctx, input) {
6397
+ const what = input.what.trim();
6398
+ const usage = input.kind === "question" ? `armada ask-owner ${input.ticket} "<question>" --choices "<a> | <b>"` : `armada validate "<what to check>" --attach <file|url>`;
6399
+ if (!what)
6400
+ throw new Refusal("say what the owner checks", usage);
6401
+ if (what.length > VALIDATION_LIMITS.what)
6402
+ throw new Refusal(`what to check has at most ${VALIDATION_LIMITS.what} characters`, usage);
6403
+ if (input.kind === "question" && !input.choices?.length)
6404
+ throw new Refusal("a question for the owner needs its choices", usage);
6405
+ const ticket = await readOpenTicket(ctx, input.ticket);
6406
+ if (input.worker && ticket.agentPhase !== PHASE) {
6407
+ const problem = transitionProblem(ticket.agentPhase, PHASE);
6408
+ if (problem)
6409
+ throw new Refusal(`${ticket.id}: ${problem}`, `armada report <phase> --message "<what you did>"`);
6410
+ }
6411
+ const { fleet, warning } = await ctx.fleet();
6412
+ if (!fleet)
6413
+ throw new Refusal(`the owner validates on Armada, which this terminal cannot reach (${warning ?? "not signed in"}); nothing was sent`, "armada login, then the same command again");
6414
+ const uploaded = input.upload ? await input.upload() : [];
6415
+ const { validation, url } = await fleet.validate({
6416
+ ticket: ticket.id,
6417
+ kind: input.kind,
6418
+ what,
6419
+ reason: null,
6420
+ choices: input.choices,
6421
+ pr: null,
6422
+ attachments: [...input.attachments, ...uploaded]
6423
+ });
6424
+ const [first = "", ...rest] = what.split(`
6425
+ `);
6426
+ if (input.worker) {
6427
+ const out = await reportPhase(ctx, {
6428
+ ticket: ticket.id,
6429
+ phase: PHASE,
6430
+ message: [`${first.trim()} — ${url}`, rest.join(`
6431
+ `).trim()].filter(Boolean).join(`
6432
+ `)
6433
+ });
6434
+ return {
6435
+ ...out,
6436
+ lines: [
6437
+ ...out.lines,
6438
+ `Validation #${validation.id} waits for the owner: ${url}`,
6439
+ "Stop here until the owner decides: the coordinator relays the decision in this session. On changes, revise and run armada validate again."
6440
+ ],
6441
+ validation,
6442
+ link: url
6443
+ };
6444
+ }
6445
+ const label = input.kind === "question" ? "Question for the owner" : "Owner validation asked";
6446
+ const choices = input.choices?.length ? `
6447
+
6448
+ Choices: ${input.choices.join(" | ")}` : "";
6449
+ await ctx.linear.comment(ticket.uuid, `${label}: ${what}${choices}
6450
+
6451
+ ${url}`);
6452
+ return {
6453
+ ticket: ticket.id,
6454
+ url: ticket.url,
6455
+ lines: [
6456
+ `${input.kind === "question" ? "Question" : "Validation"} #${validation.id} for ${ticket.id} waits for the owner: ${url}`,
6457
+ "The link is posted on the ticket; the owner's decision arrives in your inbox."
6458
+ ],
6459
+ warnings: [...ticket.warnings],
6460
+ inbox: null,
6461
+ validation,
6462
+ link: url
6463
+ };
6464
+ }
6465
+ async function closeValidated(ctx, input) {
6466
+ const { config, linear } = ctx;
6467
+ const ticket = await readOpenTicket(ctx, input.ticket);
6468
+ const { fleet, warning } = await ctx.fleet();
6469
+ if (!fleet)
6470
+ throw new Refusal(`the owner's decisions are on Armada, which this terminal cannot reach (${warning ?? "not signed in"})`, "armada login, then the same command again");
6471
+ const v = lastValidation(await fleet.validations({ ticket: ticket.id }), ticket.id);
6472
+ if (v?.decision?.outcome !== "approved" && v?.decision?.outcome !== "answered")
6473
+ throw new Refusal(v ? `${ticket.id}'s validation #${v.id} is ${v.decision ? decidedLine(v.decision) : "still waiting for the owner"}: only an approved one closes the ticket` : `${ticket.id} has no validation the owner approved`, v && !v.decision ? "armada inbox --wait: the owner's decision arrives there" : `armada validate ${ticket.id} "<what to check>"`);
6474
+ const decided = decidedLine(v.decision);
6475
+ const groups = config.tracker.labels;
6476
+ const done = firstState(ticket.states, "completed");
6477
+ await linear.updateTicket(ticket.uuid, {
6478
+ ...done ? { stateId: done.id } : {},
6479
+ removeLabelIds: [
6480
+ ...others(ticket, groups.phaseGroup, null),
6481
+ ...others(ticket, groups.runtimeGroup, null),
6482
+ ...ticket.labels.filter((label) => label.name === config.tracker.readyLabel).map((label) => label.id)
6483
+ ]
6484
+ });
6485
+ const attachments = v.attachments.map((id) => `- ${input.attachmentUrl(id)}`);
6486
+ const summary = `done without a pull request: validation #${v.id} ${decided}`;
6487
+ await linear.comment(ticket.uuid, [
6488
+ `Agent status: merged — ${summary}`,
6489
+ `What the owner validated:
6490
+ ${v.what}`,
6491
+ v.decision.note ? `The owner's note:
6492
+ ${v.decision.note}` : "",
6493
+ attachments.length ? `Attachments:
6494
+ ${attachments.join(`
6495
+ `)}` : ""
6496
+ ].filter(Boolean).join(`
6497
+
6498
+ `));
6499
+ const warnings = [...ticket.warnings];
6500
+ try {
6501
+ await fleet.done({ ticket: ticket.id, message: summary });
6502
+ } catch (err) {
6503
+ warnings.push(`Armada did not record it (${err instanceof Error ? err.message : String(err)})`);
6504
+ }
6505
+ return {
6506
+ ticket: ticket.id,
6507
+ url: ticket.url,
6508
+ lines: [
6509
+ `${ticket.id}: ${done ? `moved to ${done.name}` : "state unchanged"}, agent and ready labels removed; ${summary}.`,
6510
+ "Building it is a separate ticket: cut it, blocked by this one."
6511
+ ],
6512
+ warnings,
6513
+ inbox: null,
6514
+ validation: v
6515
+ };
6516
+ }
6075
6517
  // package.json
6076
- var version = "0.2.21";
6518
+ var version = "0.2.22";
6077
6519
 
6078
6520
  // src/attach.ts
6079
6521
  import { resolve } from "node:path";
@@ -6739,13 +7181,28 @@ async function claim(io, config, credentials, a) {
6739
7181
  }
6740
7182
  if (!handle)
6741
7183
  throw new UsageError("--handle is required: the runtime's id for this session, e.g. <workspace>/<session>");
7184
+ let validation = null;
7185
+ if (a.options.validation !== undefined)
7186
+ try {
7187
+ validation = chooseValidations(config.policy.validations, {
7188
+ ticket: ticket.toUpperCase(),
7189
+ requested: a.options.validation,
7190
+ reason: a.options["validation-reason"] ?? null,
7191
+ command: `armada claim ${ticket.toUpperCase()} --runtime ${runtime} --handle ${handle}`
7192
+ });
7193
+ } catch (err) {
7194
+ if (err instanceof ValidationChoiceError)
7195
+ throw new UsageError(err.message, err.next);
7196
+ throw err;
7197
+ }
6742
7198
  return withContext(io, config, credentials, a.json, (ctx) => claimTicket(ctx, {
6743
7199
  ticket: ticket.toUpperCase(),
6744
7200
  runtime,
6745
7201
  handle,
6746
7202
  ...a.options.branch ? { branch: a.options.branch } : {},
6747
7203
  profile,
6748
- reason
7204
+ reason,
7205
+ validation
6749
7206
  }));
6750
7207
  }
6751
7208
  async function report(io, config, credentials, a) {
@@ -7118,7 +7575,9 @@ function hideLaunchToken(b) {
7118
7575
  }
7119
7576
  function renderBrief(b) {
7120
7577
  const p = b.profile;
7121
- const promptCommand = `armada brief ${b.ticket.id}${p && (b.routing?.source === "requested" || b.routing?.reason) ? ` --profile ${shellWord(p.name)}${b.routing?.reason ? ` --reason ${shellWord(b.routing.reason)}` : ""}` : ""} --prompt`;
7578
+ const v = b.validation;
7579
+ const validationFlags = v ? v.rules.length ? ` --validation ${v.rules.map((r) => r.index).join(",")}${v.reason ? ` --validation-reason ${shellWord(v.reason)}` : ""}` : " --validation none" : "";
7580
+ const promptCommand = `armada brief ${b.ticket.id}${p && (b.routing?.source === "requested" || b.routing?.reason) ? ` --profile ${shellWord(p.name)}${b.routing?.reason ? ` --reason ${shellWord(b.routing.reason)}` : ""}` : ""}${validationFlags} --prompt`;
7122
7581
  const width = Math.max(...b.environment.map((v) => v.name.length + (v.value ? v.value.length + 1 : 0)));
7123
7582
  const out = [
7124
7583
  `Brief for ${b.ticket.id} — ${b.ticket.title} (${b.ticket.status})`,
@@ -7128,6 +7587,9 @@ function renderBrief(b) {
7128
7587
  `Profile: ${p ? `${p.name}: agent ${p.agent}, model ${p.model}, effort ${p.effort}${b.runtime === "claude-code" ? " (not applied by the Agent tool)" : ""}${p.fastMode ? ", fast mode" : ""}` : "none declared in armada.toml"}`,
7129
7588
  ...b.routing ? [`Chosen by: ${b.routing.why}`] : [],
7130
7589
  `Plans: ${b.plans.rule === "pre-approved" ? "pre-approved" : "wait for approval"} (${b.plans.why})`,
7590
+ ...v ? [
7591
+ `Validation: ${v.rules.length ? `the owner validates: ${v.rules.map((r) => `rule ${r.index} (${r.when})`).join(", ")}${v.reason ? ` — ${v.reason}` : ""}` : "no [[policy.validation]] rule applies"}`
7592
+ ] : [],
7131
7593
  ...b.conventions ? [`Conventions: ${b.conventions.path} (under "Project conventions" in the prompt)`] : [],
7132
7594
  `Repository: ${b.repository.url}`,
7133
7595
  `Branch: ${b.ticket.branch ?? "none suggested by Linear"} (the worker renames its workspace branch to it)`,
@@ -7187,6 +7649,17 @@ function launcher(io, config, credentials) {
7187
7649
  }
7188
7650
  };
7189
7651
  }
7652
+ function briefCommand(ticket, a) {
7653
+ const o = a.options;
7654
+ return [
7655
+ `armada brief ${ticket}`,
7656
+ o.profile ? ` --profile ${shellWord(o.profile)}` : "",
7657
+ o.reason ? ` --reason ${shellWord(o.reason)}` : "",
7658
+ o.prompt === "true" ? " --prompt" : "",
7659
+ o["profile-line"] === "true" ? " --profile-line" : "",
7660
+ a.json ? " --json" : ""
7661
+ ].join("");
7662
+ }
7190
7663
  async function brief(io, config, credentials, a, version, configPath) {
7191
7664
  const [ticket, ...extra] = a.rest;
7192
7665
  if (!ticket)
@@ -7227,12 +7700,17 @@ async function brief(io, config, credentials, a, version, configPath) {
7227
7700
  launch: launcher(io, config, credentials),
7228
7701
  npm: (v) => checkPublished(v, io.fetch ?? fetch),
7229
7702
  conventions,
7703
+ validation: {
7704
+ requested: a.options.validation ?? null,
7705
+ reason: a.options["validation-reason"] ?? null,
7706
+ command: briefCommand(ticket.toUpperCase(), a)
7707
+ },
7230
7708
  ...io.fetch ? { fetch: io.fetch } : {},
7231
7709
  ...io.now ? { now: io.now } : {}
7232
7710
  });
7233
7711
  } catch (err) {
7234
7712
  if (err instanceof BriefError)
7235
- throw new UsageError(err.message);
7713
+ throw new UsageError(err.message, err.next ?? undefined);
7236
7714
  throw err;
7237
7715
  }
7238
7716
  if ("selection" in b) {
@@ -8111,6 +8589,13 @@ async function merge(io, config, credentials, a, configPath) {
8111
8589
  if (noTicket && a.options.ticket)
8112
8590
  throw new UsageError("--no-ticket and --ticket cannot go together");
8113
8591
  const wait = !!a.options.wait;
8592
+ const askOwner = a.options["ask-owner"] === "true";
8593
+ if (askOwner && (wait || a.options["dry-run"] || noTicket || a.options["no-lock"]))
8594
+ throw new UsageError("--ask-owner only asks the owner: it goes with --reason (and --ticket), nothing else");
8595
+ if (askOwner && !a.options.reason?.trim())
8596
+ throw new UsageError(`--ask-owner needs --reason: armada merge ${number} --ask-owner --reason "<why the owner must see it>"`);
8597
+ if (noTicket && a.options.reason !== undefined)
8598
+ throw new UsageError("--reason judges a ticket's merge; --no-ticket has none");
8114
8599
  if (wait && a.options["dry-run"])
8115
8600
  throw new UsageError("--wait and --dry-run cannot go together");
8116
8601
  if (!wait && a.options.timeout !== undefined)
@@ -8140,8 +8625,10 @@ async function merge(io, config, credentials, a, configPath) {
8140
8625
  diff: (n) => fetchPullDiff({ ...gh, number: n }),
8141
8626
  merge: ghMerge(exec, repoDir, config.github.repository),
8142
8627
  commit: (sha) => fetchCommit({ ...gh, sha }),
8143
- updateBranch: ghUpdateBranch(exec, repoDir, config.github.repository)
8628
+ updateBranch: ghUpdateBranch(exec, repoDir, config.github.repository),
8629
+ preview: (sha) => fetchPreview({ ...gh, sha })
8144
8630
  },
8631
+ appUrl: credentials.armadaSignIn ? credentials.armadaApi.url : null,
8145
8632
  repo: gitRepo(exec, repoDir),
8146
8633
  lockRequired: !!credentials.armadaSignIn,
8147
8634
  fleet: async () => live,
@@ -8163,13 +8650,33 @@ async function merge(io, config, credentials, a, configPath) {
8163
8650
  return false;
8164
8651
  }
8165
8652
  };
8653
+ if (askOwner) {
8654
+ const asked = await askOwnerToMerge(ctx, {
8655
+ pr: number,
8656
+ ticket: a.options.ticket ?? null,
8657
+ reason: a.options.reason ?? ""
8658
+ });
8659
+ const project = config.project.slug;
8660
+ const next = await rearmFor(io, project, {
8661
+ inFlight: (await watchOf(io, project)).state?.inFlight ?? null,
8662
+ open: null
8663
+ });
8664
+ io.stdout(a.json ? `${JSON.stringify({ ...asked, watch: next }, null, 2)}
8665
+ ` : `${render(asked)}${next.line}
8666
+ `);
8667
+ for (const w of asked.warnings)
8668
+ io.stderr(`armada: warning: ${w}
8669
+ `);
8670
+ return 0;
8671
+ }
8166
8672
  const o = await mergePullRequest(ctx, {
8167
8673
  pr: number,
8168
8674
  ticket: a.options.ticket ?? null,
8169
8675
  noTicket,
8170
8676
  wait: wait ? { timeoutMs } : null,
8171
8677
  dryRun: !!a.options["dry-run"],
8172
- noLock: !!a.options["no-lock"]
8678
+ noLock: !!a.options["no-lock"],
8679
+ reason: a.options.reason ?? null
8173
8680
  });
8174
8681
  const project = config.project.slug;
8175
8682
  const coordinator = coordinatorHandle(io);
@@ -8569,6 +9076,101 @@ async function runCommand(io, config, credentials, args) {
8569
9076
  return io.spawn(command, commandArgs, { cwd: io.cwd, env: { ...io.env, ...values } });
8570
9077
  }
8571
9078
 
9079
+ // src/validate.ts
9080
+ var TICKET = /^[A-Za-z][A-Za-z0-9]*-\d+$/;
9081
+ var attachList = (raw) => (raw ?? "").split(`
9082
+ `).map((a) => a.trim()).filter(Boolean);
9083
+ async function ensurePhaseLabel(io, config, credentials) {
9084
+ const apiKey = credentials.linearApiKey;
9085
+ if (!apiKey)
9086
+ return;
9087
+ const opts = { apiKey, ...io.fetch ? { fetch: io.fetch } : {} };
9088
+ const state = await readLabels(config, opts);
9089
+ const groups = state.groups.filter((g) => g.name === config.tracker.labels.phaseGroup && g.id && g.missing.includes("awaiting-validation")).map((g) => ({ ...g, missing: ["awaiting-validation"] }));
9090
+ if (groups.length)
9091
+ await createMissingLabels({ ...state, groups }, opts);
9092
+ }
9093
+ function namedTicket(rest, options) {
9094
+ const [first, second] = rest;
9095
+ const fromOption = options.message !== undefined || options["message-file"] !== undefined;
9096
+ if (first && (second !== undefined || fromOption && TICKET.test(first)))
9097
+ return first.toUpperCase();
9098
+ return null;
9099
+ }
9100
+ async function validate(io, config, credentials, a) {
9101
+ if (a.rest.length > 2)
9102
+ throw new UsageError(`unexpected argument ${a.rest[2]}; quote what to check`);
9103
+ const named = namedTicket(a.rest, a.options);
9104
+ const positional = named ? a.rest[1] : a.rest[0];
9105
+ const fromOption = await readMessage(io, a.options);
9106
+ if (positional !== undefined && fromOption !== null)
9107
+ throw new UsageError("give what to check once: as an argument, --message or --message-file");
9108
+ const what = positional ?? fromOption;
9109
+ if (!what?.trim())
9110
+ throw new UsageError('validate needs what the owner checks: armada validate "<what to check>" --attach <file|url>');
9111
+ if (named && !TICKET.test(named))
9112
+ throw new UsageError(`"${named}" is not a ticket id such as ABC-12`);
9113
+ const ticket = named ?? currentTicket(io, config, a.options.ticket, credentials.workerTickets);
9114
+ const worker = !named && credentials.armadaSignIn?.kind === "worker";
9115
+ const items = attachList(a.options.attach);
9116
+ if (worker)
9117
+ await ensurePhaseLabel(io, config, credentials);
9118
+ return withContext(io, config, credentials, a.json, (ctx) => submitValidation(ctx, {
9119
+ ticket,
9120
+ kind: "validation",
9121
+ what,
9122
+ choices: parseChoices(a.options.choices),
9123
+ attachments: [],
9124
+ upload: async () => items.length ? (await attachItems(io, config, credentials, {
9125
+ ticket,
9126
+ items,
9127
+ ...a.options.caption ? { caption: a.options.caption } : {},
9128
+ reference: "validation"
9129
+ })).map((saved) => saved.attachment.id) : [],
9130
+ worker
9131
+ }));
9132
+ }
9133
+ async function askOwner(io, config, credentials, a) {
9134
+ const [ticket, question, ...extra] = a.rest;
9135
+ const usage = 'armada ask-owner <ticket> "<question>" --choices "<a> | <b>"';
9136
+ if (!ticket || !TICKET.test(ticket))
9137
+ throw new UsageError(`ask-owner needs a ticket: ${usage}`);
9138
+ if (extra.length)
9139
+ throw new UsageError(`unexpected argument ${extra[0]}; quote the question`);
9140
+ if (!question?.trim())
9141
+ throw new UsageError(`ask-owner needs the question: ${usage}`);
9142
+ const choices = parseChoices(a.options.choices);
9143
+ if (!choices || choices.length < 2)
9144
+ throw new UsageError(`give the owner at least two choices: ${usage}`);
9145
+ if (credentials.armadaSignIn?.kind === "worker")
9146
+ throw new UsageError("a worker asks the coordinator (armada ask), who escalates to the owner");
9147
+ return withContext(io, config, credentials, a.json, (ctx) => submitValidation(ctx, {
9148
+ ticket: ticket.toUpperCase(),
9149
+ kind: "question",
9150
+ what: question,
9151
+ choices,
9152
+ attachments: [],
9153
+ worker: false
9154
+ }));
9155
+ }
9156
+ async function done(io, config, credentials, a) {
9157
+ const [ticket, ...extra] = a.rest;
9158
+ if (!ticket || !TICKET.test(ticket))
9159
+ throw new UsageError("done needs a ticket: armada done <ticket>");
9160
+ if (extra.length)
9161
+ throw new UsageError(`unexpected argument ${extra[0]}`);
9162
+ if (credentials.armadaSignIn?.kind === "worker")
9163
+ throw new UsageError("workers never close their ticket: the coordinator runs armada done");
9164
+ const id = ticket.toUpperCase();
9165
+ const base = credentials.armadaApi.url;
9166
+ const code = await withContext(io, config, credentials, a.json, (ctx) => closeValidated(ctx, {
9167
+ ticket: id,
9168
+ attachmentUrl: (attachment) => new URL(`/agents/${encodeURIComponent(id)}?tab=attachments&attachment=${attachment}`, base).toString()
9169
+ }));
9170
+ await endWorkerSessions(io, config, credentials, id, "merged", a.json);
9171
+ return code;
9172
+ }
9173
+
8572
9174
  // src/cli.ts
8573
9175
  var COMMAND_HELP = {
8574
9176
  attach: ` attach <ticket> <file|url>... [--caption <text>] [--for <item>]
@@ -8595,16 +9197,18 @@ var COMMAND_HELP = {
8595
9197
  .claude/settings.json (yes without a terminal); --no-stop-hook skips it
8596
9198
  `,
8597
9199
  claim: ` claim <ticket> --runtime <name> --handle <id> [--branch <name>]
8598
- [--profile <name> [--reason <why>]]
9200
+ [--profile <name> [--reason <why>]] [--validation <n,...> --validation-reason <why>]
8599
9201
  Claim a ticket for this worker: In Progress, phase planning, runtime
8600
9202
  label and an Agent claim comment; refused if another worker holds it.
8601
9203
  --profile records the Conductor profile; one other than the ticket's
8602
- routed profile needs --reason. Prints the ticket's state afterwards
9204
+ routed profile needs --reason. --validation records the owner-validation
9205
+ rules the coordinator judged apply. Prints the ticket's state afterwards
8603
9206
  `,
8604
9207
  report: ` report <phase> [--message <text> | --message-file <path|->] [--pr <n|url>] [--sha <sha>]
8605
9208
  [--plan <text> | --plan-file <path|->]
8606
9209
  Report a phase (planning, awaiting-approval, implementing, shipping,
8607
- blocked, ready-to-merge); the same phase again is a status update.
9210
+ blocked, ready-to-merge, awaiting-validation); the same phase again is a
9211
+ status update; armada validate is how a worker enters awaiting-validation.
8608
9212
  --plan posts the plan as its own block under a one-line status (the
8609
9213
  message's first line, else the plan's); awaiting-approval sends it to
8610
9214
  the coordinator's inbox.
@@ -8618,6 +9222,22 @@ var COMMAND_HELP = {
8618
9222
  Worker: ask the coordinator. The phase becomes blocked, the question
8619
9223
  goes on the ticket and in the coordinator's inbox. Then stop and wait
8620
9224
  for the answer in your session, and report the phase you resume
9225
+ `,
9226
+ validate: ` validate [<ticket>] "<what to check>" [--attach <file|url>]... [--caption <text>]
9227
+ [--choices "<a> | <b>"]
9228
+ Ask the owner to validate on Armada's Validations page, with the
9229
+ attachments (images up to 2 MB, HTTPS links). Prints the approval link.
9230
+ Worker: its own ticket; the phase becomes awaiting-validation: stop until
9231
+ the coordinator relays the owner's decision. Coordinator: any ticket.
9232
+ The owner's buttons are Approve and Request changes, or the --choices
9233
+ `,
9234
+ "ask-owner": ` ask-owner <ticket> "<question>" --choices "<a> | <b>"
9235
+ Coordinator: escalate a question or a plan to the owner, with its
9236
+ choices. Prints the approval link; the owner's pick arrives in the inbox
9237
+ `,
9238
+ done: ` done <ticket> Coordinator: close a ticket whose newest validation the owner approved,
9239
+ with no pull request (a design ticket): the design and the owner's note
9240
+ are posted on it, it moves to Done, agent labels removed, session ended
8621
9241
  `,
8622
9242
  inbox: ` inbox [--wait [--timeout <seconds>]]
8623
9243
  Coordinator: open questions, plans, requests, hand-backs and silent workers,
@@ -8640,6 +9260,7 @@ var COMMAND_HELP = {
8640
9260
  Coordinator: record a delivered note; an open plan is resolved
8641
9261
  `,
8642
9262
  merge: ` merge <pr> [--ticket <id> | --no-ticket] [--dry-run] [--no-lock] [--wait [--timeout <min>]]
9263
+ [--reason <why>] [--ask-owner --reason <why>]
8643
9264
  Coordinator: check a handed-back pull request (hand-back SHA = head,
8644
9265
  CLEAN, required checks green, no open review thread, base contained
8645
9266
  or test-merged), squash-merge it pinned to that SHA under the merge
@@ -8652,12 +9273,18 @@ var COMMAND_HELP = {
8652
9273
  is the hand-back with only the base merged in counts as the hand-back.
8653
9274
  --no-ticket: a pull request no ticket owns (armada init, a release);
8654
9275
  nothing is written to Linear.
9276
+ With [policy] merge_approval, judge each pull request: --reason "<why>"
9277
+ merges on its own; --ask-owner --reason "<why>" merges nothing, asks the
9278
+ owner (PR, files, CI, preview, screenshots) and prints the approval link.
9279
+ A pull request the owner was asked about merges only once they approved
9280
+ that exact head (or it with only the base merged in).
8655
9281
  `,
8656
9282
  launch: ` launch revoke <ticket>
8657
9283
  Cancel the newest pending launch through Armada, including a worker
8658
9284
  signed in but not claimed. A claimed launch needs armada release instead
8659
9285
  `,
8660
9286
  brief: ` brief <ticket> [--profile <name> [--reason <why>]] [--prompt [--profile-line]]
9287
+ [--validation none | --validation <n,...> --validation-reason <why>]
8661
9288
  A new worker's launch prompt, the Conductor profile (agent, model,
8662
9289
  effort) and the environment variables to pass, named, never shown.
8663
9290
  The profile follows [[conductor.routing]] on the ticket's labels, then
@@ -8666,7 +9293,9 @@ var COMMAND_HELP = {
8666
9293
  Signed in to Armada, the prompt starts with a one-time launch token, so
8667
9294
  the worker needs no key. --prompt prints only the prompt, for \`--message-file -\`
8668
9295
  Human and --json views mint nothing. --prompt --profile-line also
8669
- prints the profile and its reason on stderr, leaving stdout unchanged
9296
+ prints the profile and its reason on stderr, leaving stdout unchanged.
9297
+ With [[policy.validation]] rules, judge which apply: --validation none,
9298
+ or their numbers and why; the prompt then tells the worker what to show
8670
9299
  `,
8671
9300
  secrets: ` secrets The project's secrets for workers: names, project or organization,
8672
9301
  who set each and when; never a value. Needs a sign-in to Armada
@@ -8709,7 +9338,7 @@ var COMMAND_HELP = {
8709
9338
  auth logout Remove Armada's keys from this machine
8710
9339
  `
8711
9340
  };
8712
- var TICKET_OPTION = new Set(["report", "release", "ask", "merge", "secrets", "run"]);
9341
+ var TICKET_OPTION = new Set(["report", "release", "ask", "validate", "merge", "secrets", "run"]);
8713
9342
  var CONFIG_OPTION = new Set([
8714
9343
  "attach",
8715
9344
  "status",
@@ -8719,6 +9348,9 @@ var CONFIG_OPTION = new Set([
8719
9348
  "report",
8720
9349
  "release",
8721
9350
  "ask",
9351
+ "validate",
9352
+ "ask-owner",
9353
+ "done",
8722
9354
  "inbox",
8723
9355
  "watch",
8724
9356
  "answer",
@@ -8811,7 +9443,11 @@ var VALUE_OPTIONS = [
8811
9443
  "file",
8812
9444
  "from-env",
8813
9445
  "caption",
8814
- "for"
9446
+ "for",
9447
+ "attach",
9448
+ "choices",
9449
+ "validation",
9450
+ "validation-reason"
8815
9451
  ];
8816
9452
  var FLAG_OPTIONS = [
8817
9453
  "background",
@@ -8825,25 +9461,28 @@ var FLAG_OPTIONS = [
8825
9461
  "api-key",
8826
9462
  "no-stop-hook",
8827
9463
  "org",
8828
- "value-stdin"
9464
+ "value-stdin",
9465
+ "ask-owner"
8829
9466
  ];
8830
9467
  var COMMAND_OPTIONS = {
8831
9468
  attach: ["caption", "for"],
8832
9469
  heartbeat: ["every", "parent", "background", "ticket", "handle"],
8833
- claim: ["runtime", "handle", "branch", "profile", "reason"],
9470
+ claim: ["runtime", "handle", "branch", "profile", "reason", "validation", "validation-reason"],
8834
9471
  report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha"],
8835
9472
  release: ["ticket", "reason"],
8836
9473
  ask: ["ticket", "options", "message", "message-file"],
8837
9474
  inbox: ["wait", "timeout"],
8838
9475
  answer: ["note", "message", "message-file"],
8839
9476
  init: ["program-root", "name", "slug", "no-stop-hook"],
8840
- merge: ["ticket", "no-ticket", "dry-run", "no-lock", "wait", "timeout"],
8841
- brief: ["profile", "reason", "prompt", "profile-line"],
9477
+ merge: ["ticket", "no-ticket", "dry-run", "no-lock", "wait", "timeout", "reason", "ask-owner"],
9478
+ brief: ["profile", "reason", "prompt", "profile-line", "validation", "validation-reason"],
9479
+ validate: ["ticket", "attach", "caption", "choices", "message", "message-file"],
9480
+ "ask-owner": ["choices"],
8842
9481
  login: ["api-key", "launch-token", "api-url"],
8843
9482
  secrets: ["ticket", "org", "value-stdin", "from-env", "file", "only"],
8844
9483
  run: ["ticket", "only"]
8845
9484
  };
8846
- var WORKER_COMMANDS = new Set(["claim", "report", "release", "ask"]);
9485
+ var WORKER_COMMANDS = new Set(["claim", "report", "release", "ask", "validate"]);
8847
9486
  function parseArgs(argv) {
8848
9487
  const args = {
8849
9488
  command: null,
@@ -8880,6 +9519,9 @@ function parseArgs(argv) {
8880
9519
  throw new UsageError(`--${name} needs a value`);
8881
9520
  if (name === "config")
8882
9521
  args.config = v;
9522
+ else if (name === "attach" && args.options.attach !== undefined)
9523
+ args.options.attach += `
9524
+ ${v}`;
8883
9525
  else
8884
9526
  args.options[name] = v;
8885
9527
  } else if (a?.startsWith("-"))
@@ -9033,12 +9675,13 @@ async function dispatch(argv, io) {
9033
9675
  });
9034
9676
  return await heartbeat(io, config, credentials, args);
9035
9677
  }
9036
- const worker = { claim, report, release, ask, inbox, answer }[args.command];
9678
+ const worker = { claim, report, release, ask, inbox, answer, validate, "ask-owner": askOwner, done }[args.command];
9037
9679
  if (worker) {
9038
9680
  const { path, text } = await findConfig(io, args.config, args.command);
9039
9681
  const config = parseConfig(text, path);
9040
9682
  const command = args.command;
9041
- const scope = WORKER_COMMANDS.has(command) ? {
9683
+ const workerScope = WORKER_COMMANDS.has(command) && !(command === "validate" && namedTicket(args.rest, args.options));
9684
+ const scope = workerScope ? {
9042
9685
  command,
9043
9686
  project: config.project.slug,
9044
9687
  ticket: (stored) => command === "claim" ? args.rest[0]?.toUpperCase() ?? null : currentTicket(io, config, args.options.ticket, stored)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",