ai-changelog-generator-extension 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DEVELOPMENT.md ADDED
@@ -0,0 +1,266 @@
1
+ # VS Code Extension Development Guide
2
+
3
+ ## Project Overview
4
+
5
+ This VS Code extension provides AI-powered git commit and changelog generation by leveraging the core `@entro314labs/ai-changelog-generator` npm package.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ Extension (TypeScript) → Core Package (Node.js) → AI Providers
11
+ ```
12
+
13
+ **Key Components:**
14
+ - `src/extension.ts` - Entry point, registers commands and views
15
+ - `src/views/` - Webview providers for sidebar UI
16
+ - `src/services/ExtensionConfigurationManager.ts` - Config bridge between VS Code and core
17
+ - `src/commands/` - Command handlers
18
+ - `src/types/core.d.ts` - Type definitions for core package
19
+
20
+ ## Development Setup
21
+
22
+ ### Prerequisites
23
+ - Node.js >= 22.21.1
24
+ - pnpm >= 10.27.0
25
+ - VS Code >= 1.96.0
26
+
27
+ ### Initial Setup
28
+
29
+ ```bash
30
+ # Install dependencies
31
+ pnpm install
32
+
33
+ # Compile TypeScript
34
+ pnpm run compile
35
+
36
+ # Or watch mode for development
37
+ pnpm run watch
38
+ ```
39
+
40
+ ### Running the Extension
41
+
42
+ 1. Press `F5` in VS Code (or Run → Start Debugging)
43
+ 2. This opens a new "Extension Development Host" window
44
+ 3. Open any git repository
45
+ 4. Look for "AI Changelog" icon in the Activity Bar
46
+
47
+ ### Debugging
48
+
49
+ - **Breakpoints:** Set in TypeScript files (they map to compiled JS)
50
+ - **Console:** Use `console.log()` - output appears in Debug Console
51
+ - **Reload:** Press `Ctrl+R` (Cmd+R on Mac) in Extension Host window
52
+
53
+ ### Testing Changes
54
+
55
+ 1. Make changes to TypeScript files
56
+ 2. Save (if watch mode is running, it auto-compiles)
57
+ 3. Reload Extension Host window (Cmd/Ctrl+R)
58
+ 4. Test your changes
59
+
60
+ ## Project Structure
61
+
62
+ ```
63
+ vscode-extension/
64
+ ├── src/
65
+ │ ├── extension.ts # Main entry point
66
+ │ ├── types/core.d.ts # Type definitions for core package
67
+ │ ├── commands/
68
+ │ │ └── configureProvider.ts # API key configuration
69
+ │ ├── services/
70
+ │ │ └── ExtensionConfigurationManager.ts # Config management
71
+ │ └── views/
72
+ │ ├── CommitSidebarProvider.ts # Commit UI
73
+ │ └── ReleaseSidebarProvider.ts # Release UI
74
+ ├── .vscode/
75
+ │ ├── launch.json # Debug configuration
76
+ │ └── tasks.json # Build tasks
77
+ ├── package.json # Extension manifest
78
+ └── tsconfig.json # TypeScript config
79
+ ```
80
+
81
+ ## How It Works
82
+
83
+ ### 1. Configuration Management
84
+
85
+ The extension extends the core `ConfigurationManager` to bridge VS Code settings and secrets:
86
+
87
+ ```typescript
88
+ // VS Code Settings → Core Config
89
+ config.AI_PROVIDER = vscode.workspace.getConfiguration('aiChangelog').get('provider')
90
+
91
+ // Secrets (async) → Core Config (sync)
92
+ const apiKey = await secretStorage.get('OPENAI_API_KEY')
93
+ configManager.set('OPENAI_API_KEY', apiKey)
94
+ ```
95
+
96
+ ### 2. Commit Message Generation
97
+
98
+ ```mermaid
99
+ User clicks "Generate"
100
+ → Extension reads git status
101
+ → Core GitService analyzes changes
102
+ → Core ApplicationService calls AI
103
+ → Extension shows suggestions in QuickPick
104
+ → User selects → Extension populates SCM input
105
+ ```
106
+
107
+ ### 3. Changelog Generation
108
+
109
+ ```mermaid
110
+ User enters version
111
+ → Extension calls ApplicationService
112
+ → Core analyzes commits since last tag
113
+ → AI generates structured changelog
114
+ → Extension opens in new editor
115
+ ```
116
+
117
+ ## Key Integration Points
118
+
119
+ ### Git Extension Integration
120
+
121
+ ```typescript
122
+ const gitExtension = vscode.extensions.getExtension('vscode.git')
123
+ const git = gitExtension.exports.getAPI(1)
124
+ const repo = git.repositories[0]
125
+ repo.inputBox.value = commitMessage // Populate commit input
126
+ ```
127
+
128
+ ### Secret Storage
129
+
130
+ ```typescript
131
+ // Store API key securely
132
+ await context.secrets.store('OPENAI_API_KEY', apiKey)
133
+
134
+ // Retrieve
135
+ const apiKey = await context.secrets.get('OPENAI_API_KEY')
136
+ ```
137
+
138
+ ### Webview Communication
139
+
140
+ ```typescript
141
+ // Extension → Webview
142
+ webview.postMessage({ type: 'update', files: [...] })
143
+
144
+ // Webview → Extension
145
+ webview.onDidReceiveMessage(data => {
146
+ if (data.type === 'generate') {
147
+ generateCommitMessage()
148
+ }
149
+ })
150
+ ```
151
+
152
+ ## Building for Production
153
+
154
+ ```bash
155
+ # Compile
156
+ pnpm run compile
157
+
158
+ # Package extension
159
+ pnpm run package
160
+
161
+ # Creates: ai-changelog-generator-extension-0.1.0.vsix
162
+ ```
163
+
164
+ ## Publishing
165
+
166
+ ```bash
167
+ # First time: Get Personal Access Token from Azure DevOps
168
+ # https://dev.azure.com/[your-org]/_usersSettings/tokens
169
+
170
+ # Login
171
+ vsce login entro314labs
172
+
173
+ # Publish
174
+ pnpm run publish
175
+ ```
176
+
177
+ ## Common Tasks
178
+
179
+ ### Add New Command
180
+
181
+ 1. Define in `package.json`:
182
+ ```json
183
+ {
184
+ "command": "ai-changelog.newCommand",
185
+ "title": "My New Command"
186
+ }
187
+ ```
188
+
189
+ 2. Register in `extension.ts`:
190
+ ```typescript
191
+ context.subscriptions.push(
192
+ vscode.commands.registerCommand('ai-changelog.newCommand', () => {
193
+ // Implementation
194
+ })
195
+ )
196
+ ```
197
+
198
+ ### Add Configuration Setting
199
+
200
+ 1. Define in `package.json`:
201
+ ```json
202
+ "aiChangelog.newSetting": {
203
+ "type": "string",
204
+ "default": "value",
205
+ "description": "My setting"
206
+ }
207
+ ```
208
+
209
+ 2. Read in code:
210
+ ```typescript
211
+ const value = vscode.workspace.getConfiguration('aiChangelog').get('newSetting')
212
+ ```
213
+
214
+ ### Update Core Package
215
+
216
+ ```bash
217
+ # Get latest version
218
+ pnpm update @entro314labs/ai-changelog-generator
219
+
220
+ # Update types if API changed
221
+ # Edit: src/types/core.d.ts
222
+ ```
223
+
224
+ ## Troubleshooting
225
+
226
+ ### "Cannot find module '@entro314labs/ai-changelog-generator'"
227
+ - Run: `pnpm install`
228
+ - Verify: `node_modules/@entro314labs/ai-changelog-generator` exists
229
+
230
+ ### "Extension doesn't activate"
231
+ - Check Debug Console for errors
232
+ - Verify `activationEvents` in package.json
233
+ - Ensure workspace has a git repository
234
+
235
+ ### "API Key not found"
236
+ - Run command: "AI Changelog: Configure AI Provider"
237
+ - Keys are stored in VS Code Secret Storage
238
+ - Check: `configManager.getApiKey(provider)` returns value
239
+
240
+ ### TypeScript errors
241
+ - Run: `pnpm run compile` and check output
242
+ - Verify `src/types/core.d.ts` matches core package API
243
+ - Update `@types/vscode` if VS Code API changed
244
+
245
+ ## Best Practices
246
+
247
+ 1. **Always pre-load secrets** before calling core services (they're async)
248
+ 2. **Handle multi-root workspaces** - don't assume `workspaceFolders[0]`
249
+ 3. **Show progress notifications** for long AI operations
250
+ 4. **Catch and display errors** user-friendly (no stack traces in UI)
251
+ 5. **Use workspace configuration** for repo-specific settings
252
+ 6. **Test with large repositories** (performance matters)
253
+
254
+ ## Resources
255
+
256
+ - [VS Code Extension API](https://code.visualstudio.com/api)
257
+ - [Webview Guide](https://code.visualstudio.com/api/extension-guides/webview)
258
+ - [Core Package Docs](https://github.com/entro314-labs/AI-changelog-generator)
259
+ - [Publishing Guide](https://code.visualstudio.com/api/working-with-extensions/publishing-extension)
260
+
261
+ ## Next Steps
262
+
263
+ See the main project [README.md](./README.md) for user-facing documentation.
264
+
265
+ For issues and feature requests, visit:
266
+ https://github.com/entro314-labs/ai-changelog-generator-vscode/issues
@@ -0,0 +1,240 @@
1
+ # VS Code Extension - Implementation Summary
2
+
3
+ ## ✅ Completed Tasks
4
+
5
+ ### 1. **Module System Fixed**
6
+ - ❌ Removed `src/core/` folder (was causing import issues)
7
+ - ✅ Updated `package.json` to use npm package: `@entro314labs/ai-changelog-generator: ^3.7.1`
8
+ - ✅ All imports now reference the published package
9
+ - ✅ Type definitions in `src/types/core.d.ts` provide TypeScript support
10
+
11
+ ### 2. **Development Environment Setup**
12
+ - ✅ Created `.vscode/launch.json` for debugging extension
13
+ - ✅ Created `.vscode/tasks.json` for build automation
14
+ - ✅ Created `.vscode/settings.json` for editor configuration
15
+ - ✅ Added `.gitignore` with proper exclusions
16
+ - ✅ Dependencies installed successfully
17
+
18
+ ### 3. **Configuration Management Enhanced**
19
+ - ✅ `ExtensionConfigurationManager` extends core `ConfigurationManager`
20
+ - ✅ Async secret loading with `initialize()` method
21
+ - ✅ Bridges VS Code settings → Core config
22
+ - ✅ Secure API key storage via Secret Storage
23
+
24
+ ### 4. **Error Handling & Validation**
25
+ - ✅ Workspace validation before operations
26
+ - ✅ User-friendly error messages
27
+ - ✅ Progress notifications for long operations
28
+ - ✅ Graceful fallbacks
29
+
30
+ ### 5. **Build System**
31
+ - ✅ TypeScript compilation working (`pnpm run compile`)
32
+ - ✅ Watch mode available (`pnpm run watch`)
33
+ - ✅ Output directory: `out/`
34
+ - ✅ Source maps generated for debugging
35
+
36
+ ### 6. **Documentation**
37
+ - ✅ `README.md` - User-facing documentation
38
+ - ✅ `CHANGELOG.md` - Version history
39
+ - ✅ `DEVELOPMENT.md` - Developer guide
40
+ - ✅ `package.json` - Comprehensive metadata
41
+
42
+ ## 🏗️ Architecture Overview
43
+
44
+ ```
45
+ VS Code Extension (Standalone Repo)
46
+
47
+ ├── Uses npm package: @entro314labs/ai-changelog-generator
48
+ │ └── Imports from node_modules (not bundled)
49
+
50
+ ├── Extension Components
51
+ │ ├── CommitSidebarProvider → Shows changed files
52
+ │ ├── ReleaseSidebarProvider → Shows tags
53
+ │ ├── ExtensionConfigurationManager → Config bridge
54
+ │ └── Commands → User actions
55
+
56
+ └── VS Code Integration
57
+ ├── Secret Storage → API keys
58
+ ├── Git Extension API → SCM input
59
+ └── Webview → Rich UI
60
+ ```
61
+
62
+ ## 📦 Package Structure
63
+
64
+ ```
65
+ vscode-extension/
66
+ ├── src/
67
+ │ ├── extension.ts ✅ Entry point
68
+ │ ├── types/core.d.ts ✅ Type definitions
69
+ │ ├── commands/
70
+ │ │ └── configureProvider.ts ✅ API key setup
71
+ │ ├── services/
72
+ │ │ └── ExtensionConfigurationManager.ts ✅ Config bridge
73
+ │ └── views/
74
+ │ ├── CommitSidebarProvider.ts ✅ Commit UI (enhanced)
75
+ │ └── ReleaseSidebarProvider.ts ✅ Release UI (enhanced)
76
+
77
+ ├── .vscode/ ✅ Debug & build config
78
+ ├── out/ ✅ Compiled JS (generated)
79
+ ├── package.json ✅ Updated with npm dep
80
+ ├── tsconfig.json ✅ TypeScript config
81
+ ├── README.md ✅ User docs
82
+ ├── CHANGELOG.md ✅ Version history
83
+ └── DEVELOPMENT.md ✅ Dev guide
84
+ ```
85
+
86
+ ## 🚀 How to Run
87
+
88
+ ### For Development
89
+ ```bash
90
+ cd vscode-extension
91
+ pnpm install
92
+ pnpm run compile
93
+ # Press F5 in VS Code to launch Extension Host
94
+ ```
95
+
96
+ ### For Users (Future)
97
+ ```bash
98
+ # From VS Code Marketplace
99
+ code --install-extension entro314labs.ai-changelog-generator-extension
100
+ ```
101
+
102
+ ## 🎯 Current Capabilities
103
+
104
+ ### Commit Assistant (Sidebar)
105
+ - ✅ Lists changed files (staged/unstaged)
106
+ - ✅ Shows file status (M, A, D)
107
+ - ✅ Displays categories and importance
108
+ - ✅ "Generate Commit Message" button
109
+ - ✅ AI suggestions in QuickPick
110
+ - ✅ Populates Git SCM input box
111
+
112
+ ### Release Manager (Sidebar)
113
+ - ✅ Lists recent git tags
114
+ - ✅ "Draft New Release" button
115
+ - ✅ Version input prompt
116
+ - ✅ AI generates changelog
117
+ - ✅ Opens in new editor
118
+
119
+ ### Commands
120
+ - ✅ `AI Changelog: Generate AI Commit`
121
+ - ✅ `AI Changelog: Generate Release`
122
+ - ✅ `AI Changelog: Configure AI Provider`
123
+
124
+ ### Configuration
125
+ - ✅ `aiChangelog.provider` - Select AI provider
126
+ - ✅ `aiChangelog.model` - Override model
127
+ - ✅ `aiChangelog.temperature` - Control creativity
128
+
129
+ ## 🔧 Integration Points
130
+
131
+ ### Core Package Integration
132
+ ```typescript
133
+ // Imports from npm package
134
+ import { GitManager } from '@entro314labs/ai-changelog-generator/src/domains/git/git-manager.js'
135
+ import { ApplicationService } from '@entro314labs/ai-changelog-generator/src/application/services/application.service.js'
136
+ ```
137
+
138
+ ### VS Code APIs Used
139
+ - `vscode.window.registerWebviewViewProvider` - Sidebar panels
140
+ - `vscode.commands.registerCommand` - Commands
141
+ - `vscode.workspace.getConfiguration` - Settings
142
+ - `vscode.SecretStorage` - API keys
143
+ - `vscode.extensions.getExtension('vscode.git')` - Git integration
144
+
145
+ ## 🐛 Known Limitations
146
+
147
+ 1. **Multi-root workspaces** - Currently assumes single workspace folder
148
+ 2. **Large repositories** - No pagination for file lists yet
149
+ 3. **Diff preview** - Not implemented in UI (planned)
150
+ 4. **Staging/unstaging** - View-only, no file operations yet
151
+ 5. **Offline mode** - Requires active AI provider
152
+
153
+ ## 📋 Next Steps (Future Enhancements)
154
+
155
+ ### Phase 1 - Core UX (Priority)
156
+ - [ ] Add diff preview in webview
157
+ - [ ] File tree view (grouped by folder)
158
+ - [ ] Stage/unstage operations from UI
159
+ - [ ] Commit message validation (conventional commits)
160
+ - [ ] Multi-root workspace support
161
+
162
+ ### Phase 2 - Smart Features
163
+ - [ ] AI suggests file groupings
164
+ - [ ] Breaking change detection
165
+ - [ ] Semantic versioning suggestions
166
+ - [ ] Commit templates
167
+ - [ ] Recent commits history
168
+
169
+ ### Phase 3 - Advanced
170
+ - [ ] Stacked changes visualization
171
+ - [ ] PR description generation
172
+ - [ ] Team conventions learning
173
+ - [ ] GitHub/GitLab integration
174
+ - [ ] Telemetry & analytics
175
+
176
+ ### Phase 4 - Polish
177
+ - [ ] Comprehensive testing (unit + E2E)
178
+ - [ ] Performance optimization
179
+ - [ ] Better error recovery
180
+ - [ ] Onboarding tutorial
181
+ - [ ] Keyboard shortcuts
182
+
183
+ ## 🎨 UI Improvements Needed
184
+
185
+ Current UI is basic HTML. Consider upgrading to:
186
+ - **VS Code Webview UI Toolkit** - Native look and feel
187
+ - **React/Preact** - Component-based UI
188
+ - **File tree component** - Better visualization
189
+ - **Inline diff viewer** - See changes without leaving sidebar
190
+
191
+ ## 📊 Testing Strategy
192
+
193
+ ### Manual Testing
194
+ 1. ✅ Build compiles without errors
195
+ 2. ✅ Extension activates in host window
196
+ 3. ✅ Commands registered and callable
197
+ 4. ⏳ Commit generation works (requires API key)
198
+ 5. ⏳ Release generation works (requires API key)
199
+
200
+ ### Automated Testing (TODO)
201
+ - [ ] Unit tests for ConfigurationManager
202
+ - [ ] Integration tests for GitService
203
+ - [ ] E2E tests for full workflow
204
+ - [ ] Mock AI responses
205
+
206
+ ## 🚢 Publishing Checklist
207
+
208
+ Before publishing to marketplace:
209
+
210
+ - [ ] Test with all supported AI providers
211
+ - [ ] Verify icon/logo (resources/icon.svg)
212
+ - [ ] Update version in package.json
213
+ - [ ] Complete CHANGELOG.md
214
+ - [ ] Add screenshots to README
215
+ - [ ] Create demo GIF
216
+ - [ ] Test on Windows/Linux/Mac
217
+ - [ ] Get publisher account (Azure DevOps)
218
+ - [ ] Package: `vsce package`
219
+ - [ ] Publish: `vsce publish`
220
+
221
+ ## 🔗 Related Repositories
222
+
223
+ - **Core Package**: https://github.com/entro314-labs/AI-changelog-generator
224
+ - **Extension Repo**: https://github.com/entro314-labs/ai-changelog-generator-vscode (to be created)
225
+
226
+ ## 📝 Migration Notes
227
+
228
+ When moving to separate repo:
229
+
230
+ 1. Copy entire `vscode-extension/` folder
231
+ 2. Initialize git: `git init`
232
+ 3. Create GitHub repo
233
+ 4. Update package.json URLs to new repo
234
+ 5. Publish to marketplace
235
+ 6. Update core package README to link to extension
236
+
237
+ ---
238
+
239
+ **Status**: ✅ **MVP Ready for Testing**
240
+ **Next Action**: Test with real API keys and iterate on UX