Skip to content

feat(config): doctor cwd fix + XDG Base Directory layout (BEFLOW-16, BEFLOW-17) - #5

Merged
corrm merged 4 commits into
mainfrom
feat/config-xdg-paths
Jun 21, 2026
Merged

feat(config): doctor cwd fix + XDG Base Directory layout (BEFLOW-16, BEFLOW-17)#5
corrm merged 4 commits into
mainfrom
feat/config-xdg-paths

Conversation

@corrm

@corrm corrm commented Jun 21, 2026

Copy link
Copy Markdown
Owner

BEFLOW-16 — doctor reads config from the fixed location

doctor was the only command falling back to process.cwd() instead of configDir(), so it pointed at a phantom project-local config, skipped auto-bootstrap, and gave a generic error. One-line fix + tests asserting it reads configDir() (the function, so the test survives the XDG change below).

BEFLOW-17 — XDG Base Directory layout (clean break)

New src/config/xdg.ts resolver (env-first when absolute, else ~/.config / ~/.local/state / ~/.local/share). Rewired all 7 path sites: config → $XDG_CONFIG_HOME, runs+decisions → $XDG_STATE_HOME, worktrees → $XDG_DATA_HOME. The resolver is the sole reader of XDG_*.

Breaking (pre-release): no migration; old ~/beflow / ~/.beflow are orphaned — re-run beflow doctor. Documented in README + config.md.

No config.schema.json change (path mentions are // comments, not .describe()). Gate green.

corrm added 4 commits June 21, 2026 03:53
doctor was the only command falling back to process.cwd() instead of the
fixed config location, so it pointed at a phantom project-local config,
skipped the auto-bootstrap every other command performs, and surfaced the
generic 'cannot read' error instead of the 'created from template' message.
Route it through configDir() like loadContext does.

Tests assert doctor passes configDir() (the function, not a literal) to the
loader, and that a missing config now reaches the configPath-keyed bootstrap.
…BEFLOW-17)

Move beflow's locations to the XDG spec via a single resolver (src/config/xdg.ts):
config (config.json, prompt + .mcp.json overrides) under $XDG_CONFIG_HOME/beflow,
resumable state (runs, decisions) under $XDG_STATE_HOME/beflow, and ephemeral
worktrees under $XDG_DATA_HOME/beflow — each env var honored only when absolute,
else the ~/.config / ~/.local/state / ~/.local/share fallbacks. The resolver is
the sole reader of XDG_* env; every path helper routes through it.

BREAKING (pre-release, clean break): no migration, no legacy fallback. The old
~/beflow and ~/.beflow locations are orphaned; users re-run `beflow doctor` to
bootstrap a fresh config. Also fixes the prior split where config lived in
~/beflow (no dot) while state lived in ~/.beflow.

Schema path doc-comments are plain // (not .describe()), so config.schema.json
is unchanged and its drift-guard stays green.
…LOW-19)

doctor now diagnoses and, with --fix, repairs the safe config-structure class
of problems: bootstrap a missing config.json, add a missing trackers.<active>
block (preserving existing keys; never clobbering malformed JSON), and ensure
the worktrees/runs/decisions dirs exist. Everything else (API key, repos, no
projects, acpx/gh) is reported with its exact manual remediation, never acted
on. Plain doctor suggests 'doctor --fix' only when a fixable problem is present.

fixDoctor is a pure function over injected fs primitives (DoctorFixDeps);
DoctorCheck gains an optional fixable flag tagged on the config + tracker-config
failures. No config schema change.
@corrm
corrm merged commit a3ec7b6 into main Jun 21, 2026
1 check passed
@corrm
corrm deleted the feat/config-xdg-paths branch June 21, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant