Skip to content

biancalana/OpenSpec.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSpec POSIX Implementation

Overview

This is a minimal POSIX bash rewrite of the OpenSpec CLI tool, designed to run in environments without Node.js. It provides the core functionality for spec-driven development while maintaining compatibility across Unix-like systems.

Features

Core Commands

  • openspec init [path] - Initialize OpenSpec in a project
  • openspec list [--specs] - List changes or specifications
  • openspec validate <name> - Validate change or spec structure
  • openspec archive <name> - Archive completed changes and merge specs

What's Included

  • Directory structure creation
  • Basic file validation
  • Change archiving with spec merging
  • Project context templates
  • Simple change proposal templates

Limitations vs Node.js Version

  • No interactive prompts or wizards
  • No syntax highlighting or spinners
  • Basic validation (no complex schema checking)
  • No AI tool integration or slash command generation
  • Manual spec merging (no delta tracking)
  • No concurrent processing

Usage

Installation

# Copy to your path
sudo cp openspec.sh /usr/local/bin/openspec
sudo chmod +x /usr/local/bin/openspec

# Or use directly
./openspec.sh init

Basic Workflow

# Initialize project
openspec init my-project

# Create change manually
mkdir -p my-project/openspec/changes/add-feature
echo "# Proposal\nAdd new feature" > my-project/openspec/changes/add-feature/proposal.md

# List changes
openspec list

# Validate change
openspec validate add-feature

# Archive change
openspec archive add-feature

Architecture

Directory Structure

openspec/
├── specs/          # Current specifications (source of truth)
├── changes/        # Change proposals
│   ├── [change-name]/
│   │   ├── proposal.md
│   │   ├── tasks.md
│   │   └── specs/  # Spec updates
│   └── archive/    # Archived changes
└── project.md      # Project context

Key Differences from Node.js Version

  1. Dependencies: Eliminated all npm dependencies, using only POSIX utilities
  2. Error Handling: Simple exit codes instead of complex error objects
  3. User Interface: Basic stdout instead of interactive TTY interfaces
  4. File Operations: Shell commands instead of Node.js fs module
  5. Validation: Basic existence checks instead of Zod schema validation

Compatibility

POSIX Compliance

  • Uses only POSIX shell features (/bin/sh compatible)
  • Standard utilities: find, mkdir, grep, sed, cat, echo
  • No bash-specific extensions
  • Cross-platform: Linux, macOS, BSD, WSL

Testing

# Test basic functionality
./openspec.sh init /tmp/test-project
./openspec.sh list /tmp/test-project
./openspec.sh validate --help

# Validate syntax
shellcheck openspec.sh

Migration Path

For teams that need the full OpenSpec experience:

  1. Start with POSIX version for basic spec management
  2. Install Node.js when more features are needed
  3. Migrate to full version with existing openspec/ directory

Contribution

This minimal implementation focuses on core spec management. Extending it should maintain POSIX compatibility and avoid external dependencies beyond standard Unix utilities.

About

OpenSpec POSIX Implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages