Skip to content

fix: wire --no-color, add XDG_CONFIG_HOME, add delete confirmations#39

Merged
lohnim merged 3 commits intomainfrom
chris/best-practice
Mar 26, 2026
Merged

fix: wire --no-color, add XDG_CONFIG_HOME, add delete confirmations#39
lohnim merged 3 commits intomainfrom
chris/best-practice

Conversation

@lohnim
Copy link
Copy Markdown
Collaborator

@lohnim lohnim commented Mar 26, 2026

Summary

Addresses the three YELLOW items from a CLI best-practices audit against internal design skills:

  • --no-color flag wired to color system — flag was declared in Commander but never connected to the actual color logic in colors.ts. Now esc/rgb/bgRgb check noColor lazily at render time, and the preAction hook calls setNoColor(true) when --no-color is passed.
  • $XDG_CONFIG_HOME support — config path now respects the XDG env var instead of hardcoding ~/.config. Falls back to ~/.config when unset (no behavior change for most users).
  • Confirmation prompts on destructive deletesapps delete and webhooks delete now prompt before executing, matching the existing pattern in config reset. Both accept -y, --yes to skip the prompt in CI/scripts.

Test plan

  • pnpm build passes
  • pnpm test passes (245/245 across 37 test files)
  • pnpm lint passes
  • Manual: alchemy apps delete <id> shows confirmation prompt
  • Manual: alchemy apps delete <id> --yes skips prompt
  • Manual: alchemy webhooks delete <id> shows confirmation prompt
  • Manual: echo "test" | alchemy balance --no-color produces uncolored output
  • Manual: XDG_CONFIG_HOME=/tmp/xdg alchemy config path uses /tmp/xdg/alchemy/config.json

🤖 Generated with Claude Code

Three fixes from a CLI best-practices audit:

1. --no-color flag was declared but never wired to the color system.
   Colors are now checked lazily at render time and the preAction hook
   calls setNoColor() when the flag is present.

2. Config path now respects $XDG_CONFIG_HOME instead of hardcoding
   ~/.config. Falls back to ~/.config when the env var is unset.

3. `apps delete` and `webhooks delete` now prompt for confirmation
   before executing, matching the existing pattern in `config reset`.
   Both accept --yes / -y to skip the prompt in scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lohnim lohnim requested a review from a team as a code owner March 26, 2026 00:15
Copy link
Copy Markdown
Collaborator

@CodesMcCabe CodesMcCabe left a comment

Choose a reason for hiding this comment

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

Run /changeset through Claude to create the changeset md. Having that allows the github action to create a release to NPM.

lohnim and others added 2 commits March 25, 2026 21:40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests were failing on CI because XDG_CONFIG_HOME took precedence over
HOME in configPath(), causing config files to be written outside the
temp directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lohnim lohnim merged commit 356310b into main Mar 26, 2026
7 checks passed
@lohnim lohnim deleted the chris/best-practice branch March 26, 2026 02:16
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