Commit Graph

468 Commits

Author SHA1 Message Date
eee87d4ec8 docs: template-tiers reference (must-have + optional + generator commands) 2026-05-09 14:27:57 +02:00
ae456a5436 docs: ui now optional — prerequisite notes + conditional HTML
- AGENTS.md (root): marks core-ui as optional in the package table and
  boundary rules; points per-package docs to the .hbs template
- apps/storybook/AGENTS.md: rewrites around no-core-ui-by-default;
  stories glob and globals.css import described as post-scaffold steps
- apps/web-next/AGENTS.md: cross-reference updated to template file
- apps/web-tanstack/AGENTS.md: cross-reference updated to template file
- docs/architecture/data-flow-explainer.html: core-ui bullet notes
  optional status + generator command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:23:24 +02:00
a4c8f710a6 refactor: remove core-ui from main (scaffoldable via gen core-package ui)
Removal across all three consumers:
- apps/storybook: strips @repo/core-ui dep, clears stories glob (now []),
  removes globals.css import from preview.ts
- apps/web-next: strips @repo/core-ui dep + transpilePackages entry
- apps/web-tanstack: strips @repo/core-ui dep
- packages/core-ui: deleted entirely (28 files)

No app pages needed surgery — neither web-next nor web-tanstack source
files imported @repo/core-ui directly. The storybook app referenced it
only via the stories glob and the globals.css preview import.

Gates: 40/40 tasks successful, all 4 e2e byte-identical reconstructions
pass (realtime, events, trpc, ui).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:21:04 +02:00
d42d0e5c5c feat(generators): ui byte-identical snapshot + dispatch entry + e2e test
- Adds ui.snapshot.json (28 entries) computed from packages/core-ui
- Wires CORE_PACKAGE_GENERATORS["ui"]: guard + emitTemplateTree +
  addToTranspilePackages + printUiNextSteps (web-tanstack/storybook
  wiring is printed, not generated — resists templating)
- Adds "ui" to the core-package generator choices list
- Adds core-package-ui.e2e.test.ts (byte-identical reconstruction)
  — passes in 14.6 s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:19:22 +02:00
d974bb6267 feat(generators): capture core-ui as verbatim template files
28 .hbs files mirror packages/core-ui verbatim:
atoms (Button, Input, Label + stories + tests), molecules (FormField),
organisms/templates (empty barrels), lib/utils, styles/globals.css,
plus all root config files (package.json, tsconfig.json, vitest.config.ts,
eslint.config.js, turbo.json, AGENTS.md).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:17:47 +02:00
1967cb36ec docs: trpc now optional — prerequisite notes + conditional HTML
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:13:12 +02:00
c8116ac3f4 refactor: remove core-trpc from main (scaffoldable via gen core-package trpc)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:10:48 +02:00
d216250ccd feat(generators): wire trpc entry + e2e test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:08:26 +02:00
36bae3513d feat(generators): trpc byte-identical snapshot
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:06:45 +02:00
0a3a2c3845 feat(generators): capture core-trpc as verbatim template files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:06:14 +02:00
3d653666c2 docs: events now optional — Status headers + conditional HTML rendering
- ADR-015: Status → Optional with scaffold command + behavior note (bus absent
  means no-op, IJobQueue unaffected)
- events-and-jobs.md: prerequisite callout block explaining core-events is
  optional, how to scaffold, and which features require it
- data-flow-explainer.html: note bus is optional in BindProductionContext blurb;
  add inline comment in code snippet that bus is scaffoldable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:01:38 +02:00
a9f27f0d7e refactor: remove core-events from main (scaffoldable via gen core-package events)
- Delete packages/core-events/ (15 files)
- Strip @repo/core-events from all 5 feature package.json + apps/web-next/package.json
- Strip @repo/core-events from apps/web-next/next.config.mjs transpilePackages
- Strip E1 + J no-restricted-syntax blocks from core-eslint/base.js (anchor remains)
- Update bind-production.ts: drop bus construction + IEventBus import; rename
  resolveEventsAndJobsProduction → resolveJobsProduction (queue only),
  resolveEventsAndJobsDevSeed → resolveJobsDevSeed (queue only);
  ctx no longer has bus field; BindProductionContext generic arg narrowed
- Update bind-production.test.ts: assert ctx.bus is undefined, drop
  PayloadJobsEventBus/InMemoryEventBus instanceof checks
- Update sign-up-welcome-email.test.ts: assert mailer stays empty without bus
- Inline userSignedUpEvent in auth (drop defineEvent import from core-events)
- Drop InMemoryEventBus fallback from auth/di/module.ts

Feature binders' bus?.subscribe/publish calls remain as no-ops. Scaffold
@repo/core-events back via: pnpm turbo gen core-package events

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:00:35 +02:00
681fe6ada1 feat(generators): wire events entry + e2e test
Add EVENTS_RULE_BLOCK constant, events entry in CORE_PACKAGE_GENERATORS
dispatch table, events choice in prompts, and printEventsNextSteps helper.
Events entry emits 15 template files + transpilePackages splice + ESLint
no-restricted-syntax splice (E1 + J blocks). Add byte-identical e2e test
that strips @repo/core-events deps before pnpm install, scaffolds via
gen core-package events, and diffs against the snapshot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:55:49 +02:00
60961f73d0 feat(generators): events byte-identical snapshot
Compute SHA-256 snapshot of packages/core-events (15 files) using the
shared computeSnapshot helper. The e2e test will diff a fresh scaffold
against this snapshot to guarantee byte-identical reconstruction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:53:07 +02:00
a342d064ad feat(generators): capture core-events as verbatim template files
Mirror packages/core-events/** into turbo/generators/templates/core-package/events/**/*.hbs.
15 files total (6 top-level + 9 src). No Handlebars interpolation needed
since none of the source files contain {{ }} patterns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:52:38 +02:00
2266429efd feat(core-eslint): anchor for events rules splice
Add // <gen:events-rules> anchor to base.js near the E1 + J
no-restricted-syntax blocks, and assert it in anchors.test.js.
After core-events removal the anchor remains as the splice point
for pnpm turbo gen core-package events.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:52:23 +02:00
39fd2a9f80 docs: realtime now optional — Status headers + conditional HTML rendering 2026-05-09 13:46:41 +02:00
57b2ff5191 refactor: remove core-realtime from main (scaffoldable via gen core-package realtime) 2026-05-09 13:45:52 +02:00
e28fe847fd test(generators): e2e byte-identical reconstruction of core-realtime 2026-05-09 13:33:53 +02:00
4308762caa feat(generators): wire realtime entry into core-package dispatch table 2026-05-09 13:32:46 +02:00
421d765b80 feat(generators): splicePluginRulesAt + splicePluginImportsAt + addBoundariesEntry + emitTemplateTree helpers 2026-05-09 13:31:28 +02:00
af062480b5 feat(generators): byte-identical snapshot machinery + realtime snapshot 2026-05-09 13:30:08 +02:00
a7f0a13d34 feat(generators): capture realtime ESLint rules as template files 2026-05-09 13:28:54 +02:00
2dcfecc826 feat(generators): capture core-realtime as verbatim template files 2026-05-09 13:28:46 +02:00
c4035e912e feat(core-eslint): anchors for realtime rules splice 2026-05-09 13:28:35 +02:00
a04c5eda1d fix(generators): declare @turbo/gen + @repo/core-eslint as dependencies
Adds turbo/generators to pnpm-workspace.yaml and declares its actual
dependencies so pnpm turbo boundaries reports zero issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:24:52 +02:00
4c7ccf9d1c docs: core-package generator reference + Quick Start entry
Adds docs/scaffolding/core-package-generator.md with usage, template
table, and drift-verification instructions. Updates CLAUDE.md Quick
Start and AGENTS.md Key Commands with the new pnpm turbo gen core-package
entry. Creates templates/core-package/.gitkeep placeholder for Phase 3+.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:23:37 +02:00
d5313f95ea feat(generators): core-package-utils (assertNotPresent + addToTranspilePackages)
Two helpers for use by per-package generator actions:
- assertOptionalPackageNotPresent — guards against double-scaffolding
- addToTranspilePackages — idempotent alphabetical splice into next.config.mjs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:22:52 +02:00
c59f5552af feat(generators): add core-package entry + dispatch table (empty)
Registers pnpm turbo gen core-package with an empty choices list and a
dispatch table that throws for unknown names. Adds vitest config + test
script to turbo/generators and adds it to the pnpm workspace so tests
run via pnpm --filter @repo/turbo-generators test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:22:20 +02:00
723729dd9e fix: address Phase 1 code-quality review findings
- Generator feature templates emit ctx-arg signatures + updated checklist
- signUpUseCase test for bus=undefined path
- di-explainer.html: bind-dev-seed no-arg → ctx
- data-flow-explainer.html: tradeoff card → ctx
- BindContextBase no longer exported
- CLAUDE.md binder bullet: drop vestigial cast guidance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:17:04 +02:00
ca2e7d8c10 fix: address Phase 1 spec review findings
- di-explainer.html: update stale JS data strings from positional-arg
  form (bindAllProduction(config), bindProductionBlog(config,tracer,...))
  to ctx-arg form (bindAllProduction(deps), bindProductionBlog(ctx)) with
  a note on ctx shape.
- auth/sign-up.use-case: change bus param from IEventBus to
  EventBusProtocol|undefined; guard bus.publish with if(bus) so the use
  case is safe when core-events is absent (Phase 3+).
- auth/bind-production + bind-dev-seed: drop as IEventBus cast and unused
  IEventBus import; ctx.bus is now passed directly (typed as
  EventBusProtocol|undefined).
- marketing-pages/bind-production + bind-dev-seed: drop as IJobQueue cast
  and unused IJobQueue import; wrap event-handler DI block in if(queue)
  guard so the handler is only bound when core-jobs is wired.
- core-shared/src/index.ts: add `export * from "./di"` as the plan
  specified (subpath export alone is no longer the only access path).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:02:36 +02:00
990f641425 docs(html): di + data-flow explainers reflect BindContext 2026-05-09 12:51:15 +02:00
1e8b3f2364 docs: BindContext binder shape across architecture + per-feature AGENTS 2026-05-09 12:49:55 +02:00
d5c965078c test(web-next): bind-production tests assert ctx-shape arg 2026-05-09 12:46:29 +02:00
2854023d13 refactor(web-next): aggregator builds BindContext once 2026-05-09 12:46:27 +02:00
3911405102 refactor(media): binders take BindContext arg 2026-05-09 12:44:30 +02:00
a439038748 refactor(navigation): binders take BindContext arg 2026-05-09 12:43:22 +02:00
fe6c41b69d refactor(marketing-pages): binders take BindContext arg 2026-05-09 12:42:29 +02:00
fe85976440 refactor(blog): binders take BindContext arg 2026-05-09 12:40:58 +02:00
ab8ca08307 refactor(auth): binders take BindContext arg 2026-05-09 12:39:50 +02:00
f4942098f1 feat(core-realtime): IRealtimeHandlerRegistry extends RealtimeRegistryProtocol 2026-05-09 12:37:38 +02:00
ebcce46681 feat(core-realtime): IRealtimeBroadcaster extends RealtimeBroadcasterProtocol 2026-05-09 12:37:26 +02:00
07fa35cd0b feat(core-events): IEventBus extends EventBusProtocol 2026-05-09 12:36:38 +02:00
5ba11e3405 feat(core-shared): expose ./di subpath export 2026-05-09 12:36:20 +02:00
1d160e7e22 feat(core-shared): BindContext + BindProductionContext types 2026-05-09 12:36:06 +02:00
b5a9d1fe9d feat(core-shared): bind-protocols (event bus / realtime / realtime registry) 2026-05-09 12:35:48 +02:00
54958170ab docs(plan): core-package generator + template slimming (8 phases, ~50 tasks)
Implementation plan for the design at docs/superpowers/specs/2026-05-09-core-
package-generator-design.md. Eight phases (numbered Phase 0..7 in the plan; Phase
0 is the read-first orientation, Phases 1-7 implement spec phases 0-5 plus a
final cross-doc sweep).

Phase 1 ships BindContext with bounded generics over protocol types in core-
shared. Phase 2 ships the generator framework (entry, prompt, dispatch table —
empty). Phases 3-6 each capture one optional package as a verbatim template,
ship the generator action, and remove the package from main with byte-identical
reconstruction verified via a snapshot. Phase 7 is the final cross-doc sweep
(template-tiers.md, README updates, HTML explainer pass).

Companion ADR will be assigned at implementation time (expected ADR-017).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 12:15:23 +02:00
26374253de docs(spec): core-package generator + template slimming design
6-phase design for slimming the default template to a minimal kernel
and providing turbo generators that scaffold optional core packages
(realtime, events, trpc, ui) back when needed.

Phase 0 introduces a BindContext object in core-shared with bounded
generics over minimal protocol types; optional packages keep their full
interfaces but extends-link to the protocols. This lets feature binders
take a single ctx arg and lets optional packages disappear without
breaking typechecks. Phases 1-5 ship the generator framework + per-
package templates + per-package removal from main.

Companion ADR will be assigned at implementation time (expected ADR-017).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 11:57:46 +02:00
623c1af8d1 Merge branch 'feat/realtime-layer': realtime layer (Socket.IO, ADR-016) 2026-05-09 10:17:43 +02:00
f8013451de fix(realtime): post-review polish from final branch review
Five fixes surfaced by the branch-wide code review on the realtime layer:

- server.ts: replace dynamic `import("@repo/auth/di/container")` with a
  static top-of-file import. The dynamic-import workaround from 6a0ac63 is
  no longer needed once the root tsconfig + TSX_TSCONFIG_PATH expose
  decorator metadata to tsx; verified by booting `pnpm dev` clean.
- server.ts: correct the inline structural type for `validateSession` to
  match the real `IAuthenticationService` contract (non-nullable, throws
  on invalid session) and wrap the call in try/catch so unauthenticated
  bubbles to a `null` return instead of dead-code `result ? ... : null`.
- bind-production.ts: extract `maybeRegisterRealtimePing()` that wraps the
  built-in ping inbound handler in the same `withSpan(withCapture(...))`
  sandwich the realtime-handler generator emits (R41–R44), so the
  proof-of-life channel models the convention rather than registering raw.
- bind-production.test.ts: add 4 tests for the `REALTIME_PING_DISABLED`
  env-gate (registered when unset in both binders, not registered when
  "true", treated as enabled when "1").
- docs/guides/realtime.md: correct the integration-test reference at
  line 285 — the test does not call `bindAllDevSeed()`; it builds the
  Socket.IO server inline and exercises gates 1+2 only (gates 3+4 live in
  socket-io-realtime-server.test.ts).
- adr-016: add a "Known follow-ups" section recording 6 lower-priority
  refinements deferred from this branch (bridge stub test scaffolding,
  registry register/registerChannel precedence, channel-template dot
  constraint, server bare catch{}, BindAllDeps Partial widening, AGENTS.md
  anchor count phrasing).

CI gates: lint 0 errors / 4 warnings (pre-existing turbo.json warnings),
typecheck clean, 24 web-next tests pass (was 20; 4 new env-gate tests),
boundaries 0 issues across 504 files.

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