claudecode

package
v0.1.4575 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

View Source
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, the newest of them: Own), else the one magpie downloaded; "" when there is neither.

func Install

func Install(ctx context.Context, r Release, progress func(done int64)) (string, error)

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

func KeepCurrent(ctx context.Context)

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.

func Own

func Own() string

Own is this machine's own Claude Code, the newest of them when it has more than one: a machine can have an old one first on PATH and a newer one after it, two npm installs in two Node versions, of which `claude update` updated the second while `claude` still ran the first (zi_xiang5806 on X: magpie's sign-in ran 2.1.38, which has no --claudeai). One is passed over only for one whose version is known and newer: a version that can't be read is unknown, not old, and the first stays when no other is known to be newer. "" when there is none.

func Platform

func Platform(goos, goarch string, musl bool) (string, error)

Platform is the name Anthropic's manifest gives the build for goos/goarch (musl: a Linux whose C library is musl, as Alpine's).

func Remove

func Remove() error

Remove deletes every Claude Code magpie downloaded.

func Root

func Root() string

Root is the folder magpie keeps the Claude Code it downloaded in, one folder per version.

func VersionOf

func VersionOf(path string) string

VersionOf is the version of the Claude Code at path, as `claude --version` says it (proc.Version, which reads an npm install's package.json rather than run it), "" when it can't be read. Own asks it only of one whose version isn't read where it is installed. It is kept while the binary is the same file, so asking again costs a stat; one that couldn't be read is asked again after a minute.

Types

type Release

type Release struct {
	Version  string
	Platform string
	URL      string
	Checksum string // SHA-256, hex
	Size     int64
}

Release is a build of Claude Code for this machine, as the manifest names it.

func Latest

func Latest(ctx context.Context) (Release, error)

Latest asks for the newest release (the "latest" channel, Claude Code's own default) and its build for this machine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL