Documentation
¶
Overview ¶
Package wbhome resolves the directories WB uses to coordinate work across agents and sessions: task worktrees, operation locks, and reports.
That directory used to live at <projects-root>/.wb. A recursive tool that doesn't know WB's exclusion rules — a search indexer, backup, an ad-hoc grep — walks straight into it and double-counts every in-flight worktree as a separate repository. Moving the default to the user's home directory makes "don't walk into WB's state" the default for every tool, not a rule each one has to learn.
Index ¶
Constants ¶
const EnvMigrationCompat = "WB_HOME_MIGRATION_COMPAT"
EnvMigrationCompat is written only by a managed hook that pinned the normal default home at installation time. Its value must be that resolved default home, rather than a generic boolean. This lets the resolver distinguish the one migration-compatible hook context from an arbitrary explicit WB_HOME.
const EnvOverride = "WB_HOME"
EnvOverride names the environment variable that pins WB's home directory, overriding both the new default and legacy detection. Tests use it to stay hermetic; operators use it for unusual layouts.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Layout ¶ added in v0.22.2
Layout is one supported on-disk WB state layout. Home is the parent of its worktrees, locks, and reports. Legacy is true only for the historic <projects-root>/.wb layout that remains readable during the migration.
type Resolution ¶ added in v0.22.2
Resolution makes the migration policy explicit. Write is the only layout where new state may be created; Read contains Write plus a discovered legacy layout when the default migration path can safely support it.
An explicit WB_HOME is intentionally authoritative: it is commonly used by parallel agents and hermetic tests, neither of which may accidentally scan or mutate a neighbouring projects-root legacy directory.
func Resolve ¶ added in v0.22.2
func Resolve(projectsRoot string) (Resolution, error)
Resolve returns the write home and every compatible read layout for one projects root. New state always belongs under ~/.wb by default; the legacy projects-root directory is never selected as a silent write fallback.