@guiho/runx 0.2.5 → 0.2.7

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
@@ -15,6 +15,37 @@ owner: runx
15
15
 
16
16
  # Changelog
17
17
 
18
+ ## 0.2.7 - 2026-07-15
19
+
20
+ ### Added
21
+
22
+ - Added an interactive `runx init` command that collects the project name and
23
+ scripts directory, previews the generated catalog, and confirms before writing.
24
+ - Added safe cancellation and explicit overwrite confirmation so initialization
25
+ never leaves a partial manifest or replaces an existing catalog silently.
26
+
27
+ ### Changed
28
+
29
+ - Initialized catalogs now use the SemVer-compatible manifest version `1.0.0`,
30
+ configure `scripts.directory`, include the required `public` group, and begin
31
+ with an empty command list.
32
+ - `runx init` creates only `runx.yaml`; the configured `scripts` directory is
33
+ created later with the first real script.
34
+
35
+ ## 0.2.6 - 2026-07-14
36
+
37
+ ### Added
38
+
39
+ - Added Windows CI coverage for replacing a running executable, verifying the
40
+ installed target version, cleaning the old image, and rolling back failures.
41
+
42
+ ### Fixed
43
+
44
+ - Fixed `runx upgrade` on Windows so it replaces and verifies `runx.exe` before
45
+ reporting success instead of returning a detached `scheduled: true` state.
46
+ - Failed Windows replacements now restore the previous executable, report a
47
+ non-zero error, and clean `.new` and `.old` update files safely.
48
+
18
49
  ## 0.2.4 - 2026-07-14
19
50
 
20
51
  ### Added
package/DOCS.md CHANGED
@@ -28,6 +28,7 @@ lists its commands, and runs exactly one selected command.
28
28
  | `runx` | Show the home page and usage without loading a manifest. |
29
29
  | `runx -h`, `runx --help` | Show Citty-generated usage without loading a manifest. Append help to a command for command-specific usage. |
30
30
  | `runx -v`, `runx --version` | Show the installed version without loading a manifest. |
31
+ | `runx init [--cwd <path>]` | Interactively create an empty `runx.yaml` catalog in the selected directory. |
31
32
  | `runx list` | List all manifest commands. Add `--format json` for structured output. |
32
33
  | `runx describe <selector>` | Show one command's description and operational metadata. |
33
34
  | `runx check` | Validate discovery and the manifest without execution. |
@@ -48,6 +49,13 @@ Global flags: `--cwd <path>`, `--file <path>`, `--format <text|json>`,
48
49
  Unknown options and missing required arguments produce command usage instead
49
50
  of falling through to manifest discovery.
50
51
 
52
+ `runx init` is intentionally an interactive text workflow: it accepts `--cwd`
53
+ to select the target project, but rejects `--file` (the target is always
54
+ `runx.yaml`) and `--format json`. It previews the exact file, requires a final
55
+ confirmation, asks before replacing an existing file, and leaves no partial
56
+ file when cancelled. It creates the manifest only; the configured scripts
57
+ directory is created later when the first script is added.
58
+
51
59
  Citty is the CLI parser, command router, alias registry, and ordinary usage
52
60
  renderer. RunX keeps its home page, extended command tree, and manifest guide
53
61
  as the explicit `runx`, `--help-tree`, and `--help-docs` surfaces.
@@ -58,10 +66,14 @@ RunX searches upward from the current directory for `runx.yaml`. Use `--file`
58
66
  to select an explicit manifest. RunX does not merge files.
59
67
 
60
68
  ```yaml
61
- version: 1
69
+ version: "1.0.0"
62
70
  project:
63
71
  name: example
72
+ scripts:
73
+ directory: scripts
64
74
  groups:
75
+ public:
76
+ summary: Default public project commands.
65
77
  development:
66
78
  summary: Local development work.
67
79
  release:
@@ -85,14 +97,22 @@ commands:
85
97
  confirm: always
86
98
  ```
87
99
 
88
- Required fields are `uid`, `id`, `group`, `summary`, `description`, and
89
- `command`. `uid` and `id` begin with a lowercase letter and use lowercase
100
+ `version` is a Semantic Versioning string. RunX currently supports major
101
+ version `1`, including valid prerelease and build metadata forms. Every manifest
102
+ also requires `scripts.directory`, which must be a relative subdirectory inside
103
+ the manifest directory, and a `public` group with a non-empty summary. A
104
+ catalog may start with `commands: []`; every command added later must explicitly
105
+ name an existing group (normally `public`).
106
+
107
+ Required command fields are `uid`, `id`, `group`, `summary`, `description`,
108
+ and `command`. `uid` and `id` begin with a lowercase letter and use lowercase
90
109
  letters, digits, and hyphens. `uid` is globally unique; the group and ID pair
91
110
  is also unique.
92
111
 
93
- Optional fields are `cwd`, `shell`, `tags`, and `confirm`. `cwd` is relative to
94
- the manifest and cannot escape its directory. Shell values are `auto`, `bash`,
95
- `sh`, `powershell`, and `cmd`. Confirmation values are `never` and `always`.
112
+ Optional command fields are `cwd`, `shell`, `tags`, and `confirm`. `cwd` is
113
+ relative to the manifest and cannot escape its directory. Shell values are
114
+ `auto`, `bash`, `sh`, `powershell`, and `cmd`. Confirmation values are `never`
115
+ and `always`.
96
116
 
97
117
  ## Selectors and Safety
98
118
 
@@ -122,9 +142,11 @@ runx agents install local
122
142
 
123
143
  `devops/install.ps1` installs Windows assets and `devops/install.sh` installs
124
144
  macOS/Linux assets from GitHub Releases into the user's local bin directory.
125
- `runx upgrade` uses the matching release asset and replaces a native executable;
126
- on Windows replacement is scheduled after RunX exits. `runx uninstall` removes
127
- the same native executable and supports `--dry-run`.
145
+ `runx upgrade` uses the matching release asset and replaces a native executable.
146
+ On Windows it renames the running executable, installs and verifies the target
147
+ version at the original path, and restores the previous executable if replacement
148
+ fails. Only cleanup of the renamed old image is deferred until RunX exits.
149
+ `runx uninstall` removes the same native executable and supports `--dry-run`.
128
150
 
129
151
  When the latest GitHub Release matches the installed version, `runx upgrade` prints `Already up to date.` and exits successfully without downloading or scheduling executable replacement. JSON output reports `upToDate: true`.
130
152
 
package/README.md CHANGED
@@ -39,11 +39,29 @@ curl -fsSL https://raw.githubusercontent.com/CGuiho/runx/main/devops/install.sh
39
39
 
40
40
  ## Quick Start
41
41
 
42
- Create `runx.yaml` in a project root:
42
+ Start with the interactive initializer:
43
+
44
+ ```text
45
+ runx init
46
+ ```
47
+
48
+ It writes only `runx.yaml`—not an empty `scripts/` directory. The resulting
49
+ catalog starts with a SemVer `1.x` manifest version, a configurable scripts
50
+ directory, the required `public` group, and no commands. Add commands directly
51
+ or ask an agent to add a script under the configured directory and its command
52
+ entry together.
53
+
54
+ For example, a catalog with a development command can look like this:
43
55
 
44
56
  ```yaml
45
- version: 1
57
+ version: "1.0.0"
58
+ project:
59
+ name: example
60
+ scripts:
61
+ directory: scripts
46
62
  groups:
63
+ public:
64
+ summary: Default public project commands.
47
65
  development:
48
66
  summary: Local development commands.
49
67
  commands:
@@ -52,7 +70,7 @@ commands:
52
70
  group: development
53
71
  summary: Start the application locally.
54
72
  description: Starts the application in local development mode until interrupted.
55
- command: bun run dev
73
+ command: bash scripts/dev.sh
56
74
  shell: bash
57
75
  tags: [local, watch]
58
76
  ```
@@ -63,6 +81,7 @@ Then use RunX:
63
81
  runx Show the home page and usage.
64
82
  runx -h Show Citty-generated command help.
65
83
  runx -v Show the installed version without loading a manifest.
84
+ runx init Interactively create an empty runx.yaml catalog.
66
85
  runx list List commands in the nearest manifest.
67
86
  runx describe app-dev Explain one command without execution.
68
87
  runx run app-dev --dry-run Inspect the execution plan.
@@ -6,19 +6,26 @@ children: []
6
6
  files:
7
7
  alpha-boundaries.md: Captures accepted alpha scope, safety, distribution, and compatibility decisions.
8
8
  citty-cli-migration.md: Defines the accepted full migration from handwritten parsing and routing to Citty.
9
+ interactive-init-manifest.md: Defines interactive initialization, Semantic Versioning, the public group, and the scripts directory contract.
9
10
  mirror-automatic-push.md: Defines automatic Mirror release pushes with a synchronized protected-main gate.
10
11
  npm-trusted-publishing.md: Defines the accepted npm OIDC publishing workflow and protected-branch patch-release trial.
12
+ windows-self-upgrade.md: Defines synchronous Windows executable replacement, verification, rollback, and cleanup.
11
13
  documents:
12
14
  alpha-boundaries.md: Decision record for RunX alpha boundaries.
13
15
  citty-cli-migration.md: Decision record for the complete Citty CLI parser and router migration.
16
+ interactive-init-manifest.md: Accepted manifest and interactive initialization decision for runx init.
14
17
  mirror-automatic-push.md: Accepted release-policy decision for Mirror push=true and protected delivery ordering.
15
18
  npm-trusted-publishing.md: Decision record for GitHub Actions npm trusted publishing and the first automated patch release.
19
+ windows-self-upgrade.md: Accepted design for synchronous and recoverable Windows native self-upgrade.
16
20
  tags:
17
21
  - decisions
18
22
  keywords:
19
23
  - runx
20
24
  - decisions
25
+ - runx init
26
+ - scripts directory
21
27
  - mirror push
28
+ - windows self-upgrade
22
29
  flags: []
23
30
  status: stable
24
31
  ---
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: RunX Interactive Init Manifest
3
+ purpose: Preserve the accepted manifest structure and initialization behavior for runx init.
4
+ description: Defines the Semantic Versioning manifest field, mandatory public group, configurable scripts directory, and empty interactive initialization contract.
5
+ created: 2026-07-14
6
+ flags:
7
+ - accepted
8
+ - decision
9
+ tags:
10
+ - decisions
11
+ - cli
12
+ - manifest
13
+ keywords:
14
+ - runx init
15
+ - runx.yaml
16
+ - semantic versioning
17
+ - public group
18
+ - scripts directory
19
+ owner: runx-decisions
20
+ ---
21
+
22
+ # RunX Interactive Init Manifest
23
+
24
+ ## Status
25
+
26
+ Accepted by the project owner on 2026-07-14.
27
+
28
+ ## Context
29
+
30
+ RunX needs an interactive `runx init` command so a project can establish its
31
+ single `runx.yaml` command catalog before any commands exist. The repository
32
+ already defines groups and documented commands as the core catalog model. The
33
+ initializer must preserve that model without inventing framework-specific
34
+ commands, creating a second configuration file, or forcing a placeholder
35
+ command into the catalog.
36
+
37
+ Projects may later store executable Bash, PowerShell, or other script files in
38
+ a manifest-owned scripts directory. The manifest must identify that directory
39
+ so agents and developers use one predictable location when adding scripts.
40
+
41
+ ## Decision
42
+
43
+ ### Initialized manifest
44
+
45
+ `runx init` creates this shape, using the current directory name as the default
46
+ project name:
47
+
48
+ ```yaml
49
+ version: "1.0.0"
50
+
51
+ project:
52
+ name: my-project
53
+
54
+ scripts:
55
+ directory: scripts
56
+
57
+ groups:
58
+ public:
59
+ summary: Default public project commands.
60
+
61
+ commands: []
62
+ ```
63
+
64
+ The initializer creates only `runx.yaml`. It does not create an empty `scripts`
65
+ directory because the directory is created when the first script is written.
66
+
67
+ ### Manifest version
68
+
69
+ - `version` is a valid Semantic Versioning 2.0.0 string with a
70
+ `MAJOR.MINOR.PATCH` core and optional prerelease or build metadata.
71
+ - The first supported manifest contract is `"1.0.0"`.
72
+ - RunX accepts manifest versions whose major version is `1` and rejects
73
+ unsupported major versions.
74
+ - Numeric `version: 1` manifests are invalid. RunX is still under development
75
+ and has no deployed numeric-version compatibility requirement.
76
+ - Future backward-incompatible manifest changes require a major version change.
77
+
78
+ ### Scripts directory
79
+
80
+ - Every manifest contains `scripts.directory`; it configures the project script
81
+ location.
82
+ - The initializer's default value is `scripts` relative to the directory
83
+ containing `runx.yaml`.
84
+ - The path must remain inside the manifest directory and cannot escape through
85
+ an absolute path or parent traversal.
86
+ - Existing and future command strings may invoke any suitable script type from
87
+ this directory; RunX remains language-agnostic.
88
+ - The manifest command entry is the script descriptor. No sidecar RunX config
89
+ or per-script descriptor file is introduced.
90
+
91
+ ### Groups and commands
92
+
93
+ - `groups` is a first-class catalog concept.
94
+ - Every manifest contains a `public` group, analogous to PostgreSQL's default
95
+ `public` schema.
96
+ - Additional groups may organize commands by domain or responsibility.
97
+ - Every command explicitly names an existing group. Missing and unknown group
98
+ references are invalid.
99
+ - Authoring workflows place a new command in `public` unless the user requests
100
+ or selects another group, but the stored command still contains
101
+ `group: public` explicitly.
102
+ - An initialized catalog may contain no commands. Once present, every command
103
+ retains the required `uid`, `id`, `group`, `summary`, `description`, and
104
+ executable `command` fields.
105
+
106
+ ### Interactive behavior
107
+
108
+ - `runx init` is a first-class Citty command that never requires an existing
109
+ manifest.
110
+ - The interactive flow collects or confirms the project name and scripts
111
+ directory, renders a YAML preview, and requests confirmation before writing.
112
+ - The interface should use a polished terminal presentation with clear
113
+ progress, validation, cancellation, and success states.
114
+ - No framework-specific templates or automatic package-script imports are
115
+ offered.
116
+ - An existing `runx.yaml` is never overwritten without explicit confirmation.
117
+ - Cancellation leaves no partial file, and non-interactive invocation fails
118
+ clearly instead of hanging.
119
+
120
+ ## Alternatives Considered
121
+
122
+ ### Require a first command during initialization
123
+
124
+ Rejected. Initialization establishes the catalog so commands can be added later
125
+ from explicit developer requests. A fabricated starter command would make the
126
+ manifest less truthful.
127
+
128
+ ### Offer framework-specific templates or scan package scripts
129
+
130
+ Rejected. RunX is language-agnostic, and the project owner explicitly excluded
131
+ framework-specific starter templates from the initializer.
132
+
133
+ ### Keep numeric `version: 1` compatibility
134
+
135
+ Rejected. RunX has not been used outside development, so there is no legacy
136
+ manifest population to migrate. Supporting two version shapes would add
137
+ unnecessary schema and documentation complexity.
138
+
139
+ ### Store the scripts directory in a separate config file
140
+
141
+ Rejected. `runx.yaml` remains the single source of truth for the command
142
+ catalog and its script location.
143
+
144
+ ### Create the scripts directory eagerly
145
+
146
+ Rejected for initialization. An empty directory is not useful to the catalog
147
+ and is not preserved by Git. The directory should be created with the first
148
+ real script.
149
+
150
+ ## Consequences
151
+
152
+ - The manifest TypeBox schema must accept only supported Semantic Versioning
153
+ strings, require `scripts.directory`, and allow an empty command array.
154
+ - Semantic validation must require the `public` group and continue requiring
155
+ every command to reference a declared group.
156
+ - Script-directory validation must enforce a relative path within the manifest
157
+ root.
158
+ - Existing fixtures and documentation using numeric `version: 1` must move to
159
+ `version: "1.0.0"` and include `public`.
160
+ - Listing and checking an empty initialized manifest must succeed without
161
+ attempting command execution.
162
+ - The initializer needs an isolated prompt boundary so interactive behavior can
163
+ be tested without depending on a real terminal.
164
+ - The bundled agent skill update is intentionally deferred to the process that
165
+ delivers the complete agent-integration request.
166
+
167
+ ## Reversal Or Revisit Conditions
168
+
169
+ Revisit this decision only if real-world manifest migration requires a
170
+ compatibility policy, the command catalog needs multiple script roots, or a
171
+ future major manifest version replaces the group model. Such a change must be
172
+ recorded as a new decision and reflected in the manifest's major version.
173
+
174
+ ## Follow-up Work
175
+
176
+ - Implement the manifest schema and semantic validation changes.
177
+ - Implement and test the interactive `runx init` command.
178
+ - Update canonical CLI and manifest documentation.
179
+ - Update XDocs descriptors for every changed module or companion document.
180
+ - Leave agent-skill content changes for the complete agent-integration work.
181
+
182
+ ## References
183
+
184
+ - [Alpha boundaries](./alpha-boundaries.md)
185
+ - [Alpha command-catalog requirements](../requirements/alpha-command-catalog.md)
186
+ - [CLI architecture](../architecture/cli-architecture.md)
187
+ - [GitHub issue #10](https://github.com/CGuiho/runx/issues/10)
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: RunX Windows Self-Upgrade
3
+ purpose: Define synchronous and recoverable replacement of the running RunX executable on Windows.
4
+ description: Records the accepted Windows executable-swap, verification, rollback, cleanup, testing, and patch-release behavior.
5
+ created: 2026-07-14
6
+ flags:
7
+ - accepted
8
+ - implemented
9
+ tags:
10
+ - decisions
11
+ - cli
12
+ - windows
13
+ keywords:
14
+ - runx upgrade
15
+ - windows self-upgrade
16
+ - executable replacement
17
+ - rollback
18
+ owner: runx-decisions
19
+ ---
20
+
21
+ # RunX Windows Self-Upgrade
22
+
23
+ ## Context
24
+
25
+ RunX 0.2.5 downloads a Windows update to `runx.exe.new`, starts a detached
26
+ `cmd.exe` process, reports `scheduled: true`, and exits without confirming that
27
+ the installed executable was replaced. The detached move can fail silently and
28
+ leave later invocations on the previous version.
29
+
30
+ Windows permits the running executable to be renamed while its image remains
31
+ mapped. A new executable can then be installed at the original path before the
32
+ current RunX process exits. Only deletion of the renamed, still-running image
33
+ must wait until the process releases it.
34
+
35
+ ## Decision
36
+
37
+ `runx upgrade` on Windows will complete the executable swap synchronously:
38
+
39
+ 1. Download the selected release asset to `runx.exe.new`.
40
+ 2. Remove any stale backup that is not in use.
41
+ 3. Rename the installed `runx.exe` to `runx.exe.old`.
42
+ 4. Rename `runx.exe.new` to the canonical installed path.
43
+ 5. Execute the newly installed path with `--version` and require the expected
44
+ target version and a zero exit code.
45
+ 6. If installation or verification fails, remove the failed replacement and
46
+ restore `runx.exe.old` to the canonical path.
47
+ 7. After successful verification, delete the backup immediately when possible;
48
+ when Windows still locks the running image, schedule only that backup cleanup
49
+ for after the current process exits.
50
+
51
+ The upgrade result reports `scheduled: false`. Deferred deletion of the old,
52
+ renamed image is cleanup and does not defer or weaken successful replacement.
53
+
54
+ ## Error Handling
55
+
56
+ - A replacement failure must throw a concise `RunXError` and produce a non-zero
57
+ CLI exit code.
58
+ - Rollback must be attempted whenever the installed executable was renamed but
59
+ the new executable was not verified.
60
+ - If rollback also fails, the error must report both the replacement and
61
+ recovery failures and identify the affected installed path.
62
+ - The `.new` file must be removed after failures and must not remain after a
63
+ successful rename.
64
+ - A locked stale `.old` file must stop a new upgrade before the current
65
+ executable is modified.
66
+
67
+ ## Testing
68
+
69
+ Automated coverage must prove that:
70
+
71
+ - the configured Windows self path contains the downloaded replacement before
72
+ `upgradeSelf()` resolves;
73
+ - successful Windows upgrades report `scheduled: false`;
74
+ - no `.new` file remains after success;
75
+ - a failed replacement restores the original executable;
76
+ - the equal-version no-op remains unchanged;
77
+ - `runx -h` continues to work outside a manifest directory.
78
+
79
+ The full release gate is `bun run typecheck`, `bun test`, `bun run build`,
80
+ `bun run binary`, `bun run binaries`, and strict XDocs validation.
81
+
82
+ ## Release
83
+
84
+ After implementation and validation, use Mirror to plan and apply the next
85
+ patch. Update the changelog before applying the Mirror-managed version. Do not
86
+ hand-edit the package version or create the release tag manually.
87
+
88
+ ## Acceptance Criteria
89
+
90
+ - When `runx upgrade` succeeds, the executable at the installed path is already
91
+ the target release.
92
+ - A same-terminal or new-terminal invocation immediately reports the target
93
+ version.
94
+ - The command never reports `scheduled: true` for upgrade replacement.
95
+ - Replacement and verification failures are visible and recover the old binary.
96
+ - Temporary update files are cleaned up safely.
97
+ - Issue #9 has automated Windows regression coverage and issue #1 remains
98
+ covered by the Citty help tests.
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: RunX Interactive Init Manifest Plan
3
+ purpose: Sequence implementation of the accepted runx init workflow and manifest contract.
4
+ description: Defines the schema, interactive terminal UI, validation, documentation, and pull-request work for RunX initialization.
5
+ created: 2026-07-14
6
+ flags:
7
+ - approved
8
+ tags:
9
+ - plans
10
+ - cli
11
+ - manifest
12
+ keywords:
13
+ - runx init
14
+ - runx.yaml
15
+ - semantic versioning
16
+ - public group
17
+ - scripts directory
18
+ owner: runx-plans
19
+ ---
20
+
21
+ # RunX Interactive Init Manifest Plan
22
+
23
+ ## Sources
24
+
25
+ - [Interactive Init Manifest Decision](../decisions/interactive-init-manifest.md)
26
+ - [Alpha Command Catalog Requirements](../requirements/alpha-command-catalog.md)
27
+ - [CLI Architecture](../architecture/cli-architecture.md)
28
+ - GitHub issue [#10](https://github.com/CGuiho/runx/issues/10)
29
+
30
+ ## Unit 1: Establish the Manifest Contract
31
+
32
+ - Goal: Make the current manifest validator enforce the accepted `1.x.x`
33
+ Semantic Versioning, scripts directory, public group, and empty catalog
34
+ contract.
35
+ - Owner: `C:\GUIHO\runx`.
36
+ - Dependencies: Accepted interactive-init decision.
37
+ - Files:
38
+ - `source/manifest.ts`
39
+ - `source/types.ts` when TypeScript inference exposes the new manifest shape
40
+ - `source/guiho-runx.spec.ts`
41
+ - `source/cli.spec.ts` fixtures that construct manifests
42
+ - Behavior:
43
+ - Replace numeric `version: 1` with a Semantic Versioning string and accept
44
+ only supported major version `1`.
45
+ - Require `scripts.directory` as a non-empty relative path inside the
46
+ manifest root.
47
+ - Require the `public` group with a non-empty summary.
48
+ - Permit an empty `commands` array while keeping every populated command
49
+ explicit about its existing group.
50
+ - Preserve strict unknown-property rejection and existing selector and
51
+ execution safety behavior.
52
+ - Data, auth, permissions, and cache: Local YAML contract only. No remote data,
53
+ authentication, authorization, cache, or secret changes.
54
+ - Tests:
55
+ - Accept `"1.0.0"` and prerelease/build SemVer forms with major `1`.
56
+ - Reject numeric versions, malformed SemVer, unsupported major versions,
57
+ missing scripts configuration, escaping script paths, missing public, and
58
+ commands that name unknown groups.
59
+ - Prove empty initialized catalogs check and list without execution.
60
+ - Acceptance: `readManifest()` returns a strict manifest with `scripts` and
61
+ `public`, and invalid configurations fail with actionable `RunXError`
62
+ messages.
63
+ - Stop conditions: Stop if SemVer support would require a migration policy,
64
+ scripts need more than one root, or the change weakens command safety.
65
+
66
+ ## Unit 2: Implement the Interactive Initializer
67
+
68
+ - Goal: Add a beautiful, cancellable `runx init` Citty command that creates a
69
+ valid empty `runx.yaml` without ever executing a configured command.
70
+ - Dependencies: Unit 1.
71
+ - Files:
72
+ - `package.json`
73
+ - `bun.lock`
74
+ - `source/init.ts`
75
+ - `source/init.spec.ts`
76
+ - `source/cli.ts`
77
+ - `source/cli.spec.ts`
78
+ - `source/help.ts`
79
+ - Behavior:
80
+ - Use a dependency-free Bun terminal prompt adapter with clear visual states,
81
+ so the initializer remains portable across native and Windows builds.
82
+ - Isolate prompt interactions behind an injected interface so prompt flow and
83
+ filesystem behavior can be tested without a real terminal.
84
+ - In an interactive terminal, welcome the user, collect a project name
85
+ defaulting to the selected directory name, collect a scripts directory
86
+ defaulting to `scripts`, preview the exact YAML, and request confirmation.
87
+ - Write only `runx.yaml`; create `scripts/` later when the first real script
88
+ is added.
89
+ - Detect an existing `runx.yaml` in the selected directory and require a
90
+ second explicit overwrite confirmation.
91
+ - Use an atomic temporary-file write and leave no partial manifest on
92
+ cancellation or failure.
93
+ - Fail clearly outside an interactive terminal; do not hang and do not emit
94
+ interactive ANSI frames into JSON output.
95
+ - Accept `--cwd` as the target directory, reject `--file` because the
96
+ initializer always creates `runx.yaml`, and reject `--format json` because
97
+ initialization is an interactive terminal workflow.
98
+ - Register `init` as a first-class Citty command, include it in help/home and
99
+ command-tree output, and reserve the word from selector shorthand.
100
+ - Tests:
101
+ - Successful creation exactly matches the accepted YAML shape.
102
+ - Cancellation leaves no file.
103
+ - Existing-file rejection and confirmed overwrite are safe.
104
+ - Default and custom project/scripts values validate.
105
+ - CLI help works outside a manifest and non-interactive invocation exits with
106
+ a clear error.
107
+ - `--file` and `--format json` report clear unsupported-option errors without
108
+ creating files.
109
+ - The generated file passes `runx check` and `runx list`.
110
+ - Acceptance: `runx init` produces a polished, deterministic creation flow and
111
+ never executes a manifest command.
112
+ - Stop conditions: Stop if the terminal prompt adapter fails Bun tests or native
113
+ compile, if Citty cannot route `init` without conflicting with selector shorthand, or
114
+ if atomic replacement is not portable on Windows.
115
+
116
+ ## Unit 3: Align Canonical Documentation and XDocs
117
+
118
+ - Goal: Make public and structured documentation accurately describe the new
119
+ manifest and initializer without modifying the bundled agent skill.
120
+ - Dependencies: Units 1 and 2.
121
+ - Files:
122
+ - `README.md`
123
+ - `DOCS.md`
124
+ - `source/source.xdocs.md`
125
+ - `runx.xdocs.md` when its package description needs updating
126
+ - `docs/plans/plans.xdocs.md`
127
+ - Behavior:
128
+ - Document `runx init`, Semantic Versioning, `scripts.directory`, mandatory
129
+ `public`, empty catalog initialization, and command-to-script examples.
130
+ - Keep the bundled `skills/guiho-s-runx/SKILL.md` unchanged; its update belongs
131
+ to the separate agent-integration delivery requested by the project owner.
132
+ - Update the source descriptor for the initializer module and changed CLI /
133
+ manifest responsibilities.
134
+ - Checks:
135
+ - `xdocs meta docs\plans --documents --strict --format json`
136
+ - `xdocs meta source --strict --format json`
137
+ - `xdocs tree`
138
+ - Acceptance: User-facing docs, XDocs metadata, and implementation agree.
139
+ - Stop conditions: Stop if XDocs requires unrelated coverage cleanup; validate
140
+ only the affected subtrees and report wider pre-existing findings.
141
+
142
+ ## Unit 4: Validate, Review, Commit, Push, and Open a Pull Request
143
+
144
+ - Goal: Produce evidence that the implementation satisfies the accepted
145
+ decision, then deliver it as a draft pull request from `codex/runx-init`.
146
+ - Dependencies: Units 1 through 3.
147
+ - Checks:
148
+ - `bun run typecheck`
149
+ - `bun test`
150
+ - `bun run build`
151
+ - `bun run binary`
152
+ - `xdocs meta docs\plans --documents --strict --format json`
153
+ - `xdocs meta source --strict --format json`
154
+ - `xdocs tree`
155
+ - `git diff --check`
156
+ - Delivery:
157
+ - Write an implementation review and validation report with XDocs metadata.
158
+ - Commit coherent code, tests, documentation, and validation artifacts.
159
+ - Push only the feature branch and create a draft pull request that links
160
+ issue #10 and states that agent-skill automation is intentionally tracked
161
+ separately in issue #11.
162
+ - Acceptance: All applicable checks pass, the worktree is clean, the branch is
163
+ pushed, and the draft pull request is reviewable without a release, tag, or
164
+ package publication.
165
+ - Stop conditions: Stop before push/PR if validation fails, unrelated changes
166
+ appear, GitHub rejects authentication, or the branch diverges unexpectedly.
167
+
168
+ ## TODO Alignment
169
+
170
+ This is one approved, focused package implementation and does not need a new
171
+ long-running TODO entry. The decision, plan, review, and validation records are
172
+ the durable delivery trail.
173
+
174
+ ## First Executable Unit
175
+
176
+ Unit 1: update `source/manifest.ts` and its fixtures/tests to enforce the
177
+ accepted manifest contract.