Documentation
¶
Overview ¶
Package inventory scans machines for Claude Code sessions and joins each session with its live status and git state. It is shared by the CLI, TUI and GUI.
Index ¶
- Constants
- Variables
- func ClaudeSupports(ctx context.Context, claude, flag string) bool
- func HelperBinary(explicit string, f *transport.Facts) (string, error)
- func HelperPath(f *transport.Facts) string
- func InstallHelper(ctx context.Context, conn *transport.Conn, f *transport.Facts, bin string) (string, error)
- func LocalClaude(ctx context.Context) (path, version string)
- func LocalFacts(ctx context.Context) *transport.Facts
- func LocalHostName() string
- func LocalTarget(ctx context.Context) engine.Target
- func RemoveHelper(ctx context.Context, conn *transport.Conn, f *transport.Facts) error
- type Group
- type GroupedEntry
- type Machine
- type Scanner
- type Session
Constants ¶
const ( StatusOK = "ok" StatusLocal = "local" StatusUnreachable = "unreachable" StatusAuth = "auth" StatusHostKey = "host-key" StatusKeyChanged = "host-key-changed" StatusTSCheck = "tailscale-check" StatusLocalNet = "local-network" // macOS local network privacy blocked it StatusNoClaude = "no-claude" StatusError = "error" )
Status of a machine scan.
const AgentSchema = "hopsesh.agent/v1"
AgentSchema is the agent output format this build understands.
const HelperRel = ".local/share/hopsesh/bin/hopsesh"
HelperRel is where the helper lives, relative to the remote home directory.
Variables ¶
var ErrHelperMismatch = errors.New("the helper on that machine does not match the one hopsesh installed (not run)")
ErrHelperMismatch means the helper on the machine is not the one hopsesh uploaded.
Functions ¶
func ClaudeSupports ¶
ClaudeSupports reports whether this machine's claude lists a command-line flag in its help (feature detection, rather than guessing from version numbers).
func HelperBinary ¶
HelperBinary picks the local hopsesh binary to upload: explicit, or this program when it can run there (same OS and architecture, or a universal macOS build to a Mac).
func HelperPath ¶
HelperPath is the helper's absolute path on a machine.
func InstallHelper ¶
func InstallHelper(ctx context.Context, conn *transport.Conn, f *transport.Facts, bin string) (string, error)
InstallHelper uploads bin to the machine, checks it runs and matches, and returns its SHA-256 for the config.
func LocalClaude ¶
LocalClaude finds the claude binary and its version on this machine.
func LocalFacts ¶
LocalFacts describes this machine.
func LocalTarget ¶
LocalTarget describes this machine as the destination of a move.
Types ¶
type Group ¶
type Group struct {
Identity string `json:"identity"`
Name string `json:"name"`
Remote string `json:"remote,omitempty"`
Local string `json:"localCheckout,omitempty"`
Entries []GroupedEntry `json:"entries"`
}
Group is sessions of one repository across machines.
func GroupByRepo ¶
GroupByRepo groups sessions by repository identity; sessions outside git go to a "no repository" group (identity ""). localRoots are searched for local checkouts.
type GroupedEntry ¶
GroupedEntry is one session in a group.
type Machine ¶
type Machine struct {
Name string `json:"name"`
Destination string `json:"destination"`
Local bool `json:"local"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
Hint string `json:"hint,omitempty"`
Facts *transport.Facts `json:"facts,omitempty"`
Sessions []Session `json:"sessions"`
// contains filtered or unexported fields
}
Machine is one scanned machine.
func (*Machine) Find ¶
Find locates a session on a machine by id prefix or exact/substring title match.
func (*Machine) PlanSource ¶
PlanSource is Source with the login there read too (once per scan), so a plan can tell whether both machines use the same Claude account.
type Scanner ¶
type Scanner struct {
StateDir string
Log *audit.Log
Options sessions.ListOptions
// SkipGit skips the git probe (faster listing).
SkipGit bool
}
Scanner scans machines.