sd
$ sd Community Med Risksd replaces cryptic sed delimiters with modern JS/Rust regex syntax and -F fixed-string mode. While stdin transformations stay read-only, passing file paths edits them in-place by default—making -p (--preview) mandatory before committing changes.
brew install sd Direct sd -p runs locally on files in milliseconds; no MCP wrapper is warranted for text replacement.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Clean non-interactive regex/literal interface with -p preview, though it has no --json output.
- Supports
-p/--previewand-F/--fixed-strings
Safe on stdin or with -p, but passing file arguments without -p mutates files in-place immediately.
- In-place write is default for file arguments unless
-pis given
Single Rust binary available via brew, cargo, and OS package managers.
- Cross-platform binary across macOS, Linux, and Windows
Avoids sed -i macOS/GNU portability differences and delimiter-escaping mistakes.
- Consistent syntax across macOS and Linux unlike
sed -i
Well-established OSS utility (chmln/sd) with clean Rust dependencies.
- Maintained MIT-licensed repository
Concise --help and README with clear regex and -F examples.
- Straightforward README and
--helpoutput
Security, Auth & Guardrails
None required; operates purely on local text streams or files.
100% free, offline, and open-source (MIT).
# sd Agent Rules - ALWAYS run `sd -p` (`--preview`) on target files before omitting `-p` to modify files in-place. - Prefer `-F` (`--fixed-strings`) when replacing literal identifiers, dots, or URLs.
Agent-Ready Command Recipes
Safe Read-Only Queries
sd -p 'http://' 'https://' config.toml
Uses -p (--preview) to print proposed changes to stdout without modifying config.toml.
Controlled Writes & Previews
sd -F 'old_endpoint' 'new_endpoint' src/client.ts
Uses -F literal matching (avoiding regex escaping bugs) to update src/client.ts in-place.
Strengths for Agents
- + Eliminates GNU vs BSD
sed -isyntax incompatibilities across macOS and Linux. - + Provides
-pdry-run preview and-Fliteral string matching.
Caveats & Pitfalls
- ! Passing file paths without
-pwrites changes in-place immediately without confirmation. - ! Does not recurse directories by itself—combine with
fd -Xcarefully after previewing.