Files
agentic-dev/docs/scaffolding/core-package-generator.md
Danijel Martinek ee069574ba fix: address final-review polish (docs + comments + test coverage)
- AGENTS.md bind-production code block: shows the slim default state
  (no @repo/core-events / @repo/core-realtime imports, BindProductionContext
  with no generic args) with a comment pointing to the scaffold workflow.
  The previous block showed a fully-wired post-scaffold state without
  signaling that none of those packages exist in main.
- bind-protocols.test.ts: top-of-file comment clarifies what these tests
  actually verify (protocol shapes have required methods) vs what the
  spec text might suggest (full assignability of optional packages'
  interfaces — that's verified by the e2e reconstruction tests, not here).
- core-package-generator.md: drops two stale "Until Phases 3-6 land"
  parentheticals — the phases shipped.
- config.test.ts: extends the choices assertion to cover all 4 names
  (realtime, events, trpc, ui).
- marketing-pages bind-* comments: reverse the inverted optional/required
  language. queue (IJobQueue) is from core-shared and always present;
  bus is the optional one (from @repo/core-events when scaffolded).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 15:01:40 +02:00

39 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Core-package generator
`pnpm turbo gen core-package` scaffolds an optional core package back into a slimmed template. Each name maps to a verbatim copy of the package as it shipped at the time the generator was added.
## Usage
```bash
pnpm turbo gen core-package
# → Which optional core package? (use arrow keys)
# realtime
# events
# trpc
# ui
```
The generator emits the package files, updates consuming-app config (e.g. `apps/web-next/next.config.mjs` `transpilePackages`), patches `packages/core-eslint/base.js` to re-add any package-specific lint rules, then prints the manual app/server wiring needed to bring the package fully online.
## Available templates
| Name | Description | Phase added |
|---|---|---|
| `realtime` | Socket.IO realtime layer (ADR-016) | Phase 3 |
| `events` | Cross-feature event bus + Payload jobs adapter (ADR-015) | Phase 4 |
| `trpc` | tRPC server setup | Phase 5 |
| `ui` | Design-system package | Phase 6 |
## Verifying an existing project
If your project already has a core-* package and you want to verify the generator's template hasn't drifted from the shipped source, use the byte-identical reconstruction snapshot:
```bash
git stash -u
pnpm turbo gen core-package <name>
git diff packages/core-<name>/
# Expect: zero diff (modulo .hbs strip + trailing-newline normalization)
```
Snapshots live at `turbo/generators/__snapshots__/core-package/<name>.snapshot.json` (added in Phases 3-6).