convez.ai
MCP Server
loerei

patchitRIGHT

loerei/patchitRIGHT

Ver no GitHub
InicialPluginScore · de 0 a 100

patchitRIGHT: An AST-bounded secure code-writing MCP server with transactional multi-file refactoring and rollback.

Instalação

$npx convez-ai loerei/patchitRIGHT

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 4 dias
Versão
—
Issues abertas
0
Contribuidores
1

README

A tradução para o português deste README ainda está na fila.

patchitRIGHT

patchitRIGHT is a single-tool AST-bounded secure code-writing MCP server.

It leverages jCodeMunch index engines to perform surgical search-and-replace (patch_file) operations within precise AST scopes (such as functions or classes), complete with line filters and safe dry-run previews.


🚀 Quick Setup (MCP Client)

Add the following configuration to your MCP client configuration file (e.g., claude_desktop_config.json or Antigravity settings):

{
  "mcpServers": {
    "patchitright": {
      "command": "python",
      "args": [
        "-m",
        "patchitright_mcp.server"
      ],
      "env": {
        "PYTHONPATH": "d:/Projects/patchitRIGHT/src"
      }
    }
  }
}

🛠️ Provided Tools

patch_file

Performs robust, surgical code replacement on a single target file. Supports two operation modes:

  1. Search-and-Replace Mode:
    • target_file (required): Path to the file to modify.
    • search_content (required): The exact code block to search for.
    • replace_content (required): The replacement code block.
  2. Unified Diff Mode:
    • patch_content (required): Unified Diff string to apply strictly (Fuzz = 0).

Optional parameters (common):

  • symbol_name: Restricts the search scope to a specific AST symbol (function/class) using jCodeMunch index.
  • start_line / end_line: Limits the search region to a specific 1-indexed line range.
  • allow_multiple: If true, replaces all occurrences of the search content within the scope. Defaults to false.
  • dry_run: Returns a unified git-style diff preview of the changes without writing to disk.

batch_patch_files

Performs an atomic, transactional refactoring operation across multiple target files.

  • patches (required): Array of patch objects, where each object contains:
    • target_file: Path to the target file.
    • patch_content: Git-style Unified Diff hunk(s) to apply to this file (Fuzz = 0).
  • dry_run (optional): Returns a unified git-style diff preview of all changes without writing to disk.

🛡️ Transaction Security & Auto-recovery

  • Atomic Rollback: If any patch fails validation or writing, the entire transaction is rolled back, restoring the original state of all files.
  • Optimistic Locking: Checks the raw byte hash of files before and after the backup phase to prevent conflicts with concurrent modifications.
  • Crash Resilience: Ephemeral backup files are written to .patchitRIGHT/backups/ within the active repository root. If the process is killed midway, run_startup_recovery automatically restores the backups on the next MCP server startup.

🔌 Standalone Mode & Custom AST Engines

patchitRIGHT is decoupled from jCodeMunch. If you do not wish to use jCodeMunch in a commercial/business environment:

  1. Running Standalone (No-Dependency Mode): You can run patchitRIGHT without installing or indexing via jCodeMunch. All core features — including exact search-and-replace, line-range scopes, transactional batch patching, and Strict Unified Diffs — will function out-of-the-box. The only limitation is that resolving scoping via the symbol_name parameter will not be available.

  2. Swapping the AST/Repository Resolver: If you wish to plug in a different AST parsing engine (such as tree-sitter, libcst, or a custom LSP client), you only need to modify two decoupled helper functions in patch_file.py:

    • _resolve_allowed_base_dir: Resolves the absolute project root.
    • _resolve_ast_boundaries: Scopes edits by looking up symbol definitions (returning start_line and end_line).

📄 License & Terms

  • patchitRIGHT is distributed under the MIT License.
  • When configured to dynamically interface with jCodeMunch-MCP (Copyright © 2024-2026 J. Gravelle), usage must comply with the jCodeMunch Dual-Use License. The verbatim text of this license is included in the LICENSE file. Standalone mode or custom AST engine integrations are exempt from jCodeMunch license terms.
Ver o original no GitHub

Bom para

Relacionados