@guiho/xdocs 0.3.1 → 0.4.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/DOCS.md +60 -27
  3. package/README.md +49 -18
  4. package/docs/2026-07-05-xdocs-document-model.md +77 -0
  5. package/docs/docs.xdocs.md +22 -0
  6. package/jsr.json +1 -1
  7. package/library/agents.d.ts +1 -1
  8. package/library/agents.d.ts.map +1 -1
  9. package/library/agents.js +10 -6
  10. package/library/commands/generate.d.ts.map +1 -1
  11. package/library/commands/generate.js +23 -1
  12. package/library/commands/list.d.ts.map +1 -1
  13. package/library/commands/list.js +14 -4
  14. package/library/commands/merge.d.ts.map +1 -1
  15. package/library/commands/merge.js +12 -1
  16. package/library/commands/scan.d.ts.map +1 -1
  17. package/library/commands/scan.js +13 -2
  18. package/library/config.d.ts.map +1 -1
  19. package/library/config.js +7 -3
  20. package/library/discovery.d.ts +8 -4
  21. package/library/discovery.d.ts.map +1 -1
  22. package/library/discovery.js +107 -17
  23. package/library/flags.d.ts +1 -1
  24. package/library/flags.js +1 -1
  25. package/library/guiho-xdocs.d.ts +2 -2
  26. package/library/guiho-xdocs.d.ts.map +1 -1
  27. package/library/guiho-xdocs.js +1 -1
  28. package/library/help.js +16 -15
  29. package/library/metadata.d.ts +1 -1
  30. package/library/metadata.d.ts.map +1 -1
  31. package/library/metadata.js +23 -3
  32. package/library/tree.d.ts +1 -1
  33. package/library/tree.d.ts.map +1 -1
  34. package/library/tree.js +2 -2
  35. package/library/types.d.ts +14 -2
  36. package/library/types.d.ts.map +1 -1
  37. package/package.json +4 -1
  38. package/prompts/agents.md +9 -2
  39. package/prompts/generate.md +10 -2
  40. package/prompts/prompts.xdocs.md +27 -0
  41. package/prompts/update.md +19 -7
  42. package/prompts/write.md +18 -5
  43. package/scripts/scripts.xdocs.md +5 -0
  44. package/skills/guiho-s-xdocs/SKILL.md +133 -32
  45. package/skills/guiho-s-xdocs/guiho-s-xdocs.xdocs.md +26 -0
  46. package/skills/skills.xdocs.md +9 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # GUIHO XDocs Changelog
2
2
 
3
+ ## 0.4.0-alpha.0
4
+
5
+ - Change the documentation model to one named `*.xdocs.md` descriptor per documented directory, with `XDOCS.md` reserved as the frontmatter-less repository index.
6
+ - Add first-class same-directory Markdown companion documents through the required `documents` metadata map, and validate descriptor/document alignment during scan.
7
+ - Reject nameless `.xdocs.md` descriptors, reject non-`.xdocs.md` descriptor extensions, and flag multiple descriptors in one directory.
8
+ - Update `scan`, `list`, `generate`, and `merge` output to surface both implementation files and companion Markdown documents.
9
+ - Add required `keywords` metadata to xdocs descriptors, surface descriptor keywords in scan/generate/merge output, and document companion Markdown `keywords` frontmatter.
10
+ - Refresh the bundled `guiho-s-xdocs` skill, prompt templates, README, architecture notes, AGENTS guidance, canonical `DOCS.md`, and package xdocs descriptors for the new model.
11
+
3
12
  ## 0.3.1
4
13
 
5
14
  - Fix bare `xdocs` invocations so they install or refresh the global `guiho-s-xdocs` skill before printing help, even without `xdocs.config.toml`, and remove legacy `guiho-as-xdocs` installs for that target.
package/DOCS.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # GUIHO XDocs Documentation -- @guiho/xdocs
2
2
 
3
- GUIHO XDocs is a deterministic CLI and TypeScript library for structured documentation of codebases. Each directory carries a small Markdown file with YAML frontmatter that describes its subject, purpose, files, and place in a parent-child hierarchy, so an AI agent (or a human) can understand a project without reading every source file.
3
+ GUIHO XDocs is a deterministic CLI and TypeScript library for structured documentation of codebases. Each documented directory carries exactly one named `*.xdocs.md` descriptor with YAML frontmatter that describes its subject, purpose, files, companion Markdown documents, and place in a parent-child hierarchy, so an AI agent (or a human) can understand a project without reading every source file.
4
4
 
5
5
  ```text
6
- source tree -> xdocs files (.docs.md / .xdocs.md) -> tree + metadata -> AI-readable map
6
+ source tree -> named *.xdocs.md descriptors + companion *.md documents -> tree + metadata -> AI-readable map
7
7
  ```
8
8
 
9
9
  XDocs is a documentation tool, not a versioning tool. It never bumps versions or mutates `package.json` version fields. Versioning for this project is handled separately by GUIHO Mirror.
@@ -21,24 +21,25 @@ XDocs is a documentation tool, not a versioning tool. It never bumps versions or
21
21
  - Standalone binary output: `bin/xdocs-*` release assets
22
22
  - Runtime parser dependencies: none; xdocs uses Bun-native TOML and YAML parsing
23
23
 
24
- The public package exposes a CLI named `xdocs` and a TypeScript API for discovering xdocs files, parsing metadata, building the hierarchy tree, generating documentation, and installing the agent skill.
24
+ The public package exposes a CLI named `xdocs` and a TypeScript API for discovering xdocs descriptors and companion Markdown documents, parsing metadata, building the hierarchy tree, generating documentation, and installing the agent skill.
25
25
 
26
26
  ## Core Model
27
27
 
28
28
  XDocs describes a repository as a containment hierarchy of documented modules.
29
29
 
30
30
  - Project: the repository being documented.
31
- - xdocs file: a Markdown file with YAML frontmatter that documents one directory/module.
31
+ - xdocs descriptor: a named Markdown file ending in `.xdocs.md` with YAML frontmatter that documents one directory/module. A file named only `.xdocs.md` is invalid.
32
+ - Companion document: a same-directory plain Markdown file ending in `.md` but not `.xdocs.md` and not `XDOCS.md`. Companion documents are listed in the descriptor's `documents` metadata map.
32
33
  - Repository root index: exactly one `XDOCS.md` per repository, at the repo root. It has **no frontmatter** and is not a tree node; it is a plain index that lists the repository's packages and applications.
33
34
  - Package/application root: each package or application has its own root `.xdocs.md` file (with frontmatter and `parent: null`) that is the top of that package's documentation tree. `XDOCS.md` lists these package roots.
34
- - Tree: a parent-child containment hierarchy (not a dependency graph) assembled from each `.xdocs.md` / `.docs.md` file's `subject` / `parent` / `children` fields.
35
+ - Tree: a parent-child containment hierarchy (not a dependency graph) assembled from each `.xdocs.md` descriptor's `subject` / `parent` / `children` fields.
35
36
  - AI mode: how an agent should behave when documentation needs updating, configured by `[ai].mode`.
36
37
 
37
- The tree is the main mental model. A module's xdocs file names the module (`subject`), points up to its container (`parent`), and lists the modules it contains (`children`). A package root sets `parent: null`. Reading metadata first, and the body only when needed, lets an agent navigate a project cheaply.
38
+ The tree is the main mental model. A module's xdocs descriptor names the module (`subject`), points up to its container (`parent`), lists the modules it contains (`children`), and lists sibling companion documents (`documents`). A package root sets `parent: null`. Reading metadata first, and companion documents only when relevant, lets an agent navigate a project cheaply.
38
39
 
39
- ## xdocs Files and Metadata
40
+ ## xdocs Descriptors and Metadata
40
41
 
41
- A module's xdocs file is Markdown with a YAML frontmatter block delimited by `---`. The body below the frontmatter is free-form Markdown. (The repository's single `XDOCS.md` is the one exception it has no frontmatter and is just an index.)
42
+ A module's xdocs descriptor is Markdown with a YAML frontmatter block delimited by `---`. The body below the frontmatter is free-form Markdown. The repository's single `XDOCS.md` is the one exception: it has no frontmatter and is just an index.
42
43
 
43
44
  ```markdown
44
45
  ---
@@ -51,8 +52,14 @@ children:
51
52
  files:
52
53
  login.ts: Email/password login handler.
53
54
  session.ts: Session creation and validation.
55
+ documents:
56
+ authentication-implementation.md: Detailed implementation notes and decisions.
54
57
  tags:
55
58
  - security
59
+ keywords:
60
+ - authentication
61
+ - login
62
+ - sessions
56
63
  flags: []
57
64
  status: stable
58
65
  ---
@@ -69,15 +76,41 @@ Frontmatter fields:
69
76
  | `parent` | string \| null | `subject` of the containing module; `null` for a package/application root. |
70
77
  | `children` | string[] | `subject`s of directly contained modules. |
71
78
  | `files` | map<string,string> | Filename -> short description of each significant file. |
79
+ | `documents` | map<string,string> | Same-directory plain Markdown filename -> short description. |
72
80
  | `tags` | string[] | Free-form classification labels. |
81
+ | `keywords` | string[] | Search terms and concepts agents can use to match requests. |
73
82
  | `flags` | string[] | Behavioral markers for tools/agents. |
74
83
  | `status` | string (optional) | Lifecycle marker, for example `stable`, `draft`, `deprecated`. |
75
84
 
76
- Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, and keep `files` in sync with what is on disk.
85
+ Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, keep `files` in sync with implementation/configuration files, keep `documents` in sync with same-directory plain Markdown files, and keep `keywords` useful for search/matching.
77
86
 
78
87
  ## File Discovery and Extensions
79
88
 
80
- XDocs discovers documentation files by extension. The default recognized extensions are `.docs.md` and `.xdocs.md`, configurable in `[extensions].supported`. The root `XDOCS.md` is always recognized.
89
+ XDocs discovers module descriptors by the fixed `.xdocs.md` suffix. Descriptors must be named, for example `authentication.xdocs.md`; `.xdocs.md` by itself is invalid. The root `XDOCS.md` is always recognized only as the repository index.
90
+
91
+ XDocs also discovers same-directory plain Markdown documents ending in `.md` that are not `*.xdocs.md` and not `XDOCS.md`. Each plain Markdown companion document must be listed in the containing directory descriptor's `documents` metadata map.
92
+
93
+ Ordinary companion Markdown documents should also have YAML frontmatter so agents
94
+ can decide whether to read the body. The standard companion fields are `name`,
95
+ `purpose`, `description`, `created`, `flags`, `tags`, `keywords`, and `owner`.
96
+ The `owner` value is the owning descriptor's `subject`.
97
+
98
+ ```markdown
99
+ ---
100
+ name: authentication-implementation
101
+ purpose: Explain authentication implementation details and decisions.
102
+ description: Detailed notes for login, password verification, and session behavior.
103
+ created: 2026-07-06
104
+ flags: []
105
+ tags:
106
+ - security
107
+ keywords:
108
+ - authentication
109
+ - password verification
110
+ - session lifecycle
111
+ owner: auth
112
+ ---
113
+ ```
81
114
 
82
115
  Scanning walks the project tree and skips directories listed in `[scan].exclude`. The default exclusions are `node_modules`, `.git`, `dist`, `build`, `library`, `bin`, and `bundle`.
83
116
 
@@ -169,7 +202,7 @@ Flags: `--tool <agents|claude|all>`, `--global`, `--cwd`, `--verbose`.
169
202
 
170
203
  ### `xdocs scan`
171
204
 
172
- Walks every directory (respecting `[scan].exclude`), matches files against the configured extensions, and reports coverage: total files, total directories, covered vs uncovered directories, and the discovered xdocs files with validity status. Use `--verbose` to list per-file errors and uncovered directories.
205
+ Walks every directory (respecting `[scan].exclude`), finds named `*.xdocs.md` descriptors and sibling plain `*.md` companion documents, and reports coverage: total files, total directories, companion-document count, covered vs uncovered directories, and discovered xdocs descriptors with validity status. JSON output includes descriptor keywords. Use `--verbose` to list per-file errors, discovered companion documents, and uncovered directories.
173
206
 
174
207
  ```bash
175
208
  xdocs scan
@@ -180,7 +213,7 @@ Flags: `--format <text|json>`, `--cwd`, `--config`, `--verbose`.
180
213
 
181
214
  ### `xdocs generate [path]`
182
215
 
183
- Generates Markdown documentation. With no path, it produces a project-level document containing the hierarchy and a section per module. With a path, it produces a module-level document for that directory. Output goes to stdout unless `--output <path>` is given.
216
+ Generates Markdown documentation. With no path, it produces a project-level document containing the hierarchy and a section per module, including keywords, files, and companion documents. With a path, it produces a module-level document for that directory. Output goes to stdout unless `--output <path>` is given.
184
217
 
185
218
  ```bash
186
219
  xdocs generate # whole project to stdout
@@ -192,7 +225,7 @@ Flags: `--output <path>`, `--cwd`, `--config`, `--verbose`.
192
225
 
193
226
  ### `xdocs merge [path]`
194
227
 
195
- Concatenates all xdocs files within a directory into a single Markdown document, each section prefixed with a `<!-- source: ... -->` marker. Output goes to stdout unless `--output <path>` is given.
228
+ Concatenates all xdocs descriptors within a directory into a single Markdown document, each section prefixed with a `<!-- source: ... -->` marker and including keywords plus both `files` and `documents` metadata. Output goes to stdout unless `--output <path>` is given.
196
229
 
197
230
  ```bash
198
231
  xdocs merge ./src/domain
@@ -203,7 +236,7 @@ Flags: `--output <path>`, `--cwd`, `--config`, `--verbose`.
203
236
 
204
237
  ### `xdocs tree`
205
238
 
206
- Scans all xdocs files, reads their metadata, and assembles the parent-child hierarchy (modules only, not individual files). With `--verbose`, tree integrity warnings and errors (duplicate subjects, orphans, missing children) are printed to stderr.
239
+ Scans all xdocs descriptors, reads their metadata, and assembles the parent-child hierarchy (modules only, not individual files or companion documents). With `--verbose`, tree integrity warnings and errors (duplicate subjects, orphans, missing children) are printed to stderr.
207
240
 
208
241
  ```bash
209
242
  xdocs tree
@@ -215,7 +248,7 @@ Flags: `--format <text|markdown|json>`, `--output <path>`, `--cwd`, `--config`,
215
248
 
216
249
  ### `xdocs list [path]`
217
250
 
218
- Lists every documented file in a scope with a short description pulled from the `files` metadata field.
251
+ Lists every documented implementation file and companion Markdown document in a scope with short descriptions pulled from the `files` and `documents` metadata fields. JSON entries include a `kind` field with `file` or `document`.
219
252
 
220
253
  ```bash
221
254
  xdocs list
@@ -231,8 +264,8 @@ Outputs a ready-made, self-contained instruction prompt for an AI agent. The pro
231
264
 
232
265
  Available prompts:
233
266
 
234
- - `write`: Scan a directory and write xdocs documentation.
235
- - `update`: Update existing xdocs files after code changes.
267
+ - `write`: Scan a directory and write a named xdocs descriptor.
268
+ - `update`: Update existing xdocs descriptors after code or document changes.
236
269
  - `agents`: Update `AGENTS.md` with xdocs instructions.
237
270
  - `generate`: Generate comprehensive documentation.
238
271
 
@@ -285,7 +318,7 @@ Full configuration example:
285
318
  schema = 1
286
319
 
287
320
  [extensions]
288
- supported = [".docs.md", ".xdocs.md"]
321
+ supported = [".xdocs.md"]
289
322
 
290
323
  [ai]
291
324
  mode = "prompt"
@@ -308,7 +341,7 @@ Optional. When present, must be `1`.
308
341
 
309
342
  ### `[extensions]`
310
343
 
311
- - `supported`: Array of file extensions recognized as xdocs files. Default: `[".docs.md", ".xdocs.md"]`.
344
+ - `supported`: Compatibility field for descriptor suffixes. The only supported value is `[".xdocs.md"]`; other extensions are rejected.
312
345
 
313
346
  ### `[ai]`
314
347
 
@@ -359,13 +392,13 @@ Bare `xdocs` invocations and the data commands (`scan`, `generate`, `merge`, `tr
359
392
 
360
393
  ## AI Usage Workflow
361
394
 
362
- Maintaining xdocs files is an automatic responsibility for an agent working in an xdocs project, not something the user has to request. The intended workflow:
395
+ Maintaining xdocs descriptors is an automatic responsibility for an agent working in an xdocs project, not something the user has to request. The intended workflow:
363
396
 
364
397
  1. On entering a project, read `XDOCS.md`, run `xdocs tree`, and run `xdocs scan` to understand the structure and coverage.
365
- 2. On navigating to a module, read that module's xdocs file (frontmatter first, body only if needed) instead of reading every source file.
366
- 3. On creating a new module or subdirectory, create that directory's xdocs file (for example `<name>.xdocs.md`) describing its purpose, its files (with their key functions/exports), and its `parent`/`children` links as part of the same change, without being asked.
367
- 4. On modifying a module (adding, renaming, moving, or removing files, or changing what it does), update its xdocs file and the affected parent/child links so the documentation matches reality.
368
- 5. `[ai].mode` governs only how the agent writes: `prompt` announces the xdocs changes then writes them; `auto` writes immediately. It never makes documentation optional. A code change is not complete until the affected xdocs files are updated and `xdocs tree` is consistent.
398
+ 2. On navigating to a module, read that module's named `*.xdocs.md` descriptor frontmatter first. Use `documents` to decide which companion Markdown files to open, instead of reading every source file.
399
+ 3. On creating a new module or subdirectory, create that directory's named xdocs descriptor (for example `authentication.xdocs.md`) describing its purpose, searchable `keywords`, its files (with their key functions/exports), its companion `documents`, and its `parent`/`children` links -- as part of the same change, without being asked.
400
+ 4. On modifying a module (adding, renaming, moving, or removing files or sibling Markdown documents, or changing what it does), update its xdocs descriptor, companion document frontmatter, and the affected parent/child links so the documentation matches reality.
401
+ 5. `[ai].mode` governs only how the agent writes: `prompt` announces the xdocs changes then writes them; `auto` writes immediately. It never makes documentation optional. A code change is not complete until the affected xdocs descriptors are updated and `xdocs tree` is consistent.
369
402
  6. On request, use `xdocs generate`, `xdocs merge`, and `xdocs tree` to produce documentation artifacts.
370
403
 
371
404
  ## Prompts
@@ -421,8 +454,8 @@ The API uses the same configuration discovery and validation as the CLI.
421
454
  - `source/embedded-resources.ts`: prompt, skill, and package metadata text imports used only for native binary embedding.
422
455
  - `source/cli.ts`: argument parsing, command dispatch, config-gated automation, and process-facing error handling.
423
456
  - `source/config.ts`: TOML discovery, schema validation, defaulting, default config generation, and agent-settings normalization.
424
- - `source/discovery.ts`: filesystem scanning and xdocs file matching.
425
- - `source/metadata.ts`: YAML frontmatter extraction and metadata validation.
457
+ - `source/discovery.ts`: filesystem scanning, xdocs descriptor matching, companion Markdown discovery, and descriptor/document validation.
458
+ - `source/metadata.ts`: YAML frontmatter extraction, metadata validation, and nameless descriptor rejection.
426
459
  - `source/tree.ts`: tree assembly, integrity checks, and rendering (text, markdown).
427
460
  - `source/prompts.ts`: prompt loader (reads `prompts/*.md` from disk at runtime relative to `import.meta.url`).
428
461
  - `source/help.ts`: help text and version display.
@@ -544,7 +577,7 @@ Run `xdocs init` from the project root, or pass `--config <path>`.
544
577
 
545
578
  ### A directory shows as uncovered
546
579
 
547
- Add an xdocs file (`.docs.md` or `.xdocs.md`) to the directory, or adjust `[extensions].supported`. Confirm the directory is not in `[scan].exclude`.
580
+ Add one named xdocs descriptor such as `authentication.xdocs.md` to the directory and list same-directory plain Markdown files in `documents`. Confirm the directory is not in `[scan].exclude`.
548
581
 
549
582
  ### Tree warnings or errors
550
583
 
package/README.md CHANGED
@@ -4,10 +4,10 @@
4
4
 
5
5
  **npm package:** [@guiho/xdocs](https://www.npmjs.com/package/@guiho/xdocs)
6
6
 
7
- xdocs is a CLI and TypeScript library that places structured documentation files throughout your project so that AI agents (and humans) can navigate, understand, and work within a codebase without reading every file. Each xdocs file describes the directory it lives in -- its purpose, its files, and how it fits into the project hierarchy.
7
+ xdocs is a CLI and TypeScript library that places named `*.xdocs.md` descriptors throughout your project so that AI agents (and humans) can navigate, understand, and work within a codebase without reading every file. Each descriptor describes the directory it lives in -- its purpose, searchable keywords, its files, its companion Markdown documents, and how it fits into the project hierarchy.
8
8
 
9
9
  ```text
10
- codebase -> xdocs files -> AI understands the project
10
+ codebase -> named *.xdocs.md descriptors + companion *.md documents -> AI understands the project
11
11
  ```
12
12
 
13
13
  xdocs ships as compiled native binaries, a thin Bun launcher for package-manager and `bunx` execution, and a fully-typed TypeScript library.
@@ -57,7 +57,7 @@ This creates:
57
57
  ### Typical Workflow
58
58
 
59
59
  ```bash
60
- # Scan the project for existing xdocs files
60
+ # Scan the project for xdocs descriptors and companion Markdown documents
61
61
  xdocs scan
62
62
 
63
63
  # Generate documentation for a specific module
@@ -80,11 +80,11 @@ When AI works on a codebase, most of the structural knowledge lives in the head
80
80
 
81
81
  ### The Solution
82
82
 
83
- xdocs solves this by placing documentation files throughout the project. Each xdocs file describes the directory it lives in, acting as a self-contained map of that module. Instead of opening every file to understand a directory, the AI reads its xdocs file.
83
+ xdocs solves this by placing named descriptors throughout the project. Each `*.xdocs.md` descriptor describes the directory it lives in, acting as a self-contained map of that module. Instead of opening every file to understand a directory, the AI reads descriptor frontmatter first and opens listed companion documents only when relevant.
84
84
 
85
85
  ### File Format
86
86
 
87
- xdocs files are Markdown with YAML frontmatter. A file is recognized as an xdocs file if it ends with one of the configured extensions (default: `.docs.md`, `.xdocs.md`).
87
+ xdocs descriptors are Markdown files with YAML frontmatter and a required name before the `.xdocs.md` suffix, such as `authentication.xdocs.md`. A file named only `.xdocs.md` is invalid. Same-directory plain `*.md` files are companion documents and must be listed in `documents`.
88
88
 
89
89
  ```markdown
90
90
  ---
@@ -99,7 +99,13 @@ files:
99
99
  authenticate.ts: Validates credentials and returns a session token.
100
100
  register.ts: Creates a new user account with email verification.
101
101
  session.ts: Manages session creation, validation, and expiration.
102
+ documents:
103
+ authentication-implementation.md: Detailed implementation notes and decisions.
102
104
  tags: []
105
+ keywords:
106
+ - authentication
107
+ - sessions
108
+ - identity
103
109
  flags: []
104
110
  ---
105
111
 
@@ -108,6 +114,27 @@ flags: []
108
114
  The authentication module handles all identity verification flows...
109
115
  ```
110
116
 
117
+ Ordinary same-directory companion `.md` files should also have YAML
118
+ frontmatter. Use `owner` to point back to the owning descriptor `subject`, and
119
+ include `keywords` for search/matching:
120
+
121
+ ```markdown
122
+ ---
123
+ name: authentication-implementation
124
+ purpose: Explain authentication implementation details and decisions.
125
+ description: Detailed notes for login, password verification, and session behavior.
126
+ created: 2026-07-06
127
+ flags: []
128
+ tags:
129
+ - security
130
+ keywords:
131
+ - authentication
132
+ - password verification
133
+ - session lifecycle
134
+ owner: authentication
135
+ ---
136
+ ```
137
+
111
138
  #### Metadata Fields
112
139
 
113
140
  | Field | Type | Required | Description |
@@ -117,13 +144,15 @@ The authentication module handles all identity verification flows...
117
144
  | `parent` | `string \| null` | Yes | The parent subject in the hierarchy. `null` for the root. |
118
145
  | `children` | `string[]` | Yes | Child subjects (submodules) contained within this module. |
119
146
  | `files` | `map<string, string>` | Yes | Files in this directory. Key = filename, value = description. |
147
+ | `documents` | `map<string, string>` | Yes | Same-directory plain Markdown documents. Key = filename, value = description. |
120
148
  | `tags` | `string[]` | Yes | Tags for categorization and search. |
149
+ | `keywords` | `string[]` | Yes | Search terms and concepts agents can use to match requests. |
121
150
  | `flags` | `string[]` | Yes | Flags for marking attributes or states. |
122
151
  | `status` | `string` | No | Module status (e.g., `active`, `deprecated`, `experimental`). |
123
152
 
124
153
  ### The Tree
125
154
 
126
- xdocs files form a hierarchy through their `subject`, `parent`, and `children` fields. The tree represents containment -- not dependencies -- and is computed by scanning all xdocs files.
155
+ xdocs descriptors form a hierarchy through their `subject`, `parent`, and `children` fields. The tree represents containment -- not dependencies -- and is computed by scanning all named `*.xdocs.md` descriptors.
127
156
 
128
157
  ```
129
158
  project (root)
@@ -152,7 +181,7 @@ Initializes xdocs in a project. Creates the root `XDOCS.md`, the `xdocs.config.t
152
181
 
153
182
  #### `xdocs scan`
154
183
 
155
- Scans the project for xdocs files. Reports which directories have coverage and which are missing documentation.
184
+ Scans the project for named `*.xdocs.md` descriptors and sibling plain Markdown companion documents. Reports descriptor validity, directory coverage, and companion-document coverage.
156
185
 
157
186
  ```bash
158
187
  xdocs scan
@@ -176,15 +205,15 @@ xdocs generate
176
205
  Outputs a ready-made prompt for AI agents. Each prompt is a self-contained instruction for a specific xdocs task. Prompts are selected by the `--name` flag, not by subcommand.
177
206
 
178
207
  ```bash
179
- xdocs prompt --name=write # How to write xdocs documentation
180
- xdocs prompt --name=update # How to update existing xdocs files
208
+ xdocs prompt --name=write # How to write a named xdocs descriptor
209
+ xdocs prompt --name=update # How to update existing xdocs descriptors
181
210
  xdocs prompt --name=agents # How to update AGENTS.md
182
211
  xdocs prompt --name=generate # How to generate comprehensive docs
183
212
  ```
184
213
 
185
214
  #### `xdocs merge [path]`
186
215
 
187
- Merges xdocs files from a directory into a single consolidated document.
216
+ Merges xdocs descriptors from a directory into a single consolidated document.
188
217
 
189
218
  ```bash
190
219
  xdocs merge ./src/domain
@@ -201,7 +230,7 @@ xdocs tree --format markdown --output tree.md
201
230
 
202
231
  #### `xdocs list [path]`
203
232
 
204
- Lists files in a scope with descriptions pulled from xdocs metadata.
233
+ Lists implementation files and companion Markdown documents in a scope with descriptions pulled from xdocs metadata.
205
234
 
206
235
  ```bash
207
236
  xdocs list ./src/auth
@@ -240,9 +269,8 @@ xdocs looks for configuration at `./xdocs.config.toml`, `./config/xdocs.config.t
240
269
  schema = 1
241
270
 
242
271
  [extensions]
243
- # File extensions recognized as xdocs files.
244
- # Default: [".docs.md", ".xdocs.md"]
245
- supported = [".docs.md", ".xdocs.md"]
272
+ # Descriptor suffix recognized by xdocs. Only ".xdocs.md" is supported.
273
+ supported = [".xdocs.md"]
246
274
 
247
275
  [ai]
248
276
  # How the AI handles documentation updates.
@@ -311,16 +339,19 @@ const configOrDefaults = await loadConfigOrDefaults({ cwd: process.cwd(), format
311
339
  ### Discovery and Scanning
312
340
 
313
341
  ```ts
314
- import { scanProject, scanDirectory, isXDocsFile } from '@guiho/xdocs'
342
+ import { scanProject, scanDirectory, isPlainMarkdownDocument, isXDocsDescriptorFile, isXDocsFile } from '@guiho/xdocs'
315
343
 
316
344
  // Scan the entire project
317
345
  const result = await scanProject(config)
318
346
  console.log(result.totalFiles) // Total files found
319
347
  console.log(result.xdocsFiles) // Array of XDocsFile objects
348
+ console.log(result.markdownDocuments) // Companion Markdown documents found
320
349
  console.log(result.uncoveredPaths) // Directories without xdocs coverage
321
350
 
322
- // Check if a file is an xdocs file
323
- isXDocsFile('auth.xdocs.md', ['.docs.md', '.xdocs.md']) // true
351
+ // Check descriptor and companion document files
352
+ isXDocsFile('auth.xdocs.md') // true
353
+ isXDocsDescriptorFile('auth.xdocs.md') // true
354
+ isPlainMarkdownDocument('auth-notes.md') // true
324
355
  ```
325
356
 
326
357
  ### Metadata Parsing
@@ -328,7 +359,7 @@ isXDocsFile('auth.xdocs.md', ['.docs.md', '.xdocs.md']) // true
328
359
  ```ts
329
360
  import { parseXDocsFile, extractFrontmatter, validateMetadata } from '@guiho/xdocs'
330
361
 
331
- // Parse an xdocs file from disk
362
+ // Parse an xdocs descriptor from disk
332
363
  const file = await parseXDocsFile('/path/to/auth.xdocs.md', process.cwd())
333
364
  console.log(file.metadata?.subject) // "authentication"
334
365
  console.log(file.metadata?.description) // "Handles user login..."
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: xdocs Document Model
3
+ purpose: Record the descriptor-plus-companion-document model for future xdocs implementation work.
4
+ description: Explains how named xdocs descriptors, root XDOCS.md, and same-directory Markdown companion documents work together for AI navigation.
5
+ created: 2026-07-05
6
+ keywords:
7
+ - xdocs descriptors
8
+ - companion documents
9
+ - AI navigation
10
+ ---
11
+
12
+ # xdocs Document Model
13
+
14
+ ## Summary
15
+
16
+ xdocs now treats a directory as documented by exactly one named `*.xdocs.md`
17
+ descriptor. The root of a repository still uses `XDOCS.md` as a plain index with
18
+ no frontmatter, but normal modules use a descriptor such as
19
+ `authentication.xdocs.md`. A file named only `.xdocs.md` is invalid because
20
+ `.xdocs.md` is the extension, not the filename.
21
+
22
+ ## Descriptor Metadata
23
+
24
+ The descriptor is the AI-facing map for a module. Its YAML frontmatter contains
25
+ the module identity, parent/child tree links, implementation files, and sibling
26
+ Markdown companion documents.
27
+
28
+ ```yaml
29
+ ---
30
+ subject: authentication
31
+ description: Authentication implementation and session behavior.
32
+ parent: backend
33
+ children: []
34
+ files:
35
+ login.ts: Email/password login flow.
36
+ session.ts: Session lifecycle and validation.
37
+ documents:
38
+ authentication-implementation.md: Detailed implementation notes and decisions.
39
+ tags:
40
+ - security
41
+ keywords:
42
+ - authentication
43
+ - sessions
44
+ - implementation notes
45
+ flags: []
46
+ status: stable
47
+ ---
48
+ ```
49
+
50
+ `files` is for implementation, configuration, and asset files. `documents` is
51
+ only for same-directory plain `*.md` files that are not `*.xdocs.md` descriptors
52
+ and not `XDOCS.md`.
53
+
54
+ `keywords` is for search terms and concepts an agent can use to match a user
55
+ request to the right descriptor. Companion Markdown documents use the same idea
56
+ in their own frontmatter.
57
+
58
+ ## AI Workflow
59
+
60
+ Agents should use `xdocs scan` to locate named `*.xdocs.md` descriptors, read
61
+ frontmatter first, and use the `documents` map to decide which companion
62
+ Markdown files are worth opening. When a user asks about a module, the agent can
63
+ find the relevant module by descriptor metadata before reading source files.
64
+
65
+ When changing a directory, an agent must update the directory descriptor so the
66
+ `files`, `documents`, `keywords`, `parent`, and `children` fields match disk. If a sibling
67
+ plain Markdown file is added, renamed, or removed, the descriptor's `documents`
68
+ map changes in the same unit of work.
69
+
70
+ ## CLI Rules
71
+
72
+ `xdocs scan` reports descriptor coverage and validates that every sibling plain
73
+ Markdown file is listed in `documents`. It also marks a directory invalid when it
74
+ has multiple `*.xdocs.md` descriptors or a nameless `.xdocs.md` file.
75
+
76
+ `xdocs list`, `xdocs generate`, and `xdocs merge` surface both implementation
77
+ files and companion documents, keeping the two categories separate.
@@ -0,0 +1,22 @@
1
+ ---
2
+ subject: xdocs-docs
3
+ description: Durable project documentation for xdocs behavior, design notes, and implementation context.
4
+ parent: xdocs-package
5
+ children: []
6
+ files: {}
7
+ documents:
8
+ 2026-07-05-xdocs-document-model.md: Defines the named descriptor plus companion Markdown document model for xdocs modules.
9
+ tags:
10
+ - documentation
11
+ - design
12
+ keywords:
13
+ - document model
14
+ - design notes
15
+ - companion documents
16
+ flags: []
17
+ status: stable
18
+ ---
19
+
20
+ The `docs/` directory stores durable xdocs project notes. Each plain Markdown
21
+ document in this directory is listed in `documents` so agents can find the note
22
+ from descriptor metadata before opening the full document.
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiho/xdocs",
3
- "version": "0.3.1",
3
+ "version": "0.4.0-alpha.0",
4
4
  "exports": "./source/guiho-xdocs.ts",
5
5
  "publish": {
6
6
  "include": [
@@ -38,7 +38,7 @@ export declare const detectAgentTools: (cwd: string) => XDocsAgentTool[];
38
38
  */
39
39
  export declare const resolveInstallTools: (cwd: string, toolFlag: string | undefined) => XDocsAgentTool[];
40
40
  /** The small AGENTS.md section announcing xdocs and pointing to the skill. */
41
- export declare const xdocsAgentsSection = "<!-- BEGIN XDOCS \u2014 DO NOT EDIT THIS SECTION -->\n## XDocs Structured Documentation\n\nThis project uses **xdocs** (`@guiho/xdocs`) for structured, machine-readable\ndocumentation. The repository has one root `XDOCS.md` index (no frontmatter),\nand each package/application has a root `.xdocs.md` file. Each module carries a\n`.docs.md` / `.xdocs.md` file with YAML frontmatter (`subject`, `description`,\n`parent`, `children`, `files`).\n\n**Load the `guiho-s-xdocs` agent skill** for any documentation work:\ncreating, updating, regenerating, scanning, merging, or navigating xdocs files.\nThe skill holds the full workflow, metadata schema, and CLI reference.\n\nBefore changing documentation, read `xdocs.config.toml` and respect `[ai].mode`:\n\n- **prompt** \u2014 announce which xdocs files need updating and wait for confirmation.\n- **auto** \u2014 update the relevant xdocs files immediately.\n\nUse the xdocs CLI for operations: `xdocs scan`, `xdocs tree`, `xdocs generate`,\n`xdocs list`, `xdocs merge`.\n<!-- END XDOCS -->";
41
+ export declare const xdocsAgentsSection = "<!-- BEGIN XDOCS \u2014 DO NOT EDIT THIS SECTION -->\n## XDocs Structured Documentation\n\nThis project uses **xdocs** (`@guiho/xdocs`) for structured, machine-readable\ndocumentation. The repository has one root `XDOCS.md` index (no frontmatter),\nand each package/application has a root named `*.xdocs.md` descriptor file. Each\ndocumented module has exactly one named `*.xdocs.md` descriptor in its directory\nwith YAML frontmatter (`subject`, `description`, `parent`, `children`,\n`files`, `documents`, `tags`, `keywords`, `flags`). Same-directory plain\n`*.md` files are companion documents and must be listed in the descriptor's\n`documents` metadata map. Ordinary companion documents should also include\n`keywords` in their own frontmatter.\n\n**Load the `guiho-s-xdocs` agent skill** for any documentation work:\ncreating, updating, regenerating, scanning, merging, or navigating xdocs descriptors.\nThe skill holds the full workflow, metadata schema, and CLI reference.\n\nBefore changing documentation, read `xdocs.config.toml` and respect `[ai].mode`:\n\n- **prompt** \u2014 announce which xdocs descriptors need updating and wait for confirmation.\n- **auto** \u2014 update the relevant xdocs descriptors immediately.\n\nUse the xdocs CLI for operations: `xdocs scan`, `xdocs tree`, `xdocs generate`,\n`xdocs list`, `xdocs merge`.\n<!-- END XDOCS -->";
42
42
  type SkillPathOptions = {
43
43
  cwd?: string;
44
44
  homeDirectory?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../source/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EACvB,eAAe,EAChB,MAAM,YAAY,CAAA;AAInB,+CAA+C;AAC/C,eAAO,MAAM,cAAc,kBAAkB,CAAA;AAE7C,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAuB,CAAA;AAE1E;;iEAEiE;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAS5B,CAAA;AAEJ,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,oBAAsC,CAAA;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,eAAe,EAAE,SAAS,cAAc,EAAyB,CAAA;AAE9E,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAE,cAAyB,CAAA;AAEzD,2FAA2F;AAC3F,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,cAAc,EAKzE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,cAAc,EAK5D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,cAAc,EAChC,CAAA;AAkB9D,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,mhC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ED
@@ -86,18 +86,22 @@ export const xdocsAgentsSection = `${AGENTS_BEGIN_MARKER}
86
86
 
87
87
  This project uses **xdocs** (\`@guiho/xdocs\`) for structured, machine-readable
88
88
  documentation. The repository has one root \`XDOCS.md\` index (no frontmatter),
89
- and each package/application has a root \`.xdocs.md\` file. Each module carries a
90
- \`.docs.md\` / \`.xdocs.md\` file with YAML frontmatter (\`subject\`, \`description\`,
91
- \`parent\`, \`children\`, \`files\`).
89
+ and each package/application has a root named \`*.xdocs.md\` descriptor file. Each
90
+ documented module has exactly one named \`*.xdocs.md\` descriptor in its directory
91
+ with YAML frontmatter (\`subject\`, \`description\`, \`parent\`, \`children\`,
92
+ \`files\`, \`documents\`, \`tags\`, \`keywords\`, \`flags\`). Same-directory plain
93
+ \`*.md\` files are companion documents and must be listed in the descriptor's
94
+ \`documents\` metadata map. Ordinary companion documents should also include
95
+ \`keywords\` in their own frontmatter.
92
96
 
93
97
  **Load the \`${xdocsSkillName}\` agent skill** for any documentation work:
94
- creating, updating, regenerating, scanning, merging, or navigating xdocs files.
98
+ creating, updating, regenerating, scanning, merging, or navigating xdocs descriptors.
95
99
  The skill holds the full workflow, metadata schema, and CLI reference.
96
100
 
97
101
  Before changing documentation, read \`xdocs.config.toml\` and respect \`[ai].mode\`:
98
102
 
99
- - **prompt** — announce which xdocs files need updating and wait for confirmation.
100
- - **auto** — update the relevant xdocs files immediately.
103
+ - **prompt** — announce which xdocs descriptors need updating and wait for confirmation.
104
+ - **auto** — update the relevant xdocs descriptors immediately.
101
105
 
102
106
  Use the xdocs CLI for operations: \`xdocs scan\`, \`xdocs tree\`, \`xdocs generate\`,
103
107
  \`xdocs list\`, \`xdocs merge\`.
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../source/commands/generate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAMnE,gCAAgC;AAChC,eAAO,MAAM,WAAW,GAAU,SAAS,eAAe,EAAE,QAAQ,eAAe,KAAG,OAAO,CAAC,IAAI,CA2BjG,CAAA"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../source/commands/generate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAa,eAAe,EAAE,MAAM,aAAa,CAAA;AAM9E,gCAAgC;AAChC,eAAO,MAAM,WAAW,GAAU,SAAS,eAAe,EAAE,QAAQ,eAAe,KAAG,OAAO,CAAC,IAAI,CA2BjG,CAAA"}
@@ -55,6 +55,9 @@ const generateProjectDoc = async (projectName, xdocsFiles, _cwd) => {
55
55
  lines.push(`### ${file.metadata.subject}`, '');
56
56
  lines.push(file.metadata.description, '');
57
57
  lines.push(`Location: \`${file.relativePath}\``, '');
58
+ if (file.metadata.keywords.length > 0) {
59
+ lines.push(`Keywords: ${file.metadata.keywords.map((keyword) => `\`${keyword}\``).join(', ')}`, '');
60
+ }
58
61
  const fileEntries = Object.entries(file.metadata.files);
59
62
  if (fileEntries.length > 0) {
60
63
  lines.push('Files:', '');
@@ -63,6 +66,14 @@ const generateProjectDoc = async (projectName, xdocsFiles, _cwd) => {
63
66
  }
64
67
  lines.push('');
65
68
  }
69
+ const documentEntries = Object.entries(file.metadata.documents);
70
+ if (documentEntries.length > 0) {
71
+ lines.push('Documents:', '');
72
+ for (const [name, desc] of documentEntries) {
73
+ lines.push(`- \`${name}\`: ${desc}`);
74
+ }
75
+ lines.push('');
76
+ }
66
77
  if (file.body.trim()) {
67
78
  lines.push(file.body.trim(), '');
68
79
  }
@@ -90,6 +101,9 @@ const generateModuleDoc = async (moduleName, xdocsFiles, _cwd, targetPath) => {
90
101
  continue;
91
102
  lines.push(`## ${file.metadata.subject}`, '');
92
103
  lines.push(file.metadata.description, '');
104
+ if (file.metadata.keywords.length > 0) {
105
+ lines.push(`Keywords: ${file.metadata.keywords.map((keyword) => `\`${keyword}\``).join(', ')}`, '');
106
+ }
93
107
  const fileEntries = Object.entries(file.metadata.files);
94
108
  if (fileEntries.length > 0) {
95
109
  lines.push('### Files', '');
@@ -98,6 +112,14 @@ const generateModuleDoc = async (moduleName, xdocsFiles, _cwd, targetPath) => {
98
112
  }
99
113
  lines.push('');
100
114
  }
115
+ const documentEntries = Object.entries(file.metadata.documents);
116
+ if (documentEntries.length > 0) {
117
+ lines.push('### Documents', '');
118
+ for (const [name, desc] of documentEntries) {
119
+ lines.push(`- \`${name}\`: ${desc}`);
120
+ }
121
+ lines.push('');
122
+ }
101
123
  if (file.metadata.children.length > 0) {
102
124
  lines.push('### Submodules', '');
103
125
  for (const child of file.metadata.children) {
@@ -111,7 +133,7 @@ const generateModuleDoc = async (moduleName, xdocsFiles, _cwd, targetPath) => {
111
133
  }
112
134
  }
113
135
  else {
114
- lines.push(`No xdocs files found in this directory.`, '');
136
+ lines.push(`No xdocs descriptors found in this directory.`, '');
115
137
  lines.push('### Directory contents', '');
116
138
  for (const entry of dirEntries) {
117
139
  lines.push(`- \`${entry}\``);