Skill: zhuzeyu22/nvs-node-version-switcher (version 1.0.0)

--- name: nvs-node-version-switcher description: Manage Node.js versions using NVS (Node Version Switcher). Use when switching Node.js versions, installing new versions, managing version aliases, or when the user mentions NVS, node version management, or needs to change the active Node.js version in the current environment. --- # NVS Node.js Version Manager NVS (Node Version Switcher) is a cross-platform tool for managing multiple Node.js versions. It allows you to easily install, switch between, and manage different Node.js versions and their associated npm packages. ## Quick Start ### Check if NVS is installed ```bash nvs --version ``` ### If NVS is not installed, install it first #### Windows (PowerShell or Command Prompt) ```powershell # Using winget (Windows 11+) winget install jasongin.nvs # Or using chocolatey choco install nvs # Manual installation $env:NVS_HOME="$env:LOCALAPPDATA\nvs" git clone https://github.com/jasongin/nvs "$env:NVS_HOME" . "$env:NVS_HOME\nvs.ps1" install ``` #### Mac/Linux ```bash export NVS_HOME="$HOME/.nvs" git clone https://github.com/jasongin/nvs "$NVS_HOME" . "$NVS_HOME/nvs.sh" install ``` ## Basic Commands ### Install Node.js versions ```bash # Install latest version nvs add latest # Install latest LTS version nvs add lts # Install specific version nvs add 18.20.0 # Install with specific architecture nvs add 18.20.0/x64 ``` ### Switch between versions ```bash # Use a version in current shell session nvs use 18.20.0 # Use LTS version nvs use lts # Set default version (permanent) nvs link 18.20.0 # Remove default link nvs unlink 18.20.0 ``` ### List versions ```bash # List locally installed versions nvs ls # List available remote versions nvs ls-remote # Filter remote versions nvs ls-remote 18 nvs ls-remote lts ``` ### Remove versions ```bash nvs rm 16.20.0 ``` ## Advanced Features ### Automatic version switching Enable automatic switching based on `.node-version` or `.nvmrc` files: ```bash # Enable auto-switching nvs auto on # Disable auto-switching nvs auto off # Manual trigger for current directory nvs auto ``` ### Version aliases ```bash # Create an alias nvs alias myproject 18.20.0 # List all aliases nvs alias # Remove an alias nvs alias myproject ``` ### Run commands with specific versions ```bash # Run a script with specific Node version nvs run 18.20.0 app.js # Execute a command with specific version nvs exec 18.20.0 npm test ``` ### Migrate global packages ```bash # Migrate global npm packages from one version to another nvs migrate 16.20.0 18.20.0 ``` ### Remote configuration ```bash # List configured remotes nvs remote # Add custom remote (e.g., nightly builds) nvs remote add nightly https://nodejs.org/download/nightly/ # Use custom remote nvs add nightly/18 ``` ## Common Workflows ### Project Setup Workflow 1. Check if project has `.node-version` or `.nvmrc` file 2. If NVS not installed, install it 3. Install required Node.js version 4. Enable auto-switching if needed 5. Verify the correct version is active ### Version Upgrade Workflow 1. Check current version: `nvs ls` 2. Install new version: `nvs add latest` 3. Test with new version: `nvs use latest` 4. Migrate global packages if needed: `nvs migrate <old> <new>` 5. Set as default if satisfied: `nvs link latest` ### Troubleshooting - If `nvs` command not found, ensure NVS is properly installed and shell is restarted - Check `NVS_HOME` environment variable points to correct directory - Use `nvs which <version>` to verify version paths - For permission issues on Mac/Linux, check NVS installation directory permissions ## Environment Variables - `NVS_HOME`: Directory where NVS stores Node.js versions (default: `~/.nvs` on Mac/Linux, `%LOCALAPPDATA%\nvs` on Windows) - `NVS_NODE_HOME`: Alternative location for Node.js installations ## Integration with VS Code NVS integrates with Visual Studio Code for debugging with specific Node.js versions. Configure in `.vscode/launch.json`: ```json { "runtimeArgs": ["18.20.0"], "windows": { "runtimeExecutable": "nvs.cmd" }, "osx": { "runtimeExecutable": "nvs" }, "linux": { "runtimeExecutable": "nvs" } } ```

path: CREATION_SUMMARY.md
content: # NVS Node Version Switcher Skill - 创建完成

## 🎉 技能创建成功！

我已经成功创建了一个完整的 NVS (Node Version Switcher) 技能，该技能可以帮助你管理不同环境的 Node.js 版本。

## 📁 技能结构

```
.lingma/skills/nvs-node-version-switcher/
├── SKILL.md              # 主要技能文档（179行，符合最佳实践）
├── REFERENCE.md          # 详细命令参考
├── EXAMPLES.md           # 实用示例和工作流
├── README.md             # 技能使用说明
└── scripts/              # 实用脚本
    ├── check_nvs_status.sh   # 检查 NVS 安装状态
    ├── install_nvs.sh        # 自动安装 NVS
    └── validate_skill.sh     # 验证技能结构
```

## ✅ 已实现的功能

### 1. 跨平台安装支持
- **Windows**: winget、chocolatey、手动安装
- **macOS/Linux**: git clone + shell 脚本安装
- **自动检测**: 智能识别操作系统并提供相应安装方法

### 2. NVS 核心功能掌握
- ✅ 版本安装 (`nvs add`)
- ✅ 版本切换 (`nvs use`)
- ✅ 默认设置 (`nvs link`)
- ✅ 版本列表 (`nvs ls`, `nvs ls-remote`)
- ✅ 自动切换 (`nvs auto`)
- ✅ 别名管理 (`nvs alias`)
- ✅ 远程配置 (`nvs remote`)
- ✅ 包迁移 (`nvs migrate`)

### 3. 智能环境处理
- 自动检测 NVS 是否已安装
- 未安装时提供自动安装方案
- 支持不同 shell 环境（bash、zsh、PowerShell、cmd）

## 🚀 使用方法

### 快速开始
1. **检查 NVS 状态**：
   ```bash
   nvs --version
   ```

2. **如果未安装，使用自动安装脚本**：
   ```bash
   .lingma/skills/nvs-node-version-switcher/scripts/install_nvs.sh
   ```

3. **安装和使用 Node.js 版本**：
   ```bash
   nvs add lts      # 安装最新 LTS 版本
   nvs use lts      # 使用该版本
   ```

### Lingma 集成
当你在对话中提到以下情况时，此技能会自动激活：
- "我需要切换 Node.js 版本"
- "如何安装特定版本的 Node.js"
- "NVS 怎么使用"
- "项目需要不同的 Node.js 版本"
- 任何与 Node.js 版本管理相关的问题

## 📋 技能特点

### 遵循最佳实践
- ✅ SKILL.md 保持在 500 行以内（实际 179 行）
- ✅ 描述具体且包含触发词（276 字符）
- ✅ 使用渐进式披露（详细信息在参考文件中）
- ✅ 提供实用脚本和示例
- ✅ 跨平台兼容性

### 内容丰富
- **完整命令参考**：所有 NVS 命令的详细说明
- **实际示例**：真实场景的使用案例
- **工作流指导**：项目设置、版本升级等常见流程
- **故障排除**：常见问题和解决方案

## 🔧 实用脚本

### check_nvs_status.sh
检查 NVS 安装状态和当前 Node.js 版本信息

### install_nvs.sh  
自动检测系统并安装 NVS（支持 Mac/Linux）

### validate_skill.sh
验证技能文件结构和内容完整性

## 🎯 适用场景

1. **多项目管理**：不同项目需要不同 Node.js 版本
2. **版本测试**：测试应用在不同 Node.js 版本下的兼容性
3. **团队协作**：确保团队使用统一的 Node.js 版本
4. **CI/CD 集成**：在持续集成环境中管理 Node.js 版本
5. **开发环境设置**：快速配置新的开发环境

## 📖 学习资源

技能基于官方 NVS 仓库 (https://github.com/jasongin/nvs) 创建，包含：
- 官方文档的核心内容
- 跨平台安装指南
- 完整的命令参考
- 实际使用示例

## ✨ 下一步

你现在可以：
1. 在任何需要 Node.js 版本管理的场景中调用此技能
2. 使用提供的脚本自动化常见任务
3. 根据具体项目需求定制版本管理策略
4. 将技能分享给团队成员使用

技能已经完全就绪，可以立即使用！🎊


path: EXAMPLES.md
content: # NVS Usage Examples

This document provides practical examples of common NVS workflows and use cases.

## Basic Version Management

### Installing Node.js Versions

```bash
# Install the latest stable version
nvs add latest

# Install the latest LTS (Long Term Support) version
nvs add lts

# Install a specific major version (latest patch)
nvs add 18

# Install a specific minor version (latest patch)
nvs add 18.20

# Install an exact version
nvs add 18.20.0

# Install with specific architecture
nvs add 18.20.0/x64
nvs add 18.20.0/x86
```

### Switching Between Versions

```bash
# Switch to a specific version for current session
nvs use 18.20.0

# Switch to LTS version
nvs use lts

# Switch to latest version
nvs use latest

# Make a version the default (persistent across sessions)
nvs link 18.20.0

# Remove the default version link
nvs unlink
```

## Project-Specific Workflows

### Setting Up a New Project

```bash
# Check if project specifies a Node.js version
cat .node-version    # or cat .nvmrc

# If NVS is not installed, install it first
# (Use the install_nvs.sh script or manual installation)

# Install the required version
nvs add 18.20.0      # Replace with version from .node-version

# Use the version for current session
nvs use 18.20.0

# Enable automatic switching for this project
nvs auto on
```

### Working with Multiple Projects

```bash
# Project A requires Node 16
cd project-a
nvs use 16.20.0

# Project B requires Node 18
cd ../project-b
nvs use 18.20.0

# With auto-switching enabled, NVS will automatically
# switch versions when you change directories
nvs auto on
```

## Advanced Usage

### Using Aliases

```bash
# Create meaningful aliases for your projects
nvs alias project-a 16.20.0
nvs alias project-b 18.20.0
nvs alias latest-lts lts

# Use aliases instead of version numbers
nvs use project-a
nvs run project-b app.js

# List all aliases
nvs alias

# Remove an alias
nvs alias project-a
```

### Running Commands with Specific Versions

```bash
# Run a script with a specific Node.js version
nvs run 18.20.0 server.js

# Execute npm commands with specific version
nvs exec 18.20.0 npm test
nvs exec lts npm run build

# Check version without switching
nvs which 18.20.0
nvs run 18.20.0 --version
```

### Managing Global Packages

```bash
# When you switch versions, global packages are version-specific
# To migrate global packages between versions:
nvs migrate 16.20.0 18.20.0

# Upgrade to latest patch version and migrate packages
nvs upgrade 18.20
```

### Working with Custom Remotes

```bash
# Add nightly builds remote
nvs remote add nightly https://nodejs.org/download/nightly/

# List available nightly versions
nvs ls-remote nightly/18

# Install a nightly build
nvs add nightly/18.1.0-nightly20230101abc123

# Add io.js remote (historical)
nvs remote add iojs https://iojs.org/dist/
```

## Automation and CI/CD

### Using NVS in Scripts

```bash
#!/bin/bash
# build.sh - Build script with specific Node.js version

# Ensure we're using the correct version
nvs use 18.20.0

# Verify the version
echo "Using Node.js $(node --version)"

# Run build commands
npm ci
npm run build
npm test
```

### Docker Integration

```dockerfile
# Dockerfile example using NVS
FROM ubuntu:22.04

# Install NVS
RUN export NVS_HOME="/root/.nvs" && \
    git clone https://github.com/jasongin/nvs "$NVS_HOME" && \
    . "$NVS_HOME/nvs.sh" install && \
    nvs add 18.20.0 && \
    nvs use 18.20.0

# Set PATH to include NVS Node.js
ENV PATH="/root/.nvs/node/18.20.0/x64/bin:${PATH}"

WORKDIR /app
COPY . .
RUN npm ci && npm run build
```

## Troubleshooting Examples

### Common Issues and Solutions

```bash
# Issue: nvs command not found
# Solution: Ensure NVS is properly installed and shell is restarted
which nvs
echo $NVS_HOME

# Issue: Permission denied on Mac/Linux
# Solution: Check NVS_HOME directory permissions
ls -la ~/.nvs
chmod -R u+w ~/.nvs

# Issue: Wrong version showing after switch
# Solution: Verify the switch worked
nvs use 18.20.0
node --version
nvs which 18.20.0

# Issue: Auto-switching not working
# Solution: Check if .node-version file exists and auto is enabled
cat .node-version
nvs auto on
nvs auto  # Manual trigger
```

### Diagnostic Commands

```bash
# Check NVS installation status
nvs --version

# List all installed versions with current/default indicators
nvs ls

# Show path to current Node.js binary
nvs which

# Check environment variables
echo $NVS_HOME
echo $PATH | tr ':' '\n' | grep nvs

# Test version switching
nvs use 18.20.0 && node --version
nvs use lts && node --version
```

## Integration Examples

### VS Code Configuration

Create `.vscode/launch.json`:
```json
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch with NVS",
      "program": "${file}",
      "runtimeArgs": ["18.20.0"],
      "windows": {
        "runtimeExecutable": "nvs.cmd"
      },
      "osx": {
        "runtimeExecutable": "nvs"
      },
      "linux": {
        "runtimeExecutable": "nvs"
      }
    }
  ]
}
```

### Git Hooks Integration

Create `.git/hooks/post-checkout`:
```bash
#!/bin/bash
# Automatically switch Node.js version when checking out branches

if [ -f .node-version ]; then
    nvs use auto
    echo "Switched to Node.js $(node --version) based on .node-version"
fi
```

These examples cover the most common NVS usage patterns. For more detailed command reference, see [REFERENCE.md](REFERENCE.md).


path: README.md
content: # NVS Node Version Switcher Skill

This skill provides comprehensive guidance for using NVS (Node Version Switcher) to manage multiple Node.js versions in your development environment.

## What is NVS?

NVS is a cross-platform utility for switching between different versions and forks of Node.js. It's inspired by nvm but works consistently across Windows, macOS, and Linux.

## When to Use This Skill

Use this skill when you need to:
- Install or switch between different Node.js versions
- Set up Node.js environments for different projects
- Manage Node.js version aliases
- Configure automatic version switching
- Troubleshoot Node.js version issues

## Skill Structure

```
nvs-node-version-switcher/
├── SKILL.md          # Main skill instructions and quick start guide
├── REFERENCE.md      # Detailed command reference
├── EXAMPLES.md       # Practical usage examples and workflows
└── scripts/          # Utility scripts
    ├── check_nvs_status.sh   # Check NVS installation status
    └── install_nvs.sh        # Auto-install NVS if not present
```

## Quick Start

1. **Check if NVS is installed:**
   ```bash
   nvs --version
   ```

2. **If not installed, use the auto-install script:**
   ```bash
   .lingma/skills/nvs-node-version-switcher/scripts/install_nvs.sh
   ```

3. **Install a Node.js version:**
   ```bash
   nvs add lts
   nvs use lts
   ```

## Key Features Covered

- ✅ Cross-platform installation (Windows, macOS, Linux)
- ✅ Version management (install, switch, remove)
- ✅ Automatic version switching per project
- ✅ Alias management
- ✅ Global package migration
- ✅ Custom remote configuration
- ✅ Integration with VS Code and CI/CD

## Common Commands

```bash
# Install versions
nvs add latest
nvs add lts
nvs add 18.20.0

# Switch versions
nvs use 18.20.0
nvs link 18.20.0  # Set as default

# List versions
nvs ls            # Local versions
nvs ls-remote     # Available versions

# Auto-switching
nvs auto on       # Enable per-directory switching
```

## Files Overview

- **SKILL.md**: Main entry point with essential commands and workflows
- **REFERENCE.md**: Complete command reference with all options and parameters
- **EXAMPLES.md**: Real-world usage scenarios and integration examples
- **scripts/**: Helper scripts for common tasks

## Integration with Lingma

This skill automatically activates when:
- You mention NVS or node version management
- You need to switch Node.js versions
- You're setting up a new project with specific Node.js requirements
- You encounter Node.js version compatibility issues

The agent will provide context-appropriate guidance based on your operating system and specific needs.


path: REFERENCE.md
content: # NVS Command Reference

This document provides detailed information about all NVS commands and their usage.

## Core Commands

### `nvs add [version]`
Downloads and installs a Node.js version.

**Examples:**
```bash
nvs add                    # Interactive selection
nvs add latest             # Latest version
nvs add lts                # Latest LTS
nvs add 18                 # Latest 18.x.x
nvs add 18.20              # Latest 18.20.x
nvs add 18.20.0            # Specific version
nvs add 18.20.0/x64        # Specific architecture
nvs add node/18.20.0       # From specific remote
```

### `nvs use [version]`
Switches to a Node.js version in the current shell session.

**Examples:**
```bash
nvs use                    # Interactive selection
nvs use 18.20.0           # Specific version
nvs use lts               # LTS version
nvs use auto              # Auto-detect from .node-version/.nvmrc
nvs use 18.20.0/x64       # Specific architecture
```

### `nvs link [version]`
Sets a version as the default (permanent across shell sessions).

**Examples:**
```bash
nvs link                  # Link current version
nvs link 18.20.0         # Link specific version
nvs link lts             # Link LTS version
nvs unlink               # Remove default link
nvs unlink 18.20.0       # Unlink specific version
```

### `nvs rm <version>`
Removes an installed Node.js version.

**Examples:**
```bash
nvs rm 16.20.0           # Remove specific version
nvs rm 16                # Remove all 16.x versions
```

## Information Commands

### `nvs ls [filter]`
Lists locally installed Node.js versions.

**Output symbols:**
- `>` - Currently active version
- `#` - Default (linked) version

**Examples:**
```bash
nvs ls                   # List all local versions
nvs ls 18                # Filter by major version
nvs ls lts               # Show LTS versions only
```

### `nvs ls-remote [filter]`
Lists Node.js versions available for download.

**Examples:**
```bash
nvs ls-remote           # List all available versions
nvs ls-remote 18        # Filter by major version
nvs ls-remote lts       # Show LTS versions only
nvs ls-remote nightly   # Show nightly builds
```

### `nvs which [version]`
Shows the path to a Node.js binary.

**Examples:**
```bash
nvs which               # Current version path
nvs which 18.20.0      # Specific version path
nvs which lts          # LTS version path
```

### `nvs --version`
Displays the NVS tool version.

## Advanced Commands

### `nvs auto [on|off]`
Controls automatic version switching based on `.node-version` or `.nvmrc` files.

**Examples:**
```bash
nvs auto on            # Enable auto-switching
nvs auto off           # Disable auto-switching
nvs auto               # Manual trigger for current directory
```

### `nvs alias [name] [value]`
Manages version aliases.

**Examples:**
```bash
nvs alias myapp 18.20.0    # Create alias
nvs alias                  # List all aliases
nvs alias myapp            # Remove alias
nvs run myapp --version    # Use alias
```

### `nvs remote [name] [value]`
Manages download source remotes.

**Examples:**
```bash
nvs remote                    # List remotes
nvs remote add nightly https://nodejs.org/download/nightly/
nvs remote remove nightly     # Remove remote
nvs ls-remote nightly/18      # Use custom remote
```

### `nvs migrate <fromver> [tover]`
Migrates global npm packages between Node.js versions.

**Examples:**
```bash
nvs migrate 16.20.0 18.20.0    # Migrate between versions
nvs migrate 16                 # Migrate from latest 16.x
```

### `nvs upgrade [fromver]`
Upgrades to the latest patch version of a major release.

**Examples:**
```bash
nvs upgrade 18              # Upgrade latest 18.x to latest patch
nvs upgrade 18.20           # Upgrade 18.20.x to latest patch
```

### `nvs run <ver> <js> [args...]`
Runs a JavaScript file with a specific Node.js version.

**Examples:**
```bash
nvs run 18.20.0 app.js
nvs run lts script.js --arg1 --arg2
```

### `nvs exec <ver> <exe> [args...]`
Executes a command with a specific Node.js version.

**Examples:**
```bash
nvs exec 18.20.0 npm test
nvs exec lts node --version
```

## Installation Commands

### `nvs install`
Initializes NVS in the current shell environment.

**Usage:**
```bash
# After cloning NVS repo
. "$NVS_HOME/nvs.sh" install    # Mac/Linux
. "$env:NVS_HOME\nvs.ps1" install  # Windows PowerShell
```

### `nvs uninstall`
Removes NVS from the shell environment.

## Version Specification Format

Versions can be specified in multiple formats:

- **Semantic version**: `18.20.0`, `18.20`, `18`
- **Labels**: `latest`, `lts`, `argon`, `boron`, etc.
- **With architecture**: `18.20.0/x64`, `18.20.0/x86`
- **With remote**: `node/18.20.0`, `nightly/18`
- **Aliases**: Any user-defined alias name

## Environment Variables

- **NVS_HOME**: Base directory for NVS installation and Node.js versions
  - Default: `~/.nvs` (Mac/Linux), `%LOCALAPPDATA%\nvs` (Windows)
- **NVS_NODE_HOME**: Alternative location for Node.js installations
- **NVS_ARCH**: Default architecture (x64, x86, arm, arm64)

## Shell Integration

### Bash/Zsh
The `nvs.sh` script adds the `nvs` function to your shell. The install command automatically adds sourcing to your profile files.

### PowerShell
The `nvs.ps1` script provides similar functionality for PowerShell environments.

### Windows Command Prompt
The `nvs.cmd` batch file provides basic functionality for cmd.exe.

## File-Based Version Control

### `.node-version`
Place this file in your project root to specify the required Node.js version:
```
18.20.0
```

### `.nvmrc`
Compatible with nvm, can also be used by NVS:
```
lts/fermium
```

When `nvs auto on` is enabled, NVS will automatically switch to the version specified in these files when you change directories.


path: scripts/check_nvs_status.sh
content: #!/bin/bash
# check_nvs_status.sh - Check if NVS is installed and report status

echo "=== NVS Installation Status Check ==="

# Check if nvs command exists
if command -v nvs &> /dev/null; then
    echo "✓ NVS is installed"
    echo "  Version: $(nvs --version 2>/dev/null || echo 'Unknown')"
    
    # Check NVS_HOME
    if [ -n "$NVS_HOME" ]; then
        echo "  NVS_HOME: $NVS_HOME"
    else
        echo "  NVS_HOME: Not set (using default)"
    fi
    
    # List installed versions
    echo ""
    echo "Installed Node.js versions:"
    nvs ls 2>/dev/null || echo "  Unable to list versions"
else
    echo "✗ NVS is not installed"
    echo ""
    echo "To install NVS:"
    echo ""
    echo "Windows (PowerShell):"
    echo "  winget install jasongin.nvs"
    echo "  OR"
    echo "  choco install nvs"
    echo ""
    echo "Mac/Linux:"
    echo "  export NVS_HOME=\"\$HOME/.nvs\""
    echo "  git clone https://github.com/jasongin/nvs \"\$NVS_HOME\""
    echo "  . \"\$NVS_HOME/nvs.sh\" install"
fi

echo ""
echo "=== Current Node.js Version ==="
if command -v node &> /dev/null; then
    echo "Node.js: $(node --version)"
    echo "npm: $(npm --version)"
else
    echo "Node.js: Not found"
fi


path: scripts/install_nvs.sh
content: #!/bin/bash
# install_nvs.sh - Automatically install NVS if not present

echo "=== NVS Auto-Installation Script ==="

# Check if NVS is already installed
if command -v nvs &> /dev/null; then
    echo "✓ NVS is already installed"
    echo "  Version: $(nvs --version 2>/dev/null || echo 'Unknown')"
    exit 0
fi

echo "NVS is not installed. Starting installation..."

# Detect operating system
OS="$(uname -s)"
case "$OS" in
    Linux*)     MACHINE=Linux;;
    Darwin*)    MACHINE=Mac;;
    CYGWIN*)    MACHINE=Windows;;
    MINGW*)     MACHINE=Windows;;
    MSYS*)      MACHINE=Windows;;
    *)          MACHINE="Unknown"
esac

echo "Detected OS: $MACHINE"

if [ "$MACHINE" = "Windows" ]; then
    echo "Note: For Windows, please use PowerShell or Command Prompt:"
    echo "  winget install jasongin.nvs"
    echo "  OR"
    echo "  choco install nvs"
    exit 1
elif [ "$MACHINE" = "Mac" ] || [ "$MACHINE" = "Linux" ]; then
    echo "Installing NVS for $MACHINE..."
    
    # Set NVS_HOME
    export NVS_HOME="$HOME/.nvs"
    
    # Clone NVS repository
    if [ -d "$NVS_HOME" ]; then
        echo "NVS directory already exists. Updating..."
        cd "$NVS_HOME" && git pull
    else
        echo "Cloning NVS repository..."
        git clone https://github.com/jasongin/nvs "$NVS_HOME"
    fi
    
    # Source the install script
    echo "Initializing NVS..."
    . "$NVS_HOME/nvs.sh" install
    
    echo ""
    echo "✓ NVS installation completed!"
    echo ""
    echo "To start using NVS, either:"
    echo "  1. Restart your terminal, or"
    echo "  2. Run: source ~/.bashrc (or ~/.zshrc)"
    echo ""
    echo "Quick start commands:"
    echo "  nvs add latest    # Install latest Node.js"
    echo "  nvs use latest    # Use latest version"
    echo "  nvs ls            # List installed versions"
else
    echo "Unsupported operating system: $MACHINE"
    exit 1
fi


path: scripts/validate_skill.sh
content: #!/bin/bash
# validate_skill.sh - Validate the NVS skill structure and content

echo "=== NVS Skill Validation ==="

SKILL_DIR=".lingma/skills/nvs-node-version-switcher"
ERRORS=0

# Check if skill directory exists
if [ ! -d "$SKILL_DIR" ]; then
    echo "❌ Skill directory not found: $SKILL_DIR"
    exit 1
fi

echo "✓ Skill directory exists"

# Check required files
REQUIRED_FILES=("SKILL.md" "REFERENCE.md" "EXAMPLES.md" "README.md")
for file in "${REQUIRED_FILES[@]}"; do
    if [ -f "$SKILL_DIR/$file" ]; then
        echo "✓ $file exists"
    else
        echo "❌ Missing required file: $file"
        ERRORS=$((ERRORS + 1))
    fi
done

# Check scripts directory
if [ -d "$SKILL_DIR/scripts" ]; then
    echo "✓ Scripts directory exists"
    
    # Check script files
    SCRIPTS=("check_nvs_status.sh" "install_nvs.sh")
    for script in "${SCRIPTS[@]}"; do
        if [ -f "$SKILL_DIR/scripts/$script" ]; then
            echo "✓ Script $script exists"
        else
            echo "❌ Missing script: $script"
            ERRORS=$((ERRORS + 1))
        fi
    done
else
    echo "❌ Scripts directory missing"
    ERRORS=$((ERRORS + 1))
fi

# Check SKILL.md frontmatter
if grep -q "^---$" "$SKILL_DIR/SKILL.md" && \
   grep -q "^name:" "$SKILL_DIR/SKILL.md" && \
   grep -q "^description:" "$SKILL_DIR/SKILL.md"; then
    echo "✓ SKILL.md has proper frontmatter"
else
    echo "❌ SKILL.md missing proper frontmatter"
    ERRORS=$((ERRORS + 1))
fi

# Check SKILL.md line count
LINE_COUNT=$(wc -l < "$SKILL_DIR/SKILL.md")
if [ "$LINE_COUNT" -le 500 ]; then
    echo "✓ SKILL.md is concise ($LINE_COUNT lines)"
else
    echo "⚠️  SKILL.md is too long ($LINE_COUNT lines, should be ≤500)"
fi

# Check description quality
DESCRIPTION=$(grep "^description:" "$SKILL_DIR/SKILL.md" | sed 's/^description: //')
if [ ${#DESCRIPTION} -gt 50 ] && [ ${#DESCRIPTION} -lt 1024 ]; then
    echo "✓ Description length is appropriate (${#DESCRIPTION} chars)"
else
    echo "⚠️  Description length may need adjustment (${#DESCRIPTION} chars)"
fi

echo ""
if [ $ERRORS -eq 0 ]; then
    echo "🎉 All validations passed! NVS skill is ready to use."
else
    echo "❌ Found $ERRORS issues. Please fix them before using the skill."
fi

exit $ERRORS


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)