fix self start #1

Open
opened 2026-03-21 04:02:27 +00:00 by despiegk · 4 comments
Owner

first check /code_manage_development_branch

then make sure that we have $servicename_ui and $servicename
the last one is the cli which uses the $servicename_sdk

check all carrefully and fix what needs to be fixed

check /hero_proc_service_selfstart
and that we cleanly start in makefile

first check /code_manage_development_branch then make sure that we have $servicename_ui and $servicename the last one is the cli which uses the $servicename_sdk check all carrefully and fix what needs to be fixed check /hero_proc_service_selfstart and that we cleanly start in makefile
Author
Owner

Implementation Spec: Fix Self-Start for hero_matrixchat

Objective

Wire up the hero_proc_sdk self-start/self-stop pattern to both hero_matrixchat_server and hero_matrixchat_ui, and update the Makefile to use --start / --stop flags so that services are managed cleanly through Hero Proc rather than via raw background processes and ad-hoc shell scripts.


Current State (Findings)

Component Status
hero_matrixchat (CLI) Exists, uses hero_matrixchat_sdk. No --start/--stop needed here (it is the CLI tool).
hero_matrixchat_sdk Exists as library crate. No hero_proc_sdk dependency needed.
hero_matrixchat_server Exists. main.rs has no --start/--stop flags. No hero_proc_sdk dependency.
hero_matrixchat_ui Exists. main.rs has no --start/--stop flags. No hero_proc_sdk dependency.
Makefile run/stop Delegates to scripts/run.sh and scripts/stop.sh — raw background process management, not hero_proc.
Makefile start/stop via hero_proc Missing entirely.
Workspace Cargo.toml No [workspace.dependencies] — each crate declares its own. No hero_proc_sdk entry anywhere.

Requirements

  • Add hero_proc_sdk as a workspace-level dependency in the root Cargo.toml.
  • Add hero_proc_sdk to hero_matrixchat_server/Cargo.toml and hero_matrixchat_ui/Cargo.toml.
  • Add --start and --stop CLI flags to hero_matrixchat_server/src/main.rs with self_start() and self_stop() async functions.
  • Add --start and --stop CLI flags to hero_matrixchat_ui/src/main.rs with self_start() and self_stop() async functions, where the UI service declares requires: ["hero_matrixchat_server"].
  • Add start, stop, run-server, and run-ui targets to the Makefile that use --start / --stop flags.
  • Service names: hero_matrixchat_server and hero_matrixchat_ui.

Files to Modify

File Action
Cargo.toml (workspace root) Add [workspace.dependencies] with hero_proc_sdk git dependency
crates/hero_matrixchat_server/Cargo.toml Add hero_proc_sdk = { workspace = true }
crates/hero_matrixchat_server/src/main.rs Add --start/--stop flags + self_start()/self_stop() functions
crates/hero_matrixchat_ui/Cargo.toml Add hero_proc_sdk = { workspace = true }
crates/hero_matrixchat_ui/src/main.rs Add --start/--stop flags + self_start()/self_stop() functions (with requires: ["hero_matrixchat_server"])
Makefile Replace shell-script run/stop with hero_proc --start/--stop targets

Implementation Steps

  1. Add hero_proc_sdk to workspace Cargo.toml — add [workspace.dependencies] section with git source
  2. Add hero_proc_sdk to hero_matrixchat_server/Cargo.tomlhero_proc_sdk = { workspace = true }
  3. Add self-start/self-stop to hero_matrixchat_server/src/main.rs--start/--stop args + self_start()/self_stop() async functions
  4. Add hero_proc_sdk to hero_matrixchat_ui/Cargo.tomlhero_proc_sdk = { workspace = true }
  5. Add self-start/self-stop to hero_matrixchat_ui/src/main.rs--start/--stop args + self_start()/self_stop() async functions (with requires: ["hero_matrixchat_server"])
  6. Update Makefile — replace run/stop scripts with start/stop/run-server/run-ui hero_proc targets
  7. Verify buildcargo check --workspace

Acceptance Criteria

  • cargo check --workspace passes with no errors
  • hero_matrixchat_server --help shows --start and --stop flags
  • hero_matrixchat_ui --help shows --start and --stop flags
  • make start calls --start on both binaries
  • make stop calls --stop on both binaries
  • hero_matrixchat_ui self-start declares requires: ["hero_matrixchat_server"]
# Implementation Spec: Fix Self-Start for `hero_matrixchat` ## Objective Wire up the `hero_proc_sdk` self-start/self-stop pattern to both `hero_matrixchat_server` and `hero_matrixchat_ui`, and update the Makefile to use `--start` / `--stop` flags so that services are managed cleanly through Hero Proc rather than via raw background processes and ad-hoc shell scripts. --- ## Current State (Findings) | Component | Status | |---|---| | `hero_matrixchat` (CLI) | Exists, uses `hero_matrixchat_sdk`. No `--start`/`--stop` needed here (it is the CLI tool). | | `hero_matrixchat_sdk` | Exists as library crate. No `hero_proc_sdk` dependency needed. | | `hero_matrixchat_server` | Exists. `main.rs` has no `--start`/`--stop` flags. No `hero_proc_sdk` dependency. | | `hero_matrixchat_ui` | Exists. `main.rs` has no `--start`/`--stop` flags. No `hero_proc_sdk` dependency. | | `Makefile` `run`/`stop` | Delegates to `scripts/run.sh` and `scripts/stop.sh` — raw background process management, not hero_proc. | | `Makefile` `start`/`stop` via hero_proc | Missing entirely. | | Workspace `Cargo.toml` | No `[workspace.dependencies]` — each crate declares its own. No `hero_proc_sdk` entry anywhere. | --- ## Requirements - Add `hero_proc_sdk` as a workspace-level dependency in the root `Cargo.toml`. - Add `hero_proc_sdk` to `hero_matrixchat_server/Cargo.toml` and `hero_matrixchat_ui/Cargo.toml`. - Add `--start` and `--stop` CLI flags to `hero_matrixchat_server/src/main.rs` with `self_start()` and `self_stop()` async functions. - Add `--start` and `--stop` CLI flags to `hero_matrixchat_ui/src/main.rs` with `self_start()` and `self_stop()` async functions, where the UI service declares `requires: ["hero_matrixchat_server"]`. - Add `start`, `stop`, `run-server`, and `run-ui` targets to the Makefile that use `--start` / `--stop` flags. - Service names: `hero_matrixchat_server` and `hero_matrixchat_ui`. --- ## Files to Modify | File | Action | |---|---| | `Cargo.toml` (workspace root) | Add `[workspace.dependencies]` with `hero_proc_sdk` git dependency | | `crates/hero_matrixchat_server/Cargo.toml` | Add `hero_proc_sdk = { workspace = true }` | | `crates/hero_matrixchat_server/src/main.rs` | Add `--start`/`--stop` flags + `self_start()`/`self_stop()` functions | | `crates/hero_matrixchat_ui/Cargo.toml` | Add `hero_proc_sdk = { workspace = true }` | | `crates/hero_matrixchat_ui/src/main.rs` | Add `--start`/`--stop` flags + `self_start()`/`self_stop()` functions (with `requires: ["hero_matrixchat_server"]`) | | `Makefile` | Replace shell-script run/stop with hero_proc `--start`/`--stop` targets | --- ## Implementation Steps 1. **Add `hero_proc_sdk` to workspace Cargo.toml** — add `[workspace.dependencies]` section with git source 2. **Add `hero_proc_sdk` to `hero_matrixchat_server/Cargo.toml`** — `hero_proc_sdk = { workspace = true }` 3. **Add self-start/self-stop to `hero_matrixchat_server/src/main.rs`** — `--start`/`--stop` args + `self_start()`/`self_stop()` async functions 4. **Add `hero_proc_sdk` to `hero_matrixchat_ui/Cargo.toml`** — `hero_proc_sdk = { workspace = true }` 5. **Add self-start/self-stop to `hero_matrixchat_ui/src/main.rs`** — `--start`/`--stop` args + `self_start()`/`self_stop()` async functions (with `requires: ["hero_matrixchat_server"]`) 6. **Update Makefile** — replace `run`/`stop` scripts with `start`/`stop`/`run-server`/`run-ui` hero_proc targets 7. **Verify build** — `cargo check --workspace` --- ## Acceptance Criteria - [ ] `cargo check --workspace` passes with no errors - [ ] `hero_matrixchat_server --help` shows `--start` and `--stop` flags - [ ] `hero_matrixchat_ui --help` shows `--start` and `--stop` flags - [ ] `make start` calls `--start` on both binaries - [ ] `make stop` calls `--stop` on both binaries - [ ] `hero_matrixchat_ui` self-start declares `requires: ["hero_matrixchat_server"]`
Author
Owner

Test Results

  • Status: PASS
  • Output: All 7 test suites passed (1 test ran, 6 suites with 0 tests, 0 failures)
Full output
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.59s
     Running unittests src/main.rs (target/debug/deps/hero_matrixchat-0c03af5da4bf254e)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_rhai-981ee71165765beb)

running 1 test
test tests::test_register ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_sdk-e594da9eed6c7943)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_server-d188501f19149f2a)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/main.rs (target/debug/deps/hero_matrixchat_server-b89e302dac3a0476)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_ui-218f5e0322f84cd4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/main.rs (target/debug/deps/hero_matrixchat_ui-5dfcd2257e93b485)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
## Test Results - Status: PASS - Output: All 7 test suites passed (1 test ran, 6 suites with 0 tests, 0 failures) <details> <summary>Full output</summary> ``` Finished `test` profile [unoptimized + debuginfo] target(s) in 0.59s Running unittests src/main.rs (target/debug/deps/hero_matrixchat-0c03af5da4bf254e) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_rhai-981ee71165765beb) running 1 test test tests::test_register ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_sdk-e594da9eed6c7943) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_server-d188501f19149f2a) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/main.rs (target/debug/deps/hero_matrixchat_server-b89e302dac3a0476) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/lib.rs (target/debug/deps/hero_matrixchat_ui-218f5e0322f84cd4) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Running unittests src/main.rs (target/debug/deps/hero_matrixchat_ui-5dfcd2257e93b485) running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` </details>
Author
Owner

Implementation Complete

Changes Made

Cargo.toml (workspace root)

  • Added [workspace.dependencies] section with hero_proc_sdk git dependency (forge.ourworld.tf/lhumina_code/hero_proc.git, branch: development)

crates/hero_matrixchat_server/Cargo.toml

  • Added hero_proc_sdk = { workspace = true }

crates/hero_matrixchat_server/src/main.rs

  • Added --start and --stop CLI flags to Args
  • Added self_start() async function: registers action + service with Hero Proc, health check via Unix socket ~/hero/var/sockets/hero_matrixchat_server.sock
  • Added self_stop() async function: stops service via Hero Proc

crates/hero_matrixchat_ui/Cargo.toml

  • Added hero_proc_sdk = { workspace = true }

crates/hero_matrixchat_ui/src/main.rs

  • Added --start and --stop CLI flags to Args
  • Added self_start() async function: registers action + service with Hero Proc, health check via TCP port 3790, declares requires: ["hero_matrixchat_server"]
  • Added self_stop() async function: stops service via Hero Proc

Makefile

  • run / start: now calls hero_matrixchat_server --start + hero_matrixchat_ui --start
  • stop: now calls --stop on both binaries
  • Added run-server, run-ui, restart targets
  • Kept dev (foreground debug run) and rundev (no Hero Proc) for development

Test Results

  • PASS — all 7 test suites passed, 0 failures

Acceptance Criteria

  • cargo check --workspace passes with no errors
  • hero_matrixchat_server --help shows --start and --stop flags
  • hero_matrixchat_ui --help shows --start and --stop flags
  • make start / make run calls --start on both binaries
  • make stop calls --stop on both binaries
  • hero_matrixchat_ui self-start declares requires: ["hero_matrixchat_server"]
## Implementation Complete ### Changes Made **`Cargo.toml` (workspace root)** - Added `[workspace.dependencies]` section with `hero_proc_sdk` git dependency (forge.ourworld.tf/lhumina_code/hero_proc.git, branch: development) **`crates/hero_matrixchat_server/Cargo.toml`** - Added `hero_proc_sdk = { workspace = true }` **`crates/hero_matrixchat_server/src/main.rs`** - Added `--start` and `--stop` CLI flags to `Args` - Added `self_start()` async function: registers action + service with Hero Proc, health check via Unix socket `~/hero/var/sockets/hero_matrixchat_server.sock` - Added `self_stop()` async function: stops service via Hero Proc **`crates/hero_matrixchat_ui/Cargo.toml`** - Added `hero_proc_sdk = { workspace = true }` **`crates/hero_matrixchat_ui/src/main.rs`** - Added `--start` and `--stop` CLI flags to `Args` - Added `self_start()` async function: registers action + service with Hero Proc, health check via TCP port 3790, declares `requires: ["hero_matrixchat_server"]` - Added `self_stop()` async function: stops service via Hero Proc **`Makefile`** - `run` / `start`: now calls `hero_matrixchat_server --start` + `hero_matrixchat_ui --start` - `stop`: now calls `--stop` on both binaries - Added `run-server`, `run-ui`, `restart` targets - Kept `dev` (foreground debug run) and `rundev` (no Hero Proc) for development ### Test Results - **PASS** — all 7 test suites passed, 0 failures ### Acceptance Criteria - [x] `cargo check --workspace` passes with no errors - [x] `hero_matrixchat_server --help` shows `--start` and `--stop` flags - [x] `hero_matrixchat_ui --help` shows `--start` and `--stop` flags - [x] `make start` / `make run` calls `--start` on both binaries - [x] `make stop` calls `--stop` on both binaries - [x] `hero_matrixchat_ui` self-start declares `requires: ["hero_matrixchat_server"]`
Author
Owner

Implementation committed: c9f0cc4

Browse: c9f0cc4

Implementation committed: `c9f0cc4` Browse: https://forge.ourworld.tf/lhumina_code/hero_matrixchat/commit/c9f0cc4
Sign in to join this conversation.
No labels
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_matrixchat#1
No description provided.