Create skill for hero_rpc server lifecycle with zinit (OServer::run_cli pattern) #51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
hero_rpc#7 added zinit lifecycle management to
hero_rpc_server. Generated servers now useOServer::run_cli()which provides unified CLI subcommands:start,stop,run,status,logs,ui,zinit.This is a new standard pattern that all hero services should follow. We need a skill that teaches AI how to use it.
What's needed
1. New skill:
hero_rpc_server_lifecycleShould document:
OServer::run_cli()pattern — the entry point for all generated servers~/hero/var/sockets/hero_db_{context}_{domain}.sockhero_rpc_generatorcreates the 5-crate workspace with this pattern baked instartfor production (zinit-managed),runfor development (direct)2. Update existing skills
The following skills reference the OLD server patterns and need updating:
hero_service— references manualzinit add/zinit startin Makefile; should mention that hero_rpc-generated servers have this built into the binary viaOServer::run_cli()hero_openrpc_server_admin_template— documents manual server setup withUnixRpcServer::new(); needs section on the generated OServer patternzinit_sdk— documentsZinitHandle(blocking) andAsyncZinitClient; should also referenceZinitRPCAPIClient(Pattern B, OpenRPC client) used byZinitLifecyclehero_ecosystem— may need updates to reference the new lifecycle pattern3. Reference implementation
crates/server/src/server/cli.rs— ServerCli + ServerCommandcrates/server/src/server/lifecycle.rs— ZinitLifecyclecrates/server/src/server/server.rs— OServer::run_cli()crates/generator/src/build/scaffold.rs— code generation templateSee: lhumina_code/hero_rpc#7
Additional note: as part of hero_os#12, "contexts" are being renamed to "spaces" for end-user friendliness. The new skill should document both the internal concept (OSIS contexts) and the user-facing terminology (spaces). The
OServer::run_cli()run subcommand uses--contextsbut downstream services like hero_os may alias this to--spaces.Additional best practices to include in the skill, based on hero_os implementation:
zinit-only execution — there is no standalone/direct mode. The
runsubcommand is internal (what zinit invokes). Developers usestart/stop/status/logs.cargo updateinmake start— always runcargo updatebefore building to pick up latest git dependency changes. Prevents stalehero_rpcbugs.make run= start + stream logs + stop on Ctrl-C — for DX,make runstarts via zinit, streams logs in foreground, and stops services on interrupt.HTTP/UI crates also use ZinitLifecycle — not just OpenRPC servers. Any binary that should be supervised (e.g.
hero_os_ui, static file servers) importsZinitLifecyclefromhero_rpc_serverand gets the samestart/stop/status/logssubcommands.Fixed zinit socket path —
ZinitLifecycledefault was wrong (~/hero/var/zinit/zinit.sock), now corrected to~/hero/var/sockets/zinit_server.sockmatchingzinit_serverbind path.Skill Updated for Serve Rename
The
hero_rpc_server_lifecycleskill has been updated (66a9897) to reflect the finalized naming convention:run= developer command (start + stream logs + stop on Ctrl-C)start= background start via zinitserve= internal entry point (zinit calls this, never call manually)Updates include:
runvsstartvsserve)ZinitLifecycle::run()method documentedServepatternmake rundelegates tocargo run -- run(no Makefile log polling)main.rstemplate updatedThis skill should be considered complete for the current scope.
Serve Rename Convention Applied
The zinit lifecycle serve rename convention has been applied to all 4 target repos (hero_aibroker, hero_embedder, hero_index_server, hero_redis).
Changes follow the pattern documented in this issue:
run= developer command (start + stream logs + Ctrl-C stop)serve= internal (what zinit invokes)start/stop/status/logs= zinit managementAll repos compile clean. Makefiles updated to use new subcommands.
Full details: lhumina_code/home#6