@guiho/xdocs 0.2.3 → 0.3.0-alpha.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.
- package/CHANGELOG.md +23 -0
- package/DOCS.md +57 -23
- package/README.md +25 -9
- package/jsr.json +1 -1
- package/library/agents.d.ts +13 -7
- package/library/agents.d.ts.map +1 -1
- package/library/agents.js +68 -20
- package/library/commands/agents.js +4 -1
- package/library/commands/init.js +3 -3
- package/library/config.d.ts.map +1 -1
- package/library/config.js +1 -2
- package/library/embedded-resources.d.ts +17 -0
- package/library/embedded-resources.d.ts.map +1 -0
- package/library/embedded-resources.js +30 -0
- package/library/guiho-xdocs-native-bin.d.ts +6 -0
- package/library/guiho-xdocs-native-bin.d.ts.map +1 -0
- package/library/guiho-xdocs-native-bin.js +8 -0
- package/library/guiho-xdocs.d.ts +1 -1
- package/library/guiho-xdocs.d.ts.map +1 -1
- package/library/guiho-xdocs.js +1 -1
- package/library/help.d.ts.map +1 -1
- package/library/help.js +8 -5
- package/library/metadata.d.ts.map +1 -1
- package/library/metadata.js +1 -2
- package/library/prompts.d.ts.map +1 -1
- package/library/prompts.js +3 -0
- package/library/types.d.ts +5 -2
- package/library/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/scripts/install-native.cjs +101 -0
- package/scripts/scripts.xdocs.md +18 -0
- package/skills/{guiho-as-xdocs → guiho-s-xdocs}/SKILL.md +9 -8
- package/skills/skills.xdocs.md +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# GUIHO XDocs Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0-alpha.2
|
|
4
|
+
|
|
5
|
+
- Rename the bundled xdocs agent skill from `guiho-as-xdocs` to `guiho-s-xdocs` and add a frontmatter `version` field.
|
|
6
|
+
- Refresh installed skills from the bundled package copy, removing legacy `guiho-as-xdocs` skill directories and replacing stale `guiho-s-xdocs` installs when version or content differs.
|
|
7
|
+
- Keep `[agents].auto_skill_install` defaulted to `true` and run global skill refresh during config-gated command automation.
|
|
8
|
+
- Update the TypeScript API, tests, help text, README, architecture notes, AGENTS guidance, and canonical `DOCS.md` for the renamed skill behavior.
|
|
9
|
+
|
|
10
|
+
## 0.3.0-alpha.1
|
|
11
|
+
|
|
12
|
+
- Remove external parser dependencies (`smol-toml`, `yaml`) and use Bun-native `Bun.TOML.parse` and `Bun.YAML.parse` instead.
|
|
13
|
+
- Change the package-manager `xdocs` bin to point at a native binary path and add a `postinstall` downloader that installs the matching GitHub Release binary into `bin/xdocs.exe`; Node.js is used only during install by Node-based package managers, not at `xdocs` runtime.
|
|
14
|
+
- Update build configuration to include Bun types for the library build.
|
|
15
|
+
- Document the native package-manager install path and Bun-native parser behavior.
|
|
16
|
+
|
|
17
|
+
## 0.3.0-alpha.0
|
|
18
|
+
|
|
19
|
+
- Add native-binary-first distribution support for xdocs, including a Bun-powered release binary matrix for Linux x64/arm64, macOS x64/arm64, and Windows x64.
|
|
20
|
+
- Add direct installers (`install.sh` and `install.ps1`) so users can install the native `xdocs` binary without requiring Node.js or Bun at runtime.
|
|
21
|
+
- Add a native binary entrypoint that embeds prompts, the `guiho-as-xdocs` skill, and package version metadata so compiled binaries work without adjacent package files.
|
|
22
|
+
- Update CI and the publish workflow to build the release binary matrix and publish native binaries as GitHub Release assets while keeping npm publishing intact.
|
|
23
|
+
- Document the native binary distribution model in `DOCS.md`, `README.md`, `ARCHITECTURE.md`, and `AGENTS.md`.
|
|
24
|
+
- Add xdocs metadata files for the package root, source module, and devops module.
|
|
25
|
+
|
|
3
26
|
## 0.2.3
|
|
4
27
|
|
|
5
28
|
- `xdocs agents instructions` and config-gated AGENTS.md automation now tolerate formatter-only blank lines and trailing whitespace inside the managed xdocs block, preserving the user's formatted block when the actual text is unchanged.
|
package/DOCS.md
CHANGED
|
@@ -11,13 +11,15 @@ XDocs is a documentation tool, not a versioning tool. It never bumps versions or
|
|
|
11
11
|
## Package Overview
|
|
12
12
|
|
|
13
13
|
- Package name: `@guiho/xdocs`
|
|
14
|
-
-
|
|
14
|
+
- Source/runtime during development: Bun and TypeScript (ESM)
|
|
15
|
+
- Primary release runtime: compiled native Bun binary assets
|
|
16
|
+
- Package-manager install path: Node.js is used only for `postinstall`; the installed `xdocs` command executes the native binary
|
|
15
17
|
- Package type: ESM
|
|
16
18
|
- Library entrypoint: `source/guiho-xdocs.ts`
|
|
17
19
|
- CLI entrypoint: `source/guiho-xdocs-bin.ts`
|
|
18
20
|
- TypeScript build output: `library/` (used by `main` and `types`)
|
|
19
|
-
- Standalone binary output: `bin/xdocs
|
|
20
|
-
-
|
|
21
|
+
- Standalone binary output: `bin/xdocs-*` release assets
|
|
22
|
+
- Runtime parser dependencies: none; xdocs uses Bun-native TOML and YAML parsing
|
|
21
23
|
|
|
22
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.
|
|
23
25
|
|
|
@@ -81,7 +83,17 @@ Scanning walks the project tree and skips directories listed in `[scan].exclude`
|
|
|
81
83
|
|
|
82
84
|
## Installation
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
Direct native binary install (no Node.js or Bun required after installation):
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh | sh
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```powershell
|
|
93
|
+
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Install XDocs as a development dependency through a JavaScript package manager. This uses Node.js during `postinstall` to download the matching native binary, then the installed `xdocs` command executes the native binary:
|
|
85
97
|
|
|
86
98
|
```bash
|
|
87
99
|
bun add -d @guiho/xdocs
|
|
@@ -93,7 +105,7 @@ Or with npm:
|
|
|
93
105
|
npm install -D @guiho/xdocs
|
|
94
106
|
```
|
|
95
107
|
|
|
96
|
-
Use the
|
|
108
|
+
Use the direct installer when you do not want a JavaScript package manager involved. Use the package-manager install when you want project-local dependency management; after installation, `xdocs` still runs as a native binary.
|
|
97
109
|
|
|
98
110
|
## Quick Start
|
|
99
111
|
|
|
@@ -144,8 +156,8 @@ Initializes XDocs in a project. It:
|
|
|
144
156
|
|
|
145
157
|
- Creates `xdocs.config.toml` with defaults (skips if it already exists).
|
|
146
158
|
- Creates the root `XDOCS.md` (skips if it already exists).
|
|
147
|
-
- Updates `AGENTS.md` with the xdocs section that points AI agents at the `guiho-
|
|
148
|
-
- Installs the `guiho-
|
|
159
|
+
- Updates `AGENTS.md` with the xdocs section that points AI agents at the `guiho-s-xdocs` skill (creates `AGENTS.md` if absent; refreshes the section in place if present).
|
|
160
|
+
- Installs or refreshes the `guiho-s-xdocs` skill to the standard `.agents/skills` location, removing legacy `guiho-as-xdocs` installs when present.
|
|
149
161
|
|
|
150
162
|
```bash
|
|
151
163
|
xdocs init
|
|
@@ -233,7 +245,7 @@ Both `--name=value` and `--name value` forms are supported.
|
|
|
233
245
|
|
|
234
246
|
### `xdocs agents`
|
|
235
247
|
|
|
236
|
-
Installs the `guiho-
|
|
248
|
+
Installs the `guiho-s-xdocs` agent skill and maintains the `AGENTS.md` instruction section.
|
|
237
249
|
|
|
238
250
|
```bash
|
|
239
251
|
xdocs agents install local # install under the project (.agents/skills)
|
|
@@ -315,22 +327,24 @@ Optional. When present, must be `1`.
|
|
|
315
327
|
Agent settings control skill installation and the automation that runs on data commands.
|
|
316
328
|
|
|
317
329
|
- `auto_agents_md`: Keep the `AGENTS.md` xdocs section fresh on normal commands when `AGENTS.md` already exists. Default: `true`.
|
|
318
|
-
- `auto_skill_install`: Install the
|
|
330
|
+
- `auto_skill_install`: Install or refresh the configured skill globally from the bundled package copy. Default: `true`.
|
|
319
331
|
- `skill_tool`: Default target for auto-install. Supported values are `agents` (standard) and `claude`. Default: `agents`.
|
|
320
332
|
|
|
321
333
|
## Agent Skills and Automation
|
|
322
334
|
|
|
323
|
-
XDocs ships the `guiho-
|
|
335
|
+
XDocs ships the `guiho-s-xdocs` skill inside the package at `skills/guiho-s-xdocs/SKILL.md`. The skill is a large, on-demand instruction document with a `version` field in its frontmatter; a small section in `AGENTS.md` tells an agent to load it.
|
|
324
336
|
|
|
325
337
|
Installation is standard-first:
|
|
326
338
|
|
|
327
339
|
| Target | Skill location | When installed |
|
|
328
340
|
| ------------------------- | ------------------------------------------- | --------------------------------------------------------------- |
|
|
329
|
-
| `agents` (standard) | `.agents/skills/guiho-
|
|
330
|
-
| `claude` (non-standard) | `.claude/skills/guiho-
|
|
341
|
+
| `agents` (standard) | `.agents/skills/guiho-s-xdocs/SKILL.md` | Always (default). Read by OpenCode, Codex, Jules, and any AGENTS.md tool. |
|
|
342
|
+
| `claude` (non-standard) | `.claude/skills/guiho-s-xdocs/SKILL.md` | Only when requested via `--tool`, or detected (a `.claude/` directory or `CLAUDE.md`). |
|
|
331
343
|
|
|
332
344
|
`local` scope installs under the project root; `global` scope installs under the user home directory (`~/.agents/skills/...`).
|
|
333
345
|
|
|
346
|
+
Skill installation treats the bundled package skill as the source of truth. It removes legacy `guiho-as-xdocs` skill directories for the selected target, compares the installed `guiho-s-xdocs` version/content with the bundled copy, and replaces the installed skill whenever the version or content differs.
|
|
347
|
+
|
|
334
348
|
The rule is: default to the standard target. Only write non-standard files (`.claude`, `CLAUDE.md`, etc.) when the user asks for them or when those files already exist.
|
|
335
349
|
|
|
336
350
|
### Automation
|
|
@@ -338,7 +352,7 @@ The rule is: default to the standard target. Only write non-standard files (`.cl
|
|
|
338
352
|
When an `xdocs.config.toml` is present, the data commands (`scan`, `generate`, `merge`, `tree`, `list`) run config-gated agent automation before executing:
|
|
339
353
|
|
|
340
354
|
- If `auto_agents_md` is true and `AGENTS.md` exists, the xdocs section is kept fresh.
|
|
341
|
-
- If `auto_skill_install` is true
|
|
355
|
+
- If `auto_skill_install` is true, XDocs ensures the configured global skill is current from the bundled package copy, removing legacy skill names and printing a one-line notice to stderr when it installs or refreshes anything.
|
|
342
356
|
|
|
343
357
|
Automation does nothing outside an xdocs project (no config discovered). `init` and `agents` do not run this automation; they manage agent files explicitly.
|
|
344
358
|
|
|
@@ -355,7 +369,7 @@ Maintaining xdocs files is an automatic responsibility for an agent working in a
|
|
|
355
369
|
|
|
356
370
|
## Prompts
|
|
357
371
|
|
|
358
|
-
Prompt templates live in `prompts/*.md` and are
|
|
372
|
+
Prompt templates live in `prompts/*.md` and are read from disk at runtime relative to `import.meta.url`. Each prompt file has its own YAML frontmatter with `name` and `description`. The CLI exposes them through `xdocs prompt --name=<name>`. Available names: `write`, `update`, `agents`, `generate`.
|
|
359
373
|
|
|
360
374
|
## TypeScript API
|
|
361
375
|
|
|
@@ -382,11 +396,12 @@ import { extractFrontmatter, parseXDocsFile, validateMetadata } from '@guiho/xdo
|
|
|
382
396
|
Agent skill and AGENTS.md automation:
|
|
383
397
|
|
|
384
398
|
```ts
|
|
385
|
-
import { installSkill, ensureAgentsInstructions, runAgentAutomation } from '@guiho/xdocs'
|
|
399
|
+
import { installSkill, ensureAgentsInstructions, runAgentAutomation, xdocsSkillVersion } from '@guiho/xdocs'
|
|
386
400
|
|
|
387
401
|
await installSkill('agents', 'local', { cwd: process.cwd() })
|
|
388
402
|
await ensureAgentsInstructions(process.cwd(), true)
|
|
389
403
|
await runAgentAutomation({ cwd: process.cwd(), format: 'text', verbose: false })
|
|
404
|
+
console.log(xdocsSkillVersion)
|
|
390
405
|
```
|
|
391
406
|
|
|
392
407
|
Configuration:
|
|
@@ -401,20 +416,22 @@ The API uses the same configuration discovery and validation as the CLI.
|
|
|
401
416
|
|
|
402
417
|
- `source/guiho-xdocs.ts`: public library export surface.
|
|
403
418
|
- `source/guiho-xdocs-bin.ts`: CLI binary entrypoint.
|
|
419
|
+
- `source/guiho-xdocs-native-bin.ts`: Bun-compiled native binary entrypoint that registers embedded resources before importing the CLI.
|
|
420
|
+
- `source/embedded-resources.ts`: prompt, skill, and package metadata text imports used only for native binary embedding.
|
|
404
421
|
- `source/cli.ts`: argument parsing, command dispatch, config-gated automation, and process-facing error handling.
|
|
405
422
|
- `source/config.ts`: TOML discovery, schema validation, defaulting, default config generation, and agent-settings normalization.
|
|
406
423
|
- `source/discovery.ts`: filesystem scanning and xdocs file matching.
|
|
407
424
|
- `source/metadata.ts`: YAML frontmatter extraction and metadata validation.
|
|
408
425
|
- `source/tree.ts`: tree assembly, integrity checks, and rendering (text, markdown).
|
|
409
|
-
- `source/prompts.ts`: prompt loader (
|
|
426
|
+
- `source/prompts.ts`: prompt loader (reads `prompts/*.md` from disk at runtime relative to `import.meta.url`).
|
|
410
427
|
- `source/help.ts`: help text and version display.
|
|
411
428
|
- `source/flags.ts`: argument/flag parsing utilities.
|
|
412
429
|
- `source/errors.ts`: `XDocsError` with stable exit codes and the `invariant` helper.
|
|
413
430
|
- `source/types.ts`: public and internal TypeScript types.
|
|
414
|
-
- `source/agents.ts`: agent skill installation (standard/claude, local/global), AGENTS.md section management, detection, and config-gated automation. Reads `skills/guiho-
|
|
431
|
+
- `source/agents.ts`: agent skill installation (standard/claude, local/global), legacy skill-name removal, version/content refresh, AGENTS.md section management, detection, and config-gated automation. Reads `skills/guiho-s-xdocs/SKILL.md` from disk at runtime relative to `import.meta.url`.
|
|
415
432
|
- `source/commands/*.ts`: one file per CLI command (`init`, `scan`, `generate`, `prompt`, `merge`, `tree`, `list`, `agents`).
|
|
416
433
|
- `prompts/*.md`: prompt templates embedded at build time.
|
|
417
|
-
- `skills/guiho-
|
|
434
|
+
- `skills/guiho-s-xdocs/SKILL.md`: bundled versioned AI-agent skill installed by `xdocs agents` commands.
|
|
418
435
|
|
|
419
436
|
## Development Workflow
|
|
420
437
|
|
|
@@ -468,13 +485,29 @@ Build the library:
|
|
|
468
485
|
bun run build
|
|
469
486
|
```
|
|
470
487
|
|
|
471
|
-
Compile the standalone binary:
|
|
488
|
+
Compile the host standalone binary:
|
|
472
489
|
|
|
473
490
|
```bash
|
|
474
491
|
bun run binary
|
|
475
492
|
```
|
|
476
493
|
|
|
477
|
-
|
|
494
|
+
Compile the supported release binary matrix:
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
bun run binaries
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Supported release asset matrix:
|
|
501
|
+
|
|
502
|
+
- Linux x64: `xdocs-linux-x64`
|
|
503
|
+
- Linux arm64: `xdocs-linux-arm64`
|
|
504
|
+
- macOS x64: `xdocs-macos-x64`
|
|
505
|
+
- macOS arm64: `xdocs-macos-arm64`
|
|
506
|
+
- Windows x64: `xdocs-windows-x64.exe`
|
|
507
|
+
|
|
508
|
+
Windows arm64 is intentionally not published until Bun's compilation support is reliable enough for this project. Unsupported platforms should use a documented manual path: install Bun and run from source, or download a compatible release asset manually.
|
|
509
|
+
|
|
510
|
+
The package-manager install path downloads a native binary to `bin/xdocs.exe` during `postinstall`, and the `xdocs` bin entry points to that native binary. The native binary entrypoint embeds prompt templates, the `guiho-s-xdocs` skill, and package version metadata before importing the CLI, so installed binaries do not need adjacent prompt or skill files at runtime.
|
|
478
511
|
|
|
479
512
|
## Documentation Requirement Before Publishing
|
|
480
513
|
|
|
@@ -494,10 +527,11 @@ Before publishing a new version:
|
|
|
494
527
|
4. Run `bun run typecheck`.
|
|
495
528
|
5. Run `bun test`.
|
|
496
529
|
6. Run `bun run build`.
|
|
497
|
-
7. Run `bun run binary` when the CLI binary is part of release validation.
|
|
530
|
+
7. Run `bun run binary` and `bun run binaries` when the CLI binary is part of release validation.
|
|
498
531
|
8. Build the Mirror release plan: `bun x @guiho/mirror version plan <target>`.
|
|
499
532
|
9. Commit release-documentation updates before applying the version bump.
|
|
500
533
|
10. Apply the bump with GUIHO Mirror: `bun x @guiho/mirror version apply <target> --yes`.
|
|
534
|
+
11. Confirm the tag workflow uploads native binary assets to the GitHub Release and publishes the npm package.
|
|
501
535
|
|
|
502
536
|
Versioning itself is handled by GUIHO Mirror via `mirror.config.toml`; XDocs never edits version fields directly.
|
|
503
537
|
|
|
@@ -519,9 +553,9 @@ Run `xdocs tree --verbose`. Resolve duplicate `subject` values, orphaned modules
|
|
|
519
553
|
|
|
520
554
|
The standard target is `.agents/skills` (or `~/.agents/skills` for `--global`). The Claude target (`.claude/skills`) is only used with `--tool claude`/`all` or when a `.claude/` directory or `CLAUDE.md` is detected. Use `XDOCS_AGENT_HOME` to redirect the global home in tests.
|
|
521
555
|
|
|
522
|
-
### A normal command modified AGENTS.md or installed a global skill unexpectedly
|
|
556
|
+
### A normal command modified AGENTS.md or installed/refreshed a global skill unexpectedly
|
|
523
557
|
|
|
524
|
-
That is the config-gated automation. Set `[agents].auto_agents_md = false` to stop AGENTS.md edits, and `[agents].auto_skill_install = false` to stop global skill installation.
|
|
558
|
+
That is the config-gated automation. Set `[agents].auto_agents_md = false` to stop AGENTS.md edits, and `[agents].auto_skill_install = false` to stop global skill installation and refresh.
|
|
525
559
|
|
|
526
560
|
### Prompt not found
|
|
527
561
|
|
package/README.md
CHANGED
|
@@ -16,12 +16,28 @@ xdocs runs on **Bun** and **Node >= 20**. It ships as a compiled binary, a thin
|
|
|
16
16
|
|
|
17
17
|
### Installation
|
|
18
18
|
|
|
19
|
+
Direct native binary install (no Node.js or Bun required after installation):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh | sh
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Set `XDOCS_VERSION=0.2.3` (or the full tag `@guiho/xdocs@0.2.3`) before running an installer to pin a specific release instead of installing the latest.
|
|
30
|
+
|
|
31
|
+
Package-manager install (convenient for JavaScript projects; downloads the matching native binary during `postinstall`, then runs the native binary):
|
|
32
|
+
|
|
19
33
|
```bash
|
|
20
34
|
npm install -D @guiho/xdocs
|
|
21
35
|
# or
|
|
22
36
|
bun add -d @guiho/xdocs
|
|
23
37
|
```
|
|
24
38
|
|
|
39
|
+
Native release assets are published for Linux x64/arm64, macOS x64/arm64, and Windows x64. Windows arm64 is not published yet. Package-manager installs require Node.js only during installation for the `postinstall` downloader; running `xdocs` afterwards executes the native binary.
|
|
40
|
+
|
|
25
41
|
### Initializing
|
|
26
42
|
|
|
27
43
|
Set up xdocs in your project:
|
|
@@ -31,10 +47,10 @@ xdocs init
|
|
|
31
47
|
```
|
|
32
48
|
|
|
33
49
|
This creates:
|
|
34
|
-
- `XDOCS.md` -- the
|
|
50
|
+
- `XDOCS.md` -- the single frontmatter-less repository index listing packages/applications
|
|
35
51
|
- `xdocs.config.toml` -- configuration with sensible defaults
|
|
36
52
|
- Updates `AGENTS.md` with instructions for AI agents
|
|
37
|
-
- Installs the `guiho-
|
|
53
|
+
- Installs the `guiho-s-xdocs` agent skill (standard `.agents/skills`)
|
|
38
54
|
|
|
39
55
|
### Typical Workflow
|
|
40
56
|
|
|
@@ -130,7 +146,7 @@ The CLI validates tree integrity: no orphan subjects, no missing parents, no cyc
|
|
|
130
146
|
|
|
131
147
|
#### `xdocs init`
|
|
132
148
|
|
|
133
|
-
Initializes xdocs in a project. Creates the root `XDOCS.md`, the `xdocs.config.toml` configuration, updates `AGENTS.md`, and installs the `guiho-
|
|
149
|
+
Initializes xdocs in a project. Creates the root `XDOCS.md`, the `xdocs.config.toml` configuration, updates `AGENTS.md`, and installs or refreshes the `guiho-s-xdocs` skill to the standard `.agents/skills` location.
|
|
134
150
|
|
|
135
151
|
#### `xdocs scan`
|
|
136
152
|
|
|
@@ -191,7 +207,7 @@ xdocs list ./src/auth
|
|
|
191
207
|
|
|
192
208
|
#### `xdocs agents`
|
|
193
209
|
|
|
194
|
-
Installs the `guiho-
|
|
210
|
+
Installs the `guiho-s-xdocs` agent skill and maintains the `AGENTS.md` section.
|
|
195
211
|
|
|
196
212
|
```bash
|
|
197
213
|
xdocs agents install local # install the skill under the project (.agents/skills)
|
|
@@ -245,7 +261,7 @@ name = "my-project"
|
|
|
245
261
|
[agents]
|
|
246
262
|
# Keep the xdocs section in AGENTS.md fresh on normal commands. Default: true
|
|
247
263
|
auto_agents_md = true
|
|
248
|
-
# Install the standard skill globally
|
|
264
|
+
# Install or refresh the standard skill globally from the bundled copy. Default: true
|
|
249
265
|
auto_skill_install = true
|
|
250
266
|
# Default target for skill auto-install: "agents" (standard) or "claude". Default: "agents"
|
|
251
267
|
skill_tool = "agents"
|
|
@@ -253,14 +269,14 @@ skill_tool = "agents"
|
|
|
253
269
|
|
|
254
270
|
### Agent Skills
|
|
255
271
|
|
|
256
|
-
xdocs ships the `guiho-
|
|
272
|
+
xdocs ships the `guiho-s-xdocs` agent skill that teaches AI tools how to work with xdocs -- when to create, update, or regenerate documentation, how to use the CLI, and how to respect the configured AI behavior mode. The skill is versioned in its frontmatter, large, and loaded on demand; a small section in `AGENTS.md` points the agent at it.
|
|
257
273
|
|
|
258
274
|
Installation is **standard-first**:
|
|
259
275
|
|
|
260
276
|
| Target | Location | When installed |
|
|
261
277
|
| ------------------------- | --------------------------------------------------- | --------------------------------------------------------------- |
|
|
262
|
-
| **agents** (standard) | `.agents/skills/guiho-
|
|
263
|
-
| **claude** (non-standard) | `.claude/skills/guiho-
|
|
278
|
+
| **agents** (standard) | `.agents/skills/guiho-s-xdocs/SKILL.md` | Always (default). Read by OpenCode, Codex, Jules, and any AGENTS.md tool. |
|
|
279
|
+
| **claude** (non-standard) | `.claude/skills/guiho-s-xdocs/SKILL.md` | When `--tool claude` is given, or a `.claude/` dir or `CLAUDE.md` is detected. |
|
|
264
280
|
|
|
265
281
|
```bash
|
|
266
282
|
xdocs agents install local # standard target, under the project
|
|
@@ -268,7 +284,7 @@ xdocs agents install global # standard target, under ~/.agents/skills
|
|
|
268
284
|
xdocs agents instructions # insert/refresh the AGENTS.md section
|
|
269
285
|
```
|
|
270
286
|
|
|
271
|
-
`xdocs init` runs this automatically for the standard target (`local` scope). `local` scope installs under the project; `global` installs under your home directory. The default is always the standard target -- non-standard files are written only when you ask (`--tool`) or when they are already present.
|
|
287
|
+
`xdocs init` runs this automatically for the standard target (`local` scope). `local` scope installs under the project; `global` installs under your home directory. The default is always the standard target -- non-standard files are written only when you ask (`--tool`) or when they are already present. Installation removes legacy `guiho-as-xdocs` skill directories and replaces `guiho-s-xdocs` when the bundled version or content differs.
|
|
272
288
|
|
|
273
289
|
---
|
|
274
290
|
|
package/jsr.json
CHANGED
package/library/agents.d.ts
CHANGED
|
@@ -5,17 +5,21 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Two distinct things live here:
|
|
7
7
|
* 1. The small AGENTS.md section that tells any AI agent that xdocs structured
|
|
8
|
-
* documentation exists and that it should load the guiho-
|
|
9
|
-
* 2. The large guiho-
|
|
8
|
+
* documentation exists and that it should load the guiho-s-xdocs skill.
|
|
9
|
+
* 2. The large guiho-s-xdocs skill file, installed (local or global) into the
|
|
10
10
|
* skills directory of one or more AI tools.
|
|
11
11
|
*/
|
|
12
12
|
import type { XDocsAgentAutomationResult, XDocsAgentSettings, XDocsAgentTool, XDocsAgentsInstructionsResult, XDocsCliOptions, XDocsSkillInstallResult, XDocsSkillScope } from './types.js';
|
|
13
13
|
/** Canonical name of the xdocs agent skill. */
|
|
14
|
-
export declare const xdocsSkillName = "guiho-
|
|
15
|
-
/**
|
|
14
|
+
export declare const xdocsSkillName = "guiho-s-xdocs";
|
|
15
|
+
/** Previous skill names that should be removed during install/refresh. */
|
|
16
|
+
export declare const legacyXdocsSkillNames: readonly string[];
|
|
17
|
+
/** Raw contents of the bundled guiho-s-xdocs/SKILL.md, read from disk at
|
|
16
18
|
* runtime (relative to this module) so the compiled library works under both
|
|
17
19
|
* Node and Bun. The file ships with the package in `skills/`. */
|
|
18
20
|
export declare const xdocsSkillContent: string;
|
|
21
|
+
/** Version declared by the bundled skill frontmatter. */
|
|
22
|
+
export declare const xdocsSkillVersion: string | undefined;
|
|
19
23
|
/** All AI tools the skill can be installed for. `agents` is the standard. */
|
|
20
24
|
export declare const xdocsAgentTools: readonly XDocsAgentTool[];
|
|
21
25
|
/** The standard, always-default skill target (AGENTS.md + .agents/skills). */
|
|
@@ -34,7 +38,7 @@ export declare const detectAgentTools: (cwd: string) => XDocsAgentTool[];
|
|
|
34
38
|
*/
|
|
35
39
|
export declare const resolveInstallTools: (cwd: string, toolFlag: string | undefined) => XDocsAgentTool[];
|
|
36
40
|
/** The small AGENTS.md section announcing xdocs and pointing to the skill. */
|
|
37
|
-
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-
|
|
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 -->";
|
|
38
42
|
type SkillPathOptions = {
|
|
39
43
|
cwd?: string;
|
|
40
44
|
homeDirectory?: string;
|
|
@@ -68,9 +72,11 @@ export declare const resolveAgentSettings: (options: XDocsCliOptions) => Promise
|
|
|
68
72
|
/**
|
|
69
73
|
* Config-gated automation run by normal commands. Does nothing outside an xdocs
|
|
70
74
|
* project (no config discovered). When enabled, it keeps the AGENTS.md section
|
|
71
|
-
* fresh (only if AGENTS.md already exists) and
|
|
72
|
-
* configured tool
|
|
75
|
+
* fresh (only if AGENTS.md already exists) and refreshes the global skill for
|
|
76
|
+
* the configured tool from the bundled package copy.
|
|
73
77
|
*/
|
|
74
78
|
export declare const runAgentAutomation: (options: AgentAutomationOptions, notify?: (message: string) => void) => Promise<XDocsAgentAutomationResult>;
|
|
79
|
+
/** Read a skill version from SKILL.md YAML frontmatter. */
|
|
80
|
+
export declare function readSkillVersion(content: string): string | undefined;
|
|
75
81
|
export {};
|
|
76
82
|
//# sourceMappingURL=agents.d.ts.map
|
package/library/agents.d.ts.map
CHANGED
|
@@ -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,
|
|
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,EAAu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,OAAO,CAAC,uBAAuB,CA6BjC,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,aAAa,GACxB,OAAO,SAAS,cAAc,EAAE,EAChC,OAAO,eAAe,EACtB,UAAS,mBAAwB,KAChC,OAAO,CAAC,uBAAuB,EAAE,CAInC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAU,KAAK,MAAM,EAAE,gBAAc,KAAG,OAAO,CAAC,6BAA6B,CAkBjH,CAAA;AA4BD,sDAAsD;AACtD,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAWrD,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,GAAU,SAAS,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAI/F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,sBAAsB,EAC/B,SAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,IAAe,KAC3C,OAAO,CAAC,0BAA0B,CAmBpC,CAAA;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE"}
|
package/library/agents.js
CHANGED
|
@@ -5,29 +5,36 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Two distinct things live here:
|
|
7
7
|
* 1. The small AGENTS.md section that tells any AI agent that xdocs structured
|
|
8
|
-
* documentation exists and that it should load the guiho-
|
|
9
|
-
* 2. The large guiho-
|
|
8
|
+
* documentation exists and that it should load the guiho-s-xdocs skill.
|
|
9
|
+
* 2. The large guiho-s-xdocs skill file, installed (local or global) into the
|
|
10
10
|
* skills directory of one or more AI tools.
|
|
11
11
|
*/
|
|
12
12
|
import { existsSync, readFileSync } from 'node:fs';
|
|
13
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
13
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
16
16
|
import { discoverConfig, normalizeAgentSettings } from './config.js';
|
|
17
17
|
import { XDocsError } from './errors.js';
|
|
18
18
|
/** Canonical name of the xdocs agent skill. */
|
|
19
|
-
export const xdocsSkillName = 'guiho-
|
|
20
|
-
/**
|
|
19
|
+
export const xdocsSkillName = 'guiho-s-xdocs';
|
|
20
|
+
/** Previous skill names that should be removed during install/refresh. */
|
|
21
|
+
export const legacyXdocsSkillNames = ['guiho-as-xdocs'];
|
|
22
|
+
/** Raw contents of the bundled guiho-s-xdocs/SKILL.md, read from disk at
|
|
21
23
|
* runtime (relative to this module) so the compiled library works under both
|
|
22
24
|
* Node and Bun. The file ships with the package in `skills/`. */
|
|
23
25
|
export const xdocsSkillContent = (() => {
|
|
26
|
+
const embedded = globalThis.__XDOCS_EMBEDDED_RESOURCES__?.skill;
|
|
27
|
+
if (embedded)
|
|
28
|
+
return embedded;
|
|
24
29
|
try {
|
|
25
|
-
return readFileSync(new URL('../skills/guiho-
|
|
30
|
+
return readFileSync(new URL('../skills/guiho-s-xdocs/SKILL.md', import.meta.url), 'utf8');
|
|
26
31
|
}
|
|
27
32
|
catch {
|
|
28
33
|
return '';
|
|
29
34
|
}
|
|
30
35
|
})();
|
|
36
|
+
/** Version declared by the bundled skill frontmatter. */
|
|
37
|
+
export const xdocsSkillVersion = readSkillVersion(xdocsSkillContent);
|
|
31
38
|
/** All AI tools the skill can be installed for. `agents` is the standard. */
|
|
32
39
|
export const xdocsAgentTools = ['agents', 'claude'];
|
|
33
40
|
/** The standard, always-default skill target (AGENTS.md + .agents/skills). */
|
|
@@ -62,7 +69,7 @@ export const resolveInstallTools = (cwd, toolFlag) => toolFlag ? parseAgentTools
|
|
|
62
69
|
/**
|
|
63
70
|
* Skill directory for each tool, relative to the scope root (project root for
|
|
64
71
|
* `local`, home directory for `global`). The skill is written to
|
|
65
|
-
* `<root>/<dir>/guiho-
|
|
72
|
+
* `<root>/<dir>/guiho-s-xdocs/SKILL.md`.
|
|
66
73
|
*
|
|
67
74
|
* `agents` is the cross-tool standard (OpenCode, Codex, Jules, and any AGENTS.md
|
|
68
75
|
* tool read it). `claude` is the non-standard Claude Code location.
|
|
@@ -96,9 +103,10 @@ Use the xdocs CLI for operations: \`xdocs scan\`, \`xdocs tree\`, \`xdocs genera
|
|
|
96
103
|
\`xdocs list\`, \`xdocs merge\`.
|
|
97
104
|
${AGENTS_END_MARKER}`;
|
|
98
105
|
/** Resolve the on-disk path of the skill file for a tool and scope. */
|
|
99
|
-
export const resolveSkillPath = (tool, scope, options = {}) =>
|
|
106
|
+
export const resolveSkillPath = (tool, scope, options = {}) => resolveNamedSkillPath(tool, scope, xdocsSkillName, options);
|
|
107
|
+
const resolveNamedSkillPath = (tool, scope, skillName, options = {}) => {
|
|
100
108
|
const root = scope === 'local' ? resolve(options.cwd ?? process.cwd()) : resolveAgentHome(options.homeDirectory);
|
|
101
|
-
return resolve(root, skillDirectories[tool],
|
|
109
|
+
return resolve(root, skillDirectories[tool], skillName, 'SKILL.md');
|
|
102
110
|
};
|
|
103
111
|
/** Whether the skill is already installed for a tool and scope. */
|
|
104
112
|
export const isSkillInstalled = (tool, scope, options = {}) => existsSync(resolveSkillPath(tool, scope, options));
|
|
@@ -106,14 +114,28 @@ export const isSkillInstalled = (tool, scope, options = {}) => existsSync(resolv
|
|
|
106
114
|
export const installSkill = async (tool, scope, options = {}) => {
|
|
107
115
|
const path = resolveSkillPath(tool, scope, options);
|
|
108
116
|
const exists = existsSync(path);
|
|
109
|
-
if (exists && options.overwrite === false)
|
|
110
|
-
return { tool, scope, path, installed: false, updated: false };
|
|
111
117
|
const current = exists ? await readFile(path, 'utf8') : undefined;
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
const previousVersion = current ? readSkillVersion(current) : undefined;
|
|
119
|
+
const bundledVersion = xdocsSkillVersion;
|
|
120
|
+
if (exists && options.overwrite === false) {
|
|
121
|
+
return { tool, scope, path, installed: false, updated: false, removedLegacyPaths: [], previousVersion, bundledVersion };
|
|
122
|
+
}
|
|
123
|
+
const removedLegacyPaths = [];
|
|
124
|
+
for (const legacyName of legacyXdocsSkillNames) {
|
|
125
|
+
const legacyPath = resolveNamedSkillPath(tool, scope, legacyName, options);
|
|
126
|
+
if (!existsSync(legacyPath))
|
|
127
|
+
continue;
|
|
128
|
+
await rm(dirname(legacyPath), { recursive: true, force: true });
|
|
129
|
+
removedLegacyPaths.push(legacyPath);
|
|
130
|
+
}
|
|
131
|
+
if (current === xdocsSkillContent) {
|
|
132
|
+
return { tool, scope, path, installed: false, updated: false, removedLegacyPaths, previousVersion, bundledVersion };
|
|
133
|
+
}
|
|
134
|
+
if (exists)
|
|
135
|
+
await rm(dirname(path), { recursive: true, force: true });
|
|
114
136
|
await mkdir(dirname(path), { recursive: true });
|
|
115
137
|
await writeFile(path, xdocsSkillContent, 'utf8');
|
|
116
|
-
return { tool, scope, path, installed: !exists, updated: exists };
|
|
138
|
+
return { tool, scope, path, installed: !exists, updated: exists, removedLegacyPaths, previousVersion, bundledVersion };
|
|
117
139
|
};
|
|
118
140
|
/** Install the skill for several tools at once. */
|
|
119
141
|
export const installSkills = async (tools, scope, options = {}) => {
|
|
@@ -188,8 +210,8 @@ export const resolveAgentSettings = async (options) => {
|
|
|
188
210
|
/**
|
|
189
211
|
* Config-gated automation run by normal commands. Does nothing outside an xdocs
|
|
190
212
|
* project (no config discovered). When enabled, it keeps the AGENTS.md section
|
|
191
|
-
* fresh (only if AGENTS.md already exists) and
|
|
192
|
-
* configured tool
|
|
213
|
+
* fresh (only if AGENTS.md already exists) and refreshes the global skill for
|
|
214
|
+
* the configured tool from the bundled package copy.
|
|
193
215
|
*/
|
|
194
216
|
export const runAgentAutomation = async (options, notify = () => { }) => {
|
|
195
217
|
const cwd = resolve(options.cwd);
|
|
@@ -200,13 +222,39 @@ export const runAgentAutomation = async (options, notify = () => { }) => {
|
|
|
200
222
|
const result = { settings };
|
|
201
223
|
if (settings.autoAgentsMd)
|
|
202
224
|
result.agentsMd = await ensureAgentsInstructions(cwd, false);
|
|
203
|
-
if (settings.autoSkillInstall
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
if (settings.autoSkillInstall) {
|
|
226
|
+
const globalSkill = await installSkill(settings.skillTool, 'global', { cwd, homeDirectory: options.homeDirectory });
|
|
227
|
+
const changed = globalSkill.installed || globalSkill.updated || globalSkill.removedLegacyPaths.length > 0;
|
|
228
|
+
if (changed)
|
|
229
|
+
notify(`notice: ${xdocsSkillName} skill refreshed globally at ${globalSkill.path}`);
|
|
230
|
+
result.globalSkill = globalSkill;
|
|
207
231
|
}
|
|
208
232
|
return result;
|
|
209
233
|
};
|
|
234
|
+
/** Read a skill version from SKILL.md YAML frontmatter. */
|
|
235
|
+
export function readSkillVersion(content) {
|
|
236
|
+
return readSkillFrontmatterValue(content, 'version');
|
|
237
|
+
}
|
|
238
|
+
function readSkillFrontmatterValue(content, key) {
|
|
239
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
240
|
+
if (!match)
|
|
241
|
+
return undefined;
|
|
242
|
+
const frontmatter = match[1];
|
|
243
|
+
if (frontmatter === undefined)
|
|
244
|
+
return undefined;
|
|
245
|
+
for (const line of frontmatter.split(/\r?\n/)) {
|
|
246
|
+
const separator = line.indexOf(':');
|
|
247
|
+
if (separator === -1)
|
|
248
|
+
continue;
|
|
249
|
+
if (line.slice(0, separator).trim() !== key)
|
|
250
|
+
continue;
|
|
251
|
+
const value = line.slice(separator + 1).trim();
|
|
252
|
+
if (!value)
|
|
253
|
+
return undefined;
|
|
254
|
+
return value.replace(/^['"]|['"]$/g, '');
|
|
255
|
+
}
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
210
258
|
const resolveAgentHome = (homeDirectory) => {
|
|
211
259
|
const value = homeDirectory ?? process.env['XDOCS_AGENT_HOME'] ?? homedir();
|
|
212
260
|
return isAbsolute(value) ? value : resolve(process.cwd(), value);
|
|
@@ -22,7 +22,7 @@ export const runAgents = async (options, parsed) => {
|
|
|
22
22
|
throw new XDocsError(`Missing agents subcommand.\n\n${USAGE}`);
|
|
23
23
|
throw new XDocsError(`Unknown agents subcommand: "${sub}"\n\n${USAGE}`);
|
|
24
24
|
};
|
|
25
|
-
/** Install the guiho-
|
|
25
|
+
/** Install the guiho-s-xdocs skill for one or more tools. */
|
|
26
26
|
const runInstall = async (options, parsed) => {
|
|
27
27
|
const scope = parseScope(parsed.positionals[1]);
|
|
28
28
|
const tools = resolveInstallTools(options.cwd, stringFlag(parsed.flags, 'tool'));
|
|
@@ -60,5 +60,8 @@ const formatInstall = (result) => [
|
|
|
60
60
|
`path: ${result.path}`,
|
|
61
61
|
`installed: ${result.installed}`,
|
|
62
62
|
`updated: ${result.updated}`,
|
|
63
|
+
`bundled_version: ${result.bundledVersion ?? ''}`,
|
|
64
|
+
`previous_version: ${result.previousVersion ?? ''}`,
|
|
65
|
+
`removed_legacy: ${result.removedLegacyPaths.join(', ')}`,
|
|
63
66
|
'',
|
|
64
67
|
].join('\n');
|
package/library/commands/init.js
CHANGED
|
@@ -46,7 +46,7 @@ export const runInit = async (options, parsed) => {
|
|
|
46
46
|
await writeFile(xdocsPath, createRootXDocsContent(basename(cwd)), 'utf8');
|
|
47
47
|
process.stdout.write(`created: XDOCS.md\n`);
|
|
48
48
|
}
|
|
49
|
-
// 3. Update AGENTS.md (announce xdocs + point AI at the guiho-
|
|
49
|
+
// 3. Update AGENTS.md (announce xdocs + point AI at the guiho-s-xdocs skill)
|
|
50
50
|
const agentsExisted = findAgentsFile(cwd) !== undefined;
|
|
51
51
|
const agentsResult = await ensureAgentsInstructions(cwd, true);
|
|
52
52
|
if (!agentsExisted) {
|
|
@@ -58,7 +58,7 @@ export const runInit = async (options, parsed) => {
|
|
|
58
58
|
else {
|
|
59
59
|
process.stdout.write(`exists: AGENTS.md (xdocs section already present)\n`);
|
|
60
60
|
}
|
|
61
|
-
// 4. Install the guiho-
|
|
61
|
+
// 4. Install the guiho-s-xdocs agent skill (standard by default; non-standard
|
|
62
62
|
// tools only when explicitly requested via --tool or detected in the project)
|
|
63
63
|
const scope = booleanFlag(parsed.flags, 'global') ? 'global' : 'local';
|
|
64
64
|
const tools = resolveInstallTools(cwd, stringFlag(parsed.flags, 'tool'));
|
|
@@ -68,7 +68,7 @@ export const runInit = async (options, parsed) => {
|
|
|
68
68
|
if (result.installed) {
|
|
69
69
|
process.stdout.write(`installed: ${xdocsSkillName} skill (${tool}, ${scope}) -> ${where}\n`);
|
|
70
70
|
}
|
|
71
|
-
else if (result.updated) {
|
|
71
|
+
else if (result.updated || result.removedLegacyPaths.length > 0) {
|
|
72
72
|
process.stdout.write(`updated: ${xdocsSkillName} skill (${tool}, ${scope})\n`);
|
|
73
73
|
}
|
|
74
74
|
else {
|
package/library/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAA+B,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAU/H,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,EAAE,kBAIpC,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,GAAI,KAAK,cAAc,CAAC,QAAQ,CAAC,KAAG,kBAgBtE,CAAA;AAQD,2CAA2C;AAC3C,eAAO,MAAM,cAAc,GAAU,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,cAAc,CAAA;CAAE,CAaxH,CAAA;AAED,kDAAkD;AAClD,eAAO,MAAM,UAAU,GAAU,SAAS,eAAe,KAAG,OAAO,CAAC,WAAW,CAS9E,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,GAAU,SAAS,eAAe,KAAG,OAAO,CAAC,WAAW,CAOxF,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,eAAe,GAAI,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,aAAa,MAAM,KAAG,WA8BvF,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,WAQ1C,CAAA;AAEF,sDAAsD;AACtD,eAAO,MAAM,0BAA0B,GAAI,KAAK,MAAM,KAAG,MAsBxD,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,EAAE,mBAAiB,KAAG,OAAO,CAAC,MAAM,CASvF,CAAA;AAuBD,sDAAsD;AACtD,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,WACP,CAAA"}
|
package/library/config.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
6
6
|
import { basename, isAbsolute, resolve } from 'node:path';
|
|
7
|
-
import { parse as parseToml } from 'smol-toml';
|
|
8
7
|
import { XDocsError } from './errors.js';
|
|
9
8
|
const DEFAULT_EXTENSIONS = ['.docs.md', '.xdocs.md'];
|
|
10
9
|
const DEFAULT_EXCLUDE = ['node_modules', '.git', 'dist', 'build', 'library', 'bin', 'bundle'];
|
|
@@ -148,7 +147,7 @@ const readConfigFile = async (path) => {
|
|
|
148
147
|
const content = await readFile(path, 'utf8');
|
|
149
148
|
let parsed;
|
|
150
149
|
try {
|
|
151
|
-
parsed =
|
|
150
|
+
parsed = Bun.TOML.parse(content);
|
|
152
151
|
}
|
|
153
152
|
catch (error) {
|
|
154
153
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Embedded resources used only by Bun-compiled native binaries. The Node-safe
|
|
5
|
+
* library build reads these files from disk instead.
|
|
6
|
+
*/
|
|
7
|
+
export type XDocsEmbeddedResources = {
|
|
8
|
+
prompts: Record<string, string>;
|
|
9
|
+
skill: string;
|
|
10
|
+
version: string;
|
|
11
|
+
};
|
|
12
|
+
declare global {
|
|
13
|
+
var __XDOCS_EMBEDDED_RESOURCES__: XDocsEmbeddedResources | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Register prompt/skill/package resources for a native compiled binary. */
|
|
16
|
+
export declare const registerEmbeddedResources: () => void;
|
|
17
|
+
//# sourceMappingURL=embedded-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-resources.d.ts","sourceRoot":"","sources":["../source/embedded-resources.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,4BAA4B,EAAE,sBAAsB,GAAG,SAAS,CAAA;CACrE;AAED,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,QAAO,IAW5C,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Embedded resources used only by Bun-compiled native binaries. The Node-safe
|
|
5
|
+
* library build reads these files from disk instead.
|
|
6
|
+
*/
|
|
7
|
+
// @ts-expect-error -- Bun text import for native binary embedding.
|
|
8
|
+
import writePrompt from '../prompts/write.md' with { type: 'text' };
|
|
9
|
+
// @ts-expect-error -- Bun text import for native binary embedding.
|
|
10
|
+
import updatePrompt from '../prompts/update.md' with { type: 'text' };
|
|
11
|
+
// @ts-expect-error -- Bun text import for native binary embedding.
|
|
12
|
+
import agentsPrompt from '../prompts/agents.md' with { type: 'text' };
|
|
13
|
+
// @ts-expect-error -- Bun text import for native binary embedding.
|
|
14
|
+
import generatePrompt from '../prompts/generate.md' with { type: 'text' };
|
|
15
|
+
// @ts-expect-error -- Bun text import for native binary embedding.
|
|
16
|
+
import xdocsSkill from '../skills/guiho-s-xdocs/SKILL.md' with { type: 'text' };
|
|
17
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
18
|
+
/** Register prompt/skill/package resources for a native compiled binary. */
|
|
19
|
+
export const registerEmbeddedResources = () => {
|
|
20
|
+
globalThis.__XDOCS_EMBEDDED_RESOURCES__ = {
|
|
21
|
+
prompts: {
|
|
22
|
+
write: writePrompt,
|
|
23
|
+
update: updatePrompt,
|
|
24
|
+
agents: agentsPrompt,
|
|
25
|
+
generate: generatePrompt,
|
|
26
|
+
},
|
|
27
|
+
skill: xdocsSkill,
|
|
28
|
+
version: typeof packageJson.version === 'string' ? packageJson.version : '0.0.0',
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guiho-xdocs-native-bin.d.ts","sourceRoot":"","sources":["../source/guiho-xdocs-native-bin.ts"],"names":[],"mappings":";AACA;;GAEG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import { registerEmbeddedResources } from './embedded-resources.js';
|
|
6
|
+
registerEmbeddedResources();
|
|
7
|
+
const { runCliWithErrorHandling } = await import('./cli.js');
|
|
8
|
+
await runCliWithErrorHandling();
|
package/library/guiho-xdocs.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export { extractFrontmatter, parseXDocsFile, validateMetadata } from './metadata
|
|
|
10
10
|
export { buildTree, renderTree, renderTreeMarkdown, validateTree } from './tree.js';
|
|
11
11
|
export { readPackageVersion, showCommandHelp, showHelp, showVersion } from './help.js';
|
|
12
12
|
export { getPrompt, getPromptNames, prompts } from './prompts.js';
|
|
13
|
-
export { detectAgentTools, ensureAgentsInstructions, findAgentsFile, installSkill, installSkills, isSkillInstalled, parseAgentTools, resolveAgentSettings, resolveInstallTools, resolveSkillPath, runAgentAutomation, standardAgentTool, xdocsAgentsSection, xdocsAgentTools, xdocsSkillContent, xdocsSkillName, } from './agents.js';
|
|
13
|
+
export { detectAgentTools, ensureAgentsInstructions, findAgentsFile, installSkill, installSkills, isSkillInstalled, legacyXdocsSkillNames, parseAgentTools, readSkillVersion, resolveAgentSettings, resolveInstallTools, resolveSkillPath, runAgentAutomation, standardAgentTool, xdocsAgentsSection, xdocsAgentTools, xdocsSkillContent, xdocsSkillName, xdocsSkillVersion, } from './agents.js';
|
|
14
14
|
export { runCli, runCliWithErrorHandling } from './cli.js';
|
|
15
15
|
//# sourceMappingURL=guiho-xdocs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guiho-xdocs.d.ts","sourceRoot":"","sources":["../source/guiho-xdocs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGnD,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,SAAS,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EACf,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGzE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGpF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGnF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGtF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGjE,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA"}
|
package/library/guiho-xdocs.js
CHANGED
|
@@ -18,6 +18,6 @@ export { readPackageVersion, showCommandHelp, showHelp, showVersion } from './he
|
|
|
18
18
|
// Prompts
|
|
19
19
|
export { getPrompt, getPromptNames, prompts } from './prompts.js';
|
|
20
20
|
// Agents
|
|
21
|
-
export { detectAgentTools, ensureAgentsInstructions, findAgentsFile, installSkill, installSkills, isSkillInstalled, parseAgentTools, resolveAgentSettings, resolveInstallTools, resolveSkillPath, runAgentAutomation, standardAgentTool, xdocsAgentsSection, xdocsAgentTools, xdocsSkillContent, xdocsSkillName, } from './agents.js';
|
|
21
|
+
export { detectAgentTools, ensureAgentsInstructions, findAgentsFile, installSkill, installSkills, isSkillInstalled, legacyXdocsSkillNames, parseAgentTools, readSkillVersion, resolveAgentSettings, resolveInstallTools, resolveSkillPath, runAgentAutomation, standardAgentTool, xdocsAgentsSection, xdocsAgentTools, xdocsSkillContent, xdocsSkillName, xdocsSkillVersion, } from './agents.js';
|
|
22
22
|
// CLI
|
|
23
23
|
export { runCli, runCliWithErrorHandling } from './cli.js';
|
package/library/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../source/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,QAAO,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../source/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,QAAO,MAWrC,CAAA;AAED,qCAAqC;AACrC,eAAO,MAAM,WAAW,QAAO,MAAyC,CAAA;AAExE,+BAA+B;AAC/B,eAAO,MAAM,QAAQ,QAAO,MAgCpB,CAAA;AAER,wCAAwC;AACxC,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,MAIjD,CAAA"}
|
package/library/help.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import { readFileSync } from 'node:fs';
|
|
5
5
|
/** Read the package version from package.json. */
|
|
6
6
|
export const readPackageVersion = () => {
|
|
7
|
+
const embedded = globalThis.__XDOCS_EMBEDDED_RESOURCES__?.version;
|
|
8
|
+
if (embedded)
|
|
9
|
+
return embedded;
|
|
7
10
|
try {
|
|
8
11
|
const raw = readFileSync(new URL('../package.json', import.meta.url), 'utf8');
|
|
9
12
|
const pkg = JSON.parse(raw);
|
|
@@ -29,7 +32,7 @@ Commands:
|
|
|
29
32
|
merge [path] Merge xdocs files from a directory into one file
|
|
30
33
|
tree Display the project hierarchy tree
|
|
31
34
|
list [path] List files with descriptions
|
|
32
|
-
agents Install the guiho-
|
|
35
|
+
agents Install the guiho-s-xdocs skill and AGENTS.md instructions
|
|
33
36
|
|
|
34
37
|
Global Flags:
|
|
35
38
|
-h, --help Show help for a command
|
|
@@ -66,7 +69,7 @@ Creates:
|
|
|
66
69
|
- XDOCS.md Root documentation file
|
|
67
70
|
- xdocs.config.toml Configuration with defaults
|
|
68
71
|
- Updates AGENTS.md Adds the xdocs section pointing AI at the skill
|
|
69
|
-
- Installs the skill guiho-
|
|
72
|
+
- Installs the skill guiho-s-xdocs into .agents/skills (standard, local)
|
|
70
73
|
|
|
71
74
|
By default the skill is installed for the standard target (AGENTS.md +
|
|
72
75
|
.agents/skills). The non-standard claude target (.claude/skills) is added only
|
|
@@ -172,7 +175,7 @@ Flags:
|
|
|
172
175
|
--verbose Show detailed output
|
|
173
176
|
`.trim(),
|
|
174
177
|
agents: `
|
|
175
|
-
xdocs agents - Install the guiho-
|
|
178
|
+
xdocs agents - Install the guiho-s-xdocs skill and AGENTS.md instructions
|
|
176
179
|
|
|
177
180
|
Usage:
|
|
178
181
|
xdocs agents install <local|global> [--tool <tool>]
|
|
@@ -184,8 +187,8 @@ Subcommands:
|
|
|
184
187
|
instructions Insert or refresh the xdocs section in AGENTS.md
|
|
185
188
|
|
|
186
189
|
Skill locations:
|
|
187
|
-
agents (standard) <root>/.agents/skills/guiho-
|
|
188
|
-
claude (non-standard) <root>/.claude/skills/guiho-
|
|
190
|
+
agents (standard) <root>/.agents/skills/guiho-s-xdocs/SKILL.md
|
|
191
|
+
claude (non-standard) <root>/.claude/skills/guiho-s-xdocs/SKILL.md
|
|
189
192
|
|
|
190
193
|
<root> is the project for local scope, or the user home directory for global.
|
|
191
194
|
Without --tool, the standard agents target is installed, plus claude when a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../source/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../source/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1D,8DAA8D;AAC9D,eAAO,MAAM,cAAc,GAAU,UAAU,MAAM,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,SAAS,CAqCrF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG;IAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAiB9F,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,KAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CA4D9J,CAAA"}
|
package/library/metadata.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { dirname, relative } from 'node:path';
|
|
6
|
-
import { parse as parseYaml } from 'yaml';
|
|
7
6
|
/** Parse an xdocs file from disk into an XDocsFile object. */
|
|
8
7
|
export const parseXDocsFile = async (filePath, cwd) => {
|
|
9
8
|
const content = await readFile(filePath, 'utf8');
|
|
@@ -13,7 +12,7 @@ export const parseXDocsFile = async (filePath, cwd) => {
|
|
|
13
12
|
if (frontmatter) {
|
|
14
13
|
let parsed;
|
|
15
14
|
try {
|
|
16
|
-
parsed =
|
|
15
|
+
parsed = Bun.YAML.parse(frontmatter);
|
|
17
16
|
}
|
|
18
17
|
catch (error) {
|
|
19
18
|
const message = error instanceof Error ? error.message : String(error);
|
package/library/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../source/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../source/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAsC7C,4CAA4C;AAC5C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAWjD,CAAA;AAEJ,gDAAgD;AAChD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,WAAW,GAAG,SACpC,CAAA;AAEnB,4BAA4B;AAC5B,eAAO,MAAM,cAAc,QAAO,MAAM,EACnB,CAAA"}
|
package/library/prompts.js
CHANGED
|
@@ -12,6 +12,9 @@ import { extractFrontmatter } from './metadata.js';
|
|
|
12
12
|
const PROMPT_NAMES = ['write', 'update', 'agents', 'generate'];
|
|
13
13
|
/** Read a prompt file's raw contents, or undefined when it cannot be read. */
|
|
14
14
|
const readPromptFile = (name) => {
|
|
15
|
+
const embedded = globalThis.__XDOCS_EMBEDDED_RESOURCES__?.prompts[name];
|
|
16
|
+
if (embedded)
|
|
17
|
+
return embedded;
|
|
15
18
|
try {
|
|
16
19
|
return readFileSync(new URL(`../prompts/${name}.md`, import.meta.url), 'utf8');
|
|
17
20
|
}
|
package/library/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type XDocsFormat = 'text' | 'json' | 'markdown';
|
|
|
7
7
|
export type XDocsAiMode = 'prompt' | 'auto';
|
|
8
8
|
/** Command names recognized by the CLI. */
|
|
9
9
|
export type XDocsCommand = 'init' | 'scan' | 'generate' | 'prompt' | 'merge' | 'tree' | 'list' | 'agents';
|
|
10
|
-
/** AI tools the guiho-
|
|
10
|
+
/** AI tools the guiho-s-xdocs skill can be installed for.
|
|
11
11
|
*
|
|
12
12
|
* `agents` is the standard target (AGENTS.md + .agents/skills) and the default.
|
|
13
13
|
* `claude` is a non-standard target (.claude/skills) used only when explicitly
|
|
@@ -125,13 +125,16 @@ export type XDocsPrompt = {
|
|
|
125
125
|
description: string;
|
|
126
126
|
body: string;
|
|
127
127
|
};
|
|
128
|
-
/** Result of installing the guiho-
|
|
128
|
+
/** Result of installing the guiho-s-xdocs skill for one tool/scope. */
|
|
129
129
|
export type XDocsSkillInstallResult = {
|
|
130
130
|
tool: XDocsAgentTool;
|
|
131
131
|
scope: XDocsSkillScope;
|
|
132
132
|
path: string;
|
|
133
133
|
installed: boolean;
|
|
134
134
|
updated: boolean;
|
|
135
|
+
removedLegacyPaths: string[];
|
|
136
|
+
previousVersion?: string;
|
|
137
|
+
bundledVersion?: string;
|
|
135
138
|
};
|
|
136
139
|
/** Result of ensuring the xdocs section exists in AGENTS.md. */
|
|
137
140
|
export type XDocsAgentsInstructionsResult = {
|
package/library/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../source/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEtD,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE3C,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAA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0B,GAAG;IACvC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,QAAQ,CAAC,EAAE,6BAA6B,CAAA;IACxC,WAAW,CAAC,EAAE,uBAAuB,CAAA;CACtC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiho/xdocs",
|
|
3
3
|
"description": "Structured documentation system for codebases. Helps AI make sense of projects.",
|
|
4
|
-
"version": "0.2
|
|
4
|
+
"version": "0.3.0-alpha.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./library/guiho-xdocs.js",
|
|
7
7
|
"types": "./library/guiho-xdocs.d.ts",
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"xdocs": "./
|
|
15
|
+
"xdocs": "./bin/xdocs.exe"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"README.md",
|
|
19
19
|
"library/",
|
|
20
20
|
"prompts/",
|
|
21
|
+
"scripts/",
|
|
21
22
|
"skills/",
|
|
22
23
|
"docs/",
|
|
23
24
|
"jsr.json",
|
|
@@ -45,8 +46,10 @@
|
|
|
45
46
|
"scripts": {
|
|
46
47
|
"dev": "bun run --watch source/guiho-xdocs-bin.ts",
|
|
47
48
|
"build": "rm -rf library && tsc -p tsconfig.build.json",
|
|
48
|
-
"binary": "bun build source/guiho-xdocs-bin.ts --compile --outfile bin/xdocs",
|
|
49
|
+
"binary": "bun build source/guiho-xdocs-native-bin.ts --compile --outfile bin/xdocs",
|
|
50
|
+
"binaries": "bun run devops/build-binaries.ts",
|
|
49
51
|
"bundle": "rm -rf bundle && bun build source/guiho-xdocs-bin.ts --outdir bundle --target node --sourcemap=linked",
|
|
52
|
+
"postinstall": "node ./scripts/install-native.cjs",
|
|
50
53
|
"typecheck": "tsc -p . --noEmit",
|
|
51
54
|
"clean": "rm -rf .temp",
|
|
52
55
|
"clean-build": "rm -rf build library bundle bin",
|
|
@@ -67,10 +70,7 @@
|
|
|
67
70
|
"bugs": {
|
|
68
71
|
"url": "https://github.com/CGuiho/xdocs/issues"
|
|
69
72
|
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"smol-toml": "^1.6.1",
|
|
72
|
-
"yaml": "^2.9.0"
|
|
73
|
-
},
|
|
73
|
+
"dependencies": {},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@guiho/mirror": "^3.1.2",
|
|
76
76
|
"@types/bun": "1.3.14",
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
subject: xdocs-scripts
|
|
3
|
+
description: Package-manager installation scripts for installing the native xdocs binary.
|
|
4
|
+
parent: xdocs-package
|
|
5
|
+
children: []
|
|
6
|
+
files:
|
|
7
|
+
install-native.cjs: npm postinstall helper that downloads the matching GitHub Release native binary into bin/xdocs.exe.
|
|
8
|
+
tags:
|
|
9
|
+
- install
|
|
10
|
+
- native-binary
|
|
11
|
+
- package-manager
|
|
12
|
+
flags: []
|
|
13
|
+
status: stable
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
The `scripts/` directory contains package-manager lifecycle helpers. These
|
|
17
|
+
scripts are used during install only; the resulting `xdocs` command executes the
|
|
18
|
+
downloaded native binary directly and does not require Node.js at runtime.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: guiho-
|
|
2
|
+
name: guiho-s-xdocs
|
|
3
|
+
version: 0.3.0-alpha.2
|
|
3
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.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -178,11 +179,11 @@ name = "my-project"
|
|
|
178
179
|
|
|
179
180
|
[agents]
|
|
180
181
|
auto_agents_md = true # keep the xdocs section in AGENTS.md up to date on normal commands
|
|
181
|
-
auto_skill_install = true # install the guiho-
|
|
182
|
+
auto_skill_install = true # install or refresh the guiho-s-xdocs skill globally
|
|
182
183
|
skill_tool = "agents" # default tool for auto-install: agents (standard) or claude
|
|
183
184
|
```
|
|
184
185
|
|
|
185
|
-
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 `guiho-
|
|
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.
|
|
186
187
|
|
|
187
188
|
## CLI Reference
|
|
188
189
|
|
|
@@ -194,8 +195,8 @@ xdocs list <path> # list files in a scope with descriptions
|
|
|
194
195
|
xdocs generate [path] # draft documentation for a directory or the whole project
|
|
195
196
|
xdocs merge [path] # merge a directory's xdocs files into one document
|
|
196
197
|
xdocs prompt --name=<name> # print a ready-made AI prompt (write|update|agents|generate)
|
|
197
|
-
xdocs agents install local # install guiho-
|
|
198
|
-
xdocs agents install global # install guiho-
|
|
198
|
+
xdocs agents install local # install guiho-s-xdocs into this project (.agents/skills/...)
|
|
199
|
+
xdocs agents install global # install guiho-s-xdocs into the user home skills directory
|
|
199
200
|
xdocs agents instructions # insert/refresh the xdocs section in AGENTS.md
|
|
200
201
|
```
|
|
201
202
|
|
|
@@ -203,7 +204,7 @@ Global flags: `--help`, `--version`, `--cwd <path>`, `--config <path>`, `--forma
|
|
|
203
204
|
|
|
204
205
|
## Agent Skill Installation
|
|
205
206
|
|
|
206
|
-
xdocs ships this `guiho-
|
|
207
|
+
xdocs ships this `guiho-s-xdocs` skill. The **standard** target is `AGENTS.md`
|
|
207
208
|
plus `.agents/skills`, which OpenCode, Codex, Jules, and any AGENTS.md-aware tool
|
|
208
209
|
read. A **non-standard** Claude Code target exists and is used only when it is
|
|
209
210
|
explicitly requested (`--tool claude`) or detected (a `.claude` directory or
|
|
@@ -211,8 +212,8 @@ explicitly requested (`--tool claude`) or detected (a `.claude` directory or
|
|
|
211
212
|
|
|
212
213
|
| Target | Skill location (local) |
|
|
213
214
|
| ----------------------- | ------------------------------------------- |
|
|
214
|
-
| **agents** (standard) | `.agents/skills/guiho-
|
|
215
|
-
| **claude** (non-standard) | `.claude/skills/guiho-
|
|
215
|
+
| **agents** (standard) | `.agents/skills/guiho-s-xdocs/SKILL.md` |
|
|
216
|
+
| **claude** (non-standard) | `.claude/skills/guiho-s-xdocs/SKILL.md` |
|
|
216
217
|
|
|
217
218
|
`local` scope installs under the current project; `global` scope installs under
|
|
218
219
|
the user home directory (`~/.agents/skills/...`). The small section in `AGENTS.md`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
subject: xdocs-skills
|
|
3
|
+
description: Bundled AI-agent skills shipped with @guiho/xdocs and installed by the xdocs agents commands.
|
|
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.
|
|
8
|
+
tags:
|
|
9
|
+
- skills
|
|
10
|
+
- agents
|
|
11
|
+
- documentation
|
|
12
|
+
flags: []
|
|
13
|
+
status: stable
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
The `skills/` directory contains the bundled `guiho-s-xdocs` agent skill. The
|
|
17
|
+
installer treats this packaged skill as the current source of truth, removes
|
|
18
|
+
legacy `guiho-as-xdocs` install directories, and refreshes installed copies when
|
|
19
|
+
their frontmatter version or content differs from the bundled file.
|