From bb7bed775d77aec521c52ab70e70b8b4c9eb6097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=96zer=20=C3=96zda=C5=9F?= Date: Fri, 22 May 2026 12:54:32 +0300 Subject: [PATCH 1/4] docs: update publishing and testing documentation --- PUBLISHING.md | 77 ++++++++++++++------------------ README.md | 91 ++++++++++++++++++++++++++++++++++++++ TESTING.md | 120 +++++++++++++++++++++++++++++--------------------- 3 files changed, 193 insertions(+), 95 deletions(-) create mode 100644 README.md diff --git a/PUBLISHING.md b/PUBLISHING.md index a4a1ec8..3167273 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -2,72 +2,59 @@ ## GitHub Secrets Configuration -Bu workflow'un çalışması için aşağıdaki GitHub secrets'ları ayarlamanız gerekiyor: - ### 1. VS Code Marketplace (vsce) Personal Access Token -1. https://marketplace.visualstudio.com/manage adresine gidin -2. Sol menüden "Security" sekmesine tıklayın -3. "New Personal Access Token" butonuna tıklayın -4. Token'a bir isim verin (örn: `nuvo-commit-ci`) -5. "All accessible organizations" seçin -6. Oluşturulan token'ı kopyalayın -7. GitHub repository'nizde: +1. Go to https://marketplace.visualstudio.com/manage +2. Click "Security" in the left menu +3. Click "New Personal Access Token" +4. Name it (e.g., `nuvo-commit-ci`) +5. Select "All accessible organizations" +6. Copy the generated token +7. In your GitHub repository: - Settings → Secrets and variables → Actions - - "New repository secret" butonuna tıklayın + - Click "New repository secret" - Name: `VSCE_PAT` - - Value: Kopyaladığınız token - -### 2. Open VSX Registry Token (Opsiyonel) + - Value: Paste the token -Eğer Open VSX Registry'ye de publish etmek isterseniz: +### 2. Open VSX Registry Token (Optional) -1. https://open-vsx.org/user-settings/tokens adresine gidin -2. "Create New Token" butonuna tıklayın -3. Token'ı kopyalayın -4. GitHub repository'nizde: +1. Go to https://open-vsx.org/user-settings/tokens +2. Click "Create New Token" +3. Copy the token +4. In your GitHub repository: - Settings → Secrets and variables → Actions - - "New repository secret" butonuna tıklayın + - Click "New repository secret" - Name: `OVSX_PAT` - - Value: Kopyaladığınız token + - Value: Paste the token -## Workflow Akışı +## Workflow Flow -1. **Master branch'e push** yapıldığında workflow tetiklenir -2. **CI beklemesi**: Diğer test ve build workflow'larının tamamlanmasını bekler -3. **Build**: Extension derlenir ve paketlanır -4. **Publish**: VS Code Marketplace'e otomatik olarak publish edilir +1. **Push to master** triggers the workflow +2. **CI wait**: Waits for test and build workflows to complete +3. **Build**: Compiles and packages the extension +4. **Publish**: Automatically publishes to VS Code Marketplace -## Manuel Tetikleme +## Manual Trigger -Workflow'u manuel olarak da tetikleyebilirsiniz: - GitHub repository → Actions → "Publish VS Code Extension" → "Run workflow" -## Version Yönetimi +## Version Management -Her publish işleminden önce `package.json` dosyasındaki `version` alanını güncellemeyi unutmayın: +Update the `version` field in `package.json` before each publish: ```json { - "version": "0.1.1" // Minor veya patch versiyonunu artırın + "version": "0.1.1" // Increment minor or patch version } ``` -## Gerekli CI Workflow'ları - -Bu workflow, aşağıdaki check'lerin tamamlanmasını bekler: -- `Test` - Test workflow'u -- `Build` - Build workflow'u - -Eğer farklı isimlerde CI workflow'larınız varsa, `publish.yml` dosyasındaki `check-name` değerlerini güncelleyin. - ## Troubleshooting -### Workflow CI'yi bekliyor ama CI yoksa -- Eğer henüz CI workflow'ları oluşturmadıysanız, `wait-for-ci` job'unu kaldırabilirsiniz -- Veya check-name değerlerini mevcut workflow'larınıza göre güncelleyin +### Workflow waiting for CI but no CI exists +- Remove the `wait-for-ci` job if you haven't created CI workflows yet +- Or update `check-name` values to match your workflow names -### Publish hatası alıyorsanız -- VSCE_PAT secret'ının doğru ayarlandığından emin olun -- Token'ın süresinin dolmadığını kontrol edin -- Publisher adının (`nuvocode`) marketplace'te kayıtlı olduğunu doğrulayın +### Publish errors +- Verify VSCE_PAT secret is set correctly +- Check token hasn't expired +- Confirm publisher name (`nuvocode`) is registered on marketplace diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed02331 --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +# Nuvo Commit + +> Write commits, not novels. Local-first AI commit message generator. + +## Features + +- 🤖 **AI-Powered**: Generates meaningful commit messages using local AI models +- 🔒 **Local-First**: Runs entirely on your machine via Ollama - no cloud APIs +- 🚀 **Fast**: Quick commit message generation without leaving VS Code +- ⚙️ **Customizable**: Configure models, endpoints, and behavior + +## Requirements + +- [Ollama](https://ollama.ai) installed and running +- VS Code 1.85.0 or higher +- Node.js 18 or higher + +## Installation + +1. Install the extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit) +2. Install Ollama: `brew install ollama` (macOS) or visit [ollama.ai](https://ollama.ai) +3. Pull a model: `ollama pull qwen3:4b` +4. Start Ollama: `ollama serve` + +## Usage + +1. Stage your changes: `git add .` +2. Open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) +3. Run `Nuvo Commit: Generate Commit Message` +4. Review and accept the suggested commit message + +## Configuration + +Configure in VS Code Settings (`Cmd+,`): + +```json +{ + "nuvoCommit.provider": "ollama", + "nuvoCommit.model": "qwen3:4b", + "nuvoCommit.ollamaEndpoint": "http://localhost:11434/api/generate", + "nuvoCommit.maxDiffChars": 12000, + "nuvoCommit.autoCommit": false, + "nuvoCommit.autoAccept": true +} +``` + +### Settings + +- **provider**: AI provider (currently only Ollama supported) +- **model**: Model identifier (e.g., `qwen3:4b`, `llama3.2:3b`, `mistral:7b`) +- **ollamaEndpoint**: Ollama generate endpoint URL +- **maxDiffChars**: Maximum diff characters sent to the model +- **autoCommit**: Automatically commit after accepting suggestion +- **autoAccept**: Skip approval dialog and fill commit message directly + +## Development + +```bash +# Install dependencies +npm install + +# Compile +npm run compile + +# Watch mode +npm run watch + +# Run tests +npm run test:unit + +# Run with coverage +npm run test:coverage +``` + +### Debugging + +1. Open the project in VS Code +2. Press **F5** to run the extension in debug mode +3. A new VS Code window will open with the extension loaded + +## Testing + +See [TESTING.md](./TESTING.md) for detailed testing instructions. + +## Publishing + +See [PUBLISHING.md](./PUBLISHING.md) for release and publishing guide. + +## License + +MIT diff --git a/TESTING.md b/TESTING.md index 862a413..5482711 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,93 +1,72 @@ -# 🧪 Nuvo Commit Test Rehberi +# 🧪 Nuvo Commit Testing Guide -## ✅ Unit Testler (CI'da çalışıyor) +## ✅ Unit Tests (Runs in CI) ```bash -# Tüm unit testler +# All unit tests npm run test:unit -# Coverage raporu ile +# With coverage report npm run test:coverage -# Tek bir test dosyası +# Single test file npx jest src/utils/sanitize.test.ts ``` -## 🚀 Extension Manuel Testi +## 🚀 Manual Extension Testing -### Yöntem 1: Debug Mode (Önerilen) +### Method 1: Debug Mode (Recommended) -1. **F5** tuşuna bas veya "Run and Debug" → "Run Extension" -2. Yeni bir VS Code penceresi açılacak -3. Test edilecek repo'da çalış: +1. Press **F5** or "Run and Debug" → "Run Extension" +2. A new VS Code window will open +3. In your test repo, run: ```bash git add . ``` -4. **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) -5. `Nuvo Commit: Generate Commit Message` yaz ve Enter -6. Commit mesajı oluşturulacak +4. Open **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) +5. Type `Nuvo Commit: Generate Commit Message` and press Enter +6. Commit message will be generated -### Yöntem 2: VSIX Package +### Method 2: VSIX Package ```bash -# 1. Package oluştur +# 1. Build package npm install -g @vscode/vsce vsce package -# 2. VS Code'da yükle -# - Extensions panelini aç (Cmd+Shift+X) -# - ⋯ menüsünden "Install from VSIX" -# - nuvo-commit-0.1.0.vsix dosyasını seç +# 2. Install in VS Code +# - Open Extensions panel (Cmd+Shift+X) +# - Click ⋯ → "Install from VSIX" +# - Select nuvo-commit-0.1.0.vsix ``` -### Yöntem 3: Extension Development Host +## 📋 Test Scenarios +### 1. Basic Commit Message ```bash -# Terminal'de -code --extensionDevelopmentPath=/Users/ozerozdas/Dev/companies/nuvocode/infra/nuvo-commit -``` - -## 📋 Test Senaryoları - -### 1. Temel Commit Mesajı -```bash -# Test repo oluştur +# Create test repo mkdir test-repo && cd test-repo git init echo "console.log('hello')" > index.js git add index.js -# Extension'ı çalıştır -# Beklenen: "chore: add index.js" veya benzeri -``` - -### 2. Farklı Değişiklik Tipleri -```bash -# Yeni dosya -echo "new file" > new.txt -git add new.txt - -# Değişiklik -echo "modified" >> existing.txt -git add existing.txt - -# Silme -git rm old.txt +# Run extension +# Expected: "chore: add index.js" or similar ``` -### 3. Ollama Entegrasyonu +### 2. Ollama Integration ```bash -# Ollama'nın çalıştığından emin ol +# Ensure Ollama is running ollama serve -# Model yüklü mü kontrol et +# Check if model is loaded ollama list | grep qwen3 -# Değilse yükle +# Install if needed ollama pull qwen3:4b ``` -### 4. Ayarlar Testi +### 3. Settings Test VS Code Settings (`Cmd+,`): ```json { @@ -99,6 +78,47 @@ VS Code Settings (`Cmd+,`): } ``` +## 🐛 Debugging + +### Extension Logs +```bash +# Open VS Code Output panel +# Select "Extension Host" +``` + +### Common Issues + +**"Cannot reach Ollama"** +```bash +# Start Ollama +ollama serve + +# Check if port is listening +lsof -i :11434 +``` + +**"No staged changes"** +```bash +# Stage changes +git add . +``` + +**Extension not showing** +```bash +# Restart VS Code +# Run: Developer: Reload Window (Cmd+Shift+P) +``` + +## 🎯 Quick Test Checklist + +- [ ] Unit tests passing (`npm run test:unit`) +- [ ] Extension opens with F5 +- [ ] Command visible in Command Palette +- [ ] Commit message generated from staged changes +- [ ] Ollama responding +- [ ] Settings working +- [ ] Error handling informs user + ## 🐛 Hata Ayıklama ### Extension Logları From 184a799b1f9e4201dbe682268110684618e2048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=96zer=20=C3=96zda=C5=9F?= Date: Fri, 22 May 2026 13:16:50 +0300 Subject: [PATCH 2/4] docs(config): add multi-provider support and cloud configuration options --- README.md | 182 +++++++++++++++++++++--- package.json | 68 +++++---- src/extension.ts | 103 ++++++++++++-- src/providers/AnthropicProvider.test.ts | 151 ++++++++++++++++++++ src/providers/AnthropicProvider.ts | 92 ++++++++++++ src/providers/OllamaProvider.ts | 31 +++- src/providers/OpenAIProvider.test.ts | 150 +++++++++++++++++++ src/providers/OpenAIProvider.ts | 97 +++++++++++++ src/providers/Provider.ts | 37 ++++- src/providers/index.ts | 4 + 10 files changed, 858 insertions(+), 57 deletions(-) create mode 100644 src/providers/AnthropicProvider.test.ts create mode 100644 src/providers/AnthropicProvider.ts create mode 100644 src/providers/OpenAIProvider.test.ts create mode 100644 src/providers/OpenAIProvider.ts create mode 100644 src/providers/index.ts diff --git a/README.md b/README.md index ed02331..7bb2d43 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,33 @@ ## Features -- 🤖 **AI-Powered**: Generates meaningful commit messages using local AI models -- 🔒 **Local-First**: Runs entirely on your machine via Ollama - no cloud APIs +- 🤖 **Multi-Provider Support**: Choose from Ollama (local), OpenAI, or Anthropic +- 🔒 **Local-First**: Run entirely on your machine via Ollama - no cloud APIs required +- ☁️ **Cloud Options**: Use OpenAI GPT-4 or Anthropic Claude for better results - 🚀 **Fast**: Quick commit message generation without leaving VS Code - ⚙️ **Customizable**: Configure models, endpoints, and behavior +- 📋 **Auto Model Detection**: Automatically list available models from your provider ## Requirements -- [Ollama](https://ollama.ai) installed and running +- For **Ollama** (local): + - [Ollama](https://ollama.ai) installed and running + - Pull a model: `ollama pull qwen3:4b` +- For **OpenAI** (cloud): + - OpenAI API key from https://platform.openai.com/api-keys +- For **Anthropic** (cloud): + - Anthropic API key from https://console.anthropic.com/ - VS Code 1.85.0 or higher - Node.js 18 or higher ## Installation 1. Install the extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit) -2. Install Ollama: `brew install ollama` (macOS) or visit [ollama.ai](https://ollama.ai) -3. Pull a model: `ollama pull qwen3:4b` -4. Start Ollama: `ollama serve` +2. Choose your provider: + - **Local (Recommended)**: Install Ollama: `brew install ollama` (macOS) or visit [ollama.ai](https://ollama.ai) + - **Cloud**: Get API keys from OpenAI or Anthropic +3. Configure in VS Code Settings (`Cmd+,`) +4. Start generating commit messages! ## Usage @@ -29,29 +39,169 @@ 3. Run `Nuvo Commit: Generate Commit Message` 4. Review and accept the suggested commit message +### Selecting a Model + +To choose from available models: + +1. Run command: `Nuvo Commit: Select Model` +2. Choose from the list of available models, or select "Enter manually..." +3. The selected model will be saved to your settings + +**Tip:** For Ollama users, the model list is fetched automatically from your local Ollama instance. + ## Configuration Configure in VS Code Settings (`Cmd+,`): ```json { + "nuvoCommit.autoAccept": true, + "nuvoCommit.autoCommit": false, + "nuvoCommit.maxDiffChars": 12000, "nuvoCommit.provider": "ollama", - "nuvoCommit.model": "qwen3:4b", - "nuvoCommit.ollamaEndpoint": "http://localhost:11434/api/generate", + "nuvoCommit.endpoint": "http://localhost:11434/api/generate", + "nuvoCommit.apiKey": "", + "nuvoCommit.model": "qwen3:4b" +} +``` + +### Settings (in order) + +1. **autoAccept**: Skip approval dialog and fill commit message directly +2. **autoCommit**: Automatically commit after accepting suggestion +3. **maxDiffChars**: Maximum diff characters sent to the model +4. **provider**: AI provider to use + - `ollama` - Local AI (no API key needed) + - `openai` - OpenAI API (requires API key) + - `anthropic` - Anthropic API (requires API key) +5. **endpoint**: API endpoint URL + - For Ollama: `http://localhost:11434/api/generate` + - For OpenAI: Leave empty to use default, or set custom endpoint + - For Anthropic: Leave empty to use default +6. **apiKey**: API key for cloud providers + - Leave empty for Ollama + - Required for OpenAI and Anthropic +7. **model**: Model identifier + - Use command `Nuvo Commit: Select Model` to choose from available models + - Or enter manually (e.g., `qwen3:4b`, `gpt-4o`, `claude-sonnet-4-20250514`) + +### Example Configurations + +**Ollama (Local):** +```json +{ + "nuvoCommit.autoAccept": true, + "nuvoCommit.autoCommit": false, + "nuvoCommit.maxDiffChars": 12000, + "nuvoCommit.provider": "ollama", + "nuvoCommit.endpoint": "http://localhost:11434/api/generate", + "nuvoCommit.apiKey": "", + "nuvoCommit.model": "qwen3:4b" +} +``` + +**OpenAI (Cloud):** +```json +{ + "nuvoCommit.autoAccept": true, + "nuvoCommit.autoCommit": false, "nuvoCommit.maxDiffChars": 12000, + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "", + "nuvoCommit.apiKey": "sk-your-api-key-here", + "nuvoCommit.model": "gpt-4o-mini" +} +``` + +**Anthropic (Cloud):** +```json +{ + "nuvoCommit.autoAccept": true, "nuvoCommit.autoCommit": false, - "nuvoCommit.autoAccept": true + "nuvoCommit.maxDiffChars": 12000, + "nuvoCommit.provider": "anthropic", + "nuvoCommit.endpoint": "", + "nuvoCommit.apiKey": "sk-ant-your-api-key-here", + "nuvoCommit.model": "claude-3-5-sonnet-20241022" } ``` -### Settings +**Custom OpenAI-Compatible Endpoint:** +```json +{ + "nuvoCommit.autoAccept": true, + "nuvoCommit.autoCommit": false, + "nuvoCommit.maxDiffChars": 12000, + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "http://localhost:1234/v1/chat/completions", + "nuvoCommit.apiKey": "not-needed", + "nuvoCommit.model": "local-model" +} +``` + +**Ollama (Local):** +```json +{ + "nuvoCommit.provider": "ollama", + "nuvoCommit.endpoint": "http://localhost:11434/api/generate", + "nuvoCommit.apiKey": "", + "nuvoCommit.model": "qwen3:4b" +} +``` + +**OpenAI (Cloud):** +```json +{ + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "", + "nuvoCommit.apiKey": "sk-your-api-key-here", + "nuvoCommit.model": "gpt-4o-mini" +} +``` + +**Anthropic (Cloud):** +```json +{ + "nuvoCommit.provider": "anthropic", + "nuvoCommit.endpoint": "", + "nuvoCommit.apiKey": "sk-ant-your-api-key-here", + "nuvoCommit.model": "claude-3-5-sonnet-20241022" +} +``` + +**Custom OpenAI-Compatible Endpoint:** +```json +{ + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "http://localhost:1234/v1/chat/completions", + "nuvoCommit.apiKey": "not-needed", + "nuvoCommit.model": "local-model" +} +``` + +1. **provider**: AI provider to use + - `ollama` - Local AI (no API key needed) + - `openai` - OpenAI API (requires API key) + - `anthropic` - Anthropic API (requires API key) + +2. **endpoint**: API endpoint URL + - For Ollama: `http://localhost:11434/api/generate` + - For OpenAI: Leave empty to use default, or set custom endpoint + - For Anthropic: Leave empty to use default + +3. **apiKey**: API key for cloud providers + - Leave empty for Ollama + - Required for OpenAI and Anthropic + +4. **model**: Model identifier + - Use command `Nuvo Commit: Select Model` to choose from available models + - Or enter manually (e.g., `qwen3:4b`, `gpt-4o`, `claude-sonnet-4-20250514`) + +5. **maxDiffChars**: Maximum diff characters sent to the model + +6. **autoCommit**: Automatically commit after accepting suggestion -- **provider**: AI provider (currently only Ollama supported) -- **model**: Model identifier (e.g., `qwen3:4b`, `llama3.2:3b`, `mistral:7b`) -- **ollamaEndpoint**: Ollama generate endpoint URL -- **maxDiffChars**: Maximum diff characters sent to the model -- **autoCommit**: Automatically commit after accepting suggestion -- **autoAccept**: Skip approval dialog and fill commit message directly +7. **autoAccept**: Skip approval dialog and fill commit message directly ## Development diff --git a/package.json b/package.json index 12d03e0..096e8a2 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "node": ">=18" }, "categories": ["SCM Providers", "Machine Learning"], - "keywords": ["git", "commit", "ai", "ollama", "local-first"], + "keywords": ["git", "commit", "ai", "ollama", "openai", "anthropic", "local-first", "multi-provider"], "activationEvents": [], "main": "./out/extension.js", "contributes": { @@ -23,6 +23,11 @@ { "command": "nuvoCommit.settings", "title": "Nuvo Commit: Settings" + }, + { + "command": "nuvoCommit.selectModel", + "title": "Nuvo Commit: Select Model", + "icon": "$(symbol-boolean)" } ], "menus": { @@ -37,15 +42,43 @@ "configuration": { "title": "Nuvo Commit", "properties": { + "nuvoCommit.autoAccept": { + "type": "boolean", + "default": true, + "description": "Skip the approval dialog and directly fill the commit message input. Disable to see the approval dialog." + }, + "nuvoCommit.autoCommit": { + "type": "boolean", + "default": false, + "description": "Run `git commit -m ` automatically after the user accepts the suggestion." + }, + "nuvoCommit.maxDiffChars": { + "type": "number", + "default": 12000, + "minimum": 1000, + "description": "Maximum diff characters sent to the model. Diffs above this are truncated." + }, "nuvoCommit.provider": { "type": "string", - "enum": ["ollama"], + "enum": ["ollama", "openai", "anthropic"], "enumDescriptions": [ - "Ollama - Local AI provider for running models locally" + "Ollama - Local AI provider for running models locally", + "OpenAI - Cloud API provider (requires API key)", + "Anthropic - Cloud API provider (requires API key)" ], "default": "ollama", "description": "AI provider used to generate commit messages." }, + "nuvoCommit.endpoint": { + "type": "string", + "default": "http://localhost:11434/api/generate", + "description": "API endpoint URL. For Ollama: http://localhost:11434/api/generate. For custom OpenAI/Anthropic endpoints, leave empty to use defaults." + }, + "nuvoCommit.apiKey": { + "type": "string", + "default": "", + "description": "API key for cloud providers (OpenAI, Anthropic). Leave empty for local providers like Ollama." + }, "nuvoCommit.model": { "type": "string", "default": "qwen3:4b", @@ -54,30 +87,13 @@ "llama3.2:3b", "mistral:7b", "codellama:7b", - "deepseek-coder:6.7b" + "deepseek-coder:6.7b", + "gpt-4o", + "gpt-4o-mini", + "claude-sonnet-4-20250514", + "claude-3-5-sonnet-20241022" ], - "description": "Model identifier passed to the provider. Common models: qwen3:4b, llama3.2:3b, mistral:7b." - }, - "nuvoCommit.ollamaEndpoint": { - "type": "string", - "default": "http://localhost:11434/api/generate", - "description": "Ollama generate endpoint URL." - }, - "nuvoCommit.maxDiffChars": { - "type": "number", - "default": 12000, - "minimum": 1000, - "description": "Maximum diff characters sent to the model. Diffs above this are truncated." - }, - "nuvoCommit.autoCommit": { - "type": "boolean", - "default": false, - "description": "Run `git commit -m ` automatically after the user accepts the suggestion." - }, - "nuvoCommit.autoAccept": { - "type": "boolean", - "default": true, - "description": "Skip the approval dialog and directly fill the commit message input. Disable to see the approval dialog." + "description": "Model identifier passed to the provider. Use 'Nuvo Commit: Select Model' command to choose from available models or enter manually." } } } diff --git a/src/extension.ts b/src/extension.ts index 2c35c1e..b7800ad 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,17 +3,25 @@ import { promisify } from "util"; import * as vscode from "vscode"; import { getStagedDiff, getWorkingDiff, GitError } from "./git/diff"; +import { + Provider, + ProviderConfig, + ProviderError, + ProviderRegistry, +} from "./providers/Provider"; import { OllamaProvider } from "./providers/OllamaProvider"; -import { Provider, ProviderError } from "./providers/Provider"; +import { OpenAIProvider } from "./providers/OpenAIProvider"; +import { AnthropicProvider } from "./providers/AnthropicProvider"; import { optimizeDiff } from "./utils/optimizeDiff"; import { sanitizeCommitMessage } from "./utils/sanitize"; const execFileAsync = promisify(execFile); interface Settings { - provider: "ollama"; + provider: string; model: string; - ollamaEndpoint: string; + endpoint: string; + apiKey: string; maxDiffChars: number; autoCommit: boolean; autoAccept: boolean; @@ -22,12 +30,13 @@ interface Settings { function readSettings(): Settings { const cfg = vscode.workspace.getConfiguration("nuvoCommit"); return { - provider: cfg.get<"ollama">("provider", "ollama"), + provider: cfg.get("provider", "ollama"), model: cfg.get("model", "qwen3:4b"), - ollamaEndpoint: cfg.get( - "ollamaEndpoint", + endpoint: cfg.get( + "endpoint", "http://localhost:11434/api/generate", ), + apiKey: cfg.get("apiKey", ""), maxDiffChars: cfg.get("maxDiffChars", 12000), autoCommit: cfg.get("autoCommit", false), autoAccept: cfg.get("autoAccept", true), @@ -35,13 +44,26 @@ function readSettings(): Settings { } function buildProvider(settings: Settings): Provider { - switch (settings.provider) { - case "ollama": - return new OllamaProvider({ - endpoint: settings.ollamaEndpoint, - model: settings.model, - }); + const ProviderClass = ProviderRegistry.get(settings.provider); + + if (!ProviderClass) { + throw new ProviderError(`Unknown provider: ${settings.provider}`); } + + // Build config based on provider type + const hasApiKey = settings.apiKey && settings.apiKey.length > 0; + const config: ProviderConfig = hasApiKey + ? { + model: settings.model, + apiKey: settings.apiKey, + ...(settings.endpoint ? { endpoint: settings.endpoint } : {}), + } + : { + model: settings.model, + endpoint: settings.endpoint || "http://localhost:11434/api/generate", + }; + + return new ProviderClass(config); } function getRepoRoot(): string | undefined { @@ -230,7 +252,63 @@ async function runCommand(): Promise { } } +async function selectModel(): Promise { + const settings = readSettings(); + const provider = buildProvider(settings); + + // Get available models from provider + let models: string[] = []; + if (provider.listModels) { + models = await provider.listModels(); + } + + // Add custom input option + const items: vscode.QuickPickItem[] = []; + + if (models.length > 0) { + items.push( + { label: "Available Models", kind: vscode.QuickPickItemKind.Separator }, + ...models.map((m) => ({ label: m, description: "Click to select" })), + ); + } + + items.push( + { label: "Custom Model", kind: vscode.QuickPickItemKind.Separator }, + { label: "$(pencil) Enter manually...", description: "Type a custom model name" }, + ); + + const picked = await vscode.window.showQuickPick(items, { + placeHolder: `Select model for ${settings.provider}`, + ignoreFocusOut: true, + }); + + if (!picked) return; + + let selectedModel: string; + if (picked.label === "$(pencil) Enter manually...") { + const input = await vscode.window.showInputBox({ + prompt: "Enter model name", + placeHolder: "e.g., llama3.2:3b", + ignoreFocusOut: true, + }); + if (!input) return; + selectedModel = input; + } else { + selectedModel = picked.label; + } + + // Save to settings + const cfg = vscode.workspace.getConfiguration("nuvoCommit"); + await cfg.update("model", selectedModel, vscode.ConfigurationTarget.Global); + vscode.window.showInformationMessage(`Model set to: ${selectedModel}`); +} + export function activate(context: vscode.ExtensionContext): void { + // Register providers + ProviderRegistry.register("ollama", OllamaProvider as any); + ProviderRegistry.register("openai", OpenAIProvider as any); + ProviderRegistry.register("anthropic", AnthropicProvider as any); + context.subscriptions.push( vscode.commands.registerCommand("nuvoCommit.generate", runCommand), vscode.commands.registerCommand("nuvoCommit.settings", () => { @@ -239,6 +317,7 @@ export function activate(context: vscode.ExtensionContext): void { "nuvoCommit", ); }), + vscode.commands.registerCommand("nuvoCommit.selectModel", selectModel), ); } diff --git a/src/providers/AnthropicProvider.test.ts b/src/providers/AnthropicProvider.test.ts new file mode 100644 index 0000000..be3235c --- /dev/null +++ b/src/providers/AnthropicProvider.test.ts @@ -0,0 +1,151 @@ +import { AnthropicProvider } from "./AnthropicProvider"; +import { ProviderError } from "./Provider"; + +// Mock fetch globally +global.fetch = jest.fn(); + +describe("AnthropicProvider", () => { + const mockApiKey = "sk-ant-test123"; + const mockModel = "claude-sonnet-4-20250514"; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + describe("constructor", () => { + it("should create provider with correct name", () => { + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + expect(provider.name).toBe("anthropic"); + }); + }); + + describe("generateCommitMessage", () => { + it("should generate commit message successfully", async () => { + const mockResponse = { + content: [{ type: "text", text: "feat: add new feature" }], + }; + + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve(mockResponse), + }); + + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + const diff = "diff --git a/file.js b/file.js"; + const message = await provider.generateCommitMessage(diff); + + expect(message).toBe("feat: add new feature"); + expect(global.fetch).toHaveBeenCalledWith( + "https://api.anthropic.com/v1/messages", + expect.objectContaining({ + method: "POST", + headers: expect.objectContaining({ + "Content-Type": "application/json", + "x-api-key": mockApiKey, + "anthropic-version": "2023-06-01", + }), + }), + ); + }); + + it("should use custom endpoint when provided", async () => { + const customEndpoint = "https://custom.anthropic.com/v1/messages"; + const mockResponse = { + content: [{ type: "text", text: "fix: bug fix" }], + }; + + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve(mockResponse), + }); + + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + endpoint: customEndpoint, + }); + + await provider.generateCommitMessage("diff content"); + + expect(global.fetch).toHaveBeenCalledWith( + customEndpoint, + expect.any(Object), + ); + }); + + it("should throw ProviderError on network error", async () => { + (global.fetch as jest.Mock).mockRejectedValueOnce( + new Error("Network error"), + ); + + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(ProviderError); + }); + + it("should throw ProviderError on non-OK response", async () => { + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: false, + status: 401, + text: () => Promise.resolve("Invalid API key"), + }); + + const provider = new AnthropicProvider({ + apiKey: "invalid-key", + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(/Anthropic responded 401/); + }); + + it("should throw ProviderError on empty content", async () => { + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve({ content: [] }), + }); + + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(/No response from Anthropic/); + }); + }); + + describe("listModels", () => { + it("should return static list of common Anthropic models", async () => { + const provider = new AnthropicProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + const models = await provider.listModels(); + + expect(models).toEqual([ + "claude-sonnet-4-20250514", + "claude-3-7-sonnet-20250219", + "claude-3-5-sonnet-20241022", + "claude-3-5-haiku-20241022", + "claude-3-opus-20240229", + ]); + expect(models).toHaveLength(5); + }); + }); +}); diff --git a/src/providers/AnthropicProvider.ts b/src/providers/AnthropicProvider.ts new file mode 100644 index 0000000..9960c5e --- /dev/null +++ b/src/providers/AnthropicProvider.ts @@ -0,0 +1,92 @@ +import { buildCommitPrompt } from "../prompt/commitPrompt"; +import { Provider, ProviderError, APIProviderConfig } from "./Provider"; + +interface AnthropicResponse { + content: Array<{ + text: string; + type: string; + }>; + error?: { + message: string; + }; +} + +export interface AnthropicOptions extends APIProviderConfig { + apiKey: string; + endpoint?: string; + model: string; +} + +export class AnthropicProvider implements Provider { + readonly name = "anthropic"; + private readonly defaultEndpoint = "https://api.anthropic.com/v1/messages"; + + constructor(private readonly opts: AnthropicOptions) {} + + async generateCommitMessage(diff: string): Promise { + const prompt = buildCommitPrompt(diff); + const endpoint = this.opts.endpoint ?? this.defaultEndpoint; + + let res: Response; + try { + res = await fetch(endpoint, { + method: "POST", + headers: { + "Content-Type": "application/json", + "x-api-key": this.opts.apiKey, + "anthropic-version": "2023-06-01", + }, + body: JSON.stringify({ + model: this.opts.model, + max_tokens: 150, + messages: [ + { + role: "user", + content: prompt, + }, + ], + }), + }); + } catch (err) { + throw new ProviderError( + `Cannot reach Anthropic API at ${endpoint}. Check your connection and API key.`, + err, + ); + } + + if (!res.ok) { + const body = await res.text().catch(() => ""); + throw new ProviderError( + `Anthropic responded ${res.status}: ${body.slice(0, 200)}`, + ); + } + + let data: AnthropicResponse; + try { + data = (await res.json()) as AnthropicResponse; + } catch (err) { + throw new ProviderError("Invalid JSON from Anthropic", err); + } + + if (data.error) { + throw new ProviderError(`Anthropic error: ${data.error.message}`); + } + + if (!data.content || data.content.length === 0) { + throw new ProviderError("No response from Anthropic"); + } + + return data.content[0].text.trim(); + } + + async listModels(): Promise { + // Common Anthropic models - static list + return [ + "claude-sonnet-4-20250514", + "claude-3-7-sonnet-20250219", + "claude-3-5-sonnet-20241022", + "claude-3-5-haiku-20241022", + "claude-3-opus-20240229", + ]; + } +} diff --git a/src/providers/OllamaProvider.ts b/src/providers/OllamaProvider.ts index d6b31b8..def7e81 100644 --- a/src/providers/OllamaProvider.ts +++ b/src/providers/OllamaProvider.ts @@ -1,5 +1,5 @@ import { buildCommitPrompt } from "../prompt/commitPrompt"; -import { Provider, ProviderError } from "./Provider"; +import { Provider, ProviderError, LocalProviderConfig } from "./Provider"; interface OllamaGenerateResponse { response: string; @@ -7,7 +7,18 @@ interface OllamaGenerateResponse { error?: string; } -export interface OllamaOptions { +interface OllamaTag { + name: string; + model: string; + modified_at: string; + size: number; +} + +interface OllamaTagsResponse { + models: OllamaTag[]; +} + +export interface OllamaOptions extends LocalProviderConfig { endpoint: string; model: string; } @@ -64,6 +75,22 @@ export class OllamaProvider implements Provider { return stripThinking(data.response ?? ""); } + + async listModels(): Promise { + try { + const baseUrl = this.opts.endpoint.replace("/api/generate", ""); + const res = await fetch(`${baseUrl}/api/tags`); + + if (!res.ok) { + return []; + } + + const data = (await res.json()) as OllamaTagsResponse; + return data.models.map((m) => m.name).sort(); + } catch (err) { + return []; + } + } } function stripThinking(text: string): string { diff --git a/src/providers/OpenAIProvider.test.ts b/src/providers/OpenAIProvider.test.ts new file mode 100644 index 0000000..3be3236 --- /dev/null +++ b/src/providers/OpenAIProvider.test.ts @@ -0,0 +1,150 @@ +import { OpenAIProvider } from "./OpenAIProvider"; +import { ProviderError } from "./Provider"; + +// Mock fetch globally +global.fetch = jest.fn(); + +describe("OpenAIProvider", () => { + const mockApiKey = "sk-test123"; + const mockModel = "gpt-4o"; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + describe("constructor", () => { + it("should create provider with correct name", () => { + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + expect(provider.name).toBe("openai"); + }); + }); + + describe("generateCommitMessage", () => { + it("should generate commit message successfully", async () => { + const mockResponse = { + choices: [{ message: { content: "feat: add new feature" } }], + }; + + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve(mockResponse), + }); + + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + const diff = "diff --git a/file.js b/file.js"; + const message = await provider.generateCommitMessage(diff); + + expect(message).toBe("feat: add new feature"); + expect(global.fetch).toHaveBeenCalledWith( + "https://api.openai.com/v1/chat/completions", + expect.objectContaining({ + method: "POST", + headers: expect.objectContaining({ + "Content-Type": "application/json", + Authorization: `Bearer ${mockApiKey}`, + }), + }), + ); + }); + + it("should use custom endpoint when provided", async () => { + const customEndpoint = "https://custom.openai.com/v1/chat/completions"; + const mockResponse = { + choices: [{ message: { content: "fix: bug fix" } }], + }; + + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve(mockResponse), + }); + + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + endpoint: customEndpoint, + }); + + await provider.generateCommitMessage("diff content"); + + expect(global.fetch).toHaveBeenCalledWith( + customEndpoint, + expect.any(Object), + ); + }); + + it("should throw ProviderError on network error", async () => { + (global.fetch as jest.Mock).mockRejectedValueOnce( + new Error("Network error"), + ); + + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(ProviderError); + }); + + it("should throw ProviderError on non-OK response", async () => { + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: false, + status: 401, + text: () => Promise.resolve("Unauthorized"), + }); + + const provider = new OpenAIProvider({ + apiKey: "invalid-key", + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(/OpenAI responded 401/); + }); + + it("should throw ProviderError on empty choices", async () => { + (global.fetch as jest.Mock).mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve({ choices: [] }), + }); + + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + await expect( + provider.generateCommitMessage("diff"), + ).rejects.toThrow(/No response from OpenAI/); + }); + }); + + describe("listModels", () => { + it("should return static list of common OpenAI models", async () => { + const provider = new OpenAIProvider({ + apiKey: mockApiKey, + model: mockModel, + }); + + const models = await provider.listModels(); + + expect(models).toEqual([ + "gpt-4o", + "gpt-4o-mini", + "gpt-4-turbo", + "gpt-4", + "gpt-3.5-turbo", + ]); + expect(models).toHaveLength(5); + }); + }); +}); diff --git a/src/providers/OpenAIProvider.ts b/src/providers/OpenAIProvider.ts new file mode 100644 index 0000000..df6a19d --- /dev/null +++ b/src/providers/OpenAIProvider.ts @@ -0,0 +1,97 @@ +import { buildCommitPrompt } from "../prompt/commitPrompt"; +import { Provider, ProviderError, APIProviderConfig } from "./Provider"; + +interface OpenAIChatResponse { + choices: Array<{ + message: { + content: string; + }; + }>; + error?: { + message: string; + }; +} + +export interface OpenAIOptions extends APIProviderConfig { + apiKey: string; + endpoint?: string; + model: string; +} + +export class OpenAIProvider implements Provider { + readonly name = "openai"; + private readonly defaultEndpoint = "https://api.openai.com/v1/chat/completions"; + + constructor(private readonly opts: OpenAIOptions) {} + + async generateCommitMessage(diff: string): Promise { + const prompt = buildCommitPrompt(diff); + const endpoint = this.opts.endpoint ?? this.defaultEndpoint; + + let res: Response; + try { + res = await fetch(endpoint, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.opts.apiKey}`, + }, + body: JSON.stringify({ + model: this.opts.model, + messages: [ + { + role: "system", + content: "You are a helpful assistant that generates concise git commit messages.", + }, + { + role: "user", + content: prompt, + }, + ], + temperature: 0.2, + max_tokens: 150, + }), + }); + } catch (err) { + throw new ProviderError( + `Cannot reach OpenAI API at ${endpoint}. Check your connection and API key.`, + err, + ); + } + + if (!res.ok) { + const body = await res.text().catch(() => ""); + throw new ProviderError( + `OpenAI responded ${res.status}: ${body.slice(0, 200)}`, + ); + } + + let data: OpenAIChatResponse; + try { + data = (await res.json()) as OpenAIChatResponse; + } catch (err) { + throw new ProviderError("Invalid JSON from OpenAI", err); + } + + if (data.error) { + throw new ProviderError(`OpenAI error: ${data.error.message}`); + } + + if (!data.choices || data.choices.length === 0) { + throw new ProviderError("No response from OpenAI"); + } + + return data.choices[0].message.content.trim(); + } + + async listModels(): Promise { + // Common OpenAI models - static list + return [ + "gpt-4o", + "gpt-4o-mini", + "gpt-4-turbo", + "gpt-4", + "gpt-3.5-turbo", + ]; + } +} diff --git a/src/providers/Provider.ts b/src/providers/Provider.ts index 7acd44e..594abc9 100644 --- a/src/providers/Provider.ts +++ b/src/providers/Provider.ts @@ -1,11 +1,22 @@ -export interface ProviderConfig { +export interface BaseProviderConfig { model: string; +} + +export interface LocalProviderConfig extends BaseProviderConfig { + endpoint: string; +} + +export interface APIProviderConfig extends BaseProviderConfig { + apiKey: string; endpoint?: string; } +export type ProviderConfig = LocalProviderConfig | APIProviderConfig; + export interface Provider { readonly name: string; generateCommitMessage(diff: string): Promise; + listModels?(): Promise; } export class ProviderError extends Error { @@ -14,3 +25,27 @@ export class ProviderError extends Error { this.name = "ProviderError"; } } + +export class ProviderRegistry { + private static providers = new Map Provider>(); + + static register(name: string, providerClass: new (config: ProviderConfig) => Provider): void { + this.providers.set(name, providerClass); + } + + static get(name: string): (new (config: ProviderConfig) => Provider) | undefined { + return this.providers.get(name); + } + + static list(): string[] { + return Array.from(this.providers.keys()); + } +} + +export function isLocalProvider(config: ProviderConfig): config is LocalProviderConfig { + return "endpoint" in config && !("apiKey" in config); +} + +export function isAPIProvider(config: ProviderConfig): config is APIProviderConfig { + return "apiKey" in config; +} diff --git a/src/providers/index.ts b/src/providers/index.ts new file mode 100644 index 0000000..52f8c9e --- /dev/null +++ b/src/providers/index.ts @@ -0,0 +1,4 @@ +export { Provider, ProviderConfig, LocalProviderConfig, APIProviderConfig, ProviderError, ProviderRegistry } from "./Provider"; +export { OllamaProvider, OllamaOptions } from "./OllamaProvider"; +export { OpenAIProvider, OpenAIOptions } from "./OpenAIProvider"; +export { AnthropicProvider, AnthropicOptions } from "./AnthropicProvider"; From 6f5fcca3a1fec4ad42d93536984f59b727e96542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=96zer=20=C3=96zda=C5=9F?= Date: Fri, 22 May 2026 13:20:52 +0300 Subject: [PATCH 3/4] chore(config): add order and types properties to package.json schema and --- package.json | 7 +++++++ tsconfig.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 096e8a2..7fb0ec9 100644 --- a/package.json +++ b/package.json @@ -45,17 +45,20 @@ "nuvoCommit.autoAccept": { "type": "boolean", "default": true, + "order": 1, "description": "Skip the approval dialog and directly fill the commit message input. Disable to see the approval dialog." }, "nuvoCommit.autoCommit": { "type": "boolean", "default": false, + "order": 2, "description": "Run `git commit -m ` automatically after the user accepts the suggestion." }, "nuvoCommit.maxDiffChars": { "type": "number", "default": 12000, "minimum": 1000, + "order": 3, "description": "Maximum diff characters sent to the model. Diffs above this are truncated." }, "nuvoCommit.provider": { @@ -67,21 +70,25 @@ "Anthropic - Cloud API provider (requires API key)" ], "default": "ollama", + "order": 4, "description": "AI provider used to generate commit messages." }, "nuvoCommit.endpoint": { "type": "string", "default": "http://localhost:11434/api/generate", + "order": 5, "description": "API endpoint URL. For Ollama: http://localhost:11434/api/generate. For custom OpenAI/Anthropic endpoints, leave empty to use defaults." }, "nuvoCommit.apiKey": { "type": "string", "default": "", + "order": 6, "description": "API key for cloud providers (OpenAI, Anthropic). Leave empty for local providers like Ollama." }, "nuvoCommit.model": { "type": "string", "default": "qwen3:4b", + "order": 7, "examples": [ "qwen3:4b", "llama3.2:3b", diff --git a/tsconfig.json b/tsconfig.json index 10dd4c4..d162810 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "noFallthroughCasesInSwitch": true, "esModuleInterop": true, "skipLibCheck": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "types": ["node"] }, "include": ["src/**/*"], "exclude": ["node_modules", "out"] From 404bf6a549c2d6cd67a0085197e8a267f85bf38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=96zer=20=C3=96zda=C5=9F?= Date: Fri, 22 May 2026 13:40:59 +0300 Subject: [PATCH 4/4] chore(ci): update workflow configurations and documentation --- .eslintignore | 5 + .eslintrc.json | 33 + .github/workflows/publish.yml | 24 +- .github/workflows/test.yml | 3 + .prettierignore | 5 + .prettierrc | 7 + .vscodeignore | 22 +- CHANGELOG.md | 68 ++ README.md | 225 ++--- jest.config.js | 2 +- package-lock.json | 1371 ++++++++++++++++++++++++++-- package.json | 40 +- src/extension.ts | 155 +++- src/git/diff.test.ts | 110 +++ src/providers/AnthropicProvider.ts | 55 +- src/providers/OllamaProvider.ts | 65 +- src/providers/OpenAIProvider.ts | 72 +- src/providers/Provider.ts | 39 +- src/providers/config.test.ts | 65 ++ src/providers/config.ts | 47 + src/providers/http.ts | 31 + src/providers/index.ts | 16 +- src/utils/sanitize.test.ts | 2 +- tsconfig.json | 8 +- 24 files changed, 2064 insertions(+), 406 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 CHANGELOG.md create mode 100644 src/git/diff.test.ts create mode 100644 src/providers/config.test.ts create mode 100644 src/providers/config.ts create mode 100644 src/providers/http.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..6c00920 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +out/ +node_modules/ +coverage/ +src/__mocks__/ +*.vsix diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..7c11a60 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2022, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "env": { + "node": true, + "es2022": true + }, + "rules": { + "@typescript-eslint/no-explicit-any": "error", + "no-constant-condition": ["error", { "checkLoops": false }], + "@typescript-eslint/no-unused-vars": [ + "error", + { "argsIgnorePattern": "^_" } + ], + "no-console": "off" + }, + "overrides": [ + { + "files": ["**/*.test.ts"], + "env": { "jest": true } + } + ] +} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d9d872f..0505324 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: - # Wait for other CI workflows to complete + # Wait for the Tests workflow to pass before publishing wait-for-ci: name: Wait for CI to Complete runs-on: ubuntu-latest @@ -16,15 +16,7 @@ jobs: uses: lewagon/wait-on-check-action@v1.3.4 with: ref: ${{ github.sha }} - check-name: 'Test' - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 10 - - - name: Wait for build workflow - uses: lewagon/wait-on-check-action@v1.3.4 - with: - ref: ${{ github.sha }} - check-name: 'Build' + check-name: 'test' repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 10 @@ -46,11 +38,17 @@ jobs: - name: Install Dependencies run: npm ci + - name: Lint + run: npm run lint + + - name: Run Unit Tests + run: npm run test:unit + - name: Compile Extension run: npm run compile - - name: Install vsce - run: npm install -g @vscode/vsce + - name: Install vsce and ovsx + run: npm install -g @vscode/vsce ovsx - name: Publish to VS Code Marketplace env: @@ -61,5 +59,5 @@ jobs: - name: Publish to Open VSX Registry env: OVSX_PAT: ${{ secrets.OVSX_PAT }} - run: vsce publish --no-yarn --target linux-x64 --packagedExtensionPath extension.vsix + run: ovsx publish --pat "$OVSX_PAT" if: env.OVSX_PAT != '' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 381a076..908f805 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Lint + run: npm run lint + - name: Compile TypeScript run: npm run compile diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..05f19e0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +out/ +node_modules/ +coverage/ +package-lock.json +*.vsix diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..17d2b4e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 80, + "tabWidth": 2 +} diff --git a/.vscodeignore b/.vscodeignore index d69fcb2..a759f2f 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,7 +1,23 @@ .vscode/** +.github/** src/** -tsconfig.json -**/*.map -**/*.ts +coverage/** node_modules/** +**/*.ts +**/*.map +out/**/*.test.js +out/test/** +out/__mocks__/** +tsconfig.json +tsconfig.test.json +jest.config.js +.mocharc.json +.vscode-test.json +.eslintrc.json +.eslintignore +.prettierrc +.prettierignore .gitignore +**/*.vsix +TESTING.md +PUBLISHING.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4c06a8c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ +# Changelog + +All notable changes to the **Nuvo Commit** extension are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2026-05-22 + +First stable release. No new features compared to `0.1.x` — this release hardens +the extension for production use. + +### Added + +- `Nuvo Commit: Set API Key` command — stores cloud provider API keys in VS Code's + encrypted `SecretStorage` instead of plaintext settings. +- `nuvoCommit.requestTimeoutMs` setting — provider requests now abort after a + configurable timeout (default 30s) instead of hanging indefinitely. +- ESLint + Prettier configuration and a `lint` step in CI. +- Unit tests for git diff retrieval and provider configuration. +- `CHANGELOG.md`. + +### Changed + +- API keys are migrated automatically from the deprecated `nuvoCommit.apiKey` + setting into secure storage and removed from `settings.json`. +- The provider config shape is now decided by the selected provider. Choosing a + cloud provider without an API key now shows a clear, actionable error. + +### Fixed + +- Publish workflow waited on non-existent CI checks (`Test`/`Build`), which could + stall releases indefinitely. +- `tsc` build and Jest unit tests failed because the `tsconfig` `types` field + excluded the test type definitions. +- Removed unsafe `as any` casts in provider registration. + +### Security + +- Cloud provider API keys are no longer stored as plaintext in `settings.json`. + +## [0.1.1] - 2026-05 + +### Added + +- Multi-provider documentation and cloud configuration examples. +- `order` metadata for settings so they render in a sensible order in the + Settings UI. + +### Changed + +- Updated publishing and testing documentation. + +## [0.1.0] - 2026-05 + +### Added + +- Initial release: AI-generated commit messages from staged (or working + directory) git diffs. +- Multi-provider support: Ollama (local), OpenAI, and Anthropic. +- Diff optimization that skips lock files, generated files, and build output. +- Conventional Commits enforcement with sanitization and a safe fallback. +- `Nuvo Commit: Select Model` command with automatic model discovery for Ollama. +- `autoAccept` and `autoCommit` settings. + +[1.0.0]: https://github.com/nuvocode/nuvo-commit/releases/tag/v1.0.0 +[0.1.1]: https://github.com/nuvocode/nuvo-commit/releases/tag/v0.1.1 +[0.1.0]: https://github.com/nuvocode/nuvo-commit/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 7bb2d43..b00bfe1 100644 --- a/README.md +++ b/README.md @@ -2,231 +2,136 @@ > Write commits, not novels. Local-first AI commit message generator. +[![Version](https://img.shields.io/visual-studio-marketplace/v/nuvocode.nuvo-commit)](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit) +[![Installs](https://img.shields.io/visual-studio-marketplace/i/nuvocode.nuvo-commit)](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit) +[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) + ## Features - 🤖 **Multi-Provider Support**: Choose from Ollama (local), OpenAI, or Anthropic -- 🔒 **Local-First**: Run entirely on your machine via Ollama - no cloud APIs required -- ☁️ **Cloud Options**: Use OpenAI GPT-4 or Anthropic Claude for better results +- 🔒 **Local-First**: Run entirely on your machine via Ollama — no cloud APIs required +- ☁️ **Cloud Options**: Use OpenAI or Anthropic Claude for higher-quality results +- 🔑 **Secure Keys**: Cloud API keys are stored in VS Code's encrypted secret storage - 🚀 **Fast**: Quick commit message generation without leaving VS Code -- ⚙️ **Customizable**: Configure models, endpoints, and behavior +- ⚙️ **Customizable**: Configure models, endpoints, timeouts, and behavior - 📋 **Auto Model Detection**: Automatically list available models from your provider ## Requirements -- For **Ollama** (local): - - [Ollama](https://ollama.ai) installed and running - - Pull a model: `ollama pull qwen3:4b` -- For **OpenAI** (cloud): - - OpenAI API key from https://platform.openai.com/api-keys -- For **Anthropic** (cloud): - - Anthropic API key from https://console.anthropic.com/ - VS Code 1.85.0 or higher -- Node.js 18 or higher +- For **Ollama** (local): [Ollama](https://ollama.ai) installed and running, with a + model pulled (`ollama pull qwen3:4b`) +- For **OpenAI** (cloud): an API key from +- For **Anthropic** (cloud): an API key from ## Installation -1. Install the extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit) +1. Install the extension from the + [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit). 2. Choose your provider: - - **Local (Recommended)**: Install Ollama: `brew install ollama` (macOS) or visit [ollama.ai](https://ollama.ai) - - **Cloud**: Get API keys from OpenAI or Anthropic -3. Configure in VS Code Settings (`Cmd+,`) + - **Local (recommended)**: install Ollama (`brew install ollama` on macOS, or see + [ollama.ai](https://ollama.ai)). + - **Cloud**: get an API key from OpenAI or Anthropic. +3. Configure the extension (see [Configuration](#configuration)). 4. Start generating commit messages! ## Usage -1. Stage your changes: `git add .` -2. Open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) -3. Run `Nuvo Commit: Generate Commit Message` -4. Review and accept the suggested commit message +1. Stage your changes (`git add .`). If nothing is staged, Nuvo Commit falls back + to your working-directory changes. +2. Open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`). +3. Run **Nuvo Commit: Generate Commit Message**. +4. Review and accept the suggested message. -### Selecting a Model +### Selecting a model -To choose from available models: +1. Run **Nuvo Commit: Select Model**. +2. Pick from the discovered models, or choose "Enter manually…". +3. The selection is saved to your settings. -1. Run command: `Nuvo Commit: Select Model` -2. Choose from the list of available models, or select "Enter manually..." -3. The selected model will be saved to your settings +> **Tip:** For Ollama, the model list is fetched automatically from your local instance. -**Tip:** For Ollama users, the model list is fetched automatically from your local Ollama instance. +### Setting an API key (cloud providers) -## Configuration +API keys are stored securely — **not** in `settings.json`. -Configure in VS Code Settings (`Cmd+,`): +1. Run **Nuvo Commit: Set API Key**. +2. Paste your key into the masked input (leave it empty to clear a stored key). -```json -{ - "nuvoCommit.autoAccept": true, - "nuvoCommit.autoCommit": false, - "nuvoCommit.maxDiffChars": 12000, - "nuvoCommit.provider": "ollama", - "nuvoCommit.endpoint": "http://localhost:11434/api/generate", - "nuvoCommit.apiKey": "", - "nuvoCommit.model": "qwen3:4b" -} -``` +If you previously set `nuvoCommit.apiKey` in settings, it is migrated into secure +storage automatically and removed from `settings.json` on first activation. -### Settings (in order) - -1. **autoAccept**: Skip approval dialog and fill commit message directly -2. **autoCommit**: Automatically commit after accepting suggestion -3. **maxDiffChars**: Maximum diff characters sent to the model -4. **provider**: AI provider to use - - `ollama` - Local AI (no API key needed) - - `openai` - OpenAI API (requires API key) - - `anthropic` - Anthropic API (requires API key) -5. **endpoint**: API endpoint URL - - For Ollama: `http://localhost:11434/api/generate` - - For OpenAI: Leave empty to use default, or set custom endpoint - - For Anthropic: Leave empty to use default -6. **apiKey**: API key for cloud providers - - Leave empty for Ollama - - Required for OpenAI and Anthropic -7. **model**: Model identifier - - Use command `Nuvo Commit: Select Model` to choose from available models - - Or enter manually (e.g., `qwen3:4b`, `gpt-4o`, `claude-sonnet-4-20250514`) - -### Example Configurations - -**Ollama (Local):** -```json -{ - "nuvoCommit.autoAccept": true, - "nuvoCommit.autoCommit": false, - "nuvoCommit.maxDiffChars": 12000, - "nuvoCommit.provider": "ollama", - "nuvoCommit.endpoint": "http://localhost:11434/api/generate", - "nuvoCommit.apiKey": "", - "nuvoCommit.model": "qwen3:4b" -} -``` +## Configuration -**OpenAI (Cloud):** -```json -{ - "nuvoCommit.autoAccept": true, - "nuvoCommit.autoCommit": false, - "nuvoCommit.maxDiffChars": 12000, - "nuvoCommit.provider": "openai", - "nuvoCommit.endpoint": "", - "nuvoCommit.apiKey": "sk-your-api-key-here", - "nuvoCommit.model": "gpt-4o-mini" -} -``` +Configure in VS Code Settings (`Cmd+,`) under **Nuvo Commit**: -**Anthropic (Cloud):** -```json -{ - "nuvoCommit.autoAccept": true, - "nuvoCommit.autoCommit": false, - "nuvoCommit.maxDiffChars": 12000, - "nuvoCommit.provider": "anthropic", - "nuvoCommit.endpoint": "", - "nuvoCommit.apiKey": "sk-ant-your-api-key-here", - "nuvoCommit.model": "claude-3-5-sonnet-20241022" -} -``` +| Setting | Default | Description | +|---|---|---| +| `nuvoCommit.autoAccept` | `true` | Skip the approval dialog and fill the commit message directly. | +| `nuvoCommit.autoCommit` | `false` | Run `git commit` automatically after accepting. | +| `nuvoCommit.maxDiffChars` | `12000` | Maximum diff characters sent to the model; larger diffs are truncated. | +| `nuvoCommit.provider` | `ollama` | AI provider: `ollama`, `openai`, or `anthropic`. | +| `nuvoCommit.endpoint` | Ollama URL | API endpoint. Leave empty for cloud providers to use their defaults. | +| `nuvoCommit.requestTimeoutMs` | `30000` | Milliseconds to wait for a provider response before aborting. | +| `nuvoCommit.model` | `qwen3:4b` | Model identifier passed to the provider. | -**Custom OpenAI-Compatible Endpoint:** -```json -{ - "nuvoCommit.autoAccept": true, - "nuvoCommit.autoCommit": false, - "nuvoCommit.maxDiffChars": 12000, - "nuvoCommit.provider": "openai", - "nuvoCommit.endpoint": "http://localhost:1234/v1/chat/completions", - "nuvoCommit.apiKey": "not-needed", - "nuvoCommit.model": "local-model" -} -``` +> The deprecated `nuvoCommit.apiKey` setting is kept only for one-time migration — +> use the **Set API Key** command instead. + +### Example configurations -**Ollama (Local):** +**Ollama (local):** ```json { "nuvoCommit.provider": "ollama", "nuvoCommit.endpoint": "http://localhost:11434/api/generate", - "nuvoCommit.apiKey": "", "nuvoCommit.model": "qwen3:4b" } ``` -**OpenAI (Cloud):** +**OpenAI (cloud):** set the key via **Nuvo Commit: Set API Key**, then: ```json { "nuvoCommit.provider": "openai", "nuvoCommit.endpoint": "", - "nuvoCommit.apiKey": "sk-your-api-key-here", "nuvoCommit.model": "gpt-4o-mini" } ``` -**Anthropic (Cloud):** +**Anthropic (cloud):** set the key via **Nuvo Commit: Set API Key**, then: ```json { "nuvoCommit.provider": "anthropic", "nuvoCommit.endpoint": "", - "nuvoCommit.apiKey": "sk-ant-your-api-key-here", "nuvoCommit.model": "claude-3-5-sonnet-20241022" } ``` -**Custom OpenAI-Compatible Endpoint:** +**Custom OpenAI-compatible endpoint:** ```json { "nuvoCommit.provider": "openai", "nuvoCommit.endpoint": "http://localhost:1234/v1/chat/completions", - "nuvoCommit.apiKey": "not-needed", "nuvoCommit.model": "local-model" } ``` -1. **provider**: AI provider to use - - `ollama` - Local AI (no API key needed) - - `openai` - OpenAI API (requires API key) - - `anthropic` - Anthropic API (requires API key) - -2. **endpoint**: API endpoint URL - - For Ollama: `http://localhost:11434/api/generate` - - For OpenAI: Leave empty to use default, or set custom endpoint - - For Anthropic: Leave empty to use default - -3. **apiKey**: API key for cloud providers - - Leave empty for Ollama - - Required for OpenAI and Anthropic - -4. **model**: Model identifier - - Use command `Nuvo Commit: Select Model` to choose from available models - - Or enter manually (e.g., `qwen3:4b`, `gpt-4o`, `claude-sonnet-4-20250514`) - -5. **maxDiffChars**: Maximum diff characters sent to the model - -6. **autoCommit**: Automatically commit after accepting suggestion - -7. **autoAccept**: Skip approval dialog and fill commit message directly - ## Development ```bash -# Install dependencies -npm install - -# Compile -npm run compile - -# Watch mode -npm run watch - -# Run tests -npm run test:unit - -# Run with coverage -npm run test:coverage +npm install # Install dependencies +npm run compile # Compile TypeScript +npm run watch # Compile in watch mode +npm run lint # Lint sources +npm run format # Format with Prettier +npm run test:unit # Run Jest unit tests +npm run test:coverage # Run unit tests with coverage ``` ### Debugging -1. Open the project in VS Code -2. Press **F5** to run the extension in debug mode -3. A new VS Code window will open with the extension loaded +1. Open the project in VS Code. +2. Press **F5** to launch the extension in a new Extension Development Host window. ## Testing @@ -234,7 +139,11 @@ See [TESTING.md](./TESTING.md) for detailed testing instructions. ## Publishing -See [PUBLISHING.md](./PUBLISHING.md) for release and publishing guide. +See [PUBLISHING.md](./PUBLISHING.md) for the release and publishing guide. + +## Changelog + +See [CHANGELOG.md](./CHANGELOG.md). ## License diff --git a/jest.config.js b/jest.config.js index 4e6f8b9..5f2d716 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,7 +5,7 @@ module.exports = { testMatch: ['**/*.test.ts'], testPathIgnorePatterns: ['/src/test/'], transform: { - '^.+\\.ts$': 'ts-jest', + '^.+\\.ts$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }], }, collectCoverageFrom: [ 'src/**/*.ts', diff --git a/package-lock.json b/package-lock.json index 22412db..bc42d14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,25 @@ { "name": "nuvo-commit", - "version": "0.1.0", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nuvo-commit", - "version": "0.1.0", + "version": "1.0.0", + "license": "MIT", "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^20.11.0", "@types/vscode": "^1.85.0", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/parser": "^7.18.0", "@vscode/test-cli": "^0.0.9", "@vscode/test-electron": "^2.3.9", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "jest": "^29.7.0", + "prettier": "^3.3.0", "ts-jest": "^29.1.2", "typescript": "^5.4.0" }, @@ -53,6 +59,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -538,6 +545,175 @@ "dev": true, "license": "MIT" }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", + "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", + "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1073,6 +1249,44 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -1252,113 +1466,355 @@ "dev": true, "license": "MIT" }, - "node_modules/@vscode/test-cli": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@vscode/test-cli/-/test-cli-0.0.9.tgz", - "integrity": "sha512-vsl5/ueE3Jf0f6XzB0ECHHMsd5A0Yu6StElb8a+XsubZW7kHNAOw4Y3TSSuDzKEpLnJ92nbMy1Zl+KLGCE6NaA==", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", + "integrity": "sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==", "dev": true, "license": "MIT", "dependencies": { - "@types/mocha": "^10.0.2", - "c8": "^9.1.0", - "chokidar": "^3.5.3", - "enhanced-resolve": "^5.15.0", - "glob": "^10.3.10", - "minimatch": "^9.0.3", - "mocha": "^10.2.0", - "supports-color": "^9.4.0", - "yargs": "^17.7.2" + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/type-utils": "7.18.0", + "@typescript-eslint/utils": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, - "bin": { - "vscode-test": "out/bin.mjs" + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz", + "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/typescript-estree": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "debug": "^4.3.4" }, "engines": { - "node": ">=18" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@vscode/test-electron": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.5.2.tgz", - "integrity": "sha512-8ukpxv4wYe0iWMRQU18jhzJOHkeGKbnw7xWRX3Zw1WJA4cEKbHcmmLPdPrPtL6rhDcrlCZN+xKRpv09n4gRHYg==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", + "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", "dev": true, "license": "MIT", "dependencies": { - "http-proxy-agent": "^7.0.2", - "https-proxy-agent": "^7.0.5", - "jszip": "^3.10.1", - "ora": "^8.1.0", - "semver": "^7.6.2" + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0" }, "engines": { - "node": ">=16" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/agent-base": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", - "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "node_modules/@typescript-eslint/type-utils": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz", + "integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==", "dev": true, "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "7.18.0", + "@typescript-eslint/utils": "7.18.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, "engines": { - "node": ">= 14" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "node_modules/@typescript-eslint/types": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", + "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=6" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "node_modules/@typescript-eslint/typescript-estree": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", + "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "dependencies": { - "type-fest": "^0.21.3" + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": ">=8" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "node_modules/@typescript-eslint/utils": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", + "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", "dev": true, "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/typescript-estree": "7.18.0" + }, "engines": { - "node": ">=12" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@typescript-eslint/visitor-keys": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", + "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", "dev": true, "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@typescript-eslint/types": "7.18.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": ">=8" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/anymatch": { + "node_modules/@ungap/structured-clone": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/@vscode/test-cli": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/@vscode/test-cli/-/test-cli-0.0.9.tgz", + "integrity": "sha512-vsl5/ueE3Jf0f6XzB0ECHHMsd5A0Yu6StElb8a+XsubZW7kHNAOw4Y3TSSuDzKEpLnJ92nbMy1Zl+KLGCE6NaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mocha": "^10.0.2", + "c8": "^9.1.0", + "chokidar": "^3.5.3", + "enhanced-resolve": "^5.15.0", + "glob": "^10.3.10", + "minimatch": "^9.0.3", + "mocha": "^10.2.0", + "supports-color": "^9.4.0", + "yargs": "^17.7.2" + }, + "bin": { + "vscode-test": "out/bin.mjs" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@vscode/test-electron": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.5.2.tgz", + "integrity": "sha512-8ukpxv4wYe0iWMRQU18jhzJOHkeGKbnw7xWRX3Zw1WJA4cEKbHcmmLPdPrPtL6rhDcrlCZN+xKRpv09n4gRHYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", + "jszip": "^3.10.1", + "ora": "^8.1.0", + "semver": "^7.6.2" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/acorn": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", @@ -1382,6 +1838,16 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -2040,6 +2506,13 @@ } } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -2080,6 +2553,32 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2171,6 +2670,205 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.2.tgz", + "integrity": "sha512-iI1f+D2ViGn+uvv5HuHVUamg8ll4tN+JRHGc6IJi4TP9Kl976C57fzPXgseXNs8v0iA8aSJpHsTWjDb9QJamGQ==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", + "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2185,6 +2883,52 @@ "node": ">=4" } }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -2242,6 +2986,30 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2249,6 +3017,23 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -2259,6 +3044,19 @@ "bser": "2.1.1" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -2299,6 +3097,28 @@ "flat": "cli.js" } }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "dev": true, + "license": "ISC" + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -2423,20 +3243,70 @@ "glob": "dist/esm/bin.mjs" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "is-glob": "^4.0.1" + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" }, "engines": { - "node": ">= 6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/graceful-fs": { @@ -2446,6 +3316,13 @@ "dev": true, "license": "ISC" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/handlebars": { "version": "4.7.9", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz", @@ -2546,6 +3423,16 @@ "node": ">=10.17.0" } }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", @@ -2553,6 +3440,33 @@ "dev": true, "license": "MIT" }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -2704,6 +3618,16 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -3564,6 +4488,13 @@ "node": ">=6" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -3571,6 +4502,20 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -3597,6 +4542,16 @@ "setimmediate": "^1.0.5" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -3617,6 +4572,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lie": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", @@ -3657,6 +4626,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -3724,6 +4700,16 @@ "dev": true, "license": "MIT" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -4094,6 +5080,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ora": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", @@ -4255,6 +5259,19 @@ "dev": true, "license": "(MIT AND Zlib)" }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -4335,6 +5352,16 @@ "dev": true, "license": "ISC" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -4434,6 +5461,32 @@ "node": ">=8" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", + "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -4483,6 +5536,16 @@ "node": ">= 6" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -4500,6 +5563,27 @@ ], "license": "MIT" }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -4644,6 +5728,104 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", + "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -5083,6 +6265,13 @@ "node": "*" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -5103,6 +6292,19 @@ "node": ">=8.0" } }, + "node_modules/ts-api-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-jest": { "version": "29.4.11", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.4.11.tgz", @@ -5169,6 +6371,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -5259,6 +6474,16 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5307,6 +6532,16 @@ "node": ">= 8" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index 7fb0ec9..f1b1472 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nuvo-commit", "displayName": "Nuvo Commit", "description": "Write commits, not novels. Local-first AI commit message generator.", - "version": "0.1.1", + "version": "1.0.0", "publisher": "nuvocode", "icon": "images/logo.png", "engines": { @@ -11,6 +11,10 @@ }, "categories": ["SCM Providers", "Machine Learning"], "keywords": ["git", "commit", "ai", "ollama", "openai", "anthropic", "local-first", "multi-provider"], + "galleryBanner": { + "color": "#1e1e2e", + "theme": "dark" + }, "activationEvents": [], "main": "./out/extension.js", "contributes": { @@ -28,6 +32,10 @@ "command": "nuvoCommit.selectModel", "title": "Nuvo Commit: Select Model", "icon": "$(symbol-boolean)" + }, + { + "command": "nuvoCommit.setApiKey", + "title": "Nuvo Commit: Set API Key" } ], "menus": { @@ -79,16 +87,24 @@ "order": 5, "description": "API endpoint URL. For Ollama: http://localhost:11434/api/generate. For custom OpenAI/Anthropic endpoints, leave empty to use defaults." }, + "nuvoCommit.requestTimeoutMs": { + "type": "number", + "default": 30000, + "minimum": 1000, + "order": 6, + "description": "Maximum time in milliseconds to wait for a provider response before aborting the request." + }, "nuvoCommit.apiKey": { "type": "string", "default": "", - "order": 6, - "description": "API key for cloud providers (OpenAI, Anthropic). Leave empty for local providers like Ollama." + "order": 7, + "markdownDeprecationMessage": "**Deprecated:** API keys are now stored securely. Run the `Nuvo Commit: Set API Key` command instead. Any value here is migrated automatically and then cleared.", + "description": "Deprecated. Use the 'Nuvo Commit: Set API Key' command instead." }, "nuvoCommit.model": { "type": "string", "default": "qwen3:4b", - "order": 7, + "order": 8, "examples": [ "qwen3:4b", "llama3.2:3b", @@ -106,9 +122,14 @@ } }, "scripts": { - "compile": "tsc -p ./", + "clean": "node -e \"require('fs').rmSync('out',{recursive:true,force:true})\"", + "compile": "npm run clean && tsc -p ./", "watch": "tsc -watch -p ./", "vscode:prepublish": "npm run compile", + "lint": "eslint src --ext .ts", + "lint:fix": "eslint src --ext .ts --fix", + "format": "prettier --write .", + "format:check": "prettier --check .", "test": "vscode-test", "test:unit": "jest", "test:coverage": "jest --coverage" @@ -117,9 +138,14 @@ "@types/jest": "^29.5.12", "@types/node": "^20.11.0", "@types/vscode": "^1.85.0", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/parser": "^7.18.0", "@vscode/test-cli": "^0.0.9", "@vscode/test-electron": "^2.3.9", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "jest": "^29.7.0", + "prettier": "^3.3.0", "ts-jest": "^29.1.2", "typescript": "^5.4.0" }, @@ -127,5 +153,9 @@ "type": "git", "url": "https://github.com/nuvocode/nuvo-commit.git" }, + "homepage": "https://github.com/nuvocode/nuvo-commit#readme", + "bugs": { + "url": "https://github.com/nuvocode/nuvo-commit/issues" + }, "license": "MIT" } diff --git a/src/extension.ts b/src/extension.ts index b7800ad..9c13636 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,28 +3,30 @@ import { promisify } from "util"; import * as vscode from "vscode"; import { getStagedDiff, getWorkingDiff, GitError } from "./git/diff"; -import { - Provider, - ProviderConfig, - ProviderError, - ProviderRegistry, -} from "./providers/Provider"; +import { Provider, ProviderError, ProviderRegistry } from "./providers/Provider"; import { OllamaProvider } from "./providers/OllamaProvider"; import { OpenAIProvider } from "./providers/OpenAIProvider"; import { AnthropicProvider } from "./providers/AnthropicProvider"; +import { buildProviderConfig, requiresApiKey } from "./providers/config"; import { optimizeDiff } from "./utils/optimizeDiff"; import { sanitizeCommitMessage } from "./utils/sanitize"; const execFileAsync = promisify(execFile); +/** Key under which the cloud provider API key is stored in SecretStorage. */ +const API_KEY_SECRET = "nuvoCommit.apiKey"; + +/** Set during `activate`; the only handle to VS Code's encrypted storage. */ +let secretStorage: vscode.SecretStorage | undefined; + interface Settings { provider: string; model: string; endpoint: string; - apiKey: string; maxDiffChars: number; autoCommit: boolean; autoAccept: boolean; + requestTimeoutMs: number; } function readSettings(): Settings { @@ -36,32 +38,32 @@ function readSettings(): Settings { "endpoint", "http://localhost:11434/api/generate", ), - apiKey: cfg.get("apiKey", ""), maxDiffChars: cfg.get("maxDiffChars", 12000), autoCommit: cfg.get("autoCommit", false), autoAccept: cfg.get("autoAccept", true), + requestTimeoutMs: cfg.get("requestTimeoutMs", 30000), }; } -function buildProvider(settings: Settings): Provider { +async function getApiKey(): Promise { + if (!secretStorage) return ""; + return (await secretStorage.get(API_KEY_SECRET)) ?? ""; +} + +async function buildProvider(settings: Settings): Promise { const ProviderClass = ProviderRegistry.get(settings.provider); - if (!ProviderClass) { throw new ProviderError(`Unknown provider: ${settings.provider}`); } - // Build config based on provider type - const hasApiKey = settings.apiKey && settings.apiKey.length > 0; - const config: ProviderConfig = hasApiKey - ? { - model: settings.model, - apiKey: settings.apiKey, - ...(settings.endpoint ? { endpoint: settings.endpoint } : {}), - } - : { - model: settings.model, - endpoint: settings.endpoint || "http://localhost:11434/api/generate", - }; + const apiKey = requiresApiKey(settings.provider) ? await getApiKey() : ""; + const config = buildProviderConfig({ + provider: settings.provider, + model: settings.model, + endpoint: settings.endpoint, + apiKey, + timeoutMs: settings.requestTimeoutMs, + }); return new ProviderClass(config); } @@ -72,10 +74,7 @@ function getRepoRoot(): string | undefined { return folders[0].uri.fsPath; } -async function generateOnce( - provider: Provider, - diff: string, -): Promise { +async function generateOnce(provider: Provider, diff: string): Promise { const raw = await provider.generateCommitMessage(diff); return sanitizeCommitMessage(raw); } @@ -126,8 +125,9 @@ async function applyMessage( const gitExt = vscode.extensions.getExtension("vscode.git"); if (gitExt) { const api = (await gitExt.activate()).getAPI(1); - const repo = api.repositories.find((r) => r.rootUri.fsPath === cwd) - ?? api.repositories[0]; + const repo = + api.repositories.find((r) => r.rootUri.fsPath === cwd) ?? + api.repositories[0]; if (repo) { repo.inputBox.value = message; return; @@ -156,7 +156,15 @@ async function runCommand(): Promise { } const settings = readSettings(); - const provider = buildProvider(settings); + + let provider: Provider; + try { + provider = await buildProvider(settings); + } catch (err) { + const msg = err instanceof ProviderError ? err.message : String(err); + vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`); + return; + } let staged; try { @@ -235,17 +243,19 @@ async function runCommand(): Promise { () => generateOnce(provider, optimized.diff), ); } catch (err) { - const msg = err instanceof ProviderError ? err.message : String(err); + const msg = + err instanceof ProviderError ? err.message : String(err); vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`); return; } break; - case "edit": + case "edit": { const edited = await editMessage(message); if (edited) { message = edited; } break; + } case "cancel": return; } @@ -254,7 +264,15 @@ async function runCommand(): Promise { async function selectModel(): Promise { const settings = readSettings(); - const provider = buildProvider(settings); + + let provider: Provider; + try { + provider = await buildProvider(settings); + } catch (err) { + const msg = err instanceof ProviderError ? err.message : String(err); + vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`); + return; + } // Get available models from provider let models: string[] = []; @@ -264,7 +282,7 @@ async function selectModel(): Promise { // Add custom input option const items: vscode.QuickPickItem[] = []; - + if (models.length > 0) { items.push( { label: "Available Models", kind: vscode.QuickPickItemKind.Separator }, @@ -274,7 +292,10 @@ async function selectModel(): Promise { items.push( { label: "Custom Model", kind: vscode.QuickPickItemKind.Separator }, - { label: "$(pencil) Enter manually...", description: "Type a custom model name" }, + { + label: "$(pencil) Enter manually...", + description: "Type a custom model name", + }, ); const picked = await vscode.window.showQuickPick(items, { @@ -303,11 +324,70 @@ async function selectModel(): Promise { vscode.window.showInformationMessage(`Model set to: ${selectedModel}`); } +async function setApiKey(): Promise { + if (!secretStorage) return; + + const input = await vscode.window.showInputBox({ + prompt: "Enter the API key for your cloud provider (leave empty to clear).", + password: true, + ignoreFocusOut: true, + }); + if (input === undefined) return; // cancelled + + const trimmed = input.trim(); + if (trimmed.length === 0) { + await secretStorage.delete(API_KEY_SECRET); + vscode.window.showInformationMessage("Nuvo Commit: API key cleared."); + return; + } + + await secretStorage.store(API_KEY_SECRET, trimmed); + vscode.window.showInformationMessage("Nuvo Commit: API key saved securely."); +} + +/** + * One-time migration: move any plaintext `nuvoCommit.apiKey` setting into + * SecretStorage and clear it from settings.json so it cannot leak into git. + */ +async function migrateApiKey(): Promise { + if (!secretStorage) return; + + const cfg = vscode.workspace.getConfiguration("nuvoCommit"); + const legacy = cfg.get("apiKey", ""); + if (!legacy || legacy.trim().length === 0) return; + + const existing = await secretStorage.get(API_KEY_SECRET); + if (!existing) { + await secretStorage.store(API_KEY_SECRET, legacy.trim()); + } + + // Clear the plaintext setting from every scope it might be defined in. + for (const target of [ + vscode.ConfigurationTarget.Global, + vscode.ConfigurationTarget.Workspace, + vscode.ConfigurationTarget.WorkspaceFolder, + ]) { + try { + await cfg.update("apiKey", undefined, target); + } catch { + // Scope unavailable (e.g. no workspace open) — ignore. + } + } + + vscode.window.showInformationMessage( + "Nuvo Commit: your API key was moved to secure storage and removed from settings.json.", + ); +} + export function activate(context: vscode.ExtensionContext): void { + secretStorage = context.secrets; + // Register providers - ProviderRegistry.register("ollama", OllamaProvider as any); - ProviderRegistry.register("openai", OpenAIProvider as any); - ProviderRegistry.register("anthropic", AnthropicProvider as any); + ProviderRegistry.register("ollama", OllamaProvider); + ProviderRegistry.register("openai", OpenAIProvider); + ProviderRegistry.register("anthropic", AnthropicProvider); + + void migrateApiKey(); context.subscriptions.push( vscode.commands.registerCommand("nuvoCommit.generate", runCommand), @@ -318,6 +398,7 @@ export function activate(context: vscode.ExtensionContext): void { ); }), vscode.commands.registerCommand("nuvoCommit.selectModel", selectModel), + vscode.commands.registerCommand("nuvoCommit.setApiKey", setApiKey), ); } diff --git a/src/git/diff.test.ts b/src/git/diff.test.ts new file mode 100644 index 0000000..8cc9c25 --- /dev/null +++ b/src/git/diff.test.ts @@ -0,0 +1,110 @@ +import { execFile } from "child_process"; +import { getStagedDiff, getWorkingDiff, GitError } from "./diff"; + +jest.mock("child_process"); + +const mockExecFile = execFile as unknown as jest.Mock; + +const CWD = "/repo"; + +type GitCallback = ( + err: Error | null, + result?: { stdout: string; stderr: string }, +) => void; + +type GitResult = { stdout: string } | { error: Error }; + +/** Routes git invocations to canned results keyed by the joined argument list. */ +function routeGit(routes: Record): void { + mockExecFile.mockImplementation( + (_cmd: string, args: string[], _opts: unknown, cb: GitCallback) => { + const key = args.join(" "); + const result = routes[key]; + if (!result) { + cb(new Error(`unexpected git args: ${key}`)); + return; + } + if ("error" in result) { + cb(result.error); + } else { + cb(null, { stdout: result.stdout, stderr: "" }); + } + }, + ); +} + +describe("getStagedDiff", () => { + beforeEach(() => jest.clearAllMocks()); + + it("returns an empty result when nothing is staged", async () => { + routeGit({ + "diff --cached --name-only --diff-filter=ACMRTUXB": { stdout: "" }, + }); + const result = await getStagedDiff(CWD); + expect(result).toEqual({ diff: "", files: [] }); + }); + + it("does not request a diff when no files are staged", async () => { + routeGit({ + "diff --cached --name-only --diff-filter=ACMRTUXB": { stdout: "\n \n" }, + }); + await getStagedDiff(CWD); + expect(mockExecFile).toHaveBeenCalledTimes(1); + }); + + it("returns files and diff when changes are staged", async () => { + routeGit({ + "diff --cached --name-only --diff-filter=ACMRTUXB": { + stdout: "src/a.ts\nsrc/b.ts\n", + }, + "diff --cached --no-ext-diff --unified=3": { + stdout: "diff --git a/src/a.ts b/src/a.ts\n+hello", + }, + }); + const result = await getStagedDiff(CWD); + expect(result.files).toEqual(["src/a.ts", "src/b.ts"]); + expect(result.diff).toContain("+hello"); + }); + + it("throws GitError when git fails", async () => { + routeGit({ + "diff --cached --name-only --diff-filter=ACMRTUXB": { + error: new Error("fatal: not a git repository"), + }, + }); + await expect(getStagedDiff(CWD)).rejects.toThrow(GitError); + }); +}); + +describe("getWorkingDiff", () => { + beforeEach(() => jest.clearAllMocks()); + + it("returns an empty result when the working tree is clean", async () => { + routeGit({ + "diff --name-only --diff-filter=ACMRTUXB": { stdout: "" }, + }); + const result = await getWorkingDiff(CWD); + expect(result).toEqual({ diff: "", files: [] }); + }); + + it("returns files and diff for unstaged changes", async () => { + routeGit({ + "diff --name-only --diff-filter=ACMRTUXB": { stdout: "README.md\n" }, + "diff --no-ext-diff --unified=3": { + stdout: "diff --git a/README.md b/README.md\n+docs", + }, + }); + const result = await getWorkingDiff(CWD); + expect(result.files).toEqual(["README.md"]); + expect(result.diff).toContain("+docs"); + }); + + it("throws GitError when git fails", async () => { + routeGit({ + "diff --name-only --diff-filter=ACMRTUXB": { + error: new Error("fatal"), + }, + }); + await expect(getWorkingDiff(CWD)).rejects.toThrow(GitError); + }); +}); diff --git a/src/providers/AnthropicProvider.ts b/src/providers/AnthropicProvider.ts index 9960c5e..16b14ab 100644 --- a/src/providers/AnthropicProvider.ts +++ b/src/providers/AnthropicProvider.ts @@ -1,5 +1,8 @@ import { buildCommitPrompt } from "../prompt/commitPrompt"; -import { Provider, ProviderError, APIProviderConfig } from "./Provider"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "https://api.anthropic.com/v1/messages"; interface AnthropicResponse { content: Array<{ @@ -11,43 +14,41 @@ interface AnthropicResponse { }; } -export interface AnthropicOptions extends APIProviderConfig { - apiKey: string; - endpoint?: string; - model: string; -} - export class AnthropicProvider implements Provider { readonly name = "anthropic"; - private readonly defaultEndpoint = "https://api.anthropic.com/v1/messages"; - constructor(private readonly opts: AnthropicOptions) {} + constructor(private readonly opts: ProviderConfig) {} async generateCommitMessage(diff: string): Promise { const prompt = buildCommitPrompt(diff); - const endpoint = this.opts.endpoint ?? this.defaultEndpoint; + const endpoint = this.opts.endpoint || DEFAULT_ENDPOINT; let res: Response; try { - res = await fetch(endpoint, { - method: "POST", - headers: { - "Content-Type": "application/json", - "x-api-key": this.opts.apiKey, - "anthropic-version": "2023-06-01", + res = await fetchWithTimeout( + endpoint, + { + method: "POST", + headers: { + "Content-Type": "application/json", + "x-api-key": this.opts.apiKey ?? "", + "anthropic-version": "2023-06-01", + }, + body: JSON.stringify({ + model: this.opts.model, + max_tokens: 150, + messages: [ + { + role: "user", + content: prompt, + }, + ], + }), }, - body: JSON.stringify({ - model: this.opts.model, - max_tokens: 150, - messages: [ - { - role: "user", - content: prompt, - }, - ], - }), - }); + this.opts.timeoutMs, + ); } catch (err) { + if (err instanceof ProviderError) throw err; throw new ProviderError( `Cannot reach Anthropic API at ${endpoint}. Check your connection and API key.`, err, diff --git a/src/providers/OllamaProvider.ts b/src/providers/OllamaProvider.ts index def7e81..17d853d 100644 --- a/src/providers/OllamaProvider.ts +++ b/src/providers/OllamaProvider.ts @@ -1,5 +1,8 @@ import { buildCommitPrompt } from "../prompt/commitPrompt"; -import { Provider, ProviderError, LocalProviderConfig } from "./Provider"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "http://localhost:11434/api/generate"; interface OllamaGenerateResponse { response: string; @@ -18,39 +21,43 @@ interface OllamaTagsResponse { models: OllamaTag[]; } -export interface OllamaOptions extends LocalProviderConfig { - endpoint: string; - model: string; -} - export class OllamaProvider implements Provider { readonly name = "ollama"; - constructor(private readonly opts: OllamaOptions) {} + constructor(private readonly opts: ProviderConfig) {} + + private get endpoint(): string { + return this.opts.endpoint ?? DEFAULT_ENDPOINT; + } async generateCommitMessage(diff: string): Promise { const prompt = buildCommitPrompt(diff); let res: Response; try { - res = await fetch(this.opts.endpoint, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - model: this.opts.model, - prompt, - stream: false, - options: { - temperature: 0.2, - top_p: 0.9, - num_predict: 80, - stop: ["\n\n", "```", "Here", "This commit"], - }, - }), - }); + res = await fetchWithTimeout( + this.endpoint, + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + model: this.opts.model, + prompt, + stream: false, + options: { + temperature: 0.2, + top_p: 0.9, + num_predict: 80, + stop: ["\n\n", "```", "Here", "This commit"], + }, + }), + }, + this.opts.timeoutMs, + ); } catch (err) { + if (err instanceof ProviderError) throw err; throw new ProviderError( - `Cannot reach Ollama at ${this.opts.endpoint}. Is it running?`, + `Cannot reach Ollama at ${this.endpoint}. Is it running?`, err, ); } @@ -78,16 +85,20 @@ export class OllamaProvider implements Provider { async listModels(): Promise { try { - const baseUrl = this.opts.endpoint.replace("/api/generate", ""); - const res = await fetch(`${baseUrl}/api/tags`); - + const baseUrl = this.endpoint.replace("/api/generate", ""); + const res = await fetchWithTimeout( + `${baseUrl}/api/tags`, + {}, + this.opts.timeoutMs, + ); + if (!res.ok) { return []; } const data = (await res.json()) as OllamaTagsResponse; return data.models.map((m) => m.name).sort(); - } catch (err) { + } catch { return []; } } diff --git a/src/providers/OpenAIProvider.ts b/src/providers/OpenAIProvider.ts index df6a19d..d9030f8 100644 --- a/src/providers/OpenAIProvider.ts +++ b/src/providers/OpenAIProvider.ts @@ -1,5 +1,8 @@ import { buildCommitPrompt } from "../prompt/commitPrompt"; -import { Provider, ProviderError, APIProviderConfig } from "./Provider"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "https://api.openai.com/v1/chat/completions"; interface OpenAIChatResponse { choices: Array<{ @@ -12,47 +15,46 @@ interface OpenAIChatResponse { }; } -export interface OpenAIOptions extends APIProviderConfig { - apiKey: string; - endpoint?: string; - model: string; -} - export class OpenAIProvider implements Provider { readonly name = "openai"; - private readonly defaultEndpoint = "https://api.openai.com/v1/chat/completions"; - constructor(private readonly opts: OpenAIOptions) {} + constructor(private readonly opts: ProviderConfig) {} async generateCommitMessage(diff: string): Promise { const prompt = buildCommitPrompt(diff); - const endpoint = this.opts.endpoint ?? this.defaultEndpoint; + const endpoint = this.opts.endpoint || DEFAULT_ENDPOINT; let res: Response; try { - res = await fetch(endpoint, { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${this.opts.apiKey}`, + res = await fetchWithTimeout( + endpoint, + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.opts.apiKey ?? ""}`, + }, + body: JSON.stringify({ + model: this.opts.model, + messages: [ + { + role: "system", + content: + "You are a helpful assistant that generates concise git commit messages.", + }, + { + role: "user", + content: prompt, + }, + ], + temperature: 0.2, + max_tokens: 150, + }), }, - body: JSON.stringify({ - model: this.opts.model, - messages: [ - { - role: "system", - content: "You are a helpful assistant that generates concise git commit messages.", - }, - { - role: "user", - content: prompt, - }, - ], - temperature: 0.2, - max_tokens: 150, - }), - }); + this.opts.timeoutMs, + ); } catch (err) { + if (err instanceof ProviderError) throw err; throw new ProviderError( `Cannot reach OpenAI API at ${endpoint}. Check your connection and API key.`, err, @@ -86,12 +88,6 @@ export class OpenAIProvider implements Provider { async listModels(): Promise { // Common OpenAI models - static list - return [ - "gpt-4o", - "gpt-4o-mini", - "gpt-4-turbo", - "gpt-4", - "gpt-3.5-turbo", - ]; + return ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4", "gpt-3.5-turbo"]; } } diff --git a/src/providers/Provider.ts b/src/providers/Provider.ts index 594abc9..23d1bb4 100644 --- a/src/providers/Provider.ts +++ b/src/providers/Provider.ts @@ -1,18 +1,14 @@ -export interface BaseProviderConfig { +export interface ProviderConfig { + /** Model identifier passed to the provider. */ model: string; -} - -export interface LocalProviderConfig extends BaseProviderConfig { - endpoint: string; -} - -export interface APIProviderConfig extends BaseProviderConfig { - apiKey: string; + /** API endpoint URL. Required for local providers, optional override for cloud. */ endpoint?: string; + /** API key for cloud providers. Unused by local providers. */ + apiKey?: string; + /** Request timeout in milliseconds. */ + timeoutMs?: number; } -export type ProviderConfig = LocalProviderConfig | APIProviderConfig; - export interface Provider { readonly name: string; generateCommitMessage(diff: string): Promise; @@ -20,20 +16,25 @@ export interface Provider { } export class ProviderError extends Error { - constructor(message: string, public readonly cause?: unknown) { + constructor( + message: string, + public readonly cause?: unknown, + ) { super(message); this.name = "ProviderError"; } } +export type ProviderConstructor = new (config: ProviderConfig) => Provider; + export class ProviderRegistry { - private static providers = new Map Provider>(); + private static providers = new Map(); - static register(name: string, providerClass: new (config: ProviderConfig) => Provider): void { + static register(name: string, providerClass: ProviderConstructor): void { this.providers.set(name, providerClass); } - static get(name: string): (new (config: ProviderConfig) => Provider) | undefined { + static get(name: string): ProviderConstructor | undefined { return this.providers.get(name); } @@ -41,11 +42,3 @@ export class ProviderRegistry { return Array.from(this.providers.keys()); } } - -export function isLocalProvider(config: ProviderConfig): config is LocalProviderConfig { - return "endpoint" in config && !("apiKey" in config); -} - -export function isAPIProvider(config: ProviderConfig): config is APIProviderConfig { - return "apiKey" in config; -} diff --git a/src/providers/config.test.ts b/src/providers/config.test.ts new file mode 100644 index 0000000..5e445d0 --- /dev/null +++ b/src/providers/config.test.ts @@ -0,0 +1,65 @@ +import { buildProviderConfig, requiresApiKey } from "./config"; +import { ProviderError } from "./Provider"; + +describe("requiresApiKey", () => { + it("is true for cloud providers", () => { + expect(requiresApiKey("openai")).toBe(true); + expect(requiresApiKey("anthropic")).toBe(true); + }); + + it("is false for the local Ollama provider", () => { + expect(requiresApiKey("ollama")).toBe(false); + }); +}); + +describe("buildProviderConfig", () => { + const base = { + model: "qwen3:4b", + endpoint: "http://localhost:11434/api/generate", + apiKey: "", + timeoutMs: 30000, + }; + + it("builds a local config for ollama without an api key", () => { + const config = buildProviderConfig({ ...base, provider: "ollama" }); + expect(config).toEqual({ + model: "qwen3:4b", + timeoutMs: 30000, + endpoint: "http://localhost:11434/api/generate", + }); + expect(config.apiKey).toBeUndefined(); + }); + + it("includes the api key for cloud providers", () => { + const config = buildProviderConfig({ + ...base, + provider: "openai", + endpoint: "", + apiKey: "sk-test", + }); + expect(config.apiKey).toBe("sk-test"); + expect(config.endpoint).toBeUndefined(); + }); + + it("keeps a custom endpoint for cloud providers", () => { + const config = buildProviderConfig({ + ...base, + provider: "openai", + endpoint: "https://custom/v1/chat", + apiKey: "sk-test", + }); + expect(config.endpoint).toBe("https://custom/v1/chat"); + }); + + it("throws a ProviderError when a cloud provider has no api key", () => { + expect(() => + buildProviderConfig({ ...base, provider: "anthropic", apiKey: "" }), + ).toThrow(ProviderError); + }); + + it("throws when the api key is only whitespace", () => { + expect(() => + buildProviderConfig({ ...base, provider: "openai", apiKey: " " }), + ).toThrow(/requires an API key/); + }); +}); diff --git a/src/providers/config.ts b/src/providers/config.ts new file mode 100644 index 0000000..2bfba65 --- /dev/null +++ b/src/providers/config.ts @@ -0,0 +1,47 @@ +import { ProviderConfig, ProviderError } from "./Provider"; + +const CLOUD_PROVIDERS = new Set(["openai", "anthropic"]); + +/** Cloud providers require an API key; local providers (Ollama) do not. */ +export function requiresApiKey(provider: string): boolean { + return CLOUD_PROVIDERS.has(provider); +} + +export interface BuildConfigInput { + provider: string; + model: string; + endpoint: string; + apiKey: string; + timeoutMs: number; +} + +/** + * Builds a `ProviderConfig` from raw settings. The config shape is decided by + * the *selected provider* — not by whether an API key happens to be present. + * Throws a `ProviderError` if a cloud provider is selected without a key. + */ +export function buildProviderConfig(input: BuildConfigInput): ProviderConfig { + const needsKey = requiresApiKey(input.provider); + + if (needsKey && input.apiKey.trim().length === 0) { + throw new ProviderError( + `The "${input.provider}" provider requires an API key. ` + + `Run "Nuvo Commit: Set API Key" to add one.`, + ); + } + + const config: ProviderConfig = { + model: input.model, + timeoutMs: input.timeoutMs, + }; + + if (input.endpoint.trim().length > 0) { + config.endpoint = input.endpoint; + } + + if (needsKey) { + config.apiKey = input.apiKey; + } + + return config; +} diff --git a/src/providers/http.ts b/src/providers/http.ts new file mode 100644 index 0000000..d98567b --- /dev/null +++ b/src/providers/http.ts @@ -0,0 +1,31 @@ +import { ProviderError } from "./Provider"; + +export const DEFAULT_TIMEOUT_MS = 30000; + +/** + * Wraps `fetch` with an abort-based timeout. On timeout, throws a + * `ProviderError` with a clear message instead of leaving the request hanging. + */ +export async function fetchWithTimeout( + url: string, + init: RequestInit, + timeoutMs: number = DEFAULT_TIMEOUT_MS, +): Promise { + try { + return await fetch(url, { + ...init, + signal: AbortSignal.timeout(timeoutMs), + }); + } catch (err) { + if ( + err instanceof Error && + (err.name === "TimeoutError" || err.name === "AbortError") + ) { + throw new ProviderError( + `Request timed out after ${timeoutMs}ms — the provider did not respond in time.`, + err, + ); + } + throw err; + } +} diff --git a/src/providers/index.ts b/src/providers/index.ts index 52f8c9e..e047aae 100644 --- a/src/providers/index.ts +++ b/src/providers/index.ts @@ -1,4 +1,12 @@ -export { Provider, ProviderConfig, LocalProviderConfig, APIProviderConfig, ProviderError, ProviderRegistry } from "./Provider"; -export { OllamaProvider, OllamaOptions } from "./OllamaProvider"; -export { OpenAIProvider, OpenAIOptions } from "./OpenAIProvider"; -export { AnthropicProvider, AnthropicOptions } from "./AnthropicProvider"; +export { + Provider, + ProviderConfig, + ProviderConstructor, + ProviderError, + ProviderRegistry, +} from "./Provider"; +export { OllamaProvider } from "./OllamaProvider"; +export { OpenAIProvider } from "./OpenAIProvider"; +export { AnthropicProvider } from "./AnthropicProvider"; +export { buildProviderConfig, requiresApiKey } from "./config"; +export { fetchWithTimeout, DEFAULT_TIMEOUT_MS } from "./http"; diff --git a/src/utils/sanitize.test.ts b/src/utils/sanitize.test.ts index 246e3f8..0a59e68 100644 --- a/src/utils/sanitize.test.ts +++ b/src/utils/sanitize.test.ts @@ -35,7 +35,7 @@ describe('sanitizeCommitMessage', () => { it('should handle empty input', () => { expect(sanitizeCommitMessage('')).toBe('chore: update staged changes'); - expect(sanitizeCommitMessage(null as any)).toBe('chore: update staged changes'); + expect(sanitizeCommitMessage(null as unknown as string)).toBe('chore: update staged changes'); }); it('should remove bullet points', () => { diff --git a/tsconfig.json b/tsconfig.json index d162810..554fe5a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,5 +17,11 @@ "types": ["node"] }, "include": ["src/**/*"], - "exclude": ["node_modules", "out"] + "exclude": [ + "node_modules", + "out", + "**/*.test.ts", + "src/test", + "src/__mocks__" + ] }