### Verify installation Source: https://patchloom.github.io/patchloom/getting-started/installation.html Commands to check the installed version and view available CLI options. ```bash patchloom --version patchloom --help ``` -------------------------------- ### Configure MCP Server in TOML Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Example configuration for an MCP server using the core surface in a TOML-based setup. ```toml [mcp_servers.patchloom] command = "patchloom" args = ["mcp-server"] env = { PATCHLOOM_MCP_SURFACE = "core" } ``` -------------------------------- ### Install via Shell Scripts Source: https://patchloom.github.io/patchloom/getting-started/installation.html Use automated installer scripts for Unix or Windows environments to download and set up the binary. ```bash # Unix (Linux/macOS) curl --proto '=https' --tlsv1.2 -LsSf https://github.com/patchloom/patchloom/releases/latest/download/patchloom-installer.sh | sh # Windows (PowerShell) powershell -ExecutionPolicy ByPass -c "irm https://github.com/patchloom/patchloom/releases/latest/download/patchloom-installer.ps1 | iex" ``` -------------------------------- ### Start MCP Server with Core Surface Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Sets the environment variable to 'core' and starts the MCP server via CLI. ```bash export PATCHLOOM_MCP_SURFACE=core patchloom mcp-server ``` -------------------------------- ### Install Patchloom CLI Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Standard installation commands for various operating systems and package managers. ```bash cargo install patchloom # crates.io brew install patchloom/tap/patchloom # macOS / Linux (Homebrew) npx patchloom --version # npm / GitHub binary ``` ```bash # Windows (recommended) scoop bucket add patchloom https://github.com/patchloom/scoop-bucket scoop install patchloom/patchloom ``` -------------------------------- ### Install Patchloom via Scoop Source: https://patchloom.github.io/patchloom/getting-started/installation.html Recommended installation method for Windows users using the Scoop package manager. ```bash scoop bucket add patchloom https://github.com/patchloom/scoop-bucket scoop install patchloom/patchloom ``` ```bash scoop update scoop update patchloom ``` -------------------------------- ### Install Patchloom via npm Source: https://patchloom.github.io/patchloom/getting-started/installation.html Run Patchloom as a one-shot command or install it globally using npm. ```bash # One-shot (downloads the platform binary on first run) npx patchloom --version # Global install npm install -g patchloom ``` -------------------------------- ### Build from Source Source: https://patchloom.github.io/patchloom/getting-started/installation.html Standard build and installation process using Cargo for Rust 1.95+. ```shell git clone https://github.com/patchloom/patchloom.git cd patchloom cargo install --path . ``` -------------------------------- ### Install via Package Managers Source: https://patchloom.github.io/patchloom/getting-started/installation.html Commands for installing or upgrading Patchloom using winget or Chocolatey. ```shell winget source update winget install Patchloom.Patchloom # or upgrade an existing install winget upgrade Patchloom.Patchloom # Chocolatey (community feed; may trail GitHub latest) choco install patchloom ``` -------------------------------- ### Run MCP Server Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Installs and executes the MCP server for structured tool calls. ```bash cargo install patchloom patchloom mcp-server ``` -------------------------------- ### Enable TLS for HTTP transport Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Start the server with HTTPS support by providing both a certificate and a private key. ```bash patchloom mcp-server --http --host 0.0.0.0 --port 443 \ --tls-cert cert.pem --tls-key key.pem ``` -------------------------------- ### Verify Patchloom MCP Server Installation Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Run this command in your terminal to confirm the MCP server is correctly installed and accessible. ```bash patchloom mcp-server --help ``` -------------------------------- ### Patchloom CLI Usage Examples Source: https://patchloom.github.io/patchloom/blog/community-launch-draft.html Demonstrates common CLI operations including dry-runs, applying changes to YAML files, multi-document selection, and fuzzy replacement with error handling. ```bash REPO=$(git rev-parse --show-toplevel) BIN="${REPO}/target/release/patchloom" # or: BIN=$(which patchloom) S=$(mktemp -d /tmp/patchloom-demo-XXXXXX) cd "$S" printf 'port: 1\n# keep me\n' > app.yaml printf 'name: a\n---\nname: b\n' > stream.yaml echo "=== dry-run (expect changes, no write) ===" "$BIN" doc set app.yaml port 5432 # exit 2 typical without --apply cat app.yaml echo "=== apply structured YAML ===" "$BIN" doc set app.yaml port 5432 --apply cat app.yaml echo "=== multi-doc selector ===" "$BIN" doc set stream.yaml 0.name A --apply "$BIN" doc get stream.yaml 0.name echo "=== fail-closed fuzzy (exact old absent) ===" printf 'const LIVE_NAME: i32 = 1;\n' > f.rs "$BIN" --json replace LIVE_NAAME --new X --fuzzy --apply f.rs || true grep LIVE_NAME f.rs echo "=== agent-rules snippet ===" "$BIN" agent-rules --mode mcp | head -40 echo "=== MCP explore (list_files in core pack since 0.24) ===" # stdio MCP: use your host; CLI has no list_files subcommand # Prefer MCP list_files / search_files over a second filesystem MCP ``` -------------------------------- ### Connect with Rust client Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Example of connecting to the MCP server using the rmcp Rust client with HTTP transport. ```rust #![allow(unused)] fn main() { // Requires `rmcp` 3.x with client + HTTP transport features (see crates.io). use rmcp::ServiceExt; use rmcp::transport::StreamableHttpClientTransport; let transport = StreamableHttpClientTransport::from_uri("http://localhost:8080/mcp"); let client = ().serve(transport).await?; // Negotiate initialize; tool calls go through client.peer().call_tool(...). } ``` -------------------------------- ### Install Patchloom via Cargo Source: https://patchloom.github.io/patchloom/getting-started/installation.html Use the Rust package manager to install the latest version of the Patchloom CLI. ```bash cargo install patchloom ``` -------------------------------- ### Execute Plan JSON Structure Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Example of a structured JSON plan for atomic multi-file operations using the execute_plan tool. ```json { "version": 1, "strict": true, "operations": [ { "op": "doc.set", "path": "package.json", "selector": "version", "value": "2.0.0" }, { "op": "md.replace_section", "path": "AGENTS.md", "heading": "## Commands", "content": "Run make check.\n" }, { "op": "file.create", "path": "REPORT.md", "content": "# Summary\n" } ] } ``` -------------------------------- ### Generate shell completions Source: https://patchloom.github.io/patchloom/getting-started/installation.html Commands to generate and install shell completion scripts for supported shells. ```bash # bash (system-wide; may require sudo and /etc/bash_completion.d in your setup) patchloom completions bash > /etc/bash_completion.d/patchloom # zsh (ensure ~/.zfunc is in $fpath, e.g. via oh-my-zsh custom or compinit) patchloom completions zsh > ~/.zfunc/_patchloom # fish patchloom completions fish > ~/.config/fish/completions/patchloom.fish # elvish patchloom completions elvish > ~/.config/elvish/rc.elv # PowerShell patchloom completions powershell >> $PROFILE ``` -------------------------------- ### Configure HTTP transport Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Commands to start the MCP server using HTTP transport with various host and port configurations. ```bash # Default: listen on 127.0.0.1:8080 patchloom mcp-server --http # Custom port patchloom mcp-server --http --port 3000 # Listen on all interfaces patchloom mcp-server --http --host 0.0.0.0 ``` -------------------------------- ### Install Patchloom via Homebrew Source: https://patchloom.github.io/patchloom/getting-started/installation.html Use these commands to install and update Patchloom on macOS or Linux using the Homebrew package manager. ```bash brew install patchloom/tap/patchloom ``` ```bash brew update brew upgrade patchloom patchloom --version ``` -------------------------------- ### Transaction JSON response Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Example of the JSON output returned after applying a transaction. ```json { "ok": true, "status": "success", "applied": true, "files_changed": 3, "files_created": 0, "files_deleted": 0, "changes": [ { "path": "CHANGELOG.md", "action": "modified" }, { "path": "README.md", "action": "modified", "match_mode": "exact", "match_count": 1 }, { "path": "package.json", "action": "modified" } ], "match_mode": "exact", "match_count": 1 } ``` -------------------------------- ### Check and Update Patchloom Versions Source: https://patchloom.github.io/patchloom/getting-started/installation.html Commands to verify the installed version and update via various package managers. ```bash patchloom --version ``` ```bash brew info patchloom/tap/patchloom ``` ```bash brew upgrade patchloom ``` ```bash scoop update patchloom ``` ```bash cargo install patchloom ``` ```bash cargo install-update -a ``` -------------------------------- ### Call Patchloom tool via MCP Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Example JSON payload sent by an MCP-capable agent to trigger a tool call for updating a YAML file. ```json { "method": "tools/call", "params": { "name": "doc_set", "arguments": { "path": "config.yaml", "selector": "database.port", "value": 5432 } } } ``` -------------------------------- ### Initialize Patchloom Project Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Sets up the project by creating or updating AGENTS.md and configuring MCP settings. ```bash patchloom init ``` -------------------------------- ### Host Integration Workflow Source: https://patchloom.github.io/patchloom/getting-started/embedder-host.html Demonstrates the standard workflow for sandboxed agents, including path containment, content replacement, and applying edits to files or buffers. ```rust #![allow(unused)] fn main() { use patchloom::api::{ replace_in_content, ReplaceOptions, edit_error_kind, EditErrorKind, is_fuzzy_span_suspicious, ApplyMode, apply_content_edits, apply_content_edits_to_file_with_span_policy, refuse_batch_if_suspicious_fuzzy, ContentEdit, FuzzySpanPolicy, }; use patchloom::containment::PathGuard; use std::path::Path; // 1) Containment (optional but recommended for sandboxed agents) let guard = PathGuard::builder(std::env::current_dir()?).build()?; // 2–5) Dual-path replace: same for_agent() on primary AND fallback call sites let opts = ReplaceOptions::for_agent(); match replace_in_content(content, old, new, &opts) { Ok(r) => { /* refuse_suspicious_fuzzy already ran for fuzzy */ } Err(e) => { if is_fuzzy_span_suspicious(&e) { return Err(e); // over-wide fuzzy } match edit_error_kind(&e) { Some(EditErrorKind::NoMatch) => return Err(e), Some(EditErrorKind::Binary) => return Err(e), Some(_) | None => return Err(e), // non_exhaustive: keep _ } } } // 6–7a) Disk multi-op Apply with optional pre-write span policy let edits = [ContentEdit::Replace { old: old.into(), new: new.into(), options: ReplaceOptions::for_agent(), }]; let policy = FuzzySpanPolicy::default(); let _ = apply_content_edits_to_file_with_span_policy( Path::new("notes.txt"), &edits, ApplyMode::Apply, Some(&guard), Some(&policy), )?; // 6–7b) Buffer multi-op + host write: public batch refuse (#2064) let batch = apply_content_edits("notes body", &edits)?; refuse_batch_if_suspicious_fuzzy(&batch, &policy)?; // host write of batch.modified (hardlinks, custom backup, …) } ``` -------------------------------- ### Enable logging Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Configure the server to write logs to a specified file path. ```bash patchloom mcp-server --http --log /tmp/mcp.log ``` -------------------------------- ### Generate agent documentation Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Creates an AGENTS.md file to instruct agents on tool usage and capabilities. ```bash patchloom agent-rules ``` -------------------------------- ### Manage file backups with undo commands Source: https://patchloom.github.io/patchloom/getting-started/concepts.html Use CLI commands to list, preview, or apply file restorations from the .patchloom/backups/ directory. ```bash patchloom undo --list # see available backups patchloom undo # dry-run: show what would change patchloom undo --apply # actually restore files ``` -------------------------------- ### Configure project defaults with .patchloom.toml Source: https://patchloom.github.io/patchloom/getting-started/concepts.html Define global project settings, write policies, and exclusions in a TOML configuration file located in the project root. ```toml [write_policy] ensure_final_newline = true normalize_eol = "lf" trim_trailing_whitespace = true collapse_blanks = true [tx] strict = false [exclude] globs = ["target/**", "node_modules/**"] [output] color = "auto" ``` -------------------------------- ### Build with Custom Features Source: https://patchloom.github.io/patchloom/getting-started/installation.html Commands to build specific feature sets by disabling default features. ```shell # CLI + AST only (no MCP server, no tokio/async) cargo install --path . --no-default-features --features "cli,ast" # CLI + MCP only (no AST grammars) cargo install --path . --no-default-features --features "cli,mcp" # CLI only (no MCP, no AST) cargo install --path . --no-default-features --features cli ``` -------------------------------- ### Generate Agent Rules Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Appends agent instructions to the AGENTS.md file. ```bash patchloom agent-rules >> AGENTS.md ``` -------------------------------- ### Publish to Smithery Registry Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Commands to package the MCP bundle and upload it to the Smithery registry using the provided script. ```bash make pack-mcpb # writes target/mcpb/patchloom-.mcpb (override with VERSION=x.y.z) # One-time auth + CI secret: # smithery auth login # export SMITHERY_API_KEY=$(smithery auth whoami --full | sed -n 's/^SMITHERY_API_KEY=//p') # gh secret set SMITHERY_API_KEY --repo patchloom/patchloom bash scripts/publish-smithery.sh # REST upload (reliable for stdio MCPB) ``` -------------------------------- ### Configure Grok MCP server logging Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Define logging in config.toml using either environment variables or command arguments. ```toml [mcp_servers.patchloom] command = "/path/to/patchloom" args = ["mcp-server"] env = { PATCHLOOM_MCP_LOG = "/tmp/patchloom-mcp.log" } ``` ```toml [mcp_servers.patchloom] command = "/path/to/patchloom" args = ["mcp-server", "--log", "/tmp/patchloom-mcp.log"] ``` -------------------------------- ### Configure Patchloom for VS Code Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Create an MCP configuration file in the workspace root for VS Code. ```json { "servers": { "patchloom": { "command": "/path/to/patchloom", "args": ["mcp-server"] } } } ``` -------------------------------- ### Replace Code Patterns Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Preview a replacement using a unified diff before applying the changes to files. ```bash patchloom replace 'old_function' --new 'new_function' src/ ``` ```bash patchloom replace 'old_function' --new 'new_function' src/ --apply ``` -------------------------------- ### Enable MCP logging via CLI Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Use the --log flag or the PATCHLOOM_MCP_LOG environment variable to specify the log file path. ```bash patchloom mcp-server --log /tmp/patchloom-mcp.log ``` ```bash export PATCHLOOM_MCP_LOG=/tmp/patchloom-mcp.log patchloom mcp-server ``` -------------------------------- ### List AST symbols Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Lists all functions and types within a specified directory. ```bash patchloom ast list src/ ``` -------------------------------- ### Add Patchloom with AST support Source: https://patchloom.github.io/patchloom/getting-started/installation.html Enables AST and file manipulation features for LLM agent integration. ```toml patchloom = { version = "0.26.0", default-features = false, features = ["ast", "files"] } ``` -------------------------------- ### Generate repository map Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Creates a ranked repository map using PageRank over the symbol graph. ```bash patchloom ast map src/ --max-tokens 2048 ``` -------------------------------- ### Configure Patchloom for Claude Desktop Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Add the server configuration to the Claude Desktop JSON configuration file. ```json { "mcpServers": { "patchloom": { "command": "/path/to/patchloom", "args": ["mcp-server"] } } } ``` -------------------------------- ### Define and execute transactional plans Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Use a JSON plan file to define atomic operations with optional validation and formatting. ```json { "version": 1, "write_policy": { "ensure_final_newline": true }, "operations": [ { "op": "doc.set", "path": "package.json", "selector": "version", "value": "2.0.0" }, { "op": "replace", "path": "README.md", "old": "v1.0.0", "new": "v2.0.0" }, { "op": "md.insert_after_heading", "path": "CHANGELOG.md", "heading": "## Unreleased", "content": "- Bumped to v2.0.0" } ] } ``` ```bash patchloom tx bump.json --diff ``` ```bash patchloom tx bump.json --apply ``` -------------------------------- ### Configure Patchloom MCP Server Source: https://patchloom.github.io/patchloom/examples/mcp-core.example.json Defines the command, arguments, and environment variables necessary to initialize the Patchloom MCP server. ```json { "mcpServers": { "patchloom": { "command": "patchloom", "args": ["mcp-server"], "env": { "PATCHLOOM_MCP_SURFACE": "core" } } } } ``` -------------------------------- ### Find symbol references Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Locates all references to a specific symbol across the project files. ```bash patchloom ast refs process_data src/ ``` -------------------------------- ### Configuring Approximate Recovery Source: https://patchloom.github.io/patchloom/getting-started/embedder-host.html Shows how to override default behavior to allow absent old content during replacement operations. ```rust #![allow(unused)] fn main() { ReplaceOptions { allow_absent_old: true, ..ReplaceOptions::for_agent() } } ``` -------------------------------- ### Apply transaction with JSON output Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Executes a transaction plan and returns machine-readable JSON output. ```bash patchloom --json tx bump.json --apply ``` -------------------------------- ### Configure MCP Server in JSON Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Standard JSON configuration for MCP servers, including Cursor and other compatible hosts. ```json { "mcpServers": { "patchloom": { "command": "patchloom", "args": ["mcp-server"], "env": { "PATCHLOOM_MCP_SURFACE": "core" } } } } ``` ```json { "mcpServers": { "patchloom": { "command": "patchloom", "args": ["mcp-server"], "env": { "PATCHLOOM_MCP_SURFACE": "core" } } } } ``` ```json { "name": "patchloom", "command": "patchloom", "args": ["mcp-server"], "env": { "PATCHLOOM_MCP_SURFACE": "core" } } ``` -------------------------------- ### Generate Agent Rules Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Outputs system-prompt rules tailored for the core surface. ```bash patchloom agent-rules --surface core ``` -------------------------------- ### Apply undo Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Restores the most recent backup session. ```bash patchloom undo --apply ``` -------------------------------- ### Configure Claude Desktop/VS Code MCP logging Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Add logging configuration to the MCP server JSON settings. ```json { "mcpServers": { "patchloom": { "command": "/path/to/patchloom", "args": ["mcp-server", "--log", "/tmp/patchloom-mcp.log"] } } } ``` ```json { "mcpServers": { "patchloom": { "command": "/path/to/patchloom", "args": ["mcp-server"], "env": { "PATCHLOOM_MCP_LOG": "/tmp/patchloom-mcp.log" } } } } ``` -------------------------------- ### Apply code fragments with anchors Source: https://patchloom.github.io/patchloom/getting-started/comparisons.html Apply a code fragment using known anchors like --after, --before, or --old to ensure correct placement. ```bash apply-fragment --after/--before/--old ``` -------------------------------- ### Validate Patchloom Configuration Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Use this command to verify the syntax of your .patchloom.toml file. ```bash patchloom doc get .patchloom.toml write_policy ``` -------------------------------- ### Configure Patchloom for Grok Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Add the server configuration to the Grok TOML configuration file. ```toml [mcp_servers.patchloom] command = "/path/to/patchloom" args = ["mcp-server"] ``` -------------------------------- ### Preview undo Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Previews the restoration of the most recent backup session; an exit code of 2 indicates files would be restored. ```bash patchloom undo ``` -------------------------------- ### Perform exact text replacement Source: https://patchloom.github.io/patchloom/getting-started/comparisons.html Execute an exact replacement with a dry-run first, followed by an apply command. ```bash replace OLD path --new NEW ``` -------------------------------- ### Define write policy in a tx plan Source: https://patchloom.github.io/patchloom/getting-started/concepts.html Set write policy options directly within a JSON-based tx plan file. ```json { "version": 1, "write_policy": { "ensure_final_newline": true }, "operations": [...] } ``` -------------------------------- ### Clear Patchloom Backups Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Manually remove the backup directory to free up disk space. The next --apply operation will recreate it. ```bash rm -rf .patchloom/backups/ ``` -------------------------------- ### File Operations Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Methods for performing standard file system operations including creation, modification, and deletion. ```APIDOC ## File Operations - `fix_whitespace`: Fix whitespace and line endings in a text file. Binary and invalid UTF-8 files are skipped. - `create_file`: Create a new file with content. - `append_file`: Append content to an existing file. - `prepend_file`: Prepend content to an existing file. - `delete_file`: Delete a file. - `move_file`: Move or rename a file (binary-safe). - `apply_patch`: Apply a unified diff. - `batch_replace`: Replace the same text across multiple files atomically. - `batch_tidy`: Fix whitespace in multiple files atomically. - `execute_plan`: Execute a full multi-op transaction plan atomically. ``` -------------------------------- ### Validate source syntax Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Checks the syntax of source files in the provided directory. ```bash patchloom ast validate src/ ``` -------------------------------- ### Read and set JSON values Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Commands to retrieve or update specific fields within a JSON file. ```bash patchloom doc get package.json version ``` ```bash patchloom doc set package.json version "2.0.0" --apply ``` -------------------------------- ### Read symbol source code Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Displays the source code for a specific symbol within a file. ```bash patchloom ast read src/main.rs run ``` -------------------------------- ### Execute batch operations Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Perform multiple file edits simultaneously using a heredoc input. ```bash patchloom batch <<'EOF' doc.set package.json version "3.0.0" replace README.md "v1.0.0" "v3.0.0" md.insert_after_heading CHANGELOG.md "## Unreleased" "- Bumped to v3.0.0" EOF ``` ```bash patchloom batch --apply <<'EOF' doc.set package.json version "3.0.0" replace README.md "v1.0.0" "v3.0.0" md.insert_after_heading CHANGELOG.md "## Unreleased" "- Bumped to v3.0.0" EOF ``` -------------------------------- ### Execute configuration update with comment preservation Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Updates a YAML configuration value while maintaining file formatting and comments. ```bash doc set config.yaml database.port 5432 ``` -------------------------------- ### Apply Code Fragments Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Apply a code fragment relative to a specific anchor point in a file. ```bash patchloom apply-fragment src/lib.rs \ --after 'fn foo() {' \ --fragment '// ... existing code ... bar(); // ... existing code ...' --apply ``` -------------------------------- ### Replace code using AST Source: https://patchloom.github.io/patchloom/getting-started/comparisons.html Scope the replacement to a specific symbol within a file using AST-based logic. ```bash ast replace PATH SYMBOL --old --new ``` -------------------------------- ### MCP log file format Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Each log entry is a JSON object containing execution metadata. ```json {"ts":1749123456789,"tool":"replace_text","duration_ms":3,"ok":true} {"ts":1749123456800,"tool":"doc_set","duration_ms":5,"ok":false,"error":"file not found"} ``` -------------------------------- ### Check transaction Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Verifies if a transaction plan would produce changes, returning exit code 2 if changes are detected. ```bash patchloom tx bump.json --check echo $? # 0 = clean, 2 = changes detected ``` -------------------------------- ### Check status Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Displays pending working-tree changes using git-backed tracking. ```bash patchloom status ``` -------------------------------- ### AST Analysis and Refactoring Source: https://patchloom.github.io/patchloom/getting-started/mcp-setup.html Advanced tools for analyzing, searching, and refactoring source code based on AST structures. ```APIDOC ## AST Operations - `ast_list`: List symbol definitions in a file or directory. - `ast_read`: Read a specific symbol's source code by name. - `ast_rename`: Rename identifiers across files using AST-aware renaming. - `ast_validate`: Validate syntax of source files. - `ast_search`: Structural search using AST queries. - `ast_refs`: Find all references to a symbol across files. - `ast_deps`: Extract import/dependency statements. - `ast_map`: Generate a ranked repository map. - `ast_diff`: Structural diff between two versions of a file. - `ast_impact`: Transitive impact analysis. - `ast_replace`: Replace text within a specific symbol's body. - `ast_insert`: Insert code relative to a symbol. - `ast_wrap`: Wrap a symbol in a container. - `ast_imports`: Manage import statements. - `ast_reorder`: Reorder symbols by strategy. - `ast_group`: Move symbols into a module block. - `ast_move`: Move symbols between files. - `ast_extract_to_file`: Extract a symbol to a new file. - `ast_split`: Split a file by distributing symbols. ``` -------------------------------- ### Perform Structured and Batch File Edits Source: https://patchloom.github.io/patchloom Use the CLI to modify structured data files or execute multiple operations in a single batch call. ```bash patchloom doc set config.yaml database.port 5432 --apply patchloom batch --apply <<'EOF' doc.set package.json version "2.0.0" doc.set config.yaml app.version "2.0.0" replace README.md "1.0.0" "2.0.0" EOF ``` -------------------------------- ### Perform fuzzy text replacement Source: https://patchloom.github.io/patchloom/getting-started/comparisons.html Use fuzzy matching for whitespace or near-misses. This defaults to fail-closed behavior. ```bash replace … --fuzzy ``` -------------------------------- ### Execute batch file operations Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Performs multiple file edits and replacements across different file types in a single tool call. ```bash patchloom batch --apply <<'EOF' doc.set package.json version "2.0.0" doc.set config.yaml app.version "2.0.0" doc.set config.toml project.version "2.0.0" replace README.md "1.0.0" "2.0.0" replace CHANGELOG.md "1.0.0" "2.0.0" file.create VERSION "2.0.0" EOF ``` -------------------------------- ### Add Patchloom as a Dependency Source: https://patchloom.github.io/patchloom Include Patchloom in your Rust project by adding it to your Cargo.toml file. ```toml [dependencies] patchloom = { version = "0.26.0", default-features = false } ``` -------------------------------- ### Edit YAML value by selector path Source: https://patchloom.github.io/patchloom/blog/launch-announcement.html Updates a specific field in a YAML file while preserving existing comments and formatting. ```bash patchloom doc set config.yaml database.port 5432 --apply ``` -------------------------------- ### Search for Code Patterns Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Search for specific strings within a directory, with options for counting results or filtering by file glob. ```bash patchloom search 'TODO' src/ ``` ```bash patchloom search 'TODO' --count src/ ``` ```bash patchloom search 'TODO' src/ --glob 'sub/*.rs' ``` -------------------------------- ### Apply file edits with span policy Source: https://patchloom.github.io/patchloom/getting-started/embedder-host.html Performs a file edit operation with a specified fuzzy span policy to prevent over-wide fuzzy matches before writing or backing up. ```rust apply_content_edits_to_file_with_span_policy(path, edits, mode, guard, Some(&FuzzySpanPolicy::default())) ``` -------------------------------- ### Rename a symbol with Patchloom Source: https://patchloom.github.io/patchloom/getting-started/comparisons.html Use this command to perform a project-aware AST rename of a symbol. ```bash ast rename PATH --old X --new Y --apply ``` -------------------------------- ### Restrict file processing with glob patterns Source: https://patchloom.github.io/patchloom/getting-started/concepts.html Use the --glob flag to limit operations to specific file types or paths. This flag can be repeated to include multiple patterns. ```bash patchloom replace "old" --new "new" --glob "*.rs" --glob "*.toml" --apply ``` -------------------------------- ### Filter AST symbols by kind Source: https://patchloom.github.io/patchloom/getting-started/quickstart.html Filters the list of symbols by specific kinds such as functions or structs. ```bash patchloom ast list src/ --kind function,struct ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.