Documentation
¶
Overview ¶
Package claudecode finds the Claude Code magpie's Claude subscription runs, and downloads Anthropic's own build of it when the user asks, for a machine with none: a server or a container (Jorben on Discord).
The build comes from where Anthropic's installer (claude.ai/install.sh) takes it: the release's manifest.json names each platform's SHA-256 and size, and the binary is checked against both before it is kept. It is kept in magpie's cache folder, not on PATH: it is what the bridge, the sign-in and `magpie claude` run, and the Agents page doesn't take ~/.claude for an uninstall's leftover while it is here (agent's cliHeld). While magpie serves, it keeps that download at the newest release (KeepCurrent), as Claude Code's own updater would, which magpie's runs turn off.
Index ¶
- Constants
- Variables
- func Downloaded() (path, version string)
- func Find() string
- func Install(ctx context.Context, r Release, progress func(done int64)) (string, error)
- func KeepCurrent(ctx context.Context)
- func Platform(goos, goarch string, musl bool) (string, error)
- func Remove() error
- func Root() string
- type Release
Constants ¶
const InstallHint = "or run `magpie claude-code install` to download Anthropic's own build for magpie"
InstallHint is what an error about a missing Claude Code adds: how to have magpie download it.
Variables ¶
var Base = "https://downloads.claude.ai/claude-code-releases"
Base is where Anthropic publishes Claude Code's builds, as its installer downloads them; a var for tests.
Functions ¶
func Downloaded ¶
func Downloaded() (path, version string)
Downloaded is the Claude Code magpie downloaded and its version, or "" when there is none: the newest of Root's versions that has the binary.
func Find ¶
func Find() string
Find is the Claude Code to run on this machine: the user's own (on PATH or where its installers put it, proc.FindTool), else the one magpie downloaded; "" when there is neither.
func Install ¶
Install downloads r into Root, checks its size and SHA-256 against the manifest's, and keeps it as the Claude Code magpie runs when the machine has none of its own; the versions downloaded before are removed. progress, when set, is told the bytes so far. It returns the binary's path.
func KeepCurrent ¶ added in v0.1.2605
KeepCurrent keeps the Claude Code magpie downloaded at Claude Code's newest release while magpie serves: a minute after it starts and every six hours after. Every run magpie starts sets DISABLE_AUTOUPDATER, so nothing else updates it, and a container's download (in /config/cache, on the volume) would otherwise stay at the version first installed, image update after image update (alextjy on Discord). It does nothing when magpie downloaded none, when the machine has a Claude Code of its own (that one is run, and updates itself), or when DISABLE_AUTOUPDATER is set for magpie: Claude Code's own way of holding a version.