Install OpenSpec
Install OpenSpec
Section titled “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.
What is OpenSpec?
Section titled “What is OpenSpec?”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
Application in HagiCode Projects
Section titled “Application in HagiCode Projects”In HagiCode projects, OpenSpec is used for:
- Feature Development Management: All new features must go through the OpenSpec proposal process
- Code Review: Ensure changes comply with project specifications
- Documentation Synchronization: Maintain consistency between documentation and code implementation
- Version Control Integration: Seamless integration with version control workflows
Prerequisites
Section titled “Prerequisites”Before installing OpenSpec, ensure your system meets the following requirements:
Node.js and npm
Section titled “Node.js and npm”OpenSpec is distributed via npm and requires a Node.js environment. OpenSpec requires Node.js 18.0 or higher.
Verify Node.js installation:
node --versionVerify npm installation:
npm --versionIf not installed or the version is too old, please refer to the related software installation instructions in the Installation Guide.
Installing OpenSpec
Section titled “Installing OpenSpec”OpenSpec is installed globally via npm, making it available from anywhere on your system.
Install Globally Using npm
Section titled “Install Globally Using npm”Run in PowerShell or Command Prompt:
npm install -g @fission-ai/openspec@1Run in Terminal:
npm install -g @fission-ai/openspec@1Run in Terminal:
npm install -g @fission-ai/openspec@1Verify Installation
Section titled “Verify Installation”After installation, verify that OpenSpec is installed correctly and the version meets requirements:
openspec --versionIf installed successfully, you will see a version number output, for example:
openspec/1.1.1 linux-x64 node-v18.17.0Common Issues and Troubleshooting
Section titled “Common Issues and Troubleshooting”Permission Errors
Section titled “Permission Errors”Issue: EACCES Permission Denied
Section titled “Issue: EACCES Permission Denied”Encountering permission errors when installing or running OpenSpec.
Solutions:
Run PowerShell or Command Prompt as administrator:
- Right-click PowerShell or Command Prompt
- Select “Run as administrator”
- Re-run the installation command
Install using sudo:
sudo npm install -g @fission-ai/openspec@1Or use nvm to manage Node.js and avoid global installation permission issues.
Solution 1: Use sudo
sudo npm install -g @fission-ai/openspec@1Solution 2: Configure npm to use user directory
mkdir -p ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrcnpm install -g @fission-ai/openspec@1Network Issues
Section titled “Network Issues”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:
- Use Domestic npm Mirror:
# Use Taobao mirrornpm config set registry https://registry.npmmirror.com
# Then reinstallnpm install -g @fission-ai/openspec@1- Restore Official Source (if needed):
npm config set registry https://registry.npmjs.org- Use cnpm (optional):
npm install -g cnpm --registry=https://registry.npmmirror.comcnpm install -g @fission-ai/openspec@1Version Compatibility Issues
Section titled “Version Compatibility Issues”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:
- Check Node.js Version:
node --versionEnsure the version is 18.0 or higher. If the version is too low, please upgrade Node.js.
- Check OpenSpec Version:
openspec --version- Reinstall Specific Version:
npm install -g @fission-ai/openspec@1- Clear npm Cache (if problem persists):
npm cache clean --forcenpm install -g @fission-ai/openspec@1Command Not Found
Section titled “Command Not Found”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:
- Confirm npm global installation path:
npm config get prefix- Add path to system PATH:
- Open “System Properties” → “Advanced” → “Environment Variables”
- Find
Pathin “System variables” - Add npm global path (usually
C:\Users\<username>\AppData\Roaming\npm) - Restart command line window
- Confirm npm global installation path:
npm config get prefix- Add path to PATH (in
~/.zshrcor~/.bash_profile):
export PATH="$(npm config get prefix)/bin:$PATH"- Reload configuration:
source ~/.zshrc- Confirm npm global installation path:
npm config get prefix- Add path to PATH (in
~/.bashrc):
export PATH="$(npm config get prefix)/bin:$PATH"- Reload configuration:
source ~/.bashrcUpgrading OpenSpec
Section titled “Upgrading OpenSpec”If you need to reinstall a specific version:
npm install -g @fission-ai/openspec@1Uninstalling OpenSpec
Section titled “Uninstalling OpenSpec”If you need to uninstall OpenSpec:
npm uninstall -g @fission-ai/openspecnpm uninstall -g @fission-ai/openspecOr use sudo:
sudo npm uninstall -g @fission-ai/openspecnpm uninstall -g @fission-ai/openspecOr use sudo:
sudo npm uninstall -g @fission-ai/openspecNext Steps
Section titled “Next Steps”After OpenSpec installation is complete, you can continue with the following steps:
Need More Help?
Section titled “Need More Help?”If you encounter issues not covered here:
- Check OpenSpec GitHub Issues for similar problems
- Visit OpenSpec Official Documentation for more information
- Refer to related guides on the HagiCode documentation site for additional help