@the-vibe-company/armada 0.2.45 → 0.2.46
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 +895 -161
- 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
|
|
11
|
+
import { dirname as dirname9, join as join8, resolve as resolve3 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../core/src/types.ts
|
|
14
14
|
var LABEL_PHASES = [
|
|
@@ -613,6 +613,13 @@ function armadaApi(opts) {
|
|
|
613
613
|
throw new ArmadaApiError(`Armada (${host}) answered the revoked launch in a shape this CLI does not know`);
|
|
614
614
|
return { id: body.id, ticket: body.ticket };
|
|
615
615
|
},
|
|
616
|
+
async revokePendingLaunch(signIn, target) {
|
|
617
|
+
const { status, body } = await call("POST", "workers/revoke-pending", { signIn, body: target });
|
|
618
|
+
if (status !== 200)
|
|
619
|
+
throw refusal(status, body, "Armada did not revoke this pending launch");
|
|
620
|
+
if (body.id !== target.id || body.ticket !== target.ticket)
|
|
621
|
+
throw new ArmadaApiError(`Armada (${host}) answered a different revoked launch`);
|
|
622
|
+
},
|
|
616
623
|
async signOut(signIn) {
|
|
617
624
|
const { status, body } = await call("DELETE", "session", { signIn });
|
|
618
625
|
if (status !== 200)
|
|
@@ -1976,124 +1983,19 @@ var HAS_WELLFORMED = !!"".isWellFormed;
|
|
|
1976
1983
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1977
1984
|
*/
|
|
1978
1985
|
|
|
1979
|
-
// ../core/src/herdr-profile.ts
|
|
1980
|
-
var herdrHarnessKind = (harness) => harness === "deepseek" ? "opencode" : harness;
|
|
1981
|
-
var herdrHarnessLabel = (harness) => harness === "deepseek" ? "deepseek (OpenCode + DeepSeek model)" : harness;
|
|
1982
|
-
function herdrChoice(choice) {
|
|
1983
|
-
return {
|
|
1984
|
-
...choice,
|
|
1985
|
-
profile: {
|
|
1986
|
-
runtime: "herdr",
|
|
1987
|
-
agent: herdrHarnessLabel(choice.profile.harness),
|
|
1988
|
-
model: choice.profile.model,
|
|
1989
|
-
effort: choice.profile.effort,
|
|
1990
|
-
fastMode: false
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
var herdrClaimHandle = (handle) => JSON.stringify({ workspace: handle.workspace, pane: handle.pane, agent: handle.agent });
|
|
1995
|
-
function isDeepseekModel(model) {
|
|
1996
|
-
const [provider, ...parts] = model.split("/");
|
|
1997
|
-
return !!parts.length && (provider === "deepseek" || /(?:^|[/-])deepseek(?:$|[/-])/i.test(parts.join("/")));
|
|
1998
|
-
}
|
|
1999
|
-
function setHerdrModel(text, name, model) {
|
|
2000
|
-
const raw = parse(text);
|
|
2001
|
-
const profiles = raw.herdr?.profiles;
|
|
2002
|
-
if (!profiles?.[name])
|
|
2003
|
-
throw new Error("profile is no longer present");
|
|
2004
|
-
const lines = text.split(/(?<=\n)/);
|
|
2005
|
-
let section = -1;
|
|
2006
|
-
let end = lines.length;
|
|
2007
|
-
for (let i = 0;i < lines.length; i++) {
|
|
2008
|
-
const header = lines[i]?.match(/^\s*\[herdr\s*\.\s*profiles\s*\.\s*(.+?)\]\s*(?:#.*)?(?:\r?\n)?$/);
|
|
2009
|
-
if (header) {
|
|
2010
|
-
const key = header[1]?.trim();
|
|
2011
|
-
if (key && Object.hasOwn(parse(`[${key}]
|
|
2012
|
-
`), name)) {
|
|
2013
|
-
section = i;
|
|
2014
|
-
break;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
if (section < 0)
|
|
2019
|
-
throw new Error("use an explicit [herdr.profiles.<name>] section to save the model");
|
|
2020
|
-
for (let i = section + 1;i < lines.length; i++) {
|
|
2021
|
-
if (/^\s*\[/.test(lines[i] ?? "")) {
|
|
2022
|
-
end = i;
|
|
2023
|
-
break;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
let replaced = false;
|
|
2027
|
-
for (let i = section + 1;i < end; i++) {
|
|
2028
|
-
const match = lines[i]?.match(/^(\s*(?:model|"model"|'model')\s*=\s*)("(?:[^"\\]|\\.)*"|'[^']*')(.*?)(\r?\n)?$/);
|
|
2029
|
-
if (match) {
|
|
2030
|
-
const value = match[2]?.startsWith("'") && !model.includes("'") ? `'${model}'` : JSON.stringify(model);
|
|
2031
|
-
lines[i] = `${match[1]}${value}${match[3]}${match[4] ?? ""}`;
|
|
2032
|
-
replaced = true;
|
|
2033
|
-
break;
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
if (!replaced) {
|
|
2037
|
-
const newline = text.includes(`\r
|
|
2038
|
-
`) ? `\r
|
|
2039
|
-
` : `
|
|
2040
|
-
`;
|
|
2041
|
-
if (!(lines[section] ?? "").endsWith(`
|
|
2042
|
-
`))
|
|
2043
|
-
lines[section] += newline;
|
|
2044
|
-
lines.splice(section + 1, 0, `model = ${JSON.stringify(model)}${newline}`);
|
|
2045
|
-
}
|
|
2046
|
-
const next = lines.join("");
|
|
2047
|
-
profiles[name].model = model;
|
|
2048
|
-
if (JSON.stringify(parse(next)) !== JSON.stringify(raw)) {
|
|
2049
|
-
const canonical = (value) => JSON.stringify(value, (_, v) => typeof v === "object" && v !== null && !Array.isArray(v) ? Object.fromEntries(Object.keys(v).sort().map((key) => [key, v[key]])) : v);
|
|
2050
|
-
if (canonical(parse(next)) !== canonical(raw))
|
|
2051
|
-
throw new Error("could not safely edit the profile model");
|
|
2052
|
-
}
|
|
2053
|
-
return next;
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
// ../core/src/npm.ts
|
|
2057
|
-
var ARMADA_PACKAGE = CLI_PACKAGE;
|
|
2058
|
-
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${ARMADA_PACKAGE.replace("/", "%2f")}`;
|
|
2059
|
-
var NPM_CHECK_MS = 3000;
|
|
2060
|
-
async function checkPublished(version, fetch2, timeoutMs = NPM_CHECK_MS) {
|
|
2061
|
-
try {
|
|
2062
|
-
const signal = AbortSignal.timeout(timeoutMs);
|
|
2063
|
-
const res = await fetch2(NPM_REGISTRY_URL, {
|
|
2064
|
-
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
2065
|
-
cache: "no-store",
|
|
2066
|
-
signal
|
|
2067
|
-
});
|
|
2068
|
-
if (!res.ok)
|
|
2069
|
-
return { state: "unknown", reason: `npm answered HTTP ${res.status}` };
|
|
2070
|
-
const body = await res.json();
|
|
2071
|
-
const versions = body?.versions;
|
|
2072
|
-
if (!versions || typeof versions !== "object" || Array.isArray(versions) || !Object.keys(versions).length)
|
|
2073
|
-
return { state: "unknown", reason: "npm listed no version" };
|
|
2074
|
-
const candidates = Object.keys(versions).filter((candidate) => /^\d+\.\d+\.\d+$/.test(candidate) && compareVersions(candidate, version) <= 0).sort((first, second) => compareVersions(second, first));
|
|
2075
|
-
for (const candidate of candidates) {
|
|
2076
|
-
const tarball = versions[candidate]?.dist?.tarball;
|
|
2077
|
-
if (typeof tarball !== "string" || !tarball)
|
|
2078
|
-
continue;
|
|
2079
|
-
const download = await fetch2(tarball, { method: "HEAD", cache: "no-store", signal });
|
|
2080
|
-
if (download.status === 200)
|
|
2081
|
-
return candidate === version ? { state: "published" } : { state: "missing", newest: candidate };
|
|
2082
|
-
if (download.status !== 404)
|
|
2083
|
-
return { state: "unknown", reason: `npm tarball answered HTTP ${download.status}` };
|
|
2084
|
-
}
|
|
2085
|
-
return { state: "missing", newest: null };
|
|
2086
|
-
} catch (err) {
|
|
2087
|
-
return { state: "unknown", reason: networkReason(err, timeoutMs) };
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
1986
|
// ../core/src/config.ts
|
|
2092
1987
|
var CONFIG_FILE = "armada.toml";
|
|
2093
1988
|
var PLAN_POLICIES = ["approve", "pre-approved"];
|
|
2094
1989
|
var routingLabelKey = (name) => name.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]/gu, "");
|
|
2095
1990
|
var PROFILE_RUNTIMES = ["conductor", "claude-code"];
|
|
2096
1991
|
var HERDR_HARNESSES = ["claude", "codex", "opencode", "deepseek"];
|
|
1992
|
+
var HERDR_PERMISSIONS = ["ask", "full"];
|
|
1993
|
+
var HERDR_FULL_PERMISSION_ARGS = {
|
|
1994
|
+
claude: "--dangerously-skip-permissions",
|
|
1995
|
+
codex: "--dangerously-bypass-approvals-and-sandbox",
|
|
1996
|
+
opencode: "--auto",
|
|
1997
|
+
deepseek: "--auto"
|
|
1998
|
+
};
|
|
2097
1999
|
var CONFIG_DEFAULTS = {
|
|
2098
2000
|
language: "en",
|
|
2099
2001
|
readyLabel: "ready-for-agent",
|
|
@@ -2316,7 +2218,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
2316
2218
|
problems.push(`"${path}" is not a usable profile name`);
|
|
2317
2219
|
continue;
|
|
2318
2220
|
}
|
|
2319
|
-
known.push([path, p, ["harness", "model", "effort", "extra_args", "when"]]);
|
|
2221
|
+
known.push([path, p, ["harness", "model", "effort", "extra_args", "permissions", "when"]]);
|
|
2320
2222
|
let harness = "claude";
|
|
2321
2223
|
if (p.harness === undefined)
|
|
2322
2224
|
problems.push(`missing required key "${path}.harness"`);
|
|
@@ -2333,13 +2235,23 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
2333
2235
|
}
|
|
2334
2236
|
if (harness === "deepseek" && extraArgs.some((arg) => /^(?:--model(?:=|$)|-m)/.test(arg.trim())))
|
|
2335
2237
|
problems.push(`"${path}.extra_args" must not override the DeepSeek model; use "${path}.model"`);
|
|
2238
|
+
let permissions;
|
|
2239
|
+
if (p.permissions !== undefined) {
|
|
2240
|
+
if (HERDR_PERMISSIONS.includes(p.permissions))
|
|
2241
|
+
permissions = p.permissions;
|
|
2242
|
+
else
|
|
2243
|
+
problems.push(`"${path}.permissions" must be "ask" or "full"`);
|
|
2244
|
+
}
|
|
2245
|
+
if (permissions === "ask" && extraArgs.some((arg) => arg.trim() === HERDR_FULL_PERMISSION_ARGS[harness]))
|
|
2246
|
+
problems.push(`"${path}.permissions" = "ask" cannot be combined with "${HERDR_FULL_PERMISSION_ARGS[harness]}" in "${path}.extra_args"`);
|
|
2336
2247
|
const model = (harness === "opencode" || harness === "deepseek") && (p.model === undefined || typeof p.model === "string" && !p.model.trim()) ? "" : str(p, path, "model");
|
|
2337
2248
|
herdrProfiles[name] = {
|
|
2338
2249
|
...p.when !== undefined ? { when: str(p, path, "when") } : {},
|
|
2339
2250
|
harness,
|
|
2340
2251
|
model,
|
|
2341
2252
|
effort: str(p, path, "effort"),
|
|
2342
|
-
extraArgs
|
|
2253
|
+
extraArgs,
|
|
2254
|
+
...permissions !== undefined ? { permissions } : {}
|
|
2343
2255
|
};
|
|
2344
2256
|
}
|
|
2345
2257
|
let herdrDefaultProfile = null;
|
|
@@ -2648,6 +2560,7 @@ profile = "debug"
|
|
|
2648
2560
|
# harness = "claude" # "claude", "codex", "opencode" or "deepseek" (OpenCode + DeepSeek model)
|
|
2649
2561
|
# model = "sonnet"
|
|
2650
2562
|
# effort = "high"
|
|
2563
|
+
# permissions = "ask" # normal harness approvals; use "full" for the native bypass/auto flag
|
|
2651
2564
|
# extra_args = ["--verbose"]
|
|
2652
2565
|
# when = "a ticket best handled by Claude"
|
|
2653
2566
|
|
|
@@ -2660,6 +2573,425 @@ function slugify(name) {
|
|
|
2660
2573
|
return name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "project";
|
|
2661
2574
|
}
|
|
2662
2575
|
|
|
2576
|
+
// ../core/src/herdr-profile.ts
|
|
2577
|
+
var herdrHarnessKind = (harness) => harness === "deepseek" ? "opencode" : harness;
|
|
2578
|
+
var herdrHarnessLabel = (harness) => harness === "deepseek" ? "deepseek (OpenCode + DeepSeek model)" : harness;
|
|
2579
|
+
function herdrChoice(choice) {
|
|
2580
|
+
return {
|
|
2581
|
+
...choice,
|
|
2582
|
+
profile: {
|
|
2583
|
+
runtime: "herdr",
|
|
2584
|
+
agent: herdrHarnessLabel(choice.profile.harness),
|
|
2585
|
+
model: choice.profile.model,
|
|
2586
|
+
effort: choice.profile.effort,
|
|
2587
|
+
fastMode: false
|
|
2588
|
+
}
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
var herdrClaimHandle = (handle) => JSON.stringify({ workspace: handle.workspace, pane: handle.pane, agent: handle.agent });
|
|
2592
|
+
function isDeepseekModel(model) {
|
|
2593
|
+
const [provider, ...parts] = model.split("/");
|
|
2594
|
+
return !!parts.length && (provider === "deepseek" || /(?:^|[/-])deepseek(?:$|[/-])/i.test(parts.join("/")));
|
|
2595
|
+
}
|
|
2596
|
+
function herdrPermissionArgs(profile) {
|
|
2597
|
+
const args = [...profile.extraArgs];
|
|
2598
|
+
if (profile.permissions !== "full")
|
|
2599
|
+
return args;
|
|
2600
|
+
const fullArg = HERDR_FULL_PERMISSION_ARGS[profile.harness];
|
|
2601
|
+
const firstMatching = args.findIndex((arg) => arg.trim() === fullArg);
|
|
2602
|
+
const withoutMatching = args.filter((arg) => arg.trim() !== fullArg);
|
|
2603
|
+
if (firstMatching < 0)
|
|
2604
|
+
return [...withoutMatching, fullArg];
|
|
2605
|
+
withoutMatching.splice(firstMatching, 0, fullArg);
|
|
2606
|
+
return withoutMatching;
|
|
2607
|
+
}
|
|
2608
|
+
var isTable2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2609
|
+
var canonicalToml = (value) => JSON.stringify(value, (_, nested) => typeof nested === "object" && nested !== null && !Array.isArray(nested) ? Object.fromEntries(Object.keys(nested).sort().map((key) => [key, nested[key]])) : nested);
|
|
2610
|
+
var linesOf = (text) => text.split(/(?<=\n)/);
|
|
2611
|
+
var lineWithoutEnding = (line) => line.replace(/\r?\n$/, "");
|
|
2612
|
+
var hasTomlHeader = (line) => /^\s*\[\[?[^\]]+\]\]?\s*(?:#.*)?(?:\r?\n)?$/.test(line);
|
|
2613
|
+
var profileHeaderName = (line) => {
|
|
2614
|
+
const source = lineWithoutEnding(line);
|
|
2615
|
+
if (!/^\s*\[(?!\[)/.test(source) || !/herdr\s*\.\s*profiles\s*\./.test(source))
|
|
2616
|
+
return null;
|
|
2617
|
+
try {
|
|
2618
|
+
const parsed = parse(`${source}
|
|
2619
|
+
`);
|
|
2620
|
+
const herdr = parsed.herdr;
|
|
2621
|
+
const profiles = isTable2(herdr) ? herdr.profiles : undefined;
|
|
2622
|
+
if (!isTable2(profiles))
|
|
2623
|
+
return null;
|
|
2624
|
+
const names = Object.keys(profiles);
|
|
2625
|
+
return names.length === 1 ? names[0] ?? null : null;
|
|
2626
|
+
} catch {
|
|
2627
|
+
return null;
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2630
|
+
var keyAssignment = (line, key) => new RegExp(`^\\s*(?:${key}|"${key}"|'${key}')\\s*=`).test(lineWithoutEnding(line));
|
|
2631
|
+
var keyLine = (lines, key) => {
|
|
2632
|
+
for (let i = 1;i < lines.length; i++)
|
|
2633
|
+
if (keyAssignment(lines[i] ?? "", key))
|
|
2634
|
+
return i;
|
|
2635
|
+
return -1;
|
|
2636
|
+
};
|
|
2637
|
+
var quotedValueLine = (line, key) => lineWithoutEnding(line).match(new RegExp(`^(\\s*(?:${key}|"${key}"|'${key}')\\s*=\\s*)("(?:[^"\\\\]|\\\\.)*"|'[^']*')(.*)$`));
|
|
2638
|
+
var addLineBreak = (line, newline) => /\r?\n$/.test(line) ? line : `${line}${newline}`;
|
|
2639
|
+
var skipArrayTrivia = (source, start, close) => {
|
|
2640
|
+
let cursor = start;
|
|
2641
|
+
while (cursor < close) {
|
|
2642
|
+
if (/\s/.test(source[cursor] ?? "")) {
|
|
2643
|
+
cursor++;
|
|
2644
|
+
continue;
|
|
2645
|
+
}
|
|
2646
|
+
if (source[cursor] === "#") {
|
|
2647
|
+
const newline = source.indexOf(`
|
|
2648
|
+
`, cursor);
|
|
2649
|
+
cursor = newline < 0 || newline > close ? close : newline + 1;
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
break;
|
|
2653
|
+
}
|
|
2654
|
+
return cursor;
|
|
2655
|
+
};
|
|
2656
|
+
var scanStringArray = (source, start) => {
|
|
2657
|
+
if (source[start] !== "[")
|
|
2658
|
+
throw new Error("could not safely edit extra_args: expected a string array");
|
|
2659
|
+
const close = (() => {
|
|
2660
|
+
let cursor = start + 1;
|
|
2661
|
+
let quote = null;
|
|
2662
|
+
while (cursor < source.length) {
|
|
2663
|
+
const char = source[cursor];
|
|
2664
|
+
if (quote === "'") {
|
|
2665
|
+
if (char === "'")
|
|
2666
|
+
quote = null;
|
|
2667
|
+
cursor++;
|
|
2668
|
+
continue;
|
|
2669
|
+
}
|
|
2670
|
+
if (quote === '"') {
|
|
2671
|
+
if (char === "\\") {
|
|
2672
|
+
cursor += 2;
|
|
2673
|
+
continue;
|
|
2674
|
+
}
|
|
2675
|
+
if (char === '"')
|
|
2676
|
+
quote = null;
|
|
2677
|
+
cursor++;
|
|
2678
|
+
continue;
|
|
2679
|
+
}
|
|
2680
|
+
if (char === "'") {
|
|
2681
|
+
if (source[cursor + 1] === "'")
|
|
2682
|
+
throw new Error("could not safely edit extra_args: multiline strings are unsupported");
|
|
2683
|
+
quote = "'";
|
|
2684
|
+
} else if (char === '"') {
|
|
2685
|
+
if (source[cursor + 1] === '"')
|
|
2686
|
+
throw new Error("could not safely edit extra_args: multiline strings are unsupported");
|
|
2687
|
+
quote = '"';
|
|
2688
|
+
} else if (char === "]") {
|
|
2689
|
+
return cursor;
|
|
2690
|
+
}
|
|
2691
|
+
cursor++;
|
|
2692
|
+
}
|
|
2693
|
+
throw new Error("could not safely edit extra_args: unterminated string array");
|
|
2694
|
+
})();
|
|
2695
|
+
const items = [];
|
|
2696
|
+
let cursor = skipArrayTrivia(source, start + 1, close);
|
|
2697
|
+
while (cursor < close) {
|
|
2698
|
+
const quote = source[cursor];
|
|
2699
|
+
if (quote !== "'" && quote !== '"')
|
|
2700
|
+
throw new Error("could not safely edit extra_args: expected string values");
|
|
2701
|
+
if (source[cursor + 1] === quote)
|
|
2702
|
+
throw new Error("could not safely edit extra_args: multiline strings are unsupported");
|
|
2703
|
+
const itemStart = cursor;
|
|
2704
|
+
cursor++;
|
|
2705
|
+
while (cursor < close) {
|
|
2706
|
+
if (quote === '"' && source[cursor] === "\\") {
|
|
2707
|
+
cursor += 2;
|
|
2708
|
+
continue;
|
|
2709
|
+
}
|
|
2710
|
+
if (source[cursor] === quote)
|
|
2711
|
+
break;
|
|
2712
|
+
cursor++;
|
|
2713
|
+
}
|
|
2714
|
+
if (source[cursor] !== quote)
|
|
2715
|
+
throw new Error("could not safely edit extra_args: unterminated string value");
|
|
2716
|
+
const itemEnd = cursor + 1;
|
|
2717
|
+
const literal = source.slice(itemStart, itemEnd);
|
|
2718
|
+
let decoded;
|
|
2719
|
+
try {
|
|
2720
|
+
decoded = parse(`value = ${literal}
|
|
2721
|
+
`).value;
|
|
2722
|
+
} catch {
|
|
2723
|
+
throw new Error("could not safely edit extra_args: invalid string value");
|
|
2724
|
+
}
|
|
2725
|
+
if (typeof decoded !== "string")
|
|
2726
|
+
throw new Error("could not safely edit extra_args: expected string values");
|
|
2727
|
+
cursor = skipArrayTrivia(source, itemEnd, close);
|
|
2728
|
+
const commaAfter = source[cursor] === "," ? cursor : null;
|
|
2729
|
+
items.push({ start: itemStart, end: itemEnd, commaAfter, value: decoded });
|
|
2730
|
+
if (commaAfter === null) {
|
|
2731
|
+
cursor = skipArrayTrivia(source, cursor, close);
|
|
2732
|
+
if (cursor < close)
|
|
2733
|
+
throw new Error("could not safely edit extra_args: expected a comma");
|
|
2734
|
+
break;
|
|
2735
|
+
}
|
|
2736
|
+
cursor = skipArrayTrivia(source, commaAfter + 1, close);
|
|
2737
|
+
}
|
|
2738
|
+
return { close, items };
|
|
2739
|
+
};
|
|
2740
|
+
var arrayAssignment = (source, key) => {
|
|
2741
|
+
const pattern = new RegExp(`(^|\\r?\\n)([ \\t]*(?:${key}|"${key}"|'${key}')\\s*=\\s*)`, "g");
|
|
2742
|
+
const match = pattern.exec(source);
|
|
2743
|
+
if (!match)
|
|
2744
|
+
return null;
|
|
2745
|
+
const assignmentStart = (match.index ?? 0) + (match[1]?.length ?? 0);
|
|
2746
|
+
let arrayStart = (match.index ?? 0) + match[0].length;
|
|
2747
|
+
while (/\s/.test(source[arrayStart] ?? ""))
|
|
2748
|
+
arrayStart++;
|
|
2749
|
+
if (source[arrayStart] !== "[")
|
|
2750
|
+
throw new Error(`could not safely edit ${key}: expected a string array`);
|
|
2751
|
+
return { start: assignmentStart, arrayStart, scan: scanStringArray(source, arrayStart) };
|
|
2752
|
+
};
|
|
2753
|
+
var removeArrayItems = (source, assignment, remove) => {
|
|
2754
|
+
if (!assignment)
|
|
2755
|
+
return source;
|
|
2756
|
+
const { items } = assignment.scan;
|
|
2757
|
+
if (!items.some((item) => remove(item.value)))
|
|
2758
|
+
return source;
|
|
2759
|
+
const edits = [];
|
|
2760
|
+
for (let start = 0;start < items.length; ) {
|
|
2761
|
+
if (!remove(items[start]?.value ?? "")) {
|
|
2762
|
+
start++;
|
|
2763
|
+
continue;
|
|
2764
|
+
}
|
|
2765
|
+
let end = start;
|
|
2766
|
+
while (end + 1 < items.length && remove(items[end + 1]?.value ?? ""))
|
|
2767
|
+
end++;
|
|
2768
|
+
let editStart = items[start]?.start ?? 0;
|
|
2769
|
+
let editEnd = items[end]?.end ?? editStart;
|
|
2770
|
+
if (end < items.length - 1) {
|
|
2771
|
+
const comma = items[end]?.commaAfter;
|
|
2772
|
+
if (comma === null || comma === undefined)
|
|
2773
|
+
throw new Error("could not safely edit extra_args: invalid separators");
|
|
2774
|
+
editEnd = comma + 1;
|
|
2775
|
+
while (source[editEnd] === " " || source[editEnd] === "\t")
|
|
2776
|
+
editEnd++;
|
|
2777
|
+
} else if (start > 0) {
|
|
2778
|
+
const previousComma = items[start - 1]?.commaAfter;
|
|
2779
|
+
if (previousComma === null || previousComma === undefined)
|
|
2780
|
+
throw new Error("could not safely edit extra_args: invalid separators");
|
|
2781
|
+
editStart = previousComma;
|
|
2782
|
+
const trailingComma = items[end]?.commaAfter;
|
|
2783
|
+
editEnd = trailingComma === null || trailingComma === undefined ? items[end]?.end ?? editEnd : trailingComma + 1;
|
|
2784
|
+
} else {
|
|
2785
|
+
const trailingComma = items[end]?.commaAfter;
|
|
2786
|
+
editEnd = trailingComma === null || trailingComma === undefined ? items[end]?.end ?? editEnd : trailingComma + 1;
|
|
2787
|
+
}
|
|
2788
|
+
edits.push({ start: editStart, end: editEnd });
|
|
2789
|
+
start = end + 1;
|
|
2790
|
+
}
|
|
2791
|
+
let next = source;
|
|
2792
|
+
for (const edit of edits.sort((a, b) => b.start - a.start))
|
|
2793
|
+
next = `${next.slice(0, edit.start)}${next.slice(edit.end)}`;
|
|
2794
|
+
return next;
|
|
2795
|
+
};
|
|
2796
|
+
var profileSections = (text) => {
|
|
2797
|
+
const lines = linesOf(text);
|
|
2798
|
+
const found = [];
|
|
2799
|
+
for (let i = 0;i < lines.length; i++) {
|
|
2800
|
+
const name = profileHeaderName(lines[i] ?? "");
|
|
2801
|
+
if (name)
|
|
2802
|
+
found.push({ name, start: i });
|
|
2803
|
+
}
|
|
2804
|
+
return new Map(found.map((entry, index) => {
|
|
2805
|
+
let end = lines.length;
|
|
2806
|
+
for (let i = entry.start + 1;i < lines.length; i++) {
|
|
2807
|
+
if (hasTomlHeader(lines[i] ?? "")) {
|
|
2808
|
+
end = i;
|
|
2809
|
+
break;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
const next = found[index + 1];
|
|
2813
|
+
if (next && next.start < end)
|
|
2814
|
+
end = next.start;
|
|
2815
|
+
return [entry.name, { start: entry.start, end }];
|
|
2816
|
+
}));
|
|
2817
|
+
};
|
|
2818
|
+
function setHerdrPermissions(text, names, choice) {
|
|
2819
|
+
if (!HERDR_PERMISSIONS.includes(choice))
|
|
2820
|
+
throw new Error('permissions must be "ask" or "full"');
|
|
2821
|
+
const raw = parse(text);
|
|
2822
|
+
const requested = [...new Set(names)];
|
|
2823
|
+
if (!requested.length)
|
|
2824
|
+
return text;
|
|
2825
|
+
const herdr = raw.herdr;
|
|
2826
|
+
const profiles = isTable2(herdr) ? herdr.profiles : undefined;
|
|
2827
|
+
if (!isTable2(profiles))
|
|
2828
|
+
throw new Error("could not safely edit permissions: no [herdr.profiles] table");
|
|
2829
|
+
const sections = profileSections(text);
|
|
2830
|
+
const lines = linesOf(text);
|
|
2831
|
+
const expected = structuredClone(raw);
|
|
2832
|
+
const expectedHerdr = expected.herdr;
|
|
2833
|
+
const expectedProfiles = isTable2(expectedHerdr) ? expectedHerdr.profiles : undefined;
|
|
2834
|
+
if (!isTable2(expectedProfiles))
|
|
2835
|
+
throw new Error("could not safely edit permissions: no [herdr.profiles] table");
|
|
2836
|
+
const replacements = [];
|
|
2837
|
+
for (const name of requested) {
|
|
2838
|
+
if (!Object.hasOwn(profiles, name) || !isTable2(profiles[name]))
|
|
2839
|
+
throw new Error(`profile "${name}" is no longer present`);
|
|
2840
|
+
const section = sections.get(name);
|
|
2841
|
+
if (!section)
|
|
2842
|
+
throw new Error(`use an explicit [herdr.profiles.${name}] section to save permissions`);
|
|
2843
|
+
const profile = profiles[name];
|
|
2844
|
+
const harness = profile.harness;
|
|
2845
|
+
if (!(typeof harness === "string" && Object.hasOwn(HERDR_FULL_PERMISSION_ARGS, harness)))
|
|
2846
|
+
throw new Error(`could not safely edit permissions for profile "${name}": invalid harness`);
|
|
2847
|
+
const profileLines = lines.slice(section.start, section.end);
|
|
2848
|
+
const permissionLine = keyLine(profileLines, "permissions");
|
|
2849
|
+
if (permissionLine >= 0) {
|
|
2850
|
+
const match = quotedValueLine(profileLines[permissionLine] ?? "", "permissions");
|
|
2851
|
+
if (!match)
|
|
2852
|
+
throw new Error(`could not safely edit permissions for profile "${name}"`);
|
|
2853
|
+
const oldValue = match[2] ?? '"ask"';
|
|
2854
|
+
const quote = oldValue.startsWith("'") ? "'" : '"';
|
|
2855
|
+
const value = quote === "'" ? `'${choice}'` : JSON.stringify(choice);
|
|
2856
|
+
const ending = (profileLines[permissionLine] ?? "").match(/\r?\n$/)?.[0] ?? "";
|
|
2857
|
+
profileLines[permissionLine] = `${match[1]}${value}${match[3]}${ending}`;
|
|
2858
|
+
} else if (Object.hasOwn(profile, "permissions")) {
|
|
2859
|
+
throw new Error(`could not safely edit permissions for profile "${name}"`);
|
|
2860
|
+
} else {
|
|
2861
|
+
const newline = text.includes(`\r
|
|
2862
|
+
`) ? `\r
|
|
2863
|
+
` : `
|
|
2864
|
+
`;
|
|
2865
|
+
let insertAt = keyLine(profileLines, "effort");
|
|
2866
|
+
insertAt = insertAt < 0 ? keyLine(profileLines, "model") : insertAt;
|
|
2867
|
+
insertAt = insertAt < 0 ? 1 : insertAt + 1;
|
|
2868
|
+
if (insertAt > 0 && insertAt <= profileLines.length) {
|
|
2869
|
+
const previous = insertAt - 1;
|
|
2870
|
+
profileLines[previous] = addLineBreak(profileLines[previous] ?? "", newline);
|
|
2871
|
+
}
|
|
2872
|
+
const sourceLine = profileLines.find((line) => keyAssignment(line, "harness")) ?? "";
|
|
2873
|
+
const indent = sourceLine.match(/^\s*/)?.[0] ?? "";
|
|
2874
|
+
profileLines.splice(insertAt, 0, `${indent}permissions = ${JSON.stringify(choice)}${newline}`);
|
|
2875
|
+
}
|
|
2876
|
+
let profileSource = profileLines.join("");
|
|
2877
|
+
const existingArgs = profile.extra_args;
|
|
2878
|
+
if (choice === "ask" && existingArgs !== undefined) {
|
|
2879
|
+
if (!Array.isArray(existingArgs) || !existingArgs.every((arg) => typeof arg === "string"))
|
|
2880
|
+
throw new Error(`could not safely edit extra_args for profile "${name}"`);
|
|
2881
|
+
const assignment = arrayAssignment(profileSource, "extra_args");
|
|
2882
|
+
if (!assignment)
|
|
2883
|
+
throw new Error(`could not safely edit extra_args for profile "${name}"`);
|
|
2884
|
+
const scanned = assignment.scan.items.map((item) => item.value);
|
|
2885
|
+
if (canonicalToml(scanned) !== canonicalToml(existingArgs))
|
|
2886
|
+
throw new Error(`could not safely edit extra_args for profile "${name}"`);
|
|
2887
|
+
profileSource = removeArrayItems(profileSource, assignment, (arg) => arg.trim() === HERDR_FULL_PERMISSION_ARGS[harness]);
|
|
2888
|
+
const expectedProfile = expectedProfiles[name];
|
|
2889
|
+
expectedProfile.extra_args = existingArgs.filter((arg) => arg.trim() !== HERDR_FULL_PERMISSION_ARGS[harness]);
|
|
2890
|
+
}
|
|
2891
|
+
const updatedProfile = expectedProfiles[name];
|
|
2892
|
+
updatedProfile.permissions = choice;
|
|
2893
|
+
replacements.push({ start: section.start, end: section.end, source: profileSource });
|
|
2894
|
+
}
|
|
2895
|
+
const nextLines = [...lines];
|
|
2896
|
+
for (const replacement of replacements.sort((a, b) => b.start - a.start))
|
|
2897
|
+
nextLines.splice(replacement.start, replacement.end - replacement.start, ...linesOf(replacement.source));
|
|
2898
|
+
const next = nextLines.join("");
|
|
2899
|
+
if (canonicalToml(parse(next)) !== canonicalToml(expected))
|
|
2900
|
+
throw new Error("could not safely edit profile permissions");
|
|
2901
|
+
return next;
|
|
2902
|
+
}
|
|
2903
|
+
function setHerdrModel(text, name, model) {
|
|
2904
|
+
const raw = parse(text);
|
|
2905
|
+
const profiles = raw.herdr?.profiles;
|
|
2906
|
+
if (!profiles?.[name])
|
|
2907
|
+
throw new Error("profile is no longer present");
|
|
2908
|
+
const lines = text.split(/(?<=\n)/);
|
|
2909
|
+
let section = -1;
|
|
2910
|
+
let end = lines.length;
|
|
2911
|
+
for (let i = 0;i < lines.length; i++) {
|
|
2912
|
+
const header = lines[i]?.match(/^\s*\[herdr\s*\.\s*profiles\s*\.\s*(.+?)\]\s*(?:#.*)?(?:\r?\n)?$/);
|
|
2913
|
+
if (header) {
|
|
2914
|
+
const key = header[1]?.trim();
|
|
2915
|
+
if (key && Object.hasOwn(parse(`[${key}]
|
|
2916
|
+
`), name)) {
|
|
2917
|
+
section = i;
|
|
2918
|
+
break;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
if (section < 0)
|
|
2923
|
+
throw new Error("use an explicit [herdr.profiles.<name>] section to save the model");
|
|
2924
|
+
for (let i = section + 1;i < lines.length; i++) {
|
|
2925
|
+
if (/^\s*\[/.test(lines[i] ?? "")) {
|
|
2926
|
+
end = i;
|
|
2927
|
+
break;
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
let replaced = false;
|
|
2931
|
+
for (let i = section + 1;i < end; i++) {
|
|
2932
|
+
const match = lines[i]?.match(/^(\s*(?:model|"model"|'model')\s*=\s*)("(?:[^"\\]|\\.)*"|'[^']*')(.*?)(\r?\n)?$/);
|
|
2933
|
+
if (match) {
|
|
2934
|
+
const value = match[2]?.startsWith("'") && !model.includes("'") ? `'${model}'` : JSON.stringify(model);
|
|
2935
|
+
lines[i] = `${match[1]}${value}${match[3]}${match[4] ?? ""}`;
|
|
2936
|
+
replaced = true;
|
|
2937
|
+
break;
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
if (!replaced) {
|
|
2941
|
+
const newline = text.includes(`\r
|
|
2942
|
+
`) ? `\r
|
|
2943
|
+
` : `
|
|
2944
|
+
`;
|
|
2945
|
+
if (!(lines[section] ?? "").endsWith(`
|
|
2946
|
+
`))
|
|
2947
|
+
lines[section] += newline;
|
|
2948
|
+
lines.splice(section + 1, 0, `model = ${JSON.stringify(model)}${newline}`);
|
|
2949
|
+
}
|
|
2950
|
+
const next = lines.join("");
|
|
2951
|
+
profiles[name].model = model;
|
|
2952
|
+
if (JSON.stringify(parse(next)) !== JSON.stringify(raw)) {
|
|
2953
|
+
const canonical = (value) => JSON.stringify(value, (_, v) => typeof v === "object" && v !== null && !Array.isArray(v) ? Object.fromEntries(Object.keys(v).sort().map((key) => [key, v[key]])) : v);
|
|
2954
|
+
if (canonical(parse(next)) !== canonical(raw))
|
|
2955
|
+
throw new Error("could not safely edit the profile model");
|
|
2956
|
+
}
|
|
2957
|
+
return next;
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
// ../core/src/npm.ts
|
|
2961
|
+
var ARMADA_PACKAGE = CLI_PACKAGE;
|
|
2962
|
+
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${ARMADA_PACKAGE.replace("/", "%2f")}`;
|
|
2963
|
+
var NPM_CHECK_MS = 3000;
|
|
2964
|
+
async function checkPublished(version, fetch2, timeoutMs = NPM_CHECK_MS) {
|
|
2965
|
+
try {
|
|
2966
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
2967
|
+
const res = await fetch2(NPM_REGISTRY_URL, {
|
|
2968
|
+
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
2969
|
+
cache: "no-store",
|
|
2970
|
+
signal
|
|
2971
|
+
});
|
|
2972
|
+
if (!res.ok)
|
|
2973
|
+
return { state: "unknown", reason: `npm answered HTTP ${res.status}` };
|
|
2974
|
+
const body = await res.json();
|
|
2975
|
+
const versions = body?.versions;
|
|
2976
|
+
if (!versions || typeof versions !== "object" || Array.isArray(versions) || !Object.keys(versions).length)
|
|
2977
|
+
return { state: "unknown", reason: "npm listed no version" };
|
|
2978
|
+
const candidates = Object.keys(versions).filter((candidate) => /^\d+\.\d+\.\d+$/.test(candidate) && compareVersions(candidate, version) <= 0).sort((first, second) => compareVersions(second, first));
|
|
2979
|
+
for (const candidate of candidates) {
|
|
2980
|
+
const tarball = versions[candidate]?.dist?.tarball;
|
|
2981
|
+
if (typeof tarball !== "string" || !tarball)
|
|
2982
|
+
continue;
|
|
2983
|
+
const download = await fetch2(tarball, { method: "HEAD", cache: "no-store", signal });
|
|
2984
|
+
if (download.status === 200)
|
|
2985
|
+
return candidate === version ? { state: "published" } : { state: "missing", newest: candidate };
|
|
2986
|
+
if (download.status !== 404)
|
|
2987
|
+
return { state: "unknown", reason: `npm tarball answered HTTP ${download.status}` };
|
|
2988
|
+
}
|
|
2989
|
+
return { state: "missing", newest: null };
|
|
2990
|
+
} catch (err) {
|
|
2991
|
+
return { state: "unknown", reason: networkReason(err, timeoutMs) };
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2663
2995
|
// ../core/src/phases.ts
|
|
2664
2996
|
var TRANSITIONS = {
|
|
2665
2997
|
planning: ["awaiting-approval", "implementing", "awaiting-validation"],
|
|
@@ -4939,7 +5271,7 @@ var EMPTY_PERSONAL_CONFIG = {
|
|
|
4939
5271
|
dashboard: { url: null },
|
|
4940
5272
|
api: { url: null }
|
|
4941
5273
|
};
|
|
4942
|
-
var
|
|
5274
|
+
var isTable3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4943
5275
|
function parsePersonalConfig(text, source = "config.toml") {
|
|
4944
5276
|
let raw;
|
|
4945
5277
|
try {
|
|
@@ -4955,11 +5287,11 @@ function parsePersonalConfig(text, source = "config.toml") {
|
|
|
4955
5287
|
continue;
|
|
4956
5288
|
const keys = known[key];
|
|
4957
5289
|
if (!keys) {
|
|
4958
|
-
if (!
|
|
5290
|
+
if (!isTable3(v))
|
|
4959
5291
|
problems.push(`unknown key "${key}"`);
|
|
4960
5292
|
continue;
|
|
4961
5293
|
}
|
|
4962
|
-
if (!
|
|
5294
|
+
if (!isTable3(v)) {
|
|
4963
5295
|
problems.push(`"${key}" must be a table`);
|
|
4964
5296
|
continue;
|
|
4965
5297
|
}
|
|
@@ -4975,7 +5307,7 @@ function parsePersonalConfig(text, source = "config.toml") {
|
|
|
4975
5307
|
problems.push(`"${dotted}" must be a non-empty string`);
|
|
4976
5308
|
return null;
|
|
4977
5309
|
};
|
|
4978
|
-
const table = (key) =>
|
|
5310
|
+
const table = (key) => isTable3(raw[key]) ? raw[key] : {};
|
|
4979
5311
|
const config = {
|
|
4980
5312
|
language: str(raw.language, "language"),
|
|
4981
5313
|
dashboard: { url: str(table("dashboard").url, "dashboard.url") },
|
|
@@ -10159,7 +10491,7 @@ ${attachments.join(`
|
|
|
10159
10491
|
};
|
|
10160
10492
|
}
|
|
10161
10493
|
// package.json
|
|
10162
|
-
var version = "0.2.
|
|
10494
|
+
var version = "0.2.46";
|
|
10163
10495
|
|
|
10164
10496
|
// src/attach.ts
|
|
10165
10497
|
import { resolve } from "node:path";
|
|
@@ -10492,10 +10824,10 @@ async function authLogout(io) {
|
|
|
10492
10824
|
}
|
|
10493
10825
|
|
|
10494
10826
|
// src/brief.ts
|
|
10495
|
-
import { dirname as
|
|
10827
|
+
import { dirname as dirname4, join as join2 } from "node:path";
|
|
10496
10828
|
|
|
10497
10829
|
// src/watch.ts
|
|
10498
|
-
import { dirname as
|
|
10830
|
+
import { dirname as dirname3 } from "node:path";
|
|
10499
10831
|
|
|
10500
10832
|
// src/login.ts
|
|
10501
10833
|
var hostOf = (url) => {
|
|
@@ -10696,13 +11028,50 @@ async function logout(io) {
|
|
|
10696
11028
|
return 0;
|
|
10697
11029
|
}
|
|
10698
11030
|
|
|
10699
|
-
// src/
|
|
11031
|
+
// src/herdr.ts
|
|
11032
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
11033
|
+
import { dirname as dirname2 } from "node:path";
|
|
11034
|
+
|
|
11035
|
+
// src/first-run.ts
|
|
10700
11036
|
import { stripVTControlCharacters } from "node:util";
|
|
10701
|
-
|
|
11037
|
+
function firstRunIssue(harness, raw) {
|
|
11038
|
+
const text = stripVTControlCharacters(raw).replace(/\s+/g, " ");
|
|
11039
|
+
const kind = herdrHarnessKind(harness);
|
|
11040
|
+
if (kind === "claude") {
|
|
11041
|
+
if (/Is this a project you created or one you trust\?|Yes, I trust this folder|Do you trust the files in this folder\?/i.test(text))
|
|
11042
|
+
return { kind: "trust", message: "Claude Code asks to trust this folder" };
|
|
11043
|
+
if (/\d+ new MCP servers? found in this project/i.test(text))
|
|
11044
|
+
return { kind: "mcp", message: "Claude Code asks about new project MCP servers" };
|
|
11045
|
+
if (/Select login method|Log in to use Claude|Sign in to Claude/i.test(text))
|
|
11046
|
+
return { kind: "sign-in", message: "Claude Code asks the owner to sign in" };
|
|
11047
|
+
}
|
|
11048
|
+
if (kind === "codex") {
|
|
11049
|
+
if (/not supported when using Codex with a ChatGPT account/i.test(text))
|
|
11050
|
+
return { kind: "model", message: "Codex reports the configured model is not supported by this ChatGPT account" };
|
|
11051
|
+
if (/Do you trust the contents of this directory\?/i.test(text))
|
|
11052
|
+
return { kind: "trust", message: "Codex asks to trust this repository" };
|
|
11053
|
+
if (/Update available!/i.test(text) && /Skip until next version/i.test(text))
|
|
11054
|
+
return { kind: "update", message: "Codex asks whether to update" };
|
|
11055
|
+
if (/Sign in with ChatGPT/i.test(text) && /(?:Use|Provide|Sign in with) an API key/i.test(text))
|
|
11056
|
+
return { kind: "sign-in", message: "Codex asks the owner to sign in" };
|
|
11057
|
+
}
|
|
11058
|
+
if (kind === "opencode" && /Select a provider to connect|Connect a provider/i.test(text))
|
|
11059
|
+
return { kind: "sign-in", message: "OpenCode asks the owner to connect a provider" };
|
|
11060
|
+
if (/model (?:is )?(?:not found|unavailable)|invalid model|unsupported model/i.test(text))
|
|
11061
|
+
return {
|
|
11062
|
+
kind: "model",
|
|
11063
|
+
message: `${kind === "claude" ? "Claude Code" : kind === "codex" ? "Codex" : "OpenCode"} reports a model problem`
|
|
11064
|
+
};
|
|
11065
|
+
return null;
|
|
11066
|
+
}
|
|
11067
|
+
|
|
11068
|
+
// src/opencode-model.ts
|
|
11069
|
+
import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
11070
|
+
var displayName = (value) => typeof value === "string" && !!value.trim() && !/[\r\n]/.test(value) && stripVTControlCharacters2(value) === value;
|
|
10702
11071
|
function providersFrom(raw, configuration) {
|
|
10703
11072
|
try {
|
|
10704
|
-
const catalog = JSON.parse(
|
|
10705
|
-
const config = JSON.parse(
|
|
11073
|
+
const catalog = JSON.parse(stripVTControlCharacters2(raw));
|
|
11074
|
+
const config = JSON.parse(stripVTControlCharacters2(configuration));
|
|
10706
11075
|
const providers = Array.isArray(catalog?.providers) ? catalog.providers.filter((provider) => provider && displayName(provider.id) && displayName(provider.name)) : [];
|
|
10707
11076
|
for (const [id, value] of Object.entries(config?.provider ?? {})) {
|
|
10708
11077
|
const name = value?.name;
|
|
@@ -10722,7 +11091,7 @@ function providersFrom(raw, configuration) {
|
|
|
10722
11091
|
}
|
|
10723
11092
|
function modelsFrom(raw, providers) {
|
|
10724
11093
|
const models = [];
|
|
10725
|
-
for (const match of
|
|
11094
|
+
for (const match of stripVTControlCharacters2(raw).matchAll(/^([^\s/#]+\/[^\s#]+)\r?\n(\{\r?\n[\s\S]*?^\})/gm)) {
|
|
10726
11095
|
try {
|
|
10727
11096
|
const metadata = JSON.parse(match[2] ?? "");
|
|
10728
11097
|
const id = match[1] ?? "";
|
|
@@ -10734,7 +11103,7 @@ function modelsFrom(raw, providers) {
|
|
|
10734
11103
|
return models;
|
|
10735
11104
|
}
|
|
10736
11105
|
function selectedModel(pane, models) {
|
|
10737
|
-
const lines =
|
|
11106
|
+
const lines = stripVTControlCharacters2(pane).split(`
|
|
10738
11107
|
`);
|
|
10739
11108
|
const footers = lines.flatMap((line, index) => {
|
|
10740
11109
|
const bordered = /^\s*╹/.test(lines[index + 1] ?? "");
|
|
@@ -10775,7 +11144,7 @@ async function verifyOpenCodeModel(io, pane, expected) {
|
|
|
10775
11144
|
}).catch(() => null);
|
|
10776
11145
|
if (reading?.code !== 0)
|
|
10777
11146
|
throw failure();
|
|
10778
|
-
const text =
|
|
11147
|
+
const text = stripVTControlCharacters2(reading.stdout);
|
|
10779
11148
|
if (/ProviderModelNotFoundError|Model not found:/i.test(text))
|
|
10780
11149
|
throw new UsageError(`OpenCode could not load profile model ${expected}; launch stopped`);
|
|
10781
11150
|
const selected = selectedModel(text, models);
|
|
@@ -10802,7 +11171,8 @@ var harnessArgs = (p) => [
|
|
|
10802
11171
|
"--model",
|
|
10803
11172
|
p.model,
|
|
10804
11173
|
...p.harness === "codex" ? ["-c", `model_reasoning_effort=${JSON.stringify(p.effort)}`] : p.harness === "claude" ? ["--effort", p.effort] : [],
|
|
10805
|
-
...p.extraArgs
|
|
11174
|
+
...p.harness === "codex" && !p.extraArgs.some((arg) => /^(?:check_for_update_on_startup\s*=|--config=check_for_update_on_startup=)/.test(arg)) ? ["-c", "check_for_update_on_startup=false"] : [],
|
|
11175
|
+
...herdrPermissionArgs(p)
|
|
10806
11176
|
];
|
|
10807
11177
|
var object = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : null;
|
|
10808
11178
|
var id = (v) => typeof v === "string" && /^[a-zA-Z0-9][a-zA-Z0-9:_-]{0,127}$/.test(v);
|
|
@@ -10853,6 +11223,7 @@ var credentialNames = (env, extra) => [
|
|
|
10853
11223
|
|
|
10854
11224
|
class Herdr {
|
|
10855
11225
|
io;
|
|
11226
|
+
setupShell = null;
|
|
10856
11227
|
constructor(io) {
|
|
10857
11228
|
this.io = io;
|
|
10858
11229
|
}
|
|
@@ -10865,7 +11236,7 @@ class Herdr {
|
|
|
10865
11236
|
throw new Error("no exec");
|
|
10866
11237
|
const out = await this.io.exec("herdr", args, { cwd: this.io.cwd, timeoutMs });
|
|
10867
11238
|
code = out.code;
|
|
10868
|
-
if (code === 0 && !out.stdout.trim() && !out.stderr.trim() && ["pane run", "pane report-agent"].includes(operation))
|
|
11239
|
+
if (code === 0 && !out.stdout.trim() && !out.stderr.trim() && ["pane run", "pane report-agent", "pane report-metadata"].includes(operation))
|
|
10869
11240
|
return {};
|
|
10870
11241
|
reply = object(JSON.parse(out.stdout || out.stderr));
|
|
10871
11242
|
} catch {
|
|
@@ -10920,7 +11291,8 @@ class Herdr {
|
|
|
10920
11291
|
input.branch,
|
|
10921
11292
|
"--base",
|
|
10922
11293
|
input.base,
|
|
10923
|
-
"--no-focus"
|
|
11294
|
+
"--no-focus",
|
|
11295
|
+
...input.label ? ["--label", input.label] : []
|
|
10924
11296
|
])).result);
|
|
10925
11297
|
const workspace = object(r?.workspace)?.workspace_id;
|
|
10926
11298
|
const rootPane = object(r?.root_pane)?.pane_id;
|
|
@@ -10945,7 +11317,113 @@ class Herdr {
|
|
|
10945
11317
|
await this.call(["pane", "close", rootPane]);
|
|
10946
11318
|
return { workspace, pane, agent, path };
|
|
10947
11319
|
}
|
|
10948
|
-
async
|
|
11320
|
+
async setupRoot(repo, slug, secrets) {
|
|
11321
|
+
const result = object((await this.call(["worktree", "list", "--cwd", repo])).result);
|
|
11322
|
+
const source = object(result?.source);
|
|
11323
|
+
if (source?.source_checkout_path !== repo || typeof source.repo_root !== "string" || !source.repo_root.startsWith("/") || !Array.isArray(result?.worktrees))
|
|
11324
|
+
throw new UsageError("invalid herdr worktree list response; inspect herdr worktree list before setup");
|
|
11325
|
+
const branch = `armada-local-setup-${slug}`;
|
|
11326
|
+
const label = `Armada local setup checkout: ${slug}`;
|
|
11327
|
+
const found = result.worktrees.map(object).find((tree) => tree?.branch === branch);
|
|
11328
|
+
let path;
|
|
11329
|
+
if (found) {
|
|
11330
|
+
if (found.is_linked_worktree !== true || typeof found.path !== "string" || !found.path.startsWith("/"))
|
|
11331
|
+
throw new UsageError(`the setup branch ${branch} already exists outside Armada setup; leave it untouched and choose another project slug`);
|
|
11332
|
+
path = found.path;
|
|
11333
|
+
} else {
|
|
11334
|
+
path = (await this.create({ repo, branch, base: "HEAD", ticket: "setup-local", secrets, label })).path;
|
|
11335
|
+
}
|
|
11336
|
+
const root = dirname2(path);
|
|
11337
|
+
if (root === "/" || [...root].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
|
|
11338
|
+
throw new UsageError("invalid herdr worktree parent directory");
|
|
11339
|
+
return { root, repo: source.repo_root };
|
|
11340
|
+
}
|
|
11341
|
+
async setupWorkspace(root, secrets) {
|
|
11342
|
+
const label = `Armada local setup: ${root}`;
|
|
11343
|
+
const workspaces = object((await this.call(["workspace", "list"])).result)?.workspaces;
|
|
11344
|
+
if (!Array.isArray(workspaces))
|
|
11345
|
+
throw new UsageError("invalid herdr workspace list response");
|
|
11346
|
+
const matches = workspaces.map(object).filter((ws) => ws?.label === label);
|
|
11347
|
+
if (matches.length > 1)
|
|
11348
|
+
throw new UsageError("multiple local setup workspaces; inspect herdr workspace list before retrying");
|
|
11349
|
+
if (matches.length) {
|
|
11350
|
+
const workspace = matches[0]?.workspace_id;
|
|
11351
|
+
if (!id(workspace))
|
|
11352
|
+
throw new UsageError("invalid herdr setup workspace response");
|
|
11353
|
+
return workspace;
|
|
11354
|
+
}
|
|
11355
|
+
const result = object((await this.call([
|
|
11356
|
+
"workspace",
|
|
11357
|
+
"create",
|
|
11358
|
+
"--cwd",
|
|
11359
|
+
root,
|
|
11360
|
+
"--label",
|
|
11361
|
+
label,
|
|
11362
|
+
"--no-focus",
|
|
11363
|
+
...credentialNames(this.io.env, secrets).flatMap((name) => ["--env", `${name}=`]),
|
|
11364
|
+
"--env",
|
|
11365
|
+
"ARMADA_TICKET="
|
|
11366
|
+
])).result);
|
|
11367
|
+
const workspace = object(result?.workspace)?.workspace_id;
|
|
11368
|
+
const pane = object(result?.root_pane);
|
|
11369
|
+
if (!id(workspace) || !id(pane?.pane_id) || pane?.workspace_id !== workspace)
|
|
11370
|
+
throw new UsageError("invalid herdr setup workspace response");
|
|
11371
|
+
this.setupShell = { workspace, pane: String(pane?.pane_id) };
|
|
11372
|
+
return workspace;
|
|
11373
|
+
}
|
|
11374
|
+
async setupPane(workspace, root, profile, secrets) {
|
|
11375
|
+
const kind = herdrHarnessKind(profile.harness);
|
|
11376
|
+
const fingerprint = createHash3("sha256").update(JSON.stringify([kind, ...harnessArgs(profile)])).digest("hex").slice(0, 32);
|
|
11377
|
+
const name = `setup-${workspace}-${kind}`;
|
|
11378
|
+
if (!/^[a-z][a-z0-9_-]{0,31}$/.test(name))
|
|
11379
|
+
throw new UsageError("cannot name the setup agent for this workspace");
|
|
11380
|
+
const agents = object((await this.call(["agent", "list"])).result)?.agents;
|
|
11381
|
+
if (!Array.isArray(agents))
|
|
11382
|
+
throw new UsageError("invalid herdr agent list response");
|
|
11383
|
+
const matches = agents.map(object).filter((agent) => agent?.name === name);
|
|
11384
|
+
if (matches.length > 1)
|
|
11385
|
+
throw new UsageError("multiple setup agents; inspect herdr agent list");
|
|
11386
|
+
if (matches.length) {
|
|
11387
|
+
const agent = matches[0];
|
|
11388
|
+
if (agent?.workspace_id !== workspace || !id(agent.pane_id) || agent.cwd !== root || agent.agent !== kind)
|
|
11389
|
+
throw new UsageError("setup agent identity or directory changed; inspect herdr agent list before retrying");
|
|
11390
|
+
if (object(agent.tokens)?.armadaSetup !== fingerprint)
|
|
11391
|
+
throw new UsageError(`the ${kind} setup session uses different launch settings; close its pane ${agent.pane_id} in herdr, then rerun armada setup local to check the current profile`);
|
|
11392
|
+
return { handle: { workspace, pane: agent.pane_id, agent: name, path: root }, existing: true };
|
|
11393
|
+
}
|
|
11394
|
+
const result = object((await this.call([
|
|
11395
|
+
"tab",
|
|
11396
|
+
"create",
|
|
11397
|
+
"--workspace",
|
|
11398
|
+
workspace,
|
|
11399
|
+
"--cwd",
|
|
11400
|
+
root,
|
|
11401
|
+
"--label",
|
|
11402
|
+
kind,
|
|
11403
|
+
"--no-focus",
|
|
11404
|
+
...credentialNames(this.io.env, secrets).flatMap((key) => ["--env", `${key}=`]),
|
|
11405
|
+
"--env",
|
|
11406
|
+
"ARMADA_TICKET="
|
|
11407
|
+
])).result);
|
|
11408
|
+
const pane = object(result?.root_pane);
|
|
11409
|
+
if (!id(pane?.pane_id) || pane?.workspace_id !== workspace)
|
|
11410
|
+
throw new UsageError("invalid herdr setup pane response");
|
|
11411
|
+
await this.call([
|
|
11412
|
+
"pane",
|
|
11413
|
+
"report-metadata",
|
|
11414
|
+
pane.pane_id,
|
|
11415
|
+
"--source",
|
|
11416
|
+
"armada-setup",
|
|
11417
|
+
"--token",
|
|
11418
|
+
`armadaSetup=${fingerprint}`
|
|
11419
|
+
]);
|
|
11420
|
+
if (this.setupShell?.workspace === workspace) {
|
|
11421
|
+
await this.call(["pane", "close", this.setupShell.pane]);
|
|
11422
|
+
this.setupShell = null;
|
|
11423
|
+
}
|
|
11424
|
+
return { handle: { workspace, pane: pane.pane_id, agent: name, path: root }, existing: false };
|
|
11425
|
+
}
|
|
11426
|
+
async start(handle, profile, timeoutMs = 30000, verifyModel = true) {
|
|
10949
11427
|
const r = await this.call([
|
|
10950
11428
|
"agent",
|
|
10951
11429
|
"start",
|
|
@@ -10955,12 +11433,12 @@ class Herdr {
|
|
|
10955
11433
|
"--pane",
|
|
10956
11434
|
handle.pane,
|
|
10957
11435
|
"--timeout",
|
|
10958
|
-
|
|
11436
|
+
String(timeoutMs),
|
|
10959
11437
|
"--",
|
|
10960
11438
|
...harnessArgs(profile)
|
|
10961
11439
|
]);
|
|
10962
11440
|
this.checkAgent(r, handle);
|
|
10963
|
-
if (herdrHarnessKind(profile.harness) === "opencode") {
|
|
11441
|
+
if (verifyModel && herdrHarnessKind(profile.harness) === "opencode") {
|
|
10964
11442
|
try {
|
|
10965
11443
|
await verifyOpenCodeModel(this.io, handle.pane, profile.model);
|
|
10966
11444
|
} catch (error) {
|
|
@@ -10973,11 +11451,121 @@ class Herdr {
|
|
|
10973
11451
|
}
|
|
10974
11452
|
}
|
|
10975
11453
|
}
|
|
11454
|
+
async inspect(handle, harness) {
|
|
11455
|
+
const agent = this.checkAgent(await this.call(["agent", "get", handle.pane], 5000), handle);
|
|
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");
|
|
11458
|
+
const state = agent.agent_status;
|
|
11459
|
+
if (!["working", "blocked", "idle", "done", "unknown"].includes(String(state)))
|
|
11460
|
+
throw new UsageError("invalid herdr agent state");
|
|
11461
|
+
let text;
|
|
11462
|
+
try {
|
|
11463
|
+
if (!this.io.exec)
|
|
11464
|
+
throw new Error("no exec");
|
|
11465
|
+
const result = await this.io.exec("herdr", ["pane", "read", handle.pane, "--source", "visible", "--lines", "80"], {
|
|
11466
|
+
cwd: this.io.cwd,
|
|
11467
|
+
timeoutMs: 5000
|
|
11468
|
+
});
|
|
11469
|
+
if (result.code !== 0)
|
|
11470
|
+
throw new Error("read failed");
|
|
11471
|
+
text = result.stdout;
|
|
11472
|
+
} catch {
|
|
11473
|
+
throw new UsageError(`could not inspect the worker screen; run herdr agent attach ${handle.agent}`);
|
|
11474
|
+
}
|
|
11475
|
+
return {
|
|
11476
|
+
state,
|
|
11477
|
+
ready: (state === "idle" || state === "done") && agent.interactive_ready !== false && agent.launch_pending !== true,
|
|
11478
|
+
issue: firstRunIssue(harness, text)
|
|
11479
|
+
};
|
|
11480
|
+
}
|
|
11481
|
+
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.agent}`, `herdr agent attach ${handle.agent}`);
|
|
11483
|
+
}
|
|
11484
|
+
async checkProfileModel(handle, profile) {
|
|
11485
|
+
if (herdrHarnessKind(profile.harness) !== "opencode")
|
|
11486
|
+
return;
|
|
11487
|
+
try {
|
|
11488
|
+
await verifyOpenCodeModel(this.io, handle.pane, profile.model);
|
|
11489
|
+
} catch (error) {
|
|
11490
|
+
const screen = await this.inspect(handle, profile.harness);
|
|
11491
|
+
throw this.screenError(handle, screen.issue, error instanceof UsageError ? error.message : "Could not verify the OpenCode profile model");
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
async startChecked(handle, profile) {
|
|
11495
|
+
try {
|
|
11496
|
+
await this.start(handle, profile, 3500, false);
|
|
11497
|
+
} catch (error) {
|
|
11498
|
+
if (!(error instanceof HerdrError) || !["agent_not_ready", "timeout"].includes(error.code ?? ""))
|
|
11499
|
+
throw error;
|
|
11500
|
+
}
|
|
11501
|
+
const now = this.io.now ?? (() => new Date);
|
|
11502
|
+
const deadline = now().getTime() + 30000;
|
|
11503
|
+
for (let attempt = 0;attempt < 120 && now().getTime() < deadline; attempt++) {
|
|
11504
|
+
const screen = await this.inspect(handle, profile.harness);
|
|
11505
|
+
if (screen.issue || screen.state === "blocked")
|
|
11506
|
+
throw this.screenError(handle, screen.issue);
|
|
11507
|
+
if (screen.ready) {
|
|
11508
|
+
await this.checkProfileModel(handle, profile);
|
|
11509
|
+
return;
|
|
11510
|
+
}
|
|
11511
|
+
await (this.io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))))(250);
|
|
11512
|
+
}
|
|
11513
|
+
throw this.screenError(handle, null, "The harness did not become ready");
|
|
11514
|
+
}
|
|
11515
|
+
async promptChecked(handle, profile, prompt) {
|
|
11516
|
+
const before = await this.inspect(handle, profile.harness);
|
|
11517
|
+
if (before.issue || !before.ready)
|
|
11518
|
+
throw this.screenError(handle, before.issue);
|
|
11519
|
+
await this.checkProfileModel(handle, profile);
|
|
11520
|
+
try {
|
|
11521
|
+
await this.prompt(handle, prompt);
|
|
11522
|
+
} catch (error) {
|
|
11523
|
+
const screen = await this.inspect(handle, profile.harness);
|
|
11524
|
+
if (screen.issue || screen.state === "blocked")
|
|
11525
|
+
throw this.screenError(handle, screen.issue);
|
|
11526
|
+
if (error instanceof HerdrError && ["agent_prompt_stalled", "timeout"].includes(error.code ?? ""))
|
|
11527
|
+
throw this.screenError(handle, null, "The harness did not accept the brief");
|
|
11528
|
+
throw error;
|
|
11529
|
+
}
|
|
11530
|
+
}
|
|
11531
|
+
async checkSetupModel(handle, profile) {
|
|
11532
|
+
const screen = await this.inspect(handle, profile.harness);
|
|
11533
|
+
if (screen.issue || !screen.ready)
|
|
11534
|
+
throw this.screenError(handle, screen.issue);
|
|
11535
|
+
await this.checkProfileModel(handle, profile);
|
|
11536
|
+
try {
|
|
11537
|
+
const agent = this.checkAgent(await this.call([
|
|
11538
|
+
"agent",
|
|
11539
|
+
"prompt",
|
|
11540
|
+
handle.pane,
|
|
11541
|
+
"Reply with OK only. Do not read files, run commands or modify anything.",
|
|
11542
|
+
"--wait",
|
|
11543
|
+
"--until",
|
|
11544
|
+
"idle",
|
|
11545
|
+
"--until",
|
|
11546
|
+
"done",
|
|
11547
|
+
"--timeout",
|
|
11548
|
+
"10000"
|
|
11549
|
+
], 12000), handle);
|
|
11550
|
+
const after = await this.inspect(handle, profile.harness);
|
|
11551
|
+
if (after.issue)
|
|
11552
|
+
throw this.screenError(handle, after.issue);
|
|
11553
|
+
if (!["idle", "done"].includes(String(agent.agent_status)) || !after.ready)
|
|
11554
|
+
throw this.screenError(handle, null, "The model did not finish the setup check");
|
|
11555
|
+
} catch (error) {
|
|
11556
|
+
const after = await this.inspect(handle, profile.harness);
|
|
11557
|
+
if (after.issue)
|
|
11558
|
+
throw this.screenError(handle, after.issue);
|
|
11559
|
+
if (error instanceof UsageError && !(error instanceof HerdrError))
|
|
11560
|
+
throw error;
|
|
11561
|
+
throw this.screenError(handle, null, "The model did not finish the setup check");
|
|
11562
|
+
}
|
|
11563
|
+
}
|
|
10976
11564
|
async prompt(handle, prompt) {
|
|
10977
11565
|
const r = await this.call([
|
|
10978
11566
|
"agent",
|
|
10979
11567
|
"prompt",
|
|
10980
|
-
handle.
|
|
11568
|
+
handle.pane,
|
|
10981
11569
|
prompt,
|
|
10982
11570
|
"--wait",
|
|
10983
11571
|
"--until",
|
|
@@ -11738,7 +12326,7 @@ async function watchUntil(io, config, credentials, json, configPath) {
|
|
|
11738
12326
|
if (!fleet)
|
|
11739
12327
|
throw new Refusal(`the inbox is on Armada, which cannot be reached: ${warning ?? "no answer"}`, "armada whoami");
|
|
11740
12328
|
const before = paths ? await readWatchState(paths, project) : null;
|
|
11741
|
-
await remember(io, project, { root:
|
|
12329
|
+
await remember(io, project, { root: dirname3(configPath), stopped: null });
|
|
11742
12330
|
const report = await watchInbox(observingFleet(watchingIo, fleet), {
|
|
11743
12331
|
project,
|
|
11744
12332
|
signal: controller.signal,
|
|
@@ -11812,7 +12400,7 @@ async function hookStop(io, rest, findConfig) {
|
|
|
11812
12400
|
const { path, text } = await findConfig({ ...io, cwd });
|
|
11813
12401
|
const project = parseConfig(text, path).project.slug;
|
|
11814
12402
|
const { state, running } = await watchOf(io, project);
|
|
11815
|
-
const d = stopHookDecision({ project, root:
|
|
12403
|
+
const d = stopHookDecision({ project, root: dirname3(path), state, watching: running, env: io.env });
|
|
11816
12404
|
if (d.block)
|
|
11817
12405
|
io.stdout(`${JSON.stringify({ decision: "block", reason: d.reason })}
|
|
11818
12406
|
`);
|
|
@@ -11941,7 +12529,7 @@ async function brief(io, config, credentials, a, version, configPath) {
|
|
|
11941
12529
|
if (!credentials.linearApiKey)
|
|
11942
12530
|
throw missingKey(LINEAR_KEY);
|
|
11943
12531
|
const extraPath = config.brief.extra;
|
|
11944
|
-
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join2(
|
|
12532
|
+
const conventions = extraPath ? { path: extraPath, text: await io.readFile(join2(dirname4(configPath), extraPath)).catch(() => null) } : null;
|
|
11945
12533
|
let b;
|
|
11946
12534
|
try {
|
|
11947
12535
|
b = await loadBrief(config, {
|
|
@@ -12012,7 +12600,7 @@ ${next.line}
|
|
|
12012
12600
|
import { join as join4 } from "node:path";
|
|
12013
12601
|
|
|
12014
12602
|
// src/local-tools.ts
|
|
12015
|
-
import { stripVTControlCharacters as
|
|
12603
|
+
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
12016
12604
|
var MINIMUM_HERDR_VERSION = "0.9.1";
|
|
12017
12605
|
var TOOLS = {
|
|
12018
12606
|
herdr: { command: "herdr", install: "curl -fsSL https://herdr.dev/install.sh | sh" },
|
|
@@ -12128,7 +12716,7 @@ async function openCodeModels(io) {
|
|
|
12128
12716
|
if (result?.code !== 0)
|
|
12129
12717
|
return null;
|
|
12130
12718
|
return [
|
|
12131
|
-
...new Set(
|
|
12719
|
+
...new Set(stripVTControlCharacters3(result.stdout).split(`
|
|
12132
12720
|
`).map((line) => line.trim()).filter((line) => /^[^\s/#]+\/[^\s#]+$/.test(line)))
|
|
12133
12721
|
];
|
|
12134
12722
|
}
|
|
@@ -12136,7 +12724,7 @@ async function claudeModels(io) {
|
|
|
12136
12724
|
const result = await probe(io, "claude", ["--help"], { timeoutMs: 5000, maxOutputBytes: 262144 });
|
|
12137
12725
|
if (result?.code !== 0)
|
|
12138
12726
|
return null;
|
|
12139
|
-
const help =
|
|
12727
|
+
const help = stripVTControlCharacters3(result.stdout);
|
|
12140
12728
|
const option = help.match(/(?:^|\n)\s+--model\s+<model>([\s\S]*?)(?=\n\s+--?[a-zA-Z]|$)/)?.[1];
|
|
12141
12729
|
if (!option)
|
|
12142
12730
|
return null;
|
|
@@ -12328,7 +12916,7 @@ async function ensureLocalProfile(io, configPath, name, profile) {
|
|
|
12328
12916
|
|
|
12329
12917
|
// src/repo.ts
|
|
12330
12918
|
import { lstat, mkdir as mkdir2, readdir, readFile as readFile2, readlink, rm as rm2, symlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
12331
|
-
import { dirname as
|
|
12919
|
+
import { dirname as dirname5, join as join3, relative, sep } from "node:path";
|
|
12332
12920
|
var absent = (err) => {
|
|
12333
12921
|
const code = err.code;
|
|
12334
12922
|
return code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR";
|
|
@@ -12386,12 +12974,12 @@ async function applyPlan(root, plan) {
|
|
|
12386
12974
|
await rm2(join3(root, path), { force: true });
|
|
12387
12975
|
for (const w of plan.writes) {
|
|
12388
12976
|
const full = join3(root, w.path);
|
|
12389
|
-
await mkdir2(
|
|
12977
|
+
await mkdir2(dirname5(full), { recursive: true });
|
|
12390
12978
|
await writeFile2(full, w.content);
|
|
12391
12979
|
}
|
|
12392
12980
|
for (const l of plan.links) {
|
|
12393
12981
|
const full = join3(root, l.path);
|
|
12394
|
-
await mkdir2(
|
|
12982
|
+
await mkdir2(dirname5(full), { recursive: true });
|
|
12395
12983
|
if (await lstat(full).catch(() => null))
|
|
12396
12984
|
await rm2(full, { recursive: true, force: true });
|
|
12397
12985
|
await symlink(l.target, full);
|
|
@@ -12732,6 +13320,8 @@ function renderDoctor(r) {
|
|
|
12732
13320
|
const errors = r.checks.filter((c) => c.level === "error");
|
|
12733
13321
|
if (errors.length)
|
|
12734
13322
|
lines.push(errors.some((c) => c.fix?.includes("armada init")) ? "Next: armada init, which opens one pull request with the fixes it can make" : `Next: ${errors[0]?.fix}`);
|
|
13323
|
+
if (r.checks.some((c) => c.id === "local-herdr"))
|
|
13324
|
+
lines.push("Local first-run setup: armada setup local — the owner answers trust, updates, project MCP, sign-in and model questions in herdr; new worktrees may still ask once.");
|
|
12735
13325
|
return `${lines.join(`
|
|
12736
13326
|
`)}
|
|
12737
13327
|
`;
|
|
@@ -12744,7 +13334,7 @@ async function doctor(io, json, armadaVersion) {
|
|
|
12744
13334
|
}
|
|
12745
13335
|
|
|
12746
13336
|
// src/heartbeat.ts
|
|
12747
|
-
import { createHash as
|
|
13337
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
12748
13338
|
async function heartbeat(io, config, credentials, args) {
|
|
12749
13339
|
if (args.rest.length)
|
|
12750
13340
|
throw new UsageError("heartbeat takes no positional argument");
|
|
@@ -12812,7 +13402,7 @@ async function heartbeat(io, config, credentials, args) {
|
|
|
12812
13402
|
return result;
|
|
12813
13403
|
},
|
|
12814
13404
|
ready: async (session) => {
|
|
12815
|
-
const name = `${config.project.slug}-heartbeat-${ticket.toLowerCase()}-${
|
|
13405
|
+
const name = `${config.project.slug}-heartbeat-${ticket.toLowerCase()}-${createHash4("sha256").update(`${handle}/${session.claimedAt}`).digest("hex").slice(0, 12)}`;
|
|
12816
13406
|
const acquired = await takeWatchLock(paths, name, pid, io.processAlive ?? processAlive);
|
|
12817
13407
|
if (acquired.taken)
|
|
12818
13408
|
lock = name;
|
|
@@ -13045,7 +13635,7 @@ async function init(io, opts) {
|
|
|
13045
13635
|
}
|
|
13046
13636
|
|
|
13047
13637
|
// src/launch.ts
|
|
13048
|
-
import { dirname as
|
|
13638
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
13049
13639
|
async function launch(io, config, credentials, args, version, configPath) {
|
|
13050
13640
|
if (args.rest[0] !== "revoke")
|
|
13051
13641
|
return launchLocal(io, config, credentials, args, version, configPath);
|
|
@@ -13162,7 +13752,7 @@ async function launchLocal(io, config, credentials, args, version, configPath) {
|
|
|
13162
13752
|
const base = remote.code === 0 ? remote.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD/m)?.[1] : null;
|
|
13163
13753
|
if (!base)
|
|
13164
13754
|
throw new UsageError("could not read the default branch of origin");
|
|
13165
|
-
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join6(
|
|
13755
|
+
const conventions = config.brief.extra ? { path: config.brief.extra, text: await io.readFile(join6(dirname6(configPath), config.brief.extra)) } : null;
|
|
13166
13756
|
const npm = await checkPublished(version, io.fetch ?? fetch);
|
|
13167
13757
|
if (npm.state === "missing")
|
|
13168
13758
|
throw new UsageError(`armada ${version} is not on npm yet; publish this version before launching local workers`);
|
|
@@ -13193,13 +13783,23 @@ async function launchLocal(io, config, credentials, args, version, configPath) {
|
|
|
13193
13783
|
},
|
|
13194
13784
|
herdr: { choice, handle: herdrClaimHandle(handle) }
|
|
13195
13785
|
});
|
|
13196
|
-
await runtime.
|
|
13197
|
-
await runtime.
|
|
13786
|
+
await runtime.startChecked(handle, choice.profile);
|
|
13787
|
+
await runtime.promptChecked(handle, choice.profile, b.prompt);
|
|
13198
13788
|
} catch (error) {
|
|
13199
13789
|
if (handle)
|
|
13200
13790
|
io.stderr(`armada: local workspace retained: ${herdrClaimHandle(handle)}
|
|
13201
13791
|
`);
|
|
13202
|
-
|
|
13792
|
+
let revoked = false;
|
|
13793
|
+
try {
|
|
13794
|
+
await api.revokePendingLaunch(signIn, { project: config.project.slug, ticket: ticketId, id: launch.worker.id });
|
|
13795
|
+
revoked = true;
|
|
13796
|
+
io.stderr(`armada: revoked the pending launch of ${ticketId}.
|
|
13797
|
+
`);
|
|
13798
|
+
} catch {
|
|
13799
|
+
io.stderr(`armada: could not revoke the pending launch; run armada launch revoke ${ticketId} before retrying (a claimed worker must release).
|
|
13800
|
+
`);
|
|
13801
|
+
}
|
|
13802
|
+
throw new UsageError(error instanceof UsageError || error instanceof BriefError ? error.message : "local worker launch failed", !revoked ? `armada launch revoke ${ticketId}` : handle ? `herdr agent attach ${handle.agent}` : "herdr agent list");
|
|
13203
13803
|
}
|
|
13204
13804
|
const known = (await watchOf(io, config.project.slug)).state?.inFlight ?? [];
|
|
13205
13805
|
const inFlightTickets = [...new Set([...known, ticketId])].sort();
|
|
@@ -13228,11 +13828,135 @@ ${watch.line}
|
|
|
13228
13828
|
return 0;
|
|
13229
13829
|
}
|
|
13230
13830
|
|
|
13831
|
+
// src/local-setup.ts
|
|
13832
|
+
async function setupLocal(io, initial, configPath, args) {
|
|
13833
|
+
if (args.rest.length !== 1 || args.rest[0] !== "local")
|
|
13834
|
+
throw new UsageError("setup needs a command: armada setup local");
|
|
13835
|
+
if (args.json || !io.interactive || io.env.CI || !io.prompt) {
|
|
13836
|
+
const message = "Local setup needs the owner at an interactive terminal to choose permissions and answer harness questions";
|
|
13837
|
+
io.stdout(args.json ? `${JSON.stringify({ ready: false, message, next: "armada setup local at an interactive terminal" })}
|
|
13838
|
+
` : `${message}: run armada setup local at an interactive terminal.
|
|
13839
|
+
`);
|
|
13840
|
+
return 1;
|
|
13841
|
+
}
|
|
13842
|
+
let config = initial;
|
|
13843
|
+
const profiles = Object.entries(config.herdr.profiles);
|
|
13844
|
+
if (!profiles.length)
|
|
13845
|
+
throw new UsageError("local setup needs at least one [herdr.profiles.<name>] in armada.toml");
|
|
13846
|
+
const unset = profiles.filter(([, p]) => p.permissions === undefined).map(([name]) => name);
|
|
13847
|
+
if (unset.length) {
|
|
13848
|
+
if (!io.writeFile)
|
|
13849
|
+
throw new UsageError("local setup needs configuration writes to save the owner's permission choice");
|
|
13850
|
+
const before = await io.readFile(configPath);
|
|
13851
|
+
if (before === null || JSON.stringify(parseConfig(before, configPath)) !== JSON.stringify(initial))
|
|
13852
|
+
throw new UsageError("configuration changed before setup; retry with the current armada.toml");
|
|
13853
|
+
io.stdout(`Choose permissions for local profiles: ${unset.join(", ")}.
|
|
13854
|
+
Ask keeps each harness's normal approval policy. Full uses Claude --dangerously-skip-permissions, Codex --dangerously-bypass-approvals-and-sandbox (no command sandbox), and OpenCode --auto (explicit deny rules still apply).
|
|
13855
|
+
Trust, MCP, sign-in and model questions remain the owner's decisions.
|
|
13856
|
+
`);
|
|
13857
|
+
const answer = await io.prompt("Permissions [ask/full] (Enter for ask): ", { hidden: false });
|
|
13858
|
+
if (answer === null)
|
|
13859
|
+
return 1;
|
|
13860
|
+
const permissions = answer.trim().toLowerCase() || "ask";
|
|
13861
|
+
if (permissions !== "ask" && permissions !== "full") {
|
|
13862
|
+
io.stderr(`Choose ask or full; configuration unchanged.
|
|
13863
|
+
`);
|
|
13864
|
+
return 1;
|
|
13865
|
+
}
|
|
13866
|
+
if (await io.readFile(configPath) !== before) {
|
|
13867
|
+
io.stderr(`Configuration changed while you chose permissions; retry setup without overwriting that edit.
|
|
13868
|
+
`);
|
|
13869
|
+
return 1;
|
|
13870
|
+
}
|
|
13871
|
+
let next;
|
|
13872
|
+
try {
|
|
13873
|
+
next = setHerdrPermissions(before, unset, permissions);
|
|
13874
|
+
const parsed = parseConfig(next, configPath);
|
|
13875
|
+
await io.writeFile(configPath, next);
|
|
13876
|
+
config = parsed;
|
|
13877
|
+
} catch {
|
|
13878
|
+
throw new UsageError(`could not safely save permissions; set permissions = "${permissions}" in the named profiles yourself, removing any conflicting native bypass flag from extra_args`);
|
|
13879
|
+
}
|
|
13880
|
+
io.stdout(`Saved permissions = "${permissions}" for ${unset.join(", ")} in ${configPath}.
|
|
13881
|
+
`);
|
|
13882
|
+
}
|
|
13883
|
+
if (!io.exec)
|
|
13884
|
+
throw new UsageError("local setup needs process execution");
|
|
13885
|
+
const detected = await offerLocalInstalls(io, await detectLocalTools(io, localHarnesses(config), localModelProfiles(config)));
|
|
13886
|
+
if (detected.tools.some((tool) => tool.state !== "ready")) {
|
|
13887
|
+
for (const check of detected.checks.filter((c) => c.level === "error"))
|
|
13888
|
+
io.stderr(`${check.message}${check.fix ? `: ${check.fix}` : ""}
|
|
13889
|
+
`);
|
|
13890
|
+
return 1;
|
|
13891
|
+
}
|
|
13892
|
+
const git = await io.exec("git", ["rev-parse", "--show-toplevel"], { cwd: io.cwd, timeoutMs: 1e4 });
|
|
13893
|
+
const repo = git.stdout.trim();
|
|
13894
|
+
if (git.code !== 0 || !repo.startsWith("/") || [...repo].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
|
|
13895
|
+
throw new UsageError("local setup must run in a git repository");
|
|
13896
|
+
const runtime = new Herdr(io);
|
|
13897
|
+
await runtime.ensureServer();
|
|
13898
|
+
const location = await runtime.setupRoot(repo, config.project.slug, config.secrets.names);
|
|
13899
|
+
const workspace = await runtime.setupWorkspace(location.root, config.secrets.names);
|
|
13900
|
+
io.stdout(`Local setup at ${location.root}.
|
|
13901
|
+
Answer each harness's folder trust, update, project MCP, sign-in and model questions yourself in its pane. Armada never answers these questions or edits harness settings.
|
|
13902
|
+
Claude Code: trusting this parent folder does not cover Git repositories beneath it. Current versions key linked-worktree trust on the main checkout (${location.repo}); approve that repository yourself, or answer each new worktree's question on versions that ask again. Project MCP questions can still appear per checkout.
|
|
13903
|
+
`);
|
|
13904
|
+
const selected = new Set;
|
|
13905
|
+
const sessions = [];
|
|
13906
|
+
for (const [name, profile] of Object.entries(config.herdr.profiles)) {
|
|
13907
|
+
const kind = herdrHarnessKind(profile.harness);
|
|
13908
|
+
if (selected.has(kind))
|
|
13909
|
+
continue;
|
|
13910
|
+
selected.add(kind);
|
|
13911
|
+
const pane = await runtime.setupPane(workspace, location.root, profile, config.secrets.names);
|
|
13912
|
+
const session = { handle: pane.handle, profile, name, error: null };
|
|
13913
|
+
sessions.push(session);
|
|
13914
|
+
io.stdout(`${kind} (profile ${name}): herdr agent attach ${pane.handle.agent}
|
|
13915
|
+
`);
|
|
13916
|
+
if (!pane.existing) {
|
|
13917
|
+
try {
|
|
13918
|
+
await runtime.startChecked(pane.handle, profile);
|
|
13919
|
+
} catch (error) {
|
|
13920
|
+
session.error = error instanceof UsageError ? error.message : `Could not start ${kind}; run herdr agent attach ${pane.handle.agent}`;
|
|
13921
|
+
io.stdout(`${session.error}
|
|
13922
|
+
`);
|
|
13923
|
+
}
|
|
13924
|
+
}
|
|
13925
|
+
}
|
|
13926
|
+
io.stdout(`Setup checks the selected profile for each native harness; other models remain subject to armada doctor's profile checks.
|
|
13927
|
+
`);
|
|
13928
|
+
const answer = await io.prompt("Answer the questions in those panes, then press Enter here to check (or Ctrl-C to leave them open): ", { hidden: false });
|
|
13929
|
+
if (answer === null)
|
|
13930
|
+
return 1;
|
|
13931
|
+
let ready = true;
|
|
13932
|
+
for (const session of sessions) {
|
|
13933
|
+
try {
|
|
13934
|
+
const screen = await runtime.inspect(session.handle, session.profile.harness);
|
|
13935
|
+
if (screen.issue || !screen.ready) {
|
|
13936
|
+
ready = false;
|
|
13937
|
+
io.stdout(`${screen.issue?.message ?? "The harness is not ready"}: herdr agent attach ${session.handle.agent}
|
|
13938
|
+
`);
|
|
13939
|
+
} else {
|
|
13940
|
+
await runtime.checkSetupModel(session.handle, session.profile);
|
|
13941
|
+
io.stdout(`${herdrHarnessKind(session.profile.harness)} (profile ${session.name}): ready; model answered the setup check.
|
|
13942
|
+
`);
|
|
13943
|
+
}
|
|
13944
|
+
} catch (error) {
|
|
13945
|
+
ready = false;
|
|
13946
|
+
io.stdout(`${error instanceof UsageError ? error.message : "Could not verify the harness"}; herdr agent attach ${session.handle.agent}
|
|
13947
|
+
`);
|
|
13948
|
+
}
|
|
13949
|
+
}
|
|
13950
|
+
io.stdout(`${ready ? "Local setup checked" : "Local setup still needs attention"}. The panes and setup checkout are kept; rerun armada setup local to check again.
|
|
13951
|
+
`);
|
|
13952
|
+
return ready ? 0 : 1;
|
|
13953
|
+
}
|
|
13954
|
+
|
|
13231
13955
|
// src/merge.ts
|
|
13232
13956
|
import { randomUUID } from "node:crypto";
|
|
13233
13957
|
import { rm as rm4 } from "node:fs/promises";
|
|
13234
13958
|
import { hostname, tmpdir as tmpdir2 } from "node:os";
|
|
13235
|
-
import { dirname as
|
|
13959
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
13236
13960
|
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;
|
|
13237
13961
|
var tail = (text, lines = 30) => text.trimEnd().split(`
|
|
13238
13962
|
`).slice(-lines).join(`
|
|
@@ -13419,7 +14143,7 @@ async function merge(io, config, credentials, a, configPath) {
|
|
|
13419
14143
|
if (!exec)
|
|
13420
14144
|
throw new UsageError("armada merge needs to run git and gh");
|
|
13421
14145
|
const linearApiKey = credentials.linearApiKey;
|
|
13422
|
-
const repoDir =
|
|
14146
|
+
const repoDir = dirname7(configPath);
|
|
13423
14147
|
const fetchOpt = io.fetch ? { fetch: io.fetch } : {};
|
|
13424
14148
|
const gh = { token, repository: config.github.repository, ...fetchOpt };
|
|
13425
14149
|
const linearOpts = { apiKey: linearApiKey, labels: config.tracker.labels, ...fetchOpt };
|
|
@@ -13670,7 +14394,7 @@ ${"─".repeat(60)}
|
|
|
13670
14394
|
}
|
|
13671
14395
|
|
|
13672
14396
|
// src/secrets.ts
|
|
13673
|
-
import { dirname as
|
|
14397
|
+
import { dirname as dirname8, relative as relative3, resolve as resolve2 } from "node:path";
|
|
13674
14398
|
var NAME_HINT = "upper snake case, e.g. OPENAI_API_KEY";
|
|
13675
14399
|
var hhmm2 = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
|
|
13676
14400
|
function signInOf(config, credentials) {
|
|
@@ -13750,7 +14474,7 @@ Next: armada secrets set <NAME> (an owner or admin), or the Keys page of Armada
|
|
|
13750
14474
|
async function exportRefusal(io, path) {
|
|
13751
14475
|
if (!io.exec)
|
|
13752
14476
|
return "git cannot be run here to check that the file is ignored";
|
|
13753
|
-
const cwd =
|
|
14477
|
+
const cwd = dirname8(path);
|
|
13754
14478
|
const tracked = await io.exec("git", ["ls-files", "--error-unmatch", "--", path], { cwd }).catch(() => null);
|
|
13755
14479
|
if (tracked?.code === 0)
|
|
13756
14480
|
return `git tracks ${path}: secrets written there would be committed`;
|
|
@@ -14009,11 +14733,16 @@ var COMMAND_HELP = {
|
|
|
14009
14733
|
`,
|
|
14010
14734
|
status: ` status Tickets in flight, tickets ready to start and pull requests waiting
|
|
14011
14735
|
status --all The same for every project registered by \`armada init\`
|
|
14736
|
+
`,
|
|
14737
|
+
setup: ` setup local Open local harness panes for the owner to answer first-run questions,
|
|
14738
|
+
choose ask/full permissions once, and check the selected models.
|
|
14739
|
+
Requires an interactive terminal; --json reports that requirement
|
|
14012
14740
|
`,
|
|
14013
14741
|
doctor: ` doctor What this repository lacks to be run by Armada, with the fix for each,
|
|
14014
14742
|
and whether this terminal is signed in to Armada. Local herdr profiles
|
|
14015
14743
|
check tools and harness sign-in; offers official installs with y/N.
|
|
14016
|
-
No terminal, CI and --json only print fixes and never install
|
|
14744
|
+
No terminal, CI and --json only print fixes and never install.
|
|
14745
|
+
For harness first-run questions, the owner runs armada setup local
|
|
14017
14746
|
`,
|
|
14018
14747
|
init: ` init [--program-root <ISSUE-ID>] [--name <name>] [--slug <slug>] [--no-stop-hook]
|
|
14019
14748
|
Open one pull request that installs or updates it all, create the
|
|
@@ -14199,7 +14928,8 @@ var CONFIG_OPTION = new Set([
|
|
|
14199
14928
|
"stop",
|
|
14200
14929
|
"merge",
|
|
14201
14930
|
"brief",
|
|
14202
|
-
"launch"
|
|
14931
|
+
"launch",
|
|
14932
|
+
"setup"
|
|
14203
14933
|
]);
|
|
14204
14934
|
var JSON_OPTION = new Set([
|
|
14205
14935
|
"skills",
|
|
@@ -14390,12 +15120,12 @@ async function findConfig(io, explicit, command = "status") {
|
|
|
14390
15120
|
throw new UsageError(`${path} does not exist`, `armada ${command} --config <file>, with the path of an ${CONFIG_FILE}`);
|
|
14391
15121
|
return { path, text };
|
|
14392
15122
|
}
|
|
14393
|
-
for (let dir = resolve3(io.cwd);; dir =
|
|
15123
|
+
for (let dir = resolve3(io.cwd);; dir = dirname9(dir)) {
|
|
14394
15124
|
const path = join8(dir, CONFIG_FILE);
|
|
14395
15125
|
const text = await io.readFile(path);
|
|
14396
15126
|
if (text !== null)
|
|
14397
15127
|
return { path, text };
|
|
14398
|
-
if (
|
|
15128
|
+
if (dirname9(dir) === dir)
|
|
14399
15129
|
break;
|
|
14400
15130
|
}
|
|
14401
15131
|
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`);
|
|
@@ -14416,7 +15146,7 @@ async function status(io, args) {
|
|
|
14416
15146
|
...io.fetch ? { fetch: io.fetch } : {},
|
|
14417
15147
|
...io.now ? { now: io.now } : {}
|
|
14418
15148
|
});
|
|
14419
|
-
const behind = await skillsBehind(fsRepoView(
|
|
15149
|
+
const behind = await skillsBehind(fsRepoView(dirname9(path))).catch(() => null);
|
|
14420
15150
|
if (behind)
|
|
14421
15151
|
report.warnings.push(skillsBehindLine(behind, version));
|
|
14422
15152
|
io.stdout(args.json ? `${JSON.stringify(report, null, 2)}
|
|
@@ -14569,6 +15299,10 @@ async function dispatch(argv, io) {
|
|
|
14569
15299
|
await recordPresence(io, config, credentials);
|
|
14570
15300
|
return await brief(io, config, credentials, args, version, path);
|
|
14571
15301
|
}
|
|
15302
|
+
if (args.command === "setup") {
|
|
15303
|
+
const { path, text } = await findConfig(io, args.config, "setup");
|
|
15304
|
+
return await setupLocal(io, parseConfig(text, path), path, args);
|
|
15305
|
+
}
|
|
14572
15306
|
if (args.command === "launch") {
|
|
14573
15307
|
const { path, text } = await findConfig(io, args.config, "launch");
|
|
14574
15308
|
const config = parseConfig(text, path);
|