Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created March 31, 2026 14:37
Show Gist options
  • Select an option

  • Save scottwb/b70c9ced1d6dfe0e44e81076f0d39abc to your computer and use it in GitHub Desktop.

Select an option

Save scottwb/b70c9ced1d6dfe0e44e81076f0d39abc to your computer and use it in GitHub Desktop.
Detect what version of Axios in use by native-installer-installed Claude Code
#!/usr/bin/env python3
"""
Extracts the bundled Axios version from a native-installed Claude Code binary.
Usage:
claude-axios-version # auto-detect from ~/.local/bin/claude
claude-axios-version /path/to/binary
"""
import os
import re
import sys
def resolve_binary(path=None):
if path:
return os.path.realpath(path)
default = os.path.expanduser("~/.local/bin/claude")
if not os.path.exists(default):
print("Error: Claude Code not found at ~/.local/bin/claude", file=sys.stderr)
print("Provide the binary path as an argument.", file=sys.stderr)
sys.exit(1)
return os.path.realpath(default)
def find_axios_version(binary_path):
with open(binary_path, "rb") as f:
data = f.read()
# Step 1: Find the user-agent pattern "axios/"+VARNAME
# In minified Axios source, the UA is built like: "axios/"+someVar
match = re.search(rb'"axios/"\+(\w+)', data)
if not match:
return None, "Could not find 'axios/' user-agent pattern in binary"
varname = match.group(1)
# Step 2: Find where that variable is assigned a semver string
pattern = re.escape(varname) + rb'\s*=\s*"(\d+\.\d+\.\d+[^"]*)"'
ver_match = re.search(pattern, data)
if not ver_match:
return None, f"Found variable {varname.decode()} but could not find its version assignment"
return ver_match.group(1).decode("ascii"), None
def main():
path = sys.argv[1] if len(sys.argv) > 1 else None
binary = resolve_binary(path)
if not os.path.isfile(binary):
print(f"Error: {binary} is not a file", file=sys.stderr)
sys.exit(1)
version, error = find_axios_version(binary)
if error:
print(f"Error: {error}", file=sys.stderr)
sys.exit(1)
print(version)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment