ctx7 0.4.3 → 0.4.5
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 +5 -137
- package/dist/index.js +90 -45
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# ctx7
|
|
2
2
|
|
|
3
|
-
CLI for [Context7](https://context7.com) - query up-to-date library documentation and
|
|
4
|
-
|
|
5
|
-
Skills are reusable prompt instructions that enhance your AI coding assistant with specialized capabilities like working with specific frameworks, libraries, or coding patterns.
|
|
3
|
+
CLI for [Context7](https://context7.com) - query up-to-date library documentation and configure Context7 for AI coding agents.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -41,22 +39,6 @@ ctx7 docs /facebook/react "useEffect cleanup"
|
|
|
41
39
|
ctx7 docs /vercel/next.js "middleware"
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
### Skills
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Search for skills
|
|
48
|
-
ctx7 skills search pdf
|
|
49
|
-
|
|
50
|
-
# Install a skill
|
|
51
|
-
ctx7 skills install /anthropics/skills pdf
|
|
52
|
-
|
|
53
|
-
# Generate a custom skill with AI
|
|
54
|
-
ctx7 skills generate
|
|
55
|
-
|
|
56
|
-
# List installed skills
|
|
57
|
-
ctx7 skills list --claude
|
|
58
|
-
```
|
|
59
|
-
|
|
60
42
|
## Usage
|
|
61
43
|
|
|
62
44
|
### Find a library
|
|
@@ -133,42 +115,9 @@ ctx7 remove --claude --mcp
|
|
|
133
115
|
|
|
134
116
|
If you installed the CLI itself globally with `npm install -g ctx7`, remove that separately with `npm uninstall -g ctx7`. If you use `npx ctx7`, there is no permanent CLI install to remove.
|
|
135
117
|
|
|
136
|
-
### Generate skills
|
|
137
|
-
|
|
138
|
-
Generate custom skills tailored to your use case using AI. Requires authentication.
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
# Log in first
|
|
142
|
-
ctx7 login
|
|
143
|
-
|
|
144
|
-
# Generate a skill (interactive)
|
|
145
|
-
ctx7 skills generate
|
|
146
|
-
|
|
147
|
-
# Short aliases
|
|
148
|
-
ctx7 skills gen
|
|
149
|
-
ctx7 skills g
|
|
150
|
-
|
|
151
|
-
# Generate and install to a specific client
|
|
152
|
-
ctx7 skills generate --cursor
|
|
153
|
-
ctx7 skills generate --claude
|
|
154
|
-
ctx7 skills generate --universal
|
|
155
|
-
|
|
156
|
-
# Generate globally
|
|
157
|
-
ctx7 skills generate --global
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
The generate flow:
|
|
161
|
-
|
|
162
|
-
1. Describe the expertise you want (e.g., "OAuth authentication with NextAuth.js")
|
|
163
|
-
2. Select relevant libraries from search results
|
|
164
|
-
3. Answer 3 clarifying questions to focus the skill
|
|
165
|
-
4. Review the generated skill, request changes if needed, then install
|
|
166
|
-
|
|
167
|
-
Weekly generation limits apply: free accounts get 6 generations/week, Pro accounts get 10.
|
|
168
|
-
|
|
169
118
|
### Authentication
|
|
170
119
|
|
|
171
|
-
Log in to access
|
|
120
|
+
Log in to access authenticated setup and higher documentation rate limits.
|
|
172
121
|
|
|
173
122
|
```bash
|
|
174
123
|
# Log in (opens browser for OAuth)
|
|
@@ -181,79 +130,9 @@ ctx7 whoami
|
|
|
181
130
|
ctx7 logout
|
|
182
131
|
```
|
|
183
132
|
|
|
184
|
-
### Install skills
|
|
185
|
-
|
|
186
|
-
Install skills from a project repository to your AI coding assistant's skills directory.
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# Install all skills from a project (interactive selection)
|
|
190
|
-
ctx7 skills install /anthropics/skills
|
|
191
|
-
|
|
192
|
-
# Install a specific skill
|
|
193
|
-
ctx7 skills install /anthropics/skills pdf
|
|
194
|
-
|
|
195
|
-
# Install multiple skills at once
|
|
196
|
-
ctx7 skills install /anthropics/skills pdf commit
|
|
197
|
-
|
|
198
|
-
# Install to a specific client
|
|
199
|
-
ctx7 skills install /anthropics/skills pdf --cursor
|
|
200
|
-
ctx7 skills install /anthropics/skills pdf --claude
|
|
201
|
-
ctx7 skills install /anthropics/skills pdf --universal
|
|
202
|
-
|
|
203
|
-
# Install globally (home directory instead of current project)
|
|
204
|
-
ctx7 skills install /anthropics/skills pdf --global
|
|
205
|
-
|
|
206
|
-
# Install non-interactively
|
|
207
|
-
ctx7 skills install /anthropics/skills pdf --global --universal --yes
|
|
208
|
-
|
|
209
|
-
# Install to all supported agent locations
|
|
210
|
-
ctx7 skills install /anthropics/skills pdf --all-agents
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Search for skills
|
|
214
|
-
|
|
215
|
-
Find skills across all indexed projects in the registry.
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
ctx7 skills search pdf
|
|
219
|
-
ctx7 skills search typescript
|
|
220
|
-
ctx7 skills search react testing
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### List installed skills
|
|
224
|
-
|
|
225
|
-
View skills installed in your project or globally.
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
ctx7 skills list
|
|
229
|
-
ctx7 skills list --claude
|
|
230
|
-
ctx7 skills list --cursor
|
|
231
|
-
ctx7 skills list --universal
|
|
232
|
-
ctx7 skills list --global
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Show skill information
|
|
236
|
-
|
|
237
|
-
Get details about available skills in a project.
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
ctx7 skills info /anthropics/skills
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Remove a skill
|
|
244
|
-
|
|
245
|
-
Uninstall a skill from your project.
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
ctx7 skills remove pdf
|
|
249
|
-
ctx7 skills remove pdf --claude
|
|
250
|
-
ctx7 skills remove pdf --universal
|
|
251
|
-
ctx7 skills remove pdf --global
|
|
252
|
-
```
|
|
253
|
-
|
|
254
133
|
## Supported Clients
|
|
255
134
|
|
|
256
|
-
The CLI automatically detects which AI coding assistants you have installed and
|
|
135
|
+
The CLI automatically detects which AI coding assistants you have installed and configures Context7 for them:
|
|
257
136
|
|
|
258
137
|
| Client | Skills Directory |
|
|
259
138
|
| ------------------------------------------------------------------- | ----------------- |
|
|
@@ -262,24 +141,13 @@ The CLI automatically detects which AI coding assistants you have installed and
|
|
|
262
141
|
| Cursor | `.cursor/skills/` |
|
|
263
142
|
| Antigravity | `.agent/skills/` |
|
|
264
143
|
|
|
265
|
-
## Shortcuts
|
|
266
|
-
|
|
267
|
-
For faster usage, the CLI provides short aliases:
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
ctx7 si /anthropics/skills pdf # skills install
|
|
271
|
-
ctx7 ss pdf # skills search
|
|
272
|
-
ctx7 skills gen # skills generate
|
|
273
|
-
ctx7 skills g # skills generate
|
|
274
|
-
```
|
|
275
|
-
|
|
276
144
|
## Disabling Telemetry
|
|
277
145
|
|
|
278
146
|
The CLI collects anonymous usage data to help improve the product. To disable telemetry, set the `CTX7_TELEMETRY_DISABLED` environment variable:
|
|
279
147
|
|
|
280
148
|
```bash
|
|
281
149
|
# For a single command
|
|
282
|
-
CTX7_TELEMETRY_DISABLED=1 ctx7
|
|
150
|
+
CTX7_TELEMETRY_DISABLED=1 ctx7 docs /facebook/react "useEffect examples"
|
|
283
151
|
|
|
284
152
|
# Or export in your shell profile (~/.bashrc, ~/.zshrc, etc.)
|
|
285
153
|
export CTX7_TELEMETRY_DISABLED=1
|
|
@@ -287,4 +155,4 @@ export CTX7_TELEMETRY_DISABLED=1
|
|
|
287
155
|
|
|
288
156
|
## Learn More
|
|
289
157
|
|
|
290
|
-
Visit [context7.com](https://context7.com)
|
|
158
|
+
Visit [context7.com](https://context7.com) for documentation lookup and setup guides.
|
package/dist/index.js
CHANGED
|
@@ -1911,6 +1911,11 @@ async function detectProjectDependencies(cwd) {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
1913
|
// src/commands/skill.ts
|
|
1914
|
+
var SKILL_HUB_DEPRECATION_WARNING = "Warning: Skill commands are deprecated and will stop working in the next major release.";
|
|
1915
|
+
function warnSkillHubDeprecated() {
|
|
1916
|
+
console.error(pc7.yellow(SKILL_HUB_DEPRECATION_WARNING));
|
|
1917
|
+
console.error("");
|
|
1918
|
+
}
|
|
1914
1919
|
function logInstallSummary(targets, targetDirs, skillNames) {
|
|
1915
1920
|
log.blank();
|
|
1916
1921
|
const hasUniversal = targets.ides.some((ide) => ide === "universal");
|
|
@@ -1934,7 +1939,9 @@ function logInstallSummary(targets, targetDirs, skillNames) {
|
|
|
1934
1939
|
log.blank();
|
|
1935
1940
|
}
|
|
1936
1941
|
function registerSkillCommands(program2) {
|
|
1937
|
-
const skill = program2.command("skills").alias("skill").description("Manage AI coding skills")
|
|
1942
|
+
const skill = program2.command("skills", { hidden: true }).alias("skill").description("Manage AI coding skills").hook("preAction", () => {
|
|
1943
|
+
warnSkillHubDeprecated();
|
|
1944
|
+
});
|
|
1938
1945
|
registerGenerateCommand(skill);
|
|
1939
1946
|
skill.command("install").alias("i").alias("add").argument("<repository>", "GitHub repository (/owner/repo)").argument("[skill]", "Specific skill name to install").option("--all", "Install all skills without prompting").option("--all-agents", "Install to all supported agent locations").option("-y, --yes", "Skip confirmation prompts").option("--global", "Install globally instead of current directory").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("Install skills from a repository").action(async (project, skillName, options) => {
|
|
1940
1947
|
await installCommand(project, skillName, options);
|
|
@@ -1942,7 +1949,7 @@ function registerSkillCommands(program2) {
|
|
|
1942
1949
|
skill.command("search").alias("s").argument("<keywords...>", "Search keywords").description("Search for skills across all indexed repositories").action(async (keywords) => {
|
|
1943
1950
|
await searchCommand(keywords.join(" "));
|
|
1944
1951
|
});
|
|
1945
|
-
skill.command("list").alias("ls").option("--global", "List global skills").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("List installed skills").action(async (options) => {
|
|
1952
|
+
skill.command("list").alias("ls").option("--json", "Output as JSON").option("--global", "List global skills").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("List installed skills").action(async (options) => {
|
|
1946
1953
|
await listCommand(options);
|
|
1947
1954
|
});
|
|
1948
1955
|
skill.command("remove").alias("rm").alias("delete").argument("<name>", "Skill name to remove").option("--global", "Remove from global skills").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("Remove an installed skill").action(async (name, options) => {
|
|
@@ -1957,12 +1964,15 @@ function registerSkillCommands(program2) {
|
|
|
1957
1964
|
}
|
|
1958
1965
|
function registerSkillAliases(program2) {
|
|
1959
1966
|
program2.command("si", { hidden: true }).argument("<repository>", "GitHub repository (/owner/repo)").argument("[skill]", "Specific skill name to install").option("--all", "Install all skills without prompting").option("--all-agents", "Install to all supported agent locations").option("-y, --yes", "Skip confirmation prompts").option("--global", "Install globally instead of current directory").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("Install skills (alias for: skills install)").action(async (project, skillName, options) => {
|
|
1967
|
+
warnSkillHubDeprecated();
|
|
1960
1968
|
await installCommand(project, skillName, options);
|
|
1961
1969
|
});
|
|
1962
1970
|
program2.command("ss", { hidden: true }).argument("<keywords...>", "Search keywords").description("Search for skills (alias for: skills search)").action(async (keywords) => {
|
|
1971
|
+
warnSkillHubDeprecated();
|
|
1963
1972
|
await searchCommand(keywords.join(" "));
|
|
1964
1973
|
});
|
|
1965
1974
|
program2.command("ssg", { hidden: true }).option("--global", "Install globally instead of current directory").option("--claude", "Claude Code (.claude/skills/)").option("--cursor", "Cursor (.cursor/skills/)").option("--universal", "Universal (.agents/skills/)").option("--antigravity", "Antigravity (.agent/skills/)").description("Suggest skills (alias for: skills suggest)").action(async (options) => {
|
|
1975
|
+
warnSkillHubDeprecated();
|
|
1966
1976
|
await suggestCommand(options);
|
|
1967
1977
|
});
|
|
1968
1978
|
}
|
|
@@ -2053,7 +2063,7 @@ async function installCommand(input2, skillName, options) {
|
|
|
2053
2063
|
const paddedName = s.name.padEnd(maxNameLen);
|
|
2054
2064
|
const popularity = formatPopularity(s.installCount) + " ".repeat(popularityColWidth - 4);
|
|
2055
2065
|
const trust = formatTrust(s.trustScore);
|
|
2056
|
-
const skillUrl = `https://
|
|
2066
|
+
const skillUrl = s.url || `https://github.com${s.project}`;
|
|
2057
2067
|
const skillLink = terminalLink(s.name, skillUrl, pc7.white);
|
|
2058
2068
|
const repoLink = terminalLink(s.project, `https://github.com${s.project}`, pc7.white);
|
|
2059
2069
|
const metadataLines = [
|
|
@@ -2204,11 +2214,7 @@ async function searchCommand(query) {
|
|
|
2204
2214
|
const displayName = nameWithRepo(s) + " ".repeat(maxNameLen - rawLen);
|
|
2205
2215
|
const popularity = formatPopularity(s.installCount) + " ".repeat(popularityColWidth - 4);
|
|
2206
2216
|
const trust = formatTrust(s.trustScore);
|
|
2207
|
-
const skillLink = terminalLink(
|
|
2208
|
-
s.name,
|
|
2209
|
-
`https://context7.com/skills${s.project}/${s.name}`,
|
|
2210
|
-
pc7.white
|
|
2211
|
-
);
|
|
2217
|
+
const skillLink = terminalLink(s.name, s.url || `https://github.com${s.project}`, pc7.white);
|
|
2212
2218
|
const repoLink = terminalLink(s.project, `https://github.com${s.project}`, pc7.white);
|
|
2213
2219
|
const metadataLines = [
|
|
2214
2220
|
pc7.dim("\u2500".repeat(50)),
|
|
@@ -2344,7 +2350,7 @@ async function listCommand(options) {
|
|
|
2344
2350
|
const label = ide === "universal" ? UNIVERSAL_AGENTS_LABEL : IDE_NAMES[ide];
|
|
2345
2351
|
const skills = await scanDir(dir);
|
|
2346
2352
|
if (skills.length > 0) {
|
|
2347
|
-
results.push({ label,
|
|
2353
|
+
results.push({ label, displayPath: dir, dir, source: ide, skills });
|
|
2348
2354
|
}
|
|
2349
2355
|
}
|
|
2350
2356
|
} else {
|
|
@@ -2352,24 +2358,47 @@ async function listCommand(options) {
|
|
|
2352
2358
|
const universalDir = join6(baseDir, universalPath);
|
|
2353
2359
|
const universalSkills = await scanDir(universalDir);
|
|
2354
2360
|
if (universalSkills.length > 0) {
|
|
2355
|
-
results.push({
|
|
2361
|
+
results.push({
|
|
2362
|
+
label: UNIVERSAL_AGENTS_LABEL,
|
|
2363
|
+
displayPath: universalPath,
|
|
2364
|
+
dir: universalDir,
|
|
2365
|
+
source: "universal",
|
|
2366
|
+
skills: universalSkills
|
|
2367
|
+
});
|
|
2356
2368
|
}
|
|
2357
2369
|
for (const ide of VENDOR_SPECIFIC_AGENTS) {
|
|
2358
2370
|
const pathMap = scope === "global" ? IDE_GLOBAL_PATHS : IDE_PATHS;
|
|
2359
2371
|
const dir = join6(baseDir, pathMap[ide]);
|
|
2360
2372
|
const skills = await scanDir(dir);
|
|
2361
2373
|
if (skills.length > 0) {
|
|
2362
|
-
results.push({
|
|
2374
|
+
results.push({
|
|
2375
|
+
label: IDE_NAMES[ide],
|
|
2376
|
+
displayPath: pathMap[ide],
|
|
2377
|
+
dir,
|
|
2378
|
+
source: ide,
|
|
2379
|
+
skills
|
|
2380
|
+
});
|
|
2363
2381
|
}
|
|
2364
2382
|
}
|
|
2365
2383
|
}
|
|
2384
|
+
if (options.json) {
|
|
2385
|
+
const skills = results.flatMap(
|
|
2386
|
+
(result) => result.skills.map((name) => ({
|
|
2387
|
+
name,
|
|
2388
|
+
path: join6(result.dir, name),
|
|
2389
|
+
source: result.source
|
|
2390
|
+
}))
|
|
2391
|
+
);
|
|
2392
|
+
console.log(JSON.stringify({ skills }, null, 2));
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2366
2395
|
if (results.length === 0) {
|
|
2367
2396
|
log.warn("No skills installed");
|
|
2368
2397
|
return;
|
|
2369
2398
|
}
|
|
2370
2399
|
log.blank();
|
|
2371
|
-
for (const { label,
|
|
2372
|
-
log.plain(`${pc7.bold(label)} ${pc7.dim(
|
|
2400
|
+
for (const { label, displayPath, skills } of results) {
|
|
2401
|
+
log.plain(`${pc7.bold(label)} ${pc7.dim(displayPath)}`);
|
|
2373
2402
|
for (const skill of skills) {
|
|
2374
2403
|
log.plain(` ${pc7.green(skill)}`);
|
|
2375
2404
|
}
|
|
@@ -2490,11 +2519,7 @@ async function suggestCommand(options) {
|
|
|
2490
2519
|
const trustLabel = getTrustLabel(s.trustScore);
|
|
2491
2520
|
const trust = formatTrust(s.trustScore) + " ".repeat(trustColWidth - trustLabel.length);
|
|
2492
2521
|
const matched = pc7.yellow(s.matchedDep.padEnd(maxMatchedLen));
|
|
2493
|
-
const skillLink = terminalLink(
|
|
2494
|
-
s.name,
|
|
2495
|
-
`https://context7.com/skills${s.project}/${s.name}`,
|
|
2496
|
-
pc7.white
|
|
2497
|
-
);
|
|
2522
|
+
const skillLink = terminalLink(s.name, s.url || `https://github.com${s.project}`, pc7.white);
|
|
2498
2523
|
const repoLink = terminalLink(s.project, `https://github.com${s.project}`, pc7.white);
|
|
2499
2524
|
const metadataLines = [
|
|
2500
2525
|
pc7.dim("\u2500".repeat(50)),
|
|
@@ -2628,6 +2653,7 @@ var SETUP_AGENT_NAMES = {
|
|
|
2628
2653
|
cursor: "Cursor",
|
|
2629
2654
|
opencode: "OpenCode",
|
|
2630
2655
|
codex: "Codex",
|
|
2656
|
+
antigravity: "Antigravity",
|
|
2631
2657
|
gemini: "Gemini CLI"
|
|
2632
2658
|
};
|
|
2633
2659
|
var AUTH_MODE_LABELS = {
|
|
@@ -2766,6 +2792,33 @@ var agents = {
|
|
|
2766
2792
|
globalPaths: [join7(homedir5(), ".codex")]
|
|
2767
2793
|
}
|
|
2768
2794
|
},
|
|
2795
|
+
// Antigravity is built on Gemini infrastructure and shares ~/.gemini/. Per
|
|
2796
|
+
// the official Codelabs guide, Antigravity 2.0/IDE/CLI read MCP servers from
|
|
2797
|
+
// ~/.gemini/config/mcp_config.json globally; there is no project-level MCP
|
|
2798
|
+
// config, so projectPaths is empty and setupAgent falls back to global.
|
|
2799
|
+
antigravity: {
|
|
2800
|
+
name: "antigravity",
|
|
2801
|
+
displayName: "Antigravity",
|
|
2802
|
+
mcp: {
|
|
2803
|
+
projectPaths: [],
|
|
2804
|
+
globalPaths: [join7(homedir5(), ".gemini", "config", "mcp_config.json")],
|
|
2805
|
+
configKey: "mcpServers",
|
|
2806
|
+
buildEntry: (auth, transport) => transport === "stdio" ? stdioEntry(auth) : withHeaders({ serverUrl: mcpUrl(auth) }, auth)
|
|
2807
|
+
},
|
|
2808
|
+
rule: {
|
|
2809
|
+
kind: "append",
|
|
2810
|
+
file: (scope) => scope === "global" ? join7(homedir5(), ".gemini", "GEMINI.md") : "GEMINI.md",
|
|
2811
|
+
sectionMarker: "<!-- context7 -->"
|
|
2812
|
+
},
|
|
2813
|
+
skill: {
|
|
2814
|
+
name: "context7-mcp",
|
|
2815
|
+
dir: (scope) => scope === "global" ? join7(homedir5(), ".agent", "skills") : join7(".agent", "skills")
|
|
2816
|
+
},
|
|
2817
|
+
detect: {
|
|
2818
|
+
projectPaths: [".agent"],
|
|
2819
|
+
globalPaths: [join7(homedir5(), ".gemini", "antigravity"), join7(homedir5(), ".agent")]
|
|
2820
|
+
}
|
|
2821
|
+
},
|
|
2769
2822
|
gemini: {
|
|
2770
2823
|
name: "gemini",
|
|
2771
2824
|
displayName: "Gemini CLI",
|
|
@@ -3164,11 +3217,12 @@ function getSelectedAgents(options) {
|
|
|
3164
3217
|
if (options.cursor) agents2.push("cursor");
|
|
3165
3218
|
if (options.opencode) agents2.push("opencode");
|
|
3166
3219
|
if (options.codex) agents2.push("codex");
|
|
3220
|
+
if (options.antigravity) agents2.push("antigravity");
|
|
3167
3221
|
if (options.gemini) agents2.push("gemini");
|
|
3168
3222
|
return agents2;
|
|
3169
3223
|
}
|
|
3170
3224
|
function registerSetupCommand(program2) {
|
|
3171
|
-
program2.command("setup").description("Set up Context7 for your AI coding agent").option("--claude", "Set up for Claude Code").option("--cursor", "Set up for Cursor").option("--
|
|
3225
|
+
program2.command("setup").description("Set up Context7 for your AI coding agent").option("--claude", "Set up for Claude Code").option("--cursor", "Set up for Cursor").option("--antigravity", "Set up for Antigravity (.agent/skills)").option("--opencode", "Set up for OpenCode").option("--codex", "Set up for Codex").option("--gemini", "Set up for Gemini CLI").option("--mcp", "Set up MCP server mode").option("--cli", "Set up CLI + Skills mode (no MCP server)").option("-p, --project", "Configure for current project instead of globally").option("-y, --yes", "Skip confirmation prompts").option("--api-key <key>", "Use API key authentication").option("--oauth", "Use OAuth endpoint (IDE handles auth flow)").option("--stdio", "Configure the MCP server as a local stdio process (default: HTTP)").action(async (options) => {
|
|
3172
3226
|
await setupCommand(options);
|
|
3173
3227
|
});
|
|
3174
3228
|
}
|
|
@@ -3209,7 +3263,7 @@ async function resolveAuth(options) {
|
|
|
3209
3263
|
}
|
|
3210
3264
|
async function resolveMode(options) {
|
|
3211
3265
|
if (options.cli) return "cli";
|
|
3212
|
-
if (options.mcp || options.yes || options.oauth || options.
|
|
3266
|
+
if (options.mcp || options.yes || options.oauth || options.stdio) return "mcp";
|
|
3213
3267
|
return select3({
|
|
3214
3268
|
message: "How should your agent access Context7?",
|
|
3215
3269
|
choices: [
|
|
@@ -3320,7 +3374,7 @@ function resolveEntryToWrite(agent, auth, transport, existingEntry) {
|
|
|
3320
3374
|
}
|
|
3321
3375
|
async function setupAgent(agentName, auth, transport, scope) {
|
|
3322
3376
|
const agent = getAgent(agentName);
|
|
3323
|
-
const mcpCandidates = scope === "global" ? agent.mcp.globalPaths : agent.mcp.projectPaths.map((p) => join8(process.cwd(), p));
|
|
3377
|
+
const mcpCandidates = scope === "global" || agent.mcp.projectPaths.length === 0 ? agent.mcp.globalPaths : agent.mcp.projectPaths.map((p) => join8(process.cwd(), p));
|
|
3324
3378
|
const mcpPath = await resolveMcpPath(mcpCandidates);
|
|
3325
3379
|
let mcpStatus;
|
|
3326
3380
|
try {
|
|
@@ -3522,7 +3576,7 @@ var MODE_LABELS = {
|
|
|
3522
3576
|
cli: "CLI + Skills"
|
|
3523
3577
|
};
|
|
3524
3578
|
function registerRemoveCommand(program2) {
|
|
3525
|
-
program2.command("remove").alias("uninstall").description("Remove Context7 setup from your AI coding agent").option("--claude", "Remove from Claude Code").option("--cursor", "Remove from Cursor").option("--opencode", "Remove from OpenCode").option("--codex", "Remove from Codex").option("--gemini", "Remove from Gemini CLI").option("--all", "Remove both MCP setup and CLI + Skills setup").option("--mcp", "Remove MCP setup").option("--cli", "Remove CLI + Skills setup").option("-p, --project", "Remove from the current project instead of global config").option("-y, --yes", "Skip confirmation prompts").action(async (options) => {
|
|
3579
|
+
program2.command("remove").alias("uninstall").description("Remove Context7 setup from your AI coding agent").option("--claude", "Remove from Claude Code").option("--cursor", "Remove from Cursor").option("--opencode", "Remove from OpenCode").option("--codex", "Remove from Codex").option("--antigravity", "Remove from Antigravity").option("--gemini", "Remove from Gemini CLI").option("--all", "Remove both MCP setup and CLI + Skills setup").option("--mcp", "Remove MCP setup").option("--cli", "Remove CLI + Skills setup").option("-p, --project", "Remove from the current project instead of global config").option("-y, --yes", "Skip confirmation prompts").action(async (options) => {
|
|
3526
3580
|
await removeCommand2(options);
|
|
3527
3581
|
});
|
|
3528
3582
|
}
|
|
@@ -3532,6 +3586,7 @@ function getSelectedAgents2(options) {
|
|
|
3532
3586
|
if (options.cursor) agents2.push("cursor");
|
|
3533
3587
|
if (options.opencode) agents2.push("opencode");
|
|
3534
3588
|
if (options.codex) agents2.push("codex");
|
|
3589
|
+
if (options.antigravity) agents2.push("antigravity");
|
|
3535
3590
|
if (options.gemini) agents2.push("gemini");
|
|
3536
3591
|
return agents2;
|
|
3537
3592
|
}
|
|
@@ -3583,7 +3638,7 @@ async function resolveAgents2(options, scope) {
|
|
|
3583
3638
|
if (detected.length > 0 && options.yes) return detected;
|
|
3584
3639
|
if (detected.length === 0) {
|
|
3585
3640
|
log.warn(
|
|
3586
|
-
"No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, or --gemini."
|
|
3641
|
+
"No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, --antigravity, or --gemini."
|
|
3587
3642
|
);
|
|
3588
3643
|
return [];
|
|
3589
3644
|
}
|
|
@@ -3612,6 +3667,7 @@ async function pathExists2(path2) {
|
|
|
3612
3667
|
}
|
|
3613
3668
|
async function hasMcpConfig(agentName, scope) {
|
|
3614
3669
|
const agent = getAgent(agentName);
|
|
3670
|
+
if (scope === "project" && agent.mcp.projectPaths.length === 0) return false;
|
|
3615
3671
|
const candidates = scope === "global" ? agent.mcp.globalPaths : agent.mcp.projectPaths.map((path2) => join9(process.cwd(), path2));
|
|
3616
3672
|
const mcpPath = await resolveMcpPath(candidates);
|
|
3617
3673
|
if (mcpPath.endsWith(".toml")) {
|
|
@@ -3699,6 +3755,9 @@ async function resolveModes(options, agents2, scope) {
|
|
|
3699
3755
|
}
|
|
3700
3756
|
async function uninstallMcp(agentName, scope) {
|
|
3701
3757
|
const agent = getAgent(agentName);
|
|
3758
|
+
if (scope === "project" && agent.mcp.projectPaths.length === 0) {
|
|
3759
|
+
return { status: "not found", path: "" };
|
|
3760
|
+
}
|
|
3702
3761
|
const mcpCandidates = scope === "global" ? agent.mcp.globalPaths : agent.mcp.projectPaths.map((path2) => join9(process.cwd(), path2));
|
|
3703
3762
|
const mcpPath = await resolveMcpPath(mcpCandidates);
|
|
3704
3763
|
try {
|
|
@@ -4341,7 +4400,7 @@ var brand = {
|
|
|
4341
4400
|
dim: pc12.dim
|
|
4342
4401
|
};
|
|
4343
4402
|
var program = new Command();
|
|
4344
|
-
program.name("ctx7").description("Context7 CLI -
|
|
4403
|
+
program.name("ctx7").description("Context7 CLI - Fetch documentation context and configure Context7").version(VERSION).option("--base-url <url>").hook("preAction", (thisCommand) => {
|
|
4345
4404
|
const opts = thisCommand.opts();
|
|
4346
4405
|
if (opts.baseUrl) {
|
|
4347
4406
|
setBaseUrl(opts.baseUrl);
|
|
@@ -4356,21 +4415,10 @@ program.name("ctx7").description("Context7 CLI - Manage AI coding skills and doc
|
|
|
4356
4415
|
"after",
|
|
4357
4416
|
`
|
|
4358
4417
|
Examples:
|
|
4359
|
-
${brand.dim("#
|
|
4360
|
-
${brand.primary("npx ctx7
|
|
4361
|
-
${brand.primary("npx ctx7
|
|
4362
|
-
|
|
4363
|
-
${brand.dim("# Install from a repository")}
|
|
4364
|
-
${brand.primary("npx ctx7 skills install /anthropics/skills")}
|
|
4365
|
-
${brand.primary("npx ctx7 skills install /anthropics/skills pdf")}
|
|
4366
|
-
|
|
4367
|
-
${brand.dim("# Install to specific client")}
|
|
4368
|
-
${brand.primary("npx ctx7 skills install /anthropics/skills --cursor")}
|
|
4369
|
-
${brand.primary("npx ctx7 skills install /anthropics/skills --global")}
|
|
4370
|
-
|
|
4371
|
-
${brand.dim("# List and manage installed skills")}
|
|
4372
|
-
${brand.primary("npx ctx7 skills list --claude")}
|
|
4373
|
-
${brand.primary("npx ctx7 skills remove pdf")}
|
|
4418
|
+
${brand.dim("# Configure Context7 for your coding agent")}
|
|
4419
|
+
${brand.primary("npx ctx7 setup")}
|
|
4420
|
+
${brand.primary("npx ctx7 setup --mcp")}
|
|
4421
|
+
${brand.primary("npx ctx7 setup --cli")}
|
|
4374
4422
|
|
|
4375
4423
|
${brand.dim("# Remove Context7 setup")}
|
|
4376
4424
|
${brand.primary("npx ctx7 remove --cursor")}
|
|
@@ -4381,8 +4429,6 @@ Examples:
|
|
|
4381
4429
|
${brand.dim("# Query library documentation")}
|
|
4382
4430
|
${brand.primary('npx ctx7 library react "how to use hooks"')}
|
|
4383
4431
|
${brand.primary('npx ctx7 docs /facebook/react "useEffect examples"')}
|
|
4384
|
-
|
|
4385
|
-
Visit ${brand.primary("https://context7.com")} to browse skills
|
|
4386
4432
|
`
|
|
4387
4433
|
);
|
|
4388
4434
|
registerSkillCommands(program);
|
|
@@ -4396,14 +4442,13 @@ program.action(() => {
|
|
|
4396
4442
|
console.log("");
|
|
4397
4443
|
const banner = figlet.textSync("Context7", { font: "ANSI Shadow" });
|
|
4398
4444
|
console.log(brand.primary(banner));
|
|
4399
|
-
console.log(brand.dim("
|
|
4445
|
+
console.log(brand.dim(" Documentation context for AI coding agents"));
|
|
4400
4446
|
console.log("");
|
|
4401
4447
|
console.log(" Quick start:");
|
|
4402
|
-
console.log(` ${brand.primary("npx ctx7
|
|
4403
|
-
console.log(` ${brand.primary(
|
|
4448
|
+
console.log(` ${brand.primary("npx ctx7 setup")}`);
|
|
4449
|
+
console.log(` ${brand.primary('npx ctx7 docs /facebook/react "useEffect examples"')}`);
|
|
4404
4450
|
console.log("");
|
|
4405
4451
|
console.log(` Run ${brand.primary("npx ctx7 --help")} for all commands and options`);
|
|
4406
|
-
console.log(` Visit ${brand.primary("https://context7.com")} to browse skills`);
|
|
4407
4452
|
console.log("");
|
|
4408
4453
|
});
|
|
4409
4454
|
await program.parseAsync();
|