Open
Conversation
Export getXDGStatePath/getXDGDataPath as public functions for use by the stateguard package. Add SelectWithDefault method that returns a configurable default on empty input or EOF, following the existing ConfirmWithDefault pattern.
Detects existing dot state (manifest, packages, symlinks) before the first mutating command and prompts the user to continue, start fresh, or back up and reset. Marker file prevents re-prompting. Includes marker management, three action handlers (continue, fresh, backup+fresh), and orchestrator with full test coverage (23 tests).
Adds runStateGuard as the first call in manage, adopt, and clone. Batch mode and non-TTY sessions auto-continue. Resolves manifest dir, target dir, and config path from existing config infrastructure.
Use output.Formatter and render.Colorizer for styled guard output matching the rest of the CLI. Isolate XDG_STATE_HOME in integration tests that spawn subprocess manage commands to prevent the guard marker from leaking to the real home directory.
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
manage,adopt,clone)--batch) and non-TTY sessions~/.local/state/dot/.dot-acknowledged) so prompt appears exactly onceChanges
GetXDGStatePath/GetXDGDataPathininternal/config/extended.goSelectWithDefaulttointernal/cli/prompt/— returns configurable default on empty input/EOFinternal/stateguard/package — marker management, action handlers (continue, fresh, backup+fresh), orchestratorrunStateGuard(cmd)as first call inrunManage,runAdoptCommand,runCloneTest plan
go test ./internal/stateguard/... -race -count=1— 23 tests passgo test ./internal/cli/prompt/... -race -count=1— all tests pass including new SelectWithDefaultgo test ./cmd/dot/... -race -count=1— all tests pass including integration testsgo test ./... -race -count=1— full suite passes, zero regressionsdot manage→ verify prompt appears and each option works