@tablation/crew 0.149.3 → 0.149.5
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/cli.js +151 -121
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -985,6 +985,14 @@ function staleTunnelAttentionKeys(openKeys, plannedIds) {
|
|
|
985
985
|
return !id.startsWith("periscope:") && !plannedIds.has(id);
|
|
986
986
|
});
|
|
987
987
|
}
|
|
988
|
+
function deadTunnels(stateDir, alive = isPidAlive) {
|
|
989
|
+
const out = [];
|
|
990
|
+
for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
|
|
991
|
+
const t = readPersistedTunnel(stateDir, workspaceId);
|
|
992
|
+
if (t && (t.status === "connected" || t.status === "connecting") && !alive(t.pid)) out.push({ workspaceId, pid: t.pid });
|
|
993
|
+
}
|
|
994
|
+
return out;
|
|
995
|
+
}
|
|
988
996
|
function rejectedTunnels(stateDir) {
|
|
989
997
|
const out = [];
|
|
990
998
|
for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
|
|
@@ -6707,12 +6715,18 @@ function repoStopFor(items, route2) {
|
|
|
6707
6715
|
return name ? stops.get(name) ?? null : null;
|
|
6708
6716
|
};
|
|
6709
6717
|
}
|
|
6718
|
+
var DOCKER_DAEMON_KEY = "docker_missing:daemon";
|
|
6719
|
+
var DOCKER_REMEDY = "start the Docker daemon (on macOS open Docker Desktop and add it to login items)";
|
|
6720
|
+
function dockerDaemonItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6721
|
+
return { kind: "docker_missing", key: DOCKER_DAEMON_KEY, since: nowIso, message: `the Docker daemon does not answer; ${DOCKER_REMEDY}. Sandbox image builds and Host Passengers containers wait; relay tunnels stay up for control` };
|
|
6722
|
+
}
|
|
6710
6723
|
function recheckEnvironmentStops(state, route2, ship, deps = {}) {
|
|
6711
6724
|
const onPath2 = deps.onPath ?? findOnPath;
|
|
6712
6725
|
const dockerProblem = deps.dockerProblem ?? dockerPathProblem;
|
|
6713
6726
|
const cleared = [];
|
|
6714
6727
|
for (const item of state.shipAttention().previous()) {
|
|
6715
6728
|
if (item.kind === "docker_missing") {
|
|
6729
|
+
if (item.key === DOCKER_DAEMON_KEY) continue;
|
|
6716
6730
|
if (!dockerProblem(ship)) {
|
|
6717
6731
|
clearShipAttention(state, item.key);
|
|
6718
6732
|
cleared.push("docker");
|
|
@@ -6887,6 +6901,18 @@ var SHELL_WORDS = /* @__PURE__ */ new Set([
|
|
|
6887
6901
|
"ok"
|
|
6888
6902
|
]);
|
|
6889
6903
|
|
|
6904
|
+
// src/passengers-cycle.ts
|
|
6905
|
+
async function dockerGate(deps) {
|
|
6906
|
+
if (deps.dockerUp) {
|
|
6907
|
+
deps.clear(DOCKER_DAEMON_KEY);
|
|
6908
|
+
return "proceed";
|
|
6909
|
+
}
|
|
6910
|
+
deps.warn(`Host Passengers is on for at least one route but ${deps.pathProblem() ?? "Docker is not available"} \u2014 skipping container sync this cycle`);
|
|
6911
|
+
await deps.raise(dockerDaemonItem(), deps.passengerRoutes[0]);
|
|
6912
|
+
await deps.syncTunnels([], /* @__PURE__ */ new Map(), deps.passengerRoutes);
|
|
6913
|
+
return "handled";
|
|
6914
|
+
}
|
|
6915
|
+
|
|
6890
6916
|
// src/doctor-problems.ts
|
|
6891
6917
|
var HOOK_NAMES2 = ["setup", "test", "build", "deploy"];
|
|
6892
6918
|
function repoFindings(o) {
|
|
@@ -6978,8 +7004,29 @@ function repoFindings(o) {
|
|
|
6978
7004
|
}
|
|
6979
7005
|
return { problems, passed };
|
|
6980
7006
|
}
|
|
7007
|
+
function dockerDaemonFinding(o) {
|
|
7008
|
+
if (!o.needed || o.up) return null;
|
|
7009
|
+
return {
|
|
7010
|
+
severity: "blocker",
|
|
7011
|
+
kind: "docker_daemon_down",
|
|
7012
|
+
message: "the Docker daemon does not answer `docker info`; Host Passengers containers, sandbox image builds and anything the relay reaches through them cannot work",
|
|
7013
|
+
remedy: DOCKER_REMEDY
|
|
7014
|
+
};
|
|
7015
|
+
}
|
|
7016
|
+
function deadTunnelFindings(dead, dockerDown) {
|
|
7017
|
+
return dead.map((t) => ({
|
|
7018
|
+
severity: "attention",
|
|
7019
|
+
kind: "tunnel_dead",
|
|
7020
|
+
message: `the relay tunnel for workspace ${t.workspaceId} is recorded as connected but its process ${t.pid} is gone`,
|
|
7021
|
+
remedy: dockerDown ? `run \`crew passengers\` to reopen it (control returns even while Docker is down); also: ${DOCKER_REMEDY}` : "run `crew passengers` to reopen it"
|
|
7022
|
+
}));
|
|
7023
|
+
}
|
|
7024
|
+
function visibleAttention(items, dockerFindingPresent) {
|
|
7025
|
+
return dockerFindingPresent ? items.filter((i) => i.key !== DOCKER_DAEMON_KEY) : items;
|
|
7026
|
+
}
|
|
6981
7027
|
function attentionProblems(items, already) {
|
|
6982
7028
|
const seen = new Set(already.filter((p) => p.kind === "hook_missing").map((p) => `hook_missing:${p.route}/${p.repo}/${p.hook}`));
|
|
7029
|
+
if (already.some((p) => p.kind === "docker_daemon_down")) seen.add(DOCKER_DAEMON_KEY);
|
|
6983
7030
|
return items.filter((i) => !seen.has(i.key)).map((i) => ({ severity: "attention", kind: i.kind, message: i.message }));
|
|
6984
7031
|
}
|
|
6985
7032
|
|
|
@@ -12225,6 +12272,12 @@ function failureLogIsEmpty(failure) {
|
|
|
12225
12272
|
}
|
|
12226
12273
|
async function sandboxBuildTick(repos, deps, force = false) {
|
|
12227
12274
|
const nowMs = (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime();
|
|
12275
|
+
const down = repos.length > 0 ? deps.daemonDown?.() : null;
|
|
12276
|
+
if (down) {
|
|
12277
|
+
deps.raise(down);
|
|
12278
|
+
deps.log("sandbox image: not building, the Docker daemon does not answer");
|
|
12279
|
+
return null;
|
|
12280
|
+
}
|
|
12228
12281
|
for (const r of repos) {
|
|
12229
12282
|
if (r.unreadable) {
|
|
12230
12283
|
deps.log(`sandbox image for ${r.name}: not building, ${r.unreadable}`);
|
|
@@ -26802,7 +26855,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26802
26855
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26803
26856
|
import { join as join58 } from "path";
|
|
26804
26857
|
function builtVersion() {
|
|
26805
|
-
return true ? "0.149.
|
|
26858
|
+
return true ? "0.149.5" : null;
|
|
26806
26859
|
}
|
|
26807
26860
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26808
26861
|
function newestMtime(path) {
|
|
@@ -29196,7 +29249,10 @@ if (command === "passenger-sync-daemon") {
|
|
|
29196
29249
|
}
|
|
29197
29250
|
await runBridge(stateDir, bridgeRoute, bridgeTicket);
|
|
29198
29251
|
} else {
|
|
29199
|
-
let
|
|
29252
|
+
let routineLine = function(line) {
|
|
29253
|
+
if (flag("verbose")) process.stderr.write(`${line}
|
|
29254
|
+
`);
|
|
29255
|
+
}, die = function(command2, message, fix, code = 2) {
|
|
29200
29256
|
emit.error(withFix(`${command2}: ${message}`, fix));
|
|
29201
29257
|
return process.exit(code);
|
|
29202
29258
|
}, requireArmed = function(what) {
|
|
@@ -29390,10 +29446,15 @@ if (command === "passenger-sync-daemon") {
|
|
|
29390
29446
|
void raiseShipAttention({ state, emit: emit2, route: c, ship: cfg.ship }, item);
|
|
29391
29447
|
},
|
|
29392
29448
|
clear: (key) => clearShipAttention(state, key),
|
|
29393
|
-
log: (m) => emit2.emit(m)
|
|
29449
|
+
log: (m) => emit2.emit(m),
|
|
29450
|
+
daemonDown: () => {
|
|
29451
|
+
if (!dockerAvailable()) return dockerDaemonItem();
|
|
29452
|
+
clearShipAttention(state, DOCKER_DAEMON_KEY);
|
|
29453
|
+
return null;
|
|
29454
|
+
}
|
|
29394
29455
|
};
|
|
29395
29456
|
};
|
|
29396
|
-
die2 = die, requireArmed2 = requireArmed, parseTicketNumber2 = parseTicketNumber, routeRelayUrl2 = routeRelayUrl, previewRelayFor2 = previewRelayFor, passengerApiKeys2 = passengerApiKeys, endpointApiFor2 = endpointApiFor, periscopeEndpointDeps2 = periscopeEndpointDeps, periscopeMcpDeps2 = periscopeMcpDeps, endpointReconcileDeps2 = endpointReconcileDeps, releaseRefused2 = releaseRefused, doctorMachineId2 = doctorMachineId, baseHealth2 = baseHealth, sandboxCacheRepos2 = sandboxCacheRepos, buildSandboxCachePass2 = buildSandboxCachePass, sandboxTickDeps2 = sandboxTickDeps;
|
|
29457
|
+
routineLine2 = routineLine, die2 = die, requireArmed2 = requireArmed, parseTicketNumber2 = parseTicketNumber, routeRelayUrl2 = routeRelayUrl, previewRelayFor2 = previewRelayFor, passengerApiKeys2 = passengerApiKeys, endpointApiFor2 = endpointApiFor, periscopeEndpointDeps2 = periscopeEndpointDeps, periscopeMcpDeps2 = periscopeMcpDeps, endpointReconcileDeps2 = endpointReconcileDeps, releaseRefused2 = releaseRefused, doctorMachineId2 = doctorMachineId, baseHealth2 = baseHealth, sandboxCacheRepos2 = sandboxCacheRepos, buildSandboxCachePass2 = buildSandboxCachePass, sandboxTickDeps2 = sandboxTickDeps;
|
|
29397
29458
|
async function failDaemonStart(o) {
|
|
29398
29459
|
const failEmit = new Emitter({
|
|
29399
29460
|
route: "",
|
|
@@ -29589,16 +29650,19 @@ if (command === "passenger-sync-daemon") {
|
|
|
29589
29650
|
const passengerRoutes = cfg.routes.filter((r) => r.enabled && r.hostPassengers);
|
|
29590
29651
|
if (passengerRoutes.length === 0) {
|
|
29591
29652
|
await syncShipTunnels([], /* @__PURE__ */ new Map(), []);
|
|
29653
|
+
if (!await shipNeedsDocker()) clearShipAttention(state, DOCKER_DAEMON_KEY);
|
|
29592
29654
|
return;
|
|
29593
29655
|
}
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
|
|
29599
|
-
)
|
|
29600
|
-
|
|
29601
|
-
|
|
29656
|
+
const gate = await dockerGate({
|
|
29657
|
+
dockerUp: dockerAvailable(),
|
|
29658
|
+
passengerRoutes,
|
|
29659
|
+
pathProblem: () => dockerPathProblem(cfg.ship, COMMON_DOCKER_DIRS),
|
|
29660
|
+
warn: (message) => emit.warn(message, { step: "passengers" }),
|
|
29661
|
+
raise: (item, route3) => raiseShipAttention({ state, emit, route: route3, ship: cfg.ship }, item),
|
|
29662
|
+
clear: (key) => clearShipAttention(state, key),
|
|
29663
|
+
syncTunnels: (plans, targets, routes) => syncShipTunnels(plans, targets, routes)
|
|
29664
|
+
});
|
|
29665
|
+
if (gate === "handled") return;
|
|
29602
29666
|
try {
|
|
29603
29667
|
const refusedRepos = /* @__PURE__ */ new Map();
|
|
29604
29668
|
const checkouts = syncAllPassengerCheckouts(cfg, (repo, e) => refusedRepos.set(repo, e.message));
|
|
@@ -29762,11 +29826,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
29762
29826
|
const targets = reposOf(route2);
|
|
29763
29827
|
const chosen = only ? targets.filter((t) => t.name === only) : targets;
|
|
29764
29828
|
if (only && chosen.length === 0) {
|
|
29765
|
-
|
|
29766
|
-
`crew: no repo named "${only}" on route "${route2.route}" (have: ${targets.map((t) => t.name).join(", ")})
|
|
29767
|
-
`
|
|
29768
|
-
);
|
|
29769
|
-
process.exit(2);
|
|
29829
|
+
die("crew", `no repo named "${only}" on route "${route2.route}" (have: ${targets.map((t) => t.name).join(", ")})`, `\`crew repos\` to list or add one`);
|
|
29770
29830
|
}
|
|
29771
29831
|
const summaries = [];
|
|
29772
29832
|
if (!dryRun) state.releaseHeartbeat().touch();
|
|
@@ -29971,6 +30031,21 @@ ${changed2.map((c) => ` - ${c}
|
|
|
29971
30031
|
for (const t of reposOf(c)) if (!refused.has(t.name)) clearShipAttention(state, repoContractRefusedKey(t.name));
|
|
29972
30032
|
return { settled, errors };
|
|
29973
30033
|
}
|
|
30034
|
+
async function shipNeedsDocker() {
|
|
30035
|
+
const enabled = cfg.routes.filter((r) => r.enabled);
|
|
30036
|
+
if (enabled.some((r) => r.hostPassengers)) return true;
|
|
30037
|
+
if (withShipSandbox(await sandboxReposOf(enabled)).length > 0) return true;
|
|
30038
|
+
for (const c of enabled) {
|
|
30039
|
+
let repos;
|
|
30040
|
+
try {
|
|
30041
|
+
repos = await resolvedRepos(c);
|
|
30042
|
+
} catch {
|
|
30043
|
+
continue;
|
|
30044
|
+
}
|
|
30045
|
+
if (repos.some((r) => Object.values(r.config.hooks).some((h) => typeof h === "string" && hookCommand(h) === "docker"))) return true;
|
|
30046
|
+
}
|
|
30047
|
+
return false;
|
|
30048
|
+
}
|
|
29974
30049
|
async function sandboxReposOf(routes) {
|
|
29975
30050
|
const out = /* @__PURE__ */ new Map();
|
|
29976
30051
|
for (const c of routes) {
|
|
@@ -30748,10 +30823,7 @@ ${f.tail.trimEnd()}
|
|
|
30748
30823
|
if (EXCLUSIVE[command] && !dryRun) {
|
|
30749
30824
|
const got = state.acquire(EXCLUSIVE[command]);
|
|
30750
30825
|
if (!got.ok) {
|
|
30751
|
-
|
|
30752
|
-
`crew: a previous ${command} (pid ${got.heldBy}) is still running \u2014 skipping this cycle
|
|
30753
|
-
`
|
|
30754
|
-
);
|
|
30826
|
+
emit.note(`a previous ${command} (pid ${got.heldBy}) is still running \u2014 skipping this cycle`);
|
|
30755
30827
|
process.exit(0);
|
|
30756
30828
|
}
|
|
30757
30829
|
lock = got;
|
|
@@ -31667,9 +31739,7 @@ ${f.tail.trimEnd()}
|
|
|
31667
31739
|
process.stdout.write(prompt + (role === "pair" ? harnessPromptNote(value("harness")) : ""));
|
|
31668
31740
|
} catch (e) {
|
|
31669
31741
|
if (e instanceof AgentsSyncError) {
|
|
31670
|
-
|
|
31671
|
-
`);
|
|
31672
|
-
process.exit(2);
|
|
31742
|
+
die("crew agents prompt", e.message, "`crew doctor`", 2);
|
|
31673
31743
|
}
|
|
31674
31744
|
throw e;
|
|
31675
31745
|
}
|
|
@@ -31776,9 +31846,7 @@ ${f.tail.trimEnd()}
|
|
|
31776
31846
|
newName = validateShipName(positional[2]);
|
|
31777
31847
|
} catch (e) {
|
|
31778
31848
|
if (e instanceof ShipNameError) {
|
|
31779
|
-
|
|
31780
|
-
`);
|
|
31781
|
-
process.exit(2);
|
|
31849
|
+
die("crew ship", e.message, "`crew doctor`", 2);
|
|
31782
31850
|
}
|
|
31783
31851
|
throw e;
|
|
31784
31852
|
}
|
|
@@ -31850,9 +31918,7 @@ ${f.tail.trimEnd()}
|
|
|
31850
31918
|
});
|
|
31851
31919
|
} catch (e) {
|
|
31852
31920
|
if (e instanceof ReposError) {
|
|
31853
|
-
|
|
31854
|
-
`);
|
|
31855
|
-
process.exit(2);
|
|
31921
|
+
die("crew repos", e.message, "`crew doctor`", 2);
|
|
31856
31922
|
}
|
|
31857
31923
|
throw e;
|
|
31858
31924
|
}
|
|
@@ -31967,9 +32033,7 @@ ${f.tail.trimEnd()}
|
|
|
31967
32033
|
if (agentError) process.exitCode = 1;
|
|
31968
32034
|
} catch (e) {
|
|
31969
32035
|
if (e instanceof ReposError) {
|
|
31970
|
-
|
|
31971
|
-
`);
|
|
31972
|
-
process.exit(2);
|
|
32036
|
+
die("crew repos", e.message, "`crew doctor`", 2);
|
|
31973
32037
|
}
|
|
31974
32038
|
throw e;
|
|
31975
32039
|
}
|
|
@@ -31987,9 +32051,7 @@ ${f.tail.trimEnd()}
|
|
|
31987
32051
|
addName = a.name;
|
|
31988
32052
|
} catch (e) {
|
|
31989
32053
|
if (e instanceof ReposError) {
|
|
31990
|
-
|
|
31991
|
-
`);
|
|
31992
|
-
process.exit(2);
|
|
32054
|
+
die("crew repos", e.message, "`crew doctor`", 2);
|
|
31993
32055
|
}
|
|
31994
32056
|
throw e;
|
|
31995
32057
|
}
|
|
@@ -32001,9 +32063,7 @@ ${f.tail.trimEnd()}
|
|
|
32001
32063
|
addName = a.name;
|
|
32002
32064
|
} catch (e) {
|
|
32003
32065
|
if (e instanceof ReposError) {
|
|
32004
|
-
|
|
32005
|
-
`);
|
|
32006
|
-
process.exit(2);
|
|
32066
|
+
die("crew repos", e.message, "`crew doctor`", 2);
|
|
32007
32067
|
}
|
|
32008
32068
|
throw e;
|
|
32009
32069
|
}
|
|
@@ -32165,9 +32225,7 @@ ${f.tail.trimEnd()}
|
|
|
32165
32225
|
`);
|
|
32166
32226
|
} catch (e) {
|
|
32167
32227
|
if (e instanceof ReposError) {
|
|
32168
|
-
|
|
32169
|
-
`);
|
|
32170
|
-
process.exit(2);
|
|
32228
|
+
die("crew repos", e.message, "`crew doctor`", 2);
|
|
32171
32229
|
}
|
|
32172
32230
|
throw e;
|
|
32173
32231
|
}
|
|
@@ -32252,9 +32310,7 @@ ${reconstruction.prompt}
|
|
|
32252
32310
|
}
|
|
32253
32311
|
} catch (e) {
|
|
32254
32312
|
if (e instanceof LogbookError) {
|
|
32255
|
-
|
|
32256
|
-
`);
|
|
32257
|
-
process.exit(2);
|
|
32313
|
+
die("crew logbook", e.message, "`crew doctor`", 2);
|
|
32258
32314
|
}
|
|
32259
32315
|
throw e;
|
|
32260
32316
|
}
|
|
@@ -32326,8 +32382,7 @@ ${reconstruction.prompt}
|
|
|
32326
32382
|
apiKey = existing.apiKey;
|
|
32327
32383
|
keychainBacked = true;
|
|
32328
32384
|
sessionAddress = found;
|
|
32329
|
-
|
|
32330
|
-
`);
|
|
32385
|
+
routineLine(`Reusing the existing keychain session for ${hostFromUrl4(baseUrl)}/${workspace}.`);
|
|
32331
32386
|
}
|
|
32332
32387
|
} catch {
|
|
32333
32388
|
}
|
|
@@ -32361,8 +32416,7 @@ ${reconstruction.prompt}
|
|
|
32361
32416
|
keychainBacked = true;
|
|
32362
32417
|
sessionAddress = resumed.workspace;
|
|
32363
32418
|
signInSource = "keychain";
|
|
32364
|
-
|
|
32365
|
-
`);
|
|
32419
|
+
routineLine(`Reusing the existing keychain session for ${hostFromUrl4(baseUrl)}/${workspace}.`);
|
|
32366
32420
|
}
|
|
32367
32421
|
}
|
|
32368
32422
|
let mintedFromDevice = false;
|
|
@@ -32763,8 +32817,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
32763
32817
|
mkdirSync43(dirname37(apiKeyFile), { recursive: true });
|
|
32764
32818
|
writeFileSync44(apiKeyFile, `${apiKeyVar}=${apiKey}
|
|
32765
32819
|
`, { mode: 384 });
|
|
32766
|
-
|
|
32767
|
-
`);
|
|
32820
|
+
routineLine(`API key written to ${apiKeyFile}`);
|
|
32768
32821
|
}
|
|
32769
32822
|
}
|
|
32770
32823
|
const keyPersisted = keychainBacked || apiKeyFile !== void 0;
|
|
@@ -32813,14 +32866,12 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
32813
32866
|
const mcpOpts = { bin: tc.bin, url: mcpUrl, key: apiKey, replace, dryRun, stateDir: cfg.ship.stateDir };
|
|
32814
32867
|
const { line, action } = adapter.ensureMcpResult ? adapter.ensureMcpResult(mcpOpts) : { line: adapter.ensureMcp(mcpOpts), action: void 0 };
|
|
32815
32868
|
connectEvents.emit("mcp_registered", line, { harness: tc.harness, bin: tc.bin, url: mcpUrl, ...action ? { action } : {} });
|
|
32816
|
-
|
|
32817
|
-
`);
|
|
32869
|
+
routineLine(line);
|
|
32818
32870
|
}
|
|
32819
32871
|
for (const h of shipPair(cfg.ship).filter((x) => x !== "claude")) {
|
|
32820
32872
|
const line = pairInstallerFor(h).installPair({ url: mcpUrlFor(baseUrl), replace, dryRun });
|
|
32821
32873
|
connectEvents.emit("pair_installed", line, { harness: h });
|
|
32822
|
-
|
|
32823
|
-
`);
|
|
32874
|
+
routineLine(line);
|
|
32824
32875
|
}
|
|
32825
32876
|
}
|
|
32826
32877
|
if (found.holds.length) {
|
|
@@ -32970,8 +33021,8 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
32970
33021
|
if (defaulted) {
|
|
32971
33022
|
await runConnect(defaulted.slug, project);
|
|
32972
33023
|
} else if (workspaces.length === 0) {
|
|
32973
|
-
|
|
32974
|
-
|
|
33024
|
+
connectEvents.emit("problem", "this key's identity has no workspace memberships", { stage: "workspace" });
|
|
33025
|
+
die("crew connect", "this key's identity has no workspace memberships", "mint a key inside a workspace and re-run with `--key K`");
|
|
32975
33026
|
} else if (workspaces.length === 1) {
|
|
32976
33027
|
await runConnect(workspaces[0].slug, project);
|
|
32977
33028
|
} else {
|
|
@@ -32996,18 +33047,13 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
32996
33047
|
if (e instanceof ConnectHttpError) {
|
|
32997
33048
|
connectEvents.emit("problem", e.message, { stage: "http", status: e.status, path: e.path });
|
|
32998
33049
|
if (e.status === 401 || e.status === 403) {
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33002
|
-
|
|
33003
|
-
(or CREW_CONNECT_KEY).
|
|
33004
|
-
`
|
|
33050
|
+
die(
|
|
33051
|
+
"crew connect",
|
|
33052
|
+
`${e.path} \u2014 ${e.status} ${e.status === 401 ? "(bad or expired key)" : "(this key is not a member of that workspace)"}. A key only sees the workspace it was minted in, whatever role it holds there (platform admin included)`,
|
|
33053
|
+
"pass a key minted inside the target workspace: `--key K` (or CREW_CONNECT_KEY)"
|
|
33005
33054
|
);
|
|
33006
|
-
} else {
|
|
33007
|
-
process.stderr.write(`crew connect: ${e.message}
|
|
33008
|
-
`);
|
|
33009
33055
|
}
|
|
33010
|
-
|
|
33056
|
+
die("crew connect", e.message, "`crew doctor`");
|
|
33011
33057
|
}
|
|
33012
33058
|
throw e;
|
|
33013
33059
|
}
|
|
@@ -33066,15 +33112,11 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33066
33112
|
const only = value("route");
|
|
33067
33113
|
const wanted = only ? cfg.routes.filter((r2) => r2.route === only) : cfg.routes;
|
|
33068
33114
|
if (wanted.length !== 1) {
|
|
33069
|
-
|
|
33070
|
-
`);
|
|
33071
|
-
process.exit(2);
|
|
33115
|
+
die("crew sandbox policy", `${only ? `no route "${only}"` : "no route given"} (have: ${cfg.routes.map((r2) => r2.route).join(", ")})`, "`--route ROUTE`");
|
|
33072
33116
|
}
|
|
33073
33117
|
const role = value("role") ?? "dev";
|
|
33074
33118
|
if (!ROLE_NAMES.includes(role)) {
|
|
33075
|
-
|
|
33076
|
-
`);
|
|
33077
|
-
process.exit(2);
|
|
33119
|
+
die("crew sandbox policy", `--role must be one of ${ROLE_NAMES.join(", ")}`, `\`--role ${ROLE_NAMES[0]}\``);
|
|
33078
33120
|
}
|
|
33079
33121
|
const r = wanted[0];
|
|
33080
33122
|
const repoName = value("repo");
|
|
@@ -33085,9 +33127,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33085
33127
|
process.stdout.write(flag("json") ? `${JSON.stringify({ route: r.route, role, input, groups: policy.groups, yaml: policy.yaml }, null, 2)}
|
|
33086
33128
|
` : policy.yaml);
|
|
33087
33129
|
} catch (e) {
|
|
33088
|
-
|
|
33089
|
-
`);
|
|
33090
|
-
process.exit(1);
|
|
33130
|
+
die("crew sandbox policy", e.message, "`crew doctor`", 1);
|
|
33091
33131
|
}
|
|
33092
33132
|
break;
|
|
33093
33133
|
}
|
|
@@ -33293,18 +33333,10 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33293
33333
|
const repos = await resolvedRepos(route2);
|
|
33294
33334
|
const candidates2 = repos.map((r) => ({ repo: r, found: worktreeForNumber(r.dir, n) })).filter((c) => c.found !== null);
|
|
33295
33335
|
if (candidates2.length === 0) {
|
|
33296
|
-
|
|
33297
|
-
`drop: no worktree for ISSUE-${n} in any of this route's repositories (looked in: ${repos.map((r) => r.dir).join(", ")})
|
|
33298
|
-
`
|
|
33299
|
-
);
|
|
33300
|
-
process.exit(2);
|
|
33336
|
+
die("crew drop", `no worktree for ISSUE-${n} in any of this route's repositories (looked in: ${repos.map((r) => r.dir).join(", ")})`, "`git worktree list` in the repository");
|
|
33301
33337
|
}
|
|
33302
33338
|
if (candidates2.length > 1) {
|
|
33303
|
-
|
|
33304
|
-
`drop: ISSUE-${n} has a worktree in more than one repository (${candidates2.map((c) => c.repo.name).join(", ")}) \u2014 remove them one at a time by path
|
|
33305
|
-
`
|
|
33306
|
-
);
|
|
33307
|
-
process.exit(2);
|
|
33339
|
+
die("crew drop", `ISSUE-${n} has a worktree in more than one repository (${candidates2.map((c) => c.repo.name).join(", ")})`, "remove them one at a time by path");
|
|
33308
33340
|
}
|
|
33309
33341
|
const { repo: target, found } = candidates2[0];
|
|
33310
33342
|
const wt = found.path;
|
|
@@ -33312,9 +33344,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33312
33344
|
const trD = new Tracker(route2, cfg.ship);
|
|
33313
33345
|
const tD = (await trD.ticketsByNumbers([n])).find((t) => t.issue_id.replace(/^\D+/, "") === String(num2));
|
|
33314
33346
|
if (tD && tD[trD.contract.columns.status] === trD.contract.statuses.draft) {
|
|
33315
|
-
|
|
33316
|
-
`);
|
|
33317
|
-
process.exit(2);
|
|
33347
|
+
die("crew drop", `${tD.issue_tag ?? tD.issue_id} is a draft ticket \u2014 its worktree belongs to a periscope`, `\`crew periscope down ${num2} --keep\` or \`--discard\``);
|
|
33318
33348
|
}
|
|
33319
33349
|
} catch {
|
|
33320
33350
|
}
|
|
@@ -33349,29 +33379,18 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33349
33379
|
case "rotate-passenger-url": {
|
|
33350
33380
|
emit.enter("passengers");
|
|
33351
33381
|
if (!route2.hostPassengers) {
|
|
33352
|
-
|
|
33353
|
-
`crew rotate-passenger-url: route "${route2.route}" does not have hostPassengers enabled
|
|
33354
|
-
`
|
|
33355
|
-
);
|
|
33356
|
-
process.exit(2);
|
|
33382
|
+
die("crew rotate-passenger-url", `route "${route2.route}" does not have hostPassengers enabled`, `set hostPassengers on the route in ${cfg.configFile}`);
|
|
33357
33383
|
}
|
|
33358
33384
|
if (!cfg.ship.relayHost) {
|
|
33359
|
-
|
|
33360
|
-
process.exit(2);
|
|
33385
|
+
die("crew rotate-passenger-url", "this ship has no relayHost configured \u2014 nothing to rotate", `set ship.relayHost in ${cfg.configFile}`);
|
|
33361
33386
|
}
|
|
33362
33387
|
const workspaceId = route2.resolved?.workspaceId;
|
|
33363
33388
|
if (!workspaceId) {
|
|
33364
|
-
|
|
33365
|
-
`);
|
|
33366
|
-
process.exit(2);
|
|
33389
|
+
die("crew rotate-passenger-url", `route "${route2.route}" has no resolved ids`, "`crew connect`");
|
|
33367
33390
|
}
|
|
33368
33391
|
const plans = planContainers(cfg).filter((p) => p.workspaceId === workspaceId);
|
|
33369
33392
|
if (!plans.length) {
|
|
33370
|
-
|
|
33371
|
-
`crew rotate-passenger-url: no Host Passengers container is planned for "${route2.route}" right now
|
|
33372
|
-
`
|
|
33373
|
-
);
|
|
33374
|
-
process.exit(2);
|
|
33393
|
+
die("crew rotate-passenger-url", `no Host Passengers container is planned for "${route2.route}" right now`, "`crew doctor`");
|
|
33375
33394
|
}
|
|
33376
33395
|
const existing = readPersistedTunnel(cfg.ship.stateDir, workspaceId);
|
|
33377
33396
|
const hasLiveTunnel = existing !== void 0 && isPidAlive(existing.pid);
|
|
@@ -33670,9 +33689,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
33670
33689
|
`);
|
|
33671
33690
|
} catch (e) {
|
|
33672
33691
|
if (e instanceof PeriscopeError || e instanceof ConfigError) {
|
|
33673
|
-
|
|
33674
|
-
`);
|
|
33675
|
-
process.exit(1);
|
|
33692
|
+
die("crew periscope", e.message, "`crew doctor`", 1);
|
|
33676
33693
|
}
|
|
33677
33694
|
throw e;
|
|
33678
33695
|
}
|
|
@@ -33948,9 +33965,7 @@ ${where.join("\n")}`);
|
|
|
33948
33965
|
const open = await tracker3.openTickets();
|
|
33949
33966
|
const ticket = open.find((t) => t[c.columns.key] === key);
|
|
33950
33967
|
if (!ticket) {
|
|
33951
|
-
|
|
33952
|
-
`);
|
|
33953
|
-
process.exit(2);
|
|
33968
|
+
die("crew unassign", `no open ticket ${key} on ${route2.route} (already resolved, or not this route's)`, "`crew inbox` to list open tickets");
|
|
33954
33969
|
}
|
|
33955
33970
|
const label = displayKey(ticket);
|
|
33956
33971
|
if (!ticket[c.columns.assignee]) {
|
|
@@ -33967,9 +33982,7 @@ ${where.join("\n")}`);
|
|
|
33967
33982
|
emit.emit(`cleared assignee on ${label} \u2014 back up for grabs next cycle`);
|
|
33968
33983
|
} catch (e) {
|
|
33969
33984
|
if (e instanceof StaleWriteError9) {
|
|
33970
|
-
|
|
33971
|
-
`);
|
|
33972
|
-
process.exit(2);
|
|
33985
|
+
die("crew unassign", `${label} changed on the board since it was read`, `\`crew unassign ${key}\` again`);
|
|
33973
33986
|
}
|
|
33974
33987
|
throw e;
|
|
33975
33988
|
}
|
|
@@ -34275,11 +34288,12 @@ ${where.join("\n")}`);
|
|
|
34275
34288
|
` : `${human}
|
|
34276
34289
|
`);
|
|
34277
34290
|
const fail2 = (msg) => {
|
|
34278
|
-
if (json2)
|
|
34291
|
+
if (json2) {
|
|
34292
|
+
process.stdout.write(`${JSON.stringify({ event: "error", message: msg })}
|
|
34279
34293
|
`);
|
|
34280
|
-
|
|
34281
|
-
|
|
34282
|
-
return
|
|
34294
|
+
return process.exit(2);
|
|
34295
|
+
}
|
|
34296
|
+
return die("crew sample-ticket", msg, "`crew doctor`", 2);
|
|
34283
34297
|
};
|
|
34284
34298
|
if (!route2.resolved) fail2(`route ${route2.route} is not connected \u2014 run \`crew connect\` first`);
|
|
34285
34299
|
const tracker = new Tracker(route2, cfg.ship);
|
|
@@ -34861,6 +34875,9 @@ watermark: ${state.watermark(routeSlug(route2.route))}
|
|
|
34861
34875
|
} catch {
|
|
34862
34876
|
}
|
|
34863
34877
|
}
|
|
34878
|
+
const dockerDownJson = dockerDaemonFinding({ needed: await shipNeedsDocker(), up: dockerAvailable() });
|
|
34879
|
+
if (dockerDownJson) problems.push(dockerDownJson);
|
|
34880
|
+
problems.push(...deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerDownJson)));
|
|
34864
34881
|
for (const t of rejectedTunnels(cfg.ship.stateDir)) {
|
|
34865
34882
|
problems.push({ severity: "attention", kind: TUNNEL_REJECTED_KEY, message: tunnelRejectedMessage(t.workspaceId, t.quickExits), remedy: "rotate the slug with `crew rotate-passenger-url`" });
|
|
34866
34883
|
}
|
|
@@ -34891,6 +34908,17 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
34891
34908
|
`);
|
|
34892
34909
|
process.exitCode = 1;
|
|
34893
34910
|
}
|
|
34911
|
+
const dockerFinding = dockerDaemonFinding({ needed: await shipNeedsDocker(), up: dockerAvailable() });
|
|
34912
|
+
const dockerNote = dockerFinding ? " (consequence of the Docker finding above)" : "";
|
|
34913
|
+
if (dockerFinding) {
|
|
34914
|
+
process.stdout.write(`docker: BLOCKER ${dockerFinding.message} \u2014 ${dockerFinding.remedy}
|
|
34915
|
+
`);
|
|
34916
|
+
process.exitCode = 1;
|
|
34917
|
+
}
|
|
34918
|
+
for (const f of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
|
|
34919
|
+
process.stdout.write(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
|
|
34920
|
+
`);
|
|
34921
|
+
}
|
|
34894
34922
|
for (const w of roleCapWarnings(cfg.ship)) process.stdout.write(`role concurrency: WARN ${w}
|
|
34895
34923
|
`);
|
|
34896
34924
|
for (const r of cfg.routes) for (const f of routeAvatarFailures(cfg.ship.stateDir, r.route)) process.stdout.write(`persona avatar: WARN ${r.route}: ${f.role} avatar failed to upload (${f.detail}); run \`crew agents sync\` again
|
|
@@ -35358,7 +35386,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
35358
35386
|
}
|
|
35359
35387
|
}
|
|
35360
35388
|
}
|
|
35361
|
-
for (const i of openShipAttention(state)) {
|
|
35389
|
+
for (const i of visibleAttention(openShipAttention(state), Boolean(dockerFinding))) {
|
|
35362
35390
|
process.stdout.write(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
|
|
35363
35391
|
`);
|
|
35364
35392
|
}
|
|
@@ -35401,7 +35429,7 @@ ${foreign.join("\n")}
|
|
|
35401
35429
|
const imageOk = dockerOk && imagePresent(image);
|
|
35402
35430
|
process.stdout.write(
|
|
35403
35431
|
`host passengers: ON for ${passengerRoutes.map((r) => r.route).join(", ")}
|
|
35404
|
-
docker: ${dockerOk ? "OK" :
|
|
35432
|
+
docker: ${dockerOk ? "OK" : `NOT AVAILABLE${dockerNote}`}
|
|
35405
35433
|
ssh-keygen: ${keygenOk ? "OK" : "NOT AVAILABLE"}
|
|
35406
35434
|
image: ${image} (${imageOk ? "present" : "missing"})
|
|
35407
35435
|
relay host: ${cfg.ship.relayHost ? `${cfg.ship.relayHost}:${cfg.ship.relayPort}` : "not set (ship.relayHost) \u2014 containers will run with no tunnel"}
|
|
@@ -35450,7 +35478,7 @@ ${foreign.join("\n")}
|
|
|
35450
35478
|
const stateS = readSandboxState(cfg.ship.stateDir);
|
|
35451
35479
|
for (const r of declaredS) {
|
|
35452
35480
|
const st = sandboxImageStatus(stateS, planSandbox(r.name, r.decl, r.warm, r.bridge));
|
|
35453
|
-
process.stdout.write(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}
|
|
35481
|
+
process.stdout.write(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}${st.status === "ok" ? "" : dockerNote}
|
|
35454
35482
|
`);
|
|
35455
35483
|
}
|
|
35456
35484
|
}
|
|
@@ -35470,7 +35498,8 @@ ${foreign.join("\n")}
|
|
|
35470
35498
|
} catch {
|
|
35471
35499
|
key = void 0;
|
|
35472
35500
|
}
|
|
35473
|
-
|
|
35501
|
+
const relayLine = key ? describeRelayProbe(relayUrl, await probeRelayControl(relayUrl, key, cfg.ship.userAgent)) : "relay control: could not check (no API key for this route)";
|
|
35502
|
+
process.stdout.write(`${relayLine}${/FAILED/.test(relayLine) ? dockerNote : ""}
|
|
35474
35503
|
`);
|
|
35475
35504
|
}
|
|
35476
35505
|
}
|
|
@@ -35501,6 +35530,7 @@ ${foreign.join("\n")}
|
|
|
35501
35530
|
}
|
|
35502
35531
|
lock?.release();
|
|
35503
35532
|
}
|
|
35533
|
+
var routineLine2;
|
|
35504
35534
|
var die2;
|
|
35505
35535
|
var requireArmed2;
|
|
35506
35536
|
var parseTicketNumber2;
|
package/package.json
CHANGED