unify _ui and _web UI #8

Open
opened 2026-03-20 15:45:34 +00:00 by despiegk · 3 comments
Owner

the _ui is admin section and can be under /admin/ part on the new _ui

_web functions are the enduser parts and get in _ui server

so new server is _ui and has enduser parts as well as admin parts, admin parts under /admin/

make sure we have self start using /hero_proc_log_selfstart_check

make all clean and shiny

make sure we don't have unneeded scripts

the _ui is admin section and can be under /admin/ part on the new _ui _web functions are the enduser parts and get in _ui server so new server is _ui and has enduser parts as well as admin parts, admin parts under /admin/ make sure we have self start using /hero_proc_log_selfstart_check make all clean and shiny make sure we don't have unneeded scripts
Author
Owner

Implementation Spec for Issue #8: Unify _ui and _web UI

Objective

Merge hero_collab_web (end-user Slack-like chat UI) and hero_collab_ui (admin dashboard) into a single unified hero_collab_ui crate. Admin dashboard moves under /admin/ path prefix. End-user chat interface becomes the root / page. Remove hero_collab_web entirely. Simplify Makefile to use self-start only.

Requirements

  • Unified hero_collab_ui binary serves both end-user and admin pages from one Unix socket
  • End-user routes at / (chat SPA) and /editor
  • Admin dashboard routes under /admin/
  • WebSocket relay at /ws/{channel_id} for chat
  • RPC proxy at /rpc shared by both UIs
  • Health/manifest/OpenRPC endpoints at root level
  • Self-start (--start/--stop) via hero_proc_sdk
  • Remove hero_collab_web from workspace, Cargo.toml, buildenv.sh, Makefile
  • Replace CDN links in end-user HTML with local embedded assets
  • Makefile uses --start/--stop pattern (no scripts)

Files to Modify/Create

File Action Description
Cargo.toml (root) Modify Remove hero_collab_web from workspace members
buildenv.sh Modify Remove hero_collab_web from BINARIES
Makefile Modify Remove WEB references; use self-start pattern
crates/hero_collab_ui/Cargo.toml Modify Add hyper-util dependency
crates/hero_collab_ui/src/main.rs Modify Switch to manual hyper accept loop for WebSocket support
crates/hero_collab_ui/src/routes.rs Modify Restructure router: admin under /admin/, end-user at root
crates/hero_collab_ui/templates/base.html Modify Update static asset paths
crates/hero_collab_ui/templates/chat.html Create Extracted chat SPA HTML from web crate
crates/hero_collab_ui/templates/editor.html Create Extracted editor HTML from web crate
crates/hero_collab_web/ Delete Entire crate removed

Implementation Plan

Step 1: Update workspace and build configuration

  • Remove hero_collab_web from root Cargo.toml members
  • Remove from buildenv.sh BINARIES
  • Dependencies: none

Step 2: Add hyper-util dependency to hero_collab_ui

  • Add hyper-util = { workspace = true } to _ui/Cargo.toml
  • Dependencies: none

Step 3: Extract end-user HTML into template files

  • Extract SLACK_UI_HTML (~3000 lines) into templates/chat.html
  • Extract EDITOR_HTML (~400 lines) into templates/editor.html
  • Replace CDN links with local /static/ asset paths
  • Dependencies: none

Step 4: Restructure router in routes.rs

  • Move admin routes from / to /admin/
  • Add end-user routes at root: GET / (chat), GET /editor
  • Keep shared endpoints at root (health, rpc, ws, openrpc)
  • Dependencies: Step 3

Step 5: Update main.rs with hyper accept loop

  • Replace axum::serve() with manual hyper accept loop + .with_upgrades()
  • Add hyper-util imports
  • Dependencies: Step 2, Step 4

Step 6: Update admin templates for /admin/ prefix

  • Update base.html to use absolute /static/ paths for assets
  • Dependencies: Step 4

Step 7: Update Makefile for self-start pattern

  • Remove WEB_PORT, WEB_SERVICE variables
  • Update run/stop/logs/remove targets
  • Use --start/--stop flags
  • Dependencies: Step 1

Step 8: Delete hero_collab_web crate

  • Remove entire crates/hero_collab_web/ directory
  • Dependencies: Steps 1-7

Step 9: Verify build and clean up

  • Run cargo check, cargo build --release
  • Grep for remaining hero_collab_web references
  • Dependencies: Step 8

Acceptance Criteria

  • hero_collab_web crate fully removed from workspace
  • hero_collab_ui serves chat SPA at GET /
  • hero_collab_ui serves editor at GET /editor
  • Admin dashboard at GET /admin/
  • Static assets served at /static/{*path} for both UIs
  • WebSocket relay works at /ws/{channel_id}
  • RPC proxy works at POST /rpc
  • Self-start pattern: --start/--stop flags work
  • make run / make stop use self-start pattern
  • No CDN references in end-user HTML
  • cargo check and cargo build --release pass
  • No references to hero_collab_web remain in codebase

Notes

  • The _web crate has a 3837-line main.rs with ~3000 lines of inline HTML
  • CDN libraries (bootstrap-icons, highlight.js, marked, mermaid) already exist as local files in _ui/static/
  • Manual hyper accept loop needed for WebSocket upgrade support over Unix sockets
  • scripts/run.sh and scripts/stop.sh don't actually exist on disk (only scripts/build_lib.sh)
## Implementation Spec for Issue #8: Unify _ui and _web UI ### Objective Merge `hero_collab_web` (end-user Slack-like chat UI) and `hero_collab_ui` (admin dashboard) into a single unified `hero_collab_ui` crate. Admin dashboard moves under `/admin/` path prefix. End-user chat interface becomes the root `/` page. Remove `hero_collab_web` entirely. Simplify Makefile to use self-start only. ### Requirements - Unified `hero_collab_ui` binary serves both end-user and admin pages from one Unix socket - End-user routes at `/` (chat SPA) and `/editor` - Admin dashboard routes under `/admin/` - WebSocket relay at `/ws/{channel_id}` for chat - RPC proxy at `/rpc` shared by both UIs - Health/manifest/OpenRPC endpoints at root level - Self-start (`--start`/`--stop`) via hero_proc_sdk - Remove `hero_collab_web` from workspace, Cargo.toml, buildenv.sh, Makefile - Replace CDN links in end-user HTML with local embedded assets - Makefile uses `--start`/`--stop` pattern (no scripts) ### Files to Modify/Create | File | Action | Description | |------|--------|-------------| | `Cargo.toml` (root) | Modify | Remove `hero_collab_web` from workspace members | | `buildenv.sh` | Modify | Remove `hero_collab_web` from BINARIES | | `Makefile` | Modify | Remove WEB references; use self-start pattern | | `crates/hero_collab_ui/Cargo.toml` | Modify | Add hyper-util dependency | | `crates/hero_collab_ui/src/main.rs` | Modify | Switch to manual hyper accept loop for WebSocket support | | `crates/hero_collab_ui/src/routes.rs` | Modify | Restructure router: admin under `/admin/`, end-user at root | | `crates/hero_collab_ui/templates/base.html` | Modify | Update static asset paths | | `crates/hero_collab_ui/templates/chat.html` | Create | Extracted chat SPA HTML from web crate | | `crates/hero_collab_ui/templates/editor.html` | Create | Extracted editor HTML from web crate | | `crates/hero_collab_web/` | Delete | Entire crate removed | ### Implementation Plan #### Step 1: Update workspace and build configuration - Remove `hero_collab_web` from root `Cargo.toml` members - Remove from `buildenv.sh` BINARIES - Dependencies: none #### Step 2: Add hyper-util dependency to hero_collab_ui - Add `hyper-util = { workspace = true }` to `_ui/Cargo.toml` - Dependencies: none #### Step 3: Extract end-user HTML into template files - Extract SLACK_UI_HTML (~3000 lines) into `templates/chat.html` - Extract EDITOR_HTML (~400 lines) into `templates/editor.html` - Replace CDN links with local `/static/` asset paths - Dependencies: none #### Step 4: Restructure router in routes.rs - Move admin routes from `/` to `/admin/` - Add end-user routes at root: `GET /` (chat), `GET /editor` - Keep shared endpoints at root (health, rpc, ws, openrpc) - Dependencies: Step 3 #### Step 5: Update main.rs with hyper accept loop - Replace `axum::serve()` with manual hyper accept loop + `.with_upgrades()` - Add hyper-util imports - Dependencies: Step 2, Step 4 #### Step 6: Update admin templates for /admin/ prefix - Update `base.html` to use absolute `/static/` paths for assets - Dependencies: Step 4 #### Step 7: Update Makefile for self-start pattern - Remove WEB_PORT, WEB_SERVICE variables - Update run/stop/logs/remove targets - Use `--start`/`--stop` flags - Dependencies: Step 1 #### Step 8: Delete hero_collab_web crate - Remove entire `crates/hero_collab_web/` directory - Dependencies: Steps 1-7 #### Step 9: Verify build and clean up - Run `cargo check`, `cargo build --release` - Grep for remaining `hero_collab_web` references - Dependencies: Step 8 ### Acceptance Criteria - [ ] `hero_collab_web` crate fully removed from workspace - [ ] `hero_collab_ui` serves chat SPA at `GET /` - [ ] `hero_collab_ui` serves editor at `GET /editor` - [ ] Admin dashboard at `GET /admin/` - [ ] Static assets served at `/static/{*path}` for both UIs - [ ] WebSocket relay works at `/ws/{channel_id}` - [ ] RPC proxy works at `POST /rpc` - [ ] Self-start pattern: `--start`/`--stop` flags work - [ ] `make run` / `make stop` use self-start pattern - [ ] No CDN references in end-user HTML - [ ] `cargo check` and `cargo build --release` pass - [ ] No references to `hero_collab_web` remain in codebase ### Notes - The `_web` crate has a 3837-line main.rs with ~3000 lines of inline HTML - CDN libraries (bootstrap-icons, highlight.js, marked, mermaid) already exist as local files in `_ui/static/` - Manual hyper accept loop needed for WebSocket upgrade support over Unix sockets - `scripts/run.sh` and `scripts/stop.sh` don't actually exist on disk (only `scripts/build_lib.sh`)
Author
Owner

Test Results

Branch: development @ d616108
Date: 2026-03-20

Check Result
cargo test --workspace pass (4 passed, 0 failed)
cargo build --release pass

All tests passing, release build succeeds.

## Test Results **Branch:** `development` @ `d616108` **Date:** 2026-03-20 | Check | Result | |-------|--------| | cargo test --workspace | ✅ pass (4 passed, 0 failed) | | cargo build --release | ✅ pass | All tests passing, release build succeeds.
Author
Owner

Implementation Summary

Changes Made

Workspace & Build Config:

  • Removed hero_collab_web from workspace members in root Cargo.toml
  • Removed hero_collab_web from buildenv.sh BINARIES

Unified UI Server (hero_collab_ui):

  • Router restructured (routes.rs): End-user chat SPA at GET /, editor at GET /editor, admin dashboard moved to GET /admin/
  • WebSocket support (main.rs): Replaced axum::serve() with manual hyper accept loop + .with_upgrades() for WebSocket relay over Unix sockets
  • Templates extracted: Chat SPA (2948 lines) and editor (396 lines) extracted from inline Rust constants into templates/chat.html and templates/editor.html
  • CDN links replaced: All 5 CDN references (bootstrap-icons, highlight.js, marked, mermaid, github-dark CSS) replaced with local /static/ assets
  • Admin templates updated (base.html): Static asset paths changed to absolute /static/ paths

Makefile:

  • Removed all WEB_PORT, WEB_SERVICE, WEB_SOCKET variables
  • make run now uses --start self-start pattern
  • make stop now uses --stop self-stop pattern
  • Removed logs-web target
  • Updated status, logs, remove targets to exclude web service

Deleted:

  • Entire crates/hero_collab_web/ directory

Documentation:

  • Updated TECH_SPEC.md to reflect unified architecture

Shared Endpoints (all at root level)

  • GET / — End-user chat SPA
  • GET /editor — Markdown editor
  • GET /admin/ — Admin dashboard
  • GET /ws/{channel_id} — WebSocket relay
  • POST /rpc — JSON-RPC proxy
  • GET /health — Health check
  • GET /static/{*path} — Shared static assets

Test Results

  • cargo check: pass
  • cargo test --workspace: 4 tests, 0 failures
  • cargo build --release: pass
## Implementation Summary ### Changes Made **Workspace & Build Config:** - Removed `hero_collab_web` from workspace members in root `Cargo.toml` - Removed `hero_collab_web` from `buildenv.sh` BINARIES **Unified UI Server (`hero_collab_ui`):** - **Router restructured** (`routes.rs`): End-user chat SPA at `GET /`, editor at `GET /editor`, admin dashboard moved to `GET /admin/` - **WebSocket support** (`main.rs`): Replaced `axum::serve()` with manual hyper accept loop + `.with_upgrades()` for WebSocket relay over Unix sockets - **Templates extracted**: Chat SPA (2948 lines) and editor (396 lines) extracted from inline Rust constants into `templates/chat.html` and `templates/editor.html` - **CDN links replaced**: All 5 CDN references (bootstrap-icons, highlight.js, marked, mermaid, github-dark CSS) replaced with local `/static/` assets - **Admin templates updated** (`base.html`): Static asset paths changed to absolute `/static/` paths **Makefile:** - Removed all WEB_PORT, WEB_SERVICE, WEB_SOCKET variables - `make run` now uses `--start` self-start pattern - `make stop` now uses `--stop` self-stop pattern - Removed `logs-web` target - Updated `status`, `logs`, `remove` targets to exclude web service **Deleted:** - Entire `crates/hero_collab_web/` directory **Documentation:** - Updated `TECH_SPEC.md` to reflect unified architecture ### Shared Endpoints (all at root level) - `GET /` — End-user chat SPA - `GET /editor` — Markdown editor - `GET /admin/` — Admin dashboard - `GET /ws/{channel_id}` — WebSocket relay - `POST /rpc` — JSON-RPC proxy - `GET /health` — Health check - `GET /static/{*path}` — Shared static assets ### Test Results - `cargo check`: ✅ pass - `cargo test --workspace`: ✅ 4 tests, 0 failures - `cargo build --release`: ✅ pass
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_collab#8
No description provided.