wbhome

package
v0.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
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.

View Source
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

func Root

func Root(projectsRoot string) (string, error)

Root resolves WB's authoritative write home. It remains for callers that only create state; worktree migration-aware callers must use Resolve.

Types

type Layout added in v0.22.2

type Layout struct {
	Home          string
	WorktreesRoot string
	Legacy        bool
}

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

type Resolution struct {
	Write    Layout
	Read     []Layout
	Explicit bool
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL