# PCode Dependency Installation Guide - Linux (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

Use the official .NET install script:

```bash
# Download install script
curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh

# Execute installation
chmod +x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --install-dir ~/.dotnet --channel current-channel --runtime aspnetcore

# Add to PATH (if not already added)
export PATH=$PATH:~/.dotnet
echo 'export PATH=$PATH:~/.dotnet' >> ~/.bashrc
```

Verify installation: `dotnet --version`

### Node.js Installation

Download and install Node.js from official source:

```bash
# Get system architecture
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
    NODE_ARCH="x64"
elif [ "$ARCH" = "aarch64" ]; then
    NODE_ARCH="arm64"
fi

# Download Node.js from official site
curl -fsSL https://nodejs.org/dist/vcurrent-version/node-vcurrent-version-linux-${NODE_ARCH}.tar.xz -o /tmp/node.tar.xz

# Extract and install
mkdir -p ~/.local
tar -xJf /tmp/node.tar.xz -C ~/.local --strip-components=1
rm /tmp/node.tar.xz

# Add to PATH
export PATH=$PATH:~/.local/bin
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
```

Verify installation: `node --version`

### NPM Installation

Install NPM using official npm registry:

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

Verify installation: `npm --version`

### OpenSpec Installation

Install OpenSpec using npm:

```bash
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

**File permission issues**:
```bash
chmod +x scripts/*.sh
```

**Verify script path is correct**:
```bash
ls -la scripts/
pwd
```

### Version Mismatch

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

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

# Reinstall specific version
# Re-run the official install script
```

**Node.js version mismatch**:
```bash
# Use nvm to manage Node.js versions
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install recommended-version
nvm use recommended-version
```

### Network Issues

**Use official sources**:
- .NET: Official dot.net source
- Node.js: Official nodejs.org source
- npm: Official npmjs.org registry

### Permission Issues

Some operations require sudo privileges:
```bash
sudo npm install package-name -g
```

## International Region Configuration

This guide uses official sources by default:

- **.NET SDK**: https://dot.net/v1/dotnet-install.sh
- **Node.js**: https://nodejs.org/dist/
- **npm**: https://registry.npmjs.org

## Verification Checklist

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

```bash
# 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.

## 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)
