@neuledge/context 0.2.2 → 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 +184 -146
- package/dist/build.d.ts +17 -1
- package/dist/build.js +245 -2
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +82 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +20 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/download.d.ts +20 -0
- package/dist/download.js +64 -0
- package/dist/download.js.map +1 -0
- package/dist/git.js +43 -17
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/package-builder.d.ts +2 -0
- package/dist/package-builder.js +5 -2
- package/dist/package-builder.js.map +1 -1
- package/dist/server.d.ts +9 -1
- package/dist/server.js +145 -4
- package/dist/server.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<h1 align="center">Context</h1>
|
|
3
3
|
<p align="center">
|
|
4
|
-
<strong>
|
|
5
|
-
Give your AI assistant expert knowledge of any library—offline, instant, private.
|
|
4
|
+
<strong>Up-to-date docs for AI agents — local, instant, plug and play.</strong>
|
|
6
5
|
</p>
|
|
7
6
|
</p>
|
|
8
7
|
|
|
@@ -14,27 +13,23 @@
|
|
|
14
13
|
|
|
15
14
|
---
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
AI agents are trained on outdated docs. When libraries release new versions, your AI doesn't know — and confidently gives you wrong answers.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
```js
|
|
19
|
+
// Your AI, mass-trained on AI SDK v5 docs, will suggest:
|
|
20
|
+
import { Experimental_Agent as Agent, stepCountIs } from 'ai';
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
// But v6 changed the API entirely:
|
|
23
|
+
import { ToolLoopAgent } from 'ai';
|
|
24
|
+
```
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
The fix isn't better prompting. It's giving your AI the right docs.
|
|
24
27
|
|
|
25
|
-
##
|
|
28
|
+
## How It Works
|
|
26
29
|
|
|
27
|
-
Context
|
|
30
|
+
Context is an MCP server backed by a [community-driven package registry](registry/) with **100+ popular libraries** already built and ready to use. When your AI agent needs documentation, it searches the registry, downloads the right package, and queries it locally — all automatically.
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
You: "How do I create middleware in Next.js 16?"
|
|
31
|
-
|
|
32
|
-
AI: [automatically queries local docs]
|
|
33
|
-
"In Next.js 16, create a middleware.ts file in your project root..."
|
|
34
|
-
[accurate, version-specific answer]
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
No copy-pasting. No hallucinations about deprecated APIs. No waiting for cloud lookups.
|
|
32
|
+
**Install once. Configure once. Then just ask your AI.**
|
|
38
33
|
|
|
39
34
|
<p align="center">
|
|
40
35
|
<img src="https://media.githubusercontent.com/media/neuledge/context/main/packages/context/assets/ai-sdk-demo.gif" alt="Context demo" width="800">
|
|
@@ -42,72 +37,6 @@ No copy-pasting. No hallucinations about deprecated APIs. No waiting for cloud l
|
|
|
42
37
|
|
|
43
38
|
---
|
|
44
39
|
|
|
45
|
-
## Real-World Use Cases
|
|
46
|
-
|
|
47
|
-
### :muscle: "Make my AI actually useful for the stack I use"
|
|
48
|
-
|
|
49
|
-
Add docs for your entire tech stack. Your AI assistant becomes an expert in the exact versions you're using:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
context add https://github.com/vercel/next.js
|
|
53
|
-
context add https://github.com/prisma/prisma
|
|
54
|
-
context add https://github.com/tailwindlabs/tailwindcss
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Now ask things like:
|
|
58
|
-
- *"How do I set up Prisma with Next.js App Router?"*
|
|
59
|
-
- *"What's the Tailwind config for dark mode?"*
|
|
60
|
-
- *"Show me the new Server Actions syntax"*
|
|
61
|
-
|
|
62
|
-
### :building_construction: "Stop answering the same questions for my team"
|
|
63
|
-
|
|
64
|
-
Building an internal library? Package your documentation once, share it with your team:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Build docs from your repo
|
|
68
|
-
context add https://github.com/your-company/design-system
|
|
69
|
-
|
|
70
|
-
# Your whole team can now ask:
|
|
71
|
-
# "How do I use the DataTable component?"
|
|
72
|
-
# "What props does Button accept?"
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### :airplane: "Code on flights and in coffee shops"
|
|
76
|
-
|
|
77
|
-
Context works 100% offline. Download docs once, query forever—no internet required.
|
|
78
|
-
|
|
79
|
-
### :lock: "Keep proprietary code discussions private"
|
|
80
|
-
|
|
81
|
-
Cloud documentation services see your queries. Context runs entirely on your machine. Your questions about internal APIs stay internal.
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Why Context Over Cloud Alternatives?
|
|
86
|
-
|
|
87
|
-
| | Context7 | Deepcon | **Context** |
|
|
88
|
-
|---|:---:|:---:|:---:|
|
|
89
|
-
| **Price** | $10/month | $8/month | **Free forever** |
|
|
90
|
-
| **Free tier** | 1,000 req/month ¹ | 100 req/month | **Unlimited** |
|
|
91
|
-
| **Rate limits** | 60 req/hour | Throttled | **None** |
|
|
92
|
-
| **Latency** | 100-500ms | 100-300ms | **<10ms** |
|
|
93
|
-
| **Works offline** | :x: | :x: | :white_check_mark: |
|
|
94
|
-
| **Privacy** | Queries sent to cloud | Queries sent to cloud | **100% local** |
|
|
95
|
-
| **Private repos** | $15/1M tokens | :x: | **Free** |
|
|
96
|
-
|
|
97
|
-
<sub>¹ Context7 reduced free tier from ~6,000 to 1,000 requests/month in January 2026</sub>
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## :zap: Key Features
|
|
102
|
-
|
|
103
|
-
- **Single tool** - One MCP tool does everything, no multi-step lookups
|
|
104
|
-
- **Token-aware** - Smart relevance filtering, never overwhelms the context window
|
|
105
|
-
- **Dynamic schema** - Available libraries shown in tool definition
|
|
106
|
-
- **Offline-first** - Zero network calls during operation
|
|
107
|
-
- **SQLite + FTS5** - Fast full-text search with stemming
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
40
|
## :rocket: Quick Start
|
|
112
41
|
|
|
113
42
|
### 1. Install
|
|
@@ -116,28 +45,9 @@ Cloud documentation services see your queries. Context runs entirely on your mac
|
|
|
116
45
|
npm install -g @neuledge/context
|
|
117
46
|
```
|
|
118
47
|
|
|
119
|
-
### 2.
|
|
48
|
+
### 2. Connect to your AI agent
|
|
120
49
|
|
|
121
|
-
|
|
122
|
-
# From any git repository (GitHub, GitLab, Bitbucket, etc.)
|
|
123
|
-
context add https://github.com/vercel/next.js
|
|
124
|
-
context add https://gitlab.com/org/repo
|
|
125
|
-
context add git@github.com:user/repo.git
|
|
126
|
-
|
|
127
|
-
# From a local directory
|
|
128
|
-
context add ./my-project
|
|
129
|
-
context add /path/to/docs
|
|
130
|
-
|
|
131
|
-
# From URL (pre-built package)
|
|
132
|
-
context add https://example.com/react@18.db
|
|
133
|
-
|
|
134
|
-
# From local file
|
|
135
|
-
context add ./my-package.db
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 3. Configure your AI agent
|
|
139
|
-
|
|
140
|
-
Context works with any MCP-compatible agent. Choose your setup below:
|
|
50
|
+
Context works with any MCP-compatible agent. Pick yours:
|
|
141
51
|
|
|
142
52
|
<details>
|
|
143
53
|
<summary><strong>Claude Code</strong></summary>
|
|
@@ -274,21 +184,116 @@ extensions:
|
|
|
274
184
|
|
|
275
185
|
</details>
|
|
276
186
|
|
|
277
|
-
###
|
|
187
|
+
### 3. Ask your AI anything
|
|
278
188
|
|
|
279
|
-
That's it
|
|
189
|
+
That's it. Just ask:
|
|
280
190
|
|
|
281
191
|
> "How do I create middleware in Next.js?"
|
|
282
192
|
|
|
283
|
-
|
|
193
|
+
Your agent searches the [community registry](registry/), downloads the docs, and answers with accurate, version-specific information. Everything happens automatically — no manual `context install` needed for registry packages.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## The Community Registry
|
|
198
|
+
|
|
199
|
+
The registry is what makes Context plug and play. It's a growing collection of **100+ pre-built documentation packages** maintained by the community. Think of it like a package manager, but for AI-ready docs.
|
|
200
|
+
|
|
201
|
+
**Popular packages available today:**
|
|
202
|
+
|
|
203
|
+
| Category | Libraries |
|
|
204
|
+
|----------|-----------|
|
|
205
|
+
| **Frameworks** | Next.js, Nuxt, Astro, SvelteKit, Remix, Hono |
|
|
206
|
+
| **React ecosystem** | React, React Router, TanStack Query, Zustand, Redux Toolkit |
|
|
207
|
+
| **Databases & ORMs** | Prisma, Drizzle, Mongoose, TypeORM |
|
|
208
|
+
| **Styling** | Tailwind CSS, shadcn/ui, Styled Components |
|
|
209
|
+
| **Testing** | Vitest, Playwright, Jest, Testing Library |
|
|
210
|
+
| **APIs & Auth** | tRPC, GraphQL, NextAuth.js, Passport |
|
|
211
|
+
| **AI & LLMs** | LangChain, AI SDK, OpenAI, Anthropic SDK |
|
|
212
|
+
|
|
213
|
+
[Browse the full registry →](registry/)
|
|
214
|
+
|
|
215
|
+
**Anyone can contribute.** If a library you use isn't listed, [submit a PR](registry/) to add it — your contribution helps every Context user.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Why Local?
|
|
220
|
+
|
|
221
|
+
Context runs entirely on your machine. Docs are downloaded once and stored as compact SQLite databases in `~/.context/packages/`. After that, everything is local.
|
|
222
|
+
|
|
223
|
+
- **Fast** — Local SQLite queries return in under 10ms
|
|
224
|
+
- **Offline** — Works on flights, in coffee shops, anywhere
|
|
225
|
+
- **Private** — Your queries never leave your machine
|
|
226
|
+
- **Free** — No subscriptions, no rate limits, no usage caps
|
|
227
|
+
- **Reliable** — No outages, no API changes, no service shutdowns
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Beyond the Registry
|
|
232
|
+
|
|
233
|
+
The registry covers popular open-source libraries, but Context also works with any documentation source. Use `context add` to build packages from private repos, internal libraries, or anything not yet in the registry.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Build from a git repository
|
|
237
|
+
context add https://github.com/your-company/design-system
|
|
238
|
+
|
|
239
|
+
# Build from a local directory
|
|
240
|
+
context add ./my-project
|
|
241
|
+
|
|
242
|
+
# Specific version tag
|
|
243
|
+
context add https://github.com/vercel/next.js/tree/v16.0.0
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Once built, share packages with your team — they're portable `.db` files that install instantly:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Export a package
|
|
250
|
+
context add ./my-project --name my-lib --pkg-version 2.0 --save ./packages/
|
|
251
|
+
|
|
252
|
+
# Teammate installs it (no build step needed)
|
|
253
|
+
context add ./packages/my-lib@2.0.db
|
|
254
|
+
```
|
|
284
255
|
|
|
285
256
|
---
|
|
286
257
|
|
|
287
258
|
## :books: CLI Reference
|
|
288
259
|
|
|
260
|
+
### `context browse <package>`
|
|
261
|
+
|
|
262
|
+
Search for packages available on the registry server.
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Browse by registry/name
|
|
266
|
+
context browse npm/next
|
|
267
|
+
|
|
268
|
+
# Output:
|
|
269
|
+
# npm/next@15.1.3 3.4 MB The React Framework for the Web
|
|
270
|
+
# npm/next@15.0.4 3.2 MB The React Framework for the Web
|
|
271
|
+
# ...
|
|
272
|
+
#
|
|
273
|
+
# Found 12 versions. Install with: context install npm/next
|
|
274
|
+
|
|
275
|
+
# Browse with just a name (defaults to npm)
|
|
276
|
+
context browse react
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### `context install <registry/name> [version]`
|
|
280
|
+
|
|
281
|
+
Download and install a pre-built package from the registry server.
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# Install latest version
|
|
285
|
+
context install npm/next
|
|
286
|
+
|
|
287
|
+
# Install a specific version
|
|
288
|
+
context install npm/next 15.0.4
|
|
289
|
+
|
|
290
|
+
# Install from other registries
|
|
291
|
+
context install pip/django
|
|
292
|
+
```
|
|
293
|
+
|
|
289
294
|
### `context add <source>`
|
|
290
295
|
|
|
291
|
-
|
|
296
|
+
Build and install a documentation package from source. Use this for libraries not in the registry, or for private/internal docs. The source type is auto-detected.
|
|
292
297
|
|
|
293
298
|
**From git repository:**
|
|
294
299
|
|
|
@@ -401,7 +406,7 @@ context remove nextjs
|
|
|
401
406
|
|
|
402
407
|
### `context serve`
|
|
403
408
|
|
|
404
|
-
Start the MCP server (used by
|
|
409
|
+
Start the MCP server (used by AI agents).
|
|
405
410
|
|
|
406
411
|
```bash
|
|
407
412
|
context serve
|
|
@@ -420,57 +425,90 @@ context query 'nextjs@16.0' 'middleware authentication'
|
|
|
420
425
|
|
|
421
426
|
---
|
|
422
427
|
|
|
423
|
-
## :gear:
|
|
428
|
+
## :gear: Architecture
|
|
424
429
|
|
|
425
430
|
```
|
|
426
|
-
|
|
427
|
-
│
|
|
428
|
-
│
|
|
429
|
-
│ ┌──────────┐
|
|
430
|
-
│ │
|
|
431
|
-
│ │
|
|
432
|
-
│
|
|
433
|
-
│
|
|
434
|
-
│
|
|
435
|
-
│
|
|
436
|
-
│
|
|
437
|
-
│
|
|
438
|
-
|
|
439
|
-
|
|
431
|
+
┌─────────────────────────────────────────────────────────┐
|
|
432
|
+
│ Your Machine │
|
|
433
|
+
│ │
|
|
434
|
+
│ ┌──────────┐ ┌──────────────────┐ ┌────────────┐ │
|
|
435
|
+
│ │ AI │ │ Context MCP │ │ ~/.context │ │
|
|
436
|
+
│ │ Agent │───▶│ Server │───▶│ /packages │ │
|
|
437
|
+
│ │ │ │ │ └────────────┘ │
|
|
438
|
+
│ └──────────┘ └────────┬─────────┘ │ │
|
|
439
|
+
│ │ ┌──────────┐ │
|
|
440
|
+
│ │ │ SQLite │ │
|
|
441
|
+
│ │ │ FTS5 │ │
|
|
442
|
+
│ │ └──────────┘ │
|
|
443
|
+
└───────────────────────────┼─────────────────────────────┘
|
|
444
|
+
│ (first use only)
|
|
445
|
+
▼
|
|
446
|
+
┌────────────────┐
|
|
447
|
+
│ Community │
|
|
448
|
+
│ Registry │
|
|
449
|
+
└────────────────┘
|
|
440
450
|
```
|
|
441
451
|
|
|
442
|
-
**
|
|
452
|
+
**First time you ask about a library:**
|
|
453
|
+
1. The MCP server searches the community registry
|
|
454
|
+
2. Downloads the pre-built documentation package (a SQLite `.db` file)
|
|
455
|
+
3. Stores it locally in `~/.context/packages/`
|
|
443
456
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
457
|
+
**Every time after:**
|
|
458
|
+
1. FTS5 full-text search finds relevant sections locally
|
|
459
|
+
2. Smart filtering keeps results within token budget
|
|
460
|
+
3. Your AI gets focused, accurate documentation in under 10ms
|
|
448
461
|
|
|
449
|
-
|
|
462
|
+
---
|
|
450
463
|
|
|
451
|
-
|
|
452
|
-
2. Results are filtered by relevance score
|
|
453
|
-
3. Token budget ensures responses stay concise
|
|
454
|
-
4. Claude receives focused, relevant documentation
|
|
464
|
+
## :question: FAQ
|
|
455
465
|
|
|
456
|
-
|
|
466
|
+
### Can I use Context with non-JavaScript frameworks like Spring Boot, Django, or Rails?
|
|
467
|
+
|
|
468
|
+
**Yes!** Context is language-agnostic. It natively supports Markdown (`.md`, `.mdx`), AsciiDoc (`.adoc`), and reStructuredText (`.rst`) — no conversion needed.
|
|
457
469
|
|
|
458
|
-
|
|
470
|
+
```bash
|
|
471
|
+
# Python - FastAPI (Markdown)
|
|
472
|
+
context add https://github.com/fastapi/fastapi --path docs/en/docs
|
|
473
|
+
|
|
474
|
+
# Python - Django (reStructuredText)
|
|
475
|
+
context add https://github.com/django/django --path docs
|
|
459
476
|
|
|
460
|
-
|
|
477
|
+
# Java - Spring Boot (AsciiDoc)
|
|
478
|
+
context add https://github.com/spring-projects/spring-boot --path spring-boot-project/spring-boot-docs/src/docs
|
|
461
479
|
|
|
480
|
+
# Rust - The Rust Book
|
|
481
|
+
context add https://github.com/rust-lang/book --path src
|
|
462
482
|
```
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
483
|
+
|
|
484
|
+
Point Context at the docs folder with `--path` and it handles the rest.
|
|
485
|
+
|
|
486
|
+
### Can I contribute package definitions for new ecosystems?
|
|
487
|
+
|
|
488
|
+
Yes! The `registry/` directory has YAML definitions organized by package manager:
|
|
489
|
+
|
|
490
|
+
- **`registry/npm/`** — JavaScript/TypeScript (Next.js, React, Tailwind, etc.)
|
|
491
|
+
- **`registry/pip/`** — Python (FastAPI, Flask, Django, Pydantic)
|
|
492
|
+
- **`registry/maven/`** — Java (Spring Boot, JUnit, Micrometer)
|
|
493
|
+
|
|
494
|
+
To add a package, create a YAML file:
|
|
495
|
+
|
|
496
|
+
```yaml
|
|
497
|
+
# registry/pip/my-library.yaml
|
|
498
|
+
name: my-library
|
|
499
|
+
description: "Short description of the library"
|
|
500
|
+
repository: https://github.com/org/my-library
|
|
501
|
+
|
|
502
|
+
versions:
|
|
503
|
+
- min_version: "2.0.0"
|
|
504
|
+
source:
|
|
505
|
+
type: git
|
|
506
|
+
url: https://github.com/org/my-library
|
|
507
|
+
docs_path: docs
|
|
508
|
+
tag_pattern: "v{version}"
|
|
467
509
|
```
|
|
468
510
|
|
|
469
|
-
|
|
470
|
-
- Build from any git repository (GitHub, GitLab, Bitbucket, etc.)
|
|
471
|
-
- Build from local directories
|
|
472
|
-
- Download pre-built packages from URLs
|
|
473
|
-
- Share packages via releases or any file host
|
|
511
|
+
Version discovery is supported for npm, PyPI, and Maven Central. See existing definitions for examples.
|
|
474
512
|
|
|
475
513
|
---
|
|
476
514
|
|
package/dist/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build utilities for generating documentation packages.
|
|
3
|
-
* Parses markdown/MDX files and chunks them by section.
|
|
3
|
+
* Parses markdown/MDX, AsciiDoc, and reStructuredText files and chunks them by section.
|
|
4
4
|
*/
|
|
5
5
|
export interface DocFrontmatter {
|
|
6
6
|
title?: string;
|
|
@@ -23,3 +23,19 @@ export interface ParsedDoc {
|
|
|
23
23
|
* Parse a markdown/MDX file and extract sections.
|
|
24
24
|
*/
|
|
25
25
|
export declare function parseMarkdown(source: string, filePath: string): ParsedDoc;
|
|
26
|
+
/**
|
|
27
|
+
* Parse an AsciiDoc file and extract sections.
|
|
28
|
+
* Chunks on level-1 headings (== Heading), which are equivalent to markdown h2.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseAsciidoc(source: string, filePath: string): ParsedDoc;
|
|
31
|
+
/**
|
|
32
|
+
* Parse a reStructuredText file and extract sections.
|
|
33
|
+
* RST headings are text lines followed by underline characters (=, -, ~, ^, etc.).
|
|
34
|
+
* Chunks on the second heading level encountered (equivalent to markdown h2).
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseRestructuredText(source: string, filePath: string): ParsedDoc;
|
|
37
|
+
/**
|
|
38
|
+
* Parse a document file, auto-detecting format from file extension.
|
|
39
|
+
* Supports: Markdown (.md, .mdx, .qmd, .rmd), AsciiDoc (.adoc), reStructuredText (.rst)
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseDocument(source: string, filePath: string): ParsedDoc;
|