Skip to content

Support unbundled helper scripts in extension packages #707

@bixu

Description

@bixu

Problem

Extension models that shell out to helper scripts (via Deno.Command) can't be published to the registry if the helper script imports npm packages with native/unbundleable dependencies.

The bundler tries to bundle every .ts file in extensions/models/ and in the additionalFiles extraction path. If a helper script imports a package like hap-controller (which has native deps for Bluetooth that are never used at runtime), the bundle fails and the extension can't be pushed.

Context

The @bixu/homekit extension discovers HomeKit accessories via mDNS using hap-controller. The main model (homekit.ts) bundles fine — it only imports zod and shells out to a helper script. The helper script (homekit_discover.ts) imports hap-controller and runs as a standalone deno run subprocess. This works locally in extensions/scripts/ but can't be published because:

  1. additionalFiles are extracted to extensions/models/, where swamp tries to bundle them as models
  2. There's no way to include a file that skips bundling

Proposed Solution

Support an extensions/scripts/ directory (or similar) that:

  • Is included in the extension archive during push
  • Is extracted to a known, predictable path on pull
  • Is not bundled or loaded as a model by swamp
  • Can be referenced by models at runtime via context.repoDir

Alternatively, a scripts key in the manifest (alongside models and workflows) that marks files as "include but don't bundle":

manifestVersion: 1
name: "@bixu/homekit"
version: "2026.03.14.1"
models:
  - homekit.ts
scripts:
  - homekit_discover.ts

Current workaround

Keep the helper script in extensions/scripts/ as a local-only file. The extension works in the repo but can't be published.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestexternalAn issue raised by an external contributor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions