Store devbox state in workspace .devbox directory#25
Merged
Conversation
Contributor
There was a problem hiding this comment.
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>/.devboxand removed legacy centralized state-root logic. - Updated CLI/tests to read/write state from
.devbox/(including template-generated config andstate.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.
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.
Summary
.devboxdirectory instead of a centralized location.devboxstate files