| Crates.io | kodegen_bundler_bundle |
| lib.rs | kodegen_bundler_bundle |
| version | 0.10.9 |
| created_at | 2025-11-14 13:22:56.454593+00 |
| updated_at | 2026-01-02 15:18:33.854982+00 |
| description | Multi-platform bundler for creating native installers (.deb, .rpm, .dmg, .msi, AppImage) |
| homepage | https://kodegen.ai |
| repository | https://github.com/cyrup-ai/kodegen-bundler-release |
| max_upload_size | |
| id | 1932826 |
| size | 624,324 |
Multi-platform package bundler for Rust applications.
kodegen-bundler-bundle is a standalone binary that creates platform-specific installation packages for Rust applications. It supports Linux (.deb, .rpm, AppImage), macOS (.app, .dmg), and Windows (.msi, .exe) package formats.
This bundler is designed to be called programmatically by release workflows (like kodegen-bundler-release) with explicit output path contracts.
# Install from crates.io
cargo install kodegen_bundler_bundle
# OR build from source
git clone https://github.com/cyrup-ai/kodegen-bundler-bundle
cd kodegen-bundler-bundle
cargo install --path .
The bundler accepts exactly three arguments and handles everything else internally:
# Bundle from local repository (reads Cargo.toml for GitHub URL, clones to tmp, builds, bundles)
kodegen_bundler_bundle \
--source . \
--platform deb \
--output-binary /tmp/artifacts/myapp_1.0.0_arm64.deb
# Bundle from GitHub org/repo (clones to tmp, builds, bundles)
kodegen_bundler_bundle \
--source cyrup-ai/kodegen \
--platform dmg \
--output-binary /tmp/artifacts/kodegen_0.1.2_arm64.dmg
# Bundle from GitHub URL (clones to tmp, builds, bundles)
kodegen_bundler_bundle \
--source https://github.com/cyrup-ai/kodegen \
--platform nsis \
--output-binary C:\builds\kodegen_setup.exe
Exit code 0 = artifact guaranteed to exist at --output-binary path.
--output-binary FlagWhen --output-binary is specified, the bundler establishes a strict contract with the caller:
If bundler returns exit code 0:
✓ File exists at --output-binary path
✓ File is complete and valid
✓ All parent directories created
✓ Original artifact removed from temp location
If bundler returns non-zero exit code:
✗ File may not exist at specified path
✗ Check stderr for error details
Important: Callers should only rely on exit codes for contract enforcement. stdout and stderr are for human consumption and debugging, not programmatic parsing.
--source <SOURCE> # Where to get the code (3 formats):
# 1. Local path: . or /path/to/repo
# → Reads Cargo.toml repository field
# → Clones from GitHub to /tmp/kodegen-bundle-{uuid}
# 2. GitHub org/repo: cyrup-ai/kodegen
# → Clones from GitHub to /tmp/kodegen-bundle-{uuid}
# 3. GitHub URL: https://github.com/cyrup-ai/kodegen
# → Clones from GitHub to /tmp/kodegen-bundle-{uuid}
#
# ALL sources clone to tmp - NEVER builds in-place
--platform <PLATFORM> # Target platform: deb, rpm, appimage, dmg, nsis
--output-binary <PATH> # Full output path for final artifact
# Example: /tmp/artifacts/myapp_1.0.0_arm64.deb
# Bundler creates parent dirs automatically
# Exit code 0 guarantees file exists at this path
The bundler automatically:
/tmp/kodegen-bundle-{uuid})cargo build --release)--output-binary pathCaller responsibilities: Specify source, platform, output path Bundler responsibilities: Everything else
| Platform | Extension | Description |
|---|---|---|
deb |
.deb |
Debian/Ubuntu packages |
rpm |
.rpm |
RedHat/Fedora/CentOS packages |
appimage |
.AppImage |
Portable Linux executables |
dmg |
.dmg |
macOS disk image installers |
app |
.app |
macOS application bundles |
nsis |
.exe |
Windows NSIS installers |
# Reads repository URL from Cargo.toml, clones to tmp, builds, bundles
kodegen_bundler_bundle \
--source /path/to/project \
--platform deb \
--output-binary /tmp/artifacts/myapp_1.0.0_amd64.deb
# Exit code 0 = file guaranteed at /tmp/artifacts/myapp_1.0.0_amd64.deb
# Clones cyrup-ai/kodegen from GitHub to tmp, builds, bundles
kodegen_bundler_bundle \
--source cyrup-ai/kodegen \
--platform deb \
--output-binary /tmp/artifacts/kodegen_2.0.0_arm64.deb
# Exit code 0 = file guaranteed at /tmp/artifacts/kodegen_2.0.0_arm64.deb
# Clones from full GitHub URL to tmp, builds, bundles
kodegen_bundler_bundle \
--source https://github.com/cyrup-ai/kodegen \
--platform dmg \
--output-binary ./dist/kodegen-3.1.4-arm64.dmg
# Bundler automatically creates ./dist/ directory
# Build Linux package from macOS (uses Docker internally)
kodegen_bundler_bundle \
--source . \
--platform deb \
--output-binary /tmp/myapp.deb
# Build Windows installer from Linux (uses Docker with Wine)
kodegen_bundler_bundle \
--source cyrup-ai/myapp \
--platform nsis \
--output-binary C:\builds\myapp_setup.exe
The bundler is designed to integrate seamlessly with release automation tools like kodegen-bundler-release.
--output-binary flag// In kodegen-bundler-release/src/cli/commands/release/impl.rs
// Release workflow constructs output path with architecture
let arch = detect_target_architecture()?; // "arm64", "amd64", etc.
let version = "2.0.0"; // From Cargo.toml (bundler reads this internally too)
let filename = format!("kodegen_{}_{}.deb", version, arch);
let output_path = artifacts_dir.join(&filename);
// Call bundler with three arguments
let output = Command::new("kodegen_bundler_bundle")
.arg("--source").arg("cyrup-ai/kodegen") // ← GitHub org/repo
.arg("--platform").arg("deb")
.arg("--output-binary").arg(&output_path)
.output()?;
// Contract enforcement: exit 0 = file exists
if output.status.success() {
if !output_path.exists() {
return Err("Bundler contract violation: exit 0 but file missing");
}
// File guaranteed to exist at output_path
// Bundler handled: cloning, building, bundling, cleanup
}
The caller (e.g., release workflow) is responsible for:
myapp_1.0.0_arm64.deb)The bundler handles everything else:
/tmp/kodegen-bundle-{uuid} from GitHubcargo build --release)This separation ensures:
| Exit Code | Meaning |
|---|---|
0 |
Success - if --output-binary specified, file guaranteed to exist |
1 |
General error - check stderr |
| Non-zero | Specific error - check stderr for details |
Error: Failed to create output directory /path/to/output: Permission denied
Solution: Check write permissions on the parent directory.
Error: Failed to move artifact from /tmp/bundle.deb to /output/app.deb: No such file or directory
Solution: Verify source artifact was created successfully. Check bundler logs.
Error: Move reported success but file does not exist at /output/app.deb
Solution: This indicates a bundler bug. Report to maintainers.
For bundling to work, your project must have:
your-project/
├── Cargo.toml # [package.metadata.bundle] section
├── src/
│ └── main.rs
├── assets/
│ └── img/
│ ├── icon.icns # macOS
│ ├── icon.ico # Windows
│ └── icon_*x*.png # Linux (multiple sizes)
└── target/
└── release/
└── your-binary # Built binary
See kodegen-bundler-release README for detailed asset requirements.
Bundle settings are configured in your project's Cargo.toml under [package.metadata.bundle]. The configuration uses a flat structure where platform-specific settings are direct children of the bundle section.
Important: Platform settings like deb, rpm, appimage, macos, and windows are direct fields under [package.metadata.bundle], not nested under intermediate sections like .linux.
[package.metadata.bundle]
# Universal settings
identifier = "com.example.myapp"
publisher = "Example Inc."
icon = ["assets/img/icon_32x32.png", "assets/img/icon_128x128.png"]
resources = ["assets/data"]
copyright = "Copyright © 2025 Example Inc."
category = "Utility"
short_description = "My awesome application"
long_description = "A detailed description of my application"
# Linux: Debian/Ubuntu packages
[package.metadata.bundle.deb]
depends = ["libc6 (>= 2.31)", "libssl3"]
section = "utils"
priority = "optional"
# Linux: RedHat/Fedora/CentOS packages
[package.metadata.bundle.rpm]
depends = ["glibc >= 2.31", "openssl-libs"]
release = "1"
# Linux: AppImage portable executables
[package.metadata.bundle.appimage]
bins = ["myapp"]
# macOS: Application bundles and disk images
[package.metadata.bundle.macos]
frameworks = []
minimum_system_version = "10.13"
signing_identity = "Developer ID Application: Example Inc. (TEAM123)"
[package.metadata.bundle.macos.dmg]
background = "assets/dmg-background.png"
window_size = { width = 660, height = 400 }
# Windows: MSI and NSIS installers
[package.metadata.bundle.windows]
wix_language = "en-US"
[package.metadata.bundle.windows.nsis]
installer_mode = "perUser"
compression = "lzma"
[package.metadata.bundle.deb])[package.metadata.bundle.deb]
depends = ["libc6 (>= 2.31)"] # Runtime dependencies
section = "utils" # Package category
priority = "optional" # Installation priority
Note: The path is [package.metadata.bundle.deb], not [package.metadata.bundle.linux.deb].
[package.metadata.bundle.rpm])[package.metadata.bundle.rpm]
depends = ["glibc >= 2.31"] # Runtime dependencies
release = "1" # RPM release number
Note: The path is [package.metadata.bundle.rpm], not [package.metadata.bundle.linux.rpm].
[package.metadata.bundle.appimage])[package.metadata.bundle.appimage]
bins = ["myapp", "myapp-cli"] # Binaries to include
Note: The path is [package.metadata.bundle.appimage], not [package.metadata.bundle.linux.appimage].
[package.metadata.bundle.macos])[package.metadata.bundle.macos]
frameworks = [] # Additional frameworks
minimum_system_version = "10.13" # Minimum macOS version
signing_identity = "Developer ID Application: ..." # Code signing identity
[package.metadata.bundle.macos.dmg]
background = "assets/dmg-background.png" # DMG background image
window_size = { width = 660, height = 400 } # DMG window size
[package.metadata.bundle.windows])[package.metadata.bundle.windows]
wix_language = "en-US" # MSI installer language
[package.metadata.bundle.windows.nsis]
installer_mode = "perUser" # "perUser" or "perMachine"
compression = "lzma" # "none", "zlib", or "lzma"
The bundler works with minimal configuration, using sensible defaults:
[package.metadata.bundle]
identifier = "com.example.myapp"
publisher = "Example Inc."
icon = ["assets/img/icon.png"]
All platform-specific sections are optional and will use defaults if not specified.
Correct paths for platform-specific configuration:
[package.metadata.bundle.deb] - Debian settings[package.metadata.bundle.rpm] - RPM settings[package.metadata.bundle.appimage] - AppImage settings[package.metadata.bundle.macos] - macOS settings[package.metadata.bundle.macos.dmg] - DMG-specific settings[package.metadata.bundle.windows] - Windows settings[package.metadata.bundle.windows.nsis] - NSIS-specific settingsIncorrect paths (do not use):
[package.metadata.bundle.linux.deb] - Wrong, no .linux parent[package.metadata.bundle.linux.rpm] - Wrong, no .linux parent[package.metadata.bundle.linux.appimage] - Wrong, no .linux parentrustup install nightly && rustup default nightly# Build release binary
cargo build --release
# Run tests
cargo test
# Format and lint
cargo fmt
cargo clippy -- -D warnings
Dual-licensed under Apache-2.0 OR MIT.
See LICENSE.md for details.
Part of the KODEGEN.ᴀɪ project - blazing-fast MCP tools for AI-powered code generation.