@open-agent-toolkit/docs-config 0.3.25 → 0.3.26

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
@@ -30,10 +30,16 @@ export default createDocsConfig({
30
30
  import { createSourceConfig } from '@open-agent-toolkit/docs-config';
31
31
  import { defineConfig, defineDocs } from 'fumadocs-mdx/config';
32
32
 
33
- const sourceConfig = createSourceConfig();
33
+ // Paths resolve from the app working directory, including bundled source configs.
34
+ const sourceConfig = createSourceConfig({
35
+ oatConfigFile: '../../.oat/config.json',
36
+ appRoot: '.',
37
+ });
34
38
 
35
39
  export const docs = defineDocs({
36
40
  dir: sourceConfig.contentDir,
41
+ docs: sourceConfig.docs,
42
+ meta: sourceConfig.meta,
37
43
  });
38
44
 
39
45
  export default defineConfig({
@@ -43,6 +49,10 @@ export default defineConfig({
43
49
  });
44
50
  ```
45
51
 
52
+ The `docs` and `meta` options apply shared `documentation.nonReaderPaths` only when the explicit repo config's documentation root matches this app. Patterns follow OAT's bounded content-root-relative grammar: `*` within a segment, whole-segment `**` across directories, trailing `/` for directories, all other characters literal. Excluded directories omit descendants and metadata. `documentation.excludes` remains manifest-only. No ancestor config search occurs; scaffolded apps receive their resolved relative config path.
53
+
54
+ The metadata schema preserves Fumadocs fields and accepts boolean roots and nonempty trimmed string inputs. String inputs normalize to `true` for the pinned generated collection types; authored metadata files remain unchanged. Booleans, including `false`, retain their values. Use both source options so collection validation and rendering agree with navigation. The scaffold pins MkDocs 1.4.2 separately; that version has no configurable rendering exclusion, so its non-readers leave nav/manifest but still render as routes.
55
+
46
56
  ## Exports
47
57
 
48
58
  - `createDocsConfig`
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Adapt OAT's bounded exclusion grammar to collection globs. Only `*` and a
3
+ * whole-segment `**` are operators; every other glob metacharacter is literal.
4
+ * Negative patterns cover descendants too because matching a directory prunes it.
5
+ */
6
+ export declare function collectionFiles(patterns: readonly string[], extensions: string[]): string[];
7
+ //# sourceMappingURL=reader-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reader-paths.d.ts","sourceRoot":"","sources":["../src/reader-paths.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,EAAE,CA8BV"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Adapt OAT's bounded exclusion grammar to collection globs. Only `*` and a
3
+ * whole-segment `**` are operators; every other glob metacharacter is literal.
4
+ * Negative patterns cover descendants too because matching a directory prunes it.
5
+ */
6
+ export function collectionFiles(patterns, extensions) {
7
+ const files = [`**/*.{${extensions.join(',')}}`];
8
+ for (const raw of patterns) {
9
+ const trimmed = raw.trim();
10
+ const directoryOnly = trimmed.endsWith('/');
11
+ const path = trimmed
12
+ .replace(/\/+$/, '')
13
+ .replace(/^\.\//, '')
14
+ .replace(/^\/+/, '');
15
+ if (!path)
16
+ continue;
17
+ const segments = path.split('/');
18
+ const glob = segments
19
+ .map((segment) => segment === '**'
20
+ ? '**'
21
+ : segment.replace(/\*+/g, '*').replace(/[?[\]{}()!+@|\\]/g, '\\$&'))
22
+ .join('/');
23
+ if (directoryOnly) {
24
+ // A globstar may consume zero segments, but a pruned directory must
25
+ // consume at least one, followed by an actual descendant file.
26
+ const directoryGlob = segments.every((segment) => segment === '**')
27
+ ? '*'
28
+ : glob;
29
+ files.push(`!${directoryGlob}/**/*`);
30
+ }
31
+ else {
32
+ files.push(`!${glob}`, `!${glob}/**`);
33
+ }
34
+ }
35
+ return files;
36
+ }
@@ -2,11 +2,34 @@ import type { Root } from 'mdast';
2
2
  import type { Plugin } from 'unified';
3
3
  import { type SearchConfig } from './search-config.js';
4
4
  type RemarkPlugin = Plugin<any[], Root>;
5
+ declare const docsMetaSchema: import("zod").ZodObject<{
6
+ title: import("zod").ZodOptional<import("zod").ZodString>;
7
+ pages: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
8
+ pagesIndex: import("zod").ZodOptional<import("zod").ZodString>;
9
+ description: import("zod").ZodOptional<import("zod").ZodString>;
10
+ defaultOpen: import("zod").ZodOptional<import("zod").ZodBoolean>;
11
+ collapsible: import("zod").ZodOptional<import("zod").ZodBoolean>;
12
+ icon: import("zod").ZodOptional<import("zod").ZodString>;
13
+ root: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodBoolean, import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<boolean, string>>]>>;
14
+ }, import("zod/v4/core").$strip>;
15
+ export interface SourceConfigOptions {
16
+ /** Explicit repository .oat/config.json location; no ancestor search. */
17
+ oatConfigFile?: string | URL;
18
+ /** The source.config.ts app directory; settings apply only to the matching app. */
19
+ appRoot?: string | URL;
20
+ }
5
21
  export interface SourceConfigResult {
6
22
  remarkPlugins: RemarkPlugin[];
7
23
  contentDir: string;
8
24
  search: SearchConfig;
25
+ docs: {
26
+ files: string[];
27
+ };
28
+ meta: {
29
+ files: string[];
30
+ schema: typeof docsMetaSchema;
31
+ };
9
32
  }
10
- export declare function createSourceConfig(): SourceConfigResult;
33
+ export declare function createSourceConfig(options?: SourceConfigOptions): SourceConfigResult;
11
34
  export {};
12
35
  //# sourceMappingURL=source-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG3E,KAAK,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,kBAAkB,IAAI,kBAAkB,CAMvD"}
1
+ {"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG3E,KAAK,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AAIxC,QAAA,MAAM,cAAc;;;;;;;;;gCAWlB,CAAC;AAEH,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC1B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,cAAc,CAAA;KAAE,CAAC;CAC1D;AAuCD,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAYpB"}
@@ -1,10 +1,63 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
1
4
  import { remarkLinks, remarkMermaid, remarkTabs, } from '@open-agent-toolkit/docs-transforms';
5
+ import { metaSchema } from 'fumadocs-core/source/schema';
2
6
  import { remarkAlert } from 'remark-github-blockquote-alert';
7
+ import { collectionFiles } from './reader-paths.js';
3
8
  import { createSearchConfig } from './search-config.js';
4
- export function createSourceConfig() {
9
+ // Accept named-root inputs while keeping output compatible with fumadocs-mdx
10
+ // 14.3.2's generated server.docs conditional and core 16.10.2's MetaData.
11
+ const docsMetaSchema = metaSchema.extend({
12
+ root: metaSchema.shape.root
13
+ .unwrap()
14
+ .or(metaSchema.shape.title
15
+ .unwrap()
16
+ .trim()
17
+ .min(1)
18
+ .transform(() => true))
19
+ .optional(),
20
+ });
21
+ function nonReaderPaths(options) {
22
+ if (!options.oatConfigFile || !options.appRoot)
23
+ return [];
24
+ const configFile = options.oatConfigFile instanceof URL
25
+ ? fileURLToPath(options.oatConfigFile)
26
+ : resolve(options.oatConfigFile);
27
+ const appRoot = options.appRoot instanceof URL
28
+ ? fileURLToPath(options.appRoot)
29
+ : options.appRoot;
30
+ let config;
31
+ try {
32
+ config = JSON.parse(readFileSync(configFile, 'utf8'));
33
+ }
34
+ catch (error) {
35
+ if (error.code === 'ENOENT')
36
+ return [];
37
+ throw error;
38
+ }
39
+ const doc = config.documentation;
40
+ if (typeof doc?.root !== 'string' ||
41
+ resolve(dirname(dirname(configFile)), doc.root.trim()) !== resolve(appRoot))
42
+ return [];
43
+ if (doc.nonReaderPaths === undefined)
44
+ return [];
45
+ if (!Array.isArray(doc.nonReaderPaths) ||
46
+ doc.nonReaderPaths.some((value) => typeof value !== 'string' || !value.trim())) {
47
+ throw new Error(`Invalid documentation.nonReaderPaths in ${configFile}: expected an array of non-empty strings.`);
48
+ }
49
+ return doc.nonReaderPaths;
50
+ }
51
+ export function createSourceConfig(options = {}) {
52
+ const patterns = nonReaderPaths(options);
5
53
  return {
6
54
  remarkPlugins: [remarkLinks, remarkTabs, remarkAlert, remarkMermaid],
7
55
  contentDir: './docs',
8
56
  search: createSearchConfig(),
57
+ docs: { files: collectionFiles(patterns, ['md', 'mdx']) },
58
+ meta: {
59
+ files: collectionFiles(patterns, ['json', 'yaml']),
60
+ schema: docsMetaSchema,
61
+ },
9
62
  };
10
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-agent-toolkit/docs-config",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "private": false,
5
5
  "description": "Configuration factories for OAT documentation sites",
6
6
  "homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/docs-config",
@@ -33,7 +33,8 @@
33
33
  "flexsearch": "^0.8.212",
34
34
  "remark-github-blockquote-alert": "^2.0.1",
35
35
  "unified": "^11.0.5",
36
- "@open-agent-toolkit/docs-transforms": "0.3.25"
36
+ "zod": "^4.3.6",
37
+ "@open-agent-toolkit/docs-transforms": "0.3.26"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/mdast": "^4.0.4",