aio-patch-setup
aio-patch-setup — scaffold a new Claude-binary-patching project
Goal
Drop a complete, runnable patching pipeline into the target directory so the user can immediately:
- Edit
tools/pipeline/patches.json(start from empty schema or copy frompatches.json.example) - Run
/aio-claude-toolkit:aio-patch-extractto extract cli.js + natives from their installed claude - Run
/aio-claude-toolkit:aio-patch-compileto apply patches + recompile a custom claude binary - Run
/aio-claude-toolkit:aio-patch-runto exec the patched binary
What gets copied
| Path | Source | User-owned? |
|---|---|---|
tools/extract.sh | templates/tools/extract.sh (synced from dirty-claude + ARCH patch) | No — generic |
tools/build.sh | templates/tools/build.sh | No — generic |
tools/run.sh | templates/tools/run.sh | No — generic |
tools/pipeline/*.py | dirty-claude pipeline (extract_cli, patch_cli, resolve_symbols, inline_sources, extract_native_modules) | No — generic |
tools/pipeline/patches.json | EMPTY schema template | YES — user content |
tools/pipeline/patches.json.example | dirty-claude pinned reference | No — reference |
tools/pipeline/sources/*.example | dirty-claude reference patch body | No — reference |
tools/cli-nav/*.cjs | AST navigator (acorn-based) | No — generic |
docs/*.md | curated generic guides (anchor strategy, drift recovery, etc.) | No — generic |
.gitignore | sensible defaults (dist/, *.backup, pycache/) | No — generic |
CLAUDE.md.example | template for your project's CLAUDE.md | No — template |
README.md.example | template for your project's README | No — template |
.aio-patch-setup (hidden) | sync metadata (VERSION) | No — generated |
NOT copied (opt-in via sibling skill): control/ — call /aio-claude-toolkit:aio-patch-control scaffold to install the reference HTTP control-channel sample.
Usage
/aio-claude-toolkit:aio-patch-setup [target_dir]
target_dirdefaults to CWD.FORCE=1env var: overwrite generic scripts in an existing scaffold. Does NOT overwritetools/pipeline/patches.jsonortools/pipeline/sources/*.js(your patch content).
Next steps printed at end
After scaffold, prints:
- Edit
tools/pipeline/patches.json(start frompatches.json.exampleif you want the dirty-claude HTTP control-channel patch body). /aio-claude-toolkit:aio-patch-extractto extract cli.js./aio-claude-toolkit:aio-patch-compileto apply + build./aio-claude-toolkit:aio-patch-runto exec.
Implementation
The skill body invokes ${CLAUDE_PLUGIN_ROOT}/skills/aio-patch-setup/scripts/setup.sh "$@".
When invoked:
- Resolves
TARGET = $1 ?? $PWD - Guard: if
$TARGET/tools/pipeline/exists andFORCEis unset → exit 1 with hint cp -r templates/tools+cp -r templates/docs+ copy ancillary files into$TARGET/- Copy
templates/VERSION→$TARGET/.aio-patch-setup(hidden — sync metadata for drift recovery) - Run
check-deps.sh(warn-only) - Print "Next steps" hint