@takazudo/zudo-doc 2.4.1 → 2.5.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/dist/integrations/claude-resources/generate.js +5 -2
- package/dist/integrations/claude-resources/index.d.ts +19 -2
- package/dist/integrations/claude-resources/index.js +2 -1
- package/dist/plugins/claude-resources.js +2 -0
- package/dist/preset.d.ts +5 -0
- package/dist/preset.js +1 -0
- package/dist/settings.d.ts +1 -0
- package/package.json +2 -2
|
@@ -97,11 +97,14 @@ function downgradeRepoRelativeLinks(content) {
|
|
|
97
97
|
function findClaudeMdFiles(dir, excludeDirs) {
|
|
98
98
|
const results = [];
|
|
99
99
|
if (!fs.existsSync(dir)) return results;
|
|
100
|
+
const excludes = excludeDirs.map(
|
|
101
|
+
(d) => d.endsWith(path.sep) ? d.slice(0, -path.sep.length) : d
|
|
102
|
+
);
|
|
100
103
|
for (const item of fs.readdirSync(dir)) {
|
|
101
104
|
if (item === "node_modules") continue;
|
|
102
105
|
if (item.startsWith(".")) continue;
|
|
103
106
|
const itemPath = path.join(dir, item);
|
|
104
|
-
if (
|
|
107
|
+
if (excludes.some((d) => itemPath === d || itemPath.startsWith(d + path.sep))) continue;
|
|
105
108
|
let stat;
|
|
106
109
|
try {
|
|
107
110
|
stat = fs.lstatSync(itemPath);
|
|
@@ -109,7 +112,7 @@ function findClaudeMdFiles(dir, excludeDirs) {
|
|
|
109
112
|
continue;
|
|
110
113
|
}
|
|
111
114
|
if (stat.isDirectory()) {
|
|
112
|
-
results.push(...findClaudeMdFiles(itemPath,
|
|
115
|
+
results.push(...findClaudeMdFiles(itemPath, excludes));
|
|
113
116
|
} else if (stat.isFile() && item === "CLAUDE.md") {
|
|
114
117
|
results.push(itemPath);
|
|
115
118
|
}
|
|
@@ -12,10 +12,27 @@ export interface ClaudeResourcesPluginOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
claudeDir: string;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* and
|
|
15
|
+
* Anchor for resolving the relative `claudeDir`, `docsDir`, and `scanRoot`
|
|
16
|
+
* paths, and the default value of `scanRoot`. Defaults to `process.cwd()`.
|
|
17
|
+
*
|
|
18
|
+
* Note: this does NOT itself decide where `CLAUDE.md` discovery walks — that
|
|
19
|
+
* is `scanRoot` (which defaults to this). Set `scanRoot` to widen discovery
|
|
20
|
+
* (e.g. a subdirectory doc site scanning its repo root) without moving the
|
|
21
|
+
* output base, which stays anchored here.
|
|
17
22
|
*/
|
|
18
23
|
projectRoot?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Root for `CLAUDE.md` discovery and the base for the generated pages'
|
|
26
|
+
* relative-path titles/slugs. Defaults to `projectRoot`. Resolved against
|
|
27
|
+
* `projectRoot` when relative (absolute allowed).
|
|
28
|
+
*
|
|
29
|
+
* Scope: governs `CLAUDE.md` discovery ONLY. Commands, skills, and agents
|
|
30
|
+
* always come from `claudeDir` and are unaffected by `scanRoot`. Decoupling
|
|
31
|
+
* this from `projectRoot` lets a doc site in a repo subdirectory scan
|
|
32
|
+
* repo-wide `CLAUDE.md` files while still writing generated pages into its
|
|
33
|
+
* own content collection (see #2558).
|
|
34
|
+
*/
|
|
35
|
+
scanRoot?: string;
|
|
19
36
|
/**
|
|
20
37
|
* Output directory for generated MDX pages, resolved against
|
|
21
38
|
* `projectRoot` when relative. Defaults to `src/content/docs` to
|
|
@@ -12,9 +12,10 @@ function claudeResourcesPlugin(options) {
|
|
|
12
12
|
function runClaudeResourcesPreStep(options) {
|
|
13
13
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
14
14
|
const claudeDir = path.isAbsolute(options.claudeDir) ? options.claudeDir : path.resolve(projectRoot, options.claudeDir);
|
|
15
|
+
const scanRoot = options.scanRoot === void 0 ? projectRoot : path.isAbsolute(options.scanRoot) ? options.scanRoot : path.resolve(projectRoot, options.scanRoot);
|
|
15
16
|
const docsDirInput = options.docsDir ?? "src/content/docs";
|
|
16
17
|
const docsDir = path.isAbsolute(docsDirInput) ? docsDirInput : path.resolve(projectRoot, docsDirInput);
|
|
17
|
-
return generateClaudeResourcesDocs({ claudeDir, projectRoot, docsDir });
|
|
18
|
+
return generateClaudeResourcesDocs({ claudeDir, projectRoot: scanRoot, docsDir });
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
20
21
|
CLAUDE_RESOURCES_PLUGIN_NAME,
|
|
@@ -10,10 +10,12 @@ const plugin = {
|
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
const projectRootOpt = ctx.options["projectRoot"];
|
|
13
|
+
const scanRootOpt = ctx.options["scanRoot"];
|
|
13
14
|
const docsDirOpt = ctx.options["docsDir"];
|
|
14
15
|
const result = await runClaudeResourcesPreStep({
|
|
15
16
|
claudeDir,
|
|
16
17
|
projectRoot: typeof projectRootOpt === "string" ? projectRootOpt : ctx.projectRoot,
|
|
18
|
+
scanRoot: typeof scanRootOpt === "string" ? scanRootOpt : void 0,
|
|
17
19
|
docsDir: typeof docsDirOpt === "string" ? docsDirOpt : "src/content/docs"
|
|
18
20
|
});
|
|
19
21
|
ctx.logger.info(
|
package/dist/preset.d.ts
CHANGED
|
@@ -50,6 +50,11 @@ export interface PresetVersionConfig {
|
|
|
50
50
|
export interface PresetClaudeResourcesConfig {
|
|
51
51
|
claudeDir: string;
|
|
52
52
|
projectRoot?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Root for `CLAUDE.md` discovery; defaults to `projectRoot`. Decouples
|
|
55
|
+
* repo-wide scanning from the output base for subdirectory doc sites (#2558).
|
|
56
|
+
*/
|
|
57
|
+
scanRoot?: string;
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
55
60
|
* The subset of `settings` the preset reads. Any concrete `typeof settings`
|
package/dist/preset.js
CHANGED
|
@@ -171,6 +171,7 @@ function buildPlugins(settings, routeContext) {
|
|
|
171
171
|
options: {
|
|
172
172
|
claudeDir: settings.claudeResources.claudeDir,
|
|
173
173
|
projectRoot: settings.claudeResources.projectRoot,
|
|
174
|
+
scanRoot: settings.claudeResources.scanRoot,
|
|
174
175
|
docsDir: settings.docsDir
|
|
175
176
|
}
|
|
176
177
|
}
|
package/dist/settings.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -586,7 +586,7 @@
|
|
|
586
586
|
"zod": "^4.3.6",
|
|
587
587
|
"@takazudo/zfb": "0.1.0-next.76",
|
|
588
588
|
"@takazudo/zfb-runtime": "0.1.0-next.76",
|
|
589
|
-
"@takazudo/zudo-doc-history-server": "2.
|
|
589
|
+
"@takazudo/zudo-doc-history-server": "2.5.0"
|
|
590
590
|
},
|
|
591
591
|
"scripts": {
|
|
592
592
|
"build": "tsup && tsc -p tsconfig.build.json",
|