# PCode Dependency Installation Guide - Windows (LLM Prompt)

## Purpose

This document provides unified dependency checking and installation guidance for AI/LLM systems. LLMs should guide users through dependency checking and installation based on the content provided in this document.

## Check Workflow

1. Check .NET SDK version: Run `dotnet --version`
2. Check Node.js version: Run `node --version`
3. Check npm version: Run `npm --version`
4. Check OpenSpec version: Run `openspec --version`

## Installation Guide

### .NET SDK Installation

Install .NET SDK using winget:

```powershell
winget install Microsoft.DotNet.SDK.10 --accept-source-agreements --accept-package-agreements
```

Verify installation: `dotnet --version`

### Node.js Installation

Install Node.js using winget:

```powershell
winget install OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements
```

Verify installation: `node --version`

### NPM Installation

Install NPM using official npm registry:

```powershell
npm install npm@recommended-version -g
```

Verify installation: `npm --version`

### OpenSpec Installation

Install OpenSpec using npm:

```powershell
npm install @fission-ai/openspec@minimum-version -g
```

Verify installation: `openspec --version`

## Dependency Requirements

The following dependency version requirements are pre-populated in this prompt and ready to use:

### claudeCode
- 最低版本: 2.1.0
- 描述: Claude Code - AI-powered development framework

### dotnet
- 最低版本: 10.0.0
- 推荐版本: 10.0.0
- 安装提示: Install from https://dotnet.microsoft.com/download/dotnet/10.0
- 描述: .NET 10 runtime and SDK

### node
- 最低版本: 20.11.0
- 推荐版本: 24.12.0
- 安装提示: Install from https://nodejs.org/ or use nvm
- 描述: Node.js runtime

### npm
- 最低版本: 10.0.0
- 推荐版本: 10.9.0
- 描述: NPM package manager

### openspec
- 最低版本: 1.0.0
- 最高版本: 2.0.0
- 描述: OpenSpec proposal management system

### system
- 描述: System requirements for Hagicode platform



## Troubleshooting

### Script Execution Failed

**Check PowerShell execution policy**:

```powershell
Get-ExecutionPolicy
```

If it shows `Restricted`, you need to set the execution policy:

```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
```

**Run PowerShell as Administrator**:

Right-click on PowerShell icon and select "Run as Administrator".

### Version Mismatch

Use the version requirements listed in this prompt and upgrade or downgrade according to each dependency's installHint.

**.NET SDK version mismatch**:
```powershell
# List installed .NET versions
dotnet --list-sdks

# Reinstall using winget
winget install Microsoft.DotNet.SDK.10
```

**Node.js version mismatch**:
```powershell
# Use nvm-windows to manage Node.js versions
# Download nvm-windows: https://github.com/coreybutler/nvm-windows/releases
nvm install recommended-version
nvm use recommended-version
```

### Network Issues

**Use official sources**:
- npm: Official npmjs.org registry
- winget: Use default sources

### Permission Issues

Some operations require administrator privileges:
- Run PowerShell as Administrator
- Or use "Run as administrator" option

### Environment Variables

If commands are not recognized, you may need to add to PATH:
1. Open "System Properties" -> "Advanced" -> "Environment Variables"
2. Edit PATH environment variable
3. Add installation path (e.g., `C:\Program Files\dotnet\`)
4. Restart PowerShell

## International Region Configuration

This guide uses official sources by default:

- **.NET SDK**: Installed via winget
- **Node.js**: Installed via winget
- **npm**: https://registry.npmjs.org

## Verification Checklist

After completing installation, run the following commands to verify all dependencies:

```powershell
# Verify .NET
dotnet --version

# Verify Node.js
node --version

# Verify npm
npm --version

# Verify OpenSpec
openspec --version
```

## Execution Boundary (Mandatory)

- The only required action after installation is dependency status checking.
- Do not attempt to start any service.
- Do not perform extra initialization tasks.
- Do not trigger post-install workflows unrelated to dependency checks.
- In non-interactive mode, do not ask interactive questions; use deterministic defaults and record assumptions in the output.
- The final output must be: installation completed + dependency check results.

## Output Installation Result Report

**Important**: After completing all dependency checks and installations, you must output a clear table report to the user summarizing the status of all dependencies.

Report format:

```markdown
## Dependency Installation Result Report

| Dependency | Status | Current Version | Required Version | Notes |
|------------|--------|-----------------|------------------|-------|
| .NET SDK | ✓ Installed | 10.0.0 | >= 10.0.0 | |
| Node.js | ✓ Installed | 20.11.0 | >= 20.11.0 | |
| npm | ✓ Installed | 10.9.0 | >= 10.0.0 | |
| OpenSpec | ✓ Installed | 1.0.5 | 1.0.0 - < 2.0.0 | |

## Summary
- Required dependencies: 4/4 installed ✓
```

**Notes**:
- **Status**: Use "✓ Installed", "✗ Not Installed", "⚠ Version Mismatch"
- **Current Version**: Actual version obtained from `--version` command
- **Required Version**: Version requirement listed in this prompt
- **Notes**: Whether the dependency is required or any items needing attention

After outputting the report, if there are uninstalled or version-mismatched dependencies, provide specific installation or upgrade recommendations.

## Windows Specific Notes

- **System Requirements**: Windows 10 version 1607+ or Windows 11
- **Architecture**: x64
- **PowerShell**: PowerShell 7+ recommended (compatible with Windows PowerShell 5.1)
- **Administrator Privileges**: Some operations require administrator rights
- **Windows Defender**: May block script execution, need to add exclusions

## PowerShell Basic Commands

```powershell
# View execution policy
Get-ExecutionPolicy

# Set execution policy (current session)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

# Run as Administrator
# Right-click PowerShell -> "Run as Administrator"

# Check environment variables
$env:PATH

# List installed software
winget list
```

## Additional Windows Tips

- **Terminal**: Use Windows Terminal for better experience
- **Line Endings**: Windows uses CRLF, may cause issues with cross-platform scripts
- **Path Separators**: Use backslash `\` or forward slash `/` (PowerShell handles both)
- **Case Insensitivity**: Windows file system is case-insensitive

## Important Notes

1. **Version Numbers**: Version information in this guide is pre-populated in the dependency section of this prompt
2. **Package Names**: OpenSpec package name is `@fission-ai/openspec` (note the namespace)
