mix crosswake.gen.bridge_hook (crosswake v0.2.4)

View Source

Teaches you how to wire the library-owned bridge hook — and, with --eject, writes a host-owned copy you then own forever.

Why this task refuses by default

Run with no flag, this task writes NOTHING and prints the three wiring fragments. The refusal IS the feature (D-33): the hook is the primary onboarding surface for the bridge, and a refusal you hit while reaching for a generator teaches more reliably than a guide nobody opens.

Crosswake's own package-design rule is: use generators when adopters need editable app code, and keep security- and protocol-sensitive behavior library-owned. The no-component-tier anti-feature governs PRESENTATION — things adopters restyle. priv/static/crosswake.esm.js is not presentation: it is the client half of a versioned wire protocol whose one job is deciding whether a denial gets synthesized when there is no shell (D-30, D-31). A host-owned copy of that file means silent protocol drift on the exact code that decides whether the fail-closed contract holds.

It also would not work here. The reference host has NO bundler at all — its endpoint serves dependency JavaScript through Plug.Static and its layout imports from a bare <script type="module"> — so a generator writing into assets/js/ would write into a directory nothing builds (D-32). That is why the eject target is the host's own priv/static/, not its assets tree.

Usage

mix crosswake.gen.bridge_hook            # refuses, prints the wiring
mix crosswake.gen.bridge_hook --eject    # writes a stamped host-owned copy

Options

  • --eject — write a host-owned copy carrying a protocol-version stamp
  • --dir — the target host directory (defaults to the current directory)
  • --path — the eject destination relative to --dir (defaults to priv/static/crosswake.esm.js)

The stamp

An ejected copy carries a protocol-version header. mix crosswake.doctor compares that stamp against Crosswake.Bridge.Contract.version/0 and warns when the copy has fallen behind the protocol it speaks (T-154-26). Re-running the eject never clobbers a host-owned copy and never duplicates the stamp.