Skip to content

CLI Reference ​

This page is generated from the repository README and CLI command source so the published reference stays aligned with the shipped package.

Install ​

bash
npm install -g optymd

Or use directly:

bash
npx optymd scan .
npx optymd scan CLAUDE.md

Command overview ​

CommandDescription
opty diff [path]Show before/after diff for auto-fixable changes
opty fix [path]Auto-fix safe issues and interactively review suggestions
opty init [platform]Scaffold agent config files for a platform
opty restore [path]Restore agent config files from a backup
opty scan [path]Scan agent config files and report quality
opty score [path]Output project quality grade
opty verify [path]Compare repo behavior with rule intent using local git, repo config, and GitHub evidence when available
opty watch [path]Watch config files and re-scan on change

opty diff [path] ​

Show before/after diff for auto-fixable changes

Examples ​

bash
opty diff .

Options ​

  • No command-specific options.

opty fix [path] ​

Auto-fix safe issues and interactively review suggestions

Examples ​

bash
opty fix --dry-run
opty fix .
opty fix . --auto-only

Options ​

  • --dry-run - show fix plan without applying
  • --auto-only - only apply AUTO fixes, skip interactive suggestions

opty init [platform] ​

Scaffold agent config files for a platform

Examples ​

bash
opty init claude
opty init openclaw

Options ​

  • No command-specific options.

opty restore [path] ​

Restore agent config files from a backup

Examples ​

bash
opty restore
opty restore --id 20260416-120301

Options ​

  • --id <id> - specific backup ID to restore

opty scan [path] ​

Scan agent config files and report quality

Examples ​

bash
opty scan .
opty scan CLAUDE.md
opty scan . --verbose

Options ​

  • --verbose - include per-file dimension breakdown for the worst 10 files

opty score [path] ​

Output project quality grade

Examples ​

bash
opty score .
opty score . --badge

Options ​

  • --badge - output shields.io badge JSON to .opty/badge.json

opty verify [path] ​

Compare repo behavior with rule intent using local git, repo config, and GitHub evidence when available

Examples ​

bash
opty verify .
opty verify . --json
opty verify . --fail-on-violations

Options ​

  • --json - output the verify report as JSON
  • --fail-on-violations - exit with code 2 when any verify rule is violated

opty watch [path] ​

Watch config files and re-scan on change

Examples ​

bash
opty watch .

Options ​

  • No command-specific options.

CI and PR integration ​

Add opty to your PR workflow for automatic config quality checks or verify-based rule enforcement.

Score mode stays backward compatible and lets you gate on the numeric score:

yaml
name: opty
on: [pull_request]
jobs:
  score:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - uses: AytuncYildizli/opty/action@v1
        with:
          path: .
          fail-below: 50

Verify mode runs opty verify --json --fail-on-violations, exposes machine-readable outputs, and fails CI when rule violations are found:

yaml
name: opty-verify
on: [pull_request]
jobs:
  verify:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - id: opty
        uses: AytuncYildizli/opty/action@v1
        with:
          mode: verify
          path: .
      - name: Read verify outputs
        run: |
          echo "Spec status: ${{ steps.opty.outputs.spec_status }}"
          echo "Spec adherence: ${{ steps.opty.outputs.spec_adherence }}"
          echo "Violation count: ${{ steps.opty.outputs.violation_count }}"
          echo "Default branch: ${{ steps.opty.outputs.default_branch }}"
InputDefaultDescription
modescoreAction mode: score or verify
path.Project root to scan
fail-below0Fail CI if score is below this threshold (score mode only, 0-100)
commenttruePost a score or verify summary as a PR comment (pull_request events only)
OutputAvailable inDescription
modescore, verifyExecuted action mode
scorescoreParsed score value
gradescoreParsed score grade
spec_adherenceverifyVerify adherence percentage, blank when unknown
spec_statusverifyVerify status: STABLE, DRIFTING, or UNKNOWN
violation_countverifyTotal counted rule violations
default_branchverifyDetected default branch
analyzed_refverifyGit ref used for local git evidence