Skip to content

wk tui config changes#1341

Open
sfierro wants to merge 1 commit intomainfrom
sfierro/wk-tui
Open

wk tui config changes#1341
sfierro wants to merge 1 commit intomainfrom
sfierro/wk-tui

Conversation

@sfierro
Copy link
Copy Markdown
Contributor

@sfierro sfierro commented Apr 24, 2026

these are needed for Steve's worktree_tui repo wk tool if you check out my branch sfierro/wk-selector-workspace-side-by-side

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bf1c0c9e-642c-4b69-83d0-9930499c9e25

📥 Commits

Reviewing files that changed from the base of the PR and between b1d9efe and 4ad5b57.

📒 Files selected for processing (5)
  • .agents/claude/setup.sh
  • .config/wk.yml
  • .config/wt/.worktreeinclude
  • .config/wt/env.sh
  • .gitignore
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (2)
  • .agents/claude/setup.sh
  • .config/wt/env.sh

Walkthrough

This pull request adds workspace environment setup infrastructure with a new configuration script that manages per-branch port allocation, exports workspace variables, and initializes workspace windows in the development environment. The setup ensures .worktreeinclude is created during agent initialization and added to git ignore.

Changes

Cohort / File(s) Summary
Workspace Configuration
.config/wk.yml
Added workspace_env_script hook pointing to .config/wt/env.sh and new workspace_windows configuration defining startup commands for terminal, agent, backend, and web UI with appropriate working directories and environment variables.
Environment Setup
.config/wt/env.sh
New shell script that computes branch-specific ports via hashing, exports KILN_PORT, KILN_FRONTEND_PORT, VITE_API_PORT, VITE_BRANCH_NAME, and KILN_CODER_CMD, with optional user settings override and workspace binary directory management.
Agent Initialization
.agents/claude/setup.sh
Added step to ensure .worktreeinclude file exists at repository root by copying from .config/wt/.worktreeinclude.
Git Configuration
.gitignore
Added ignore rule for root-level .worktreeinclude file.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • wt fix #1202: Extends workspace startup scripts to source .config/wt/user_settings.sh for user customization, which this PR also implements.
  • .env in .worktreeinclude for worktrunk #1212: Manages .config/wt/user_settings.sh and .env entries in .worktreeinclude, complementing this PR's worktreeinclude setup logic.
  • Workspaces & Worktrees #1130: Adds workspace configuration and environment startup scripts with similar port handling and multi-window setup patterns.

Suggested reviewers

  • scosman
  • chiang-daniel
  • leonardmq

Poem

🐰 Hop hop, the ports align!
Branch names hash and ports define,
Windows spawn in harmony fine,
Claude's included, all by design! 🎪✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete; it lacks required sections from the template including 'What does this PR do?', related issues, CLA confirmation, and checklists. Complete the PR description by filling in the template sections: explain what the PR does, link related issues, confirm CLA agreement with your GitHub username, and check the required checkboxes.
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'wk tui config changes' directly refers to the primary changes: configuration updates for the wk (worktree_tui) tool, covering workspace environment and startup configurations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sfierro/wk-tui

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.config/wt/env.sh (1)

32-33: Make PATH prepend idempotent.

Lines 32–33 prepend WK_BIN_DIR every time the script is sourced, which can bloat PATH across window/session reloads.

Suggested fix
 export WK_BIN_DIR="$REPO_ROOT/.config/wt/bin"
-export PATH="$WK_BIN_DIR:$PATH"
+case ":$PATH:" in
+  *":$WK_BIN_DIR:"*) ;;
+  *) export PATH="$WK_BIN_DIR:$PATH" ;;
+esac
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.config/wt/env.sh around lines 32 - 33, Prepend to PATH only if WK_BIN_DIR
is not already present: ensure WK_BIN_DIR is defined, check PATH for an exact
entry (use colon-wrapped comparison to avoid partial matches) and only then set
PATH="$WK_BIN_DIR:$PATH" and export; this makes the export of WK_BIN_DIR and
PATH idempotent across repeated sourcing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.config/wk.yml:
- Line 7: The term value currently references SHELL directly which can be unset;
update the term string to use shell parameter expansion to provide a safe
fallback (e.g., fall back to /bin/sh or /bin/bash) when SHELL is undefined so
the echo+exec sequence won't fail; specifically modify the "term" entry in the
YAML to replace plain $SHELL with a fallback expansion (use the existing term
key as the location to change).

In @.config/wt/env.sh:
- Line 8: The BRANCH assignment uses git in the caller's CWD so it can pick the
wrong branch when the script is sourced outside the repo; change it to resolve
git operations from the repository root instead. Update the BRANCH logic (the
BRANCH variable assignment) to first get the repo root (via git rev-parse
--show-toplevel 2>/dev/null) and then run git --show-current with -C pointing at
that root, falling back to "main" if those git calls fail.

---

Nitpick comments:
In @.config/wt/env.sh:
- Around line 32-33: Prepend to PATH only if WK_BIN_DIR is not already present:
ensure WK_BIN_DIR is defined, check PATH for an exact entry (use colon-wrapped
comparison to avoid partial matches) and only then set PATH="$WK_BIN_DIR:$PATH"
and export; this makes the export of WK_BIN_DIR and PATH idempotent across
repeated sourcing.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6fbb3c80-a81d-499b-9599-131f27b1fe43

📥 Commits

Reviewing files that changed from the base of the PR and between 7f69c4c and 3d4a7c0.

📒 Files selected for processing (3)
  • .config/wk.yml
  • .config/wt/env.sh
  • .worktreeinclude

Comment thread .config/wk.yml
Comment thread .config/wt/env.sh Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a workspace environment configuration by adding a dynamic environment setup script and defining workspace window commands. The changes include a new shell script to manage branch-specific ports and environment variables, and updates to the workspace configuration file. Feedback was provided to improve the robustness of the port hashing function against missing dependencies and to prevent duplicate entries in the PATH variable when the script is sourced multiple times.

Comment thread .config/wt/env.sh
Comment thread .config/wt/env.sh Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

📊 Coverage Report

Overall Coverage: 45%

Diff: origin/main...HEAD

No lines with coverage information in this diff.


@sfierro sfierro changed the title wk tui changes wk tui config changes Apr 24, 2026
@sfierro sfierro changed the base branch from main to scosman/cleanup_root April 24, 2026 01:48
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
libs/server/kiln_server/utils/agent_checks/policy_lookup.py (1)

32-40: Remove the deprecated _load() method to eliminate dead code.

The _load() method is never called internally within the class and has no external callers. Since _load is private by convention, removing it outright is cleaner than maintaining a deprecation shim for unused code. The public API is already preload() and get_policy(), both of which work correctly without it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/server/kiln_server/utils/agent_checks/policy_lookup.py` around lines 32
- 40, The private deprecated method _load() is dead code; remove the entire
_load method (the warnings.warn call and self.preload() invocation) from
policy_lookup.py and any associated docstring or comments so the class exposes
only the public preload() and get_policy() API; after removal, run linters/tests
and delete any now-unused imports (e.g., warnings) if they become unused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@libs/server/kiln_server/utils/agent_checks/policy_lookup.py`:
- Around line 32-40: The private deprecated method _load() is dead code; remove
the entire _load method (the warnings.warn call and self.preload() invocation)
from policy_lookup.py and any associated docstring or comments so the class
exposes only the public preload() and get_policy() API; after removal, run
linters/tests and delete any now-unused imports (e.g., warnings) if they become
unused.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a87c3db2-5de3-4f5d-8939-0bdcc8ef8926

📥 Commits

Reviewing files that changed from the base of the PR and between e4879fc and 99a75f9.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • .agents/claude/setup.sh
  • .config/wk.yml
  • .config/wt/.worktreeinclude
  • .config/wt/env.sh
  • .config/wt/layout.kdl
  • .github/workflows/check_api_bindings.yml
  • .github/workflows/test_count.yml
  • .github/workflows/web_format_lint_build.yml
  • .gitignore
  • CONTRIBUTING.md
  • Makefile
  • app/desktop/studio_server/chat/routes.py
  • app/desktop/studio_server/chat/test_routes.py
  • app/web_ui/.nvmrc
  • app/web_ui/src/lib/stores/local_storage_store.ts
  • app/web_ui/src/routes/(app)/dataset/[project_id]/[task_id]/[run_id]/run/+page.svelte
  • app/web_ui/src/routes/(app)/run/run.svelte
  • libs/server/kiln_server/utils/agent_checks/policy_lookup.py
  • libs/server/kiln_server/utils/agent_checks/test_policy_lookup.py
✅ Files skipped from review due to trivial changes (7)
  • .gitignore
  • app/web_ui/.nvmrc
  • .agents/claude/setup.sh
  • .github/workflows/check_api_bindings.yml
  • .github/workflows/test_count.yml
  • .config/wk.yml
  • .config/wt/env.sh
🚧 Files skipped from review as they are similar to previous changes (8)
  • CONTRIBUTING.md
  • .github/workflows/web_format_lint_build.yml
  • app/desktop/studio_server/chat/routes.py
  • .config/wt/layout.kdl
  • libs/server/kiln_server/utils/agent_checks/test_policy_lookup.py
  • app/web_ui/src/lib/stores/local_storage_store.ts
  • app/desktop/studio_server/chat/test_routes.py
  • Makefile

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
app/web_ui/src/lib/ui/kiln_settings_row.svelte (2)

57-90: Consider extracting the inline SVGs to icon components for consistency.

The rest of the settings page uses dedicated icon components from $lib/ui/icons/*. Inlining these two glyphs here diverges from that pattern and makes future swaps (e.g., new external-link icon) harder. Low priority since the component is self-contained.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/web_ui/src/lib/ui/kiln_settings_row.svelte` around lines 57 - 90, The
inline SVGs in kiln_settings_row.svelte (the conditional branch for {`#if` href &&
is_external} and the {:else} chevron) should be replaced with icon components
for consistency; create or import icon components (e.g., ExternalLinkIcon and
ChevronRightIcon) from $lib/ui/icons, pass through the existing class="w-full
h-full" and aria-hidden="true" props (or class/style slot) so sizing/visibility
stays the same, and then remove the inline SVG blocks and their duplicated
attributes, keeping the {`#if` href && is_external} conditional and span wrapper
intact and ensuring the icons render based on the same is_external/href logic.

41-48: Nit: use DaisyUI/Tailwind token for the warning dot color.

The inline hex #F4B544 bypasses the theme. A DaisyUI token (e.g., bg-warning) keeps styling consistent and theme-aware:

🎨 Suggested tweak
-        <span
-          class="inline-block w-2 h-2 rounded-full flex-shrink-0"
-          style="background-color: `#F4B544`;"
-          role="img"
-          aria-label="Warning"
-        ></span>
+        <span
+          class="inline-block w-2 h-2 rounded-full flex-shrink-0 bg-warning"
+          role="img"
+          aria-label="Warning"
+        ></span>

As per coding guidelines: "Use DaisyUI for UI components in the web frontend".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/web_ui/src/lib/ui/kiln_settings_row.svelte` around lines 41 - 48, The
warning dot uses an inline style color (`#F4B544`) which bypasses theme tokens;
replace the inline style on the <span> rendered when status === "warn" with a
DaisyUI/Tailwind background token (e.g., add the class bg-warning) so it
respects theming, keeping the existing classes (inline-block w-2 h-2
rounded-full flex-shrink-0) and the role/aria-label attributes intact; update
the span in the conditional block that checks status === "warn" to use the
token-based class instead of style.
app/web_ui/src/routes/(app)/settings/+page.svelte (1)

31-44: Row type allows both href and on_click, but only one is actually honored.

KilnSettingsRow wires on:click only when href is falsy, so a row declaring both would silently lose its click handler. Current usages are mutually exclusive, so no bug today — consider a discriminated union if you want the type system to enforce this:

♻️ Optional stricter typing
-  type SettingsRow = {
-    label: string
-    icon: ComponentType
-    detail?: string
-    href?: string
-    on_click?: () => void
-    is_external?: boolean
-    status?: "warn"
-  }
+  type SettingsRowBase = {
+    label: string
+    icon: ComponentType
+    detail?: string
+    status?: "warn"
+  }
+  type SettingsRow =
+    | (SettingsRowBase & { href: string; is_external?: boolean; on_click?: never })
+    | (SettingsRowBase & { on_click: () => void; href?: never; is_external?: never })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/web_ui/src/routes/`(app)/settings/+page.svelte around lines 31 - 44, The
SettingsRow type currently allows both href and on_click which is misleading
because KilnSettingsRow only wires on:click when href is falsy; change
SettingsRow to a discriminated union so callers cannot provide both: create two
variants (e.g., { href: string; is_external?: boolean; icon: ComponentType;
label: string; detail?: string; status?: "warn" } and { on_click: () => void;
icon: ComponentType; label: string; detail?: string; status?: "warn" }) and
update any code that builds rows to conform to the appropriate variant; keep the
KilnSettingsRow wiring logic unchanged but adjust its prop type to accept the
union so the type system enforces mutual exclusivity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/web_ui/src/lib/ui/kiln_settings_row.svelte`:
- Around line 57-90: The inline SVGs in kiln_settings_row.svelte (the
conditional branch for {`#if` href && is_external} and the {:else} chevron) should
be replaced with icon components for consistency; create or import icon
components (e.g., ExternalLinkIcon and ChevronRightIcon) from $lib/ui/icons,
pass through the existing class="w-full h-full" and aria-hidden="true" props (or
class/style slot) so sizing/visibility stays the same, and then remove the
inline SVG blocks and their duplicated attributes, keeping the {`#if` href &&
is_external} conditional and span wrapper intact and ensuring the icons render
based on the same is_external/href logic.
- Around line 41-48: The warning dot uses an inline style color (`#F4B544`) which
bypasses theme tokens; replace the inline style on the <span> rendered when
status === "warn" with a DaisyUI/Tailwind background token (e.g., add the class
bg-warning) so it respects theming, keeping the existing classes (inline-block
w-2 h-2 rounded-full flex-shrink-0) and the role/aria-label attributes intact;
update the span in the conditional block that checks status === "warn" to use
the token-based class instead of style.

In `@app/web_ui/src/routes/`(app)/settings/+page.svelte:
- Around line 31-44: The SettingsRow type currently allows both href and
on_click which is misleading because KilnSettingsRow only wires on:click when
href is falsy; change SettingsRow to a discriminated union so callers cannot
provide both: create two variants (e.g., { href: string; is_external?: boolean;
icon: ComponentType; label: string; detail?: string; status?: "warn" } and {
on_click: () => void; icon: ComponentType; label: string; detail?: string;
status?: "warn" }) and update any code that builds rows to conform to the
appropriate variant; keep the KilnSettingsRow wiring logic unchanged but adjust
its prop type to accept the union so the type system enforces mutual
exclusivity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 65b9d353-835c-4275-b33a-8546dd766472

📥 Commits

Reviewing files that changed from the base of the PR and between 99a75f9 and b1d9efe.

📒 Files selected for processing (12)
  • app/web_ui/src/lib/ui/icons/book_icon.svelte
  • app/web_ui/src/lib/ui/icons/cube_icon.svelte
  • app/web_ui/src/lib/ui/icons/edit_icon.svelte
  • app/web_ui/src/lib/ui/icons/folder_icon.svelte
  • app/web_ui/src/lib/ui/icons/folders_icon.svelte
  • app/web_ui/src/lib/ui/icons/key_icon.svelte
  • app/web_ui/src/lib/ui/icons/refresh_icon.svelte
  • app/web_ui/src/lib/ui/icons/shield_icon.svelte
  • app/web_ui/src/lib/ui/icons/terminal_icon.svelte
  • app/web_ui/src/lib/ui/kiln_settings_row.svelte
  • app/web_ui/src/routes/(app)/settings/+page.svelte
  • app/web_ui/src/routes/(app)/settings/page.test.ts
✅ Files skipped from review due to trivial changes (9)
  • app/web_ui/src/lib/ui/icons/book_icon.svelte
  • app/web_ui/src/lib/ui/icons/cube_icon.svelte
  • app/web_ui/src/lib/ui/icons/key_icon.svelte
  • app/web_ui/src/lib/ui/icons/folder_icon.svelte
  • app/web_ui/src/lib/ui/icons/folders_icon.svelte
  • app/web_ui/src/lib/ui/icons/shield_icon.svelte
  • app/web_ui/src/lib/ui/icons/edit_icon.svelte
  • app/web_ui/src/lib/ui/icons/terminal_icon.svelte
  • app/web_ui/src/lib/ui/icons/refresh_icon.svelte

Base automatically changed from scosman/cleanup_root to main April 24, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant