Skip to content

refactor(cli): separate instance creation from session management#54

Merged
jmgilman merged 4 commits intomasterfrom
refactor/cli-separate-run-agent
Jan 5, 2026
Merged

refactor(cli): separate instance creation from session management#54
jmgilman merged 4 commits intomasterfrom
refactor/cli-separate-run-agent

Conversation

@jmgilman
Copy link
Collaborator

@jmgilman jmgilman commented Jan 5, 2026

Summary

  • Separate hjk run from session management: hjk run now only creates instances (worktree + container), no longer creating or attaching to sessions
  • New hjk agent command: Creates agent sessions in existing instances (hjk agent <branch> <agent> [prompt])
  • New hjk exec command: Executes commands or starts shell sessions (hjk exec <branch> [command...])
  • Direct execution mode: hjk exec --no-mux bypasses tmux for quick one-off commands
  • Auto-restart: Commands targeting stopped instances automatically restart them

Breaking Changes

Old Workflow New Workflow
hjk run feat/x --agent claude "prompt" hjk run feat/x && hjk agent feat/x claude "prompt"
hjk run feat/x (shell session) hjk run feat/x && hjk exec feat/x

Test plan

  • Run just check to verify code quality
  • Test new workflow: hjk run feat/test && hjk agent feat/test claude
  • Test exec command: hjk exec feat/test
  • Test no-mux mode: hjk exec feat/test --no-mux pwd
  • Verify error message when no instance exists: hjk agent nonexistent claude
  • Review updated documentation in docs/

🤖 Generated with Claude Code

Current behavior:
`hjk run` created both an instance and a session in one command,
using --agent flag for agents or defaulting to shell. This made
the CLI less explicit and harder to understand.

New behavior:
- `hjk run <branch>` only creates instances (worktree + container)
- `hjk agent <branch> <agent> [prompt]` creates agent sessions
- `hjk exec <branch> [command...]` creates shell sessions or runs commands
- `hjk exec --no-mux` allows direct command execution without tmux
- Commands auto-restart stopped instances when targeting them

Breaking Changes:
- `hjk run` no longer accepts --agent, --name, or --detached flags
- `hjk run` no longer creates or attaches to sessions
- Old workflow `hjk run feat/x --agent claude` becomes
  `hjk run feat/x && hjk agent feat/x claude`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 5, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
headjack a379c66 Commit Preview URL

Branch Preview URL
Jan 05 2026, 04:00 AM

jmgilman and others added 3 commits January 4, 2026 19:04
Current behavior:
`hjk exec --no-mux <cmd>` always passed Interactive: true to Docker,
which adds -it flags. In CI without a TTY, Docker fails with
"the input device is not a TTY".

New behavior:
Only use interactive mode when starting a shell (no command specified).
Running a specific command like `hjk exec branch --no-mux echo hello`
doesn't need TTY allocation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Current behavior:
Non-interactive container exec captured output but didn't forward
it to the terminal, causing commands like `hjk exec --no-mux echo hello`
to produce no visible output.

New behavior:
Connect stdout/stderr directly to os.Stdout/os.Stderr in non-interactive
mode, so command output is visible.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Current behavior:
`hjk agent <branch> <agent_name> [prompt]` required agent_name and
accepted prompt as an optional positional argument.

New behavior:
`hjk agent <branch> [agent_name] [--prompt "..."]`
- agent_name is optional; uses default.agent from config if not specified
- prompt is now a --prompt/-p flag instead of positional argument
- Error with helpful hint if no default is configured and none specified

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jmgilman jmgilman merged commit 08d0d55 into master Jan 5, 2026
4 checks passed
@jmgilman jmgilman deleted the refactor/cli-separate-run-agent branch January 5, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant