@the-vibe-company/armada 0.2.3 → 0.2.4

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 +12 -2
  2. package/dist/armada.js +224 -112
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -80,6 +80,8 @@ armada brief ABC-12 --profile codex --reason "a back-end bug behind a web label"
80
80
  ```
81
81
 
82
82
  - The prompt names the ticket and its Linear branch, starts by installing the coordinator's Armada version (`npm install -g`, with an `npm exec` fallback), signing in with `armada login --launch-token <token>` and running `armada claim` with the handle `$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID`, and carries the blockers with their hand-back notes, the comments already on the ticket and the workers in flight.
83
+ - **Plan rule.** A "Plan" section says in one line whether the worker waits for approval: "post your plan with `armada report implementing --plan-file -` and go on" when plans are pre-approved, "post your plan with `armada report awaiting-approval --plan-file -` and wait for approval" otherwise. `[policy] plans` decides (`approve` by default, or `pre-approved`); a ticket labelled `plan-approved` (`policy.pre_approved_label`) is pre-approved, and one labelled `needs-plan-approval` (`policy.approval_label`) waits for approval, which wins when a ticket has both. The settings show the rule and where it comes from (`Plans:`), and `--json` carries it as `plans`.
84
+ - **Project conventions.** `[brief] extra = "<path>"` names a file of the repository (relative to `armada.toml`) that every prompt ends with, under "Project conventions": the checks to run, the generated files to refresh, how to bring main in. A missing file is a brief warning, and `armada doctor` checks it.
83
85
  - **Workers need no key.** When the coordinator is signed in to an Armada that keeps the organization's keys, the brief asks it for a launch token: one ticket, used once, valid one hour. The worker exchanges it for a session limited to its ticket's `claim`, `report`, `ask` and `release`, and Armada gives each of those commands its keys. The `Launch:` line says whether the prompt carries one, and when there is none, why (not signed in, or an Armada without accounts or keys). Make the brief right before the launch; the token is the only secret a prompt ever holds, useless once used. Merging or releasing the ticket ends the worker's session, and Organization > Workers on the dashboard revokes one.
84
86
  - The settings give the profile's agent, model and effort from `[conductor]` in `armada.toml`, and the environment variables: `ARMADA_TICKET=<ticket>`, and, only without a launch token, `LINEAR_API_KEY` (required). Each shows whether this shell has it. No value is ever printed.
85
87
  - The profile follows the ticket's Linear labels: the first `[[conductor.routing]]` rule with a label the ticket carries (case, spaces and punctuation ignored), else `conductor.default_profile`, else the only profile. The settings say which rule chose it.
@@ -92,7 +94,7 @@ A worker writes to the tracker only through three commands. They set the labels
92
94
  ```sh
93
95
  armada login --launch-token <token> # the first line of the launch message: no key needed after it
94
96
  armada claim ABC-12 --runtime conductor --handle <workspace>/<session>
95
- armada report awaiting-approval --message-file plan.md # first line = summary
97
+ armada report awaiting-approval --plan-file plan.md # the plan as its own block, one-line status
96
98
  armada report implementing --message "plan approved, writing the parser"
97
99
  armada report implementing --message "parser done, wiring the CLI" # same phase = status update
98
100
  armada report shipping --message "PR open" --pr 34
@@ -103,6 +105,7 @@ armada release --reason "wrong ticket"
103
105
  - `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.
104
106
  - `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.
105
107
  - `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.
108
+ - `--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.
106
109
  - `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`.
107
110
  - `ready-to-merge` is refused unless the pull request is open in the project repository, `--sha` is the full 40-character SHA of its head, and every check in `[gates] required_checks` is green on that head (with none declared: at least one check, all green). It needs a GitHub token.
108
111
  - `release` removes the phase and runtime labels, keeps the configured ready label so the ticket can be taken again, moves the ticket back to the team's first unstarted state and posts `Agent status: released — <reason>`.
@@ -122,7 +125,7 @@ armada answer --note ABC-12 "main moved: rebase before you ship" # an unsolicit
122
125
  ```
123
126
 
124
127
  - `ask` reports the `blocked` phase with `Agent status: blocked — question: <first line>` (the rest and the numbered options below it) and adds a `question` item to the coordinator's inbox on Armada. The worker then stops and waits for the answer in its session, and reports the phase it resumes. It finds the ticket like `report`.
125
- - `report awaiting-approval` adds a `plan` item with the full message and worker handle to the coordinator's inbox. Same-phase heartbeats neither duplicate nor reopen it. Answering it, recording a note, leaving the phase or releasing the ticket closes the plan and any pending approval request. For a pre-approved plan, post the plan with `report implementing` instead: no approval item is needed.
128
+ - `report awaiting-approval` adds a `plan` item with the full message (and the `--plan` block) and worker handle to the coordinator's inbox. Same-phase heartbeats neither duplicate nor reopen it. Answering it, recording a note, leaving the phase or releasing the ticket closes the plan and any pending approval request. For a pre-approved plan (the brief's "Plan" line says which), post the plan with `report implementing --plan-file -` instead: no approval item is needed.
126
129
  - `inbox` lists the coordinator's open items (questions, plans, requests, hand-backs) and silent workers, oldest first. A worker is silent when it holds a ticket, its newest event is older than `policy.silence_minutes`, and its phase does not wait on someone else. It reads Armada only (a sign-in, no Linear key) and records that the coordinator is at work, for the dashboard. `--wait` asks Armada every 15 s until `--timeout`; Armada answers "not modified" (HTTP 304, no body) while the inbox holds the same entries, so a waiting coordinator costs one short request per ask and holds nothing open. It marks the items that were not there before with `*`; loop on it.
127
130
  - `watch` is how a coordinator keeps listening, run in the background while a worker is in flight. It asks Armada like `inbox --wait` (every 15 s, every 60 s when no worker is in flight, 304 while nothing changed) with no time limit of its own, and exits as soon as something needs the coordinator that it has not been shown yet by `inbox` or `watch` on this machine: it prints the inbox, new items marked `*`. It exits with "nothing to watch" when no worker is in flight and nothing is open. Armada unreachable or answering 5xx only prints a warning and it keeps going, waiting longer each time; a refusal (signed out) ends it. One watch per project and machine: a second one says the first is running. Its state (a lock, the entries shown, the tickets in flight at the last read, the checkout it ran in) lives in `~/.config/armada/watch/`, no secret.
128
131
  - The last line of `inbox`, `watch`, `merge` and `brief` (not `brief --prompt`) says whether to start watching again, for example `2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch`; with `--json`, the same is the `watch` field.
@@ -362,6 +365,13 @@ local_commands = ["npm ci", "npm test"] # run by `armada merge` on a test merge
362
365
 
363
366
  [policy]
364
367
  silence_minutes = 15 # a worker with no report for longer is flagged silent (default 15)
368
+ coordinator_minutes = 10 # an inbox item open longer shows "waiting for the coordinator" (default 10)
369
+ plans = "approve" # or "pre-approved": workers post their plan and go on (default "approve")
370
+ pre_approved_label = "plan-approved" # a ticket with this label is pre-approved (default)
371
+ approval_label = "needs-plan-approval" # a ticket with this label waits for approval; wins over the other (default)
372
+
373
+ [brief]
374
+ extra = "docs/worker-conventions.md" # every brief ends with this file under "Project conventions" (default: none)
365
375
 
366
376
  [conductor]
367
377
  default_profile = "opus" # for tickets no routing rule matches (required with routing)
package/dist/armada.js CHANGED
@@ -7,7 +7,7 @@ import { readFile as readFile3 } from "node:fs/promises";
7
7
  import { isatty } from "node:tty";
8
8
 
9
9
  // src/cli.ts
10
- import { dirname as dirname5, join as join5, resolve } from "node:path";
10
+ import { dirname as dirname6, join as join6, resolve } from "node:path";
11
11
 
12
12
  // ../core/src/types.ts
13
13
  var LABEL_PHASES = [
@@ -40,6 +40,7 @@ var LEGACY = { "handed-back": "ready-to-merge", "ci-fixing": "shipping" };
40
40
  var firstLine = (body) => (body.split(`
41
41
  `).find((l) => l.trim()) ?? "").replace(/[*_`]/g, "");
42
42
  var COORDINATOR_RECORD = /^(?:answer|note)\s*:/i;
43
+ var PLAN_BLOCK = /^## Plan[ \t]*$/m;
43
44
  function parseStatusLine(body) {
44
45
  const m = firstLine(body).match(/^\s*Agent status\s*:\s*([a-z-]+)\s*(?:[—–-]+\s*(.*))?$/i);
45
46
  if (!m?.[1])
@@ -49,7 +50,9 @@ function parseStatusLine(body) {
49
50
  const summary = (m[2] ?? "").trim();
50
51
  if (COORDINATOR_RECORD.test(summary))
51
52
  return null;
52
- return PHASES.includes(phase) ? { phase, summary } : null;
53
+ if (!PHASES.includes(phase))
54
+ return null;
55
+ return PLAN_BLOCK.test(body) ? { phase, summary, plan: true } : { phase, summary };
53
56
  }
54
57
  var unescapeMarkdown = (line) => line.replace(/\\([!-/:-@[-`{-~])/g, "$1");
55
58
  var trimMarks = (v) => {
@@ -770,11 +773,12 @@ function buildLane(m, allComments, issue, opts) {
770
773
  since,
771
774
  lastUpdate,
772
775
  lastReport,
773
- statusLine: fresh?.message && phaseSource === "live" ? { summary: fresh.message, at: fresh.at, author: null, url: issue.url } : withStatus?.status ? {
776
+ statusLine: fresh?.message && phaseSource === "live" ? { summary: fresh.message, at: fresh.at, author: null, url: issue.url, plan: false } : withStatus?.status ? {
774
777
  summary: withStatus.status.summary,
775
778
  at: withStatus.createdAt,
776
779
  author: withStatus.author,
777
- url: commentUrl(issue, withStatus)
780
+ url: commentUrl(issue, withStatus),
781
+ plan: !!withStatus.status.plan
778
782
  } : null,
779
783
  pr,
780
784
  openBlockers,
@@ -1798,6 +1802,7 @@ var HAS_WELLFORMED = !!"".isWellFormed;
1798
1802
 
1799
1803
  // ../core/src/config.ts
1800
1804
  var CONFIG_FILE = "armada.toml";
1805
+ var PLAN_POLICIES = ["approve", "pre-approved"];
1801
1806
  var routingLabelKey = (name) => name.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]/gu, "");
1802
1807
  var CONFIG_DEFAULTS = {
1803
1808
  language: "en",
@@ -1806,7 +1811,10 @@ var CONFIG_DEFAULTS = {
1806
1811
  runtimeGroup: "Agent runtime",
1807
1812
  runtimes: ["Claude Code", "Codex", "Conductor"],
1808
1813
  silentAfterMinutes: 15,
1809
- coordinatorMinutes: 10
1814
+ coordinatorMinutes: 10,
1815
+ plans: "approve",
1816
+ preApprovedLabel: "plan-approved",
1817
+ approvalLabel: "needs-plan-approval"
1810
1818
  };
1811
1819
 
1812
1820
  class ConfigError extends Error {
@@ -1880,6 +1888,10 @@ function parseConfig(text, source = CONFIG_FILE) {
1880
1888
  if (!isTable(gates))
1881
1889
  problems.push(`"gates" must be a table`);
1882
1890
  const gatesT = isTable(gates) ? gates : {};
1891
+ const brief = raw.brief === undefined ? {} : raw.brief;
1892
+ if (!isTable(brief))
1893
+ problems.push(`"brief" must be a table`);
1894
+ const briefT = isTable(brief) ? brief : {};
1883
1895
  const conductor = raw.conductor === undefined ? {} : raw.conductor;
1884
1896
  if (!isTable(conductor))
1885
1897
  problems.push(`"conductor" must be a table`);
@@ -1894,7 +1906,19 @@ function parseConfig(text, source = CONFIG_FILE) {
1894
1906
  ["tracker.labels", labelsT, ["phase_group", "runtime_group", "runtimes"]],
1895
1907
  ["github", github, ["repository"]],
1896
1908
  ["gates", gatesT, ["required_checks", "local_commands"]],
1897
- ["policy", policyT, ["silence_minutes", "silent_after_minutes", "coordinator_minutes"]],
1909
+ [
1910
+ "policy",
1911
+ policyT,
1912
+ [
1913
+ "silence_minutes",
1914
+ "silent_after_minutes",
1915
+ "coordinator_minutes",
1916
+ "plans",
1917
+ "pre_approved_label",
1918
+ "approval_label"
1919
+ ]
1920
+ ],
1921
+ ["brief", briefT, ["extra"]],
1898
1922
  ["conductor", conductorT, ["default_profile", "profiles", "routing"]]
1899
1923
  ];
1900
1924
  const profiles = {};
@@ -1979,6 +2003,26 @@ function parseConfig(text, source = CONFIG_FILE) {
1979
2003
  else
1980
2004
  problems.push(`"policy.coordinator_minutes" must be a positive number`);
1981
2005
  }
2006
+ let plans = CONFIG_DEFAULTS.plans;
2007
+ if (policyT.plans !== undefined) {
2008
+ const v = policyT.plans;
2009
+ if (typeof v === "string" && PLAN_POLICIES.includes(v.trim()))
2010
+ plans = v.trim();
2011
+ else
2012
+ problems.push(`"policy.plans" must be ${PLAN_POLICIES.map((p) => `"${p}"`).join(" or ")}`);
2013
+ }
2014
+ const preApprovedLabel = str(policyT, "policy", "pre_approved_label", { default: CONFIG_DEFAULTS.preApprovedLabel });
2015
+ const approvalLabel = str(policyT, "policy", "approval_label", { default: CONFIG_DEFAULTS.approvalLabel });
2016
+ if (preApprovedLabel && approvalLabel && routingLabelKey(preApprovedLabel) === routingLabelKey(approvalLabel))
2017
+ problems.push(`"policy.pre_approved_label" and "policy.approval_label" must name different labels`);
2018
+ let extra = null;
2019
+ if (briefT.extra !== undefined) {
2020
+ const v = str(briefT, "brief", "extra");
2021
+ if (v && (v.startsWith("/") || v.split(/[\\/]/).includes("..")))
2022
+ problems.push(`"brief.extra" is "${v}", expected a path inside the repository, relative to ${CONFIG_FILE}`);
2023
+ else if (v)
2024
+ extra = v;
2025
+ }
1982
2026
  let requiredChecks = [];
1983
2027
  if (gatesT.required_checks !== undefined) {
1984
2028
  const v = gatesT.required_checks;
@@ -2017,7 +2061,8 @@ function parseConfig(text, source = CONFIG_FILE) {
2017
2061
  repository: str(github, "github", "repository", { pattern: REPOSITORY, hint: "owner/name" })
2018
2062
  },
2019
2063
  gates: { requiredChecks, localCommands },
2020
- policy: { silentAfterMinutes, coordinatorMinutes },
2064
+ policy: { silentAfterMinutes, coordinatorMinutes, plans, preApprovedLabel, approvalLabel },
2065
+ brief: { extra },
2021
2066
  conductor: { defaultProfile, profiles, routing }
2022
2067
  };
2023
2068
  if (problems.length)
@@ -2053,6 +2098,12 @@ repository = ${q(p.repository)}
2053
2098
  [policy]
2054
2099
  silence_minutes = 15 # a worker with no report for longer than this shows as silent
2055
2100
  coordinator_minutes = 10 # an inbox item open longer than this shows "waiting for the coordinator"
2101
+ # plans = "approve" # or "pre-approved": workers post their plan and go on without waiting
2102
+ # pre_approved_label = "plan-approved" # a ticket with this label skips the approval
2103
+ # approval_label = "needs-plan-approval" # a ticket with this label waits for it; wins over the other
2104
+
2105
+ [brief]
2106
+ # extra = "docs/worker-conventions.md" # a file every worker brief carries under "Project conventions"
2056
2107
 
2057
2108
  # How \`armada brief\` launches workers on Conductor. Every value is passed explicitly;
2058
2109
  # \`conductor model\` lists each agent's model ids and effort levels.
@@ -2093,6 +2144,80 @@ function slugify(name) {
2093
2144
  return name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "project";
2094
2145
  }
2095
2146
 
2147
+ // ../core/src/phases.ts
2148
+ var TRANSITIONS = {
2149
+ planning: ["awaiting-approval", "implementing"],
2150
+ "awaiting-approval": ["planning", "implementing"],
2151
+ implementing: ["shipping"],
2152
+ shipping: ["implementing", "ready-to-merge"],
2153
+ "ready-to-merge": ["shipping"],
2154
+ blocked: ["planning", "awaiting-approval", "implementing", "shipping", "ready-to-merge"]
2155
+ };
2156
+ var isLabelPhase = (v) => LABEL_PHASES.includes(v);
2157
+ function transitionProblem(from, to) {
2158
+ if (from === null)
2159
+ return "the ticket has no agent phase: no worker has claimed it";
2160
+ if (from === to || to === "blocked" || TRANSITIONS[from].includes(to))
2161
+ return null;
2162
+ const allowed = [...TRANSITIONS[from], "blocked", `${from} (status update)`].join(", ");
2163
+ return `cannot go from ${from} to ${to}; from ${from} a worker may report: ${allowed}`;
2164
+ }
2165
+ function planRule(config, labels) {
2166
+ const { plans, preApprovedLabel, approvalLabel } = config.policy;
2167
+ const has = (name) => labels.some((l) => routingLabelKey(l) === routingLabelKey(name));
2168
+ if (has(approvalLabel))
2169
+ return { rule: "approve", why: `the ticket's label ${approvalLabel}` };
2170
+ if (has(preApprovedLabel))
2171
+ return { rule: "pre-approved", why: `the ticket's label ${preApprovedLabel}` };
2172
+ return { rule: plans, why: `armada.toml [policy] plans = "${plans}"` };
2173
+ }
2174
+ var FULL_SHA = /^[0-9a-f]{40}$/;
2175
+ function handBackProblems({ pr, repository, sha, requiredChecks }) {
2176
+ const problems = [];
2177
+ if (!sha)
2178
+ problems.push("--sha is required: the full 40-character head SHA of the pull request");
2179
+ else if (!FULL_SHA.test(sha))
2180
+ problems.push(`--sha must be the full 40-character commit SHA, got "${sha}" (${sha.length} characters)`);
2181
+ if (!pr) {
2182
+ problems.push("no pull request is linked to the ticket; pass --pr <number or URL>");
2183
+ return problems;
2184
+ }
2185
+ if (pr.repo.toLowerCase() !== repository.toLowerCase())
2186
+ problems.push(`pull request #${pr.number} is in ${pr.repo}, not in the project repository ${repository}`);
2187
+ if (pr.state && pr.state !== "open")
2188
+ problems.push(`pull request #${pr.number} is ${pr.state}, not open`);
2189
+ if (pr.draft)
2190
+ problems.push(`pull request #${pr.number} is a draft; mark it ready for review`);
2191
+ if (pr.mergeable === "CONFLICTING")
2192
+ problems.push(`pull request #${pr.number} conflicts with its base; rebase it`);
2193
+ if (!pr.headSha)
2194
+ problems.push(`the head of pull request #${pr.number} could not be read from GitHub`);
2195
+ else if (sha && FULL_SHA.test(sha) && pr.headSha !== sha)
2196
+ problems.push(`${sha} is not the head of pull request #${pr.number} (head is ${pr.headSha}); push, then report`);
2197
+ problems.push(...checkProblems(pr.checks ?? [], requiredChecks));
2198
+ return problems;
2199
+ }
2200
+ function checkProblems(checks, requiredChecks) {
2201
+ const problems = [];
2202
+ if (requiredChecks.length) {
2203
+ for (const name of requiredChecks) {
2204
+ const runs = checks.filter((c) => c.name === name);
2205
+ const bad = runs.find((c) => c.state !== "success");
2206
+ if (!runs.length)
2207
+ problems.push(`required check "${name}" has not reported on the head yet`);
2208
+ else if (bad)
2209
+ problems.push(`required check "${name}" is ${bad.state}`);
2210
+ }
2211
+ } else if (!checks.length) {
2212
+ problems.push("no CI check has reported on the head yet (or set [gates] required_checks in armada.toml)");
2213
+ } else {
2214
+ for (const c of checks)
2215
+ if (c.state !== "success")
2216
+ problems.push(`check "${c.name}" is ${c.state}`);
2217
+ }
2218
+ return problems;
2219
+ }
2220
+
2096
2221
  // ../core/src/routing.ts
2097
2222
  class ProfileError extends Error {
2098
2223
  name = "ProfileError";
@@ -2162,71 +2287,6 @@ function chooseProfile(config, input) {
2162
2287
  return { name, profile, source: "requested", rule: null, routed: route?.name ?? null, reason, why };
2163
2288
  }
2164
2289
 
2165
- // ../core/src/phases.ts
2166
- var TRANSITIONS = {
2167
- planning: ["awaiting-approval", "implementing"],
2168
- "awaiting-approval": ["planning", "implementing"],
2169
- implementing: ["shipping"],
2170
- shipping: ["implementing", "ready-to-merge"],
2171
- "ready-to-merge": ["shipping"],
2172
- blocked: ["planning", "awaiting-approval", "implementing", "shipping", "ready-to-merge"]
2173
- };
2174
- var isLabelPhase = (v) => LABEL_PHASES.includes(v);
2175
- function transitionProblem(from, to) {
2176
- if (from === null)
2177
- return "the ticket has no agent phase: no worker has claimed it";
2178
- if (from === to || to === "blocked" || TRANSITIONS[from].includes(to))
2179
- return null;
2180
- const allowed = [...TRANSITIONS[from], "blocked", `${from} (status update)`].join(", ");
2181
- return `cannot go from ${from} to ${to}; from ${from} a worker may report: ${allowed}`;
2182
- }
2183
- var FULL_SHA = /^[0-9a-f]{40}$/;
2184
- function handBackProblems({ pr, repository, sha, requiredChecks }) {
2185
- const problems = [];
2186
- if (!sha)
2187
- problems.push("--sha is required: the full 40-character head SHA of the pull request");
2188
- else if (!FULL_SHA.test(sha))
2189
- problems.push(`--sha must be the full 40-character commit SHA, got "${sha}" (${sha.length} characters)`);
2190
- if (!pr) {
2191
- problems.push("no pull request is linked to the ticket; pass --pr <number or URL>");
2192
- return problems;
2193
- }
2194
- if (pr.repo.toLowerCase() !== repository.toLowerCase())
2195
- problems.push(`pull request #${pr.number} is in ${pr.repo}, not in the project repository ${repository}`);
2196
- if (pr.state && pr.state !== "open")
2197
- problems.push(`pull request #${pr.number} is ${pr.state}, not open`);
2198
- if (pr.draft)
2199
- problems.push(`pull request #${pr.number} is a draft; mark it ready for review`);
2200
- if (pr.mergeable === "CONFLICTING")
2201
- problems.push(`pull request #${pr.number} conflicts with its base; rebase it`);
2202
- if (!pr.headSha)
2203
- problems.push(`the head of pull request #${pr.number} could not be read from GitHub`);
2204
- else if (sha && FULL_SHA.test(sha) && pr.headSha !== sha)
2205
- problems.push(`${sha} is not the head of pull request #${pr.number} (head is ${pr.headSha}); push, then report`);
2206
- problems.push(...checkProblems(pr.checks ?? [], requiredChecks));
2207
- return problems;
2208
- }
2209
- function checkProblems(checks, requiredChecks) {
2210
- const problems = [];
2211
- if (requiredChecks.length) {
2212
- for (const name of requiredChecks) {
2213
- const runs = checks.filter((c) => c.name === name);
2214
- const bad = runs.find((c) => c.state !== "success");
2215
- if (!runs.length)
2216
- problems.push(`required check "${name}" has not reported on the head yet`);
2217
- else if (bad)
2218
- problems.push(`required check "${name}" is ${bad.state}`);
2219
- }
2220
- } else if (!checks.length) {
2221
- problems.push("no CI check has reported on the head yet (or set [gates] required_checks in armada.toml)");
2222
- } else {
2223
- for (const c of checks)
2224
- if (c.state !== "success")
2225
- problems.push(`check "${c.name}" is ${c.state}`);
2226
- }
2227
- return problems;
2228
- }
2229
-
2230
2290
  // ../core/src/worker.ts
2231
2291
  class Refusal extends Error {
2232
2292
  next;
@@ -2423,6 +2483,14 @@ ${claimLine({ runtime: runtime.name, handle: input.handle, branch, started, prof
2423
2483
  const state = await readBack(ctx, ticket.id, warnings);
2424
2484
  return { ticket: ticket.id, url: ticket.url, lines, warnings, inbox: null, state };
2425
2485
  }
2486
+ var PLAN_HEADING = "## Plan";
2487
+ var SUMMARY_MAX = 100;
2488
+ function planSummary(plan) {
2489
+ const lines = plan.split(`
2490
+ `).map((l) => l.replace(/^\s*(?:#+|>|[-*+]|\d+[.)])\s*/, "").replace(/[*_`]/g, "").trim()).filter((l) => l && !/^plan\s*:?$/i.test(l));
2491
+ const first = lines[0] ?? "plan posted";
2492
+ return first.length > SUMMARY_MAX ? `${first.slice(0, SUMMARY_MAX - 1).trimEnd()}…` : first;
2493
+ }
2426
2494
  function resolvePr(ticket, repository, pr) {
2427
2495
  if (pr) {
2428
2496
  const trimmed = pr.trim().replace(/^#/, "");
@@ -2447,6 +2515,7 @@ async function reportPhase(ctx, input) {
2447
2515
  throw new Refusal(`${ticket.id}: ${problem}`, ticket.agentPhase ? `armada report <one of the phases above> --ticket ${ticket.id} --message "<what you did>"` : `armada claim ${ticket.id} --runtime <name> --handle <id>`);
2448
2516
  const warnings = [...ticket.warnings];
2449
2517
  const message = input.message?.trim() ?? "";
2518
+ const plan = input.plan?.trim() ?? "";
2450
2519
  let pr = resolvePr(ticket, config.github.repository, input.pr);
2451
2520
  const sha = input.sha?.trim().toLowerCase() || null;
2452
2521
  let summary;
@@ -2474,14 +2543,20 @@ ${problems.map((p) => ` - ${p}`).join(`
2474
2543
  summary = `PR #${pr?.number}, head ${sha}, CI green`;
2475
2544
  body = message;
2476
2545
  } else {
2477
- if (!message)
2546
+ if (!message && !plan)
2478
2547
  throw new Refusal("--message is required: say what you did or what you are doing", `armada report ${input.phase} --ticket ${ticket.id} --message "<what you did>"`);
2479
2548
  const [first = "", ...rest] = message.split(`
2480
2549
  `);
2481
- summary = first.trim();
2550
+ summary = message ? first.trim() : planSummary(plan);
2482
2551
  body = rest.join(`
2483
2552
  `).trim();
2484
2553
  }
2554
+ if (plan)
2555
+ body = [body, `${PLAN_HEADING}
2556
+
2557
+ ${plan}`].filter(Boolean).join(`
2558
+
2559
+ `);
2485
2560
  const target = ticket.agentPhase === input.phase ? null : findLabel(await linear.groupLabels(groups.phaseGroup, ticket.teamId), input.phase, groups.phaseGroup);
2486
2561
  if (pr && input.pr && !ticket.prs.some((p) => p.url === pr?.url)) {
2487
2562
  await linear.linkUrl(ticket.uuid, pr.url, pr.title || `Pull request #${pr.number}`);
@@ -2504,7 +2579,9 @@ ${body}` : statusLine);
2504
2579
  phase: input.phase,
2505
2580
  previous: ticket.agentPhase,
2506
2581
  summary,
2507
- message,
2582
+ message: plan ? [summary, body].join(`
2583
+
2584
+ `) : message,
2508
2585
  prUrl: pr?.url ?? null,
2509
2586
  headSha: sha
2510
2587
  }));
@@ -2680,6 +2757,11 @@ function buildBrief(input) {
2680
2757
  purpose: "the ticket this worker owns"
2681
2758
  }
2682
2759
  ];
2760
+ const extra = input.conventions ?? null;
2761
+ if (extra && extra.text === null)
2762
+ warnings.push(`[brief] extra names ${extra.path}, which could not be read; the brief has no project conventions`);
2763
+ else if (extra && !extra.text?.trim())
2764
+ warnings.push(`[brief] extra names ${extra.path}, which is empty`);
2683
2765
  const brief = {
2684
2766
  ticket: {
2685
2767
  id: ticket.id,
@@ -2706,6 +2788,8 @@ function buildBrief(input) {
2706
2788
  blockers: ticket.blockers.map(({ notes, ...b }) => ({ ...b, handBack: handBackNote(notes) })),
2707
2789
  notes: ticket.notes.slice(0, MAX_NOTES),
2708
2790
  parallel,
2791
+ plans: planRule(config, ticket.labels),
2792
+ conventions: extra?.text?.trim() ? { path: extra.path, text: extra.text } : null,
2709
2793
  warnings
2710
2794
  };
2711
2795
  if (ticket.notes.length > MAX_NOTES)
@@ -2763,6 +2847,7 @@ ${quote(x.handBack.body)}` : "No hand-back note.", "");
2763
2847
  for (const n of b.notes)
2764
2848
  out.push(`### ${byLine(n)}`, "", quote(n.body), "");
2765
2849
  }
2850
+ 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.`, "");
2766
2851
  out.push("## Workers in flight", "");
2767
2852
  if (b.parallel.length) {
2768
2853
  out.push("Stay out of their areas. If you must change the same files, say so in a report before you do.", "");
@@ -2771,6 +2856,8 @@ ${quote(x.handBack.body)}` : "No hand-back note.", "");
2771
2856
  } else
2772
2857
  out.push("None.");
2773
2858
  out.push("", "## Environment", "", b.launch ? `No key is needed in this workspace: once signed in, Armada hands each command the keys it needs, for ${t.id} only. If a command says this worker was cut off from Armada, stop and say so in your reply. Never print, commit or log a token or a key.` : `The coordinator set ${b.environment.map((v) => `\`${v.name}\``).join(", ")} in this workspace. Never print, commit or log their values.`);
2859
+ if (b.conventions)
2860
+ out.push("", "## Project conventions", "", b.conventions.text.trim());
2774
2861
  return `${out.join(`
2775
2862
  `)}
2776
2863
  `;
@@ -2808,6 +2895,7 @@ async function loadBrief(config, opts) {
2808
2895
  ...opts.stored ? { stored: opts.stored } : {},
2809
2896
  launch: made,
2810
2897
  noLaunch: missed?.reason ?? null,
2898
+ conventions: opts.conventions ?? null,
2811
2899
  now: now()
2812
2900
  });
2813
2901
  }
@@ -4522,7 +4610,7 @@ A coordinator may start cold, on a laptop or in a fresh cloud session, with noth
4522
4610
  5. **Launch ready tickets** that do not collide with work in flight, one at a time:
4523
4611
  - pick the ticket from the frontier in \`armada status\`;
4524
4612
  - run \`armada brief <ticket>\` and resolve its warnings. The profile (agent, model, effort) is routed from the ticket's labels by \`[[conductor.routing]]\` in \`armada.toml\`, else \`default_profile\`, and the brief says which rule chose it. Follow it. Override it only when the ticket's labels mislead (for example a \`web\` ticket that is really a tricky back-end bug): \`armada brief <ticket> --profile <name> --reason "<why>"\`. The reason lands in the worker's claim comment;
4525
- - write the prompt with \`armada brief <ticket> --prompt > <file>\` and add what only you know: which parallel workers touch neighbouring code and where the boundary is, and decisions not yet on the ticket;
4613
+ - write the prompt with \`armada brief <ticket> --prompt > <file>\` and 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;
4526
4614
  - 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;
4527
4615
  - 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.
4528
4616
  6. **Merge handed-back pull requests** one at a time with \`armada merge <pr>\`, 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.
@@ -4574,7 +4662,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
4574
4662
 
4575
4663
  1. **Claim** with the exact commands your brief starts with, for example \`armada claim <ticket> --runtime conductor --handle "$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID"\`. Install the Armada version the brief names first; if it gives a fallback command, use it wherever this skill says \`armada\`. When the brief has an \`armada login --launch-token <token>\` line, run it once, right after the install and before the claim: it signs your workspace in to Armada for your ticket only, and Armada then gives your \`claim\`, \`report\`, \`ask\` and \`release\` their keys, so none is needed in your environment (do not ask for one; \`armada whoami\` shows the sign-in). The token works once, within the hour; never copy it anywhere else. If it is refused, or a later command says you were cut off from Armada, stop and say so in your reply: the coordinator decides whether you get a new one. The claim assigns the ticket, moves it to In Progress, sets \`Agent phase = planning\` and your \`Agent runtime\`, and posts the \`Agent claim\` comment. If it refuses because another claim exists, stop: the older claim wins.
4576
4664
  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.
4577
- 3. **Plan.** Write the plan: what changes, how it is tested, and the checks a person could observe when it is done. If the ticket's plan policy or your brief says plans are pre-approved, post the full plan with \`armada report implementing --message "<plan>"\` and go on; do not enter \`awaiting-approval\`. Otherwise post the full plan with \`armada report awaiting-approval --message "<plan>"\`: it creates a \`plan\` item in the coordinator's inbox. 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.
4665
+ 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.
4578
4666
  4. **Implement** test-first. A material change to the approved plan needs a new approval.
4579
4667
  5. **Ship.** \`armada report shipping --pr <number>\`. Use the \`ship-pr-dev\` skill when the repository has it; otherwise 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.
4580
4668
  6. **Rebase** on the latest default branch right before hand-back, and get CI green on that final head.
@@ -4672,6 +4760,9 @@ async function checkRepository(view, armadaVersion) {
4672
4760
  try {
4673
4761
  const config = parseConfig(configText, CONFIG_FILE);
4674
4762
  checks.push(ok("config", `${CONFIG_FILE} is valid (project ${config.project.slug})`));
4763
+ const extra = config.brief.extra;
4764
+ if (extra)
4765
+ checks.push(await view.readFile(extra) === null ? bad("brief-extra", "warning", `[brief] extra names ${extra}, which is missing: briefs go out without the project conventions`, `add ${extra}, or fix the path in ${CONFIG_FILE}`) : ok("brief-extra", `${extra} goes into every brief as the project conventions`));
4675
4766
  } catch (err) {
4676
4767
  if (!(err instanceof ConfigError))
4677
4768
  throw err;
@@ -4960,7 +5051,7 @@ function buildStatus({
4960
5051
  lastUpdate: l.lastUpdate,
4961
5052
  lastReport: l.lastReport,
4962
5053
  silent: l.flags.includes("silent"),
4963
- statusLine: l.statusLine ? { summary: l.statusLine.summary, at: l.statusLine.at, url: l.statusLine.url } : null,
5054
+ statusLine: l.statusLine ? { summary: l.statusLine.summary, at: l.statusLine.at, url: l.statusLine.url, plan: l.statusLine.plan } : null,
4964
5055
  pr: l.pr ? prRef(l.pr) : null,
4965
5056
  openBlockers: l.openBlockers,
4966
5057
  flags: l.flags
@@ -5024,7 +5115,7 @@ async function loadStatus(config, opts) {
5024
5115
  });
5025
5116
  }
5026
5117
  // package.json
5027
- var version = "0.2.3";
5118
+ var version = "0.2.4";
5028
5119
 
5029
5120
  // src/io.ts
5030
5121
  class UsageError extends Error {
@@ -5270,6 +5361,9 @@ async function authLogout(io) {
5270
5361
  return 0;
5271
5362
  }
5272
5363
 
5364
+ // src/brief.ts
5365
+ import { dirname as dirname3, join as join2 } from "node:path";
5366
+
5273
5367
  // src/watch.ts
5274
5368
  import { dirname as dirname2 } from "node:path";
5275
5369
 
@@ -5550,17 +5644,18 @@ function print(io, outcome, json) {
5550
5644
  io.stderr(`armada: warning: ${w}
5551
5645
  `);
5552
5646
  }
5553
- async function readMessage(io, options) {
5554
- if (options.message !== undefined && options["message-file"] !== undefined)
5555
- throw new UsageError("pass --message or --message-file, not both");
5556
- const file = options["message-file"];
5647
+ async function readMessage(io, options, name = "message") {
5648
+ const fileOption = `${name}-file`;
5649
+ if (options[name] !== undefined && options[fileOption] !== undefined)
5650
+ throw new UsageError(`pass --${name} or --${fileOption}, not both`);
5651
+ const file = options[fileOption];
5557
5652
  if (file === undefined)
5558
- return options.message ?? null;
5653
+ return options[name] ?? null;
5559
5654
  const text = file === "-" ? await io.readStdin?.() ?? null : await io.readFile(file);
5560
5655
  if (text === null)
5561
- throw new UsageError(`cannot read the message from ${file}`);
5656
+ throw new UsageError(`cannot read the ${name} from ${file}`);
5562
5657
  if (!text.trim())
5563
- throw new UsageError(`${file === "-" ? "standard input" : `message file ${file}`} is empty or whitespace-only`, 'pass --message "<text>" or pipe a non-empty message into --message-file -');
5658
+ throw new UsageError(`${file === "-" ? "standard input" : `${name} file ${file}`} is empty or whitespace-only`, `pass --${name} "<text>" or pipe a non-empty ${name} into --${fileOption} -`);
5564
5659
  return text;
5565
5660
  }
5566
5661
  async function withContext(io, config, credentials, json, act) {
@@ -5605,14 +5700,18 @@ async function report(io, config, credentials, a) {
5605
5700
  throw new UsageError(`report needs a phase: ${LABEL_PHASES.join(", ")}${phase ? ` (got "${phase}")` : ""}`);
5606
5701
  if (extra.length)
5607
5702
  throw new UsageError(`unexpected argument ${extra[0]}`);
5703
+ if (a.options["message-file"] === "-" && a.options["plan-file"] === "-")
5704
+ throw new UsageError("--message-file - and --plan-file - both read standard input; give one of them a file");
5608
5705
  const message = await readMessage(io, a.options);
5609
- if (!message?.trim() && phase !== "ready-to-merge")
5610
- throw new UsageError("--message is required: what you did or what you are doing (first line = summary)");
5706
+ const plan = await readMessage(io, a.options, "plan");
5707
+ if (!message?.trim() && !plan?.trim() && phase !== "ready-to-merge")
5708
+ throw new UsageError("--message is required: what you did or what you are doing (first line = summary), or --plan-file with your plan");
5611
5709
  const ticket = currentTicket(io, config, a.options.ticket, credentials.workerTickets);
5612
5710
  return withContext(io, config, credentials, a.json, (ctx) => reportPhase(ctx, {
5613
5711
  ticket,
5614
5712
  phase,
5615
5713
  message,
5714
+ plan,
5616
5715
  pr: a.options.pr ?? null,
5617
5716
  sha: a.options.sha ?? null
5618
5717
  }));
@@ -5894,6 +5993,8 @@ function renderBrief(b) {
5894
5993
  `Runtime: conductor (follow the armada-runtime-conductor skill to launch)`,
5895
5994
  `Profile: ${p ? `${p.name}: agent ${p.agent}, model ${p.model}, effort ${p.effort}${p.fastMode ? ", fast mode" : ""}` : "none declared in armada.toml"}`,
5896
5995
  ...b.routing ? [`Chosen by: ${b.routing.why}`] : [],
5996
+ `Plans: ${b.plans.rule === "pre-approved" ? "pre-approved" : "wait for approval"} (${b.plans.why})`,
5997
+ ...b.conventions ? [`Conventions: ${b.conventions.path} (under "Project conventions" in the prompt)`] : [],
5897
5998
  `Repository: ${b.repository.url}`,
5898
5999
  `Branch: ${b.ticket.branch ?? "none suggested by Linear"} (the worker renames its workspace branch to it)`,
5899
6000
  `Launch: ${b.launch ? `one-time token in the prompt, valid until ${b.launch.expiresAt.slice(0, 16).replace("T", " ")} UTC: the worker needs no key` : `no launch token${b.noLaunch ? ` (${b.noLaunch})` : ""}: pass the keys below in the worker's environment`}`,
@@ -5934,7 +6035,7 @@ function launcher(io, config, credentials) {
5934
6035
  }
5935
6036
  };
5936
6037
  }
5937
- async function brief2(io, config, credentials, a, version) {
6038
+ async function brief2(io, config, credentials, a, version, configPath) {
5938
6039
  const [ticket, ...extra] = a.rest;
5939
6040
  if (!ticket)
5940
6041
  throw new UsageError('brief needs a ticket: armada brief <ticket> [--profile <name> [--reason "<why>"]]');
@@ -5956,6 +6057,8 @@ async function brief2(io, config, credentials, a, version) {
5956
6057
  }
5957
6058
  if (!credentials.linearApiKey)
5958
6059
  throw missingKey(LINEAR_KEY);
6060
+ const extraPath = config.brief.extra;
6061
+ const conventions = extraPath ? { path: extraPath, text: await io.readFile(join2(dirname3(configPath), extraPath)).catch(() => null) } : null;
5959
6062
  let b;
5960
6063
  try {
5961
6064
  b = await loadBrief(config, {
@@ -5967,6 +6070,7 @@ async function brief2(io, config, credentials, a, version) {
5967
6070
  env: io.env,
5968
6071
  stored: STORED_KEYS.filter((k) => credentials.sources[k.name]?.kind === "store").map((k) => k.variable),
5969
6072
  launch: launcher(io, config, credentials),
6073
+ conventions,
5970
6074
  ...io.fetch ? { fetch: io.fetch } : {},
5971
6075
  ...io.now ? { now: io.now } : {}
5972
6076
  });
@@ -6001,14 +6105,14 @@ ${next.line}
6001
6105
 
6002
6106
  // src/repo.ts
6003
6107
  import { lstat, mkdir as mkdir2, readdir, readFile as readFile2, readlink, rm as rm2, symlink, writeFile as writeFile2 } from "node:fs/promises";
6004
- import { dirname as dirname3, join as join2, relative, sep } from "node:path";
6108
+ import { dirname as dirname4, join as join3, relative, sep } from "node:path";
6005
6109
  var absent = (err) => {
6006
6110
  const code = err.code;
6007
6111
  return code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR";
6008
6112
  };
6009
6113
  async function collect(base, dir, out) {
6010
6114
  for (const entry of await readdir(dir, { withFileTypes: true })) {
6011
- const full = join2(dir, entry.name);
6115
+ const full = join3(dir, entry.name);
6012
6116
  if (entry.isDirectory()) {
6013
6117
  if (entry.name !== ".git" && entry.name !== "node_modules")
6014
6118
  await collect(base, full, out);
@@ -6018,12 +6122,12 @@ async function collect(base, dir, out) {
6018
6122
  }
6019
6123
  function fsRepoView(root) {
6020
6124
  return {
6021
- readFile: (path) => readFile2(join2(root, path), "utf8").catch((err) => {
6125
+ readFile: (path) => readFile2(join3(root, path), "utf8").catch((err) => {
6022
6126
  if (absent(err))
6023
6127
  return null;
6024
6128
  throw err;
6025
6129
  }),
6026
- readLink: (path) => readlink(join2(root, path)).catch((err) => {
6130
+ readLink: (path) => readlink(join3(root, path)).catch((err) => {
6027
6131
  if (absent(err) || err.code === "EINVAL")
6028
6132
  return null;
6029
6133
  throw err;
@@ -6031,7 +6135,7 @@ function fsRepoView(root) {
6031
6135
  readFolder: async (path) => {
6032
6136
  const out = [];
6033
6137
  try {
6034
- await collect(join2(root, path), join2(root, path), out);
6138
+ await collect(join3(root, path), join3(root, path), out);
6035
6139
  } catch (err) {
6036
6140
  if (absent(err))
6037
6141
  return null;
@@ -6045,7 +6149,7 @@ async function assertNoLinkedParent(root, path) {
6045
6149
  const parts = path.split("/").slice(0, -1);
6046
6150
  for (let k = 1;k <= parts.length; k++) {
6047
6151
  const parent = parts.slice(0, k).join("/");
6048
- if ((await lstat(join2(root, parent)).catch(() => null))?.isSymbolicLink())
6152
+ if ((await lstat(join3(root, parent)).catch(() => null))?.isSymbolicLink())
6049
6153
  throw new CommandError(`${parent} is a link; Armada does not write through it. Replace it with a folder first.`);
6050
6154
  }
6051
6155
  }
@@ -6053,15 +6157,15 @@ async function applyPlan(root, plan) {
6053
6157
  for (const path of [...plan.removes, ...plan.writes.map((w) => w.path), ...plan.links.map((l) => l.path)])
6054
6158
  await assertNoLinkedParent(root, path);
6055
6159
  for (const path of plan.removes)
6056
- await rm2(join2(root, path), { force: true });
6160
+ await rm2(join3(root, path), { force: true });
6057
6161
  for (const w of plan.writes) {
6058
- const full = join2(root, w.path);
6059
- await mkdir2(dirname3(full), { recursive: true });
6162
+ const full = join3(root, w.path);
6163
+ await mkdir2(dirname4(full), { recursive: true });
6060
6164
  await writeFile2(full, w.content);
6061
6165
  }
6062
6166
  for (const l of plan.links) {
6063
- const full = join2(root, l.path);
6064
- await mkdir2(dirname3(full), { recursive: true });
6167
+ const full = join3(root, l.path);
6168
+ await mkdir2(dirname4(full), { recursive: true });
6065
6169
  if (await lstat(full).catch(() => null))
6066
6170
  await rm2(full, { recursive: true, force: true });
6067
6171
  await symlink(l.target, full);
@@ -6237,7 +6341,7 @@ async function doctor(io, json, armadaVersion) {
6237
6341
  // src/init.ts
6238
6342
  import { mkdtemp, realpath, rm as rm3 } from "node:fs/promises";
6239
6343
  import { tmpdir } from "node:os";
6240
- import { join as join3 } from "node:path";
6344
+ import { join as join4 } from "node:path";
6241
6345
  var STOP_HOOK_QUESTION = "Add the Claude Code stop hook to this repository's .claude/settings.json? A coordinator then cannot end its turn while workers are in flight and no armada watch runs; your user settings are not touched. [Y/n] ";
6242
6346
  async function wantsStopHook(io, opts) {
6243
6347
  if (opts.stopHook !== null)
@@ -6270,7 +6374,7 @@ async function resolveConfig(exec, root, checkout, opts) {
6270
6374
  return { config: parse(onDefault, `${CONFIG_FILE} on the default branch`), text: null, source: "default branch" };
6271
6375
  const local = await fsRepoView(root).readFile(CONFIG_FILE);
6272
6376
  if (local !== null && !opts.programRoot)
6273
- return { config: parse(local, join3(root, CONFIG_FILE)), text: local, source: "working tree" };
6377
+ return { config: parse(local, join4(root, CONFIG_FILE)), text: local, source: "working tree" };
6274
6378
  const branch = initBranch(opts.armadaVersion);
6275
6379
  if (!opts.programRoot && await sh(exec, root, "git", ["ls-remote", "origin", `refs/heads/${branch}`])) {
6276
6380
  await sh(exec, root, "git", ["fetch", "--quiet", "origin", branch]);
@@ -6340,7 +6444,7 @@ async function init(io, opts) {
6340
6444
  const base = await defaultBranch(exec, root);
6341
6445
  await sh(exec, root, "git", ["fetch", "--quiet", "origin", base]);
6342
6446
  const baseSha = await sh(exec, root, "git", ["rev-parse", "FETCH_HEAD"]);
6343
- const checkout = await realpath(await mkdtemp(join3(tmpdir(), "armada-init-")));
6447
+ const checkout = await realpath(await mkdtemp(join4(tmpdir(), "armada-init-")));
6344
6448
  try {
6345
6449
  await sh(exec, root, "git", ["worktree", "add", "--quiet", "--detach", checkout, baseSha]);
6346
6450
  const { config, text, source } = await resolveConfig(exec, root, checkout, opts);
@@ -6441,7 +6545,7 @@ async function init(io, opts) {
6441
6545
  import { randomUUID } from "node:crypto";
6442
6546
  import { rm as rm4 } from "node:fs/promises";
6443
6547
  import { hostname, tmpdir as tmpdir2 } from "node:os";
6444
- import { dirname as dirname4, join as join4 } from "node:path";
6548
+ import { dirname as dirname5, join as join5 } from "node:path";
6445
6549
  var TRANSIENT = /\bHTTP 5\d\d\b|\b5\d\d (?:Bad Gateway|Service Unavailable|Gateway Time-?out|Internal Server Error)\b|Bad Gateway|Service Unavailable|Gateway Time-?out|ECONNRESET|ETIMEDOUT|connection reset|i\/o timeout|TLS handshake timeout/i;
6446
6550
  var tail = (text, lines = 30) => text.trimEnd().split(`
6447
6551
  `).slice(-lines).join(`
@@ -6501,7 +6605,7 @@ function gitRepo(exec, cwd) {
6501
6605
  },
6502
6606
  async testMerge({ branch, base, head, number, commands }) {
6503
6607
  await must(["fetch", "--quiet", "origin", branch, `refs/pull/${number}/head`]);
6504
- const dir = join4(tmpdir2(), `armada-merge-${number}-${randomUUID().slice(0, 8)}`);
6608
+ const dir = join5(tmpdir2(), `armada-merge-${number}-${randomUUID().slice(0, 8)}`);
6505
6609
  const remove = async () => {
6506
6610
  await git(["worktree", "remove", "--force", dir]);
6507
6611
  await git(["worktree", "prune"]);
@@ -6588,7 +6692,7 @@ async function merge2(io, config, credentials, a, configPath) {
6588
6692
  if (!exec)
6589
6693
  throw new UsageError("armada merge needs to run git and gh");
6590
6694
  const linearApiKey = credentials.linearApiKey;
6591
- const repoDir = dirname4(configPath);
6695
+ const repoDir = dirname5(configPath);
6592
6696
  const fetchOpt = io.fetch ? { fetch: io.fetch } : {};
6593
6697
  const gh = { token, repository: config.github.repository, ...fetchOpt };
6594
6698
  const linearOpts = { apiKey: linearApiKey, labels: config.tracker.labels, ...fetchOpt };
@@ -6619,7 +6723,7 @@ async function merge2(io, config, credentials, a, configPath) {
6619
6723
  `),
6620
6724
  installedSkill: async (name) => {
6621
6725
  for (const dir of [AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR])
6622
- if (await io.readFile(join4(repoDir, dir, name, "SKILL.md")) !== null)
6726
+ if (await io.readFile(join5(repoDir, dir, name, "SKILL.md")) !== null)
6623
6727
  return true;
6624
6728
  return false;
6625
6729
  }
@@ -6696,6 +6800,8 @@ function renderStatus(r) {
6696
6800
  out.push(`${indent}${truncate(t.title, 90)}${t.spec ? ` [${t.spec}]` : ""}`);
6697
6801
  if (t.statusLine?.summary)
6698
6802
  out.push(`${indent}“${truncate(t.statusLine.summary, 100)}”`);
6803
+ if (t.statusLine?.plan)
6804
+ out.push(`${indent}plan: ${t.statusLine.url}`);
6699
6805
  if (t.pr)
6700
6806
  out.push(`${indent}${[`PR #${t.pr.number}`, prState(t.pr)].filter(Boolean).join(" · ")}`);
6701
6807
  if (t.flags.length)
@@ -6817,8 +6923,12 @@ var COMMAND_HELP = {
6817
6923
  routed profile needs --reason. Prints the ticket's state afterwards
6818
6924
  `,
6819
6925
  report: ` report <phase> [--message <text> | --message-file <path|->] [--pr <n|url>] [--sha <sha>]
6926
+ [--plan <text> | --plan-file <path|->]
6820
6927
  Report a phase (planning, awaiting-approval, implementing, shipping,
6821
6928
  blocked, ready-to-merge); the same phase again is a status update.
6929
+ --plan posts the plan as its own block under a one-line status (the
6930
+ message's first line, else the plan's); awaiting-approval sends it to
6931
+ the coordinator's inbox.
6822
6932
  ready-to-merge needs --sha (full 40 characters, the PR head) and green CI.
6823
6933
  Prints the ticket's state and what waits in this worker's inbox.
6824
6934
  `,
@@ -6959,6 +7069,8 @@ var VALUE_OPTIONS = [
6959
7069
  "ticket",
6960
7070
  "message",
6961
7071
  "message-file",
7072
+ "plan",
7073
+ "plan-file",
6962
7074
  "pr",
6963
7075
  "sha",
6964
7076
  "reason",
@@ -6974,7 +7086,7 @@ var VALUE_OPTIONS = [
6974
7086
  var FLAG_OPTIONS = ["dry-run", "no-lock", "prompt", "wait", "note", "api-key", "no-stop-hook"];
6975
7087
  var COMMAND_OPTIONS = {
6976
7088
  claim: ["runtime", "handle", "branch", "profile", "reason"],
6977
- report: ["ticket", "message", "message-file", "pr", "sha"],
7089
+ report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha"],
6978
7090
  release: ["ticket", "reason"],
6979
7091
  ask: ["ticket", "options", "message", "message-file"],
6980
7092
  inbox: ["wait", "timeout"],
@@ -7035,12 +7147,12 @@ async function findConfig(io, explicit, command = "status") {
7035
7147
  throw new UsageError(`${path} does not exist`, `armada ${command} --config <file>, with the path of an ${CONFIG_FILE}`);
7036
7148
  return { path, text };
7037
7149
  }
7038
- for (let dir = resolve(io.cwd);; dir = dirname5(dir)) {
7039
- const path = join5(dir, CONFIG_FILE);
7150
+ for (let dir = resolve(io.cwd);; dir = dirname6(dir)) {
7151
+ const path = join6(dir, CONFIG_FILE);
7040
7152
  const text = await io.readFile(path);
7041
7153
  if (text !== null)
7042
7154
  return { path, text };
7043
- if (dirname5(dir) === dir)
7155
+ if (dirname6(dir) === dir)
7044
7156
  break;
7045
7157
  }
7046
7158
  throw new UsageError(`no ${CONFIG_FILE} found in ${io.cwd} or any parent directory, so this is not a repository Armada runs`, `armada init to set this repository up, armada ${command} --config <file> to use another ${CONFIG_FILE}, or armada status --all to see the registered projects`);
@@ -7146,7 +7258,7 @@ async function run(argv, io) {
7146
7258
  if (args.command === "brief") {
7147
7259
  const { path, text } = await findConfig(io, args.config, "brief");
7148
7260
  const { credentials } = await loadCredentials(io);
7149
- return await brief2(io, parseConfig(text, path), credentials, args, version);
7261
+ return await brief2(io, parseConfig(text, path), credentials, args, version, path);
7150
7262
  }
7151
7263
  if (args.command === "status") {
7152
7264
  noExtra(args.rest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",