@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.
Files changed (2) hide show
  1. package/README.md +65 -70
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,106 +1,101 @@
1
- # @jmcombs/pi-EXTENSION_NAME
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
- > TODO: One-paragraph description of what this extension does and who it is
4
- > for. Mention the tools and/or commands it provides.
12
+ # @jmcombs/pi-context7
5
13
 
6
- ## Install
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
- ```bash
9
- # Globally (recommended)
10
- pi install npm:@jmcombs/pi-EXTENSION_NAME
16
+ ## Quick Start
11
17
 
12
- # For a single session, without installing
13
- pi -e npm:@jmcombs/pi-EXTENSION_NAME
14
- ```
18
+ Get better library documentation in your agent in under a minute.
15
19
 
16
- See the [Pi packages documentation](https://pi.dev/docs/packages) for git, local
17
- path, project-scoped install, and filtering options.
20
+ 1. Install the extension:
18
21
 
19
- ## What It Adds
22
+ ```bash
23
+ pi install @jmcombs/pi-context7
24
+ ```
20
25
 
21
- - **Tool**: `example_echo` — TODO: describe the tool, its parameters, and what
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
- ## Configuration
28
+ ```
29
+ /context7_onboard
30
+ ```
27
31
 
28
- <!-- Delete this section if your extension does not need any configuration. -->
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
- ### API Keys / Secrets
34
+ After setup, just ask the agent for documentation normally:
31
35
 
32
- If this extension calls a third-party service, store the credential using one
33
- of Pi's recommended auth storage methods. **Never** hard-code API keys or commit
34
- them to source control.
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
- #### Option 1 — Environment variable
40
+ The agent will automatically use the Context7 tools to fetch fresh, high-quality documentation and code snippets.
37
41
 
38
- ```bash
39
- export EXAMPLE_API_KEY="…"
40
- ```
42
+ ## How It Works
41
43
 
42
- #### Option 2 — `~/.pi/agent/auth.json`
44
+ This extension registers two tools:
43
45
 
44
- ```json
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
- #### Option 3 — Shell-resolved secret (macOS Keychain, 1Password, pass, etc.)
49
+ The tools support two authentication modes:
54
50
 
55
- ```json
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
- ```json
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
- The extension reads the key with:
56
+ ## /context7_onboard
74
57
 
75
- ```ts
76
- import { AuthStorage } from "@earendil-works/pi-coding-agent";
77
- const auth = AuthStorage.create();
78
- const apiKey = (await auth.getApiKey("example")) ?? process.env.EXAMPLE_API_KEY;
58
+ Run this command to securely configure your Context7 API key:
59
+
60
+ ```
61
+ /context7_onboard
79
62
  ```
80
63
 
81
- ## Requirements
64
+ It supports:
82
65
 
83
- - Pi `>= TODO: minimum tested pi version`
84
- - Node `>= 20.6.0`
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 # full quality gate
95
- npm run test # this package's smoke test
93
+ npm run check
94
+ npm run test -- --run packages/context7
96
95
  ```
97
96
 
98
- To try local changes against a real Pi session:
97
+ To test changes locally:
99
98
 
100
99
  ```bash
101
- pi -e ./packages/EXTENSION_NAME
100
+ pi -e ./packages/context7
102
101
  ```
103
-
104
- ## License
105
-
106
- [MIT](./LICENSE) © Jeremy Combs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmcombs/pi-context7",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "description": "Real-time documentation for the Pi coding agent via Context7.",
6
6
  "homepage": "https://github.com/jmcombs/pi-extensions/tree/main/packages/context7",