@the-vibe-company/armada 0.2.49 → 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/dist/armada.js +44 -11
- package/package.json +1 -1
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),
|
|
@@ -6576,7 +6593,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
6576
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.
|
|
6577
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.
|
|
6578
6595
|
4. **Implement** test-first. A material change to the approved plan needs a new approval.
|
|
6579
|
-
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.
|
|
6580
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.
|
|
6581
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.
|
|
6582
6599
|
|
|
@@ -10241,6 +10258,7 @@ function buildStatus({
|
|
|
10241
10258
|
...heartbeats ? { heartbeats } : {},
|
|
10242
10259
|
...live ? { live } : {}
|
|
10243
10260
|
});
|
|
10261
|
+
const stageOf = new Map(lanes.map((l) => [l.issue.id, l.shippingStage ?? null]));
|
|
10244
10262
|
const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
|
|
10245
10263
|
const prRef = (p) => ({
|
|
10246
10264
|
files: p.files ?? null,
|
|
@@ -10282,6 +10300,7 @@ function buildStatus({
|
|
|
10282
10300
|
url: l.issue.url,
|
|
10283
10301
|
spec: l.spec,
|
|
10284
10302
|
phase: l.phase,
|
|
10303
|
+
shippingStage: l.shippingStage ?? null,
|
|
10285
10304
|
phaseSource: l.phaseSource,
|
|
10286
10305
|
runtime: l.runtime,
|
|
10287
10306
|
handle: l.handle,
|
|
@@ -10326,7 +10345,11 @@ function buildStatus({
|
|
|
10326
10345
|
updatedAt: pr.updatedAt ?? null,
|
|
10327
10346
|
failingChecks: (pr.checks ?? []).filter((c) => c.state === "failure").map((c) => c.name),
|
|
10328
10347
|
branch: pr.headRef ?? null,
|
|
10329
|
-
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
|
|
10330
10353
|
})) : null,
|
|
10331
10354
|
warnings: [...program.warnings, ...forge?.warnings ?? [], ...extraWarnings]
|
|
10332
10355
|
};
|
|
@@ -10361,7 +10384,7 @@ async function loadStatus(config, opts) {
|
|
|
10361
10384
|
const launchesP = opts.launches ? opts.launches().then((launches) => ({ launches }), (err) => ({
|
|
10362
10385
|
warning: `Armada's launches could not be read (${err instanceof Error ? err.message : String(err)}); workers launched that never started are not listed`
|
|
10363
10386
|
})) : Promise.resolve({});
|
|
10364
|
-
const [{ program, forge, forgeError }, events, launches, heartbeats, runtimeHandles] = await Promise.all([
|
|
10387
|
+
const [{ program, forge, forgeError }, events, launches, heartbeats, runtimeHandles, latestEvents] = await Promise.all([
|
|
10365
10388
|
readStatusSources(config, opts),
|
|
10366
10389
|
eventsP,
|
|
10367
10390
|
launchesP,
|
|
@@ -10370,6 +10393,9 @@ async function loadStatus(config, opts) {
|
|
|
10370
10393
|
}),
|
|
10371
10394
|
opts.runtimeHandles?.().catch(() => {
|
|
10372
10395
|
return;
|
|
10396
|
+
}),
|
|
10397
|
+
opts.latestEvents?.().catch(() => {
|
|
10398
|
+
return;
|
|
10373
10399
|
})
|
|
10374
10400
|
]);
|
|
10375
10401
|
return buildStatus({
|
|
@@ -10379,11 +10405,11 @@ async function loadStatus(config, opts) {
|
|
|
10379
10405
|
forgeError,
|
|
10380
10406
|
...events.events ? { lastEvents: events.events } : {},
|
|
10381
10407
|
...heartbeats ? { heartbeats } : {},
|
|
10382
|
-
...runtimeHandles ? {
|
|
10408
|
+
...runtimeHandles || latestEvents ? {
|
|
10383
10409
|
live: {
|
|
10384
10410
|
after: program.fetchedAt,
|
|
10385
|
-
events: {},
|
|
10386
|
-
handles: Object.fromEntries(runtimeHandles.map((h) => [h.ticket, h]))
|
|
10411
|
+
events: latestEvents ?? {},
|
|
10412
|
+
handles: Object.fromEntries((runtimeHandles ?? []).map((h) => [h.ticket, h]))
|
|
10387
10413
|
}
|
|
10388
10414
|
} : {},
|
|
10389
10415
|
...launches.launches ? { launches: launches.launches } : {},
|
|
@@ -10516,7 +10542,7 @@ ${attachments.join(`
|
|
|
10516
10542
|
};
|
|
10517
10543
|
}
|
|
10518
10544
|
// package.json
|
|
10519
|
-
var version = "0.2.
|
|
10545
|
+
var version = "0.2.50";
|
|
10520
10546
|
|
|
10521
10547
|
// src/attach.ts
|
|
10522
10548
|
import { resolve } from "node:path";
|
|
@@ -11874,6 +11900,7 @@ function statusLive(io, config, credentials) {
|
|
|
11874
11900
|
const { fleet } = liveFleet(io, config, credentials);
|
|
11875
11901
|
return fleet ? {
|
|
11876
11902
|
lastEvents: () => fleet.lastEventTimes(),
|
|
11903
|
+
latestEvents: () => fleet.latestEvents(),
|
|
11877
11904
|
heartbeats: () => fleet.heartbeatTimes(),
|
|
11878
11905
|
launches: () => fleet.pendingLaunches(),
|
|
11879
11906
|
runtimeHandles: () => observeHerdr(io, fleet)
|
|
@@ -12028,6 +12055,7 @@ async function report(io, config, credentials, a) {
|
|
|
12028
12055
|
return withContext(io, config, credentials, a.json, (ctx) => reportPhase(ctx, {
|
|
12029
12056
|
ticket,
|
|
12030
12057
|
phase,
|
|
12058
|
+
stage: a.options.stage ?? null,
|
|
12031
12059
|
message,
|
|
12032
12060
|
plan,
|
|
12033
12061
|
pr: a.options.pr ?? null,
|
|
@@ -14416,7 +14444,10 @@ function prState(pr) {
|
|
|
14416
14444
|
pr.mergeable ? MERGEABLE[pr.mergeable] ?? pr.mergeable.toLowerCase() : null
|
|
14417
14445
|
].filter(Boolean).join(" · ");
|
|
14418
14446
|
}
|
|
14419
|
-
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
|
+
};
|
|
14420
14451
|
function renderStatus(r) {
|
|
14421
14452
|
const now = Date.parse(r.generatedAt);
|
|
14422
14453
|
const out = [];
|
|
@@ -14480,7 +14511,7 @@ function renderStatus(r) {
|
|
|
14480
14511
|
else if (!r.pullRequests.length)
|
|
14481
14512
|
out.push(" none open");
|
|
14482
14513
|
for (const p of r.pullRequests ?? []) {
|
|
14483
|
-
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";
|
|
14484
14515
|
out.push(` ${pad(`#${p.number}`, idWidth)} ${[ticket, prState(p)].filter(Boolean).join(" · ")}`);
|
|
14485
14516
|
out.push(`${indent}${truncate(p.title, 90)}`);
|
|
14486
14517
|
if (p.failingChecks.length)
|
|
@@ -14922,7 +14953,7 @@ var COMMAND_HELP = {
|
|
|
14922
14953
|
rules the coordinator judged apply. Prints the ticket's state afterwards
|
|
14923
14954
|
`,
|
|
14924
14955
|
report: ` report <phase> [--message <text> | --message-file <path|->] [--pr <n|url>] [--sha <sha>]
|
|
14925
|
-
[--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]
|
|
14926
14957
|
Report a phase (planning, awaiting-approval, implementing, shipping,
|
|
14927
14958
|
blocked, ready-to-merge, awaiting-validation); the same phase again is a
|
|
14928
14959
|
status update; armada validate is how a worker enters awaiting-validation.
|
|
@@ -14930,6 +14961,7 @@ var COMMAND_HELP = {
|
|
|
14930
14961
|
message's first line, else the plan's); awaiting-approval sends it to
|
|
14931
14962
|
the coordinator's inbox.
|
|
14932
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.
|
|
14933
14965
|
--shipped-with names the shipping path in its hand-back and inbox.
|
|
14934
14966
|
Prints the ticket's state and what waits in this worker's inbox.
|
|
14935
14967
|
`,
|
|
@@ -15170,6 +15202,7 @@ var VALUE_OPTIONS = [
|
|
|
15170
15202
|
"pr",
|
|
15171
15203
|
"sha",
|
|
15172
15204
|
"shipped-with",
|
|
15205
|
+
"stage",
|
|
15173
15206
|
"reason",
|
|
15174
15207
|
"program-root",
|
|
15175
15208
|
"name",
|
|
@@ -15209,7 +15242,7 @@ var COMMAND_OPTIONS = {
|
|
|
15209
15242
|
attach: ["caption", "for"],
|
|
15210
15243
|
heartbeat: ["every", "parent", "background", "ticket", "handle"],
|
|
15211
15244
|
claim: ["runtime", "handle", "branch", "profile", "reason", "validation", "validation-reason"],
|
|
15212
|
-
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"],
|
|
15213
15246
|
release: ["ticket", "reason"],
|
|
15214
15247
|
ask: ["ticket", "options", "message", "message-file"],
|
|
15215
15248
|
inbox: ["wait", "timeout"],
|