@jmcombs/pi-context7 0.1.0 → 0.1.1
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 +65 -70
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,106 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/jmcombs/pi-extensions/main/assets/context7/preview.png" width="250" alt="Context7 for Pi">
|
|
3
|
+
<br>
|
|
4
|
+
<a href="https://www.npmjs.com/package/@jmcombs/pi-context7"><img src="https://img.shields.io/npm/v/@jmcombs/pi-context7.svg" alt="npm version"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@jmcombs/pi-context7"><img src="https://img.shields.io/npm/dm/@jmcombs/pi-context7.svg" alt="npm downloads"></a>
|
|
6
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
7
|
+
<a href="https://github.com/jmcombs/pi-extensions/stargazers"><img src="https://img.shields.io/github/stars/jmcombs/pi-extensions?style=social" alt="GitHub stars"></a>
|
|
8
|
+
<a href="https://github.com/jmcombs/pi-extensions/issues"><img src="https://img.shields.io/github/issues/jmcombs/pi-extensions" alt="Open issues"></a>
|
|
9
|
+
<a href="https://github.com/sponsors/jmcombs"><img src="https://img.shields.io/badge/Sponsor-30363D?style=flat&logo=GitHub-Sponsors&logoColor=EA4AAA" alt="Sponsor"></a>
|
|
10
|
+
</div>
|
|
2
11
|
|
|
3
|
-
|
|
4
|
-
> for. Mention the tools and/or commands it provides.
|
|
12
|
+
# @jmcombs/pi-context7
|
|
5
13
|
|
|
6
|
-
|
|
14
|
+
Real-time documentation for the Pi coding agent via [Context7](https://context7.com). Gives the agent access to up-to-date, version-aware docs and code examples without polluting context with outdated information.
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
# Globally (recommended)
|
|
10
|
-
pi install npm:@jmcombs/pi-EXTENSION_NAME
|
|
16
|
+
## Quick Start
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
pi -e npm:@jmcombs/pi-EXTENSION_NAME
|
|
14
|
-
```
|
|
18
|
+
Get better library documentation in your agent in under a minute.
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
path, project-scoped install, and filtering options.
|
|
20
|
+
1. Install the extension:
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
```bash
|
|
23
|
+
pi install @jmcombs/pi-context7
|
|
24
|
+
```
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
the LLM uses it for.
|
|
23
|
-
- **Command**: `/example-hello [name]` — TODO: describe the command and any
|
|
24
|
-
arguments.
|
|
26
|
+
2. Configure your Context7 API key:
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
```
|
|
29
|
+
/context7_onboard
|
|
30
|
+
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
The command opens a clean, bordered prompt where you can securely enter your key. You can choose to save it permanently or use it only for the current session.
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
After setup, just ask the agent for documentation normally:
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
- "How do I set up Row Level Security in Supabase?"
|
|
37
|
+
- "Show me how to use server actions in Next.js 15"
|
|
38
|
+
- "What's the current recommended way to do authentication in tRPC?"
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
The agent will automatically use the Context7 tools to fetch fresh, high-quality documentation and code snippets.
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
export EXAMPLE_API_KEY="…"
|
|
40
|
-
```
|
|
42
|
+
## How It Works
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
This extension registers two tools:
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"example": {
|
|
47
|
-
"type": "api_key",
|
|
48
|
-
"key": "EXAMPLE_API_KEY"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
46
|
+
- `context7_search` — Finds the correct Context7 library ID for a programming language, framework, or library.
|
|
47
|
+
- `context7_get_docs` — Retrieves detailed, version-specific documentation and real code examples for that library.
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
The tools support two authentication modes:
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"example": {
|
|
58
|
-
"type": "api_key",
|
|
59
|
-
"key": "!security find-generic-password -ws 'example'"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
51
|
+
- **Persisted keys** — Saved via `/context7_onboard` into `~/.pi/agent/auth.json` (supports plain keys and `!op read` references).
|
|
52
|
+
- **Runtime-only keys** — Entered ad-hoc when a tool is called and kept only for the current session (also supports `!op read` references).
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
{
|
|
66
|
-
"example": {
|
|
67
|
-
"type": "api_key",
|
|
68
|
-
"key": "!op read 'op://Personal/example/credential'"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
54
|
+
This design lets you use Context7 without ever leaking keys into the LLM context.
|
|
72
55
|
|
|
73
|
-
|
|
56
|
+
## /context7_onboard
|
|
74
57
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
Run this command to securely configure your Context7 API key:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
/context7_onboard
|
|
79
62
|
```
|
|
80
63
|
|
|
81
|
-
|
|
64
|
+
It supports:
|
|
82
65
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
66
|
+
- Entering keys directly or via `!op read` references
|
|
67
|
+
- Overwriting an existing key (with confirmation)
|
|
68
|
+
- Choosing between permanent storage and runtime-only for the current session
|
|
69
|
+
|
|
70
|
+
The command never exposes the actual key to the model.
|
|
71
|
+
|
|
72
|
+
## After Setup
|
|
73
|
+
|
|
74
|
+
Just talk to the agent naturally. It will use Context7 automatically when it needs current documentation for a library.
|
|
75
|
+
|
|
76
|
+
Examples of good prompts:
|
|
77
|
+
|
|
78
|
+
- "Find the Context7 library for Prisma and show me how to do relations"
|
|
79
|
+
- "What's the recommended way to handle file uploads in Supabase right now?"
|
|
80
|
+
- "Give me examples of using the new React 19 use() hook"
|
|
81
|
+
|
|
82
|
+
## Checking Status
|
|
83
|
+
|
|
84
|
+
If you ever need to update or rotate your key, just run `/context7_onboard` again. It will detect the existing key and offer to overwrite it.
|
|
85
85
|
|
|
86
86
|
## Development
|
|
87
87
|
|
|
88
88
|
This package lives in the [pi-extensions monorepo](https://github.com/jmcombs/pi-extensions).
|
|
89
|
-
See `CONTRIBUTING.md` at the repo root for project conventions.
|
|
90
89
|
|
|
91
90
|
```bash
|
|
92
91
|
# From the repo root
|
|
93
92
|
npm ci
|
|
94
|
-
npm run check
|
|
95
|
-
npm run test
|
|
93
|
+
npm run check
|
|
94
|
+
npm run test -- --run packages/context7
|
|
96
95
|
```
|
|
97
96
|
|
|
98
|
-
To
|
|
97
|
+
To test changes locally:
|
|
99
98
|
|
|
100
99
|
```bash
|
|
101
|
-
pi -e ./packages/
|
|
100
|
+
pi -e ./packages/context7
|
|
102
101
|
```
|
|
103
|
-
|
|
104
|
-
## License
|
|
105
|
-
|
|
106
|
-
[MIT](./LICENSE) © Jeremy Combs
|
package/package.json
CHANGED