Craft Agents uses esbuild for the main and preload processes, and Vite for the renderer process. All build scripts are managed through Bun.
Build Commands Overview
The build process is split into several stages for flexibility:Build Process Breakdown
Main Process
Build the Electron main process using esbuild:This compiles the main process TypeScript code from
apps/electron/src/main/ into optimized JavaScript.Preload Scripts
Build the context bridge preload scripts:Compiles the preload scripts that expose secure APIs to the renderer process.
Renderer Process
Build the React UI using Vite:Bundles the renderer process with all React components, shadcn/ui, and Tailwind CSS v4.
Creating Distributions
Useelectron-builder to create platform-specific installers and packages.
All Platforms
electron-builder.yml.
Platform-Specific Builds
Build Output
Built distributions are created in the project root:Development vs Production
Development Build
- Hot module replacement (HMR)
- Source maps enabled
- Debug logging on by default
- React DevTools integration
- Unminified code for debugging
Production Build
- Minified and optimized code
- Tree-shaking to reduce bundle size
- Production React build (no dev warnings)
- Source maps optional
- Environment-specific optimizations
Type Checking
Always run type checks before building for distribution:packages/core- Type definitionspackages/shared- Business logicpackages/session-tools-core- Session tools
Type checking runs separately from the build process. Always verify types before creating distributions.
Linting
Ensure code quality before building:Additional Build Scripts
Playground Development
Test UI components in isolation:http://localhost:5173/playground.html.
Release Script
Automated release process:Build Configuration
The Electron Builder configuration is defined inelectron-builder.yml at the project root:
electron-builder.yml
Troubleshooting
Build Fails with Type Errors
Run type checking first to identify issues:Missing Dependencies
Reinstall dependencies:Stale Build Cache
Clean all build artifacts:Platform-Specific Build Issues
Make sure you have the required platform tools:- macOS: Xcode Command Line Tools
- Windows: Visual Studio Build Tools or Visual Studio
- Linux: Standard build tools (
build-essentialon Debian/Ubuntu)
Next Steps
Setup
Review development environment setup
Guidelines
Learn contribution guidelines and best practices