$ show openclaw/clawpatch
Clawpatch is an automated code review and repair CLI tool that maps a repository into bounded semantic feature slices, invokes external AI coding agents (Codex, Claude, ACPX, Grok, etc.) to review each slice for bugs and quality issues, and supports explicit fix workflows with validation. The architecture is a modular TypeScript application with a provider abstraction layer, language-specific feature mappers (Node, Python, Ruby, Go, Rust, C/C++, .NET, Java/Kotlin, Swift, Elixir, PHP/Laravel), state persistence via JSON files in a `.clawpatch` directory, and a safety-first design (read-only reviews, explicit fix commands, clean worktree checks, change auditing). Key entry points are the CLI (`src/cli.ts`) and application orchestrator (`src/app.ts`), with data flowing from project detection to feature mapping to provider-based review to optional fix/revalidation/PR creation. External dependencies include git, gh CLI, various AI coding CLIs, and the npm registry (optional). The tool is well-tested with Vitest, has extensive CI/CD, and demonstrates high craftsmanship in its provider abstraction, state management with locking, prompt building with provenance tracking, and review validation pipeline.
The LLM identified 5 files worth highlighting for reuse:
Provides `shellQuotePath` and related utilities for safe path quoting across POSIX and Windows shells. Isolated, no internal imports beyond Node built-ins, and can be extracted for any CLI tool needing cross-platform shell-safe argument construction.
Parses and clamps user-configured timeout values with consistent semantics. Self-contained utility that can be reused in any Node.js application requiring timeout parsing and enforcement.
Implements a rate limiter that throttles provider calls per minute across parallel jobs. Isolated module with no internal dependencies, demonstrating a clean token-bucket or sliding-window pattern reusable for any API rate-limiting need.
Fingerprints file contents and symlinks before and after fix attempts to detect unintended changes. Self-contained utility that can be extracted for any tool needing pre/post operation change detection.
Queries the npm registry to verify package existence claims, used to drop false-positive findings. Isolated module with network logic, caching, and timeout handling; reusable for any tool needing registry-based fact-checking.