Enhances code documentation and structure for plugin #3

Merged
AlexKucera merged 20 commits from docstrings into master 2025-10-25 10:50:22 +02:00
20 Commits
Author SHA1 Message Date
AlexKucera 4efa8a1282 Updates Anthropic API limits with detailed documentation
Revises token and character limit constants with more precise descriptions

- Increases default max output tokens from 4000 to 8192
- Expands documentation explaining token-to-character estimation
- Provides context about current Claude model token limits
- Clarifies variability in character-to-token conversions
2025-10-24 17:00:21 +02:00
AlexKucera c5ebfceea6 Improves API error handling in cleanup command
Enhances error reporting for different API error scenarios by:
- Adding a generic API error handler for unspecified status codes
- Preserving more detailed error information when possible
- Providing clearer user notifications for various error types
2025-10-24 16:58:32 +02:00
AlexKucera ab5e134a12 Improves API error handling and response parsing
Enhances error handling for Anthropic API client:
- Adds specific handling for 429 (rate limit) errors
- Improves authentication error detection
- Modifies text extraction to capture multiple response blocks

Provides more robust and informative error responses during API interactions
2025-10-24 16:28:57 +02:00
AlexKucera bb6cc929f5 Enhances error handling and performance tracking
Adds more granular error types and handling for API interactions
Improves token estimation with safety margin
Introduces duration tracking for cleanup operations

Provides clearer user feedback for various error scenarios including authentication, rate limiting, and network issues
2025-10-24 16:27:37 +02:00
AlexKucera 306e6819a3 Improves API retry logic with selective retries
Enhances request retry mechanism to avoid unnecessary retries on non-transient errors

Adds specific error handling to prevent retrying:
- API key configuration errors
- Client-side API errors (4xx status codes)

Ensures more efficient and targeted retry strategy that avoids wasting API quota
2025-10-24 16:08:05 +02:00
AlexKucera d50f11269b Improves error handling with detailed error messages
Updates error notices to display specific error messages instead of static text

Provides more informative feedback to users when cleanup process encounters issues
2025-10-24 16:06:49 +02:00
AlexKucera 20c27b45ce Removes duplicate error notification in cleanup service
Simplifies error handling by allowing the command layer to manage user feedback

Prevents potential redundant error notices and improves separation of concerns
2025-10-24 16:06:03 +02:00
AlexKucera e29539c8eb Adds robust error handling for API interactions
Introduces a comprehensive custom error hierarchy for more precise error management in API calls

Replaces generic error throwing with specific error types:
- Adds custom error classes for various API-related scenarios
- Improves error handling in cleanup and API client components
- Enables more informative and type-safe error tracking

Enhances error reporting and debugging capabilities for Anthropic API interactions
2025-10-24 15:52:34 +02:00
AlexKucera ecb57d794c Refactors model fallback retrieval with new helper method
Extracts common fallback model caching logic into a new private method `cacheFallbackModels()`

Reduces code duplication in model retrieval methods by centralizing fallback model caching
Improves code readability and maintainability by consolidating repetitive logic
Adds descriptive docstring to explain the purpose of the new helper method
2025-10-24 15:43:37 +02:00
AlexKucera 5e77136370 Improves custom commentary error message clarity
Enhances error messaging for custom commentary style to provide more specific guidance

Clarifies that a custom prompt is required when selecting custom commentary style, making the error message more informative and user-friendly
2025-10-24 15:38:45 +02:00
AlexKucera 58575c1880 Removes unnecessary text selection validation check
Eliminates redundant empty selection check in cleanup command

Allows processing of empty selections by removing the initial validation
preventing user action when no text is selected
2025-10-24 15:38:38 +02:00
AlexKucera e6b357f3f2 Simplifies text selection validation method
Removes redundant text info formatting method and associated info reporting from selection validation

Streamlines validation process by focusing solely on checking text eligibility
2025-10-24 15:35:47 +02:00
AlexKucera 58abaf7e91 Updates ModelsListResponse types to handle empty lists
Allows first_id and last_id to be null when no models are present

Improves type safety by explicitly handling edge cases in model list responses, preventing potential null reference issues
2025-10-24 15:25:18 +02:00
AlexKucera 2edf2e5c28 Updates type definition for stop_sequence
Expands stop_sequence type from null to allow string values

Improves type flexibility by making stop_sequence nullable with string support, enabling more precise type representation for Anthropic response handling
2025-10-24 15:24:49 +02:00
AlexKucera d0666a4967 Adds error notice throttling for model fetching
Prevents notification fatigue during API failures by throttling error messages

Introduces new method to limit error notices to once per minute when fetching models fails
Refactors model fetching error handling to use a consistent conversion method
Improves user experience by reducing repetitive error notifications
2025-10-24 15:23:52 +02:00
AlexKucera d9489a82dc Adds debounce and improves settings save mechanism
Introduces debounced settings save to reduce unnecessary disk I/O during rapid user interactions

Improvements include:
- Adds scheduleSave method to prevent excessive writes
- Updates settings change handlers to use debounced save
- Updates usage limits text with dynamic token/character references

Enhances plugin performance and user experience
2025-10-24 15:22:19 +02:00
AlexKucera bd5321b69e Improves plugin settings loading and command registration
Refactors settings loading to exclude model cache from persisted settings

Modifies command registration to use prefixed ID for better stability and collision prevention

Enhances type safety and plugin configuration management
2025-10-24 15:18:30 +02:00
AlexKucera e43d4a0631 Improves cleanup command error handling and formatting
Refactors error handling in cleanup command execution
- Moves loading notice hide to finally block for consistent dismissal
- Enhances error message formatting with locale-specific number formatting
- Imports character and token limit constants for more dynamic error messages
- Renames unused view parameter to indicate intentional non-use

Improves user experience by providing more readable error notifications
2025-10-24 15:17:44 +02:00
AlexKucera ee892b3231 Adds validation for custom commentary style
Enforces requirement of custom commentary prompt when custom style is selected

Prevents potential runtime errors by throwing an explicit error if custom commentary style is chosen without providing a custom prompt
2025-10-24 15:16:23 +02:00
AlexKucera 0f3d6ec7a3 Enhances code documentation and structure for plugin
Adds comprehensive documentation for all major classes and methods in the Freewriting Cleanup plugin

Improves code readability by:
- Adding detailed JSDoc comments explaining purpose and functionality
- Clarifying method behaviors and input/output expectations
- Providing inline context for complex operations

Standardizes error handling and adds more robust validation across services
2025-10-24 13:16:42 +02:00