@guiho/runx 0.2.7 → 0.4.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/DOCS.md +127 -128
  3. package/README.md +56 -75
  4. package/devops/build-binaries.ts +44 -62
  5. package/devops/devops.xdocs.md +8 -5
  6. package/devops/install.ps1 +182 -152
  7. package/devops/install.sh +197 -262
  8. package/devops/installers.spec.ts +31 -0
  9. package/devops/verify-release-assets.ts +17 -0
  10. package/docs/docs.xdocs.md +3 -1
  11. package/docs/plans/plans.xdocs.md +7 -0
  12. package/docs/plans/rfc-0034-cli-compliance-migration.md +586 -0
  13. package/docs/plans/upgrade-reliability-implementation.md +95 -0
  14. package/docs/reviews/implementation/implementation.xdocs.md +2 -0
  15. package/docs/reviews/implementation/rfc-0034-cli-compliance-migration-review.md +69 -0
  16. package/docs/reviews/plans/plans.xdocs.md +6 -0
  17. package/docs/reviews/plans/rfc-0034-cli-compliance-migration-review.md +80 -0
  18. package/docs/reviews/plans/upgrade-reliability-implementation-review.md +65 -0
  19. package/docs/superpowers/specs/2026-07-15-upgrade-reliability-design.md +662 -0
  20. package/docs/superpowers/specs/specs.xdocs.md +24 -0
  21. package/docs/superpowers/superpowers.xdocs.md +21 -0
  22. package/docs/todo/rfc-0034-cli-compliance-migration-implementation.md +77 -0
  23. package/docs/todo/rfc-0034-cli-compliance-migration.md +152 -0
  24. package/docs/todo/todo.xdocs.md +6 -2
  25. package/docs/validation/rfc-0034-cli-compliance-migration.md +83 -0
  26. package/docs/validation/upgrade-reliability.md +124 -0
  27. package/docs/validation/validation.xdocs.md +5 -0
  28. package/library/agents.d.ts +29 -4
  29. package/library/agents.d.ts.map +1 -1
  30. package/library/agents.js +143 -41
  31. package/library/cli.d.ts.map +1 -1
  32. package/library/cli.js +311 -331
  33. package/library/configuration.d.ts +57 -0
  34. package/library/configuration.d.ts.map +1 -0
  35. package/library/configuration.js +111 -0
  36. package/library/embedded-resources.d.ts +6 -1
  37. package/library/embedded-resources.d.ts.map +1 -1
  38. package/library/embedded-resources.js +10 -4
  39. package/library/executor.d.ts +5 -1
  40. package/library/executor.d.ts.map +1 -1
  41. package/library/executor.js +10 -10
  42. package/library/help.d.ts +8 -4
  43. package/library/help.d.ts.map +1 -1
  44. package/library/help.js +70 -46
  45. package/library/init.d.ts +8 -27
  46. package/library/init.d.ts.map +1 -1
  47. package/library/init.js +37 -159
  48. package/library/manifest.d.ts +4 -43
  49. package/library/manifest.d.ts.map +1 -1
  50. package/library/manifest.js +4 -125
  51. package/library/path-utils.d.ts +13 -0
  52. package/library/path-utils.d.ts.map +1 -0
  53. package/library/path-utils.js +82 -0
  54. package/library/recovery.d.ts +7 -0
  55. package/library/recovery.d.ts.map +1 -0
  56. package/library/recovery.js +23 -0
  57. package/library/release-catalog.d.ts +32 -0
  58. package/library/release-catalog.d.ts.map +1 -0
  59. package/library/release-catalog.js +124 -0
  60. package/library/self-management.d.ts +24 -4
  61. package/library/self-management.d.ts.map +1 -1
  62. package/library/self-management.js +279 -99
  63. package/library/storage.d.ts +13 -0
  64. package/library/storage.d.ts.map +1 -0
  65. package/library/storage.js +38 -0
  66. package/library/types.d.ts +11 -16
  67. package/library/types.d.ts.map +1 -1
  68. package/library/types.js +3 -0
  69. package/library/update-cache.d.ts +21 -0
  70. package/library/update-cache.d.ts.map +1 -0
  71. package/library/update-cache.js +68 -0
  72. package/library/upgrade-reporting.d.ts +11 -0
  73. package/library/upgrade-reporting.d.ts.map +1 -0
  74. package/library/upgrade-reporting.js +67 -0
  75. package/library/upgrade-types.d.ts +72 -0
  76. package/library/upgrade-types.d.ts.map +1 -0
  77. package/library/upgrade-types.js +3 -0
  78. package/package.json +6 -3
  79. package/scripts/runx-bin.mjs +49 -0
  80. package/scripts/runx-bin.spec.ts +62 -0
  81. package/scripts/scripts.xdocs.md +3 -3
  82. package/skills/guiho-s-runx/SKILL.md +64 -59
  83. package/skills/guiho-s-runx/guiho-s-runx.xdocs.md +7 -4
  84. package/skills/skills.xdocs.md +1 -1
  85. package/docs/todo/implement-runx-alpha.md +0 -36
  86. package/scripts/runx-bin.ts +0 -24
@@ -0,0 +1,586 @@
1
+ ---
2
+ name: RunX RFC 0034 CLI Compliance Migration Plan
3
+ purpose: Provide an executable, breaking-change migration plan that brings the RunX CLI into complete compliance with GUIHO RFC 0034.
4
+ description: Defines the final command catalog, Bun-only runtime migration, TypeBox validation, YAML configuration, startup lifecycle, Developer Context help, agent integration, upgrades, installers, npm bootstrap, release assets, documentation, and verification.
5
+ created: 2026-07-18
6
+ flags:
7
+ - approved
8
+ - breaking-change
9
+ - implementation-ready
10
+ - implemented
11
+ tags:
12
+ - planning
13
+ - cli
14
+ - migration
15
+ - rfc-0034
16
+ keywords:
17
+ - runx
18
+ - guiho-s-0034-cli-engineer
19
+ - Bun
20
+ - Citty
21
+ - TypeBox
22
+ - runx.yaml
23
+ - agent namespace
24
+ - fourteen release assets
25
+ owner: runx-plans
26
+ ---
27
+
28
+ # RunX RFC 0034 CLI Compliance Migration Plan
29
+
30
+ ## Outcome
31
+
32
+ Migrate `@guiho/runx` from its current partial RFC implementation to the complete
33
+ GUIHO RFC 0034 CLI contract. The migration is intentionally breaking. RunX is
34
+ pre-1.0, and the developer has approved removing aliases, compatibility
35
+ shorthands, legacy configuration discovery, legacy asset names, legacy agent
36
+ commands, and any other interface that conflicts with RFC 0034.
37
+
38
+ The completed CLI must use Bun, strict ESM TypeScript, raw Citty, and TypeBox;
39
+ contain no prohibited Node built-ins in core CLI source; expose the exact
40
+ Developer Context and agent command contracts; use the standardized startup and
41
+ storage lifecycle; and publish exactly fourteen release assets.
42
+
43
+ ## Authority And Required Execution Roles
44
+
45
+ Every implementation session must load and follow:
46
+
47
+ - Agent: `guiho-a-0001-swe`, the GUIHO Software Engineer/SWE coordinator at
48
+ `C:\GUIHO\superiority\agents\guiho-a-0001-swe.AGENTS.md`.
49
+ - Mandatory specialist skill: `guiho-s-0034-cli-engineer`.
50
+ - Implementation controller: `guiho-s-0023-plan-executor`.
51
+ - Runtime and language skills: `guiho-s-0015-bun` and
52
+ `guiho-s-0019-typescript`.
53
+ - Runtime-contract skill: `guiho-s-0011-typebox`.
54
+ - Documentation skills: `guiho-s-0016-writing-docs`,
55
+ `guiho-s-0017-todo`, and `guiho-s-xdocs`.
56
+ - Release skills: `guiho-s-mirror` and, when GitHub release automation changes,
57
+ `guiho-s-0020-cloud-computing`.
58
+ - Review and validation skills: `guiho-s-0029-implementation-reviewer` and
59
+ `guiho-s-0030-validation-reporter`.
60
+
61
+ `guiho-s-0034-cli-engineer` is a skill, not an agent. The SWE agent coordinates
62
+ the work and the CLI engineer skill supplies the mandatory CLI contract.
63
+
64
+ ## Approved Breaking-Change Boundary
65
+
66
+ The implementation must prefer a clean RFC 0034 design over compatibility.
67
+ Specifically:
68
+
69
+ - Remove the `runx r` command alias.
70
+ - Remove the root `runx <selector>` compatibility shorthand.
71
+ - Replace `--file` with RFC configuration selection through `--config`.
72
+ - Stop searching parent directories for `runx.yaml`.
73
+ - Replace `runx agents ...` with the singular RFC `runx agent ...` namespace.
74
+ - Remove `--tool agents|claude|all` and positional `local|global` installation
75
+ syntax in favor of global-by-default operations and `--local`.
76
+ - Replace `macos` release asset names with `darwin`.
77
+ - Replace the Bun-dependent npm launcher with a Node-compatible native-binary
78
+ bootstrap.
79
+ - Do not add deprecated aliases, compatibility adapters, dual configuration
80
+ loaders, dual release names, or migration warnings that keep the old contract
81
+ alive.
82
+
83
+ The RunX manifest remains YAML and keeps its command-catalog domain purpose.
84
+ Its schema may change where necessary to satisfy strict TypeBox decoding, but
85
+ the plan does not add workflow graphs, remote execution, or secret management.
86
+
87
+ ## Final Public Command Catalog
88
+
89
+ The final Citty tree must be:
90
+
91
+ ```text
92
+ runx
93
+ ├── list
94
+ ├── describe <selector>
95
+ ├── run <selector>
96
+ ├── check
97
+ ├── init
98
+ ├── agent
99
+ │ ├── skill
100
+ │ │ ├── install
101
+ │ │ ├── uninstall
102
+ │ │ ├── update
103
+ │ │ ├── list
104
+ │ │ └── show <id>
105
+ │ ├── instruction
106
+ │ │ ├── apply
107
+ │ │ ├── remove
108
+ │ │ ├── update
109
+ │ │ └── show
110
+ │ └── prompt
111
+ │ ├── list
112
+ │ └── show <id>
113
+ ├── upgrade
114
+ │ ├── check
115
+ │ └── list
116
+ └── uninstall
117
+ ```
118
+
119
+ Rules:
120
+
121
+ - Citty is the only parser and router.
122
+ - Only `-h` for `--help` and root `-v` for `--version` exist.
123
+ - Every command and subcommand supports `--help`, `-h`, `--help-tree`,
124
+ `--help-tree-depth <positive-integer>`, and `--help-docs`.
125
+ - Domain flags remain descriptive long kebab-case flags, including
126
+ `--dry-run`, `--yes`, `--format`, `--cwd`, and `--config` where applicable.
127
+ - `runx run` is the only execution path. Inspection, help, configuration,
128
+ agent, upgrade, and dry-run paths must not execute manifest commands.
129
+
130
+ ## Skill Routing By Unit
131
+
132
+ | Units | Required skills |
133
+ | --- | --- |
134
+ | RX-01 | `guiho-a-0001-swe`, `guiho-s-0023-plan-executor`, `guiho-s-0034-cli-engineer` |
135
+ | RX-02-RX-03 | Add `guiho-s-0015-bun`, `guiho-s-0019-typescript`, and `guiho-s-xdocs` |
136
+ | RX-04-RX-05 | Add `guiho-s-0011-typebox`; keep Bun, TypeScript, CLI engineer, and xdocs loaded |
137
+ | RX-06-RX-10 | Keep CLI engineer, Bun, TypeScript, TypeBox, and xdocs loaded |
138
+ | RX-11-RX-14 | Add `guiho-s-0020-cloud-computing` for release hosting/CI; use `guiho-s-mirror` only for release configuration inspection, not version application |
139
+ | RX-15 | Add `guiho-s-0016-writing-docs` and `guiho-s-0017-todo` |
140
+ | RX-16 | Add `guiho-s-0029-implementation-reviewer` and `guiho-s-0030-validation-reporter` |
141
+
142
+ Every row also inherits the SWE agent and plan executor. Reload a skill in a new
143
+ execution session rather than assuming it remains active from an earlier unit.
144
+
145
+ ## Execution Sequence
146
+
147
+ ### Unit RX-01 - Freeze The Baseline And Create The Migration Ledger
148
+
149
+ - Goal: capture the current public behavior, test baseline, file inventory, and
150
+ known RFC violations before source changes begin.
151
+ - Owner: RunX repository root.
152
+ - Dependencies: none.
153
+ - Read first:
154
+ - `AGENTS.md`
155
+ - `TODO.md`
156
+ - this plan and its linked task specification
157
+ - `package.json`, `bun.lock`, `tsconfig.json`
158
+ - `source/cli.ts`, `source/help.ts`, `source/agents.ts`,
159
+ `source/manifest.ts`, `source/self-management.ts`
160
+ - entrypoints, launchers, installers, binary builder, workflows, bundled
161
+ skill, descriptors, README, and DOCS.
162
+ - Actions:
163
+ 1. Confirm `main`, record `git status --short`, and preserve unrelated work.
164
+ 2. Run the current typecheck and tests.
165
+ 3. Record current command/output snapshots for root, every command, agent
166
+ operations, upgrade operations, and invalid input.
167
+ 4. Search `source/` for prohibited Node imports and save the exact result in
168
+ implementation notes.
169
+ 5. Inventory current release filenames and current GitHub upload globs.
170
+ - Acceptance:
171
+ - Baseline successes and existing failures are distinguishable from migration
172
+ regressions.
173
+ - No source or generated output changes occur in this unit.
174
+ - Stop conditions:
175
+ - Stop if the worktree contains overlapping unexplained changes.
176
+
177
+ ### Unit RX-02 - Normalize The Project Layout And Dependencies
178
+
179
+ - Goal: establish the RFC module boundaries and mandatory dependencies without
180
+ changing domain behavior.
181
+ - Dependencies: RX-01.
182
+ - Expected files:
183
+ - `package.json`, `bun.lock`, `tsconfig.json`
184
+ - `source/commands/agent.ts`
185
+ - `source/commands/catalog.ts`
186
+ - `source/commands/upgrade.ts`
187
+ - `source/configuration.ts`
188
+ - `source/storage.ts`
189
+ - `source/update-cache.ts`
190
+ - `source/output.ts`
191
+ - existing source modules moved only when ownership becomes clearer
192
+ - affected `*.xdocs.md` descriptors.
193
+ - Actions:
194
+ 1. Keep `citty` and `@sinclair/typebox` as runtime dependencies.
195
+ 2. Keep strict ESM TypeScript and Bun types.
196
+ 3. Separate platform behavior from RunX catalog behavior.
197
+ 4. Keep `source/cli.ts` responsible for assembling and running one command
198
+ tree, not domain implementation.
199
+ 5. Keep entrypoints thin and make the hidden worker test-callable.
200
+ 6. Update source descriptors for every new, moved, or removed module.
201
+ - Acceptance:
202
+ - The final ownership of CLI, catalog, configuration, storage, help, agents,
203
+ upgrades, output, and errors is explicit.
204
+ - No duplicated parser or router exists.
205
+
206
+ ### Unit RX-03 - Remove Prohibited Node Built-ins From Core Source
207
+
208
+ - Goal: make core RunX Bun-only.
209
+ - Dependencies: RX-02.
210
+ - Expected files:
211
+ - `source/agents.ts`
212
+ - `source/cli.ts`
213
+ - `source/executor.ts`
214
+ - `source/init.ts`
215
+ - `source/manifest.ts`
216
+ - `source/self-management.ts`
217
+ - new Bun-first path/storage modules.
218
+ - Actions:
219
+ 1. Replace `node:fs` and `node:fs/promises` operations with `Bun.file`,
220
+ `Bun.write`, and approved Bun-native filesystem operations.
221
+ 2. Replace `node:path` joins/resolution with URL-based resource paths and a
222
+ narrow platform-aware path utility.
223
+ 3. Resolve home from `Bun.env.HOME` or `Bun.env.USERPROFILE`; fail clearly
224
+ when neither exists.
225
+ 4. Keep subprocesses on `Bun.spawn`/`Bun.spawnSync`.
226
+ 5. Permit Node imports only in the isolated npm bootstrap wrapper.
227
+ 6. Add a static test that fails when prohibited imports appear in core
228
+ source.
229
+ - Acceptance:
230
+ - Static search finds no `node:fs`, `node:fs/promises`,
231
+ `node:child_process`, `node:path`, or `node:os` in core CLI source.
232
+ - RunX catalog reads and executions still work on Windows, Linux, and Darwin
233
+ path forms.
234
+
235
+ ### Unit RX-04 - Implement The Exact YAML Configuration Contract
236
+
237
+ - Goal: make `runx.yaml` the schema-backed RFC configuration.
238
+ - Dependencies: RX-03.
239
+ - Expected files:
240
+ - `source/configuration.ts`
241
+ - `source/manifest.ts`
242
+ - `source/types.ts`
243
+ - `source/init.ts`
244
+ - CLI adapters and tests.
245
+ - Resolution order:
246
+ 1. `--config <path>`
247
+ 2. `<effective-cwd>/runx.yaml`
248
+ 3. `~/.guiho/runx/runx.yaml`
249
+ - Actions:
250
+ 1. Remove `--file`.
251
+ 2. Remove upward parent-directory discovery.
252
+ 3. Resolve `--cwd` first, then apply the exact configuration precedence.
253
+ 4. Parse with `Bun.YAML.parse`.
254
+ 5. Decode the complete manifest with TypeBox.
255
+ 6. Print `configuration file loaded: <absolute-path>` whenever a manifest is
256
+ loaded.
257
+ 7. Make `runx init` create the selected/effective `runx.yaml` and never create
258
+ TOML or JSON configuration.
259
+ 8. Reject missing, malformed, or schema-invalid input with exit code `3`.
260
+ - Acceptance:
261
+ - Precedence, absolute-path reporting, invalid YAML, invalid schema, and
262
+ absent-config behavior have focused tests.
263
+ - No fallback silently changes an invalid object.
264
+
265
+ ### Unit RX-05 - Expand TypeBox To Every Structured Boundary
266
+
267
+ - Goal: use TypeBox for all untrusted or structured runtime input, not only the
268
+ manifest.
269
+ - Dependencies: RX-04.
270
+ - Schemas:
271
+ - RunX manifest and nested command/group records.
272
+ - cached update object.
273
+ - GitHub release and asset API responses.
274
+ - release catalog entries and upgrade selections.
275
+ - enum-like flags such as format, architecture, and variant.
276
+ - positive integers such as help depth, page, and per-page.
277
+ - structured JSON output envelopes where stability matters.
278
+ - Actions:
279
+ 1. Define schemas next to the owning data boundary.
280
+ 2. Derive static types from schemas.
281
+ 3. Decode unknown values before access.
282
+ 4. Map validation failures to usage/config/remote exit codes.
283
+ - Acceptance:
284
+ - No `as` cast substitutes for runtime decoding of external data.
285
+ - Invalid cache and remote payloads cannot reach selection logic.
286
+
287
+ ### Unit RX-06 - Rebuild The Citty Tree To The Final Catalog
288
+
289
+ - Goal: remove compatibility routing and define the final command tree exactly
290
+ once.
291
+ - Dependencies: RX-05.
292
+ - Expected files: `source/cli.ts`, `source/commands/*.ts`, CLI tests.
293
+ - Actions:
294
+ 1. Remove `runx r`.
295
+ 2. Remove root selector fallback.
296
+ 3. Define every final command/subcommand with `defineCommand`.
297
+ 4. Route with Citty `runMain` or `runCommand`.
298
+ 5. Use common flag factories without pre-scanning ordinary arguments.
299
+ 6. Preserve the child process exit code for an actual `runx run`.
300
+ 7. Enforce long kebab-case flags and reject arbitrary short forms.
301
+ - Acceptance:
302
+ - Unknown commands are usage errors, never manifest selectors.
303
+ - One Citty tree owns routing, usage metadata, help traversal, and docs
304
+ traversal.
305
+
306
+ ### Unit RX-07 - Implement The Standard Startup Lifecycle
307
+
308
+ - Goal: make startup deterministic, local-first, and non-blocking.
309
+ - Dependencies: RX-05 and RX-06.
310
+ - Exact sequence:
311
+ 1. Read and TypeBox-decode `~/.guiho/runx/cache.json` synchronously.
312
+ 2. If `newVersionAvailable` is true, print exactly
313
+ `New version available. Run this command to upgrade: runx upgrade`.
314
+ 3. Resolve, decode, and report configuration only for commands that need it.
315
+ 4. Spawn the hidden detached update worker without awaiting network work.
316
+ 5. Route the command.
317
+ 6. For no arguments, print exactly `Hello Windows - runx v<version>`.
318
+ - Actions:
319
+ - Add a recursion-safe hidden worker path.
320
+ - Validate GitHub release responses, compare SemVer, and atomically write the
321
+ cache object.
322
+ - Ignore corrupt foreground cache with verbose diagnostics and allow the
323
+ worker to replace it.
324
+ - Ensure help, version, and help-docs output are not polluted by notices or
325
+ progress when their contract requires clean redirection.
326
+ - Acceptance:
327
+ - Tests prove the foreground never calls `fetch`.
328
+ - The worker writes both update-available and up-to-date cache shapes.
329
+
330
+ ### Unit RX-08 - Generate Complete Developer Context Help
331
+
332
+ - Goal: derive all help forms from the actual Citty tree.
333
+ - Dependencies: RX-06.
334
+ - Actions:
335
+ 1. Delete the handwritten drifting command list in `source/help.ts`.
336
+ 2. Make standard help include usage, description, positionals, flags, and
337
+ practical examples.
338
+ 3. Implement `--help-tree` at every scope, beginning with `COMMAND TREE`.
339
+ 4. Render Unicode `├──`, `└──`, and `│ ` branches with flags nested under
340
+ their owning command.
341
+ 5. Implement and TypeBox-validate
342
+ `--help-tree-depth <positive-integer>`.
343
+ 6. Implement `--help-docs` as redirect-safe Markdown for the selected scope.
344
+ 7. Align description columns deterministically.
345
+ - Acceptance:
346
+ - No ASCII `|-` tree remains.
347
+ - Every root, group, and leaf has all help forms and focused snapshot tests.
348
+
349
+ ### Unit RX-09 - Replace Agent Automation With The Full RFC Namespace
350
+
351
+ - Goal: implement every required agent action against embedded, versioned
352
+ resources.
353
+ - Dependencies: RX-03, RX-05, and RX-06.
354
+ - Expected files:
355
+ - `source/commands/agent.ts`
356
+ - `source/agents.ts`
357
+ - `source/embedded-resources.ts`
358
+ - `skills/guiho-s-runx/SKILL.md`
359
+ - `prompts/guiho-i-runx.md`
360
+ - tests and descriptors.
361
+ - Skill actions:
362
+ - `install`, `update`, and `uninstall` always target both
363
+ `.agents/skills/guiho-s-runx` and `.claude/skills/guiho-s-runx`.
364
+ - Default scope is global; `--local` selects project-local scope.
365
+ - `list [--filter <keyword>]` enumerates bundled skills.
366
+ - `show <id>` prints path, description, and metadata.
367
+ - Instruction actions:
368
+ - Resolve existing `AGENTS.md`, existing `CLAUDE.md`, both when both exist,
369
+ and create `AGENTS.md` when neither exists.
370
+ - Use exact markers:
371
+ `<!-- BEGIN RUNX — DO NOT EDIT THIS SECTION -->` and
372
+ `<!-- END RUNX -->`.
373
+ - `apply` appends or replaces; `remove` removes; `update` replaces stale
374
+ content; `show` prints the raw template.
375
+ - Every action is idempotent.
376
+ - Prompt actions:
377
+ - Create `prompts/guiho-i-runx.md` as the canonical bundled RunX instruction
378
+ prompt asset.
379
+ - `list` prints names and descriptions.
380
+ - `list --names` prints names only.
381
+ - `show <id>` prints only the raw prompt body.
382
+ - Removal:
383
+ - Delete `runx agents install`, `runx agents instructions`, `--tool`, and the
384
+ old marker format.
385
+ - Acceptance:
386
+ - Tests cover global/local paths, both tool directories, zero/one/two
387
+ instruction files, repeated actions, stale content, names-only output, and
388
+ unknown IDs without touching the user's real home.
389
+
390
+ ### Unit RX-10 - Standardize Output And Exit Codes
391
+
392
+ - Goal: keep text human-readable and JSON deterministic.
393
+ - Dependencies: RX-05 through RX-09.
394
+ - Exit map:
395
+ - `0` success
396
+ - `1` unexpected operational failure
397
+ - `2` usage or TypeBox validation failure
398
+ - `3` configuration resolution/decoding failure
399
+ - `4` release/network failure
400
+ - `5` installation/upgrade/filesystem mutation failure
401
+ - `130` interruption
402
+ - Actions:
403
+ - Send ordinary results to stdout and diagnostics to stderr.
404
+ - Emit one valid JSON document for JSON mode.
405
+ - Never mix progress or ANSI decoration into JSON stdout.
406
+ - Preserve the exact delegated command exit code for `runx run`.
407
+ - Acceptance:
408
+ - CLI-level tests assert stdout, stderr, JSON parsing, and exit codes.
409
+
410
+ ### Unit RX-11 - Complete Upgrade, Catalog, And Post-Upgrade Reconciliation
411
+
412
+ - Goal: retain transactional replacement while adding the exact RFC interface.
413
+ - Dependencies: RX-05, RX-07, RX-09, and RX-10.
414
+ - `runx upgrade` flags:
415
+ - `--version <version>`
416
+ - `--arch <x64|arm64>`
417
+ - `--variant <baseline|default|modern>`
418
+ - `--dry-run`
419
+ - `--format <text|json>`
420
+ - `runx upgrade list` flags:
421
+ - `--page <positive-integer>`
422
+ - `--per-page <positive-integer>`
423
+ - `--pre-releases`
424
+ - applicable format/compatibility flags.
425
+ - Actions:
426
+ 1. Default x64 variant to `baseline`.
427
+ 2. List stable releases by default, latest first.
428
+ 3. Show real-time text progress while keeping JSON clean.
429
+ 4. Replace and verify the canonical executable transactionally.
430
+ 5. After success, update the global skill in both tool locations.
431
+ 6. When inside a project, reconcile instruction blocks.
432
+ 7. Commit the standardized cache only after verified replacement.
433
+ - Acceptance:
434
+ - Dry-run, exact version, architecture, variant, pagination,
435
+ pre-release listing, rollback, cache warning, and reconciliation tests pass.
436
+
437
+ ### Unit RX-12 - Rebuild Both Direct Installers
438
+
439
+ - Goal: make `devops/install.sh` and `devops/install.ps1` complete RFC
440
+ installers.
441
+ - Dependencies: RX-09 and RX-11.
442
+ - Actions:
443
+ 1. Select the exact `darwin`, Linux, or Windows asset.
444
+ 2. Print the required sequence heading, target version, architecture,
445
+ variant, and source URL before download.
446
+ 3. Display real-time download progress; remove silent download flags.
447
+ 4. Validate integrity and architecture.
448
+ 5. Transactionally install and verify the binary.
449
+ 6. Add the global binary directory to PATH when missing.
450
+ 7. Download/extract `guiho-s-runx` into both global skill locations.
451
+ 8. Download `guiho-i-runx`, discover instruction files, and reconcile their
452
+ managed blocks.
453
+ 9. Log every action and final `runx --version` verification.
454
+ - Acceptance:
455
+ - Isolated Windows and POSIX installer tests cover success, fallback,
456
+ corruption, rollback, PATH, both skills, instructions, and progress.
457
+
458
+ ### Unit RX-13 - Replace The Npm Launcher With A Node-Compatible Bootstrap
459
+
460
+ - Goal: allow `@guiho/runx` installation and first execution without Bun.
461
+ - Dependencies: RX-11 and final asset names.
462
+ - Expected files: package metadata and `scripts/runx-bin.mjs` as the isolated
463
+ launcher/bootstrap source.
464
+ - Actions:
465
+ 1. Keep all RunX domain logic in native binaries.
466
+ 2. Replace the package `bin` target with a small Node-compatible ESM bootstrap
467
+ at `scripts/runx-bin.mjs`; this is the sole exception to the Node-import
468
+ ban.
469
+ 3. Detect platform/architecture and choose the exact RFC asset, defaulting
470
+ x64 to baseline.
471
+ 4. Cache the versioned native binary, download only when absent, apply Unix
472
+ executable permissions, pass args/stdio/env unchanged, and preserve the
473
+ native exit code.
474
+ 5. Remove Bun source and library fallbacks from the published launcher.
475
+ - Acceptance:
476
+ - Packed-package tests run the bootstrap with Node and no Bun in PATH.
477
+
478
+ ### Unit RX-14 - Publish Exactly Fourteen Release Assets
479
+
480
+ - Goal: make the build and GitHub release workflows enforce the exact release
481
+ contract.
482
+ - Dependencies: RX-09, RX-12, and RX-13.
483
+ - Binary names:
484
+ - `runx-linux-arm64`
485
+ - `runx-linux-x64`
486
+ - `runx-linux-x64-baseline`
487
+ - `runx-linux-x64-modern`
488
+ - `runx-darwin-arm64`
489
+ - `runx-darwin-x64`
490
+ - `runx-darwin-x64-baseline`
491
+ - `runx-darwin-x64-modern`
492
+ - `runx-windows-arm64.exe`
493
+ - `runx-windows-x64.exe`
494
+ - `runx-windows-x64-baseline.exe`
495
+ - `runx-windows-x64-modern.exe`
496
+ - Agent asset names:
497
+ - `guiho-s-runx`
498
+ - `guiho-i-runx`
499
+ - Actions:
500
+ 1. Replace every `macos` name and selector with `darwin`.
501
+ 2. Use Bun APIs in the binary builder rather than Node filesystem/path
502
+ imports.
503
+ 3. Package the skill directory and instruction/prompt artifact reproducibly.
504
+ 4. Upload only the fourteen expected assets.
505
+ 5. Make CI fail for missing, duplicate, extra, wrongly suffixed, or legacy
506
+ assets.
507
+ - Acceptance:
508
+ - Automated verification observes exactly fourteen unique names.
509
+
510
+ ### Unit RX-15 - Align Documentation, Skill, TODO, And XDocs
511
+
512
+ - Goal: remove the obsolete pre-RFC public contract from every durable surface.
513
+ - Dependencies: RX-01 through RX-14 behavior stable.
514
+ - Expected files:
515
+ - `README.md`, `DOCS.md`, `CHANGELOG.md`
516
+ - `AGENTS.md`
517
+ - `skills/guiho-s-runx/SKILL.md`
518
+ - `TODO.md`, task spec, implementation notes
519
+ - architecture/requirements/decision records that still promise aliases,
520
+ upward discovery, or a home page
521
+ - affected descriptors.
522
+ - Actions:
523
+ 1. Document the final command catalog and exact configuration precedence.
524
+ 2. Mark incompatible older RunX command/compatibility decisions as
525
+ superseded; do not leave contradictory approved documents.
526
+ 3. Document agent commands, markers, targets, prompt output, storage, cache,
527
+ installers, wrapper, exit codes, and fourteen assets.
528
+ 4. Update the bundled skill to match the executable.
529
+ 5. Maintain descriptor `files` and `documents` maps and tree links.
530
+ 6. Keep the TODO task open until full validation passes.
531
+ - Acceptance:
532
+ - Repository search finds no public promise for `runx r`, root selector
533
+ shorthand, `--file`, `runx agents`, `macos` asset names, or the old startup
534
+ home page.
535
+
536
+ ### Unit RX-16 - Full Validation And Delivery Handoff
537
+
538
+ - Goal: prove RFC compliance without publishing or mutating real installations.
539
+ - Dependencies: RX-15.
540
+ - Checks:
541
+ 1. `bun run typecheck`
542
+ 2. `bun test`
543
+ 3. `bun run build`
544
+ 4. `bun run binary`
545
+ 5. `bun run binaries`
546
+ 6. all CLI contract cases from RFC 0034
547
+ 7. Node-only packed npm bootstrap smoke tests
548
+ 8. isolated PowerShell and POSIX installer tests
549
+ 9. static prohibited-import scan
550
+ 10. exact fourteen-asset verification
551
+ 11. narrow strict xdocs metadata, tree, scan, and doctor checks
552
+ 12. `git diff --check` and final scoped status.
553
+ - Evidence:
554
+ - Write a validation report under `docs/validation/`.
555
+ - Run an implementation review and a plan-conformance review.
556
+ - Acceptance:
557
+ - Every RFC completion-gate item has direct evidence.
558
+ - Failures or skipped checks keep the TODO in `testing` or `todo` with exact
559
+ residual risk.
560
+ - Approval gates:
561
+ - Do not apply a Mirror version, tag, publish, push, install globally, or
562
+ overwrite the user's live RunX executable without separate explicit
563
+ authorization.
564
+
565
+ ## First Executable Unit
566
+
567
+ Start with RX-01. Establish clean baseline evidence and the violation inventory,
568
+ then execute RX-02 and RX-03 before changing configuration or command behavior.
569
+ This prevents Bun-only and module-boundary work from being entangled with the
570
+ public command migration.
571
+
572
+ ## Completion Definition
573
+
574
+ The task is complete only when all sixteen units pass, the final command catalog
575
+ is the only documented catalog, core source is Bun-only, TypeBox covers every
576
+ structured boundary, both installers and the npm wrapper work in isolation, and
577
+ the release workflow proves exactly twelve binaries plus the two named agent
578
+ assets.
579
+
580
+ ## References
581
+
582
+ - [RunX TODO](../../TODO.md)
583
+ - [RFC 0034 task specification](../todo/rfc-0034-cli-compliance-migration.md)
584
+ - [RunX CLI architecture](../architecture/cli-architecture.md)
585
+ - [Previous Citty migration plan](./citty-cli-migration.md)
586
+ - [Canonical package documentation](../../DOCS.md)
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: RunX Upgrade Reliability Implementation Plan
3
+ purpose: Sequence the approved RunX upgrade reliability design into executable and independently verifiable units.
4
+ description: Implementation plan for release discovery, progress reporting, transactional replacement, recovery commands, hardened installers, documentation, and validation for GitHub issues 12 and 13.
5
+ created: 2026-07-15
6
+ flags:
7
+ - approved
8
+ - in-progress
9
+ tags:
10
+ - plans
11
+ - cli
12
+ - reliability
13
+ keywords:
14
+ - runx upgrade
15
+ - upgrade list
16
+ - windows replacement
17
+ - recovery install
18
+ owner: runx-plans
19
+ ---
20
+
21
+ # RunX Upgrade Reliability Implementation Plan
22
+
23
+ ## Source of Truth
24
+
25
+ - Approved design: [upgrade reliability design](../superpowers/specs/2026-07-15-upgrade-reliability-design.md)
26
+ - GitHub issues: `CGuiho/runx#12` and `CGuiho/runx#13`
27
+ - Task: [Upgrade Reliability](../todo/upgrade-reliability.md)
28
+
29
+ ## Unit 1: Release Catalog and Recovery Contract
30
+
31
+ - Goal: Replace one-page release lookup and ad hoc version comparison with a complete, deterministic catalog and reusable platform recovery instructions.
32
+ - Owner: RunX package, `source/`.
33
+ - Dependencies: approved design only.
34
+ - Expected files: new focused catalog/recovery modules and colocated specs; `source/source.xdocs.md`.
35
+ - Data impact: introduces the schema-versioned catalog envelope and normalized release metadata; no persisted data.
36
+ - Auth/cache impact: unauthenticated GitHub API access remains; no upgrade cache is introduced.
37
+ - Checks: pagination with `Link`, malformed/non-2xx failures, SemVer precedence, channel labels, non-SemVer tail ordering, compatible assets, exact pinned recovery commands.
38
+ - Acceptance: every non-draft published release is present newest first, latest stable is computed independently, asset policy is deterministic, and commands are safe/copyable.
39
+ - Stop condition: stop if implementing the approved contract requires changing release tag or asset naming.
40
+
41
+ ## Unit 2: Planner, Events, Transactional Installer, and Reporter
42
+
43
+ - Goal: Make one execution pipeline expose the immutable plan before download, stream ordered text phases, buffer equivalent JSON, and return only after verified canonical replacement or rollback.
44
+ - Owner: RunX package, `source/`.
45
+ - Dependencies: Unit 1.
46
+ - Expected files: self-management modules/specs, shared types, CLI integration/specs, `source/source.xdocs.md`.
47
+ - Data impact: adds schema-versioned upgrade envelope and typed phase events.
48
+ - Auth/cache impact: no change; `cache` is explicitly reported as skipped.
49
+ - Checks: unique temporary paths, native magic validation, download-before-replace ordering, Windows rename/swap/verify/rollback, POSIX swap/verify/rollback, cleanup semantics, already-current/dry-run/failure recovery output, single JSON document.
50
+ - Acceptance: the plan is visible before awaiting the body, every slow phase is announced first, success proves the canonical binary reports the exact target, and all outcomes include recovery instructions.
51
+ - Stop condition: stop if Citty must be bypassed or a second token router would be required.
52
+
53
+ ## Unit 3: CLI Catalog Presentation and Error Boundary
54
+
55
+ - Goal: Wire `runx upgrade`, `check`, and `list` to the shared envelopes without changing Citty command ownership.
56
+ - Owner: RunX CLI, `source/cli.ts` and colocated tests.
57
+ - Dependencies: Units 1 and 2.
58
+ - Checks: complete aligned list output, current/latest/asset markers, exact JSON, output ordering, concise stderr failures plus stdout recovery, help descriptions.
59
+ - Acceptance: text and JSON expose equivalent facts; JSON remains one parseable document; failures exit nonzero without suppressing recovery.
60
+ - Stop condition: stop if global error handling would leak manifest behavior into self-management commands.
61
+
62
+ ## Unit 4: Direct Installer Hardening
63
+
64
+ - Goal: Make PowerShell and POSIX installers honor exact versions, unique temporary state, native validation, verified replacement, rollback, and actionable failure messages.
65
+ - Owner: RunX package, `devops/`.
66
+ - Dependencies: Unit 1 asset and version contract.
67
+ - Expected files: `devops/install.ps1`, `devops/install.sh`, focused contract/smoke tests, `devops/devops.xdocs.md`.
68
+ - Checks: exact stable/prerelease version, candidate ordering, version verification, rollback, nonzero failure, cleanup, paths with spaces.
69
+ - Acceptance: installers never report success until the installed canonical binary reports the requested resolved version.
70
+ - Stop condition: if a platform cannot be safely exercised locally, retain contract tests and record the unavailable live check.
71
+
72
+ ## Unit 5: User and Agent Documentation
73
+
74
+ - Goal: Document the real upgrade/list/recovery behavior and keep bundled agent guidance aligned.
75
+ - Owner: RunX package docs and skill.
76
+ - Dependencies: Units 1-4.
77
+ - Expected files: `README.md`, `DOCS.md`, `skills/guiho-s-runx/SKILL.md`, affected xdocs descriptors, task state.
78
+ - Checks: examples match actual command output and installer flags; xdocs metadata strictness/tree/doctor.
79
+ - Acceptance: users can identify versions/channels, understand phases, and copy the pinned recovery command after every attempt.
80
+
81
+ ## Unit 6: Full Validation and Handoff
82
+
83
+ - Goal: prove the branch is release-ready without publishing.
84
+ - Dependencies: Units 1-5.
85
+ - Checks: `bun run typecheck`, `bun test`, `bun run build`, `bun run binary`, `bun run binaries` when feasible, focused installer smokes, `xdocs meta ... --strict`, `xdocs doctor`, and `xdocs tree`.
86
+ - Acceptance: all feasible checks pass, deviations are recorded, no generated output is committed, and task status is `testing` or `completed` only when evidence supports it.
87
+ - Stop condition: do not publish, tag, or apply a Mirror version.
88
+
89
+ ## Execution Order and Checkpoints
90
+
91
+ Execute Units 1 through 6 in order. Commit coherent units with explicit file staging. Architecture is approved and the user explicitly authorized uninterrupted implementation; no additional approval gate exists unless a design contradiction, release mutation, or destructive action is discovered.
92
+
93
+ ## First Executable Unit
94
+
95
+ Unit 1: implement and test the release catalog and recovery contract.