feat(setup): `--project <id>` — one-line agent setup that also links the directory

Merged
TO
2mo ago
+126-1

Why

The console's Connect-your-agent panel currently renders three copy rows (install, project link, services add) because no single pasteable line survives every shell: && errors in PowerShell 5.1, ; breaks cmd.exe, and shells without bracketed paste feed the queued next line into setup agent's log in now with GitHub? (Y/n) prompt (see console PR InsForge/insta-frontend#290). Tony wants the panel back to one line.

What

insta setup agent --project <id> moves the chaining inside the CLI process, where it's shell-safe:

  1. existing setup (CLI install, skills, MCP) — unchanged
  2. existing interactive login offer — unchanged
  3. new: with a session, runs the same code path as insta project link <id> (writes ./.insta/project.json, installs per-project stack skills + observe hook)

Edge behavior:

  • no session (declined login, -y, non-TTY): link is skipped with the manual hint (insta login, then insta project link <id>) — exit 0, matching the declined-login best-effort philosophy
  • link failure (bad id, no access): prints the retry command and sets exit 1 — the link is the entire point of the flag

CLI reference mirror (cross-repo)

skills/insta/cli-reference.md is the insta-skills submodule — the mirror cannot land in this repo's diff. It is up as InsForge/insta-skills#57, same change set.

Tests

4 new cases in test/setup-agent.test.ts (login→link ordering, already-logged-in, no-session hint, failure exit code). npm run typecheck clean; suite 497 passed + the 5 that also fail on pristine main on this machine (local staging config resolves #devel skill specs — unrelated).

Companion PRs

🤖 Generated with Claude Code

https://claude.ai/code/session_012CoVYZxJmGpNBUCWSnxwhK