Skip to content

Conversation

@TataMata
Copy link

@TataMata TataMata commented Jan 30, 2026

Summary

  • Fix local package bundling: Replaced file: references (which create symlinks) with direct copying of @automaker/* packages to node_modules, resolving ERR_MODULE_NOT_FOUND errors in packaged Electron apps (AppImage, deb)
  • Collect transitive dependencies: External dependencies of local packages (e.g. p-limit from @automaker/platform) are now collected and installed via npm
  • Fix first-launch ENOENT: Ensure parent directories exist before writing to Electron userData, preventing crashes on first app launch

Test plan

  • Run npm run build:electron:linux (or mac/win equivalent) — build should complete without errors
  • Launch the built AppImage/installer — server should start without module resolution errors
  • Verify first launch works on a clean system (no ~/.config/Automaker/ directory)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced file system operations to automatically ensure parent directories exist before writing files, preventing potential failures.
  • Chores

    • Optimized build and server preparation processes to streamline local package handling and reduce symlink dependencies for improved deployment reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

Local @automaker/* packages were bundled using file: references that
created symlinks, which break inside packaged Electron apps (AppImage,
deb). This copies packages directly to node_modules and collects their
external dependencies (e.g. p-limit) for proper npm installation.

Also ensures parent directories exist before writing to Electron
userData, preventing ENOENT errors on first launch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @TataMata, 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 addresses critical build and runtime issues in packaged Electron applications. It refines the module resolution strategy for local packages by moving from symlinked file: references to direct copying, and ensures all necessary transitive dependencies are correctly bundled. Additionally, it improves application stability on first launch by proactively creating required user data directories, preventing common file system errors.

Highlights

  • Local Package Bundling Fix: Replaced file: references for local @automaker/* packages with direct copying into node_modules during the build process. This resolves ERR_MODULE_NOT_FOUND errors encountered in packaged Electron applications (e.g., AppImage, deb) that struggle with symlinked dependencies.
  • Transitive Dependency Collection: Implemented a mechanism to collect and install external transitive dependencies of local packages (e.g., p-limit from @automaker/platform) via npm. This ensures all necessary external modules are present in the bundled application.
  • First-Launch ENOENT Error Prevention: Modified the electronUserDataWriteFileSync utility to ensure that parent directories exist before attempting to write files to the Electron userData directory. This prevents ENOENT (No such file or directory) errors and potential crashes on the application's first launch on a clean system.

🧠 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.

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.

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

The PR refactors the server preparation script to inline local packages directly into node_modules instead of using file: references and symlinks. Additionally, it adds parent directory creation logic to ensure target directories exist before writing files in the file system utility.

Changes

Cohort / File(s) Summary
Server Build Configuration
apps/ui/scripts/prepare-server.mjs
Significantly restructures the build process: removes local packages from dependencies, collects external dependencies by scanning each local package's package.json, installs external dependencies, and copies local packages directly into node_modules instead of relying on symlinks. Step ordering changed to prioritize external dependency installation before local package copying and native module rebuilding.
File System Utility
libs/platform/src/system-paths.ts
Adds parent directory creation logic to electronUserDataWriteFileSync to ensure target directories exist before attempting to write files, enabling recursive parent directory creation when needed.

Sequence Diagram

sequenceDiagram
    participant Script as Build Script
    participant PkgJson as Local Package<br/>package.json Files
    participant ExtDeps as External<br/>Dependencies
    participant NodeMods as node_modules
    participant Native as Native<br/>Modules

    Script->>PkgJson: Scan each local package
    activate PkgJson
    Script->>Script: Collect external dependencies<br/>from each package
    deactivate PkgJson
    
    Script->>ExtDeps: Install external dependencies
    activate ExtDeps
    ExtDeps-->>NodeMods: Install packages
    deactivate ExtDeps
    
    Script->>NodeMods: Copy local packages directly<br/>(no symlinks)
    activate NodeMods
    NodeMods-->>NodeMods: Local packages inlined
    deactivate NodeMods
    
    Script->>Native: Rebuild native modules
    activate Native
    Native-->>NodeMods: Updated binaries
    deactivate Native
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Testers-Requested, Do Not Merge

Poem

🐰 Local packages bundled snug and tight,
No symlinks dancing in the night,
Directories crafted with careful care,
Server builds now native to its lair!

🚥 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 clearly and specifically summarizes the main change: fixing Electron build module resolution by handling local packages. It directly relates to the primary objective of replacing file: references with direct copying to avoid module not found errors in packaged apps.
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

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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
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 several important fixes for the Electron build process. It correctly changes the strategy for handling local packages from using file: symlinks to directly copying them into node_modules, which resolves module resolution errors in packaged applications. It also adds logic to collect transitive dependencies from these local packages and fixes a file system error on first launch by ensuring directories are created before writing files. The changes are well-implemented. I have one suggestion to improve the dependency collection script by adding a warning for version conflicts, which would make the build process more robust.

Comment on lines +108 to +111
if (!dependencies[depName]) {
dependencies[depName] = depVersion;
console.log(` + ${depName}@${depVersion} (from ${pkgName})`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current logic for collecting transitive dependencies from local packages doesn't handle version conflicts. If two local packages (or the server and a local package) depend on different versions of the same external dependency, the script will silently use the first version it encounters. This could lead to subtle bugs or runtime errors if the versions are incompatible.

It would be safer to add a warning when a version conflict is detected. This will make developers aware of potential issues during the build process.

        if (!dependencies[depName]) {
          dependencies[depName] = depVersion;
          console.log(`   + ${depName}@${depVersion} (from ${pkgName})`);
        } else if (dependencies[depName] !== depVersion) {
          console.warn(`   ⚠️  Version conflict for ${depName}: existing version is ${dependencies[depName]}, but ${pkgName} requires ${depVersion}. Using existing version.`);
        }

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