(MOT-4258) feat(worktree,console): ship the worktrees page as injectable console UI - #610
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
skill-check — worker0 verified, 49 skipped (no docs/).
Four for four. Nicely done. |
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR moves the worktree console UI into the worker as an injected frontend, adds RPC-backed live data and embedded asset registration, and removes the former first-party worktrees route, navigation option, page, and lifecycle subscription hook. ChangesWorktree UI migration
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
console/web/src/hooks/use-hash-route.ts (1)
94-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPreserve existing
#/worktreesdeep links.
routeFromHash('#/worktrees')now returnsnull, souseHashRoutefalls back totraceswhile leaving the old hash in the URL. Existing bookmarks and links therefore open the traces view instead of the injected#/ext/worktreepage. Add an explicit compatibility redirect and a regression test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@console/web/src/hooks/use-hash-route.ts` around lines 94 - 99, Update routeFromHash in useHashRoute to recognize the legacy `#/worktrees` hash and redirect it to the injected `#/ext/worktree` route, preserving existing deep-link behavior. Add a regression test covering routeFromHash('`#/worktrees`') and verify it resolves to the worktree page rather than falling back to traces.
🧹 Nitpick comments (1)
console/web/src/hooks/use-hash-route.ts (1)
6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the routing comment aligned with
View.The comment omits the still-supported
memory,github, andextviews. Update it to describe the complete routed-view set.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@console/web/src/hooks/use-hash-route.ts` at line 6, Update the routed-views comment in use-hash-route.ts to include the supported memory, github, and ext views alongside traces, workers, browser, and configuration, keeping it aligned with the View definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@worktree/build.rs`:
- Around line 47-60: Register SKIP_UI_BUILD, PNPM, and PATH as build-script
rerun inputs at the start of the build logic, using Cargo’s rustc-env change
directives. Keep the existing locate_pnpm and asset-generation behavior
unchanged.
---
Outside diff comments:
In `@console/web/src/hooks/use-hash-route.ts`:
- Around line 94-99: Update routeFromHash in useHashRoute to recognize the
legacy `#/worktrees` hash and redirect it to the injected `#/ext/worktree` route,
preserving existing deep-link behavior. Add a regression test covering
routeFromHash('`#/worktrees`') and verify it resolves to the worktree page rather
than falling back to traces.
---
Nitpick comments:
In `@console/web/src/hooks/use-hash-route.ts`:
- Line 6: Update the routed-views comment in use-hash-route.ts to include the
supported memory, github, and ext views alongside traces, workers, browser, and
configuration, keeping it aligned with the View definition.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a812978a-773c-4e42-9c6f-2524f6d838fc
⛔ Files ignored due to path filters (2)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlworktree/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (27)
console/web/src/App.tsxconsole/web/src/hooks/use-hash-route.tsconsole/web/src/hooks/use-worktree-events.tsconsole/web/src/lib/nav-options.test.tsconsole/web/src/lib/nav-options.tsconsole/web/src/pages/Worktrees/components/WorktreeGraph.stories.tsxconsole/web/src/pages/Worktrees/hooks/useWorktreesLive.tsconsole/web/src/pages/Worktrees/index.tsxpnpm-workspace.yamlworktree/Cargo.tomlworktree/build.rsworktree/src/lib.rsworktree/src/main.rsworktree/src/ui.rsworktree/ui/build.mjsworktree/ui/package.jsonworktree/ui/page.tsxworktree/ui/src/page/WorktreeDetailPanel.tsxworktree/ui/src/page/WorktreeGraph.tsxworktree/ui/src/page/icons.tsxworktree/ui/src/page/index.tsxworktree/ui/src/page/layout.test.tsworktree/ui/src/page/layout.tsworktree/ui/src/page/useWorktreesLive.tsworktree/ui/src/page/worktree-data.tsworktree/ui/styles.cssworktree/ui/tsconfig.json
💤 Files with no reviewable changes (4)
- console/web/src/pages/Worktrees/index.tsx
- console/web/src/pages/Worktrees/components/WorktreeGraph.stories.tsx
- console/web/src/pages/Worktrees/hooks/useWorktreesLive.ts
- console/web/src/lib/nav-options.ts
| if std::env::var_os("SKIP_UI_BUILD").is_some() { | ||
| for asset in &dist_assets { | ||
| if !asset.exists() { | ||
| panic!( | ||
| "SKIP_UI_BUILD set but {} is missing — build the UI manually \ | ||
| (cd ui && pnpm install && pnpm build) or unset the env var", | ||
| asset.display() | ||
| ); | ||
| } | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| let pnpm = locate_pnpm(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'var_os\("SKIP_UI_BUILD"\)|var\("PNPM"\)|var_os\("PATH"\)|rerun-if-env-changed' worktree/build.rsRepository: iii-hq/workers
Length of output: 327
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)worktree/(build\.rs|.*toml)$|^Cargo\.lock$|^Cargo\.toml$'
echo "== build.rs outline =="
ast-grep outline worktree/build.rs --view expanded || true
echo "== build.rs relevant lines =="
sed -n '1,220p' worktree/build.rs
echo "== cargo env rerun mentions =="
rg -n 'cargo:rerun-if-env-changed|SKIP_UI_BUILD|run_ui_pnpm|locate_pnpm|PATH|PNPM' worktree/build.rs worktree/Cargo.toml Cargo.tomlRepository: iii-hq/workers
Length of output: 144
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== tracked relevant files =="
git ls-files | awk '$1 ~ /^(worktree\/build\.rs|.*Cargo\.toml|Cargo\.lock)$/ {print}' | sed -n '1,80p'
echo "== relevant text search =="
rg -n 'var_os\("SKIP_UI_BUILD"\)|var\("PNPM"\)|var_os\("PATH"\)|cargo:rerun-if-env-changed|worktree' worktree/build.rs worktree/Cargo.toml Cargo.toml 2>/dev/null || true
echo "== build.rs line count =="
wc -l worktree/build.rs 2>/dev/null || true
echo "== build.rs snippets =="
sed -n '1,220p' worktree/build.rs 2>/dev/null || trueRepository: iii-hq/workers
Length of output: 7278
Track build-control environment changes.
SKIP_UI_BUILD, PNPM, and PATH affect whether this build script regenerates or embeds assets, but Cargo does not rerun it when they change unless registered.
Proposed fix
fn main() {
+ println!("cargo:rerun-if-env-changed=SKIP_UI_BUILD");
+ println!("cargo:rerun-if-env-changed=PNPM");
+ println!("cargo:rerun-if-env-changed=PATH");
+
println!(📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if std::env::var_os("SKIP_UI_BUILD").is_some() { | |
| for asset in &dist_assets { | |
| if !asset.exists() { | |
| panic!( | |
| "SKIP_UI_BUILD set but {} is missing — build the UI manually \ | |
| (cd ui && pnpm install && pnpm build) or unset the env var", | |
| asset.display() | |
| ); | |
| } | |
| } | |
| return; | |
| } | |
| let pnpm = locate_pnpm(); | |
| println!("cargo:rerun-if-env-changed=SKIP_UI_BUILD"); | |
| println!("cargo:rerun-if-env-changed=PNPM"); | |
| println!("cargo:rerun-if-env-changed=PATH"); | |
| if std::env::var_os("SKIP_UI_BUILD").is_some() { | |
| for asset in &dist_assets { | |
| if !asset.exists() { | |
| panic!( | |
| "SKIP_UI_BUILD set but {} is missing — build the UI manually \ | |
| (cd ui && pnpm install && pnpm build) or unset the env var", | |
| asset.display() | |
| ); | |
| } | |
| } | |
| return; | |
| } | |
| let pnpm = locate_pnpm(); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@worktree/build.rs` around lines 47 - 60, Register SKIP_UI_BUILD, PNPM, and
PATH as build-script rerun inputs at the start of the build logic, using Cargo’s
rustc-env change directives. Keep the existing locate_pnpm and asset-generation
behavior unchanged.
…able-ui # Conflicts: # console/web/src/App.tsx # console/web/src/hooks/use-hash-route.ts # console/web/src/lib/nav-options.test.ts # pnpm-lock.yaml
|
@coderabbitai review |
✅ Action performedReview finished.
|
What
Moves the console's worktrees page to an injectable UI shipped by the worktree worker, per
docs/sops/injectable-console-ui.md(state worker as the reference), mirroring the github port. Part of the console injectable-UI migration (MOT-4256).worktree/ui (injectable)
page.tsx:setup(host)registers the worktrees page (#/ext/worktree, nav labelworktrees).src/page/: the graph (WorktreeGraph), detail panel, and purelayout.tsgeometry ported to@iii-dev/console-ui+host.iii.trigger;useWorktreesLivere-subscribes on the sixworktree::{created,claimed,released,removed,landed,land-blocked}events (tab-scoped, unmount cleanup). Inline SVG icons.styles.cssscoped[data-iii-ui="worktree"], tokens only.build.mjsesbuild with the five shared externals.iii-console-uicrate,ConsoleUi::new("worktree").script(...).style(...).register(&iii);build.rsrespectsSKIP_UI_BUILD.pnpm-workspace.yamljoinsworktree/ui.console (deletions)
pages/Worktrees/(page + graph + detail + layout + live hook + Storybook story). EditedApp.tsx,use-hash-route.ts,nav-options.ts,use-worktree-events.ts(page-only lifecycle hook). Kept the chat-shell worktree bits (use-worktree-status,WorktreeBadge,DirectoryPicker,worktreeAvailable) that ChatView uses.Verification
ui::tests).tsc -bexit 0, biome clean on changed files.Closes MOT-4258.
Summary by CodeRabbit
New Features
Changes