feat: add spawn command — one-command SpawnDock container bootstrap#3
Merged
skulidropek merged 4 commits intomainfrom Mar 24, 2026
Merged
feat: add spawn command — one-command SpawnDock container bootstrap#3skulidropek merged 4 commits intomainfrom
skulidropek merged 4 commits intomainfrom
Conversation
Adds `docker-git spawn --token <pairing-token>` which: 1. Creates a fresh Docker dev container (SpawnDock/tma-project) 2. Waits for SSH readiness (30 retries × 2s) 3. Runs `npx -y @spawn-dock/create@beta --token <token>` inside the container 4. Parses project dir from output 5. Opens tmux with SSH pane pre-loaded: `cd '<dir>' && spawn-dock agent` New files: - packages/app/src/docker-git/cli/parser-spawn.ts - packages/app/src/docker-git/spawn.ts Modified: - domain.ts: SpawnCommand interface + Command union - shell/errors.ts: SpawnProjectDirError, SpawnSetupError - usecases/errors.ts: AppError union + renderError handlers - parser.ts: spawn verb registered - tmux.ts: spawnAttachTmux exported - program.ts: Spawn dispatch wired + catchTags - usage.ts: spawn command documented Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- parser-spawn.ts: replace `as const` with typed intermediate vars (ParseError, SpawnCommand) + add functional comment block per AGENTS.md convention - spawn.ts: type buildSpawnCreateCommand return as CreateCommand (removes _tag cast); fix useless-undefined via ip ?? "" + length check; inline import for dprint - tmux.ts: flip negated condition sshKey !== null → sshKey === null All three violations caught by eslint-effect-ts-check (no-restricted-syntax: TSAsExpression) and standard eslint (unicorn/no-negated-condition, dprint). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tmux.ts: - Extract private openTmuxWorkspace(template, leftPaneCommand) helper that contains session detection + create + configure + setup + attach logic - attachTmux: delegate to openTmuxWorkspace (removes duplicated session setup) - spawnAttachTmux: delegate to openTmuxWorkspace (removes duplicated session detection, bind-keys, select-pane blocks — DUPLICATE #1 and #2) spawn.ts: - Merge buildSshProbeArgs + buildSshRunArgs into single buildSshArgs(template, sshKey, ipAddress, remoteCommand?) — probe mode when remoteCommand=undefined (removes structural duplication — DUPLICATE #3) - Fix unicorn/no-negated-condition: flip if(remoteCommand!==undefined) guard - Fix unicorn/prefer-single-call: inline trailing push into preceding spread Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
domain.ts was 5 lines over the 300 non-blank-line ESLint limit after adding SpawnCommand. Extracted the interface to spawn-domain.ts (mirrors session-gist-domain pattern), re-exported via session-gist-domain so the import can be merged with the existing line-1 import. Updated app consumers to import SpawnCommand from @effect-template/lib/core/spawn-domain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docker-git spawn --token <pairing-token>command that orchestrates the full SpawnDock workflow in one stepSpawnDock/tma-project, runs@spawn-dock/create@betainside via SSH, then opens a tmux workspace withspawn-dock agentSpawnCommandtype to domain,SpawnProjectDirError/SpawnSetupErrorerror types, and full error renderingChanges
packages/lib/src/core/domain.tsSpawnCommandinterface +Commandunionpackages/lib/src/shell/errors.tsSpawnProjectDirError,SpawnSetupErrorpackages/lib/src/usecases/errors.tsAppErrorunion +renderErrorhandlerspackages/app/src/docker-git/cli/parser-spawn.ts--tokenintoSpawnCommandpackages/app/src/docker-git/cli/parser.tsspawnverbpackages/app/src/docker-git/spawn.tspackages/app/src/docker-git/tmux.tsspawnAttachTmux— opens tmux with agent pre-loadedpackages/app/src/docker-git/program.tsSpawndispatch +catchTaghandlerspackages/app/src/docker-git/cli/usage.tsspawncommand documentedTest plan
docker-git --helpshowsspawncommand in usage textdocker-git spawn(no token) printsMissing required option: --tokendocker-git spawn --token pair_xxxstarts container, runs@spawn-dock/create, opens tmuxpnpm -w typecheckpasses (verified ✅)pnpm buildsucceeds (verified ✅)🤖 Generated with Claude Code