diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..d9d872f
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,65 @@
+name: Publish VS Code Extension
+
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+
+jobs:
+ # Wait for other CI workflows to complete
+ wait-for-ci:
+ name: Wait for CI to Complete
+ runs-on: ubuntu-latest
+ steps:
+ - name: Wait for test workflow
+ 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'
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ wait-interval: 10
+
+ # Publish to VS Code Marketplace
+ publish:
+ name: Publish Extension
+ runs-on: ubuntu-latest
+ needs: wait-for-ci
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+
+ - name: Install Dependencies
+ run: npm ci
+
+ - name: Compile Extension
+ run: npm run compile
+
+ - name: Install vsce
+ run: npm install -g @vscode/vsce
+
+ - name: Publish to VS Code Marketplace
+ env:
+ VSCE_PAT: ${{ secrets.VSCE_PAT }}
+ run: vsce publish --no-yarn
+ if: env.VSCE_PAT != ''
+
+ - name: Publish to Open VSX Registry
+ env:
+ OVSX_PAT: ${{ secrets.OVSX_PAT }}
+ run: vsce publish --no-yarn --target linux-x64 --packagedExtensionPath extension.vsix
+ if: env.OVSX_PAT != ''
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..f8555db
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,29 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Run Extension",
+ "type": "extensionHost",
+ "request": "launch",
+ "args": {
+ "preLaunchTask": "${defaultBuildTask}"
+ },
+ "outFiles": [
+ "${workspaceFolder}/out/**/*.js"
+ ],
+ "preLaunchTask": "npm: compile"
+ },
+ {
+ "name": "Extension Tests",
+ "type": "extensionHost",
+ "request": "launch",
+ "name": "vscode-test",
+ "args": {
+ "preLaunchTask": "${defaultBuildTask}"
+ },
+ "outFiles": [
+ "${workspaceFolder}/out/test/**/*.js"
+ ]
+ }
+ ]
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..c26b3f2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 Nuvo Code
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/PUBLISHING.md b/PUBLISHING.md
new file mode 100644
index 0000000..a4a1ec8
--- /dev/null
+++ b/PUBLISHING.md
@@ -0,0 +1,73 @@
+# VS Code Extension Publishing Guide
+
+## 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:
+ - Settings → Secrets and variables → Actions
+ - "New repository secret" butonuna tıklayın
+ - Name: `VSCE_PAT`
+ - Value: Kopyaladığınız token
+
+### 2. Open VSX Registry Token (Opsiyonel)
+
+Eğer Open VSX Registry'ye de publish etmek isterseniz:
+
+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:
+ - Settings → Secrets and variables → Actions
+ - "New repository secret" butonuna tıklayın
+ - Name: `OVSX_PAT`
+ - Value: Kopyaladığınız token
+
+## Workflow Akışı
+
+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
+
+## Manuel Tetikleme
+
+Workflow'u manuel olarak da tetikleyebilirsiniz:
+- GitHub repository → Actions → "Publish VS Code Extension" → "Run workflow"
+
+## Version Yönetimi
+
+Her publish işleminden önce `package.json` dosyasındaki `version` alanını güncellemeyi unutmayın:
+
+```json
+{
+ "version": "0.1.1" // Minor veya patch versiyonunu artırın
+}
+```
+
+## 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
+
+### 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
diff --git a/TESTING.md b/TESTING.md
new file mode 100644
index 0000000..862a413
--- /dev/null
+++ b/TESTING.md
@@ -0,0 +1,172 @@
+# 🧪 Nuvo Commit Test Rehberi
+
+## ✅ Unit Testler (CI'da çalışıyor)
+
+```bash
+# Tüm unit testler
+npm run test:unit
+
+# Coverage raporu ile
+npm run test:coverage
+
+# Tek bir test dosyası
+npx jest src/utils/sanitize.test.ts
+```
+
+## 🚀 Extension Manuel Testi
+
+### Yöntem 1: Debug Mode (Önerilen)
+
+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ış:
+ ```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
+
+### Yöntem 2: VSIX Package
+
+```bash
+# 1. Package oluştur
+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ç
+```
+
+### Yöntem 3: Extension Development Host
+
+```bash
+# Terminal'de
+code --extensionDevelopmentPath=/Users/ozerozdas/Dev/companies/nuvocode/infra/nuvo-commit
+```
+
+## 📋 Test Senaryoları
+
+### 1. Temel Commit Mesajı
+```bash
+# Test repo oluştur
+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
+```
+
+### 3. Ollama Entegrasyonu
+```bash
+# Ollama'nın çalıştığından emin ol
+ollama serve
+
+# Model yüklü mü kontrol et
+ollama list | grep qwen3
+
+# Değilse yükle
+ollama pull qwen3:4b
+```
+
+### 4. Ayarlar Testi
+VS Code Settings (`Cmd+,`):
+```json
+{
+ "nuvoCommit.provider": "ollama",
+ "nuvoCommit.model": "qwen3:4b",
+ "nuvoCommit.ollamaEndpoint": "http://localhost:11434/api/generate",
+ "nuvoCommit.maxDiffChars": 12000,
+ "nuvoCommit.autoCommit": false
+}
+```
+
+## 🐛 Hata Ayıklama
+
+### Extension Logları
+```bash
+# VS Code Output panelini aç
+# "Extension Host" seç
+```
+
+### Ollama Hataları
+- Ollama çalışıyor mu? `ollama list`
+- Endpoint doğru mu? Varsayılan: `http://localhost:11434/api/generate`
+- Model yüklü mü? `ollama pull qwen3:4b`
+
+### Common Issues
+
+**"Cannot reach Ollama"**
+```bash
+# Ollama'yı başlat
+ollama serve
+
+# Port dinleniyor mu?
+lsof -i :11434
+```
+
+**"No staged changes"**
+```bash
+# Değişiklikleri stage et
+git add .
+```
+
+**Extension görünmüyor**
+```bash
+# VS Code'u yeniden başlat
+# Developer: Reload Window (Cmd+Shift+P)
+```
+
+## 🔍 Integration Test (Otomatik)
+
+```bash
+# VS Code instance'ında çalıştır
+npm test
+
+# Not: X server gerektirir, macOS'ta sorun olabilir
+# CI'da xvfb ile çalışır
+```
+
+## 📊 Coverage Raporu
+
+```bash
+npm run test:coverage
+
+# coverage/lcov-report/index.html dosyasını aç
+open coverage/lcov-report/index.html
+```
+
+## 🎯 Hızlı Test Checklist
+
+- [ ] Unit testler geçiyor (`npm run test:unit`)
+- [ ] Extension F5 ile açılıyor
+- [ ] Command Palette'de komut görünüyor
+- [ ] Staged değişikliklerle commit mesajı üretiliyor
+- [ ] Ollama yanıt veriyor
+- [ ] Ayarlar çalışıyor
+- [ ] Hata durumlarında kullanıcı bilgilendiriliyor
+
+## 💡 İpuçları
+
+1. **Geliştirme sırasında**: F5 ile debug mode kullan
+2. **Paylaşım öncesi**: `vsce package` ile .vsix oluştur
+3. **CI/CD**: GitHub Actions otomatik test yapıyor
+4. **Hata ayıklama**: Output panelinde "Extension Host" loglarını kontrol et
diff --git a/images/logo.png b/images/logo.png
new file mode 100644
index 0000000..51bbf11
Binary files /dev/null and b/images/logo.png differ
diff --git a/images/logo.svg b/images/logo.svg
new file mode 100644
index 0000000..500c3b2
--- /dev/null
+++ b/images/logo.svg
@@ -0,0 +1,77 @@
+
diff --git a/package.json b/package.json
index d8e4345..12d03e0 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,10 @@
{
"name": "nuvo-commit",
- "displayName": "Nuvo Commit AI",
+ "displayName": "Nuvo Commit",
"description": "Write commits, not novels. Local-first AI commit message generator.",
- "version": "0.1.0",
+ "version": "0.1.1",
"publisher": "nuvocode",
+ "icon": "images/logo.png",
"engines": {
"vscode": "^1.85.0",
"node": ">=18"
@@ -16,22 +17,46 @@
"commands": [
{
"command": "nuvoCommit.generate",
- "title": "Nuvo Commit: Generate Commit Message"
+ "title": "Nuvo Commit: Generate Commit Message",
+ "icon": "$(sparkle)"
+ },
+ {
+ "command": "nuvoCommit.settings",
+ "title": "Nuvo Commit: Settings"
}
],
+ "menus": {
+ "scm/title": [
+ {
+ "command": "nuvoCommit.generate",
+ "when": "scmProvider == git",
+ "group": "navigation"
+ }
+ ]
+ },
"configuration": {
- "title": "Nuvo Commit AI",
+ "title": "Nuvo Commit",
"properties": {
"nuvoCommit.provider": {
"type": "string",
"enum": ["ollama"],
+ "enumDescriptions": [
+ "Ollama - Local AI provider for running models locally"
+ ],
"default": "ollama",
"description": "AI provider used to generate commit messages."
},
"nuvoCommit.model": {
"type": "string",
"default": "qwen3:4b",
- "description": "Model identifier passed to the provider."
+ "examples": [
+ "qwen3:4b",
+ "llama3.2:3b",
+ "mistral:7b",
+ "codellama:7b",
+ "deepseek-coder:6.7b"
+ ],
+ "description": "Model identifier passed to the provider. Common models: qwen3:4b, llama3.2:3b, mistral:7b."
},
"nuvoCommit.ollamaEndpoint": {
"type": "string",
@@ -48,6 +73,11 @@
"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."
}
}
}
@@ -69,5 +99,10 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.0"
- }
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nuvocode/nuvo-commit.git"
+ },
+ "license": "MIT"
}
diff --git a/src/extension.ts b/src/extension.ts
index e3fa6f4..2c35c1e 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -2,7 +2,7 @@ import { execFile } from "child_process";
import { promisify } from "util";
import * as vscode from "vscode";
-import { getStagedDiff, GitError } from "./git/diff";
+import { getStagedDiff, getWorkingDiff, GitError } from "./git/diff";
import { OllamaProvider } from "./providers/OllamaProvider";
import { Provider, ProviderError } from "./providers/Provider";
import { optimizeDiff } from "./utils/optimizeDiff";
@@ -16,6 +16,7 @@ interface Settings {
ollamaEndpoint: string;
maxDiffChars: number;
autoCommit: boolean;
+ autoAccept: boolean;
}
function readSettings(): Settings {
@@ -29,6 +30,7 @@ function readSettings(): Settings {
),
maxDiffChars: cfg.get("maxDiffChars", 12000),
autoCommit: cfg.get("autoCommit", false),
+ autoAccept: cfg.get("autoAccept", true),
};
}
@@ -106,15 +108,11 @@ async function applyMessage(
?? api.repositories[0];
if (repo) {
repo.inputBox.value = message;
- vscode.window.showInformationMessage("Commit message set in SCM input.");
return;
}
}
await vscode.env.clipboard.writeText(message);
- vscode.window.showInformationMessage(
- "Commit message copied to clipboard (Git extension not available).",
- );
}
interface GitRepository {
@@ -147,56 +145,100 @@ async function runCommand(): Promise {
return;
}
+ // If no staged changes, check for working directory changes
+ let useWorkingDir = false;
if (staged.files.length === 0) {
- vscode.window.showWarningMessage(
- "Nuvo Commit: no staged changes. Stage files and try again.",
- );
- return;
+ try {
+ const working = await getWorkingDiff(cwd);
+ if (working.files.length === 0) {
+ vscode.window.showWarningMessage(
+ "Nuvo Commit: no changes detected. Stage files or add unstaged changes to proceed.",
+ );
+ return;
+ }
+ staged = working;
+ useWorkingDir = true;
+ } catch (err) {
+ const msg = err instanceof GitError ? err.message : String(err);
+ vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`);
+ return;
+ }
}
const optimized = optimizeDiff(staged.diff, settings.maxDiffChars);
if (optimized.includedFiles.length === 0) {
vscode.window.showWarningMessage(
- "Nuvo Commit: all staged files are ignored (lock/generated/binary).",
+ `Nuvo Commit: all ${useWorkingDir ? "unstaged" : "staged"} files are ignored (lock/generated/binary).`,
);
return;
}
let message: string;
- while (true) {
- try {
- message = await vscode.window.withProgress(
- {
- location: vscode.ProgressLocation.Notification,
- title: `Nuvo Commit: generating with ${settings.model}…`,
- cancellable: false,
- },
- () => generateOnce(provider, optimized.diff),
- );
- } catch (err) {
- const msg = err instanceof ProviderError ? err.message : String(err);
- vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`);
- return;
- }
+ try {
+ message = await vscode.window.withProgress(
+ {
+ location: vscode.ProgressLocation.Notification,
+ title: `Nuvo Commit: generating with ${settings.model}…`,
+ cancellable: false,
+ },
+ () => generateOnce(provider, optimized.diff),
+ );
+ } catch (err) {
+ const msg = err instanceof ProviderError ? err.message : String(err);
+ vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`);
+ return;
+ }
+
+ // Auto-accept: skip dialog and directly apply the message
+ if (settings.autoAccept) {
+ await applyMessage(message, cwd, settings.autoCommit);
+ return;
+ }
+ // Show dialog for manual approval
+ while (true) {
const action = await pickAction(message);
- if (action === "accept") break;
- if (action === "cancel") return;
- if (action === "edit") {
- const edited = await editMessage(message);
- if (!edited) return;
- message = sanitizeCommitMessage(edited);
- break;
+ switch (action) {
+ case "accept":
+ await applyMessage(message, cwd, settings.autoCommit);
+ return;
+ case "regenerate":
+ try {
+ message = await vscode.window.withProgress(
+ {
+ location: vscode.ProgressLocation.Notification,
+ title: `Nuvo Commit: regenerating with ${settings.model}…`,
+ cancellable: false,
+ },
+ () => generateOnce(provider, optimized.diff),
+ );
+ } catch (err) {
+ const msg = err instanceof ProviderError ? err.message : String(err);
+ vscode.window.showErrorMessage(`Nuvo Commit: ${msg}`);
+ return;
+ }
+ break;
+ case "edit":
+ const edited = await editMessage(message);
+ if (edited) {
+ message = edited;
+ }
+ break;
+ case "cancel":
+ return;
}
- // regenerate -> loop
}
-
- await applyMessage(message, cwd, settings.autoCommit);
}
export function activate(context: vscode.ExtensionContext): void {
context.subscriptions.push(
vscode.commands.registerCommand("nuvoCommit.generate", runCommand),
+ vscode.commands.registerCommand("nuvoCommit.settings", () => {
+ vscode.commands.executeCommand(
+ "workbench.action.openSettings",
+ "nuvoCommit",
+ );
+ }),
);
}
diff --git a/src/git/diff.ts b/src/git/diff.ts
index 172e30c..b512491 100644
--- a/src/git/diff.ts
+++ b/src/git/diff.ts
@@ -8,6 +8,11 @@ export interface StagedDiff {
files: string[];
}
+export interface WorkingDiff {
+ diff: string;
+ files: string[];
+}
+
export class GitError extends Error {
constructor(message: string, public readonly cause?: unknown) {
super(message);
@@ -48,3 +53,22 @@ export async function getStagedDiff(cwd: string): Promise {
return { diff, files };
}
+
+export async function getWorkingDiff(cwd: string): Promise {
+ const filesOut = await git(
+ ["diff", "--name-only", "--diff-filter=ACMRTUXB"],
+ cwd,
+ );
+ const files = filesOut
+ .split("\n")
+ .map((l) => l.trim())
+ .filter(Boolean);
+
+ if (files.length === 0) {
+ return { diff: "", files: [] };
+ }
+
+ const diff = await git(["diff", "--no-ext-diff", "--unified=3"], cwd);
+
+ return { diff, files };
+}