Add hero_office selfstart CLI (hero_proc_service_selfstart pattern) #2

Closed
opened 2026-04-21 07:51:55 +00:00 by mahmoud · 0 comments
Owner

Problem

This repo does not follow the hero_proc_service_selfstart pattern used by every other Hero service. Specifically:

  • The cargo workspace contains only hero_office_server, hero_office_ui, hero_office_sdk, hero_office_examplesno top-level hero_office CLI crate.
  • buildenv.sh declares only BINARIES="hero_office_server hero_office_ui".
  • The archived hero_zero/services/hero_office.toml further references a non-existent __HERO_BIN__/hero_office binary and has no [ui] block.

As a consequence, tools/modules/services/service_office.nu in hero_skills has to hand-transcribe the full hero_proc action spec (retry policy, kill_other, health checks, env pass-through) rather than delegating to the canonical Rust definition — mirroring how hero_claude, hero_books, hero_agent, hero_voice, hero_collab, and ~8 other services encode it once in Rust.

Proposed solution

Add a small top-level hero_office CLI crate that follows the selfstart pattern:

hero_office --start    # register hero_office_server + hero_office_ui with hero_proc and start them
hero_office --stop     # stop and unregister via hero_proc

Scope

  • New crate crates/hero_office/ (lib-less, one src/main.rs) added to the workspace members list.
  • [[bin]] name = "hero_office".
  • Depends on hero_proc_sdk (git, branch development) and clap.
  • main.rs pattern: identical to hero_claude/crates/hero_claude/src/main.rs or hero_voice/crates/hero_voice/src/bin/hero_voice.rs:
    • clap struct with --start / --stop flags (conflicting).
    • build_service_definition() that returns a ServiceBuildResult with both actions (hero_office_server, hero_office_ui), their env (RUST_LOG base + the OnlyOffice pass-through vars: ONLYOFFICE_JWT_SECRET, OO_SERVER_URL, CONNECTOR_EXTERNAL_URL, DEFAULT_CONTEXT, HERO_SOCKET_DIR — forwarded only when set), their retry / health / kill_other / stop timeouts, and the service wrapper.
    • self_start() / self_stop()hero_proc_sdk::lifecycle::restart_service / stop_service.
  • Update buildenv.shBINARIES="hero_office hero_office_server hero_office_ui".
  • Update root Cargo.toml [workspace].members to include crates/hero_office.
  • Update README.md with the hero_office --start/--stop usage block.
  • Optional: update scripts/nu_service.nu to delegate to hero_office --start/--stop instead of duplicating the spec, OR simply note that it's a legacy pre-selfstart path.

Reference exemplars

  • lhumina_code/hero_claude/crates/hero_claude/src/main.rs — closest match (single service, two actions, soft preflight env).
  • lhumina_code/hero_voice/crates/hero_voice/src/bin/hero_voice.rs — even cleaner shape for the two-binary case.
  • lhumina_code/hero_agent/crates/hero_agent_daemon/src/main.rs — shows the _daemon crate naming if a separate crate is preferred.

Downstream effect

Once this lands, tools/modules/services/service_office.nu in hero_skills can be refactored to a thin delegator (~150 lines instead of ~400), removing the drift risk noted in hero_skills/issues/99.

See the hero_proc_service_selfstart skill for the canonical pattern description.

Refs: lhumina_code/hero_skills#75

## Problem This repo does not follow the `hero_proc_service_selfstart` pattern used by every other Hero service. Specifically: - The cargo workspace contains only `hero_office_server`, `hero_office_ui`, `hero_office_sdk`, `hero_office_examples` — **no top-level `hero_office` CLI crate**. - `buildenv.sh` declares only `BINARIES="hero_office_server hero_office_ui"`. - The archived `hero_zero/services/hero_office.toml` further references a non-existent `__HERO_BIN__/hero_office` binary and has no `[ui]` block. As a consequence, `tools/modules/services/service_office.nu` in `hero_skills` has to hand-transcribe the full hero_proc action spec (retry policy, kill_other, health checks, env pass-through) rather than delegating to the canonical Rust definition — mirroring how `hero_claude`, `hero_books`, `hero_agent`, `hero_voice`, `hero_collab`, and ~8 other services encode it once in Rust. ## Proposed solution Add a small top-level `hero_office` CLI crate that follows the selfstart pattern: ```bash hero_office --start # register hero_office_server + hero_office_ui with hero_proc and start them hero_office --stop # stop and unregister via hero_proc ``` ## Scope - New crate `crates/hero_office/` (lib-less, one `src/main.rs`) added to the workspace members list. - `[[bin]] name = "hero_office"`. - Depends on `hero_proc_sdk` (git, branch `development`) and `clap`. - `main.rs` pattern: identical to `hero_claude/crates/hero_claude/src/main.rs` or `hero_voice/crates/hero_voice/src/bin/hero_voice.rs`: - `clap` struct with `--start` / `--stop` flags (conflicting). - `build_service_definition()` that returns a `ServiceBuildResult` with both actions (`hero_office_server`, `hero_office_ui`), their env (RUST_LOG base + the OnlyOffice pass-through vars: `ONLYOFFICE_JWT_SECRET`, `OO_SERVER_URL`, `CONNECTOR_EXTERNAL_URL`, `DEFAULT_CONTEXT`, `HERO_SOCKET_DIR` — forwarded only when set), their retry / health / kill_other / stop timeouts, and the service wrapper. - `self_start()` / `self_stop()` → `hero_proc_sdk::lifecycle::restart_service` / `stop_service`. - Update `buildenv.sh` → `BINARIES="hero_office hero_office_server hero_office_ui"`. - Update root `Cargo.toml` `[workspace].members` to include `crates/hero_office`. - Update `README.md` with the `hero_office --start/--stop` usage block. - Optional: update `scripts/nu_service.nu` to delegate to `hero_office --start/--stop` instead of duplicating the spec, OR simply note that it's a legacy pre-selfstart path. ## Reference exemplars - `lhumina_code/hero_claude/crates/hero_claude/src/main.rs` — closest match (single service, two actions, soft preflight env). - `lhumina_code/hero_voice/crates/hero_voice/src/bin/hero_voice.rs` — even cleaner shape for the two-binary case. - `lhumina_code/hero_agent/crates/hero_agent_daemon/src/main.rs` — shows the `_daemon` crate naming if a separate crate is preferred. ## Downstream effect Once this lands, `tools/modules/services/service_office.nu` in `hero_skills` can be refactored to a thin delegator (~150 lines instead of ~400), removing the drift risk noted in `hero_skills/issues/99`. See the `hero_proc_service_selfstart` skill for the canonical pattern description. Refs: https://forge.ourworld.tf/lhumina_code/hero_skills/issues/75
Sign in to join this conversation.
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_office#2
No description provided.