-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(errors): adopt anyhow + thiserror @atrtde #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Refactors error handling across the CLI to use anyhow for task execution surfaces and introduces a typed AppError via thiserror for core utilities/registry code, while also adding a mntn sync --diff view and stripping ANSI codes from captured command output during package-manager backups.
Changes:
- Introduce
src/error.rs(AppError,Result<T>) and migrate core helpers (e.g., system command runner, registry) to return typed errors. - Switch
Task::execute()and most task implementations toanyhow::Result<()>, updating call sites accordingly. - Add
mntn sync --diffto show unstaged + staged diffs (with--cachedfallback), and add ANSI-stripping helper used during package-manager backup output capture.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/system.rs | Switch command helpers to typed AppError and add strip_ansi_codes + test. |
| src/tasks/validate.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/use_profile.rs | Replace manual io::Error boxing with anyhow::bail! and update signature. |
| src/tasks/sync.rs | Add --diff execution/dry-run logic and staged diff fallback; migrate to anyhow::Result. |
| src/tasks/restore.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/purge.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/package_registry.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/migrate.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/install.rs | Update task execution signature(s) to anyhow::Result<()>. |
| src/tasks/encrypted_configs_registry.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/delete.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/core.rs | Change Task::execute() to return anyhow::Result<()> and update tests accordingly. |
| src/tasks/configs_registry.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/clean.rs | Update task execution signature to anyhow::Result<()>. |
| src/tasks/biometric_sudo.rs | Update signature and error conversion to integrate with anyhow. |
| src/tasks/backup.rs | Use strip_ansi_codes on captured package-manager output; update signature to anyhow::Result. |
| src/registry.rs | Migrate registry APIs to typed AppError/Result and update tests. |
| src/main.rs | Register new error module. |
| src/error.rs | Add AppError and crate-wide Result<T> alias. |
| src/encryption.rs | Convert to anyhow + add context-rich error messages. |
| src/cli.rs | Add sync --diff CLI flag. |
| README.md | Document sync diff usage (currently mentions unimplemented --diff-stat). |
| Cargo.toml | Add anyhow and thiserror dependencies. |
| Cargo.lock | Lockfile updates for new deps and transitive changes. |
| CHANGELOG.md | Add v2.3.0 notes (currently mentions unimplemented --diff-stat and inaccurate ANSI-stripping description). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/mntn into refactor/anyhow-thiserror
No description provided.