Skip to content

feat: add structured error formatting#18

Merged
gnapse merged 1 commit intomainfrom
feat/structured-errors
Jan 25, 2026
Merged

feat: add structured error formatting#18
gnapse merged 1 commit intomainfrom
feat/structured-errors

Conversation

@gnapse
Copy link
Copy Markdown
Contributor

@gnapse gnapse commented Jan 25, 2026

Summary

  • Add formatError() function to src/lib/output.ts for structured error messages with error codes and hints
  • Update existing error handling in auth, document, collection, and skill commands to use the new format
  • Add comprehensive tests for the formatError function

Test plan

  • Run npm run type-check - passes
  • Run npm test - all 39 tests pass

Closes #12

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a reusable formatError() helper to standardize CLI error output with an error code, message, and optional hint list, and updates multiple commands to use it.

Changes:

  • Added formatError(code, message, hints?) to src/lib/output.ts for structured, colored error formatting.
  • Updated auth, document, collection, and skill commands to emit structured errors (with codes + hints) for common failure cases.
  • Added unit tests covering formatError behavior with/without hints.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib/output.ts Introduces the new formatError() helper used across commands.
src/commands/skill.ts Replaces unknown-agent error output with formatError(...) + actionable hints.
src/commands/document.ts Uses formatError(...) for missing --confirm deletion confirmation.
src/commands/collection.ts Uses formatError(...) for missing --confirm deletion confirmation.
src/commands/auth.ts Uses formatError(...) for missing token and auth verification failures.
src/tests/output.test.ts Adds test coverage for formatError across hint scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gnapse gnapse merged commit 17658d2 into main Jan 25, 2026
8 checks passed
@gnapse gnapse deleted the feat/structured-errors branch January 25, 2026 12:34
github-actions Bot pushed a commit that referenced this pull request Mar 25, 2026
# 1.0.0 (2026-03-25)

### Bug Fixes

* broaden CI detection to handle all truthy values ([7dc2806](7dc2806))
* exclude dist from biome checks ([0dc49a3](0dc49a3))

### Features

* add API Spinner Proxy ([#17](#17)) ([a3bc75a](a3bc75a))
* add fuzzy reference resolution ([#19](#19)) ([6c1c6f9](6c1c6f9))
* add npm publishing, new agent skills, and skill auto-update ([#36](#36)) ([bcb2e75](bcb2e75)), closes [Doist/todoist-cli#176](Doist/todoist-cli#176) [Doist/bob-cli#17](Doist/bob-cli#17) [Doist/twist-cli#101](Doist/twist-cli#101)
* add structured error formatting with codes and hints ([#18](#18)) ([17658d2](17658d2))
* implement OAuth PKCE browser login ([#20](#20)) ([b7f6eec](b7f6eec)), closes [#7](#7) [outline/outline#11254](outline/outline#11254)
* improve oauth login inputs and callback UX ([#31](#31)) ([3011b28](3011b28))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add structured error formatting with codes and hints

2 participants