Agent setup script: keep the installer's advice for people out of an agent's setup log (#255)
* Agent setup script: keep the installer's advice for people out of an agent's setup log
- CI / Typecheck and bundlesuccess
- CI / Unit tests (1/2)success
- CI / Unit tests (2/2)Failed
- End-to-end / End-to-end (agent reviews, tasks, Today)success
- End-to-end / End-to-end (git, PRs, Actions)success
- End-to-end / End-to-end (large pushes)success
- End-to-end / End-to-end (passkeys, registry, email)success
- End-to-end / End-to-end (real histories)success
- End-to-end / End-to-end (runner Docker)success
- End-to-end / End-to-end (security)success
2 files changed+8−1
modifiedapps/cli/install/agent-setup.sh+6−1View file
| @@ -58,7 +58,12 @@ | ||
| 58 | 58 | no_rc=${DIFFINERY_NO_MODIFY_PATH:-} |
| 59 | 59 | if [ -d "$link_dir" ] && [ -w "$link_dir" ]; then no_rc=1; fi |
| 60 | 60 | installer=$(curl -fsSL "$server/install") || fail "couldn't download $server/install: allow $host in the environment's network settings (Custom with $host, or Full)" |
| 61 | - printf '%s\n' "$installer" | DIFFINERY_URL=$server DIFFINERY_INSTALL=$root DIFFINERY_NO_MODIFY_PATH=$no_rc bash || fail "the diffinery CLI didn't install (see above)" | |
| 61 | + # The installer's own next steps (sign in through a browser, PATH) are for people: shown only if it fails. | |
| 62 | + if ! out=$(printf '%s\n' "$installer" | DIFFINERY_URL=$server DIFFINERY_INSTALL=$root DIFFINERY_NO_MODIFY_PATH=$no_rc bash 2>&1); then | |
| 63 | + printf '%s\n' "$out" | |
| 64 | + fail "the diffinery CLI didn't install (see above)" | |
| 65 | + fi | |
| 66 | + say "${green}✓${reset} diffinery CLI: installed $("$root/bin/diffinery" --version 2>/dev/null)" | |
| 62 | 67 | fi |
| 63 | 68 | if [ -d "$link_dir" ] && [ -w "$link_dir" ]; then |
| 64 | 69 | ln -sfn "$root/bin/diffinery" "$link_dir/diffinery" || fail "couldn't link $link_dir/diffinery" |
modifiedapps/diffinery/test/e2e/agent-setup.test.mjs+2−0View file
| @@ -288,6 +288,8 @@ | ||
| 288 | 288 | const first = await runSetup(m, env); |
| 289 | 289 | assert.equal(first.code, 0, first.out); |
| 290 | 290 | assert.ok(!first.out.includes(token), "never prints the token"); |
| 291 | + assert.match(first.out, /✓ diffinery CLI: installed diffinery \d/); | |
| 292 | + assert.ok(!first.out.includes("sign in through your browser"), "no advice meant for people"); | |
| 291 | 293 | for (const s of ["✓ server:", "✓ diffinery on PATH:", "✓ DIFFINERY_TOKEN: acts as zutrix-agent (agent)", "✓ repository: ada/zutrix with write access", "✓ git:", "✓ clone: cloned into", "✓ gh: gh api acts as zutrix-agent", "✓ gh in the clone:", "Ready:"]) assert.ok(first.out.includes(s), `${s}\n${first.out}`); |
| 292 | 294 | const all = { ...m.env, ...env }; |
| 293 | 295 | // The acceptance checks, as the session would run them: no path prefix, no prompt. |