Skip to content

Store devbox state in workspace .devbox directory#25

Merged
PabloZaiden merged 1 commit into
mainfrom
plan-from-stop-using-centralized-dir-db97433
May 11, 2026
Merged

Store devbox state in workspace .devbox directory#25
PabloZaiden merged 1 commit into
mainfrom
plan-from-stop-using-centralized-dir-db97433

Conversation

@PabloZaiden
Copy link
Copy Markdown
Owner

Summary

  • Move devbox state storage into each workspace’s .devbox directory instead of a centralized location
  • Update CLI/core behavior and tests to use the workspace-local state directory
  • Document the new state directory behavior and ignore generated .devbox state files

Copilot AI review requested due to automatic review settings May 11, 2026 20:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves devbox’s persisted workspace state from an OS-level centralized state location into a workspace-local .devbox/ directory, updating core path resolution, CLI behavior, tests, and documentation accordingly.

Changes:

  • Switched workspace state directory resolution to <workspace>/.devbox and removed legacy centralized state-root logic.
  • Updated CLI/tests to read/write state from .devbox/ (including template-generated config and state.json) and ensure .devbox/ is VCS-ignored.
  • Documented the new workspace-local state behavior and added .devbox/ to .gitignore.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/examples.test.ts Updates example fixtures to expect .devbox/ as the state directory.
tests/examples.live.test.ts Updates live fixtures to expect state.json under .devbox/.
tests/core.test.ts Adjusts unit tests to validate workspace-local state paths and template config behavior.
src/core.ts Redirects state dir/file paths to .devbox/ and removes legacy centralized state-root + legacy template generated-config path logic.
src/cli.ts Ensures .devbox/ is ignored via git exclude when running up/rebuild.
README.md Documents workspace-local .devbox/ state location and updated behavior notes.
.gitignore Ignores .devbox/ in this repository.
Comments suppressed due to low confidence (1)

src/core.ts:405

  • With getStateRoot removed, loadWorkspaceState() will now only look for state at /.devbox/state.json. This means existing installs with state stored under the old global locations (e.g. $XDG_STATE_HOME/devbox or ~/Library/Application Support/devbox) will be treated as having no state, losing persisted port/template/config info after upgrade. Consider adding a fallback that checks the legacy state path and migrates/copies it into .devbox/ on first load (or explicitly documenting this as a breaking change and providing a migration command).
export function getWorkspaceStateDir(workspacePath: string): string {
  return path.join(workspacePath, ".devbox");
}

export function getWorkspaceStateFile(workspacePath: string): string {
  return path.join(getWorkspaceStateDir(workspacePath), "state.json");
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PabloZaiden PabloZaiden merged commit 3e28b4d into main May 11, 2026
5 checks passed
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.

2 participants