mirror of
https://github.com/roger2ai/Claude-Code-Compiled.git
synced 2026-05-10 03:07:28 +08:00
fix: auto-patch Commander.js multi-char short flags in postinstall
The source uses -d2e flag which Commander.js rejects (single-char only). postinstall.sh now patches both: 1. shortFlagExp regex: /^-[^-]$/ → /^-[^-]+$/ 2. single-char restriction check disabled Users no longer need to manually patch node_modules after bun install.
This commit is contained in:
@@ -117,3 +117,13 @@ STUBEOF
|
||||
fi
|
||||
|
||||
echo "[postinstall] Stubs created."
|
||||
|
||||
# ── Patch Commander.js for multi-char short flags ───────────────────────────
|
||||
OPTION_JS=$(find node_modules -path "*/commander/lib/option.js" -type f | head -1)
|
||||
if [ -n "$OPTION_JS" ]; then
|
||||
# Patch 1: shortFlagExp — allow one or more chars after dash
|
||||
sed -i "s|shortFlagExp = /\^-\\[^-\\]\\$/|shortFlagExp = /\^-[^-]+\$/|" "$OPTION_JS"
|
||||
# Patch 2: disable single-char short flag restriction
|
||||
sed -i "s|if (/\\^-\\[^-\\]\\[^-\\]/.test(unsupportedFlag))|if (false)|" "$OPTION_JS"
|
||||
echo "[postinstall] Patched Commander.js for multi-char short flags"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user