Installation

SOVR Patch runs as a CLI tool. Install globally or use via npx.

Install globallybash
# Install globally (recommended for frequent use)
npm install -g sovr-patch

# Verify installation
sovr-patch --help
Use without installingbash
# Run directly with npx (always latest version)
npx sovr-patch run --rule field-rename \
  --from "config.baseUrl" --to "config.apiBaseUrl" \
  --repo ./my-project
Requirements
  • Node.js 18+ (LTS recommended)
  • TypeScript project with tsconfig.json
  • No network required for scanning (offline-first)

Quick Start

This walkthrough takes you from zero to a completed migration in under 5 minutes. We'll rename config.baseUrl to config.apiBaseUrl across a real TypeScript project.

Scenario

Your team decided to rename the API config field from baseUrl to apiBaseUrl for clarity. The field is referenced in type definitions, property access, destructuring patterns, and this. chains across 22 files. Manual rename would take hours and risk missing references. SOVR Patch does it in seconds.

Step 1: Install SOVR Patch

Install globally for repeated use, or run directly with npx.

Installbash
# Option A: Install globally
npm install -g sovr-patch

# Option B: Run without installing (always latest)
npx sovr-patch --help

Step 2: Dry-run scan (free, no files changed)

Run a dry-run to discover every reference. No files are modified — this is always free.

Scan your projectbash
sovr-patch run --rule field-rename \
  --from "config.baseUrl" \
  --to "config.apiBaseUrl" \
  --repo ./my-project \
  --report

Step 3: Review the output

The engine shows every hit with its classification. Safe hits get patches. Ambiguous hits are flagged for manual review.

Example outputtext
Rule: field-rename
Repo: /projects/my-project

Scanning 22 TypeScript files...

Hits:          13
  safe:        12
  ambiguous:    1
  unsafe:       0
Patches:       12
Changed files:  3
Verify:        PASS
Applied:       no (dry-run)

─── src/api/client.ts ───
  L4:  const url = `${this.config.baseUrl}${path}`  [SAFE → PATCH]
  L12: return this.config.baseUrl                       [SAFE → PATCH]

─── src/config.ts ───
  L4:  baseUrl: "https://api.example.com"               [SAFE → PATCH]

─── src/types.ts ───
  L2:  baseUrl: string                                  [SAFE → PATCH]

Dry-run complete.
Safe apply is locked on the free plan.

Unlock options:
  Safe TS Migration Pack — $99
  Full Engine — $249

→ sovr.app/patch/pricing

Step 4: Activate your license

After purchasing, download your license.json and activate it. The license is verified locally — no network call needed.

Activate licensebash
# Download license.json from your purchase confirmation page
# Then activate it:
sovr-patch activate license.json

# Expected output:
# License activated successfully.
#   Plan:    Safe TS Migration Pack
#   Email:   [email protected]
#   Rules:   field-rename, nullish-fallback
#   Expires: 3/7/2027

# Verify activation:
sovr-patch status

Step 5: Apply with safe-apply

Add --apply to write changes. The engine copies your project to a temp directory, applies patches, runs tsc --noEmit, and only writes to your real files if the compiler says yes.

Safe applybash
sovr-patch run --rule field-rename \
  --from "config.baseUrl" \
  --to "config.apiBaseUrl" \
  --repo ./my-project \
  --apply
Expected outputtext
Rule: field-rename
Repo: /projects/my-project

Scanning 22 TypeScript files...

Hits:          13
Patches:       12
Changed files:  3
Verify:        PASS ✓
Applied:       yes (3 files written)

Done. All patches applied and verified.

Step 6: Verify and commit

Check the diff, run your own tests, and commit.

Post-apply workflowbash
# Review what changed
git diff

# Run your project's tests
npm test

# If something went wrong, rollback instantly
sovr-patch rollback

# All good? Commit.
git add -A && git commit -m "refactor: rename config.baseUrl → config.apiBaseUrl"
What's next?
  • Try sovr-patch audit --pack safe-ts-migration --repo ./my-project to scan for all migration opportunities
  • Use --json flag to pipe output into your CI pipeline
  • Check sovr-patch status --verbose to see all unlocked rules
  • Read the AI Tool Integration section to use with Cursor, Claude Code, or Copilot

Commands

Complete reference for every CLI command.

sovr-patch run

Run a rule against a repository. By default performs a dry-run (no file changes). Add --apply to write patches after verification.

ParameterTypeRequiredDescription
--rulestringrequiredRule to execute (e.g., field-rename, nullish-fallback)
--repopathdefault: .Path to target repository
--tsconfigpathdefault: <repo>/tsconfig.jsonPath to tsconfig.json
--applyflagoptionalApply patches to real files (requires license + tsc verification)
--no-verifyflagoptionalSkip tsc verification in dry-run mode
--jsonflagoptionalOutput results as JSON
--reportflagoptionalPrint summary report
--report-filepathoptionalWrite JSON report to file
Examplesbash
# Basic dry-run with report
sovr-patch run --rule field-rename \
  --from "config.baseUrl" --to "config.apiBaseUrl" \
  --repo ./my-project --report

# Apply with safe-apply verification
sovr-patch run --rule field-rename \
  --from "plan.yearlyPrice" \
  --to "plan.prices.find(p => p.interval === 'year')?.amount" \
  --fallback "0" --repo ./my-project --apply

# Output as JSON for CI integration
sovr-patch run --rule nullish-fallback \
  --target "response.data" --fallback "null" \
  --repo ./api-server --json

# Save report to file
sovr-patch run --rule field-rename \
  --from "user.name" --to "user.displayName" \
  --repo ./app --report-file ./migration-report.json

sovr-patch scan

Alias for run without --apply. Always performs a dry-run. Accepts the same parameters as run.

Examplebash
# Equivalent to: sovr-patch run --rule field-rename ...
sovr-patch scan --rule field-rename \
  --from "config.baseUrl" --to "config.apiBaseUrl" \
  --repo ./my-project

sovr-patch audit

Audit a repository to quantify migration debt before changing code. Supports single-rule and pack modes.

ParameterTypeRequiredDescription
--rulestringoptionalSingle rule to audit (e.g., design-token)
--packstringoptionalAudit pack to run (safe-ts-migration or frontend-refactor)
--repopathdefault: .Path to target repository
--tsconfigpathdefault: <repo>/tsconfig.jsonPath to tsconfig.json
--jsonflagoptionalOutput audit report as JSON
--report-filepathoptionalWrite JSON audit report to file
Examplesbash
# Audit a single rule
sovr-patch audit --rule design-token \
  --repo ./web-app \
  --map "#ff0000:var(--sovr-danger),#00ff88:var(--sovr-success)"

# Audit an entire pack
sovr-patch audit --pack frontend-refactor --repo ./web-app

# Export audit report as JSON
sovr-patch audit --pack safe-ts-migration \
  --repo ./api-server --json

# Save audit report to file
sovr-patch audit --pack safe-ts-migration \
  --repo ./api-server --report-file ./audit-report.json
Available Packs
safe-ts-migration — field-rename + nullish-fallback
frontend-refactor — design-token + inline-style

sovr-patch status

Check your current license status, plan, available rules, and expiry date.

ParameterTypeRequiredDescription
--jsonflagoptionalOutput license status as JSON
--verboseflagoptionalShow additional details (file path, signature info)
Examplesbash
# Check license status
sovr-patch status

# JSON output (for scripts)
sovr-patch status --json

# Verbose output with file path and signature details
sovr-patch status --verbose
Example outputtext
  SOVR Patch — License Status
  ─────────────────────────────────
  Plan:     Full Engine
  Email:    [email protected]
  Expires:  2027-03-07
  Status:   Active ✓

  Licensed rules:
    ✓ field-rename
    ✓ nullish-fallback
    ✓ design-token
    ✓ inline-style

sovr-patch activate

Activate a signed license file to unlock safe-apply. The license is verified locally using Ed25519 signature — no network required.

ParameterTypeRequiredDescription
<license.json>pathrequiredPath to the signed license file downloaded after purchase
--keystringoptionalLegacy: verify key against API (deprecated)
--statusflagoptionalCheck current license (alias for 'status' command)
--deactivateflagoptionalRemove current license from this machine
Examplesbash
# Activate with signed license file (recommended)
sovr-patch activate license.json

# Activate from a specific path
sovr-patch activate ~/Downloads/sovr-license.json

# Check current license status
sovr-patch activate --status

# Remove license from this machine
sovr-patch activate --deactivate

sovr-patch list-rules

List all available rules with their descriptions and required parameters.

Examplebash
sovr-patch list-rules
Example outputtext
Available rules:
  field-rename
    Safe TypeScript field rename across value refs, property keys, and type fields.

  nullish-fallback
    Inject ?? fallback for repeated property access targets.

  design-token
    Replace hardcoded hex color values with CSS custom property references.

  inline-style
    Convert JSX inline style objects to className strings.

sovr-patch ci-gate

CI enforcement gate. Fails the build if migration debt exceeds the threshold. Requires Full Engine or Enterprise license.

ParameterTypeRequiredDescription
--rulesstringrequiredComma-separated rules to check
--max-hitsnumberdefault: 0Max allowed hits before failing
--repopathdefault: .Path to target repository
--report-filepathoptionalWrite combined JSON report to file
--jsonflagoptionalOutput results as JSON
Examplesbash
# Block PRs with any migration debt
sovr-patch ci-gate \
  --rules field-rename,nullish-fallback \
  --repo ./my-project --max-hits 0

# Allow up to 5 hits (gradual migration)
sovr-patch ci-gate \
  --rules field-rename \
  --max-hits 5 --repo ./my-project

# Save CI report for artifact upload
sovr-patch ci-gate \
  --rules field-rename,nullish-fallback \
  --repo ./my-project \
  --report-file ./sovr-ci-report.json
GitHub Actions exampleyaml
# .github/workflows/sovr-gate.yml
name: SOVR Migration Gate
on: [pull_request]
jobs:
  migration-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npx sovr-patch ci-gate \
          --rules field-rename,nullish-fallback \
          --max-hits 0 \
          --report-file sovr-report.json
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: sovr-migration-report
          path: sovr-report.json

sovr-patch rollback

Rollback applied patches using automatically created checkpoints. Every --apply creates a checkpoint before writing.

ParameterTypeRequiredDescription
--listflagoptionalList all available checkpoints
--checkpointstringoptionalTimestamp of the checkpoint to restore
--repopathdefault: .Path to target repository
--jsonflagoptionalOutput results as JSON
Examplesbash
# List available checkpoints
sovr-patch rollback --list --repo ./my-project

# Rollback to a specific checkpoint
sovr-patch rollback \
  --checkpoint "2026-03-07T10:30:00.000Z" \
  --repo ./my-project

Rules Reference

Detailed reference for each rule, including what it detects, how it classifies hits, and the required configuration.

field-rename

P0PACK ASafe TS Migration

Safe TypeScript field rename across value refs, property keys, type fields, this. chains, destructuring patterns, and shorthand properties. Handles all AST node types that reference the target field.

ParameterTypeRequiredDescription
--fromstringrequiredSource field path (e.g., "config.baseUrl", "plan.yearlyPrice")
--tostringrequiredTarget field path (e.g., "config.apiBaseUrl")
--fallbackstringoptionalFallback value for nullish coalescing (e.g., "0")
--include-thisflagoptionalAlso scan this.<from> chains
What it detectstypescript
// All of these are detected and renamed:
config.baseUrl                    // property access
this.config.baseUrl               // this. chain (with --include-this)
const { baseUrl } = config;       // destructuring
type Config = { baseUrl: string } // type field
interface IConfig { baseUrl: string } // interface field
{ baseUrl: config.baseUrl }       // shorthand property
Full examplebash
sovr-patch run --rule field-rename \
  --from "config.baseUrl" \
  --to "config.apiBaseUrl" \
  --include-this \
  --repo ./my-project \
  --apply --report

nullish-fallback

P0PACK ASafe TS Migration

Inject ?? fallback for repeated property access targets. Chain-aware: wraps entire optional chains. Operator-precedence-aware: adds parentheses in binary expressions.

ParameterTypeRequiredDescription
--targetstringrequiredTarget property access (e.g., "response.data", "plan.yearlyPrice")
--fallbackstringrequiredFallback value (e.g., "null", "0", "[]")
What it transformstypescript
// Before:
return response.data?.items;
if (plan.yearlyPrice > 100) {

// After:
return (response.data ?? null).items;
if ((plan.yearlyPrice ?? 0) > 100) {
Full examplebash
sovr-patch run --rule nullish-fallback \
  --target "response.data" \
  --fallback "null" \
  --repo ./api-server \
  --apply

design-token

P1PACK BDUAL-MODEFrontend Refactor

Replace hardcoded hex color values with CSS custom property references. Supports dual-mode: audit mode discovers all hex colors zero-config, run mode applies replacements using presets or custom maps.

ParameterTypeRequiredDescription
--mapstringoptionalComma-separated hex:token pairs. Required for run mode. (e.g., "#ff0000:var(--sovr-danger)")
--presetstringoptionalUse a built-in preset instead of --map. Available: sovr-core, all-hex
Audit mode (zero-config discovery)bash
# Discover all hardcoded hex colors — no map needed
sovr-patch audit --rule design-token --repo ./web-app

# Use a preset for smarter classification
sovr-patch audit --rule design-token --preset sovr-core --repo ./web-app
What it transforms (run mode)typescript
// Before:
const errorColor = "#ff0000";
const successColor = "#00FF88";
const style = `color: #ff0000`;

// After:
const errorColor = "var(--sovr-danger)";
const successColor = "var(--sovr-success)";
const style = `color: var(--sovr-danger)`;
Run with presetbash
# Use built-in sovr-core preset (maps common colors to CSS vars)
sovr-patch run --rule design-token --preset sovr-core --repo ./web-app --apply

# Or use a custom map
sovr-patch run --rule design-token \
  --map "#ff0000:var(--sovr-danger),#00ff88:var(--sovr-success)" \
  --repo ./web-app --apply

Available presets:

sovr-core — 12 common colors mapped to CSS custom properties (--sovr-danger, --sovr-success, etc.)
all-hex — Discover all hex colors (audit-only, no replacements)

inline-style

P1PACK BDUAL-MODEFrontend Refactor

Convert JSX inline style objects to className strings. Supports dual-mode: audit mode discovers all inline styles zero-config, run mode applies replacements using presets or custom maps. Full-match produces a safe replace. Partial-match is flagged as ambiguous.

ParameterTypeRequiredDescription
--mapstringoptionalComma-separated style:class pairs. Required for run mode. (e.g., "color:red:text-red")
--presetstringoptionalUse a built-in preset instead of --map. Available: tailwind-common
Audit mode (zero-config discovery)bash
# Discover all inline styles — no map needed
sovr-patch audit --rule inline-style --repo ./web-app

# Use tailwind-common preset for smarter classification
sovr-patch audit --rule inline-style --preset tailwind-common --repo ./web-app
What it transforms (run mode)tsx
// Before:
<div style={{ color: "red" }}>Error</div>
<span style={{ fontSize: "14px" }}>Small text</span>

// After:
<div className="text-red">Error</div>
<span className="text-sm">Small text</span>
Run with presetbash
# Use built-in tailwind-common preset
sovr-patch run --rule inline-style --preset tailwind-common --repo ./web-app --apply

# Or use a custom map
sovr-patch run --rule inline-style \
  --map "color:red:text-red,color:blue:text-blue" \
  --repo ./web-app --apply

Available presets:

tailwind-common — 20+ common CSS-to-Tailwind mappings (color, font-size, display, etc.)

Presets

Presets are built-in mapping tables that eliminate the need to manually specify --map arguments. They provide curated color-to-token and style-to-class mappings for common frameworks and design systems.

sovr-core

Maps 12 common hex colors to SOVR CSS custom properties. Ideal for projects adopting a SOVR-style design system.

Usagebash
# Audit with preset
sovr-patch audit --rule design-token --preset sovr-core --repo ./app

# Run with preset
sovr-patch run --rule design-token --preset sovr-core --repo ./app --apply

Included mappings (12 colors):

#ff0000 var(--sovr-danger)
#00ff88 var(--sovr-success)
#ffb800 var(--sovr-warning)
#0066cc var(--sovr-info)
... and 8 more (primary, secondary, bg, surface, border, text, muted, accent)

tailwind-common

Maps 20+ common CSS inline style patterns to Tailwind CSS utility classes. Covers color, font-size, display, text-align, font-weight, and more.

Usagebash
# Audit with preset
sovr-patch audit --rule inline-style --preset tailwind-common --repo ./app

# Run with preset
sovr-patch run --rule inline-style --preset tailwind-common --repo ./app --apply

Sample mappings:

color: "red" text-red-500
fontSize: "14px" text-sm
display: "flex" flex
fontWeight: "bold" font-bold
... and 16+ more mappings

Custom presets

You can always override presets with --map. When both --preset and --map are provided, the custom map takes precedence. Custom preset files are planned for a future release.

Licensing

SOVR Patch uses offline signed licenses. No license server. No phone-home. Your license is a JSON file verified locally with Ed25519 cryptography.

How it works

1.Purchase a plan at sovr.app/patch/pricing
2.Download license.json from the confirmation page
3.Run sovr-patch activate license.json
4.License is stored at ~/.sovr-patch/license.json
5.All verification happens locally — no network calls

Plans

PlanPriceRulesSafe Apply
Free$0All (dry-run only)No
Pack A$99field-rename, nullish-fallbackYes
Pack B$99design-token, inline-styleYes
Full Engine$249All rulesYes
EnterpriseCustomAll + custom rulesYes + CI gate

Environment variables

ParameterTypeRequiredDescription
SOVR_LICENSE_PATHpathoptionalOverride the default license file location (~/.sovr-patch/license.json)
SOVR_NO_UPDATE_CHECK0|1optionalSet to 1 to disable automatic update checks

Configuration

SOVR Patch is zero-config by default. All configuration is passed via CLI flags. No config files needed.

TypeScript Configuration

SOVR Patch reads your tsconfig.json to understand your project structure. It uses the same file resolution as tsc.

Custom tsconfig pathbash
# Use a specific tsconfig
sovr-patch run --rule field-rename \
  --from "config.baseUrl" --to "config.apiBaseUrl" \
  --tsconfig ./tsconfig.build.json \
  --repo ./my-project

License Storage

Default:~/.sovr-patch/license.json
Override:SOVR_LICENSE_PATH=/path/to/license.json
CI/CD:Store license.json as a CI secret, set SOVR_LICENSE_PATH

AI Tool Integration

SOVR Patch works with AI coding tools like Cursor, Claude Code, GitHub Copilot, and Windsurf.

Cursor / Claude Code

Add SOVR Patch to your AI tool's context by including it in the project rules or system prompt:

.cursorrules (or equivalent)text
When performing TypeScript field renames or migrations:
1. Use sovr-patch instead of manual find-and-replace
2. Run: npx sovr-patch run --rule field-rename --from "<old>" --to "<new>" --repo . --report
3. Review the output before applying
4. Apply with: npx sovr-patch run --rule field-rename --from "<old>" --to "<new>" --repo . --apply

CI/CD Integration

Use the ci-gate command to block PRs that introduce migration debt:

Environment setup for CIbash
# Store license.json as a CI secret
# Set the path in your CI environment:
export SOVR_LICENSE_PATH=/path/to/license.json

# Disable update checks in CI
export SOVR_NO_UPDATE_CHECK=1

# Run the gate
npx sovr-patch ci-gate \
  --rules field-rename,nullish-fallback \
  --max-hits 0

Troubleshooting

Common Issues

License signature invalid

The license.json file may have been modified after download. Re-download from your Orders page and activate again.

License expired

Licenses include 1 year of updates. After expiry, you can still use the version you have, but --apply will be locked. Purchase a renewal to continue.

tsc verification failed

Safe-apply detected type errors after patching. This means the migration would break your code. Review the tsc output, adjust your rule config, or fix the underlying type issue first.

No tsconfig.json found

SOVR Patch requires a TypeScript project. Ensure tsconfig.json exists at the repo root, or specify it with --tsconfig.

Rule requires config

Some rules need specific parameters. Use sovr-patch list-rules to see required config for each rule, or check the Rules Reference above.

Getting Help