@guiho/xdocs 0.3.0-alpha.2 → 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 (51) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/DOCS.md +70 -36
  3. package/README.md +57 -22
  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 +4 -5
  8. package/library/agents.d.ts.map +1 -1
  9. package/library/agents.js +15 -14
  10. package/library/cli.d.ts.map +1 -1
  11. package/library/cli.js +5 -4
  12. package/library/commands/generate.d.ts.map +1 -1
  13. package/library/commands/generate.js +23 -1
  14. package/library/commands/list.d.ts.map +1 -1
  15. package/library/commands/list.js +14 -4
  16. package/library/commands/merge.d.ts.map +1 -1
  17. package/library/commands/merge.js +12 -1
  18. package/library/commands/scan.d.ts.map +1 -1
  19. package/library/commands/scan.js +13 -2
  20. package/library/config.d.ts.map +1 -1
  21. package/library/config.js +7 -3
  22. package/library/discovery.d.ts +8 -4
  23. package/library/discovery.d.ts.map +1 -1
  24. package/library/discovery.js +107 -17
  25. package/library/flags.d.ts +1 -1
  26. package/library/flags.js +1 -1
  27. package/library/guiho-xdocs.d.ts +2 -2
  28. package/library/guiho-xdocs.d.ts.map +1 -1
  29. package/library/guiho-xdocs.js +1 -1
  30. package/library/help.js +16 -15
  31. package/library/metadata.d.ts +1 -1
  32. package/library/metadata.d.ts.map +1 -1
  33. package/library/metadata.js +23 -3
  34. package/library/tree.d.ts +1 -1
  35. package/library/tree.d.ts.map +1 -1
  36. package/library/tree.js +2 -2
  37. package/library/types.d.ts +14 -2
  38. package/library/types.d.ts.map +1 -1
  39. package/package.json +6 -3
  40. package/prompts/agents.md +9 -2
  41. package/prompts/generate.md +10 -2
  42. package/prompts/prompts.xdocs.md +27 -0
  43. package/prompts/update.md +19 -7
  44. package/prompts/write.md +18 -5
  45. package/scripts/install-package.ts +88 -0
  46. package/scripts/scripts.xdocs.md +12 -5
  47. package/scripts/xdocs-bin.ts +33 -0
  48. package/skills/guiho-s-xdocs/SKILL.md +135 -34
  49. package/skills/guiho-s-xdocs/guiho-s-xdocs.xdocs.md +26 -0
  50. package/skills/skills.xdocs.md +9 -4
  51. package/scripts/install-native.cjs +0 -101
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
4
+ *
5
+ * Small package-manager launcher for the downloaded native xdocs binary.
6
+ */
7
+
8
+ const binaryPath = new URL(`../vendor/xdocs${process.platform === 'win32' ? '.exe' : ''}`, import.meta.url)
9
+ const executablePath = Bun.fileURLToPath(binaryPath)
10
+ const binary = Bun.file(binaryPath)
11
+
12
+ if (!(await binary.exists())) {
13
+ const installerPath = new URL('install-package.ts', import.meta.url)
14
+ const proc = Bun.spawn([process.execPath, Bun.fileURLToPath(installerPath)], {
15
+ stdin: 'inherit',
16
+ stdout: 'inherit',
17
+ stderr: 'inherit',
18
+ })
19
+
20
+ const exitCode = await proc.exited
21
+ if (exitCode !== 0 || !(await Bun.file(binaryPath).exists())) {
22
+ console.error('error: xdocs native binary is missing. Reinstall @guiho/xdocs or run `bun run scripts/install-package.ts`.')
23
+ process.exit(exitCode || 1)
24
+ }
25
+ }
26
+
27
+ const proc = Bun.spawn([executablePath, ...process.argv.slice(2)], {
28
+ stdin: 'inherit',
29
+ stdout: 'inherit',
30
+ stderr: 'inherit',
31
+ })
32
+
33
+ process.exit(await proc.exited)
@@ -1,15 +1,30 @@
1
1
  ---
2
2
  name: guiho-s-xdocs
3
- version: 0.3.0-alpha.2
4
- description: Use this skill whenever the user works with xdocs (`@guiho/xdocs`) structured documentation, AND proactively whenever you create a new module or subdirectory or add/change/remove files in a directory of an xdocs project, so you create or update that directory's `.xdocs.md` as part of the change. This includes creating, updating, or regenerating `.docs.md` / `.xdocs.md` files, the root `XDOCS.md`, the project tree, scanning documentation coverage, merging docs, or maintaining xdocs metadata and AGENTS.md guidance, even when the user only says "document this module", "update the docs", or "what does this folder do" without naming xdocs.
3
+ version: 0.4.0
4
+ purpose: Teach AI agents how to maintain xdocs descriptor files, companion Markdown documents, metadata, and tree integrity.
5
+ description: Use this skill whenever the user works with xdocs (`@guiho/xdocs`) structured documentation, AND proactively whenever you create a new module or subdirectory or add/change/remove files in a directory of an xdocs project, so you create or update that directory's named `*.xdocs.md` descriptor as part of the change. This includes creating, updating, or regenerating `*.xdocs.md` descriptor files, companion Markdown documents, the root `XDOCS.md`, the project tree, scanning documentation coverage, merging docs, or maintaining xdocs metadata and AGENTS.md guidance, even when the user only says "document this module", "update the docs", or "what does this folder do" without naming xdocs.
6
+ created: 2026-07-06
7
+ flags:
8
+ - automatic-documentation-maintenance
9
+ - companion-document-metadata
10
+ tags:
11
+ - xdocs
12
+ - documentation
13
+ - agents
14
+ keywords:
15
+ - xdocs
16
+ - structured documentation
17
+ - companion documents
18
+ - agent workflow
19
+ owner: xdocs-guiho-s-xdocs-skill
5
20
  ---
6
21
 
7
22
  # GUIHO XDocs
8
23
 
9
- GUIHO XDocs is a deterministic CLI and TypeScript library for **structured documentation of codebases**. It lets an AI agent understand a project without reading every source file: each directory carries a small Markdown file with YAML frontmatter that describes its subject, purpose, files, and place in a parent-child hierarchy.
24
+ GUIHO XDocs is a deterministic CLI and TypeScript library for **structured documentation of codebases**. It lets an AI agent understand a project without reading every source file: each documented directory carries one named `*.xdocs.md` descriptor with YAML frontmatter that describes its subject, purpose, files, companion Markdown documents, and place in a parent-child hierarchy.
10
25
 
11
26
  ```text
12
- source tree -> xdocs files (.docs.md / .xdocs.md) -> tree + metadata -> AI-readable map
27
+ source tree -> named *.xdocs.md descriptors + companion *.md documents -> tree + metadata -> AI-readable map
13
28
  ```
14
29
 
15
30
  Use xdocs for documentation work instead of ad hoc README sprawl or re-reading the whole codebase. The value of xdocs is that the structure (subjects, descriptions, files, parent/child links) is machine-readable and stays close to the code it describes.
@@ -28,15 +43,16 @@ xdocs is a Bun/TypeScript ESM tool. Bun is the recommended runtime. The CLI neve
28
43
 
29
44
  ## Core Concepts
30
45
 
31
- - **xdocs file**: a Markdown file with YAML frontmatter that documents one directory/module. Default extensions are `.docs.md` and `.xdocs.md`. Extensions are configurable in `xdocs.config.toml`.
46
+ - **xdocs descriptor**: a named Markdown file ending in `.xdocs.md` with YAML frontmatter that documents one directory/module. There is exactly one descriptor per documented directory. The file must have a name such as `authentication.xdocs.md`; a file named only `.xdocs.md` is invalid.
47
+ - **Companion document**: a same-directory plain Markdown file ending in `.md` but not `.xdocs.md` and not `XDOCS.md`. Every companion document must be listed in the descriptor's `documents` metadata map, and ordinary companion documents should carry their own YAML frontmatter with `name`, `purpose`, `description`, `created`, `flags`, `tags`, `keywords`, and `owner`.
32
48
  - **Repository root index**: there is exactly one `XDOCS.md` per repository, at the repo root. It has **no frontmatter** — it is a plain index that lists the repository's packages and applications, and it is not itself a tree node.
33
49
  - **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. A module's `parent` is the `subject` of the module that contains it; a package/application root uses `parent: null`.
50
+ - **Tree**: a parent-child **containment** hierarchy (not a dependency graph), assembled from each `.xdocs.md` descriptor's `subject` / `parent` / `children` fields. A module's `parent` is the `subject` of the module that contains it; a package/application root uses `parent: null`.
35
51
  - **AI mode**: `xdocs.config.toml` `[ai].mode` is either `"prompt"` (announce the documentation updates, then write them) or `"auto"` (write immediately). It governs *how* you write docs, not *whether* — documenting a changed module is always required (see Automatic Documentation Maintenance).
36
52
 
37
53
  ### Metadata schema (YAML frontmatter)
38
54
 
39
- Every `.xdocs.md` / `.docs.md` file carries frontmatter with these fields. The repository's single `XDOCS.md` is the exception: it has no frontmatter and is just an index.
55
+ Every `*.xdocs.md` descriptor carries frontmatter with these fields. The repository's single `XDOCS.md` is the exception: it has no frontmatter and is just an index.
40
56
 
41
57
  | Field | Type | Meaning |
42
58
  | ------------- | --------------------- | ------------------------------------------------------------ |
@@ -45,29 +61,74 @@ Every `.xdocs.md` / `.docs.md` file carries frontmatter with these fields. The r
45
61
  | `parent` | string \| null | `subject` of the containing module; `null` for a package/application root. |
46
62
  | `children` | string[] | `subject`s of directly contained modules. |
47
63
  | `files` | map<string,string> | Filename -> short description of each significant file. |
64
+ | `documents` | map<string,string> | Same-directory plain Markdown filename -> short description. |
48
65
  | `tags` | string[] | Free-form classification labels. |
66
+ | `keywords` | string[] | Search terms and concepts agents can use to match requests. |
49
67
  | `flags` | string[] | Behavioral markers for tools/agents. |
50
68
  | `status` | string (optional) | Lifecycle marker (e.g. `stable`, `draft`, `deprecated`). |
51
69
 
52
- Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, and keep `files` in sync with what is actually on disk.
70
+ Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, keep `files` in sync with implementation files, and keep `documents` in sync with same-directory plain Markdown files.
71
+
72
+ ### Companion document metadata (YAML frontmatter)
73
+
74
+ Ordinary same-directory companion Markdown documents also use YAML frontmatter.
75
+ This metadata makes the document useful before an agent reads the whole body.
76
+ The `owner` field must be the `subject` of the same-directory xdocs descriptor
77
+ that owns the document.
78
+
79
+ ```yaml
80
+ ---
81
+ name: authentication-implementation
82
+ purpose: Explain the implementation details and decisions behind authentication.
83
+ description: Detailed notes for login, password verification, and session behavior.
84
+ created: 2026-07-06
85
+ flags: []
86
+ tags:
87
+ - security
88
+ keywords:
89
+ - login
90
+ - password verification
91
+ - sessions
92
+ owner: auth
93
+ ---
94
+ ```
95
+
96
+ Companion document fields:
97
+
98
+ | Field | Type | Meaning |
99
+ | ------------- | ---------- | -------------------------------------------------------------- |
100
+ | `name` | string | Stable document name or title. |
101
+ | `purpose` | string | Why this document exists and what question it answers. |
102
+ | `description` | string | One-line summary of the document's contents. |
103
+ | `created` | string | Creation date in `YYYY-MM-DD` format. |
104
+ | `flags` | string[] | Behavioral markers for tools/agents. |
105
+ | `tags` | string[] | Free-form classification labels. |
106
+ | `keywords` | string[] | Search terms and concepts agents can use to match requests. |
107
+ | `owner` | string | Owning xdocs descriptor `subject` in the same directory. |
108
+
109
+ Special-purpose Markdown files that already have a required host schema, such
110
+ as prompt templates or `SKILL.md`, must preserve their required host fields.
111
+ When compatible, add the companion metadata fields as well.
53
112
 
54
113
  ## Automatic Documentation Maintenance (core responsibility)
55
114
 
56
- Maintaining xdocs files is an **automatic, built-in responsibility — not a task the user has to request.** Treat it as part of the definition of done for every code change in an xdocs project. The user should never have to ask you to document a module; you do it as a reflex whenever you touch one.
115
+ Maintaining xdocs descriptors is an **automatic, built-in responsibility — not a task the user has to request.** Treat it as part of the definition of done for every code change in an xdocs project. The user should never have to ask you to document a module; you do it as a reflex whenever you touch one.
57
116
 
58
- **Trigger.** Whenever you, as the agent, do any of the following, you must create or update the affected directory's xdocs file in the *same unit of work*, before you consider the task finished:
117
+ **Trigger.** Whenever you, as the agent, do any of the following, you must create or update the affected directory's named xdocs descriptor in the *same unit of work*, before you consider the task finished:
59
118
 
60
119
  - Create a new directory, module, or subpackage.
61
120
  - Add, rename, move, or delete significant files in a directory.
121
+ - Add, rename, move, or delete sibling plain Markdown documents in a directory.
62
122
  - Change what a module does, what it exposes, or how it relates to its parent or children.
63
123
 
64
124
  **Action.**
65
125
 
66
- - If the directory has **no** xdocs file, create one (for example `<name>.xdocs.md`) in that directory.
67
- - If it **already** has one, update it so it matches the new reality.
126
+ - If the directory has **no** xdocs descriptor, create one named `<name>.xdocs.md` in that directory.
127
+ - If it **already** has one, update it so it matches the new reality. If there is more than one descriptor, consolidate to one.
128
+ - Never create or keep a descriptor named only `.xdocs.md`. `.xdocs.md` is the extension, not the whole filename.
68
129
  - Then fix the parent/child links and verify with `<xdocs> tree`.
69
130
 
70
- **What every module's xdocs file must capture:**
131
+ **What every module's xdocs descriptor must capture:**
71
132
 
72
133
  - `subject` — the module's unique name in the tree.
73
134
  - `description` — the module's **purpose**: what it is for and what it does.
@@ -75,12 +136,16 @@ Maintaining xdocs files is an **automatic, built-in responsibility — not a tas
75
136
  - `parent` — the `subject` of the containing module (and add this module to that parent's `children`).
76
137
  - `children` — the `subject`s of the modules contained inside this one.
77
138
 
78
- **Do not wait to be asked.** After you finish creating or modifying a module or directory, create or update its xdocs file as part of the same change. A code change that adds or alters a module is **not complete** until its xdocs file and the affected parent/child links are updated.
139
+ Every descriptor also includes `documents`, a map from each same-directory plain Markdown filename to the purpose of that companion document.
140
+ Each ordinary companion document listed there should include its own frontmatter
141
+ with `owner` equal to this descriptor's `subject`.
142
+
143
+ **Do not wait to be asked.** After you finish creating or modifying a module or directory, create or update its xdocs descriptor as part of the same change. A code change that adds or alters a module is **not complete** until its xdocs descriptor, companion-document list, and affected parent/child links are updated.
79
144
 
80
145
  **How `[ai].mode` applies.** The mode controls only *how* you write the docs, never *whether* you write them and never whether the user must ask first:
81
146
 
82
- - `auto` — create/update the xdocs files immediately as part of the change, then report what changed.
83
- - `prompt` — state exactly which xdocs files you are creating or updating, then write them (honoring any pending confirmation). Announcing is for transparency; it does not make documentation optional and the user never has to request it.
147
+ - `auto` — create/update the xdocs descriptors immediately as part of the change, then report what changed.
148
+ - `prompt` — state exactly which xdocs descriptors you are creating or updating, then write them (honoring any pending confirmation). Announcing is for transparency; it does not make documentation optional and the user never has to request it.
84
149
 
85
150
  ### Example: documenting a new module
86
151
 
@@ -95,8 +160,14 @@ children: []
95
160
  files:
96
161
  login.ts: Email/password login flow; exports `login()` and `verifyPassword()`.
97
162
  session.ts: Session lifecycle; exports `createSession()` and `validateSession()`.
163
+ documents:
164
+ authentication-implementation.md: Companion notes that explain implementation details and decisions.
98
165
  tags:
99
166
  - security
167
+ keywords:
168
+ - authentication
169
+ - login
170
+ - sessions
100
171
  flags: []
101
172
  status: stable
102
173
  ---
@@ -105,7 +176,31 @@ Auth validates credentials and issues sessions. `login()` delegates password
105
176
  checks to `verifyPassword()`; sessions are created and validated in `session.ts`.
106
177
  ```
107
178
 
108
- Then add `auth` to the `children` list of the `src` module's xdocs file so the tree stays consistent.
179
+ Then create or update `src/auth/authentication-implementation.md` with
180
+ companion-document frontmatter:
181
+
182
+ ```markdown
183
+ ---
184
+ name: authentication-implementation
185
+ purpose: Explain authentication implementation details and decisions.
186
+ description: Detailed notes for login, password verification, and session behavior.
187
+ created: 2026-07-06
188
+ flags: []
189
+ tags:
190
+ - security
191
+ keywords:
192
+ - authentication
193
+ - password verification
194
+ - session lifecycle
195
+ owner: auth
196
+ ---
197
+
198
+ # Authentication Implementation
199
+
200
+ Describe the implementation details that are too long for `auth.xdocs.md`.
201
+ ```
202
+
203
+ Then add `auth` to the `children` list of the `src` module's xdocs descriptor so the tree stays consistent.
109
204
 
110
205
  If the directory you are documenting is the **root of a package or application** (not a sub-module), set `parent: null` instead, and list that package's root `.xdocs.md` in the repository's single `XDOCS.md` index rather than in a parent module's `children`.
111
206
 
@@ -115,23 +210,26 @@ When you start working in a project that uses xdocs:
115
210
 
116
211
  1. Read the root `XDOCS.md` to learn the project's top-level subject and structure.
117
212
  2. Run `<xdocs> tree` to see the module hierarchy.
118
- 3. Run `<xdocs> scan` to see documentation coverage and which directories are missing xdocs files.
119
- 4. Read `xdocs.config.toml` and note `[ai].mode`, the supported `[extensions]`, and `[scan].exclude`.
120
- 5. When you navigate into a module, read that module's xdocs file (frontmatter first, body only if you need more) instead of reading every source file.
213
+ 3. Run `<xdocs> scan` to see documentation coverage, invalid descriptors, and companion-document coverage.
214
+ 4. Read `xdocs.config.toml` and note `[ai].mode` and `[scan].exclude`; xdocs descriptors always use the `.xdocs.md` suffix.
215
+ 5. When you navigate into a module, read that module's named `*.xdocs.md` descriptor frontmatter first. Read listed companion documents only when their descriptions show they are relevant.
121
216
 
122
217
  ## Documentation Workflow (writing and updating)
123
218
 
124
219
  Follow this whenever the automatic trigger above fires, or when the user asks to document a directory:
125
220
 
126
- 1. Determine the target directory and whether it already has an xdocs file (`<xdocs> scan` or `<xdocs> list <path>`).
221
+ 1. Determine the target directory and whether it already has exactly one named `*.xdocs.md` descriptor (`<xdocs> scan` or `<xdocs> list <path>`).
127
222
  2. Read the directory's actual files so the documentation reflects reality. Never invent files, modules, or behavior that is not present.
128
223
  3. Respect `[ai].mode` (it controls how you write, not whether you write):
129
- - **prompt mode**: state exactly which xdocs files you are creating or updating, then write them (honor a pending confirmation, but never skip the documentation).
130
- - **auto mode**: create or update the xdocs files immediately, then report what changed.
131
- 4. Write or update the xdocs file with correct frontmatter:
132
- - Set `subject` (unique), `description` (the module's purpose), and `files` (each real file -> short purpose, including key functions/exports).
224
+ - **prompt mode**: state exactly which xdocs descriptors you are creating or updating, then write them (honor a pending confirmation, but never skip the documentation).
225
+ - **auto mode**: create or update the xdocs descriptors immediately, then report what changed.
226
+ 4. Write or update the xdocs descriptor with correct frontmatter:
227
+ - Set `subject` (unique), `description` (the module's purpose), and `files` (each real implementation/configuration file -> short purpose, including key functions/exports).
228
+ - Set `documents` to every same-directory plain Markdown file -> short purpose. Use `{}` when there are no companion documents.
229
+ - Set `keywords` to search terms and concepts that should help agents match user requests to the module.
230
+ - For each ordinary companion document, add or update frontmatter with `name`, `purpose`, `description`, `created`, `flags`, `tags`, `keywords`, and `owner`; set `owner` to the descriptor's `subject`.
133
231
  - Set `parent` to the containing module's `subject`, and add this `subject` to that parent's `children`.
134
- - Use `tags`/`flags`/`status` where useful.
232
+ - Use `tags`/`keywords`/`flags`/`status` where useful.
135
233
  5. Keep the tree consistent: if you add a module, update its parent's `children`; if you remove one, update both sides.
136
234
  6. Validate with `<xdocs> tree` (it reports duplicate subjects, orphans, and missing children) and fix any reported issues.
137
235
 
@@ -150,7 +248,8 @@ When generating from scratch, prefer `<xdocs> generate <path>` (one directory) o
150
248
 
151
249
  ## Safety Rules
152
250
 
153
- - Never leave a new or changed module undocumented. Creating or updating its xdocs file is part of finishing the work, not a separate request the user must make.
251
+ - Never leave a new or changed module undocumented. Creating or updating its xdocs descriptor is part of finishing the work, not a separate request the user must make.
252
+ - Never leave an ordinary companion Markdown document without useful frontmatter; it should identify its `owner`, purpose, tags, keywords, and flags.
154
253
  - Never fabricate files, modules, descriptions, or relationships. Documentation must match the repository.
155
254
  - Never edit generated or build outputs (`library/`, `bundle/`, `bin/`, `*.tgz`). They are ignored and regenerated.
156
255
  - In prompt mode, announce the xdocs changes you will make and honor a pending confirmation — but still treat documenting the change as required, never optional.
@@ -166,7 +265,7 @@ xdocs searches for configuration via `--config <path>`, `./xdocs.config.toml`, o
166
265
  schema = 1
167
266
 
168
267
  [extensions]
169
- supported = [".docs.md", ".xdocs.md"]
268
+ supported = [".xdocs.md"]
170
269
 
171
270
  [ai]
172
271
  mode = "prompt" # "prompt" (announce and wait) or "auto" (update immediately)
@@ -178,22 +277,24 @@ exclude = ["node_modules", ".git", "dist", "build", "library", "bin", "bundle"]
178
277
  name = "my-project"
179
278
 
180
279
  [agents]
181
- auto_agents_md = true # keep the xdocs section in AGENTS.md up to date on normal commands
280
+ auto_agents_md = true # keep the xdocs section in AGENTS.md up to date on bare and normal commands
182
281
  auto_skill_install = true # install or refresh the guiho-s-xdocs skill globally
183
282
  skill_tool = "agents" # default tool for auto-install: agents (standard) or claude
184
283
  ```
185
284
 
186
- Agent automation options default to true. Set `auto_agents_md = false` to stop xdocs from touching AGENTS.md, and `auto_skill_install = false` to stop xdocs from installing or refreshing `guiho-s-xdocs` globally.
285
+ Agent automation options default to true. A bare `xdocs` invocation and normal data commands always bootstrap the standard global skill when no config is present; with config, set `auto_agents_md = false` to stop xdocs from touching AGENTS.md, and `auto_skill_install = false` to stop xdocs from installing or refreshing `guiho-s-xdocs` globally.
286
+
287
+ The `[extensions]` section is retained for config compatibility, but the only supported descriptor suffix is `.xdocs.md`.
187
288
 
188
289
  ## CLI Reference
189
290
 
190
291
  ```bash
191
292
  xdocs init # create XDOCS.md + xdocs.config.toml, update AGENTS.md, install the skill
192
- xdocs scan # report xdocs coverage across the project
293
+ xdocs scan # report descriptor and companion-document coverage
193
294
  xdocs tree # print the module hierarchy
194
- xdocs list <path> # list files in a scope with descriptions
295
+ xdocs list <path> # list files and companion documents with descriptions
195
296
  xdocs generate [path] # draft documentation for a directory or the whole project
196
- xdocs merge [path] # merge a directory's xdocs files into one document
297
+ xdocs merge [path] # merge a directory's xdocs descriptors into one document
197
298
  xdocs prompt --name=<name> # print a ready-made AI prompt (write|update|agents|generate)
198
299
  xdocs agents install local # install guiho-s-xdocs into this project (.agents/skills/...)
199
300
  xdocs agents install global # install guiho-s-xdocs into the user home skills directory
@@ -252,7 +353,7 @@ await ensureAgentsInstructions(process.cwd(), true)
252
353
  When reporting an xdocs result, include:
253
354
 
254
355
  - The command that ran and the target path.
255
- - Which xdocs files were created or changed, if any.
356
+ - Which xdocs descriptors and companion documents were created or changed, if any.
256
357
  - Tree/coverage status (subjects added, orphans or duplicates resolved).
257
358
  - The configured AI mode, and — in prompt mode — exactly what you are waiting to write.
258
359
 
@@ -0,0 +1,26 @@
1
+ ---
2
+ subject: xdocs-guiho-s-xdocs-skill
3
+ description: Packaged guiho-s-xdocs agent skill that teaches AI agents how to maintain xdocs projects.
4
+ parent: xdocs-skills
5
+ children: []
6
+ files: {}
7
+ documents:
8
+ SKILL.md: Versioned xdocs workflow skill installed into .agents/skills or .claude/skills; defines descriptor, companion-document metadata, scan, tree, and maintenance rules.
9
+ tags:
10
+ - skills
11
+ - agents
12
+ - documentation
13
+ keywords:
14
+ - xdocs skill
15
+ - companion metadata
16
+ - agent workflow
17
+ flags: []
18
+ status: stable
19
+ ---
20
+
21
+ The `guiho-s-xdocs/` directory contains the bundled agent skill shipped with the
22
+ package. The installer treats `SKILL.md` as the source of truth and refreshes
23
+ installed copies when the bundled version or content changes.
24
+ The skill also documents the standard frontmatter fields expected on ordinary
25
+ companion Markdown documents: `name`, `purpose`, `description`, `created`,
26
+ `flags`, `tags`, `keywords`, and `owner`.
@@ -2,13 +2,18 @@
2
2
  subject: xdocs-skills
3
3
  description: Bundled AI-agent skills shipped with @guiho/xdocs and installed by the xdocs agents commands.
4
4
  parent: xdocs-package
5
- children: []
6
- files:
7
- guiho-s-xdocs/SKILL.md: Versioned xdocs workflow skill installed into .agents/skills or .claude/skills; replaces legacy guiho-as-xdocs installs when refreshed.
5
+ children:
6
+ - xdocs-guiho-s-xdocs-skill
7
+ files: {}
8
+ documents: {}
8
9
  tags:
9
10
  - skills
10
11
  - agents
11
12
  - documentation
13
+ keywords:
14
+ - agent skills
15
+ - bundled skill
16
+ - skill installation
12
17
  flags: []
13
18
  status: stable
14
19
  ---
@@ -16,4 +21,4 @@ status: stable
16
21
  The `skills/` directory contains the bundled `guiho-s-xdocs` agent skill. The
17
22
  installer treats this packaged skill as the current source of truth, removes
18
23
  legacy `guiho-as-xdocs` install directories, and refreshes installed copies when
19
- their frontmatter version or content differs from the bundled file.
24
+ their frontmatter version or content differs from the bundled file.
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env node
2
- /*
3
- * Install the platform-native xdocs binary for package-manager installs.
4
- * Node is used only during installation. The installed `xdocs` command points
5
- * directly at the downloaded native binary and does not require Node at runtime.
6
- */
7
-
8
- const { createWriteStream, existsSync, mkdirSync, chmodSync } = require('node:fs')
9
- const { readFile } = require('node:fs/promises')
10
- const { get } = require('node:https')
11
- const { join } = require('node:path')
12
-
13
- const root = join(__dirname, '..')
14
- const packagePath = join(root, 'package.json')
15
- const targetPath = join(root, 'bin', 'xdocs.exe')
16
-
17
- main().catch((error) => {
18
- console.error(`xdocs: failed to install native binary: ${error.message}`)
19
- process.exit(1)
20
- })
21
-
22
- async function main() {
23
- if (process.env.XDOCS_SKIP_NATIVE_INSTALL === '1') {
24
- console.warn('xdocs: skipping native binary installation because XDOCS_SKIP_NATIVE_INSTALL=1')
25
- return
26
- }
27
-
28
- if (existsSync(join(root, 'source'))) {
29
- console.warn('xdocs: skipping native binary installation in a source checkout')
30
- return
31
- }
32
-
33
- const packageJson = JSON.parse(await readFile(packagePath, 'utf8'))
34
- const version = packageJson.version
35
- if (typeof version !== 'string' || version.length === 0) throw new Error('package.json version is missing')
36
-
37
- const asset = assetName()
38
- const tag = `@guiho/xdocs@${version}`
39
- const url = `https://github.com/CGuiho/xdocs/releases/download/${encodeURIComponent(tag)}/${asset}`
40
-
41
- mkdirSync(join(root, 'bin'), { recursive: true })
42
- await download(url, targetPath)
43
- if (process.platform !== 'win32') chmodSync(targetPath, 0o755)
44
-
45
- console.log(`xdocs: installed native binary ${asset}`)
46
- }
47
-
48
- function assetName() {
49
- if (process.platform === 'linux') {
50
- if (process.arch === 'x64') return 'xdocs-linux-x64'
51
- if (process.arch === 'arm64') return 'xdocs-linux-arm64'
52
- }
53
-
54
- if (process.platform === 'darwin') {
55
- if (process.arch === 'x64') return 'xdocs-macos-x64'
56
- if (process.arch === 'arm64') return 'xdocs-macos-arm64'
57
- }
58
-
59
- if (process.platform === 'win32') {
60
- if (process.arch === 'x64') return 'xdocs-windows-x64.exe'
61
- }
62
-
63
- throw new Error(`unsupported platform: ${process.platform}/${process.arch}`)
64
- }
65
-
66
- function download(url, destination) {
67
- return new Promise((resolve, reject) => {
68
- const request = get(url, (response) => {
69
- if (response.statusCode === 302 || response.statusCode === 301) {
70
- const location = response.headers.location
71
- if (!location) {
72
- reject(new Error(`redirect from ${url} did not include a Location header`))
73
- return
74
- }
75
-
76
- download(location, destination).then(resolve, reject)
77
- return
78
- }
79
-
80
- if (response.statusCode !== 200) {
81
- reject(new Error(`download failed (${response.statusCode}) from ${url}`))
82
- return
83
- }
84
-
85
- const file = createWriteStream(destination)
86
- response.pipe(file)
87
- file.on('finish', () => {
88
- file.close(resolve)
89
- })
90
- file.on('error', reject)
91
- })
92
-
93
- request.on('error', reject)
94
- request.end()
95
- })
96
- }
97
-
98
- // Keep npm pack from treating this package as broken before postinstall runs.
99
- if (!existsSync(targetPath)) {
100
- mkdirSync(join(root, 'bin'), { recursive: true })
101
- }