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