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
- Variables
- type App
- func (a *App) AddCLIToPath() (string, error)
- func (a *App) AddHost(name, destination string, password, remember bool) error
- func (a *App) AddSkillRules() ([]string, error)
- func (a *App) Apply() (*DoneDTO, error)
- func (a *App) CancelPassword(id string)
- func (a *App) CheckUpdate() (*UpdateDTO, error)
- func (a *App) ChooseFolder(title string) (string, error)
- func (a *App) CopyText(text string) bool
- func (a *App) Discover() []HostDTO
- func (a *App) DismissCLIOffer() error
- func (a *App) DismissSkillOffer() error
- func (a *App) ForgetPassword(name string) error
- func (a *App) Info() Info
- func (a *App) InstallCLI(force bool) (integrate.CLIStatus, error)
- func (a *App) InstallSkill(force, addRules bool) (claudeskill.Status, error)
- func (a *App) OpenInDesktop() error
- func (a *App) OpenInTerminal(command string) error
- func (a *App) OpenLocalNetworkSettings() error
- func (a *App) OpenURL(url string) error
- func (a *App) PendingPasswords() []PasswordRequest
- func (a *App) Plan(machine, sessionID string, o OptsDTO) (*PlanDTO, error)
- func (a *App) ProvidePassword(id, password string, remember bool) error
- func (a *App) RemoveSkill(force bool) (claudeskill.Status, error)
- func (a *App) RetryLocalNetwork()
- func (a *App) Reveal(path string) error
- func (a *App) SaveSettings(in SettingsInput) error
- func (a *App) Scan() (*ScanDTO, error)
- func (a *App) ScanKeys(name string) (*KeysDTO, error)
- func (a *App) SetAllowed(name, destination string, allowed bool) error
- func (a *App) SetAuth(name, auth string, remember bool) error
- func (a *App) SetReposDir(dir string) error
- func (a *App) SetUpdateCheck(on bool) error
- func (a *App) Settings() SettingsDTO
- func (a *App) SetupKeyLogin(name string, createKey bool) (*KeyLoginDTO, error)
- func (a *App) Shutdown()
- func (a *App) SkillPreview() (string, error)
- func (a *App) TrustHost(name string) error
- func (a *App) Undo(sessionID string) error
- func (a *App) UninstallCLI() (integrate.CLIStatus, error)
- type DoneDTO
- type EntryDTO
- type GroupDTO
- type HostDTO
- type Info
- type KeyLoginDTO
- type KeysDTO
- type MachineDTO
- type OptsDTO
- type PasswordRequest
- type PlanDTO
- type ScanDTO
- type SettingsDTO
- type SettingsInput
- type UpdateDTO
Constants ¶
const PasswordEvent = "hopsesh:password"
PasswordEvent is the event the window gets when ssh asks for a machine's password.
Variables ¶
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 (*App) AddCLIToPath ¶ added in v0.2.0
AddCLIToPath adds ~/.local/bin to the login shell's PATH (only on the user's click).
func (*App) AddHost ¶
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
AddSkillRules adds the permission rules (read-only hopsesh commands allowed, moves ask) to Claude Code's settings.
func (*App) CancelPassword ¶ added in v0.2.0
CancelPassword declines a password question; that machine is skipped this time.
func (*App) CheckUpdate ¶
CheckUpdate looks for a newer release, at most once a day, and only when allowed.
func (*App) ChooseFolder ¶
ChooseFolder asks for a directory.
func (*App) DismissCLIOffer ¶ added in v0.2.0
DismissCLIOffer stops the app from offering to link the command-line tool.
func (*App) DismissSkillOffer ¶ added in v0.2.0
DismissSkillOffer stops the app from offering the skill (it stays in Settings).
func (*App) ForgetPassword ¶ added in v0.2.0
ForgetPassword removes a machine's remembered password (it is asked for again).
func (*App) InstallCLI ¶ added in v0.2.0
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 ¶
OpenInDesktop opens the moved session in the Claude desktop app.
func (*App) OpenInTerminal ¶
OpenInTerminal runs the resume command in a new terminal window.
func (*App) OpenLocalNetworkSettings ¶
OpenLocalNetworkSettings opens System Settings at Privacy & Security, where the Local Network list is (macOS offers no link to the list itself).
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) ProvidePassword ¶ added in v0.2.0
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) SaveSettings ¶ added in v0.2.0
func (a *App) SaveSettings(in SettingsInput) error
SaveSettings stores the user's choices.
func (*App) SetAllowed ¶
SetAllowed records consent for a machine.
func (*App) SetAuth ¶ added in v0.2.0
SetAuth switches a machine between key login ("key") and password login ("password").
func (*App) SetReposDir ¶
SetReposDir changes the clone folder.
func (*App) SetUpdateCheck ¶
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) SkillPreview ¶ added in v0.2.0
SkillPreview returns the SKILL.md this build would install.
func (*App) TrustHost ¶
TrustHost re-scans and records the machine's host keys (after the user confirmed).
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 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.