@the-vibe-company/armada 0.2.60 → 0.2.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/armada.js +218 -82
- package/package.json +1 -1
package/dist/armada.js
CHANGED
|
@@ -1488,7 +1488,7 @@ import { hostname as hostname2 } from "node:os";
|
|
|
1488
1488
|
import { isatty } from "node:tty";
|
|
1489
1489
|
|
|
1490
1490
|
// src/cli.ts
|
|
1491
|
-
import { basename as basename4, dirname as
|
|
1491
|
+
import { basename as basename4, dirname as dirname14, join as join11, resolve as resolve8 } from "node:path";
|
|
1492
1492
|
|
|
1493
1493
|
// ../core/src/merge.ts
|
|
1494
1494
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
@@ -2074,7 +2074,7 @@ async function watchDeploy(o) {
|
|
|
2074
2074
|
sha: o.sha,
|
|
2075
2075
|
state,
|
|
2076
2076
|
detail: deployDetail(detail),
|
|
2077
|
-
pauseOnFailure: o.target.pauseOnFailure,
|
|
2077
|
+
pauseOnFailure: state !== "not-runnable" && o.target.pauseOnFailure,
|
|
2078
2078
|
liveSha
|
|
2079
2079
|
});
|
|
2080
2080
|
await record("waiting");
|
|
@@ -2102,6 +2102,10 @@ async function watchDeploy(o) {
|
|
|
2102
2102
|
if (live) {
|
|
2103
2103
|
detail = live.detail;
|
|
2104
2104
|
liveSha = live.sha;
|
|
2105
|
+
if (live.notRunnable) {
|
|
2106
|
+
await record("not-runnable");
|
|
2107
|
+
return "not-runnable";
|
|
2108
|
+
}
|
|
2105
2109
|
let includes = live.sha === o.sha;
|
|
2106
2110
|
if (live.sha && !includes) {
|
|
2107
2111
|
try {
|
|
@@ -2124,6 +2128,10 @@ could not compare the live commit; retrying`;
|
|
|
2124
2128
|
result = { ok: null, detail: "could not read or record shared smoke state; retrying" };
|
|
2125
2129
|
}
|
|
2126
2130
|
detail = result.detail;
|
|
2131
|
+
if (result.notRunnable) {
|
|
2132
|
+
await record("not-runnable");
|
|
2133
|
+
return "not-runnable";
|
|
2134
|
+
}
|
|
2127
2135
|
if (result.ok !== null) {
|
|
2128
2136
|
const state = result.ok ? "healthy" : "smoke-failed";
|
|
2129
2137
|
await record(state);
|
|
@@ -2141,7 +2149,7 @@ ${detail}`;
|
|
|
2141
2149
|
}
|
|
2142
2150
|
function deployLine(row, now) {
|
|
2143
2151
|
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(row.updatedAt)) / 60000));
|
|
2144
|
-
return `${row.target}: ${row.state === "skipped" ? "skipped (not configured on this machine)" : row.state} ${row.sha}${row.state === "waiting" || row.state === "live" ? ` — watching since ${row.startedAt.slice(11, 16)}, no news for ${age} min${age >= 2 ? "; watcher may have stopped" : ""}` : ""}`;
|
|
2152
|
+
return `${row.target}: ${row.state === "skipped" ? "skipped (not configured on this machine)" : row.state === "not-runnable" ? "not runnable (configuration)" : row.state} ${row.sha}${row.state === "waiting" || row.state === "live" ? ` — watching since ${row.startedAt.slice(11, 16)}, no news for ${age} min${age >= 2 ? "; watcher may have stopped" : ""}` : ""}`;
|
|
2145
2153
|
}
|
|
2146
2154
|
|
|
2147
2155
|
// ../../node_modules/.bun/smol-toml@1.9.0/node_modules/smol-toml/dist/error.js
|
|
@@ -3146,10 +3154,53 @@ var RUNNER = /No space left on device|The runner has received a shutdown signal|
|
|
|
3146
3154
|
function ciLine(line) {
|
|
3147
3155
|
return line.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z\s?/, "").replace(/\r$/, "").slice(0, 1000);
|
|
3148
3156
|
}
|
|
3157
|
+
function summaryDependencies(check, log) {
|
|
3158
|
+
if (!log || log.warnings.length || check.conclusion !== "FAILURE" || !check.steps?.length)
|
|
3159
|
+
return [];
|
|
3160
|
+
const exitError = "##[error]Process completed with exit code 1.";
|
|
3161
|
+
const gateNotice = (text) => !text?.trim() || [exitError, "Process completed with exit code 1."].includes(text.trim());
|
|
3162
|
+
if (!gateNotice(check.summary) || check.annotations.some((a) => !gateNotice(a.title) || !gateNotice(a.message)))
|
|
3163
|
+
return [];
|
|
3164
|
+
if (log.lines.some((line) => line.length > 1000))
|
|
3165
|
+
return [];
|
|
3166
|
+
if (check.steps.filter((s) => s.conclusion === "failure").length !== 1)
|
|
3167
|
+
return [];
|
|
3168
|
+
const setup = check.steps[0];
|
|
3169
|
+
const complete = check.steps.at(-1);
|
|
3170
|
+
if (setup?.name !== "Set up job" || setup.number !== 1 || setup.conclusion !== "success" || complete?.name !== "Complete job" || complete.conclusion !== "success" || complete.number !== Math.max(...check.steps.map((s) => s.number)))
|
|
3171
|
+
return [];
|
|
3172
|
+
const userSteps = check.steps.slice(1, -1);
|
|
3173
|
+
if (userSteps.filter((s) => s.conclusion === "failure").length !== 1 || userSteps.some((s) => s.conclusion !== "failure" && s.conclusion !== "skipped"))
|
|
3174
|
+
return [];
|
|
3175
|
+
const lines = log.lines.map(ciLine).map((l) => l.trim()).filter(Boolean);
|
|
3176
|
+
if (lines.filter((l) => l.includes("##[error]")).join(`
|
|
3177
|
+
`) !== exitError)
|
|
3178
|
+
return [];
|
|
3179
|
+
if (lines.filter((l) => l.startsWith("##[group]Run ")).length !== 1)
|
|
3180
|
+
return [];
|
|
3181
|
+
const start = lines.findIndex((l) => l.startsWith('##[group]Run echo "Dependency failed: '));
|
|
3182
|
+
const end = lines.indexOf("##[endgroup]", start);
|
|
3183
|
+
const failed = lines.indexOf(exitError, end);
|
|
3184
|
+
if (start < 0 || end < 0 || failed < 0)
|
|
3185
|
+
return [];
|
|
3186
|
+
const script = lines.slice(start + 1, end).filter((l) => !l.startsWith("shell: "));
|
|
3187
|
+
if (script.pop() !== "exit 1" || !script.length)
|
|
3188
|
+
return [];
|
|
3189
|
+
const commands = script.map((l) => l.match(/^echo "Dependency failed: ([^"$`\\]+)"$/)?.[1]);
|
|
3190
|
+
if (commands.some((name) => !name))
|
|
3191
|
+
return [];
|
|
3192
|
+
if (lines[start] !== `##[group]Run ${script[0]}`)
|
|
3193
|
+
return [];
|
|
3194
|
+
const output = lines.slice(end + 1, failed);
|
|
3195
|
+
if (output.length !== commands.length || output.some((l, i) => l !== `Dependency failed: ${commands[i]}`))
|
|
3196
|
+
return [];
|
|
3197
|
+
return [...new Set(commands)];
|
|
3198
|
+
}
|
|
3149
3199
|
function explainChecks(checks, logs, config) {
|
|
3150
3200
|
const patterns = [...(config?.failurePatterns ?? []).map(failurePattern), ...TEST_PATTERNS];
|
|
3151
|
-
|
|
3201
|
+
const explanations = checks.map((check) => {
|
|
3152
3202
|
const log = check.id === null ? [] : (logs.get(check.id)?.lines ?? []).map(ciLine);
|
|
3203
|
+
const dependencyCandidate = log.some((line) => line.trim().startsWith('##[group]Run echo "Dependency failed: '));
|
|
3153
3204
|
const annotations = check.annotations.flatMap((a) => [a.title ?? "", ...a.message.split(`
|
|
3154
3205
|
`)]).map(ciLine);
|
|
3155
3206
|
const summary = (check.summary ?? "").split(`
|
|
@@ -3178,9 +3229,9 @@ function explainChecks(checks, logs, config) {
|
|
|
3178
3229
|
`))) : [];
|
|
3179
3230
|
const unknownNames = names.filter((name) => !matches(name).length && !blockMatches.length);
|
|
3180
3231
|
const matched = [...new Set([...names.flatMap(matches), ...blockMatches])];
|
|
3181
|
-
const known = !unknownNames.length ? matched[0] : undefined;
|
|
3232
|
+
const known = !dependencyCandidate && !unknownNames.length ? matched[0] : undefined;
|
|
3182
3233
|
const knownMatches = matched.map(({ ticket, pattern }) => ({ ticket, pattern }));
|
|
3183
|
-
const runnerOnly = runner && !unknownNames.length;
|
|
3234
|
+
const runnerOnly = !dependencyCandidate && runner && !unknownNames.length;
|
|
3184
3235
|
return {
|
|
3185
3236
|
check: check.name,
|
|
3186
3237
|
conclusion: check.conclusion,
|
|
@@ -3196,6 +3247,28 @@ function explainChecks(checks, logs, config) {
|
|
|
3196
3247
|
...check.superseded ? { superseded: true } : {}
|
|
3197
3248
|
};
|
|
3198
3249
|
});
|
|
3250
|
+
let changed = true;
|
|
3251
|
+
while (changed) {
|
|
3252
|
+
changed = false;
|
|
3253
|
+
for (const [i, check] of checks.entries()) {
|
|
3254
|
+
const explanation = explanations[i];
|
|
3255
|
+
if (explanation?.class !== "failure" || explanation.tests.length || check.runId === null || check.superseded)
|
|
3256
|
+
continue;
|
|
3257
|
+
const dependencies = summaryDependencies(check, check.id === null ? undefined : logs.get(check.id));
|
|
3258
|
+
if (!dependencies.length)
|
|
3259
|
+
continue;
|
|
3260
|
+
const covered = dependencies.every((name) => {
|
|
3261
|
+
const peers = checks.flatMap((c, j) => j !== i && c.name === name && c.runId === check.runId && c.headSha === check.headSha && !c.superseded ? [explanations[j]] : []);
|
|
3262
|
+
return peers.length > 0 && peers.every((e) => e && ["known", "runner", "dependent"].includes(e.class));
|
|
3263
|
+
});
|
|
3264
|
+
if (covered) {
|
|
3265
|
+
explanation.class = "dependent";
|
|
3266
|
+
explanation.dependencies = dependencies;
|
|
3267
|
+
changed = true;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
return explanations;
|
|
3199
3272
|
}
|
|
3200
3273
|
function rerunDecision(explanations, attempt) {
|
|
3201
3274
|
const refuse = (reason) => ({ allowed: false, reason, tickets: [] });
|
|
@@ -3206,9 +3279,11 @@ function rerunDecision(explanations, attempt) {
|
|
|
3206
3279
|
const failures = explanations.filter((e) => !e.superseded);
|
|
3207
3280
|
if (!failures.length)
|
|
3208
3281
|
return refuse("No failing checks to rerun");
|
|
3209
|
-
const unknown = failures.filter((e) =>
|
|
3282
|
+
const unknown = failures.filter((e) => !["known", "runner", "dependent"].includes(e.class));
|
|
3210
3283
|
if (unknown.length)
|
|
3211
3284
|
return refuse(`unknown or external failures: ${unknown.map((e) => e.check).join("; ")}`);
|
|
3285
|
+
if (!failures.some((e) => e.class === "known" || e.class === "runner"))
|
|
3286
|
+
return refuse("No real failing checks to rerun");
|
|
3212
3287
|
if (failures.some((e) => e.class === "known" && !e.known))
|
|
3213
3288
|
return refuse("known failure has no root-cause ticket");
|
|
3214
3289
|
return {
|
|
@@ -7475,6 +7550,22 @@ async function fetchJobLog(opts) {
|
|
|
7475
7550
|
return { lines: [], warnings };
|
|
7476
7551
|
}
|
|
7477
7552
|
}
|
|
7553
|
+
async function fetchJobSteps(opts) {
|
|
7554
|
+
return httpRequest(`${GITHUB_REST}/repos/${opts.repository}/actions/jobs/${opts.jobId}`, { headers: { Authorization: `Bearer ${opts.token}`, Accept: "application/vnd.github+json" } }, { ...opts, retry: true, retryStatus, service: "GitHub" }, async (res) => {
|
|
7555
|
+
if (!res.ok)
|
|
7556
|
+
throw new GithubError(`GitHub Actions HTTP ${res.status} reading job steps`);
|
|
7557
|
+
const job = await res.json();
|
|
7558
|
+
if (!job || job.id !== opts.jobId || job.run_id !== opts.runId || job.head_sha !== opts.sha || job.name !== opts.name || job.status !== "completed" || job.conclusion !== "failure" || !Array.isArray(job.steps) || !job.steps.length || job.steps.some((s) => !s || typeof s.name !== "string" || s.conclusion !== null && typeof s.conclusion !== "string" || !Number.isSafeInteger(s.number) || (s.number ?? 0) < 1))
|
|
7559
|
+
throw new GithubError("GitHub Actions returned incomplete or mismatched job steps");
|
|
7560
|
+
if (new Set(job.steps.map((s) => s.number)).size !== job.steps.length)
|
|
7561
|
+
throw new GithubError("GitHub Actions returned duplicate step numbers");
|
|
7562
|
+
return job.steps.map((s) => ({
|
|
7563
|
+
name: s.name,
|
|
7564
|
+
conclusion: s.conclusion,
|
|
7565
|
+
number: s.number
|
|
7566
|
+
}));
|
|
7567
|
+
});
|
|
7568
|
+
}
|
|
7478
7569
|
async function fetchRunAttempt(opts) {
|
|
7479
7570
|
return (await fetchWorkflowRun(opts)).attempt;
|
|
7480
7571
|
}
|
|
@@ -15878,7 +15969,7 @@ ${attachments.join(`
|
|
|
15878
15969
|
};
|
|
15879
15970
|
}
|
|
15880
15971
|
// package.json
|
|
15881
|
-
var version = "0.2.
|
|
15972
|
+
var version = "0.2.61";
|
|
15882
15973
|
|
|
15883
15974
|
// src/io.ts
|
|
15884
15975
|
class UsageError extends Error {
|
|
@@ -17428,7 +17519,7 @@ class ClaudeCodeAdapter {
|
|
|
17428
17519
|
}
|
|
17429
17520
|
|
|
17430
17521
|
// src/doctor.ts
|
|
17431
|
-
import { join as join4 } from "node:path";
|
|
17522
|
+
import { dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
|
|
17432
17523
|
|
|
17433
17524
|
// src/local-tools.ts
|
|
17434
17525
|
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
@@ -17897,8 +17988,8 @@ function keyFileChecks(machine, credentials) {
|
|
|
17897
17988
|
}
|
|
17898
17989
|
];
|
|
17899
17990
|
}
|
|
17900
|
-
async function projectConfig(
|
|
17901
|
-
const text = await
|
|
17991
|
+
async function projectConfig(view) {
|
|
17992
|
+
const text = await view.readFile(CONFIG_FILE);
|
|
17902
17993
|
if (text === null)
|
|
17903
17994
|
return null;
|
|
17904
17995
|
try {
|
|
@@ -18267,11 +18358,20 @@ async function localRuntimeChecks(io, config, options = { readOnly: true }) {
|
|
|
18267
18358
|
];
|
|
18268
18359
|
}
|
|
18269
18360
|
async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
18270
|
-
const
|
|
18361
|
+
const selected = options.configPath || io.env.ARMADA_CONFIG?.trim();
|
|
18362
|
+
const configPath = selected ? resolve2(io.cwd, selected) : null;
|
|
18363
|
+
const checkout = configPath ? dirname4(configPath) : io.cwd;
|
|
18364
|
+
const root = (io.exec ? await gitRoot(io.exec, checkout) : null) ?? checkout;
|
|
18365
|
+
const repository = fsRepoView(root);
|
|
18366
|
+
const view = configPath ? {
|
|
18367
|
+
...repository,
|
|
18368
|
+
readFile: (path) => path === CONFIG_FILE ? io.readFile(configPath) : repository.readFile(path)
|
|
18369
|
+
} : repository;
|
|
18370
|
+
const configFlag = configPath ? ` --config ${shellWord(configPath)}` : "";
|
|
18271
18371
|
const upgrade = (err) => err instanceof ArmadaApiError && err.upgrade ? err : null;
|
|
18272
18372
|
let outdated = null;
|
|
18273
18373
|
let loaded;
|
|
18274
|
-
const config = await projectConfig(
|
|
18374
|
+
const config = await projectConfig(view);
|
|
18275
18375
|
try {
|
|
18276
18376
|
loaded = await loadCredentials(io, config ? { project: config.project.slug } : {});
|
|
18277
18377
|
} catch (err) {
|
|
@@ -18292,7 +18392,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18292
18392
|
}
|
|
18293
18393
|
const signing = await readSigning(io, root);
|
|
18294
18394
|
const checks = [
|
|
18295
|
-
...await checkRepository(
|
|
18395
|
+
...await checkRepository(view, armadaVersion),
|
|
18296
18396
|
...config ? optionalFeatures(config) : [],
|
|
18297
18397
|
...signIn,
|
|
18298
18398
|
...versionChecks(hostOf(credentials.armadaApi.url), api, armadaVersion, outdated),
|
|
@@ -18307,7 +18407,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18307
18407
|
id: `deploy-env:${target.name}`,
|
|
18308
18408
|
level: missing.length ? "warning" : "ok",
|
|
18309
18409
|
message: missing.length ? `${target.name}: ${missing.join(", ")} not set on this machine; deploy check will be skipped` : `${target.name}: required deploy settings are configured`,
|
|
18310
|
-
fix: missing.length ? missing.map((name) => `armada config set deploy.env.${name} <value
|
|
18410
|
+
fix: missing.length ? missing.map((name) => `armada config set deploy.env.${name} <value>${configFlag}`).join(`
|
|
18311
18411
|
`) : null
|
|
18312
18412
|
};
|
|
18313
18413
|
});
|
|
@@ -18316,7 +18416,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18316
18416
|
id: "deploy-machine-settings",
|
|
18317
18417
|
level: "warning",
|
|
18318
18418
|
message: local.warning,
|
|
18319
|
-
fix: checks.find((c) => c.fix)?.fix ??
|
|
18419
|
+
fix: checks.find((c) => c.fix)?.fix ?? `armada config set deploy.env.<VAR> <value>${configFlag}`
|
|
18320
18420
|
});
|
|
18321
18421
|
return checks;
|
|
18322
18422
|
})(),
|
|
@@ -18349,7 +18449,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
18349
18449
|
fix: null
|
|
18350
18450
|
}
|
|
18351
18451
|
] : [],
|
|
18352
|
-
...await localRuntimeChecks(io, config, { ...options, configPath: join4(root, CONFIG_FILE) }),
|
|
18452
|
+
...await localRuntimeChecks(io, config, { ...options, configPath: configPath ?? join4(root, CONFIG_FILE) }),
|
|
18353
18453
|
...config ? await reviewRuntimeChecks(io, root) : [],
|
|
18354
18454
|
...await secretChecks(api, config, credentials)
|
|
18355
18455
|
];
|
|
@@ -18388,8 +18488,8 @@ function renderDoctor(r) {
|
|
|
18388
18488
|
`)}
|
|
18389
18489
|
`;
|
|
18390
18490
|
}
|
|
18391
|
-
async function doctor(io, json, armadaVersion, deep = false) {
|
|
18392
|
-
const report = await buildDoctor(io, armadaVersion, { readOnly: json, deep });
|
|
18491
|
+
async function doctor(io, json, armadaVersion, deep = false, configPath) {
|
|
18492
|
+
const report = await buildDoctor(io, armadaVersion, { readOnly: json, deep, configPath });
|
|
18393
18493
|
io.stdout(json ? `${JSON.stringify(report, null, 2)}
|
|
18394
18494
|
` : renderDoctor(report));
|
|
18395
18495
|
return report.errors ? 1 : 0;
|
|
@@ -19930,7 +20030,7 @@ ${result.stderr}`, secrets) + detail : `Command failed; diagnostics withheld bec
|
|
|
19930
20030
|
}
|
|
19931
20031
|
|
|
19932
20032
|
// src/attach.ts
|
|
19933
|
-
import { resolve as
|
|
20033
|
+
import { resolve as resolve3 } from "node:path";
|
|
19934
20034
|
async function attachItems(io, config, credentials, target) {
|
|
19935
20035
|
const ticket = target.ticket.toUpperCase();
|
|
19936
20036
|
if (!/^[A-Z][A-Z0-9]*-\d+$/.test(ticket))
|
|
@@ -19956,7 +20056,7 @@ async function attachItems(io, config, credentials, target) {
|
|
|
19956
20056
|
} else {
|
|
19957
20057
|
if (!io.readBinaryFile)
|
|
19958
20058
|
throw new UsageError("this CLI cannot read attachment files");
|
|
19959
|
-
const bytes = await io.readBinaryFile(
|
|
20059
|
+
const bytes = await io.readBinaryFile(resolve3(io.cwd, item), MAX_ATTACHMENT_BYTES);
|
|
19960
20060
|
if (!bytes)
|
|
19961
20061
|
throw new UsageError(`attachment file not found: ${item}`);
|
|
19962
20062
|
const contentType = attachmentImageType(bytes) ?? "";
|
|
@@ -19993,7 +20093,7 @@ async function attachCommand(io, config, credentials, args) {
|
|
|
19993
20093
|
}
|
|
19994
20094
|
|
|
19995
20095
|
// src/brief.ts
|
|
19996
|
-
import { dirname as
|
|
20096
|
+
import { dirname as dirname7, join as join5 } from "node:path";
|
|
19997
20097
|
|
|
19998
20098
|
// src/plan-approval.ts
|
|
19999
20099
|
function preApprovalReason(options) {
|
|
@@ -20038,7 +20138,7 @@ async function preparePreApproval(io, config, credentials, briefTicket, reason)
|
|
|
20038
20138
|
}
|
|
20039
20139
|
|
|
20040
20140
|
// src/watch.ts
|
|
20041
|
-
import { dirname as
|
|
20141
|
+
import { dirname as dirname6 } from "node:path";
|
|
20042
20142
|
|
|
20043
20143
|
// src/inbox.ts
|
|
20044
20144
|
var DEFAULT_WAIT_SECONDS = 300;
|
|
@@ -20207,7 +20307,7 @@ async function inbox2(io, config, credentials, a) {
|
|
|
20207
20307
|
}
|
|
20208
20308
|
|
|
20209
20309
|
// src/job.ts
|
|
20210
|
-
import { dirname as
|
|
20310
|
+
import { dirname as dirname5 } from "node:path";
|
|
20211
20311
|
function definition(config, name) {
|
|
20212
20312
|
const job = Object.hasOwn(config.jobs ?? {}, name) ? config.jobs[name] : undefined;
|
|
20213
20313
|
if (!job)
|
|
@@ -20272,7 +20372,7 @@ async function jobCommand(io, config, credentials, args, configPath) {
|
|
|
20272
20372
|
if (!fleet)
|
|
20273
20373
|
throw new UsageError("jobs need a sign-in to Armada", "armada login");
|
|
20274
20374
|
const now = () => io.now?.() ?? new Date;
|
|
20275
|
-
const root =
|
|
20375
|
+
const root = dirname5(configPath);
|
|
20276
20376
|
const print = (jobs) => io.stdout(args.json ? `${JSON.stringify(jobs, null, 2)}
|
|
20277
20377
|
` : jobs.length ? jobs.map((j) => renderJob(j, config, now())).join("") : `No jobs.
|
|
20278
20378
|
`);
|
|
@@ -20718,9 +20818,9 @@ function watchDeadline(until, clock, expire, schedule = (run, ms) => {
|
|
|
20718
20818
|
async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
20719
20819
|
requireSignIn(credentials);
|
|
20720
20820
|
const project = config.project.slug;
|
|
20721
|
-
const name = await coordinatorName(io, project,
|
|
20821
|
+
const name = await coordinatorName(io, project, dirname6(configPath));
|
|
20722
20822
|
const scope = options.scope ?? (name === "default" ? "all" : "mine");
|
|
20723
|
-
io = { ...io, coordinatorRoot:
|
|
20823
|
+
io = { ...io, coordinatorRoot: dirname6(configPath), env: { ...io.env, ARMADA_COORDINATOR: name } };
|
|
20724
20824
|
const paths = machinePaths(io.env);
|
|
20725
20825
|
const pid = io.pid ?? process.pid;
|
|
20726
20826
|
const controller = new AbortController;
|
|
@@ -20787,13 +20887,13 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20787
20887
|
if (!fleet)
|
|
20788
20888
|
throw new Refusal(`the inbox is on Armada, which cannot be reached: ${warning ?? "no answer"}`, "armada whoami");
|
|
20789
20889
|
const before = paths ? await readWatchState(paths, project, name) : null;
|
|
20790
|
-
await remember(io, project, { root:
|
|
20890
|
+
await remember(io, project, { root: dirname6(configPath), stopped: null });
|
|
20791
20891
|
if (until && !io.sleep)
|
|
20792
20892
|
cancelDeadline = watchDeadline(until, () => now(io), () => {
|
|
20793
20893
|
timedOut = true;
|
|
20794
20894
|
controller.abort(new Error("watch duration ended"));
|
|
20795
20895
|
});
|
|
20796
|
-
const watchingFleet = refreshingJobsFleet(watchingIo, observingFleet(watchingIo, fleet, config), config,
|
|
20896
|
+
const watchingFleet = refreshingJobsFleet(watchingIo, observingFleet(watchingIo, fleet, config), config, dirname6(configPath), controller.signal);
|
|
20797
20897
|
const common = {
|
|
20798
20898
|
until,
|
|
20799
20899
|
project,
|
|
@@ -20826,7 +20926,7 @@ async function watchUntil(io, config, credentials, json, configPath, options) {
|
|
|
20826
20926
|
},
|
|
20827
20927
|
onRetry: (message) => io.stderr(`armada: warning: ${message}
|
|
20828
20928
|
`),
|
|
20829
|
-
release: pendingRelease(watchingIo, version, before?.seen ?? [], fsRepoView(
|
|
20929
|
+
release: pendingRelease(watchingIo, version, before?.seen ?? [], fsRepoView(dirname6(configPath)))
|
|
20830
20930
|
};
|
|
20831
20931
|
if (options.follow) {
|
|
20832
20932
|
const cursor = options.cursor ?? before?.cursor ?? eventCursor(0, now(io).toISOString());
|
|
@@ -20913,8 +21013,8 @@ async function hookStop(io, rest, findConfig) {
|
|
|
20913
21013
|
const cwd = typeof input.cwd === "string" && input.cwd ? input.cwd : io.cwd;
|
|
20914
21014
|
const { path, text } = await findConfig({ ...io, cwd });
|
|
20915
21015
|
const project = parseConfig(text, path).project.slug;
|
|
20916
|
-
const { state, running } = await watchOf({ ...io, coordinatorRoot:
|
|
20917
|
-
const d = stopHookDecision({ project, root:
|
|
21016
|
+
const { state, running } = await watchOf({ ...io, coordinatorRoot: dirname6(path) }, project);
|
|
21017
|
+
const d = stopHookDecision({ project, root: dirname6(path), state, watching: running, env: io.env });
|
|
20918
21018
|
if (d.block)
|
|
20919
21019
|
io.stdout(`${JSON.stringify({ decision: "block", reason: d.reason })}
|
|
20920
21020
|
`);
|
|
@@ -21046,7 +21146,7 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
21046
21146
|
if (!credentials.linearApiKey)
|
|
21047
21147
|
throw missingKey(LINEAR_KEY);
|
|
21048
21148
|
const extraPath = config.brief.extra;
|
|
21049
|
-
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join5(
|
|
21149
|
+
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join5(dirname7(configPath), extraPath)).catch(() => null) } : null;
|
|
21050
21150
|
const { fleet } = liveFleet(io, config, credentials);
|
|
21051
21151
|
let b;
|
|
21052
21152
|
try {
|
|
@@ -21129,6 +21229,7 @@ ${next.line}
|
|
|
21129
21229
|
var LABELS = {
|
|
21130
21230
|
known: "known flaky test",
|
|
21131
21231
|
runner: "runner problem",
|
|
21232
|
+
dependent: "ignored as a dependent summary",
|
|
21132
21233
|
failure: "failure",
|
|
21133
21234
|
external: "external check"
|
|
21134
21235
|
};
|
|
@@ -21140,6 +21241,8 @@ function renderCiWhy(sha, explanations) {
|
|
|
21140
21241
|
lines.push("", `${e.check}: ${e.superseded ? "superseded by a newer head" : LABELS[e.class]} (${e.conclusion.toLowerCase()}${e.attempt ? `, workflow attempt ${e.attempt}` : ""})`);
|
|
21141
21242
|
if (e.tests.length)
|
|
21142
21243
|
lines.push(` Tests: ${e.tests.join("; ")}`);
|
|
21244
|
+
if (e.dependencies?.length)
|
|
21245
|
+
lines.push(` Dependencies: ${e.dependencies.join("; ")}`);
|
|
21143
21246
|
lines.push(...e.error.map((l) => ` ${l}`));
|
|
21144
21247
|
if (!e.error.length && !e.superseded)
|
|
21145
21248
|
lines.push(" No error details available; open the check link.");
|
|
@@ -21214,11 +21317,26 @@ async function ciWhy(io, config, credentials, args) {
|
|
|
21214
21317
|
check.attempt = attempts.get(check.runId);
|
|
21215
21318
|
}
|
|
21216
21319
|
}
|
|
21320
|
+
for (const check of reading.checks) {
|
|
21321
|
+
if (check.app !== "github-actions" || check.superseded || check.id === null || check.runId === null || !logs.get(check.id)?.lines.some((l) => l.includes('##[group]Run echo "Dependency failed: ')))
|
|
21322
|
+
continue;
|
|
21323
|
+
try {
|
|
21324
|
+
check.steps = await fetchJobSteps({
|
|
21325
|
+
...opts,
|
|
21326
|
+
jobId: check.id,
|
|
21327
|
+
runId: check.runId,
|
|
21328
|
+
sha: check.headSha,
|
|
21329
|
+
name: check.name
|
|
21330
|
+
});
|
|
21331
|
+
} catch {
|
|
21332
|
+
warnings.push(`job ${check.id}: dependency step evidence unavailable; treating summary as an unknown failure`);
|
|
21333
|
+
}
|
|
21334
|
+
}
|
|
21217
21335
|
const original = explainChecks(reading.checks, logs, config.ci);
|
|
21218
21336
|
const explanations = [...original];
|
|
21219
21337
|
const reruns = [];
|
|
21220
21338
|
if (args.options.rerun) {
|
|
21221
|
-
explanations.sort((a, b) => Number(
|
|
21339
|
+
explanations.sort((a, b) => Number(["known", "runner", "dependent"].includes(a.class)) - Number(["known", "runner", "dependent"].includes(b.class)));
|
|
21222
21340
|
const groups = new Map;
|
|
21223
21341
|
for (const id of reading.runIds)
|
|
21224
21342
|
groups.set(id, []);
|
|
@@ -21334,7 +21452,7 @@ async function configCommand(io, config, args) {
|
|
|
21334
21452
|
|
|
21335
21453
|
// src/deploy.ts
|
|
21336
21454
|
import { createHash as createHash7, randomUUID } from "node:crypto";
|
|
21337
|
-
import { dirname as
|
|
21455
|
+
import { dirname as dirname8, join as join6 } from "node:path";
|
|
21338
21456
|
var hash = (s) => createHash7("sha256").update(s).digest("base64url");
|
|
21339
21457
|
var sleepOf2 = (io) => io.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
21340
21458
|
async function recordDeploy(io, write, input) {
|
|
@@ -21387,7 +21505,7 @@ async function startDeploys(io, config, credentials, configPath, sha, targets, j
|
|
|
21387
21505
|
const target = config.deploy?.targets.find((t) => t.name === name);
|
|
21388
21506
|
if (!target)
|
|
21389
21507
|
continue;
|
|
21390
|
-
const { missing } = resolveDeployEnv(target, local.env, io.env);
|
|
21508
|
+
const { missing, env } = resolveDeployEnv(target, local.env, io.env);
|
|
21391
21509
|
if (missing.length) {
|
|
21392
21510
|
await skipUnconfigured(io, config, credentials, target, sha, missing);
|
|
21393
21511
|
results.push({ target: name, started: false, next: null, skipped: true });
|
|
@@ -21398,7 +21516,10 @@ async function startDeploys(io, config, credentials, configPath, sha, targets, j
|
|
|
21398
21516
|
let started = false;
|
|
21399
21517
|
try {
|
|
21400
21518
|
const paths = machinePaths(io.env);
|
|
21401
|
-
started = (sha ? await io.startBackground?.(args,
|
|
21519
|
+
started = (sha ? await io.startBackground?.(args, {
|
|
21520
|
+
env: { ...io.env, ...env },
|
|
21521
|
+
...paths ? { logPath: join6(paths.dir, "watch", `deploy-${hash(`${config.project.slug}/${name}/${sha}`)}.log`) } : {}
|
|
21522
|
+
}) : false) ?? false;
|
|
21402
21523
|
} catch {}
|
|
21403
21524
|
results.push({ target: name, started, next: started ? null : next });
|
|
21404
21525
|
if (!json)
|
|
@@ -21483,7 +21604,7 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21483
21604
|
base,
|
|
21484
21605
|
head
|
|
21485
21606
|
}) : (await io.exec?.("git", ["merge-base", "--is-ancestor", base, head], {
|
|
21486
|
-
cwd:
|
|
21607
|
+
cwd: dirname8(configPath),
|
|
21487
21608
|
timeoutMs: 1e4
|
|
21488
21609
|
}))?.code === 0;
|
|
21489
21610
|
if (credentials.githubToken || answer)
|
|
@@ -21501,7 +21622,8 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21501
21622
|
return fleet.recordDeploy({ ...candidate, detail: clean(candidate.detail) });
|
|
21502
21623
|
}, input);
|
|
21503
21624
|
const holder = `deploy-${randomUUID()}`;
|
|
21504
|
-
const cwd =
|
|
21625
|
+
const cwd = dirname8(configPath);
|
|
21626
|
+
let configurationDetail = "";
|
|
21505
21627
|
const command = async (command, liveSha, remainingMs) => {
|
|
21506
21628
|
const result = await io.exec?.("sh", ["-c", command], {
|
|
21507
21629
|
cwd,
|
|
@@ -21509,12 +21631,21 @@ async function deploy2(io, config, credentials, args, configPath) {
|
|
|
21509
21631
|
maxOutputBytes: 64 * 1024,
|
|
21510
21632
|
processGroup: true,
|
|
21511
21633
|
env: { ...io.env, ...settings.env, ARMADA_DEPLOY_SHA: liveSha, ARMADA_DEPLOY_TARGET: target.name }
|
|
21634
|
+
}).catch((err) => {
|
|
21635
|
+
if (err.code !== "ENOENT" && err.code !== "ENOTDIR")
|
|
21636
|
+
throw err;
|
|
21637
|
+
return { code: 127, stdout: "", stderr: err.message, timedOut: false };
|
|
21512
21638
|
});
|
|
21639
|
+
const notRunnable = !!result && !result.timedOut && result.code !== 0 && (result.code === 127 || /(?:^|\n)[^\n]*(?:sh|bash|dash|zsh):[^\n]*(?:[A-Za-z_][A-Za-z0-9_]*: (?:set [A-Za-z_][A-Za-z0-9_]*|parameter (?:null or )?not set|unbound variable)|cd:[^\n]*(?:can't cd|cannot|No such file|not a directory))/i.test(result.stderr) || [...command.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*):?\?/g)].some((match) => result.stderr.includes(`${match[1]}:`)));
|
|
21640
|
+
const detail = deployDetail(clean(`${result?.stdout ?? ""}
|
|
21641
|
+
${result?.stderr ?? ""}
|
|
21642
|
+
${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`));
|
|
21643
|
+
if (notRunnable)
|
|
21644
|
+
configurationDetail = detail;
|
|
21513
21645
|
return {
|
|
21514
21646
|
ok: result?.code === 0 && !result.timedOut,
|
|
21515
|
-
detail
|
|
21516
|
-
|
|
21517
|
-
${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
21647
|
+
detail,
|
|
21648
|
+
notRunnable,
|
|
21518
21649
|
stdout: result?.stdout ?? ""
|
|
21519
21650
|
};
|
|
21520
21651
|
};
|
|
@@ -21544,9 +21675,9 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21544
21675
|
target: target.name,
|
|
21545
21676
|
sha: liveSha,
|
|
21546
21677
|
liveSha,
|
|
21547
|
-
state: result.ok ? "healthy" : "smoke-failed",
|
|
21678
|
+
state: result.notRunnable ? "not-runnable" : result.ok ? "healthy" : "smoke-failed",
|
|
21548
21679
|
detail: result.detail,
|
|
21549
|
-
pauseOnFailure: target.pauseOnFailure
|
|
21680
|
+
pauseOnFailure: !result.notRunnable && target.pauseOnFailure
|
|
21550
21681
|
});
|
|
21551
21682
|
return result;
|
|
21552
21683
|
} finally {
|
|
@@ -21560,7 +21691,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21560
21691
|
};
|
|
21561
21692
|
try {
|
|
21562
21693
|
const prior = (await fleet.deployState({ target: target.name, sha }))[0];
|
|
21563
|
-
if (prior && !["waiting", "live", "skipped"].includes(prior.state)) {
|
|
21694
|
+
if (prior && !["waiting", "live", "skipped", "not-runnable"].includes(prior.state)) {
|
|
21564
21695
|
io.backgroundReady?.(true);
|
|
21565
21696
|
io.stdout(`${target.name}: ${prior.state}
|
|
21566
21697
|
`);
|
|
@@ -21577,7 +21708,7 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21577
21708
|
const result = await watchDeploy({
|
|
21578
21709
|
target,
|
|
21579
21710
|
sha,
|
|
21580
|
-
...prior && prior.state
|
|
21711
|
+
...prior && !["skipped", "not-runnable"].includes(prior.state) ? { startedAt: new Date(prior.startedAt) } : {},
|
|
21581
21712
|
now,
|
|
21582
21713
|
sleep: sleepOf2(io),
|
|
21583
21714
|
record: write,
|
|
@@ -21598,13 +21729,18 @@ ${result?.timedOut ? "command timed out" : `exit ${result?.code ?? 1}`}`)),
|
|
|
21598
21729
|
return {
|
|
21599
21730
|
sha: result.ok && /^[0-9a-f]{40}$/.test(liveSha) ? liveSha : null,
|
|
21600
21731
|
state: result.ok && /^[0-9a-f]{40}$/.test(liveSha) ? "success" : "pending",
|
|
21601
|
-
detail: result.detail
|
|
21732
|
+
detail: result.detail,
|
|
21733
|
+
notRunnable: result.notRunnable
|
|
21602
21734
|
};
|
|
21603
21735
|
}
|
|
21604
21736
|
});
|
|
21605
|
-
|
|
21737
|
+
if (result === "not-runnable")
|
|
21738
|
+
io.stderr(`armada: warning: ${target.name}: deploy check not runnable on this machine (configuration)
|
|
21739
|
+
${configurationDetail}
|
|
21740
|
+
`);
|
|
21741
|
+
io.stdout(`${target.name}: ${result === "not-runnable" ? "not runnable (configuration)" : result}
|
|
21606
21742
|
`);
|
|
21607
|
-
return result === "healthy" ? 0 : 1;
|
|
21743
|
+
return result === "healthy" || result === "not-runnable" ? 0 : 1;
|
|
21608
21744
|
} catch (err) {
|
|
21609
21745
|
io.backgroundReady?.(false);
|
|
21610
21746
|
io.stderr(`armada: deploy watcher failed: ${clean(err instanceof Error ? err.message : "unexpected failure")}
|
|
@@ -21790,10 +21926,10 @@ import { join as join9 } from "node:path";
|
|
|
21790
21926
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
21791
21927
|
import { rm as rm3 } from "node:fs/promises";
|
|
21792
21928
|
import { hostname, tmpdir } from "node:os";
|
|
21793
|
-
import { dirname as
|
|
21929
|
+
import { dirname as dirname11, join as join8 } from "node:path";
|
|
21794
21930
|
|
|
21795
21931
|
// src/after-merge.ts
|
|
21796
|
-
import { dirname as
|
|
21932
|
+
import { dirname as dirname10, resolve as resolve5 } from "node:path";
|
|
21797
21933
|
|
|
21798
21934
|
// src/deferred-launch.ts
|
|
21799
21935
|
async function launchDeferredAfterMerge(outcome, config, fleet, launch) {
|
|
@@ -21841,7 +21977,7 @@ async function launchDeferredAfterMerge(outcome, config, fleet, launch) {
|
|
|
21841
21977
|
|
|
21842
21978
|
// src/launch.ts
|
|
21843
21979
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
21844
|
-
import { basename, dirname as
|
|
21980
|
+
import { basename, dirname as dirname9, join as join7, resolve as resolve4 } from "node:path";
|
|
21845
21981
|
async function launch(io, config, credentials, args, version, configPath) {
|
|
21846
21982
|
if (args.options["when-unblocked"] || args.options.after !== undefined)
|
|
21847
21983
|
return deferLaunch(io, config, credentials, args);
|
|
@@ -22039,7 +22175,7 @@ async function prepareLaunch(io, config, credentials, args, version, configPath,
|
|
|
22039
22175
|
gaps.push(error instanceof UsageError ? error.message : "could not read the repository state");
|
|
22040
22176
|
}
|
|
22041
22177
|
runtime = runtimeFor({ ...io, cwd: repo }, config, runtimeName);
|
|
22042
|
-
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join7(
|
|
22178
|
+
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join7(dirname9(configPath), config.brief.extra)) } : null;
|
|
22043
22179
|
const sharedResources = await reservationsForBrief(() => fleet.reservations(), config.reservations.length > 0);
|
|
22044
22180
|
const npm = await checkPublished(version, io.fetch ?? fetch);
|
|
22045
22181
|
if (npm.state === "missing") {
|
|
@@ -22363,7 +22499,7 @@ async function readNotes(io, path) {
|
|
|
22363
22499
|
throw new UsageError("--notes - needs standard input");
|
|
22364
22500
|
text = await io.readStdin();
|
|
22365
22501
|
} else
|
|
22366
|
-
text = await io.readFile(
|
|
22502
|
+
text = await io.readFile(resolve4(io.cwd, path));
|
|
22367
22503
|
} catch {
|
|
22368
22504
|
throw new UsageError("could not read --notes; supply a readable file or - for standard input");
|
|
22369
22505
|
}
|
|
@@ -22398,7 +22534,7 @@ async function launchPlan(io, json, input) {
|
|
|
22398
22534
|
cwd: repo,
|
|
22399
22535
|
timeoutMs: 1e4
|
|
22400
22536
|
});
|
|
22401
|
-
const mainRoot = common.code === 0 && common.stdout.trim().startsWith("/") ?
|
|
22537
|
+
const mainRoot = common.code === 0 && common.stdout.trim().startsWith("/") ? dirname9(common.stdout.trim()) : repo;
|
|
22402
22538
|
const remote = await execute("git", ["ls-remote", "--symref", "origin", "HEAD"], { cwd: repo, timeoutMs: 20000 });
|
|
22403
22539
|
base = remote.code === 0 ? remote.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD/m)?.[1] ?? null : null;
|
|
22404
22540
|
if (!base)
|
|
@@ -22598,7 +22734,7 @@ async function afterMerge(io, config, credentials, outcome, opts) {
|
|
|
22598
22734
|
rest: [request.ticket],
|
|
22599
22735
|
json: false,
|
|
22600
22736
|
options: request.profile ? { profile: request.profile, reason: "deferred launch requested by the coordinator" } : {}
|
|
22601
|
-
}, version, opts.configPath ??
|
|
22737
|
+
}, version, opts.configPath ?? resolve5(io.cwd, "armada.toml"));
|
|
22602
22738
|
if (code !== 0)
|
|
22603
22739
|
throw new UsageError("the launcher did not start a worker");
|
|
22604
22740
|
return printed.join("");
|
|
@@ -22626,7 +22762,7 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22626
22762
|
const who = `${outcome.ticket.id} (${[a.runtime, a.handle].filter(Boolean).join(" · ") || "session unknown"})`;
|
|
22627
22763
|
return result(false, `No runtime guide is installed for ${a.runtime ?? "the worker's runtime"}, so Armada has nothing to archive for ${who}: a local session or subagent ends with its task; stop it yourself if it still runs.`);
|
|
22628
22764
|
}
|
|
22629
|
-
const configPath = opts.configPath ?
|
|
22765
|
+
const configPath = opts.configPath ? resolve5(io.cwd, opts.configPath) : null;
|
|
22630
22766
|
const recovery = `armada stop ${shellWord(outcome.ticket.id)} --merged-pr ${shellWord(outcome.pr.url)}${a.source === "armada" && a.claim?.releasedAt ? ` --claim-key ${archiveClaimKey(claimRef(a.claim))}` : ""}${configPath ? ` --config ${shellWord(configPath)}` : ""}`;
|
|
22631
22767
|
const failure = (detail) => {
|
|
22632
22768
|
const safe = redactRuntimeText(detail).replace(/\s+/g, " ").trim();
|
|
@@ -22650,7 +22786,7 @@ async function archiveWorker(io, config, credentials, outcome, opts) {
|
|
|
22650
22786
|
if (!fleet)
|
|
22651
22787
|
return failure("Armada is unavailable");
|
|
22652
22788
|
const ref = claimRef(h);
|
|
22653
|
-
const adapter = runtimeFor(configPath ? { ...io, cwd:
|
|
22789
|
+
const adapter = runtimeFor(configPath ? { ...io, cwd: dirname10(configPath) } : io, config, h.runtime);
|
|
22654
22790
|
const archived = await guarded(fleet, ref, "ended", () => adapter.archive(ref, { reason: "merged", whenWorking: "wait", waitMs: 600000 }));
|
|
22655
22791
|
if (!archived.archived && !archived.alreadyGone)
|
|
22656
22792
|
return failure("the runtime did not confirm archive");
|
|
@@ -23101,7 +23237,7 @@ async function merge2(io, config, credentials, a, configPath, guards) {
|
|
|
23101
23237
|
if (!exec)
|
|
23102
23238
|
throw new UsageError("armada merge needs to run git and gh");
|
|
23103
23239
|
const linearApiKey = credentials.linearApiKey;
|
|
23104
|
-
const repoDir =
|
|
23240
|
+
const repoDir = dirname11(configPath);
|
|
23105
23241
|
const fetchOpt = httpOptions(io);
|
|
23106
23242
|
const gh = { token, repository: config.github.repository, ...fetchOpt };
|
|
23107
23243
|
const linearOpts = { apiKey: linearApiKey, labels: config.tracker.labels, ...fetchOpt };
|
|
@@ -24327,7 +24463,7 @@ ${"─".repeat(60)}
|
|
|
24327
24463
|
|
|
24328
24464
|
// src/relaunch.ts
|
|
24329
24465
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
24330
|
-
import { basename as basename2, dirname as
|
|
24466
|
+
import { basename as basename2, dirname as dirname12, join as join10 } from "node:path";
|
|
24331
24467
|
async function relaunch(io, config, credentials, args, version, configPath) {
|
|
24332
24468
|
const [input, ...extra] = args.rest;
|
|
24333
24469
|
const o = args.options;
|
|
@@ -24466,7 +24602,7 @@ async function relaunch(io, config, credentials, args, version, configPath) {
|
|
|
24466
24602
|
const configHome = io.env.XDG_CONFIG_HOME ?? (io.env.HOME ? join10(io.env.HOME, ".config") : null);
|
|
24467
24603
|
const path = io.env.HERDR_CONFIG_PATH ?? (configHome ? join10(configHome, "herdr", "config.toml") : null);
|
|
24468
24604
|
const text = path ? await io.readFile(path).catch(() => null) : null;
|
|
24469
|
-
const directory = workspace?.path && old.runtime === "herdr" ?
|
|
24605
|
+
const directory = workspace?.path && old.runtime === "herdr" ? dirname12(workspace.path) : dirname12(herdrWorktreePath(herdrWorktreesDirectory(io.env, text), basename2(prepared.repo), prepared.spec.branch));
|
|
24470
24606
|
prepared.spec.herdrTarget = {
|
|
24471
24607
|
path: join10(directory, `armada-relaunch-${ticket.toLowerCase()}-${suffix}`),
|
|
24472
24608
|
agent: `relaunch-${ticket.toLowerCase()}-${suffix}`.slice(0, 31)
|
|
@@ -24717,7 +24853,7 @@ async function unreserveCommand(io, config, credentials, args) {
|
|
|
24717
24853
|
}
|
|
24718
24854
|
|
|
24719
24855
|
// src/secrets.ts
|
|
24720
|
-
import { dirname as
|
|
24856
|
+
import { dirname as dirname13, relative as relative3, resolve as resolve6 } from "node:path";
|
|
24721
24857
|
var NAME_HINT = "upper snake case, e.g. OPENAI_API_KEY";
|
|
24722
24858
|
var hhmm2 = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
|
|
24723
24859
|
function signInOf(config, credentials) {
|
|
@@ -24797,7 +24933,7 @@ Next: armada secrets set <NAME> (an owner or admin), or the Keys page of Armada
|
|
|
24797
24933
|
async function exportRefusal(io, path) {
|
|
24798
24934
|
if (!io.exec)
|
|
24799
24935
|
return "git cannot be run here to check that the file is ignored";
|
|
24800
|
-
const cwd =
|
|
24936
|
+
const cwd = dirname13(path);
|
|
24801
24937
|
const tracked = await io.exec("git", ["ls-files", "--error-unmatch", "--", path], { cwd }).catch(() => null);
|
|
24802
24938
|
if (tracked?.code === 0)
|
|
24803
24939
|
return `git tracks ${path}: secrets written there would be committed`;
|
|
@@ -24904,7 +25040,7 @@ When set, re-run with armada run -- <command>. Never paste a key into chat.
|
|
|
24904
25040
|
const file = args.options.file;
|
|
24905
25041
|
if (!file)
|
|
24906
25042
|
throw new UsageError("secrets export needs --file <path>, a file git ignores (e.g. .env.local)");
|
|
24907
|
-
const path =
|
|
25043
|
+
const path = resolve6(io.cwd, file);
|
|
24908
25044
|
const refusal = await exportRefusal(io, path);
|
|
24909
25045
|
if (refusal)
|
|
24910
25046
|
throw new UsageError(refusal, "a path git ignores, e.g. .env.local listed in .gitignore");
|
|
@@ -25194,7 +25330,7 @@ async function upgrade(io, running, root) {
|
|
|
25194
25330
|
}
|
|
25195
25331
|
|
|
25196
25332
|
// src/validate.ts
|
|
25197
|
-
import { basename as basename3, resolve as
|
|
25333
|
+
import { basename as basename3, resolve as resolve7 } from "node:path";
|
|
25198
25334
|
async function readExcerpt(io, raw) {
|
|
25199
25335
|
const match = /^(.*):(\d+)-(\d+)$/.exec(raw);
|
|
25200
25336
|
const file = match?.[1] ?? raw;
|
|
@@ -25203,7 +25339,7 @@ async function readExcerpt(io, raw) {
|
|
|
25203
25339
|
const usage = `armada validate "<headline>" --excerpt '${file.replaceAll("'", "'\\''")}':1-40`;
|
|
25204
25340
|
if (!file || !Number.isSafeInteger(from) || from < 1 || to !== null && (!Number.isSafeInteger(to) || to < from))
|
|
25205
25341
|
throw new UsageError(`--excerpt needs <file>[:from-to], with a one-based inclusive range: ${usage}`);
|
|
25206
|
-
const text = await io.readFile(
|
|
25342
|
+
const text = await io.readFile(resolve7(io.cwd, file));
|
|
25207
25343
|
if (text === null)
|
|
25208
25344
|
throw new UsageError(`cannot read excerpt file: ${file}`);
|
|
25209
25345
|
const lines = excerptLines(text);
|
|
@@ -25218,7 +25354,7 @@ async function readExcerpt(io, raw) {
|
|
|
25218
25354
|
async function validationFiles(io, options) {
|
|
25219
25355
|
const excerpts = await Promise.all(attachList(options.excerpt).map((raw) => readExcerpt(io, raw)));
|
|
25220
25356
|
const file = options["details-file"];
|
|
25221
|
-
const details = file ? await io.readFile(
|
|
25357
|
+
const details = file ? await io.readFile(resolve7(io.cwd, file)) : null;
|
|
25222
25358
|
if (file && details === null)
|
|
25223
25359
|
throw new UsageError(`cannot read details file: ${file}`);
|
|
25224
25360
|
return { excerpts, details };
|
|
@@ -26047,21 +26183,21 @@ async function findConfig(io, explicit, command = "status", project = null) {
|
|
|
26047
26183
|
selected = join11(checkout.root, CONFIG_FILE);
|
|
26048
26184
|
}
|
|
26049
26185
|
if (selected) {
|
|
26050
|
-
const path =
|
|
26186
|
+
const path = resolve8(io.cwd, selected);
|
|
26051
26187
|
const text = await io.readFile(path);
|
|
26052
26188
|
if (text === null)
|
|
26053
26189
|
throw new UsageError(`${path} does not exist`, `armada ${command} --config <file>, with the path of an ${CONFIG_FILE}`);
|
|
26054
|
-
io.coordinatorRoot =
|
|
26190
|
+
io.coordinatorRoot = dirname14(path);
|
|
26055
26191
|
return { path, text };
|
|
26056
26192
|
}
|
|
26057
|
-
for (let dir =
|
|
26193
|
+
for (let dir = resolve8(io.cwd);; dir = dirname14(dir)) {
|
|
26058
26194
|
const path = join11(dir, CONFIG_FILE);
|
|
26059
26195
|
const text = await io.readFile(path);
|
|
26060
26196
|
if (text !== null) {
|
|
26061
|
-
io.coordinatorRoot =
|
|
26197
|
+
io.coordinatorRoot = dirname14(path);
|
|
26062
26198
|
return { path, text };
|
|
26063
26199
|
}
|
|
26064
|
-
if (
|
|
26200
|
+
if (dirname14(dir) === dir)
|
|
26065
26201
|
break;
|
|
26066
26202
|
}
|
|
26067
26203
|
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`);
|
|
@@ -26085,7 +26221,7 @@ async function status2(io, args) {
|
|
|
26085
26221
|
...httpOptions(io),
|
|
26086
26222
|
...io.now ? { now: io.now } : {}
|
|
26087
26223
|
});
|
|
26088
|
-
const behind = await skillsBehind(fsRepoView(
|
|
26224
|
+
const behind = await skillsBehind(fsRepoView(dirname14(path))).catch(() => null);
|
|
26089
26225
|
if (behind)
|
|
26090
26226
|
report.warnings.push(skillsBehindLine(behind, version));
|
|
26091
26227
|
let deploys = null;
|
|
@@ -26145,7 +26281,7 @@ async function run(argv, io) {
|
|
|
26145
26281
|
if (args.all)
|
|
26146
26282
|
return await noticeRelease(io, version);
|
|
26147
26283
|
const { path } = await findConfig(io, args.config, command, args.project);
|
|
26148
|
-
await noticeRelease(io, version, fsRepoView(
|
|
26284
|
+
await noticeRelease(io, version, fsRepoView(dirname14(path)));
|
|
26149
26285
|
})().catch(() => {});
|
|
26150
26286
|
return code;
|
|
26151
26287
|
}
|
|
@@ -26306,7 +26442,7 @@ async function dispatch(argv, io) {
|
|
|
26306
26442
|
const { credentials } = await loadCredentials(io, scope ? { worker: scope } : { project: config.project.slug });
|
|
26307
26443
|
if (command === "inbox")
|
|
26308
26444
|
await recordPresence(io, config, credentials);
|
|
26309
|
-
return await worker(command === "stop" ? { ...io, cwd:
|
|
26445
|
+
return await worker(command === "stop" ? { ...io, cwd: dirname14(path) } : io, config, credentials, args);
|
|
26310
26446
|
}
|
|
26311
26447
|
if (args.command === "coordinator") {
|
|
26312
26448
|
const { text } = await findConfig(io, args.config, "coordinator", args.project);
|
|
@@ -26317,7 +26453,7 @@ async function dispatch(argv, io) {
|
|
|
26317
26453
|
if (args.command === "peek") {
|
|
26318
26454
|
const { path, text } = await findConfig(io, args.config, "peek", args.project);
|
|
26319
26455
|
const config = parseConfig(text, path);
|
|
26320
|
-
const selectedIo = { ...io, cwd:
|
|
26456
|
+
const selectedIo = { ...io, cwd: dirname14(path) };
|
|
26321
26457
|
const local = await loadCredentials(selectedIo, {
|
|
26322
26458
|
armada: false,
|
|
26323
26459
|
worker: {
|
|
@@ -26403,7 +26539,7 @@ async function dispatch(argv, io) {
|
|
|
26403
26539
|
}
|
|
26404
26540
|
if (args.command === "doctor") {
|
|
26405
26541
|
noExtra(args.rest);
|
|
26406
|
-
return await doctor(io, args.json, version, args.options.deep === "true");
|
|
26542
|
+
return await doctor(io, args.json, version, args.options.deep === "true", args.config ?? undefined);
|
|
26407
26543
|
}
|
|
26408
26544
|
if (args.command === "upgrade") {
|
|
26409
26545
|
noExtra(args.rest);
|
|
@@ -26413,8 +26549,8 @@ async function dispatch(argv, io) {
|
|
|
26413
26549
|
const { credentials } = await loadCredentials(io, { armada: false });
|
|
26414
26550
|
if (credentials.armadaSignIn?.kind === "worker" || !credentials.armadaSignIn && credentials.workerTickets.length || io.env.ARMADA_TICKET?.trim())
|
|
26415
26551
|
throw new UsageError("workers keep their launch's pinned version; the coordinator runs armada upgrade");
|
|
26416
|
-
const root = await gitRoot(requireExec(io),
|
|
26417
|
-
if (basename4(path) !== CONFIG_FILE || root !==
|
|
26552
|
+
const root = await gitRoot(requireExec(io), dirname14(path));
|
|
26553
|
+
if (basename4(path) !== CONFIG_FILE || root !== dirname14(path))
|
|
26418
26554
|
throw new UsageError("armada upgrade needs armada.toml at the selected repository's Git root; use that checkout's armada.toml");
|
|
26419
26555
|
if (credentials.armadaSignIn)
|
|
26420
26556
|
try {
|
|
@@ -26681,7 +26817,7 @@ async function inspectProcess(exec, pid, system = {
|
|
|
26681
26817
|
import { spawn as spawn2 } from "node:child_process";
|
|
26682
26818
|
import { closeSync, fstatSync, mkdirSync, mkdtempSync, openSync, readSync, rmSync } from "node:fs";
|
|
26683
26819
|
import { constants, tmpdir as tmpdir3 } from "node:os";
|
|
26684
|
-
import { dirname as
|
|
26820
|
+
import { dirname as dirname15, join as join12 } from "node:path";
|
|
26685
26821
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
26686
26822
|
var spawnInherited = (command, args, { cwd, env, output }) => new Promise((done, fail) => {
|
|
26687
26823
|
const child = spawn2(command, args, { cwd, env, stdio: output ? ["inherit", "pipe", "pipe"] : "inherit" });
|
|
@@ -26719,7 +26855,7 @@ var startBackground = (args, options) => new Promise((resolve) => {
|
|
|
26719
26855
|
let log;
|
|
26720
26856
|
try {
|
|
26721
26857
|
if (options?.logPath) {
|
|
26722
|
-
mkdirSync(
|
|
26858
|
+
mkdirSync(dirname15(options.logPath), { recursive: true, mode: 448 });
|
|
26723
26859
|
log = openSync(options.logPath, "a", 384);
|
|
26724
26860
|
}
|
|
26725
26861
|
} catch {
|
|
@@ -26727,7 +26863,7 @@ var startBackground = (args, options) => new Promise((resolve) => {
|
|
|
26727
26863
|
}
|
|
26728
26864
|
const child = spawn2(process.execPath, [...process.execArgv, process.argv[1], ...args], {
|
|
26729
26865
|
cwd: process.cwd(),
|
|
26730
|
-
env: process.env,
|
|
26866
|
+
env: options?.env ?? process.env,
|
|
26731
26867
|
detached: true,
|
|
26732
26868
|
stdio: ["ignore", log ?? "ignore", log ?? "ignore", "ipc"]
|
|
26733
26869
|
});
|