UNPKG

check-vscode-extensions

Version:

πŸ” Intelligently detect VSCode/Cursor/WindSurf extension status, support multi-editor environments, provide one-click installation commands. Supports English and Chinese.

315 lines (233 loc) β€’ 8.8 kB
# check-vscode-extensions > πŸ” Intelligently detect VSCode/Cursor/WindSurf extension status, support multi-editor environments, provide one-click installation commands [![npm version](https://img.shields.io/npm/v/check-vscode-extensions.svg)](https://www.npmjs.com/package/check-vscode-extensions) [![Node.js](https://img.shields.io/badge/Node.js-v14+-green.svg)](https://nodejs.org/) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Downloads](https://img.shields.io/npm/dm/check-vscode-extensions.svg)](https://www.npmjs.com/package/check-vscode-extensions) Have you ever encountered these situations in team development: - New team member submits messy code in PR, CI fails - ESLint errors locally but they have no idea - You remind them to install extensions, they say "I didn't see the recommendation" πŸ‘† If you nodded, this tool is built for you. ## ✨ Core Features - πŸ” **Smart Editor Detection** - Automatically identify VSCode, Cursor, WindSurf - πŸ“Š **Multi-Editor Support** - Detect all running editors simultaneously - πŸ› οΈ **Path Conflict Resolution** - Intelligently handle `code` command conflicts - 🎨 **User-Friendly Interface** - Colorful output with clear status indicators - ⚑ **Precise Installation Guide** - Provide directly executable installation commands - πŸ“¦ **Zero Configuration** - Works out of the box, no complex setup required - 🌍 **Internationalization** - Support for English and Chinese ## πŸš€ Quick Start ### Method 1: Use npx (Recommended) ```bash npx check-vscode-extensions ``` ### Method 2: Global Installation ```bash npm install -g check-vscode-extensions check-vscode-extensions ``` ### Method 3: Project Integration ```bash npm install --save-dev check-vscode-extensions ``` Add scripts to your `package.json`: ```json { "scripts": { "check:env": "check-vscode-extensions", "postinstall": "check-vscode-extensions" } } ``` ## πŸ“Š Usage Examples ### βœ… All Extensions Installed ```bash $ npx check-vscode-extensions βœ… All required extensions are installed in Cursor ℹ️ πŸ” Detected Cursor is running, checked its extension status. ``` ### ⚠️ Missing Extensions ```bash $ npx check-vscode-extensions ℹ️ Current editor: VSCode ℹ️ Missing extensions: dbaeumer.vscode-eslint, esbenp.prettier-vscode πŸ’‘ Installation commands (copy and run): code --install-extension dbaeumer.vscode-eslint code --install-extension esbenp.prettier-vscode Or install all at once: code --install-extension dbaeumer.vscode-eslint && code --install-extension esbenp.prettier-vscode ``` ### πŸ”„ Multi-Editor Detection ```bash $ npx check-vscode-extensions ℹ️ Detected multiple editors running: Cursor, VSCode βœ… All required extensions are installed in Cursor ℹ️ ⚠️ VSCode missing extensions: esbenp.prettier-vscode Installation commands: VSCode: "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" --install-extension esbenp.prettier-vscode ``` ## πŸ“‹ Default Detected Extensions | Extension ID | Extension Name | Description | |--------------|----------------|-------------| | `dbaeumer.vscode-eslint` | ESLint | JavaScript/TypeScript code linting | | `esbenp.prettier-vscode` | Prettier | Code formatting tool | ## 🎯 Use Cases ### Team Development ```json { "scripts": { "postinstall": "check-vscode-extensions" } } ``` Automatically check after project clone, **eliminate extension missing issues**. ### CI/CD Integration ```yaml # .github/workflows/check-env.yml - name: Check VSCode Extensions run: npx check-vscode-extensions ``` ### Git Hooks ```bash # .husky/pre-commit npx check-vscode-extensions ``` ## πŸ”§ Customization Currently, the tool detects a fixed list of extensions. For customization: ### Option 1: Fork and Customize 1. Fork this project 2. Modify the `requiredExtensions` array in `lib/index.js` 3. Publish your own npm package ### Option 2: Local Script Download the source code to your project and modify directly: ```bash # Download script curl -o check-extensions.js https://raw.githubusercontent.com/leeguooooo/check-vscode-extensions/main/lib/index.js # Modify requiredExtensions array # Run node check-extensions.js ``` ### Common Extension Examples ```javascript const requiredExtensions = [ // Basic extensions 'dbaeumer.vscode-eslint', 'esbenp.prettier-vscode', // Frontend development 'bradlc.vscode-tailwindcss', 'ms-vscode.vscode-typescript-next', // Backend development 'ms-python.python', 'golang.go', // Utility extensions 'eamodio.gitlens', 'ms-vscode.vscode-json' ] ``` ## 🧠 How It Works ### Smart Detection Flow ```mermaid graph TD A[Start Detection] --> B{Check Environment Variables} B -->|CURSOR_TRACE_ID| C[Cursor Environment] B -->|TERM_PROGRAM=vscode| D[VSCode Environment] B -->|No Special Variables| E[Detect Running Processes] E --> F{Scan Active Editors} F --> G[VSCode Process] F --> H[Cursor Process] F --> I[WindSurf Process] C --> J[Get Extension List] D --> J G --> J H --> J I --> J J --> K{Check Required Extensions} K -->|Missing| L[Generate Install Commands] K -->|Complete| M[Show Success Status] ``` ### Core Technical Features - **πŸ” Multi-layer Detection**: Environment Variables β†’ Process Scanning β†’ CLI Verification - **πŸ› οΈ Path Conflict Resolution**: Intelligently handle `code` command conflicts - **πŸ“Š Concurrent Editor Support**: Detect multiple running editors simultaneously - **⚑ Zero Dependencies**: Uses only Node.js built-in modules ## πŸ“Š Comparison with Other Solutions | Feature | VSCode Recommended Extensions | check-vscode-extensions | |---------|------------------------------|------------------------| | Auto-detect extension status | ❌ | βœ… | | Terminal missing extension alerts | ❌ | βœ… | | One-click install commands | ❌ | βœ… | | Support Cursor/WindSurf | ❌ | βœ… | | Multi-editor detection | ❌ | βœ… | | CI/CD integration | ❌ | βœ… | | Zero configuration | ❌ | βœ… | ## πŸ› οΈ Troubleshooting ### Common Issues #### ❓ Editor Not Detected Ensure your editor has CLI commands installed and enabled: - **VSCode**: `Cmd+Shift+P` β†’ "Shell Command: Install 'code' command in PATH" - **Cursor**: Usually installs `cursor` command automatically #### ❓ Wrong Editor Detected Check which editor your system `code` command points to: ```bash which code # If it points to Cursor but you want VSCode, reinstall VSCode CLI ``` #### ❓ Permission Errors Ensure you have permission to execute editor CLI: ```bash # Test if CLI is available code --version cursor --version ``` ### Supported Platforms - βœ… **macOS**: Full support - ⚠️ **Windows**: Partial support (path adaptation needed) - ⚠️ **Linux**: Partial support (path adaptation needed) > Currently optimized for macOS, Windows and Linux support is under development ## 🌍 Language Support The tool supports multiple languages: - **English** (default) - **δΈ­ζ–‡** (Chinese) Set language via environment variable: ```bash # English (default) npx check-vscode-extensions # Chinese LANG=zh-CN npx check-vscode-extensions ``` ## πŸ”„ Changelog ### v1.0.0 (2024-01-XX) - πŸŽ‰ Initial release - βœ… Support VSCode, Cursor, WindSurf detection - βœ… Multi-editor concurrent detection - βœ… Smart path conflict resolution - βœ… Zero dependencies design - 🌍 Internationalization support ## 🀝 Contributing We welcome all forms of contributions! ### πŸ› Report Issues - Use [Issue Templates](https://github.com/leeguooooo/check-vscode-extensions/issues/new) - Provide detailed environment information and error logs ### πŸ’‘ Feature Suggestions - Discuss in [Discussions](https://github.com/leeguooooo/check-vscode-extensions/discussions) - Describe use cases and expected outcomes ### πŸ”§ Code Contributions 1. Fork the project 2. Create feature branch: `git checkout -b feature/amazing-feature` 3. Commit changes: `git commit -m 'feat: add amazing feature'` 4. Push branch: `git push origin feature/amazing-feature` 5. Submit Pull Request ## πŸ“„ License This project is licensed under the [MIT License](LICENSE). ## 🌟 Star History If this tool helps you, please give it a ⭐️! [![Star History Chart](https://api.star-history.com/svg?repos=leeguooooo/check-vscode-extensions&type=Date)](https://star-history.com/#leeguooooo/check-vscode-extensions&Date) --- **πŸš€ Automate extension checking, make team collaboration more efficient!** *Made with ❀️ by [leeguoo](https://github.com/leeguooooo)* ## πŸ“– Documentation - [δΈ­ζ–‡ζ–‡ζ‘£](README.zh-CN.md) - Chinese documentation - [Usage Guide](USAGE.md) - Detailed usage instructions - [Release Guide](RELEASE.md) - How to release new versions