Add Cursor IDE support to interactive installer#52
Draft
matthewhembree wants to merge 11 commits intocolbymchenry:mainfrom
Draft
Add Cursor IDE support to interactive installer#52matthewhembree wants to merge 11 commits intocolbymchenry:mainfrom
matthewhembree wants to merge 11 commits intocolbymchenry:mainfrom
Conversation
## Summary Added parallel installation support for Cursor IDE alongside Claude Code, allowing users to configure CodeGraph MCP tools for either or both IDEs. ## Key Changes ### IDE Selection - Refactored to checkbox-style selection (comma-separated numbers) - Changed type from `IDE = 'claude' | 'cursor' | 'both'` to `IDE = IDEName[]` - Easy to extend with additional IDEs (VSCode, Zed, etc.) ### Cursor-Specific Implementation - Creates `.cursor/mcp.json` for MCP server configuration - Creates `.cursor/rules/codegraph.md` for AI assistant instructions - Only supports local installation (no global config) ### Architecture Improvements - Separated templates into `src/installer/templates/` directory - `claude-code.ts`: Claude Code template with section markers - `cursor.ts`: Cursor standalone template (no markers needed) - IDE-specific config functions: `hasClaudeMcpConfig()` / `hasCursorMcpConfig()` - Separated install functions: `installForClaude()` / `installForCursor()` ### Files Created - `src/installer/templates/claude-code.ts` - `src/installer/templates/cursor.ts` ### Files Modified - `src/installer/prompts.ts`: Multi-select IDE picker - `src/installer/config-writer.ts`: Cursor config writers - `src/installer/index.ts`: Parallel install orchestration - `src/installer/banner.ts`: Multi-IDE messaging ## Installation Flow 1. User selects IDE(s): `1` (Claude), `2` (Cursor), or `1,2` (both) 2. Choose location: Global or local (Cursor forces local) 3. Configure selected IDEs in parallel 4. Index project if local install 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
## Changes - Detects installed IDEs by checking for config directories - Claude Code: `~/.claude` or `./.claude` - Cursor: `./.cursor` - Shows "✓ Detected" indicator next to installed IDEs - Pre-selects detected IDEs as defaults - Improves UX by automatically suggesting correct configuration ## Example Output ``` Which IDE(s) would you like to configure? (Enter comma-separated numbers, e.g., "1,2" for both) 1) Claude Code ✓ Detected 2) Cursor ✓ Detected Selection [1,2]: ``` ## Benefits - Smarter defaults based on actual installation - Reduces user confusion - Automatically suggests "both" when both IDEs detected - Fallback to Claude Code if nothing detected 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add InstallerTestHelper class for e2e test utilities - Test Claude Code global/local installation - Test Cursor local installation - Test both IDEs installed together - Test update scenarios for both IDEs - Test IDE detection (fresh, after install, independent detection) - Test permissions and hooks for Claude Code - All 20 tests passing (8 existing + 12 new e2e tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add --ide flag to 'install' command for non-interactive installation - Support comma-separated IDE list: --ide=claude,cursor - Support 'all' keyword: --ide=all (installs both IDEs) - Add InstallerOptions interface for programmatic usage - Add parseIDEArg() to validate and parse IDE arguments - Add 4 new tests for non-interactive mode (24 total tests passing) - Update CLI help text with examples Usage examples: codegraph install --ide=claude codegraph install --ide=cursor codegraph install --ide=claude,cursor codegraph install --ide=all 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add --location flag to specify global or local installation - Add validateLocation() to validate location argument - Skip location prompt when --location is provided - Add 4 new tests for location flag (28 total tests passing) - Update CLI help text with location examples Usage examples: codegraph install --ide=claude --location=global codegraph install --ide=claude --location=local codegraph install --ide=all --location=local codegraph install --ide=cursor # Cursor is always local 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes: - Default installation location changed from global to local - Add isInteractive() to detect TTY (stdin.isTTY && stdout.isTTY) - Non-interactive shells use sensible defaults: - IDE: detected IDEs or 'claude' if none detected - Location: always 'local' - Swap order in prompt: Local (1) is now default, Global (2) - All 28 tests passing Benefits: - Works in CI/CD pipelines without hanging - Works in scripts and automation - Safer default (local doesn't affect other projects) - Explicit --ide and --location flags still override defaults 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add DEFAULT_IDE and DEFAULT_LOCATION constants in prompts.ts - Replace hardcoded 'claude' and 'local' with constants - Makes it easy to change defaults in one place - All 28 tests passing To change defaults in the future, just update: export const DEFAULT_IDE: IDEName = 'claude'; export const DEFAULT_LOCATION: InstallLocation = 'local'; 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update tagline to mention both Claude Code and Cursor - Add IDE selection to installer flow description - Document non-interactive mode with --ide and --location flags - Add note about Cursor Agent mode vs Composer - Update MCP configuration examples to include Cursor - Add examples for all installation combinations - Document TTY auto-detection behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Exports parseIDEArg and validateLocation for direct testability, then adds coverage for isInteractive(), promptIDE/promptInstallLocation non-interactive paths, and all edge cases for IDE/location arg parsing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a3c6e0c to
1b3967d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds parallel Cursor IDE support to the interactive installer alongside existing Claude Code support, with non-interactive CLI mode and improved defaults.
Key Features:
1,2).cursor/mcp.jsonand.cursor/rules/codegraph.md)--ideand--locationflags (CI/scripting)Architecture:
src/installer/templates/directoryclaude-code.ts- Template with section markers for shared CLAUDE.mdcursor.ts- Standalone template for dedicated.cursor/rules/codegraph.mdsrc/installer/config-writer.tssrc/installer/prompts.tsisInteractive()guard prevents readline hang in non-TTY environmentsNon-Interactive Usage:
Testing:
isInteractive()— all TTY combinationspromptIDE()non-interactive path — no IDEs, each IDE, both detectedpromptInstallLocation()non-interactive path — all IDE combinationsparseIDEArg()— valid values, case-insensitivity, whitespace, invalid throws, mixed listsvalidateLocation()— valid values, case-insensitivity, undefined passthrough, invalid throwsFiles Modified:
src/installer/templates/claude-code.ts(new)src/installer/templates/cursor.ts(new)src/installer/prompts.ts- Added IDE selection, auto-detection, andisInteractive()src/installer/config-writer.ts- Added Cursor writers, renamedhasMcpConfig→hasClaudeMcpConfigsrc/installer/index.ts- Parallel installation logic, non-interactive arg parsingsrc/installer/banner.ts- Updated for multiple IDEssrc/bin/codegraph.ts- Added--ideand--locationflags toinstallcommand__tests__/installer.test.ts- Comprehensive test suiteConfiguration Differences:
.claude.jsonor~/.claude.json.cursor/mcp.json(local only).claude/CLAUDE.md(shared, uses markers).cursor/rules/codegraph.md(dedicated).claude/settings.json.claude/settings.json🤖 Generated with Claude Code