Skip to content

feat(cli): improve output UX and error handling#736

Merged
kguzek merged 4 commits into
mainfrom
feat/error-handling
Mar 14, 2026
Merged

feat(cli): improve output UX and error handling#736
kguzek merged 4 commits into
mainfrom
feat/error-handling

Conversation

@kguzek

@kguzek kguzek commented Mar 13, 2026

Copy link
Copy Markdown
Member

also adds a temporary dependency version check which detects unsupported versions of eslint

resolves #727

@kguzek kguzek self-assigned this Mar 13, 2026
@kguzek kguzek added the enhancement New feature or request label Mar 13, 2026
@kguzek
kguzek requested a review from Copilot March 14, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors CLI UX and error handling by centralizing spinner behavior and improving top-level async error handling, while also making small messaging/lint cleanups.

Changes:

  • Introduces a runWithSpinner utility to standardize clack spinner usage with error handling.
  • Updates PackageJson.install() to use the shared spinner helper for install/update flows.
  • Improves CLI termination behavior by wrapping main() in an async mainWrapper() with environment-specific error output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/utils/run-with-spinner.ts Adds reusable helper to run async work with interactive spinner start/stop/error messages.
src/utils/package-json.ts Replaces duplicated spinner logic in install() with runWithSpinner() calls.
src/eslint/configs/comments.ts Removes unnecessary eslint-disable comment in plugin registration.
src/cli/index.ts Tweaks user-facing warning copy, simplifies success printing, and adds robust async error wrapper with issue link.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/utils/package-json.ts Outdated
Comment thread src/cli/index.ts Outdated
Comment thread src/cli/index.ts
@kguzek
kguzek force-pushed the feat/error-handling branch from 2112ede to 4fccd44 Compare March 14, 2026 00:08
@pkg-pr-new

pkg-pr-new Bot commented Mar 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solvro/config@736

commit: d171b0f

@kguzek
kguzek force-pushed the feat/error-handling branch from e388360 to 7fe0b63 Compare March 14, 2026 01:28
@kguzek
kguzek requested a review from Copilot March 14, 2026 01:29
@kguzek kguzek changed the title feat(cli): add error handling feat(cli): improve output UX and error handling Mar 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors parts of the CLI setup flow to improve UX and error handling, introducing shared utilities (spinner + project-type confirmation) and adding a centralized bug tracker URL for user-facing guidance.

Changes:

  • Added reusable helpers: runWithSpinner() and confirmProjectType(), plus a BUG_TRACKER_URL constant.
  • Updated PackageJson.install() to support version selection and to use the new spinner helper.
  • Enhanced CLI flow with early package.json validation, ESLint peer-version gating (<10), and improved fatal error reporting.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/run-with-spinner.ts New helper to run async work with a clack spinner in interactive mode.
src/utils/package-json.ts Adds version-aware install logic, spinner integration, improved messages.
src/utils/confirm-project-type.ts New helper for consistent interactive project-type confirmation and cancellation handling.
src/eslint/configs/comments.ts Removes an unnecessary eslint-disable comment.
src/constants/index.ts Introduces BUG_TRACKER_URL constant for consistent reporting links.
src/cli/install-eslint.ts Pins ESLint to ^9 and updates method name to doesSatisfy.
src/cli/index.ts Adds ESLint version gate, refactors project-type confirmation, and improves unhandled error messaging.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/utils/package-json.ts
Comment thread src/cli/index.ts Outdated
@kguzek
kguzek force-pushed the feat/error-handling branch from f2f47d0 to d171b0f Compare March 14, 2026 02:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors parts of the CLI setup flow for @solvro/config, adding shared helpers for interactive prompts/spinners, tightening dependency/version handling, and improving user-facing messages and error reporting.

Changes:

  • Add reusable utilities for spinner-wrapped operations and project type confirmation.
  • Update PackageJson install/version APIs and apply them in CLI installers (ESLint/Prettier).
  • Improve CLI UX: earlier project directory validation, peer dependency guard for ESLint, and a friendlier “report a bug” path.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/run-with-spinner.ts New helper to run async work with a clack spinner and consistent error handling.
src/utils/package-json.ts Refactors package install/update logic, introduces doesSatisfy/getPackageInfo, and integrates spinner helper.
src/utils/confirm-project-type.ts New helper to confirm autodetected project type and route users to bug tracker on mismatch.
src/constants/index.ts Adds BUG_TRACKER_URL used by CLI/error handling.
src/eslint/configs/comments.ts Removes a now-unneeded eslint-disable comment.
src/cli/install-prettier.ts Updates installer to new PackageJson.install() option shape.
src/cli/install-eslint.ts Updates installer to new doesSatisfy name and new install option shape.
src/cli/index.ts Adds ESLint peer-deps check, centralizes project-type confirmation, and improves top-level error handling/reporting.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/utils/package-json.ts
Comment thread src/utils/confirm-project-type.ts
Comment thread src/cli/index.ts
Comment thread src/cli/index.ts
@kguzek
kguzek enabled auto-merge (squash) March 14, 2026 02:11
@kguzek
kguzek merged commit 0d30d5e into main Mar 14, 2026
10 checks passed
@kguzek
kguzek deleted the feat/error-handling branch March 14, 2026 02:14
@solvro-ci

solvro-ci Bot commented Mar 14, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@solvro-ci solvro-ci Bot added the released label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Błąd podczas inicjalizacji konfiguracji

2 participants