@the-vibe-company/armada 0.2.33 → 0.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/armada.js +182 -7
  2. package/package.json +1 -1
package/dist/armada.js CHANGED
@@ -9901,7 +9901,7 @@ ${attachments.join(`
9901
9901
  };
9902
9902
  }
9903
9903
  // package.json
9904
- var version = "0.2.33";
9904
+ var version = "0.2.35";
9905
9905
 
9906
9906
  // src/attach.ts
9907
9907
  import { resolve } from "node:path";
@@ -11230,6 +11230,171 @@ ${next.line}
11230
11230
  return 0;
11231
11231
  }
11232
11232
 
11233
+ // src/local-tools.ts
11234
+ import { stripVTControlCharacters } from "node:util";
11235
+ var MINIMUM_HERDR_VERSION = "0.9.1";
11236
+ var TOOLS = {
11237
+ herdr: { command: "herdr", install: "curl -fsSL https://herdr.dev/install.sh | sh" },
11238
+ claude: { command: "claude", install: "curl -fsSL https://claude.ai/install.sh | bash" },
11239
+ codex: { command: "codex", install: "npm i -g @openai/codex" },
11240
+ opencode: { command: "opencode", install: "curl -fsSL https://opencode.ai/install | bash" },
11241
+ deepseek: { command: "dsh", install: "npm i -g @deepseek-ai/dsh" }
11242
+ };
11243
+ function localHarnesses(config) {
11244
+ return [...new Set(Object.values(config.herdr?.profiles ?? {}).map((profile) => profile.harness))];
11245
+ }
11246
+ async function probe(io, command, args) {
11247
+ if (!io.exec)
11248
+ return null;
11249
+ return io.exec(command, args, { cwd: io.cwd }).catch(() => null);
11250
+ }
11251
+ function versionOf(result) {
11252
+ if (result.code !== 0)
11253
+ return null;
11254
+ for (const line of `${result.stdout}
11255
+ ${result.stderr}`.split(`
11256
+ `)) {
11257
+ const match = line.trim().match(/^(?:(?:herdr|claude|codex(?:-cli)?|opencode|dsh)\s+)?v?(\d+\.\d+\.\d+)(-[\w.-]+)?(?:\+[\w.-]+)?(?:\s|\(|$)/i);
11258
+ if (match?.[1])
11259
+ return { version: match[1], prerelease: !!match[2] };
11260
+ }
11261
+ return null;
11262
+ }
11263
+ async function detectTool(io, name) {
11264
+ const definition = TOOLS[name];
11265
+ const base = { name, ...definition, version: null };
11266
+ if (!io.exec)
11267
+ return { ...base, state: "unknown" };
11268
+ let result;
11269
+ try {
11270
+ result = await io.exec(definition.command, ["--version"], { cwd: io.cwd });
11271
+ } catch (error) {
11272
+ const missing = typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
11273
+ return { ...base, state: missing ? "missing" : "unusable" };
11274
+ }
11275
+ const found = versionOf(result);
11276
+ if (!found)
11277
+ return { ...base, state: "unusable" };
11278
+ const old = name === "herdr" && (found.prerelease || compareVersions(found.version, MINIMUM_HERDR_VERSION) < 0);
11279
+ return { ...base, version: found.version, state: old ? "old" : "ready" };
11280
+ }
11281
+ function toolCheck(tool) {
11282
+ const { command, state, version } = tool;
11283
+ const message = state === "ready" ? `${command} ${version} is on PATH${tool.name === "herdr" ? ` (minimum ${MINIMUM_HERDR_VERSION})` : ""}` : state === "missing" ? `${command} is not installed` : state === "old" ? `herdr needs stable ${MINIMUM_HERDR_VERSION} or newer; found ${version}` : state === "unknown" ? `${command}: could not check installation` : `${command} could not report a usable version`;
11284
+ return {
11285
+ id: `local-${command}`,
11286
+ level: state === "ready" ? "ok" : "error",
11287
+ message,
11288
+ fix: state === "ready" ? null : `\`${tool.install}\`${state === "unusable" ? `; then check \`${command} --version\` and PATH` : ""}`
11289
+ };
11290
+ }
11291
+ function installerEnv(env) {
11292
+ const names = [
11293
+ "PATH",
11294
+ "HOME",
11295
+ "USER",
11296
+ "LOGNAME",
11297
+ "SHELL",
11298
+ "TMPDIR",
11299
+ "TMP",
11300
+ "TEMP",
11301
+ "XDG_CONFIG_HOME",
11302
+ "XDG_DATA_HOME",
11303
+ "npm_config_prefix",
11304
+ "NPM_CONFIG_PREFIX"
11305
+ ];
11306
+ return Object.fromEntries(names.filter((name) => env[name] !== undefined).map((name) => [name, env[name]]));
11307
+ }
11308
+ async function signInCheck(io, harness) {
11309
+ const command = TOOLS[harness].command;
11310
+ let state = "unknown";
11311
+ let login;
11312
+ if (harness === "claude") {
11313
+ login = "claude auth login";
11314
+ const result = await probe(io, command, ["auth", "status"]);
11315
+ if (result && (result.code === 0 || result.code === 1)) {
11316
+ try {
11317
+ const status = JSON.parse(result.stdout);
11318
+ if (typeof status === "object" && status !== null && "loggedIn" in status) {
11319
+ if (status.loggedIn === true && result.code === 0)
11320
+ state = "ready";
11321
+ if (status.loggedIn === false)
11322
+ state = "missing";
11323
+ }
11324
+ } catch {}
11325
+ }
11326
+ } else if (harness === "codex") {
11327
+ login = "codex login";
11328
+ const result = await probe(io, command, ["login", "status"]);
11329
+ if (result?.code === 0)
11330
+ state = "ready";
11331
+ else if (result?.code === 1 && /(?:^|\n)Not logged in\s*(?:\n|$)/i.test(`${result.stdout}
11332
+ ${result.stderr}`))
11333
+ state = "missing";
11334
+ } else if (harness === "opencode") {
11335
+ login = "opencode auth login";
11336
+ const result = await probe(io, command, ["auth", "list"]);
11337
+ if (result?.code === 0) {
11338
+ const text = stripVTControlCharacters(`${result.stdout}
11339
+ ${result.stderr}`);
11340
+ const count = text.match(/\b(\d+) credentials\b/);
11341
+ const environment = text.match(/\b(\d+) environment variables?\b/);
11342
+ if (count)
11343
+ state = Number(count[1]) > 0 || Number(environment?.[1] ?? 0) > 0 ? "ready" : "missing";
11344
+ }
11345
+ } else {
11346
+ login = "dsh web";
11347
+ }
11348
+ return {
11349
+ id: `local-${command}-sign-in`,
11350
+ level: state === "ready" ? "ok" : state === "missing" ? "error" : "warning",
11351
+ message: state === "ready" ? `${command} reports credentials are present${harness === "opencode" ? "; the owner must check the selected provider" : ""}` : state === "missing" ? `${command} is not signed in` : `${command}: could not check sign-in`,
11352
+ fix: state === "ready" ? null : `the owner runs \`${login}\`${harness === "deepseek" ? " and configures the provider in Settings → Models" : ""}; Armada never runs sign-in`
11353
+ };
11354
+ }
11355
+ async function detectLocalTools(io, harnesses) {
11356
+ const tools = [];
11357
+ const checks = [];
11358
+ for (const name of ["herdr", ...new Set(harnesses)]) {
11359
+ const tool = await detectTool(io, name);
11360
+ tools.push(tool);
11361
+ checks.push(toolCheck(tool));
11362
+ if (name !== "herdr" && tool.state === "ready")
11363
+ checks.push(await signInCheck(io, name));
11364
+ }
11365
+ return { tools, checks, ready: !checks.some((check) => check.level === "error") };
11366
+ }
11367
+ async function offerLocalInstalls(io, detected, options = {}) {
11368
+ const platform = io.platform ?? process.platform;
11369
+ if (options.readOnly || !io.interactive || io.env.CI || !io.prompt || !io.spawn || platform !== "darwin" && platform !== "linux")
11370
+ return detected;
11371
+ let attempted = false;
11372
+ for (const tool of detected.tools) {
11373
+ if (tool.state === "ready" || tool.state === "unknown")
11374
+ continue;
11375
+ const check = toolCheck(tool);
11376
+ const answer = await io.prompt(`${check.message}: \`${tool.install}\` — install now? [y/N] `, { hidden: false });
11377
+ if (answer === null)
11378
+ break;
11379
+ if (!/^(y|yes)$/i.test(answer.trim()))
11380
+ continue;
11381
+ attempted = true;
11382
+ const definition = TOOLS[tool.name];
11383
+ const npm = tool.name === "codex" || tool.name === "deepseek";
11384
+ const code = await io.spawn(npm ? "npm" : "sh", npm ? ["i", "-g", tool.name === "codex" ? "@openai/codex" : "@deepseek-ai/dsh"] : ["-c", definition.install], { cwd: io.cwd, env: installerEnv(io.env) }).catch(() => null);
11385
+ if (code !== 0)
11386
+ io.stderr(`${tool.command} installation failed${code === null ? "" : ` (exit ${code})`}. Run \`${definition.install}\` yourself.
11387
+ `);
11388
+ }
11389
+ if (!attempted)
11390
+ return detected;
11391
+ const result = await detectLocalTools(io, detected.tools.filter((tool) => tool.name !== "herdr").map((tool) => tool.name));
11392
+ if (result.tools.some((tool) => tool.state !== "ready"))
11393
+ io.stderr(`Some local tools still cannot run. Check PATH, open a new terminal if needed, and retry.
11394
+ `);
11395
+ return result;
11396
+ }
11397
+
11233
11398
  // src/repo.ts
11234
11399
  import { lstat, mkdir as mkdir2, readdir, readFile as readFile2, readlink, rm as rm2, symlink, writeFile as writeFile2 } from "node:fs/promises";
11235
11400
  import { dirname as dirname4, join as join3, relative, sep } from "node:path";
@@ -11445,7 +11610,7 @@ function versionChecks(host, api, armadaVersion, outdated) {
11445
11610
  ];
11446
11611
  }
11447
11612
  var BUNDLED_CONDUCTOR = "/Applications/Conductor.app/Contents/Resources/bin/conductor";
11448
- async function versionOf(io, command) {
11613
+ async function versionOf2(io, command) {
11449
11614
  if (!io.exec)
11450
11615
  return null;
11451
11616
  try {
@@ -11459,7 +11624,7 @@ async function versionOf(io, command) {
11459
11624
  async function conductorChecks(io, config) {
11460
11625
  if (!io.exec || !Object.values(config?.conductor.profiles ?? {}).some((p) => p.runtime === "conductor"))
11461
11626
  return [];
11462
- const onPath = await versionOf(io, "conductor");
11627
+ const onPath = await versionOf2(io, "conductor");
11463
11628
  if (onPath !== null)
11464
11629
  return [
11465
11630
  { id: "conductor-cli", level: "ok", message: `conductor ${onPath ? `${onPath} ` : ""}is on PATH`, fix: null }
@@ -11470,7 +11635,7 @@ async function conductorChecks(io, config) {
11470
11635
  const link = (dir) => `ln -s "${BUNDLED_CONDUCTOR}" ${dir}/conductor`;
11471
11636
  const pathLine = `export PATH="${BUNDLED_CONDUCTOR.slice(0, -"/conductor".length)}:$PATH"`;
11472
11637
  const fix = userBin ? link(`~/${userBin}`) : `add \`${pathLine}\` to your shell profile (~/.zshrc), or \`sudo ${link("/usr/local/bin")}\``;
11473
- if (await versionOf(io, BUNDLED_CONDUCTOR) !== null)
11638
+ if (await versionOf2(io, BUNDLED_CONDUCTOR) !== null)
11474
11639
  return [
11475
11640
  {
11476
11641
  id: "conductor-cli",
@@ -11553,7 +11718,13 @@ async function secretChecks(api, config, credentials) {
11553
11718
  return [{ id: "secrets", level: "ok", message: `the secrets the project expects are set: ${list}`, fix: null }];
11554
11719
  return warning(`the project expects the secrets ${list}; not set in Armada: ${missing.join(", ")}`, "an owner or admin runs `armada secrets set <NAME>` for each (or sets it on the Keys page of Armada)");
11555
11720
  }
11556
- async function buildDoctor(io, armadaVersion) {
11721
+ async function localRuntimeChecks(io, config, options = { readOnly: true }) {
11722
+ const harnesses = config ? localHarnesses(config) : [];
11723
+ if (!harnesses.length)
11724
+ return [];
11725
+ return (await offerLocalInstalls(io, await detectLocalTools(io, harnesses), options)).checks;
11726
+ }
11727
+ async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
11557
11728
  const root = (io.exec ? await gitRoot(io.exec, io.cwd) : null) ?? io.cwd;
11558
11729
  const upgrade = (err) => err instanceof ArmadaApiError && err.upgrade ? err : null;
11559
11730
  let outdated = null;
@@ -11584,6 +11755,7 @@ async function buildDoctor(io, armadaVersion) {
11584
11755
  ...keyFileChecks(machine, credentials),
11585
11756
  ...await labelChecks(io, config, credentials),
11586
11757
  ...await conductorChecks(io, config),
11758
+ ...await localRuntimeChecks(io, config, options),
11587
11759
  ...config ? await reviewRuntimeChecks(io, root) : [],
11588
11760
  ...await secretChecks(api, config, credentials)
11589
11761
  ];
@@ -11621,7 +11793,7 @@ function renderDoctor(r) {
11621
11793
  `;
11622
11794
  }
11623
11795
  async function doctor(io, json, armadaVersion) {
11624
- const report = await buildDoctor(io, armadaVersion);
11796
+ const report = await buildDoctor(io, armadaVersion, { readOnly: json });
11625
11797
  io.stdout(json ? `${JSON.stringify(report, null, 2)}
11626
11798
  ` : renderDoctor(report));
11627
11799
  return report.errors ? 1 : 0;
@@ -12727,7 +12899,9 @@ var COMMAND_HELP = {
12727
12899
  status --all The same for every project registered by \`armada init\`
12728
12900
  `,
12729
12901
  doctor: ` doctor What this repository lacks to be run by Armada, with the fix for each,
12730
- and whether this terminal is signed in to Armada
12902
+ and whether this terminal is signed in to Armada. Local herdr profiles
12903
+ check tools and harness sign-in; offers official installs with y/N.
12904
+ No terminal, CI and --json only print fixes and never install
12731
12905
  `,
12732
12906
  init: ` init [--program-root <ISSUE-ID>] [--name <name>] [--slug <slug>] [--no-stop-hook]
12733
12907
  Open one pull request that installs or updates it all, create the
@@ -13555,6 +13729,7 @@ if (process.argv.includes("heartbeat") && !process.argv.includes("--background")
13555
13729
  stopped = true;
13556
13730
  });
13557
13731
  var code = await run(process.argv.slice(2), {
13732
+ platform: process.platform,
13558
13733
  machineName: hostname2(),
13559
13734
  ttyName: process.stdin.isTTY ? spawnSync("tty", [], { encoding: "utf8", stdio: ["inherit", "pipe", "ignore"] }).stdout?.trim() || null : null,
13560
13735
  cwd: process.cwd(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",