@milo4jo/contextkit 0.1.0 → 0.3.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/README.md +237 -72
- package/dist/commands/index-cmd.d.ts.map +1 -1
- package/dist/commands/index-cmd.js +10 -2
- package/dist/commands/index-cmd.js.map +1 -1
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +23 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/watch.d.ts +8 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +171 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +11 -2
- package/dist/db/index.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer/chunker.d.ts.map +1 -1
- package/dist/indexer/chunker.js +14 -15
- package/dist/indexer/chunker.js.map +1 -1
- package/dist/indexer/discovery.d.ts +7 -0
- package/dist/indexer/discovery.d.ts.map +1 -1
- package/dist/indexer/discovery.js +9 -0
- package/dist/indexer/discovery.js.map +1 -1
- package/dist/indexer/index.d.ts +17 -3
- package/dist/indexer/index.d.ts.map +1 -1
- package/dist/indexer/index.js +135 -24
- package/dist/indexer/index.js.map +1 -1
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +20 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +252 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp-server.d.ts +18 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +22 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/selector/budget.d.ts +2 -0
- package/dist/selector/budget.d.ts.map +1 -1
- package/dist/selector/budget.js +19 -6
- package/dist/selector/budget.js.map +1 -1
- package/dist/selector/formatter.d.ts.map +1 -1
- package/dist/selector/formatter.js +7 -5
- package/dist/selector/formatter.js.map +1 -1
- package/dist/selector/scoring.d.ts +15 -5
- package/dist/selector/scoring.d.ts.map +1 -1
- package/dist/selector/scoring.js +193 -19
- package/dist/selector/scoring.js.map +1 -1
- package/dist/utils/streams.d.ts +4 -0
- package/dist/utils/streams.d.ts.map +1 -1
- package/dist/utils/streams.js +7 -0
- package/dist/utils/streams.js.map +1 -1
- package/package.json +19 -7
package/README.md
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
# ContextKit 🎯
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **Stop dumping your entire codebase into AI prompts.**
|
|
4
|
+
> ContextKit selects the *right* context for any query — saving tokens and improving answers.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
[](https://www.npmjs.com/package/@milo4jo/contextkit)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
8
12
|
|
|
9
|
-
AI coding assistants
|
|
13
|
+
AI coding assistants are only as good as the context you give them. But:
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
- **Too much context** = expensive, slow, diluted focus
|
|
16
|
+
- **Too little context** = hallucinations, wrong answers
|
|
17
|
+
- **Manual selection** = tedious, doesn't scale
|
|
18
|
+
|
|
19
|
+
**ContextKit fixes this.** It indexes your code and intelligently selects the most relevant chunks for any query.
|
|
20
|
+
|
|
21
|
+
## How It Works
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
25
|
+
│ Your Code │ ──▶ │ Index │ ──▶ │ Select │
|
|
26
|
+
│ (files) │ │ (local db) │ │ (semantic) │
|
|
27
|
+
└──────────────┘ └──────────────┘ └──────────────┘
|
|
28
|
+
│
|
|
29
|
+
▼
|
|
30
|
+
┌──────────────┐
|
|
31
|
+
│ Optimized │
|
|
32
|
+
│ Context │
|
|
33
|
+
└──────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
1. **Index** your codebase (embeddings stored locally)
|
|
37
|
+
2. **Query** in natural language
|
|
38
|
+
3. **Get** the most relevant code chunks, ready to paste
|
|
15
39
|
|
|
16
40
|
## Install
|
|
17
41
|
|
|
18
42
|
```bash
|
|
19
|
-
npm install -g contextkit
|
|
43
|
+
npm install -g @milo4jo/contextkit
|
|
20
44
|
```
|
|
21
45
|
|
|
22
46
|
## Quick Start
|
|
@@ -26,22 +50,64 @@ npm install -g contextkit
|
|
|
26
50
|
cd your-project
|
|
27
51
|
contextkit init
|
|
28
52
|
|
|
29
|
-
# Add
|
|
53
|
+
# Add directories to index
|
|
30
54
|
contextkit source add ./src
|
|
31
55
|
contextkit source add ./lib
|
|
32
56
|
|
|
33
|
-
#
|
|
57
|
+
# Build the index
|
|
34
58
|
contextkit index
|
|
35
59
|
|
|
36
|
-
# Find relevant context
|
|
60
|
+
# Find relevant context for any query
|
|
37
61
|
contextkit select "How does authentication work?"
|
|
38
62
|
```
|
|
39
63
|
|
|
64
|
+
**Output:**
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
## src/auth/middleware.ts (lines 1-45)
|
|
68
|
+
```typescript
|
|
69
|
+
export const authMiddleware = async (req, res, next) => {
|
|
70
|
+
const token = req.headers.authorization?.split(' ')[1];
|
|
71
|
+
if (!token) return res.status(401).json({ error: 'No token' });
|
|
72
|
+
// ...
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## src/auth/utils.ts (lines 12-30)
|
|
77
|
+
```typescript
|
|
78
|
+
export function validateToken(token: string): User | null {
|
|
79
|
+
// ...
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
📊 2,847 tokens | 6 chunks | 2 files
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Why ContextKit?
|
|
88
|
+
|
|
89
|
+
| Approach | Problem |
|
|
90
|
+
|----------|---------|
|
|
91
|
+
| **Dump everything** | Expensive, hits token limits, noisy |
|
|
92
|
+
| **Basic RAG** | Returns "similar" not "relevant" |
|
|
93
|
+
| **Manual selection** | Tedious, doesn't scale |
|
|
94
|
+
| **ContextKit** | ✅ Intelligent, fast, local-first |
|
|
95
|
+
|
|
96
|
+
### vs. LangChain / LlamaIndex
|
|
97
|
+
|
|
98
|
+
Those are full frameworks. ContextKit does **one thing well**: context selection. No lock-in, no complexity.
|
|
99
|
+
|
|
100
|
+
### vs. Vector Databases (Pinecone, Chroma)
|
|
101
|
+
|
|
102
|
+
They're storage. ContextKit adds the **intelligence layer** — scoring, budgeting, formatting.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
40
106
|
## Commands
|
|
41
107
|
|
|
42
108
|
### `contextkit init`
|
|
43
109
|
|
|
44
|
-
Initialize ContextKit in your project. Creates `.contextkit/` directory
|
|
110
|
+
Initialize ContextKit in your project. Creates `.contextkit/` directory.
|
|
45
111
|
|
|
46
112
|
```bash
|
|
47
113
|
contextkit init
|
|
@@ -49,31 +115,35 @@ contextkit init
|
|
|
49
115
|
|
|
50
116
|
### `contextkit source`
|
|
51
117
|
|
|
52
|
-
Manage
|
|
118
|
+
Manage which directories to index.
|
|
53
119
|
|
|
54
120
|
```bash
|
|
55
|
-
# Add a source
|
|
56
|
-
contextkit source
|
|
57
|
-
|
|
58
|
-
# List sources
|
|
59
|
-
contextkit source list
|
|
60
|
-
|
|
61
|
-
# Remove a source
|
|
62
|
-
contextkit source remove src
|
|
121
|
+
contextkit source add ./src # Add a source
|
|
122
|
+
contextkit source list # List all sources
|
|
123
|
+
contextkit source remove src # Remove a source
|
|
63
124
|
```
|
|
64
125
|
|
|
65
126
|
### `contextkit index`
|
|
66
127
|
|
|
67
|
-
|
|
128
|
+
Build or rebuild the index. Uses incremental indexing by default (only re-indexes changed files).
|
|
68
129
|
|
|
69
130
|
```bash
|
|
70
|
-
#
|
|
71
|
-
contextkit index
|
|
131
|
+
contextkit index # Incremental index (fast)
|
|
132
|
+
contextkit index --force # Full re-index
|
|
133
|
+
contextkit index --source src # Index specific source
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `contextkit watch`
|
|
72
137
|
|
|
73
|
-
|
|
74
|
-
|
|
138
|
+
Watch sources and auto-reindex on changes.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
contextkit watch # Watch with 1s debounce
|
|
142
|
+
contextkit watch --debounce 2000 # Custom debounce (ms)
|
|
75
143
|
```
|
|
76
144
|
|
|
145
|
+
Press `Ctrl+C` to stop watching.
|
|
146
|
+
|
|
77
147
|
### `contextkit select`
|
|
78
148
|
|
|
79
149
|
Find relevant context for a query.
|
|
@@ -82,7 +152,7 @@ Find relevant context for a query.
|
|
|
82
152
|
# Basic usage
|
|
83
153
|
contextkit select "How does the auth middleware work?"
|
|
84
154
|
|
|
85
|
-
#
|
|
155
|
+
# Set token budget (default: 8000)
|
|
86
156
|
contextkit select "error handling" --budget 4000
|
|
87
157
|
|
|
88
158
|
# Filter to specific sources
|
|
@@ -91,38 +161,77 @@ contextkit select "database queries" --sources src,lib
|
|
|
91
161
|
# Show scoring details
|
|
92
162
|
contextkit select "user validation" --explain
|
|
93
163
|
|
|
94
|
-
# JSON output for scripts
|
|
164
|
+
# JSON output (for scripts/integrations)
|
|
95
165
|
contextkit select "API routes" --json
|
|
96
166
|
```
|
|
97
167
|
|
|
98
|
-
|
|
168
|
+
---
|
|
99
169
|
|
|
100
|
-
|
|
101
|
-
## src/auth/middleware.ts (lines 1-45)
|
|
102
|
-
```typescript
|
|
103
|
-
export const authMiddleware = async (req, res, next) => {
|
|
104
|
-
// ... relevant code
|
|
105
|
-
}
|
|
106
|
-
```
|
|
170
|
+
## 🤖 MCP Server (Claude Desktop Integration)
|
|
107
171
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
172
|
+
ContextKit includes an **MCP server** for seamless integration with Claude Desktop and other MCP-compatible AI assistants.
|
|
173
|
+
|
|
174
|
+
### What is MCP?
|
|
175
|
+
|
|
176
|
+
[Model Context Protocol](https://modelcontextprotocol.io/) is a standard for connecting AI assistants to external tools. With MCP, Claude can directly use ContextKit to find relevant code.
|
|
177
|
+
|
|
178
|
+
### Setup for Claude Desktop
|
|
179
|
+
|
|
180
|
+
**1. Find your config file:**
|
|
181
|
+
|
|
182
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
183
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
184
|
+
|
|
185
|
+
**2. Add ContextKit:**
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"mcpServers": {
|
|
190
|
+
"contextkit": {
|
|
191
|
+
"command": "contextkit-mcp",
|
|
192
|
+
"args": [],
|
|
193
|
+
"env": {
|
|
194
|
+
"CONTEXTKIT_PROJECT": "/path/to/your/project"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
112
198
|
}
|
|
113
199
|
```
|
|
114
200
|
|
|
115
|
-
|
|
116
|
-
📊 3,847 tokens | 8 chunks | 2 files
|
|
117
|
-
```
|
|
201
|
+
**3. Restart Claude Desktop**
|
|
118
202
|
|
|
119
|
-
|
|
203
|
+
### Available Tools
|
|
204
|
+
|
|
205
|
+
Once configured, Claude can use these tools:
|
|
206
|
+
|
|
207
|
+
| Tool | Description |
|
|
208
|
+
|------|-------------|
|
|
209
|
+
| `contextkit_select` | Find relevant context for any query |
|
|
210
|
+
| `contextkit_index` | Re-index the codebase |
|
|
211
|
+
| `contextkit_status` | Check index status (files, chunks, etc.) |
|
|
212
|
+
|
|
213
|
+
### Example Conversation
|
|
214
|
+
|
|
215
|
+
> **You:** Find all code related to user authentication
|
|
216
|
+
>
|
|
217
|
+
> **Claude:** *[Uses contextkit_select]* I found the relevant code. Here's what handles authentication:
|
|
218
|
+
> - `src/auth/middleware.ts` - The main auth middleware
|
|
219
|
+
> - `src/auth/jwt.ts` - Token validation
|
|
220
|
+
> - ...
|
|
120
221
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
222
|
+
### Manual Server Start
|
|
223
|
+
|
|
224
|
+
For debugging or other MCP clients:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Start the MCP server
|
|
228
|
+
contextkit mcp
|
|
229
|
+
|
|
230
|
+
# With a specific project
|
|
231
|
+
CONTEXTKIT_PROJECT=/path/to/project contextkit mcp
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
126
235
|
|
|
127
236
|
## Configuration
|
|
128
237
|
|
|
@@ -138,44 +247,100 @@ sources:
|
|
|
138
247
|
include:
|
|
139
248
|
- "**/*.ts"
|
|
140
249
|
- "**/*.js"
|
|
250
|
+
- "**/*.tsx"
|
|
141
251
|
exclude:
|
|
142
252
|
- "**/node_modules/**"
|
|
143
253
|
- "**/*.test.ts"
|
|
254
|
+
- "**/*.spec.ts"
|
|
144
255
|
|
|
145
256
|
settings:
|
|
146
|
-
chunk_size: 500
|
|
147
|
-
chunk_overlap: 50
|
|
257
|
+
chunk_size: 500 # Target tokens per chunk
|
|
258
|
+
chunk_overlap: 50 # Overlap between chunks
|
|
259
|
+
embedding_model: gte-small
|
|
148
260
|
```
|
|
149
261
|
|
|
150
|
-
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Privacy & Security
|
|
265
|
+
|
|
266
|
+
- ✅ **All processing is local** — nothing leaves your machine
|
|
267
|
+
- ✅ **Embeddings stored locally** in `.contextkit/index.db`
|
|
268
|
+
- ✅ **No API keys required** — uses local embedding model
|
|
269
|
+
- ✅ **`.contextkit` is gitignored** automatically
|
|
151
270
|
|
|
152
|
-
|
|
271
|
+
---
|
|
153
272
|
|
|
154
|
-
|
|
155
|
-
|--------|-------------|
|
|
156
|
-
| `--json` | Output as JSON |
|
|
157
|
-
| `--plain` | No colors (or set `NO_COLOR=1`) |
|
|
158
|
-
| `--quiet` | Suppress non-essential output |
|
|
273
|
+
## Technical Details
|
|
159
274
|
|
|
160
|
-
|
|
275
|
+
### How Selection Works
|
|
161
276
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
277
|
+
1. **Chunking** — Files split into ~500 token chunks with overlap
|
|
278
|
+
2. **Embedding** — Each chunk embedded with [gte-small](https://huggingface.co/thenlper/gte-small) (runs locally)
|
|
279
|
+
3. **Similarity** — Query embedded and compared via cosine similarity
|
|
280
|
+
4. **Scoring** — Chunks ranked by similarity + path relevance + recency
|
|
281
|
+
5. **Budgeting** — Top chunks selected until token budget filled
|
|
166
282
|
|
|
167
|
-
|
|
283
|
+
### Requirements
|
|
168
284
|
|
|
169
285
|
- Node.js 18+
|
|
170
|
-
- ~500MB disk space
|
|
286
|
+
- ~500MB disk space (embedding model downloaded on first run)
|
|
287
|
+
|
|
288
|
+
---
|
|
171
289
|
|
|
172
|
-
##
|
|
290
|
+
## Try the Demo
|
|
173
291
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
-
|
|
292
|
+
Want to see ContextKit in action? Check out the [demo project](./examples/demo-project/):
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
cd examples/demo-project
|
|
296
|
+
contextkit init
|
|
297
|
+
contextkit source add ./src
|
|
298
|
+
contextkit index
|
|
299
|
+
contextkit select "How does authentication work?"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Roadmap
|
|
305
|
+
|
|
306
|
+
- [x] CLI with init, source, index, select
|
|
307
|
+
- [x] MCP server for Claude Desktop
|
|
308
|
+
- [x] Demo project for testing
|
|
309
|
+
- [x] Incremental indexing (only changed files)
|
|
310
|
+
- [x] Watch mode (auto-reindex on save)
|
|
311
|
+
- [x] Multi-factor scoring algorithm
|
|
312
|
+
- [ ] VS Code extension
|
|
313
|
+
- [ ] Cursor integration
|
|
314
|
+
- [ ] Cloud sync (optional)
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Contributing
|
|
319
|
+
|
|
320
|
+
Contributions welcome! Please read the [contributing guide](./CONTRIBUTING.md) first.
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Clone and setup
|
|
324
|
+
git clone https://github.com/milo4jo/contextkit.git
|
|
325
|
+
cd contextkit
|
|
326
|
+
npm install
|
|
327
|
+
npm run build
|
|
328
|
+
|
|
329
|
+
# Run tests
|
|
330
|
+
npm test
|
|
331
|
+
|
|
332
|
+
# Link for local development
|
|
333
|
+
npm link
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
178
337
|
|
|
179
338
|
## License
|
|
180
339
|
|
|
181
|
-
MIT
|
|
340
|
+
MIT © [Milo](https://github.com/milo4jo)
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
<p align="center">
|
|
345
|
+
Built with 🦊 by Milo
|
|
346
|
+
</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/index-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/index-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,YAAY,SA0IrB,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { SourceNotFoundError } from '../errors/index.js';
|
|
|
10
10
|
export const indexCommand = new Command('index')
|
|
11
11
|
.description('Index all sources')
|
|
12
12
|
.option('-s, --source <name>', 'Index only a specific source')
|
|
13
|
+
.option('-f, --force', 'Force full re-index (ignore cached hashes)')
|
|
13
14
|
.action(async (options) => {
|
|
14
15
|
ensureInitialized();
|
|
15
16
|
const config = loadConfig();
|
|
@@ -81,7 +82,7 @@ export const indexCommand = new Command('index')
|
|
|
81
82
|
const stats = await indexSources(sourcesToIndex, process.cwd(), db, {
|
|
82
83
|
chunkSize: config.settings.chunk_size,
|
|
83
84
|
chunkOverlap: config.settings.chunk_overlap,
|
|
84
|
-
}, onProgress);
|
|
85
|
+
}, onProgress, { force: options.force });
|
|
85
86
|
// Stop progress bar
|
|
86
87
|
if (progressBar) {
|
|
87
88
|
progressBar.stop();
|
|
@@ -90,7 +91,14 @@ export const indexCommand = new Command('index')
|
|
|
90
91
|
if (!opts.quiet) {
|
|
91
92
|
writeMessage('');
|
|
92
93
|
const timeStr = (stats.timeMs / 1000).toFixed(1);
|
|
93
|
-
|
|
94
|
+
// Show incremental stats
|
|
95
|
+
if (stats.filesUnchanged > 0 || stats.filesRemoved > 0) {
|
|
96
|
+
writeSuccess(`Indexed ${stats.chunks} chunks from ${stats.files} files in ${timeStr}s`);
|
|
97
|
+
writeMessage(formatDim(` ${stats.filesChanged} changed, ${stats.filesUnchanged} unchanged, ${stats.filesRemoved} removed`));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
writeSuccess(`Indexed ${stats.chunks} chunks from ${stats.files} files in ${timeStr}s`);
|
|
101
|
+
}
|
|
94
102
|
if (stats.skipped > 0) {
|
|
95
103
|
writeMessage(formatDim(` (${stats.skipped} files skipped - too large or binary)`));
|
|
96
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-cmd.js","sourceRoot":"","sources":["../../src/commands/index-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,YAAY,E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AC,YAAY,GAAG,CAAC,EAAE,CAAC;gBACvD,YAAY,CAAC,WAAW,KAAK,CAAC,MAAM,gBAAgB,KAAK,CAAC,KAAK,aAAa,OAAO,GAAG,CAAC,CAAC;gBACxF,YAAY,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,YAAY,aAAa,KAAK,CAAC,cAAc,eAAe,KAAK,CAAC,YAAY,UAAU,CAAC,CAAC,CAAC;YAC/H,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,WAAW,KAAK,CAAC,MAAM,gBAAgB,KAAK,CAAC,KAAK,aAAa,OAAO,GAAG,CAAC,CAAC;YAC1F,CAAC;YAED,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;gBACtB,YAAY,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC,CAAC;YACtF,CAAC;YACD,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;QAED,cAAc;QACd,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,SAAS,CACP,IAAI,CAAC,SAAS,CACZ;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK;aACN,EACD,IAAI,EACJ,CAAC,CACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,UAAU,SAYnB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Command
|
|
3
|
+
*
|
|
4
|
+
* Start the Model Context Protocol server for AI assistant integration.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { startMcpServer } from "../mcp/server.js";
|
|
8
|
+
import { writeMessage, writeError } from "../utils/streams.js";
|
|
9
|
+
export const mcpCommand = new Command("mcp")
|
|
10
|
+
.description("Start MCP server for AI assistant integration")
|
|
11
|
+
.option("--stdio", "Use stdio transport (default)")
|
|
12
|
+
.action(async () => {
|
|
13
|
+
try {
|
|
14
|
+
writeMessage("Starting ContextKit MCP server...");
|
|
15
|
+
await startMcpServer();
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
writeError(`Failed to start MCP server: ${message}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KACzC,WAAW,CAAC,+CAA+C,CAAC;KAC5D,MAAM,CAAC,SAAS,EAAE,+BAA+B,CAAC;KAClD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,YAAY,CAAC,mCAAmC,CAAC,CAAC;QAClD,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,UAAU,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,eAAO,MAAM,YAAY,SAiLrB,CAAC"}
|