agdex 0.3.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 CHANGED
@@ -28,6 +28,41 @@ npm install -D agdex
28
28
  npx agdex
29
29
  ```
30
30
 
31
+ ## Configuration
32
+
33
+ You can configure agdex defaults using either `.agdexrc.json` or the `agdex` field in `package.json`.
34
+
35
+ ### Using .agdexrc.json
36
+
37
+ Create a `.agdexrc.json` file in your project root:
38
+
39
+ ```json
40
+ {
41
+ "output": "CLAUDE.md"
42
+ }
43
+ ```
44
+
45
+ ### Using package.json
46
+
47
+ Add an `agdex` field to your `package.json`:
48
+
49
+ ```json
50
+ {
51
+ "name": "my-project",
52
+ "agdex": {
53
+ "output": "CLAUDE.md"
54
+ }
55
+ }
56
+ ```
57
+
58
+ **Note:** `.agdexrc.json` takes priority over `package.json` if both are present.
59
+
60
+ ### Configuration Options
61
+
62
+ | Option | Type | Default | Description |
63
+ |----------|--------|-------------|-------------|
64
+ | `output` | string | `CLAUDE.md` | Default output file for indexes |
65
+
31
66
  ## CLI Usage
32
67
 
33
68
  ### Interactive Mode
@@ -77,7 +112,7 @@ npx agdex --provider nextjs --description "Project uses App Router only"
77
112
  ```bash
78
113
  -p, --provider <name> Documentation provider (nextjs, react, etc.)
79
114
  --fw-version <version> Framework version (auto-detected if not provided)
80
- -o, --output <file> Target file (default: AGENTS.md)
115
+ -o, --output <file> Target file (default: from config or CLAUDE.md)
81
116
  -d, --description <text> Additional description to include in the index
82
117
  -g, --global Store docs in global cache (~/.cache/agdex/)
83
118
  ```
package/dist/cli/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  embed,
15
15
  embedSkills,
16
16
  generateIndex,
17
+ getDefaultOutput,
17
18
  getDefaultSkillSources,
18
19
  getProvider,
19
20
  hasExistingIndex,
@@ -32,7 +33,7 @@ import {
32
33
  tailwindProvider,
33
34
  tauriProvider,
34
35
  tyProvider
35
- } from "../index-4shp3mqh.js";
36
+ } from "../index-zrmn6fd2.js";
36
37
 
37
38
  // node_modules/commander/lib/error.js
38
39
  var require_error = __commonJS((exports) => {
@@ -6937,7 +6938,7 @@ async function runEmbed(options) {
6937
6938
  await executeEmbed(cwd, provider, version, output, options.global, result.description);
6938
6939
  return;
6939
6940
  }
6940
- output = options.output || "AGENTS.md";
6941
+ output = options.output || getDefaultOutput();
6941
6942
  if (!version && !provider.detectVersion) {
6942
6943
  console.error(import_picocolors.default.red(`Provider ${provider.displayName} requires --version flag since auto-detection is not supported.`));
6943
6944
  process.exit(1);
@@ -7179,23 +7180,27 @@ agdex - Documentation Index for AI Coding Agents
7179
7180
  };
7180
7181
  }
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;
7182
7191
  const response = await import_prompts.default({
7183
7192
  type: "select",
7184
7193
  name: "output",
7185
7194
  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
7195
+ choices,
7196
+ initial
7192
7197
  }, { onCancel });
7193
7198
  if (response.output === "__custom__") {
7194
7199
  const customOutput = await import_prompts.default({
7195
7200
  type: "text",
7196
7201
  name: "file",
7197
7202
  message: "Custom file path",
7198
- initial: "AGENTS.md",
7203
+ initial: defaultOutput,
7199
7204
  validate: (v) => v.trim() ? true : "Please enter a file path"
7200
7205
  }, { onCancel });
7201
7206
  return customOutput.file;
@@ -7360,7 +7365,7 @@ async function runLocal(docsPath, options) {
7360
7365
  process.exit(1);
7361
7366
  }
7362
7367
  const name = options.name || path.basename(docsPath);
7363
- const output = options.output || "AGENTS.md";
7368
+ const output = options.output || getDefaultOutput();
7364
7369
  const extensions = options.extensions?.split(",") || [".md", ".mdx"];
7365
7370
  console.log(`
7366
7371
  Building index from ${import_picocolors.default.cyan(docsPath)}...`);
@@ -7432,12 +7437,12 @@ Sources you can index:
7432
7437
  • Claude Code skills
7433
7438
 
7434
7439
  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);
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);
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);
7437
7442
  program2.command("list").description("List available documentation providers").action(runList);
7438
7443
  function runRemove(options) {
7439
7444
  const cwd = process.cwd();
7440
- const output = options.output || "AGENTS.md";
7445
+ const output = options.output || getDefaultOutput();
7441
7446
  const targetPath = path.join(cwd, output);
7442
7447
  if (!fs.existsSync(targetPath)) {
7443
7448
  console.error(import_picocolors.default.red(`File not found: ${output}`));
@@ -7477,11 +7482,11 @@ No indices found to remove.
7477
7482
  console.log(import_picocolors.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
7478
7483
  console.log("");
7479
7484
  }
7480
- program2.command("remove").description("Remove embedded indices from AGENTS.md/CLAUDE.md").option("-o, --output <file>", "Target file (default: AGENTS.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);
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);
7481
7486
  var skillsCommand = program2.command("skills").description("Manage Claude Code skills indexing");
7482
7487
  async function runSkillsEmbed(options) {
7483
7488
  const cwd = process.cwd();
7484
- const output = options.output || "AGENTS.md";
7489
+ const output = options.output || getDefaultOutput();
7485
7490
  const sources = getDefaultSkillSources(cwd, {
7486
7491
  includeUser: options.user !== false,
7487
7492
  includeProject: options.project !== false,
@@ -7561,7 +7566,7 @@ async function runSkillsLocal(skillsPath, options) {
7561
7566
  console.error(import_picocolors.default.red(`Skills directory not found: ${skillsPath}`));
7562
7567
  process.exit(1);
7563
7568
  }
7564
- const output = options.output || "AGENTS.md";
7569
+ const output = options.output || getDefaultOutput();
7565
7570
  const label = options.name || path.basename(skillsPath);
7566
7571
  const hasPluginsDir = fs.existsSync(path.join(absolutePath, "plugins"));
7567
7572
  const sources = [{
@@ -7582,7 +7587,7 @@ Discovering skills from ${import_picocolors.default.cyan(skillsPath)}...`);
7582
7587
  console.log(`${import_picocolors.default.green("✓")} Indexed ${import_picocolors.default.bold(result.skillCount.toString())} skills`);
7583
7588
  console.log("");
7584
7589
  }
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);
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);
7586
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);
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);
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);
7588
7593
  program2.parse();