agdex 0.8.0 → 0.9.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 +36 -8
- package/dist/cli/index.js +76 -86
- package/dist/{url-scraper-fme0jdje.js → index-az2g46dy.js} +11 -42
- package/dist/index-pyanjjwn.js +21 -0
- package/dist/{index-38fpcrpr.js → index-xbmyce2p.js} +262 -25
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -4
- package/dist/lib/agents-md.d.ts +77 -2
- package/dist/lib/agents-md.d.ts.map +1 -1
- package/dist/lib/index-maintenance.d.ts +6 -0
- package/dist/lib/index-maintenance.d.ts.map +1 -1
- package/dist/lib/lockfile.d.ts +9 -0
- package/dist/lib/lockfile.d.ts.map +1 -1
- package/dist/lib/providers/generic.d.ts +12 -1
- package/dist/lib/providers/generic.d.ts.map +1 -1
- package/dist/lib/providers/index.d.ts +1 -2
- package/dist/lib/providers/index.d.ts.map +1 -1
- package/dist/lib/types.d.ts +18 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/url-scraper.d.ts +0 -11
- package/dist/lib/url-scraper.d.ts.map +1 -1
- package/dist/url-scraper-9bqyj00r.js +7 -0
- package/package.json +2 -2
- package/dist/index-3d051m1n.js +0 -2557
- package/dist/index-e7c8d7rq.js +0 -2357
- package/dist/index-gg9mmf42.js +0 -2357
- package/dist/index-thmt54kg.js +0 -2302
package/README.md
CHANGED
|
@@ -11,10 +11,30 @@ AI coding agents rely on training data that becomes outdated. When agents don't
|
|
|
11
11
|
1. Downloads version-matched documentation from GitHub
|
|
12
12
|
2. Creates a compressed index (~8KB for Next.js)
|
|
13
13
|
3. Stores the docs in local `.agdex/` cache
|
|
14
|
-
4.
|
|
15
|
-
5.
|
|
14
|
+
4. Writes the full index to a dedicated `DOCINDEX.md` file
|
|
15
|
+
5. Adds a small **Document Indices** pointer section to your local agent instruction file (`AGENTS.md` / `CLAUDE.md`)
|
|
16
|
+
6. Agents can then retrieve specific docs on demand
|
|
16
17
|
|
|
17
|
-
The key instruction
|
|
18
|
+
The key instruction tells agents to **prefer retrieval-led reasoning over pre-training-led reasoning**.
|
|
19
|
+
|
|
20
|
+
### Progressive disclosure
|
|
21
|
+
|
|
22
|
+
To keep your `AGENTS.md` / `CLAUDE.md` lean, agdex uses a progressive disclosure
|
|
23
|
+
strategy. The full (potentially large) per-provider indexes live in `DOCINDEX.md`,
|
|
24
|
+
while your agent file only gets a compact pointer section that is regenerated
|
|
25
|
+
every time an index is added or removed:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
## Document Indices
|
|
29
|
+
|
|
30
|
+
IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any of the docs found in DOCINDEX.md .
|
|
31
|
+
|
|
32
|
+
- NVIDIA TensorRT (`tensorrt`)
|
|
33
|
+
- Bun (`bun`)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Agents read this list, then open `DOCINDEX.md` only when they need the detailed
|
|
37
|
+
file index for a specific library.
|
|
18
38
|
|
|
19
39
|
## Installation
|
|
20
40
|
|
|
@@ -281,7 +301,7 @@ import {
|
|
|
281
301
|
collectDocFiles,
|
|
282
302
|
buildDocTree,
|
|
283
303
|
generateIndex,
|
|
284
|
-
|
|
304
|
+
applyDocIndex
|
|
285
305
|
} from 'agdex'
|
|
286
306
|
|
|
287
307
|
// Collect doc files
|
|
@@ -300,8 +320,15 @@ const index = generateIndex({
|
|
|
300
320
|
instruction: 'Use retrieval-led reasoning.'
|
|
301
321
|
})
|
|
302
322
|
|
|
303
|
-
//
|
|
304
|
-
|
|
323
|
+
// Progressive disclosure: write the full index to DOCINDEX.md and refresh
|
|
324
|
+
// the "## Document Indices" summary section in the agent file.
|
|
325
|
+
applyDocIndex({
|
|
326
|
+
cwd: process.cwd(),
|
|
327
|
+
agentFile: 'CLAUDE.md',
|
|
328
|
+
providerName: 'my-docs',
|
|
329
|
+
indexContent: index,
|
|
330
|
+
// docIndexFile defaults to DOCINDEX.md
|
|
331
|
+
})
|
|
305
332
|
```
|
|
306
333
|
|
|
307
334
|
## Output Format
|
|
@@ -351,8 +378,9 @@ This format:
|
|
|
351
378
|
2. **Download**: Uses git sparse-checkout to fetch only docs folder
|
|
352
379
|
3. **Index**: Builds a tree of all doc files
|
|
353
380
|
4. **Compress**: Generates pipe-delimited format
|
|
354
|
-
5. **
|
|
355
|
-
6. **
|
|
381
|
+
5. **Write index**: Writes/updates the full index in `DOCINDEX.md` (one marked block per provider)
|
|
382
|
+
6. **Summarize**: Refreshes the `## Document Indices` pointer section in `AGENTS.md` / `CLAUDE.md` with the current list of indices
|
|
383
|
+
7. **Gitignore**: Adds docs directory to .gitignore
|
|
356
384
|
|
|
357
385
|
## Contributing
|
|
358
386
|
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
DEFAULT_DOC_INDEX_FILE,
|
|
4
|
+
applyDocIndex,
|
|
3
5
|
basedpyrightProvider,
|
|
4
6
|
buildDocTree,
|
|
5
7
|
bunProvider,
|
|
@@ -20,11 +22,9 @@ import {
|
|
|
20
22
|
generateSkillsIndex,
|
|
21
23
|
getDefaultOutput,
|
|
22
24
|
getDefaultSkillSources,
|
|
23
|
-
|
|
25
|
+
getDocIndexEntries,
|
|
24
26
|
getProvider,
|
|
25
|
-
hasExistingIndex,
|
|
26
27
|
hasExistingSkillsIndex,
|
|
27
|
-
injectIndex,
|
|
28
28
|
injectSkillsIndex,
|
|
29
29
|
isProviderAvailable,
|
|
30
30
|
listProviders,
|
|
@@ -36,7 +36,8 @@ import {
|
|
|
36
36
|
polarsProvider,
|
|
37
37
|
rattlerBuildProvider,
|
|
38
38
|
readIndexLockfile,
|
|
39
|
-
|
|
39
|
+
removeDocIndexEntry,
|
|
40
|
+
removeIndexLockEntries,
|
|
40
41
|
removeSkillsIndex,
|
|
41
42
|
ruffProvider,
|
|
42
43
|
svelteProvider,
|
|
@@ -44,12 +45,12 @@ import {
|
|
|
44
45
|
tauriProvider,
|
|
45
46
|
tyProvider,
|
|
46
47
|
upsertIndexLockEntry
|
|
47
|
-
} from "../index-
|
|
48
|
+
} from "../index-xbmyce2p.js";
|
|
48
49
|
import {
|
|
49
50
|
__commonJS,
|
|
50
51
|
__require,
|
|
51
52
|
__toESM
|
|
52
|
-
} from "../
|
|
53
|
+
} from "../index-pyanjjwn.js";
|
|
53
54
|
|
|
54
55
|
// node_modules/commander/lib/error.js
|
|
55
56
|
var require_error = __commonJS((exports) => {
|
|
@@ -2114,7 +2115,7 @@ var require_clear = __commonJS((exports, module) => {
|
|
|
2114
2115
|
if (it)
|
|
2115
2116
|
o = it;
|
|
2116
2117
|
var i = 0;
|
|
2117
|
-
var F = function
|
|
2118
|
+
var F = function F2() {};
|
|
2118
2119
|
return { s: F, n: function n() {
|
|
2119
2120
|
if (i >= o.length)
|
|
2120
2121
|
return { done: true };
|
|
@@ -4446,7 +4447,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
4446
4447
|
if (it)
|
|
4447
4448
|
o = it;
|
|
4448
4449
|
var i = 0;
|
|
4449
|
-
var F = function
|
|
4450
|
+
var F = function F2() {};
|
|
4450
4451
|
return { s: F, n: function n() {
|
|
4451
4452
|
if (i >= o.length)
|
|
4452
4453
|
return { done: true };
|
|
@@ -4549,7 +4550,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4549
4550
|
}
|
|
4550
4551
|
return question2.format ? yield question2.format(answer2, answers) : answer2;
|
|
4551
4552
|
});
|
|
4552
|
-
return function
|
|
4553
|
+
return function getFormattedAnswer2(_x, _x2) {
|
|
4553
4554
|
return _ref.apply(this, arguments);
|
|
4554
4555
|
};
|
|
4555
4556
|
}();
|
|
@@ -7160,9 +7161,13 @@ Embedding ${import_picocolors2.default.cyan(provider.displayName)} ${import_pico
|
|
|
7160
7161
|
} else {
|
|
7161
7162
|
console.log(`${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolors2.default.bold(result.docsPath)}`);
|
|
7162
7163
|
}
|
|
7164
|
+
if (result.docIndexFile) {
|
|
7165
|
+
const docSizeInfo = result.docIndexSizeBefore === 0 ? formatSize(result.docIndexSizeAfter) : `${formatSize(result.docIndexSizeBefore)} → ${formatSize(result.docIndexSizeAfter)}`;
|
|
7166
|
+
console.log(`${import_picocolors2.default.green("✓")} Wrote index to ${import_picocolors2.default.bold(result.docIndexFile)} (${docSizeInfo})`);
|
|
7167
|
+
}
|
|
7163
7168
|
const action = result.isNewFile ? "Created" : "Updated";
|
|
7164
7169
|
const sizeInfo = result.isNewFile ? formatSize(result.sizeAfter) : `${formatSize(result.sizeBefore)} → ${formatSize(result.sizeAfter)}`;
|
|
7165
|
-
console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
|
|
7170
|
+
console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} summary (${sizeInfo})`);
|
|
7166
7171
|
if (result.gitignoreUpdated) {
|
|
7167
7172
|
console.log(`${import_picocolors2.default.green("✓")} Added ${import_picocolors2.default.bold(".agdex")} to .gitignore`);
|
|
7168
7173
|
}
|
|
@@ -7555,15 +7560,6 @@ async function runLocal(docsPath, options) {
|
|
|
7555
7560
|
const extensions = options.extensions?.split(",") || [".md", ".mdx"];
|
|
7556
7561
|
console.log(`
|
|
7557
7562
|
Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
|
|
7558
|
-
const targetPath = path.join(cwd, output);
|
|
7559
|
-
let existingContent = "";
|
|
7560
|
-
let sizeBefore = 0;
|
|
7561
|
-
let isNewFile = true;
|
|
7562
|
-
if (fs.existsSync(targetPath)) {
|
|
7563
|
-
existingContent = fs.readFileSync(targetPath, "utf-8");
|
|
7564
|
-
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
7565
|
-
isNewFile = false;
|
|
7566
|
-
}
|
|
7567
7563
|
const docFiles = collectDocFiles(absoluteDocsPath, { extensions });
|
|
7568
7564
|
const sections = buildDocTree(docFiles);
|
|
7569
7565
|
const indexContent = generateIndex({
|
|
@@ -7575,9 +7571,7 @@ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
|
|
|
7575
7571
|
regenerateCommand: `npx agdex local ${docsPath} --name "${name}" --output ${output}`
|
|
7576
7572
|
});
|
|
7577
7573
|
const providerName = name.toLowerCase().replace(/\s+/g, "-");
|
|
7578
|
-
const
|
|
7579
|
-
fs.writeFileSync(targetPath, newContent, "utf-8");
|
|
7580
|
-
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
|
|
7574
|
+
const applied = applyDocIndex({ cwd, agentFile: output, providerName, indexContent });
|
|
7581
7575
|
upsertIndexLockEntry(cwd, {
|
|
7582
7576
|
id: createIndexId("docs", providerName, output),
|
|
7583
7577
|
kind: "docs",
|
|
@@ -7593,15 +7587,19 @@ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
|
|
|
7593
7587
|
cachePath: absoluteDocsPath,
|
|
7594
7588
|
command: `npx agdex local ${docsPath} --name "${name}" --output ${output}`
|
|
7595
7589
|
});
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7590
|
+
printApplyResult(applied);
|
|
7591
|
+
}
|
|
7592
|
+
function printApplyResult(applied) {
|
|
7593
|
+
const docSizeInfo = applied.docIndexSizeBefore === 0 ? formatSize(applied.docIndexSizeAfter) : `${formatSize(applied.docIndexSizeBefore)} → ${formatSize(applied.docIndexSizeAfter)}`;
|
|
7594
|
+
console.log(`${import_picocolors2.default.green("✓")} Wrote index to ${import_picocolors2.default.bold(applied.docIndexFile)} (${docSizeInfo})`);
|
|
7595
|
+
const action = applied.isNewAgentFile ? "Created" : "Updated";
|
|
7596
|
+
const sizeInfo = applied.isNewAgentFile ? formatSize(applied.agentSizeAfter) : `${formatSize(applied.agentSizeBefore)} → ${formatSize(applied.agentSizeAfter)}`;
|
|
7597
|
+
console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(applied.agentFile)} summary (${sizeInfo})`);
|
|
7599
7598
|
console.log("");
|
|
7600
7599
|
}
|
|
7601
7600
|
async function runUrl(url, options) {
|
|
7602
7601
|
const cwd = process.cwd();
|
|
7603
|
-
const {
|
|
7604
|
-
const { pullDocsFromUrl } = await import("../url-scraper-fme0jdje.js");
|
|
7602
|
+
const { pullDocsFromUrl } = await import("../url-scraper-9bqyj00r.js");
|
|
7605
7603
|
const name = options.name || new URL(url).hostname.replace(/^docs\./, "").replace(/\.\w+$/, "");
|
|
7606
7604
|
const providerName = name.toLowerCase().replace(/\s+/g, "-");
|
|
7607
7605
|
const output = options.output || getDefaultOutput();
|
|
@@ -7635,15 +7633,6 @@ Failed: ${pullResult.error}`));
|
|
|
7635
7633
|
console.log(`
|
|
7636
7634
|
${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolors2.default.bold(docsPath)}`);
|
|
7637
7635
|
}
|
|
7638
|
-
const targetPath = path.join(cwd, output);
|
|
7639
|
-
let existingContent = "";
|
|
7640
|
-
let sizeBefore = 0;
|
|
7641
|
-
let isNewFile = true;
|
|
7642
|
-
if (fs.existsSync(targetPath)) {
|
|
7643
|
-
existingContent = fs.readFileSync(targetPath, "utf-8");
|
|
7644
|
-
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
7645
|
-
isNewFile = false;
|
|
7646
|
-
}
|
|
7647
7636
|
const docFiles = collectDocFiles(docsPath, { extensions: [".md"] });
|
|
7648
7637
|
const sections = buildDocTree(docFiles);
|
|
7649
7638
|
const indexContent = generateIndex({
|
|
@@ -7654,9 +7643,7 @@ ${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolor
|
|
|
7654
7643
|
instruction: `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${name} tasks.`,
|
|
7655
7644
|
regenerateCommand: `npx agdex url "${url}" --name "${name}" --output ${output}${globalCache ? " --global" : ""}`
|
|
7656
7645
|
});
|
|
7657
|
-
const
|
|
7658
|
-
fs.writeFileSync(targetPath, newContent, "utf-8");
|
|
7659
|
-
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
|
|
7646
|
+
const applied = applyDocIndex({ cwd, agentFile: output, providerName, indexContent });
|
|
7660
7647
|
upsertIndexLockEntry(cwd, {
|
|
7661
7648
|
id: createIndexId("docs", providerName, output),
|
|
7662
7649
|
kind: "docs",
|
|
@@ -7673,16 +7660,13 @@ ${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolor
|
|
|
7673
7660
|
cachePath: docsPath,
|
|
7674
7661
|
command: `npx agdex url "${url}" --name "${name}" --output ${output}${globalCache ? " --global" : ""}`
|
|
7675
7662
|
});
|
|
7676
|
-
const action = isNewFile ? "Created" : "Updated";
|
|
7677
|
-
const sizeInfo = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
|
|
7678
|
-
console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
|
|
7679
7663
|
if (!globalCache) {
|
|
7680
7664
|
const gitignoreResult = ensureGitignoreEntry(cwd, ".agdex");
|
|
7681
7665
|
if (gitignoreResult.updated) {
|
|
7682
7666
|
console.log(`${import_picocolors2.default.green("✓")} Added ${import_picocolors2.default.bold(".agdex")} to .gitignore`);
|
|
7683
7667
|
}
|
|
7684
7668
|
}
|
|
7685
|
-
|
|
7669
|
+
printApplyResult(applied);
|
|
7686
7670
|
}
|
|
7687
7671
|
function runList() {
|
|
7688
7672
|
console.log(import_picocolors2.default.cyan(`
|
|
@@ -7915,29 +7899,33 @@ agdex migrate
|
|
|
7915
7899
|
console.log("");
|
|
7916
7900
|
}
|
|
7917
7901
|
program2.command("migrate").description("Create lockfile entries from existing embedded markers when safe").option("-o, --output <file>", "Migrate one agent instruction file").option("--json", "Print machine-readable JSON").action(runMigrate);
|
|
7902
|
+
function removeSkillsFromAgentFile(targetPath) {
|
|
7903
|
+
const content = fs.existsSync(targetPath) ? fs.readFileSync(targetPath, "utf-8") : "";
|
|
7904
|
+
if (!hasExistingSkillsIndex(content))
|
|
7905
|
+
return false;
|
|
7906
|
+
fs.writeFileSync(targetPath, removeSkillsIndex(content), "utf-8");
|
|
7907
|
+
return true;
|
|
7908
|
+
}
|
|
7918
7909
|
async function runRemove(options) {
|
|
7919
7910
|
const cwd = process.cwd();
|
|
7920
7911
|
const output = options.output || getDefaultOutput();
|
|
7921
7912
|
const targetPath = path.join(cwd, output);
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
}
|
|
7926
|
-
let content = fs.readFileSync(targetPath, "utf-8");
|
|
7927
|
-
const sizeBefore = Buffer.byteLength(content, "utf-8");
|
|
7913
|
+
const docIndexPath = path.join(cwd, DEFAULT_DOC_INDEX_FILE);
|
|
7914
|
+
const agentContent = fs.existsSync(targetPath) ? fs.readFileSync(targetPath, "utf-8") : "";
|
|
7915
|
+
const docIndexContent = fs.existsSync(docIndexPath) ? fs.readFileSync(docIndexPath, "utf-8") : "";
|
|
7928
7916
|
const hasExplicitFlags = options.docs || options.skills || options.provider;
|
|
7929
7917
|
if (!hasExplicitFlags) {
|
|
7930
|
-
const
|
|
7931
|
-
const hasSkills = hasExistingSkillsIndex(
|
|
7932
|
-
if (
|
|
7918
|
+
const docEntries = getDocIndexEntries(docIndexContent);
|
|
7919
|
+
const hasSkills = hasExistingSkillsIndex(agentContent);
|
|
7920
|
+
if (docEntries.length === 0 && !hasSkills) {
|
|
7933
7921
|
console.log(import_picocolors2.default.yellow(`
|
|
7934
7922
|
No indices found to remove.
|
|
7935
7923
|
`));
|
|
7936
7924
|
return;
|
|
7937
7925
|
}
|
|
7938
7926
|
const choices = [];
|
|
7939
|
-
for (const
|
|
7940
|
-
choices.push({ title: `docs: ${
|
|
7927
|
+
for (const entry of docEntries) {
|
|
7928
|
+
choices.push({ title: `docs: ${entry.displayName} (${entry.name})`, value: `docs:${entry.name}` });
|
|
7941
7929
|
}
|
|
7942
7930
|
if (hasSkills) {
|
|
7943
7931
|
choices.push({ title: "skills", value: "skills" });
|
|
@@ -7957,64 +7945,66 @@ No indices selected.
|
|
|
7957
7945
|
return;
|
|
7958
7946
|
}
|
|
7959
7947
|
const selected = response.indices;
|
|
7960
|
-
|
|
7948
|
+
const docsRemoved2 = [];
|
|
7961
7949
|
let skillsRemoved2 = false;
|
|
7962
7950
|
for (const item of selected) {
|
|
7963
|
-
if (item
|
|
7964
|
-
content = removeSkillsIndex(content);
|
|
7965
|
-
skillsRemoved2 = true;
|
|
7966
|
-
} else if (item.startsWith("docs:")) {
|
|
7951
|
+
if (item.startsWith("docs:")) {
|
|
7967
7952
|
const provider = item.slice(5);
|
|
7968
|
-
|
|
7969
|
-
|
|
7953
|
+
const res = removeDocIndexEntry({ cwd, agentFile: output, providerName: provider });
|
|
7954
|
+
if (res.removed) {
|
|
7955
|
+
docsRemoved2.push(...res.removedProviders);
|
|
7956
|
+
for (const removedProvider of res.removedProviders) {
|
|
7957
|
+
removeIndexLockEntries(cwd, { kind: "docs", marker: removedProvider });
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7970
7960
|
}
|
|
7971
7961
|
}
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
console.log(`${import_picocolors2.default.green("✓")} Removed docs index (${provider}) from ${import_picocolors2.default.bold(output)}`);
|
|
7977
|
-
}
|
|
7978
|
-
if (skillsRemoved2) {
|
|
7979
|
-
console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
|
|
7962
|
+
if (selected.includes("skills")) {
|
|
7963
|
+
skillsRemoved2 = removeSkillsFromAgentFile(targetPath);
|
|
7964
|
+
if (skillsRemoved2)
|
|
7965
|
+
removeIndexLockEntries(cwd, { kind: "skills", targetFile: output });
|
|
7980
7966
|
}
|
|
7981
|
-
|
|
7982
|
-
console.log("");
|
|
7967
|
+
printRemoveResult(docsRemoved2, skillsRemoved2, output);
|
|
7983
7968
|
return;
|
|
7984
7969
|
}
|
|
7985
7970
|
const removeAll = !options.docs && !options.skills;
|
|
7986
7971
|
const removeDocs = removeAll || options.docs;
|
|
7987
7972
|
const removeSkillsIdx = removeAll || options.skills;
|
|
7988
|
-
|
|
7973
|
+
const docsRemoved = [];
|
|
7989
7974
|
let skillsRemoved = false;
|
|
7990
|
-
if (removeDocs
|
|
7991
|
-
|
|
7992
|
-
|
|
7975
|
+
if (removeDocs) {
|
|
7976
|
+
const res = removeDocIndexEntry({ cwd, agentFile: output, providerName: options.provider });
|
|
7977
|
+
if (res.removed) {
|
|
7978
|
+
docsRemoved.push(...res.removedProviders);
|
|
7979
|
+
for (const removedProvider of res.removedProviders) {
|
|
7980
|
+
removeIndexLockEntries(cwd, { kind: "docs", marker: removedProvider });
|
|
7981
|
+
}
|
|
7982
|
+
}
|
|
7993
7983
|
}
|
|
7994
|
-
if (removeSkillsIdx
|
|
7995
|
-
|
|
7996
|
-
skillsRemoved
|
|
7984
|
+
if (removeSkillsIdx) {
|
|
7985
|
+
skillsRemoved = removeSkillsFromAgentFile(targetPath);
|
|
7986
|
+
if (skillsRemoved)
|
|
7987
|
+
removeIndexLockEntries(cwd, { kind: "skills", targetFile: output });
|
|
7997
7988
|
}
|
|
7998
|
-
if (
|
|
7989
|
+
if (docsRemoved.length === 0 && !skillsRemoved) {
|
|
7999
7990
|
console.log(import_picocolors2.default.yellow(`
|
|
8000
7991
|
No indices found to remove.
|
|
8001
7992
|
`));
|
|
8002
7993
|
return;
|
|
8003
7994
|
}
|
|
8004
|
-
|
|
8005
|
-
|
|
7995
|
+
printRemoveResult(docsRemoved, skillsRemoved, output);
|
|
7996
|
+
}
|
|
7997
|
+
function printRemoveResult(docsRemoved, skillsRemoved, output) {
|
|
8006
7998
|
console.log("");
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
console.log(`${import_picocolors2.default.green("✓")} Removed docs index${providerInfo} from ${import_picocolors2.default.bold(output)}`);
|
|
7999
|
+
for (const provider of docsRemoved) {
|
|
8000
|
+
console.log(`${import_picocolors2.default.green("✓")} Removed docs index (${provider}) from ${import_picocolors2.default.bold(DEFAULT_DOC_INDEX_FILE)}`);
|
|
8010
8001
|
}
|
|
8011
8002
|
if (skillsRemoved) {
|
|
8012
8003
|
console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
|
|
8013
8004
|
}
|
|
8014
|
-
console.log(import_picocolors2.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
|
|
8015
8005
|
console.log("");
|
|
8016
8006
|
}
|
|
8017
|
-
program2.command("remove").description("Remove
|
|
8007
|
+
program2.command("remove").description("Remove docs indices from DOCINDEX.md (and skills indices from AGENTS.md/CLAUDE.md)").option("-o, --output <file>", "Target file (default: from config or CLAUDE.local.md)").option("--docs", "Remove only docs indices (from DOCINDEX.md)").option("--skills", "Remove only skills index").option("-p, --provider <name>", "Remove only a specific provider's docs index").action(runRemove);
|
|
8018
8008
|
var skillsCommand = program2.command("skills").description("Manage Claude Code skills indexing");
|
|
8019
8009
|
async function runSkillsEmbed(options) {
|
|
8020
8010
|
const cwd = process.cwd();
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__toESM
|
|
4
|
+
} from "./index-pyanjjwn.js";
|
|
20
5
|
|
|
21
6
|
// node_modules/he/he.js
|
|
22
7
|
var require_he = __commonJS((exports, module) => {
|
|
@@ -10832,7 +10817,7 @@ var require_htmlelts = __commonJS((exports) => {
|
|
|
10832
10817
|
var HTMLElement = exports.HTMLElement = define2({
|
|
10833
10818
|
superclass: Element,
|
|
10834
10819
|
name: "HTMLElement",
|
|
10835
|
-
ctor: function
|
|
10820
|
+
ctor: function HTMLElement2(doc, localName, prefix) {
|
|
10836
10821
|
Element.call(this, doc, localName, utils.NAMESPACE.HTML, prefix);
|
|
10837
10822
|
},
|
|
10838
10823
|
props: {
|
|
@@ -10969,7 +10954,7 @@ var require_htmlelts = __commonJS((exports) => {
|
|
|
10969
10954
|
});
|
|
10970
10955
|
var HTMLUnknownElement = define2({
|
|
10971
10956
|
name: "HTMLUnknownElement",
|
|
10972
|
-
ctor: function
|
|
10957
|
+
ctor: function HTMLUnknownElement2(doc, localName, prefix) {
|
|
10973
10958
|
HTMLElement.call(this, doc, localName, prefix);
|
|
10974
10959
|
}
|
|
10975
10960
|
});
|
|
@@ -11184,7 +11169,7 @@ var require_htmlelts = __commonJS((exports) => {
|
|
|
11184
11169
|
define2({
|
|
11185
11170
|
tag: "form",
|
|
11186
11171
|
name: "HTMLFormElement",
|
|
11187
|
-
ctor: function
|
|
11172
|
+
ctor: function HTMLFormElement2(doc, localName, prefix) {
|
|
11188
11173
|
HTMLElement.call(this, doc, localName, prefix);
|
|
11189
11174
|
},
|
|
11190
11175
|
attributes: {
|
|
@@ -12241,7 +12226,7 @@ var require_svg = __commonJS((exports) => {
|
|
|
12241
12226
|
var SVGElement = define2({
|
|
12242
12227
|
superclass: Element,
|
|
12243
12228
|
name: "SVGElement",
|
|
12244
|
-
ctor: function
|
|
12229
|
+
ctor: function SVGElement2(doc, localName, prefix) {
|
|
12245
12230
|
Element.call(this, doc, localName, utils.NAMESPACE.SVG, prefix);
|
|
12246
12231
|
},
|
|
12247
12232
|
props: {
|
|
@@ -12660,7 +12645,7 @@ var require_Document = __commonJS((exports, module) => {
|
|
|
12660
12645
|
contentType: { get: function contentType() {
|
|
12661
12646
|
return this._contentType;
|
|
12662
12647
|
} },
|
|
12663
|
-
URL: { get: function
|
|
12648
|
+
URL: { get: function URL3() {
|
|
12664
12649
|
return this._address;
|
|
12665
12650
|
} },
|
|
12666
12651
|
domain: { get: utils.nyi, set: utils.nyi },
|
|
@@ -16498,7 +16483,7 @@ var require_HTMLParser = __commonJS((exports, module) => {
|
|
|
16498
16483
|
parser(EOF);
|
|
16499
16484
|
doc.modclock = 1;
|
|
16500
16485
|
}
|
|
16501
|
-
var insertToken = htmlparser.insertToken = function
|
|
16486
|
+
var insertToken = htmlparser.insertToken = function insertToken2(t, value, arg3, arg4) {
|
|
16502
16487
|
flushText();
|
|
16503
16488
|
var current = stack.top;
|
|
16504
16489
|
if (!current || current.namespaceURI === NAMESPACE.HTML) {
|
|
@@ -22415,21 +22400,5 @@ async function pullDocsFromUrl(config, destDir, options) {
|
|
|
22415
22400
|
};
|
|
22416
22401
|
}
|
|
22417
22402
|
}
|
|
22418
|
-
function createUrlProvider(options) {
|
|
22419
|
-
return {
|
|
22420
|
-
name: options.name,
|
|
22421
|
-
displayName: options.displayName,
|
|
22422
|
-
repo: "",
|
|
22423
|
-
docsPath: "",
|
|
22424
|
-
extensions: options.extensions || [".md"],
|
|
22425
|
-
excludePatterns: options.excludePatterns || [],
|
|
22426
|
-
instruction: options.instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${options.displayName} tasks.`,
|
|
22427
|
-
urlConfig: options.urlConfig
|
|
22428
|
-
};
|
|
22429
|
-
}
|
|
22430
|
-
export {
|
|
22431
|
-
pullDocsFromUrl,
|
|
22432
|
-
createUrlProvider
|
|
22433
|
-
};
|
|
22434
22403
|
|
|
22435
|
-
export {
|
|
22404
|
+
export { pullDocsFromUrl };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
export { __toESM, __commonJS, __require };
|