8.0 KiB
8.0 KiB
@suaveplan/electrobun - Electrobun desktop-app generator + orchestrator: scaffolds projects, generates icons, drives dev/build/package/sign commands via an injectable runner. Typed ELECTROBUN_CODES, Zod-validated options, OTel self-telemetry.
Electrobun desktop-app generator and orchestrator for the SuavePlan
ecosystem. Scaffolds a fresh Electrobun project from a layered config +
prompt flow, drives the upstream electrobun binary for dev / build /
package / sign, and emits structured reports + OpenTelemetry metrics for
every operation.
Documentation tree
- bin — Single-file binary that wires
process.argvinto the purerunClidispatcher and translates the resolved exit code in…- suaveplan-electrobun — Single-file binary that wires
process.argvinto the purerunClidispatcher and translates the resolved exit code in…
- suaveplan-electrobun — Single-file binary that wires
- cli — Owns the five command surfaces —
createCommand,devCommand,buildCommand,packageCommand,signCommand— plus…- cli — Owns the five command surfaces —
createCommand,devCommand,buildCommand,packageCommand,signCommand— plus…
- cli — Owns the five command surfaces —
- config —
loadConfig(cliArgs, deps?)builds anElectrobunConfigby layering hard-coded defaults, an optional on-disk `.suavep…- config —
loadConfig(cliArgs, deps?)builds anElectrobunConfigby layering hard-coded defaults, an optional on-disk `.suavep…
- config —
- error-codes — Owns the stable
ELECTROBUN.*error-code namespace and theElectrobunErrorclass that every public entry point throw…- error-codes — Owns the stable
ELECTROBUN.*error-code namespace and theElectrobunErrorclass that every public entry point throw…
- error-codes — Owns the stable
- fs — Owns the
FsAdapterseam and the synchronousConfigDiscoveryAdapterused by the layered-config loader. Every IO-touc…- fs — Owns the
FsAdapterseam and the synchronousConfigDiscoveryAdapterused by the layered-config loader. Every IO-touc…
- fs — Owns the
- generator — Owns the two-call surface that scaffolds an Electrobun project on disk.
collectFiles(options, overrides?)is pure — i…- generator — Owns the two-call surface that scaffolds an Electrobun project on disk.
collectFiles(options, overrides?)is pure — i…
- generator — Owns the two-call surface that scaffolds an Electrobun project on disk.
- icons — Wraps the upstream
iconzlibrary behind anIconRendererAdapterseam so the generator can run the icon-generation pi…- icons — Wraps the upstream
iconzlibrary behind anIconRendererAdapterseam so the generator can run the icon-generation pi…
- icons — Wraps the upstream
- prompts — Owns the interactive scaffolder that backs the CLI's
createcommand.runPrompts(config, outputDir, prompter)walks…- prompts — Owns the interactive scaffolder that backs the CLI's
createcommand.runPrompts(config, outputDir, prompter)walks…
- prompts — Owns the interactive scaffolder that backs the CLI's
- runner — Owns the
CommandRunnerseam that every electrobun shell-out flows through, plus theprobeElectrobunand `invokeElec…- runner — Owns the
CommandRunnerseam that every electrobun shell-out flows through, plus theprobeElectrobunand `invokeElec…
- runner — Owns the
- schemas — Owns the Zod schemas that gate every public boundary of
@suaveplan/electrobun. Each interface in `src/types/electrobu…- schemas — Owns the Zod schemas that gate every public boundary of
@suaveplan/electrobun. Each interface in `src/types/electrobu…
- schemas — Owns the Zod schemas that gate every public boundary of
- telemetry — Owns the OpenTelemetry surface for
@suaveplan/electrobun. Every public entry point that does observable work (project…- telemetry — Owns the OpenTelemetry surface for
@suaveplan/electrobun. Every public entry point that does observable work (project…
- telemetry — Owns the OpenTelemetry surface for
- templates — Owns every renderer that produces a project-level file in the scaffolded output:
electrobun.config.ts,package.json…
Features
- Five-command CLI:
create,dev,build,package,sign. - Layered config: defaults +
.suaveplan-electrobun.json+ CLI args via@suaveplan/config. - Injectable seams:
FsAdapter,CommandRunner,IconRendererAdapter,Prompter— every IO path is testable withoutvi.mock. - Zod-validated options at every public boundary; bad input fails as
ELECTROBUN.INVALID_OPTIONS. - Eleven typed error codes under the
ELECTROBUN.*namespace. - OpenTelemetry: five counters + two histograms on the
@suaveplan/electrobunmeter. - iconz integration for
.icns/.ico/.pngicon generation. - Auto-update bundling via the
--updateflag onbuild. - Code-signing pipeline via
sign --identity --entitlements --notarize(the wrapper shapes argv; signing certificates remain in the user's keychain). - Eight feature renderers (
i18n,networking× basic/full,api,api-schemas,storage,auth,form-builder,r3fwith five modules).
Installation
bun add @suaveplan/electrobun
The package ships a suaveplan-electrobun binary:
suaveplan-electrobun --help
Usage
Scaffold a new project
suaveplan-electrobun create my-app --skip-prompts \
--name my-app --id com.example.my-app --icon ./assets/icon.png
Interactive scaffold
suaveplan-electrobun create ./my-app
Dev / build / package / sign
suaveplan-electrobun dev --cwd ./my-app
suaveplan-electrobun build --cwd ./my-app --target mac --update
suaveplan-electrobun package --cwd ./my-app --target mac
suaveplan-electrobun sign --cwd ./my-app \
--identity "Developer ID Application: ..." \
--entitlements ./entitlements.plist --notarize
Programmatic use
import {
buildCommand,
createCommand,
generate,
runCli,
} from "@suaveplan/electrobun";
const report = await generate({
name: "my-app",
identifier: "com.example.my-app",
description: "A demo",
version: "0.1.0",
outputDir: "./my-app",
features: ["i18n", "api"],
networkingComplexity: "basic",
r3fModules: [],
});
Subpath exports
| Subpath | Surface |
|---|---|
@suaveplan/electrobun |
Full barrel |
@suaveplan/electrobun/cli |
Five command functions + runCli |
@suaveplan/electrobun/config |
loadConfig, defaults |
@suaveplan/electrobun/error-codes |
ELECTROBUN_CODES, ElectrobunError |
@suaveplan/electrobun/fs |
FsAdapter, nodeFsAdapter, file helpers |
@suaveplan/electrobun/generator |
collectFiles, generate |
@suaveplan/electrobun/icons |
generateIcons, iconzRendererAdapter |
@suaveplan/electrobun/prompts |
runPrompts |
@suaveplan/electrobun/runner |
CommandRunner, probeElectrobun, invokeElectrobun |
@suaveplan/electrobun/schemas |
Zod schemas + parseOrThrow |
@suaveplan/electrobun/telemetry |
OTel counters + histograms |
@suaveplan/electrobun/templates |
Project + feature renderers |
@suaveplan/electrobun/types |
Shared types + FEATURE_ORDER |
Error codes
The full ELECTROBUN.* registry:
INVALID_OPTIONS, OUTPUT_NOT_EMPTY, CONFIG_PARSE_FAILED,
ICON_SOURCE_MISSING, ICON_RENDER_FAILED, TEMPLATE_RENDER_FAILED,
FS_WRITE_FAILED, BINARY_UNAVAILABLE, RUNNER_FAILED,
PROMPT_ABORTED, UNKNOWN_FLAG.
License
MIT — see the repository root.