refactor(cli): separate instance creation from session management#54
Merged
refactor(cli): separate instance creation from session management#54
Conversation
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>
Deploying with
|
| 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 |
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>
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
hjk runfrom session management:hjk runnow only creates instances (worktree + container), no longer creating or attaching to sessionshjk agentcommand: Creates agent sessions in existing instances (hjk agent <branch> <agent> [prompt])hjk execcommand: Executes commands or starts shell sessions (hjk exec <branch> [command...])hjk exec --no-muxbypasses tmux for quick one-off commandsBreaking Changes
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/xTest plan
just checkto verify code qualityhjk run feat/test && hjk agent feat/test claudehjk exec feat/testhjk exec feat/test --no-mux pwdhjk agent nonexistent claude🤖 Generated with Claude Code