@the-vibe-company/armada 0.2.48 → 0.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/armada.js +91 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,7 +219,7 @@ armada merge 35 --no-ticket # a pull request no ticket owns: armada init's, a re
|
|
|
219
219
|
- A head that lacks commits of its base branch is refused, unless `[gates] local_commands` is set: then the head is merged into the base in a throwaway `git worktree`, the commands run there, and the worktree is removed.
|
|
220
220
|
- `--wait [--timeout <min>]` (30 minutes by default) keeps going until the pull request merges or a real refusal. A head behind its base that GitHub says merges cleanly is updated with GitHub's "update branch" (a merge commit, no force-push), and every required check is waited for on the new head; when the base does not require heads up to date and `[gates] local_commands` is set, it is test-merged instead. A red check, a conflict, any other refused rule, or GitHub refusing the update (a protected branch) or not applying it within 3 minutes stops it and says which. The merge lock is held only while merging, never while waiting; signed in with Armada down, it refuses before touching the branch.
|
|
221
221
|
- A head that is the handed-back SHA followed only by merge commits of the base still counts as the hand-back: each merge commit's first parent is the commit before it, its second parent is on the base branch, and its tree is the clean merge of the two (`git merge-tree`). The merged comment then names both heads (`head <new>, the handed-back <old> updated with main`).
|
|
222
|
-
- `--no-ticket` merges a pull request no ticket owns (`armada init` prints the command for its own): no hand-back, nothing written to Linear, every other check unchanged, pinned to the head it checked.
|
|
222
|
+
- `--no-ticket` merges a pull request no ticket owns (`armada init` prints the command for its own): no hand-back, nothing written to Linear, every other check unchanged, pinned to the head it checked. A branch that names a ticket of the program is refused unless you add `--reason "<why the ticket stays open>"`: the reason is posted on the PR before merging, and its ticket and worker stay unchanged. These overrides require the configured CI checks; they do not use the release exception below. When none of the required checks ran on the head (a release pull request opened with the workflow's token), it passes with a note once the head is a minute old (never a head this run updated), `UNSTABLE` included when nothing failed.
|
|
223
223
|
- GitHub's `HAS_HOOKS` (mergeable, with pre-receive hooks) counts as `CLEAN`.
|
|
224
224
|
- Hints, never blocking: top-level functions, classes, types and constants the pull request removes or renames that the base branch still uses in files the pull request does not touch.
|
|
225
225
|
- One merge at a time per project: a `merge` lease taken through Armada (20 minutes, renewed before the merge, atomic on its database and timed by its clock) makes a second coordinator wait. When the terminal is signed in but Armada is unreachable the merge is refused; `--no-lock` forces it, with a warning and "merged without lock" in the ticket's merged comment. Not signed in at all (one coordinator) the merge runs unlocked with a warning.
|
package/dist/armada.js
CHANGED
|
@@ -11,6 +11,7 @@ import { isatty } from "node:tty";
|
|
|
11
11
|
import { dirname as dirname9, join as join9, resolve as resolve3 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../core/src/types.ts
|
|
14
|
+
var isShippingStage = (value) => value === "review" || value === "ci";
|
|
14
15
|
var LABEL_PHASES = [
|
|
15
16
|
"planning",
|
|
16
17
|
"awaiting-approval",
|
|
@@ -862,6 +863,11 @@ var latest = (...xs) => xs.filter((x) => !!x).reduce((a, b) => b > a ? b : a, ""
|
|
|
862
863
|
function workerLivenessAt(worker) {
|
|
863
864
|
return latest(worker.lastHeartbeat, worker.lastReport) || worker.lastUpdate;
|
|
864
865
|
}
|
|
866
|
+
function deriveShippingStage(pr) {
|
|
867
|
+
if (pr?.state !== "open")
|
|
868
|
+
return null;
|
|
869
|
+
return pr.ci && pr.ci !== "none" || pr.checks?.some((c) => c.state !== "none") ? "ci" : "review";
|
|
870
|
+
}
|
|
865
871
|
function inferPhase(pr, comments) {
|
|
866
872
|
if (pr?.state === "open")
|
|
867
873
|
return pr.ci === "success" && pr.mergeable !== "CONFLICTING" ? "ready-to-merge" : "shipping";
|
|
@@ -902,6 +908,11 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
902
908
|
const shippingPhase = phase === "shipping" || phase === "ready-to-merge";
|
|
903
909
|
if (pr?.state === "merged" && !isDone(issue) && (shippingPhase || phaseSource === "status-line" || phaseSource === "inferred"))
|
|
904
910
|
phase = "merged";
|
|
911
|
+
const event = opts.live?.events[issue.id];
|
|
912
|
+
const claimedAt = opts.live?.handles?.[issue.id]?.claimedAt ?? claims.at(-1)?.at;
|
|
913
|
+
const leftShipping = comments.find((c) => c.status && c.status.phase !== "shipping");
|
|
914
|
+
const explicitStage = (event?.kind === "report" || event?.kind === "claim") && event.phase === "shipping" && (!claimedAt || event.at >= claimedAt) && (!leftShipping || event.at >= leftShipping.createdAt) ? event.shippingStage : null;
|
|
915
|
+
const shippingStage = phase === "shipping" ? explicitStage ?? deriveShippingStage(pr) : null;
|
|
905
916
|
let announcing;
|
|
906
917
|
for (const c of comments) {
|
|
907
918
|
if (!c.status || c.status.phase === "released")
|
|
@@ -941,6 +952,7 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
941
952
|
spec: spec ? `Spec ${spec.ordinal}` : null,
|
|
942
953
|
phase,
|
|
943
954
|
phaseSource,
|
|
955
|
+
shippingStage,
|
|
944
956
|
runtime: issue.agentRuntime ?? claimRuntime ?? fresh?.runtime ?? opts.live?.handles?.[issue.id]?.runtime ?? null,
|
|
945
957
|
handle: opts.live?.handles?.[issue.id]?.handle ?? claims[0]?.session ?? fresh?.handle ?? null,
|
|
946
958
|
claim: claims[0] ?? null,
|
|
@@ -3481,6 +3493,8 @@ function resolvePr(ticket, repository, pr) {
|
|
|
3481
3493
|
async function reportPhase(ctx, input) {
|
|
3482
3494
|
const { config, linear } = ctx;
|
|
3483
3495
|
const groups = config.tracker.labels;
|
|
3496
|
+
if (input.stage != null && (input.phase !== "shipping" || !isShippingStage(input.stage)))
|
|
3497
|
+
throw new Refusal("--stage is for shipping: use review or ci", 'armada report shipping --stage review|ci --message "<progress>"');
|
|
3484
3498
|
const ticket = await readOpenTicket(ctx, input.ticket);
|
|
3485
3499
|
const problem = transitionProblem(ticket.agentPhase, input.phase);
|
|
3486
3500
|
if (problem)
|
|
@@ -3553,6 +3567,7 @@ ${body}` : statusLine);
|
|
|
3553
3567
|
const inbox = await live(ctx, warnings, "record the report", (fleet) => fleet.report({
|
|
3554
3568
|
ticket: ticket.id,
|
|
3555
3569
|
phase: input.phase,
|
|
3570
|
+
shippingStage: isShippingStage(input.stage) ? input.stage : null,
|
|
3556
3571
|
previous: ticket.agentPhase,
|
|
3557
3572
|
summary,
|
|
3558
3573
|
message: plan ? [summary, body].join(`
|
|
@@ -4538,6 +4553,7 @@ var FLEET_OPS = [
|
|
|
4538
4553
|
"coordinator",
|
|
4539
4554
|
"request",
|
|
4540
4555
|
"events/latest",
|
|
4556
|
+
"events/state",
|
|
4541
4557
|
"heartbeats/latest",
|
|
4542
4558
|
"runtime/handles",
|
|
4543
4559
|
"runtime/handle",
|
|
@@ -4569,6 +4585,7 @@ function fleetClient(o) {
|
|
|
4569
4585
|
register: () => call("register", {}).then(() => {
|
|
4570
4586
|
return;
|
|
4571
4587
|
}),
|
|
4588
|
+
latestEvents: () => call("events/state", {}),
|
|
4572
4589
|
lastEventTimes: () => call("events/latest", {}),
|
|
4573
4590
|
heartbeatTimes: () => call("heartbeats/latest", {}),
|
|
4574
4591
|
heartbeat: (input) => call("heartbeat", input),
|
|
@@ -5511,7 +5528,15 @@ var STATE_HELP = {
|
|
|
5511
5528
|
UNSTABLE: "a check that is not required is failing"
|
|
5512
5529
|
};
|
|
5513
5530
|
var stateLine = (pull) => `GitHub reports #${pull.number} as ${pull.mergeStateStatus}, not CLEAN${STATE_HELP[pull.mergeStateStatus] ? `: ${STATE_HELP[pull.mergeStateStatus]}` : ""}`;
|
|
5514
|
-
function assess({
|
|
5531
|
+
function assess({
|
|
5532
|
+
pull,
|
|
5533
|
+
ticket,
|
|
5534
|
+
handBack,
|
|
5535
|
+
requiredChecks,
|
|
5536
|
+
requireChecks,
|
|
5537
|
+
lineage,
|
|
5538
|
+
now
|
|
5539
|
+
}) {
|
|
5515
5540
|
const n = `#${pull.number}`;
|
|
5516
5541
|
const problems = [];
|
|
5517
5542
|
const waits = [];
|
|
@@ -5539,7 +5564,7 @@ function assess({ pull, ticket, handBack, requiredChecks, lineage, now }) {
|
|
|
5539
5564
|
problems.push(`${n} is a draft`);
|
|
5540
5565
|
if (!COMMITIZEN_TITLE.test(pull.title))
|
|
5541
5566
|
problems.push(`the title "${pull.title}" is not in Commitizen format, e.g. "feat(cli): add a command"`);
|
|
5542
|
-
const checks = checkStates(pull, requiredChecks, !ticket && !lineage?.updates, now);
|
|
5567
|
+
const checks = checkStates(pull, requiredChecks, !ticket && !requireChecks && !lineage?.updates, now);
|
|
5543
5568
|
problems.push(...checks.failed);
|
|
5544
5569
|
waits.push(...checks.pending);
|
|
5545
5570
|
notes.push(...checks.notes);
|
|
@@ -5704,14 +5729,19 @@ async function readSettled(ctx, number) {
|
|
|
5704
5729
|
throw new Refusal(`pull request #${number} was not found in ${ctx.config.github.repository}`, "armada status, which lists the pull requests waiting");
|
|
5705
5730
|
return pull;
|
|
5706
5731
|
}
|
|
5732
|
+
var mergeReason = (input) => input.reason?.replace(/\s+/g, " ").trim() || null;
|
|
5733
|
+
function programTicket(config, pull) {
|
|
5734
|
+
const named = pull.headRef ? ticketFromBranch(pull.headRef, config.tracker.programRoot) : null;
|
|
5735
|
+
const team = config.tracker.programRoot.split("-")[0]?.toUpperCase();
|
|
5736
|
+
return named && named.split("-")[0] === team ? named : null;
|
|
5737
|
+
}
|
|
5707
5738
|
async function readTicketFor(ctx, pull, input) {
|
|
5708
5739
|
const named = pull.headRef ? ticketFromBranch(pull.headRef, ctx.config.tracker.programRoot) : null;
|
|
5709
5740
|
if (input.noTicket) {
|
|
5710
5741
|
if (input.ticket)
|
|
5711
5742
|
throw new Refusal("--no-ticket and --ticket cannot go together", `armada merge ${pull.number}`);
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
throw new Refusal(`the branch of #${pull.number} (${pull.headRef}) names ${named}: merge it on its worker's hand-back, not with --no-ticket`, `armada merge ${pull.number}`);
|
|
5743
|
+
if (programTicket(ctx.config, pull) && !mergeReason(input))
|
|
5744
|
+
throw new Refusal(`the branch of #${pull.number} (${pull.headRef}) names ${named}: merge it on its worker's hand-back, or use --no-ticket --reason "<why the ticket stays open>"`, `armada merge ${pull.number}, or armada merge ${pull.number} --no-ticket --reason "<why the ticket stays open>"`);
|
|
5715
5745
|
return null;
|
|
5716
5746
|
}
|
|
5717
5747
|
const id = input.ticket?.trim().toUpperCase() || named;
|
|
@@ -5777,6 +5807,7 @@ async function look(ctx, input, run) {
|
|
|
5777
5807
|
ticket,
|
|
5778
5808
|
handBack,
|
|
5779
5809
|
requiredChecks: ctx.config.gates.requiredChecks,
|
|
5810
|
+
requireChecks: !!input.noTicket && !!programTicket(ctx.config, pull),
|
|
5780
5811
|
lineage,
|
|
5781
5812
|
now: ctx.now()
|
|
5782
5813
|
});
|
|
@@ -5887,7 +5918,7 @@ ${problems.map((p) => ` - ${p}`).join(`
|
|
|
5887
5918
|
async function ownerDecision(ctx, input, c, dryRun) {
|
|
5888
5919
|
const n = c.pull.number;
|
|
5889
5920
|
const rule = c.ticket ? ctx.config.policy.mergeApproval ?? null : null;
|
|
5890
|
-
const reason = input
|
|
5921
|
+
const reason = mergeReason(input);
|
|
5891
5922
|
const lines = rule ? [`Merge rule (armada.toml [policy] merge_approval): "${rule}"`] : [];
|
|
5892
5923
|
let approval = { state: "none" };
|
|
5893
5924
|
let unreadable = null;
|
|
@@ -6155,6 +6186,17 @@ async function locked(ctx, input, run) {
|
|
|
6155
6186
|
const handBacks = c.ticket ? await live(ctx, c.warnings, "read the hand-back for merge recovery", (fleet) => fleet.ticketItems(c.ticket?.id ?? "")) : null;
|
|
6156
6187
|
const handBackId = handBacks?.find((item) => item.kind === "hand-back")?.id ?? null;
|
|
6157
6188
|
await recheck(ctx, input, run, c);
|
|
6189
|
+
const reason = input.noTicket ? mergeReason(input) : null;
|
|
6190
|
+
if (reason) {
|
|
6191
|
+
const named = programTicket(config, c.pull);
|
|
6192
|
+
const body = `Armada merge --no-ticket at ${c.sha}: ${reason}.${named ? ` ${named} stays open; its ticket and worker are left unchanged.` : " No ticket is closed."}`;
|
|
6193
|
+
try {
|
|
6194
|
+
await ctx.forge.comment(c.pull.number, body);
|
|
6195
|
+
} catch (err) {
|
|
6196
|
+
throw new Refusal(`could not record the --no-ticket reason on #${c.pull.number} (${err instanceof Error ? err.message : String(err)}); nothing was merged`, `armada merge ${input.pr} --no-ticket --reason "<why the ticket stays open>" again once GitHub answers`);
|
|
6197
|
+
}
|
|
6198
|
+
c.lines.push(`Recorded --no-ticket reason on #${c.pull.number}: ${reason}`);
|
|
6199
|
+
}
|
|
6158
6200
|
if (!await renew())
|
|
6159
6201
|
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`);
|
|
6160
6202
|
say(ctx, `Merging #${c.pull.number} at ${c.sha}…`);
|
|
@@ -6309,7 +6351,7 @@ var skills_generated_default = [
|
|
|
6309
6351
|
files: [
|
|
6310
6352
|
{
|
|
6311
6353
|
path: "MERGE.md",
|
|
6312
|
-
content: "# 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.
|
|
6354
|
+
content: "# 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. A branch that names a ticket of the program is refused unless you add `--reason \"<why the ticket stays open>\"`. Use that override for partial or configuration work that must land before the ticket is done: it requires the configured CI checks, posts the reason on the PR before merging, and leaves the ticket and its worker unchanged. A failed reason comment refuses the merge; `--dry-run` posts nothing.\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"
|
|
6313
6355
|
},
|
|
6314
6356
|
{
|
|
6315
6357
|
path: "SKILL.md",
|
|
@@ -6551,7 +6593,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
6551
6593
|
2. **Branch.** Use the branch named after the ticket (the tracker suggests one, for example \`feature/abc-12-short-title\`), created from the latest default branch.
|
|
6552
6594
|
3. **Plan.** Write the plan: what changes, how it is tested, and the checks a person could observe when it is done. Your brief's "Plan" section says in one line whether it needs approval (from \`[policy] plans\` in \`armada.toml\`, or a label on the ticket); follow that line, do not guess. Pre-approved: post the plan with \`armada report implementing --plan-file -\` (or \`--plan-file <path>\`) and go on; do not enter \`awaiting-approval\`. Otherwise post it with \`armada report awaiting-approval --plan-file -\`: it creates a \`plan\` item in the coordinator's inbox. \`--plan-file\` posts the plan as its own block, under a one-line status (\`--message\` sets that line, else the plan's first line). Push your branch and wait for the coordinator's decision in your session. On approval, report \`implementing\`; on amendments, report \`planning\`, revise the plan and submit it for approval again.
|
|
6553
6595
|
4. **Implement** test-first. A material change to the approved plan needs a new approval.
|
|
6554
|
-
5. **Ship.** \`armada report shipping --pr <number
|
|
6596
|
+
5. **Ship.** \`armada report shipping --pr <number> --message "Preparing the pull request for independent review"\`. Use the bundled \`ship-pr-dev\` skill by default, including its independent \`review-code-dev\` gate and report-only \`capture-learning-tools\` pass. At the independent \`review-code-dev\` review gate, report \`armada report shipping --stage review --pr <number> --message "Independent code review started"\` (omit \`--pr\` if no PR is open yet). Once that review passes, report \`armada report shipping --stage ci --pr <number> --message "Independent review passed; checking CI"\`. Report \`review\` again when changes need another independent review, and \`ci\` after it passes. Keep \`--stage review|ci\` on repeated shipping reports so the current step stays explicit. These stages are Armada data, not Linear labels; other phases do not take \`--stage\`. Within that workflow you own delivery (Git and the PR); its delegated helpers are its workers. The Armada coordinator still owns merging. If it cannot run (for example the OCR download or isolated reviewer is unavailable), record the exact limitation and use the fallback: run the repository's local checks, open the pull request with a Commitizen title (\`feat(scope): …\`), link it on the ticket, and fix CI until every required check is green.
|
|
6555
6597
|
6. **Bring the default branch in** right before hand-back (rebase, or merge it into your branch; squash merges make both fine), and get CI green on that final head. Never force-push a branch someone else pushed to.
|
|
6556
6598
|
7. **Hand back.** \`armada report ready-to-merge --pr <number> --sha <full 40-character head SHA> --shipped-with "ship-pr-dev"\`. For the fallback, use \`--shipped-with "fallback: <exact reason ship-pr-dev could not run>"\`. The generated hand-back line names the shipping path in Linear and \`armada inbox\`. Armada refuses a short SHA, a SHA that is not the pull request head, or a red check. Then report to the coordinator: \`shipped with ship-pr-dev\` or \`shipped with the fallback: <reason>\`, pull request URL, full SHA, CI state, the decisions you made, and what the next tickets need to know.
|
|
6557
6599
|
|
|
@@ -10216,6 +10258,7 @@ function buildStatus({
|
|
|
10216
10258
|
...heartbeats ? { heartbeats } : {},
|
|
10217
10259
|
...live ? { live } : {}
|
|
10218
10260
|
});
|
|
10261
|
+
const stageOf = new Map(lanes.map((l) => [l.issue.id, l.shippingStage ?? null]));
|
|
10219
10262
|
const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
|
|
10220
10263
|
const prRef = (p) => ({
|
|
10221
10264
|
files: p.files ?? null,
|
|
@@ -10257,6 +10300,7 @@ function buildStatus({
|
|
|
10257
10300
|
url: l.issue.url,
|
|
10258
10301
|
spec: l.spec,
|
|
10259
10302
|
phase: l.phase,
|
|
10303
|
+
shippingStage: l.shippingStage ?? null,
|
|
10260
10304
|
phaseSource: l.phaseSource,
|
|
10261
10305
|
runtime: l.runtime,
|
|
10262
10306
|
handle: l.handle,
|
|
@@ -10301,7 +10345,11 @@ function buildStatus({
|
|
|
10301
10345
|
updatedAt: pr.updatedAt ?? null,
|
|
10302
10346
|
failingChecks: (pr.checks ?? []).filter((c) => c.state === "failure").map((c) => c.name),
|
|
10303
10347
|
branch: pr.headRef ?? null,
|
|
10304
|
-
ticket: ticket ? {
|
|
10348
|
+
ticket: ticket ? {
|
|
10349
|
+
id: ticket.id,
|
|
10350
|
+
phase: phaseOf.get(ticket.id) ?? ticket.agentPhase,
|
|
10351
|
+
shippingStage: stageOf.get(ticket.id) ?? null
|
|
10352
|
+
} : null
|
|
10305
10353
|
})) : null,
|
|
10306
10354
|
warnings: [...program.warnings, ...forge?.warnings ?? [], ...extraWarnings]
|
|
10307
10355
|
};
|
|
@@ -10336,7 +10384,7 @@ async function loadStatus(config, opts) {
|
|
|
10336
10384
|
const launchesP = opts.launches ? opts.launches().then((launches) => ({ launches }), (err) => ({
|
|
10337
10385
|
warning: `Armada's launches could not be read (${err instanceof Error ? err.message : String(err)}); workers launched that never started are not listed`
|
|
10338
10386
|
})) : Promise.resolve({});
|
|
10339
|
-
const [{ program, forge, forgeError }, events, launches, heartbeats, runtimeHandles] = await Promise.all([
|
|
10387
|
+
const [{ program, forge, forgeError }, events, launches, heartbeats, runtimeHandles, latestEvents] = await Promise.all([
|
|
10340
10388
|
readStatusSources(config, opts),
|
|
10341
10389
|
eventsP,
|
|
10342
10390
|
launchesP,
|
|
@@ -10345,6 +10393,9 @@ async function loadStatus(config, opts) {
|
|
|
10345
10393
|
}),
|
|
10346
10394
|
opts.runtimeHandles?.().catch(() => {
|
|
10347
10395
|
return;
|
|
10396
|
+
}),
|
|
10397
|
+
opts.latestEvents?.().catch(() => {
|
|
10398
|
+
return;
|
|
10348
10399
|
})
|
|
10349
10400
|
]);
|
|
10350
10401
|
return buildStatus({
|
|
@@ -10354,11 +10405,11 @@ async function loadStatus(config, opts) {
|
|
|
10354
10405
|
forgeError,
|
|
10355
10406
|
...events.events ? { lastEvents: events.events } : {},
|
|
10356
10407
|
...heartbeats ? { heartbeats } : {},
|
|
10357
|
-
...runtimeHandles ? {
|
|
10408
|
+
...runtimeHandles || latestEvents ? {
|
|
10358
10409
|
live: {
|
|
10359
10410
|
after: program.fetchedAt,
|
|
10360
|
-
events: {},
|
|
10361
|
-
handles: Object.fromEntries(runtimeHandles.map((h) => [h.ticket, h]))
|
|
10411
|
+
events: latestEvents ?? {},
|
|
10412
|
+
handles: Object.fromEntries((runtimeHandles ?? []).map((h) => [h.ticket, h]))
|
|
10362
10413
|
}
|
|
10363
10414
|
} : {},
|
|
10364
10415
|
...launches.launches ? { launches: launches.launches } : {},
|
|
@@ -10491,7 +10542,7 @@ ${attachments.join(`
|
|
|
10491
10542
|
};
|
|
10492
10543
|
}
|
|
10493
10544
|
// package.json
|
|
10494
|
-
var version = "0.2.
|
|
10545
|
+
var version = "0.2.50";
|
|
10495
10546
|
|
|
10496
10547
|
// src/attach.ts
|
|
10497
10548
|
import { resolve } from "node:path";
|
|
@@ -11849,6 +11900,7 @@ function statusLive(io, config, credentials) {
|
|
|
11849
11900
|
const { fleet } = liveFleet(io, config, credentials);
|
|
11850
11901
|
return fleet ? {
|
|
11851
11902
|
lastEvents: () => fleet.lastEventTimes(),
|
|
11903
|
+
latestEvents: () => fleet.latestEvents(),
|
|
11852
11904
|
heartbeats: () => fleet.heartbeatTimes(),
|
|
11853
11905
|
launches: () => fleet.pendingLaunches(),
|
|
11854
11906
|
runtimeHandles: () => observeHerdr(io, fleet)
|
|
@@ -12003,6 +12055,7 @@ async function report(io, config, credentials, a) {
|
|
|
12003
12055
|
return withContext(io, config, credentials, a.json, (ctx) => reportPhase(ctx, {
|
|
12004
12056
|
ticket,
|
|
12005
12057
|
phase,
|
|
12058
|
+
stage: a.options.stage ?? null,
|
|
12006
12059
|
message,
|
|
12007
12060
|
plan,
|
|
12008
12061
|
pr: a.options.pr ?? null,
|
|
@@ -14249,8 +14302,6 @@ async function merge(io, config, credentials, a, configPath) {
|
|
|
14249
14302
|
throw new UsageError("--ask-owner only asks the owner: it goes with --reason (and --ticket), nothing else");
|
|
14250
14303
|
if (askOwner && !a.options.reason?.trim())
|
|
14251
14304
|
throw new UsageError(`--ask-owner needs --reason: armada merge ${number} --ask-owner --reason "<why the owner must see it>"`);
|
|
14252
|
-
if (noTicket && a.options.reason !== undefined)
|
|
14253
|
-
throw new UsageError("--reason judges a ticket's merge; --no-ticket has none");
|
|
14254
14305
|
if (wait && a.options["dry-run"])
|
|
14255
14306
|
throw new UsageError("--wait and --dry-run cannot go together");
|
|
14256
14307
|
if (!wait && a.options.timeout !== undefined)
|
|
@@ -14279,6 +14330,19 @@ async function merge(io, config, credentials, a, configPath) {
|
|
|
14279
14330
|
compare: (base, head) => fetchComparison({ ...gh, base, head }),
|
|
14280
14331
|
diff: (n) => fetchPullDiff({ ...gh, number: n }),
|
|
14281
14332
|
merge: ghMerge(exec, repoDir, config.github.repository),
|
|
14333
|
+
comment: async (number, body) => {
|
|
14334
|
+
const result = await ghAttempt(exec, repoDir, [
|
|
14335
|
+
"pr",
|
|
14336
|
+
"comment",
|
|
14337
|
+
String(number),
|
|
14338
|
+
"--repo",
|
|
14339
|
+
config.github.repository,
|
|
14340
|
+
"--body",
|
|
14341
|
+
body
|
|
14342
|
+
]);
|
|
14343
|
+
if (!result.ok)
|
|
14344
|
+
throw new Error(result.message);
|
|
14345
|
+
},
|
|
14282
14346
|
commit: (sha) => fetchCommit({ ...gh, sha }),
|
|
14283
14347
|
updateBranch: ghUpdateBranch(exec, repoDir, config.github.repository),
|
|
14284
14348
|
preview: (sha) => fetchPreview({ ...gh, sha })
|
|
@@ -14380,7 +14444,10 @@ function prState(pr) {
|
|
|
14380
14444
|
pr.mergeable ? MERGEABLE[pr.mergeable] ?? pr.mergeable.toLowerCase() : null
|
|
14381
14445
|
].filter(Boolean).join(" · ");
|
|
14382
14446
|
}
|
|
14383
|
-
var phaseLabel = (t) =>
|
|
14447
|
+
var phaseLabel = (t) => {
|
|
14448
|
+
const phase = `${t.phase}${t.shippingStage ? ` · ${t.shippingStage}` : ""}`;
|
|
14449
|
+
return t.phaseSource === "label" ? phase : `${phase} (${t.phaseSource})`;
|
|
14450
|
+
};
|
|
14384
14451
|
function renderStatus(r) {
|
|
14385
14452
|
const now = Date.parse(r.generatedAt);
|
|
14386
14453
|
const out = [];
|
|
@@ -14444,7 +14511,7 @@ function renderStatus(r) {
|
|
|
14444
14511
|
else if (!r.pullRequests.length)
|
|
14445
14512
|
out.push(" none open");
|
|
14446
14513
|
for (const p of r.pullRequests ?? []) {
|
|
14447
|
-
const ticket = p.ticket ? `${p.ticket.id}${p.ticket.phase ? ` ${p.ticket.phase}` : ""}` : "no ticket";
|
|
14514
|
+
const ticket = p.ticket ? `${p.ticket.id}${p.ticket.phase ? ` ${p.ticket.phase}${p.ticket.shippingStage ? ` · ${p.ticket.shippingStage}` : ""}` : ""}` : "no ticket";
|
|
14448
14515
|
out.push(` ${pad(`#${p.number}`, idWidth)} ${[ticket, prState(p)].filter(Boolean).join(" · ")}`);
|
|
14449
14516
|
out.push(`${indent}${truncate(p.title, 90)}`);
|
|
14450
14517
|
if (p.failingChecks.length)
|
|
@@ -14886,7 +14953,7 @@ var COMMAND_HELP = {
|
|
|
14886
14953
|
rules the coordinator judged apply. Prints the ticket's state afterwards
|
|
14887
14954
|
`,
|
|
14888
14955
|
report: ` report <phase> [--message <text> | --message-file <path|->] [--pr <n|url>] [--sha <sha>]
|
|
14889
|
-
[--plan <text> | --plan-file <path|->] [--shipped-with "ship-pr-dev"|"fallback: <reason>"]
|
|
14956
|
+
[--plan <text> | --plan-file <path|->] [--shipped-with "ship-pr-dev"|"fallback: <reason>"] [--stage review|ci]
|
|
14890
14957
|
Report a phase (planning, awaiting-approval, implementing, shipping,
|
|
14891
14958
|
blocked, ready-to-merge, awaiting-validation); the same phase again is a
|
|
14892
14959
|
status update; armada validate is how a worker enters awaiting-validation.
|
|
@@ -14894,6 +14961,7 @@ var COMMAND_HELP = {
|
|
|
14894
14961
|
message's first line, else the plan's); awaiting-approval sends it to
|
|
14895
14962
|
the coordinator's inbox.
|
|
14896
14963
|
ready-to-merge needs --sha (full 40 characters, the PR head) and green CI.
|
|
14964
|
+
--stage is shipping only: review at independent review, ci after it passes.
|
|
14897
14965
|
--shipped-with names the shipping path in its hand-back and inbox.
|
|
14898
14966
|
Prints the ticket's state and what waits in this worker's inbox.
|
|
14899
14967
|
`,
|
|
@@ -14960,7 +15028,8 @@ var COMMAND_HELP = {
|
|
|
14960
15028
|
for, without the lock; a red check or a conflict stops it. A head that
|
|
14961
15029
|
is the hand-back with only the base merged in counts as the hand-back.
|
|
14962
15030
|
--no-ticket: a pull request no ticket owns (armada init, a release);
|
|
14963
|
-
|
|
15031
|
+
on a ticket-named branch, --reason is required and posted on the PR;
|
|
15032
|
+
the ticket and its worker stay unchanged, with nothing written to Linear.
|
|
14964
15033
|
With [policy] merge_approval, judge each pull request: --reason "<why>"
|
|
14965
15034
|
merges on its own; --ask-owner --reason "<why>" merges nothing, asks the
|
|
14966
15035
|
owner (PR, files, CI, preview, screenshots) and prints the approval link.
|
|
@@ -15133,6 +15202,7 @@ var VALUE_OPTIONS = [
|
|
|
15133
15202
|
"pr",
|
|
15134
15203
|
"sha",
|
|
15135
15204
|
"shipped-with",
|
|
15205
|
+
"stage",
|
|
15136
15206
|
"reason",
|
|
15137
15207
|
"program-root",
|
|
15138
15208
|
"name",
|
|
@@ -15172,7 +15242,7 @@ var COMMAND_OPTIONS = {
|
|
|
15172
15242
|
attach: ["caption", "for"],
|
|
15173
15243
|
heartbeat: ["every", "parent", "background", "ticket", "handle"],
|
|
15174
15244
|
claim: ["runtime", "handle", "branch", "profile", "reason", "validation", "validation-reason"],
|
|
15175
|
-
report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha", "shipped-with"],
|
|
15245
|
+
report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha", "shipped-with", "stage"],
|
|
15176
15246
|
release: ["ticket", "reason"],
|
|
15177
15247
|
ask: ["ticket", "options", "message", "message-file"],
|
|
15178
15248
|
inbox: ["wait", "timeout"],
|