Skip to content

Add dynamic agent selection to configure#14

Merged
codeprakhar25 merged 2 commits into
mainfrom
agentdiff/dynamic-configure-agents
May 5, 2026
Merged

Add dynamic agent selection to configure#14
codeprakhar25 merged 2 commits into
mainfrom
agentdiff/dynamic-configure-agents

Conversation

@codeprakhar25
Copy link
Copy Markdown
Owner

Summary

  • Add interactive agent selection for agentdiff configure, with detected/not-detected labels and Gemini/Antigravity left optional by default.
  • Add non-interactive --all and --agents paths while preserving existing --no-* skip flags.
  • Update README configure examples and behavior notes.

Closes #10

Test plan

  • cargo test
  • cargo run --bin agentdiff -- configure --help
  • cargo run --bin agentdiff -- configure --agents nope fails before writing setup files

Configure now supports interactive agent selection plus explicit --all and --agents paths so users can install only the integrations they want while preserving scripted setup.
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR adds interactive agent selection to agentdiff configure via a dialoguer multi-select picker, plus non-interactive --all and --agents escape hatches, while preserving existing --no-* skip flags. The AgentTarget/AgentSelection abstraction is clean and the refactor to pass &ConfigureArgs directly simplifies the call site significantly. The three P2 findings are all in src/configure/mod.rs: a silent behavior change for --no-mcp when Claude is de-selected, an inconsistency between interactive and non-interactive default selections, and a Copilot false-positive detection heuristic.

Confidence Score: 4/5

Safe to merge with minor caveats; no data loss or security risk, but three P2 issues in configure logic worth addressing.

All findings are P2 (non-blocking). The --no-mcp behavior change is a subtle breaking change for an edge-case workflow, the non-interactive vs interactive default inconsistency may produce noisy CI output, and the Copilot detection false positive is cosmetic. Core attribution logic is untouched.

src/configure/mod.rs — resolve_agent_selection, detect_agents, and the MCP gate logic.

Important Files Changed

Filename Overview
src/configure/mod.rs Core refactor introducing dynamic agent selection; contains a behavior change for --no-mcp, an inconsistency between interactive and non-interactive defaults, and a false-positive Copilot detection heuristic.
src/cli.rs Adds --all and --agents flags to ConfigureArgs; straightforward and correct.
src/main.rs Simplified configure dispatch to pass args struct directly; clean change.
README.md Updated configure examples and behavior notes for interactive/non-interactive modes; accurate.
Cargo.toml Adds dialoguer 0.12.0 with default-features disabled; appropriate minimal dependency.
Cargo.lock Lock file updated to include dialoguer, console, shell-words, encode_unicode, unicode-width; all from crates.io.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[agentdiff configure] --> B{--all AND --agents?}
    B -- yes --> ERR[bail! mutually exclusive]
    B -- no --> C{--all?}
    C -- yes --> SEL_ALL[AgentSelection::all]
    C -- no --> D{--agents list?}
    D -- yes --> PARSE[parse names via AgentTarget::from_name\nbail on unknown agent]
    PARSE --> SEL_EXP[AgentSelection from explicit list]
    D -- no --> E{stdin is_terminal?}
    E -- yes --> PROMPT[prompt_agent_selection\ndetect_agents + MultiSelect picker\ndefault = default_selected AND detected]
    E -- no --> SEL_REC[AgentSelection::recommended\nall except Antigravity]
    SEL_ALL --> FLAGS[apply_skip_flags\nno_claude/cursor/codex/windsurf/opencode/copilot/antigravity]
    SEL_EXP --> FLAGS
    PROMPT --> FLAGS
    SEL_REC --> FLAGS
    FLAGS --> RUN[run configure steps per selection flags]
    RUN --> MCP{selection.claude AND NOT no_mcp?}
    MCP -- yes --> CMCP[step_configure_mcp_claude]
    MCP -- no --> SKIP_MCP[skip MCP]
Loading

Comments Outside Diff (1)

  1. src/configure/mod.rs, line 390-398 (link)

    P2 Copilot detection produces false positives

    detect_agents marks Copilot as "detected" if any VS Code extensions directory exists:

    if [".vscode/extensions", ".vscode-server/extensions", ".vscode-insiders/extensions"]
        .iter()
        .any(|path| home.join(path).exists())
    {
        detected.push(AgentTarget::Copilot);
    }

    Any VS Code user who does not have the GitHub Copilot extension installed will see it labeled (detected, default) in the interactive picker and it will be pre-selected. Checking for the Copilot extension directory (e.g. extensions/github.copilot-*) would make the heuristic accurate.

Reviews (1): Last reviewed commit: "feat: add dynamic agent selection to con..." | Re-trigger Greptile

Comment thread src/configure/mod.rs
Comment on lines +52 to 57
if selection.claude {
claude::step_configure_claude(config)?;
}
if !no_mcp {
if selection.claude && !args.no_mcp {
claude::step_configure_mcp_claude()?;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 --no-claude now silently skips MCP configuration

The old code gated Claude and MCP independently:

// old
if !no_claude { claude::step_configure_claude(config)?; }
if !no_mcp    { claude::step_configure_mcp_claude()?;  }

The new code ties MCP to selection.claude:

if selection.claude && !args.no_mcp {
    claude::step_configure_mcp_claude()?;
}

selection.claude becomes false via the interactive picker (user de-selects Claude), --no-claude, or --agents <list-without-claude>. In all those cases MCP is now silently skipped even if --no-mcp was not supplied. Anyone who previously ran --no-claude expecting MCP to still be registered will now silently get neither. If the intent is to permanently couple them, the change should be documented explicitly.

Comment thread src/configure/mod.rs
Comment on lines +276 to +283
println!(
"{} non-interactive configure: using recommended agents (use --all for Gemini/Antigravity too)",
dim()
);
AgentSelection::recommended()
};

selection.apply_skip_flags(args);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-interactive mode configures all agents regardless of installation

When stdin is not a terminal (CI, scripts), AgentSelection::recommended() enables every agent except Antigravity unconditionally:

fn recommended() -> Self {
    Self { antigravity: false, ..Self::all() }
}

In contrast, the interactive picker only pre-checks agents that are both default_selected and present on disk (detected.contains(agent)). A CI runner that calls agentdiff configure without flags will attempt to configure Cursor, Codex, Windsurf, OpenCode, and Copilot even when none of those tools are installed. The individual configure steps may handle missing dirs gracefully, but the inconsistency between interactive and non-interactive defaults is surprising and may produce noisy output in automated contexts.

Avoid marking Copilot as detected unless a Copilot extension is installed, and document that Claude MCP setup follows the Claude Code selection.
@codeprakhar25 codeprakhar25 merged commit 2ac6236 into main May 5, 2026
2 checks passed
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.

Configure only selected detected agents

1 participant