Wu Microfrontends
Produce a working Wu project, not isolated snippets. Operate the Wu CLI and Wu
Framework directly. Preserve the user's frameworks, package manager, repository
layout, and release channel unless they explicitly request a migration.
Establish the project contract
Before changing files:
- Locate the project root using
wu.config.json, the workspace
package.json, or the shell/ plus mf-*/ layout.
- Inspect installed and locked versions. Wu V3 and CLI 0.5 require Node 20+.
- Prefer the project-local CLI or an explicitly pinned
npx invocation. Do
not silently replace latest with beta, or beta with latest; verify
registry tags when the user asks for the newest release.
- Read references/framework-selection.md
when choosing frameworks, splitting features, designing shared components,
or connecting unlike runtimes.
- Read references/wu-v3-contract.md when the
task touches configuration, manifests, permissions, migration, plugins, AI,
WebSocket sync, builds, or deployment.
Honor or choose the framework deliberately
- If the user names a supported framework, use it unless the repository proves
it incompatible. Explain any real incompatibility before substituting it.
- In an existing project, preserve each app's framework. Do not rewrite apps
merely to make the stack uniform.
- If no choice was made, derive it from the existing stack, team constraints,
feature boundary, bundle budget, rendering model, and component-sharing
needs. Ask only when the choice materially changes the product contract.
- Use React, Angular, Vue, Svelte, Solid, Preact, Qwik, or another supported
adapter for an independently owned feature when that runtime fits its team.
- Consider Lit or Stencil Web Components for framework-neutral visual
primitives and design systems. Do not turn an entire bounded feature into a
component library.
- Consider Vanilla, Alpine, HTMX, or Stimulus for small or HTML-first features.
Astro and Next.js are shell choices, not Wu micro-app adapters.
- Do not use Lit as a substitute for Wu's app-to-app contracts. Share visual
elements through Web Components; share state, events, and operations through
the app-scoped Wu facade.
Drive the project through Wu
- Select and preserve an explicit CLI version or dist-tag before scaffolding.
- New project: use
wu create. For reproducible automation, prefer
npx @wu-framework/cli@<version> create <name> --template <app-framework> --shell <shell-framework>.
- Existing project: edit its current structure instead of regenerating it.
- Add an app: use
wu add <framework> <name>. For a batch, run each add with
--no-install, then run one wu install to consolidate dependency graphs.
- Inspect the generated adapter, lifecycle,
wu.json, and wu.config.json
entry before adding business logic. Do not hand-roll CLI output when the
installed CLI already supports the requested topology.
- Use Wu Framework APIs for lifecycle, events, RPC, stores, plugins, AI, and
sync. Keep framework code behind its generated adapter boundary.
- Migration: keep legacy apps on the explicit V2 compatibility bridge only
while removing each reported use; new apps stay strict.
- Diagnosis: reproduce first, then use
wu info, wu doctor, relevant tests,
and the browser only when runtime behavior must be observed.
- Release or deployment: prepare and validate artifacts, but publish, deploy,
change npm dist-tags, or mutate cloud state only with explicit authorization.
Keep cross-framework boundaries explicit
- A bounded product feature is a micro-app; a reusable visual primitive may be
a Lit or Stencil Web Component; same-framework internals belong in a normal
package; nonvisual collaboration belongs in Wu events, RPC, or stores.
- Never import another micro-app's private framework modules. Define versioned,
serializable payloads and stable event/RPC names at the boundary.
- For Web Components, use DOM properties for rich input and intentional custom
events for DOM output. Bridge cross-app behavior through Wu instead of making
unrelated apps query or mutate each other's DOM.
- Use
domOwnership: "app" when Lit or another component runtime owns its
ShadowRoot. Avoid nested isolation boundaries unless tested and intentional.
- Mount, unmount, and remount cleanly. Dispose framework roots, subscriptions,
observers, timers, DOM listeners, RPC providers, and shared-store watchers.
Preserve V3 authority boundaries
Treat app requests and host authority as separate inputs:
- The app requests capabilities in its
wu.json.
- The shell grants the maximum allowed authority through
apps[].grants.
- Effective authority is their intersection. Never fix a denial by granting a
wildcard unless the user explicitly accepts that scope.
- A required denied request must remain a mount error; optional denied requests
should remain observable in diagnostics.
Use the app-scoped Wu facade supplied by the lifecycle. Do not reintroduce
EventBus identity administration through the public bus. Await plugin
installation and pass explicit plugin grants. Keep AI actions and network
access deny-by-default, and require authenticated WebSocket peers or an
explicitly trusted transport.
Validate observable outcomes
Run checks proportional to the change. For a typical implementation,
polyglot addition, or migration, require:
- unit and framework-specific tests for every touched app, shared component,
and shell;
- contract tests for cross-app event, RPC, store, and Web Component payloads;
- mount/unmount/remount integration tests for every touched adapter;
wu doctor with no unexplained V2 or publication findings;
wu build from the project root;
- inspection of
dist/apps.json, dist/wu-manifest.json, and each built
app's wu.json, especially hashed entries and preserved permissions;
wu serve or the target host's preview, including at least one real
cross-framework flow when the project is polyglot.
Do not describe wu serve as a production server. For production, hand the
static build to the user's real host and validate its generated security
headers, app origins, connect origins, caching, and fallback behavior.
Report exactly what was validated, what remains environment-dependent, and any
compatibility bridge or broad grant still present.
1---2name: wu-microfrontends3description: Design, scaffold, extend, migrate, diagnose, and validate polyglot microfrontends with Wu Framework V3 and @wu-framework/cli. Use for Wu projects that need wu create, wu add, framework selection or preservation, Lit or Web Components, cross-framework contracts, manifests, grants, lifecycle integration, builds, or deployment handoff; do not activate for generic frontend composition that has not chosen Wu.4---56# Wu Microfrontends78Produce a working Wu project, not isolated snippets. Operate the Wu CLI and Wu9Framework directly. Preserve the user's frameworks, package manager, repository10layout, and release channel unless they explicitly request a migration.1112## Establish the project contract1314Before changing files:15161. Locate the project root using `wu.config.json`, the workspace17 `package.json`, or the `shell/` plus `mf-*/` layout.182. Inspect installed and locked versions. Wu V3 and CLI 0.5 require Node 20+.193. Prefer the project-local CLI or an explicitly pinned `npx` invocation. Do20 not silently replace `latest` with `beta`, or `beta` with `latest`; verify21 registry tags when the user asks for the newest release.224. Read [references/framework-selection.md](references/framework-selection.md)23 when choosing frameworks, splitting features, designing shared components,24 or connecting unlike runtimes.255. Read [references/wu-v3-contract.md](references/wu-v3-contract.md) when the26 task touches configuration, manifests, permissions, migration, plugins, AI,27 WebSocket sync, builds, or deployment.2829## Honor or choose the framework deliberately3031- If the user names a supported framework, use it unless the repository proves32 it incompatible. Explain any real incompatibility before substituting it.33- In an existing project, preserve each app's framework. Do not rewrite apps34 merely to make the stack uniform.35- If no choice was made, derive it from the existing stack, team constraints,36 feature boundary, bundle budget, rendering model, and component-sharing37 needs. Ask only when the choice materially changes the product contract.38- Use React, Angular, Vue, Svelte, Solid, Preact, Qwik, or another supported39 adapter for an independently owned feature when that runtime fits its team.40- Consider Lit or Stencil Web Components for framework-neutral visual41 primitives and design systems. Do not turn an entire bounded feature into a42 component library.43- Consider Vanilla, Alpine, HTMX, or Stimulus for small or HTML-first features.44 Astro and Next.js are shell choices, not Wu micro-app adapters.45- Do not use Lit as a substitute for Wu's app-to-app contracts. Share visual46 elements through Web Components; share state, events, and operations through47 the app-scoped Wu facade.4849## Drive the project through Wu5051- Select and preserve an explicit CLI version or dist-tag before scaffolding.52- New project: use `wu create`. For reproducible automation, prefer53 `npx @wu-framework/cli@<version> create <name> --template <app-framework>54 --shell <shell-framework>`.55- Existing project: edit its current structure instead of regenerating it.56- Add an app: use `wu add <framework> <name>`. For a batch, run each add with57 `--no-install`, then run one `wu install` to consolidate dependency graphs.58- Inspect the generated adapter, lifecycle, `wu.json`, and `wu.config.json`59 entry before adding business logic. Do not hand-roll CLI output when the60 installed CLI already supports the requested topology.61- Use Wu Framework APIs for lifecycle, events, RPC, stores, plugins, AI, and62 sync. Keep framework code behind its generated adapter boundary.63- Migration: keep legacy apps on the explicit V2 compatibility bridge only64 while removing each reported use; new apps stay strict.65- Diagnosis: reproduce first, then use `wu info`, `wu doctor`, relevant tests,66 and the browser only when runtime behavior must be observed.67- Release or deployment: prepare and validate artifacts, but publish, deploy,68 change npm dist-tags, or mutate cloud state only with explicit authorization.6970## Keep cross-framework boundaries explicit7172- A bounded product feature is a micro-app; a reusable visual primitive may be73 a Lit or Stencil Web Component; same-framework internals belong in a normal74 package; nonvisual collaboration belongs in Wu events, RPC, or stores.75- Never import another micro-app's private framework modules. Define versioned,76 serializable payloads and stable event/RPC names at the boundary.77- For Web Components, use DOM properties for rich input and intentional custom78 events for DOM output. Bridge cross-app behavior through Wu instead of making79 unrelated apps query or mutate each other's DOM.80- Use `domOwnership: "app"` when Lit or another component runtime owns its81 ShadowRoot. Avoid nested isolation boundaries unless tested and intentional.82- Mount, unmount, and remount cleanly. Dispose framework roots, subscriptions,83 observers, timers, DOM listeners, RPC providers, and shared-store watchers.8485## Preserve V3 authority boundaries8687Treat app requests and host authority as separate inputs:8889- The app requests capabilities in its `wu.json`.90- The shell grants the maximum allowed authority through `apps[].grants`.91- Effective authority is their intersection. Never fix a denial by granting a92 wildcard unless the user explicitly accepts that scope.93- A required denied request must remain a mount error; optional denied requests94 should remain observable in diagnostics.9596Use the app-scoped Wu facade supplied by the lifecycle. Do not reintroduce97EventBus identity administration through the public bus. Await plugin98installation and pass explicit plugin grants. Keep AI actions and network99access deny-by-default, and require authenticated WebSocket peers or an100explicitly trusted transport.101102## Validate observable outcomes103104Run checks proportional to the change. For a typical implementation,105polyglot addition, or migration, require:1061071. unit and framework-specific tests for every touched app, shared component,108 and shell;1092. contract tests for cross-app event, RPC, store, and Web Component payloads;1103. mount/unmount/remount integration tests for every touched adapter;1114. `wu doctor` with no unexplained V2 or publication findings;1125. `wu build` from the project root;1136. inspection of `dist/apps.json`, `dist/wu-manifest.json`, and each built114 app's `wu.json`, especially hashed entries and preserved permissions;1157. `wu serve` or the target host's preview, including at least one real116 cross-framework flow when the project is polyglot.117118Do not describe `wu serve` as a production server. For production, hand the119static build to the user's real host and validate its generated security120headers, app origins, connect origins, caching, and fallback behavior.121122Report exactly what was validated, what remains environment-dependent, and any123compatibility bridge or broad grant still present.