@guiho/xdocs 0.4.2 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # GUIHO XDocs Changelog
2
2
 
3
+ ## 0.4.9
4
+
5
+ - Fix GitHub Actions artifact names for scoped package tags by using run IDs, allowing the native binary publish workflow to upload artifacts and continue to GitHub Release asset publication.
6
+
7
+ ## 0.4.8
8
+
9
+ - Harden the direct Linux/macOS Bash installer and Windows PowerShell installer for native xdocs binaries, including baseline-first x64 fallback, explicit default/modern variants, downloaded binary validation, PATH setup, and shadowing warnings.
10
+ - Verify the 12-asset native binary matrix during `bun run binaries` for Linux, macOS, and Windows arm64/x64 baseline/default/modern outputs.
11
+ - Upload native binaries as CI workflow artifacts and publish/verify all 12 GitHub Release assets before npm publishing on version-tag releases.
12
+ - Document native binary installation, PATH fallback commands, and the full release asset matrix in `README.md` and `DOCS.md`.
13
+
3
14
  ## 0.4.0-alpha.0
4
15
 
5
16
  - Change the documentation model to one named `*.xdocs.md` descriptor per documented directory, with `XDOCS.md` reserved as the frontmatter-less repository index.
package/DOCS.md CHANGED
@@ -119,11 +119,29 @@ Scanning walks the project tree and skips directories listed in `[scan].exclude`
119
119
  Direct native binary install (no Node.js or Bun required after installation):
120
120
 
121
121
  ```bash
122
- curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh | sh
122
+ curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh | bash
123
123
  ```
124
124
 
125
125
  ```powershell
126
- irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
126
+ irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1 | iex
127
+ ```
128
+
129
+ The Linux/macOS installer is a Bash script in `devops/install.sh`; the Windows
130
+ installer is the PowerShell script in `devops/install.ps1`. Both download from
131
+ GitHub Releases, install into `~/.local/bin` by default, and add that directory
132
+ then fall back to the default and `modern` variants. Users can force a specific
133
+ architecture or variant with `--arch` / `--variant` on Bash or `-Arch` /
134
+ `-Variant` on PowerShell.
135
+
136
+ Manual PATH fallback commands:
137
+
138
+ ```bash
139
+ export PATH="$HOME/.local/bin:$PATH"
140
+ ```
141
+
142
+ ```powershell
143
+ $env:Path = "$HOME\.local\bin;$env:Path"
144
+ [Environment]::SetEnvironmentVariable('Path', "$HOME\.local\bin;" + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')
127
145
  ```
128
146
 
129
147
  Install XDocs as a development dependency through a JavaScript package manager. Package-manager execution uses the shipped Bun launcher, which downloads the matching native binary during `postinstall` or on first run if the install hook did not run, then executes the native binary:
@@ -469,7 +487,7 @@ The API uses the same configuration discovery and validation as the CLI.
469
487
 
470
488
  ## Development Workflow
471
489
 
472
- Run package commands from `xdocs/`.
490
+ Run package commands from the repository root.
473
491
 
474
492
  ```bash
475
493
  bun install
@@ -498,6 +516,7 @@ Current tests cover:
498
516
  - Tree construction, rendering, and integrity validation.
499
517
  - Config discovery, validation, and defaulting.
500
518
  - Agent settings normalization, skill path resolution, skill installation (local/global), tool detection, and AGENTS.md section insertion.
519
+ - Package launcher execution from a source checkout without a native vendor binary.
501
520
 
502
521
  Run all tests:
503
522
 
@@ -533,15 +552,34 @@ bun run binaries
533
552
 
534
553
  Supported release asset matrix:
535
554
 
536
- - Linux x64: `xdocs-linux-x64`
555
+ - Linux x64: `xdocs-linux-x64-baseline`, `xdocs-linux-x64`, `xdocs-linux-x64-modern`
537
556
  - Linux arm64: `xdocs-linux-arm64`
538
- - macOS x64: `xdocs-macos-x64`
557
+ - macOS x64: `xdocs-macos-x64-baseline`, `xdocs-macos-x64`, `xdocs-macos-x64-modern`
539
558
  - macOS arm64: `xdocs-macos-arm64`
540
- - Windows x64: `xdocs-windows-x64.exe`
541
-
542
- 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.
543
-
544
- 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.
559
+ - Windows x64: `xdocs-windows-x64-baseline.exe`, `xdocs-windows-x64.exe`, `xdocs-windows-x64-modern.exe`
560
+ - Windows arm64: `xdocs-windows-arm64.exe`
561
+
562
+ `bun run binaries` verifies that all 12 expected native assets are present and
563
+ non-empty after compilation. CI builds the matrix and uploads `bin/xdocs-*` as a
564
+ GitHub Actions artifact. The tag publish workflow has `contents: write`, rebuilds
565
+ the same matrix, uploads it as a workflow artifact, publishes `bin/xdocs-*` to
566
+ the matching GitHub Release before npm publishing, and verifies that the release
567
+ contains exactly 12 `xdocs-*` assets.
568
+
569
+ Unsupported platforms should use a documented manual path: install Bun and run
570
+ from source, or download a compatible release asset manually.
571
+
572
+ The package-manager install path ships `scripts/xdocs-bin.ts` as the package
573
+ `bin`. That launcher delegates to `vendor/xdocs` or `vendor/xdocs.exe` when the
574
+ native binary exists. In source checkouts, it falls back to
575
+ `source/guiho-xdocs-bin.ts` so local package execution tests the checked-out
576
+ source without downloading a release artifact. In published package layouts, it
577
+ calls `scripts/install-package.ts` during first run if the vendor binary is
578
+ missing. The install helper downloads the matching GitHub Release asset, or
579
+ copies a bundled asset when present. The native binary entrypoint embeds prompt
580
+ templates, the `guiho-s-xdocs` skill, and package version metadata before
581
+ importing the CLI, so installed binaries do not need adjacent prompt or skill
582
+ files at runtime.
545
583
 
546
584
  ## Documentation Requirement Before Publishing
547
585
 
package/README.md CHANGED
@@ -2,15 +2,13 @@
2
2
 
3
3
  **Structured documentation system for codebases. Helps AI make sense of projects.**
4
4
 
5
- **npm package:** [@guiho/xdocs](https://www.npmjs.com/package/@guiho/xdocs)
6
-
7
- xdocs is a CLI and TypeScript library that places named `*.xdocs.md` descriptors throughout your project so that AI agents (and humans) can navigate, understand, and work within a codebase without reading every file. Each descriptor describes the directory it lives in -- its purpose, searchable keywords, its files, its companion Markdown documents, and how it fits into the project hierarchy.
5
+ xdocs is a CLI tool that places named `*.xdocs.md` descriptors throughout your project so that AI agents (and humans) can navigate, understand, and work within a codebase without reading every file. Each descriptor describes the directory it lives in -- its purpose, searchable keywords, its files, its companion Markdown documents, and how it fits into the project hierarchy.
8
6
 
9
7
  ```text
10
8
  codebase -> named *.xdocs.md descriptors + companion *.md documents -> AI understands the project
11
9
  ```
12
10
 
13
- xdocs ships as compiled native binaries, a thin Bun launcher for package-manager and `bunx` execution, and a fully-typed TypeScript library.
11
+ xdocs ships as a single native binary no Node.js, Bun, or runtime required.
14
12
 
15
13
  ---
16
14
 
@@ -18,27 +16,74 @@ xdocs ships as compiled native binaries, a thin Bun launcher for package-manager
18
16
 
19
17
  ### Installation
20
18
 
21
- Direct native binary install (no Node.js or Bun required after installation):
19
+ Download and run the installer:
20
+
21
+ **Linux / macOS:**
22
+ ```bash
23
+ curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh | bash
24
+ ```
25
+
26
+ **Windows (PowerShell):**
27
+ ```powershell
28
+ irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1 | iex
29
+ ```
30
+
31
+ The installers download native binaries from GitHub Releases, install `xdocs` into `~/.local/bin` by default, and add that directory to your user PATH when possible. x64 installs prefer the `baseline` variant first for maximum compatibility, then fall back to the default and `modern` variants.
32
+
33
+ **Flags and options:**
22
34
 
23
35
  ```bash
24
- curl -fsSL https://raw.githubusercontent.com/CGuiho/xdocs/main/install.sh | sh
36
+ # Pin a specific version
37
+ curl .../install.sh | bash -s -- --version 0.4.7
38
+
39
+ # Force architecture and variant
40
+ curl .../install.sh | bash -s -- --arch arm64
41
+ curl .../install.sh | bash -s -- --arch x64 --variant modern
42
+ curl .../install.sh | bash -s -- --arch x64 --variant default
43
+
44
+ # Custom install directory
45
+ curl .../install.sh | bash -s -- --install-dir /usr/local/bin
25
46
  ```
26
47
 
48
+ PowerShell examples:
49
+
27
50
  ```powershell
28
- irm https://raw.githubusercontent.com/CGuiho/xdocs/main/install.ps1 | iex
51
+ & ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -Version 0.4.7
52
+ & ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -Arch x64 -Variant baseline
53
+ & ([scriptblock]::Create((irm https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.ps1))) -InstallDir "$HOME\.local\bin"
54
+ ```
55
+
56
+ Or download the script first and run with flags directly:
57
+ ```bash
58
+ curl -O https://raw.githubusercontent.com/CGuiho/xdocs/main/devops/install.sh
59
+ chmod +x install.sh
60
+ ./install.sh --version latest --arch x64 --variant baseline
29
61
  ```
30
62
 
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.
63
+ Native binaries are built and uploaded for all supported OS/architecture/variant combinations:
32
64
 
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):
65
+ | OS | ARM64 | x64 baseline | x64 default | x64 modern |
66
+ | --- | --- | --- | --- | --- |
67
+ | Linux | `xdocs-linux-arm64` | `xdocs-linux-x64-baseline` | `xdocs-linux-x64` | `xdocs-linux-x64-modern` |
68
+ | macOS | `xdocs-macos-arm64` | `xdocs-macos-x64-baseline` | `xdocs-macos-x64` | `xdocs-macos-x64-modern` |
69
+ | Windows | `xdocs-windows-arm64.exe` | `xdocs-windows-x64-baseline.exe` | `xdocs-windows-x64.exe` | `xdocs-windows-x64-modern.exe` |
70
+
71
+ CI builds the same 12 native binaries and uploads them as a GitHub Actions artifact. Version-tag releases upload `bin/xdocs-*` to the matching GitHub Release and verify that all 12 assets are present.
72
+
73
+ If your current shell does not see the updated PATH immediately, open a new terminal or run one of these commands:
34
74
 
35
75
  ```bash
36
- npm install -D @guiho/xdocs
37
- # or
38
- bun add -d @guiho/xdocs
76
+ # bash/zsh
77
+ export PATH="$HOME/.local/bin:$PATH"
78
+
79
+ # fish
80
+ fish_add_path "$HOME/.local/bin"
39
81
  ```
40
82
 
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.
83
+ ```powershell
84
+ $env:Path = "$HOME\.local\bin;$env:Path"
85
+ [Environment]::SetEnvironmentVariable('Path', "$HOME\.local\bin;" + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')
86
+ ```
42
87
 
43
88
  ### Initializing
44
89
 
@@ -404,10 +449,9 @@ console.log(prompt?.body)
404
449
 
405
450
  ## Development
406
451
 
407
- Development requires Bun. Run from the `xdocs/` directory:
452
+ Development requires Bun. Run from the repository root:
408
453
 
409
454
  ```bash
410
- cd xdocs
411
455
  bun install
412
456
  bun run typecheck
413
457
  bun test
@@ -419,4 +463,4 @@ bun run binary
419
463
 
420
464
  ## License
421
465
 
422
- MIT -- see [LICENSE.md](xdocs/LICENSE.md).
466
+ MIT -- see [LICENSE.md](LICENSE.md).
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: Package Launcher Source Fallback
3
+ purpose: Record the immediate repair decisions for broken xdocs package execution after the package moved to the repository root.
4
+ description: Explains why the package launcher now falls back to the TypeScript CLI in source checkouts and why root package metadata/docs were corrected together.
5
+ created: 2026-07-09T18:38:18Z
6
+ flags:
7
+ - decision
8
+ tags:
9
+ - cli
10
+ - package
11
+ - documentation
12
+ keywords:
13
+ - xdocs-bin
14
+ - source checkout
15
+ - native binary
16
+ - vendor
17
+ - package root
18
+ - mirror.config.toml
19
+ ---
20
+
21
+ # Package Launcher Source Fallback
22
+
23
+ ## Summary
24
+
25
+ xdocs failed when the package launcher was executed from a source checkout with no
26
+ `vendor/xdocs` native binary. `scripts/install-package.ts` correctly skips native
27
+ binary download when `source/guiho-xdocs-bin.ts` exists, but
28
+ `scripts/xdocs-bin.ts` still expected the vendor binary to appear and exited with
29
+ an error.
30
+
31
+ The selected fix is to make the package launcher prefer the native vendor binary
32
+ when it exists, fall back to the TypeScript CLI when running from a source
33
+ checkout, and only invoke the installer for published package layouts where the
34
+ source entrypoint is absent.
35
+
36
+ ## Decisions
37
+
38
+ 1. Preserve native-binary-first execution for installed packages. Published npm
39
+ installs and `bunx` executions should still delegate to `vendor/xdocs` or
40
+ `vendor/xdocs.exe` after postinstall or first-run installation.
41
+ 2. Treat `source/guiho-xdocs-bin.ts` as the source-checkout fallback. This keeps
42
+ local development and repository-root package execution working without
43
+ downloading a release artifact.
44
+ 3. Keep package-root metadata consistent with the current layout. The package now
45
+ lives at the repository root, so `repository.directory`, `mirror.config.toml`,
46
+ `AGENTS.md`, `XDOCS.md`, and the root xdocs descriptor must not point at a
47
+ nested `xdocs/` package directory.
48
+
49
+ ## Rejected Alternatives
50
+
51
+ 1. Always download a native binary, even in source checkouts. This would make
52
+ development depend on an already-published release and would not test the
53
+ local TypeScript source being edited.
54
+ 2. Run `install-package.ts` first and infer its skip result from output. That
55
+ keeps the broken control flow indirect and noisy for normal source-checkout
56
+ commands.
57
+ 3. Remove the native launcher path entirely. That would regress the intended
58
+ CLI-only distribution where users can run the compiled binary without Node.js
59
+ or Bun at runtime after installation.
60
+
61
+ ## Validation
62
+
63
+ The repair is validated by a regression test that executes
64
+ `bun run scripts/xdocs-bin.ts --version` from the source checkout and asserts that
65
+ it exits successfully without reporting a missing native binary.
@@ -0,0 +1,22 @@
1
+ ---
2
+ subject: xdocs-decisions
3
+ description: Decision records for xdocs implementation and operational repairs.
4
+ parent: xdocs-docs
5
+ children: []
6
+ files: {}
7
+ documents:
8
+ 2026-07-09-package-launcher-source-fallback.md: Records the decision to make the package launcher fall back to the TypeScript CLI in source checkouts while published installs keep using native binaries.
9
+ tags:
10
+ - documentation
11
+ - decisions
12
+ keywords:
13
+ - decisions
14
+ - launcher
15
+ - source checkout
16
+ flags: []
17
+ status: stable
18
+ ---
19
+
20
+ The `docs/decisions/` directory stores point-in-time technical decisions for
21
+ xdocs. Each decision document captures context, selected behavior, rejected
22
+ alternatives, and validation evidence for future agents and maintainers.
@@ -2,7 +2,8 @@
2
2
  subject: xdocs-docs
3
3
  description: Durable project documentation for xdocs behavior, design notes, and implementation context.
4
4
  parent: xdocs-package
5
- children: []
5
+ children:
6
+ - xdocs-decisions
6
7
  files: {}
7
8
  documents:
8
9
  2026-07-05-xdocs-document-model.md: Defines the named descriptor plus companion Markdown document model for xdocs modules.
@@ -17,6 +18,6 @@ flags: []
17
18
  status: stable
18
19
  ---
19
20
 
20
- The `docs/` directory stores durable xdocs project notes. Each plain Markdown
21
- document in this directory is listed in `documents` so agents can find the note
22
- from descriptor metadata before opening the full document.
21
+ The `docs/` directory stores durable xdocs project notes. Plain Markdown
22
+ documents directly in this directory are listed in `documents`; categorized
23
+ subdirectories such as `decisions/` have their own xdocs descriptors.
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiho/xdocs",
3
- "version": "0.4.0-alpha.0",
3
+ "version": "0.4.9",
4
4
  "exports": "./source/guiho-xdocs.ts",
5
5
  "publish": {
6
6
  "include": [
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env bun
2
2
  /**
3
3
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
4
4
  */
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env bun
2
2
  /**
3
3
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
4
4
  */
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.4.2",
4
+ "version": "0.4.9",
5
5
  "type": "module",
6
6
  "main": "./library/guiho-xdocs.js",
7
7
  "types": "./library/guiho-xdocs.d.ts",
@@ -66,8 +66,7 @@
66
66
  },
67
67
  "repository": {
68
68
  "type": "git",
69
- "url": "git+https://github.com/CGuiho/xdocs.git",
70
- "directory": "xdocs"
69
+ "url": "git+https://github.com/CGuiho/xdocs.git"
71
70
  },
72
71
  "homepage": "https://github.com/CGuiho/xdocs#readme",
73
72
  "bugs": {
@@ -23,33 +23,47 @@ if (await sourceEntrypoint.exists()) {
23
23
 
24
24
  const version = process.env['XDOCS_VERSION'] ?? packageJson.version ?? 'latest'
25
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))
26
+ const candidates = detectAssetCandidates()
28
27
  const destination = new URL(`../vendor/xdocs${process.platform === 'win32' ? '.exe' : ''}`, import.meta.url)
29
28
 
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)
29
+ for (const asset of candidates) {
30
+ const bundledAsset = Bun.file(new URL(`../bin/${asset}`, import.meta.url))
31
+
32
+ if (await bundledAsset.exists()) {
33
+ await Bun.write(destination, bundledAsset)
34
+ await makeExecutable(destination)
35
+ console.log(`installed bundled xdocs native binary: ${asset}`)
36
+ process.exit(0)
37
+ }
35
38
  }
36
39
 
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}`
40
+ for (const asset of candidates) {
41
+ const tag = version === 'latest' ? 'latest' : `@guiho/xdocs@${version}`
42
+ const url = tag === 'latest'
43
+ ? `https://github.com/${repo}/releases/latest/download/${asset}`
44
+ : `https://github.com/${repo}/releases/download/${encodeURIComponent(tag)}/${asset}`
41
45
 
42
- const response = await fetch(url)
46
+ console.log(` Downloading ${asset} from GitHub Releases...`)
47
+ const response = await fetch(url)
43
48
 
44
- if (!response.ok) {
45
- console.error(`error: failed to download ${url}`)
46
- console.error(`status: ${response.status} ${response.statusText}`)
47
- process.exit(1)
49
+ if (!response.ok) {
50
+ if (candidates.length > 1 && asset !== candidates[candidates.length - 1]) {
51
+ console.log(` ${asset} not available (${response.status}), trying next variant...`)
52
+ continue
53
+ }
54
+ console.error(`error: failed to download ${url}`)
55
+ console.error(`status: ${response.status} ${response.statusText}`)
56
+ process.exit(1)
57
+ }
58
+
59
+ await Bun.write(destination, response)
60
+ await makeExecutable(destination)
61
+ console.log(`installed xdocs native binary: ${asset}`)
62
+ process.exit(0)
48
63
  }
49
64
 
50
- await Bun.write(destination, response)
51
- await makeExecutable(destination)
52
- console.log(`installed xdocs native binary: ${asset}`)
65
+ console.error('error: no compatible xdocs binary found for this platform')
66
+ process.exit(1)
53
67
 
54
68
  async function makeExecutable(path: URL) {
55
69
  if (process.platform === 'win32') return
@@ -66,10 +80,16 @@ async function makeExecutable(path: URL) {
66
80
  }
67
81
  }
68
82
 
69
- function detectAsset() {
83
+ function detectAssetCandidates() {
70
84
  const os = detectOs()
71
85
  const arch = detectArch()
72
- return `xdocs-${os}-${arch}${os === 'windows' ? '.exe' : ''}`
86
+ const ext = os === 'windows' ? '.exe' : ''
87
+
88
+ if (arch === 'x64') {
89
+ return [`xdocs-${os}-x64-baseline${ext}`, `xdocs-${os}-x64${ext}`, `xdocs-${os}-x64-modern${ext}`]
90
+ }
91
+
92
+ return [`xdocs-${os}-${arch}${ext}`]
73
93
  }
74
94
 
75
95
  function detectOs() {
@@ -85,4 +105,4 @@ function detectArch() {
85
105
  if (process.arch === 'arm64') return 'arm64'
86
106
  console.error(`error: unsupported architecture: ${process.arch}`)
87
107
  process.exit(1)
88
- }
108
+ }
@@ -4,7 +4,7 @@ description: Package-manager launcher and installation scripts for executing the
4
4
  parent: xdocs-package
5
5
  children: []
6
6
  files:
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.
7
+ xdocs-bin.ts: Shipped Bun launcher used as the package bin; delegates to an installed native binary, falls back to the TypeScript CLI in source checkouts, and installs the native binary on first run for published packages.
8
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.
9
9
  documents: {}
10
10
  tags:
@@ -21,5 +21,7 @@ status: stable
21
21
 
22
22
  The `scripts/` directory contains the package-manager launcher and install
23
23
  helper. Package-manager and `bunx` execution start in `xdocs-bin.ts`; if the
24
- native binary is missing, it runs `install-package.ts` and then delegates to the
25
- downloaded binary in `vendor/`. Direct installers remain the no-Bun runtime path.
24
+ native binary is missing in a published package, it runs `install-package.ts` and
25
+ then delegates to the downloaded binary in `vendor/`. Source checkouts run the
26
+ TypeScript CLI directly when no vendor binary exists. Direct installers remain
27
+ the no-Bun runtime path.
@@ -6,10 +6,24 @@
6
6
  */
7
7
 
8
8
  const binaryPath = new URL(`../vendor/xdocs${process.platform === 'win32' ? '.exe' : ''}`, import.meta.url)
9
+ const sourceEntrypointPath = new URL('../source/guiho-xdocs-bin.ts', import.meta.url)
9
10
  const executablePath = Bun.fileURLToPath(binaryPath)
10
11
  const binary = Bun.file(binaryPath)
12
+ const args = process.argv.slice(2)
11
13
 
12
14
  if (!(await binary.exists())) {
15
+ const sourceEntrypoint = Bun.file(sourceEntrypointPath)
16
+
17
+ if (await sourceEntrypoint.exists()) {
18
+ const proc = Bun.spawn([process.execPath, Bun.fileURLToPath(sourceEntrypointPath), ...args], {
19
+ stdin: 'inherit',
20
+ stdout: 'inherit',
21
+ stderr: 'inherit',
22
+ })
23
+
24
+ process.exit(await proc.exited)
25
+ }
26
+
13
27
  const installerPath = new URL('install-package.ts', import.meta.url)
14
28
  const proc = Bun.spawn([process.execPath, Bun.fileURLToPath(installerPath)], {
15
29
  stdin: 'inherit',
@@ -24,10 +38,10 @@ if (!(await binary.exists())) {
24
38
  }
25
39
  }
26
40
 
27
- const proc = Bun.spawn([executablePath, ...process.argv.slice(2)], {
41
+ const proc = Bun.spawn([executablePath, ...args], {
28
42
  stdin: 'inherit',
29
43
  stdout: 'inherit',
30
44
  stderr: 'inherit',
31
45
  })
32
46
 
33
- process.exit(await proc.exited)
47
+ process.exit(await proc.exited)