aio-patch-extract
aio-patch-extract — extract cli.js + native modules from a claude binary
Goal
Materialize dist/<arch>/cli.js + dist/<arch>/native/*.node from an installed claude binary so subsequent aio-patch-compile can apply patches and recompile.
Usage
/aio-claude-toolkit:aio-patch-extract # download latest claude from npm for HOST arch
/aio-claude-toolkit:aio-patch-extract /path/to/claude # extract from a local binary (positional arg)
ARCH=linux-arm64 /aio-claude-toolkit:aio-patch-extract # cross-arch (downloads target-arch npm pkg)
CLAUDE_VERSION=2.1.150 /aio-claude-toolkit:aio-patch-extract # pin a specific upstream version
Argument and env precedence (tools/extract.sh):
- Positional arg 1: path to a claude binary you already have
- Otherwise:
claude-src/claudeat project root if present - Otherwise: download
@anthropic-ai/claude-code-<arch>from npm (CLAUDE_VERSION env pins, default: latest) ARCHenv: override host-detected platform (cross-arch). Supported:darwin-arm64,darwin-amd64,linux-arm64,linux-amd64.
Requires
- Walk-up must find a scaffolded project (
tools/pipeline/patch_cli.pyexists above CWD) python3(forextract_cli.py+extract_native_modules.py)npm(only if downloading a fresh claude — passing a positional binary path skips this)
Implementation
The skill body invokes ${CLAUDE_PLUGIN_ROOT}/skills/aio-patch-extract/scripts/extract.sh "$@".
It:
- Walks up from CWD to find the project root
cdto project root- Exec
./tools/extract.sh "$@"(pass-through args, honorsARCHenv)
tools/extract.sh handles binary resolution, npm download fallback, arch detection (or ARCH override after sync patch), and pipeline invocation.