Commit Graph
32 Commits
Author SHA1 Message Date
AlexKucera 3d1227dc45 Improves model fallback and caching strategy
Adds API key validation before fetching models
Ensures consistent fallback model caching on API errors or missing key
Reduces redundant code by centralizing fallback model caching logic

Relates to dynamic-models branch
2025-10-24 11:03:30 +02:00
AlexKucera fcc495aa8f Enhances model service fallback and caching logic
Improves model retrieval strategy for scenarios with invalid/missing API keys

Adds immediate fallback model generation when API key is invalid
Ensures consistent model caching for both API and fallback scenarios
Sorts model options alphabetically for improved user experience

Introduces new getFallbackOptions() method for direct fallback access
Refactors model refresh and error handling to provide more robust model selection
2025-10-24 11:00:42 +02:00
AlexKucera c3d4888c98 Optimizes settings and model cache loading
Refactors loadSettings method to avoid redundant data loading
Reduces duplicate loadData() calls by reusing loaded data
Improves efficiency of plugin initialization process
2025-10-24 10:57:47 +02:00
AlexKucera 4db5639160 Adds token usage tracking for text cleanup requests
Enhances Anthropic API client to return token usage information

Modifies cleanup service to capture and store input and output token counts from API responses
Refactors request and response handling to extract and pass usage metrics
Provides more detailed tracking of API request resource consumption
2025-10-24 10:55:54 +02:00
AlexKucera b63ab214b3 Refactors Anthropic model type and list handling
Removes strict type definition for Anthropic models to enable more dynamic model selection

Allows for flexible model ID fetching from Anthropic API
Provides a fallback list of models when direct API access is limited

Supports more adaptable model configuration in the application
2025-10-24 10:53:54 +02:00
AlexKucera eae48521c5 Refactors confirmation modal with Obsidian integration
Replaces custom modal implementation with Obsidian's Modal class for improved consistency and accessibility

Enhances API key management with dynamic model refreshing and fallback handling
Improves event handling and modal interaction patterns
2025-10-24 10:44:53 +02:00
Jarvis 7b23ed6615 feat: add dynamic model fetching from Anthropic API
Replace hardcoded model list with dynamic API-based model fetching
that queries the Anthropic models endpoint. Implements 24-hour caching
with automatic fallback to hardcoded models if API is unavailable.

Changes:
- Add ModelService to fetch and cache available models from API
- Implement 24-hour TTL cache persisted in plugin data
- Update AnthropicClient with fetchModels() method
- Modify settings UI to load models asynchronously with loading states
- Auto-refresh models when API key is entered or changed
- Display model names using display_name field from API
- Preserve user's selected model across updates and restarts
- Show notice when falling back to hardcoded model list
- Change model type from strict enum to string for dynamic support

Technical details:
- New ModelInfo and ModelsListResponse interfaces for API response
- ModelCache interface with timestamp for TTL validation
- FreewritingCleanupData extends settings to include cache
- Settings dropdown disabled during model fetch/refresh
- Fallback to ANTHROPIC_MODELS constant on API failure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-23 10:25:22 +02:00
AlexKucera b119923300 Merge pull request #1 from AlexKucera/coderabbit_fixes
Enhances plugin architecture and fixes issues
2025-09-26 14:21:24 +02:00
AlexKucera 13b2567672 Avoids potential null reference error
Ensures that the modal element is not null before attempting to append it to the document body or remove it from its parent node. This prevents potential errors if the modal element is not properly initialized.
2025-09-26 08:58:23 +02:00
AlexKucera 69a92e02d2 Validates text selection before processing
Refactors text validation to ensure that the cleanup process only proceeds with valid text selections.

Removes the insertion position logic as it is no longer needed.
2025-09-26 08:56:33 +02:00
AlexKucera 565cddf86c Updates Anthropic API to use structured content
Adapts the Anthropic client to use the new structured content format
for messages and system prompts, ensuring compatibility with the API's
expected input structure. This change modifies both the standard
request and the test request within the Anthropic client.
2025-09-26 08:52:24 +02:00
AlexKucera fe51d1efd2 Updates license badge to GPL v3
Updates the license badge in the README to reflect the project's licensing under GPL v3. This ensures accurate and up-to-date information regarding the project's licensing terms.
2025-09-26 08:49:26 +02:00
AlexKucera e90eef0f95 Refactors plugin architecture and documentation
Improves plugin structure by adopting a modular architecture
with separated services, commands, and settings.

Updates documentation to reflect the new architecture,
settings management, command registration, UI components,
and resource cleanup strategies.

This change enhances maintainability, testability, and
API interaction separation.
2025-09-26 08:46:25 +02:00
AlexKucera bf683b2983 Updates changelog date for security fix
Corrects the date in the changelog to reflect the accurate release date of the security fix.
2025-09-26 08:44:48 +02:00
AlexKucera 733147f8a8 Updates GitHub release action to v2
Updates the action used for creating releases to the latest major version.

This ensures continued compatibility and access to the newest features and bug fixes provided by the action.
2025-09-26 08:44:43 +02:00
AlexKucera 2783552ed0 Fixes broken links and updates repository name
Updates broken links in the README and corrects the repository name used for BRAT.
This improves the plugin installation experience.
2025-09-26 07:48:14 +02:00
AlexKucera 40ee33f3a0 Fixes broken CodeRabbit badge link
Corrects the CodeRabbit badge URL in the README file, resolving a broken link and ensuring proper navigation to the CodeRabbit reviews page.
2025-09-25 16:19:28 +02:00
AlexKucera f5bd806733 Adds CodeRabbit Reviews badge
Includes a CodeRabbit Reviews badge in the README to
provide easy access to code review insights.
2025-09-25 15:37:39 +02:00
AlexKucera ba2b29361a Updates downloads badge URL
Updates the downloads badge URL to link to the releases page
instead of the Obsidian plugins page. This provides a more
direct route to download the plugin files.
2025-09-21 22:09:10 +02:00
AlexKucera fe33bbc8c3 Updates badges in README
Updates the badges in the README to reflect the new repository name and license, and adds a downloads badge.
2025-09-21 16:10:33 +02:00
Jarvis 03120d8e19 chore: release 1.0.2
- Update version to 1.0.2 in manifest.json, package.json, and versions.json
- Add CHANGELOG.md entry for security fixes
- Prepare for patch release with XSS vulnerability fixes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
1.0.2
2025-09-21 07:43:11 +02:00
Jarvis 178a9e6618 security: fix innerHTML usage in settings to prevent XSS vulnerabilities
Replaces innerHTML usage with Obsidian's safe DOM manipulation methods:
- Line 150: Use createEl() and appendText() for commentary style display
- Lines 159-168: Build usage instructions with createEl() instead of innerHTML

This addresses the Obsidian Review Bot security warning and follows
the official guidelines: https://docs.obsidian.md/Plugins/User+interface/HTML+elements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 07:40:39 +02:00
Jarvis e11be2bdbd chore: release 1.0.1
- Fix license information in package.json to match GPL-3.0
- Update command name to follow Obsidian guidelines
- Move inline styles to CSS for better theme compatibility
- Update CHANGELOG.md with version 1.0.1 changes
- Update manifest.json and versions.json

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
1.0.1
2025-09-20 12:40:31 +02:00
AlexKucera 7d04b2d868 Removes workspace file and ignores it.
Deletes the Sublime Text workspace file and adds it to the .gitignore file. This prevents IDE-specific state from being tracked in the repository.
2025-09-20 12:34:55 +02:00
Jarvis 809fce9c89 refactor: prepare plugin for Obsidian community submission
- Fix command name from "Clean Up Freewriting" to "Clean up text" to follow Obsidian guidelines (no plugin name in command)
- Replace inline JavaScript styles with CSS classes for better theme compatibility
- Add proper CSS styles in styles.css for textarea and description elements
- Correct license information in README from MIT to GPL v3 to match actual LICENSE file
- Update README documentation to reflect new command name

These changes address common Obsidian plugin review feedback:
- Avoid assigning styles via JavaScript
- Command names should not include plugin name
- Maintain consistency between documentation and actual license

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 12:34:09 +02:00
AlexKucera aa4193410c Adds release workflow
Implements a GitHub Actions workflow to automate the plugin release process.

This workflow:
- Builds the plugin
- Creates a zip package of the plugin
- Generates release notes from the changelog
- Creates a GitHub release with the package and notes
2025-09-20 12:29:23 +02:00
AlexKucera 56fbf49ab7 Creates changelog file for initial release
Adds a changelog file to document notable changes, following Keep a Changelog format and Semantic Versioning.

This file details the features, technical implementation, and initial release information for the Freewriting Cleanup plugin.
2025-09-20 12:29:19 +02:00
AlexKucera 8866dbfab9 Adds initial README for the plugin
Creates a comprehensive README file that explains the plugin's features, installation, usage, configuration, troubleshooting, development setup, contribution guidelines, license, and support information.
2025-09-20 12:23:07 +02:00
AlexKucera a63d184448 Implements freewriting cleanup plugin
Adds a plugin to clean up freewriting text using the Anthropic API.

This initial commit introduces core functionality, including:
- API client for interacting with Anthropic's Claude models.
- Service for orchestrating cleanup operations and managing API calls.
- Command for executing the cleanup process on selected text within Obsidian editor.
- Settings tab for configuring the API key, model, prompts, and commentary preferences.
- Type definitions for settings, API requests/responses, and cleanup results.

The plugin provides a command to clean up selected text, apply custom prompts, and optionally generate commentary on the freewriting session.
2025-09-20 12:14:55 +02:00
AlexKucera 933f7ec405 Replaces license with GNU GPLv3
Replaces the existing proprietary license with the GNU General Public License version 3.
This ensures that the software adheres to the principles of free and open-source software.
2025-09-20 12:14:41 +02:00
AlexKucera 4fdf0a73ff Initializes the freewriting cleanup plugin
Sets up the basic project structure for the "Freewriting Cleanup" Obsidian plugin.

This includes:
- Adding necessary configuration files (.gitignore, package-lock.json, tsconfig.json, etc.)
- Creating a manifest file with plugin metadata
- Adding initial project files
- Adding documentation about the project

This setup provides a foundation for developing the plugin's functionality to clean up freewriting typos using AI.
2025-09-20 11:49:08 +02:00
AlexKucera e996b217ba Initial commit 2025-09-20 11:16:03 +02:00