feat(skills): service_os wasm_build + --wasm flag on service_complete #128

Closed
mik-tf wants to merge 2 commits from development_mik_wasm_build into development
Owner

Adds the Dioxus WASM shell build into hero_skills so DEPLOYMENT_NU_HERO_OS.md §6 (cd ~/code/hero_os; make build-wasm; make install-assets-release) becomes a single nu invocation.

Changes

New service_os wasm_build export

Runs make build-wasm (or scripts/build-wasm.sh fallback) inside the cloned hero_os repo, then copies dist/share/hero_os/public/ into ~/hero/share/hero_os/public/.

Flags:

  • --root — install assets under /root/hero/share/ (sudo)
  • --updateforge merge before building
  • --reset — wipe target/dx/ for a cold rebuild (preserves cargo cache)
  • --restart — also restart hero_os via hero_proc so the new bundle is picked up

service_complete --wasm

Runs service_os wasm_build --restart at the end of phase 2. Gated behind opt-in because the build is 20-30 min on a cold dx cache and not always wanted on iterative redeploys. Skipped under --core (which has no hero_os in its set anyway).

Quick path with WASM

su - driver -c '
  source ~/hero/cfg/init.sh
  nu -c "use ~/code/hero_skills/tools/modules/services *; service_complete --wasm"
'

Replaces both step 4 (service_complete) and the §6 manual block in the runbook.

Validation

nu -c "use tools/modules/services *" parses cleanly; runtime needs a hero_os clone + Dioxus toolchain to actually exercise.

Tracker

home#185.

Signed-off-by: mik-tf

Adds the Dioxus WASM shell build into hero_skills so [DEPLOYMENT_NU_HERO_OS.md §6](https://forge.ourworld.tf/lhumina_code/hero_demo/src/branch/development/docs/ops/DEPLOYMENT_NU_HERO_OS.md) (`cd ~/code/hero_os; make build-wasm; make install-assets-release`) becomes a single nu invocation. ## Changes ### New `service_os wasm_build` export Runs `make build-wasm` (or `scripts/build-wasm.sh` fallback) inside the cloned hero_os repo, then copies `dist/share/hero_os/public/` into `~/hero/share/hero_os/public/`. Flags: - `--root` — install assets under `/root/hero/share/` (sudo) - `--update` — `forge merge` before building - `--reset` — wipe `target/dx/` for a cold rebuild (preserves cargo cache) - `--restart` — also restart hero_os via hero_proc so the new bundle is picked up ### `service_complete --wasm` Runs `service_os wasm_build --restart` at the end of phase 2. Gated behind opt-in because the build is **20-30 min on a cold dx cache** and not always wanted on iterative redeploys. Skipped under `--core` (which has no hero_os in its set anyway). ## Quick path with WASM ```bash su - driver -c ' source ~/hero/cfg/init.sh nu -c "use ~/code/hero_skills/tools/modules/services *; service_complete --wasm" ' ``` Replaces both step 4 (`service_complete`) and the §6 manual block in the runbook. ## Validation `nu -c "use tools/modules/services *"` parses cleanly; runtime needs a hero_os clone + Dioxus toolchain to actually exercise. ## Tracker [home#185](https://forge.ourworld.tf/lhumina_code/home/issues/185). Signed-off-by: mik-tf
Adds the Dioxus WASM shell build into hero_skills so the runbook §6
(`cd ~/code/hero_os; make build-wasm; make install-assets-release`)
becomes a single nu invocation.

- New `service_os wasm_build` export — runs `make build-wasm` (or
  `scripts/build-wasm.sh` fallback) inside the cloned hero_os repo,
  copies `dist/share/hero_os/public/` into `~/hero/share/hero_os/public/`.
  Flags: --root, --update, --reset (clears target/dx for cold rebuild),
  --restart (also restarts hero_os via hero_proc).
- `service_complete --wasm` runs the build at the end of phase 2 +
  restarts hero_os. Gated behind opt-in because the build is 20-30 min
  on a cold dx cache and not always wanted on iterative redeploys.
  Skipped under --core (which has no hero_os in its set anyway).

Closes the deploy-side §6 gap from
lhumina_code/home#185.

Validation: `nu -c "use tools/modules/services *"` parses; runtime
needs a hero_os clone + Dioxus toolchain to actually exercise.

Signed-off-by: mik-tf
Author
Owner

Pre-merge audit caught one bug — pushed 424a3ba:

cd leaking cwd. The bare cd $repo_path; ^make build-wasm inside wasm_build would leak the working-directory change back to the caller after the function returned. Operators running service_complete --wasm in an interactive nu shell would have ended up in ~/code/hero_os afterwards, breaking subsequent commands that assume cwd is unchanged. Fixed by wrapping each build invocation in do { cd ...; ^make ... } so the cd is scoped to the do-block environment only.

Pre-merge audit caught one bug — pushed `424a3ba`: **`cd` leaking cwd.** The bare `cd $repo_path; ^make build-wasm` inside `wasm_build` would leak the working-directory change back to the caller after the function returned. Operators running `service_complete --wasm` in an interactive nu shell would have ended up in `~/code/hero_os` afterwards, breaking subsequent commands that assume cwd is unchanged. Fixed by wrapping each build invocation in `do { cd ...; ^make ... }` so the `cd` is scoped to the `do`-block environment only.
Caught during prod-readiness audit before merge: the bare `cd $repo_path`
inside wasm_build would leak the cwd change back to the caller's shell
context after the function returned.  Wrapped each build invocation in
`do { cd ... ; ^make/^bash ... }` so the cd is scoped to the do-block
environment only.

This was a real bug — operators running `service_complete --wasm` in an
interactive nu shell would have ended up in ~/code/hero_os afterwards,
silently breaking subsequent commands that assume cwd is unchanged.
mik-tf closed this pull request 2026-04-25 20:33:41 +00:00
Author
Owner

Squash-merged to development as 6d1f725. Branch deleted.

Squash-merged to `development` as [`6d1f725`](https://forge.ourworld.tf/lhumina_code/hero_skills/commit/6d1f725). Branch deleted.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_skills!128
No description provided.