@the-vibe-company/armada 0.2.46 → 0.2.48
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 +162 -35
- package/package.json +1 -1
package/dist/armada.js
CHANGED
|
@@ -8,7 +8,7 @@ import { hostname as hostname2 } from "node:os";
|
|
|
8
8
|
import { isatty } from "node:tty";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
|
-
import { dirname as dirname9, join as
|
|
11
|
+
import { dirname as dirname9, join as join9, resolve as resolve3 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../core/src/types.ts
|
|
14
14
|
var LABEL_PHASES = [
|
|
@@ -10491,7 +10491,7 @@ ${attachments.join(`
|
|
|
10491
10491
|
};
|
|
10492
10492
|
}
|
|
10493
10493
|
// package.json
|
|
10494
|
-
var version = "0.2.
|
|
10494
|
+
var version = "0.2.48";
|
|
10495
10495
|
|
|
10496
10496
|
// src/attach.ts
|
|
10497
10497
|
import { resolve } from "node:path";
|
|
@@ -10824,7 +10824,7 @@ async function authLogout(io) {
|
|
|
10824
10824
|
}
|
|
10825
10825
|
|
|
10826
10826
|
// src/brief.ts
|
|
10827
|
-
import { dirname as dirname4, join as
|
|
10827
|
+
import { dirname as dirname4, join as join3 } from "node:path";
|
|
10828
10828
|
|
|
10829
10829
|
// src/watch.ts
|
|
10830
10830
|
import { dirname as dirname3 } from "node:path";
|
|
@@ -11030,7 +11030,7 @@ async function logout(io) {
|
|
|
11030
11030
|
|
|
11031
11031
|
// src/herdr.ts
|
|
11032
11032
|
import { createHash as createHash3 } from "node:crypto";
|
|
11033
|
-
import { dirname as dirname2 } from "node:path";
|
|
11033
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
11034
11034
|
|
|
11035
11035
|
// src/first-run.ts
|
|
11036
11036
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -11176,6 +11176,46 @@ var harnessArgs = (p) => [
|
|
|
11176
11176
|
];
|
|
11177
11177
|
var object = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : null;
|
|
11178
11178
|
var id = (v) => typeof v === "string" && /^[a-zA-Z0-9][a-zA-Z0-9:_-]{0,127}$/.test(v);
|
|
11179
|
+
function herdrWorktreesDirectory(env, configText) {
|
|
11180
|
+
const configured = configText ? worktreesDirectoryOf(configText) : null;
|
|
11181
|
+
const directory = configured ?? "~/.herdr/worktrees";
|
|
11182
|
+
const home = env.HOME;
|
|
11183
|
+
if (directory === "~")
|
|
11184
|
+
return home ?? directory;
|
|
11185
|
+
if (directory.startsWith("~/"))
|
|
11186
|
+
return home ? join2(home, directory.slice(2)) : directory;
|
|
11187
|
+
return directory;
|
|
11188
|
+
}
|
|
11189
|
+
function herdrWorktreePath(directory, repoName, branch) {
|
|
11190
|
+
return join2(directory, repoName, branch.replaceAll("/", "-"));
|
|
11191
|
+
}
|
|
11192
|
+
function worktreesDirectoryOf(text) {
|
|
11193
|
+
let inWorktrees = false;
|
|
11194
|
+
for (const raw of text.split(`
|
|
11195
|
+
`)) {
|
|
11196
|
+
const line = raw.trim();
|
|
11197
|
+
if (!line || line.startsWith("#"))
|
|
11198
|
+
continue;
|
|
11199
|
+
const table = line.match(/^\[([^\]]+)\]\s*(?:#.*)?$/);
|
|
11200
|
+
if (table) {
|
|
11201
|
+
inWorktrees = table[1]?.trim() === "worktrees";
|
|
11202
|
+
continue;
|
|
11203
|
+
}
|
|
11204
|
+
if (!inWorktrees)
|
|
11205
|
+
continue;
|
|
11206
|
+
const value = line.match(/^directory\s*=\s*("(?:[^"\\]|\\.)*"|'[^']*')\s*(?:#.*)?$/)?.[1];
|
|
11207
|
+
if (!value)
|
|
11208
|
+
continue;
|
|
11209
|
+
if (value.startsWith("'"))
|
|
11210
|
+
return value.slice(1, -1);
|
|
11211
|
+
try {
|
|
11212
|
+
return JSON.parse(value);
|
|
11213
|
+
} catch {
|
|
11214
|
+
return null;
|
|
11215
|
+
}
|
|
11216
|
+
}
|
|
11217
|
+
return null;
|
|
11218
|
+
}
|
|
11179
11219
|
function parseHerdrHandle(raw) {
|
|
11180
11220
|
let h = null;
|
|
11181
11221
|
try {
|
|
@@ -11437,7 +11477,7 @@ class Herdr {
|
|
|
11437
11477
|
"--",
|
|
11438
11478
|
...harnessArgs(profile)
|
|
11439
11479
|
]);
|
|
11440
|
-
this.
|
|
11480
|
+
await this.checkLaunchAgent(r, handle, profile.harness);
|
|
11441
11481
|
if (verifyModel && herdrHarnessKind(profile.harness) === "opencode") {
|
|
11442
11482
|
try {
|
|
11443
11483
|
await verifyOpenCodeModel(this.io, handle.pane, profile.model);
|
|
@@ -11452,9 +11492,7 @@ class Herdr {
|
|
|
11452
11492
|
}
|
|
11453
11493
|
}
|
|
11454
11494
|
async inspect(handle, harness) {
|
|
11455
|
-
const agent = this.
|
|
11456
|
-
if (agent.agent !== undefined && agent.agent !== null && agent.agent !== herdrHarnessKind(harness))
|
|
11457
|
-
throw new UsageError("herdr worker harness changed; inspect herdr agent list before retrying");
|
|
11495
|
+
const agent = await this.checkLaunchAgent(await this.call(["agent", "get", handle.pane], 5000), handle, harness);
|
|
11458
11496
|
const state = agent.agent_status;
|
|
11459
11497
|
if (!["working", "blocked", "idle", "done", "unknown"].includes(String(state)))
|
|
11460
11498
|
throw new UsageError("invalid herdr agent state");
|
|
@@ -11470,7 +11508,7 @@ class Herdr {
|
|
|
11470
11508
|
throw new Error("read failed");
|
|
11471
11509
|
text = result.stdout;
|
|
11472
11510
|
} catch {
|
|
11473
|
-
throw new UsageError(`could not inspect the worker screen; run herdr agent attach ${handle.
|
|
11511
|
+
throw new UsageError(`could not inspect the worker screen; run herdr agent attach ${handle.pane}`);
|
|
11474
11512
|
}
|
|
11475
11513
|
return {
|
|
11476
11514
|
state,
|
|
@@ -11479,7 +11517,7 @@ class Herdr {
|
|
|
11479
11517
|
};
|
|
11480
11518
|
}
|
|
11481
11519
|
screenError(handle, issue, message = "The harness needs the owner's attention") {
|
|
11482
|
-
return new UsageError(`${issue?.message ?? message}: run armada setup local, or answer it with herdr agent attach ${handle.
|
|
11520
|
+
return new UsageError(`${issue?.message ?? message}: run armada setup local, or answer it with herdr agent attach ${handle.pane}`, `herdr agent attach ${handle.pane}`);
|
|
11483
11521
|
}
|
|
11484
11522
|
async checkProfileModel(handle, profile) {
|
|
11485
11523
|
if (herdrHarnessKind(profile.harness) !== "opencode")
|
|
@@ -11634,6 +11672,16 @@ class Herdr {
|
|
|
11634
11672
|
if (result?.workspace_id !== handle.workspace || result?.path !== path || result?.forced !== false)
|
|
11635
11673
|
throw new UsageError("invalid herdr worktree removal response; inspect herdr worktree list before retrying");
|
|
11636
11674
|
}
|
|
11675
|
+
async checkLaunchAgent(reply, handle, harness) {
|
|
11676
|
+
const kind = herdrHarnessKind(harness);
|
|
11677
|
+
const occupant = object(object(reply.result)?.agent);
|
|
11678
|
+
if (occupant && (occupant.name === null || occupant.name === undefined) && occupant.agent === kind && occupant.pane_id === handle.pane && occupant.workspace_id === handle.workspace)
|
|
11679
|
+
reply = await this.call(["agent", "rename", handle.pane, handle.agent], 5000);
|
|
11680
|
+
const agent = this.checkAgent(reply, handle);
|
|
11681
|
+
if (agent.agent !== kind)
|
|
11682
|
+
throw new UsageError("herdr worker harness changed; inspect herdr agent list before retrying");
|
|
11683
|
+
return agent;
|
|
11684
|
+
}
|
|
11637
11685
|
checkAgent(reply, handle) {
|
|
11638
11686
|
const agent = object(object(reply.result)?.agent);
|
|
11639
11687
|
if (!agent || agent.name !== handle.agent || agent.pane_id !== handle.pane || agent.workspace_id !== handle.workspace)
|
|
@@ -12529,7 +12577,7 @@ async function brief(io, config, credentials, a, version, configPath) {
|
|
|
12529
12577
|
if (!credentials.linearApiKey)
|
|
12530
12578
|
throw missingKey(LINEAR_KEY);
|
|
12531
12579
|
const extraPath = config.brief.extra;
|
|
12532
|
-
const conventions = extraPath ? { path: extraPath, text: await io.readFile(
|
|
12580
|
+
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join3(dirname4(configPath), extraPath)).catch(() => null) } : null;
|
|
12533
12581
|
let b;
|
|
12534
12582
|
try {
|
|
12535
12583
|
b = await loadBrief(config, {
|
|
@@ -12597,7 +12645,7 @@ ${next.line}
|
|
|
12597
12645
|
}
|
|
12598
12646
|
|
|
12599
12647
|
// src/doctor.ts
|
|
12600
|
-
import { join as
|
|
12648
|
+
import { join as join5 } from "node:path";
|
|
12601
12649
|
|
|
12602
12650
|
// src/local-tools.ts
|
|
12603
12651
|
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
@@ -12916,14 +12964,14 @@ async function ensureLocalProfile(io, configPath, name, profile) {
|
|
|
12916
12964
|
|
|
12917
12965
|
// src/repo.ts
|
|
12918
12966
|
import { lstat, mkdir as mkdir2, readdir, readFile as readFile2, readlink, rm as rm2, symlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
12919
|
-
import { dirname as dirname5, join as
|
|
12967
|
+
import { dirname as dirname5, join as join4, relative, sep } from "node:path";
|
|
12920
12968
|
var absent = (err) => {
|
|
12921
12969
|
const code = err.code;
|
|
12922
12970
|
return code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR";
|
|
12923
12971
|
};
|
|
12924
12972
|
async function collect(base, dir, out) {
|
|
12925
12973
|
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
12926
|
-
const full =
|
|
12974
|
+
const full = join4(dir, entry.name);
|
|
12927
12975
|
if (entry.isDirectory()) {
|
|
12928
12976
|
if (![".git", "node_modules", "__pycache__"].includes(entry.name))
|
|
12929
12977
|
await collect(base, full, out);
|
|
@@ -12933,12 +12981,12 @@ async function collect(base, dir, out) {
|
|
|
12933
12981
|
}
|
|
12934
12982
|
function fsRepoView(root) {
|
|
12935
12983
|
return {
|
|
12936
|
-
readFile: (path) => readFile2(
|
|
12984
|
+
readFile: (path) => readFile2(join4(root, path), "utf8").catch((err) => {
|
|
12937
12985
|
if (absent(err))
|
|
12938
12986
|
return null;
|
|
12939
12987
|
throw err;
|
|
12940
12988
|
}),
|
|
12941
|
-
readLink: (path) => readlink(
|
|
12989
|
+
readLink: (path) => readlink(join4(root, path)).catch((err) => {
|
|
12942
12990
|
if (absent(err) || err.code === "EINVAL")
|
|
12943
12991
|
return null;
|
|
12944
12992
|
throw err;
|
|
@@ -12946,7 +12994,7 @@ function fsRepoView(root) {
|
|
|
12946
12994
|
readFolder: async (path) => {
|
|
12947
12995
|
const out = [];
|
|
12948
12996
|
try {
|
|
12949
|
-
await collect(
|
|
12997
|
+
await collect(join4(root, path), join4(root, path), out);
|
|
12950
12998
|
} catch (err) {
|
|
12951
12999
|
if (absent(err))
|
|
12952
13000
|
return null;
|
|
@@ -12960,7 +13008,7 @@ async function assertNoLinkedParent(root, path) {
|
|
|
12960
13008
|
const parts = path.split("/").slice(0, -1);
|
|
12961
13009
|
for (let k = 1;k <= parts.length; k++) {
|
|
12962
13010
|
const parent = parts.slice(0, k).join("/");
|
|
12963
|
-
if ((await lstat(
|
|
13011
|
+
if ((await lstat(join4(root, parent)).catch(() => null))?.isSymbolicLink())
|
|
12964
13012
|
throw new CommandError(`${parent} is a link; Armada does not write through it. Replace it with a folder first.`);
|
|
12965
13013
|
}
|
|
12966
13014
|
}
|
|
@@ -12968,17 +13016,17 @@ async function applyPlan(root, plan) {
|
|
|
12968
13016
|
for (const path of [...plan.removes, ...plan.writes.map((w) => w.path), ...plan.links.map((l) => l.path)])
|
|
12969
13017
|
await assertNoLinkedParent(root, path);
|
|
12970
13018
|
for (const w of plan.writes)
|
|
12971
|
-
if ((await lstat(
|
|
13019
|
+
if ((await lstat(join4(root, w.path)).catch(() => null))?.isSymbolicLink())
|
|
12972
13020
|
throw new CommandError(`${w.path} is a link; Armada does not write through it. Replace it with a file first.`);
|
|
12973
13021
|
for (const path of plan.removes)
|
|
12974
|
-
await rm2(
|
|
13022
|
+
await rm2(join4(root, path), { force: true });
|
|
12975
13023
|
for (const w of plan.writes) {
|
|
12976
|
-
const full =
|
|
13024
|
+
const full = join4(root, w.path);
|
|
12977
13025
|
await mkdir2(dirname5(full), { recursive: true });
|
|
12978
13026
|
await writeFile2(full, w.content);
|
|
12979
13027
|
}
|
|
12980
13028
|
for (const l of plan.links) {
|
|
12981
|
-
const full =
|
|
13029
|
+
const full = join4(root, l.path);
|
|
12982
13030
|
await mkdir2(dirname5(full), { recursive: true });
|
|
12983
13031
|
if (await lstat(full).catch(() => null))
|
|
12984
13032
|
await rm2(full, { recursive: true, force: true });
|
|
@@ -13242,7 +13290,7 @@ async function localRuntimeChecks(io, config, options = { readOnly: true }) {
|
|
|
13242
13290
|
if (!harnesses.length)
|
|
13243
13291
|
return [];
|
|
13244
13292
|
const result = await offerLocalInstalls(io, await detectLocalTools(io, harnesses, config ? localModelProfiles(config) : []), options);
|
|
13245
|
-
const selected = await offerLocalModels(io, result, options.configPath ??
|
|
13293
|
+
const selected = await offerLocalModels(io, result, options.configPath ?? join5(io.cwd, CONFIG_FILE), options);
|
|
13246
13294
|
return [
|
|
13247
13295
|
...selected.checks,
|
|
13248
13296
|
...harnesses.some((harness) => harness === "opencode" || harness === "deepseek") ? [
|
|
@@ -13287,7 +13335,7 @@ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
|
|
|
13287
13335
|
...keyFileChecks(machine, credentials),
|
|
13288
13336
|
...await labelChecks(io, config, credentials),
|
|
13289
13337
|
...await conductorChecks(io, config),
|
|
13290
|
-
...await localRuntimeChecks(io, config, { ...options, configPath:
|
|
13338
|
+
...await localRuntimeChecks(io, config, { ...options, configPath: join5(root, CONFIG_FILE) }),
|
|
13291
13339
|
...config ? await reviewRuntimeChecks(io, root) : [],
|
|
13292
13340
|
...await secretChecks(api, config, credentials)
|
|
13293
13341
|
];
|
|
@@ -13428,7 +13476,7 @@ async function heartbeat(io, config, credentials, args) {
|
|
|
13428
13476
|
// src/init.ts
|
|
13429
13477
|
import { mkdtemp, realpath, rm as rm3 } from "node:fs/promises";
|
|
13430
13478
|
import { tmpdir } from "node:os";
|
|
13431
|
-
import { join as
|
|
13479
|
+
import { join as join6 } from "node:path";
|
|
13432
13480
|
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] ";
|
|
13433
13481
|
async function wantsStopHook(io, opts) {
|
|
13434
13482
|
if (opts.stopHook !== null)
|
|
@@ -13461,7 +13509,7 @@ async function resolveConfig(exec, root, checkout, opts) {
|
|
|
13461
13509
|
return { config: parse(onDefault, `${CONFIG_FILE} on the default branch`), text: null, source: "default branch" };
|
|
13462
13510
|
const local = await fsRepoView(root).readFile(CONFIG_FILE);
|
|
13463
13511
|
if (local !== null && !opts.programRoot)
|
|
13464
|
-
return { config: parse(local,
|
|
13512
|
+
return { config: parse(local, join6(root, CONFIG_FILE)), text: local, source: "working tree" };
|
|
13465
13513
|
const branch = initBranch(opts.armadaVersion);
|
|
13466
13514
|
if (!opts.programRoot && await sh(exec, root, "git", ["ls-remote", "origin", `refs/heads/${branch}`])) {
|
|
13467
13515
|
await sh(exec, root, "git", ["fetch", "--quiet", "origin", branch]);
|
|
@@ -13532,7 +13580,7 @@ async function init(io, opts) {
|
|
|
13532
13580
|
const base = await defaultBranch(exec, root);
|
|
13533
13581
|
await sh(exec, root, "git", ["fetch", "--quiet", "origin", base]);
|
|
13534
13582
|
const baseSha = await sh(exec, root, "git", ["rev-parse", "FETCH_HEAD"]);
|
|
13535
|
-
const checkout = await realpath(await mkdtemp(
|
|
13583
|
+
const checkout = await realpath(await mkdtemp(join6(tmpdir(), "armada-init-")));
|
|
13536
13584
|
try {
|
|
13537
13585
|
await sh(exec, root, "git", ["worktree", "add", "--quiet", "--detach", checkout, baseSha]);
|
|
13538
13586
|
const { config, text, source } = await resolveConfig(exec, root, checkout, opts);
|
|
@@ -13635,7 +13683,7 @@ async function init(io, opts) {
|
|
|
13635
13683
|
}
|
|
13636
13684
|
|
|
13637
13685
|
// src/launch.ts
|
|
13638
|
-
import { dirname as dirname6, join as
|
|
13686
|
+
import { basename, dirname as dirname6, join as join7 } from "node:path";
|
|
13639
13687
|
async function launch(io, config, credentials, args, version, configPath) {
|
|
13640
13688
|
if (args.rest[0] !== "revoke")
|
|
13641
13689
|
return launchLocal(io, config, credentials, args, version, configPath);
|
|
@@ -13726,6 +13774,8 @@ async function launchLocal(io, config, credentials, args, version, configPath) {
|
|
|
13726
13774
|
throw new UsageError("local launch needs a [herdr.profiles.<name>] with harness, model and effort");
|
|
13727
13775
|
if (o.harness && o.harness !== choice.profile.harness)
|
|
13728
13776
|
throw new UsageError(`profile "${choice.name}" uses ${choice.profile.harness}; choose a matching --profile with --reason to change harness`);
|
|
13777
|
+
if (o["dry-run"] === "true")
|
|
13778
|
+
return await launchPlan(io, args.json, { ticketId, choice, branch, version });
|
|
13729
13779
|
const execute = io.exec;
|
|
13730
13780
|
const preflight = {
|
|
13731
13781
|
...io,
|
|
@@ -13752,7 +13802,7 @@ async function launchLocal(io, config, credentials, args, version, configPath) {
|
|
|
13752
13802
|
const base = remote.code === 0 ? remote.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD/m)?.[1] : null;
|
|
13753
13803
|
if (!base)
|
|
13754
13804
|
throw new UsageError("could not read the default branch of origin");
|
|
13755
|
-
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(
|
|
13805
|
+
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join7(dirname6(configPath), config.brief.extra)) } : null;
|
|
13756
13806
|
const npm = await checkPublished(version, io.fetch ?? fetch);
|
|
13757
13807
|
if (npm.state === "missing")
|
|
13758
13808
|
throw new UsageError(`armada ${version} is not on npm yet; publish this version before launching local workers`);
|
|
@@ -13764,7 +13814,7 @@ async function launchLocal(io, config, credentials, args, version, configPath) {
|
|
|
13764
13814
|
await runtime.ensureServer();
|
|
13765
13815
|
handle = await runtime.create({ repo, branch, base, ticket: ticketId, secrets: config.secrets.names });
|
|
13766
13816
|
if (configSnapshot !== null && io.writeFile)
|
|
13767
|
-
await io.writeFile(
|
|
13817
|
+
await io.writeFile(join7(handle.path, CONFIG_FILE), configSnapshot);
|
|
13768
13818
|
const b = buildBrief({
|
|
13769
13819
|
config,
|
|
13770
13820
|
ticket,
|
|
@@ -13827,6 +13877,78 @@ ${watch.line}
|
|
|
13827
13877
|
`);
|
|
13828
13878
|
return 0;
|
|
13829
13879
|
}
|
|
13880
|
+
async function launchPlan(io, json, input) {
|
|
13881
|
+
const openCode = herdrHarnessKind(input.choice.profile.harness) === "opencode";
|
|
13882
|
+
const detected = await detectLocalTools(io, [input.choice.profile.harness], openCode ? [{ name: input.choice.name, harness: input.choice.profile.harness, model: input.choice.profile.model }] : []);
|
|
13883
|
+
const npm = await checkPublished(input.version, io.fetch ?? fetch);
|
|
13884
|
+
const describe = (checks) => checks.map((check) => `${check.message}${check.fix ? `: ${check.fix}` : ""}`);
|
|
13885
|
+
const gaps = describe(detected.checks.filter((check) => check.level === "error"));
|
|
13886
|
+
const warnings = describe(detected.checks.filter((check) => check.level === "warning"));
|
|
13887
|
+
if (npm.state === "missing")
|
|
13888
|
+
gaps.push(`armada ${input.version} is not on npm yet; publish this version before launching local workers`);
|
|
13889
|
+
let worktree = null;
|
|
13890
|
+
let base = null;
|
|
13891
|
+
try {
|
|
13892
|
+
const execute = io.exec;
|
|
13893
|
+
if (!execute)
|
|
13894
|
+
throw new UsageError("local launch needs process execution");
|
|
13895
|
+
const root = await execute("git", ["rev-parse", "--show-toplevel"], { cwd: io.cwd, timeoutMs: 1e4 });
|
|
13896
|
+
if (root.code !== 0 || !root.stdout.trim().startsWith("/"))
|
|
13897
|
+
throw new UsageError("local launch must run in a git repository");
|
|
13898
|
+
const repo = root.stdout.trim();
|
|
13899
|
+
const common = await execute("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
|
|
13900
|
+
cwd: repo,
|
|
13901
|
+
timeoutMs: 1e4
|
|
13902
|
+
});
|
|
13903
|
+
const mainRoot = common.code === 0 && common.stdout.trim().startsWith("/") ? dirname6(common.stdout.trim()) : repo;
|
|
13904
|
+
const remote = await execute("git", ["ls-remote", "--symref", "origin", "HEAD"], { cwd: repo, timeoutMs: 20000 });
|
|
13905
|
+
base = remote.code === 0 ? remote.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD/m)?.[1] ?? null : null;
|
|
13906
|
+
if (!base)
|
|
13907
|
+
throw new UsageError("could not read the default branch of origin");
|
|
13908
|
+
const configHome = io.env.XDG_CONFIG_HOME ?? (io.env.HOME ? join7(io.env.HOME, ".config") : null);
|
|
13909
|
+
const herdrConfigPath = io.env.HERDR_CONFIG_PATH ?? (configHome ? join7(configHome, "herdr", "config.toml") : null);
|
|
13910
|
+
const herdrConfig = herdrConfigPath ? await io.readFile(herdrConfigPath).catch(() => null) : null;
|
|
13911
|
+
worktree = herdrWorktreePath(herdrWorktreesDirectory(io.env, herdrConfig), basename(mainRoot), input.branch);
|
|
13912
|
+
} catch (error) {
|
|
13913
|
+
gaps.push(error instanceof UsageError ? error.message : "could not read the repository state");
|
|
13914
|
+
}
|
|
13915
|
+
const ready = gaps.length === 0;
|
|
13916
|
+
const plan = {
|
|
13917
|
+
ticket: input.ticketId,
|
|
13918
|
+
runtime: "herdr",
|
|
13919
|
+
dryRun: true,
|
|
13920
|
+
profile: input.choice.name,
|
|
13921
|
+
profileWhy: input.choice.why,
|
|
13922
|
+
routed: input.choice.routed,
|
|
13923
|
+
reason: input.choice.reason,
|
|
13924
|
+
harness: input.choice.profile.harness,
|
|
13925
|
+
actualHarness: herdrHarnessKind(input.choice.profile.harness),
|
|
13926
|
+
harnessDescription: herdrHarnessLabel(input.choice.profile.harness),
|
|
13927
|
+
model: input.choice.profile.model,
|
|
13928
|
+
effort: input.choice.profile.effort,
|
|
13929
|
+
branch: input.branch,
|
|
13930
|
+
worktree,
|
|
13931
|
+
base,
|
|
13932
|
+
preflight: { ready, gaps, warnings }
|
|
13933
|
+
};
|
|
13934
|
+
io.stdout(json ? `${JSON.stringify(plan, null, 2)}
|
|
13935
|
+
` : `Launch plan for ${input.ticketId} (dry run: nothing is created)
|
|
13936
|
+
|
|
13937
|
+
Profile ${input.choice.name} — ${input.choice.why}
|
|
13938
|
+
Harness ${plan.harnessDescription} (exact model: ${plan.model || "not set"}, effort ${plan.effort})
|
|
13939
|
+
Branch ${plan.branch}
|
|
13940
|
+
Worktree ${worktree ?? "unknown"}
|
|
13941
|
+
Base ${base ?? "unknown"}
|
|
13942
|
+
Preflight ${ready ? "ready" : "blocked"}
|
|
13943
|
+
`);
|
|
13944
|
+
for (const warning of warnings)
|
|
13945
|
+
io.stderr(`armada: warning: ${warning}
|
|
13946
|
+
`);
|
|
13947
|
+
for (const gap of gaps)
|
|
13948
|
+
io.stderr(`armada: ${gap}
|
|
13949
|
+
`);
|
|
13950
|
+
return ready ? 0 : 1;
|
|
13951
|
+
}
|
|
13830
13952
|
|
|
13831
13953
|
// src/local-setup.ts
|
|
13832
13954
|
async function setupLocal(io, initial, configPath, args) {
|
|
@@ -13956,7 +14078,7 @@ Claude Code: trusting this parent folder does not cover Git repositories beneath
|
|
|
13956
14078
|
import { randomUUID } from "node:crypto";
|
|
13957
14079
|
import { rm as rm4 } from "node:fs/promises";
|
|
13958
14080
|
import { hostname, tmpdir as tmpdir2 } from "node:os";
|
|
13959
|
-
import { dirname as dirname7, join as
|
|
14081
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
13960
14082
|
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;
|
|
13961
14083
|
var tail = (text, lines = 30) => text.trimEnd().split(`
|
|
13962
14084
|
`).slice(-lines).join(`
|
|
@@ -14034,7 +14156,7 @@ function gitRepo(exec, cwd) {
|
|
|
14034
14156
|
},
|
|
14035
14157
|
async testMerge({ branch, base, head, number, commands }) {
|
|
14036
14158
|
await must(["fetch", "--quiet", "origin", branch, `refs/pull/${number}/head`]);
|
|
14037
|
-
const dir =
|
|
14159
|
+
const dir = join8(tmpdir2(), `armada-merge-${number}-${randomUUID().slice(0, 8)}`);
|
|
14038
14160
|
const remove = async () => {
|
|
14039
14161
|
await git(["worktree", "remove", "--force", dir]);
|
|
14040
14162
|
await git(["worktree", "prune"]);
|
|
@@ -14178,7 +14300,7 @@ async function merge(io, config, credentials, a, configPath) {
|
|
|
14178
14300
|
`),
|
|
14179
14301
|
installedSkill: async (name) => {
|
|
14180
14302
|
for (const dir of [AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR])
|
|
14181
|
-
if (await io.readFile(
|
|
14303
|
+
if (await io.readFile(join8(repoDir, dir, name, "SKILL.md")) !== null)
|
|
14182
14304
|
return true;
|
|
14183
14305
|
return false;
|
|
14184
14306
|
}
|
|
@@ -14850,6 +14972,11 @@ var COMMAND_HELP = {
|
|
|
14850
14972
|
[--profile <name> [--reason <why>]] [--validation <n|none>]
|
|
14851
14973
|
Create the ticket's worktree and start a persistent local worker
|
|
14852
14974
|
with its launch-token brief. Profiles follow [[herdr.routing]]
|
|
14975
|
+
launch <ticket> --runtime herdr --dry-run [--json]
|
|
14976
|
+
Print the launch plan (profile and why, harness and exact model,
|
|
14977
|
+
branch and worktree path, preflight) and create nothing: no
|
|
14978
|
+
worktree, token, pane or install. Exits 0 when the preflight
|
|
14979
|
+
passes, else non-zero, listing every gap
|
|
14853
14980
|
launch revoke <ticket>
|
|
14854
14981
|
Cancel the newest pending launch through Armada, including a worker
|
|
14855
14982
|
signed in but not claimed. A claimed launch needs armada release instead
|
|
@@ -15054,7 +15181,7 @@ var COMMAND_OPTIONS = {
|
|
|
15054
15181
|
init: ["program-root", "name", "slug", "no-stop-hook"],
|
|
15055
15182
|
merge: ["ticket", "no-ticket", "dry-run", "no-lock", "wait", "timeout", "reason", "ask-owner"],
|
|
15056
15183
|
brief: ["profile", "reason", "prompt", "profile-line", "validation", "validation-reason"],
|
|
15057
|
-
launch: ["runtime", "harness", "profile", "reason", "validation", "validation-reason"],
|
|
15184
|
+
launch: ["runtime", "harness", "profile", "reason", "validation", "validation-reason", "dry-run"],
|
|
15058
15185
|
validate: ["ticket", "attach", "caption", "choices", "message", "message-file"],
|
|
15059
15186
|
"ask-owner": ["choices"],
|
|
15060
15187
|
login: ["api-key", "launch-token", "api-url"],
|
|
@@ -15121,7 +15248,7 @@ async function findConfig(io, explicit, command = "status") {
|
|
|
15121
15248
|
return { path, text };
|
|
15122
15249
|
}
|
|
15123
15250
|
for (let dir = resolve3(io.cwd);; dir = dirname9(dir)) {
|
|
15124
|
-
const path =
|
|
15251
|
+
const path = join9(dir, CONFIG_FILE);
|
|
15125
15252
|
const text = await io.readFile(path);
|
|
15126
15253
|
if (text !== null)
|
|
15127
15254
|
return { path, text };
|