Skip to content

Install OpenSpec

OpenSpec is a specification-driven development tool for managing proposals, specifications, and changes. It helps teams manage workflows in a structured manner, ensuring all changes are reviewed and verified. This guide will walk you through the OpenSpec installation process.

OpenSpec is a command-line tool specifically designed for managing proposals (Proposals) and specifications (Specifications) in the software development process. It provides a complete workflow including:

  • Proposal Management: Create, review, and track feature proposals
  • Specification Validation: Ensure code changes conform to predefined specifications
  • Change Tracking: Record all reviewed change history
  • Team Collaboration: Support multi-person collaborative development

In HagiCode projects, OpenSpec is used for:

  1. Feature Development Management: All new features must go through the OpenSpec proposal process
  2. Code Review: Ensure changes comply with project specifications
  3. Documentation Synchronization: Maintain consistency between documentation and code implementation
  4. Version Control Integration: Seamless integration with version control workflows

Before installing OpenSpec, ensure your system meets the following requirements:

OpenSpec is distributed via npm and requires a Node.js environment. OpenSpec requires Node.js 18.0 or higher.

Verify Node.js installation:

Terminal window
node --version

Verify npm installation:

Terminal window
npm --version

If not installed or the version is too old, please refer to the related software installation instructions in the Installation Guide.

OpenSpec is installed globally via npm, making it available from anywhere on your system.

Run in PowerShell or Command Prompt:

Terminal window
npm install -g @fission-ai/openspec@1

After installation, verify that OpenSpec is installed correctly and the version meets requirements:

Terminal window
openspec --version

If installed successfully, you will see a version number output, for example:

openspec/1.1.1 linux-x64 node-v18.17.0

Encountering permission errors when installing or running OpenSpec.

Solutions:

Run PowerShell or Command Prompt as administrator:

  1. Right-click PowerShell or Command Prompt
  2. Select “Run as administrator”
  3. Re-run the installation command

Issue: npm Installation Fails or is Very Slow

Section titled “Issue: npm Installation Fails or is Very Slow”

Unable to download OpenSpec from npm registry due to network reasons.

Solutions:

  1. Use Domestic npm Mirror:
Terminal window
# Use Taobao mirror
npm config set registry https://registry.npmmirror.com
# Then reinstall
npm install -g @fission-ai/openspec@1
  1. Restore Official Source (if needed):
Terminal window
npm config set registry https://registry.npmjs.org
  1. Use cnpm (optional):
Terminal window
npm install -g cnpm --registry=https://registry.npmmirror.com
cnpm install -g @fission-ai/openspec@1

Issue: OpenSpec Commands Run Abnormally or Report Errors

Section titled “Issue: OpenSpec Commands Run Abnormally or Report Errors”

The installed OpenSpec version is incompatible with the current environment.

Solutions:

  1. Check Node.js Version:
Terminal window
node --version

Ensure the version is 18.0 or higher. If the version is too low, please upgrade Node.js.

  1. Check OpenSpec Version:
Terminal window
openspec --version
  1. Reinstall Specific Version:
Terminal window
npm install -g @fission-ai/openspec@1
  1. Clear npm Cache (if problem persists):
Terminal window
npm cache clean --force
npm install -g @fission-ai/openspec@1

Issue: Typing openspec Command Shows “Command Not Found”

Section titled “Issue: Typing openspec Command Shows “Command Not Found””

OpenSpec is installed but the system cannot find the command.

Solutions:

  1. Confirm npm global installation path:
Terminal window
npm config get prefix
  1. Add path to system PATH:
    • Open “System Properties” → “Advanced” → “Environment Variables”
    • Find Path in “System variables”
    • Add npm global path (usually C:\Users\<username>\AppData\Roaming\npm)
    • Restart command line window

If you need to reinstall a specific version:

Terminal window
npm install -g @fission-ai/openspec@1

If you need to uninstall OpenSpec:

Terminal window
npm uninstall -g @fission-ai/openspec

After OpenSpec installation is complete, you can continue with the following steps:

If you encounter issues not covered here:

  1. Check OpenSpec GitHub Issues for similar problems
  2. Visit OpenSpec Official Documentation for more information
  3. Refer to related guides on the HagiCode documentation site for additional help