agdex 0.2.0 → 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 +73 -2
- package/dist/cli/index.js +380 -83
- package/dist/index-4shp3mqh.js +1871 -0
- package/dist/index-57bfejpe.js +1357 -0
- package/dist/index-5h59833k.js +1270 -0
- package/dist/index-9gy9s47s.js +1366 -0
- package/dist/index-p0xjkwcp.js +1283 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/agents-md.d.ts.map +1 -1
- package/dist/lib/providers/basedpyright.d.ts +3 -0
- package/dist/lib/providers/basedpyright.d.ts.map +1 -0
- package/dist/lib/providers/convex.d.ts +3 -0
- package/dist/lib/providers/convex.d.ts.map +1 -0
- package/dist/lib/providers/delta-rs.d.ts +3 -0
- package/dist/lib/providers/delta-rs.d.ts.map +1 -0
- package/dist/lib/providers/index.d.ts +8 -0
- package/dist/lib/providers/index.d.ts.map +1 -1
- package/dist/lib/providers/polars.d.ts +3 -0
- package/dist/lib/providers/polars.d.ts.map +1 -0
- package/dist/lib/providers/ruff.d.ts +3 -0
- package/dist/lib/providers/ruff.d.ts.map +1 -0
- package/dist/lib/providers/svelte.d.ts +3 -0
- package/dist/lib/providers/svelte.d.ts.map +1 -0
- package/dist/lib/providers/tailwind.d.ts +3 -0
- package/dist/lib/providers/tailwind.d.ts.map +1 -0
- package/dist/lib/providers/ty.d.ts +3 -0
- package/dist/lib/providers/ty.d.ts.map +1 -0
- package/dist/lib/skills.d.ts +5 -0
- package/dist/lib/skills.d.ts.map +1 -1
- package/dist/lib/types.d.ts +5 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -3,11 +3,14 @@ import {
|
|
|
3
3
|
__commonJS,
|
|
4
4
|
__require,
|
|
5
5
|
__toESM,
|
|
6
|
+
basedpyrightProvider,
|
|
6
7
|
buildDocTree,
|
|
7
8
|
bunProvider,
|
|
8
9
|
collectAllSkills,
|
|
9
10
|
collectDocFiles,
|
|
11
|
+
convexProvider,
|
|
10
12
|
createProvider,
|
|
13
|
+
deltaRsProvider,
|
|
11
14
|
embed,
|
|
12
15
|
embedSkills,
|
|
13
16
|
generateIndex,
|
|
@@ -20,11 +23,16 @@ import {
|
|
|
20
23
|
listProviders,
|
|
21
24
|
nextjsProvider,
|
|
22
25
|
pixiProvider,
|
|
26
|
+
polarsProvider,
|
|
23
27
|
rattlerBuildProvider,
|
|
24
28
|
removeDocsIndex,
|
|
25
29
|
removeSkillsIndex,
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
ruffProvider,
|
|
31
|
+
svelteProvider,
|
|
32
|
+
tailwindProvider,
|
|
33
|
+
tauriProvider,
|
|
34
|
+
tyProvider
|
|
35
|
+
} from "../index-4shp3mqh.js";
|
|
28
36
|
|
|
29
37
|
// node_modules/commander/lib/error.js
|
|
30
38
|
var require_error = __commonJS((exports) => {
|
|
@@ -6918,7 +6926,7 @@ async function runEmbed(options) {
|
|
|
6918
6926
|
provider = result.provider;
|
|
6919
6927
|
version = result.version;
|
|
6920
6928
|
output = result.output;
|
|
6921
|
-
await executeEmbed(cwd, provider, version, output, options.global);
|
|
6929
|
+
await executeEmbed(cwd, provider, version, output, options.global, result.description);
|
|
6922
6930
|
return;
|
|
6923
6931
|
}
|
|
6924
6932
|
} else {
|
|
@@ -6926,7 +6934,7 @@ async function runEmbed(options) {
|
|
|
6926
6934
|
provider = result.provider;
|
|
6927
6935
|
version = result.version;
|
|
6928
6936
|
output = result.output;
|
|
6929
|
-
await executeEmbed(cwd, provider, version, output, options.global);
|
|
6937
|
+
await executeEmbed(cwd, provider, version, output, options.global, result.description);
|
|
6930
6938
|
return;
|
|
6931
6939
|
}
|
|
6932
6940
|
output = options.output || "AGENTS.md";
|
|
@@ -6934,9 +6942,9 @@ async function runEmbed(options) {
|
|
|
6934
6942
|
console.error(import_picocolors.default.red(`Provider ${provider.displayName} requires --version flag since auto-detection is not supported.`));
|
|
6935
6943
|
process.exit(1);
|
|
6936
6944
|
}
|
|
6937
|
-
await executeEmbed(cwd, provider, version, output, options.global);
|
|
6945
|
+
await executeEmbed(cwd, provider, version, output, options.global, options.description);
|
|
6938
6946
|
}
|
|
6939
|
-
async function executeEmbed(cwd, provider, version, output, globalCache) {
|
|
6947
|
+
async function executeEmbed(cwd, provider, version, output, globalCache, description) {
|
|
6940
6948
|
let resolvedVersion = version;
|
|
6941
6949
|
if (!resolvedVersion && provider.detectVersion) {
|
|
6942
6950
|
const detected = provider.detectVersion(cwd);
|
|
@@ -6954,7 +6962,8 @@ Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_pic
|
|
|
6954
6962
|
provider,
|
|
6955
6963
|
version: resolvedVersion,
|
|
6956
6964
|
output,
|
|
6957
|
-
globalCache
|
|
6965
|
+
globalCache,
|
|
6966
|
+
description
|
|
6958
6967
|
});
|
|
6959
6968
|
if (!result.success) {
|
|
6960
6969
|
console.error(import_picocolors.default.red(`Failed: ${result.error}`));
|
|
@@ -6969,7 +6978,7 @@ Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_pic
|
|
|
6969
6978
|
console.log("");
|
|
6970
6979
|
}
|
|
6971
6980
|
function autoDetectProvider(cwd) {
|
|
6972
|
-
const providers = [nextjsProvider, pixiProvider, rattlerBuildProvider, tauriProvider, bunProvider];
|
|
6981
|
+
const providers = [nextjsProvider, pixiProvider, rattlerBuildProvider, tauriProvider, bunProvider, svelteProvider, tailwindProvider, ruffProvider, tyProvider, basedpyrightProvider, convexProvider, polarsProvider, deltaRsProvider];
|
|
6973
6982
|
for (const provider of providers) {
|
|
6974
6983
|
if (provider.detectVersion) {
|
|
6975
6984
|
const result = provider.detectVersion(cwd);
|
|
@@ -6980,62 +6989,172 @@ function autoDetectProvider(cwd) {
|
|
|
6980
6989
|
}
|
|
6981
6990
|
return null;
|
|
6982
6991
|
}
|
|
6992
|
+
function parseGitHubInput(input) {
|
|
6993
|
+
input = input.trim();
|
|
6994
|
+
if (/^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(input)) {
|
|
6995
|
+
return { repo: input };
|
|
6996
|
+
}
|
|
6997
|
+
const urlMatch = input.match(/^https?:\/\/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)(?:\/(?:tree|blob)\/([^/]+)(?:\/(.+))?)?/);
|
|
6998
|
+
if (urlMatch) {
|
|
6999
|
+
return {
|
|
7000
|
+
repo: urlMatch[1],
|
|
7001
|
+
branch: urlMatch[2] || undefined,
|
|
7002
|
+
path: urlMatch[3] || undefined
|
|
7003
|
+
};
|
|
7004
|
+
}
|
|
7005
|
+
return null;
|
|
7006
|
+
}
|
|
7007
|
+
async function detectRepoContent(repo, branch) {
|
|
7008
|
+
const result = {
|
|
7009
|
+
hasDocs: false,
|
|
7010
|
+
hasReadme: false,
|
|
7011
|
+
hasSkills: false,
|
|
7012
|
+
docsPath: undefined,
|
|
7013
|
+
skillsPath: undefined,
|
|
7014
|
+
defaultBranch: branch || "main"
|
|
7015
|
+
};
|
|
7016
|
+
const { execSync } = await import("child_process");
|
|
7017
|
+
try {
|
|
7018
|
+
if (!branch) {
|
|
7019
|
+
try {
|
|
7020
|
+
const repoInfo = execSync(`gh api repos/${repo} --jq '.default_branch'`, {
|
|
7021
|
+
encoding: "utf-8",
|
|
7022
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
7023
|
+
}).trim();
|
|
7024
|
+
result.defaultBranch = repoInfo || "main";
|
|
7025
|
+
} catch {
|
|
7026
|
+
result.defaultBranch = "main";
|
|
7027
|
+
}
|
|
7028
|
+
}
|
|
7029
|
+
const contents = execSync(`gh api repos/${repo}/contents?ref=${result.defaultBranch} --jq '.[].name'`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim().split(`
|
|
7030
|
+
`);
|
|
7031
|
+
const docsDirectories = ["docs", "doc", "documentation"];
|
|
7032
|
+
for (const dir of docsDirectories) {
|
|
7033
|
+
if (contents.includes(dir)) {
|
|
7034
|
+
result.hasDocs = true;
|
|
7035
|
+
result.docsPath = dir;
|
|
7036
|
+
break;
|
|
7037
|
+
}
|
|
7038
|
+
}
|
|
7039
|
+
const readmeFiles = ["README.md", "README.mdx", "readme.md", "Readme.md"];
|
|
7040
|
+
for (const readme of readmeFiles) {
|
|
7041
|
+
if (contents.includes(readme)) {
|
|
7042
|
+
result.hasReadme = true;
|
|
7043
|
+
break;
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
const skillsDirectories = ["skills", ".claude/skills"];
|
|
7047
|
+
for (const dir of skillsDirectories) {
|
|
7048
|
+
if (contents.includes(dir) || contents.includes(dir.split("/")[0])) {
|
|
7049
|
+
result.hasSkills = true;
|
|
7050
|
+
result.skillsPath = dir;
|
|
7051
|
+
break;
|
|
7052
|
+
}
|
|
7053
|
+
}
|
|
7054
|
+
} catch {}
|
|
7055
|
+
return result;
|
|
7056
|
+
}
|
|
6983
7057
|
async function promptForOptions(cwd) {
|
|
6984
7058
|
const detected = autoDetectProvider(cwd);
|
|
6985
7059
|
console.log(import_picocolors.default.cyan(`
|
|
6986
7060
|
agdex - Documentation Index for AI Coding Agents
|
|
7061
|
+
`));
|
|
7062
|
+
console.log(import_picocolors.default.gray(" Create compressed documentation indexes for AI coding assistants."));
|
|
7063
|
+
console.log(import_picocolors.default.gray(` Indexes are embedded into AGENTS.md/CLAUDE.md files.
|
|
6987
7064
|
`));
|
|
6988
7065
|
if (detected) {
|
|
6989
|
-
console.log(import_picocolors.default.
|
|
7066
|
+
console.log(import_picocolors.default.green(` ✓ Detected ${detected.provider.displayName} v${detected.version}
|
|
6990
7067
|
`));
|
|
6991
7068
|
}
|
|
7069
|
+
const actionResponse = await import_prompts.default({
|
|
7070
|
+
type: "select",
|
|
7071
|
+
name: "action",
|
|
7072
|
+
message: "What would you like to index?",
|
|
7073
|
+
choices: [
|
|
7074
|
+
...detected ? [{
|
|
7075
|
+
title: `${detected.provider.displayName} docs (detected)`,
|
|
7076
|
+
value: "detected",
|
|
7077
|
+
description: `Index ${detected.provider.displayName} v${detected.version} documentation`
|
|
7078
|
+
}] : [],
|
|
7079
|
+
{
|
|
7080
|
+
title: "Built-in provider",
|
|
7081
|
+
value: "provider",
|
|
7082
|
+
description: "Next.js, React, Pixi, Bun, Tauri, etc."
|
|
7083
|
+
},
|
|
7084
|
+
{
|
|
7085
|
+
title: "GitHub repository",
|
|
7086
|
+
value: "github",
|
|
7087
|
+
description: "Enter a GitHub URL or owner/repo"
|
|
7088
|
+
},
|
|
7089
|
+
{
|
|
7090
|
+
title: "Local directory",
|
|
7091
|
+
value: "local",
|
|
7092
|
+
description: "Index docs from a local folder"
|
|
7093
|
+
},
|
|
7094
|
+
{
|
|
7095
|
+
title: "Skills",
|
|
7096
|
+
value: "skills",
|
|
7097
|
+
description: "Index Claude Code skills"
|
|
7098
|
+
}
|
|
7099
|
+
],
|
|
7100
|
+
initial: detected ? 0 : 0
|
|
7101
|
+
}, { onCancel });
|
|
7102
|
+
if (actionResponse.action === "detected" && detected) {
|
|
7103
|
+
const output2 = await promptForOutputFile();
|
|
7104
|
+
const description2 = await promptForDescription();
|
|
7105
|
+
return {
|
|
7106
|
+
provider: detected.provider,
|
|
7107
|
+
version: detected.version,
|
|
7108
|
+
output: output2,
|
|
7109
|
+
description: description2
|
|
7110
|
+
};
|
|
7111
|
+
}
|
|
7112
|
+
if (actionResponse.action === "local") {
|
|
7113
|
+
const localResponse = await import_prompts.default({
|
|
7114
|
+
type: "text",
|
|
7115
|
+
name: "path",
|
|
7116
|
+
message: "Path to documentation directory",
|
|
7117
|
+
initial: "./docs",
|
|
7118
|
+
validate: (v) => {
|
|
7119
|
+
if (!v.trim())
|
|
7120
|
+
return "Please enter a path";
|
|
7121
|
+
const absPath = path.isAbsolute(v) ? v : path.join(cwd, v);
|
|
7122
|
+
if (!fs.existsSync(absPath))
|
|
7123
|
+
return `Directory not found: ${v}`;
|
|
7124
|
+
return true;
|
|
7125
|
+
}
|
|
7126
|
+
}, { onCancel });
|
|
7127
|
+
const nameResponse = await import_prompts.default({
|
|
7128
|
+
type: "text",
|
|
7129
|
+
name: "name",
|
|
7130
|
+
message: "Display name",
|
|
7131
|
+
initial: path.basename(localResponse.path)
|
|
7132
|
+
}, { onCancel });
|
|
7133
|
+
const output2 = await promptForOutputFile();
|
|
7134
|
+
await runLocal(localResponse.path, { name: nameResponse.name, output: output2 });
|
|
7135
|
+
process.exit(0);
|
|
7136
|
+
}
|
|
7137
|
+
if (actionResponse.action === "skills") {
|
|
7138
|
+
await runSkillsEmbed({});
|
|
7139
|
+
process.exit(0);
|
|
7140
|
+
}
|
|
7141
|
+
if (actionResponse.action === "github") {
|
|
7142
|
+
return await promptForGitHubRepo(cwd);
|
|
7143
|
+
}
|
|
6992
7144
|
const availableProviders = listProviders().filter(isProviderAvailable);
|
|
6993
7145
|
const response = await import_prompts.default([
|
|
6994
7146
|
{
|
|
6995
7147
|
type: "select",
|
|
6996
7148
|
name: "provider",
|
|
6997
7149
|
message: "Documentation provider",
|
|
6998
|
-
choices:
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
})),
|
|
7003
|
-
{ title: "Custom GitHub repo...", value: "__custom__" }
|
|
7004
|
-
],
|
|
7150
|
+
choices: availableProviders.map((p) => ({
|
|
7151
|
+
title: getProvider(p).displayName,
|
|
7152
|
+
value: p
|
|
7153
|
+
})),
|
|
7005
7154
|
initial: detected ? availableProviders.indexOf(detected.provider.name) : 0
|
|
7006
7155
|
}
|
|
7007
7156
|
], { onCancel });
|
|
7008
|
-
|
|
7009
|
-
if (response.provider === "__custom__") {
|
|
7010
|
-
const customResponse = await import_prompts.default([
|
|
7011
|
-
{
|
|
7012
|
-
type: "text",
|
|
7013
|
-
name: "repo",
|
|
7014
|
-
message: "GitHub repository (owner/repo)",
|
|
7015
|
-
validate: (v) => v.includes("/") ? true : "Format: owner/repo"
|
|
7016
|
-
},
|
|
7017
|
-
{
|
|
7018
|
-
type: "text",
|
|
7019
|
-
name: "docsPath",
|
|
7020
|
-
message: "Path to docs folder",
|
|
7021
|
-
initial: "docs"
|
|
7022
|
-
},
|
|
7023
|
-
{
|
|
7024
|
-
type: "text",
|
|
7025
|
-
name: "displayName",
|
|
7026
|
-
message: "Display name",
|
|
7027
|
-
initial: "Custom"
|
|
7028
|
-
}
|
|
7029
|
-
], { onCancel });
|
|
7030
|
-
provider = createProvider({
|
|
7031
|
-
name: "custom",
|
|
7032
|
-
displayName: customResponse.displayName,
|
|
7033
|
-
repo: customResponse.repo,
|
|
7034
|
-
docsPath: customResponse.docsPath
|
|
7035
|
-
});
|
|
7036
|
-
} else {
|
|
7037
|
-
provider = getProvider(response.provider);
|
|
7038
|
-
}
|
|
7157
|
+
const provider = getProvider(response.provider);
|
|
7039
7158
|
let initialVersion = "";
|
|
7040
7159
|
if (provider.detectVersion) {
|
|
7041
7160
|
const detectedVersion = provider.detectVersion(cwd);
|
|
@@ -7043,28 +7162,35 @@ agdex - Documentation Index for AI Coding Agents
|
|
|
7043
7162
|
initialVersion = detectedVersion.version;
|
|
7044
7163
|
}
|
|
7045
7164
|
}
|
|
7046
|
-
const versionResponse = await import_prompts.default(
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7165
|
+
const versionResponse = await import_prompts.default({
|
|
7166
|
+
type: "text",
|
|
7167
|
+
name: "version",
|
|
7168
|
+
message: `${provider.displayName} version`,
|
|
7169
|
+
initial: initialVersion,
|
|
7170
|
+
validate: (v) => v.trim() ? true : "Please enter a version"
|
|
7171
|
+
}, { onCancel });
|
|
7172
|
+
const output = await promptForOutputFile();
|
|
7173
|
+
const description = await promptForDescription();
|
|
7174
|
+
return {
|
|
7175
|
+
provider,
|
|
7176
|
+
version: versionResponse.version,
|
|
7177
|
+
output,
|
|
7178
|
+
description
|
|
7179
|
+
};
|
|
7180
|
+
}
|
|
7181
|
+
async function promptForOutputFile() {
|
|
7182
|
+
const response = await import_prompts.default({
|
|
7183
|
+
type: "select",
|
|
7184
|
+
name: "output",
|
|
7185
|
+
message: "Target file",
|
|
7186
|
+
choices: [
|
|
7187
|
+
{ title: "AGENTS.md", value: "AGENTS.md" },
|
|
7188
|
+
{ title: "CLAUDE.md", value: "CLAUDE.md" },
|
|
7189
|
+
{ title: "Custom...", value: "__custom__" }
|
|
7190
|
+
],
|
|
7191
|
+
initial: 0
|
|
7192
|
+
}, { onCancel });
|
|
7193
|
+
if (response.output === "__custom__") {
|
|
7068
7194
|
const customOutput = await import_prompts.default({
|
|
7069
7195
|
type: "text",
|
|
7070
7196
|
name: "file",
|
|
@@ -7072,13 +7198,159 @@ agdex - Documentation Index for AI Coding Agents
|
|
|
7072
7198
|
initial: "AGENTS.md",
|
|
7073
7199
|
validate: (v) => v.trim() ? true : "Please enter a file path"
|
|
7074
7200
|
}, { onCancel });
|
|
7075
|
-
|
|
7201
|
+
return customOutput.file;
|
|
7076
7202
|
}
|
|
7077
|
-
return
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7203
|
+
return response.output;
|
|
7204
|
+
}
|
|
7205
|
+
async function promptForDescription() {
|
|
7206
|
+
const response = await import_prompts.default({
|
|
7207
|
+
type: "text",
|
|
7208
|
+
name: "description",
|
|
7209
|
+
message: "Additional description (optional, press Enter to skip)",
|
|
7210
|
+
initial: ""
|
|
7211
|
+
}, { onCancel });
|
|
7212
|
+
return response.description?.trim() || undefined;
|
|
7213
|
+
}
|
|
7214
|
+
async function promptForGitHubRepo(cwd) {
|
|
7215
|
+
console.log("");
|
|
7216
|
+
console.log(import_picocolors.default.gray(" Enter a GitHub URL or owner/repo. Examples:"));
|
|
7217
|
+
console.log(import_picocolors.default.gray(" • anthropics/skills"));
|
|
7218
|
+
console.log(import_picocolors.default.gray(" • https://github.com/vercel/next.js"));
|
|
7219
|
+
console.log(import_picocolors.default.gray(" • https://github.com/anthropics/skills/tree/main/skills"));
|
|
7220
|
+
console.log("");
|
|
7221
|
+
const urlResponse = await import_prompts.default({
|
|
7222
|
+
type: "text",
|
|
7223
|
+
name: "url",
|
|
7224
|
+
message: "GitHub repository",
|
|
7225
|
+
validate: (v) => {
|
|
7226
|
+
if (!v.trim())
|
|
7227
|
+
return "Please enter a URL or owner/repo";
|
|
7228
|
+
const parsed2 = parseGitHubInput(v);
|
|
7229
|
+
if (!parsed2)
|
|
7230
|
+
return "Invalid format. Use owner/repo or a GitHub URL";
|
|
7231
|
+
return true;
|
|
7232
|
+
}
|
|
7233
|
+
}, { onCancel });
|
|
7234
|
+
const parsed = parseGitHubInput(urlResponse.url);
|
|
7235
|
+
console.log(`
|
|
7236
|
+
${import_picocolors.default.gray("Checking repository contents...")}`);
|
|
7237
|
+
const repoContent = await detectRepoContent(parsed.repo, parsed.branch);
|
|
7238
|
+
if (parsed.path) {
|
|
7239
|
+
console.log(import_picocolors.default.green(` ✓ Using specified path: ${parsed.path}
|
|
7240
|
+
`));
|
|
7241
|
+
const nameResponse2 = await import_prompts.default({
|
|
7242
|
+
type: "text",
|
|
7243
|
+
name: "name",
|
|
7244
|
+
message: "Display name",
|
|
7245
|
+
initial: path.basename(parsed.path) || parsed.repo.split("/")[1]
|
|
7246
|
+
}, { onCancel });
|
|
7247
|
+
const versionResponse2 = await import_prompts.default({
|
|
7248
|
+
type: "text",
|
|
7249
|
+
name: "version",
|
|
7250
|
+
message: 'Version/tag (or "latest" for default branch)',
|
|
7251
|
+
initial: parsed.branch || repoContent.defaultBranch
|
|
7252
|
+
}, { onCancel });
|
|
7253
|
+
const output2 = await promptForOutputFile();
|
|
7254
|
+
const description2 = await promptForDescription();
|
|
7255
|
+
const provider2 = createProvider({
|
|
7256
|
+
name: nameResponse2.name.toLowerCase().replace(/\s+/g, "-"),
|
|
7257
|
+
displayName: nameResponse2.name,
|
|
7258
|
+
repo: parsed.repo,
|
|
7259
|
+
docsPath: parsed.path
|
|
7260
|
+
});
|
|
7261
|
+
return { provider: provider2, version: versionResponse2.version, output: output2, description: description2 };
|
|
7262
|
+
}
|
|
7263
|
+
const detected = [];
|
|
7264
|
+
if (repoContent.hasDocs)
|
|
7265
|
+
detected.push(`docs (${repoContent.docsPath})`);
|
|
7266
|
+
if (repoContent.hasReadme)
|
|
7267
|
+
detected.push("README.md");
|
|
7268
|
+
if (repoContent.hasSkills)
|
|
7269
|
+
detected.push(`skills (${repoContent.skillsPath})`);
|
|
7270
|
+
if (detected.length > 0) {
|
|
7271
|
+
console.log(import_picocolors.default.green(` ✓ Found: ${detected.join(", ")}
|
|
7272
|
+
`));
|
|
7273
|
+
} else {
|
|
7274
|
+
console.log(import_picocolors.default.yellow(` No standard docs/skills directories detected.
|
|
7275
|
+
`));
|
|
7276
|
+
}
|
|
7277
|
+
const choices = [];
|
|
7278
|
+
if (repoContent.hasDocs) {
|
|
7279
|
+
choices.push({
|
|
7280
|
+
title: `Documentation (${repoContent.docsPath}/)`,
|
|
7281
|
+
value: "docs",
|
|
7282
|
+
description: "Index the docs directory"
|
|
7283
|
+
});
|
|
7284
|
+
}
|
|
7285
|
+
if (repoContent.hasReadme) {
|
|
7286
|
+
choices.push({
|
|
7287
|
+
title: "README.md",
|
|
7288
|
+
value: "readme",
|
|
7289
|
+
description: "Index the README file"
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
if (repoContent.hasSkills) {
|
|
7293
|
+
choices.push({
|
|
7294
|
+
title: `Skills (${repoContent.skillsPath}/)`,
|
|
7295
|
+
value: "skills",
|
|
7296
|
+
description: "Index Claude Code skills"
|
|
7297
|
+
});
|
|
7298
|
+
}
|
|
7299
|
+
choices.push({
|
|
7300
|
+
title: "Custom path...",
|
|
7301
|
+
value: "custom",
|
|
7302
|
+
description: "Specify a custom path in the repository"
|
|
7303
|
+
});
|
|
7304
|
+
const contentChoice = await import_prompts.default({
|
|
7305
|
+
type: "select",
|
|
7306
|
+
name: "content",
|
|
7307
|
+
message: "What would you like to index?",
|
|
7308
|
+
choices
|
|
7309
|
+
}, { onCancel });
|
|
7310
|
+
let docsPath;
|
|
7311
|
+
let displayName = parsed.repo.split("/")[1];
|
|
7312
|
+
if (contentChoice.content === "docs") {
|
|
7313
|
+
docsPath = repoContent.docsPath;
|
|
7314
|
+
displayName = `${parsed.repo.split("/")[1]} Docs`;
|
|
7315
|
+
} else if (contentChoice.content === "readme") {
|
|
7316
|
+
docsPath = ".";
|
|
7317
|
+
displayName = `${parsed.repo.split("/")[1]} README`;
|
|
7318
|
+
} else if (contentChoice.content === "skills") {
|
|
7319
|
+
console.log(import_picocolors.default.yellow(`
|
|
7320
|
+
Skills indexing from GitHub URLs is coming soon!`));
|
|
7321
|
+
console.log(import_picocolors.default.gray(`For now, clone the repo and use: agdex skills local <path>
|
|
7322
|
+
`));
|
|
7323
|
+
process.exit(0);
|
|
7324
|
+
} else {
|
|
7325
|
+
const pathResponse = await import_prompts.default({
|
|
7326
|
+
type: "text",
|
|
7327
|
+
name: "path",
|
|
7328
|
+
message: "Path in repository",
|
|
7329
|
+
initial: "docs"
|
|
7330
|
+
}, { onCancel });
|
|
7331
|
+
docsPath = pathResponse.path;
|
|
7332
|
+
}
|
|
7333
|
+
const nameResponse = await import_prompts.default({
|
|
7334
|
+
type: "text",
|
|
7335
|
+
name: "name",
|
|
7336
|
+
message: "Display name",
|
|
7337
|
+
initial: displayName
|
|
7338
|
+
}, { onCancel });
|
|
7339
|
+
const versionResponse = await import_prompts.default({
|
|
7340
|
+
type: "text",
|
|
7341
|
+
name: "version",
|
|
7342
|
+
message: "Version/tag (or branch name for latest)",
|
|
7343
|
+
initial: repoContent.defaultBranch
|
|
7344
|
+
}, { onCancel });
|
|
7345
|
+
const output = await promptForOutputFile();
|
|
7346
|
+
const description = await promptForDescription();
|
|
7347
|
+
const provider = createProvider({
|
|
7348
|
+
name: nameResponse.name.toLowerCase().replace(/\s+/g, "-"),
|
|
7349
|
+
displayName: nameResponse.name,
|
|
7350
|
+
repo: parsed.repo,
|
|
7351
|
+
docsPath
|
|
7352
|
+
});
|
|
7353
|
+
return { provider, version: versionResponse.version, output, description };
|
|
7082
7354
|
}
|
|
7083
7355
|
async function runLocal(docsPath, options) {
|
|
7084
7356
|
const cwd = process.cwd();
|
|
@@ -7122,7 +7394,7 @@ Building index from ${import_picocolors.default.cyan(docsPath)}...`);
|
|
|
7122
7394
|
}
|
|
7123
7395
|
function runList() {
|
|
7124
7396
|
console.log(import_picocolors.default.cyan(`
|
|
7125
|
-
|
|
7397
|
+
\uD83D\uDCDA Built-in Documentation Providers
|
|
7126
7398
|
`));
|
|
7127
7399
|
for (const preset of listProviders()) {
|
|
7128
7400
|
const provider = getProvider(preset);
|
|
@@ -7132,12 +7404,35 @@ Available documentation providers:
|
|
|
7132
7404
|
console.log(` ${status} ${import_picocolors.default.bold(preset)} - ${name} (${import_picocolors.default.gray(repo)})`);
|
|
7133
7405
|
}
|
|
7134
7406
|
console.log("");
|
|
7135
|
-
console.log(import_picocolors.default.
|
|
7136
|
-
|
|
7407
|
+
console.log(import_picocolors.default.cyan(`\uD83D\uDCE6 Usage Examples
|
|
7408
|
+
`));
|
|
7409
|
+
console.log(import_picocolors.default.gray(" Built-in provider:"));
|
|
7410
|
+
console.log(` ${import_picocolors.default.white("agdex --provider nextjs")}`);
|
|
7411
|
+
console.log("");
|
|
7412
|
+
console.log(import_picocolors.default.gray(" Any GitHub repository:"));
|
|
7413
|
+
console.log(` ${import_picocolors.default.white("agdex --repo owner/repo --docs-path docs")}`);
|
|
7414
|
+
console.log("");
|
|
7415
|
+
console.log(import_picocolors.default.gray(" GitHub URL with path:"));
|
|
7416
|
+
console.log(` ${import_picocolors.default.white("agdex")} ${import_picocolors.default.gray("(interactive)")}`);
|
|
7417
|
+
console.log(` ${import_picocolors.default.gray("→ then enter:")} ${import_picocolors.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
|
|
7418
|
+
console.log("");
|
|
7419
|
+
console.log(import_picocolors.default.gray(" Local documentation:"));
|
|
7420
|
+
console.log(` ${import_picocolors.default.white('agdex local ./my-docs --name "My Docs"')}`);
|
|
7421
|
+
console.log("");
|
|
7422
|
+
console.log(import_picocolors.default.gray(" Skills indexing:"));
|
|
7423
|
+
console.log(` ${import_picocolors.default.white("agdex skills embed")}`);
|
|
7137
7424
|
console.log("");
|
|
7138
7425
|
}
|
|
7139
|
-
program2.name("agdex").description(
|
|
7140
|
-
|
|
7426
|
+
program2.name("agdex").description(`Create compressed documentation indexes for AI coding agents.
|
|
7427
|
+
|
|
7428
|
+
Sources you can index:
|
|
7429
|
+
• Built-in providers (Next.js, React, Bun, Pixi, Tauri, etc.)
|
|
7430
|
+
• Any GitHub repository URL or owner/repo
|
|
7431
|
+
• Local documentation directories
|
|
7432
|
+
• Claude Code skills
|
|
7433
|
+
|
|
7434
|
+
Run 'agdex' without arguments for interactive mode.`).version("0.2.0");
|
|
7435
|
+
program2.command("embed", { isDefault: true }).description("Embed documentation index into AGENTS.md/CLAUDE.md").option("-p, --provider <name>", "Documentation provider (nextjs, react, etc.)").option("--fw-version <version>", "Framework version (auto-detected if not provided)").option("-o, --output <file>", "Target file (default: AGENTS.md)").option("--repo <owner/repo>", "Custom GitHub repository").option("--docs-path <path>", "Path to docs folder in repository").option("-g, --global", "Store docs in global cache (~/.cache/agdex/) instead of local .agdex/").option("-d, --description <text>", "Additional description to include in the index").action(runEmbed);
|
|
7141
7436
|
program2.command("local <docs-path>").description("Build index from local documentation directory").option("-n, --name <name>", "Display name for the documentation").option("-o, --output <file>", "Target file (default: AGENTS.md)").option("-e, --extensions <exts>", "File extensions to include (comma-separated, default: .md,.mdx)").action(runLocal);
|
|
7142
7437
|
program2.command("list").description("List available documentation providers").action(runList);
|
|
7143
7438
|
function runRemove(options) {
|
|
@@ -7190,10 +7485,11 @@ async function runSkillsEmbed(options) {
|
|
|
7190
7485
|
const sources = getDefaultSkillSources(cwd, {
|
|
7191
7486
|
includeUser: options.user !== false,
|
|
7192
7487
|
includeProject: options.project !== false,
|
|
7488
|
+
includeEnabledPlugins: options.plugins !== false,
|
|
7193
7489
|
pluginPaths: options.plugin || []
|
|
7194
7490
|
});
|
|
7195
7491
|
if (sources.length === 0) {
|
|
7196
|
-
console.error(import_picocolors.default.red("No skill sources configured. Use --plugin, --user, or --
|
|
7492
|
+
console.error(import_picocolors.default.red("No skill sources configured. Use --plugin, --user, --project, or --plugins flags."));
|
|
7197
7493
|
process.exit(1);
|
|
7198
7494
|
}
|
|
7199
7495
|
console.log(`
|
|
@@ -7227,6 +7523,7 @@ function runSkillsList(options) {
|
|
|
7227
7523
|
const sources = getDefaultSkillSources(cwd, {
|
|
7228
7524
|
includeUser: options.user !== false,
|
|
7229
7525
|
includeProject: options.project !== false,
|
|
7526
|
+
includeEnabledPlugins: options.plugins !== false,
|
|
7230
7527
|
pluginPaths: options.plugin || []
|
|
7231
7528
|
});
|
|
7232
7529
|
const skills = collectAllSkills(sources);
|
|
@@ -7285,7 +7582,7 @@ Discovering skills from ${import_picocolors.default.cyan(skillsPath)}...`);
|
|
|
7285
7582
|
console.log(`${import_picocolors.default.green("✓")} Indexed ${import_picocolors.default.bold(result.skillCount.toString())} skills`);
|
|
7286
7583
|
console.log("");
|
|
7287
7584
|
}
|
|
7288
|
-
skillsCommand.command("embed").description("Embed skills index into AGENTS.md").option("-o, --output <file>", "Target file (default: AGENTS.md)").option("--plugin <path...>", "
|
|
7289
|
-
skillsCommand.command("list").description("List discovered skills").option("--plugin <path...>", "
|
|
7585
|
+
skillsCommand.command("embed").description("Embed skills index into AGENTS.md").option("-o, --output <file>", "Target file (default: AGENTS.md)").option("--plugin <path...>", "Additional plugin repo paths (with plugins/ structure)").option("--plugins", "Include enabled plugins from settings.json (default: true)").option("--no-plugins", "Exclude enabled plugins from settings.json").option("--user", "Include ~/.claude/skills (default: true)").option("--no-user", "Exclude ~/.claude/skills").option("--project", "Include .claude/skills (default: true)").option("--no-project", "Exclude .claude/skills").action(runSkillsEmbed);
|
|
7586
|
+
skillsCommand.command("list").description("List discovered skills").option("--plugin <path...>", "Additional plugin repo paths (with plugins/ structure)").option("--plugins", "Include enabled plugins from settings.json (default: true)").option("--no-plugins", "Exclude enabled plugins from settings.json").option("--user", "Include ~/.claude/skills (default: true)").option("--no-user", "Exclude ~/.claude/skills").option("--project", "Include .claude/skills (default: true)").option("--no-project", "Exclude .claude/skills").action(runSkillsList);
|
|
7290
7587
|
skillsCommand.command("local <skills-path>").description("Index skills from a local path").option("-o, --output <file>", "Target file (default: AGENTS.md)").option("-n, --name <name>", "Label for this skill source").action(runSkillsLocal);
|
|
7291
7588
|
program2.parse();
|