Documentation
¶
Overview ¶
Package workspacecreate owns the shared Create Workspace form: presentation and in-memory state. It does not talk to git or tmux. Hosts bind it and submit through workspaceops.
Index ¶
- Constants
- type Form
- func (f *Form) Agent() string
- func (f *Form) AgentItems() []modal.DropdownItem
- func (f *Form) BaseBranch() string
- func (f *Form) Build(width int) *modal.Modal
- func (f *Form) Error() string
- func (f *Form) InitialFocusID() string
- func (f *Form) Kind() Kind
- func (f *Form) Modal() *modal.Modal
- func (f *Form) Name() string
- func (f *Form) PersistLastAgent()
- func (f *Form) ProjectIndex() int
- func (f *Form) ProjectKey() string
- func (f *Form) RestoreFocus()
- func (f *Form) SetBranches(branches []string, current string)
- func (f *Form) SetError(msg string)
- func (f *Form) SetKind(k Kind)
- func (f *Form) SetKindFromClickX(x, regionX, regionW int)
- func (f *Form) ShowSkip() bool
- func (f *Form) SkipPerms() bool
- func (f *Form) SyncAfterInput()
- func (f *Form) Validate() string
- type Kind
- type OpenOpts
- type ProjectItem
Constants ¶
const ( FieldKind = "create-kind" FieldProject = "create-project" FieldName = "create-name" FieldBase = "create-base" FieldAgent = "create-agent" FieldSkip = "create-skip-permissions" ActionCreate = "create-submit" ActionCancel = "create-cancel" )
Stable field IDs shared by both hosts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form is the Create Workspace chooser: inputs, indexes, skip, error, and modal cache.
func Open ¶
Open builds form state and loads last-used agent and that agent's auto-approve. It does not persist last agent.
func (*Form) AgentItems ¶
func (f *Form) AgentItems() []modal.DropdownItem
AgentItems is this kind's picker (None first for shells, last for worktrees).
func (*Form) BaseBranch ¶
func (*Form) Build ¶
Build returns the cached modal, rebuilding when width or kind/branch-list visibility change.
func (*Form) InitialFocusID ¶
InitialFocusID is Name, or the kind toggle when Open was given FocusKind.
func (*Form) PersistLastAgent ¶
func (f *Form) PersistLastAgent()
PersistLastAgent writes the current agent after a successful modal create.
func (*Form) ProjectIndex ¶
func (*Form) ProjectKey ¶
func (*Form) RestoreFocus ¶
func (f *Form) RestoreFocus()
RestoreFocus applies the pending focus after the modal has been rendered. No-op if focus is already managed by the modal.
func (*Form) SetBranches ¶
SetBranches replaces the worktree base-branch list. Prefills current as the value unless the typed value is still a branch in the new list.
func (*Form) SetKindFromClickX ¶
SetKindFromClickX picks Shell or Worktree from a click on the kind toggle.
func (*Form) SyncAfterInput ¶
func (f *Form) SyncAfterInput()
SyncAfterInput rematches combo indexes, reloads auto-approve when the agent changes, and persists skip immediately on toggle.
type Kind ¶
type Kind int
Kind is the workspace type the form will create.
func KindFromClickX ¶
KindFromClickX maps a click on the kind toggle to Shell (left half) or Worktree (right half). regionX/regionW are the toggle's hit-region bounds.
type OpenOpts ¶
type OpenOpts struct {
Kind Kind
FocusKind bool
ShowProject bool
ProjectKey string
Name string
Projects []ProjectItem
Agents []string
Branches []string
NextShell string
PreferredAgent string
DefaultAgent string
}
OpenOpts configures a new form. PreferredAgent and DefaultAgent are the already-resolved fallbacks from the host (.sidecar-agent / defaultAgentType); this package does not load them from disk.
type ProjectItem ¶
ProjectItem is one row in the global project combo.