Skip to content

refactor(renderer): normalize static shell file organization#130

Merged
Mehdi-Bl merged 3 commits into
mainfrom
feat/renderer-static-organization
Feb 14, 2026
Merged

refactor(renderer): normalize static shell file organization#130
Mehdi-Bl merged 3 commits into
mainfrom
feat/renderer-static-organization

Conversation

@Mehdi-Bl

@Mehdi-Bl Mehdi-Bl commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move renderer static shell files into scoped folders:
    • src/renderer/public/index.html
    • src/renderer/styles/styles.css
  • update all runtime/build references to the new paths (main load file path, Tailwind input/content, QA screenshot static server)
  • adjust moved index.html asset links and moved stylesheet @config/@source paths
  • add a short renderer folder structure section in README.md

Backlog

  • P0 Renderer cleanup 3/4: normalize static file organization (public/styles/assets)

Validation

  • npm run lint
  • npm test -- --runInBand
  • npm run qa:screenshot
  • make sonar

Summary by Sourcery

Normalize renderer static shell file organization and update references to the new locations.

Enhancements:

  • Document the renderer folder structure in the README for clearer project organization.
  • Move the renderer HTML shell into a scoped public directory and renderer styles into a dedicated styles directory, aligning paths across the app and build tooling.
  • Adjust Tailwind CSS configuration and entry stylesheet to point to the new renderer HTML and source file locations.
  • Update main process renderer load path and QA screenshot server static routes to serve the HTML shell from the new public directory.
  • Update build and watch CSS scripts to use the relocated renderer stylesheet entry file.

Summary by CodeRabbit

  • Documentation

    • Added Renderer Structure section to README documenting project directories, assets, and component organization.
  • Chores

    • Updated build configuration and npm scripts for reorganized project structure.
    • Modified asset paths and references to align with new directory hierarchy.
    • Updated Tailwind and static file routing configuration accordingly.

@sourcery-ai

sourcery-ai Bot commented Feb 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the renderer’s static shell layout by moving index.html and styles into scoped renderer/public and renderer/styles directories, updating all paths and references (Electron main, Tailwind config/CLI, QA screenshot server, and asset links) and documenting the structure in the README.

Sequence diagram for QA screenshot server static file handling after refactor

sequenceDiagram
  actor QAEngineer
  participant Script as capture-ui-screenshot.js
  participant Playwright as Playwright browser
  participant StaticServer
  participant FileSystem

  QAEngineer ->> Script: run npm run qa:screenshot
  Script ->> StaticServer: start server with routes
  Script ->> Playwright: launch Chromium and open /

  Playwright ->> StaticServer: GET /
  StaticServer ->> FileSystem: read src/renderer/public/index.html
  FileSystem -->> StaticServer: index.html contents
  StaticServer -->> Playwright: 200 index.html

  Playwright ->> StaticServer: GET /dist/renderer/output.css
  StaticServer ->> FileSystem: read dist/renderer/output.css
  FileSystem -->> StaticServer: output.css contents
  StaticServer -->> Playwright: 200 output.css

  Playwright ->> StaticServer: GET /dist/renderer/bundle.js
  StaticServer ->> FileSystem: read dist/renderer/bundle.js
  FileSystem -->> StaticServer: bundle.js contents
  StaticServer -->> Playwright: 200 bundle.js

  Playwright ->> StaticServer: GET /assets/icon.png
  StaticServer ->> FileSystem: read src/assets/icon.png
  FileSystem -->> StaticServer: icon.png
  StaticServer -->> Playwright: 200 icon.png

  Playwright ->> Script: rendered page ready
  Script ->> Playwright: capture screenshot
Loading

File-Level Changes

Change Details Files
Reorganize renderer static shell files into scoped public and styles directories and fix internal paths.
  • Move renderer HTML shell into src/renderer/public/index.html and update CSS and JS asset href/src paths to match new relative location.
  • Move main renderer stylesheet into src/renderer/styles/styles.css and adjust Tailwind @config and @source directives for the new directory depth and HTML location.
  • Update Electron main process to load the renderer from src/renderer/public/index.html instead of the previous root-level renderer index.
src/renderer/public/index.html
src/renderer/styles/styles.css
src/main/index.ts
Align build, tooling, and runtime configurations with the new renderer file structure.
  • Change Tailwind CLI input paths in npm scripts to point at src/renderer/styles/styles.css for both watch and build commands.
  • Update Tailwind content configuration to reference src/renderer/public/index.html as the HTML source for class scanning.
  • Adjust QA screenshot capture server routes to serve index.html from src/renderer/public and keep asset and bundle routes consistent with the dist structure.
package.json
tailwind.config.js
scripts/capture-ui-screenshot.js
Document the renderer folder layout for contributors.
  • Add a Renderer Structure section to the README describing locations for public HTML, styles, runtime renderer code, and shared assets.
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Feb 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR reorganizes the renderer structure by moving index.html to a new src/renderer/public/ directory and styles.css to src/renderer/styles/styles.css, updating corresponding build scripts, configuration files, and asset path references throughout the codebase.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added "Renderer Structure" section documenting new renderer directory layout (public/, styles/, components/, context/, i18n/, and assets/).
Build Configuration & Tools
package.json, tailwind.config.js, sonar-project.properties, scripts/capture-ui-screenshot.js
Updated Tailwind input/content paths from src/renderer/styles.css and src/renderer/index.html to new locations (src/renderer/styles/styles.css and src/renderer/public/index.html). Added Sonar test inclusions, CPD exclusions, and issue-ignore rules. Modified static file routing in screenshot script to serve from public directory.
Renderer Configuration
src/main/index.ts
Updated RENDERER_INDEX_PATH constant to reference new location: src/renderer/public/index.html.
Renderer Assets
src/renderer/public/index.html, src/renderer/styles/styles.css
Adjusted HTML asset paths (stylesheet and bundle script) to use new directory depth. Removed Tailwind @config and @source directives from styles.css, retaining only @import statement.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, hop! The renderer takes its place,
In public folders, keeping graceful pace.
Styles nest deeper in their styled array,
Asset paths corrected—hoorah, hooray! ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: reorganizing static shell files (index.html and styles.css) into scoped directories (public/ and styles/) to normalize renderer structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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 feat/renderer-static-organization

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
sonar-project.properties (1)

23-28: Verify the scope of the rule suppression is intentionally broad.

The suppression for typescript:S7772 applies to all files under src/**/*. If this is only needed for a few specific files that import fs or path without the node: prefix, consider narrowing the resourceKey to limit the suppression scope (e.g., src/main/**/* or specific files).

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.16.0)
package.json

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

scripts/capture-ui-screenshot.js

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

src/main/index.ts

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

  • 1 others

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.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Review Summary by Qodo

Organize renderer static files into scoped folders

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Move renderer static files into organized scoped folders
  - index.html moved to src/renderer/public/
  - styles.css moved to src/renderer/styles/
• Update all runtime and build references to new file paths
  - Main process renderer index path
  - Tailwind configuration content paths
  - QA screenshot static server routes
  - CSS build script input paths
• Adjust asset links and stylesheet config paths for new structure
• Add renderer folder structure documentation to README
Diagram
flowchart LR
  A["Renderer Files<br/>Reorganization"] --> B["Move to<br/>public/ & styles/"]
  B --> C["Update Path<br/>References"]
  C --> D["Main Process"]
  C --> E["Tailwind Config"]
  C --> F["QA Screenshot"]
  C --> G["CSS Build Scripts"]
  B --> H["Adjust Asset<br/>Links"]
  A --> I["Document<br/>Structure"]
Loading

Grey Divider

File Changes

1. src/main/index.ts ⚙️ Configuration changes +1/-1

Update main process renderer index path

• Update renderer index path from src/renderer/index.html to src/renderer/public/index.html

src/main/index.ts


2. scripts/capture-ui-screenshot.js ⚙️ Configuration changes +3/-2

Update QA screenshot static file routes

• Add new RENDERER_PUBLIC_DIR constant pointing to src/renderer/public
• Update static file routes to use new public directory path for index.html

scripts/capture-ui-screenshot.js


3. tailwind.config.js ⚙️ Configuration changes +1/-1

Update Tailwind content configuration path

• Update content path from ./src/renderer/index.html to ./src/renderer/public/index.html

tailwind.config.js


View more (4)
4. src/renderer/public/index.html ⚙️ Configuration changes +2/-2

Update asset link paths for new location

• Adjust stylesheet link path from ../../dist/renderer/output.css to
 ../../../dist/renderer/output.css
• Adjust script source path from ../../dist/renderer/bundle.js to
 ../../../dist/renderer/bundle.js

src/renderer/public/index.html


5. src/renderer/styles/styles.css ⚙️ Configuration changes +3/-3

Update stylesheet config and source paths

• Update @config path from ../../tailwind.config.js to ../../../tailwind.config.js
• Update @source paths to reference parent directory and public subdirectory

src/renderer/styles/styles.css


6. README.md 📝 Documentation +7/-0

Add renderer folder structure documentation

• Add new "Renderer Structure" section documenting folder organization
• Document purpose of public/, styles/, and other renderer directories

README.md


7. package.json ⚙️ Configuration changes +2/-2

Update CSS build script input paths

• Update watch:css script to reference ./src/renderer/styles/styles.css
• Update build:css script to reference ./src/renderer/styles/styles.css

package.json


Grey Divider

Qodo Logo

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Mehdi-Bl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the renderer's static file organization by relocating core files like index.html and styles.css into dedicated subdirectories. This change aims to create a more structured and maintainable project layout for renderer-related assets. The update necessitated comprehensive path adjustments across various configuration and script files to ensure all build processes and runtime references correctly point to the new locations.

Highlights

  • File Renaming and Relocation: The index.html file has been moved from src/renderer/index.html to src/renderer/public/index.html, and styles.css has been moved from src/renderer/styles.css to src/renderer/styles/styles.css to improve static file organization.
  • Path Updates Across the Project: Numerous references to the moved files have been updated, including in package.json for CSS build commands, scripts/capture-ui-screenshot.js for static file serving, src/main/index.ts for the main renderer path, and tailwind.config.js for content scanning.
  • Internal Asset Link Adjustments: The index.html file's internal links to output.css and bundle.js have been adjusted to correctly reflect its new location, and the styles.css file's @config and @source paths have been updated accordingly.
  • Documentation Update: A new section detailing the renderer's folder structure has been added to the README.md to provide clarity on the new organization.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Added a new 'Renderer Structure' section to document the organization of renderer-related files.
  • package.json
    • Updated the input path for Tailwind CSS in the watch:css and build:css scripts to reflect the new location of styles.css.
  • scripts/capture-ui-screenshot.js
    • Introduced a new constant RENDERER_PUBLIC_DIR for the public renderer directory.
    • Updated the STATIC_FILE_ROUTES map to reference index.html from its new public directory.
  • src/main/index.ts
    • Modified the RENDERER_INDEX_PATH constant to point to the new index.html location within the public subdirectory.
  • src/renderer/public/index.html
    • Renamed from src/renderer/index.html to src/renderer/public/index.html.
    • Adjusted relative paths for linked stylesheets and JavaScript bundles to account for the file's new directory depth.
  • src/renderer/styles/styles.css
    • Renamed from src/renderer/styles.css to src/renderer/styles/styles.css.
    • Updated the @config path to tailwind.config.js and @source paths for Tailwind CSS content scanning to reflect the new file location.
  • tailwind.config.js
    • Updated the content array to include the new path for index.html (./src/renderer/public/index.html).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Both src/main/index.ts and scripts/capture-ui-screenshot.js hardcode the renderer index.html path separately; consider centralizing this path in a shared config/module to avoid future drift when the structure changes again.
  • The relative href/src paths in public/index.html now depend on an extra ../ level; if you expect more structure changes, you might want to switch to a more resilient pattern (e.g., root-relative or injected asset base paths) to reduce the chance of breakage.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Both `src/main/index.ts` and `scripts/capture-ui-screenshot.js` hardcode the renderer `index.html` path separately; consider centralizing this path in a shared config/module to avoid future drift when the structure changes again.
- The relative `href`/`src` paths in `public/index.html` now depend on an extra `../` level; if you expect more structure changes, you might want to switch to a more resilient pattern (e.g., root-relative or injected asset base paths) to reduce the chance of breakage.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions

github-actions Bot commented Feb 14, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

The refactoring successfully normalizes the renderer's static file organization by moving the HTML shell and stylesheet into scoped directories. All build and runtime references have been updated accordingly. However, moving index.html to a deeper directory level (public/) changes the base URL for relative paths in the renderer, which breaks existing asset links in React components that were not updated in this PR.

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI Code Fusion</title>
<link rel="stylesheet" href="../../dist/renderer/output.css" />
<link rel="stylesheet" href="../../../dist/renderer/output.css" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Moving index.html to src/renderer/public/ changes the base path for relative URLs resolved by the browser. This breaks the application icon link in src/renderer/components/App.tsx (line 83), which currently uses src='../assets/icon.png'.

Since the HTML shell is now one level deeper, that path should be updated to ../../assets/icon.png in App.tsx to correctly point to src/assets/icon.png when running in Electron. Please verify if other components use similar relative paths to assets.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Feb 14, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Sonar excludes wrong CSS 🐞 Bug ✓ Correctness
Description
Tailwind CSS input was moved to src/renderer/styles/styles.css, but Sonar exclusions still list
src/renderer/styles.css. As a result, Sonar will no longer exclude the Tailwind source stylesheet as
intended, potentially adding noise and slowing CI analysis/quality gates.
Code

package.json[R38-40]

+    "watch:css": "npx @tailwindcss/cli -i ./src/renderer/styles/styles.css -o ./dist/renderer/output.css --watch",
 "prebuild:css": "node scripts/ensure-build-dirs.js",
-    "build:css": "npx @tailwindcss/cli -i ./src/renderer/styles.css -o ./dist/renderer/output.css",
+    "build:css": "npx @tailwindcss/cli -i ./src/renderer/styles/styles.css -o ./dist/renderer/output.css",
Evidence
The PR updates the Tailwind CLI input to the new stylesheet location under
src/renderer/styles/styles.css. However, both sonar-project.properties and the SonarCloud workflow
still exclude the old path src/renderer/styles.css, which no longer matches any file under
src/renderer; the only stylesheet present is src/renderer/styles/styles.css.

package.json[37-41]
sonar-project.properties[10-15]
.github/workflows/sonarcloud.yml[81-85]
src/renderer/styles/styles.css[1-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Sonar exclusions still reference `src/renderer/styles.css`, but the Tailwind source file is now `src/renderer/styles/styles.css`. This means Sonar may start analyzing the Tailwind source CSS unexpectedly.
### Issue Context
The PR updated the Tailwind CLI input path to `./src/renderer/styles/styles.css`, and the only stylesheet under `src/renderer` is now located at that path.
### Fix Focus Areas
- sonar-project.properties[10-16]
- .github/workflows/sonarcloud.yml[81-86]
### Suggested change
Replace `src/renderer/styles.css` with either:
- `src/renderer/styles/styles.css` (exact file), or
- `src/renderer/styles/**` (if you want to exclude all renderer CSS sources)
Keep the exclusions consistent between `sonar-project.properties` and the GitHub Actions SonarCloud args.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@sonarqubecloud

Copy link
Copy Markdown

@Mehdi-Bl Mehdi-Bl merged commit 164e35d into main Feb 14, 2026
25 checks passed
@Mehdi-Bl Mehdi-Bl deleted the feat/renderer-static-organization branch February 14, 2026 21:52
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