Documentation
¶
Index ¶
- Constants
- func Complete(wrkHome string, req CompletionRequest) []string
- func FormatCompareBranches(refA, refB string, result *git.CompareBranchesResult) string
- func FormatMasterBrief(result *git.CompareBranchesResult, colorEnabled bool) string
- func FormatRemoteBrief(result *git.CompareBranchesResult, colorEnabled bool) string
- func IsWipSubject(subject string) bool
- func NormalizeTaskSlug(taskDesc string) (string, error)
- func RegisterWebServe(fn webServeFunc)
- func ResolveReinstallScanRoot(workDir string, useMain bool) (string, error)
- func ResolveWrkHome(wrkHome string) (string, error)
- func Run(args []string) error
- func ShellSafeQuote(s string) string
- func Version() string
- type Action
- type CompletionRequest
- type Config
- type CreateAgent
- type CreateSection
- type CreateTerminal
- type CreateWindow
- type CreateWorktreeResult
- type DirHintOptions
- type Edge
- type ExitCodeError
- type Inventory
- type LocalReinstallPlan
- type Method
- type ModuleEntry
- type ModuleReinstallPlan
- type MultiLocalReinstallPlan
- type PlanItem
- type ProjectEntry
- type ReplaceEntry
- type RequireEntry
- type SourceRelease
- type SourceReleasesResult
- type StatusPathLists
- type WebServeOptions
Constants ¶
const ( MethodGoInstall Method = "go-install" MethodGoRunInstall Method = "go-run-install" ActionInstall Action = "install" ActionSkip Action = "skip" )
Variables ¶
This section is empty.
Functions ¶
func Complete ¶
func Complete(wrkHome string, req CompletionRequest) []string
Complete returns bash tab-completion candidates for the given request.
func FormatCompareBranches ¶
func FormatCompareBranches(refA, refB string, result *git.CompareBranchesResult) string
FormatCompareBranches returns kool compare-branch text for refA vs refB.
func FormatMasterBrief ¶
func FormatMasterBrief(result *git.CompareBranchesResult, colorEnabled bool) string
FormatMasterBrief returns a one-line master sync summary for --status linked worktrees.
func FormatRemoteBrief ¶
func FormatRemoteBrief(result *git.CompareBranchesResult, colorEnabled bool) string
FormatRemoteBrief returns a one-line remote sync summary for --projects.
func IsWipSubject ¶ added in v0.0.2
IsWipSubject reports whether a commit subject is a WIP commit for sync pass-1. After trimming surrounding whitespace, match is case-insensitive prefix any of:
wip: | wip( | [wip]
Empty / whitespace-only subjects and mid-string-only occurrences are not WIP.
func NormalizeTaskSlug ¶
NormalizeTaskSlug turns free-text task into a path slug. Empty or whitespace-only input yields empty slug (no task segment). Non-empty input that slugifies to empty is an error.
func RegisterWebServe ¶
func RegisterWebServe(fn webServeFunc)
RegisterWebServe sets the implementation used by `wrk --web`. cmd/wrk calls this from init with wrkcli/web.Serve.
func ResolveReinstallScanRoot ¶ added in v0.0.6
ResolveReinstallScanRoot returns the absolute directory from which Go module discovery should begin for multi-module local reinstall planning.
Rules (priority):
- useMain == true: workDir must be inside a git checkout; scan root is the main repository path (ResolveMainRepo of ShowToplevel).
- useMain == false and inside git: scan root is ShowToplevel(workDir).
- Not in git: walk up from workDir looking for a go.mod; first hit is root.
- No scan root: not in git and no go.mod on the walk-up → error.
func ResolveWrkHome ¶
ResolveWrkHome returns wrkHome when non-empty; otherwise WRK_HOME or ~/.wrk.
func Run ¶
Run executes wrk logic with args. The first positional argument, if present, is the source directory for all modes.
func ShellSafeQuote ¶
ShellSafeQuote encodes s as a single POSIX shell word using single quotes. Empty string becomes ”; embedded single quotes use the '\” join form.
Types ¶
type CompletionRequest ¶
CompletionRequest carries bash COMP_WORDS and COMP_CWORD for tab completion.
type Config ¶
type Config struct {
Version int `json:"version"`
Create *CreateSection `json:"create,omitempty"`
}
Config is the optional user config at $WRK_HOME/config.json.
type CreateAgent ¶
type CreateAgent struct {
Enabled *bool `json:"enabled,omitempty"`
Runner string `json:"runner,omitempty"`
PromptTemplate string `json:"prompt_template,omitempty"`
Args []string `json:"args,omitempty"`
}
CreateAgent configures agent-run launch after create.
type CreateSection ¶
type CreateSection struct {
Window *CreateWindow `json:"window,omitempty"`
Terminal *CreateTerminal `json:"terminal,omitempty"`
Agent *CreateAgent `json:"agent,omitempty"`
}
CreateSection holds create-mode UX options. Legacy create.interceptor is deliberately omitted so leftover JSON is ignored.
type CreateTerminal ¶
type CreateTerminal struct {
// Mode is "new" | "reuse" | "smart"; absent/empty means terminal off.
Mode string `json:"mode,omitempty"`
}
CreateTerminal configures iTerm2 open mode.
type CreateWindow ¶
type CreateWindow struct {
// Mode is "new" when window UX is on; absent/empty means off.
Mode string `json:"mode,omitempty"`
}
CreateWindow configures Mission Control Desktop creation.
type CreateWorktreeResult ¶
CreateWorktreeResult is the structured outcome of default worktree creation.
func CreateDefaultWorktree ¶
func CreateDefaultWorktree(projectPath, wrkHome, taskSlug string) (*CreateWorktreeResult, error)
CreateDefaultWorktree creates a linked worktree under wrkHome/worktrees using wrk default naming (basename-branchToken-date[-slug][-N]).
projectPath may be the main repo or any checkout that resolves to it. wrkHome must be non-empty (callers inject Options.WrkHome or ResolveWrkHome). taskSlug is an already-slugified task segment; empty means no task in names. Callers that accept free-text tasks should use NormalizeTaskSlug first.
type DirHintOptions ¶
DirHintOptions carries CLI context for reconstructing guided file-collision hints.
type Edge ¶ added in v0.0.6
type Edge struct {
ConsumerProject string
ConsumerModule string
DepPath string
DepVersion string
OwnerProject string
}
Edge is a require from a consumer module to a dependency module path whose owner project is known in the inventory.
type ExitCodeError ¶
type ExitCodeError struct {
Code int
}
ExitCodeError signals a non-zero exit without stderr output.
func (ExitCodeError) Error ¶
func (e ExitCodeError) Error() string
type Inventory ¶ added in v0.0.6
type Inventory struct {
Projects []ProjectEntry
SkippedPaths []string
}
Inventory is the in-process model of registered projects, their modules, and soft-skipped registry paths.
func BuildInventory ¶ added in v0.0.6
BuildInventory loads WRK_HOME projects, soft-skips missing paths, scans modules, and builds ownership.
func (Inventory) CrossEdges ¶ added in v0.0.6
CrossEdges returns require edges where consumer and owner projects both known and differ.
func (Inventory) FindOwner ¶ added in v0.0.6
FindOwner returns the registered project path that owns modulePath.
func (Inventory) IntraEdges ¶ added in v0.0.6
IntraEdges returns require edges where consumer and owner projects both known and equal.
type LocalReinstallPlan ¶ added in v0.0.6
type LocalReinstallPlan struct {
ModuleRoot string
ModulePath string // full module path from go.mod
ModuleName string // basename of module path from go.mod
BinDir string
Items []PlanItem // sorted lexicographically by BinName
}
LocalReinstallPlan is the pure discovery/filter result for local binary reinstalls.
func PlanLocalReinstalls ¶ added in v0.0.6
func PlanLocalReinstalls(moduleRoot, binDir string) (*LocalReinstallPlan, error)
PlanLocalReinstalls discovers package-main candidates under moduleRoot's cmd/ and script/ trees and filters them against binDir.
moduleRoot must contain a parseable go.mod with a module path. Callers resolve binDir (e.g. GOBIN); this function only stats entries there.
type Method ¶ added in v0.0.6
type Method string
Method and Action are string type aliases so harness code can use string(it.Method).
type ModuleEntry ¶ added in v0.0.6
type ModuleEntry struct {
Dir string // relative to project Path; "." for root
Path string // module path from go.mod
Requires []RequireEntry
Replaces []ReplaceEntry
}
ModuleEntry describes one go.mod under a project.
type ModuleReinstallPlan ¶ added in v0.0.6
type ModuleReinstallPlan struct {
ModuleRoot string
ModulePath string // full module path from go.mod
ModuleName string // basename of module path from go.mod
RelDir string // module root relative to scan root ("." or slash path); set by FromWorkDir
Items []PlanItem // sorted lexicographically by BinName
}
ModuleReinstallPlan is one module's contribution to a multi-module plan.
type MultiLocalReinstallPlan ¶ added in v0.0.6
type MultiLocalReinstallPlan struct {
BinDir string
Modules []ModuleReinstallPlan
}
MultiLocalReinstallPlan is the multi-module discovery/filter result for a shared binDir. Modules are ordered lexicographically by absolute ModuleRoot.
func PlanLocalReinstallsFromWorkDir ¶ added in v0.0.6
func PlanLocalReinstallsFromWorkDir(workDir, binDir string, useMain bool) (*MultiLocalReinstallPlan, error)
PlanLocalReinstallsFromWorkDir resolves the scan root from workDir, discovers every Go module under that root via mod/scan, and builds a multi-module reinstall plan against binDir.
Zero modules under the scan root is a hard error (message mentions go.mod). Each ModuleReinstallPlan.RelDir is the scan-relative module dir (scan.Module.Dir).
func PlanLocalReinstallsMulti ¶ added in v0.0.6
func PlanLocalReinstallsMulti(moduleRoots []string, binDir string) (*MultiLocalReinstallPlan, error)
PlanLocalReinstallsMulti runs PlanLocalReinstalls for each module root and returns a multi-module plan sorted by absolute ModuleRoot path.
Empty moduleRoots yields an empty Modules list and nil error. After per-module planning, if the same BinName has Action=install from two or more modules, returns a hard error naming the bin and both modules. Skip-only (or install×skip) duplicates across modules are allowed.
type PlanItem ¶ added in v0.0.6
type PlanItem struct {
BinName string
RelPath string // "./cmd/foo" or "./script/foo/install"
Method Method // "go-install" | "go-run-install"
Action Action // "install" | "skip"
}
PlanItem is one candidate binary to install or skip.
type ProjectEntry ¶ added in v0.0.6
type ProjectEntry struct {
Path string
Modules []ModuleEntry
}
ProjectEntry is one existing registered main-repo path and its Go modules.
type ReplaceEntry ¶ added in v0.0.6
ReplaceEntry is a single replace directive from go.mod.
type RequireEntry ¶ added in v0.0.6
RequireEntry is a single require directive from go.mod.
type SourceRelease ¶ added in v0.0.6
type SourceRelease struct {
ModulePath string
Tag string // full git tag, e.g. "v1.2.3" or "sub/v0.1.0"
Version string // go require version, e.g. "v1.2.3" or "v0.1.0"
}
SourceRelease is one module's resolved git tag and go require version.
type SourceReleasesResult ¶ added in v0.0.6
type SourceReleasesResult struct {
Releases []SourceRelease
Missing []string
}
SourceReleasesResult maps modules under a source main repo to their latest numeric release tags (or lists modules with no such tag).
func ResolveSourceReleases ¶ added in v0.0.6
func ResolveSourceReleases(sourceMain string) (SourceReleasesResult, error)
ResolveSourceReleases scans sourceMain for modules and maps numeric release tags to go require versions. Modules without a numeric tag are listed in Missing; overall success is still returned when any/all modules are missing.
type StatusPathLists ¶ added in v0.0.5
StatusPathLists holds ordered primary vs external status paths for main-repo status display planning.
func PartitionStatusPaths ¶ added in v0.0.5
func PartitionStatusPaths(mainRoot string, scanPaths, linkedOrdered []string) StatusPathLists
PartitionStatusPaths partitions status paths for main-repo status display planning. Primary: mainRoot first, then main-owned linked worktrees in linkedOrdered (ListLinked porcelain) order. External: scanPaths that are not primary, sorted by normalized path. Returned paths are storage.NormalizePath'd.
type WebServeOptions ¶
WebServeOptions configures the local web UI started by `wrk --web`.
Source Files
¶
- basename.go
- bashintegration.go
- cd.go
- color.go
- compare_format.go
- config.go
- create_api.go
- create_ux.go
- exec_cmd.go
- followup.go
- gen_commit_msg.go
- gitexec.go
- invocation.go
- main.go
- name_budget.go
- plan_local_reinstall.go
- projects_dep_graph.go
- projects_gather.go
- projects_inventory.go
- projects_perf.go
- propagate_tags.go
- push_main.go
- run.go
- set_config.go
- set_task_replace.go
- shell_safe.go
- skill.go
- status.go
- status_partition.go
- sync.go
- tag_next.go
- task_like.go
- version.go
- web_serve.go
- where.go