@guiho/xdocs 0.3.0-alpha.1 → 0.3.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # GUIHO XDocs Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - 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.
6
+ - Change the package-manager `xdocs` bin to a shipped Bun launcher (`scripts/xdocs-bin.ts`) that installs the native binary on first run when needed, matching GUIHO Mirror's `bun x` behavior.
7
+
8
+ ## 0.3.0
9
+
10
+ - Stabilize the 0.3.0 release line, including native binary distribution, direct installers, package-manager native binary installation, and Bun-native TOML/YAML parsing.
11
+ - Ship the renamed `guiho-s-xdocs` agent skill with versioned frontmatter, automatic refresh from the bundled package copy, and legacy `guiho-as-xdocs` cleanup.
12
+ - Refresh README guidance and regression coverage for the stable release.
13
+
14
+ ## 0.3.0-alpha.2
15
+
16
+ - Rename the bundled xdocs agent skill from `guiho-as-xdocs` to `guiho-s-xdocs` and add a frontmatter `version` field.
17
+ - 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.
18
+ - Keep `[agents].auto_skill_install` defaulted to `true` and run global skill refresh during config-gated command automation.
19
+ - Update the TypeScript API, tests, help text, README, architecture notes, AGENTS guidance, and canonical `DOCS.md` for the renamed skill behavior.
20
+
3
21
  ## 0.3.0-alpha.1
4
22
 
5
23
  - Remove external parser dependencies (`smol-toml`, `yaml`) and use Bun-native `Bun.TOML.parse` and `Bun.YAML.parse` instead.
package/DOCS.md CHANGED
@@ -13,7 +13,7 @@ XDocs is a documentation tool, not a versioning tool. It never bumps versions or
13
13
  - Package name: `@guiho/xdocs`
14
14
  - Source/runtime during development: Bun and TypeScript (ESM)
15
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
16
+ - Package-manager install path: the shipped Bun launcher runs `postinstall` or first-run native binary installation, then executes the native binary
17
17
  - Package type: ESM
18
18
  - Library entrypoint: `source/guiho-xdocs.ts`
19
19
  - CLI entrypoint: `source/guiho-xdocs-bin.ts`
@@ -93,7 +93,7 @@ curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh | sh
93
93
  irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
94
94
  ```
95
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:
96
+ 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:
97
97
 
98
98
  ```bash
99
99
  bun add -d @guiho/xdocs
@@ -105,7 +105,7 @@ Or with npm:
105
105
  npm install -D @guiho/xdocs
106
106
  ```
107
107
 
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.
108
+ Use the direct installer when you do not want a JavaScript package manager or Bun involved at runtime. Use the package-manager install when you want project-local dependency management or `bunx` execution; the shipped Bun launcher ensures the native binary exists and delegates to it.
109
109
 
110
110
  ## Quick Start
111
111
 
@@ -156,8 +156,8 @@ Initializes XDocs in a project. It:
156
156
 
157
157
  - Creates `xdocs.config.toml` with defaults (skips if it already exists).
158
158
  - Creates the root `XDOCS.md` (skips if it already exists).
159
- - Updates `AGENTS.md` with the xdocs section that points AI agents at the `guiho-as-xdocs` skill (creates `AGENTS.md` if absent; refreshes the section in place if present).
160
- - Installs the `guiho-as-xdocs` skill to the standard `.agents/skills` location.
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.
161
161
 
162
162
  ```bash
163
163
  xdocs init
@@ -245,7 +245,7 @@ Both `--name=value` and `--name value` forms are supported.
245
245
 
246
246
  ### `xdocs agents`
247
247
 
248
- Installs the `guiho-as-xdocs` agent skill and maintains the `AGENTS.md` instruction section.
248
+ Installs the `guiho-s-xdocs` agent skill and maintains the `AGENTS.md` instruction section.
249
249
 
250
250
  ```bash
251
251
  xdocs agents install local # install under the project (.agents/skills)
@@ -324,35 +324,38 @@ Optional. When present, must be `1`.
324
324
 
325
325
  ### `[agents]`
326
326
 
327
- Agent settings control skill installation and the automation that runs on data commands.
327
+ Agent settings control skill installation and the automation that runs on bare and data commands.
328
328
 
329
329
  - `auto_agents_md`: Keep the `AGENTS.md` xdocs section fresh on normal commands when `AGENTS.md` already exists. Default: `true`.
330
- - `auto_skill_install`: Install the standard skill globally when it is missing. Default: `true`.
330
+ - `auto_skill_install`: Install or refresh the configured skill globally from the bundled package copy. Default: `true`.
331
331
  - `skill_tool`: Default target for auto-install. Supported values are `agents` (standard) and `claude`. Default: `agents`.
332
332
 
333
333
  ## Agent Skills and Automation
334
334
 
335
- XDocs ships the `guiho-as-xdocs` skill inside the package at `skills/guiho-as-xdocs/SKILL.md`. The skill is a large, on-demand instruction document; a small section in `AGENTS.md` tells an agent to load it.
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.
336
336
 
337
337
  Installation is standard-first:
338
338
 
339
339
  | Target | Skill location | When installed |
340
340
  | ------------------------- | ------------------------------------------- | --------------------------------------------------------------- |
341
- | `agents` (standard) | `.agents/skills/guiho-as-xdocs/SKILL.md` | Always (default). Read by OpenCode, Codex, Jules, and any AGENTS.md tool. |
342
- | `claude` (non-standard) | `.claude/skills/guiho-as-xdocs/SKILL.md` | Only when requested via `--tool`, or detected (a `.claude/` directory or `CLAUDE.md`). |
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`). |
343
343
 
344
344
  `local` scope installs under the project root; `global` scope installs under the user home directory (`~/.agents/skills/...`).
345
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
+
346
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.
347
349
 
348
350
  ### Automation
349
351
 
350
- When an `xdocs.config.toml` is present, the data commands (`scan`, `generate`, `merge`, `tree`, `list`) run config-gated agent automation before executing:
352
+ Bare `xdocs` invocations and the data commands (`scan`, `generate`, `merge`, `tree`, `list`) run agent automation before executing:
351
353
 
352
- - If `auto_agents_md` is true and `AGENTS.md` exists, the xdocs section is kept fresh.
353
- - If `auto_skill_install` is true and the global skill is missing, XDocs installs it for the configured `skill_tool` and prints a one-line notice to stderr.
354
+ - XDocs always bootstraps the global skill with default settings when no config is present, using the standard `agents` target.
355
+ - When `xdocs.config.toml` is present and `auto_agents_md` is true, the xdocs section is kept fresh if `AGENTS.md` exists.
356
+ - When config is present and `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.
354
357
 
355
- Automation does nothing outside an xdocs project (no config discovered). `init` and `agents` do not run this automation; they manage agent files explicitly.
358
+ `--help` and `--version` stay read-only. `init` and `agents` do not run this automation; they manage agent files explicitly.
356
359
 
357
360
  ## AI Usage Workflow
358
361
 
@@ -394,11 +397,12 @@ import { extractFrontmatter, parseXDocsFile, validateMetadata } from '@guiho/xdo
394
397
  Agent skill and AGENTS.md automation:
395
398
 
396
399
  ```ts
397
- import { installSkill, ensureAgentsInstructions, runAgentAutomation } from '@guiho/xdocs'
400
+ import { installSkill, ensureAgentsInstructions, runAgentAutomation, xdocsSkillVersion } from '@guiho/xdocs'
398
401
 
399
402
  await installSkill('agents', 'local', { cwd: process.cwd() })
400
403
  await ensureAgentsInstructions(process.cwd(), true)
401
404
  await runAgentAutomation({ cwd: process.cwd(), format: 'text', verbose: false })
405
+ console.log(xdocsSkillVersion)
402
406
  ```
403
407
 
404
408
  Configuration:
@@ -425,10 +429,10 @@ The API uses the same configuration discovery and validation as the CLI.
425
429
  - `source/flags.ts`: argument/flag parsing utilities.
426
430
  - `source/errors.ts`: `XDocsError` with stable exit codes and the `invariant` helper.
427
431
  - `source/types.ts`: public and internal TypeScript types.
428
- - `source/agents.ts`: agent skill installation (standard/claude, local/global), AGENTS.md section management, detection, and config-gated automation. Reads `skills/guiho-as-xdocs/SKILL.md` from disk at runtime relative to `import.meta.url`.
432
+ - `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`.
429
433
  - `source/commands/*.ts`: one file per CLI command (`init`, `scan`, `generate`, `prompt`, `merge`, `tree`, `list`, `agents`).
430
434
  - `prompts/*.md`: prompt templates embedded at build time.
431
- - `skills/guiho-as-xdocs/SKILL.md`: bundled AI-agent skill installed by `xdocs agents` commands.
435
+ - `skills/guiho-s-xdocs/SKILL.md`: bundled versioned AI-agent skill installed by `xdocs agents` commands.
432
436
 
433
437
  ## Development Workflow
434
438
 
@@ -504,7 +508,7 @@ Supported release asset matrix:
504
508
 
505
509
  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.
506
510
 
507
- 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-as-xdocs` skill, and package version metadata before importing the CLI, so installed binaries do not need adjacent prompt or skill files at runtime.
511
+ The package-manager install path ships `scripts/xdocs-bin.ts` as the package `bin`. That launcher calls `scripts/install-package.ts` during first run if `vendor/xdocs` or `vendor/xdocs.exe` is missing. The install helper downloads the matching GitHub Release asset, or copies a bundled asset when present. 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.
508
512
 
509
513
  ## Documentation Requirement Before Publishing
510
514
 
@@ -550,9 +554,9 @@ Run `xdocs tree --verbose`. Resolve duplicate `subject` values, orphaned modules
550
554
 
551
555
  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.
552
556
 
553
- ### A normal command modified AGENTS.md or installed a global skill unexpectedly
557
+ ### A normal command modified AGENTS.md or installed/refreshed a global skill unexpectedly
554
558
 
555
- 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.
559
+ 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.
556
560
 
557
561
  ### Prompt not found
558
562
 
package/README.md CHANGED
@@ -2,13 +2,15 @@
2
2
 
3
3
  **Structured documentation system for codebases. Helps AI make sense of projects.**
4
4
 
5
+ **npm package:** [@guiho/xdocs](https://www.npmjs.com/package/@guiho/xdocs)
6
+
5
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.
6
8
 
7
9
  ```text
8
10
  codebase -> xdocs files -> AI understands the project
9
11
  ```
10
12
 
11
- xdocs runs on **Bun** and **Node >= 20**. It ships as a compiled binary, a thin JS loader for `npx`/`bunx`, and a fully-typed TypeScript library.
13
+ xdocs ships as compiled native binaries, a thin Bun launcher for package-manager and `bunx` execution, and a fully-typed TypeScript library.
12
14
 
13
15
  ---
14
16
 
@@ -28,7 +30,7 @@ irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
28
30
 
29
31
  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
32
 
31
- Package-manager install (convenient for JavaScript projects; downloads the matching native binary during `postinstall`, then runs the native binary):
33
+ Package-manager install (convenient for JavaScript projects; downloads the matching native binary during `postinstall`, or on first run if the install hook did not run):
32
34
 
33
35
  ```bash
34
36
  npm install -D @guiho/xdocs
@@ -36,7 +38,7 @@ npm install -D @guiho/xdocs
36
38
  bun add -d @guiho/xdocs
37
39
  ```
38
40
 
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.
41
+ Native release assets are published for Linux x64/arm64, macOS x64/arm64, and Windows x64. Windows arm64 is not published yet. Direct installs run without Node.js or Bun at runtime. Package-manager and `bunx` execution use a shipped Bun launcher that ensures the matching native binary is installed, then delegates to it.
40
42
 
41
43
  ### Initializing
42
44
 
@@ -50,7 +52,7 @@ This creates:
50
52
  - `XDOCS.md` -- the single frontmatter-less repository index listing packages/applications
51
53
  - `xdocs.config.toml` -- configuration with sensible defaults
52
54
  - Updates `AGENTS.md` with instructions for AI agents
53
- - Installs the `guiho-as-xdocs` agent skill (standard `.agents/skills`)
55
+ - Installs the `guiho-s-xdocs` agent skill (standard `.agents/skills`)
54
56
 
55
57
  ### Typical Workflow
56
58
 
@@ -146,7 +148,7 @@ The CLI validates tree integrity: no orphan subjects, no missing parents, no cyc
146
148
 
147
149
  #### `xdocs init`
148
150
 
149
- Initializes xdocs in a project. Creates the root `XDOCS.md`, the `xdocs.config.toml` configuration, updates `AGENTS.md`, and installs the `guiho-as-xdocs` skill to the standard `.agents/skills` location.
151
+ 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.
150
152
 
151
153
  #### `xdocs scan`
152
154
 
@@ -207,7 +209,7 @@ xdocs list ./src/auth
207
209
 
208
210
  #### `xdocs agents`
209
211
 
210
- Installs the `guiho-as-xdocs` agent skill and maintains the `AGENTS.md` section.
212
+ Installs the `guiho-s-xdocs` agent skill and maintains the `AGENTS.md` section.
211
213
 
212
214
  ```bash
213
215
  xdocs agents install local # install the skill under the project (.agents/skills)
@@ -259,9 +261,9 @@ exclude = ["node_modules", ".git", "dist", "build", "library", "bin", "bundle"]
259
261
  name = "my-project"
260
262
 
261
263
  [agents]
262
- # Keep the xdocs section in AGENTS.md fresh on normal commands. Default: true
264
+ # Keep the xdocs section in AGENTS.md fresh on bare and normal commands. Default: true
263
265
  auto_agents_md = true
264
- # Install the standard skill globally when missing. Default: true
266
+ # Install or refresh the standard skill globally from the bundled copy. Default: true
265
267
  auto_skill_install = true
266
268
  # Default target for skill auto-install: "agents" (standard) or "claude". Default: "agents"
267
269
  skill_tool = "agents"
@@ -269,14 +271,14 @@ skill_tool = "agents"
269
271
 
270
272
  ### Agent Skills
271
273
 
272
- xdocs ships the `guiho-as-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 large and loaded on demand; a small section in `AGENTS.md` points the agent at it.
274
+ 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.
273
275
 
274
276
  Installation is **standard-first**:
275
277
 
276
278
  | Target | Location | When installed |
277
279
  | ------------------------- | --------------------------------------------------- | --------------------------------------------------------------- |
278
- | **agents** (standard) | `.agents/skills/guiho-as-xdocs/SKILL.md` | Always (default). Read by OpenCode, Codex, Jules, and any AGENTS.md tool. |
279
- | **claude** (non-standard) | `.claude/skills/guiho-as-xdocs/SKILL.md` | When `--tool claude` is given, or a `.claude/` dir or `CLAUDE.md` is detected. |
280
+ | **agents** (standard) | `.agents/skills/guiho-s-xdocs/SKILL.md` | Always (default). Read by OpenCode, Codex, Jules, and any AGENTS.md tool. |
281
+ | **claude** (non-standard) | `.claude/skills/guiho-s-xdocs/SKILL.md` | When `--tool claude` is given, or a `.claude/` dir or `CLAUDE.md` is detected. |
280
282
 
281
283
  ```bash
282
284
  xdocs agents install local # standard target, under the project
@@ -284,7 +286,9 @@ xdocs agents install global # standard target, under ~/.agents/skills
284
286
  xdocs agents instructions # insert/refresh the AGENTS.md section
285
287
  ```
286
288
 
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.
289
+ `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.
290
+
291
+ A bare `xdocs` invocation and the normal data commands refresh the global skill before doing their usual work. Without `xdocs.config.toml`, xdocs uses the standard `agents` target; with config, `[agents].skill_tool` can choose the target and `[agents].auto_skill_install = false` can disable the refresh. If the legacy `guiho-as-xdocs` skill exists for that global target, xdocs removes it and writes the bundled `guiho-s-xdocs` skill.
288
292
 
289
293
  ---
290
294
 
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiho/xdocs",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.3.1",
4
4
  "exports": "./source/guiho-xdocs.ts",
5
5
  "publish": {
6
6
  "include": [
@@ -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-as-xdocs skill.
9
- * 2. The large guiho-as-xdocs skill file, installed (local or global) into the
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-as-xdocs";
15
- /** Raw contents of the bundled guiho-as-xdocs/SKILL.md, read from disk at
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-as-xdocs` agent skill** for any documentation work:\ncreating, updating, regenerating, scanning, merging, or navigating xdocs files.\nThe skill holds the full workflow, metadata schema, and CLI reference.\n\nBefore changing documentation, read `xdocs.config.toml` and respect `[ai].mode`:\n\n- **prompt** \u2014 announce which xdocs files need updating and wait for confirmation.\n- **auto** \u2014 update the relevant xdocs files immediately.\n\nUse the xdocs CLI for operations: `xdocs scan`, `xdocs tree`, `xdocs generate`,\n`xdocs list`, `xdocs merge`.\n<!-- END XDOCS -->";
41
+ export declare const xdocsAgentsSection = "<!-- BEGIN XDOCS \u2014 DO NOT EDIT THIS SECTION -->\n## XDocs Structured Documentation\n\nThis project uses **xdocs** (`@guiho/xdocs`) for structured, machine-readable\ndocumentation. The repository has one root `XDOCS.md` index (no frontmatter),\nand each package/application has a root `.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;
@@ -66,11 +70,12 @@ export declare const findAgentsFile: (cwd: string) => string | undefined;
66
70
  /** Resolve agent settings from the discovered xdocs config (defaults when absent). */
67
71
  export declare const resolveAgentSettings: (options: XDocsCliOptions) => Promise<XDocsAgentSettings>;
68
72
  /**
69
- * Config-gated automation run by normal commands. Does nothing outside an xdocs
70
- * project (no config discovered). When enabled, it keeps the AGENTS.md section
71
- * fresh (only if AGENTS.md already exists) and installs the global skill for the
72
- * configured tool when it is missing.
73
+ * Agent automation run by bare and data commands. It always bootstraps the
74
+ * configured global skill from the bundled package copy; when config exists,
75
+ * it also keeps the AGENTS.md section fresh if enabled and AGENTS.md exists.
73
76
  */
74
77
  export declare const runAgentAutomation: (options: AgentAutomationOptions, notify?: (message: string) => void) => Promise<XDocsAgentAutomationResult>;
78
+ /** Read a skill version from SKILL.md YAML frontmatter. */
79
+ export declare function readSkillVersion(content: string): string | undefined;
75
80
  export {};
76
81
  //# sourceMappingURL=agents.d.ts.map
@@ -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,mBAAmB,CAAA;AAE9C;;iEAEiE;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAS5B,CAAA;AAEJ,6EAA6E;AAC7E,eAAO,MAAM,eAAe,EAAE,SAAS,cAAc,EAAyB,CAAA;AAE9E,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAE,cAAyB,CAAA;AAEzD,2FAA2F;AAC3F,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,cAAc,EAKzE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,cAAc,EAK5D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,UAAU,MAAM,GAAG,S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@@
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-as-xdocs skill.
9
- * 2. The large guiho-as-xdocs skill file, installed (local or global) into the
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-as-xdocs';
20
- /** Raw contents of the bundled guiho-as-xdocs/SKILL.md, read from disk at
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 = (() => {
@@ -25,12 +27,14 @@ export const xdocsSkillContent = (() => {
25
27
  if (embedded)
26
28
  return embedded;
27
29
  try {
28
- return readFileSync(new URL('../skills/guiho-as-xdocs/SKILL.md', import.meta.url), 'utf8');
30
+ return readFileSync(new URL('../skills/guiho-s-xdocs/SKILL.md', import.meta.url), 'utf8');
29
31
  }
30
32
  catch {
31
33
  return '';
32
34
  }
33
35
  })();
36
+ /** Version declared by the bundled skill frontmatter. */
37
+ export const xdocsSkillVersion = readSkillVersion(xdocsSkillContent);
34
38
  /** All AI tools the skill can be installed for. `agents` is the standard. */
35
39
  export const xdocsAgentTools = ['agents', 'claude'];
36
40
  /** The standard, always-default skill target (AGENTS.md + .agents/skills). */
@@ -65,7 +69,7 @@ export const resolveInstallTools = (cwd, toolFlag) => toolFlag ? parseAgentTools
65
69
  /**
66
70
  * Skill directory for each tool, relative to the scope root (project root for
67
71
  * `local`, home directory for `global`). The skill is written to
68
- * `<root>/<dir>/guiho-as-xdocs/SKILL.md`.
72
+ * `<root>/<dir>/guiho-s-xdocs/SKILL.md`.
69
73
  *
70
74
  * `agents` is the cross-tool standard (OpenCode, Codex, Jules, and any AGENTS.md
71
75
  * tool read it). `claude` is the non-standard Claude Code location.
@@ -99,9 +103,10 @@ Use the xdocs CLI for operations: \`xdocs scan\`, \`xdocs tree\`, \`xdocs genera
99
103
  \`xdocs list\`, \`xdocs merge\`.
100
104
  ${AGENTS_END_MARKER}`;
101
105
  /** Resolve the on-disk path of the skill file for a tool and scope. */
102
- 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 = {}) => {
103
108
  const root = scope === 'local' ? resolve(options.cwd ?? process.cwd()) : resolveAgentHome(options.homeDirectory);
104
- return resolve(root, skillDirectories[tool], xdocsSkillName, 'SKILL.md');
109
+ return resolve(root, skillDirectories[tool], skillName, 'SKILL.md');
105
110
  };
106
111
  /** Whether the skill is already installed for a tool and scope. */
107
112
  export const isSkillInstalled = (tool, scope, options = {}) => existsSync(resolveSkillPath(tool, scope, options));
@@ -109,14 +114,28 @@ export const isSkillInstalled = (tool, scope, options = {}) => existsSync(resolv
109
114
  export const installSkill = async (tool, scope, options = {}) => {
110
115
  const path = resolveSkillPath(tool, scope, options);
111
116
  const exists = existsSync(path);
112
- if (exists && options.overwrite === false)
113
- return { tool, scope, path, installed: false, updated: false };
114
117
  const current = exists ? await readFile(path, 'utf8') : undefined;
115
- if (current === xdocsSkillContent)
116
- return { tool, scope, path, installed: false, updated: false };
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 });
117
136
  await mkdir(dirname(path), { recursive: true });
118
137
  await writeFile(path, xdocsSkillContent, 'utf8');
119
- return { tool, scope, path, installed: !exists, updated: exists };
138
+ return { tool, scope, path, installed: !exists, updated: exists, removedLegacyPaths, previousVersion, bundledVersion };
120
139
  };
121
140
  /** Install the skill for several tools at once. */
122
141
  export const installSkills = async (tools, scope, options = {}) => {
@@ -189,27 +208,50 @@ export const resolveAgentSettings = async (options) => {
189
208
  return normalizeAgentSettings(discovered.raw?.agents);
190
209
  };
191
210
  /**
192
- * Config-gated automation run by normal commands. Does nothing outside an xdocs
193
- * project (no config discovered). When enabled, it keeps the AGENTS.md section
194
- * fresh (only if AGENTS.md already exists) and installs the global skill for the
195
- * configured tool when it is missing.
211
+ * Agent automation run by bare and data commands. It always bootstraps the
212
+ * configured global skill from the bundled package copy; when config exists,
213
+ * it also keeps the AGENTS.md section fresh if enabled and AGENTS.md exists.
196
214
  */
197
215
  export const runAgentAutomation = async (options, notify = () => { }) => {
198
216
  const cwd = resolve(options.cwd);
199
217
  const discovered = await discoverConfig(cwd, options.config);
200
- if (!discovered.raw)
201
- return { settings: { ...normalizeAgentSettings(undefined) } };
202
- const settings = normalizeAgentSettings(discovered.raw.agents);
218
+ const settings = normalizeAgentSettings(discovered.raw?.agents);
203
219
  const result = { settings };
204
- if (settings.autoAgentsMd)
220
+ if (discovered.raw && settings.autoAgentsMd)
205
221
  result.agentsMd = await ensureAgentsInstructions(cwd, false);
206
- if (settings.autoSkillInstall && !isSkillInstalled(settings.skillTool, 'global', { cwd, homeDirectory: options.homeDirectory })) {
207
- const path = resolveSkillPath(settings.skillTool, 'global', { cwd, homeDirectory: options.homeDirectory });
208
- notify(`notice: ${xdocsSkillName} skill not found globally; xdocs is installing it at ${path}`);
209
- result.globalSkill = await installSkill(settings.skillTool, 'global', { cwd, homeDirectory: options.homeDirectory, overwrite: false });
222
+ if (settings.autoSkillInstall) {
223
+ const globalSkill = await installSkill(settings.skillTool, 'global', { cwd, homeDirectory: options.homeDirectory });
224
+ const changed = globalSkill.installed || globalSkill.updated || globalSkill.removedLegacyPaths.length > 0;
225
+ if (changed)
226
+ notify(`notice: ${xdocsSkillName} skill refreshed globally at ${globalSkill.path}`);
227
+ result.globalSkill = globalSkill;
210
228
  }
211
229
  return result;
212
230
  };
231
+ /** Read a skill version from SKILL.md YAML frontmatter. */
232
+ export function readSkillVersion(content) {
233
+ return readSkillFrontmatterValue(content, 'version');
234
+ }
235
+ function readSkillFrontmatterValue(content, key) {
236
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
237
+ if (!match)
238
+ return undefined;
239
+ const frontmatter = match[1];
240
+ if (frontmatter === undefined)
241
+ return undefined;
242
+ for (const line of frontmatter.split(/\r?\n/)) {
243
+ const separator = line.indexOf(':');
244
+ if (separator === -1)
245
+ continue;
246
+ if (line.slice(0, separator).trim() !== key)
247
+ continue;
248
+ const value = line.slice(separator + 1).trim();
249
+ if (!value)
250
+ return undefined;
251
+ return value.replace(/^['"]|['"]$/g, '');
252
+ }
253
+ return undefined;
254
+ }
213
255
  const resolveAgentHome = (homeDirectory) => {
214
256
  const value = homeDirectory ?? process.env['XDOCS_AGENT_HOME'] ?? homedir();
215
257
  return isAbsolute(value) ? value : resolve(process.cwd(), value);
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH,4BAA4B;AAC5B,eAAO,MAAM,MAAM,GAAU,UAAS,MAAM,EAA0B,KAAG,OAAO,CAAC,IAAI,CA4DpF,CAAA;AAmBD,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,GAAU,UAAU,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAiB9E,CAAA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH,4BAA4B;AAC5B,eAAO,MAAM,MAAM,GAAU,UAAS,MAAM,EAA0B,KAAG,OAAO,CAAC,IAAI,CA6DpF,CAAA;AAmBD,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,GAAU,UAAU,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAiB9E,CAAA"}
package/library/cli.js CHANGED
@@ -33,14 +33,15 @@ export const runCli = async (rawArgs = process.argv.slice(2)) => {
33
33
  }
34
34
  return;
35
35
  }
36
+ if (parsed.command && !validCommands.has(parsed.command)) {
37
+ throw new XDocsError(`Unknown command: ${parsed.command}\n\nRun \`xdocs --help\` for available commands.`);
38
+ }
39
+ const options = resolveOptions(parsed.flags);
36
40
  if (!parsed.command) {
41
+ await runAgentAutomation(options, (message) => process.stderr.write(message + '\n'));
37
42
  process.stdout.write(showHelp() + '\n');
38
43
  return;
39
44
  }
40
- if (!validCommands.has(parsed.command)) {
41
- throw new XDocsError(`Unknown command: ${parsed.command}\n\nRun \`xdocs --help\` for available commands.`);
42
- }
43
- const options = resolveOptions(parsed.flags);
44
45
  const command = parsed.command;
45
46
  if (automationCommands.has(command)) {
46
47
  await runAgentAutomation(options, (message) => process.stderr.write(message + '\n'));
@@ -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-as-xdocs skill for one or more tools. */
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');
@@ -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-as-xdocs skill)
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-as-xdocs agent skill (standard by default; non-standard
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 {
@@ -13,7 +13,7 @@ import agentsPrompt from '../prompts/agents.md' with { type: 'text' };
13
13
  // @ts-expect-error -- Bun text import for native binary embedding.
14
14
  import generatePrompt from '../prompts/generate.md' with { type: 'text' };
15
15
  // @ts-expect-error -- Bun text import for native binary embedding.
16
- import xdocsSkill from '../skills/guiho-as-xdocs/SKILL.md' with { type: 'text' };
16
+ import xdocsSkill from '../skills/guiho-s-xdocs/SKILL.md' with { type: 'text' };
17
17
  import packageJson from '../package.json' with { type: 'json' };
18
18
  /** Register prompt/skill/package resources for a native compiled binary. */
19
19
  export const registerEmbeddedResources = () => {
@@ -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=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AAA;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"}
@@ -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.js CHANGED
@@ -32,7 +32,7 @@ Commands:
32
32
  merge [path] Merge xdocs files from a directory into one file
33
33
  tree Display the project hierarchy tree
34
34
  list [path] List files with descriptions
35
- agents Install the guiho-as-xdocs skill and AGENTS.md instructions
35
+ agents Install the guiho-s-xdocs skill and AGENTS.md instructions
36
36
 
37
37
  Global Flags:
38
38
  -h, --help Show help for a command
@@ -69,7 +69,7 @@ Creates:
69
69
  - XDOCS.md Root documentation file
70
70
  - xdocs.config.toml Configuration with defaults
71
71
  - Updates AGENTS.md Adds the xdocs section pointing AI at the skill
72
- - Installs the skill guiho-as-xdocs into .agents/skills (standard, local)
72
+ - Installs the skill guiho-s-xdocs into .agents/skills (standard, local)
73
73
 
74
74
  By default the skill is installed for the standard target (AGENTS.md +
75
75
  .agents/skills). The non-standard claude target (.claude/skills) is added only
@@ -175,7 +175,7 @@ Flags:
175
175
  --verbose Show detailed output
176
176
  `.trim(),
177
177
  agents: `
178
- xdocs agents - Install the guiho-as-xdocs skill and AGENTS.md instructions
178
+ xdocs agents - Install the guiho-s-xdocs skill and AGENTS.md instructions
179
179
 
180
180
  Usage:
181
181
  xdocs agents install <local|global> [--tool <tool>]
@@ -187,8 +187,8 @@ Subcommands:
187
187
  instructions Insert or refresh the xdocs section in AGENTS.md
188
188
 
189
189
  Skill locations:
190
- agents (standard) <root>/.agents/skills/guiho-as-xdocs/SKILL.md
191
- claude (non-standard) <root>/.claude/skills/guiho-as-xdocs/SKILL.md
190
+ agents (standard) <root>/.agents/skills/guiho-s-xdocs/SKILL.md
191
+ claude (non-standard) <root>/.claude/skills/guiho-s-xdocs/SKILL.md
192
192
 
193
193
  <root> is the project for local scope, or the user home directory for global.
194
194
  Without --tool, the standard agents target is installed, plus claude when a
@@ -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-as-xdocs skill can be installed for.
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-as-xdocs skill for one tool/scope. */
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 = {
@@ -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,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzG;;;;iCAIiC;AACjC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEhD,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEhD,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,OAAO,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAA;KACpB,CAAC,CAAA;IACF,EAAE,EAAE,OAAO,CAAC;QACV,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF,IAAI,EAAE,OAAO,CAAC;QACZ,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB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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.3.0-alpha.1",
4
+ "version": "0.3.1",
5
5
  "type": "module",
6
6
  "main": "./library/guiho-xdocs.js",
7
7
  "types": "./library/guiho-xdocs.d.ts",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "bin": {
15
- "xdocs": "./bin/xdocs.exe"
15
+ "xdocs": "scripts/xdocs-bin.ts"
16
16
  },
17
17
  "files": [
18
18
  "README.md",
@@ -49,7 +49,7 @@
49
49
  "binary": "bun build source/guiho-xdocs-native-bin.ts --compile --outfile bin/xdocs",
50
50
  "binaries": "bun run devops/build-binaries.ts",
51
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",
52
+ "postinstall": "bun run scripts/install-package.ts",
53
53
  "typecheck": "tsc -p . --noEmit",
54
54
  "clean": "rm -rf .temp",
55
55
  "clean-build": "rm -rf build library bundle bin",
@@ -0,0 +1,88 @@
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
+ * Package-manager install helper for xdocs.
6
+ *
7
+ * This script downloads the platform-native xdocs binary into `vendor/xdocs` or
8
+ * `vendor/xdocs.exe`. Package-manager installs use the small Bun launcher in
9
+ * `scripts/xdocs-bin.ts`; direct installers remain the no-Bun runtime path.
10
+ */
11
+
12
+ type PackageJson = {
13
+ version?: string
14
+ }
15
+
16
+ const packageJson = await Bun.file(new URL('../package.json', import.meta.url)).json() as PackageJson
17
+ const sourceEntrypoint = Bun.file(new URL('../source/guiho-xdocs-bin.ts', import.meta.url))
18
+
19
+ if (await sourceEntrypoint.exists()) {
20
+ console.log('source checkout detected; skipping native binary download')
21
+ process.exit(0)
22
+ }
23
+
24
+ const version = process.env['XDOCS_VERSION'] ?? packageJson.version ?? 'latest'
25
+ const repo = process.env['XDOCS_REPO'] ?? 'CGuiho/xdocs'
26
+ const asset = detectAsset()
27
+ const bundledAsset = Bun.file(new URL(`../bin/${asset}`, import.meta.url))
28
+ const destination = new URL(`../vendor/xdocs${process.platform === 'win32' ? '.exe' : ''}`, import.meta.url)
29
+
30
+ if (await bundledAsset.exists()) {
31
+ await Bun.write(destination, bundledAsset)
32
+ await makeExecutable(destination)
33
+ console.log(`installed bundled xdocs native binary: ${asset}`)
34
+ process.exit(0)
35
+ }
36
+
37
+ const tag = version === 'latest' ? 'latest' : `@guiho/xdocs@${version}`
38
+ const url = tag === 'latest'
39
+ ? `https://github.com/${repo}/releases/latest/download/${asset}`
40
+ : `https://github.com/${repo}/releases/download/${encodeURIComponent(tag)}/${asset}`
41
+
42
+ const response = await fetch(url)
43
+
44
+ if (!response.ok) {
45
+ console.error(`error: failed to download ${url}`)
46
+ console.error(`status: ${response.status} ${response.statusText}`)
47
+ process.exit(1)
48
+ }
49
+
50
+ await Bun.write(destination, response)
51
+ await makeExecutable(destination)
52
+ console.log(`installed xdocs native binary: ${asset}`)
53
+
54
+ async function makeExecutable(path: URL) {
55
+ if (process.platform === 'win32') return
56
+
57
+ const result = Bun.spawn(['chmod', '755', Bun.fileURLToPath(path)], {
58
+ stdout: 'ignore',
59
+ stderr: 'inherit',
60
+ })
61
+ const exitCode = await result.exited
62
+
63
+ if (exitCode !== 0) {
64
+ console.error('error: failed to make xdocs native binary executable')
65
+ process.exit(exitCode)
66
+ }
67
+ }
68
+
69
+ function detectAsset() {
70
+ const os = detectOs()
71
+ const arch = detectArch()
72
+ return `xdocs-${os}-${arch}${os === 'windows' ? '.exe' : ''}`
73
+ }
74
+
75
+ function detectOs() {
76
+ if (process.platform === 'linux') return 'linux'
77
+ if (process.platform === 'darwin') return 'macos'
78
+ if (process.platform === 'win32') return 'windows'
79
+ console.error(`error: unsupported OS: ${process.platform}`)
80
+ process.exit(1)
81
+ }
82
+
83
+ function detectArch() {
84
+ if (process.arch === 'x64') return 'x64'
85
+ if (process.arch === 'arm64') return 'arm64'
86
+ console.error(`error: unsupported architecture: ${process.arch}`)
87
+ process.exit(1)
88
+ }
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  subject: xdocs-scripts
3
- description: Package-manager installation scripts for installing the native xdocs binary.
3
+ description: Package-manager launcher and installation scripts for executing the native xdocs binary.
4
4
  parent: xdocs-package
5
5
  children: []
6
6
  files:
7
- install-native.cjs: npm postinstall helper that downloads the matching GitHub Release native binary into bin/xdocs.exe.
7
+ xdocs-bin.ts: Shipped Bun launcher used as the package bin; installs the native binary on first run when needed and delegates to it.
8
+ install-package.ts: Package-manager install helper that downloads or copies the matching GitHub Release native binary into vendor/xdocs or vendor/xdocs.exe.
8
9
  tags:
9
10
  - install
10
11
  - native-binary
@@ -13,6 +14,7 @@ flags: []
13
14
  status: stable
14
15
  ---
15
16
 
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.
17
+ The `scripts/` directory contains the package-manager launcher and install
18
+ helper. Package-manager and `bunx` execution start in `xdocs-bin.ts`; if the
19
+ native binary is missing, it runs `install-package.ts` and then delegates to the
20
+ downloaded binary in `vendor/`. Direct installers remain the no-Bun runtime path.
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
4
+ *
5
+ * Small package-manager launcher for the downloaded native xdocs binary.
6
+ */
7
+
8
+ const binaryPath = new URL(`../vendor/xdocs${process.platform === 'win32' ? '.exe' : ''}`, import.meta.url)
9
+ const executablePath = Bun.fileURLToPath(binaryPath)
10
+ const binary = Bun.file(binaryPath)
11
+
12
+ if (!(await binary.exists())) {
13
+ const installerPath = new URL('install-package.ts', import.meta.url)
14
+ const proc = Bun.spawn([process.execPath, Bun.fileURLToPath(installerPath)], {
15
+ stdin: 'inherit',
16
+ stdout: 'inherit',
17
+ stderr: 'inherit',
18
+ })
19
+
20
+ const exitCode = await proc.exited
21
+ if (exitCode !== 0 || !(await Bun.file(binaryPath).exists())) {
22
+ console.error('error: xdocs native binary is missing. Reinstall @guiho/xdocs or run `bun run scripts/install-package.ts`.')
23
+ process.exit(exitCode || 1)
24
+ }
25
+ }
26
+
27
+ const proc = Bun.spawn([executablePath, ...process.argv.slice(2)], {
28
+ stdin: 'inherit',
29
+ stdout: 'inherit',
30
+ stderr: 'inherit',
31
+ })
32
+
33
+ process.exit(await proc.exited)
@@ -1,5 +1,6 @@
1
1
  ---
2
- name: guiho-as-xdocs
2
+ name: guiho-s-xdocs
3
+ version: 0.3.0
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
 
@@ -177,12 +178,12 @@ exclude = ["node_modules", ".git", "dist", "build", "library", "bin", "bundle"]
177
178
  name = "my-project"
178
179
 
179
180
  [agents]
180
- 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-as-xdocs skill globally when missing
181
+ auto_agents_md = true # keep the xdocs section in AGENTS.md up to date on bare and normal commands
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-as-xdocs` globally when it is missing.
186
+ Agent automation options default to true. A bare `xdocs` invocation and normal data commands always bootstrap the standard global skill when no config is present; with config, set `auto_agents_md = false` to stop xdocs from touching AGENTS.md, and `auto_skill_install = false` to stop xdocs from installing or refreshing `guiho-s-xdocs` globally.
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-as-xdocs into this project (.agents/skills/...)
198
- xdocs agents install global # install guiho-as-xdocs into the user home skills directory
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-as-xdocs` skill. The **standard** target is `AGENTS.md`
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-as-xdocs/SKILL.md` |
215
- | **claude** (non-standard) | `.claude/skills/guiho-as-xdocs/SKILL.md` |
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.
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env node
2
- /*
3
- * Install the platform-native xdocs binary for package-manager installs.
4
- * Node is used only during installation. The installed `xdocs` command points
5
- * directly at the downloaded native binary and does not require Node at runtime.
6
- */
7
-
8
- const { createWriteStream, existsSync, mkdirSync, chmodSync } = require('node:fs')
9
- const { readFile } = require('node:fs/promises')
10
- const { get } = require('node:https')
11
- const { join } = require('node:path')
12
-
13
- const root = join(__dirname, '..')
14
- const packagePath = join(root, 'package.json')
15
- const targetPath = join(root, 'bin', 'xdocs.exe')
16
-
17
- main().catch((error) => {
18
- console.error(`xdocs: failed to install native binary: ${error.message}`)
19
- process.exit(1)
20
- })
21
-
22
- async function main() {
23
- if (process.env.XDOCS_SKIP_NATIVE_INSTALL === '1') {
24
- console.warn('xdocs: skipping native binary installation because XDOCS_SKIP_NATIVE_INSTALL=1')
25
- return
26
- }
27
-
28
- if (existsSync(join(root, 'source'))) {
29
- console.warn('xdocs: skipping native binary installation in a source checkout')
30
- return
31
- }
32
-
33
- const packageJson = JSON.parse(await readFile(packagePath, 'utf8'))
34
- const version = packageJson.version
35
- if (typeof version !== 'string' || version.length === 0) throw new Error('package.json version is missing')
36
-
37
- const asset = assetName()
38
- const tag = `@guiho/xdocs@${version}`
39
- const url = `https://github.com/CGuiho/xdocs/releases/download/${encodeURIComponent(tag)}/${asset}`
40
-
41
- mkdirSync(join(root, 'bin'), { recursive: true })
42
- await download(url, targetPath)
43
- if (process.platform !== 'win32') chmodSync(targetPath, 0o755)
44
-
45
- console.log(`xdocs: installed native binary ${asset}`)
46
- }
47
-
48
- function assetName() {
49
- if (process.platform === 'linux') {
50
- if (process.arch === 'x64') return 'xdocs-linux-x64'
51
- if (process.arch === 'arm64') return 'xdocs-linux-arm64'
52
- }
53
-
54
- if (process.platform === 'darwin') {
55
- if (process.arch === 'x64') return 'xdocs-macos-x64'
56
- if (process.arch === 'arm64') return 'xdocs-macos-arm64'
57
- }
58
-
59
- if (process.platform === 'win32') {
60
- if (process.arch === 'x64') return 'xdocs-windows-x64.exe'
61
- }
62
-
63
- throw new Error(`unsupported platform: ${process.platform}/${process.arch}`)
64
- }
65
-
66
- function download(url, destination) {
67
- return new Promise((resolve, reject) => {
68
- const request = get(url, (response) => {
69
- if (response.statusCode === 302 || response.statusCode === 301) {
70
- const location = response.headers.location
71
- if (!location) {
72
- reject(new Error(`redirect from ${url} did not include a Location header`))
73
- return
74
- }
75
-
76
- download(location, destination).then(resolve, reject)
77
- return
78
- }
79
-
80
- if (response.statusCode !== 200) {
81
- reject(new Error(`download failed (${response.statusCode}) from ${url}`))
82
- return
83
- }
84
-
85
- const file = createWriteStream(destination)
86
- response.pipe(file)
87
- file.on('finish', () => {
88
- file.close(resolve)
89
- })
90
- file.on('error', reject)
91
- })
92
-
93
- request.on('error', reject)
94
- request.end()
95
- })
96
- }
97
-
98
- // Keep npm pack from treating this package as broken before postinstall runs.
99
- if (!existsSync(targetPath)) {
100
- mkdirSync(join(root, 'bin'), { recursive: true })
101
- }