### Install Azure CLI on macOS Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Use Homebrew to install the Azure CLI, which is required for Azure setup scripts. ```bash brew install azure-cli ``` -------------------------------- ### Install Azure CLI on Linux Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Download and install the Azure CLI on Linux systems using the provided script. ```bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash ``` -------------------------------- ### Automated Telemetry Setup Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/COMPREHENSIVE_TELEMETRY_GUIDE.md Executes the unified setup script to configure telemetry automatically. ```bash # Clone the project and navigate to scripts cd /path/to/GitMind/scripts # Run the unified setup script bash unified-telemetry-setup.sh ``` -------------------------------- ### Install Azure CLI on Windows Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Use the Windows Package Manager (winget) to install the Azure CLI. ```powershell winget install Microsoft.AzureCLI ``` -------------------------------- ### Run Unified Telemetry Setup Script Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Execute the main script to configure all telemetry settings and privacy validations. ```bash ./scripts/unified-telemetry-setup.sh ``` -------------------------------- ### Install Node.js on macOS Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Install Node.js using Homebrew, which is a prerequisite for running Node.js scripts like the privacy validator. ```bash brew install node # macOS ``` -------------------------------- ### Register Check API Setup Command Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Validates the connectivity and configuration of the selected AI provider. Implements a 15-second timeout for the connection test. ```typescript // Check API setup command validates provider configuration vscode.commands.registerCommand("ai-commit-assistant.checkApiSetup", async () => { const apiConfig = getApiConfig(); const provider = apiConfig.type; // Test API connection with timeout const result = await Promise.race([ checkApiSetup(), new Promise((_, reject) => setTimeout(() => reject(new Error("Connection test timed out")), 15000) ) ]); // Result contains validation status console.log(result); // { // success: true, // provider: "openai", // model: "gpt-4o", // responseTime: 550, // details: "Connection test successful" // } }); // Usage: Command Palette > "AI Commit Assistant: Check API Setup" ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/COMPREHENSIVE_TELEMETRY_GUIDE.md Environment variables required for automated telemetry resource setup. ```bash export RESOURCE_GROUP="gitmind-telemetry-rg" export APP_INSIGHTS_NAME="gitmind-insights" export LOCATION="canadacentral" export WORKSPACE_NAME="gitmind-workspace" ``` -------------------------------- ### Install AI Commit Assistant Extension Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/README.md Install the GitMind AI Commit Assistant extension for VS Code using the provided command. This is the primary method for adding the extension to your development environment. ```bash ext install ShahabBahreiniJangjoo.ai-commit-assistant ``` -------------------------------- ### Azure Insights Setup Scripts Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Scripts to set up Azure Application Insights for telemetry. Use the macOS/Linux version for Bash environments and the PowerShell version for Windows. ```bash ./scripts/azure-insights-setup.sh ``` ```powershell ./scripts/azure-insights-setup.ps1 ``` -------------------------------- ### Check API Setup and Connectivity Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Validates the API key and connectivity for the configured AI provider. Returns success status, provider details, and response time or error information. ```typescript import { checkApiSetup, checkRateLimits } from "./services/api/validation"; // Check API setup const result = await checkApiSetup(); ``` ```typescript const limits = await checkRateLimits(); ``` -------------------------------- ### Get API Configuration Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Retrieves the current API configuration and the full extension configuration from VS Code settings. It supports multiple providers and includes default model settings for each. ```typescript import { getApiConfig, getConfiguration } from "./config/settings"; // Get current API configuration const apiConfig = getApiConfig(); // Returns typed config based on selected provider: // { // type: "openai", // apiKey: "sk-ப்புகளை", // model: "gpt-4o" // } // Get full extension configuration const config = getConfiguration(); // Returns: // { // provider: "openai", // debug: false, // commit: { // style: "conventional", // maxLength: 72, // includeScope: true, // verbose: true // }, // promptCustomization: { // enabled: true, // saveLastPrompt: true, // lastPrompt: "Implements feature X" // }, // openai: { apiKey: "sk-ப்புகளை", model: "gpt-4o" }, // gemini: { apiKey: "AIza...", model: "gemini-2.5-flash" }, // ollama: { url: "http://localhost:11434", model: "phi4" } // } ``` ```typescript // Provider defaults used when not configured const PROVIDER_DEFAULTS = { gemini: { model: "gemini-2.5-flash" }, openai: { model: "gpt-4o" }, anthropic: { model: "claude-3-5-sonnet-20241022" }, ollama: { model: "phi4", url: "http://localhost:11434" }, deepseek: { model: "deepseek-chat" }, grok: { model: "grok-3" }, perplexity: { model: "sonar-pro" } }; ``` -------------------------------- ### Set Environment Variables for Telemetry Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Configure essential environment variables after running the setup scripts. These variables are required for the telemetry service to connect to Azure Application Insights. ```env APPLICATIONINSIGHTS_CONNECTION_STRING="your-connection-string" AZURE_RESOURCE_GROUP="gitmind-telemetry-rg" AZURE_APP_INSIGHTS_NAME="gitmind-insights" ``` -------------------------------- ### Add Provider Case to generateMessageWithConfig Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Integrates a new API provider into the main message generation function. Handles API key input, configuration updates, and model selection. Prompts the user to enter or retrieve an API key if not found, and guides them to settings if the model is not configured. ```typescript case "PROVIDER_NAME": { const providerConfig = config as ProviderNameApiConfig; if (!providerConfig.apiKey) { const result = await vscode.window.showWarningMessage( "Provider Name API key is required. Would you like to configure it now?", "Enter API Key", "Get API Key", "Cancel" ); if (result === "Enter API Key") { const apiKey = await vscode.window.showInputBox({ title: "Provider Name API Key", prompt: "Please enter your Provider Name API key", password: true, placeHolder: "Paste your API key here", ignoreFocusOut: true, validateInput: (text) => text?.trim() ? null : "API key cannot be empty", }); if (apiKey) { const config = vscode.workspace.getConfiguration("aiCommitAssistant"); await config.update( "PROVIDER_NAME.apiKey", apiKey.trim(), vscode.ConfigurationTarget.Global ); if (!providerConfig.model) { await vscode.commands.executeCommand( "ai-commit-assistant.openSettings" ); return ""; } return await callProviderNameAPI( apiKey.trim(), providerConfig.model, diff, customContext ); } } else if (result === "Get API Key") { await vscode.env.openExternal( vscode.Uri.parse("https://provider.com/api-keys") // Replace with actual URL ); const apiKey = await vscode.window.showInputBox({ title: "Provider Name API Key", prompt: "Please enter your Provider Name API key after getting it from the website", password: true, placeHolder: "Paste your API key here", ignoreFocusOut: true, validateInput: (text) => text?.trim() ? null : "API key cannot be empty", }); if (apiKey) { const config = vscode.workspace.getConfiguration("aiCommitAssistant"); await config.update( "PROVIDER_NAME.apiKey", apiKey.trim(), vscode.ConfigurationTarget.Global ); if (!providerConfig.model) { await vscode.commands.executeCommand( "ai-commit-assistant.openSettings" ); return ""; } return await callProviderNameAPI( apiKey.trim(), providerConfig.model, diff, customContext ); } } return ""; } if (!providerConfig.model) { await vscode.window.showErrorMessage( "Please select a Provider Name model in the settings." ); await vscode.commands.executeCommand( "ai-commit-assistant.openSettings" ); return ""; } return await callProviderNameAPI( providerConfig.apiKey, providerConfig.model, diff, customContext ); } ``` -------------------------------- ### Register Open Settings Command Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Opens the extension's settings webview panel for provider and preference configuration. ```typescript // Open the settings webview panel vscode.commands.registerCommand("ai-commit-assistant.openSettings", () => { SettingsWebview.createOrShow(context.extensionUri); }); // Usage: Click settings icon in Source Control panel or Command Palette // Provides UI for: // - Selecting AI provider (13 providers supported) // - Entering API keys // - Choosing model variant // - Enabling debug mode // - Configuring prompt customization ``` -------------------------------- ### Update Extension Main File Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Update logs and onboarding content to reflect the new provider. ```typescript debugLog( "Supported API providers: Gemini, Hugging Face, Ollama, Mistral, Cohere, OpenAI, Together AI, OpenRouter, Anthropic, GitHub Copilot, DeepSeek, Provider Name" ); ``` ```typescript content: 'GitMind supports multiple AI providers:\n• Gemini (Google)\n• Hugging Face\n• Ollama (Local)\n• Mistral AI\n• Cohere\n• OpenAI\n• Together AI\n• OpenRouter\n• Anthropic\n• GitHub Copilot\n• DeepSeek\n• Provider Name\n\nClick Next to learn how to configure your chosen provider.', ``` -------------------------------- ### Configure Provider API Key and Model in Package JSON Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Define the configuration settings for the new provider's API key and model in `package.json`. This includes type, default values, and descriptions. ```json "aiCommitAssistant.PROVIDER_NAME.apiKey": { "type": "string", "default": "", "markdownDescription": "API key for Provider Display Name [Learn more](https://provider.com/api-keys)" }, "aiCommitAssistant.PROVIDER_NAME.model": { "type": "string", "enum": [ "model-name-1", "model-name-2", "model-name-3" ], "enumDescriptions": [ "Model 1 - Description of capabilities", "Model 2 - Description of capabilities", "Model 3 - Description of capabilities" ], "default": "DEFAULT_MODEL_NAME", "description": "Provider Name model to use for generating commit messages" } ``` -------------------------------- ### Import Provider Validation Function Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Import the specific API key validation function for the new provider. This is used in the API setup check. ```typescript import { validateProviderNameAPIKey } from "./PROVIDER_NAME"; ``` -------------------------------- ### Run Test Commands Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/README.md Use these npm scripts to execute the test suite, check coverage status, or validate compilation. ```bash # Compile and run all tests npm test # Check test status and coverage npm run test:status # Validate test compilation npm run test:validate ``` -------------------------------- ### Validate Privacy Compliance Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Run the Node.js script to validate that telemetry practices meet privacy compliance standards. Ensure Node.js is installed. ```javascript node scripts/privacy-validator.js ``` -------------------------------- ### Add Privacy Validation to CI/CD Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Integrate privacy validation into your CI/CD pipeline by running this npm script. Ensure Node.js and npm are installed. ```bash npm run validate-privacy ``` -------------------------------- ### Retrieve Azure Connection String Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/COMPREHENSIVE_TELEMETRY_GUIDE.md Fetches the existing connection string via Azure CLI. ```bash # Get existing connection string bash get-connection-string.sh ``` -------------------------------- ### Extension Configuration Settings Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/COMPREHENSIVE_TELEMETRY_GUIDE.md JSON configuration for enabling and setting the telemetry connection string in VS Code. ```json { "aiCommitAssistant.telemetry.enabled": true, "aiCommitAssistant.telemetry.connectionString": "your-connection-string", "aiCommitAssistant.telemetry.level": "minimal" } ``` -------------------------------- ### Execute Test Commands Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/TEST_DOCUMENTATION.md Commands for compiling, running, and validating the test suite. ```bash # Compile tests npm run compile-tests # Run all tests npm test # Run specific test suite npx vscode-test --grep "Settings UI" # Validate test setup node scripts/test-validator.js ``` -------------------------------- ### Get Git Diff and Set Commit Message Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Retrieves staged Git changes, falling back to unstaged changes if necessary, and sets the commit message in VS Code's SCM input. It validates that the workspace is a Git repository before proceeding. ```typescript import { getDiff, validateGitRepository, setCommitMessage } from "./services/git/repository"; import * as vscode from "vscode"; const workspaceFolder = vscode.workspace.workspaceFolders[0]; // Validate git repository await validateGitRepository(workspaceFolder); // Throws "Not a git repository" if not initialized // Get diff (staged first, then unstaged with user prompt) const diff = await getDiff(workspaceFolder); // Executes: git diff --staged // If empty, prompts user to use unstaged changes: git diff // Returns diff string like: // "diff --git a/file.ts b/file.ts\n..." ``` ```typescript // Set commit message in VS Code's SCM input const commitMessage = { summary: "feat(auth): add login validation", description: "- Add email format validation\n- Implement password strength check" }; await setCommitMessage(commitMessage); // Sets VS Code git extension's inputBox.value // Respects verbose setting for including description ``` -------------------------------- ### Update Onboarding Manager Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Add the provider's API key URL to the onboarding configuration. ```typescript private static readonly API_KEY_URLS = { // ... existing URLs 'Provider Display Name': 'https://provider.com/api-keys' }; ``` -------------------------------- ### Add Provider Keywords to Package JSON Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Include relevant keywords for the new provider in the `keywords` array in `package.json` to improve searchability. ```json "keywords": [ // ... existing keywords "PROVIDER_NAME", "provider-name-ai" ] ``` -------------------------------- ### Add Provider Description to Package JSON Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Provide a descriptive text for the new provider in the `enumDescriptions` array in `package.json`. ```json "enumDescriptions": [ // ... existing descriptions "Use Provider Display Name for generating commit messages" ], ``` -------------------------------- ### Implement Provider API Service Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Create a new file `src/services/api/PROVIDER_NAME.ts` containing the API implementation for the new provider. This includes functions for making API calls and validating API keys. ```typescript import { debugLog } from "../debug/logger"; import { RequestManager } from "../../utils/requestManager"; import { APIErrorHandler } from "../../utils/errorHandler"; const PROVIDER_NAME_BASE_URL = "https://api.provider.com/v1"; // Replace with actual URL export async function callProviderNameAPI( apiKey: string, model: string, diff: string, customContext?: string ): Promise { debugLog(`Making API call to Provider Name with model: ${model}`); const headers = { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }; const messages = [ { role: "system", content: "You are an expert at creating concise, informative git commit messages...", }, { role: "user", content: `${ customContext ? customContext + "\n\n" : "" }Here's the git diff:\n\n${diff}`, }, ]; const body = { model: model, messages: messages, max_tokens: 150, temperature: 0.3, }; try { const response = await RequestManager.makeRequest( `${PROVIDER_NAME_BASE_URL}/chat/completions`, // Adjust endpoint { method: "POST", headers, body: JSON.stringify(body), } ); if (!response.ok) { const errorText = await response.text(); debugLog(`Provider Name API error: ${response.status} - ${errorText}`); throw APIErrorHandler.handleError( new Error(`Provider Name API error: ${response.status}`), "PROVIDER_NAME" ); } const data = await response.json(); const message = data.choices?.[0]?.message?.content || data.message?.content; if (!message) { throw new Error("No valid response from Provider Name API"); } debugLog(`Provider Name API response received successfully`); return message.trim(); } catch (error) { debugLog(`Provider Name API call failed: ${error}`); throw APIErrorHandler.handleError(error as Error, "PROVIDER_NAME"); } } export async function validateProviderNameAPIKey( apiKey: string ): Promise { try { const response = await RequestManager.makeRequest( `${PROVIDER_NAME_BASE_URL}/models`, // Adjust validation endpoint { method: "GET", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, } ); return response.ok; } catch (error) { debugLog(`Provider Name API key validation failed: ${error}`); return false; } } ``` -------------------------------- ### Generate Commit Prompt with Configuration Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Generates a standardized commit prompt for AI providers using provided diff, configuration, and custom context. Ensure PromptConfig is imported. ```typescript import { generateCommitPrompt, PromptConfig } from "./services/api/prompts"; // Prompt configuration options const config: PromptConfig = { maxLength: 72, // Max subject line length includeScope: true // Include scope in parentheses }; const diff = `diff --git a/src/api.ts b/src/api.ts @@ -15,6 +15,10 @@ +export async function fetchUsers(): Promise { + return await api.get('/users'); +}`; const customContext = "New API endpoint for user management"; const prompt = generateCommitPrompt(diff, config, customContext); ``` -------------------------------- ### Authenticate Azure CLI Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Log in to your Azure account and set the active subscription. This is necessary if the Azure CLI is not authenticated. ```bash az login az account set --subscription "your-subscription-id" ``` -------------------------------- ### Update README Documentation Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Update project documentation, tables, and feature lists. ```markdown **Multi-Provider AI Support**: Access 12 different AI providers with unified configuration and intelligent fallback handling. ``` ```markdown | **Provider Name** | ✓/✗ | ✓/✗ | ✓/✗ | ✓/✗ | Basic/Advanced| ~X min | ``` ```markdown **For [Use Case]**: Provider Name (model-name) - Description of benefits ``` ```markdown | **Provider Name** | model-name-1 | XXXk tokens | XX RPM | Description of model capabilities | Free/Paid | | | model-name-2 | XXXk tokens | XX RPM | Description of model capabilities | Free/Paid | | | model-name-3 | XXXk tokens | XX RPM | Description of model capabilities | Free/Paid | ``` ```markdown **12 AI Providers**: Gemini, OpenAI, Claude, Mistral, HuggingFace, Ollama, Anthropic, Together AI, DeepSeek, Provider Name, OpenRouter, GitHub Copilot ``` -------------------------------- ### VS Code Settings Schema Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Configure the AI Commit Assistant extension using VS Code's settings.json file or the Settings UI. This includes selecting the API provider, configuring provider-specific keys and models, and setting commit message and prompt customization options. ```jsonc // .vscode/settings.json { // Select AI provider "aiCommitAssistant.apiProvider": "openai", // gemini|openai|anthropic|ollama|copilot|deepseek|grok|perplexity|... // Provider-specific settings "aiCommitAssistant.openai.apiKey": "sk-your-api-key", "aiCommitAssistant.openai.model": "gpt-4o", "aiCommitAssistant.gemini.apiKey": "AIza-your-key", "aiCommitAssistant.gemini.model": "gemini-2.5-flash", "aiCommitAssistant.anthropic.apiKey": "sk-ant-your-key", "aiCommitAssistant.anthropic.model": "claude-sonnet-4", "aiCommitAssistant.ollama.url": "http://localhost:11434", "aiCommitAssistant.ollama.model": "phi4", // Commit message settings "aiCommitAssistant.commit.verbose": true, // Include detailed body "aiCommitAssistant.showDiagnostics": false, // Show token count before generation // Prompt customization "aiCommitAssistant.promptCustomization.enabled": true, "aiCommitAssistant.promptCustomization.saveLastPrompt": true, // Debug mode "aiCommitAssistant.debug": false } ``` -------------------------------- ### Import Provider Model Type Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md In `src/config/settings.ts`, import the newly defined `ProviderNameModel` type. ```typescript import { // ... existing imports ProviderNameModel, // Add this import } from "./types"; ``` -------------------------------- ### Update Changelog for Provider Integration Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Document new provider integrations in the CHANGELOG.md file, including capabilities, models, UI integration, and configuration details. ```markdown ## [X.Y.Z] - YYYY-MM-DD ### Added - **Provider Name AI Provider Integration**: [Brief description of capabilities] - Complete Provider Name API implementation with support for [models/features] - Added model-name-1 model for [use case description] - Added model-name-2 model for [use case description] - Comprehensive UI integration with dedicated settings panel and model selection - Full configuration support in package.json with proper schema validation - Seamless integration with existing provider architecture and error handling - Professional SVG icon integration matching other provider branding - API key management with secure storage and validation flows - Rate limiting support and proper error messaging for missing configurations - **Enhanced Provider Support**: Expanded AI provider ecosystem to 12 total providers - Updated provider comparison tables and documentation - Added Provider Name to recommended configurations for [use cases] - Enhanced [free tier/performance/etc.] options with competitive Provider Name [features] - Improved provider selection guidance with [specific benefits] ### Enhanced - **Documentation Updates**: Comprehensive documentation refresh - Updated README.md with Provider Name provider information and capabilities - Added Provider Name to model specifications table with context windows and rate limits - Enhanced provider comparison with Provider Name [key benefits] - Updated recommended configurations for different development scenarios ### Technical - Extended provider count from 11 to 12 in all documentation and marketing materials - Enhanced type definitions with ProviderNameApiConfig and ProviderNameModel types - Implemented complete API integration matching existing provider patterns - Added comprehensive validation and error handling for Provider Name endpoints - Updated settings management to include Provider Name form fields and persistence ``` -------------------------------- ### Configure Test Environment Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/TEST_DOCUMENTATION.md Configuration settings for the test runner defined in .vscode-test.mjs. ```javascript export default defineConfig({ files: "out/test/**/*.test.js", workspaceFolder: "./test-workspace", mocha: { ui: "tdd", timeout: 20000, }, }); ``` -------------------------------- ### Standardized Prompts for AI Providers Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Ensures consistent prompt templates across all AI providers for uniform output quality. ```markdown - **Standardized Prompts**: Consistent prompt templates across all 12 AI providers ``` -------------------------------- ### Add Provider Configuration to getConfiguration Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md In `src/config/settings.ts`, add the logic to retrieve and set the configuration for the new provider within the `getConfiguration` function. ```typescript export function getConfiguration(): ExtensionConfig { // ... existing code return { // ... existing providers PROVIDER_NAME: { enabled: config.get("PROVIDER_NAME.enabled", false), apiKey: config.get("PROVIDER_NAME.apiKey"), model: config.get("PROVIDER_NAME.model", "DEFAULT_MODEL_NAME"), }, // ... rest of config }; } ``` -------------------------------- ### Define Provider Configuration Interface Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Extend the `ExtensionSettings` interface to include configuration options for the new provider, such as API key and model. ```typescript export interface ExtensionSettings { // ... existing providers PROVIDER_NAME: { apiKey: string; model: string; }; // ... rest of interface } ``` -------------------------------- ### Unified Prompt Engineering Across AI Providers Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Achieve consistent, high-quality output regardless of the chosen AI model through unified prompt engineering. ```markdown Unified prompt engineering across all 12 AI providers ensuring consistent, high-quality output regardless of chosen model. ``` -------------------------------- ### Test File Structure Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/TEST_DOCUMENTATION.md Organizes modular test files for specific extension aspects. Ensure all required VS Code API mocks are in place. ```treeview src/test/ ├── extension.test.ts # Main test entry point ├── comprehensive.test.ts # Integration test runner └── suites/ ├── settingsUI.test.ts # Settings UI testing ├── aiProviders.test.ts # AI provider integration testing ├── extensionCommands.test.ts # Extension command testing ├── gitIntegration.test.ts # Git integration testing ├── webviewComponents.test.ts # Webview component testing ├── errorHandling.test.ts # Error handling testing └── configurationManagement.test.ts # Configuration testing ``` -------------------------------- ### Run Compilation Test Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Execute the compilation script to check for TypeScript errors. Ensure all imports are correct and files exist. ```bash npm run compile ``` -------------------------------- ### Prompt Manager API Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Manages custom prompt context with save/reuse functionality across commit generations. ```APIDOC ## Prompt Manager ### Custom Context Management Manages custom prompt context with save/reuse functionality across commit generations. #### Get Custom Context - **Method**: GET (assumed) - **Endpoint**: /prompt-manager/custom-context (assumed) - **Description**: Retrieves custom context, with support for saving prompts. If `promptCustomization.enabled` is true, it shows an input box with the last saved prompt as default, optionally copies it to the clipboard, and saves new prompts if `saveLastPrompt` is enabled. - **Returns**: User input or an empty string. #### Get Last Saved Prompt - **Method**: GET (assumed) - **Endpoint**: /prompt-manager/last-prompt (assumed) - **Description**: Retrieves the last saved prompt directly. - **Returns**: The last saved prompt string (e.g., "Implements feature X for issue #123"). #### Clear Last Saved Prompt - **Method**: DELETE (assumed) - **Endpoint**: /prompt-manager/last-prompt (assumed) - **Description**: Clears the last saved prompt from global configuration. - **Returns**: void (or success status). ### VS Code Commands - **AI Commit Assistant: View Last Custom Prompt**: Shows the last prompt with copy/clear options. - **AI Commit Assistant: Clear Last Custom Prompt**: Clears the last prompt with confirmation. ``` -------------------------------- ### Update SettingsWebviewProvider Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Adds the new provider to the selection dropdown in the webview provider. ```html ``` -------------------------------- ### Configure VS Code Telemetry Settings Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/azure-deployment/telemetry-setup-summary.md Add these properties to your settings.json file to enable telemetry and provide the connection string for Azure Application Insights. ```json { "aiCommitAssistant.telemetry.enabled": true, "aiCommitAssistant.telemetry.connectionString": "InstrumentationKey=fff83741-d639-438a-8cc1-528623bf2c2e;IngestionEndpoint=https://canadacentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://canadacentral.livediagnostics.monitor.azure.com/;ApplicationId=aaa7702a-4008-4c73-9ac6-8502b537724f" } ``` -------------------------------- ### Add Provider to Package JSON Enum Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Include the new provider's name in the `enum` array within `package.json` to register it as a supported provider. ```json "enum": [ "gemini", "huggingface", "ollama", "mistral", "cohere", "openai", "together", "openrouter", "anthropic", "copilot", "deepseek", "PROVIDER_NAME" ], ``` -------------------------------- ### Generate Commit Prompt API Source: https://context7.com/shahabahreini/ai-commit-assistant/llms.txt Creates a standardized prompt for AI providers with conventional commit formatting instructions. ```APIDOC ## Generate Commit Prompt ### Description Creates a standardized prompt for AI providers with conventional commit formatting instructions. ### Method POST (assumed, based on function call) ### Endpoint /api/prompts (assumed, based on import path) ### Parameters #### Request Body - **diff** (string) - Required - The git diff to analyze. - **config** (object) - Optional - Configuration options for the prompt. - **maxLength** (number) - Optional - Maximum subject line length. - **includeScope** (boolean) - Optional - Whether to include scope in parentheses. - **customContext** (string) - Optional - Additional context for the AI. ### Request Example ```json { "diff": "diff --git a/src/api.ts b/src/api.ts\n@@ -15,6 +15,10 @@\n+export async function fetchUsers(): Promise {\n+ return await api.get('/users');\n+}", "config": { "maxLength": 72, "includeScope": true }, "customContext": "New API endpoint for user management" } ``` ### Response #### Success Response (200) - **prompt** (string) - The generated commit message prompt. #### Response Example ```json { "prompt": "You are a Git commit message generator...\n\nCRITICAL INSTRUCTIONS:\n- Generate a COMPLETE commit message\n- Write the FULL subject line and body\n\nUser Context: New API endpoint for user management\n\nDIFF TO ANALYZE:\ndiff --git a/src/api.ts...\n\nREQUIRED FORMAT:\n(): \n\n- \n\nCOMMIT TYPES:\n- feat: New feature\n- fix: Bug fix\n- docs: Documentation\n..." } ``` ``` -------------------------------- ### Update Settings Manager Scripts Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Handle form population, collection, and update logic for the new provider. ```typescript document.getElementById("PROVIDER_NAMEApiKey").value = currentSettings.PROVIDER_NAME?.apiKey || ""; document.getElementById("PROVIDER_NAMEModel").value = currentSettings.PROVIDER_NAME?.model || "DEFAULT_MODEL_NAME"; ``` ```typescript PROVIDER_NAME: { apiKey: document.getElementById('PROVIDER_NAMEApiKey').value, model: document.getElementById('PROVIDER_NAMEModel').value }, ``` ```typescript if (currentSettings.PROVIDER_NAME) { document.getElementById("PROVIDER_NAMEApiKey").value = currentSettings.PROVIDER_NAME.apiKey || ""; document.getElementById("PROVIDER_NAMEModel").value = currentSettings.PROVIDER_NAME.model || "DEFAULT_MODEL_NAME"; } ``` -------------------------------- ### Implement ProviderNameSettings Component Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Defines the UI structure for provider-specific settings, including API key input and model selection. ```typescript import { ExtensionSettings } from "../../../models/ExtensionSettings"; import { ProviderIcon } from "./ProviderIcon"; export class ProviderNameSettings { private _settings: ExtensionSettings; constructor(settings: ExtensionSettings) { this._settings = settings; } public render(): string { return ` `; } } ``` -------------------------------- ### Create Provider API Configuration Interface Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Define an interface for the new provider's API configuration, extending `BaseApiConfig`, in `src/config/types.ts`. ```typescript export interface ProviderNameApiConfig extends BaseApiConfig { type: "PROVIDER_NAME"; apiKey: string; // or other auth fields model: ProviderNameModel; } ``` -------------------------------- ### Query Commit Success Rate by Provider Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/azure-deployment/telemetry-setup-summary.md Aggregates commit generation attempts and calculates the success percentage grouped by AI provider. ```kusto customEvents | where name == 'gitmind.commit_generated' | where timestamp > ago(7d) | summarize TotalAttempts = count(), SuccessRate = round(100.0 * countif(tostring(customDimensions.success) == 'true') / count(), 2) by Provider = tostring(customDimensions.provider) | order by SuccessRate desc ``` -------------------------------- ### Make Scripts Executable Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/scripts/README.md Grant execute permissions to all shell scripts in the scripts directory. This is often required after cloning a repository. ```bash chmod +x scripts/*.sh ``` -------------------------------- ### Implement Provider Rate Limit Checks Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Add the rate limit checking logic for the new provider in the `checkRateLimits` function. This helps manage API usage and prevent exceeding limits. ```typescript case "PROVIDER_NAME": result.success = true; result.limits = { reset: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now limit: 10000, // Adjust based on provider limits remaining: 9500, queryCost: 1 }; result.notes = "Provider Name rate limits depend on your account tier and model usage"; break; ``` -------------------------------- ### Update UI Manager Script Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Manage visibility, icons, and status information for the new provider in the UI. ```typescript document.getElementById("PROVIDER_NAMESettings").style.display = provider === "PROVIDER_NAME" ? "block" : "none"; ``` ```typescript const icons = { // ... existing icons PROVIDER_NAME: "SVG_PATH_DATA_HERE", }; ``` ```typescript case "PROVIDER_NAME": modelInfo = settings.PROVIDER_NAME.model || "DEFAULT_MODEL_NAME"; break; ``` ```typescript case "PROVIDER_NAME": apiConfigured = !!settings.PROVIDER_NAME.apiKey; break; ``` ```typescript const displayNames = { // ... existing providers PROVIDER_NAME: "Provider Display Name", }; ``` -------------------------------- ### Add Provider API Key Validation Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Integrate the new provider's API key validation logic into the `checkApiSetup` function. This ensures the API key is valid before proceeding. ```typescript case "PROVIDER_NAME": if (!config.apiKey) { result.error = "API key not configured"; result.troubleshooting = "Please enter your Provider Name API key in the settings"; } else { const isValid = await validateProviderNameAPIKey(config.apiKey); result.success = isValid; if (isValid) { result.model = config.model || "DEFAULT_MODEL_NAME"; result.responseTime = 600; // Placeholder value result.details = "Connection test successful"; } else { result.error = "Invalid API key"; result.troubleshooting = "Please check your Provider Name API key configuration"; } } break; ``` -------------------------------- ### Add Provider Option to GeneralSettings Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Update the provider selection dropdown in the webview settings. ```typescript ``` -------------------------------- ### Retrieve Provider Settings in Settings Manager Source: https://github.com/shahabahreini/ai-commit-assistant/blob/main/instructions/provider_integration_guide.md Implement logic in `getCurrentSettings` within `SettingsManager.ts` to retrieve the API key and model configuration for the new provider from VS Code settings. ```typescript PROVIDER_NAME: { apiKey: config.get("PROVIDER_NAME.apiKey") || "", model: config.get("PROVIDER_NAME.model") || "DEFAULT_MODEL_NAME", }, ```