80 Commits
Author SHA1 Message Date
AlexKucera cfacb78da4 Removes redundant settings heading
Cleans up the interface by eliminating an unnecessary
heading for freewriting prompts, enhancing the user
experience by reducing clutter in the settings panel.
2025-11-09 17:35:12 +01:00
AlexKucera f2972a5b83 Standardizes settings labels and improves UI consistency
Updates capitalization in command names and settings labels to enhance
UI consistency. Replaces element creation with a standardized heading
approach for setting sections, ensuring a cohesive design throughout
the plugin settings interface. Fixes element reference inconsistency.

Improves user experience by providing clear and uniform interface
elements.
2025-11-09 17:11:12 +01:00
AlexKucera 10a4a9f215 Merge pull request #1 from AlexKucera/dynamic-models
Adds dynamic Claude model fetching and management
2025-10-31 13:42:04 +01:00
AlexKucera 4cb2308bd6 Refines timed prompt notification duration logic
Adjusts notification duration calculation to improve timing precision for different delay intervals

Ensures consistent minimum notification display time while preventing potential overlap or flickering
2025-10-31 13:36:03 +01:00
AlexKucera 5bf804b266 Fixes pagination ID consistency in model sorting
Recomputes pagination first and last IDs after sorting models to ensure consistent
ID references match the sorted array order.

Prevents potential misalignment between sorted model list and pagination metadata
2025-10-31 13:35:49 +01:00
AlexKucera 9b8ff3181a Refines notification timing for timed prompts
Adjusts notification display duration calculation for more predictable behavior

Improves timing logic for prompts with different delay intervals:
- Ensures notifications end 500ms before next tick for delays >1s
- Maintains minimum 300ms display time to prevent flickering
- Keeps existing logic for short delay intervals
2025-10-31 13:21:00 +01:00
AlexKucera 9ee37cd087 Sanitizes writing prompts for consistent formatting
Prevents potential formatting issues by ensuring prompts are single-line and trimmed

Collapses multiple whitespaces and trims prompt text to maintain clean, uniform list rendering in markdown output
2025-10-31 13:20:31 +01:00
AlexKucera bdb4949c1b Adds input constraints to settings numeric fields
Improves user input validation for settings by:
- Adding min/max range limits to numeric settings
- Enforcing input type as number for better UX
- Ensures settings inputs have appropriate constraints

Validates timed count, delay, and note prompt settings with specific numeric ranges
2025-10-31 13:19:28 +01:00
AlexKucera d5af2a08ce Improves ping response validation robustness
Enhances API ping check to handle multiple text content blocks

Modifies response text extraction to:
- Process all text content blocks
- Support multiple text segments
- Normalize and validate ping response more comprehensively

Increases reliability of API connection verification
2025-10-31 13:17:36 +01:00
AlexKucera d31cec0383 Improves prompt notification duration calculation
Enhances notification display logic to prevent flicker and ensure minimum visibility

- Adds floor of 0 for delay milliseconds to prevent negative values
- Ensures minimum notification duration of 300ms to improve user experience
- Maintains existing logic for longer delay times
2025-10-25 10:49:40 +02:00
AlexKucera fc04d3f1af Improves model listing and prompt parsing logic
Adds sorting for model dropdown to ensure consistent user experience across sessions

Enhances prompt extraction by supporting more list prefix formats, improving robustness of text parsing
2025-10-25 10:49:01 +02:00
AlexKucera fca191b850 Simplifies note prompt selection and timestamp formatting
Refactors cursor handling to use setCursor instead of setSelection when collapsing selections

Improves timestamp generation by using environment's default locale automatically instead of manually specifying language

Enhances code clarity and simplifies locale handling for timestamp formatting
2025-10-25 10:48:02 +02:00
AlexKucera 2b9c8fbc5b Prevents cross-key model cache leakage
Clears model cache when API key changes to ensure accurate model list access

Prevents potential issues with stale model entitlements when switching API keys programmatically
2025-10-25 10:47:04 +02:00
AlexKucera 1c1cba6ce5 Enhances model selection and caching in settings
Improves model dropdown handling with debounced settings save
Adds model list cache clearing functionality
Handles edge cases for model availability and selection

Introduces more robust error handling for model dropdowns
Provides user control over model list refreshing
2025-10-25 10:46:20 +02:00
AlexKucera 4c03bed948 Refactors model fetching with deduplication strategy
Extracts common model fetching logic into shared method to prevent duplicate API calls

Improves error handling and caching for model retrieval by:
- Creating a centralized fetchWithDeduplication method
- Adding model type filtering in cache update
- Resetting fallback notice flag during cache clearing

Enhances reliability of model list retrieval across multiple service methods
2025-10-25 10:44:53 +02:00
AlexKucera 3f53bb5a30 Improves model list pagination with safety measures
Adds robust pagination handling for Anthropic model retrieval:
- Implements duplicate model filtering
- Adds iteration limit to prevent infinite loops
- Introduces cursor advancement validation
- Fixes potential API pagination edge cases

Ensures more reliable and predictable model list retrieval
2025-10-24 16:56:38 +02:00
AlexKucera b57fe8cd89 Adds deduplication for concurrent prompt generation
Prevents duplicate API calls by tracking in-flight requests
Ensures consistent prompt generation under high concurrency
Mitigates potential race conditions in prompt retrieval

Improves performance and reliability of prompt generation service
2025-10-24 16:55:05 +02:00
AlexKucera 902d2b1b9a Refines Anthropic model type and list definitions
Updates model type to use ModelId type for stronger type safety

Improves hardcoded model list with TODO for keeping it current
Removes outdated comments and simplifies model list annotations

Prepares for more dynamic model handling with explicit update guidance
2025-10-24 16:53:06 +02:00
AlexKucera ea14071d22 Improves notification duration calculation for timed prompts
Refines notification display timing logic to prevent flickering and ensure smoother user experience

Adjusts notification duration calculation for short delays, using a more nuanced approach that:
- Caps notification time at 900ms or delay-100ms for very short intervals
- Maintains existing behavior for longer delays
2025-10-24 16:51:35 +02:00
AlexKucera 329c12ab4b Refactors Anthropic API client configuration
Centralizes API base URL and version configuration for improved maintainability

Adds constants for API base URL and version to prevent potential drift
Normalizes API version header usage across request methods
Improves ping validation to handle variations in response text

Supports more robust and consistent API client configuration
2025-10-24 16:50:20 +02:00
AlexKucera a93c887cad Optimizes settings handling with debounce and async improvements
Introduces debounce mechanism for settings saves to reduce unnecessary disk writes

Refactors settings change handlers to:
- Improve performance by debouncing save operations
- Simplify async method handling
- Prevent excessive API calls and disk writes
- Add more robust handling of model loading and settings updates

Enhances user experience by minimizing unnecessary background operations
2025-10-24 16:46:59 +02:00
AlexKucera 8e6441ff7d Improves timestamp localization for note prompts
Uses the user's preferred language locale for timestamp formatting, enhancing regional customization and user experience

Allows automatic fallback to 'en-US' if navigator language is unavailable
2025-10-24 16:42:04 +02:00
AlexKucera 13645af300 Improves data loading with robust error handling
Adds comprehensive error handling for plugin data loading to prevent potential startup failures

Implements graceful fallback to default settings when data loading fails or is corrupted
Ensures plugin can initialize even with invalid or missing persistent data
Separates model cache extraction to prevent type drift and improve data integrity
2025-10-24 16:41:53 +02:00
AlexKucera c9adf05a82 Improves model fetching resilience and performance
Adds deduplication of concurrent API calls to prevent redundant requests

Enhances error handling by preferring stale cache over hardcoded fallback models
Introduces new getStaleCacheModels method to provide more robust model retrieval
Prevents multiple simultaneous model fetch attempts with in-flight request tracking
2025-10-24 16:37:45 +02:00
AlexKucera afa725df7f Enhances ESLint configuration for TypeScript project
Updates ESLint configuration to:
- Use latest globals for Node.js and browser environments
- Enable type-aware TypeScript ESLint rules
- Improve parser and ecmaVersion settings
- Add explicit TypeScript ESLint plugin

Increases code quality and type safety for the project
2025-10-24 16:35:01 +02:00
AlexKucera 893aae5bca Improves timed prompts command concurrency handling
Enhances execution flow to prevent race conditions during async prompt generation

Refines inProgress flag management to ensure reliable concurrent execution:
- Sets flag before async work begins
- Guarantees flag reset in finally block
- Prevents potential state inconsistencies during rapid command triggers

Clarifies code comments explaining concurrency protection mechanism
2025-10-24 13:48:25 +02:00
AlexKucera 52ea9de4c0 Improves model fallback and settings handling
Enhances model selection resilience by adding detailed fallback notifications

Adds model ID check before changing default model to prevent unnecessary updates
Improves user experience with more informative model unavailability notices
Removes redundant API key update and settings save operations

Supports dynamic model management on model refresh
2025-10-24 13:46:25 +02:00
AlexKucera 53e61abd3b Optimize settings and API key management
Improves settings loading and saving by preventing model cache merging and tracking API key changes

Prevents type drift in settings by destructuring saved data
Adds tracking of last API key to avoid unnecessary prompt generator updates
Ensures only meaningful settings are merged with defaults

Reduces redundant operations and improves plugin performance
2025-10-24 13:44:45 +02:00
AlexKucera 61788b39ad Enforces precise prompt generation count
Trims generated prompts to requested count

Ensures consistent user experience by slicing array if model over-generates
Prevents potential cache key mismatches due to inconsistent prompt counts
2025-10-24 13:41:44 +02:00
AlexKucera b76f085137 Improves model fetching with deduplication and notice control
Adds a session-based flag to prevent repeated fallback notices during API failures

Implements model list deduplication to handle potential duplicate entries
Prevents spamming users with repeated error notifications
Resets notice flag on successful model fetches to allow future warnings
2025-10-24 13:40:42 +02:00
AlexKucera e5c7a523c5 Improves Anthropic API client robustness
Enhances API client with more reliable pagination and response handling:
- Uses URLSearchParams for clearer parameter management
- Increases pagination limit to 1000 to reduce API calls
- Adds more robust content parsing for multi-block responses
- Implements stricter API health check validation

Ensures more predictable and resilient API interactions
2025-10-24 13:38:28 +02:00
AlexKucera cc1b452872 Extracts note command execute validation logic
Refactors active note validation into a dedicated static method for improved readability and reusability

Enhances code maintainability by centralizing the check for valid editor and view
2025-10-24 13:36:33 +02:00
AlexKucera c698a19345 Improves timed prompt notification duration calculation
Refines notification display duration for timed prompts to handle both short and long delay intervals

Adjusts duration calculation to:
- Cap notifications at 500ms for very short delays
- Subtract 500ms from longer delays to prevent prompt overlap
- Ensures smoother user experience during prompt sequences
2025-10-24 13:36:26 +02:00
AlexKucera db641cfe9d Updates ANTHROPIC_MODELS with latest model versions
Refreshes hardcoded fallback model list with recent Claude AI model releases

Adds newest model versions:
- Sonnet 4.5
- Haiku 4.5
- Opus 4.1

Reorganizes model list for clarity, keeping legacy models for backward compatibility
2025-10-24 13:33:50 +02:00
AlexKucera 456a2226ea Updates ESLint configuration to latest standards
Migrates ESLint configuration to new flat config format

Upgrades TypeScript and ESLint dependencies to latest versions
Removes legacy .eslintignore and .eslintrc files
Consolidates linting configuration into a single eslint.config.mjs file

Improves project code quality and linting consistency
2025-10-24 13:29:15 +02:00
AlexKucera da6056bf0d Improves prompt insertion logic and timestamp formatting
Refines text insertion handling for writing prompts:
- Collapses text selection before insertion
- Adds more intelligent newline management
- Uses Intl.DateTimeFormat for consistent timestamp generation

Enhances edge case handling for cursor and text positioning
2025-10-24 13:27:14 +02:00
AlexKucera ee7faef92b Adds debounce mechanism for API key refresh
Implements debounce timer to prevent excessive API calls when updating API key

Prevents rapid repeated model refreshes by:
- Adding a 500ms delay timer
- Clearing previous timers to avoid multiple concurrent requests
- Cleaning up timers when settings tab is hidden

Improves performance and reduces unnecessary API load during key entry
2025-10-24 13:13:49 +02:00
AlexKucera f9fefceac1 Adds pagination support for Anthropic models API
Enhances models fetching to handle paginated API responses

Implements robust pagination mechanism to retrieve all available models
- Continues fetching pages while 'has_more' is true
- Accumulates models across multiple API calls
- Preserves first and last page identifiers
- Ensures complete model list retrieval

Improves error handling and response validation
2025-10-24 13:12:32 +02:00
AlexKucera def8bbcfe5 Improves Anthropic models API response validation
Enhances type checking and validation for API response structure

Adds more robust type validation to ensure:
- Correct response object structure
- Presence of required model fields
- Type safety for model data retrieval

Prevents potential runtime errors by implementing stricter type checks
2025-10-24 13:11:06 +02:00
AlexKucera e96ef65200 Added DocStrings 2025-10-24 13:09:10 +02:00
AlexKucera 03d2b1c93d Adds robust model list response validation
Improves models API response handling by adding structural validation

Ensures that the API response contains an array of model data before processing
Prevents potential runtime errors from unexpected response formats
2025-10-24 13:00:31 +02:00
AlexKucera 361f946d87 Improves async model loading for settings UI
Refactors model loading to prevent UI blocking
Adds fallback mechanism for model selection
Ensures smooth dropdown population and model persistence

Handles cases where previously selected model may no longer be available
2025-10-24 13:00:02 +02:00
AlexKucera 92e109e2e8 Fixes timed prompts generation race condition
Reorders initialization of in-progress flag to prevent potential race conditions during timed prompt generation

Ensures that the in-progress status is set before stopping existing sequences and generates prompts
2025-10-24 12:59:19 +02:00
AlexKucera 6ccfb9e023 Optimizes token usage for timed prompts
Reduces max tokens for timed prompts to improve latency and cost-efficiency

Introduces dynamic max_tokens configuration based on prompt type, using a smaller token limit for time-sensitive requests
2025-10-24 11:29:33 +02:00
AlexKucera e8443a878d Improves model selection fallback handling
Adds null check when selecting fallback model to prevent potential errors

Ensures graceful handling when the current model becomes unavailable by verifying a fallback model exists before setting it
2025-10-24 11:27:50 +02:00
AlexKucera e06b07eb26 Adds API key validation and model sorting
Improves model retrieval by adding API key validation check for both model fetching methods

Adds fallback to predefined models when no API key is present
Sorts model lists alphabetically by display name for consistent presentation

Enhances robustness of model service handling
2025-10-24 11:26:48 +02:00
AlexKucera 7932663d2a Adds type refinement for dynamic model selection
Introduces ModelId type alias to clarify model ID intent
Refines prompt generator type to support specific prompt types
Improves type safety for model and prompt configuration
2025-10-24 11:25:36 +02:00
AlexKucera 435af4ccab Adds required Claude model validation check
Enforces Claude model selection as a mandatory setting

Prevents configuration submission without specifying a valid Claude model to ensure proper API interaction and prevent potential errors
2025-10-24 11:24:09 +02:00
AlexKucera 8e19f6bc8f Simplifies data loading and initialization logic
Combines data loading for settings and model cache
Reduces redundant data loading steps and improves initialization efficiency

Supports dynamic model handling on the dynamic-models branch
2025-10-24 11:23:29 +02:00
AlexKucera 766eb26df3 Improves model fetch error notification message
Updates error notification to provide clearer feedback when API model retrieval fails

Enhances user experience by making the fallback model list error message more descriptive and informative
2025-10-24 11:22:33 +02:00
AlexKucera 4164471ed0 Adds fallback for unavailable AI models
Handles scenario where previously selected AI model is no longer available

Automatically selects the first available model and notifies the user when their current model is removed, improving user experience and preventing potential configuration errors
2025-10-24 11:21:02 +02:00
AlexKucera 6875a7c06c Adds user notification for ongoing timed prompts
Prevents multiple simultaneous timed prompt generations by displaying a notice when an operation is already in progress

Improves user experience by providing clear feedback during concurrent prompt generation attempts
2025-10-24 11:18:29 +02:00
AlexKucera c06afe7a4a Updates project license badge to GPL v3
Replaces MIT license badge with GPL v3 license badge in README

Ensures accurate representation of project licensing information
2025-10-24 11:18:23 +02:00
AlexKucera a79dcec18f Updates CHANGELOG.md with correct release dates
Corrects release dates for versions 1.0.0, 1.1.0, and 1.1.1 in the changelog.
2025-09-26 08:44:55 +02:00
AlexKucera 8dc28ccd5e Updates release action and BRAT repo URL
Updates the release action to the latest major version.

Also corrects the repository URL in the BRAT installation instructions
to reflect the rename of the repository.
2025-09-26 08:25:03 +02:00
AlexKucera f589057912 Updates repository URLs in CHANGELOG
Updates the repository URLs in the CHANGELOG.md file to reflect the new repository name and location.
This ensures that the links to previous versions and comparisons are accurate and functional.
2025-09-26 08:23:51 +02:00
AlexKucera 8b0b4f6607 Updates repository links and license
Updates the repository links in the README to reflect the
rename of the repository.

Changes the license to GNU General Public License v3 (GPLv3).
2025-09-26 08:22:50 +02:00
AlexKucera b8b701d78b Simplifies cursor placement after prompt insertion
Removes conditional logic for setting the cursor position
after inserting a prompt. Now, the cursor is consistently
placed at the end of the inserted text, regardless of the
previous cursor location. This change ensures consistent behavior
and simplifies the code.
2025-09-26 08:20:00 +02:00
AlexKucera d7497c1259 Removes unnecessary error notification
The Notice was removed because the error is already being logged to the console and re-thrown.
2025-09-26 08:19:54 +02:00
AlexKucera 9249897d27 Prevents race conditions in timed prompts
Adds a flag to prevent the timed prompt execution from running concurrently, avoiding potential race conditions and unexpected behavior.

Also, addresses edge case in the status check where the displayed current prompt number could be inaccurate.
2025-09-26 08:18:13 +02:00
AlexKucera 847768417c Updates author and license info
Updates the author name to include the last name.
Also, changes the plugin license to GPL-3.0-only.
2025-09-26 08:13:03 +02:00
AlexKucera ac20fadef6 Guards against empty cache arrays
Prevents errors when attempting to process an empty cache.

Deletes the cache entry if it is empty to avoid repeatedly
attempting to process an invalid cache entry.
2025-09-26 08:11:44 +02:00
AlexKucera 520ac6e826 Fixes broken links in README
Corrects several broken links in the README file:

- Updates the download badge link
- Corrects the manual installation link to GitHub releases
- Updates the BRAT repository link

These changes ensure users can access the correct resources.
2025-09-26 07:48:44 +02:00
AlexKucera 5a97bd50a6 Fixes broken CodeRabbit badge link
Corrects the URL for the CodeRabbit Reviews badge in the README.

The previous URL was malformed, preventing the badge from displaying correctly. This change ensures the badge accurately reflects the status of CodeRabbit reviews.
2025-09-25 16:19:08 +02:00
AlexKucera ac1468c72e Adds CodeRabbit badge to README
Includes a CodeRabbit badge in the README to showcase code review status.
2025-09-25 15:37:44 +02:00
AlexKucera 16901f9ec6 Updates downloads badge URL
Corrects a typo in the downloads badge URL in the README, ensuring it links to the releases page instead of an invalid location.
2025-09-21 22:09:23 +02:00
AlexKucera 383f355e45 Updates project badges in README
Updates the project badges in the README file to reflect the correct repository name and adds a downloads badge.
2025-09-21 16:08:50 +02:00
AlexKucera 8147662d61 Adds plugin combination recommendations
Recommends complementary plugins to enhance the freewriting workflow, suggesting specific usage patterns and benefits.
2025-09-20 14:21:11 +02:00
AlexKucera c34ee2edd6 Enhances prompt generation with type-specific instructions
Refines prompt generation by incorporating modifiers based on the prompt type.

This ensures that staggered prompts are short and direct, while also enforcing a consistent output format across all prompt types by appending specific instructions to the system prompt.

The user message is also updated to ensure the model returns only the numbered prompts, nothing else.
2025-09-20 10:55:06 +02:00
AlexKucera 2fbe582c4d Simplifies prompt generation model usage
Updates prompt generation to use the model type directly, removing the need for casting.

This change streamlines the prompt generation process and enhances type safety.
2025-09-20 10:53:36 +02:00
AlexKucera eaab2012db Improves staggered prompt display timing
Ensures prompt notifications display correctly
by adjusting the notification duration based
on the configured delay. Prevents potential overlap
between successive prompts.
2025-09-20 10:52:41 +02:00
AlexKucera cc63d92b6c Automates plugin release process with GitHub Actions
Sets up a GitHub Actions workflow to automatically build, package, and release the Obsidian plugin when a new tag is pushed.

This workflow:
- Checks out the code, sets up Node.js, and installs dependencies.
- Builds the plugin using `npm run build`.
- Creates a zip package containing the necessary files (main.js, manifest.json, and styles.css).
- Extracts the version from `manifest.json` and changelog from `CHANGELOG.md`.
- Creates a GitHub release with the extracted version and changelog, including installation instructions and file information.
2025-09-19 22:24:36 +02:00
AlexKucera e045dcf5ad Adds initial changelog file
Creates a new CHANGELOG.md file to document notable
changes to the project, adhering to Keep a Changelog format
and Semantic Versioning.

This file details the features, technical aspects, and security
considerations introduced in version 1.0.0, as well as a link
to the unreleased changes.
2025-09-19 22:24:26 +02:00
AlexKucera 9c8e5b022e Updates example prompt
Updates the default staggered example prompt to provide a more open-ended starting point. This aims to encourage more creative and diverse initial responses from users.
2025-09-19 22:24:19 +02:00
AlexKucera c209b5a6bf Excludes project-specific files from Git tracking.
Ignores Sublime Text project and workspace files to prevent them from being tracked in the repository. This ensures a cleaner repository state and avoids accidental inclusion of user-specific settings.
2025-09-19 22:24:11 +02:00
AlexKucera 4254ef3ae9 Sets up release workflow and licensing
Adds a GitHub Actions workflow to automate plugin releases upon tagging.

Includes a LICENSE file with the GNU General Public License v3.

Removes old LICENSE and manifest files.

Removes console logs from the main plugin file to reduce noise.
2025-09-19 19:04:26 +02:00
AlexKucera 44936775cd Implements freewriting prompts plugin
Initial implementation of the Freewriting Prompts plugin.

This commit introduces the core functionality for generating
AI-powered writing prompts using Anthropic's Claude API.

It includes:
- API client for interacting with the Anthropic API
- Services for generating and caching prompts
- Commands for displaying staggered prompts and appending prompts to notes
- Settings tab for configuring the plugin
2025-09-19 18:51:48 +02:00
AlexKucera e204a9998c Adds package-lock.json file
Adds the package-lock.json file to the repository to ensure consistent dependency versions across different environments.
This file helps to maintain the integrity and reproducibility of the project's dependencies.
2025-09-19 18:51:20 +02:00
AlexKucera dd73fcb592 Adds Claude guidance and ignores log file
Adds a CLAUDE.md file to provide guidance for Claude Code (claude.ai/code) when working with this repository.

Also, adds `logs/stack-exchange-mcp-server.log` to the .gitignore file to prevent it from being tracked.
2025-09-19 18:50:21 +02:00
AlexKucera 81dd4ae3f7 Initial commit 2025-09-19 18:29:50 +02:00