@grunnverk/kilde 0.1.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.
Files changed (75) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +31 -0
  3. package/.github/pull_request_template.md +48 -0
  4. package/.github/workflows/deploy-docs.yml +59 -0
  5. package/.github/workflows/npm-publish.yml +48 -0
  6. package/.github/workflows/test.yml +48 -0
  7. package/CHANGELOG.md +92 -0
  8. package/CONTRIBUTING.md +438 -0
  9. package/LICENSE +190 -0
  10. package/PROJECT_SUMMARY.md +318 -0
  11. package/README.md +444 -0
  12. package/RELEASE_CHECKLIST.md +182 -0
  13. package/dist/application.js +166 -0
  14. package/dist/application.js.map +1 -0
  15. package/dist/commands/release.js +326 -0
  16. package/dist/commands/release.js.map +1 -0
  17. package/dist/constants.js +122 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/logging.js +176 -0
  20. package/dist/logging.js.map +1 -0
  21. package/dist/main.js +24 -0
  22. package/dist/main.js.map +1 -0
  23. package/dist/mcp-server.js +17467 -0
  24. package/dist/mcp-server.js.map +7 -0
  25. package/dist/utils/config.js +89 -0
  26. package/dist/utils/config.js.map +1 -0
  27. package/docs/AI_GUIDE.md +618 -0
  28. package/eslint.config.mjs +85 -0
  29. package/guide/architecture.md +776 -0
  30. package/guide/commands.md +580 -0
  31. package/guide/configuration.md +779 -0
  32. package/guide/mcp-integration.md +708 -0
  33. package/guide/overview.md +225 -0
  34. package/package.json +91 -0
  35. package/scripts/build-mcp.js +115 -0
  36. package/scripts/test-mcp-compliance.js +254 -0
  37. package/src/application.ts +246 -0
  38. package/src/commands/release.ts +450 -0
  39. package/src/constants.ts +162 -0
  40. package/src/logging.ts +210 -0
  41. package/src/main.ts +25 -0
  42. package/src/mcp/prompts/index.ts +98 -0
  43. package/src/mcp/resources.ts +121 -0
  44. package/src/mcp/server.ts +195 -0
  45. package/src/mcp/tools.ts +219 -0
  46. package/src/types.ts +131 -0
  47. package/src/utils/config.ts +181 -0
  48. package/tests/application.test.ts +114 -0
  49. package/tests/commands/commit.test.ts +248 -0
  50. package/tests/commands/release.test.ts +325 -0
  51. package/tests/constants.test.ts +118 -0
  52. package/tests/logging.test.ts +142 -0
  53. package/tests/mcp/prompts/index.test.ts +202 -0
  54. package/tests/mcp/resources.test.ts +166 -0
  55. package/tests/mcp/tools.test.ts +211 -0
  56. package/tests/utils/config.test.ts +212 -0
  57. package/tsconfig.json +32 -0
  58. package/vite.config.ts +107 -0
  59. package/vitest.config.ts +40 -0
  60. package/website/index.html +14 -0
  61. package/website/src/App.css +142 -0
  62. package/website/src/App.tsx +34 -0
  63. package/website/src/components/Commands.tsx +182 -0
  64. package/website/src/components/Configuration.tsx +214 -0
  65. package/website/src/components/Examples.tsx +234 -0
  66. package/website/src/components/Footer.css +99 -0
  67. package/website/src/components/Footer.tsx +93 -0
  68. package/website/src/components/GettingStarted.tsx +94 -0
  69. package/website/src/components/Hero.css +95 -0
  70. package/website/src/components/Hero.tsx +50 -0
  71. package/website/src/components/Navigation.css +102 -0
  72. package/website/src/components/Navigation.tsx +57 -0
  73. package/website/src/index.css +36 -0
  74. package/website/src/main.tsx +10 -0
  75. package/website/vite.config.ts +12 -0
@@ -0,0 +1,708 @@
1
+ # MCP Integration Guide
2
+
3
+ Complete guide to integrating Kilde with AI assistants via the Model Context Protocol (MCP).
4
+
5
+ ## What is MCP?
6
+
7
+ The [Model Context Protocol](https://modelcontextprotocol.io/) is an open protocol that enables AI assistants to securely access external tools, data sources, and services. Kilde implements an MCP server that exposes its git automation capabilities to AI assistants like Claude.
8
+
9
+ ### Benefits
10
+
11
+ - **Natural Language Git Operations**: Execute git tasks through conversation
12
+ - **Context-Aware**: AI has access to repository status and configuration
13
+ - **Guided Workflows**: Predefined prompts for common tasks
14
+ - **Safe Execution**: Review all operations before they execute
15
+ - **Universal**: Works with any MCP-compatible AI assistant
16
+
17
+ ## Supported Clients
18
+
19
+ ### Claude Desktop
20
+
21
+ Official desktop app for macOS and Windows with built-in MCP support.
22
+
23
+ **Download**: [claude.ai/download](https://claude.ai/download)
24
+
25
+ ### Claude Code
26
+
27
+ VSCode extension with MCP integration.
28
+
29
+ **Install**: Search "Claude Code" in VSCode extensions
30
+
31
+ ### Custom Clients
32
+
33
+ Any application using the MCP SDK can connect to Kilde's server.
34
+
35
+ ## Installation
36
+
37
+ ### Prerequisites
38
+
39
+ 1. **Node.js 24+**: Required for Kilde
40
+ ```bash
41
+ node --version # Should be 24.x or higher
42
+ ```
43
+
44
+ 2. **Kilde**: Install globally
45
+ ```bash
46
+ npm install -g @grunnverk/kilde
47
+ ```
48
+
49
+ 3. **AI Assistant**: Install Claude Desktop or Claude Code
50
+
51
+ 4. **API Keys**: OpenAI or Anthropic API key
52
+ ```bash
53
+ export OPENAI_API_KEY=sk-...
54
+ # or
55
+ export ANTHROPIC_API_KEY=sk-ant-...
56
+ ```
57
+
58
+ ## Setup: Claude Desktop
59
+
60
+ ### 1. Locate Configuration File
61
+
62
+ **macOS**:
63
+ ```bash
64
+ ~/Library/Application Support/Claude/claude_desktop_config.json
65
+ ```
66
+
67
+ **Windows**:
68
+ ```
69
+ %APPDATA%\Claude\claude_desktop_config.json
70
+ ```
71
+
72
+ ### 2. Add Kilde Server
73
+
74
+ Edit the configuration file:
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "kilde": {
80
+ "command": "kilde-mcp",
81
+ "args": [],
82
+ "env": {
83
+ "OPENAI_API_KEY": "sk-..."
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ **With custom config**:
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "kilde": {
95
+ "command": "kilde-mcp",
96
+ "args": ["--config", "/path/to/.kilde/config.yaml"],
97
+ "env": {
98
+ "OPENAI_API_KEY": "sk-...",
99
+ "KILDE_LOG_LEVEL": "debug"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ ### 3. Restart Claude Desktop
107
+
108
+ Quit and restart Claude Desktop for changes to take effect.
109
+
110
+ ### 4. Verify Connection
111
+
112
+ In Claude Desktop, start a new conversation:
113
+
114
+ ```
115
+ You: What Kilde tools are available?
116
+
117
+ Claude: I have access to the following Kilde tools:
118
+ - kilde_commit: Generate AI-powered commit messages
119
+ - kilde_release: Generate release notes from git history
120
+ ```
121
+
122
+ ## Setup: Claude Code
123
+
124
+ ### 1. Install Extension
125
+
126
+ In VSCode:
127
+ 1. Open Extensions (Cmd+Shift+X / Ctrl+Shift+X)
128
+ 2. Search "Claude Code"
129
+ 3. Click Install
130
+
131
+ ### 2. Configure MCP Server
132
+
133
+ Open VSCode settings (`Cmd+,` / `Ctrl+,`):
134
+
135
+ 1. Search "Claude Code MCP"
136
+ 2. Edit `settings.json`:
137
+
138
+ ```json
139
+ {
140
+ "claudeCode.mcpServers": {
141
+ "kilde": {
142
+ "command": "kilde-mcp",
143
+ "args": [],
144
+ "env": {
145
+ "OPENAI_API_KEY": "sk-..."
146
+ }
147
+ }
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### 3. Reload Window
153
+
154
+ Reload VSCode window (Cmd+R / Ctrl+R) or restart VSCode.
155
+
156
+ ### 4. Verify Connection
157
+
158
+ Open Claude Code panel and type:
159
+
160
+ ```
161
+ What Kilde tools are available?
162
+ ```
163
+
164
+ ## MCP Components
165
+
166
+ Kilde exposes three types of MCP components:
167
+
168
+ ### Tools
169
+
170
+ Executable operations that perform actions.
171
+
172
+ #### `kilde_commit`
173
+
174
+ Generate and create git commits with AI-powered messages.
175
+
176
+ **Parameters**:
177
+ ```json
178
+ {
179
+ "directory": "/path/to/repo", // Optional: working directory
180
+ "add": true, // Optional: stage changes
181
+ "sendit": false, // Optional: auto-commit
182
+ "context": "Fix login bug", // Optional: additional context
183
+ "contextFiles": ["BUGS.md"], // Optional: context files
184
+ "interactive": true, // Optional: review mode
185
+ "amend": false, // Optional: amend last commit
186
+ "push": false, // Optional: push after commit
187
+ "dryRun": true // Optional: preview only
188
+ }
189
+ ```
190
+
191
+ **Usage in Claude**:
192
+ ```
193
+ Generate a commit message for the staged changes in the current directory
194
+ ```
195
+
196
+ ```
197
+ Create a commit for all changes with context: "Implement user authentication"
198
+ ```
199
+
200
+ #### `kilde_release`
201
+
202
+ Generate release notes from git history.
203
+
204
+ **Parameters**:
205
+ ```json
206
+ {
207
+ "directory": "/path/to/repo", // Optional: working directory
208
+ "version": "1.0.0", // Optional: version number
209
+ "from": "v0.9.0", // Optional: start reference
210
+ "to": "HEAD", // Optional: end reference
211
+ "output": "RELEASE.md", // Optional: output file
212
+ "focus": "security,performance", // Optional: focus areas
213
+ "context": "Major rewrite", // Optional: additional context
214
+ "interactive": true, // Optional: review mode
215
+ "dryRun": true // Optional: preview only
216
+ }
217
+ ```
218
+
219
+ **Usage in Claude**:
220
+ ```
221
+ Generate release notes for version 1.0.0
222
+ ```
223
+
224
+ ```
225
+ Create release notes from v0.9.0 to HEAD focusing on security changes
226
+ ```
227
+
228
+ ### Resources
229
+
230
+ Read-only data sources that provide context.
231
+
232
+ #### `kilde://config`
233
+
234
+ Current Kilde configuration.
235
+
236
+ **Content**: JSON representation of merged configuration.
237
+
238
+ **Usage**:
239
+ ```
240
+ What is my current Kilde configuration?
241
+ ```
242
+
243
+ **Example Response**:
244
+ ```json
245
+ {
246
+ "commit": {
247
+ "type": "conventional",
248
+ "autoStage": false,
249
+ "ai": {
250
+ "model": "gpt-4",
251
+ "temperature": 0.7
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ #### `kilde://status`
258
+
259
+ Git repository status.
260
+
261
+ **Content**: Current branch, staged/unstaged changes, recent commits.
262
+
263
+ **Usage**:
264
+ ```
265
+ What is the git status?
266
+ ```
267
+
268
+ **Example Response**:
269
+ ```
270
+ Current branch: main
271
+ Staged changes: 3 files
272
+ Unstaged changes: 1 file
273
+ Recent commits:
274
+ - abc123 feat(auth): add OAuth2
275
+ - def456 fix(ui): resolve button alignment
276
+ ```
277
+
278
+ #### `kilde://workspace`
279
+
280
+ Workspace information.
281
+
282
+ **Content**: Repository path, config location, available commands.
283
+
284
+ **Usage**:
285
+ ```
286
+ Show me the Kilde workspace information
287
+ ```
288
+
289
+ ### Prompts
290
+
291
+ Predefined workflows for common tasks.
292
+
293
+ #### `commit-workflow`
294
+
295
+ Guided workflow for creating commits.
296
+
297
+ **Parameters**:
298
+ - `commitType`: Type of commit (feat, fix, docs, etc.)
299
+ - `scope`: Optional scope
300
+
301
+ **Usage**:
302
+ ```
303
+ Help me create a commit using the commit workflow
304
+ ```
305
+
306
+ **Workflow**:
307
+ 1. Analyze staged changes
308
+ 2. Suggest commit type and scope
309
+ 3. Generate message
310
+ 4. Review and confirm
311
+ 5. Execute commit
312
+
313
+ #### `release-workflow`
314
+
315
+ Guided workflow for creating releases.
316
+
317
+ **Parameters**:
318
+ - `version`: Version number
319
+ - `releaseType`: major, minor, patch
320
+
321
+ **Usage**:
322
+ ```
323
+ Help me create a release using the release workflow
324
+ ```
325
+
326
+ **Workflow**:
327
+ 1. Determine version number
328
+ 2. Generate release notes
329
+ 3. Review and edit
330
+ 4. Tag release
331
+ 5. Push to remote
332
+
333
+ ## Usage Examples
334
+
335
+ ### Basic Commit
336
+
337
+ ```
338
+ You: Create a commit for my staged changes
339
+
340
+ Claude: I'll generate a commit message for your staged changes.
341
+
342
+ [Uses kilde_commit tool]
343
+
344
+ Generated commit message:
345
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
346
+ feat(auth): add OAuth2 authentication
347
+
348
+ Implement OAuth2 flow with support for
349
+ Google and GitHub providers.
350
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
351
+
352
+ Would you like me to create this commit?
353
+ ```
354
+
355
+ ### Commit with Context
356
+
357
+ ```
358
+ You: Create a commit for all changes with context: "Fixes bug reported in issue #123"
359
+
360
+ Claude: I'll stage all changes and generate a commit message with that context.
361
+
362
+ [Uses kilde_commit with add=true and context]
363
+
364
+ Generated commit message:
365
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
366
+ fix(auth): resolve session timeout issue
367
+
368
+ Fix session timeout bug reported in #123.
369
+ Update session refresh logic to properly
370
+ handle edge cases.
371
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
372
+
373
+ Shall I create this commit?
374
+ ```
375
+
376
+ ### Release Notes
377
+
378
+ ```
379
+ You: Generate release notes for version 2.0.0
380
+
381
+ Claude: I'll generate release notes from the last tag to HEAD.
382
+
383
+ [Uses kilde_release tool]
384
+
385
+ Release Notes for v2.0.0:
386
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
387
+
388
+ ## Features
389
+ - OAuth2 authentication
390
+ - User profile management
391
+ - Role-based access control
392
+
393
+ ## Bug Fixes
394
+ - Session timeout handling
395
+ - Memory leak in auth service
396
+
397
+ ## Breaking Changes
398
+ - API endpoints now require authentication
399
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
400
+
401
+ Would you like me to save these to a file?
402
+ ```
403
+
404
+ ### Check Configuration
405
+
406
+ ```
407
+ You: What's my Kilde configuration?
408
+
409
+ Claude: [Accesses kilde://config resource]
410
+
411
+ Your Kilde configuration:
412
+ - Commit type: conventional
413
+ - Auto-stage: false
414
+ - AI model: gpt-4
415
+ - Temperature: 0.7
416
+ - Max tokens: 500
417
+ ```
418
+
419
+ ### Guided Commit Workflow
420
+
421
+ ```
422
+ You: Help me create a commit using the commit workflow
423
+
424
+ Claude: [Uses commit-workflow prompt]
425
+
426
+ I'll guide you through creating a commit. First, let me analyze your staged changes.
427
+
428
+ [Analyzes changes]
429
+
430
+ Based on your changes, I suggest:
431
+ - Type: feat (new feature)
432
+ - Scope: auth
433
+
434
+ Would you like me to proceed with this suggestion?
435
+
436
+ You: Yes
437
+
438
+ Claude: [Generates and creates commit]
439
+
440
+ Commit created successfully!
441
+ ```
442
+
443
+ ## Configuration
444
+
445
+ Configure MCP server behavior in `.kilde/config.yaml`:
446
+
447
+ ```yaml
448
+ mcp:
449
+ # Server identification
450
+ name: kilde
451
+ version: 0.1.0
452
+
453
+ # Tools to expose
454
+ tools:
455
+ - kilde_commit
456
+ - kilde_release
457
+
458
+ # Resources to expose
459
+ resources:
460
+ - config
461
+ - status
462
+ - workspace
463
+
464
+ # Prompts to expose
465
+ prompts:
466
+ - commit-workflow
467
+ - release-workflow
468
+
469
+ # Tool defaults
470
+ defaults:
471
+ commit:
472
+ interactive: true # Always review commits
473
+ dryRun: false
474
+ release:
475
+ interactive: true
476
+ dryRun: false
477
+ ```
478
+
479
+ ## Security Considerations
480
+
481
+ ### API Keys
482
+
483
+ Store API keys securely:
484
+
485
+ **Environment variables** (recommended):
486
+ ```bash
487
+ export OPENAI_API_KEY=sk-...
488
+ ```
489
+
490
+ **MCP config** (less secure):
491
+ ```json
492
+ {
493
+ "mcpServers": {
494
+ "kilde": {
495
+ "env": {
496
+ "OPENAI_API_KEY": "sk-..."
497
+ }
498
+ }
499
+ }
500
+ }
501
+ ```
502
+
503
+ **Never** commit API keys to git.
504
+
505
+ ### Command Execution
506
+
507
+ Kilde executes git commands on your behalf. To stay safe:
508
+
509
+ 1. **Review operations**: Use interactive mode by default
510
+ 2. **Use dry-run**: Preview changes before executing
511
+ 3. **Check workspace**: Verify you're in the correct repository
512
+ 4. **Limit permissions**: Don't run with elevated privileges
513
+
514
+ ### Network Access
515
+
516
+ Kilde makes API calls to:
517
+ - OpenAI (if using GPT models)
518
+ - Anthropic (if using Claude models)
519
+
520
+ Data sent to APIs:
521
+ - Git diffs (for commits)
522
+ - Commit history (for releases)
523
+ - Context you provide
524
+
525
+ Data **not** sent:
526
+ - Entire codebase
527
+ - Credentials or secrets
528
+ - Files not related to the operation
529
+
530
+ ## Troubleshooting
531
+
532
+ ### Server Not Connecting
533
+
534
+ **Check installation**:
535
+ ```bash
536
+ which kilde-mcp
537
+ kilde-mcp --version
538
+ ```
539
+
540
+ **Check MCP config**:
541
+ ```bash
542
+ # macOS
543
+ cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
544
+
545
+ # Windows
546
+ type %APPDATA%\Claude\claude_desktop_config.json
547
+ ```
548
+
549
+ **Enable debug logging**:
550
+ ```json
551
+ {
552
+ "mcpServers": {
553
+ "kilde": {
554
+ "command": "kilde-mcp",
555
+ "args": ["--debug"],
556
+ "env": {
557
+ "KILDE_LOG_LEVEL": "debug"
558
+ }
559
+ }
560
+ }
561
+ }
562
+ ```
563
+
564
+ **Check logs**:
565
+ ```bash
566
+ # macOS
567
+ tail -f ~/Library/Logs/Claude/mcp*.log
568
+
569
+ # Windows
570
+ type %LOCALAPPDATA%\Claude\Logs\mcp*.log
571
+ ```
572
+
573
+ ### Tools Not Available
574
+
575
+ **Restart AI assistant**: Quit and restart completely.
576
+
577
+ **Verify server running**:
578
+ ```bash
579
+ # Test server manually
580
+ kilde-mcp
581
+ # Should wait for input (stdio mode)
582
+ ```
583
+
584
+ **Check tool permissions**: Some AI assistants require explicit tool approval.
585
+
586
+ ### API Errors
587
+
588
+ **Check API key**:
589
+ ```bash
590
+ echo $OPENAI_API_KEY
591
+ ```
592
+
593
+ **Test API access**:
594
+ ```bash
595
+ curl https://api.openai.com/v1/models \
596
+ -H "Authorization: Bearer $OPENAI_API_KEY"
597
+ ```
598
+
599
+ **Check rate limits**: You may have exceeded API rate limits.
600
+
601
+ ### Git Errors
602
+
603
+ **Verify git repository**:
604
+ ```bash
605
+ cd /path/to/repo
606
+ git status
607
+ ```
608
+
609
+ **Check git configuration**:
610
+ ```bash
611
+ git config --list
612
+ ```
613
+
614
+ **Ensure clean state**: Resolve any merge conflicts or locks.
615
+
616
+ ## Advanced Usage
617
+
618
+ ### Multiple Repositories
619
+
620
+ Configure different MCP servers for different repositories:
621
+
622
+ ```json
623
+ {
624
+ "mcpServers": {
625
+ "kilde-project-a": {
626
+ "command": "kilde-mcp",
627
+ "args": ["--config", "/path/to/project-a/.kilde/config.yaml"]
628
+ },
629
+ "kilde-project-b": {
630
+ "command": "kilde-mcp",
631
+ "args": ["--config", "/path/to/project-b/.kilde/config.yaml"]
632
+ }
633
+ }
634
+ }
635
+ ```
636
+
637
+ ### Custom Commands
638
+
639
+ Extend Kilde with custom MCP tools by modifying `src/mcp/tools.ts` and rebuilding.
640
+
641
+ ### Automation
642
+
643
+ Combine MCP tools with other automation:
644
+
645
+ ```
646
+ You: Create a commit, generate release notes, and create a GitHub release
647
+
648
+ Claude: [Orchestrates multiple tools]
649
+ 1. Creating commit...
650
+ 2. Generating release notes...
651
+ 3. Creating GitHub release...
652
+ ```
653
+
654
+ ## Best Practices
655
+
656
+ ### Interactive Mode
657
+
658
+ Always use interactive mode for important operations:
659
+
660
+ ```yaml
661
+ mcp:
662
+ defaults:
663
+ commit:
664
+ interactive: true
665
+ release:
666
+ interactive: true
667
+ ```
668
+
669
+ ### Context Files
670
+
671
+ Configure context files for better AI understanding:
672
+
673
+ ```yaml
674
+ commit:
675
+ contextFiles:
676
+ - ARCHITECTURE.md
677
+ - CONTRIBUTING.md
678
+ ```
679
+
680
+ ### Commit Messages
681
+
682
+ Review all generated commit messages before accepting.
683
+
684
+ ### Dry-Run First
685
+
686
+ Test with dry-run before executing:
687
+
688
+ ```
689
+ You: Create a commit with dry-run enabled
690
+
691
+ Claude: [Uses dryRun=true]
692
+
693
+ Preview of commit message (not executed):
694
+ ...
695
+ ```
696
+
697
+ ## Next Steps
698
+
699
+ - [Commands Guide](./commands.md) - Command reference
700
+ - [Configuration Guide](./configuration.md) - Configuration options
701
+ - [Architecture Guide](./architecture.md) - Technical implementation
702
+
703
+ ## Resources
704
+
705
+ - [Model Context Protocol](https://modelcontextprotocol.io/)
706
+ - [MCP SDK Documentation](https://github.com/modelcontextprotocol/sdk)
707
+ - [Claude Desktop](https://claude.ai/download)
708
+ - [Kilde GitHub](https://github.com/grunnverk/kilde)