@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,779 @@
1
+ # Configuration Guide
2
+
3
+ Complete guide to configuring Kilde for your workflow.
4
+
5
+ ## Configuration Files
6
+
7
+ Kilde supports multiple configuration file formats and locations.
8
+
9
+ ### File Formats
10
+
11
+ #### YAML (Recommended)
12
+ ```yaml
13
+ # .kilde/config.yaml
14
+ commit:
15
+ type: conventional
16
+ autoStage: false
17
+ ai:
18
+ model: gpt-4
19
+ temperature: 0.7
20
+
21
+ release:
22
+ format: markdown
23
+ includeHashes: true
24
+ ```
25
+
26
+ #### JSON
27
+ ```json
28
+ {
29
+ "commit": {
30
+ "type": "conventional",
31
+ "autoStage": false,
32
+ "ai": {
33
+ "model": "gpt-4",
34
+ "temperature": 0.7
35
+ }
36
+ },
37
+ "release": {
38
+ "format": "markdown",
39
+ "includeHashes": true
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### File Locations
45
+
46
+ Kilde searches for configuration files in this order:
47
+
48
+ 1. **Command-line specified**: `--config /path/to/config.yaml`
49
+ 2. **Project config**: `.kilde/config.yaml` or `.kilde/config.json`
50
+ 3. **Project root**: `.kilderc.yaml`, `.kilderc.json`, `.kilderc`
51
+ 4. **User home**: `~/.kilde/config.yaml`, `~/.kilderc.yaml`
52
+
53
+ Files are merged with later files taking precedence. This allows:
54
+ - Global defaults in home directory
55
+ - Project-specific settings in repository
56
+ - Command-specific overrides via CLI
57
+
58
+ ### Creating a Config File
59
+
60
+ Generate a sample configuration:
61
+
62
+ ```bash
63
+ mkdir -p .kilde
64
+ cat > .kilde/config.yaml << 'EOF'
65
+ commit:
66
+ type: conventional
67
+ ai:
68
+ model: gpt-4
69
+ temperature: 0.7
70
+
71
+ release:
72
+ format: markdown
73
+ includeHashes: true
74
+ EOF
75
+ ```
76
+
77
+ ## Configuration Schema
78
+
79
+ ### Top-Level Structure
80
+
81
+ ```yaml
82
+ # General settings
83
+ logLevel: info # debug, info, warn, error
84
+ configDirectory: .kilde # Config directory name
85
+
86
+ # Command-specific settings
87
+ commit: { }
88
+ release: { }
89
+ mcp: { }
90
+ ```
91
+
92
+ ## Commit Configuration
93
+
94
+ ### `commit.type`
95
+
96
+ Commit message format style.
97
+
98
+ **Type**: `string`
99
+ **Default**: `conventional`
100
+ **Options**: `conventional`, `simple`
101
+
102
+ ```yaml
103
+ commit:
104
+ type: conventional
105
+ ```
106
+
107
+ **conventional**: Follows [Conventional Commits](https://www.conventionalcommits.org/)
108
+ ```
109
+ feat(auth): add OAuth2 support
110
+
111
+ Implement OAuth2 authentication flow with support
112
+ for multiple providers.
113
+ ```
114
+
115
+ **simple**: Plain commit messages
116
+ ```
117
+ Add OAuth2 support
118
+
119
+ Implement OAuth2 authentication flow with support
120
+ for multiple providers.
121
+ ```
122
+
123
+ ### `commit.autoStage`
124
+
125
+ Automatically stage changes before committing.
126
+
127
+ **Type**: `boolean`
128
+ **Default**: `false`
129
+
130
+ ```yaml
131
+ commit:
132
+ autoStage: true
133
+ ```
134
+
135
+ Equivalent to `git add -A` before generating commit message.
136
+
137
+ ### `commit.autoCommit`
138
+
139
+ Skip interactive review and commit immediately.
140
+
141
+ **Type**: `boolean`
142
+ **Default**: `false`
143
+
144
+ ```yaml
145
+ commit:
146
+ autoCommit: true
147
+ ```
148
+
149
+ **Warning**: Use with caution. Recommended to keep `false` for safety.
150
+
151
+ ### `commit.autoPush`
152
+
153
+ Push to remote after successful commit.
154
+
155
+ **Type**: `boolean`
156
+ **Default**: `false`
157
+
158
+ ```yaml
159
+ commit:
160
+ autoPush: true
161
+ ```
162
+
163
+ ### `commit.contextFiles`
164
+
165
+ Files to always include for context.
166
+
167
+ **Type**: `string[]`
168
+ **Default**: `[]`
169
+
170
+ ```yaml
171
+ commit:
172
+ contextFiles:
173
+ - CHANGELOG.md
174
+ - README.md
175
+ - docs/ARCHITECTURE.md
176
+ ```
177
+
178
+ Useful for providing consistent context to the AI.
179
+
180
+ ### `commit.ai`
181
+
182
+ AI model configuration for commit messages.
183
+
184
+ ```yaml
185
+ commit:
186
+ ai:
187
+ model: gpt-4 # Model name
188
+ temperature: 0.7 # 0.0 to 1.0
189
+ maxTokens: 500 # Max response length
190
+ provider: openai # openai, anthropic
191
+ ```
192
+
193
+ #### `commit.ai.model`
194
+
195
+ AI model to use.
196
+
197
+ **Type**: `string`
198
+ **Default**: `gpt-4`
199
+
200
+ **OpenAI Models**:
201
+ - `gpt-4`: Best quality, slower
202
+ - `gpt-3.5-turbo`: Faster, good quality
203
+ - `gpt-4-turbo`: Fast and high quality
204
+
205
+ **Anthropic Models**:
206
+ - `claude-3-opus`: Highest quality
207
+ - `claude-3-sonnet`: Balanced
208
+ - `claude-3-haiku`: Fastest
209
+
210
+ ```yaml
211
+ commit:
212
+ ai:
213
+ model: claude-3-sonnet
214
+ provider: anthropic
215
+ ```
216
+
217
+ #### `commit.ai.temperature`
218
+
219
+ Creativity level for AI responses.
220
+
221
+ **Type**: `number` (0.0 to 1.0)
222
+ **Default**: `0.7`
223
+
224
+ - `0.0-0.3`: More focused and deterministic
225
+ - `0.4-0.7`: Balanced creativity
226
+ - `0.8-1.0`: More creative and varied
227
+
228
+ ```yaml
229
+ commit:
230
+ ai:
231
+ temperature: 0.5 # More consistent messages
232
+ ```
233
+
234
+ #### `commit.ai.maxTokens`
235
+
236
+ Maximum length of generated message.
237
+
238
+ **Type**: `number`
239
+ **Default**: `500`
240
+
241
+ ```yaml
242
+ commit:
243
+ ai:
244
+ maxTokens: 800 # Allow longer messages
245
+ ```
246
+
247
+ ### `commit.format`
248
+
249
+ Commit message formatting options.
250
+
251
+ ```yaml
252
+ commit:
253
+ format:
254
+ maxLineLength: 72 # Wrap at 72 characters
255
+ includeScope: true # Include scope in type
256
+ scopeRequired: false # Require scope
257
+ breakingPrefix: "!" # Breaking change indicator
258
+ ```
259
+
260
+ ### Example Commit Configurations
261
+
262
+ #### Minimal
263
+ ```yaml
264
+ commit:
265
+ type: conventional
266
+ ```
267
+
268
+ #### Team Standard
269
+ ```yaml
270
+ commit:
271
+ type: conventional
272
+ autoStage: false
273
+ autoCommit: false
274
+ ai:
275
+ model: gpt-4
276
+ temperature: 0.5
277
+ contextFiles:
278
+ - CHANGELOG.md
279
+ format:
280
+ maxLineLength: 72
281
+ scopeRequired: true
282
+ ```
283
+
284
+ #### Fast Workflow
285
+ ```yaml
286
+ commit:
287
+ type: simple
288
+ autoStage: true
289
+ autoCommit: true
290
+ autoPush: true
291
+ ai:
292
+ model: gpt-3.5-turbo
293
+ temperature: 0.7
294
+ ```
295
+
296
+ ## Release Configuration
297
+
298
+ ### `release.format`
299
+
300
+ Output format for release notes.
301
+
302
+ **Type**: `string`
303
+ **Default**: `markdown`
304
+ **Options**: `markdown`, `plain`
305
+
306
+ ```yaml
307
+ release:
308
+ format: markdown
309
+ ```
310
+
311
+ ### `release.includeHashes`
312
+
313
+ Include commit hashes in release notes.
314
+
315
+ **Type**: `boolean`
316
+ **Default**: `true`
317
+
318
+ ```yaml
319
+ release:
320
+ includeHashes: true
321
+ ```
322
+
323
+ Output with hashes:
324
+ ```markdown
325
+ ## Features
326
+ - feat(auth): add OAuth2 support (abc123)
327
+ ```
328
+
329
+ Output without hashes:
330
+ ```markdown
331
+ ## Features
332
+ - feat(auth): add OAuth2 support
333
+ ```
334
+
335
+ ### `release.includeAuthors`
336
+
337
+ Include commit authors in release notes.
338
+
339
+ **Type**: `boolean`
340
+ **Default**: `true`
341
+
342
+ ```yaml
343
+ release:
344
+ includeAuthors: true
345
+ ```
346
+
347
+ Output:
348
+ ```markdown
349
+ ## Features
350
+ - feat(auth): add OAuth2 support (@username)
351
+ ```
352
+
353
+ ### `release.focus`
354
+
355
+ Default focus areas for release notes.
356
+
357
+ **Type**: `string[]`
358
+ **Default**: `[]`
359
+
360
+ ```yaml
361
+ release:
362
+ focus:
363
+ - features
364
+ - bugfixes
365
+ - breaking
366
+ - security
367
+ ```
368
+
369
+ ### `release.groupBy`
370
+
371
+ How to group commits in release notes.
372
+
373
+ **Type**: `string`
374
+ **Default**: `type`
375
+ **Options**: `type`, `scope`, `none`
376
+
377
+ ```yaml
378
+ release:
379
+ groupBy: type
380
+ ```
381
+
382
+ **type**: Group by commit type (feat, fix, docs, etc.)
383
+ ```markdown
384
+ ## Features
385
+ - Add OAuth2 support
386
+ - Add user profile page
387
+
388
+ ## Bug Fixes
389
+ - Fix login redirect
390
+ ```
391
+
392
+ **scope**: Group by scope (auth, ui, api, etc.)
393
+ ```markdown
394
+ ## auth
395
+ - Add OAuth2 support
396
+ - Fix login redirect
397
+
398
+ ## ui
399
+ - Add user profile page
400
+ ```
401
+
402
+ **none**: No grouping, chronological order
403
+
404
+ ### `release.ai`
405
+
406
+ AI configuration for release notes.
407
+
408
+ ```yaml
409
+ release:
410
+ ai:
411
+ model: gpt-4
412
+ temperature: 0.7
413
+ maxTokens: 2000
414
+ provider: openai
415
+ ```
416
+
417
+ Configuration works the same as `commit.ai`.
418
+
419
+ ### Example Release Configurations
420
+
421
+ #### Minimal
422
+ ```yaml
423
+ release:
424
+ format: markdown
425
+ ```
426
+
427
+ #### Detailed
428
+ ```yaml
429
+ release:
430
+ format: markdown
431
+ includeHashes: true
432
+ includeAuthors: true
433
+ groupBy: type
434
+ focus:
435
+ - features
436
+ - breaking
437
+ - security
438
+ ai:
439
+ model: gpt-4
440
+ temperature: 0.5
441
+ ```
442
+
443
+ #### Simple
444
+ ```yaml
445
+ release:
446
+ format: plain
447
+ includeHashes: false
448
+ includeAuthors: false
449
+ groupBy: none
450
+ ```
451
+
452
+ ## MCP Configuration
453
+
454
+ Configuration for the Model Context Protocol server.
455
+
456
+ ### `mcp.name`
457
+
458
+ Server name for MCP.
459
+
460
+ **Type**: `string`
461
+ **Default**: `kilde`
462
+
463
+ ```yaml
464
+ mcp:
465
+ name: kilde
466
+ ```
467
+
468
+ ### `mcp.version`
469
+
470
+ Server version.
471
+
472
+ **Type**: `string`
473
+ **Default**: Package version
474
+
475
+ ```yaml
476
+ mcp:
477
+ version: 0.1.0
478
+ ```
479
+
480
+ ### `mcp.tools`
481
+
482
+ Tools to expose via MCP.
483
+
484
+ **Type**: `string[]`
485
+ **Default**: `["kilde_commit", "kilde_release"]`
486
+
487
+ ```yaml
488
+ mcp:
489
+ tools:
490
+ - kilde_commit
491
+ - kilde_release
492
+ ```
493
+
494
+ ### `mcp.resources`
495
+
496
+ Resources to expose via MCP.
497
+
498
+ **Type**: `string[]`
499
+ **Default**: `["config", "status", "workspace"]`
500
+
501
+ ```yaml
502
+ mcp:
503
+ resources:
504
+ - config
505
+ - status
506
+ - workspace
507
+ ```
508
+
509
+ ### `mcp.prompts`
510
+
511
+ Workflow prompts to expose.
512
+
513
+ **Type**: `string[]`
514
+ **Default**: `["commit-workflow", "release-workflow"]`
515
+
516
+ ```yaml
517
+ mcp:
518
+ prompts:
519
+ - commit-workflow
520
+ - release-workflow
521
+ ```
522
+
523
+ ## Environment Variables
524
+
525
+ ### `OPENAI_API_KEY`
526
+
527
+ OpenAI API key for GPT models.
528
+
529
+ ```bash
530
+ export OPENAI_API_KEY=sk-...
531
+ ```
532
+
533
+ Required when using OpenAI models (gpt-4, gpt-3.5-turbo).
534
+
535
+ ### `ANTHROPIC_API_KEY`
536
+
537
+ Anthropic API key for Claude models.
538
+
539
+ ```bash
540
+ export ANTHROPIC_API_KEY=sk-ant-...
541
+ ```
542
+
543
+ Required when using Anthropic models (claude-3-*).
544
+
545
+ ### `KILDE_CONFIG_DIR`
546
+
547
+ Override default config directory.
548
+
549
+ ```bash
550
+ export KILDE_CONFIG_DIR=/custom/path
551
+ ```
552
+
553
+ Default: `.kilde`
554
+
555
+ ### `KILDE_LOG_LEVEL`
556
+
557
+ Override log level.
558
+
559
+ ```bash
560
+ export KILDE_LOG_LEVEL=debug
561
+ ```
562
+
563
+ Options: `debug`, `info`, `warn`, `error`
564
+
565
+ ### `KILDE_DEBUG`
566
+
567
+ Enable debug mode (alternative to --debug flag).
568
+
569
+ ```bash
570
+ export KILDE_DEBUG=1
571
+ ```
572
+
573
+ ## Configuration Precedence
574
+
575
+ Configuration is merged in this order (later overrides earlier):
576
+
577
+ 1. **Built-in defaults**
578
+ 2. **User home config** (`~/.kilde/config.yaml`)
579
+ 3. **Project root config** (`.kilderc.yaml`)
580
+ 4. **Project .kilde config** (`.kilde/config.yaml`)
581
+ 5. **Environment variables**
582
+ 6. **Command-line flags**
583
+
584
+ ### Example Merge
585
+
586
+ **Built-in defaults**:
587
+ ```yaml
588
+ commit:
589
+ type: conventional
590
+ autoStage: false
591
+ ai:
592
+ model: gpt-4
593
+ temperature: 0.7
594
+ ```
595
+
596
+ **Project config** (`.kilde/config.yaml`):
597
+ ```yaml
598
+ commit:
599
+ autoStage: true
600
+ ai:
601
+ model: gpt-3.5-turbo
602
+ ```
603
+
604
+ **Command-line**:
605
+ ```bash
606
+ kilde commit --context "Fix bug"
607
+ ```
608
+
609
+ **Effective configuration**:
610
+ ```yaml
611
+ commit:
612
+ type: conventional # from defaults
613
+ autoStage: true # from project config
614
+ ai:
615
+ model: gpt-3.5-turbo # from project config
616
+ temperature: 0.7 # from defaults
617
+ context: "Fix bug" # from CLI
618
+ ```
619
+
620
+ ## Validation
621
+
622
+ Kilde validates configuration files on load. Common errors:
623
+
624
+ ### Invalid Type
625
+ ```yaml
626
+ commit:
627
+ type: invalid # Error: must be 'conventional' or 'simple'
628
+ ```
629
+
630
+ ### Invalid Value
631
+ ```yaml
632
+ commit:
633
+ ai:
634
+ temperature: 2.0 # Error: must be between 0.0 and 1.0
635
+ ```
636
+
637
+ ### Unknown Field
638
+ ```yaml
639
+ commit:
640
+ unknownField: value # Warning: unknown field (ignored)
641
+ ```
642
+
643
+ ## Best Practices
644
+
645
+ ### Team Configuration
646
+
647
+ **Commit team config to git**:
648
+ ```bash
649
+ # .kilde/config.yaml (committed)
650
+ commit:
651
+ type: conventional
652
+ format:
653
+ maxLineLength: 72
654
+ scopeRequired: true
655
+
656
+ # Developer overrides in ~/.kilde/config.yaml (not committed)
657
+ commit:
658
+ autoStage: true
659
+ ai:
660
+ model: gpt-3.5-turbo # Faster for development
661
+ ```
662
+
663
+ ### Per-Branch Configuration
664
+
665
+ Use different configs for different workflows:
666
+
667
+ ```bash
668
+ # Feature branch
669
+ git checkout feature/auth
670
+ cat > .kilde/config.yaml << EOF
671
+ commit:
672
+ contextFiles:
673
+ - docs/auth-spec.md
674
+ ai:
675
+ temperature: 0.8 # More creative for new features
676
+ EOF
677
+
678
+ # Bugfix branch
679
+ git checkout bugfix/login
680
+ cat > .kilde/config.yaml << EOF
681
+ commit:
682
+ contextFiles:
683
+ - BUGS.md
684
+ ai:
685
+ temperature: 0.3 # More focused for bug fixes
686
+ EOF
687
+ ```
688
+
689
+ ### CI/CD Configuration
690
+
691
+ ```yaml
692
+ # .kilde/config.yaml
693
+ commit:
694
+ # Production settings
695
+ autoCommit: false
696
+ ai:
697
+ model: gpt-4
698
+
699
+ # CI overrides via environment
700
+ # In CI: KILDE_LOG_LEVEL=debug kilde commit
701
+ ```
702
+
703
+ ### Configuration Templates
704
+
705
+ Create templates for common scenarios:
706
+
707
+ ```bash
708
+ # .kilde/templates/feature.yaml
709
+ commit:
710
+ type: conventional
711
+ contextFiles:
712
+ - ARCHITECTURE.md
713
+ ai:
714
+ temperature: 0.8
715
+
716
+ # .kilde/templates/bugfix.yaml
717
+ commit:
718
+ type: conventional
719
+ contextFiles:
720
+ - BUGS.md
721
+ ai:
722
+ temperature: 0.3
723
+
724
+ # Use template
725
+ cp .kilde/templates/feature.yaml .kilde/config.yaml
726
+ ```
727
+
728
+ ## Troubleshooting
729
+
730
+ ### Config Not Loading
731
+
732
+ **Check search paths**:
733
+ ```bash
734
+ kilde commit --debug
735
+ # Look for "Loading config from..." messages
736
+ ```
737
+
738
+ **Verify file syntax**:
739
+ ```bash
740
+ # For YAML
741
+ yamllint .kilde/config.yaml
742
+
743
+ # For JSON
744
+ jq . .kilde/config.json
745
+ ```
746
+
747
+ ### API Keys Not Working
748
+
749
+ **Check environment variables**:
750
+ ```bash
751
+ echo $OPENAI_API_KEY
752
+ echo $ANTHROPIC_API_KEY
753
+ ```
754
+
755
+ **Verify in debug mode**:
756
+ ```bash
757
+ kilde commit --debug
758
+ # Look for "Using AI provider: ..." message
759
+ ```
760
+
761
+ ### Unexpected Behavior
762
+
763
+ **Dump effective configuration**:
764
+ ```bash
765
+ kilde commit --dry-run --debug
766
+ # Shows merged configuration
767
+ ```
768
+
769
+ **Test with minimal config**:
770
+ ```bash
771
+ kilde commit --config /dev/null
772
+ # Uses only built-in defaults
773
+ ```
774
+
775
+ ## Next Steps
776
+
777
+ - [Commands Guide](./commands.md) - Command reference
778
+ - [MCP Integration Guide](./mcp-integration.md) - Set up AI assistant integration
779
+ - [Architecture Guide](./architecture.md) - Technical implementation details