link

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 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 link connects the old and new sessions using only official Claude Code features: it builds the resume command (--resume, --fork-session, --remote-control, --desktop), the start prompt that tells the resumed session it was moved and asks it to check its environment (and, when asked, to notify the old session with SendMessage), and the text to paste into the old session otherwise. It reads `claude auth status` to decide whether Remote Control is available and whether both machines use the same account. It never writes to session sockets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultShell

func DefaultShell() string

DefaultShell is the shell family of this machine.

func OldSessionNotice

func OldSessionNotice(targetHost, targetCWD, newName string, fork bool) string

OldSessionNotice is the text for the user to paste into the old session when automatic notification is not possible (no Remote Control on both sides).

func SameAccount

func SameAccount(a, b *Auth) (same, known bool)

SameAccount compares two logins. known is false when either side could not be read.

func StartPrompt

func StartPrompt(c Context) string

StartPrompt is the first message of the moved session. It tells Claude what happened, what that implies, and asks it to verify the environment before continuing.

Types

type Auth

type Auth struct {
	LoggedIn     bool   `json:"loggedIn"`
	Method       string `json:"authMethod"`       // claude.ai | api-key | …
	Provider     string `json:"apiProvider"`      // firstParty | bedrock | vertex | …
	OrgID        string `json:"orgId"`            // identifies the account for comparisons
	Subscription string `json:"subscriptionType"` // pro | max | team | enterprise | …
}

Auth is what `claude auth status --json` reports about a machine's login. The email address is deliberately not kept.

func ParseAuth

func ParseAuth(b []byte) (*Auth, error)

ParseAuth reads `claude auth status --json` output.

func (*Auth) RemoteControl

func (a *Auth) RemoteControl() (bool, string)

RemoteControl reports whether this login can use Remote Control, and why not. Remote Control needs a claude.ai subscription login with Anthropic as the provider.

type Context

type Context struct {
	SourceHost    string
	SourceOS      string
	SourceVersion string // Claude Code version that last wrote the transcript
	SourceCWD     string
	TargetHost    string
	TargetOS      string
	TargetCWD     string
	Branch        string
	WorktreeNote  string // e.g. "a new worktree was created at …" / "the main checkout is used"
	Unpushed      int
	Dirty         int
	UnmappedNote  string // paths that were not remapped, if any
	SecretsFound  int
	Redacted      bool
	ThinkingDrop  bool
	Live          bool   // the source session was still running
	Fork          bool   // the source keeps running (fork) instead of handing off
	NotifyOld     bool   // ask this session to message the old one
	OldName       string // the old session's name, for SendMessage
	NewName       string // this session's Remote Control name
}

Context is what the new session should know about its move.

type Resume

type Resume struct {
	Dir         string
	SessionID   string
	Fork        bool
	RemoteCtl   bool
	Name        string // Remote Control / session name
	StartPrompt string
	// PromptFile, when set, holds StartPrompt; shell commands read it instead of inlining
	// a long quoted prompt.
	PromptFile string
	// Desktop opens the session in the Claude desktop app (claude --desktop), where the
	// installed Claude Code has that flag.
	Desktop bool
}

Resume describes how to start the moved session.

func (Resume) Argv

func (r Resume) Argv() []string

Argv returns the claude command line (without changing directory).

func (Resume) Shell

func (r Resume) Shell(family string) string

Shell returns a copy-pasteable command for the given shell family ("posix" or "powershell").

Jump to

Keyboard shortcuts

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