Skip to content

feat(init): interactive agent selection during ox init and integrate#509

Merged
rsnodgrass merged 1 commit intomainfrom
ryan/init-agent-selection
Apr 14, 2026
Merged

feat(init): interactive agent selection during ox init and integrate#509
rsnodgrass merged 1 commit intomainfrom
ryan/init-agent-selection

Conversation

@rsnodgrass
Copy link
Copy Markdown
Contributor

@rsnodgrass rsnodgrass commented Apr 14, 2026

Summary

  • ox init was aggressively installing hooks for ALL discovered adapter binaries (.codex, .factory, .gemini, .opencode) without asking — bad DX
  • Adds a multi-select TUI prompt during ox init letting users choose which AI coworkers to configure
  • Claude Code defaults to selected; all others default to off; only agents detected as installed on the machine are shown
  • ox integrate install (no flags) now shows the same interactive selector, with already-installed agents greyed out
  • ox integrate list dynamically shows status of all discovered adapters instead of hardcoded Claude Code only
  • New --agents flag on ox init for scripted/CI usage (e.g., ox init --agents claude-code,gemini)
  • Non-interactive/CI environments default to Claude Code only
flowchart TD
    A[ox init] --> B{--agents flag?}
    B -->|yes| C[parse flag, skip prompt]
    B -->|no| D{interactive TTY?}
    D -->|no| E[Claude Code only]
    D -->|yes| F[discover adapters]
    F --> G[filter by Detect]
    G --> H[multi-select prompt]
    H --> I[install selected agents]
Loading

Test plan

  • ox init in fresh repo — verify multi-select appears with Claude Code pre-checked
  • Uncheck Claude Code — verify no .claude/ directory created
  • ox init --agents gemini — verify only Gemini + no prompt
  • Piped stdin (echo | ox init) — verify Claude Code only, no prompt
  • ox integrate install — verify interactive selector with installed agents greyed out
  • ox integrate list — verify all discovered adapters shown with status
  • make lint && make test — 13,097 tests pass, 0 lint issues

Co-Authored-By: SageOx ox@sageox.ai

Summary by CodeRabbit

  • New Features
    • Added --agents CLI flag to specify agent adapters to configure during initialization
    • Interactive multi-select interface for choosing which agents to integrate into your project
    • Extended agent support beyond Claude Code to include external adapters and OpenCode
    • Enhanced integration list display with agent categories and installation status
    • New interactive checkbox UI for selecting multiple options with keyboard navigation

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a7679f27-1870-40c4-a56c-69831c679f09

📥 Commits

Reviewing files that changed from the base of the PR and between 73e3637 and 4cce502.

📒 Files selected for processing (3)
  • cmd/ox/init.go
  • cmd/ox/integrate.go
  • internal/cli/prompt.go

📝 Walkthrough

Walkthrough

Multi-agent selection support introduced to initialization and integration commands with a new interactive multi-select UI component. Users can now select which agent adapters to configure during ox init and ox integrate, with agent hook installation and configuration conditional on selections.

Changes

Cohort / File(s) Summary
Interactive Multi-Select UI Component
internal/cli/prompt.go
Added MultiSelectOption struct and SelectMany() function for interactive checkbox UI with keyboard controls (space/x to toggle, enter to confirm, ctrl+c to cancel). Falls back to simple non-TTY mode when stdin is not a terminal.
Agent Selection in Initialization
cmd/ox/init.go
Added --agents CLI flag and selectAgentsForInit() function for interactive or explicit agent selection. Modified runInit() to conditionally integrate Claude Code, external adapters, and OpenCode based on selections. Updated installAgentHooks() signature to accept selectedAgents parameter.
Agent Selection in Integration
cmd/ox/integrate.go
Implemented interactive agent chooser flow for ox integrate command that detects available agents, displays their installation status, and performs multi-select. Added helper functions hasAnyAgentFlag(), integrateAgentInfo struct, and printAgentStatus(). Refactored runIntegrateList() output to categorize agents under "AI Coworker Integrations" section.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as ox init
    participant Selector as selectAgentsForInit
    participant Hooks as installAgentHooks
    participant Config as Config/Hooks
    
    User->>CLI: ox init [--agents flag]
    CLI->>Selector: Detect repo & available agents
    
    alt --agents provided
        Selector->>Selector: Parse agent names
    else Interactive mode
        Selector->>User: Multi-select UI
        User->>Selector: Select agents
    else Non-interactive mode
        Selector->>Selector: Default to claude-code
    end
    
    Selector-->>CLI: Return selectedAgents map
    
    alt claude-code selected
        CLI->>Config: Inject Claude Code config
        CLI->>Config: Install slash commands
    end
    
    CLI->>Hooks: installAgentHooks(selectedAgents)
    Hooks->>Config: Install selected agent hooks
    Config-->>Hooks: Success
    Hooks-->>CLI: Complete
    
    CLI-->>User: Integration summary
Loading
sequenceDiagram
    participant User
    participant CLI as ox integrate
    participant Detector as Agent Detector
    participant UI as SelectMany UI
    participant Installer as Agent Installers
    participant Status as Status Display
    
    User->>CLI: ox integrate (interactive, no flags)
    CLI->>Detector: Detect git root & agents
    Detector->>Detector: Enumerate Claude Code hooks
    Detector->>Detector: Discover external adapters
    Detector->>Detector: Check for OpenCode
    
    Detector->>Detector: Precompute install status
    Detector-->>CLI: Return agent info list
    
    CLI->>UI: SelectMany(agents with status)
    UI->>User: Display multi-select with disabled installed
    User->>UI: Select agents to install
    UI-->>CLI: Return selected agents
    
    loop For each selected agent
        CLI->>Installer: Run agent installer
        Installer->>Status: Update install status
        Status-->>CLI: Success/warning
    end
    
    CLI-->>User: Per-agent status report
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • feat(pi): add Pi coding agent CLI support #414: Addition of a new Pi agent with install/uninstall/hasHooks integrations will interact with the refactored agent selection and installation flows introduced in this PR, particularly the conditional hook installation and agent enumeration logic.

Poem

🐰 A warren of agents awaits your selection,
With checkboxes dancing in interactive perfection,
Claude Code leads the way, or choose by your own,
Multi-select magic makes agents well-known!
From init to integrate, the choice is quite clear—
Pick your AI coworkers and bring them quite near! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ryan/init-agent-selection

Comment @coderabbitai help to get the list of available commands and usage tips.

@rsnodgrass rsnodgrass marked this pull request as ready for review April 14, 2026 00:12
@rsnodgrass rsnodgrass merged commit f1c493f into main Apr 14, 2026
2 of 3 checks passed
@rsnodgrass rsnodgrass deleted the ryan/init-agent-selection branch April 14, 2026 00:13
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