implement file association support#342
implement file association support#342tsconfigdotjson wants to merge 1 commit intoblackboardsh:mainfrom
Conversation
|
@YoavCodes pretty big one to be able to support file assocations, have your agents PR |
e497e40 to
5a6c6b0
Compare
5a6c6b0 to
fcce111
Compare
Clean Room ValidationTested end-to-end by creating a standalone project in fileAssociations: [
{ ext: ["ebtest"], name: "Electrobun Test Document", role: "Viewer" },
{ ext: ["ebtest2", "ebtest3"], name: "Electrobun Multi-Ext Document", role: "Editor" },
{ ext: [".ebdot"], name: "Dot-Prefix Test", role: "Viewer" },
]What was validated
|
527ac15 to
926d314
Compare
Adds app.fileAssociations config for declaring document types. The CLI generates CFBundleDocumentTypes in Info.plist and copies document type icon files to the app bundle's Resources folder. Build-time validation strips leading dots from extensions, skips entries with missing ext/name, and verifies icon files exist before writing plist references. On macOS, files opened via associations arrive as file:// URLs through the existing application:openURLs: handler and open-url event — no new event type or native code needed. Also fixes a pre-existing cold-launch race in URL handling: URLs that arrived before the Bun Worker registered its handler were dropped. They are now buffered with a mutex and flushed on registration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
926d314 to
00a5766
Compare
Summary
Fixes #304 — double-clicking a file associated with an Electrobun app now delivers it as a
file://URL through the existingopen-urlevent.app.fileAssociationstoelectrobun.config.tsfor declaring document types.CFBundleDocumentTypeswithLSItemContentTypesandUTExportedTypeDeclarationsin Info.plist for proper Launch Services integration on modern macOS. UTI identifiers are derived from the app identifier (e.g.,com.example.app.myext). Icon files are copied to the bundle with build-time existence checks. Validation strips leading dots from extensions and skips entries with missing ext/name.file://URLs through the existingapplication:openURLs:handler — no new native code needed.Usage
Files changed (3)
ElectrobunConfig.ts— fileAssociations type + docscli/index.ts— generateDocumentTypes (CFBundleDocumentTypes + UTExportedTypeDeclarations), icon copy + validationnativeWrapper.mm— URL cold-launch buffering with mutex🤖 Generated with Claude Code