Skip to content

Add repo-scoped filtering to runbox ps/history #45

Description

@proboscis

Problem

Currently runbox ps and runbox history list ALL runs from global storage (~/.local/share/runbox/runs/), regardless of which repo the user is in.

For users working on multiple projects, this creates noise - runs from unrelated projects are mixed together.

Design Decisions

1. Default behavior: Repo-scoped (BREAKING CHANGE)

# In a git repo (main or worktree):
runbox ps          # filters to current repo (NEW default)
runbox history     # filters to current repo (NEW default)

# Escape hatch for global view:
runbox ps --global
runbox history --global

2. Worktree handling

When in a worktree, resolve to the main repo's origin URL. This groups all experiments across worktrees together.

main-repo/
├── worktree-exp-v1/  → same repo URL
├── worktree-exp-v2/  → same repo URL  
└── worktree-exp-v3/  → same repo URL

# In ANY of these dirs:
runbox ps  → shows runs from ALL worktrees of this repo

3. Outside git repo: Error

$ cd /tmp
$ runbox ps
Error: Not in a git repository. Use --global to see all runs.

$ runbox ps --global
# Works, shows all runs

Implementation Notes

  • Run struct already stores code_state.repo_url
  • Use GitContext::from_current_dir() to get repo URL (works in worktrees too)
  • Add --global flag to ps and history commands
  • Filter: run.code_state.repo_url == current_repo_url
  • URL normalization: extract org/repo portion for comparison (handles SSH vs HTTPS)

Acceptance Criteria

  • runbox ps in git repo filters to current repo by default
  • runbox ps in worktree filters to main repo
  • runbox ps --global shows all runs regardless of location
  • runbox ps outside git repo errors with helpful message
  • runbox history same behavior as ps
  • URL matching handles SSH/HTTPS variants of same repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions