Merged
Conversation
Create internal/errors package with UserError and SystemError types to enable clear distinction between user-fixable issues and system failures. This improves error messages and helps users understand what action to take. - UserError: for invalid input, missing config, etc. - SystemError: for API failures, network issues, etc. - Includes Retryable flag for transient errors - IsRetryable helper function Closes #42 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create internal/output package with JSON() and JSONStdout() functions to eliminate identical printJSON() implementations across 4 packages. JSON() accepts an io.Writer for testability, JSONStdout() is a convenience wrapper for stdout. Files consolidated: - internal/cmd/mail/output.go - internal/cmd/calendar/output.go - internal/cmd/contacts/output.go - internal/cmd/drive/output.go Closes #43 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create EventListOptions struct and listAndPrintEvents() function to eliminate duplicated event listing logic across today.go, week.go, and events.go. Each file had ~30 lines of nearly identical code for fetching, formatting, and printing calendar events. EventListOptions provides: - CalendarID, TimeMin, TimeMax, MaxResults - JSONOutput flag - Header and EmptyMessage for display customization Closes #44 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change exported Service fields to private service fields in all API client structs to prevent abstraction bypass. External access to API functionality now goes through interface methods only. Changes: - gmail.Client: Service→service, UserID→userID, add GetProfile() - calendar.Client: Service→service - contacts.Client: Service→service - drive.Client: Service→service Updated consumers to use interface methods instead of direct Service access. Closes #45 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements Phase 4 quality improvements from the codebase simplification plan:
Error classification (feat: classify errors as user errors vs system errors #42): Create
internal/errorspackage withUserErrorandSystemErrortypes for better UX. Enables distinguishing between user-fixable issues and system failures.Shared output utilities (refactor: extract shared output utilities to internal/output package #43): Extract duplicated
printJSON()function from 4 packages intointernal/outputpackage.JSON(io.Writer, data)for testability,JSONStdout(data)for convenience.Calendar event helper (refactor: extract shared calendar event listing helper #44): Extract ~30 lines of duplicated event listing code from
today.go,week.go,events.gointo sharedEventListOptionsstruct andlistAndPrintEvents()function.Private Service fields (refactor: make API Service fields private to prevent abstraction bypass #45): Make
Servicefields private in all API clients (gmail, calendar, contacts, drive) to prevent abstraction bypass. External access now goes through interface methods only.Test plan
make test)make lint)internal/errorspackage has comprehensive testsinternal/outputpackage has testsCloses #42, #43, #44, #45
🤖 Generated with Claude Code