code management #3

Closed
opened 2026-04-04 08:06:47 +00:00 by despiegk · 8 comments
Owner

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

  • the repo's we have in our CODEROOT
  • we can add repo's just specify the URL or part of name, like we do in the tools
  • we can hide repo's keep metadata in HERO_DB (redis server, use std redis server for now, use redis client), this means repo exists in CODE ROOT but we don't show (allow to see hidden ones as well)
  • we can unhide repo's
  • we can filter repo's
  • we can delete repo's (delete from filesystem)
  • we can push-add-commit (use ai agent, see tools, there we know how to do it)
  • we can pull-merge (use ai agent, see tools, there we know how to do it)
  • we can select all repo's
  • we can select some repos
  • add tags (more than 1) to a repo

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

# 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 - the repo's we have in our CODEROOT - we can add repo's just specify the URL or part of name, like we do in the tools - we can hide repo's keep metadata in HERO_DB (redis server, use std redis server for now, use redis client), this means repo exists in CODE ROOT but we don't show (allow to see hidden ones as well) - we can unhide repo's - we can filter repo's - we can delete repo's (delete from filesystem) - we can push-add-commit (use ai agent, see tools, there we know how to do it) - we can pull-merge (use ai agent, see tools, there we know how to do it) - we can select all repo's - we can select some repos - add tags (more than 1) to a repo 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
despiegk changed title from editor to code management 2026-04-04 08:41:28 +00:00
Author
Owner

Implementation 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 CODEROOT directory. 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 current CODEROOT value (from hero_proc secrets) with a red error if it is not set.

Requirements

  • CODEROOT display in Admin tab: Show the CODEROOT value fetched from hero_proc secrets. Show a red error banner when not set.
  • WEBROOT from secrets: Fetch WEBROOT from hero_proc secrets for constructing job log links.
  • Code Management tab: New top-level tab in the dashboard showing all git repos under CODEROOT.
  • Add repos: By URL or partial name (clone via herolib_os::git::GitTree).
  • Hide/unhide repos: Store hidden state in Redis (redis://127.0.0.1/); hidden repos are filtered out by default but viewable via toggle.
  • Tags: Assign one or more tags to a repo, stored in Redis; filter by tag.
  • Filter/search repos: Client-side text filter plus tag filter.
  • Delete repos: Remove from filesystem.
  • Push-add-commit: Launch as a hero_proc job. Link to job logs at ${WEBROOT}/hero_proc_ui#logs/job/$JOBID.
  • Pull-merge: Launch as a hero_proc job. Link to job logs similarly.
  • Select repos: Individual selection via checkboxes, select-all, then batch actions.
  • Right-click context menu: Per-repo actions.
  • Long-running jobs: Submit via hero_proc job.create, display running jobs, link to hero_proc UI logs.

Files to Modify/Create

File Action Description
Cargo.toml (root) Modify Add redis and herolib_os workspace deps
crates/hero_runner_server/Cargo.toml Modify Add redis, herolib_os, hero_proc_sdk deps
crates/hero_runner_server/src/redis_client.rs Create Redis client wrapper for tags/hidden state
crates/hero_runner_server/src/rpc/code.rs Create All code.* RPC handlers
crates/hero_runner_server/src/rpc/mod.rs Modify Add pub mod code; and dispatch wiring
crates/hero_runner_server/src/web.rs Modify Extend WebState with Redis connection
crates/hero_runner_server/openrpc.json Modify Add code.* method definitions
crates/hero_runner_ui/templates/index.html Modify Add Code tab button + pane HTML
crates/hero_runner_ui/static/js/dashboard.js Modify All code management UI functions
crates/hero_runner_ui/static/css/dashboard.css Modify Styles for code management components

Implementation Plan

Step 1: Add Redis client infrastructure

  • Create redis_client.rs with get/set/del and set operations (sadd, srem, smembers)
  • Add redis crate to workspace and server Cargo.toml
  • Key naming: hero_runner:code:hidden:{name}, hero_runner:code:tags:{name}

Step 2: Add code.* RPC handlers

  • Create rpc/code.rs with 12 methods: get_coderoot, get_webroot, list, add, delete, hide, unhide, tag_add, tag_remove, tags_list, push, pull
  • Wire into rpc/mod.rs dispatch
  • Extend WebState with Redis connection
  • Use herolib_os::git::GitTree for repo scanning, hero_proc_sdk for secrets and job submission

Step 3: Update OpenRPC spec

  • Add all code.* methods to openrpc.json so the proxy macro generates routes

Step 4: Add Code Management tab HTML

  • Add tab button and #tab-code pane to index.html
  • Include CODEROOT banner, toolbar (search, tag filter, add/batch buttons), repo table, context menu
  • Add CODEROOT status in Admin tab

Step 5: Add Code Management JavaScript

  • Implement all UI functions in dashboard.js: loadCodeRepos(), filterCodeRepos(), addCodeRepo(), deleteCodeRepos(), hideCodeRepo(), unhideCodeRepo(), addTagToRepo(), removeTagFromRepo(), pushCodeRepos(), pullCodeRepos(), context menu, selection management, job link navigation

Step 6: Add CSS styles

  • Style banner, tags, hidden rows, dirty status, reuse existing dashboard patterns

Acceptance Criteria

  • Admin tab displays CODEROOT value when set (fetched from hero_proc secrets)
  • Admin tab shows red error when CODEROOT is not set
  • Code Management tab appears in the tab bar
  • Repos under CODEROOT are listed with name, path, dirty/clean status, and tags
  • Repos can be added by providing a URL or partial name
  • Repos can be hidden; hidden repos are not shown by default
  • "Show hidden" toggle reveals hidden repos (visually dimmed)
  • Tags can be added and removed per repo; tags persist in Redis
  • Repos can be filtered by text search and by tag
  • Repos can be deleted (filesystem removal + Redis cleanup)
  • Push-add-commit submits a hero_proc job and returns a job ID link
  • Pull-merge submits a hero_proc job and returns a job ID link
  • Job links open at ${WEBROOT}/hero_proc_ui#logs/job/$JOBID
  • Multiple repos can be selected and batch actions applied
  • Right-click context menu works on individual repo rows

Notes

  • Redis follows the existing pattern from herolib_os::git::git_executor (uses REDIS_URL env var, fallback redis://127.0.0.1/)
  • hero_proc secrets access via hero_proc_sdk::HeroProcRPCAPIClient::connect_socket()
  • herolib_os added as git dependency from hero_lib repo (development branch)
  • AI commit messages for push can be a follow-up enhancement; initial push uses plain git commands
  • OpenRPC spec update is mandatory for the proxy macro to forward code.* calls
## Implementation 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 `CODEROOT` directory. 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 current `CODEROOT` value (from hero_proc secrets) with a red error if it is not set. ### Requirements - **CODEROOT display in Admin tab**: Show the `CODEROOT` value fetched from hero_proc secrets. Show a red error banner when not set. - **WEBROOT from secrets**: Fetch `WEBROOT` from hero_proc secrets for constructing job log links. - **Code Management tab**: New top-level tab in the dashboard showing all git repos under `CODEROOT`. - **Add repos**: By URL or partial name (clone via `herolib_os::git::GitTree`). - **Hide/unhide repos**: Store hidden state in Redis (`redis://127.0.0.1/`); hidden repos are filtered out by default but viewable via toggle. - **Tags**: Assign one or more tags to a repo, stored in Redis; filter by tag. - **Filter/search repos**: Client-side text filter plus tag filter. - **Delete repos**: Remove from filesystem. - **Push-add-commit**: Launch as a hero_proc job. Link to job logs at `${WEBROOT}/hero_proc_ui#logs/job/$JOBID`. - **Pull-merge**: Launch as a hero_proc job. Link to job logs similarly. - **Select repos**: Individual selection via checkboxes, select-all, then batch actions. - **Right-click context menu**: Per-repo actions. - **Long-running jobs**: Submit via hero_proc `job.create`, display running jobs, link to hero_proc UI logs. ### Files to Modify/Create | File | Action | Description | |------|--------|-------------| | `Cargo.toml` (root) | Modify | Add `redis` and `herolib_os` workspace deps | | `crates/hero_runner_server/Cargo.toml` | Modify | Add `redis`, `herolib_os`, `hero_proc_sdk` deps | | `crates/hero_runner_server/src/redis_client.rs` | **Create** | Redis client wrapper for tags/hidden state | | `crates/hero_runner_server/src/rpc/code.rs` | **Create** | All `code.*` RPC handlers | | `crates/hero_runner_server/src/rpc/mod.rs` | Modify | Add `pub mod code;` and dispatch wiring | | `crates/hero_runner_server/src/web.rs` | Modify | Extend `WebState` with Redis connection | | `crates/hero_runner_server/openrpc.json` | Modify | Add `code.*` method definitions | | `crates/hero_runner_ui/templates/index.html` | Modify | Add Code tab button + pane HTML | | `crates/hero_runner_ui/static/js/dashboard.js` | Modify | All code management UI functions | | `crates/hero_runner_ui/static/css/dashboard.css` | Modify | Styles for code management components | ### Implementation Plan #### Step 1: Add Redis client infrastructure - Create `redis_client.rs` with get/set/del and set operations (sadd, srem, smembers) - Add `redis` crate to workspace and server Cargo.toml - Key naming: `hero_runner:code:hidden:{name}`, `hero_runner:code:tags:{name}` #### Step 2: Add `code.*` RPC handlers - Create `rpc/code.rs` with 12 methods: `get_coderoot`, `get_webroot`, `list`, `add`, `delete`, `hide`, `unhide`, `tag_add`, `tag_remove`, `tags_list`, `push`, `pull` - Wire into `rpc/mod.rs` dispatch - Extend `WebState` with Redis connection - Use `herolib_os::git::GitTree` for repo scanning, `hero_proc_sdk` for secrets and job submission #### Step 3: Update OpenRPC spec - Add all `code.*` methods to `openrpc.json` so the proxy macro generates routes #### Step 4: Add Code Management tab HTML - Add tab button and `#tab-code` pane to `index.html` - Include CODEROOT banner, toolbar (search, tag filter, add/batch buttons), repo table, context menu - Add CODEROOT status in Admin tab #### Step 5: Add Code Management JavaScript - Implement all UI functions in `dashboard.js`: `loadCodeRepos()`, `filterCodeRepos()`, `addCodeRepo()`, `deleteCodeRepos()`, `hideCodeRepo()`, `unhideCodeRepo()`, `addTagToRepo()`, `removeTagFromRepo()`, `pushCodeRepos()`, `pullCodeRepos()`, context menu, selection management, job link navigation #### Step 6: Add CSS styles - Style banner, tags, hidden rows, dirty status, reuse existing dashboard patterns ### Acceptance Criteria - [ ] Admin tab displays CODEROOT value when set (fetched from hero_proc secrets) - [ ] Admin tab shows red error when CODEROOT is not set - [ ] Code Management tab appears in the tab bar - [ ] Repos under CODEROOT are listed with name, path, dirty/clean status, and tags - [ ] Repos can be added by providing a URL or partial name - [ ] Repos can be hidden; hidden repos are not shown by default - [ ] "Show hidden" toggle reveals hidden repos (visually dimmed) - [ ] Tags can be added and removed per repo; tags persist in Redis - [ ] Repos can be filtered by text search and by tag - [ ] Repos can be deleted (filesystem removal + Redis cleanup) - [ ] Push-add-commit submits a hero_proc job and returns a job ID link - [ ] Pull-merge submits a hero_proc job and returns a job ID link - [ ] Job links open at `${WEBROOT}/hero_proc_ui#logs/job/$JOBID` - [ ] Multiple repos can be selected and batch actions applied - [ ] Right-click context menu works on individual repo rows ### Notes - Redis follows the existing pattern from `herolib_os::git::git_executor` (uses `REDIS_URL` env var, fallback `redis://127.0.0.1/`) - hero_proc secrets access via `hero_proc_sdk::HeroProcRPCAPIClient::connect_socket()` - `herolib_os` added as git dependency from hero_lib repo (development branch) - AI commit messages for push can be a follow-up enhancement; initial push uses plain git commands - OpenRPC spec update is mandatory for the proxy macro to forward `code.*` calls
Author
Owner

Test Results

  • Total: 91
  • Passed: 91
  • Failed: 0
  • Ignored: 3 (doc-tests)

All tests passed.

Breakdown by test suite:

Suite Tests Status
hero_runner_lib (unit) 44 OK
hero_runner_sdk (unit) 5 OK
job_lifecycle (integration) 9 OK
rhai_execution (integration) 6 OK
rpc_dispatch (integration) 27 OK
## Test Results - Total: 91 - Passed: 91 - Failed: 0 - Ignored: 3 (doc-tests) All tests passed. **Breakdown by test suite:** | Suite | Tests | Status | |---|---|---| | hero_runner_lib (unit) | 44 | OK | | hero_runner_sdk (unit) | 5 | OK | | job_lifecycle (integration) | 9 | OK | | rhai_execution (integration) | 6 | OK | | rpc_dispatch (integration) | 27 | OK |
Author
Owner

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 all code.* methods

Modified files (7):

  • Cargo.toml (root) — Added redis and herolib_os workspace dependencies
  • crates/hero_runner_server/Cargo.toml — Added redis, herolib_os, hero_proc_sdk, dirs dependencies
  • crates/hero_runner_server/src/lib.rs — Added redis_client module
  • crates/hero_runner_server/src/rpc/mod.rs — Added code module and 12 dispatch entries
  • crates/hero_runner_server/src/web.rs — Added Redis connection to WebState, positional-to-named param mappings
  • crates/hero_runner_server/openrpc.json — Added 12 code.* method definitions and CodeRepo schema
  • crates/hero_runner_ui/templates/index.html — Added Code tab with repo table, CODEROOT banner, admin config section
  • crates/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 repos

Test Results

  • 91 tests passed, 0 failed

Features Implemented

  • CODEROOT display in Admin tab (green when set, red error when not)
  • Code Management tab with repo listing from CODEROOT
  • Add repos by URL (clone into CODEROOT)
  • Hide/unhide repos (persisted in Redis)
  • Tag management (add/remove, persisted in Redis)
  • Filter by search text and tags
  • Delete repos from filesystem
  • Push (commit + push) and Pull for individual or batch-selected repos
  • Right-click context menu on repo rows
  • Select all / individual repo selection for batch operations
## 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 all `code.*` methods **Modified files (7):** - `Cargo.toml` (root) — Added `redis` and `herolib_os` workspace dependencies - `crates/hero_runner_server/Cargo.toml` — Added `redis`, `herolib_os`, `hero_proc_sdk`, `dirs` dependencies - `crates/hero_runner_server/src/lib.rs` — Added `redis_client` module - `crates/hero_runner_server/src/rpc/mod.rs` — Added `code` module and 12 dispatch entries - `crates/hero_runner_server/src/web.rs` — Added Redis connection to `WebState`, positional-to-named param mappings - `crates/hero_runner_server/openrpc.json` — Added 12 `code.*` method definitions and `CodeRepo` schema - `crates/hero_runner_ui/templates/index.html` — Added Code tab with repo table, CODEROOT banner, admin config section - `crates/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 repos ### Test Results - 91 tests passed, 0 failed ### Features Implemented - CODEROOT display in Admin tab (green when set, red error when not) - Code Management tab with repo listing from CODEROOT - Add repos by URL (clone into CODEROOT) - Hide/unhide repos (persisted in Redis) - Tag management (add/remove, persisted in Redis) - Filter by search text and tags - Delete repos from filesystem - Push (commit + push) and Pull for individual or batch-selected repos - Right-click context menu on repo rows - Select all / individual repo selection for batch operations
Author
Owner

Implementation committed: 14c6124

Browse: lhumina_code/hero_runner_v2@14c6124

Implementation committed: `14c6124` Browse: https://forge.ourworld.tf/lhumina_code/hero_runner_v2/commit/14c6124
Author
Owner

Implementation Spec for Issue #3 — Code Management (hero_code)

Objective

Add a Code Management tab to the hero_runner_ui dashboard. It must:

  • Show git repos under $CODEROOT
  • Let users add/hide/unhide/delete/filter/tag repos
  • Run long-running git operations (push-add-commit, pull-merge) via hero_proc jobs
  • Display CODEROOT and WEBROOT in the Admin tab (red error when not set)
  • Use Redis for metadata persistence (hidden flag, tags)

What Already Exists

  • Bootstrap 5.3 dark-theme SPA shell with tab system
  • Admin tab (no CODEROOT display yet)
  • IDE tab with single-repo git scanner (git.repos, git.status, git.commit_push, git.pull)
  • dashboard.js with rpcCall, toast, escapeHtml
  • hero_proc secret.get / job.* RPCs

New RPC Methods

Method Params Returns
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

Action Path
Create crates/hero_runner_server/src/rpc/code.rs
Create crates/hero_runner_server/src/code_db.rs
Create crates/hero_runner_ui/static/js/code_manage.js
Modify crates/hero_runner_server/src/rpc/mod.rs
Modify crates/hero_runner_server/src/rpc/git.rs
Modify crates/hero_runner_server/src/web.rs
Modify crates/hero_runner_server/src/lib.rs
Modify crates/hero_runner_server/Cargo.toml
Modify crates/hero_runner_server/openrpc.json
Modify crates/hero_runner_ui/templates/index.html
Modify crates/hero_runner_ui/static/js/dashboard.js
Modify crates/hero_runner_ui/static/css/dashboard.css

Implementation Steps

Step 1 — Redis metadata store (code_db.rs)

Create code_db.rs wrapping 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 redis crate dep to hero_runner_server/Cargo.toml.

Step 2 — code.coderoot_get RPC

Create rpc/code.rs with handle_coderoot_get.
Returns CODEROOT env var value (or null).
Wire dispatch in rpc/mod.rs. Add to openrpc.json.

Step 3 — code.list RPC

Scan CODEROOT, enrich each repo with branch/ahead/behind/hidden/tags.
Refactor scan_for_repos from rpc/git.rs to shared util.

Step 4 — code.hide, code.unhide, code.tag_set, code.tag_get

Four simple Redis-backed handlers.

Step 5 — code.delete

remove_dir_all with CODEROOT path validation.

Step 6 — code.add

Clone repo synchronously: git clone <url> <coderoot>/<name>.

Step 7 — code.push and code.pull

Submit hero_runner Rhai inline jobs; return job_id.

Step 8 — Admin Tab: CODEROOT / WEBROOT status panel

Add Infrastructure section to #tab-admin in index.html.
Add loadAdminInfra() to dashboard.js.

Step 9 — Code Management Tab HTML

Add Code tab button + #tab-code pane (toolbar, bulk bar, repo table, running-jobs strip, Add Repo modal, Tag Editor modal).

Step 10 — code_manage.js

Full 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

  • Admin tab shows CODEROOT; red alert when absent
  • Admin tab shows WEBROOT
  • Code tab renders in nav
  • code.list returns repos with branch/ahead/behind/hidden/tags
  • Hide/unhide persists across reload (Redis)
  • Tags persist across reload (Redis)
  • Add Repo clones and appears in list
  • Right-click context menu works (Hide/Unhide/Delete/Push/Pull/Tag)
  • Select all + bulk actions work
  • Delete shows confirmation, removes directory
  • Push returns job_id; running jobs widget shows link to ${WEBROOT}/hero_proc_ui#logs/job/${JOBID}
  • Pull same as Push
  • Search filter narrows list in real time
  • cargo build passes with no new warnings
  • code.* RPC calls proxy correctly through hero_runner_ui
# Implementation Spec for Issue #3 — Code Management (hero_code) ## Objective Add a **Code Management tab** to the `hero_runner_ui` dashboard. It must: - Show git repos under `$CODEROOT` - Let users add/hide/unhide/delete/filter/tag repos - Run long-running git operations (push-add-commit, pull-merge) via `hero_proc` jobs - Display CODEROOT and WEBROOT in the Admin tab (red error when not set) - Use Redis for metadata persistence (hidden flag, tags) --- ## What Already Exists - Bootstrap 5.3 dark-theme SPA shell with tab system - Admin tab (no CODEROOT display yet) - IDE tab with single-repo git scanner (`git.repos`, `git.status`, `git.commit_push`, `git.pull`) - `dashboard.js` with `rpcCall`, `toast`, `escapeHtml` - hero_proc `secret.get` / `job.*` RPCs --- ## New RPC Methods | Method | Params | Returns | |---|---|---| | `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 | Action | Path | |---|---| | **Create** | `crates/hero_runner_server/src/rpc/code.rs` | | **Create** | `crates/hero_runner_server/src/code_db.rs` | | **Create** | `crates/hero_runner_ui/static/js/code_manage.js` | | **Modify** | `crates/hero_runner_server/src/rpc/mod.rs` | | **Modify** | `crates/hero_runner_server/src/rpc/git.rs` | | **Modify** | `crates/hero_runner_server/src/web.rs` | | **Modify** | `crates/hero_runner_server/src/lib.rs` | | **Modify** | `crates/hero_runner_server/Cargo.toml` | | **Modify** | `crates/hero_runner_server/openrpc.json` | | **Modify** | `crates/hero_runner_ui/templates/index.html` | | **Modify** | `crates/hero_runner_ui/static/js/dashboard.js` | | **Modify** | `crates/hero_runner_ui/static/css/dashboard.css` | --- ## Implementation Steps ### Step 1 — Redis metadata store (`code_db.rs`) Create `code_db.rs` wrapping 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 `redis` crate dep to `hero_runner_server/Cargo.toml`. ### Step 2 — `code.coderoot_get` RPC Create `rpc/code.rs` with `handle_coderoot_get`. Returns `CODEROOT` env var value (or null). Wire dispatch in `rpc/mod.rs`. Add to `openrpc.json`. ### Step 3 — `code.list` RPC Scan `CODEROOT`, enrich each repo with branch/ahead/behind/hidden/tags. Refactor `scan_for_repos` from `rpc/git.rs` to shared util. ### Step 4 — `code.hide`, `code.unhide`, `code.tag_set`, `code.tag_get` Four simple Redis-backed handlers. ### Step 5 — `code.delete` `remove_dir_all` with CODEROOT path validation. ### Step 6 — `code.add` Clone repo synchronously: `git clone <url> <coderoot>/<name>`. ### Step 7 — `code.push` and `code.pull` Submit hero_runner Rhai inline jobs; return `job_id`. ### Step 8 — Admin Tab: CODEROOT / WEBROOT status panel Add Infrastructure section to `#tab-admin` in `index.html`. Add `loadAdminInfra()` to `dashboard.js`. ### Step 9 — Code Management Tab HTML Add Code tab button + `#tab-code` pane (toolbar, bulk bar, repo table, running-jobs strip, Add Repo modal, Tag Editor modal). ### Step 10 — `code_manage.js` Full 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 - [ ] Admin tab shows CODEROOT; red alert when absent - [ ] Admin tab shows WEBROOT - [ ] Code tab renders in nav - [ ] `code.list` returns repos with branch/ahead/behind/hidden/tags - [ ] Hide/unhide persists across reload (Redis) - [ ] Tags persist across reload (Redis) - [ ] Add Repo clones and appears in list - [ ] Right-click context menu works (Hide/Unhide/Delete/Push/Pull/Tag) - [ ] Select all + bulk actions work - [ ] Delete shows confirmation, removes directory - [ ] Push returns job_id; running jobs widget shows link to `${WEBROOT}/hero_proc_ui#logs/job/${JOBID}` - [ ] Pull same as Push - [ ] Search filter narrows list in real time - [ ] `cargo build` passes with no new warnings - [ ] `code.*` RPC calls proxy correctly through `hero_runner_ui`
Author
Owner

Test Results

Build: pass

  • Total: 91
  • Passed: 91
  • Failed: 0
  • Ignored: 3 (doc-tests)

Breakdown by crate

Crate / Test File Tests Result
hero_runner_lib (unit) 44 all pass
hero_runner_sdk (unit) 5 all pass
hero_runner_tests/job_lifecycle 9 all pass
hero_runner_tests/rhai_execution 6 all pass
hero_runner_tests/rpc_dispatch 27 all pass
Doc-tests (hero_runner_lib) 1 ignored
Doc-tests (hero_runner_sdk) 2 ignored

All 91 tests passed with 0 failures. Build completed in ~15 s (dev profile).

## Test Results **Build:** pass - Total: 91 - Passed: 91 - Failed: 0 - Ignored: 3 (doc-tests) ### Breakdown by crate | Crate / Test File | Tests | Result | |---|---|---| | `hero_runner_lib` (unit) | 44 | all pass | | `hero_runner_sdk` (unit) | 5 | all pass | | `hero_runner_tests/job_lifecycle` | 9 | all pass | | `hero_runner_tests/rhai_execution` | 6 | all pass | | `hero_runner_tests/rpc_dispatch` | 27 | all pass | | Doc-tests (`hero_runner_lib`) | 1 ignored | — | | Doc-tests (`hero_runner_sdk`) | 2 ignored | — | All 91 tests passed with 0 failures. Build completed in ~15 s (dev profile).
Author
Owner

Implementation Complete — Code Management

New Files (3)

  • crates/hero_runner_server/src/code_db.rs — Redis metadata store (hidden flag, tags) with in-memory fallback
  • crates/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.pull
  • crates/hero_runner_ui/static/js/code_manage.js — Full Code Management UI: table rendering, modals, bulk actions, context menu, tag editor

Modified Files (9)

  • crates/hero_runner_server/Cargo.toml — added redis dependency
  • crates/hero_runner_server/src/lib.rs — pub mod code_db
  • crates/hero_runner_server/src/web.rs — added code_db: Arc<CodeMetaStore> to WebState
  • crates/hero_runner_server/src/rpc/mod.rs — dispatch for all 10 new code.* methods
  • crates/hero_runner_server/openrpc.json — 10 new method entries
  • crates/hero_runner_ui/templates/index.html — Code tab button, #tab-code pane (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.jsloadAdminInfra(), codeInit() wired to tab activation
  • crates/hero_runner_ui/static/css/dashboard.css — Code Management styles

Features Implemented

  • Admin tab shows CODEROOT; red alert when absent
  • Code tab with repo table (name, branch, ahead/behind, tags)
  • code.list scans CODEROOT, enriches with Redis metadata
  • Hide/unhide repos (persisted in Redis, fallback to in-memory)
  • Tags (multiple) per repo (persisted in Redis)
  • Visibility filter (visible / hidden / all)
  • Search filter (real-time)
  • Add Repo (clone via URL or org/name shorthand)
  • Delete repo (with confirmation, path validated against CODEROOT)
  • Push (git add -A → commit → push)
  • Pull (git pull --rebase)
  • Right-click context menu
  • Select all + bulk actions (hide/unhide/delete/push/pull)
  • Build: | Tests: 91 passed, 0 failed
## Implementation Complete — Code Management ### New Files (3) - `crates/hero_runner_server/src/code_db.rs` — Redis metadata store (hidden flag, tags) with in-memory fallback - `crates/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.pull` - `crates/hero_runner_ui/static/js/code_manage.js` — Full Code Management UI: table rendering, modals, bulk actions, context menu, tag editor ### Modified Files (9) - `crates/hero_runner_server/Cargo.toml` — added `redis` dependency - `crates/hero_runner_server/src/lib.rs` — pub mod code_db - `crates/hero_runner_server/src/web.rs` — added `code_db: Arc<CodeMetaStore>` to WebState - `crates/hero_runner_server/src/rpc/mod.rs` — dispatch for all 10 new code.* methods - `crates/hero_runner_server/openrpc.json` — 10 new method entries - `crates/hero_runner_ui/templates/index.html` — Code tab button, `#tab-code` pane (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 activation - `crates/hero_runner_ui/static/css/dashboard.css` — Code Management styles ### Features Implemented - ✅ Admin tab shows CODEROOT; red alert when absent - ✅ Code tab with repo table (name, branch, ahead/behind, tags) - ✅ `code.list` scans CODEROOT, enriches with Redis metadata - ✅ Hide/unhide repos (persisted in Redis, fallback to in-memory) - ✅ Tags (multiple) per repo (persisted in Redis) - ✅ Visibility filter (visible / hidden / all) - ✅ Search filter (real-time) - ✅ Add Repo (clone via URL or org/name shorthand) - ✅ Delete repo (with confirmation, path validated against CODEROOT) - ✅ Push (git add -A → commit → push) - ✅ Pull (git pull --rebase) - ✅ Right-click context menu - ✅ Select all + bulk actions (hide/unhide/delete/push/pull) - ✅ Build: ✅ | Tests: 91 passed, 0 failed
Author
Owner

Implementation committed: e2c6e75

Browse: e2c6e75

Implementation committed: `e2c6e75` Browse: https://forge.ourworld.tf/lhumina_code/hero_code/commit/e2c6e75
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_code#3
No description provided.