@hagicode/hagiscript 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,356 +1,231 @@
1
- # Hagiscript
1
+ # Hagiscript Runtime Guide
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40hagicode%2Fhagiscript?logo=npm&color=cb3837)](https://www.npmjs.com/package/@hagicode/hagiscript)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/%40hagicode%2Fhagiscript?logo=npm&color=2d8cf0)](https://www.npmjs.com/package/@hagicode/hagiscript)
5
5
  [![license](https://img.shields.io/badge/license-MIT-ffd43b)](./LICENSE)
6
6
 
7
- `@hagicode/hagiscript` is the scoped npm package foundation for future Hagiscript language tooling. This initial package intentionally keeps runtime behavior small: it exposes version metadata, a baseline runtime-info API, and an executable CLI placeholder that can be built, tested, packed, and published safely.
7
+ `@hagicode/hagiscript` is the runtime management CLI behind the `hagicode-runtime` contract. Use it to install, inspect, update, remove, and operate a managed HagiCode runtime without depending on system Node.js, system PM2, or host-global npm packages.
8
8
 
9
- ## Installation Assumptions
10
-
11
- - Node.js 20 or newer is required.
12
- - npm is the package manager for this standalone repository.
13
- - The npm package name is `@hagicode/hagiscript`.
14
- - GitHub Actions publishing uses `npm publish --provenance`. Local manual publishing should use plain `npm publish` unless you are inside a supported trusted publishing environment.
15
-
16
- ## Usage
17
-
18
- Install the package from npm:
9
+ ## Install
19
10
 
20
11
  ```bash
21
- npm install @hagicode/hagiscript
12
+ npm install -g @hagicode/hagiscript
22
13
  ```
23
14
 
24
- The installed CLI command remains `hagiscript`.
15
+ Primary entrypoints:
25
16
 
26
- Run the CLI locally during development:
17
+ - `hagiscript`
18
+ - `hagicode-runtime` (`hagiscript runtime ...` wrapper)
27
19
 
28
- ```bash
29
- npm run dev -- --help
30
- npm run dev -- info
31
- npm run dev -- install-node --target .tmp/node-runtime
32
- npm run dev -- check-node --target .tmp/node-runtime
33
- npm run dev -- npm-sync --runtime .tmp/node-runtime --manifest manifest.json
34
- ```
20
+ Node.js 20 or newer is required to run the package itself.
35
21
 
36
- After building, run the compiled CLI:
22
+ ## Runtime Model
37
23
 
38
- ```bash
39
- npm run build
40
- node dist/cli.js --version
41
- node dist/cli.js info
42
- node dist/cli.js install-node --target .tmp/node-runtime
43
- node dist/cli.js check-node --target .tmp/node-runtime
44
- node dist/cli.js npm-sync --runtime .tmp/node-runtime --manifest manifest.json
24
+ By default, Hagiscript loads `runtime/manifest.yaml` and manages the runtime under `~/.hagicode/runtime`.
25
+
26
+ ```text
27
+ <runtime-root>/
28
+ program/
29
+ bin/
30
+ npm/
31
+ components/
32
+ runtime-data/
33
+ config/
34
+ logs/
35
+ data/
36
+ components/
37
+ state.json
45
38
  ```
46
39
 
47
- ### Managed Node.js Runtime Commands
40
+ The split is intentional:
48
41
 
49
- `install-node` downloads an official Node.js archive from `https://nodejs.org/dist`, extracts it into the target directory, and verifies both `node` and `npm` before reporting success.
42
+ - `program/` holds managed executables, vendored payloads, wrappers, and the managed npm prefix.
43
+ - `runtime-data/` holds mutable config, logs, state, PM2 data, and component-specific writable files.
50
44
 
51
- ```bash
52
- hagiscript install-node --target /opt/hagiscript/node
53
- hagiscript install-node --target /opt/hagiscript/node20 --version 20
54
- hagiscript install-node --target /opt/hagiscript/lts --version lts
55
- ```
45
+ The packaged manifest currently manages:
56
46
 
57
- When `--version` is omitted, Hagiscript installs the latest available Node.js 22 release. Supported selectors are `lts`, `latest`, `current`, a major version such as `22`, an exact version such as `22.12.0`, or an exact version with a `v` prefix such as `v22.12.0`.
47
+ - `node` - managed Node.js runtime
48
+ - `dotnet` - managed .NET and ASP.NET Core runtime
49
+ - `npm-packages` - managed npm prefix, including `pm2`
50
+ - `omniroute` - vendored bundled runtime
51
+ - `code-server` - vendored bundled runtime
58
52
 
59
- The target path must be missing or empty. Hagiscript refuses to install into a non-empty target directory and does not delete existing user files. During installation, temporary staging files are created beside the target directory and cleaned up after success or failure.
53
+ ## Core Runtime Commands
60
54
 
61
- Example success output:
55
+ Install the full runtime:
62
56
 
63
- ```text
64
- Installing Node.js 22 into /opt/hagiscript/node
65
- Download progress: 100%
66
- Node.js runtime installed successfully.
67
- Target: /opt/hagiscript/node
68
- Node.js: v22.12.0
69
- npm: 10.9.0
70
- node: /opt/hagiscript/node/bin/node
71
- npm: /opt/hagiscript/node/bin/npm
57
+ ```bash
58
+ hagiscript runtime install
72
59
  ```
73
60
 
74
- `check-node` validates an existing runtime directory and exits with code `0` only when both `node --version` and `npm --version` succeed.
61
+ Install selected components only:
75
62
 
76
63
  ```bash
77
- hagiscript check-node --target /opt/hagiscript/node
64
+ hagiscript runtime install --components node,npm-packages
78
65
  ```
79
66
 
80
- Example valid output:
67
+ Preview planned changes without mutating files:
81
68
 
82
- ```text
83
- Node.js runtime is valid.
84
- Target: /opt/hagiscript/node
85
- Node.js: v22.12.0
86
- npm: 10.9.0
87
- node: /opt/hagiscript/node/bin/node
88
- npm: /opt/hagiscript/node/bin/npm
69
+ ```bash
70
+ hagiscript runtime install --dry-run
71
+ hagiscript runtime update --check-only
89
72
  ```
90
73
 
91
- Example invalid output exits non-zero and includes the failure reason:
74
+ Inspect the canonical runtime state:
92
75
 
93
- ```text
94
- Node.js runtime is invalid.
95
- Target: /opt/hagiscript/node
96
- Reason: missing executable
76
+ ```bash
77
+ hagiscript runtime state
78
+ hagiscript runtime state --json
97
79
  ```
98
80
 
99
- ### npm Global Package Synchronization
100
-
101
- `npm-sync` aligns npm global packages inside a HagiScript-managed Node.js runtime with a JSON manifest. By default, it verifies or installs the managed runtime at `~/.hagiscript/node-runtime` and uses that runtime's `npm`; it does not use or mutate npm from the ambient shell `PATH`. Existing automation can keep passing `--runtime` to use an explicit runtime directory.
81
+ Update or remove managed components:
102
82
 
103
83
  ```bash
104
- hagiscript npm-sync --manifest ./manifest.json
105
- hagiscript npm-sync --runtime /opt/hagiscript/node --manifest ./manifest.json
106
- hagiscript npm-sync --manifest ./manifest.json --force
107
- hagiscript npm-sync --manifest ./manifest.json --registry-mirror https://registry.npmmirror.com/
108
- hagiscript npm-sync --manifest ./manifest.json --registry-mirror https://registry.npmmirror.com/ --mirror-only
84
+ hagiscript runtime update
85
+ hagiscript runtime remove --components code-server --purge
109
86
  ```
110
87
 
111
- Compatibility manifest schema:
112
-
113
- ```json
114
- {
115
- "registryMirror": "https://registry.npmmirror.com/",
116
- "packages": {
117
- "<npm-package-name>": {
118
- "version": "<semver range>",
119
- "target": "<optional npm install selector>"
120
- }
121
- }
122
- }
88
+ Override the runtime root or manifest when needed:
89
+
90
+ ```bash
91
+ hagiscript runtime install --runtime-root /srv/hagicode/runtime
92
+ hagiscript runtime state --from-manifest /path/to/runtime-manifest.yaml --json
123
93
  ```
124
94
 
125
- The required `version` field accepts package.json-style semver ranges such as `^1.2.0`, `>=1.0.0 <2.0.0`, or `1.0.0 || 2.0.0`. The optional `target` field controls the selector used for `npm install -g`; when omitted, Hagiscript installs `<package>@<version>`.
95
+ If you prefer the runtime-oriented wrapper:
126
96
 
127
- By default, `npm-sync` plans installed packages that already satisfy the requested range as `noop` and skips `npm install -g` for them. Use `--force` to skip that installed-package satisfaction check and re-run sync for matching packages. `--force` does not upgrade packages to the latest version and does not change semver selection; it only turns an otherwise skipped `noop` action into an executable `sync` action.
97
+ ```bash
98
+ hagicode-runtime install --runtime-root /srv/hagicode/runtime
99
+ ```
128
100
 
129
- The optional top-level `registryMirror` field configures the npm registry used for both inventory and install commands. It must be a non-empty absolute `http:` or `https:` URL. When present, HagiScript first appends `--registry <registryMirror>` to `npm list -g --depth=0 --json` and `npm install -g <package>@<selector>` without changing package selection. If that mirror-backed npm command fails, HagiScript automatically retries the same inventory or install command once against the official npm registry `https://registry.npmjs.org/`. This mirror-first retry scope is intentionally limited to npm inventory and package mutation commands; runtime validation, manifest validation, and package planning do not retry. This is useful for public mirrors such as `https://registry.npmmirror.com/` or enterprise registries such as `https://npm.company.example/repository/npm/`.
101
+ ## Runtime State and Maintenance
130
102
 
131
- Product-managed tool sync can use the expanded `tools` manifest shape. Mandatory tools are always included using internally pinned versions from `src/runtime/tool-sync-catalog.config.json`: OpenSpec skills (`skills@1.5.1`), OmniRoute (`omniroute@3.6.9`), and code-server (`code-server@4.117.0`). Optional agent CLI sync is enabled explicitly; selected built-in CLIs or custom npm packages are added when provided.
103
+ `hagiscript runtime state --json` is the canonical inspection surface for automation. It reports:
132
104
 
133
- ```json
134
- {
135
- "registryMirror": "https://npm.company.example/repository/npm/",
136
- "tools": {
137
- "optionalAgentCliSyncEnabled": true,
138
- "selectedOptionalAgentCliIds": ["codex", "claude-code", "fission-openspec", "opencode"],
139
- "customAgentClis": [
140
- {
141
- "packageName": "@scope/agent-cli",
142
- "version": "^1.0.0"
143
- }
144
- ]
145
- }
146
- }
147
- ```
105
+ - resolved runtime root
106
+ - `program/` and `runtime-data/` locations
107
+ - per-component install status
108
+ - per-component runtime data homes
109
+ - derived PM2 homes for managed services
110
+ - program/data path separation
148
111
 
149
- The first built-in optional agent CLI IDs are `codex` (`@openai/codex@0.125.0`), `claude-code` (`@anthropic-ai/claude-code@2.1.119`), `fission-openspec` (`@fission-ai/openspec@1.3.1`), `qoder` (`@qoder-ai/qodercli@0.1.48`), and `opencode` (`opencode-ai@1.14.24`). These built-in package versions are pinned in `src/runtime/tool-sync-catalog.config.json`. HagiScript validates unknown tool IDs, npm package names, and version selectors before `npm list` or `npm install` runs.
112
+ Use it before and after maintenance work to confirm the expected component set and writable paths.
150
113
 
151
- Use `--registry-mirror <url>` when automation needs to override the manifest registry for a single run. Precedence is CLI override first, manifest `registryMirror` second, and npm's default registry behavior third. If neither the CLI nor manifest provides a mirror, HagiScript does not add `--registry` and existing npm defaults, `.npmrc`, or environment configuration continue to apply.
114
+ Typical maintenance flow:
152
115
 
153
- Use `--mirror-only` when a run must stay on the configured mirror and must not retry against `https://registry.npmjs.org/`. When omitted, automatic official-registry fallback remains enabled by default for mirror-backed npm inventory and install commands.
116
+ 1. Check current state: `hagiscript runtime state --json`
117
+ 2. Apply changes: `hagiscript runtime install`, `update`, or `remove`
118
+ 3. Re-check state to confirm the final layout
119
+ 4. Operate services through `hagiscript pm2 ...`
154
120
 
155
- For simple product-managed requests, optional CLI selections can be provided directly without writing a manifest:
121
+ Lifecycle commands print the resolved manifest, managed root, changed component count, skipped entries, and log file path when a log is generated.
156
122
 
157
- ```bash
158
- hagiscript npm-sync --selected-agent-cli codex
159
- hagiscript npm-sync --selected-agent-cli codex --custom-agent-cli @scope/agent-cli@^1.0.0
160
- ```
123
+ ## Managed PM2 Services
161
124
 
162
- Example manifest for openspec and skills tooling:
163
-
164
- ```json
165
- {
166
- "packages": {
167
- "@openspec/cli": {
168
- "version": "^1.0.0"
169
- },
170
- "@hagicode/skills": {
171
- "version": ">=0.5.0 <1.0.0",
172
- "target": "0.5.4"
173
- }
174
- }
175
- }
176
- ```
125
+ Hagiscript manages runtime-scoped PM2 services for:
177
126
 
178
- During execution, Hagiscript validates the manifest and runtime before any npm install command runs, lists global packages with `/opt/hagiscript/node/bin/npm list -g --depth=0 --json`, plans no-op, install, upgrade, downgrade, or sync actions, and then runs `npm install -g <package>@<selector>` only for packages that need changes. With `--force`, packages that already satisfy the requested range are replanned from `noop` to `sync`, so the same selector is installed again to re-sync the existing target.
127
+ - `omniroute`
128
+ - `code-server`
179
129
 
180
- Example output:
130
+ Supported actions:
181
131
 
182
- ```text
183
- Manifest validated: ./manifest.json (2 packages, mode=packages)
184
- Registry mirror: https://registry.npmmirror.com/
185
- Fallback policy: auto
186
- Runtime validated: /opt/hagiscript/node
187
- node: /opt/hagiscript/node/bin/node (v22.12.0)
188
- npm: /opt/hagiscript/node/bin/npm (10.9.0)
189
- Detected global packages: 4
190
- Plan: @openspec/cli noop installed=1.0.2 required=^1.0.0 selector=@openspec/cli@^1.0.0
191
- Skip: @openspec/cli already satisfies range
192
- Plan: @hagicode/skills upgrade installed=0.4.0 required=>=0.5.0 <1.0.0 selector=@hagicode/skills@0.5.4
193
- Install: @hagicode/skills using @hagicode/skills@0.5.4
194
- Synced: @hagicode/skills (upgrade)
195
- npm-sync complete.
196
- Runtime: /opt/hagiscript/node
197
- Manifest: ./manifest.json
198
- Mode: packages
199
- Registry mirror: https://registry.npmmirror.com/
200
- Fallback policy: auto
201
- Fallback used: no
202
- Packages: 2
203
- No-op: 1
204
- Changed: 1
205
- ```
132
+ - `start`
133
+ - `stop`
134
+ - `status`
206
135
 
207
- Forced re-sync example:
136
+ Examples:
208
137
 
209
- ```text
210
- $ hagiscript npm-sync --manifest ./manifest.json --force
211
- Plan: @openspec/cli sync installed=1.0.2 required=^1.0.0 selector=@openspec/cli@^1.0.0
212
- Install: @openspec/cli using @openspec/cli@^1.0.0
213
- Synced: @openspec/cli (sync)
138
+ ```bash
139
+ hagiscript pm2 omniroute status
140
+ hagiscript pm2 omniroute start
141
+ hagiscript pm2 code-server stop
214
142
  ```
215
143
 
216
- When fallback is triggered, HagiScript logs `Fallback used: ...` during execution and records `Fallback detail: ...` in the final summary so CI or desktop automation can see which mirror failed, which official registry retry was used, and whether that retry succeeded.
144
+ The PM2 flow is runtime-scoped:
217
145
 
218
- ### Runtime Package Management
146
+ - PM2 is installed into the managed npm prefix, not the host environment.
147
+ - Hagiscript resolves the runtime manifest before every PM2 action.
148
+ - PM2 runs with the managed Node runtime and managed PATH ordering.
149
+ - `PM2_HOME` is derived from the managed runtime layout, so service state stays inside the runtime data boundary.
219
150
 
220
- `hagiscript runtime` adds a manifest-driven package manager for the broader `hagicode-runtime` contract. By default it loads `runtime/manifest.yaml` from the installed package, resolves the managed runtime root to `~/.hagicode/runtime`, then splits that managed runtime into a program home and a mutable runtime-data home unless `--runtime-root <path>` overrides the base location for a specific install, deployment mode, or automation run.
151
+ This means maintenance scripts should call `hagiscript pm2 ...` instead of a system `pm2` binary.
221
152
 
222
- ```bash
223
- hagiscript runtime install
224
- hagiscript runtime install --components node,npm-packages --dry-run
225
- hagiscript runtime update --runtime-root /opt/hagicode/runtime --check-only
226
- hagiscript runtime remove --components code-server --purge
227
- hagiscript runtime state --json
228
- ```
153
+ ## Runtime Environment Contract
229
154
 
230
- The packaged runtime manifest aligns its default component boundaries with HagiCode Desktop:
155
+ Runtime lifecycle scripts and managed services receive a stable environment contract:
231
156
 
232
- - Node is governed as a Desktop-aligned Node 22 toolchain component.
233
- - `.NET` is modeled as a Desktop-aligned 10.0 runtime component.
234
- - Mutable npm packages, including the managed `pm2` binary, are installed into a managed prefix under the runtime program home instead of the immutable Node payload or host-global npm locations.
235
- - `code-server` and `omniroute` stay grouped as vendored bundled-runtime components rather than npm-managed packages.
157
+ - `HAGICODE_RUNTIME_HOME` - runtime program home
158
+ - `HAGICODE_RUNTIME_DATA_HOME` - writable runtime data home for the current component
159
+ - `PM2_HOME` - PM2 state directory for the current managed service
160
+ - `PATH` - rebuilt so managed Node, managed npm, and managed wrappers come first
236
161
 
237
- The runtime layout is explicit and stable for downstream consumers:
162
+ This contract is what keeps installs, updates, wrappers, and PM2-managed services aligned to the same runtime root.
238
163
 
239
- ```text
240
- <runtime-root>/
241
- program/
242
- bin/
243
- npm/
244
- components/
245
- runtime-data/
246
- config/
247
- logs/
248
- data/
249
- components/
250
- state.json
251
- ```
164
+ ## Manifest Customization
165
+
166
+ `runtime/manifest.yaml` controls the runtime shape. Common override points:
252
167
 
253
- `hagiscript runtime state --json` is the canonical contract for install, update, remove, and downstream inspection. It reports the resolved runtime home, runtime data root, per-component runtime data homes, and derived PM2 homes so Desktop, local bootstrap flows, or automation does not need to probe files directly.
168
+ - `paths.runtimeRoot`
169
+ - `paths.runtimeHome`
170
+ - `paths.runtimeDataRoot`
171
+ - `paths.componentDataRoot`
172
+ - `paths.defaultPm2Home`
173
+ - component `runtimeDataDir`
174
+ - service `pm2.appName`
175
+ - service `pm2.cwd`
176
+ - service `pm2.script`
177
+ - service `pm2.args`
178
+ - service `pm2.env`
179
+ - service `pm2.pm2Home`
254
180
 
255
- Runtime lifecycle scripts and managed PM2 services receive the same public runtime environment contract:
181
+ For deployment-specific behavior, keep the packaged manifest as the baseline and pass `--from-manifest` with an override manifest rather than mutating the installed package in place.
256
182
 
257
- - `HAGICODE_RUNTIME_HOME` points to the runtime program home.
258
- - `HAGICODE_RUNTIME_DATA_HOME` points to the current component's writable runtime data home.
259
- - `PM2_HOME` defaults to a child directory beneath `HAGICODE_RUNTIME_DATA_HOME`.
260
- - `PATH` is rebuilt so the managed Node runtime, managed npm prefix, and managed wrappers take precedence over the ambient shell environment.
183
+ ## Related Runtime Tooling
261
184
 
262
- ### Managed PM2 Service Commands
185
+ ### Managed Node Runtime
263
186
 
264
- `hagiscript pm2` manages the runtime-scoped `omniroute` and `code-server` services through the PM2 binary installed by `hagiscript runtime install`.
187
+ Install a standalone managed Node.js runtime:
265
188
 
266
189
  ```bash
267
- hagiscript pm2 omniroute start
268
- hagiscript pm2 omniroute status
269
- hagiscript pm2 code-server stop
190
+ hagiscript install-node --target /opt/hagiscript/node
191
+ hagiscript install-node --target /opt/hagiscript/node22 --version 22
270
192
  ```
271
193
 
272
- Each PM2 command resolves the runtime manifest first, loads the canonical runtime homes, derives a component-scoped `PM2_HOME`, and executes the managed PM2 binary from `<runtime-home>/npm`. It does not rely on a system PM2 or a system Node on the ambient shell `PATH`.
273
-
274
- The packaged `runtime/manifest.yaml` can override:
275
-
276
- - runtime-level `paths.runtimeHome`, `paths.runtimeDataRoot`, `paths.componentDataRoot`, and `paths.defaultPm2Home`
277
- - component-level `runtimeDataDir`
278
- - service-level `pm2.appName`, `pm2.cwd`, `pm2.script`, `pm2.args`, `pm2.env`, and `pm2.pm2Home`
279
-
280
- The package also ships a thin `hagicode-runtime` wrapper binary that delegates to `hagiscript runtime ...` for automation that prefers a runtime-oriented entrypoint:
194
+ Validate an existing managed Node.js runtime:
281
195
 
282
196
  ```bash
283
- hagicode-runtime install --runtime-root /srv/hagicode/runtime
197
+ hagiscript check-node --target /opt/hagiscript/node
284
198
  ```
285
199
 
286
- Use the library API from ESM consumers:
200
+ ### Managed npm Package Sync
287
201
 
288
- ```ts
289
- import { createRuntimeInfo, getPackageMetadata } from "@hagicode/hagiscript";
202
+ Sync npm global packages into a managed runtime instead of the host environment:
290
203
 
291
- console.log(getPackageMetadata());
292
- console.log(createRuntimeInfo());
204
+ ```bash
205
+ hagiscript npm-sync --manifest ./manifest.json
206
+ hagiscript npm-sync --runtime /opt/hagiscript/node --manifest ./manifest.json
293
207
  ```
294
208
 
295
- ## Development Commands
209
+ This is mainly useful when runtime maintenance also needs a controlled agent CLI or package inventory inside the managed runtime.
210
+
211
+ ## Development
296
212
 
297
- Run all commands from `repos/hagiscript/`:
213
+ Run from `repos/hagiscript/`:
298
214
 
299
215
  ```bash
300
216
  npm install
301
- npm run lint
302
- npm run format:check
303
217
  npm test
304
218
  npm run build
305
219
  npm run pack:check
306
220
  ```
307
221
 
308
- Additional commands:
309
-
310
- ```bash
311
- npm run clean
312
- npm run format
313
- npm run test:watch
314
- npm run publish:prepare-dev-version
315
- npm run publish:verify-release -- v0.1.0
316
- ```
317
-
318
- ## Build Outputs
319
-
320
- `npm run build` compiles TypeScript with strict NodeNext settings into `dist/`. Expected entry points include:
321
-
322
- - `dist/index.js`
323
- - `dist/index.d.ts`
324
- - `dist/index.js.map`
325
- - `dist/cli.js`
326
- - `dist/cli.d.ts`
327
- - `dist/cli.js.map`
328
-
329
- The package `exports` field points consumers to `dist/index.js` and `dist/index.d.ts`. The published package name is `@hagicode/hagiscript`, and the `bin.hagiscript` entry points to `dist/cli.js`.
330
-
331
- ## Package Verification
332
-
333
- `npm run pack:check` runs a dry-run package inspection and fails if required runtime files are missing or source-only files are accidentally included. The published package should contain generated `dist` files and documentation, not raw tests, scripts, coverage, or temporary files.
334
-
335
- ## Release Automation
336
-
337
- GitHub Actions provide three automation paths:
338
-
339
- - `ci.yml` installs dependencies with `npm ci`, then runs tests, build, and package verification.
340
- - `npm-publish.yml` resolves a unique prerelease version from `main`, stamps both `package.json` and `package-lock.json` with `npm version --no-git-tag-version`, then publishes to the `dev` dist-tag.
341
- - `npm-publish.yml` also publishes stable GitHub releases tagged as `vX.Y.Z` to the `latest` dist-tag after validating the tag format, rejecting tags older than the repository base version, and stamping the stable version the same way.
342
- - `release-drafter.yml` keeps a categorized release draft using `.github/release-drafter.yml`.
343
-
344
- Before the first publish, make sure the npm organization or user scope `hagicode` exists on npm and grant publish access for `@hagicode/hagiscript`. For GitHub Actions releases, configure npm trusted publishing with package `@hagicode/hagiscript`, owner `HagiCode-org`, repository `hagiscript`, and workflow filename `npm-publish.yml`. Do not enter the full workflow path as the filename; leave the npm environment field empty unless the workflow job explicitly declares an environment. If the scope is missing or the workflow identity cannot create packages under it, npm returns `E404 Not Found` during the final `PUT https://registry.npmjs.org/@hagicode%2fhagiscript` publish request.
345
-
346
- Run the publish prerequisite check before retrying a failed release:
222
+ Useful runtime-focused checks:
347
223
 
348
224
  ```bash
349
- npm run publish:check-prereqs
225
+ npm run integration:runtime-management
226
+ npm run integration:installed-runtime
350
227
  ```
351
228
 
352
- For local manual releases, run plain `npm publish` after logging in with an npm account that can publish under `@hagicode`.
353
-
354
229
  ## License
355
230
 
356
231
  MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,37 @@
1
+ import { type CommandRunner } from "./command-launch.js";
2
+ export interface InstallManagedDotnetRuntimeOptions {
3
+ targetDirectory: string;
4
+ version: string;
5
+ runner?: CommandRunner;
6
+ fetchImpl?: typeof fetch;
7
+ platform?: NodeJS.Platform;
8
+ architecture?: string;
9
+ timeoutMs?: number;
10
+ scriptBaseUrl?: string;
11
+ verbose?: boolean;
12
+ }
13
+ export interface ManagedDotnetVerificationResult {
14
+ valid: boolean;
15
+ targetDirectory: string;
16
+ dotnetPath: string;
17
+ installedRuntimes: Record<string, string[]>;
18
+ requiredVersion: string;
19
+ failureReason?: string;
20
+ infoOutput?: string;
21
+ listRuntimesOutput?: string;
22
+ }
23
+ export interface InstallManagedDotnetRuntimeResult extends ManagedDotnetVerificationResult {
24
+ valid: true;
25
+ }
26
+ export declare function installManagedDotnetRuntime(options: InstallManagedDotnetRuntimeOptions): Promise<InstallManagedDotnetRuntimeResult>;
27
+ export declare function verifyManagedDotnetRuntime(options: {
28
+ targetDirectory: string;
29
+ version: string;
30
+ runner?: CommandRunner;
31
+ platform?: NodeJS.Platform;
32
+ timeoutMs?: number;
33
+ }): Promise<ManagedDotnetVerificationResult>;
34
+ export declare function getManagedDotnetExecutablePath(targetDirectory: string, platform?: NodeJS.Platform): string;
35
+ export declare function parseInstalledDotnetRuntimes(output: string): Record<string, string[]>;
36
+ export declare function mapDotnetArchitecture(architecture: string): "x64" | "arm64";
37
+ export declare function buildDotnetInstallScriptUrl(platform: NodeJS.Platform, scriptBaseUrl?: string): string;