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
Markdown
# check-vscode-extensions
> π Intelligently detect VSCode/Cursor/WindSurf extension status, support multi-editor environments, provide one-click installation commands
[](https://www.npmjs.com/package/check-vscode-extensions)
[](https://nodejs.org/)
[](LICENSE)
[](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 βοΈ!
[](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