Skip to content

feat: add direct command execution without templates#30

Open
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-027/run-20251231-115307
Open

feat: add direct command execution without templates#30
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-027/run-20251231-115307

Conversation

@proboscis
Copy link
Owner

Summary

Add the ability to run and log commands directly without requiring a template, making runbox more convenient for ad-hoc command execution.

New Commands

  • runbox run -- <command> - Execute a command directly and log it as a Run
  • runbox log -- <command> - Alias for runbox run --

Features

  • Direct command execution: Run any command without creating a template first
  • Git context capture: Automatically captures commit + uncommitted changes for reproducibility
  • Options supported:
    • --runtime <bg|tmux> - Execution runtime (default: bg)
    • --timeout <seconds> - Command timeout (default: 0 = no timeout)
    • --env KEY=VALUE - Additional environment variables
    • --cwd <path> - Working directory (default: current)
    • --no-git - Skip git context capture
  • Source field: Runs are marked with "source": "direct" to distinguish from template-based runs
  • Full compatibility: Works with runbox ps, runbox show, runbox logs, runbox replay

Example Usage

# Simple command
runbox run -- echo hello

# With runtime option
runbox run --runtime tmux -- python train.py --epochs 10

# Using the log alias
runbox log -- make test

# With environment variables
runbox run --env CUDA_VISIBLE_DEVICES=0 -- python train.py

# Skip git context capture
runbox run --no-git -- echo "quick test"

Test plan

  • All existing tests pass
  • New integration tests for direct execution (20 tests)
  • Tests cover: simple commands, timeout, env vars, cwd, no-git, runtimes, log alias, error cases

Related Issue

ISSUE-027

🤖 Generated with Claude Code

Add the ability to run and log commands directly without requiring a template,
making runbox more convenient for ad-hoc command execution.

Changes:
- Add `runbox run -- <command>` syntax for direct execution
- Add `runbox log -- <command>` as an alias for direct runs
- Add `source` field to Run struct to distinguish direct vs template runs
- Support options: --timeout, --env, --cwd, --no-git, --runtime
- Capture git context (commit + uncommitted changes) for reproducibility
- Create Run records with source: "direct" field
- Add comprehensive integration tests for direct execution

The `--` separator distinguishes direct commands from template-based runs.
Example usage:
  runbox run -- echo hello
  runbox run --runtime tmux -- python train.py --epochs 10
  runbox log -- make test

ISSUE-027

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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