Help us shape the future of Go! Take the 2026 Go Developer Survey

claudecode

package
v0.1.1520 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 17 Imported by: 0

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, so it stands in for no agent: it is only what the bridge and the sign-in run.

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, proc.FindTool), 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 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.

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