gui

package
v0.2.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: 28 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 gui is the backend of the hopsesh desktop app (Wails v3). The frontend in assets/ calls these methods; all work is done by the same engine as the CLI.

Index

Constants

View Source
const PasswordEvent = "hopsesh:password"

PasswordEvent is the event the window gets when ssh asks for a machine's password.

Variables

View Source
var Assets embed.FS

Assets is the frontend (plain HTML, CSS and JS; no build step).

Functions

This section is empty.

Types

type App

type App struct {
	App *application.App `json:"-"`
	// contains filtered or unexported fields
}

App is the service bound to the frontend.

func NewApp

func NewApp() (*App, error)

NewApp loads configuration.

func (*App) AddCLIToPath added in v0.2.0

func (a *App) AddCLIToPath() (string, error)

AddCLIToPath adds ~/.local/bin to the login shell's PATH (only on the user's click).

func (*App) AddHost

func (a *App) AddHost(name, destination string, password, remember bool) error

AddHost adds and allows a machine by ssh destination. password: it logs in with a password (asked for when hopsesh connects; remember keeps it in the Keychain).

func (*App) AddSkillRules added in v0.2.0

func (a *App) AddSkillRules() ([]string, error)

AddSkillRules adds the permission rules (read-only hopsesh commands allowed, moves ask) to Claude Code's settings.

func (*App) Apply

func (a *App) Apply() (*DoneDTO, error)

Apply performs the last plan.

func (*App) CancelPassword added in v0.2.0

func (a *App) CancelPassword(id string)

CancelPassword declines a password question; that machine is skipped this time.

func (*App) CheckUpdate

func (a *App) CheckUpdate() (*UpdateDTO, error)

CheckUpdate looks for a newer release, at most once a day, and only when allowed.

func (*App) ChooseFolder

func (a *App) ChooseFolder(title string) (string, error)

ChooseFolder asks for a directory.

func (*App) CopyText

func (a *App) CopyText(text string) bool

CopyText puts text on the clipboard.

func (*App) Discover

func (a *App) Discover() []HostDTO

Discover lists machines (connecting to none) with their consent state.

func (*App) DismissCLIOffer added in v0.2.0

func (a *App) DismissCLIOffer() error

DismissCLIOffer stops the app from offering to link the command-line tool.

func (*App) DismissSkillOffer added in v0.2.0

func (a *App) DismissSkillOffer() error

DismissSkillOffer stops the app from offering the skill (it stays in Settings).

func (*App) ForgetPassword added in v0.2.0

func (a *App) ForgetPassword(name string) error

ForgetPassword removes a machine's remembered password (it is asked for again).

func (*App) Info

func (a *App) Info() Info

Info returns app and machine information.

func (*App) InstallCLI added in v0.2.0

func (a *App) InstallCLI(force bool) (integrate.CLIStatus, error)

InstallCLI links the hopsesh command into ~/.local/bin.

func (*App) InstallSkill added in v0.2.0

func (a *App) InstallSkill(force, addRules bool) (claudeskill.Status, error)

InstallSkill installs or updates the hopsesh skill for Claude Code.

func (*App) OpenInDesktop

func (a *App) OpenInDesktop() error

OpenInDesktop opens the moved session in the Claude desktop app.

func (*App) OpenInTerminal

func (a *App) OpenInTerminal(command string) error

OpenInTerminal runs the resume command in a new terminal window.

func (*App) OpenLocalNetworkSettings

func (a *App) OpenLocalNetworkSettings() error

OpenLocalNetworkSettings opens System Settings at Privacy & Security, where the Local Network list is (macOS offers no link to the list itself).

func (*App) OpenURL

func (a *App) OpenURL(url string) error

OpenURL opens a web page in the default browser (release notes only).

func (*App) PendingPasswords added in v0.2.0

func (a *App) PendingPasswords() []PasswordRequest

PendingPasswords lists unanswered password questions (for a window that missed the event).

func (*App) Plan

func (a *App) Plan(machine, sessionID string, o OptsDTO) (*PlanDTO, error)

Plan builds a transport plan for a session (nothing changes).

func (*App) ProvidePassword added in v0.2.0

func (a *App) ProvidePassword(id, password string, remember bool) error

ProvidePassword answers a password question. remember stores it in the Keychain and sets the machine to remember it; false forgets any remembered one.

func (*App) RemoveSkill added in v0.2.0

func (a *App) RemoveSkill(force bool) (claudeskill.Status, error)

RemoveSkill removes the hopsesh skill.

func (*App) RetryLocalNetwork

func (a *App) RetryLocalNetwork()

RetryLocalNetwork makes the next scan wait for the macOS prompt again, for someone who just changed the setting or wants to answer a prompt they dismissed.

func (*App) Reveal added in v0.2.0

func (a *App) Reveal(path string) error

Reveal shows a folder in Finder (or the system file manager).

func (*App) SaveSettings added in v0.2.0

func (a *App) SaveSettings(in SettingsInput) error

SaveSettings stores the user's choices.

func (*App) Scan

func (a *App) Scan() (*ScanDTO, error)

Scan scans this machine and every allowed machine.

func (*App) ScanKeys

func (a *App) ScanKeys(name string) (*KeysDTO, error)

ScanKeys fetches a machine's host keys for the trust dialog.

func (*App) SetAllowed

func (a *App) SetAllowed(name, destination string, allowed bool) error

SetAllowed records consent for a machine.

func (*App) SetAuth added in v0.2.0

func (a *App) SetAuth(name, auth string, remember bool) error

SetAuth switches a machine between key login ("key") and password login ("password").

func (*App) SetReposDir

func (a *App) SetReposDir(dir string) error

SetReposDir changes the clone folder.

func (*App) SetUpdateCheck

func (a *App) SetUpdateCheck(on bool) error

SetUpdateCheck records whether the app may look for new releases once a day.

func (*App) Settings added in v0.2.0

func (a *App) Settings() SettingsDTO

Settings returns the current settings and integration state.

func (*App) SetupKeyLogin added in v0.2.0

func (a *App) SetupKeyLogin(name string, createKey bool) (*KeyLoginDTO, error)

SetupKeyLogin adds this Mac's public key to a password machine, checks that key login works and switches the machine to it. Without createKey it fails with "no-key" when this Mac has no key ssh would use (the window then asks before one is made).

func (*App) Shutdown

func (a *App) Shutdown()

Shutdown closes connections.

func (*App) SkillPreview added in v0.2.0

func (a *App) SkillPreview() (string, error)

SkillPreview returns the SKILL.md this build would install.

func (*App) TrustHost

func (a *App) TrustHost(name string) error

TrustHost re-scans and records the machine's host keys (after the user confirmed).

func (*App) Undo

func (a *App) Undo(sessionID string) error

Undo reverses the latest transport of a session.

func (*App) UninstallCLI added in v0.2.0

func (a *App) UninstallCLI() (integrate.CLIStatus, error)

UninstallCLI removes the link the app made (and its PATH block).

type DoneDTO

type DoneDTO struct {
	Title       string   `json:"title"`
	Command     string   `json:"command"`
	Paths       int      `json:"paths"`
	Files       int      `json:"files"`
	Bytes       string   `json:"bytes"`
	Secrets     int      `json:"secrets"`
	Cloned      bool     `json:"cloned"`
	Worktree    string   `json:"worktree"`
	SessionID   string   `json:"sessionId"`
	OldNotice   string   `json:"oldNotice"`
	NewName     string   `json:"newName"`
	RemoteCtl   bool     `json:"remoteControl"`
	NotifyOld   bool     `json:"notifyOld"`
	SetAside    []string `json:"setAside"`
	AuditDir    string   `json:"auditDir"`
	TargetDir   string   `json:"targetDir"`
	PromptFile  string   `json:"promptFile"`
	SourceHost  string   `json:"sourceHost"`
	Desktop     bool     `json:"desktop"` // the installed claude can open it in the desktop app
	Stopped     int      `json:"stoppedPid,omitempty"`
	Pushed      string   `json:"pushed,omitempty"`
	PushError   string   `json:"pushError,omitempty"`
	SyncNote    string   `json:"syncNote,omitempty"`
	SyncState   string   `json:"syncState,omitempty"`
	Mark        string   `json:"mark"`
	MarkError   string   `json:"markError,omitempty"`
	MarkedTitle string   `json:"markedTitle,omitempty"`
	ResumeArgv  []string `json:"-"`
	ResumeIntoD string   `json:"-"`
}

DoneDTO reports a finished transport.

type EntryDTO

type EntryDTO struct {
	Machine    string `json:"machine"`
	ID         string `json:"id"`
	Title      string `json:"title"`
	Status     string `json:"status"`
	Live       bool   `json:"live"`
	LastActive string `json:"lastActive"`
	LastPrompt string `json:"lastPrompt"`
	CWD        string `json:"cwd"`
	Branch     string `json:"branch"`
	Worktree   string `json:"worktree"`
	MainBranch string `json:"mainBranch"`
	Unpushed   int    `json:"unpushed"`
	Dirty      int    `json:"dirty"`
	SizeKB     int64  `json:"sizeKB"`
	// Copies of this session on other machines (it was moved); this entry is the newest.
	Copies    []inventory.Copy `json:"copies,omitempty"`
	HereNewer bool             `json:"hereNewest,omitempty"` // the newest copy is on this machine
	StaleHere bool             `json:"staleHere,omitempty"`  // an older copy is on this machine
	ResumeCmd string           `json:"resumeCommand,omitempty"`
}

EntryDTO is one session row.

type GroupDTO

type GroupDTO struct {
	Name    string     `json:"name"`
	Remote  string     `json:"remote"`
	Local   string     `json:"local"`
	NoRepo  bool       `json:"noRepo"`
	Entries []EntryDTO `json:"entries"`
}

GroupDTO is one repository.

type HostDTO

type HostDTO struct {
	Name        string   `json:"name"`
	Destination string   `json:"destination"`
	Via         []string `json:"via"`
	OS          string   `json:"os"`
	Online      *bool    `json:"online"`
	OtherOwner  bool     `json:"otherOwner"`
	Owner       string   `json:"owner"`
	Allowed     bool     `json:"allowed"`
	Auth        string   `json:"auth"`     // "key" or "password"
	Keychain    bool     `json:"keychain"` // the password is remembered
	CanRemember bool     `json:"canRemember"`
}

HostDTO is one machine on the consent screen.

type Info

type Info struct {
	Version   string `json:"version"`
	Host      string `json:"host"`
	ReposDir  string `json:"reposDir"`
	AuditDir  string `json:"auditDir"`
	HasHosts  bool   `json:"hasHosts"`
	ClaudeVer string `json:"claudeVersion"`
	// LocalNetwork describes macOS local network privacy: gated (macOS 15+) and firstRun
	// (the prompt has probably not been answered yet).
	LocalNetwork struct {
		Gated    bool `json:"gated"`
		FirstRun bool `json:"firstRun"`
	} `json:"localNetwork"`
	UpdateCheck string `json:"updateCheck"` // "", "on" or "off"
	// Defaults for the round-trip choices on the preflight screen.
	SkillState  string `json:"skillState"`  // absent | current | stale | modified | foreign | broken
	SkillPrompt string `json:"skillPrompt"` // "declined" once the user said not now
	CLIOffer    bool   `json:"cliOffer"`    // offer to link the command-line tool (app, not linked, not declined)
	Defaults    struct {
		MarkMoved  bool `json:"markMoved"`
		SyncCode   bool `json:"syncCode"`
		PushSource bool `json:"pushSource"`
	} `json:"defaults"`
}

Info is static information for the window.

type KeyLoginDTO added in v0.2.0

type KeyLoginDTO struct {
	PublicKey string `json:"publicKey"`
	Created   bool   `json:"created"`
	Added     bool   `json:"added"`
}

KeyLoginDTO is what SetupKeyLogin did.

type KeysDTO

type KeysDTO struct {
	Host         string   `json:"host"`
	Address      string   `json:"address"`
	Fingerprints []string `json:"fingerprints"`
	Verified     string   `json:"verified"` // how it was verified, "" if not
}

KeysDTO describes host keys awaiting confirmation.

type MachineDTO

type MachineDTO struct {
	Name     string `json:"name"`
	Status   string `json:"status"`
	Hint     string `json:"hint"`
	Error    string `json:"error"`
	OS       string `json:"os"`
	Sessions int    `json:"sessions"`
	Local    bool   `json:"local"`
	Claude   string `json:"claude"`
}

MachineDTO summarises one scanned machine.

type OptsDTO

type OptsDTO struct {
	TargetDir    string `json:"targetDir"`
	Clone        bool   `json:"clone"`
	ReposDir     string `json:"reposDir"`
	Worktree     string `json:"worktree"`
	Fork         bool   `json:"fork"`
	RemoteCtl    bool   `json:"remoteControl"`
	NotifyOld    bool   `json:"notifyOld"`
	Redact       bool   `json:"redact"`
	OtherAccount bool   `json:"otherAccount"`
	Memory       bool   `json:"memory"`
	MarkSource   bool   `json:"markSource"`
	SyncCode     bool   `json:"syncCode"`
	PushSource   bool   `json:"pushSource"`
	StopLocal    bool   `json:"stopLocal"`
	Conflict     string `json:"conflict"` // "", "replace" or "keep-both"
}

OptsDTO are the preflight choices.

type PasswordRequest added in v0.2.0

type PasswordRequest struct {
	ID          string `json:"id"`
	Machine     string `json:"machine"`
	Destination string `json:"destination"`
	Retry       bool   `json:"retry"`       // the last password was refused
	CanRemember bool   `json:"canRemember"` // the Keychain is available
	Remember    bool   `json:"remember"`    // the machine is set to remember it
}

PasswordRequest asks the window for a machine's password.

type PlanDTO

type PlanDTO struct {
	Plan  *engine.Plan `json:"plan"`
	Kinds []string     `json:"kinds"`
}

PlanDTO is the rendered plan.

type ScanDTO

type ScanDTO struct {
	Machines []MachineDTO `json:"machines"`
	Groups   []GroupDTO   `json:"groups"`
	Total    int          `json:"total"`
}

ScanDTO is the result of a scan.

type SettingsDTO added in v0.2.0

type SettingsDTO struct {
	Version    string `json:"version"`
	ReposDir   string `json:"reposDir"`
	Layout     string `json:"layout"`     // flat | ghq
	LivePolicy string `json:"livePolicy"` // handoff | fork
	RemoteCtl  bool   `json:"remoteControl"`
	MarkMoved  bool   `json:"markMoved"`
	SyncCode   bool   `json:"syncCode"`
	PushSource bool   `json:"pushSource"`
	UpdateChk  string `json:"updateCheck"`

	CLI         integrate.CLIStatus `json:"cli"`
	Skill       claudeskill.Status  `json:"skill"`
	SkillBin    string              `json:"skillBin"`
	SkillRules  bool                `json:"skillRules"`
	SkillPrompt string              `json:"skillPrompt"`
	ClaudeDir   string              `json:"claudeConfigDir"`

	LocalNetworkGated bool   `json:"localNetworkGated"`
	ConfigDir         string `json:"configDir"`
	StateDir          string `json:"stateDir"`
}

SettingsDTO is everything the Settings screen shows.

type SettingsInput added in v0.2.0

type SettingsInput struct {
	Layout     string `json:"layout"`
	LivePolicy string `json:"livePolicy"`
	RemoteCtl  bool   `json:"remoteControl"`
	MarkMoved  bool   `json:"markMoved"`
	SyncCode   bool   `json:"syncCode"`
	PushSource bool   `json:"pushSource"`
	UpdateChk  string `json:"updateCheck"`
}

SettingsInput are the settings the user can change.

type UpdateDTO

type UpdateDTO struct {
	Latest string `json:"latest"`
	Newer  bool   `json:"newer"`
	URL    string `json:"url"`
}

UpdateDTO is the result of an update check.

Jump to

Keyboard shortcuts

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