@hagicode/hagiscript is the CLI used to install and operate a managed HagiCode runtime. It manages the runtime layout, bundled services, managed npm tools, and the released backend server from a manifest-driven workflow.
npm install -g @hagicode/hagiscriptCheck the installed version:
hagiscript --versionFor a first-time setup, run these commands in order:
npm install -g @hagicode/hagiscript
hagiscript runtime install
hagiscript server install
hagiscript server start
hagiscript server statusIf you also want the npm tools declared in your runtime manifest:
hagiscript npm-sync --runtime-root ~/.hagicode/runtimeIf you are working with a custom manifest or runtime root, use the same flow with explicit paths:
hagiscript runtime install \
--from-manifest ./runtime/manifest.yaml \
--runtime-root ~/.hagicode/runtime
hagiscript server install \
--from-manifest ./runtime/manifest.yaml \
--runtime-root ~/.hagicode/runtime
hagiscript server start \
--from-manifest ./runtime/manifest.yaml \
--runtime-root ~/.hagicode/runtimeThe packaged runtime manifest defines these default components:
node: managed Node.js runtimedotnet: managed .NET runtimeomniroute: bundled PM2-managed servicecode-server: bundled PM2-managed serviceserver: released backend service package
The managed runtime layout separates immutable program files from mutable data:
program/: installed runtime payloads, wrappers, bundled executablesruntime-data/: mutable config, logs, PM2 state, managed npm packagesserver/: installed released server versionsserver-data/: server config, logs, PM2 runtime files, version state
By default, the packaged manifest installs into ~/.hagicode/runtime, but you can override that with --runtime-root.
Create a standalone editable manifest from Hagiscript's packaged default:
hagiscript manifest init ./hagiscript.manifest.yamlGenerate a manifest and set the managed layout at the same time:
hagiscript manifest init ./hagiscript.manifest.yaml \
--runtime-home program \
--runtime-data-root runtime-data \
--server-program-root server \
--server-data-root server-dataUpdate an existing manifest after initialization:
hagiscript manifest set ./hagiscript.manifest.yaml \
--npm-package-version pm2=7.0.2 \
--npm-package-version @openai/codex=0.126.0 \
--server-active-version 0.1.0-beta.60Print the current manifest summary in a friendlier format:
hagiscript manifest get ./hagiscript.manifest.yamlInstall the default runtime:
hagiscript runtime installInstall from an explicit manifest into a specific root:
hagiscript runtime install \
--from-manifest ./runtime/manifest.yaml \
--runtime-root ~/.hagicode/runtimeShow the current runtime state:
hagiscript runtime stateShow machine-readable state:
hagiscript runtime state --jsonPreview what would be installed without changing files:
hagiscript runtime install --dry-runUpdate installed components:
hagiscript runtime updateOnly check whether updates are needed:
hagiscript runtime update --check-onlyRemove the runtime but keep retained data where supported:
hagiscript runtime removePurge runtime data as well:
hagiscript runtime remove --purgeOperate on selected components only:
hagiscript runtime install --components node,dotnet
hagiscript runtime update --components code-server,omniroute
hagiscript runtime remove --components code-server --purgeThe typical runtime flow is:
hagiscript runtime install
hagiscript runtime state
hagiscript runtime updateIf you want a clean rebuild:
hagiscript runtime remove --purge
hagiscript runtime installThe managed server is installed separately from the core runtime. hagiscript server install ensures runtime dependencies are available, resolves a released server package, and makes that version active.
Install the server from the default source:
hagiscript server installInstall the server against an explicit runtime manifest and root:
hagiscript server install \
--from-manifest ./runtime/manifest.yaml \
--runtime-root ~/.hagicode/runtimeInstall from a local archive:
hagiscript server install --archive ./hagicode-server.zipInstall from a specific index version:
hagiscript server install --index-version 0.1.0-beta.60List installed server versions and the active version:
hagiscript server listSwitch the active version:
hagiscript server use 0.1.0-beta.60Remove an installed version:
hagiscript server remove 0.1.0-beta.60Start the managed server:
hagiscript server startStop it:
hagiscript server stopRestart it:
hagiscript server restartCheck status:
hagiscript server statusShow the startup environment:
hagiscript server envEmit JSON for status or environment:
hagiscript server status --json
hagiscript server env --jsonOverride the PM2 instance name used for namespaced app names:
hagiscript server start --instance myruntimeRead the effective managed server config:
hagiscript server config getUpdate host and port:
hagiscript server config set --host 127.0.0.1 --port 39150Read the config as JSON:
hagiscript server config get --jsonThe runtime manifest can also declare managed npm packages under npmSync. These packages are installed into the managed npm prefix under runtime-data/npm, not into program/.
If the managed runtime has already been installed, npm-sync can read runtime-data/state.json under the selected runtime and automatically reuse the recorded manifestPath and managed npm prefix. In that case you do not need to pass --from-manifest.
Sync npm packages by pointing at the runtime root:
hagiscript npm-sync --runtime-root ~/.hagicode/runtimeSync npm packages declared in a runtime manifest:
hagiscript npm-sync --from-manifest ./runtime/manifest.yamlnpm-sync does not define its own program/data/server root layout. It reads the runtime manifest associated with the selected runtime root and follows that manifest's npmSync definition.
If you want to change the npm tool versions captured in a manifest, update the manifest first:
hagiscript manifest set ./hagiscript.manifest.yaml \
--npm-package-version pm2=7.0.2 \
--npm-package-version @openai/codex=0.126.0Use an explicit managed Node runtime and prefix:
hagiscript npm-sync \
--from-manifest ./runtime/manifest.yaml \
--managed-runtime ~/.hagicode/runtime/program/components/node/runtime \
--prefix ~/.hagicode/runtime/runtime-data/npmForce re-sync even if installed versions already satisfy the requested target:
hagiscript npm-sync --from-manifest ./runtime/manifest.yaml --forceFor a fresh machine or a new runtime root, this is the usual sequence:
hagiscript runtime install
hagiscript server install
hagiscript server start
hagiscript server statusIf you also want the manifest-declared npm tools:
hagiscript npm-sync --runtime-root ~/.hagicode/runtimemanifest init [path]: generate an editable manifest from the packaged defaultmanifest get [path]: print a readable summary of the current manifestmanifest set <path>: update manifest paths, npmSync package versions, or server defaults--from-manifest <path>: use a specific runtime manifest YAML--runtime-root <path>: change the managed runtime root--runtime-home <path>: set the manifest's program root--runtime-data-root <path>: set the manifest's runtime-data root--server-program-root <path>: set the manifest's server program root--server-data-root <path>: set the manifest's server data root--npm-package-version <package=version>: update a manifest npmSync package entry--server-active-version <version>: set the manifest's preferred managed server version--components <list>: target specific runtime components--dry-run: print the plan without mutating files--force: force reinstall or update where supported--purge: remove retained mutable data during runtime removal--json: emit machine-readable output formanifest get, state, status, env, and config commands
MIT. See LICENSE.