rename & some refactor #14

Closed
opened 2026-04-06 06:23:03 +00:00 by despiegk · 3 comments
Owner

rename to use hero_router

change all references to it, check everywhere

also go over /Users/despiegk/hero/code/hero_skills/claude
to make sure all renames done

changes

$servicename/rpc endpoint

should be implemented in hero_router and goes to right rpc socket see /hero_sockets
so basically we no longer use an implemented proxy we have the router to automatically connect this

$servicename/admin endpoint

this only works if context = 0

a new endpoint which is for admin UI, which is the $name_ui component normally but not relevant here
see /hero_sockets where its mapped

$HERO_SOCKET_DIR/<service_name>/ui.sock

this means we have automatic mapping between admin

don't forget to set X-Forwarded-Prefix to $servicename/admin
because otherwise the UI won't work

set X-Hero-Context = 0 because is always the admin
because this is for admin interface

make sure X-Hero-Claims is not set, because we are admin

$servicename/$webname endpoint

$HERO_SOCKET_DIR/<service_name>/web_$webname.sock

don't forget to set X-Forwarded-Prefix

context awareness

see skill /hero_context

a hero_router is always started in a context --context 8
when starting it

this context is available and set X-Hero-Context for every request to backend

rename to use hero_router change all references to it, check everywhere also go over /Users/despiegk/hero/code/hero_skills/claude to make sure all renames done ## changes ### $servicename/rpc endpoint should be implemented in hero_router and goes to right rpc socket see /hero_sockets so basically we no longer use an implemented proxy we have the router to automatically connect this ### $servicename/admin endpoint this only works if context = 0 a new endpoint which is for admin UI, which is the $name_ui component normally but not relevant here see /hero_sockets where its mapped $HERO_SOCKET_DIR/<service_name>/ui.sock this means we have automatic mapping between admin don't forget to set X-Forwarded-Prefix to $servicename/admin because otherwise the UI won't work set X-Hero-Context = 0 because is always the admin because this is for admin interface make sure X-Hero-Claims is not set, because we are admin ### $servicename/$webname endpoint $HERO_SOCKET_DIR/<service_name>/web_$webname.sock don't forget to set X-Forwarded-Prefix ### context awareness see skill /hero_context a hero_router is always started in a context --context 8 when starting it this context is available and set X-Hero-Context for every request to backend
Author
Owner

Implementation Spec for Issue #14: Rename hero_inspector to hero_router

Objective

Rename the hero_inspector project/crate hierarchy to hero_router, update all internal references, and refactor the routing logic to implement automatic socket-based routing for three endpoint types: $servicename/rpc, $servicename/admin, and $servicename/$webname. Add context awareness so hero_router injects X-Hero-Context on every proxied request.

Requirements

  • Rename all crates: herolib_inspectorherolib_router, hero_inspector_serverhero_router_server, hero_inspector_uihero_router_ui, hero_inspector_sdkhero_router_sdk, hero_inspector_exampleshero_router_examples
  • Update all binary names, types, constants, imports, and docs
  • Implement /$servicename/rpc$HERO_SOCKET_DIR/<service_name>/rpc.sock
  • Implement /$servicename/admin$HERO_SOCKET_DIR/<service_name>/ui.sock (context==0 only, set X-Forwarded-Prefix, X-Hero-Context=0, no X-Hero-Claims)
  • Implement /$servicename/$webname$HERO_SOCKET_DIR/<service_name>/web_$webname.sock (set X-Forwarded-Prefix)
  • Add --context <N> CLI arg; inject X-Hero-Context on every request
  • Update all skill files referencing hero_inspector

Implementation Plan (11 Steps)

  1. Rename crate directories — mv all crates/hero_inspector* to crates/hero_router*
  2. Update all Cargo.toml files — package names, binary names, dependency paths
  3. Rename types, constants, imports in core libraryInspectorConfigRouterConfig, InspectorCacheRouterCache, etc.
  4. Refactor routing for new endpoint patterns — implement /$svc/rpc, /$svc/admin, /$svc/$webname with proper header injection
  5. Add --context CLI argument — pass through config, inject X-Hero-Context
  6. Update server and UI binaries — rename constants, imports in main.rs files
  7. Update SDK, examples, static assets — client names, openrpc.json, HTML templates
  8. Update build/config files — buildenv.sh, Makefile, README, SPEC.md
  9. Update skill files — all references in /Users/despiegk/hero/code/hero_skills/claude
  10. Update scanner for new directory layout — support per-service subdirectories
  11. Build, test, and verifycargo build/test/clippy

Acceptance Criteria

  • All crate dirs renamed, Cargo.toml files consistent
  • All Rust types/constants renamed
  • cargo build --workspace compiles
  • cargo test --workspace passes
  • Three endpoint patterns (/rpc, /admin, /$webname) route correctly with proper headers
  • --context CLI arg works and injects X-Hero-Context
  • All skill files updated
  • OpenRPC spec, README, Makefile updated

Notes

  • JSON-RPC methods rename from inspector.* to router.* (breaking change)
  • Scanner supports both old flat layout and new per-service directory layout
  • Admin endpoint returns 403 if router context ≠ 0
  • Env vars rename from INSPECTOR_* to ROUTER_*
## Implementation Spec for Issue #14: Rename hero_inspector to hero_router ### Objective Rename the `hero_inspector` project/crate hierarchy to `hero_router`, update all internal references, and refactor the routing logic to implement automatic socket-based routing for three endpoint types: `$servicename/rpc`, `$servicename/admin`, and `$servicename/$webname`. Add context awareness so `hero_router` injects `X-Hero-Context` on every proxied request. ### Requirements - Rename all crates: `herolib_inspector` → `herolib_router`, `hero_inspector_server` → `hero_router_server`, `hero_inspector_ui` → `hero_router_ui`, `hero_inspector_sdk` → `hero_router_sdk`, `hero_inspector_examples` → `hero_router_examples` - Update all binary names, types, constants, imports, and docs - Implement `/$servicename/rpc` → `$HERO_SOCKET_DIR/<service_name>/rpc.sock` - Implement `/$servicename/admin` → `$HERO_SOCKET_DIR/<service_name>/ui.sock` (context==0 only, set `X-Forwarded-Prefix`, `X-Hero-Context=0`, no `X-Hero-Claims`) - Implement `/$servicename/$webname` → `$HERO_SOCKET_DIR/<service_name>/web_$webname.sock` (set `X-Forwarded-Prefix`) - Add `--context <N>` CLI arg; inject `X-Hero-Context` on every request - Update all skill files referencing `hero_inspector` ### Implementation Plan (11 Steps) 1. **Rename crate directories** — mv all `crates/hero_inspector*` to `crates/hero_router*` 2. **Update all Cargo.toml files** — package names, binary names, dependency paths 3. **Rename types, constants, imports in core library** — `InspectorConfig` → `RouterConfig`, `InspectorCache` → `RouterCache`, etc. 4. **Refactor routing for new endpoint patterns** — implement `/$svc/rpc`, `/$svc/admin`, `/$svc/$webname` with proper header injection 5. **Add `--context` CLI argument** — pass through config, inject `X-Hero-Context` 6. **Update server and UI binaries** — rename constants, imports in main.rs files 7. **Update SDK, examples, static assets** — client names, openrpc.json, HTML templates 8. **Update build/config files** — buildenv.sh, Makefile, README, SPEC.md 9. **Update skill files** — all references in `/Users/despiegk/hero/code/hero_skills/claude` 10. **Update scanner for new directory layout** — support per-service subdirectories 11. **Build, test, and verify** — `cargo build/test/clippy` ### Acceptance Criteria - [ ] All crate dirs renamed, Cargo.toml files consistent - [ ] All Rust types/constants renamed - [ ] `cargo build --workspace` compiles - [ ] `cargo test --workspace` passes - [ ] Three endpoint patterns (`/rpc`, `/admin`, `/$webname`) route correctly with proper headers - [ ] `--context` CLI arg works and injects `X-Hero-Context` - [ ] All skill files updated - [ ] OpenRPC spec, README, Makefile updated ### Notes - JSON-RPC methods rename from `inspector.*` to `router.*` (breaking change) - Scanner supports both old flat layout and new per-service directory layout - Admin endpoint returns 403 if router context ≠ 0 - Env vars rename from `INSPECTOR_*` to `ROUTER_*`
Author
Owner

Implementation Complete

Build & Test Results

  • cargo build --workspacePASSED
  • cargo test --workspacePASSED (0 test failures)
  • cargo clippy --workspace -- -D warningsPASSED

Changes Summary

Rename (hero_inspector → hero_router):

  • 5 crate directories renamed: hero_inspector*hero_router*
  • All Cargo.toml files updated (package names, binary names, dependency paths)
  • All Rust types renamed: InspectorConfigRouterConfig, InspectorCacheRouterCache, etc.
  • All JSON-RPC methods: inspector.*router.* (15 methods)
  • OpenRPC specs, HTML templates, CSS, JS all updated
  • Build files: buildenv.sh, Makefile, README.md, SPEC.md
  • SDK client: HeroInspectorClientHeroRouterClient
  • Env vars: INSPECTOR_*ROUTER_*

New Routing Endpoints:

  • /$servicename/rpc$HERO_SOCKET_DIR/<service>/rpc.sock (with X-Hero-Context)
  • /$servicename/admin$HERO_SOCKET_DIR/<service>/ui.sock (context==0 only, X-Hero-Context=0, no X-Hero-Claims)
  • /$servicename/$webname$HERO_SOCKET_DIR/<service>/web_$webname.sock (with X-Forwarded-Prefix)

Context Awareness:

  • Added --context <N> CLI argument to all binaries
  • X-Hero-Context header injected on every proxied request
  • Admin endpoint returns 403 when context ≠ 0

Scanner Update:

  • Supports new per-service directory layout (<service>/rpc.sock, ui.sock, web_*.sock)
  • Backward compatible with old flat layout (*_server.sock, *_ui.sock)

Skill Files Updated (6 files):

  • hero_router, hero_sockets, hero_ui_test_create, dioxus_bootstrap, hero_ecosystem, hero_ui_dashboard
## Implementation Complete ### Build & Test Results - `cargo build --workspace` — **PASSED** - `cargo test --workspace` — **PASSED** (0 test failures) - `cargo clippy --workspace -- -D warnings` — **PASSED** ### Changes Summary **Rename (hero_inspector → hero_router):** - 5 crate directories renamed: `hero_inspector*` → `hero_router*` - All Cargo.toml files updated (package names, binary names, dependency paths) - All Rust types renamed: `InspectorConfig` → `RouterConfig`, `InspectorCache` → `RouterCache`, etc. - All JSON-RPC methods: `inspector.*` → `router.*` (15 methods) - OpenRPC specs, HTML templates, CSS, JS all updated - Build files: buildenv.sh, Makefile, README.md, SPEC.md - SDK client: `HeroInspectorClient` → `HeroRouterClient` - Env vars: `INSPECTOR_*` → `ROUTER_*` **New Routing Endpoints:** - `/$servicename/rpc` → `$HERO_SOCKET_DIR/<service>/rpc.sock` (with X-Hero-Context) - `/$servicename/admin` → `$HERO_SOCKET_DIR/<service>/ui.sock` (context==0 only, X-Hero-Context=0, no X-Hero-Claims) - `/$servicename/$webname` → `$HERO_SOCKET_DIR/<service>/web_$webname.sock` (with X-Forwarded-Prefix) **Context Awareness:** - Added `--context <N>` CLI argument to all binaries - X-Hero-Context header injected on every proxied request - Admin endpoint returns 403 when context ≠ 0 **Scanner Update:** - Supports new per-service directory layout (`<service>/rpc.sock`, `ui.sock`, `web_*.sock`) - Backward compatible with old flat layout (`*_server.sock`, `*_ui.sock`) **Skill Files Updated (6 files):** - hero_router, hero_sockets, hero_ui_test_create, dioxus_bootstrap, hero_ecosystem, hero_ui_dashboard
Author
Owner

Implementation committed: 6c93792

Browse: lhumina_code/hero_inspector@6c93792

Implementation committed: `6c93792` Browse: https://forge.ourworld.tf/lhumina_code/hero_inspector/commit/6c93792
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_router#14
No description provided.