ctx7 0.3.10 → 0.3.12
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 +6 -0
- package/dist/index.js +41 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -177,6 +177,12 @@ ctx7 skills install /anthropics/skills pdf --universal
|
|
|
177
177
|
|
|
178
178
|
# Install globally (home directory instead of current project)
|
|
179
179
|
ctx7 skills install /anthropics/skills pdf --global
|
|
180
|
+
|
|
181
|
+
# Install non-interactively
|
|
182
|
+
ctx7 skills install /anthropics/skills pdf --global --universal --yes
|
|
183
|
+
|
|
184
|
+
# Install to all supported agent locations
|
|
185
|
+
ctx7 skills install /anthropics/skills pdf --all-agents
|
|
180
186
|
```
|
|
181
187
|
|
|
182
188
|
### Search for skills
|
package/dist/index.js
CHANGED
|
@@ -623,6 +623,9 @@ var DEFAULT_CONFIG = {
|
|
|
623
623
|
|
|
624
624
|
// src/utils/ide.ts
|
|
625
625
|
function getSelectedIdes(options) {
|
|
626
|
+
if (options.allAgents) {
|
|
627
|
+
return ["universal", ...VENDOR_SPECIFIC_AGENTS];
|
|
628
|
+
}
|
|
626
629
|
const ides = [];
|
|
627
630
|
if (options.claude) ides.push("claude");
|
|
628
631
|
if (options.cursor) ides.push("cursor");
|
|
@@ -631,7 +634,7 @@ function getSelectedIdes(options) {
|
|
|
631
634
|
return ides;
|
|
632
635
|
}
|
|
633
636
|
function hasExplicitIdeOption(options) {
|
|
634
|
-
return !!(options.claude || options.cursor || options.universal || options.antigravity);
|
|
637
|
+
return !!(options.allAgents || options.claude || options.cursor || options.universal || options.antigravity);
|
|
635
638
|
}
|
|
636
639
|
async function detectVendorSpecificAgents(scope) {
|
|
637
640
|
const baseDir = scope === "global" ? homedir() : process.cwd();
|
|
@@ -1887,7 +1890,7 @@ function logInstallSummary(targets, targetDirs, skillNames) {
|
|
|
1887
1890
|
function registerSkillCommands(program2) {
|
|
1888
1891
|
const skill = program2.command("skills").alias("skill").description("Manage AI coding skills");
|
|
1889
1892
|
registerGenerateCommand(skill);
|
|
1890
|
-
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("--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) => {
|
|
1893
|
+
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) => {
|
|
1891
1894
|
await installCommand(project, skillName, options);
|
|
1892
1895
|
});
|
|
1893
1896
|
skill.command("search").alias("s").argument("<keywords...>", "Search keywords").description("Search for skills across all indexed repositories").action(async (keywords) => {
|
|
@@ -1907,7 +1910,7 @@ function registerSkillCommands(program2) {
|
|
|
1907
1910
|
});
|
|
1908
1911
|
}
|
|
1909
1912
|
function registerSkillAliases(program2) {
|
|
1910
|
-
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("--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) => {
|
|
1913
|
+
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) => {
|
|
1911
1914
|
await installCommand(project, skillName, options);
|
|
1912
1915
|
});
|
|
1913
1916
|
program2.command("ss", { hidden: true }).argument("<keywords...>", "Search keywords").description("Search for skills (alias for: skills search)").action(async (keywords) => {
|
|
@@ -2782,6 +2785,7 @@ alwaysApply: true
|
|
|
2782
2785
|
---
|
|
2783
2786
|
|
|
2784
2787
|
`;
|
|
2788
|
+
var CODEX_CLI_SANDBOX_GUIDANCE = `Run Context7 CLI requests outside Codex's default sandbox. If a Context7 CLI command fails with DNS or network errors such as ENOTFOUND, host resolution failures, or fetch failed, rerun it outside the sandbox instead of retrying inside the sandbox.`;
|
|
2785
2789
|
async function fetchRule(filename, fallback) {
|
|
2786
2790
|
for (const base of GITHUB_RAW_URLS) {
|
|
2787
2791
|
try {
|
|
@@ -2795,9 +2799,40 @@ async function fetchRule(filename, fallback) {
|
|
|
2795
2799
|
}
|
|
2796
2800
|
async function getRuleContent(mode, agent) {
|
|
2797
2801
|
const [filename, fallback] = mode === "mcp" ? ["context7-mcp.md", FALLBACK_MCP] : ["context7-cli.md", FALLBACK_CLI];
|
|
2798
|
-
|
|
2802
|
+
let body = await fetchRule(filename, fallback);
|
|
2803
|
+
if (mode === "cli" && agent === "codex" && !body.includes(CODEX_CLI_SANDBOX_GUIDANCE)) {
|
|
2804
|
+
body = `${body.trimEnd()}
|
|
2805
|
+
${CODEX_CLI_SANDBOX_GUIDANCE}
|
|
2806
|
+
`;
|
|
2807
|
+
}
|
|
2799
2808
|
return agent === "cursor" ? `${CURSOR_FRONTMATTER}${body}` : body;
|
|
2800
2809
|
}
|
|
2810
|
+
function customizeSkillFilesForAgent(agent, skillName, files) {
|
|
2811
|
+
if (agent !== "codex" || skillName !== "find-docs") {
|
|
2812
|
+
return files;
|
|
2813
|
+
}
|
|
2814
|
+
return files.map((file) => {
|
|
2815
|
+
if (file.path !== "SKILL.md" || file.content.includes(CODEX_CLI_SANDBOX_GUIDANCE)) {
|
|
2816
|
+
return file;
|
|
2817
|
+
}
|
|
2818
|
+
const marker = "## Step 1: Resolve a Library";
|
|
2819
|
+
const guidance = `${CODEX_CLI_SANDBOX_GUIDANCE}
|
|
2820
|
+
|
|
2821
|
+
`;
|
|
2822
|
+
if (file.content.includes(marker)) {
|
|
2823
|
+
return {
|
|
2824
|
+
...file,
|
|
2825
|
+
content: file.content.replace(marker, `${guidance}${marker}`)
|
|
2826
|
+
};
|
|
2827
|
+
}
|
|
2828
|
+
const separator = file.content.endsWith("\n") ? "\n" : "\n\n";
|
|
2829
|
+
return {
|
|
2830
|
+
...file,
|
|
2831
|
+
content: `${file.content}${separator}${CODEX_CLI_SANDBOX_GUIDANCE}
|
|
2832
|
+
`
|
|
2833
|
+
};
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2801
2836
|
|
|
2802
2837
|
// src/setup/mcp-writer.ts
|
|
2803
2838
|
import { access as access3, readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
@@ -3181,7 +3216,8 @@ async function setupCliAgent(agentName, scope, downloadData) {
|
|
|
3181
3216
|
const skillDir = scope === "global" ? agent.skill.dir("global") : join9(process.cwd(), agent.skill.dir("project"));
|
|
3182
3217
|
let skillStatus;
|
|
3183
3218
|
try {
|
|
3184
|
-
|
|
3219
|
+
const files = customizeSkillFilesForAgent(agentName, "find-docs", downloadData.files);
|
|
3220
|
+
await installSkillFiles("find-docs", files, skillDir);
|
|
3185
3221
|
skillStatus = "installed";
|
|
3186
3222
|
} catch (err) {
|
|
3187
3223
|
skillStatus = `failed: ${err instanceof Error ? err.message : String(err)}`;
|