Documentation
¶
Overview ¶
Package worktrees implements `sf worktrees` — a read-only, cross-project view of git-worktree dev forks under a configured parent directory (see DefaultWww). For each repo it lists linked worktrees; where a repo ships dev/worktree.sh it enriches them with that script's `ls --json` (stack state, health, ports — the single source of truth for the per-project scheme). This tool never mutates: create/remove forks via the project's own dev/worktree.sh.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultWww ¶
func DefaultWww() string
DefaultWww is the parent dir sf worktrees scans when neither --www nor Options.Www is set: the SOFIA_WWW env var when present, else the conventional /www directory when it actually exists on this machine (many dev setups symlink it to a shared checkout root — but that's a convention, not something every install has), else the current working directory. No single absolute path is universal, so unlike a hardcoded "/www" this never points somewhere that doesn't exist without the caller opting in.
func NewCommand ¶
NewCommand returns the `worktrees` Cobra command (`sf worktrees`).
Types ¶
type Fork ¶
type Fork struct {
Project string `json:"project"` // repo name (basename of /www/<project>)
Slug string `json:"slug,omitempty"` // fork id from dev/worktree.sh; empty for plain worktrees
Branch string `json:"branch"`
Dir string `json:"dir"`
Running *bool `json:"running,omitempty"`
Health string `json:"health,omitempty"`
Dirty bool `json:"dirty"`
Ahead *int `json:"ahead,omitempty"`
URL string `json:"url,omitempty"`
FrontURL string `json:"front_url,omitempty"` // front-end (vite) URL, where the scheme provides one
Age string `json:"age,omitempty"`
}
Fork is one linked worktree, optionally enriched with dev-stack info when the owning repo ships dev/worktree.sh (otherwise stack fields stay empty/nil).