Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

srgn

$ srgn Community Low Risk
alexpovel · Files & Search · MIT · macos / linux / windows

srgn combines regex matching with Tree-sitter syntax scopes (such as --rust comments, --python strings, or --ts-imports) to search or transform only specific AST regions. Stdin mode is read-only, while --glob edits matched files in-place unless --dry-run is passed.

FCRS-1.0 Score
85 /100
Good
Medium Confidence
Zero-Friction Install
brew install srgn
CLI vs MCP Decision CLI Only

Tree-sitter scoped local search and diff preview (--dry-run) execute natively on files in milliseconds.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
✓ Read-Only Mode
✓ NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Non-interactive, supports --dry-run diff previews and -- separator safety, though it outputs plain text/diffs without --json.

  • Supports --dry-run with --glob and language scope flags
  • No --json output mode
Trust & Safety 23 / 25

Stdin mode is read-only and --glob supports --dry-run previews, though forgetting --dry-run with --glob overwrites files in-place.

  • --dry-run prevents destructive writes when testing --glob transforms
Setup & Portability 13 / 15

Single Rust binary via brew install srgn, cargo install srgn, and GitHub Releases across macOS, Linux, and Windows.

  • Zero runtime dependencies; static Rust binary
Utility & Efficiency 12 / 15

Unique Tree-sitter grammar scoping (comments, strings, docstrings, function bodies) avoids false-positive regex replacements.

  • Scoping flags for Rust, Python, TypeScript, Go, C, etc.
Maintenance & Lineage 8 / 10

Actively developed Rust tool (alexpovel/srgn) under the MIT license.

  • Active GitHub repository under MIT
Docs & Verifiability 8 / 10

Well-structured README and --help documenting every language scope and action flag.

  • Comprehensive scope/action reference in README

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; operates purely on local stdin or workspace files.

Side Effects
Read-Only Local Write
Cost & Quotas

100% free, offline, and open-source (MIT).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# srgn Agent Rules
- ALWAYS pass `--dry-run` when using `--glob` (`-G`), because `--glob` writes replacements in-place by default.
- Separate replacement strings with `--` (e.g., `srgn ... 'pattern' -- 'replacement'`) to prevent flag ambiguity.

Agent-Ready Command Recipes

Safe Read-Only Queries

Search inside Rust comments without modifying files
srgn --glob 'src/**/*.rs' --dry-run --rust 'comments' 'TODO'

Matches TODO strictly inside Rust comment nodes and prints a diff/match preview without modifying files.

Dry-run replacement scoped to Python strings
srgn --glob '**/*.py' --dry-run --python 'strings' 'http://' -- 'https://'

Previews replacing http:// inside Python string literals only (--dry-run keeps files untouched).

Controlled Writes & Previews

Apply syntax-scoped replacement across globbed files
srgn --glob 'src/**/*.rs' --rust 'comments' 'old_term' -- 'new_term'

Replaces old_term only within Rust comment AST nodes across matched files in-place.

Strengths for Agents

  • + Language-aware Tree-sitter scoping (--rust 'comments', --python 'strings') prevents unintended edits in unrelated syntax.
  • + --dry-run renders clear change previews before committing --glob edits.

Caveats & Pitfalls

  • ! Using --glob with an action or replacement overwrites files in-place unless --dry-run is passed.
  • ! No --json output format.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI