feat: move CLI config to cross-platform config directory#130
Merged
angeloashmore merged 5 commits intomainfrom Apr 15, 2026
Merged
feat: move CLI config to cross-platform config directory#130angeloashmore merged 5 commits intomainfrom
angeloashmore merged 5 commits intomainfrom
Conversation
Move CLI state from ~/.prismic to ~/.config/prismic/ with separate files per concern (credentials.json, update-notifier.json). Drop Slice Machine auth format compatibility (base/cookies fields, checkIsSliceMachineProject branching). Support PRISMIC_CONFIG_DIR env var override. Resolves #126 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Merge src/config.ts (prismic.config.json CRUD) into src/project.ts since both are project-level concerns - Recreate src/config.ts as the CLI config directory module (CREDENTIALS_PATH, UPDATE_NOTIFIER_STATE_PATH) - src/auth.ts now imports paths from src/config.ts instead of owning them - Update all import paths across consumers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename: InvalidPrismicConfig, MissingPrismicConfig, UnknownProjectRoot, InvalidLegacySliceMachineConfig, MissingLegacySliceMachineConfig — all now have an Error suffix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…h on Linux Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The old CLI wrote latestKnownVersion/lastUpdateCheckAt into ~/.prismic, breaking Slice Machine's backward compatibility. On startup, detect and delete these files so they don't interfere. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Resolves: #126
Description
Move CLI state from
~/.prismicto~/.config/prismic/with separate files per concern, following XDG conventions used by GitHub CLI, Vercel CLI, and others.~/.config/prismic/credentials.json~/.config/prismic/update-notifier.jsonbase/cookiesfields,checkIsSliceMachineProjectbranching)PRISMIC_CONFIG_DIRenv var overrideprismic loginChecklist
Preview
How to QA 1
prismic login→ verify~/.config/prismic/credentials.jsonis createdprismic whoami→ verify it reads from new locationprismic logout→ verifycredentials.jsonis deletedPRISMIC_CONFIG_DIR=/tmp/test-prismic prismic login→ verify credentials go to/tmp/test-prismic/credentials.json🦊
Note
Medium Risk
Touches CLI authentication persistence and update-notifier state storage, so path/permission issues could break login/logout or notifications across platforms. Logic is mostly a relocation/refactor with updated tests, but it changes on-disk formats and drops Slice Machine auth compatibility.
Overview
Moves CLI persisted state out of
~/.prismicinto a cross-platform config directory (defaulting to~/.config/prismic/, withPRISMIC_CONFIG_DIRoverride), splitting concerns intocredentials.json(auth) andupdate-notifier.json(update cache).Refactors project/config utilities by relocating config and route helpers from
src/config.tsintosrc/project.ts(and renaming related error classes), updating adapters and commands to import from../project.Removes Slice Machine auth-format branching (
base/cookies) and adds best-effort cleanup of the legacy~/.prismicfile when it appears to contain update-notifier state; update notifier now ensures parent directories exist before writing. Tests are updated to use the new paths and env override.Reviewed by Cursor Bugbot for commit 52cfefa. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩