@guiho/runx 0.4.1 → 0.5.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 (63) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/DOCS.md +24 -4
  3. package/README.md +6 -1
  4. package/devops/build-binaries.ts +3 -3
  5. package/devops/devops.xdocs.md +9 -6
  6. package/devops/extract-release-notes.spec.ts +54 -0
  7. package/devops/extract-release-notes.ts +40 -0
  8. package/devops/install.ps1 +29 -6
  9. package/devops/install.sh +36 -11
  10. package/devops/installers.spec.ts +152 -5
  11. package/devops/verify-release-assets.ts +14 -0
  12. package/docs/architecture/architecture.xdocs.md +2 -1
  13. package/docs/architecture/cli-architecture.md +18 -9
  14. package/docs/decisions/decisions.xdocs.md +4 -0
  15. package/docs/decisions/markdown-release-assets-and-version-scoped-notes.md +84 -0
  16. package/docs/plans/automatic-agent-maintenance.md +120 -0
  17. package/docs/plans/plans.xdocs.md +2 -0
  18. package/docs/plans/rfc-0034-cli-compliance-migration.md +17 -8
  19. package/docs/plans/upgrade-reliability-implementation.md +1 -1
  20. package/docs/reviews/implementation/automatic-agent-maintenance-review.md +63 -0
  21. package/docs/reviews/implementation/bash-installer-review.md +42 -0
  22. package/docs/reviews/implementation/implementation.xdocs.md +10 -0
  23. package/docs/reviews/implementation/rfc-0034-cli-compliance-migration-review.md +5 -2
  24. package/docs/reviews/implementation/unicode-help-tree-review.md +41 -0
  25. package/docs/reviews/implementation/upgrade-reliability-issue-12-review.md +62 -0
  26. package/docs/reviews/implementation/upgrade-reliability-issue-13-review.md +63 -0
  27. package/docs/reviews/plans/automatic-agent-maintenance-review.md +56 -0
  28. package/docs/reviews/plans/plans.xdocs.md +2 -0
  29. package/docs/superpowers/specs/2026-07-15-upgrade-reliability-design.md +1 -1
  30. package/docs/todo/automatic-agent-maintenance-implementation.md +55 -0
  31. package/docs/todo/automatic-agent-maintenance.md +86 -0
  32. package/docs/todo/bash-installer.md +45 -0
  33. package/docs/todo/rfc-0034-cli-compliance-migration-implementation.md +7 -2
  34. package/docs/todo/rfc-0034-cli-compliance-migration.md +7 -3
  35. package/docs/todo/todo.xdocs.md +10 -0
  36. package/docs/todo/unicode-help-tree.md +44 -0
  37. package/docs/todo/upgrade-reliability.md +51 -0
  38. package/docs/validation/automatic-agent-maintenance.md +63 -0
  39. package/docs/validation/bash-installer.md +55 -0
  40. package/docs/validation/rfc-0034-cli-compliance-migration.md +10 -4
  41. package/docs/validation/unicode-help-tree.md +43 -0
  42. package/docs/validation/upgrade-reliability-issue-12.md +74 -0
  43. package/docs/validation/upgrade-reliability-issue-13.md +72 -0
  44. package/docs/validation/upgrade-reliability.md +38 -99
  45. package/docs/validation/validation.xdocs.md +12 -2
  46. package/library/agent-maintenance.d.ts +19 -0
  47. package/library/agent-maintenance.d.ts.map +1 -0
  48. package/library/agent-maintenance.js +49 -0
  49. package/library/agents.d.ts +6 -1
  50. package/library/agents.d.ts.map +1 -1
  51. package/library/agents.js +58 -11
  52. package/library/cli.d.ts.map +1 -1
  53. package/library/cli.js +24 -7
  54. package/library/recovery.js +1 -1
  55. package/library/release-catalog.d.ts +2 -1
  56. package/library/release-catalog.d.ts.map +1 -1
  57. package/library/release-catalog.js +9 -1
  58. package/library/storage.d.ts +2 -1
  59. package/library/storage.d.ts.map +1 -1
  60. package/library/storage.js +13 -1
  61. package/package.json +1 -1
  62. package/skills/guiho-s-runx/SKILL.md +11 -0
  63. package/skills/guiho-s-runx/guiho-s-runx.xdocs.md +4 -1
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: RunX Upgrade Reliability Issue 12 Validation
3
+ purpose: Record current-main evidence for GitHub issue 12.
4
+ description: Captures focused and full transaction, catalog, routing, native, live GitHub, XDocs, and Git integrity checks.
5
+ created: 2026-07-19
6
+ flags:
7
+ - validated
8
+ tags:
9
+ - validation
10
+ - cli
11
+ - reliability
12
+ keywords:
13
+ - RunX
14
+ - issue 12
15
+ - 50 tests
16
+ - 14 assets
17
+ owner: runx-validation
18
+ ---
19
+
20
+ # RunX Upgrade Reliability Issue 12 Validation
21
+
22
+ ## Summary
23
+
24
+ All local completion gates for GitHub issue #12 passed after correcting the
25
+ complete-list default and Citty parent/subcommand routing. No validation
26
+ blocker remains.
27
+
28
+ ## Commands Run
29
+
30
+ | Command or check | Result |
31
+ | --- | --- |
32
+ | `bun run typecheck` | Passed |
33
+ | focused catalog, transaction, reporting, and CLI tests | Passed: 31 tests, 222 assertions |
34
+ | `bun test --timeout 30000` | Passed: 50 tests, 342 assertions |
35
+ | `bun run build` | Passed |
36
+ | `bun run binary` | Passed |
37
+ | `bun run binaries` | Passed: twelve native targets |
38
+ | `bun run verify-assets` | Passed: exactly fourteen unique assets |
39
+ | live source `upgrade list --format json` | Passed: one JSON document, ten current published releases, current/latest/asset metadata |
40
+ | live source `upgrade check --format json` | Passed: one JSON document, no parent upgrade envelope |
41
+ | strict XDocs metadata and doctor | Passed for source and docs: zero errors and zero warnings |
42
+ | `git diff --check` | Passed |
43
+
44
+ ## Transaction Evidence
45
+
46
+ - The self-management suite renames a running Windows executable, places the
47
+ new binary at the canonical path, executes that path with `--version`, and
48
+ reports success only after the exact target is observed.
49
+ - Controlled second-rename, target-version mismatch, and rollback-failure tests
50
+ prove nonzero structured outcomes and deterministic restoration behavior.
51
+ - Plan and phase callbacks prove plan output precedes download work and
52
+ replacement starts only after download and native validation.
53
+
54
+ ## Catalog Evidence
55
+
56
+ - GitHub `Link` pagination, SemVer/prerelease ordering, channel labels,
57
+ malformed payloads, candidate ordering, and missing compatible assets are
58
+ covered by focused tests.
59
+ - A real Citty-route regression follows two mocked release pages, includes an
60
+ alpha release without an opt-in flag, parses exactly one JSON document, and
61
+ proves the parent upgrade action did not execute.
62
+ - Live GitHub-backed list and check routes each returned one parseable document
63
+ with exit code zero.
64
+
65
+ ## Skipped Checks
66
+
67
+ - No installed user executable was replaced.
68
+ - No package publication, GitHub Release creation, Mirror version, or tag was
69
+ performed during this issue unit.
70
+
71
+ ## References
72
+
73
+ - [Implementation review](../reviews/implementation/upgrade-reliability-issue-12-review.md)
74
+ - [Implementation plan](../plans/upgrade-reliability-implementation.md)
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: RunX Upgrade Reliability Issue 13 Validation
3
+ purpose: Record current-main exact recovery and installer evidence for GitHub issue 13.
4
+ description: Captures outcome-matrix, exact target, executable installer, native text/JSON, full suite, assets, XDocs, and Git checks.
5
+ created: 2026-07-19
6
+ flags:
7
+ - validated
8
+ tags:
9
+ - validation
10
+ - cli
11
+ - reliability
12
+ keywords:
13
+ - RunX
14
+ - issue 13
15
+ - exact recovery
16
+ - installer verification
17
+ owner: runx-validation
18
+ ---
19
+
20
+ # RunX Upgrade Reliability Issue 13 Validation
21
+
22
+ ## Summary
23
+
24
+ All local completion gates for GitHub issue #13 passed. No validation blocker
25
+ remains.
26
+
27
+ ## Commands Run
28
+
29
+ | Command or check | Result |
30
+ | --- | --- |
31
+ | `bun run typecheck` | Passed |
32
+ | focused recovery, transaction, reporting, and installer tests | Passed: 23 tests, 126 assertions |
33
+ | `bun test --timeout 30000` | Passed: 52 tests, 358 assertions |
34
+ | `bun run build` | Passed |
35
+ | `bun run binary` and `bun run binaries` | Passed: single local build and twelve native targets |
36
+ | `bun run verify-assets` | Passed: exactly fourteen unique assets |
37
+ | native Windows x64 already-current text smoke | Passed: exact 0.4.1 installer followed by separate stop command |
38
+ | native Windows x64 already-current JSON smoke | Passed: resolved 0.4.1 recovery object |
39
+ | strict XDocs metadata and doctor | Passed for source, devops, and docs: zero errors and zero warnings |
40
+ | `git diff --check` | Passed |
41
+
42
+ ## Recovery Evidence
43
+
44
+ - The reporter test matrix covers `upgraded`, `up-to-date`, `dry-run`,
45
+ `rolled-back`, and `failed`; every summary precedes the exact installer, and
46
+ every installer precedes the separate process-stop command.
47
+ - Discovery failure retains a visibly labeled fallback-current repair command.
48
+ - Download and replacement failures retain the resolved recovery object in the
49
+ shared upgrade envelope.
50
+ - JSON exposes `targetVersion`, `targetSource`, `installCommand`, and
51
+ `stopProcessCommand` without mixing text into stdout.
52
+
53
+ ## Installer Evidence
54
+
55
+ - Windows and POSIX recovery generators preserve full prerelease identifiers.
56
+ - The PowerShell installer functions execute exact stable and prerelease
57
+ normalization, accept the real Bun executable when its reported version
58
+ matches, and reject a controlled mismatch.
59
+ - Installer contract tests cover exact flags, native validation, transactional
60
+ replacement, rollback language, and the separate stop workflow.
61
+
62
+ ## Platform Boundary
63
+
64
+ No WSL distribution is installed in the current Windows environment. Git for
65
+ Windows Bash executes the installer syntax, piped startup, exact-version
66
+ normalization, and executable verification locally; Ubuntu CI remains the
67
+ native Linux gate.
68
+
69
+ ## References
70
+
71
+ - [Implementation review](../reviews/implementation/upgrade-reliability-issue-13-review.md)
72
+ - [Umbrella validation](./upgrade-reliability.md)
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: RunX Upgrade Reliability Validation
3
- purpose: Record release-ready verification evidence for GitHub issues 12 and 13.
4
- description: Results for release pagination, progress reporting, transactional replacement, rollback, recovery commands, direct installers, native builds, live release smokes, and XDocs integrity.
3
+ purpose: Preserve the completed umbrella validation for GitHub issues 12 and 13.
4
+ description: Summarizes current release discovery, transaction, recovery, installer, native, and structured documentation evidence.
5
5
  created: 2026-07-15
6
+ updated: 2026-07-19
6
7
  flags:
7
- - superseded
8
- - needs-revalidation
8
+ - validated
9
9
  tags:
10
10
  - validation
11
11
  - cli
@@ -24,101 +24,40 @@ owner: runx-validation
24
24
 
25
25
  ## Current Status
26
26
 
27
- The first validation pass below is superseded by independent review findings.
28
- The implementation has since been corrected for exact JSON envelope fidelity,
29
- post-backup rename/rollback state, downgrade prevention, installer failure
30
- classification, Ubuntu portability, and executable controlled installer tests.
31
- Candidate verification now has a bounded ten-second timeout in the CLI and both
32
- direct installers. Those corrections still require the complete release gate
33
- to be rerun before this document or the TODO task can return to
34
- `validated`/`completed`.
35
-
36
- No package publication, version apply, or tag operation was performed.
37
-
38
- ## Superseded Automated Gate
39
-
40
- | Command | Result |
41
- | --- | --- |
42
- | `bun run typecheck` | Passed. |
43
- | `bun test` | Passed: 37 tests, 0 failures, 245 assertions across 8 files. |
44
- | `bun run build` | Passed; TypeScript library output compiled. |
45
- | `bun run binary` | Passed; local native executable compiled. |
46
- | `bun run binaries` | Passed; all 12 Linux, macOS, and Windows release assets compiled and were non-empty. |
47
- | `bun test devops/installers.spec.ts` | Superseded: the earlier suite relied partly on source-pattern checks. The replacement suite executes controlled native installer and recovery scenarios and awaits revalidation. |
48
-
49
- Generated `library/` and `bin/` outputs remain ignored and are not part of the
50
- committed change.
51
-
52
- ## Superseded Behavior Evidence
53
-
54
- - Release-catalog tests follow `Link: rel="next"`, reject malformed/non-2xx
55
- responses, apply SemVer prerelease precedence, retain invalid tags last, and
56
- enforce baseline/default/modern asset candidates.
57
- - Reporting tests prove the complete plan precedes `Downloading`, which
58
- precedes the download body and then `Validating`, `Replacing`, and
59
- `Verifying`.
60
- - The Windows test runs a copied executable, keeps it mapped in a live process,
61
- renames it, installs the new canonical executable immediately, verifies the
62
- exact version, and allows only old-image cleanup to be deferred.
63
- - Failure tests reject non-native downloads before mutation and restore the
64
- original executable after target verification failure.
65
- - Bun-launcher failure returns a recovery command pinned to the resolved target
66
- instead of losing recovery at the generic CLI error boundary.
67
- - Installer tests enforce unique temporary paths, exact target versions,
68
- canonical verification, rollback language/behavior, and separate stop
69
- commands.
70
-
71
- ## Superseded Compiled Binary Smoke
72
-
73
- The compiled `runx-windows-x64-baseline.exe` reported version `0.2.7`.
74
- `upgrade --dry-run` queried live GitHub release metadata and printed the full
75
- plan before any mutation, followed by the pinned `0.2.7` PowerShell recovery
76
- command and the separate safe stop command. `upgrade list --format json`
77
- returned one valid schema-versioned document containing all eight currently
78
- published releases from `0.2.7` through `0.2.0`, newest first, with current,
79
- latest-stable, publication, channel, and compatible-asset data.
80
-
81
- The first smoke command targeted `bin/runx.exe` after the complete matrix build
82
- had replaced the local single-binary output with named assets. It failed only
83
- because that path no longer existed; the smoke was immediately rerun against
84
- the actual baseline matrix asset and passed.
85
-
86
- ## Superseded XDocs Gate
87
-
88
- Using an equivalent validation-only XDocs configuration with agent file writes
89
- disabled:
90
-
91
- - strict metadata passed for `docs/plans`, `docs/reviews/plans`, `docs/todo`,
92
- `source`, `devops`, and `skills/guiho-s-runx`;
93
- - `xdocs doctor --warnings-as-errors --format json` returned `valid: true`,
94
- zero errors, and zero warnings; and
95
- - `xdocs tree` returned one connected RunX tree without duplicate subjects or
96
- orphans.
27
+ Validated.
28
+
29
+ The earlier blocked validation is superseded by the current-main issue-specific
30
+ reviews and passing gates. GitHub issue #12 owns immediate verified replacement
31
+ and the complete release catalog. GitHub issue #13 owns exact-version recovery
32
+ instructions and direct installer verification.
33
+
34
+ ## Completion Evidence
35
+
36
+ - The canonical executable is replaced and verified before success; only old
37
+ backup cleanup may be deferred on Windows.
38
+ - Replacement, verification, and rollback failures return stable structured
39
+ outcomes and preserve exact recovery instructions.
40
+ - Release discovery follows every GitHub page, applies SemVer ordering and
41
+ channel labels, and exposes current/latest/date/compatible-asset metadata.
42
+ - The default public list includes all published prereleases and emits only its
43
+ selected Citty leaf result.
44
+ - Every terminal upgrade outcome renders a pinned install command before a
45
+ separate platform process-stop command.
46
+ - PowerShell and POSIX installers accept exact stable and prerelease versions,
47
+ validate native assets, verify the installed `--version`, and fail nonzero on
48
+ mismatch.
49
+ - TypeScript, the complete Bun suite, library build, twelve native targets,
50
+ exact fourteen assets, live native text/JSON smokes, XDocs, and Git integrity
51
+ pass on the final implementation.
52
+
53
+ ## Detailed Records
54
+
55
+ - [Issue 12 implementation review](../reviews/implementation/upgrade-reliability-issue-12-review.md)
56
+ - [Issue 12 validation](./upgrade-reliability-issue-12.md)
57
+ - [Issue 13 implementation review](../reviews/implementation/upgrade-reliability-issue-13-review.md)
58
+ - [Issue 13 validation](./upgrade-reliability-issue-13.md)
97
59
 
98
60
  ## Release Boundary
99
61
 
100
- The branch preserves package version `0.2.7`. A future merge/release owner must
101
- use Mirror to plan and apply any requested patch release; this implementation
102
- does not publish or tag automatically.
103
-
104
- ## Required Revalidation
105
-
106
- - `bun run typecheck`
107
- - `bun test`, including the controlled installer/recovery suite on Ubuntu and Windows
108
- - `bun run build`, `bun run binary`, and `bun run binaries`
109
- - compiled CLI text/JSON smokes, including failed and rolled-back envelopes
110
- - strict XDocs metadata, doctor warnings-as-errors, and tree validation
111
-
112
- The current isolated Windows worktree could not begin that rerun because
113
- `bun install --frozen-lockfile` was denied while opening `bun.lock` with
114
- `EPERM`. This is an environment validation blocker, not a passing result.
115
-
116
- ## Review-Correction Checks
117
-
118
- | Command | Result |
119
- | --- | --- |
120
- | Cached TypeScript 6 compiler, `-p . --noEmit` | Passed after the review corrections. |
121
- | PowerShell parser for `devops/install.ps1` | Passed. |
122
- | Git Bash `bash -n devops/install.sh` | Passed. |
123
- | `git diff --check` | Passed. |
124
- | Focused Bun tests | Blocked before test execution by `EPERM` reading the isolated worktree and `tsconfig.json`; zero tests passed in that attempt. |
62
+ No package publication or GitHub Release mutation was performed directly.
63
+ Mirror versioning remains deferred to the single final open-issue release step.
@@ -4,20 +4,30 @@ description: Validation evidence and implementation summaries for RunX releases.
4
4
  parent: runx-docs
5
5
  children: []
6
6
  files:
7
+ bash-installer.md: Records Bash syntax, piped startup, exact versions, executable verification, native assets, XDocs, and Git evidence for issue 15.
7
8
  alpha-implementation-summary.md: Records the completed alpha implementation, checks, and release boundaries.
8
9
  citty-cli-migration.md: Records the complete local validation gate for the Citty command-tree migration.
9
10
  interactive-init-manifest.md: Records validation evidence for the interactive initializer and strict manifest contract.
10
11
  windows-self-upgrade.md: Records Windows replacement, rollback, cleanup, native build, CI, and XDocs validation evidence.
11
- upgrade-reliability.md: Tracks the superseded first pass and required revalidation after independent upgrade reliability review corrections.
12
+ upgrade-reliability.md: Summarizes completed current-main validation for GitHub issues 12 and 13.
12
13
  rfc-0034-cli-compliance-migration.md: Records passing RFC tests, live upgrade/startup/prompt regressions, builds, bootstrap, installers, import scan, and fourteen-asset evidence.
14
+ automatic-agent-maintenance.md: Records focused and full tests, native builds, exact assets, import scan, XDocs, and Git evidence for issue 11.
15
+ upgrade-reliability-issue-12.md: Records transaction, complete catalog, Citty routing, native matrix, live GitHub, XDocs, and Git evidence for issue 12.
16
+ upgrade-reliability-issue-13.md: Records all-outcome recovery, exact target, executable installer, native text/JSON, XDocs, and Git evidence for issue 13.
17
+ unicode-help-tree.md: Records focused/full tests, explicit glyph/alignment assertions, native smoke, assets, XDocs, and Git evidence for issue 17.
13
18
  documents:
19
+ bash-installer.md: Current-main validation report for the RunX Bash installer.
14
20
  alpha-implementation-summary.md: Validation summary for the first RunX implementation.
15
21
  citty-cli-migration.md: Validation evidence for TypeScript, tests, native assets, npm packaging, CLI behavior, and XDocs.
16
22
  interactive-init-manifest.md: Validation evidence for the RunX interactive init manifest feature.
17
23
  npm-trusted-publishing-0.2.2.md: Validation evidence for the blocked 0.2.2 npm trusted-publishing retry.
18
24
  windows-self-upgrade.md: Validation evidence for GitHub issues #9 and #1 and the Windows self-upgrade patch.
19
- upgrade-reliability.md: Revalidation record for GitHub issues 12 and 13; currently marked needs-revalidation.
25
+ upgrade-reliability.md: Completed umbrella validation for GitHub issues 12 and 13.
20
26
  rfc-0034-cli-compliance-migration.md: Complete RFC 0034 correction validation and patch-release readiness report.
27
+ automatic-agent-maintenance.md: Complete validation report for automatic RunX agent maintenance.
28
+ upgrade-reliability-issue-12.md: Current-main validation report for GitHub issue 12.
29
+ upgrade-reliability-issue-13.md: Current-main validation report for GitHub issue 13.
30
+ unicode-help-tree.md: Current-main validation report for the RunX Unicode help tree.
21
31
  tags:
22
32
  - validation
23
33
  keywords:
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ export { agentMaintenanceWorkerCwd, runAgentMaintenanceWorker, spawnAgentMaintenanceWorker, };
5
+ type AgentWorkerSpawnOptions = {
6
+ readonly detached: true;
7
+ readonly stdout: 'ignore';
8
+ readonly stderr: 'ignore';
9
+ readonly stdin: 'ignore';
10
+ readonly cwd: string;
11
+ readonly env: Record<string, string | undefined>;
12
+ };
13
+ type AgentWorkerSpawner = (command: string[], options: AgentWorkerSpawnOptions) => {
14
+ unref(): unknown;
15
+ };
16
+ declare function agentMaintenanceWorkerCwd(rawArgs: string[]): string | null;
17
+ declare function runAgentMaintenanceWorker(cwd: string): Promise<void>;
18
+ declare function spawnAgentMaintenanceWorker(cwd: string, spawn?: AgentWorkerSpawner): boolean;
19
+ //# sourceMappingURL=agent-maintenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-maintenance.d.ts","sourceRoot":"","sources":["../source/agent-maintenance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,GAC5B,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjD,CAAA;AACD,KAAK,kBAAkB,GAAG,CACxB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,uBAAuB,KAC7B;IAAE,KAAK,IAAI,OAAO,CAAA;CAAE,CAAA;AAQzB,iBAAS,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOnE;AAED,iBAAe,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAED,iBAAS,2BAA2B,CAClC,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,kBAAsE,GAC5E,OAAO,CAmBT"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ import { Type } from '@sinclair/typebox';
5
+ import { Value } from '@sinclair/typebox/value';
6
+ import { maintainAgentIntegration } from './agents.js';
7
+ import { RunXError } from './errors.js';
8
+ import { directoryName, resolvePath } from './path-utils.js';
9
+ export { agentMaintenanceWorkerCwd, runAgentMaintenanceWorker, spawnAgentMaintenanceWorker, };
10
+ const workerFlag = '--maintain-agent-integration-worker';
11
+ const workerArgsSchema = Type.Tuple([
12
+ Type.Literal(workerFlag),
13
+ Type.String({ minLength: 1 }),
14
+ ]);
15
+ function agentMaintenanceWorkerCwd(rawArgs) {
16
+ if (rawArgs[0] !== workerFlag)
17
+ return null;
18
+ try {
19
+ return resolvePath(Value.Decode(workerArgsSchema, rawArgs)[1]);
20
+ }
21
+ catch (error) {
22
+ throw new RunXError(`Invalid agent-maintenance worker invocation: ${error instanceof Error ? error.message : String(error)}`, 2);
23
+ }
24
+ }
25
+ async function runAgentMaintenanceWorker(cwd) {
26
+ await maintainAgentIntegration(resolvePath(cwd));
27
+ }
28
+ function spawnAgentMaintenanceWorker(cwd, spawn = (command, options) => Bun.spawn(command, options)) {
29
+ if (Bun.env.RUNX_DISABLE_AGENT_MAINTENANCE_WORKER === '1')
30
+ return false;
31
+ const effectiveCwd = resolvePath(cwd);
32
+ const command = process.execPath.toLowerCase().includes('bun')
33
+ ? [process.execPath, Bun.main, workerFlag, effectiveCwd]
34
+ : [process.execPath, workerFlag, effectiveCwd];
35
+ try {
36
+ spawn(command, {
37
+ detached: true,
38
+ stdout: 'ignore',
39
+ stderr: 'ignore',
40
+ stdin: 'ignore',
41
+ cwd: directoryName(process.execPath),
42
+ env: { ...process.env, RUNX_DISABLE_AGENT_MAINTENANCE_WORKER: '1' },
43
+ }).unref();
44
+ return true;
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ }
@@ -2,11 +2,15 @@
2
2
  * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
4
  import type { AgentScope } from './types.js';
5
- export { applyAgentInstructions, installAgentSkill, listAgentPrompts, listAgentSkills, removeAgentInstructions, showAgentInstructions, showAgentPrompt, showAgentSkill, uninstallAgentSkill, updateAgentInstructions, updateAgentSkill, };
5
+ export { applyAgentInstructions, installAgentSkill, listAgentPrompts, listAgentSkills, maintainAgentIntegration, removeAgentInstructions, showAgentInstructions, showAgentPrompt, showAgentSkill, uninstallAgentSkill, updateAgentInstructions, updateAgentSkill, };
6
6
  type EmbeddedResources = {
7
7
  skill: string;
8
8
  prompt: string;
9
9
  } | undefined;
10
+ type AgentMaintenanceResult = {
11
+ readonly skills: string[];
12
+ readonly instructions: string[];
13
+ };
10
14
  declare global {
11
15
  var __RUNX_EMBEDDED_RESOURCES__: EmbeddedResources;
12
16
  }
@@ -33,4 +37,5 @@ declare function listAgentPrompts(namesOnly?: false): Array<{
33
37
  description: string;
34
38
  }>;
35
39
  declare function showAgentPrompt(id: string): Promise<string>;
40
+ declare function maintainAgentIntegration(cwd: string): Promise<AgentMaintenanceResult>;
36
41
  //# sourceMappingURL=agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../source/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GACjB,CAAA;AAED,KAAK,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAA;AAEtE,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,2BAA2B,EAAE,iBAAiB,CAAA;CACnD;AAOD,iBAAe,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAElF;AAED,iBAAe,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEjF;AAED,iBAAe,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIpF;AAED,iBAAS,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAIpF;AAED,iBAAe,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAQtI;AAED,iBAAe,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEpE;AAED,iBAAe,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAErE;AAED,iBAAe,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYrE;AAED,iBAAe,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEtD;AAED,iBAAS,gBAAgB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;AACpD,iBAAS,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAOxF,iBAAe,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1D"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../source/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GACjB,CAAA;AAED,KAAK,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAA;AACtE,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAChC,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,2BAA2B,EAAE,iBAAiB,CAAA;CACnD;AASD,iBAAe,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAElF;AAED,iBAAe,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEjF;AAED,iBAAe,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIpF;AAED,iBAAS,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAIpF;AAED,iBAAe,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAQtI;AAED,iBAAe,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEpE;AAED,iBAAe,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAErE;AAED,iBAAe,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYrE;AAED,iBAAe,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEtD;AAED,iBAAS,gBAAgB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;AACpD,iBAAS,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAOxF,iBAAe,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1D;AAED,iBAAe,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoBpF"}
package/library/agents.js CHANGED
@@ -2,13 +2,15 @@
2
2
  * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
4
  import { RunXError } from './errors.js';
5
- import { homeDirectory, joinPath, resolvePath } from './path-utils.js';
6
- import { ensureDirectory, pathExists, readTextIfExists, removePath, writeTextFile } from './storage.js';
7
- export { applyAgentInstructions, installAgentSkill, listAgentPrompts, listAgentSkills, removeAgentInstructions, showAgentInstructions, showAgentPrompt, showAgentSkill, uninstallAgentSkill, updateAgentInstructions, updateAgentSkill, };
5
+ import { directoryName, homeDirectory, joinPath, resolvePath } from './path-utils.js';
6
+ import { ensureDirectory, pathExists, readTextIfExists, removePath, writeTextFile, writeTextFileAtomic } from './storage.js';
7
+ export { applyAgentInstructions, installAgentSkill, listAgentPrompts, listAgentSkills, maintainAgentIntegration, removeAgentInstructions, showAgentInstructions, showAgentPrompt, showAgentSkill, uninstallAgentSkill, updateAgentInstructions, updateAgentSkill, };
8
8
  const skillId = 'guiho-s-runx';
9
9
  const promptId = 'guiho-i-runx';
10
10
  const managedStart = '<!-- BEGIN RUNX — DO NOT EDIT THIS SECTION -->';
11
11
  const managedEnd = '<!-- END RUNX -->';
12
+ const legacyManagedStart = '<!-- BEGIN RUNX AGENT INSTRUCTIONS -->';
13
+ const legacyManagedEnd = '<!-- END RUNX AGENT INSTRUCTIONS -->';
12
14
  async function installAgentSkill(scope, cwd) {
13
15
  return writeSkillTargets(scope, cwd);
14
16
  }
@@ -69,6 +71,26 @@ async function showAgentPrompt(id) {
69
71
  throw new RunXError(`Unknown RunX prompt: ${id}`, 2);
70
72
  return readBundledPrompt();
71
73
  }
74
+ async function maintainAgentIntegration(cwd) {
75
+ const skill = await readBundledSkill();
76
+ const skills = [];
77
+ for (const directory of skillDirectories('global', cwd)) {
78
+ const path = joinPath(directory, 'SKILL.md');
79
+ if (await readTextIfExists(path) === skill)
80
+ continue;
81
+ await writeTextFileAtomic(path, skill);
82
+ skills.push(path);
83
+ }
84
+ const instructionPath = await nearestAgentsPath(cwd);
85
+ const existing = await readTextIfExists(instructionPath) ?? '';
86
+ const next = replaceManagedBlock(existing, instructionBlock());
87
+ const instructions = [];
88
+ if (next !== existing) {
89
+ await writeTextFileAtomic(instructionPath, next);
90
+ instructions.push(instructionPath);
91
+ }
92
+ return { skills, instructions };
93
+ }
72
94
  async function writeSkillTargets(scope, cwd) {
73
95
  const skill = await readBundledSkill();
74
96
  const installed = [];
@@ -115,23 +137,48 @@ function instructionBlock() {
115
137
  return `${managedStart}
116
138
  ## RunX Command Catalog
117
139
 
118
- Load the \`guiho-s-runx\` skill before working with \`runx.yaml\`. Inspect with
119
- \`runx check --format json\` and \`runx list --format json\`, select stable UIDs,
120
- use \`runx run <uid> --dry-run\` before unfamiliar work, and add \`--yes\` only
121
- after explicit approval for a confirmation-gated command.
140
+ Load the \`guiho-s-runx\` skill whenever discovering commands, creating or
141
+ updating catalog entries, validating \`runx.yaml\`, inspecting command details,
142
+ or executing RunX commands.
143
+ Start with \`runx check --format json\` and \`runx list --format json\`, select
144
+ stable UIDs, use \`runx describe <uid>\`, and run
145
+ \`runx run <uid> --dry-run\` before unfamiliar or side-effecting work.
122
146
  ${managedEnd}
123
147
  `;
124
148
  }
125
149
  function replaceManagedBlock(existing, block) {
126
- const pattern = new RegExp(`${escapeRegExp(managedStart)}[\\s\\S]*?${escapeRegExp(managedEnd)}\\s*`, 'g');
127
- const stripped = existing.replace(pattern, '').trimEnd();
150
+ const stripped = removeKnownManagedBlocks(existing).trimEnd();
128
151
  return `${stripped}${stripped ? '\n\n' : ''}${block}`;
129
152
  }
130
153
  function removeManagedBlock(existing) {
131
- const pattern = new RegExp(`\\s*${escapeRegExp(managedStart)}[\\s\\S]*?${escapeRegExp(managedEnd)}\\s*`, 'g');
132
- const next = existing.replace(pattern, '\n').trimEnd();
154
+ const next = removeKnownManagedBlocks(existing, true).trimEnd();
133
155
  return next ? `${next}\n` : '';
134
156
  }
157
+ function removeKnownManagedBlocks(existing, includeLeadingWhitespace = false) {
158
+ let output = existing;
159
+ for (const [start, end] of [
160
+ [managedStart, managedEnd],
161
+ [legacyManagedStart, legacyManagedEnd],
162
+ ]) {
163
+ const prefix = includeLeadingWhitespace ? '\\s*' : '';
164
+ const pattern = new RegExp(`${prefix}${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}\\s*`, 'g');
165
+ output = output.replace(pattern, includeLeadingWhitespace ? '\n' : '');
166
+ }
167
+ return output;
168
+ }
169
+ async function nearestAgentsPath(cwd) {
170
+ const effectiveCwd = resolvePath(cwd);
171
+ let current = effectiveCwd;
172
+ while (true) {
173
+ const candidate = joinPath(current, 'AGENTS.md');
174
+ if (await pathExists(candidate))
175
+ return candidate;
176
+ const parent = directoryName(current);
177
+ if (parent === current)
178
+ return joinPath(effectiveCwd, 'AGENTS.md');
179
+ current = parent;
180
+ }
181
+ }
135
182
  async function readBundledSkill() {
136
183
  if (globalThis.__RUNX_EMBEDDED_RESOURCES__?.skill)
137
184
  return globalThis.__RUNX_EMBEDDED_RESOURCES__.skill;
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8BH,OAAO,KAAK,EAAkB,UAAU,EAAkB,MAAM,OAAO,CAAA;AAIvE,OAAO,EACL,MAAM,EACN,uBAAuB,EACvB,WAAW,GACZ,CAAA;AAsPD,QAAA,MAAiB,WAAW,iBAAwB,CAAA;AAEpD,iBAAe,MAAM,CAAC,OAAO,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB9E;AAED,iBAAe,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+BH,OAAO,KAAK,EAAkB,UAAU,EAAkB,MAAM,OAAO,CAAA;AAIvE,OAAO,EACL,MAAM,EACN,uBAAuB,EACvB,WAAW,GACZ,CAAA;AAyPD,QAAA,MAAiB,WAAW,iBAAwB,CAAA;AAEpD,iBAAe,MAAM,CAAC,OAAO,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9E;AAMD,iBAAe,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE"}
package/library/cli.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { Type } from '@sinclair/typebox';
5
5
  import { Value } from '@sinclair/typebox/value';
6
6
  import { defineCommand, renderUsage, runCommand as runCittyCommand } from 'citty';
7
+ import { agentMaintenanceWorkerCwd, runAgentMaintenanceWorker, spawnAgentMaintenanceWorker } from './agent-maintenance.js';
7
8
  import { applyAgentInstructions, installAgentSkill, listAgentPrompts, listAgentSkills, removeAgentInstructions, showAgentInstructions, showAgentPrompt, showAgentSkill, uninstallAgentSkill, updateAgentInstructions, updateAgentSkill, } from './agents.js';
8
9
  import { RunXError } from './errors.js';
9
10
  import { runCommand } from './executor.js';
@@ -12,7 +13,7 @@ import { initializeRunXManifest } from './init.js';
12
13
  import { readManifest, resolveCommand } from './manifest.js';
13
14
  import { resolvePath } from './path-utils.js';
14
15
  import { renderDescription, renderExecutionPlan, renderJson, renderList } from './render.js';
15
- import { fetchReleaseCatalog, resolveUpgradePlatform } from './release-catalog.js';
16
+ import { fetchReleaseCatalog, paginateReleaseCatalog, resolveUpgradePlatform } from './release-catalog.js';
16
17
  import { checkForLatestVersion, uninstallSelf, upgradeSelf } from './self-management.js';
17
18
  import { readCachedUpdateNotice, runUpdateWorker, spawnUpdateWorker } from './update-cache.js';
18
19
  import { renderReleaseCatalog, renderUpgradeEvent, renderUpgradeHeading, renderUpgradePlan, renderUpgradeResult } from './upgrade-reporting.js';
@@ -135,7 +136,7 @@ function createCommandTree() {
135
136
  const upgradeList = leaf('runx upgrade list', 'List RunX releases newest first.', {
136
137
  page: { type: 'string', valueHint: 'positive-integer', description: 'Select result page.' },
137
138
  'per-page': { type: 'string', valueHint: 'positive-integer', description: 'Select page size.' },
138
- 'pre-releases': { type: 'boolean', description: 'Include prerelease versions.' },
139
+ 'pre-releases': { type: 'boolean', description: 'Accepted explicitly; prereleases are always included.' },
139
140
  arch: { type: 'string', valueHint: 'x64|arm64', description: 'Select target architecture.' },
140
141
  variant: { type: 'string', valueHint: 'baseline|default|modern', description: 'Select x64 variant.' },
141
142
  format: catalogArgs.format,
@@ -145,7 +146,11 @@ function createCommandTree() {
145
146
  args: { ...upgradeArgs, ...helpArgs },
146
147
  subCommands: { check: upgradeCheck, list: upgradeList },
147
148
  setup: helpSetup(state),
148
- run: async () => runUpgrade(options(state.args), state.args),
149
+ run: async () => {
150
+ if (state.command === upgradeCheck || state.command === upgradeList)
151
+ return;
152
+ await runUpgrade(options(state.args), state.args);
153
+ },
149
154
  });
150
155
  state.commands.set('upgrade', upgrade);
151
156
  const uninstall = leaf('runx uninstall', 'Uninstall the native RunX executable.', {
@@ -229,6 +234,11 @@ async function runCli(rawArgs = process.argv.slice(2)) {
229
234
  await runUpdateWorker();
230
235
  return;
231
236
  }
237
+ const maintenanceWorkerCwd = agentMaintenanceWorkerCwd(rawArgs);
238
+ if (maintenanceWorkerCwd !== null) {
239
+ await runAgentMaintenanceWorker(maintenanceWorkerCwd);
240
+ return;
241
+ }
232
242
  const { command, state } = createCommandTree();
233
243
  const cleanOutput = rawArgs.some((arg) => ['-h', '--help', '-v', '--version', '--help-tree', '--help-docs'].includes(arg) || arg.startsWith('--help-tree-depth'));
234
244
  if (!cleanOutput) {
@@ -253,6 +263,14 @@ async function runCli(rawArgs = process.argv.slice(2)) {
253
263
  throw new CliUsageError(error.message, await renderUsage(state.command));
254
264
  throw error;
255
265
  }
266
+ finally {
267
+ if (shouldScheduleAgentMaintenance(rawArgs)) {
268
+ spawnAgentMaintenanceWorker(resolvePath(state.args.cwd ?? process.cwd()));
269
+ }
270
+ }
271
+ }
272
+ function shouldScheduleAgentMaintenance(rawArgs) {
273
+ return !['agent', 'uninstall'].includes(rawArgs[0] ?? '');
256
274
  }
257
275
  async function runCliWithErrorHandling(rawArgs) {
258
276
  try {
@@ -335,11 +353,10 @@ async function runUpgradeList(args) {
335
353
  const requestedArch = args.arch ? decode(archSchema, args.arch, '--arch') : process.arch;
336
354
  const platform = resolveUpgradePlatform(process.platform, requestedArch);
337
355
  const variant = decode(variantSchema, args.variant ?? 'baseline', '--variant');
338
- const page = positiveInteger(args.page ?? '1', '--page');
339
- const perPage = positiveInteger(args.perPage ?? '20', '--per-page');
356
+ const page = args.page ? positiveInteger(args.page, '--page') : undefined;
357
+ const perPage = args.perPage ? positiveInteger(args.perPage, '--per-page') : undefined;
340
358
  const catalog = await fetchReleaseCatalog({ ...platform, variant, currentVersion: readVersion() });
341
- const filtered = args.preReleases ? catalog.releases : catalog.releases.filter((release) => !release.prerelease);
342
- const paged = { ...catalog, releases: filtered.slice((page - 1) * perPage, page * perPage) };
359
+ const paged = paginateReleaseCatalog(catalog, page, perPage);
343
360
  write(options(args).format === 'json' ? renderJson(paged) : renderReleaseCatalog(paged));
344
361
  }
345
362
  async function runUpgrade(optionsValue, args) {
@@ -15,7 +15,7 @@ const createRecoveryInstructions = (targetVersion, os, targetSource = 'resolved'
15
15
  return {
16
16
  targetVersion,
17
17
  targetSource,
18
- installCommand: `curl -fsSL ${installerBaseUrl}/install.sh | sh -s -- --version '${escapeShell(targetVersion)}'`,
18
+ installCommand: `curl -fsSL ${installerBaseUrl}/install.sh | bash -s -- --version '${escapeShell(targetVersion)}'`,
19
19
  stopProcessCommand: 'pkill -x runx',
20
20
  };
21
21
  };