@the-vibe-company/armada 0.1.5 → 0.1.6
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 +29 -1
- package/dist/armada.js +112 -67
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,6 +109,34 @@ armada merge 34 # or the pull request URL; --ticket ABC-12 when the
|
|
|
109
109
|
- Then the ticket moves to Done with its agent labels removed, the pull request is linked, `Agent status: merged — …` is posted, the Turso hand-back is resolved and the runtime handle released. The output lists the workers in flight to tell and the worker session to archive with its runtime guide.
|
|
110
110
|
- It runs `gh` and `git` in the repository checkout and needs `LINEAR_API_KEY` and a GitHub token.
|
|
111
111
|
|
|
112
|
+
## Watch the fleet (dashboard)
|
|
113
|
+
|
|
114
|
+
`packages/dashboard` is a Next.js app with one page: the Fleet of every project registered in Turso.
|
|
115
|
+
|
|
116
|
+
- **Waiting for you** comes first, across projects. It lists questions, blocked workers, plans to approve, hand-backs and silent workers, the most urgent first.
|
|
117
|
+
- **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).
|
|
118
|
+
- A filter shows one project. Each project shows whether its coordinator is active, from its last inbox read.
|
|
119
|
+
- 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.
|
|
120
|
+
- When Turso is unreachable, a banner says so and the view falls back to Linear and GitHub.
|
|
121
|
+
- The interface is in English or French (`ARMADA_DASHBOARD_LANGUAGE`, or the EN/FR switch).
|
|
122
|
+
|
|
123
|
+
Try it locally with synthetic data and no key:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
cd packages/dashboard
|
|
127
|
+
bun run demo:seed # a local file: database with two invented projects
|
|
128
|
+
ARMADA_DASHBOARD_DEMO=fleet ARMADA_TURSO_URL=file:.demo/armada.db bun run dev # http://localhost:4822
|
|
129
|
+
bun run demo:report WID-12 shipping "Opened the pull request" # watch the row change
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Deploy on Vercel.** Create a project from this repository and set these options:
|
|
133
|
+
|
|
134
|
+
- 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`.
|
|
135
|
+
- Environment variables: `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`) and `ARMADA_DASHBOARD_SNAPSHOT_SECONDS` (Linear and GitHub read period, default 60).
|
|
136
|
+
- Keep it private. Turn on Vercel Authentication (Settings > Deployment Protection). The keys stay on the server; the browser only receives the fleet reading.
|
|
137
|
+
|
|
138
|
+
One deployment covers one Linear workspace and one GitHub organization: its keys must read every registered project.
|
|
139
|
+
|
|
112
140
|
## Keys
|
|
113
141
|
|
|
114
142
|
Armada needs a few keys. Set them up once per machine with `armada auth login`, or pass them as environment variables, which always win over the stored ones (the way to go in CI and cloud sandboxes).
|
|
@@ -205,7 +233,7 @@ See [AGENTS.md](https://github.com/The-Vibe-Company/armada/blob/main/AGENTS.md)
|
|
|
205
233
|
- **Linear** holds the plan: specs, tickets, dependencies and agent phases.
|
|
206
234
|
- **Turso** (libSQL) holds live telemetry: events, heartbeats, pending questions and locks. Losing it loses live detail, never progress.
|
|
207
235
|
- **Conductor Cloud** runs the workers in the first version. Other runtimes come later without changing the worker contract.
|
|
208
|
-
- **Dashboard
|
|
236
|
+
- **Dashboard** (Next.js, `packages/dashboard`): the live Fleet view of every project. The program view comes later.
|
|
209
237
|
|
|
210
238
|
## License
|
|
211
239
|
|
package/dist/armada.js
CHANGED
|
@@ -1381,6 +1381,16 @@ function criticalIds(m) {
|
|
|
1381
1381
|
return out;
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
1384
|
+
// ../core/src/types.ts
|
|
1385
|
+
var LABEL_PHASES = [
|
|
1386
|
+
"planning",
|
|
1387
|
+
"awaiting-approval",
|
|
1388
|
+
"implementing",
|
|
1389
|
+
"shipping",
|
|
1390
|
+
"blocked",
|
|
1391
|
+
"ready-to-merge"
|
|
1392
|
+
];
|
|
1393
|
+
|
|
1384
1394
|
// ../core/src/fleet.ts
|
|
1385
1395
|
var MIN = 60000;
|
|
1386
1396
|
var NEEDS_HUMAN = ["awaiting-approval", "blocked", "ready-to-merge"];
|
|
@@ -1424,6 +1434,12 @@ function inferPhase(pr, comments) {
|
|
|
1424
1434
|
return "awaiting-approval";
|
|
1425
1435
|
return "planning";
|
|
1426
1436
|
}
|
|
1437
|
+
var ENDS_WORK = ["release", "merge"];
|
|
1438
|
+
var livePhase = (e) => e.kind === "release" ? "released" : LABEL_PHASES.find((p) => p === e.phase) ?? null;
|
|
1439
|
+
function freshEvent(issueId, opts) {
|
|
1440
|
+
const e = opts.live?.events[issueId];
|
|
1441
|
+
return e && opts.live && e.at > opts.live.after ? e : null;
|
|
1442
|
+
}
|
|
1427
1443
|
function buildLane(m, allComments, issue, opts) {
|
|
1428
1444
|
const comments = commentsFor(allComments, issue.id);
|
|
1429
1445
|
const withStatus = comments.find((c) => c.status && c.status.phase !== "released");
|
|
@@ -1441,13 +1457,27 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
1441
1457
|
phase = inferPhase(pr, comments);
|
|
1442
1458
|
phaseSource = "inferred";
|
|
1443
1459
|
}
|
|
1460
|
+
const fresh = freshEvent(issue.id, opts);
|
|
1461
|
+
const freshPhase = fresh ? livePhase(fresh) : null;
|
|
1462
|
+
const trackerPhase = phase;
|
|
1463
|
+
if (freshPhase && freshPhase !== "released") {
|
|
1464
|
+
phase = freshPhase;
|
|
1465
|
+
phaseSource = "live";
|
|
1466
|
+
}
|
|
1444
1467
|
const shippingPhase = phase === "shipping" || phase === "ready-to-merge";
|
|
1445
|
-
if (pr?.state === "merged" && !isDone(issue) && (shippingPhase || phaseSource
|
|
1468
|
+
if (pr?.state === "merged" && !isDone(issue) && (shippingPhase || phaseSource === "status-line" || phaseSource === "inferred"))
|
|
1446
1469
|
phase = "merged";
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1470
|
+
let announcing;
|
|
1471
|
+
for (const c of comments) {
|
|
1472
|
+
if (!c.status || c.status.phase === "released")
|
|
1473
|
+
continue;
|
|
1474
|
+
if (c.status.phase !== phase)
|
|
1475
|
+
break;
|
|
1476
|
+
announcing = c;
|
|
1477
|
+
}
|
|
1478
|
+
const since = (fresh && phaseSource === "live" && phase !== trackerPhase ? fresh.at : undefined) ?? announcing?.createdAt ?? (fresh && phaseSource === "live" ? fresh.at : undefined) ?? (phase === "shipping" || phase === "ready-to-merge" ? pr?.createdAt : undefined) ?? claims[0]?.at ?? issue.startedAt ?? issue.updatedAt;
|
|
1479
|
+
const lastUpdate = latest(issue.updatedAt, comments[0]?.createdAt, pr?.updatedAt, issue.startedAt, fresh?.at);
|
|
1480
|
+
const lastReport = latest(comments.find((c) => c.status || c.claim)?.createdAt, claims.at(-1)?.at, opts.lastEvents?.[issue.id], fresh?.at) || null;
|
|
1451
1481
|
const openBlockers = m.openBlockersOf(issue);
|
|
1452
1482
|
const agent = issue.delegate ?? issue.assignee;
|
|
1453
1483
|
const flags = [];
|
|
@@ -1465,9 +1495,9 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
1465
1495
|
flags.push("double-claim");
|
|
1466
1496
|
if (openBlockers.length)
|
|
1467
1497
|
flags.push("started-before-blockers");
|
|
1468
|
-
if (!agent)
|
|
1498
|
+
if (!agent && phaseSource !== "live")
|
|
1469
1499
|
flags.push("no-assignee");
|
|
1470
|
-
if (!issue.agentPhase)
|
|
1500
|
+
if (!issue.agentPhase && phaseSource !== "live")
|
|
1471
1501
|
flags.push("no-phase-label");
|
|
1472
1502
|
const spec = m.specOf(issue.id);
|
|
1473
1503
|
return {
|
|
@@ -1475,13 +1505,14 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
1475
1505
|
spec: spec ? `Spec ${spec.ordinal}` : null,
|
|
1476
1506
|
phase,
|
|
1477
1507
|
phaseSource,
|
|
1478
|
-
runtime: issue.agentRuntime ?? claimRuntime ?? null,
|
|
1508
|
+
runtime: issue.agentRuntime ?? claimRuntime ?? fresh?.runtime ?? opts.live?.handles?.[issue.id]?.runtime ?? null,
|
|
1509
|
+
handle: opts.live?.handles?.[issue.id]?.handle ?? claims[0]?.session ?? fresh?.handle ?? null,
|
|
1479
1510
|
claim: claims[0] ?? null,
|
|
1480
1511
|
agent,
|
|
1481
1512
|
since,
|
|
1482
1513
|
lastUpdate,
|
|
1483
1514
|
lastReport,
|
|
1484
|
-
statusLine: withStatus?.status ? {
|
|
1515
|
+
statusLine: fresh?.message && phaseSource === "live" ? { summary: fresh.message, at: fresh.at, author: null, url: issue.url } : withStatus?.status ? {
|
|
1485
1516
|
summary: withStatus.status.summary,
|
|
1486
1517
|
at: withStatus.createdAt,
|
|
1487
1518
|
author: withStatus.author,
|
|
@@ -1493,7 +1524,11 @@ function buildLane(m, allComments, issue, opts) {
|
|
|
1493
1524
|
};
|
|
1494
1525
|
}
|
|
1495
1526
|
function inFlight(m, comments, opts) {
|
|
1496
|
-
|
|
1527
|
+
const held = (i) => {
|
|
1528
|
+
const fresh = freshEvent(i.id, opts);
|
|
1529
|
+
return fresh ? !ENDS_WORK.includes(fresh.kind) : !!i.agentPhase || isStarted(i);
|
|
1530
|
+
};
|
|
1531
|
+
return m.program.filter((i) => m.isLeaf(i) && !isClosed(i) && held(i)).map((i) => buildLane(m, comments, i, opts)).sort((a, b) => PHASE_RANK[a.phase] - PHASE_RANK[b.phase] || a.issue.id.localeCompare(b.issue.id, "en", { numeric: true }));
|
|
1497
1532
|
}
|
|
1498
1533
|
function frontier(m, readyLabel) {
|
|
1499
1534
|
const dependents = new Map;
|
|
@@ -1535,16 +1570,6 @@ function waitingPullRequests(m, prs) {
|
|
|
1535
1570
|
return prs.filter((p) => p.state === "open").map((pr) => ({ pr, ticket: ticketOf.get(pr.url) ?? null })).sort((a, b) => a.pr.number - b.pr.number);
|
|
1536
1571
|
}
|
|
1537
1572
|
|
|
1538
|
-
// ../core/src/types.ts
|
|
1539
|
-
var LABEL_PHASES = [
|
|
1540
|
-
"planning",
|
|
1541
|
-
"awaiting-approval",
|
|
1542
|
-
"implementing",
|
|
1543
|
-
"shipping",
|
|
1544
|
-
"blocked",
|
|
1545
|
-
"ready-to-merge"
|
|
1546
|
-
];
|
|
1547
|
-
|
|
1548
1573
|
// ../core/src/linear.ts
|
|
1549
1574
|
var LINEAR_ENDPOINT = "https://api.linear.app/graphql";
|
|
1550
1575
|
var MAX_DEPTH = 8;
|
|
@@ -2941,6 +2966,13 @@ var MIGRATIONS = [
|
|
|
2941
2966
|
PRIMARY KEY (project, name)
|
|
2942
2967
|
)`
|
|
2943
2968
|
]
|
|
2969
|
+
},
|
|
2970
|
+
{
|
|
2971
|
+
version: 2,
|
|
2972
|
+
statements: [
|
|
2973
|
+
"CREATE INDEX IF NOT EXISTS events_by_time ON events (project, created_at)",
|
|
2974
|
+
"CREATE INDEX IF NOT EXISTS events_by_kind ON events (project, kind, created_at)"
|
|
2975
|
+
]
|
|
2944
2976
|
}
|
|
2945
2977
|
];
|
|
2946
2978
|
var SCHEMA_VERSION = MIGRATIONS.at(-1)?.version ?? 0;
|
|
@@ -3039,7 +3071,7 @@ async function recordEvent(db, e) {
|
|
|
3039
3071
|
}
|
|
3040
3072
|
async function lastEventTimes(db, project) {
|
|
3041
3073
|
const rs = await db.execute({
|
|
3042
|
-
sql: "SELECT ticket, max(created_at) AS at FROM events WHERE project = ? GROUP BY ticket",
|
|
3074
|
+
sql: "SELECT ticket, max(created_at) AS at FROM events WHERE project = ? AND ticket <> '' GROUP BY ticket",
|
|
3043
3075
|
args: [project]
|
|
3044
3076
|
});
|
|
3045
3077
|
return Object.fromEntries(rs.rows.map((r) => [String(r.ticket), String(r.at)]));
|
|
@@ -3910,6 +3942,29 @@ function outcome(c, merged, pr, lines, workers, archive) {
|
|
|
3910
3942
|
warnings: c.warnings
|
|
3911
3943
|
};
|
|
3912
3944
|
}
|
|
3945
|
+
// ../core/src/projects.ts
|
|
3946
|
+
var message = (err) => err instanceof Error ? err.message : String(err);
|
|
3947
|
+
async function readProjectConfig(p, opts) {
|
|
3948
|
+
const fallback = (why) => ({
|
|
3949
|
+
config: parseConfig(configTemplate(p), `registry record ${p.slug}`),
|
|
3950
|
+
warning: `${CONFIG_FILE} not read (${why}); using the registry record with default labels and policy`
|
|
3951
|
+
});
|
|
3952
|
+
if (!opts.githubToken)
|
|
3953
|
+
return fallback("no GitHub token");
|
|
3954
|
+
try {
|
|
3955
|
+
const text = await fetchDefaultBranchFile({
|
|
3956
|
+
token: opts.githubToken,
|
|
3957
|
+
repository: p.repository,
|
|
3958
|
+
path: CONFIG_FILE,
|
|
3959
|
+
...opts.fetch ? { fetch: opts.fetch } : {}
|
|
3960
|
+
});
|
|
3961
|
+
if (text === null)
|
|
3962
|
+
return fallback(`not on the default branch of ${p.repository}`);
|
|
3963
|
+
return { config: parseConfig(text, `${p.repository}:${CONFIG_FILE}`), warning: null };
|
|
3964
|
+
} catch (err) {
|
|
3965
|
+
return fallback(message(err));
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3913
3968
|
// ../core/src/skills.ts
|
|
3914
3969
|
import { createHash } from "node:crypto";
|
|
3915
3970
|
|
|
@@ -4019,11 +4074,11 @@ var SKILLS_LOCK_FILE = "skills-lock.json";
|
|
|
4019
4074
|
var CONDUCTOR_SETTINGS = ".conductor/settings.toml";
|
|
4020
4075
|
var GITIGNORE = ".gitignore";
|
|
4021
4076
|
var SHIP_ARTIFACTS = "plans/ship-pr-dev/";
|
|
4022
|
-
var ok = (id,
|
|
4023
|
-
var bad = (id, level,
|
|
4077
|
+
var ok = (id, message2) => ({ id, level: "ok", message: message2, fix: null });
|
|
4078
|
+
var bad = (id, level, message2, fix) => ({
|
|
4024
4079
|
id,
|
|
4025
4080
|
level,
|
|
4026
|
-
message,
|
|
4081
|
+
message: message2,
|
|
4027
4082
|
fix
|
|
4028
4083
|
});
|
|
4029
4084
|
var skillDir = (name) => `${AGENTS_SKILLS_DIR}/${name}`;
|
|
@@ -4248,6 +4303,7 @@ function buildStatus({
|
|
|
4248
4303
|
forge,
|
|
4249
4304
|
forgeError = null,
|
|
4250
4305
|
lastEvents,
|
|
4306
|
+
live: live2,
|
|
4251
4307
|
extraWarnings = [],
|
|
4252
4308
|
now
|
|
4253
4309
|
}) {
|
|
@@ -4256,7 +4312,8 @@ function buildStatus({
|
|
|
4256
4312
|
const lanes = inFlight(m, program.comments, {
|
|
4257
4313
|
now: now.getTime(),
|
|
4258
4314
|
silentAfterMinutes: config.policy.silentAfterMinutes,
|
|
4259
|
-
...lastEvents ? { lastEvents } : {}
|
|
4315
|
+
...lastEvents ? { lastEvents } : {},
|
|
4316
|
+
...live2 ? { live: live2 } : {}
|
|
4260
4317
|
});
|
|
4261
4318
|
const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
|
|
4262
4319
|
const prRef = (p) => ({
|
|
@@ -4285,6 +4342,7 @@ function buildStatus({
|
|
|
4285
4342
|
phase: l.phase,
|
|
4286
4343
|
phaseSource: l.phaseSource,
|
|
4287
4344
|
runtime: l.runtime,
|
|
4345
|
+
handle: l.handle,
|
|
4288
4346
|
agent: l.agent,
|
|
4289
4347
|
since: l.since,
|
|
4290
4348
|
lastUpdate: l.lastUpdate,
|
|
@@ -4295,7 +4353,7 @@ function buildStatus({
|
|
|
4295
4353
|
openBlockers: l.openBlockers,
|
|
4296
4354
|
flags: l.flags
|
|
4297
4355
|
})),
|
|
4298
|
-
frontier: frontier(m, config.tracker.readyLabel).map((c) => ({
|
|
4356
|
+
frontier: frontier(m, config.tracker.readyLabel).filter((c) => !phaseOf.has(c.issue.id)).map((c) => ({
|
|
4299
4357
|
id: c.issue.id,
|
|
4300
4358
|
title: c.issue.title,
|
|
4301
4359
|
url: c.issue.url,
|
|
@@ -4314,7 +4372,7 @@ function buildStatus({
|
|
|
4314
4372
|
warnings: [...program.warnings, ...forge?.warnings ?? [], ...extraWarnings]
|
|
4315
4373
|
};
|
|
4316
4374
|
}
|
|
4317
|
-
async function
|
|
4375
|
+
async function readStatusSources(config, opts) {
|
|
4318
4376
|
const now = opts.now ?? (() => new Date);
|
|
4319
4377
|
const programP = fetchProgram({
|
|
4320
4378
|
apiKey: opts.linearApiKey,
|
|
@@ -4328,23 +4386,28 @@ async function loadStatus(config, opts) {
|
|
|
4328
4386
|
repository: config.github.repository,
|
|
4329
4387
|
...opts.fetch ? { fetch: opts.fetch } : {},
|
|
4330
4388
|
now
|
|
4331
|
-
}).then((forge2) => ({ forge: forge2,
|
|
4389
|
+
}).then((forge2) => ({ forge: forge2, forgeError: null }), (err) => ({ forge: null, forgeError: err instanceof Error ? err.message : String(err) })) : Promise.resolve({ forge: null, forgeError: "no GitHub token (set GITHUB_TOKEN or run gh auth login)" });
|
|
4390
|
+
const [program, forge] = await Promise.all([programP, forgeP]);
|
|
4391
|
+
return { program, ...forge };
|
|
4392
|
+
}
|
|
4393
|
+
async function loadStatus(config, opts) {
|
|
4394
|
+
const now = opts.now ?? (() => new Date);
|
|
4332
4395
|
const eventsP = opts.lastEvents ? opts.lastEvents().then((events2) => ({ events: events2 }), (err) => ({
|
|
4333
4396
|
warning: `Turso could not be read (${err instanceof Error ? err.message : String(err)}); silence is measured from Linear only`
|
|
4334
4397
|
})) : Promise.resolve({});
|
|
4335
|
-
const [program,
|
|
4398
|
+
const [{ program, forge, forgeError }, events] = await Promise.all([readStatusSources(config, opts), eventsP]);
|
|
4336
4399
|
return buildStatus({
|
|
4337
4400
|
config,
|
|
4338
4401
|
program,
|
|
4339
4402
|
forge,
|
|
4340
|
-
forgeError
|
|
4403
|
+
forgeError,
|
|
4341
4404
|
...events.events ? { lastEvents: events.events } : {},
|
|
4342
4405
|
extraWarnings: events.warning ? [events.warning] : [],
|
|
4343
4406
|
now: now()
|
|
4344
4407
|
});
|
|
4345
4408
|
}
|
|
4346
4409
|
// package.json
|
|
4347
|
-
var version = "0.1.
|
|
4410
|
+
var version = "0.1.6";
|
|
4348
4411
|
|
|
4349
4412
|
// src/io.ts
|
|
4350
4413
|
class UsageError extends Error {
|
|
@@ -5091,20 +5154,20 @@ async function report(io, config2, credentials2, a) {
|
|
|
5091
5154
|
throw new UsageError(`unexpected argument ${extra[0]}`);
|
|
5092
5155
|
if (a.options.message !== undefined && a.options["message-file"] !== undefined)
|
|
5093
5156
|
throw new UsageError("pass --message or --message-file, not both");
|
|
5094
|
-
let
|
|
5157
|
+
let message2 = a.options.message ?? null;
|
|
5095
5158
|
const file = a.options["message-file"];
|
|
5096
5159
|
if (file !== undefined) {
|
|
5097
|
-
|
|
5098
|
-
if (
|
|
5160
|
+
message2 = file === "-" ? await io.readStdin?.() ?? null : await io.readFile(file);
|
|
5161
|
+
if (message2 === null)
|
|
5099
5162
|
throw new UsageError(`cannot read the message from ${file}`);
|
|
5100
5163
|
}
|
|
5101
|
-
if (!
|
|
5164
|
+
if (!message2?.trim() && phase !== "ready-to-merge")
|
|
5102
5165
|
throw new UsageError("--message is required: what you did or what you are doing (first line = summary)");
|
|
5103
5166
|
const ticket = currentTicket(io, config2, a.options.ticket);
|
|
5104
5167
|
return withContext(io, config2, credentials2, a.json, (ctx) => reportPhase(ctx, {
|
|
5105
5168
|
ticket,
|
|
5106
5169
|
phase,
|
|
5107
|
-
message,
|
|
5170
|
+
message: message2,
|
|
5108
5171
|
pr: a.options.pr ?? null,
|
|
5109
5172
|
sha: a.options.sha ?? null
|
|
5110
5173
|
}));
|
|
@@ -5129,9 +5192,9 @@ function ghMerge(exec, cwd, repository) {
|
|
|
5129
5192
|
const args = ["pr", "merge", String(number), "--repo", repository, "--squash", "--match-head-commit", sha];
|
|
5130
5193
|
try {
|
|
5131
5194
|
const r = await exec("gh", args, { cwd });
|
|
5132
|
-
const
|
|
5195
|
+
const message2 = tail(`${r.stderr}
|
|
5133
5196
|
${r.stdout}`.trim(), 5) || `gh exited with ${r.code}`;
|
|
5134
|
-
return { ok: r.code === 0, message, transient: r.code !== 0 && TRANSIENT.test(
|
|
5197
|
+
return { ok: r.code === 0, message: message2, transient: r.code !== 0 && TRANSIENT.test(message2) };
|
|
5135
5198
|
} catch (err) {
|
|
5136
5199
|
return {
|
|
5137
5200
|
ok: false,
|
|
@@ -5409,28 +5472,7 @@ function renderStatus(r) {
|
|
|
5409
5472
|
}
|
|
5410
5473
|
|
|
5411
5474
|
// src/projects.ts
|
|
5412
|
-
var
|
|
5413
|
-
async function projectConfig(p, githubToken, io) {
|
|
5414
|
-
const fallback = (why) => ({
|
|
5415
|
-
config: parseConfig(configTemplate(p), `registry record ${p.slug}`),
|
|
5416
|
-
warning: `${CONFIG_FILE} not read (${why}); using the registry record with default labels and policy`
|
|
5417
|
-
});
|
|
5418
|
-
if (!githubToken)
|
|
5419
|
-
return fallback("no GitHub token");
|
|
5420
|
-
try {
|
|
5421
|
-
const text = await fetchDefaultBranchFile({
|
|
5422
|
-
token: githubToken,
|
|
5423
|
-
repository: p.repository,
|
|
5424
|
-
path: CONFIG_FILE,
|
|
5425
|
-
...io.fetch ? { fetch: io.fetch } : {}
|
|
5426
|
-
});
|
|
5427
|
-
if (text === null)
|
|
5428
|
-
return fallback(`not on the default branch of ${p.repository}`);
|
|
5429
|
-
return { config: parseConfig(text, `${p.repository}:${CONFIG_FILE}`), warning: null };
|
|
5430
|
-
} catch (err) {
|
|
5431
|
-
return fallback(message(err));
|
|
5432
|
-
}
|
|
5433
|
-
}
|
|
5475
|
+
var message2 = (err) => err instanceof Error ? err.message : String(err);
|
|
5434
5476
|
async function statusAll(io, json) {
|
|
5435
5477
|
const { credentials: credentials2 } = await loadCredentials(io);
|
|
5436
5478
|
const linearApiKey = credentials2.linearApiKey;
|
|
@@ -5446,11 +5488,14 @@ async function statusAll(io, json) {
|
|
|
5446
5488
|
} finally {
|
|
5447
5489
|
db.close();
|
|
5448
5490
|
}
|
|
5449
|
-
const
|
|
5491
|
+
const projects2 = await Promise.all(records.map(async (p) => {
|
|
5450
5492
|
const base = { slug: p.slug, name: p.name, repository: p.repository };
|
|
5451
5493
|
let warning = null;
|
|
5452
5494
|
try {
|
|
5453
|
-
const read = await
|
|
5495
|
+
const read = await readProjectConfig(p, {
|
|
5496
|
+
githubToken: credentials2.githubToken,
|
|
5497
|
+
...io.fetch ? { fetch: io.fetch } : {}
|
|
5498
|
+
});
|
|
5454
5499
|
warning = read.warning;
|
|
5455
5500
|
const config2 = read.config;
|
|
5456
5501
|
const report2 = await loadStatus(config2, {
|
|
@@ -5461,17 +5506,17 @@ async function statusAll(io, json) {
|
|
|
5461
5506
|
});
|
|
5462
5507
|
return { ...base, report: report2, error: null, configWarning: warning };
|
|
5463
5508
|
} catch (err) {
|
|
5464
|
-
return { ...base, report: null, error:
|
|
5509
|
+
return { ...base, report: null, error: message2(err), configWarning: warning };
|
|
5465
5510
|
}
|
|
5466
5511
|
}));
|
|
5467
|
-
const all = { schemaVersion: 1, projects };
|
|
5512
|
+
const all = { schemaVersion: 1, projects: projects2 };
|
|
5468
5513
|
if (json)
|
|
5469
5514
|
io.stdout(`${JSON.stringify(all, null, 2)}
|
|
5470
5515
|
`);
|
|
5471
|
-
else if (!
|
|
5516
|
+
else if (!projects2.length)
|
|
5472
5517
|
io.stdout("No project is registered yet. Run `armada init` in a repository to register it.\n");
|
|
5473
5518
|
else
|
|
5474
|
-
io.stdout(
|
|
5519
|
+
io.stdout(projects2.map((p) => {
|
|
5475
5520
|
if (!p.report)
|
|
5476
5521
|
return `${p.name} (${p.slug}) · ${p.repository}
|
|
5477
5522
|
! not read: ${p.error}
|
|
@@ -5483,7 +5528,7 @@ ${p.configWarning ? ` ! ${p.configWarning}
|
|
|
5483
5528
|
${"─".repeat(60)}
|
|
5484
5529
|
|
|
5485
5530
|
`));
|
|
5486
|
-
return
|
|
5531
|
+
return projects2.some((p) => p.error) ? 1 : 0;
|
|
5487
5532
|
}
|
|
5488
5533
|
|
|
5489
5534
|
// src/cli.ts
|