[#1] ✨ - Multiple AI providers#2
Conversation
…pt transformation - Updated .eslintrc.js to ignore coverage and test directories. - Expanded package.json to include new transformation provider commands and configuration options for multiple AI providers (OpenAI, Anthropic, Google Gemini, Azure, and Ollama). - Enhanced VSCodeConfigRepository to manage settings for different transformation providers and their respective API keys. - Updated README.md to document new features and configuration options for prompt transformation. - Refactored transformation logic to support dynamic provider selection via PromptTransformerFactory. - Updated pnpm-lock.yaml for new dependencies related to additional AI providers.
|
To view this pull requests documentation preview, visit the following URL: docs.page/vypdev/cursor-whisper~2 Documentation is deployed and generated using docs.page. |
✨ Feature Actions
Debug log🚀 Happy coding! Made with ❤️ by vypdev/copilot |
…vements - Updated .eslintrc.js to ignore additional test patterns. - Refactored logging in extension activation for consistency. - Improved error handling in audio recording classes. - Enhanced prompt transformation logic with new validation and error handling. - Updated test cases for Azure and Ollama prompt transformers. - Adjusted configuration repository to enable prompt transformation by default. - Streamlined code formatting and structure across various files for better readability.
…r-0.1.0.vsix binary
…atus bar updates - Integrated configuration validation on startup to ensure API key and transformation provider are set correctly. - Updated StartRecordingUseCase to validate configuration before starting recording. - Added transformation provider label management in the status bar for better user feedback. - Improved error handling for missing or invalid configuration during recording.
…nt and error handling - Enhanced configuration validation during startup to ensure all required settings are correctly configured. - Updated StartRecordingUseCase to include pre-recording configuration checks. - Improved status bar feedback with dynamic transformation provider labels. - Strengthened error handling for scenarios involving missing or invalid configurations during recording.
…improvements - Introduced a setup wizard for first-time users to configure OpenAI API key and optional prompt optimization provider. - Updated configuration validation to ensure required settings are completed during startup. - Improved status bar feedback to indicate setup status and prompt users for incomplete configurations. - Enhanced command prompts for configuring API keys and transformation providers with clearer messaging. - Updated documentation to reflect new setup process and configuration options.
…s and enhance user experience - Replaced the setup wizard command with a direct configuration panel command for improved accessibility. - Updated configuration validation messages to guide users towards the new configuration panel. - Enhanced status bar items to reflect the new configuration command, promoting a more intuitive user interface. - Adjusted test cases to align with the updated command structure and ensure consistent behavior across the extension.
…d configuration validation - Introduced new commands for starting and stopping transcription and prompt optimization recordings. - Updated package.json to reflect deprecated recording commands and added new keybindings. - Enhanced configuration validation to ensure OpenAI API key is set for transcription and prompt optimization. - Improved status bar feedback to indicate recording modes and configuration requirements. - Refactored StartRecordingUseCase to handle different recording modes and session management. - Updated tests to cover new recording functionalities and validation scenarios.
…ates - Updated settings item text to include 'Settings' for clarity. - Added command for opening the configuration panel directly from the status bar. - Implemented logic to display a warning label when the configuration checklist is incomplete. - Enhanced tests to verify the new setup state behavior and UI updates for the status bar items.
…master' branch; modify button text in configuration panel for clarity
- Added a new configuration option for the transformation system prompt in package.json. - Updated the ConfigurationPanel to allow users to customize and reset the system prompt. - Enhanced prompt transformer classes to utilize the configured system prompt. - Improved tests to validate the new system prompt functionality and ensure correct behavior across different transformers. - Updated the default system prompt to provide clearer transformation instructions.
…uracy - Changed markdown description in package.json to link to the Configuration Guide instead of the Provider Guide. - Revised progress documentation to reflect the current status of automated testing and documentation structure. - Updated README to clarify provider setup instructions and project status references. - Removed outdated references to provider setup documentation in quickstart and ADR files. - Enhanced architecture overview to better describe the system's functionality and integration points.
| await useCase.execute('promptimize'); | ||
| await vscode.window.showInformationMessage('Recording started'); | ||
| } catch (error) { | ||
| if (error instanceof MissingApiKeyError) { |
There was a problem hiding this comment.
MissingApiKeyError and ConfigError catch branches are unreachable dead code
Severity: low
Location: src/presentation/commands/StartRecordingCommand.ts:44
The catch block at lines 44-48 handles MissingApiKeyError and ConfigError, but neither is thrown within the try block. validateConfigurationForPromptimize returns a value (does not throw) and useCase.execute() only throws RecordingError. These branches will never execute.
Suggested fix:
Remove the MissingApiKeyError and ConfigError catch branches since they can never be triggered.
Written by vypdev/copilot for commit 51cd340232e0fb179ab054d6111870adfde909f1. This will update automatically on new commits.
…uter providers - Added OpenCode and OpenRouter as new transformation providers in package.json. - Updated configuration options to include OpenCode base URL and model identifier. - Enhanced documentation to reflect the addition of new providers and their setup instructions. - Improved validation and error handling for OpenCode and OpenRouter configurations. - Updated tests to cover new provider functionalities and ensure correct behavior across the extension.
…nsion - Introduced Cursor as a new transformation provider in package.json and updated related configuration options. - Enhanced documentation to include setup instructions for the Cursor provider and its models. - Updated validation logic to ensure proper configuration of Cursor API keys and models. - Added tests to cover the new Cursor provider functionality and ensure correct behavior across the extension. - Improved user interface elements to facilitate selection and configuration of the Cursor model.
| const result = await Agent.prompt(fullPrompt, { | ||
| apiKey, | ||
| model: { id: model }, | ||
| local: { cwd: process.cwd() }, |
There was a problem hiding this comment.
CursorPromptTransformer uses process.cwd() which is unreliable in VS Code extension host
Severity: medium
Location: src/infrastructure/transformation/CursorPromptTransformer.ts:59
CursorPromptTransformer.transform() at line 59 passes local: { cwd: process.cwd() } to Agent.prompt(). In a VS Code extension host, process.cwd() often returns the VS Code installation directory (e.g. /usr/share/code) rather than the user's workspace folder. This causes the Cursor SDK to operate relative to the wrong directory, potentially breaking file references and workspace-aware operations.
Suggested fix:
Replace process.cwd() with vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath || process.cwd() to use the actual workspace folder when available, falling back to process.cwd() only when no workspace is open.
Written by vypdev/copilot for commit edd9c47e6addd66b0af2b47ab05fce927aec9e9a. This will update automatically on new commits.
|
|
||
| async transform( | ||
| transcription: string, | ||
| context?: import('../../application/ports/IPromptTransformer').PromptContext |
There was a problem hiding this comment.
ConfigurablePromptTransformer uses inline dynamic import for type annotation
Severity: low
Location: src/infrastructure/transformation/PromptTransformerFactory.ts:185
ConfigurablePromptTransformer.transform() at line 185 uses import('../../application/ports/IPromptTransformer').PromptContext as a dynamic import expression for a type annotation. This non-standard pattern may confuse bundlers (webpack), IDEs, and type checkers. The type should be imported at the top of the file via a regular import type statement.
Suggested fix:
Add import type { PromptContext } from '../../application/ports/IPromptTransformer' at the top of the file (alongside the existing import { IPromptTransformer } ... on line 2 or as a separate import type), and replace the inline import(...) expression with the simple name PromptContext.
Written by vypdev/copilot for commit edd9c47e6addd66b0af2b47ab05fce927aec9e9a. This will update automatically on new commits.
| return { client: this.client, model }; | ||
| } | ||
|
|
||
| const apiKey = new ApiKey(apiKeyStr); |
There was a problem hiding this comment.
OpenRouterPromptTransformer uses OpenAI-specific ApiKey validation
Severity: high
Location: src/infrastructure/transformation/OpenRouterPromptTransformer.ts:45
OpenRouterPromptTransformer.ensureClient() at line 45 calls new ApiKey(apiKeyStr) which requires the key to start with sk- (OpenAI format). OpenRouter API keys use a different format and prefix, so this throws an uncaught Error('API key must start with sk-') before any transformation can occur, completely blocking OpenRouter provider usage.
Suggested fix:
Remove the ApiKey value object usage from OpenRouterPromptTransformer. The ApiKey class is OpenAI-specific (validates sk- prefix). For OpenRouter, simply validate that the key is non-empty without the sk- prefix check, consistent with how AnthropicPromptTransformer and GooglePromptTransformer handle API keys.
Written by vypdev/copilot for commit edd9c47e6addd66b0af2b47ab05fce927aec9e9a. This will update automatically on new commits.
…configuration - Refactored status bar item creation to include explicit names for 'transcribe', 'promptimize', and 'settings'. - Adjusted alignment values for status bar items to ensure consistent positioning. - Enhanced unit tests to verify the correct creation and configuration of status bar items. - Updated .vscodeignore to exclude additional test files and documentation from the build.
…oved documentation - Added a new configuration option for `transcriptionHint` in package.json to allow users to specify optional vocabulary for improved recognition accuracy. - Updated markdown descriptions for several configuration options to clarify their current status and future implementation plans. - Revised README and documentation to include details about the new recording modes and updated keyboard shortcuts. - Enhanced progress documentation to reflect the latest changes in configuration and user experience. - Improved user interface elements to facilitate better understanding of the new features and settings.
…nhancements - Added support for the token-costs npm package to fetch real-time provider pricing data. - Updated ConfigurationPanel to include dynamic provider comparison data based on token-costs. - Enhanced UI to display real-time pricing updates and fallback static data when necessary. - Revised provider comparison logic to improve user experience and data accuracy. - Updated configuration and documentation to reflect the new pricing strategy and architecture.
…s and documentation - Changed the extension name from Cursor Whisper to Promptimize in package.json and all related files. - Updated command names and titles to reflect the new branding throughout the extension. - Revised documentation, including README, quick start guide, and configuration details, to align with the new name. - Adjusted issue templates to reference Promptimize instead of Cursor Whisper. - Enhanced user experience by ensuring all references to the old name are replaced for consistency.
- Changed descriptions in hotfix and release issue templates to reference Promptimize instead of Copilot. - Updated disclaimers to clarify that only members of the Promptimize team can create these issues.
…ports - Expanded options in bug report, feature request, chore task, and help request templates to cover more specific areas of concern and actions. - Improved categorization of affected areas and actions to better guide users in reporting issues and requesting features. - Added new options related to audio recording, transcription, and configuration to align with recent updates in the extension.
✨ Feature Actions
Debug log🚀 Happy coding! Made with ❤️ by vypdev/copilot |


📌 Summary
This PR adds support for multiple AI providers for prompt optimization, separating it from Whisper transcription (which remains exclusively OpenAI). Users can now choose from 8 providers — OpenAI, Anthropic, Google Gemini, Azure OpenAI, Ollama, OpenCode, OpenRouter, and Cursor — each with its own credentials, model selection, and configuration flow. A new configuration webview and setup wizard streamline the multi-provider experience, while the
RecordingSessionModesystem introduces two distinct recording modes: "transcribe" (raw Whisper output) and "promptimize" (Whisper + optional optimization).🎯 Related Issues / Tickets
🧩 Scope of Changes
PromptTransformerFactory— factory resolving the active provider from configurationConfigurationPanel— new VS Code webview for unified settings (Whisper key + optimization provider + system prompt)ProviderPricingService— real-time cost comparison viatoken-costsnpm package with static fallbackRecordingSessionMode—transcribe/promptimizemodes with separate start/stop commandsConfigureTransformationProviderCommand,TestTransformationCommand,OpenConfigurationPanelCommand,FirstTimeSetupCommandConfigurationValidationService— validates both Whisper and optimization setup with user-facing messagesRecordingStatusBarItem— enhanced tooltip showing both service statuses__tests__/— 15+ new test files covering providers, factory, validation, pricing, status bar, and integrationVSCodeConfigRepository— provider-specific settings (API keys via SecretStorage, model per provider)StartRecordingUseCase/StopRecordingUseCase— split into transcribe-only and promptimize variantsextension.ts— registers all new commands and servicespackage.json— 8 new commands, new configuration keys, new dependencies (@anthropic-ai/sdk,@google/generative-ai,@cursor/sdk,token-costs,ollama)README.mdand all docs — rebranded to Promptimize with multi-provider guidanceOpenAIPromptTransformer— simplified to match the new adapter patternRecordingStatusBarItem— two-service status display🛠️ Technical Details
IPromptTransformerport. ThePromptTransformerFactoryuses aswitchonTransformationProviderto instantiate the correct adapter — no dynamic dispatch or reflection.SecretStorageunderpromptimize.apiKey.{provider}. This avoids any secrets in settings.json.ProviderPricingServicefetches live pricing fromtoken-costs(daily cache, 3s timeout) and falls back to static data fromsrc/shared/constants/providerComparison.ts. Only OpenAI, Anthropic, Google, and OpenRouter support live pricing; Ollama, OpenCode, Azure, and Cursor always use static values.start/stopTranscribeRecordingandstart/stopPromptimizeRecording) allow users to bypass optimization entirely or apply it. The status bar tracks which mode is active viaRecordingSessionMode.baseURL, since their APIs are OpenAI-compatible. Cursor uses the@cursor/sdkwithAgent.prompt(). Ollama uses its own REST API directly.startRecording/stopRecordingcommands are deprecated but kept for migration. The default provider remains OpenAI, so existing single-provider setups work without changes.🔍 How to Test
F5).Promptimize: Setup Wizard— follow the flow to configure an OpenAI Whisper key.Promptimize: Open Configuration Panel— select a provider (e.g., Anthropic), enter its API key, and pick a model.Promptimize: Test Transformation— verify the selected provider responds correctly.Promptimize: Start Transcribe Recording— record audio, verify raw transcription output.Promptimize: Start Promptimize Recording— verify transcription + optimization output.Promptimize: Start Transcribe Recordingstill works without a provider configured.🧪 Test Coverage
PromptTransformerFactoryConfigurationValidationServiceProviderPricingServiceTransformationProvidervalue objectRecordingStatusBarItemFirstTimeSetupCommand,StartRecordingUseCasepromptimize.startRecording/promptimize.stopRecordingcommands are deprecated (marked in the UI). Users should migrate to theTranscribeorPromptimizevariants.promptimize.transformationModelis now scoped per-provider (e.g.,promptimize.anthropicModel,promptimize.ollamaModel). The old key is read as fallback for OpenAI.🚀 Deployment Notes
🔒 Security Considerations
📈 Performance Impact
ProviderPricingServiceuses a 1-hour cache with 3s timeout to avoid blocking the UI📝 Notes for Reviewers
The largest files are the configuration webview (
ConfigurationPanel.ts+ HTML + CSS) and the provider adapters. Focus review on:PromptTransformerFactory.ts:100–125— exhaustiveness check vianevertypeVSCodeConfigRepository.ts— SecretStorage key management and per-provider setting resolutionTransformationError)RecordingSessionModestate module is intentionally a simple singleton module (not injected) because it lives entirely in the sync presentation layer✅ Checklist