feat(config): doctor cwd fix + XDG Base Directory layout (BEFLOW-16, BEFLOW-17) - #5
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEFLOW-16 — doctor reads config from the fixed location
doctorwas the only command falling back toprocess.cwd()instead ofconfigDir(), so it pointed at a phantom project-local config, skipped auto-bootstrap, and gave a generic error. One-line fix + tests asserting it readsconfigDir()(the function, so the test survives the XDG change below).BEFLOW-17 — XDG Base Directory layout (clean break)
New
src/config/xdg.tsresolver (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 ofXDG_*.Breaking (pre-release): no migration; old
~/beflow/~/.befloware orphaned — re-runbeflow doctor. Documented in README + config.md.No
config.schema.jsonchange (path mentions are//comments, not.describe()). Gate green.