readiness

package
v0.185.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 4 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 readiness answers "can this computer run agents yet, and if not, what is the next step?" — the setup checklist of Settings → Computers, Home, `caprock setup`, and the readiness a linked laptop reads through `/v1/m/{id}/v1/setup` (GET /v1/setup, ADR-099).

The owner's first two-computer test (a MacBook driving a Windows PC, 2026-11-20) found a PC without Git and Claude Code that nothing on either screen mentioned, and a laptop that showed the PC linked without saying whether it could do anything. Five items cover the path from a fresh install to "start agents from your laptop": Git, an agent, its sign-in, a project, the link. Each says in a sentence what to do, and the installs and sign-ins carry the command that does it — typed into a shell tab for the user to run, never run by Caprock (ADR-046).

Build is pure: the daemon gathers the facts (files, PATH, the pairing state) and Build words them, so every wording is tested on every OS.

Index

Constants

View Source
const (
	// OK: done.
	OK = "ok"
	// Missing: not done; Detail says what to do, Command does it when there
	// is one command for it.
	Missing = "missing"
	// Unknown: Caprock cannot tell from what it may read (Codex keeping its
	// sign-in in the system keyring). Offered, never ticked.
	Unknown = "unknown"
	// NotNeeded: does not apply on this computer. A client treats it as done.
	NotNeeded = "not_needed"
)

The states of an item.

View Source
const (
	KeyGit   = "git"
	KeyAgent = "agent"
	// KeySignIn was the sign-in's own item until the agents became
	// switches (owner, 2026-11-20): each agent's row carries its sign-in now,
	// and the item is no longer sent.
	KeySignIn  = "signin"
	KeyProject = "project"
	KeyLink    = "link"
)

The items, in the checklist's order.

View Source
const (
	StepInstall = "install"
	StepPath    = "path"
	StepSignIn  = "signin"
)

The steps an agent's row can be at.

View Source
const ActionPath = "path"

ActionPath: the agent item's command adds ~/.local/bin to the user's PATH.

Variables

View Source
var LocalBin = filepath.Join(".local", "bin")

LocalBin is the folder the agents' native installers use, under home.

Functions

func AgentOn added in v0.185.1

func AgentOn(id string, installed bool, chosen map[string]bool) bool

AgentOn is an agent's switch: the user's choice when there is one (kept in the daemon's settings), else on when it is installed, and Claude Code on on a fresh computer; the rest off.

func GitInstall

func GitInstall(goos string) string

GitInstall is the command that installs Git, "" where there is no single one (Linux: the distribution's package manager).

  • Windows: winget's Git for Windows package (Git.Git), the install Claude Code's setup page points at (code.claude.com/docs/en/setup, read 2026-11-20). It asks for an administrator once.
  • macOS: the Command Line Tools, which carry Git; macOS opens its own installer window.

func PathFix added in v0.185.1

func PathFix(goos, shell string) string

PathFix adds ~/.local/bin to the user's PATH for terminals opened from now on, and does nothing when it is there already. Typed into a shell tab and run by the user's Enter, never by Caprock (ADR-046).

  • Windows: the user's Path only (never the system's, which needs an administrator), through .NET, which also tells Windows the environment changed so terminals started afterwards see it. PowerShell, the shell tab's shell there; an empty user Path is handled.
  • macOS and Linux: one export line appended to the login shell's file — ~/.zshrc for zsh, ~/.bash_profile for bash on macOS, ~/.bashrc for bash elsewhere, ~/.profile for anything else — only when that exact line is not there yet; fish has its own idempotent fish_add_path.

Types

type Agent

type Agent struct {
	ID    string // "claude", "codex"
	Label string // "Claude Code", "Codex"
	// On is its switch, as AgentOn resolves it.
	On        bool
	Installed bool
	// Install is the catalog's install command (ADR-046).
	Install string
	// SignIn is OK, Missing or Unknown.
	SignIn string
	// SignInCommand is the agent's own sign-in.
	SignInCommand string
	// SignInText says what is missing in the agent's own words, for an
	// agent whose sign-in is not a subscription file (OpenCode's provider).
	SignInText string
	// OffPath is the folder the agent was found in when a terminal opened
	// now cannot find it there: installed, but not on the user's PATH
	// (OffPathDir). "" when it is on the PATH, or the PATH could not be read.
	OffPath string
}

Agent is one agent that can run here: Claude Code, Codex, OpenCode, Gemini CLI, Cursor, … — every built-in the catalog can install.

type AgentRow added in v0.185.1

type AgentRow struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	// On is the switch: an agent switched off is grey, not counted, and
	// its state is not_needed. Switching changes nothing but the setting.
	On     bool   `json:"on"`
	State  string `json:"state"`
	Detail string `json:"detail"`
	// Step is install, path or signin while one is left; Command does it.
	Step    string `json:"step,omitempty"`
	Command string `json:"command,omitempty"`
	Action  string `json:"action,omitempty"`
}

AgentRow is one agent under the agent item: switched on or off, its own state, and its one next step.

type Git

type Git struct {
	Found bool
	// Fresh is false when the user's current PATH could not be read, so a Git
	// installed after Caprock started may not be seen until it restarts.
	Fresh bool
}

Git is what was found of Git.

type GitFinder

type GitFinder struct {
	GOOS string
	// Dirs is the user's PATH as it is now (userenv.CurrentPath), split.
	Dirs []string
	// Env reads a variable (ProgramFiles, LOCALAPPDATA on Windows).
	Env func(string) string
	// IsFile reports whether a path is a regular file. Swapped by tests.
	IsFile func(string) bool
}

GitFinder looks for Git without running it. Running `git --version` on a Mac without the Command Line Tools would open Apple's install dialog from a daemon on a timer, so the answer is read from the file system only.

func (GitFinder) Found

func (f GitFinder) Found() bool

Found reports whether Git is installed.

type Inputs

type Inputs struct {
	GOOS     string
	Git      Git
	Agents   []Agent
	Projects int
	Link     Link
	// Shell is the login shell's name ("zsh", "bash", "fish"): which file
	// PathFix adds to on macOS and Linux.
	Shell string
	// CloneDir is where the Add project sheet clones by default — the folder
	// set as default, else ~/dev — in full, so the project item says where.
	CloneDir string
}

Inputs are the facts Build words.

type Item

type Item struct {
	Key    string `json:"key"`
	State  string `json:"state"`
	Label  string `json:"label"`
	Detail string `json:"detail"`
	// Command fixes it in a terminal: typed into a shell tab, or printed by
	// `caprock setup`, never run by Caprock. The link's is a caprock command
	// for a computer reached over SSH; its screen has its own buttons.
	Command string `json:"command,omitempty"`
	// Action says what Command does when it is not an install or a sign-in:
	// ActionPath adds the agent's folder to the user's PATH. The button reads
	// after it ("Add to PATH").
	Action string `json:"action,omitempty"`
	// Optional marks an item that never counts as a step left: the
	// project. Its state is ok or not_needed, so a reader from before the
	// field treats it as done too.
	Optional bool `json:"optional,omitempty"`
}

Item is one line of the checklist.

type Link struct {
	// Supported is false in a build that cannot be reached through a relay.
	Supported bool
	// On: access from anywhere is on.
	On bool
	// Allowed are the computers allowed here, by name; Waiting those that
	// redeemed a link and wait for Allow.
	Allowed []string
	Waiting []string
}

Link is how this computer stands with the computers that reach it.

type OffPath added in v0.185.1

type OffPath struct {
	GOOS string
	Home string
	// Dirs is the PATH a terminal opened now gets (userenv.TerminalPath),
	// split.
	Dirs []string
	// IsFile reports whether a path is a regular file. Swapped by tests.
	IsFile func(string) bool
}

OffPath finds an agent installed in a well-known folder that is not on the PATH a terminal gets.

func (OffPath) Dir added in v0.185.1

func (o OffPath) Dir(bin string) string

Dir is the folder holding bin ("claude", "codex") when a terminal cannot find it: bin is in ~/.local/bin, that folder is not on the PATH, and no folder on the PATH has bin either. "" otherwise.

type Report

type Report struct {
	OS    string `json:"os"`
	Items []Item `json:"items"`
	// Agents are the agent item's rows: every agent Caprock can start that
	// has a way to be installed here, or is installed, each with its switch.
	Agents []AgentRow `json:"agents,omitempty"`
}

Report is GET /v1/setup.

func Build

func Build(in Inputs) Report

Build words the checklist.

func (Report) Ready

func (r Report) Ready() bool

Ready reports whether nothing is left to do.

Jump to

Keyboard shortcuts

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