# anspar-wf

Development toolchain for requirement-traceable software projects. Provides CLI tools for development workflow, requirement validation, and optional Claude Code plugins.

## Quick Start

```bash
# Clone and install
git clone https://github.com/Anspar-Org/anspar-wf.git ~/anspar-wf
cd ~/anspar-wf
pip install -e .

# Install external dev tools (gitleaks, squawk, elspais, markdownlint)
anspar-wf install

# Set up git hooks for your project
anspar-wf hooks --project-dir ~/your-project

# (Optional) Register Claude Code plugins
anspar-wf plugins register --project-dir ~/your-project
```

Or use the all-in-one installer:

```bash
~/anspar-wf/install.sh --project-dir ~/your-project --with-claude
```

## What's Included

### CLI Tools (`anspar-wf`)

| Command | Description |
|---------|-------------|
| `anspar-wf install` | Install/update external tools at pinned versions |
| `anspar-wf check` | Verify tool versions match versions.lock |
| `anspar-wf hooks` | Configure git hooks for a project |
| `anspar-wf validate` | Validate requirement format and references |
| `anspar-wf trace` | Generate requirement traceability views |
| `anspar-wf serve` | Serve trace_view HTML reports |
| `anspar-wf plugins register` | Register Claude Code plugin marketplace |
| `anspar-wf mcp traceability` | Start requirement-traceability MCP server |
| `anspar-wf mcp compliance` | Start compliance-verification MCP server |

### External Tool Management

The `versions.lock` file pins versions of external tools used in CI and local development:

- **gitleaks** - Secret detection (pre-commit, CI)
- **squawk** - PostgreSQL migration linter (CI)
- **elspais** - Requirement validation and traceability (pre-commit, CI)
- **markdownlint-cli** - Documentation linting (pre-commit, CI)

Run `anspar-wf install` to install them. Run `anspar-wf check --versions-env .github/versions.env` to verify your project's CI pins are in sync.

### Claude Code Plugins (Optional)

Three plugins for developers using Claude Code:

- **workflow** - Ticket lifecycle management, branch protection, task-switch detection
- **spec-compliance** - AI-powered content validation for spec/ files
- **plugin-wizard** - Scaffold new Claude Code plugins

### MCP Servers (Optional)

For Claude Code / MCP client integration:

- **traceability** - Requirement-to-ticket mapping and coverage analysis
- **compliance** - FDA 21 CFR Part 11 verification workflows

Configure in your project's `.mcp.json`:

```json
{
  "mcpServers": {
    "traceability": {
      "command": "anspar-wf",
      "args": ["mcp", "traceability"]
    },
    "compliance": {
      "command": "anspar-wf",
      "args": ["mcp", "compliance"]
    }
  }
}
```

## For Non-Claude Users

Claude Code plugins are entirely optional. If you don't use Claude Code:

```bash
pip install -e ~/anspar-wf
anspar-wf install                              # Install CI tools
anspar-wf hooks --project-dir ~/your-project   # Set up git hooks
```

This gives you all CI-enforced tools and git hooks without any Claude dependencies.

## CI Integration

Add to your GitHub Actions workflow:

```yaml
- name: Setup anspar-wf
  run: |
    pip install git+https://github.com/Anspar-Org/anspar-wf.git
    anspar-wf install
```

Or validate version alignment:

```yaml
- name: Check tool versions
  run: anspar-wf check --versions-env .github/versions.env
```

## Development

```bash
pip install -e ".[dev]"
pytest
ruff check src/
```
