@guiho/xdocs 0.3.1 → 0.4.9
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/CHANGELOG.md +20 -0
- package/DOCS.md +108 -37
- package/README.md +108 -33
- package/docs/2026-07-05-xdocs-document-model.md +77 -0
- package/docs/decisions/2026-07-09-package-launcher-source-fallback.md +65 -0
- package/docs/decisions/decisions.xdocs.md +22 -0
- package/docs/docs.xdocs.md +23 -0
- package/jsr.json +1 -1
- package/library/agents.d.ts +1 -1
- package/library/agents.d.ts.map +1 -1
- package/library/agents.js +10 -6
- package/library/commands/generate.d.ts.map +1 -1
- package/library/commands/generate.js +23 -1
- package/library/commands/list.d.ts.map +1 -1
- package/library/commands/list.js +14 -4
- package/library/commands/merge.d.ts.map +1 -1
- package/library/commands/merge.js +12 -1
- package/library/commands/scan.d.ts.map +1 -1
- package/library/commands/scan.js +13 -2
- package/library/config.d.ts.map +1 -1
- package/library/config.js +7 -3
- package/library/discovery.d.ts +8 -4
- package/library/discovery.d.ts.map +1 -1
- package/library/discovery.js +107 -17
- package/library/flags.d.ts +1 -1
- package/library/flags.js +1 -1
- package/library/guiho-xdocs-bin.d.ts +1 -1
- package/library/guiho-xdocs-bin.js +1 -1
- package/library/guiho-xdocs.d.ts +2 -2
- package/library/guiho-xdocs.d.ts.map +1 -1
- package/library/guiho-xdocs.js +1 -1
- package/library/help.js +16 -15
- package/library/metadata.d.ts +1 -1
- package/library/metadata.d.ts.map +1 -1
- package/library/metadata.js +23 -3
- package/library/tree.d.ts +1 -1
- package/library/tree.d.ts.map +1 -1
- package/library/tree.js +2 -2
- package/library/types.d.ts +14 -2
- package/library/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/prompts/agents.md +9 -2
- package/prompts/generate.md +10 -2
- package/prompts/prompts.xdocs.md +27 -0
- package/prompts/update.md +19 -7
- package/prompts/write.md +18 -5
- package/scripts/install-package.ts +42 -22
- package/scripts/scripts.xdocs.md +10 -3
- package/scripts/xdocs-bin.ts +16 -2
- package/skills/guiho-s-xdocs/SKILL.md +133 -32
- package/skills/guiho-s-xdocs/guiho-s-xdocs.xdocs.md +26 -0
- package/skills/skills.xdocs.md +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# GUIHO XDocs Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.9
|
|
4
|
+
|
|
5
|
+
- Fix GitHub Actions artifact names for scoped package tags by using run IDs, allowing the native binary publish workflow to upload artifacts and continue to GitHub Release asset publication.
|
|
6
|
+
|
|
7
|
+
## 0.4.8
|
|
8
|
+
|
|
9
|
+
- Harden the direct Linux/macOS Bash installer and Windows PowerShell installer for native xdocs binaries, including baseline-first x64 fallback, explicit default/modern variants, downloaded binary validation, PATH setup, and shadowing warnings.
|
|
10
|
+
- Verify the 12-asset native binary matrix during `bun run binaries` for Linux, macOS, and Windows arm64/x64 baseline/default/modern outputs.
|
|
11
|
+
- Upload native binaries as CI workflow artifacts and publish/verify all 12 GitHub Release assets before npm publishing on version-tag releases.
|
|
12
|
+
- Document native binary installation, PATH fallback commands, and the full release asset matrix in `README.md` and `DOCS.md`.
|
|
13
|
+
|
|
14
|
+
## 0.4.0-alpha.0
|
|
15
|
+
|
|
16
|
+
- Change the documentation model to one named `*.xdocs.md` descriptor per documented directory, with `XDOCS.md` reserved as the frontmatter-less repository index.
|
|
17
|
+
- Add first-class same-directory Markdown companion documents through the required `documents` metadata map, and validate descriptor/document alignment during scan.
|
|
18
|
+
- Reject nameless `.xdocs.md` descriptors, reject non-`.xdocs.md` descriptor extensions, and flag multiple descriptors in one directory.
|
|
19
|
+
- Update `scan`, `list`, `generate`, and `merge` output to surface both implementation files and companion Markdown documents.
|
|
20
|
+
- Add required `keywords` metadata to xdocs descriptors, surface descriptor keywords in scan/generate/merge output, and document companion Markdown `keywords` frontmatter.
|
|
21
|
+
- 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.
|
|
22
|
+
|
|
3
23
|
## 0.3.1
|
|
4
24
|
|
|
5
25
|
- 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
|
|
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
|
|
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
|
|
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
|
|
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`
|
|
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
|
|
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
|
|
40
|
+
## xdocs Descriptors and Metadata
|
|
40
41
|
|
|
41
|
-
A module's xdocs
|
|
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,
|
|
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
|
|
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
|
|
|
@@ -86,11 +119,29 @@ Scanning walks the project tree and skips directories listed in `[scan].exclude`
|
|
|
86
119
|
Direct native binary install (no Node.js or Bun required after installation):
|
|
87
120
|
|
|
88
121
|
```bash
|
|
89
|
-
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh |
|
|
122
|
+
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh | bash
|
|
90
123
|
```
|
|
91
124
|
|
|
92
125
|
```powershell
|
|
93
|
-
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
|
|
126
|
+
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1 | iex
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The Linux/macOS installer is a Bash script in `devops/install.sh`; the Windows
|
|
130
|
+
installer is the PowerShell script in `devops/install.ps1`. Both download from
|
|
131
|
+
GitHub Releases, install into `~/.local/bin` by default, and add that directory
|
|
132
|
+
then fall back to the default and `modern` variants. Users can force a specific
|
|
133
|
+
architecture or variant with `--arch` / `--variant` on Bash or `-Arch` /
|
|
134
|
+
`-Variant` on PowerShell.
|
|
135
|
+
|
|
136
|
+
Manual PATH fallback commands:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```powershell
|
|
143
|
+
$env:Path = "$HOME\.local\bin;$env:Path"
|
|
144
|
+
[Environment]::SetEnvironmentVariable('Path', "$HOME\.local\bin;" + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')
|
|
94
145
|
```
|
|
95
146
|
|
|
96
147
|
Install XDocs as a development dependency through a JavaScript package manager. Package-manager execution uses the shipped Bun launcher, which downloads the matching native binary during `postinstall` or on first run if the install hook did not run, then executes the native binary:
|
|
@@ -169,7 +220,7 @@ Flags: `--tool <agents|claude|all>`, `--global`, `--cwd`, `--verbose`.
|
|
|
169
220
|
|
|
170
221
|
### `xdocs scan`
|
|
171
222
|
|
|
172
|
-
Walks every directory (respecting `[scan].exclude`),
|
|
223
|
+
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
224
|
|
|
174
225
|
```bash
|
|
175
226
|
xdocs scan
|
|
@@ -180,7 +231,7 @@ Flags: `--format <text|json>`, `--cwd`, `--config`, `--verbose`.
|
|
|
180
231
|
|
|
181
232
|
### `xdocs generate [path]`
|
|
182
233
|
|
|
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.
|
|
234
|
+
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
235
|
|
|
185
236
|
```bash
|
|
186
237
|
xdocs generate # whole project to stdout
|
|
@@ -192,7 +243,7 @@ Flags: `--output <path>`, `--cwd`, `--config`, `--verbose`.
|
|
|
192
243
|
|
|
193
244
|
### `xdocs merge [path]`
|
|
194
245
|
|
|
195
|
-
Concatenates all xdocs
|
|
246
|
+
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
247
|
|
|
197
248
|
```bash
|
|
198
249
|
xdocs merge ./src/domain
|
|
@@ -203,7 +254,7 @@ Flags: `--output <path>`, `--cwd`, `--config`, `--verbose`.
|
|
|
203
254
|
|
|
204
255
|
### `xdocs tree`
|
|
205
256
|
|
|
206
|
-
Scans all xdocs
|
|
257
|
+
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
258
|
|
|
208
259
|
```bash
|
|
209
260
|
xdocs tree
|
|
@@ -215,7 +266,7 @@ Flags: `--format <text|markdown|json>`, `--output <path>`, `--cwd`, `--config`,
|
|
|
215
266
|
|
|
216
267
|
### `xdocs list [path]`
|
|
217
268
|
|
|
218
|
-
Lists every documented file in a scope with
|
|
269
|
+
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
270
|
|
|
220
271
|
```bash
|
|
221
272
|
xdocs list
|
|
@@ -231,8 +282,8 @@ Outputs a ready-made, self-contained instruction prompt for an AI agent. The pro
|
|
|
231
282
|
|
|
232
283
|
Available prompts:
|
|
233
284
|
|
|
234
|
-
- `write`: Scan a directory and write xdocs
|
|
235
|
-
- `update`: Update existing xdocs
|
|
285
|
+
- `write`: Scan a directory and write a named xdocs descriptor.
|
|
286
|
+
- `update`: Update existing xdocs descriptors after code or document changes.
|
|
236
287
|
- `agents`: Update `AGENTS.md` with xdocs instructions.
|
|
237
288
|
- `generate`: Generate comprehensive documentation.
|
|
238
289
|
|
|
@@ -285,7 +336,7 @@ Full configuration example:
|
|
|
285
336
|
schema = 1
|
|
286
337
|
|
|
287
338
|
[extensions]
|
|
288
|
-
supported = [".
|
|
339
|
+
supported = [".xdocs.md"]
|
|
289
340
|
|
|
290
341
|
[ai]
|
|
291
342
|
mode = "prompt"
|
|
@@ -308,7 +359,7 @@ Optional. When present, must be `1`.
|
|
|
308
359
|
|
|
309
360
|
### `[extensions]`
|
|
310
361
|
|
|
311
|
-
- `supported`:
|
|
362
|
+
- `supported`: Compatibility field for descriptor suffixes. The only supported value is `[".xdocs.md"]`; other extensions are rejected.
|
|
312
363
|
|
|
313
364
|
### `[ai]`
|
|
314
365
|
|
|
@@ -359,13 +410,13 @@ Bare `xdocs` invocations and the data commands (`scan`, `generate`, `merge`, `tr
|
|
|
359
410
|
|
|
360
411
|
## AI Usage Workflow
|
|
361
412
|
|
|
362
|
-
Maintaining xdocs
|
|
413
|
+
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
414
|
|
|
364
415
|
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
|
|
366
|
-
3. On creating a new module or subdirectory, create that directory's xdocs
|
|
367
|
-
4. On modifying a module (adding, renaming, moving, or removing files, or changing what it does), update its xdocs
|
|
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
|
|
416
|
+
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.
|
|
417
|
+
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.
|
|
418
|
+
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.
|
|
419
|
+
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
420
|
6. On request, use `xdocs generate`, `xdocs merge`, and `xdocs tree` to produce documentation artifacts.
|
|
370
421
|
|
|
371
422
|
## Prompts
|
|
@@ -421,8 +472,8 @@ The API uses the same configuration discovery and validation as the CLI.
|
|
|
421
472
|
- `source/embedded-resources.ts`: prompt, skill, and package metadata text imports used only for native binary embedding.
|
|
422
473
|
- `source/cli.ts`: argument parsing, command dispatch, config-gated automation, and process-facing error handling.
|
|
423
474
|
- `source/config.ts`: TOML discovery, schema validation, defaulting, default config generation, and agent-settings normalization.
|
|
424
|
-
- `source/discovery.ts`: filesystem scanning
|
|
425
|
-
- `source/metadata.ts`: YAML frontmatter extraction and
|
|
475
|
+
- `source/discovery.ts`: filesystem scanning, xdocs descriptor matching, companion Markdown discovery, and descriptor/document validation.
|
|
476
|
+
- `source/metadata.ts`: YAML frontmatter extraction, metadata validation, and nameless descriptor rejection.
|
|
426
477
|
- `source/tree.ts`: tree assembly, integrity checks, and rendering (text, markdown).
|
|
427
478
|
- `source/prompts.ts`: prompt loader (reads `prompts/*.md` from disk at runtime relative to `import.meta.url`).
|
|
428
479
|
- `source/help.ts`: help text and version display.
|
|
@@ -436,7 +487,7 @@ The API uses the same configuration discovery and validation as the CLI.
|
|
|
436
487
|
|
|
437
488
|
## Development Workflow
|
|
438
489
|
|
|
439
|
-
Run package commands from
|
|
490
|
+
Run package commands from the repository root.
|
|
440
491
|
|
|
441
492
|
```bash
|
|
442
493
|
bun install
|
|
@@ -465,6 +516,7 @@ Current tests cover:
|
|
|
465
516
|
- Tree construction, rendering, and integrity validation.
|
|
466
517
|
- Config discovery, validation, and defaulting.
|
|
467
518
|
- Agent settings normalization, skill path resolution, skill installation (local/global), tool detection, and AGENTS.md section insertion.
|
|
519
|
+
- Package launcher execution from a source checkout without a native vendor binary.
|
|
468
520
|
|
|
469
521
|
Run all tests:
|
|
470
522
|
|
|
@@ -500,15 +552,34 @@ bun run binaries
|
|
|
500
552
|
|
|
501
553
|
Supported release asset matrix:
|
|
502
554
|
|
|
503
|
-
- Linux x64: `xdocs-linux-x64`
|
|
555
|
+
- Linux x64: `xdocs-linux-x64-baseline`, `xdocs-linux-x64`, `xdocs-linux-x64-modern`
|
|
504
556
|
- Linux arm64: `xdocs-linux-arm64`
|
|
505
|
-
- macOS x64: `xdocs-macos-x64`
|
|
557
|
+
- macOS x64: `xdocs-macos-x64-baseline`, `xdocs-macos-x64`, `xdocs-macos-x64-modern`
|
|
506
558
|
- macOS arm64: `xdocs-macos-arm64`
|
|
507
|
-
- Windows x64: `xdocs-windows-x64.exe`
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
559
|
+
- Windows x64: `xdocs-windows-x64-baseline.exe`, `xdocs-windows-x64.exe`, `xdocs-windows-x64-modern.exe`
|
|
560
|
+
- Windows arm64: `xdocs-windows-arm64.exe`
|
|
561
|
+
|
|
562
|
+
`bun run binaries` verifies that all 12 expected native assets are present and
|
|
563
|
+
non-empty after compilation. CI builds the matrix and uploads `bin/xdocs-*` as a
|
|
564
|
+
GitHub Actions artifact. The tag publish workflow has `contents: write`, rebuilds
|
|
565
|
+
the same matrix, uploads it as a workflow artifact, publishes `bin/xdocs-*` to
|
|
566
|
+
the matching GitHub Release before npm publishing, and verifies that the release
|
|
567
|
+
contains exactly 12 `xdocs-*` assets.
|
|
568
|
+
|
|
569
|
+
Unsupported platforms should use a documented manual path: install Bun and run
|
|
570
|
+
from source, or download a compatible release asset manually.
|
|
571
|
+
|
|
572
|
+
The package-manager install path ships `scripts/xdocs-bin.ts` as the package
|
|
573
|
+
`bin`. That launcher delegates to `vendor/xdocs` or `vendor/xdocs.exe` when the
|
|
574
|
+
native binary exists. In source checkouts, it falls back to
|
|
575
|
+
`source/guiho-xdocs-bin.ts` so local package execution tests the checked-out
|
|
576
|
+
source without downloading a release artifact. In published package layouts, it
|
|
577
|
+
calls `scripts/install-package.ts` during first run if the vendor binary is
|
|
578
|
+
missing. The install helper downloads the matching GitHub Release asset, or
|
|
579
|
+
copies a bundled asset when present. The native binary entrypoint embeds prompt
|
|
580
|
+
templates, the `guiho-s-xdocs` skill, and package version metadata before
|
|
581
|
+
importing the CLI, so installed binaries do not need adjacent prompt or skill
|
|
582
|
+
files at runtime.
|
|
512
583
|
|
|
513
584
|
## Documentation Requirement Before Publishing
|
|
514
585
|
|
|
@@ -544,7 +615,7 @@ Run `xdocs init` from the project root, or pass `--config <path>`.
|
|
|
544
615
|
|
|
545
616
|
### A directory shows as uncovered
|
|
546
617
|
|
|
547
|
-
Add
|
|
618
|
+
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
619
|
|
|
549
620
|
### Tree warnings or errors
|
|
550
621
|
|
package/README.md
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
**Structured documentation system for codebases. Helps AI make sense of projects.**
|
|
4
4
|
|
|
5
|
-
|
|
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.
|
|
5
|
+
xdocs is a CLI tool 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
6
|
|
|
9
7
|
```text
|
|
10
|
-
codebase -> xdocs
|
|
8
|
+
codebase -> named *.xdocs.md descriptors + companion *.md documents -> AI understands the project
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
xdocs ships as
|
|
11
|
+
xdocs ships as a single native binary — no Node.js, Bun, or runtime required.
|
|
14
12
|
|
|
15
13
|
---
|
|
16
14
|
|
|
@@ -18,27 +16,74 @@ xdocs ships as compiled native binaries, a thin Bun launcher for package-manager
|
|
|
18
16
|
|
|
19
17
|
### Installation
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
Download and run the installer:
|
|
22
20
|
|
|
21
|
+
**Linux / macOS:**
|
|
23
22
|
```bash
|
|
24
|
-
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh |
|
|
23
|
+
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh | bash
|
|
25
24
|
```
|
|
26
25
|
|
|
26
|
+
**Windows (PowerShell):**
|
|
27
27
|
```powershell
|
|
28
|
-
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
|
|
28
|
+
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1 | iex
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The installers download native binaries from GitHub Releases, install `xdocs` into `~/.local/bin` by default, and add that directory to your user PATH when possible. x64 installs prefer the `baseline` variant first for maximum compatibility, then fall back to the default and `modern` variants.
|
|
32
|
+
|
|
33
|
+
**Flags and options:**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Pin a specific version
|
|
37
|
+
curl .../install.sh | bash -s -- --version 0.4.7
|
|
38
|
+
|
|
39
|
+
# Force architecture and variant
|
|
40
|
+
curl .../install.sh | bash -s -- --arch arm64
|
|
41
|
+
curl .../install.sh | bash -s -- --arch x64 --variant modern
|
|
42
|
+
curl .../install.sh | bash -s -- --arch x64 --variant default
|
|
43
|
+
|
|
44
|
+
# Custom install directory
|
|
45
|
+
curl .../install.sh | bash -s -- --install-dir /usr/local/bin
|
|
29
46
|
```
|
|
30
47
|
|
|
31
|
-
|
|
48
|
+
PowerShell examples:
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
```powershell
|
|
51
|
+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -Version 0.4.7
|
|
52
|
+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -Arch x64 -Variant baseline
|
|
53
|
+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -InstallDir "$HOME\.local\bin"
|
|
54
|
+
```
|
|
34
55
|
|
|
56
|
+
Or download the script first and run with flags directly:
|
|
35
57
|
```bash
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
curl -O https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh
|
|
59
|
+
chmod +x install.sh
|
|
60
|
+
./install.sh --version latest --arch x64 --variant baseline
|
|
39
61
|
```
|
|
40
62
|
|
|
41
|
-
Native
|
|
63
|
+
Native binaries are built and uploaded for all supported OS/architecture/variant combinations:
|
|
64
|
+
|
|
65
|
+
| OS | ARM64 | x64 baseline | x64 default | x64 modern |
|
|
66
|
+
| --- | --- | --- | --- | --- |
|
|
67
|
+
| Linux | `xdocs-linux-arm64` | `xdocs-linux-x64-baseline` | `xdocs-linux-x64` | `xdocs-linux-x64-modern` |
|
|
68
|
+
| macOS | `xdocs-macos-arm64` | `xdocs-macos-x64-baseline` | `xdocs-macos-x64` | `xdocs-macos-x64-modern` |
|
|
69
|
+
| Windows | `xdocs-windows-arm64.exe` | `xdocs-windows-x64-baseline.exe` | `xdocs-windows-x64.exe` | `xdocs-windows-x64-modern.exe` |
|
|
70
|
+
|
|
71
|
+
CI builds the same 12 native binaries and uploads them as a GitHub Actions artifact. Version-tag releases upload `bin/xdocs-*` to the matching GitHub Release and verify that all 12 assets are present.
|
|
72
|
+
|
|
73
|
+
If your current shell does not see the updated PATH immediately, open a new terminal or run one of these commands:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# bash/zsh
|
|
77
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
78
|
+
|
|
79
|
+
# fish
|
|
80
|
+
fish_add_path "$HOME/.local/bin"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
$env:Path = "$HOME\.local\bin;$env:Path"
|
|
85
|
+
[Environment]::SetEnvironmentVariable('Path', "$HOME\.local\bin;" + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')
|
|
86
|
+
```
|
|
42
87
|
|
|
43
88
|
### Initializing
|
|
44
89
|
|
|
@@ -57,7 +102,7 @@ This creates:
|
|
|
57
102
|
### Typical Workflow
|
|
58
103
|
|
|
59
104
|
```bash
|
|
60
|
-
# Scan the project for
|
|
105
|
+
# Scan the project for xdocs descriptors and companion Markdown documents
|
|
61
106
|
xdocs scan
|
|
62
107
|
|
|
63
108
|
# Generate documentation for a specific module
|
|
@@ -80,11 +125,11 @@ When AI works on a codebase, most of the structural knowledge lives in the head
|
|
|
80
125
|
|
|
81
126
|
### The Solution
|
|
82
127
|
|
|
83
|
-
xdocs solves this by placing
|
|
128
|
+
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
129
|
|
|
85
130
|
### File Format
|
|
86
131
|
|
|
87
|
-
xdocs
|
|
132
|
+
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
133
|
|
|
89
134
|
```markdown
|
|
90
135
|
---
|
|
@@ -99,7 +144,13 @@ files:
|
|
|
99
144
|
authenticate.ts: Validates credentials and returns a session token.
|
|
100
145
|
register.ts: Creates a new user account with email verification.
|
|
101
146
|
session.ts: Manages session creation, validation, and expiration.
|
|
147
|
+
documents:
|
|
148
|
+
authentication-implementation.md: Detailed implementation notes and decisions.
|
|
102
149
|
tags: []
|
|
150
|
+
keywords:
|
|
151
|
+
- authentication
|
|
152
|
+
- sessions
|
|
153
|
+
- identity
|
|
103
154
|
flags: []
|
|
104
155
|
---
|
|
105
156
|
|
|
@@ -108,6 +159,27 @@ flags: []
|
|
|
108
159
|
The authentication module handles all identity verification flows...
|
|
109
160
|
```
|
|
110
161
|
|
|
162
|
+
Ordinary same-directory companion `.md` files should also have YAML
|
|
163
|
+
frontmatter. Use `owner` to point back to the owning descriptor `subject`, and
|
|
164
|
+
include `keywords` for search/matching:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
---
|
|
168
|
+
name: authentication-implementation
|
|
169
|
+
purpose: Explain authentication implementation details and decisions.
|
|
170
|
+
description: Detailed notes for login, password verification, and session behavior.
|
|
171
|
+
created: 2026-07-06
|
|
172
|
+
flags: []
|
|
173
|
+
tags:
|
|
174
|
+
- security
|
|
175
|
+
keywords:
|
|
176
|
+
- authentication
|
|
177
|
+
- password verification
|
|
178
|
+
- session lifecycle
|
|
179
|
+
owner: authentication
|
|
180
|
+
---
|
|
181
|
+
```
|
|
182
|
+
|
|
111
183
|
#### Metadata Fields
|
|
112
184
|
|
|
113
185
|
| Field | Type | Required | Description |
|
|
@@ -117,13 +189,15 @@ The authentication module handles all identity verification flows...
|
|
|
117
189
|
| `parent` | `string \| null` | Yes | The parent subject in the hierarchy. `null` for the root. |
|
|
118
190
|
| `children` | `string[]` | Yes | Child subjects (submodules) contained within this module. |
|
|
119
191
|
| `files` | `map<string, string>` | Yes | Files in this directory. Key = filename, value = description. |
|
|
192
|
+
| `documents` | `map<string, string>` | Yes | Same-directory plain Markdown documents. Key = filename, value = description. |
|
|
120
193
|
| `tags` | `string[]` | Yes | Tags for categorization and search. |
|
|
194
|
+
| `keywords` | `string[]` | Yes | Search terms and concepts agents can use to match requests. |
|
|
121
195
|
| `flags` | `string[]` | Yes | Flags for marking attributes or states. |
|
|
122
196
|
| `status` | `string` | No | Module status (e.g., `active`, `deprecated`, `experimental`). |
|
|
123
197
|
|
|
124
198
|
### The Tree
|
|
125
199
|
|
|
126
|
-
xdocs
|
|
200
|
+
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
201
|
|
|
128
202
|
```
|
|
129
203
|
project (root)
|
|
@@ -152,7 +226,7 @@ Initializes xdocs in a project. Creates the root `XDOCS.md`, the `xdocs.config.t
|
|
|
152
226
|
|
|
153
227
|
#### `xdocs scan`
|
|
154
228
|
|
|
155
|
-
Scans the project for xdocs
|
|
229
|
+
Scans the project for named `*.xdocs.md` descriptors and sibling plain Markdown companion documents. Reports descriptor validity, directory coverage, and companion-document coverage.
|
|
156
230
|
|
|
157
231
|
```bash
|
|
158
232
|
xdocs scan
|
|
@@ -176,15 +250,15 @@ xdocs generate
|
|
|
176
250
|
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
251
|
|
|
178
252
|
```bash
|
|
179
|
-
xdocs prompt --name=write # How to write xdocs
|
|
180
|
-
xdocs prompt --name=update # How to update existing xdocs
|
|
253
|
+
xdocs prompt --name=write # How to write a named xdocs descriptor
|
|
254
|
+
xdocs prompt --name=update # How to update existing xdocs descriptors
|
|
181
255
|
xdocs prompt --name=agents # How to update AGENTS.md
|
|
182
256
|
xdocs prompt --name=generate # How to generate comprehensive docs
|
|
183
257
|
```
|
|
184
258
|
|
|
185
259
|
#### `xdocs merge [path]`
|
|
186
260
|
|
|
187
|
-
Merges xdocs
|
|
261
|
+
Merges xdocs descriptors from a directory into a single consolidated document.
|
|
188
262
|
|
|
189
263
|
```bash
|
|
190
264
|
xdocs merge ./src/domain
|
|
@@ -201,7 +275,7 @@ xdocs tree --format markdown --output tree.md
|
|
|
201
275
|
|
|
202
276
|
#### `xdocs list [path]`
|
|
203
277
|
|
|
204
|
-
Lists files in a scope with descriptions pulled from xdocs metadata.
|
|
278
|
+
Lists implementation files and companion Markdown documents in a scope with descriptions pulled from xdocs metadata.
|
|
205
279
|
|
|
206
280
|
```bash
|
|
207
281
|
xdocs list ./src/auth
|
|
@@ -240,9 +314,8 @@ xdocs looks for configuration at `./xdocs.config.toml`, `./config/xdocs.config.t
|
|
|
240
314
|
schema = 1
|
|
241
315
|
|
|
242
316
|
[extensions]
|
|
243
|
-
#
|
|
244
|
-
|
|
245
|
-
supported = [".docs.md", ".xdocs.md"]
|
|
317
|
+
# Descriptor suffix recognized by xdocs. Only ".xdocs.md" is supported.
|
|
318
|
+
supported = [".xdocs.md"]
|
|
246
319
|
|
|
247
320
|
[ai]
|
|
248
321
|
# How the AI handles documentation updates.
|
|
@@ -311,16 +384,19 @@ const configOrDefaults = await loadConfigOrDefaults({ cwd: process.cwd(), format
|
|
|
311
384
|
### Discovery and Scanning
|
|
312
385
|
|
|
313
386
|
```ts
|
|
314
|
-
import { scanProject, scanDirectory, isXDocsFile } from '@guiho/xdocs'
|
|
387
|
+
import { scanProject, scanDirectory, isPlainMarkdownDocument, isXDocsDescriptorFile, isXDocsFile } from '@guiho/xdocs'
|
|
315
388
|
|
|
316
389
|
// Scan the entire project
|
|
317
390
|
const result = await scanProject(config)
|
|
318
391
|
console.log(result.totalFiles) // Total files found
|
|
319
392
|
console.log(result.xdocsFiles) // Array of XDocsFile objects
|
|
393
|
+
console.log(result.markdownDocuments) // Companion Markdown documents found
|
|
320
394
|
console.log(result.uncoveredPaths) // Directories without xdocs coverage
|
|
321
395
|
|
|
322
|
-
// Check
|
|
323
|
-
isXDocsFile('auth.xdocs.md'
|
|
396
|
+
// Check descriptor and companion document files
|
|
397
|
+
isXDocsFile('auth.xdocs.md') // true
|
|
398
|
+
isXDocsDescriptorFile('auth.xdocs.md') // true
|
|
399
|
+
isPlainMarkdownDocument('auth-notes.md') // true
|
|
324
400
|
```
|
|
325
401
|
|
|
326
402
|
### Metadata Parsing
|
|
@@ -328,7 +404,7 @@ isXDocsFile('auth.xdocs.md', ['.docs.md', '.xdocs.md']) // true
|
|
|
328
404
|
```ts
|
|
329
405
|
import { parseXDocsFile, extractFrontmatter, validateMetadata } from '@guiho/xdocs'
|
|
330
406
|
|
|
331
|
-
// Parse an xdocs
|
|
407
|
+
// Parse an xdocs descriptor from disk
|
|
332
408
|
const file = await parseXDocsFile('/path/to/auth.xdocs.md', process.cwd())
|
|
333
409
|
console.log(file.metadata?.subject) // "authentication"
|
|
334
410
|
console.log(file.metadata?.description) // "Handles user login..."
|
|
@@ -373,10 +449,9 @@ console.log(prompt?.body)
|
|
|
373
449
|
|
|
374
450
|
## Development
|
|
375
451
|
|
|
376
|
-
Development requires Bun. Run from the
|
|
452
|
+
Development requires Bun. Run from the repository root:
|
|
377
453
|
|
|
378
454
|
```bash
|
|
379
|
-
cd xdocs
|
|
380
455
|
bun install
|
|
381
456
|
bun run typecheck
|
|
382
457
|
bun test
|
|
@@ -388,4 +463,4 @@ bun run binary
|
|
|
388
463
|
|
|
389
464
|
## License
|
|
390
465
|
|
|
391
|
-
MIT -- see [LICENSE.md](
|
|
466
|
+
MIT -- see [LICENSE.md](LICENSE.md).
|