code management #3
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_code#3
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?
CODE MGMT
CODEROOT
is a SECRET in hero_proc see /hero_proc_secrets
Show in ADMIN what that location is
if NOT SET SHOW RED ERROR, because then we haven't specified where our code is
code management tab
make a code management tab where we see all the repo's which we have underneith $CODEROOT
see what we do in our nushell scripts /Users/despiegk/hero/code/hero_skills/tools/modules/forge.nu
this is implemented in /Volumes/T7/code0/hero_lib/crates/tools
use this crate
in code management we want to see
we can do actions repo per repo, right mouse on repo, or first select and then action on all selected ones
if we use long running action e.g. use AI agent run it as job(s) in hero_proc so we can see logs, show which jobs are running, let user click on job and then we jump in new TAB to ${WEBROOT}/hero_proc_ui#logs/job/$JOBID in browser
e.g. http://127.0.0.1:9998/hero_proc_ui#logs/job/711
WEBROOT IS IN SECRETS in HERO_PROC
TAGS
we can give tags to each entry, this gets remembered in redis
PURPOSE
everything we can do in nutools we want to be able to do here for code mgmt
editorto code managementImplementation Spec for Issue #3 — Code Management
Objective
Add a Code Management tab to the Hero Runner admin dashboard that lets users view, manage, and operate on git repositories located under the
CODEROOTdirectory. This includes repository listing, adding/cloning repos, hiding/unhiding, tagging, filtering, deleting, and triggering long-running git operations (push-add-commit, pull-merge) as hero_proc jobs. The Admin tab must also display the currentCODEROOTvalue (from hero_proc secrets) with a red error if it is not set.Requirements
CODEROOTvalue fetched from hero_proc secrets. Show a red error banner when not set.WEBROOTfrom hero_proc secrets for constructing job log links.CODEROOT.herolib_os::git::GitTree).redis://127.0.0.1/); hidden repos are filtered out by default but viewable via toggle.${WEBROOT}/hero_proc_ui#logs/job/$JOBID.job.create, display running jobs, link to hero_proc UI logs.Files to Modify/Create
Cargo.toml(root)redisandherolib_osworkspace depscrates/hero_runner_server/Cargo.tomlredis,herolib_os,hero_proc_sdkdepscrates/hero_runner_server/src/redis_client.rscrates/hero_runner_server/src/rpc/code.rscode.*RPC handlerscrates/hero_runner_server/src/rpc/mod.rspub mod code;and dispatch wiringcrates/hero_runner_server/src/web.rsWebStatewith Redis connectioncrates/hero_runner_server/openrpc.jsoncode.*method definitionscrates/hero_runner_ui/templates/index.htmlcrates/hero_runner_ui/static/js/dashboard.jscrates/hero_runner_ui/static/css/dashboard.cssImplementation Plan
Step 1: Add Redis client infrastructure
redis_client.rswith get/set/del and set operations (sadd, srem, smembers)rediscrate to workspace and server Cargo.tomlhero_runner:code:hidden:{name},hero_runner:code:tags:{name}Step 2: Add
code.*RPC handlersrpc/code.rswith 12 methods:get_coderoot,get_webroot,list,add,delete,hide,unhide,tag_add,tag_remove,tags_list,push,pullrpc/mod.rsdispatchWebStatewith Redis connectionherolib_os::git::GitTreefor repo scanning,hero_proc_sdkfor secrets and job submissionStep 3: Update OpenRPC spec
code.*methods toopenrpc.jsonso the proxy macro generates routesStep 4: Add Code Management tab HTML
#tab-codepane toindex.htmlStep 5: Add Code Management JavaScript
dashboard.js:loadCodeRepos(),filterCodeRepos(),addCodeRepo(),deleteCodeRepos(),hideCodeRepo(),unhideCodeRepo(),addTagToRepo(),removeTagFromRepo(),pushCodeRepos(),pullCodeRepos(), context menu, selection management, job link navigationStep 6: Add CSS styles
Acceptance Criteria
${WEBROOT}/hero_proc_ui#logs/job/$JOBIDNotes
herolib_os::git::git_executor(usesREDIS_URLenv var, fallbackredis://127.0.0.1/)hero_proc_sdk::HeroProcRPCAPIClient::connect_socket()herolib_osadded as git dependency from hero_lib repo (development branch)code.*callsTest Results
All tests passed.
Breakdown by test suite:
Implementation Summary
Changes Made
New files (2):
crates/hero_runner_server/src/redis_client.rs— Thin Redis client wrapper for code management metadata (hidden state, tags)crates/hero_runner_server/src/rpc/code.rs— 12 RPC handlers for allcode.*methodsModified files (7):
Cargo.toml(root) — Addedredisandherolib_osworkspace dependenciescrates/hero_runner_server/Cargo.toml— Addedredis,herolib_os,hero_proc_sdk,dirsdependenciescrates/hero_runner_server/src/lib.rs— Addedredis_clientmodulecrates/hero_runner_server/src/rpc/mod.rs— Addedcodemodule and 12 dispatch entriescrates/hero_runner_server/src/web.rs— Added Redis connection toWebState, positional-to-named param mappingscrates/hero_runner_server/openrpc.json— Added 12code.*method definitions andCodeReposchemacrates/hero_runner_ui/templates/index.html— Added Code tab with repo table, CODEROOT banner, admin config sectioncrates/hero_runner_ui/static/js/dashboard.js— All code management UI functions (load, filter, add, delete, hide, tag, push, pull, context menu, selection)crates/hero_runner_ui/static/css/dashboard.css— Styles for coderoot banner, tag badges, hidden reposTest Results
Features Implemented
Implementation committed:
14c6124Browse:
lhumina_code/hero_runner_v2@14c6124Implementation Spec for Issue #3 — Code Management (hero_code)
Objective
Add a Code Management tab to the
hero_runner_uidashboard. It must:$CODEROOThero_procjobsWhat Already Exists
git.repos,git.status,git.commit_push,git.pull)dashboard.jswithrpcCall,toast,escapeHtmlsecret.get/job.*RPCsNew RPC Methods
code.coderoot_get{}{ coderoot: str|null }code.list{ coderoot?: str }{ repos: [{name, path, hidden, tags, branch, ahead, behind}] }code.add{ url_or_name: str }{ ok: true }code.hide{ path: str }{ ok: true }code.unhide{ path: str }{ ok: true }code.delete{ path: str }{ ok: true }code.tag_set{ path: str, tags: [str] }{ ok: true }code.tag_get{ path: str }{ tags: [str] }code.push{ path: str, message?: str }{ job_id: u64 }code.pull{ path: str }{ job_id: u64 }Files to Modify/Create
crates/hero_runner_server/src/rpc/code.rscrates/hero_runner_server/src/code_db.rscrates/hero_runner_ui/static/js/code_manage.jscrates/hero_runner_server/src/rpc/mod.rscrates/hero_runner_server/src/rpc/git.rscrates/hero_runner_server/src/web.rscrates/hero_runner_server/src/lib.rscrates/hero_runner_server/Cargo.tomlcrates/hero_runner_server/openrpc.jsoncrates/hero_runner_ui/templates/index.htmlcrates/hero_runner_ui/static/js/dashboard.jscrates/hero_runner_ui/static/css/dashboard.cssImplementation Steps
Step 1 — Redis metadata store (
code_db.rs)Create
code_db.rswrapping a Redis connection with graceful in-memory fallback.Methods:
set_hidden(path),is_hidden(path),set_tags(path, tags),get_tags(path).Redis key:
hero_code:meta:{sha256_of_path}HASH.Wire into
WebState,lib.rs.Add
rediscrate dep tohero_runner_server/Cargo.toml.Step 2 —
code.coderoot_getRPCCreate
rpc/code.rswithhandle_coderoot_get.Returns
CODEROOTenv var value (or null).Wire dispatch in
rpc/mod.rs. Add toopenrpc.json.Step 3 —
code.listRPCScan
CODEROOT, enrich each repo with branch/ahead/behind/hidden/tags.Refactor
scan_for_reposfromrpc/git.rsto shared util.Step 4 —
code.hide,code.unhide,code.tag_set,code.tag_getFour simple Redis-backed handlers.
Step 5 —
code.deleteremove_dir_allwith CODEROOT path validation.Step 6 —
code.addClone repo synchronously:
git clone <url> <coderoot>/<name>.Step 7 —
code.pushandcode.pullSubmit hero_runner Rhai inline jobs; return
job_id.Step 8 — Admin Tab: CODEROOT / WEBROOT status panel
Add Infrastructure section to
#tab-admininindex.html.Add
loadAdminInfra()todashboard.js.Step 9 — Code Management Tab HTML
Add Code tab button +
#tab-codepane (toolbar, bulk bar, repo table, running-jobs strip, Add Repo modal, Tag Editor modal).Step 10 —
code_manage.jsFull JS:
codeLoad(),codeAdd(),codeHide/Unhide(),codeDelete(),codePush/Pull(),codeTagEdit(),codeSelectAll(),codeBulkAction(),codeContextMenu(),codeJobsWidget().Step 11 — CSS additions
.code-hidden-row,.code-tag-badge,.code-branch-ok/warn,.code-jobs-strip,.code-jobs-link.Acceptance Criteria
code.listreturns repos with branch/ahead/behind/hidden/tags${WEBROOT}/hero_proc_ui#logs/job/${JOBID}cargo buildpasses with no new warningscode.*RPC calls proxy correctly throughhero_runner_uiTest Results
Build: pass
Breakdown by crate
hero_runner_lib(unit)hero_runner_sdk(unit)hero_runner_tests/job_lifecyclehero_runner_tests/rhai_executionhero_runner_tests/rpc_dispatchhero_runner_lib)hero_runner_sdk)All 91 tests passed with 0 failures. Build completed in ~15 s (dev profile).
Implementation Complete — Code Management
New Files (3)
crates/hero_runner_server/src/code_db.rs— Redis metadata store (hidden flag, tags) with in-memory fallbackcrates/hero_runner_server/src/rpc/code.rs— 10 RPC handlers:code.coderoot_get,code.list,code.hide,code.unhide,code.tag_set,code.tag_get,code.delete,code.add,code.push,code.pullcrates/hero_runner_ui/static/js/code_manage.js— Full Code Management UI: table rendering, modals, bulk actions, context menu, tag editorModified Files (9)
crates/hero_runner_server/Cargo.toml— addedredisdependencycrates/hero_runner_server/src/lib.rs— pub mod code_dbcrates/hero_runner_server/src/web.rs— addedcode_db: Arc<CodeMetaStore>to WebStatecrates/hero_runner_server/src/rpc/mod.rs— dispatch for all 10 new code.* methodscrates/hero_runner_server/openrpc.json— 10 new method entriescrates/hero_runner_ui/templates/index.html— Code tab button,#tab-codepane (toolbar, bulk bar, repo table, jobs strip, Add Repo modal, Tag Editor modal), Admin Infrastructure section (CODEROOT/WEBROOT display with red error when absent)crates/hero_runner_ui/static/js/dashboard.js—loadAdminInfra(),codeInit()wired to tab activationcrates/hero_runner_ui/static/css/dashboard.css— Code Management stylesFeatures Implemented
code.listscans CODEROOT, enriches with Redis metadataImplementation committed:
e2c6e75Browse:
e2c6e75