@milo4jo/contextkit 0.5.6 → 0.5.7

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/README.md CHANGED
@@ -118,6 +118,34 @@ They're storage. ContextKit adds the **intelligence layer** — scoring, budgeti
118
118
 
119
119
  ---
120
120
 
121
+ ## Performance
122
+
123
+ Benchmarks on a MacBook Pro M4 (ContextKit's own codebase: 40 files, 166 chunks):
124
+
125
+ | Operation | Time | Notes |
126
+ |-----------|------|-------|
127
+ | **Initial index** | ~14s | Includes embedding generation |
128
+ | **Incremental index** | <1s | Only changed files |
129
+ | **Query (cold)** | ~200ms | First query loads model |
130
+ | **Query (warm)** | ~50ms | Subsequent queries |
131
+ | **Query (cached)** | <5ms | Identical queries |
132
+
133
+ Scaling (tested on larger codebases):
134
+
135
+ | Codebase Size | Index Time | Query Time |
136
+ |---------------|------------|------------|
137
+ | 100 files | ~30s | ~60ms |
138
+ | 500 files | ~2min | ~80ms |
139
+ | 1000 files | ~4min | ~100ms |
140
+
141
+ **Key optimizations:**
142
+ - Incremental indexing (content hashing)
143
+ - Query caching with automatic invalidation
144
+ - Local embeddings (no API latency)
145
+ - SQLite for fast reads
146
+
147
+ ---
148
+
121
149
  ## Commands
122
150
 
123
151
  ### `contextkit init`
@@ -352,6 +380,58 @@ settings:
352
380
 
353
381
  ---
354
382
 
383
+ ## Troubleshooting
384
+
385
+ ### Quick Diagnosis
386
+
387
+ ```bash
388
+ contextkit doctor
389
+ ```
390
+
391
+ This checks your setup and shows any issues:
392
+
393
+ ```
394
+ 🩺 ContextKit Doctor
395
+
396
+ Running diagnostics...
397
+
398
+ ✓ Node.js version: v20.10.0
399
+ ✓ Configuration: 2 source(s) configured
400
+ ✓ Index database: 166 chunks, 40 files (12.5 MB)
401
+ ✓ Embeddings: 166/166 chunks (100%)
402
+ ✓ Query cache: 5 cached queries
403
+ ✓ Disk space: OK
404
+
405
+ ✓ All checks passed! ContextKit is ready to use.
406
+ ```
407
+
408
+ ### Common Issues
409
+
410
+ **"Not initialized"**
411
+ ```bash
412
+ contextkit init
413
+ contextkit source add ./src
414
+ contextkit index
415
+ ```
416
+
417
+ **"No sources configured"**
418
+ ```bash
419
+ contextkit source add ./src
420
+ ```
421
+
422
+ **"No embeddings generated"**
423
+ ```bash
424
+ contextkit index --force # Re-index with embeddings
425
+ ```
426
+
427
+ **Slow queries?**
428
+ ```bash
429
+ contextkit cache clear # Clear query cache
430
+ contextkit index --force # Rebuild index
431
+ ```
432
+
433
+ ---
434
+
355
435
  ## Technical Details
356
436
 
357
437
  ### How Selection Works
@@ -398,10 +478,12 @@ contextkit select "How does authentication work?"
398
478
  - [x] Multi-factor scoring algorithm
399
479
  - [x] Multiple output formats (markdown, XML, JSON, plain)
400
480
  - [x] **Import-aware scoring** — understands code dependencies
401
- - [ ] Function/class boundary awareness
402
- - [ ] VS Code extension
481
+ - [x] **Doctor command** — diagnose setup issues
482
+ - [ ] ~~Function/class boundary awareness~~ (done via AST chunking)
483
+ - [x] **VS Code extension** — [in development](https://github.com/milo4jo/contextkit-vscode)
403
484
  - [ ] Cursor integration
404
485
  - [ ] Neovim plugin
486
+ - [ ] Cloud sync for teams
405
487
 
406
488
  ---
407
489
 
@@ -27,4 +27,19 @@ export declare class AlreadyInitializedError extends ContextKitError {
27
27
  export declare class InvalidUsageError extends ContextKitError {
28
28
  constructor(message: string);
29
29
  }
30
+ export declare class IndexEmptyError extends ContextKitError {
31
+ constructor();
32
+ }
33
+ export declare class NoSourcesError extends ContextKitError {
34
+ constructor();
35
+ }
36
+ export declare class EmbeddingError extends ContextKitError {
37
+ constructor(detail?: string);
38
+ }
39
+ export declare class QueryError extends ContextKitError {
40
+ constructor(message: string);
41
+ }
42
+ export declare class DatabaseError extends ContextKitError {
43
+ constructor(operation: string, detail?: string);
44
+ }
30
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.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AU,CAAC,EAAE,MAAM;CAM9C;AAED,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;CAOhD;AAED,qBAAa,uBAAwB,SAAQ,eAAe;;CAI3D;AAED,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,eAAgB,SAAQ,eAAe;;CAQnD;AAED,qBAAa,cAAe,SAAQ,eAAe;;CAQlD;AAED,qBAAa,cAAe,SAAQ,eAAe;gBACrC,MAAM,CAAC,EAAE,MAAM;CAM5B;AAED,qBAAa,UAAW,SAAQ,eAAe;gBACjC,OAAO,EAAE,MAAM;CAO5B;AAED,qBAAa,aAAc,SAAQ,eAAe;gBACpC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAM/C"}
@@ -48,4 +48,36 @@ export class InvalidUsageError extends ContextKitError {
48
48
  super(message, 'INVALID_USAGE');
49
49
  }
50
50
  }
51
+ export class IndexEmptyError extends ContextKitError {
52
+ constructor() {
53
+ super('Index is empty. Run `contextkit index` after adding sources.', 'INDEX_EMPTY', true // recoverable
54
+ );
55
+ }
56
+ }
57
+ export class NoSourcesError extends ContextKitError {
58
+ constructor() {
59
+ super('No sources configured. Add sources with `contextkit source add ./src`', 'NO_SOURCES', true);
60
+ }
61
+ }
62
+ export class EmbeddingError extends ContextKitError {
63
+ constructor(detail) {
64
+ const msg = detail
65
+ ? `Embedding generation failed: ${detail}`
66
+ : 'Embedding generation failed. Try `contextkit index --force` to rebuild.';
67
+ super(msg, 'EMBEDDING_ERROR', true);
68
+ }
69
+ }
70
+ export class QueryError extends ContextKitError {
71
+ constructor(message) {
72
+ super(`Query failed: ${message}. Run \`contextkit doctor\` to diagnose.`, 'QUERY_ERROR', true);
73
+ }
74
+ }
75
+ export class DatabaseError extends ContextKitError {
76
+ constructor(operation, detail) {
77
+ const msg = detail
78
+ ? `Database ${operation} failed: ${detail}`
79
+ : `Database ${operation} failed. Try removing .contextkit/index.db and re-indexing.`;
80
+ super(msg, 'DATABASE_ERROR');
81
+ }
82
+ }
51
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAS;IACb,WAAW,CAAU;IAE9B,YAAY,OAAe,EAAE,IAAY,EAAE,WAAW,GAAG,KAAK;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAC7C,UAAU,GAAG,iBAAiB,CAAC;IAExC;QACE,KAAK,CACH,gFAAgF,EAChF,iBAAiB,CAClB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAC7C,UAAU,GAAG,wBAAwB,CAAC;IAE/C,YAAY,IAAY;QACtB,KAAK,CACH,WAAW,IAAI,uEAAuE,EACtF,kBAAkB,CACnB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD,YAAY,IAAY,EAAE,UAAmB;QAC3C,MAAM,GAAG,GAAG,UAAU;YACpB,CAAC,CAAC,SAAS,IAAI,8BAA8B,UAAU,IAAI;YAC3D,CAAC,CAAC,SAAS,IAAI,cAAc,CAAC;QAChC,KAAK,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD,YAAY,IAAY,EAAE,YAAqB;QAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,kBAAkB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Aa,EACb,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,eAAe;IAChD,YAAY,SAAiB,EAAE,MAAe;QAC5C,MAAM,GAAG,GAAG,MAAM;YAChB,CAAC,CAAC,YAAY,SAAS,YAAY,MAAM,EAAE;YAC3C,CAAC,CAAC,YAAY,SAAS,6DAA6D,CAAC;QACvF,KAAK,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC/B,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milo4jo/contextkit",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Intelligent context selection for LLM applications",
5
5
  "author": "Milo <milo4jo@outlook.de>",
6
6
  "license": "MIT",