Skip to content

feat: move CLI config to cross-platform config directory#130

Merged
angeloashmore merged 5 commits intomainfrom
aa/config-dir
Apr 15, 2026
Merged

feat: move CLI config to cross-platform config directory#130
angeloashmore merged 5 commits intomainfrom
aa/config-dir

Conversation

@angeloashmore
Copy link
Copy Markdown
Member

@angeloashmore angeloashmore commented Apr 14, 2026

Resolves: #126

Description

Move CLI state from ~/.prismic to ~/.config/prismic/ with separate files per concern, following XDG conventions used by GitHub CLI, Vercel CLI, and others.

  • Auth credentials → ~/.config/prismic/credentials.json
  • Update notifier state → ~/.config/prismic/update-notifier.json
  • Drop Slice Machine auth format compatibility (base/cookies fields, checkIsSliceMachineProject branching)
  • Support PRISMIC_CONFIG_DIR env var override
  • No migration — users re-login with prismic login

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

  1. prismic login → verify ~/.config/prismic/credentials.json is created
  2. prismic whoami → verify it reads from new location
  3. prismic logout → verify credentials.json is deleted
  4. Run with PRISMIC_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 ~/.prismic into a cross-platform config directory (defaulting to ~/.config/prismic/, with PRISMIC_CONFIG_DIR override), splitting concerns into credentials.json (auth) and update-notifier.json (update cache).

Refactors project/config utilities by relocating config and route helpers from src/config.ts into src/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 ~/.prismic file 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

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 5 commits April 14, 2026 23:52
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>
@angeloashmore angeloashmore merged commit 39fc1d7 into main Apr 15, 2026
13 checks passed
@angeloashmore angeloashmore deleted the aa/config-dir branch April 15, 2026 01:02
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.

feat: move config and auth files from ~/.prismic to ~/.config/prismic/

1 participant