@the-vibe-company/armada 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -5
- package/dist/armada.js +21 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ armada release --reason "wrong ticket"
|
|
|
90
90
|
|
|
91
91
|
- `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 in Turso, 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.
|
|
92
92
|
- `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.
|
|
93
|
+
- `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.
|
|
93
94
|
- `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`.
|
|
94
95
|
- `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.
|
|
95
96
|
- `release` removes the phase and runtime labels, moves the ticket back to the team's first unstarted state and posts `Agent status: released — <reason>`.
|
|
@@ -128,12 +129,12 @@ armada merge 34 # or the pull request URL; --ticket ABC-12 when the
|
|
|
128
129
|
|
|
129
130
|
## Watch the fleet (dashboard)
|
|
130
131
|
|
|
131
|
-
`packages/dashboard` is a Next.js app
|
|
132
|
+
`packages/dashboard` is a Next.js app whose main page is the Fleet of the projects registered in Turso. With accounts, each person sees the projects of their organization; under the shared password, every project.
|
|
132
133
|
|
|
133
134
|
- **Waiting for you** comes first, across projects. It lists questions, blocked workers, plans to approve, hand-backs and silent workers, the most urgent first.
|
|
134
135
|
- **At work** has one row per ticket in flight. A row shows the project, the runtime and session, the six-step phase pipeline, time in phase, the last report, the pull request with its CI, and the flags (red CI, conflict, double claim).
|
|
135
136
|
- A filter shows one project. Each project shows whether its coordinator is active, from its last inbox read.
|
|
136
|
-
- **Answer** a question from its line in Waiting for you (an option of the question fills the answer in). **Ready to launch** lists the frontier with a Launch button and a profile picker, the routed profile preselected. Neither reaches a worker: each becomes a request in that project's coordinator inbox, signed with the name the viewer gives (remembered in a cookie
|
|
137
|
+
- **Answer** a question from its line in Waiting for you (an option of the question fills the answer in). **Ready to launch** lists the frontier with a Launch button and a profile picker, the routed profile preselected. Neither reaches a worker: each becomes a request in that project's coordinator inbox, signed with the signed-in person's name and address (with accounts) or with the name the viewer gives (under the shared password; remembered in a cookie, default `ARMADA_DASHBOARD_AUTHOR`), and shows as pending until the coordinator carries it out. The dashboard holds no runtime credential.
|
|
137
138
|
- It stays live without a reload. Linear and GitHub are read at most once a minute per project. Turso is read on every 5-second poll, so a worker's `armada report` shows within seconds.
|
|
138
139
|
- When Turso is unreachable, a banner says so and the view falls back to Linear and GitHub.
|
|
139
140
|
- The interface is in English or French (`ARMADA_DASHBOARD_LANGUAGE`, or the EN/FR switch).
|
|
@@ -147,18 +148,50 @@ ARMADA_DASHBOARD_PASSWORD=off ARMADA_DASHBOARD_DEMO=fleet ARMADA_TURSO_URL=file:
|
|
|
147
148
|
bun run demo:report WID-12 shipping "Opened the pull request" # watch the row change
|
|
148
149
|
```
|
|
149
150
|
|
|
151
|
+
The same with accounts (email and password work in development only; confirmation links are printed in the server log):
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
ARMADA_DASHBOARD_DEMO=fleet ARMADA_TURSO_URL=file:.demo/armada.db \
|
|
155
|
+
ARMADA_AUTH_DATABASE_URL=file:.demo/auth.db ARMADA_AUTH_SECRET="$(openssl rand -base64 32)" \
|
|
156
|
+
ARMADA_AUTH_URL=http://localhost:4822 ARMADA_AUTH_OWNER_EMAILS=you@example.com bun run dev
|
|
157
|
+
```
|
|
158
|
+
|
|
150
159
|
**Deploy on Vercel.** Create a project from this repository and set these options:
|
|
151
160
|
|
|
152
161
|
- Root Directory: `packages/dashboard`, with files outside the root directory included (the default). The framework preset is Next.js, and Bun installs the workspace from `bun.lock`.
|
|
153
|
-
- Environment variables: `ARMADA_DASHBOARD_PASSWORD
|
|
162
|
+
- Environment variables: the accounts variables below (or, until they are set, `ARMADA_DASHBOARD_PASSWORD`), `LINEAR_API_KEY`, `GITHUB_TOKEN`, `ARMADA_TURSO_URL` and `ARMADA_TURSO_TOKEN`. Optional: `ARMADA_REPOSITORIES` (the `owner/name` list shown while Turso is unreachable on a fresh server), `ARMADA_DASHBOARD_LANGUAGE` (`en` or `fr`), `ARMADA_DASHBOARD_SNAPSHOT_SECONDS` (Linear and GitHub read period, default 60) and `ARMADA_DASHBOARD_AUTHOR` (the name requests are signed with until a viewer gives theirs). Never add a runtime token (Conductor or other): the coordinator carries out every request.
|
|
154
163
|
- The keys stay on the server; the browser only receives the fleet reading.
|
|
155
164
|
|
|
156
|
-
**
|
|
165
|
+
**Accounts.** People sign in with GitHub (or email and password where enabled) and belong to organizations, with the roles owner, admin and member. Accounts, sessions, organizations and invitations live in a libSQL database of their own, separate from the fleet's Turso database; its schema is applied on first use. Accounts turn on only when every required variable below is set. With none of them set, the shared password applies, unchanged; with some but not all, the dashboard fails closed (503, naming the missing ones) rather than fall back to a password that shows every organization's projects.
|
|
166
|
+
|
|
167
|
+
| Variable | What |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `ARMADA_AUTH_DATABASE_URL` | The accounts database, `libsql://...` (a new Turso database, not the fleet's), or `file:` locally |
|
|
170
|
+
| `ARMADA_AUTH_DATABASE_TOKEN` | Its token (not needed for `file:`) |
|
|
171
|
+
| `ARMADA_AUTH_SECRET` | Signs sessions: 32 characters at least, for example `openssl rand -base64 32`. Changing it signs everyone out |
|
|
172
|
+
| `ARMADA_AUTH_URL` | The dashboard's public address, for example `https://armada.example.com`: GitHub's callback and the links in emails |
|
|
173
|
+
| `ARMADA_AUTH_GITHUB_CLIENT_ID`, `ARMADA_AUTH_GITHUB_CLIENT_SECRET` | A GitHub OAuth app (GitHub > Settings > Developer settings > OAuth Apps) whose callback URL is `<ARMADA_AUTH_URL>/api/auth/callback/github` |
|
|
174
|
+
| `ARMADA_AUTH_OWNER_EMAILS` | Comma-separated addresses that may create an account without an invitation and create organizations |
|
|
175
|
+
| `ARMADA_AUTH_EMAIL_PASSWORD` | Optional, `on` or `off`: email and password sign-in, with address confirmation. Development only for now (default on): production ignores it until an email provider is plugged in, since confirmation links would sit in the server log |
|
|
176
|
+
|
|
177
|
+
- Accounts are by invitation: an account is created only for an owner address or an address with a pending invitation. The first owner to sign in creates the organization; the projects already registered, and those the CLI registers until it signs in, join the deployment's first organization. Organizations cannot be deleted.
|
|
178
|
+
- An owner or admin invites by email from the Organization page (the name in the top bar). No email provider is plugged in yet: messages (invitations, address confirmations) go to the server log, and the Organization page shows each pending invitation's link to copy and send. The invited person signs in with that address and accepts.
|
|
179
|
+
- Sessions are HttpOnly, SameSite=Lax cookies (Secure over https) valid 30 days; a revoked session can last up to five minutes (signed cookie cache). Without its accounts database the dashboard fails closed (503).
|
|
180
|
+
|
|
181
|
+
**Switch from the shared password to accounts** (a deployment that runs on `ARMADA_DASHBOARD_PASSWORD` keeps working until the redeploy of step 4; set every variable before it, since a partial set locks the dashboard):
|
|
182
|
+
|
|
183
|
+
1. Create the accounts database (`turso db create armada-accounts`, then `turso db show armada-accounts --url` and `turso db tokens create armada-accounts`) and set `ARMADA_AUTH_DATABASE_URL` and `ARMADA_AUTH_DATABASE_TOKEN`.
|
|
184
|
+
2. Create a GitHub OAuth app with the callback URL `https://<your dashboard>/api/auth/callback/github`, and set `ARMADA_AUTH_GITHUB_CLIENT_ID` and `ARMADA_AUTH_GITHUB_CLIENT_SECRET`.
|
|
185
|
+
3. Set `ARMADA_AUTH_SECRET`, `ARMADA_AUTH_URL` and `ARMADA_AUTH_OWNER_EMAILS` (at least the address of your GitHub account), for Production and Preview.
|
|
186
|
+
4. Redeploy. The dashboard now asks for an account; sign in with GitHub, create the organization (the registered projects join it) and invite the others.
|
|
187
|
+
5. Remove `ARMADA_DASHBOARD_PASSWORD` and `ARMADA_DASHBOARD_AUTHOR`: with accounts they are no longer read.
|
|
188
|
+
|
|
189
|
+
**Password (until accounts are configured).** The dashboard asks for `ARMADA_DASHBOARD_PASSWORD` before it shows anything, on every host, a custom domain included. Every page, the polling route and every server action answer 401 or send the viewer to the login page until then; only the build's static files are public.
|
|
157
190
|
|
|
158
191
|
- Use a long random value, for example `openssl rand -base64 24`, and set it for the Production and Preview environments. It stays on the server: never prefix it with `NEXT_PUBLIC_`.
|
|
159
192
|
- A correct password sets a signed session cookie (HttpOnly, Secure, SameSite=Lax) for 30 days. The signature is derived from the password, so changing it and redeploying logs every browser out. "Log out" in the top bar ends one session.
|
|
160
193
|
- Five wrong passwords from one address block it for 15 minutes, counted per server instance.
|
|
161
|
-
- Without the variable, the dashboard fails closed: every route answers 503 and names the variable. `ARMADA_DASHBOARD_PASSWORD=off` turns the password off for local development only; a production server refuses it the same way.
|
|
194
|
+
- Without the variable and without accounts, the dashboard fails closed: every route answers 503 and names the variable. `ARMADA_DASHBOARD_PASSWORD=off` turns the password off for local development only; a production server refuses it the same way.
|
|
162
195
|
- Vercel Authentication (Settings > Deployment Protection) is a useful second layer, but its standard protection leaves the production custom domain open (covering it takes a paid option), so it cannot replace the password.
|
|
163
196
|
|
|
164
197
|
One deployment covers one Linear workspace and one GitHub organization: its keys must read every registered project.
|
package/dist/armada.js
CHANGED
|
@@ -20,7 +20,9 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
20
20
|
|
|
21
21
|
// src/main.ts
|
|
22
22
|
import { spawn, spawnSync } from "node:child_process";
|
|
23
|
+
import { createReadStream } from "node:fs";
|
|
23
24
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
25
|
+
import { isatty } from "node:tty";
|
|
24
26
|
|
|
25
27
|
// src/cli.ts
|
|
26
28
|
import { dirname as dirname3, join as join5, resolve } from "node:path";
|
|
@@ -2112,6 +2114,16 @@ var MIGRATIONS = [
|
|
|
2112
2114
|
)`,
|
|
2113
2115
|
"CREATE INDEX IF NOT EXISTS inbox_requests_by_question ON inbox_requests (project, question)"
|
|
2114
2116
|
]
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
version: 5,
|
|
2120
|
+
statements: [
|
|
2121
|
+
`CREATE TABLE IF NOT EXISTS project_organizations (
|
|
2122
|
+
project TEXT PRIMARY KEY,
|
|
2123
|
+
organization TEXT NOT NULL,
|
|
2124
|
+
assigned_at TEXT NOT NULL
|
|
2125
|
+
)`
|
|
2126
|
+
]
|
|
2115
2127
|
}
|
|
2116
2128
|
];
|
|
2117
2129
|
var SCHEMA_VERSION = MIGRATIONS.at(-1)?.version ?? 0;
|
|
@@ -2180,12 +2192,14 @@ async function ensureProject(db, p, now = new Date) {
|
|
|
2180
2192
|
});
|
|
2181
2193
|
}
|
|
2182
2194
|
async function listProjects(db) {
|
|
2183
|
-
const rs = await db.execute(
|
|
2195
|
+
const rs = await db.execute(`SELECT p.slug, p.name, p.repository, p.program_root, o.organization, p.created_at, p.updated_at
|
|
2196
|
+
FROM projects p LEFT JOIN project_organizations o ON o.project = p.slug ORDER BY p.slug`);
|
|
2184
2197
|
return rs.rows.map((r) => ({
|
|
2185
2198
|
slug: String(r.slug),
|
|
2186
2199
|
name: String(r.name),
|
|
2187
2200
|
repository: String(r.repository),
|
|
2188
2201
|
programRoot: String(r.program_root),
|
|
2202
|
+
organization: r.organization === null ? null : String(r.organization),
|
|
2189
2203
|
createdAt: String(r.created_at),
|
|
2190
2204
|
updatedAt: String(r.updated_at)
|
|
2191
2205
|
}));
|
|
@@ -5050,7 +5064,7 @@ async function loadStatus(config, opts) {
|
|
|
5050
5064
|
});
|
|
5051
5065
|
}
|
|
5052
5066
|
// package.json
|
|
5053
|
-
var version = "0.1.
|
|
5067
|
+
var version = "0.1.12";
|
|
5054
5068
|
|
|
5055
5069
|
// src/io.ts
|
|
5056
5070
|
class UsageError extends Error {
|
|
@@ -5593,6 +5607,8 @@ async function readMessage(io, options) {
|
|
|
5593
5607
|
const text = file === "-" ? await io.readStdin?.() ?? null : await io.readFile(file);
|
|
5594
5608
|
if (text === null)
|
|
5595
5609
|
throw new UsageError(`cannot read the message from ${file}`);
|
|
5610
|
+
if (!text.trim())
|
|
5611
|
+
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 -');
|
|
5596
5612
|
return text;
|
|
5597
5613
|
}
|
|
5598
5614
|
async function withContext(io, config2, credentials2, json, act) {
|
|
@@ -6690,8 +6706,8 @@ function gitBranch() {
|
|
|
6690
6706
|
}
|
|
6691
6707
|
async function readStdin() {
|
|
6692
6708
|
let text = "";
|
|
6693
|
-
|
|
6694
|
-
for await (const chunk of
|
|
6709
|
+
const input = createReadStream("", { fd: 0, autoClose: false, encoding: "utf8" });
|
|
6710
|
+
for await (const chunk of input)
|
|
6695
6711
|
text += chunk;
|
|
6696
6712
|
return text;
|
|
6697
6713
|
}
|
|
@@ -6752,7 +6768,7 @@ var code = await run(process.argv.slice(2), {
|
|
|
6752
6768
|
stdout: (t) => process.stdout.write(t),
|
|
6753
6769
|
stderr: (t) => process.stderr.write(t),
|
|
6754
6770
|
ghToken,
|
|
6755
|
-
interactive:
|
|
6771
|
+
interactive: isatty(0) && isatty(2),
|
|
6756
6772
|
prompt,
|
|
6757
6773
|
gitBranch,
|
|
6758
6774
|
readStdin,
|