Skip to content

Fix theme directory path for bun bundler flat output#279

Merged
subsy merged 2 commits intomainfrom
claude/investigate-issue-277-TCvtD
Feb 4, 2026
Merged

Fix theme directory path for bun bundler flat output#279
subsy merged 2 commits intomainfrom
claude/investigate-issue-277-TCvtD

Conversation

@subsy
Copy link
Copy Markdown
Owner

@subsy subsy commented Feb 4, 2026

Summary

Updated the theme directory resolution logic to correctly handle the bun bundler's flat output structure, where the compiled CLI is located at dist/cli.js rather than in a nested directory structure.

Changes

  • Updated the dist-mode theme path from ../assets/themes to assets/themes to match bun's flat bundling output
  • Added clarifying comments explaining the difference between webpack's nested output structure (dist/tui/theme.js) and bun's flat output (dist/cli.js)
  • The path resolution now correctly locates themes in dist/assets/themes when running the bundled CLI

Implementation Details

The fix leverages the existing isInDist check that detects when code is running from the dist directory. Since bun produces a flat output structure where cli.js is directly in the dist root (rather than nested in dist/tui/), the relative path to assets needs to be adjusted accordingly. The development path resolution remains unchanged.

https://claude.ai/code/session_01WrY1zjHuxQ1ddiJNDfqVqi

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed theme directory resolution in bundled builds to ensure themes are correctly located and loaded.

The getThemesDir() function incorrectly navigated up one directory
when resolving bundled theme paths in the dist build. This caused
"Theme file not found" errors when using --theme with bundled themes
like dracula in npm-installed packages.

The bug was caused by outdated path logic that assumed bun's bundler
would preserve directory structure (dist/tui/theme.js), when it
actually produces flat output (dist/cli.js). The fix removes the
unnecessary parent directory traversal.

Fixes #277

https://claude.ai/code/session_01WrY1zjHuxQ1ddiJNDfqVqi
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ralph-tui Ignored Ignored Preview Feb 4, 2026 6:03pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

Updates the path resolution logic in the theme directory lookup function to accommodate a flattened dist bundle layout. The resolution path for the bundled theme assets changes from a nested structure to a flat structure, while development mode behaviour remains unaffected.

Changes

Cohort / File(s) Summary
Theme Path Resolution
src/tui/theme.ts
Adjusts dist build path resolution logic for theme directory lookup from nested dist structure (dist/tui/theme.js) to flat bundler layout (dist/cli.js), updating relative path from ../assets/themes to assets/themes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarises the main change: adjusting the theme directory path to accommodate bun's flat bundler output structure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/investigate-issue-277-TCvtD

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.70%. Comparing base (df431d9) to head (96ce25f).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/tui/theme.ts 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #279      +/-   ##
==========================================
- Coverage   43.70%   43.70%   -0.01%     
==========================================
  Files          94       94              
  Lines       29021    29022       +1     
==========================================
  Hits        12684    12684              
- Misses      16337    16338       +1     
Files with missing lines Coverage Δ
src/tui/theme.ts 89.23% <0.00%> (-0.32%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@subsy subsy merged commit d7d3ccd into main Feb 4, 2026
7 checks passed
@subsy subsy deleted the claude/investigate-issue-277-TCvtD branch February 4, 2026 18:03
sakaman pushed a commit to sakaman/ralph-tui that referenced this pull request Feb 15, 2026
…TCvtD

Fix theme directory path for bun bundler flat output
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.

2 participants