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/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..b00bfe1 --- /dev/null +++ b/README.md @@ -0,0 +1,150 @@ +# Nuvo Commit + +> 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 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, timeouts, and behavior +- 📋 **Auto Model Detection**: Automatically list available models from your provider + +## Requirements + +- VS Code 1.85.0 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 the + [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nuvocode.nuvo-commit). +2. Choose your provider: + - **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 .`). 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 + +1. Run **Nuvo Commit: Select Model**. +2. Pick from the discovered models, or choose "Enter manually…". +3. The selection is saved to your settings. + +> **Tip:** For Ollama, the model list is fetched automatically from your local instance. + +### Setting an API key (cloud providers) + +API keys are stored securely — **not** in `settings.json`. + +1. Run **Nuvo Commit: Set API Key**. +2. Paste your key into the masked input (leave it empty to clear a stored key). + +If you previously set `nuvoCommit.apiKey` in settings, it is migrated into secure +storage automatically and removed from `settings.json` on first activation. + +## Configuration + +Configure in VS Code Settings (`Cmd+,`) under **Nuvo Commit**: + +| 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. | + +> The deprecated `nuvoCommit.apiKey` setting is kept only for one-time migration — +> use the **Set API Key** command instead. + +### Example configurations + +**Ollama (local):** +```json +{ + "nuvoCommit.provider": "ollama", + "nuvoCommit.endpoint": "http://localhost:11434/api/generate", + "nuvoCommit.model": "qwen3:4b" +} +``` + +**OpenAI (cloud):** set the key via **Nuvo Commit: Set API Key**, then: +```json +{ + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "", + "nuvoCommit.model": "gpt-4o-mini" +} +``` + +**Anthropic (cloud):** set the key via **Nuvo Commit: Set API Key**, then: +```json +{ + "nuvoCommit.provider": "anthropic", + "nuvoCommit.endpoint": "", + "nuvoCommit.model": "claude-3-5-sonnet-20241022" +} +``` + +**Custom OpenAI-compatible endpoint:** +```json +{ + "nuvoCommit.provider": "openai", + "nuvoCommit.endpoint": "http://localhost:1234/v1/chat/completions", + "nuvoCommit.model": "local-model" +} +``` + +## Development + +```bash +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 launch the extension in a new Extension Development Host window. + +## Testing + +See [TESTING.md](./TESTING.md) for detailed testing instructions. + +## Publishing + +See [PUBLISHING.md](./PUBLISHING.md) for the release and publishing guide. + +## Changelog + +See [CHANGELOG.md](./CHANGELOG.md). + +## 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ı 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 12d03e0..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": { @@ -10,7 +10,11 @@ "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"], + "galleryBanner": { + "color": "#1e1e2e", + "theme": "dark" + }, "activationEvents": [], "main": "./out/extension.js", "contributes": { @@ -23,6 +27,15 @@ { "command": "nuvoCommit.settings", "title": "Nuvo Commit: Settings" + }, + { + "command": "nuvoCommit.selectModel", + "title": "Nuvo Commit: Select Model", + "icon": "$(symbol-boolean)" + }, + { + "command": "nuvoCommit.setApiKey", + "title": "Nuvo Commit: Set API Key" } ], "menus": { @@ -37,55 +50,86 @@ "configuration": { "title": "Nuvo Commit", "properties": { + "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": { "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", + "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.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": 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": 8, "examples": [ "qwen3:4b", "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." } } } }, "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" @@ -94,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" }, @@ -104,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 2c35c1e..9c13636 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,45 +3,69 @@ import { promisify } from "util"; import * as vscode from "vscode"; import { getStagedDiff, getWorkingDiff, GitError } from "./git/diff"; +import { Provider, 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 { 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: "ollama"; + provider: string; model: string; - ollamaEndpoint: string; + endpoint: string; maxDiffChars: number; autoCommit: boolean; autoAccept: boolean; + requestTimeoutMs: number; } 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", ), 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 { - switch (settings.provider) { - case "ollama": - return new OllamaProvider({ - endpoint: settings.ollamaEndpoint, - model: settings.model, - }); +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}`); } + + 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); } function getRepoRoot(): string | undefined { @@ -50,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); } @@ -104,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; @@ -134,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 { @@ -213,24 +243,152 @@ 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; } } } +async function selectModel(): Promise { + const settings = readSettings(); + + 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[] = []; + 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}`); +} + +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); + ProviderRegistry.register("openai", OpenAIProvider); + ProviderRegistry.register("anthropic", AnthropicProvider); + + void migrateApiKey(); + context.subscriptions.push( vscode.commands.registerCommand("nuvoCommit.generate", runCommand), vscode.commands.registerCommand("nuvoCommit.settings", () => { @@ -239,6 +397,8 @@ export function activate(context: vscode.ExtensionContext): void { "nuvoCommit", ); }), + 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.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..16b14ab --- /dev/null +++ b/src/providers/AnthropicProvider.ts @@ -0,0 +1,93 @@ +import { buildCommitPrompt } from "../prompt/commitPrompt"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "https://api.anthropic.com/v1/messages"; + +interface AnthropicResponse { + content: Array<{ + text: string; + type: string; + }>; + error?: { + message: string; + }; +} + +export class AnthropicProvider implements Provider { + readonly name = "anthropic"; + + constructor(private readonly opts: ProviderConfig) {} + + async generateCommitMessage(diff: string): Promise { + const prompt = buildCommitPrompt(diff); + const endpoint = this.opts.endpoint || DEFAULT_ENDPOINT; + + let res: Response; + try { + 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, + }, + ], + }), + }, + 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, + ); + } + + 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..17d853d 100644 --- a/src/providers/OllamaProvider.ts +++ b/src/providers/OllamaProvider.ts @@ -1,5 +1,8 @@ import { buildCommitPrompt } from "../prompt/commitPrompt"; -import { Provider, ProviderError } from "./Provider"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "http://localhost:11434/api/generate"; interface OllamaGenerateResponse { response: string; @@ -7,39 +10,54 @@ interface OllamaGenerateResponse { error?: string; } -export interface OllamaOptions { - endpoint: string; +interface OllamaTag { + name: string; model: string; + modified_at: string; + size: number; +} + +interface OllamaTagsResponse { + models: OllamaTag[]; } 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, ); } @@ -64,6 +82,26 @@ export class OllamaProvider implements Provider { return stripThinking(data.response ?? ""); } + + async listModels(): Promise { + try { + 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 { + 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..d9030f8 --- /dev/null +++ b/src/providers/OpenAIProvider.ts @@ -0,0 +1,93 @@ +import { buildCommitPrompt } from "../prompt/commitPrompt"; +import { Provider, ProviderConfig, ProviderError } from "./Provider"; +import { fetchWithTimeout } from "./http"; + +const DEFAULT_ENDPOINT = "https://api.openai.com/v1/chat/completions"; + +interface OpenAIChatResponse { + choices: Array<{ + message: { + content: string; + }; + }>; + error?: { + message: string; + }; +} + +export class OpenAIProvider implements Provider { + readonly name = "openai"; + + constructor(private readonly opts: ProviderConfig) {} + + async generateCommitMessage(diff: string): Promise { + const prompt = buildCommitPrompt(diff); + const endpoint = this.opts.endpoint || DEFAULT_ENDPOINT; + + let res: Response; + try { + 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, + }), + }, + 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, + ); + } + + 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..23d1bb4 100644 --- a/src/providers/Provider.ts +++ b/src/providers/Provider.ts @@ -1,16 +1,44 @@ export interface ProviderConfig { + /** Model identifier passed to the provider. */ model: 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 interface Provider { readonly name: string; generateCommitMessage(diff: string): Promise; + listModels?(): Promise; } 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(); + + static register(name: string, providerClass: ProviderConstructor): void { + this.providers.set(name, providerClass); + } + + static get(name: string): ProviderConstructor | undefined { + return this.providers.get(name); + } + + static list(): string[] { + return Array.from(this.providers.keys()); + } +} 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 new file mode 100644 index 0000000..e047aae --- /dev/null +++ b/src/providers/index.ts @@ -0,0 +1,12 @@ +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 10dd4c4..554fe5a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,8 +13,15 @@ "noFallthroughCasesInSwitch": true, "esModuleInterop": true, "skipLibCheck": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "types": ["node"] }, "include": ["src/**/*"], - "exclude": ["node_modules", "out"] + "exclude": [ + "node_modules", + "out", + "**/*.test.ts", + "src/test", + "src/__mocks__" + ] }