enable: address PR review — make the picker-path test meaningful · Entire

enable: address PR review — make the picker-path test meaningful

c8b30c8→main·

Soph·1w ago·2 files·+73 added/-49 removed

Route the real interactive multi-select through a package-level promptAgentSelection seam (matching runDispatchWizardForm/runTrailCreateForm) and collapse the selectFn-vs-form branch into a single selection step, so a lone detected agent has no "skip the picker" path to slip back into.

Rewrite the regression test to stub that seam and drive the selectFn == nil path, so it now fails if the single-built-in auto-use shortcut returns — the previous test injected a selectFn and would have passed against the old code.

Also clarify the doc comment that selectFn/--yes bypasses the prompt even on a TTY.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KX0WFAFV72G1YRVSTNJXXV4CView transcript

[?
Auto-select Detected Agents in Enable FlowClaude Code·Opus 4.8[1m]·2 steps](/content/gh/entireio/cli/session/3f9d6f60-de69-46ef-a729-55b8ecb1bc80#timeline-01KX0WFAFV72G1YRVSTNJXXV4C/index.html)

Changes

2

1457 unmodified lines
// promptAgentSelection shows the interactive multi-select agent picker and
// returns the chosen agent names. It is a package-level var so tests can
// substitute it — no real TTY/form is available under `go test`.
var promptAgentSelection = func(options []huh.Option[string]) ([]string, error) {
    var selected []string
    form := NewAccessibleForm(
        huh.NewGroup(
            huh.NewMultiSelect[string]().
                Title("Select the agents you want to use").
                Description("Use space to select, enter to confirm.").
                Options(options...).
                Validate(func(sel []string) error {
                    if len(sel) == 0 {
                        return errors.New("please select at least one agent")
                    }
                    return nil
                }).
                Value(&selected),
            ),
        )
    if err := form.Run(); err != nil {
        return nil, fmt.Errorf("agent selection cancelled: %w", err)
    }
    return selected, nil
}

// detectOrSelectAgent tries to auto-detect agents, or prompts the user to select.
// Returns the detected/selected agents and any error.
func detectOrSelectAgent(ctx context.Context, w io.Writer, selectFn func(available []string) ([]string, error)) ([]agent.Agent, error) {
    // Check for agents with hooks already installed (re-run detection)
    installedAgentNames := GetAgentsWithHooksInstalled(ctx)
    
    var availableNames []string
    // Additional logic and implementation...
}

// TestDetectOrSelectAgent_FirstRun_SingleBuiltIn_PromptsWithDetectedPreSelected tests...
func TestDetectOrSelectAgent_FirstRun_SingleBuiltIn_ShowsPickerPreSelected(t *testing.T) {
    setupTestRepo(t)
    t.Setenv("ENTIRE_TEST_TTY", "1")
    // Test logic...
}