@stardeck-customer-apps/compose 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md ADDED
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: compose
3
+ description: Regenerate a Stardeck app's Module-rail artifacts (the *.gen.ts registries and the route/endpoint stubs) from the installed Modules.
4
+ ---
5
+
6
+ # @stardeck-customer-apps/compose
7
+
8
+ Every Module in `apps/web/src/modules/*` declares its mounts, endpoints,
9
+ enhancements, contributions, i18n layers and data stores in `module.json`.
10
+ Compose turns that declaration into the code Next.js actually builds:
11
+
12
+ - `apps/web/src/modules.gen.ts` — the Module registry and `isModuleEnabled`
13
+ - `apps/web/src/module-contributions.gen.ts`
14
+ - `apps/web/src/module-i18n.gen.ts`
15
+ - `apps/web/src/module-init.server.gen.ts`
16
+ - `apps/web/src/module-datastores.gen.ts`
17
+ - one `page.tsx` / `route.ts` stub under `apps/web/src/app/**` per declared
18
+ mount and endpoint
19
+
20
+ ## Running it
21
+
22
+ ```bash
23
+ npx stardeck-compose [--enabled=a,b,c] [--prune] [--cwd=<repo root>]
24
+ ```
25
+
26
+ Run it from the repo root (the directory holding `apps/web`). Today you invoke
27
+ it manually — `npx stardeck-compose` before `next dev` / `next build` / your
28
+ typecheck — after changing any `module.json`. The `predev` / `prebuild` /
29
+ `pretypecheck` / `pretest` wiring that makes this automatic has not landed yet.
30
+
31
+ **Caveat: compose has no platform database.** It composes from `module.json`
32
+ alone, so Module data-store bindings resolve to none (`module-datastores.gen.ts`
33
+ comes out empty) and every Module's registry version reads `unreleased`. An app
34
+ whose platform-side rail resolved real data-store bindings must not run compose
35
+ until the consumer wiring supplies them — compose would otherwise overwrite the
36
+ bindings with nothing.
37
+
38
+ - `--enabled` — comma-separated **feature** Module names. Unset composes every
39
+ installed Module. Library and contract Modules are always composed. A name
40
+ that is not installed fails with exit 1. Falls back to
41
+ `NEXT_PUBLIC_STARDECK_ENABLED_MODULES` (how the platform passes the selection
42
+ at deploy time); the flag wins.
43
+ - `--prune` — after composing, delete the source of every excluded Module, plus
44
+ any enhancement slice an enabled Module keeps for an excluded peer (the slice
45
+ imports its peer, so leaving it breaks `next build`). Requires `--enabled`,
46
+ a git checkout, and a clean one: it refuses when `git status --ignored`
47
+ reports uncommitted or ignored files under `apps/web/src/modules`, and
48
+ refuses outside a checkout — it is for throwaway deploy checkouts, not yours.
49
+
50
+ ## Rules
51
+
52
+ - **Never hand-edit a generated file.** Every `*.gen.ts` and every stub carries
53
+ a rail marker; the next compose overwrites them, and a file whose marker is
54
+ missing or wrong makes compose refuse rather than clobber your edit.
55
+ - Change `module.json` (or the Module's own source under `routes/`,
56
+ `contributions.ts`, `i18n/`, …) and re-run compose.
57
+ - `@stardeck-customer-apps/compose/runtime` exports `isModuleEnabledByList`,
58
+ the single enablement rule, and imports nothing — it is safe in client
59
+ components.