Skip to content

refactor: simplify InstallCommand by consolidating CodeEnvironment handling and removing legacy agents #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

pushpak1300
Copy link
Member

@pushpak1300 pushpak1300 commented Aug 12, 2025

Clean up Agent/IDE Management in InstallCommand

This MR refactors the InstallCommand to improve clarity and maintainability around agent and IDE management.

Key Changes

Contract Updates:

  • Replaced Ide interface with McpClient interface for better naming clarity
  • Enhanced Agent contract with agentName() method and improved documentation
  • Removed legacy agent classes (ClaudeCode, Copilot, Cursor) from /Install/Agents/

InstallCommand Improvements:

  • Renamed methods for better clarity:
    • enact()performInstallation()
    • enactGuidelines()installGuidelines()
    • enactMcpServers()installMcpServerConfig()
  • Consolidated agent/IDE selection into unified selectCodeEnvironments() method
  • Removed reflection-based discovery in favor of CodeEnvironment approach
  • Simplified property naming: selectedTargetIdesselectedTargetMcpClient

Code Cleanup:

  • Removed unused projectInstalledAgents property and related discovery logic
  • Removed ReflectionClass import and reflection-based code
  • Better type hints and method documentation

Benefits

  • Cleaner separation between agents (receive guidelines) and MCP clients (install MCP servers)
  • More maintainable code with unified environment selection logic
  • Improved naming consistency throughout the codebase
  • Reduced complexity by removing reflection-based discovery

pushpak1300 and others added 5 commits August 12, 2025 19:30
…ndling and removing legacy agents

- Removed `Agents` directory and deprecated agent-related classes.
- Consolidated IDE and agent selection logic into `CodeEnvironment`.
- Implemented MCP installation strategies in `CodeEnvironment`.
- Added `McpInstallationStrategy` enum for shell, file, or none-based configurations.
- Updated `InstallCommand` to use consolidated `CodeEnvironment` functionality.
- Enhanced `CodeEnvironment` with support for MCP installation and guideline paths.
- Removed `Agent` and `Ide` contracts, introducing `CodingAgent` and `McpClient` interfaces.
- Updated `CodeEnvironment` subclasses to implement the new contracts.
- Renamed and adjusted methods in `CodeEnvironment` for better clarity (`supportsAgent` -> `isCodingAgent`, `supportsIde` -> `isMcpClient`).
- Updated `GuidelineWriter` and related tests to use `CodingAgent`.
- Simplified `InstallCommand` filtering logic by adopting new contract methods.
…and remove unused MCP strategies

- Replaced `CodingAgent` interface with `Agent` and updated all references.
- Removed redundant `mcpInstallationStrategy` and `frontmatter` methods in favor of simplified logic.
- Improved `CodeEnvironment` with consolidated detection methods (`isCodingAgent` -> `IsAgent`).
- Adjusted related classes, tests, and docblocks for consistency and clarity.
…d for MCP handling

- Introduced comprehensive tests for `CodeEnvironment`, covering detection, MCP installation, and interface logic.
- Renamed variables in `InstallCommand` for clarity (`selectedTargetIdes` -> `selectedTargetMcpClient`).
- Replaced `enact` method in `InstallCommand` with `performInstallation`.
- Adjusted MCP installation logic for streamlined and consistent implementation.
…ling

- Replaced `ideName` references with `mcpClientName` for clarity.
- Updated `InstallCommand` to use specific type hints (`Agent`, `McpClient`) for better consistency and readability.
- Added docblocks and exceptions for improved code documentation and error handling.
- Adjusted tests to reflect the `McpClient` changes and renamed corresponding test cases.
- Minor updates in `VSCode` and contract interfaces to align with the new naming convention.
@pushpak1300 pushpak1300 marked this pull request as ready for review August 12, 2025 17:30
…ent enum naming convention

- Renamed enum cases in `McpInstallationStrategy` to uppercase for standardization.
- Updated references across codebase and adjusted related test cases.
…rename methods for consistency

- Updated method names in `InstallCommand` to reflect contract-specific responsibilities (`selectTargetIdes` -> `selectTargetMcpClients`).
- Introduced `getSelectionConfig` to centralize configuration for contract-based selection.
- Standardized `CodeEnvironment` method behaviors (`name()` -> `displayName()`).
- Adjusted tests to align with updated method and property names.
- Included exception handling for unsupported contract classes.
…method

- Replaced `getAllPrograms` with `getCodeEnvironments` for consistency and public access.
- Removed the private `getAllPrograms` method in favor of consolidated logic.
- Adjusted usage across detection methods to align with the updated method structure.
@pushpak1300 pushpak1300 force-pushed the ai-53-cleaner-agentide-management-in-installcommand-pair branch from 402dba1 to b623165 Compare August 12, 2025 18:06
@ashleyhindle ashleyhindle merged commit be37f15 into main Aug 12, 2025
10 checks passed
@ashleyhindle ashleyhindle deleted the ai-53-cleaner-agentide-management-in-installcommand-pair branch August 13, 2025 14:04
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.

2 participants