@catalyst-cloud/cli 0.16.2 → 0.16.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.3
4
+
5
+ Setup checks your local Docker engine's capabilities on macOS and explains mount or network problems.
6
+
3
7
  ## 0.16.2
4
8
 
5
9
  Setup keeps verified earlier Catalyst skill copies and reports where it moved them.
@@ -122,7 +122,12 @@ const REASONS = {
122
122
  runner_session_network_misshaped: "A Docker network named catalyst-session-v1 exists with the wrong settings. Remove it with docker network rm catalyst-session-v1 when nothing uses it, then run catalyst onboard again.",
123
123
  runner_session_network_failed: "Docker could not create the catalyst-session-v1 network. Check that Docker is running, then run catalyst onboard again.",
124
124
  runner_docker_socket_unreadable: "Setup could not read the group of the Docker socket at /var/run/docker.sock. Check that Docker is running, then run catalyst onboard again.",
125
- runner_engine_unsupported: "Runner setup needs local Docker Desktop or OrbStack on Mac, or native Linux Docker at /var/run/docker.sock. Select a supported local engine, then run catalyst onboard --runner.",
125
+ runner_engine_unsupported: "Runner setup needs a local Linux Docker engine with Compose on Mac, or native Linux Docker at /var/run/docker.sock. Select a local engine, then run catalyst onboard --runner.",
126
+ runner_engine_nonlocal: "The selected Docker endpoint is not a verified local unix:/// socket, or DOCKER_CONTEXT conflicts with DOCKER_HOST. Select a local Docker context and clear the conflicting variable, then run catalyst onboard --runner.",
127
+ runner_home_mount_unwritable: "A container could not read and write the runner home mounts as uid 10001. Share Catalyst's state directory with your Docker VM and enable writable mounts. For Colima, configure a writable home mount with ownership mapping for uid 10001, then restart the VM and run catalyst onboard --runner.",
128
+ runner_container_host_unreachable: "A container could not reach this Mac. Enable container-to-host networking in your Docker VM and allow the setup process through the Mac firewall, then run catalyst onboard --runner.",
129
+ runner_container_network_unreachable: "A container could not reach Catalyst's health endpoint. Check the Docker VM's DNS, proxy and outbound HTTPS access, then run catalyst onboard --runner.",
130
+ runner_engine_probe_unavailable: "Setup could not complete the container capability probe. Check Docker access and the pinned supervisor image, then run catalyst onboard --runner. Setup has not enrolled or started this machine.",
126
131
  runner_installation_unverified: "Setup found a possible existing machine installation but could not verify its Compose files and identity. Keep its files and credentials. Run docker compose -p catalyst-host logs supervisor to check it, then run catalyst setup --runner again.",
127
132
  runner_enrollment_unavailable: "Setup could not read this workspace's runner hosts. Run catalyst onboard again to retry.",
128
133
  runner_enrolled_for_other_team: "This runner is enrolled for another Linear team. Keep using that team, or ask your administrator to revoke the old enrollment before setting up this machine for the selected team.",
@@ -0,0 +1,114 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { createServer } from "node:http";
4
+ import { networkInterfaces } from "node:os";
5
+ import { join } from "node:path";
6
+ /** Runs as the supervisor's uid. A matching engine-side path is insufficient: both sides must
7
+ * read the fresh challenge, including a container write returned through the host mount. */
8
+ export function runnerMountProbe(paths, challenge) {
9
+ return `const fs=require("node:fs");
10
+ try { for (const path of ${JSON.stringify(paths)}) {
11
+ if (fs.readFileSync(path+"/challenge","utf8")!==${JSON.stringify(challenge)}) process.exit(41);
12
+ fs.writeFileSync(path+"/pending",${JSON.stringify(challenge)},{mode:0o600,flag:"wx"});
13
+ fs.renameSync(path+"/pending",path+"/received");
14
+ } console.log(${JSON.stringify(challenge)}); } catch { process.exit(41); }`;
15
+ }
16
+ /** Contains no credentials. Host reach requires our exact fresh challenge response; public
17
+ * reach checks the configured Catalyst endpoint. Each request and the program have deadlines. */
18
+ export function runnerNetworkProbe(hostUrls, networkUrl, challenge) {
19
+ return `(async()=>{
20
+ const deadline=setTimeout(()=>process.exit(44),20000);
21
+ try {
22
+ const hostStop=new AbortController();
23
+ try { await Promise.any(${JSON.stringify(hostUrls)}.map(async url=>{
24
+ const response=await fetch(url,{redirect:"error",
25
+ signal:AbortSignal.any([hostStop.signal,AbortSignal.timeout(12000)])});
26
+ if(!response.ok || await response.text()!==${JSON.stringify(challenge)}) throw Error("host");
27
+ })); } catch { process.exit(42); }
28
+ finally { hostStop.abort(); }
29
+ try { const response=await fetch(${JSON.stringify(networkUrl)},
30
+ {redirect:"error",signal:AbortSignal.timeout(5000)});
31
+ if(!response.ok) process.exit(43);
32
+ await response.body?.cancel();
33
+ } catch { process.exit(43); }
34
+ console.log(${JSON.stringify(challenge)});
35
+ } finally { clearTimeout(deadline); }
36
+ })().catch(()=>process.exit(44));`;
37
+ }
38
+ export async function runnerVmCapabilities(input) {
39
+ const challenge = randomUUID();
40
+ const scratch = [];
41
+ const options = { env: input.env, signal: input.signal, timeoutMs: 35_000 };
42
+ async function run(program, mounts = []) {
43
+ const name = `catalyst-engine-probe-${randomUUID()}`;
44
+ try {
45
+ return await input.exec(["run", "--rm", "--name", name, "--pull=never", "--read-only",
46
+ "--cap-drop=ALL", "--security-opt=no-new-privileges:true", "--user", "10001:10001",
47
+ "--tmpfs", "/tmp:size=16m,mode=1777", ...mounts.flatMap(path => ["--mount", `type=bind,src=${path},dst=${path}`]),
48
+ "--entrypoint", "bun", input.image, "-e", program], options);
49
+ }
50
+ finally {
51
+ // Killing a docker client does not stop its container. Clean up only our fresh exact name,
52
+ // even on abort, with an independent short deadline. Never touch any existing container.
53
+ const removed = await input.exec(["rm", "--force", name], { env: input.env, timeoutMs: 10_000 });
54
+ if (removed.code !== 0 && ![
55
+ `Error response from daemon: No such container: ${name}`, `Error: No such container: ${name}`,
56
+ ].includes(removed.stderr?.trim() ?? ""))
57
+ throw Error("probe_cleanup_unverified");
58
+ }
59
+ }
60
+ try {
61
+ if (input.paths.length === 0 || input.signal?.aborted)
62
+ return "runner_engine_probe_unavailable";
63
+ try {
64
+ for (const path of input.paths) {
65
+ const dir = mkdtempSync(join(path, ".catalyst-engine-probe-"));
66
+ scratch.push(dir);
67
+ writeFileSync(join(dir, "challenge"), challenge, { mode: 0o600, flag: "wx" });
68
+ }
69
+ const mounted = await run(runnerMountProbe(scratch, challenge), scratch);
70
+ if (mounted.code !== 0 || mounted.stdout.trim() !== challenge ||
71
+ scratch.some(path => readFileSync(join(path, "received"), "utf8") !== challenge))
72
+ return "runner_home_mount_unwritable";
73
+ }
74
+ catch {
75
+ return "runner_home_mount_unwritable";
76
+ }
77
+ const server = createServer((request, response) => {
78
+ const matches = request.method === "GET" && request.url === `/${challenge}`;
79
+ response.writeHead(matches ? 200 : 404, { "content-type": "text/plain", "connection": "close" });
80
+ response.end(matches ? challenge : "");
81
+ });
82
+ try {
83
+ await new Promise((resolve, reject) => {
84
+ server.once("error", reject);
85
+ server.listen(0, "0.0.0.0", resolve);
86
+ });
87
+ const address = server.address();
88
+ if (!address || typeof address === "string")
89
+ return "runner_engine_probe_unavailable";
90
+ const hosts = input.hostAddresses ?? ["host.docker.internal", ...Object.values(networkInterfaces())
91
+ .flatMap(rows => rows ?? []).filter(row => row.family === "IPv4" && !row.internal)
92
+ .map(row => row.address)];
93
+ const urls = [...new Set(hosts)].slice(0, 16)
94
+ .map(host => `http://${host}:${address.port}/${challenge}`);
95
+ const result = await run(runnerNetworkProbe(urls, new URL("/healthz", input.baseUrl).href, challenge));
96
+ if (result.code === 42)
97
+ return "runner_container_host_unreachable";
98
+ if (result.code === 43)
99
+ return "runner_container_network_unreachable";
100
+ return result.code === 0 && result.stdout.trim() === challenge ? "ready" : "runner_engine_probe_unavailable";
101
+ }
102
+ finally {
103
+ server.closeAllConnections();
104
+ await new Promise(resolve => server.close(() => resolve()));
105
+ }
106
+ }
107
+ catch {
108
+ return "runner_engine_probe_unavailable";
109
+ }
110
+ finally {
111
+ for (const path of scratch)
112
+ rmSync(path, { recursive: true, force: true });
113
+ }
114
+ }
@@ -7,6 +7,7 @@ import { nativeEgressReady, NATIVE_EGRESS_DIR } from "./onboard-runner-egress.js
7
7
  import { runnerAdmission, issueRunnerOrgKey, verifyRunnerRoutes } from "./onboard-runner-cloud.js";
8
8
  import { verifyOnboardRoutes } from "./onboard-capabilities.js";
9
9
  import { liveTeamKey, onboardTeamAdmission } from "./onboard-capacity.js";
10
+ import { runnerVmCapabilities } from "./onboard-runner-probes.js";
10
11
  import { readExistingOnboardJson, readOnboardTeamInventory, selectedOnboardTeam, } from "./onboard-existing.js";
11
12
  import { onboardStateRoot, } from "./onboard.js";
12
13
  // "Run Catalyst's work on this machine": the self-hosted host from catalyst-cloud's deploy/self-host
@@ -125,12 +126,15 @@ export function dockerRunnerEngine(deps = {}) {
125
126
  return null;
126
127
  if ((await docker(["compose", "version"], { signal })).code !== 0)
127
128
  return null;
128
- const vm = /docker desktop|orbstack/i.test(String(body.OperatingSystem));
129
129
  const host = await endpoint(signal);
130
130
  const platform = deps.platform ?? process.platform;
131
+ const vm = platform === "darwin" || /docker desktop|orbstack/i.test(String(body.OperatingSystem));
132
+ const localSocket = host?.startsWith("unix:///") === true;
131
133
  nativeLocal = platform === "linux" && !vm && host === "unix:///var/run/docker.sock";
132
- const supportedVm = platform === "darwin" && vm && host?.startsWith("unix:///");
133
- return { arch, vm, ...(!nativeLocal && !supportedVm ? { unsupported: true } : {}) };
134
+ const supportedVm = platform === "darwin" && localSocket;
135
+ return { arch, vm, ...(!nativeLocal && !supportedVm ? {
136
+ unsupported: true, ...(!localSocket ? { unsupportedReason: "runner_engine_nonlocal" } : {}),
137
+ } : {}) };
134
138
  },
135
139
  async installation(home, supervisorImage, signal) {
136
140
  const listed = await docker(["ps", "--all", "--filter", `label=com.docker.compose.project=${RUNNER_PROJECT}`,
@@ -247,6 +251,10 @@ export function dockerRunnerEngine(deps = {}) {
247
251
  async nativeEgressStatus(nowMs, signal) {
248
252
  return nativeLocal && (await nativeEgressReady(nowMs, signal));
249
253
  },
254
+ async vmCapabilities(dir, image, baseUrl, signal) {
255
+ return runnerVmCapabilities({ paths: DIRS.map(sub => join(dir, sub)), image, baseUrl,
256
+ exec: docker, env, signal });
257
+ },
250
258
  async socketGid() {
251
259
  if (!nativeLocal)
252
260
  return null;
@@ -495,7 +503,7 @@ export function onboardRunnerAdapter(input = {}) {
495
503
  if (!info)
496
504
  return { state: "skipped", reason: "runner_docker_missing", evidence: selected };
497
505
  if (info.unsupported)
498
- return waiting("runner_engine_unsupported", selected);
506
+ return waiting(info.unsupportedReason ?? "runner_engine_unsupported", selected);
499
507
  const cfg = loadConfig(ctx.home);
500
508
  const account = journal.account ?? journal.tenant;
501
509
  if (!cfg?.user ||
@@ -816,6 +824,11 @@ export function onboardRunnerAdapter(input = {}) {
816
824
  if (arch !== p.info.arch)
817
825
  return waiting("runner_image_emulated", { ...selected, image: ref });
818
826
  }
827
+ if (p.info.vm) {
828
+ const capability = await engine.vmCapabilities(p.dir, p.images.supervisor, p.baseUrl, signal);
829
+ if (capability !== "ready")
830
+ return waiting(capability, selected);
831
+ }
819
832
  const network = await engine.network(RUNNER_SESSION_NETWORK, signal);
820
833
  if (network === "misshaped")
821
834
  return waiting("runner_session_network_misshaped", selected);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catalyst-cloud/cli",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "Set up Catalyst Cloud, check your tickets and manage your account from the command line.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,7 +4,7 @@ description: >-
4
4
  Catalyst's GitHub: show a ticket's pull request with its checks, reviews and review threads, say whether it is mergeable under this repository's policy, and explain what a PR accumulates as the ticket moves (the branch, the draft, the rewrite, the force-pushes, the labels, the queue). Use when someone asks "show me the PR", "what are the checks saying", "why hasn't it merged", "what does the queue need", "what does that label mean", or wants the branch and merge conventions Catalyst follows.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # Catalyst's GitHub
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  Catalyst's view of Linear on the customer's own cloud account. Reads a ticket with its comments, relations, labels, linked pull requests and agent sessions inline, from the cloud API by default, with local replica reads available as an explicit opt-in, always naming the source; searches tickets, PRs, projects and initiatives; writes comments, card moves, labels and new tickets through the account's agent proxy as the app actor, with every route, stage id, label id and marker read from the account's contract. Knows what a ticket accumulates as Catalyst works it (phase-outcome comments, the document per phase, the agent session, the labels, the single blocks relation, the bookkeeping marker, the eyes acknowledgement). Use when a person says "show me the ticket", "what did Catalyst write on it", "comment on it", "move it", "label it" or "file a ticket". Not for raising a decision for a human (what-needs-me) and not for pull requests (catalyst-github).
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # Catalyst Linear
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  Set up Catalyst Cloud and say whether setup is working. Walks a person from nothing to their first ticket running, one step at a time: the coding account, the project, the integrations and connected accounts, each repository's settings file, then one real ticket moving. Also logs this machine in, reads the readiness verdict with who can fix each failure, and checks the optional local replica. Use when someone says "set me up", "onboard me", "I just signed up", "get me started", "what do I do first", "log me in", "which account is this machine on", "am I set up", "what is missing", "why does nothing happen" or "is the replica running", when a login expired, or when a skill script exits 2 saying this machine is not connected. Does every step a key can do through the catalyst CLI, hands over the exact page for the steps only a browser can do, and never claims a step it did not watch succeed.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # Onboard me
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  Own one Catalyst Cloud project end to end until it closes. Use when the person says "run this project for me", "own this until it ships", "keep this moving", or hands you a project id or a set of tickets to drive. Subscribes to the account's event stream for the scope through the catalyst CLI, reacts to each change in the same turn, makes tickets ready and moves them to dispatch, parks what should stop, chases stalls, escalates inward, and keeps one status summary current. Writes to Linear as the app actor; never polls.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # Run this project
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  Get a stuck Catalyst Cloud ticket moving again. Use when the person asks "why is this parked and can you release it?", "unpark this", "get things flowing again", "the outage is over, retry what failed", or hands you a ticket that is not moving. Reads why nothing runs and what holds the ticket through the catalyst CLI, decides whether the recorded cause is fixed, previews the release, releases every governor holding the ticket the right way (or one failure class across a team), and raises an ask only for what a person has to do. Never releases a cause it cannot show changed without saying so.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # Unstick
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  The human's decision inbox on Catalyst Cloud, and the one way an agent raises a decision on their behalf. Use when the person asks "what needs me?", "what am I blocking?", or when active work is gated on a choice only they can make. Lists open asks ranked by how much open work each one holds, files an ask through the cloud's ask route with the account's own template, and records the answer so the held work releases. Never answers as the human, never duplicates an open ask.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # What needs me
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  What environment variable names does this repository need, and where does each one come from? Scans the repository offline (no login, no network) and lists the names in three groups (build/test, deploy-only, bindings), each with where it was found, what uses it, and where a local value would come from. Never reads a value or prints one. Also checks the environment variable table in `.catalyst/catalyst.toml` offline. Use when someone asks "what does catalyst.env.json mean", "what env vars does this repo need", "why does the container need this", or before reviewing or writing the declaration.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # What this repository needs
10
10
 
@@ -4,7 +4,7 @@ description: >-
4
4
  Use for "what's happening?", "what machines do we have?", "how much capacity do we have?", "where are we?", "why is that stuck?", "what closed?", "what's next?", "how does this work?", "why did it do that?", "how does it prioritise?" and "what does this setting do, where is it set?" in Catalyst Cloud, or asks for something to be done rather than known. Reads the contract via catalyst CLI. Read-only: route work/decisions, never answer as the human.
5
5
  allowed-tools: Bash(catalyst:*) Bash(npx -p @catalyst-cloud/cli catalyst:*)
6
6
  ---
7
- <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.2 — written in this repository for customer accounts -->
7
+ <!-- vendored-from: @catalyst-cloud/catalyst-skills@0.16.3 — written in this repository for customer accounts -->
8
8
 
9
9
  # What's happening
10
10