Commit Graph

16 Commits

Author SHA1 Message Date
e7c3e1a247 feat(turbo-gen): templates for gen realtime handler 2026-05-08 22:56:44 +02:00
a39f372710 feat(turbo-gen): templates for gen realtime channel 2026-05-08 22:56:28 +02:00
71c1a6c216 chore(generators): add // <gen:realtime-*> anchors to feature template
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 22:07:43 +02:00
a98e41d080 chore: workspace green check (Task 56)
Three issues uncovered by the full pnpm typecheck/test/boundaries pass
and resolved here:

- core-testing was importing IEventBus / IJobQueue from core-events /
  core-shared, creating two boundary violations (tooling → core) and a
  build-graph cycle. Inlined the type aliases (mirroring how
  RecordingTracer / RecordingLogger handle ITracer / ILogger).
  recording-event-bus.test.ts replaces defineEvent() with an inline
  descriptor literal so no runtime import is needed either. core-events
  and core-shared are removed from core-testing dependencies.

- turbo.json: typecheck and test no longer dependsOn ^typecheck / ^build.
  Each package's tsc / vitest resolves cross-package types via
  node_modules independently, and dropping the topological dep avoids the
  spurious cycle warning that appeared once core-testing started
  importing core-events / core-shared.

- turbo.json: feature.dependencies.allow gains "feature". Cross-feature
  event flow (ADR-015) requires a consumer feature to import the
  publisher's event contract directly. The dangerous form (importing
  the publisher's handler/use-case/repo) is still blocked by E1's
  no-handler-reexport ESLint rule and the missing public exports.

- TaskConfig<"slug-string"> → TaskConfig<{ input; output }> in the gen
  job task template (and the shipped send-welcome-email.task.ts) since
  runtime-generated slugs aren't keys of TypedJobs['tasks'].
2026-05-08 17:21:47 +02:00
6b57a34c0c feat(marketing-pages): subscribe to auth.user.signed-up
Generated handler + Payload event-task via gen event consume,
threaded through symbols / both binders / cms re-export at the
configured anchors. bus.subscribe wires the in-memory delivery in
dev-seed; the __events.auth.user.signed-up.marketing-pages Payload
task closes the production-bus loop.

Also fixes two generator-level issues found during Phase 8:
- Drop publisher prompt's `when` clause so --args can supply the
  4th positional argument (Plop limitation: --args cannot bypass
  conditional prompts). Validate runs only in consume mode.
- Switch event-task.ts.hbs from TaskConfig<"slug-string"> to
  TaskConfig<{ input: ...; output: object }> since runtime-generated
  event slugs are not keys of TypedJobs['tasks'].
2026-05-08 16:33:14 +02:00
d5f230e07f feat(turbo-gen): job generator
Adds `pnpm turbo gen job <feature> <slug> <void|typed>` which scaffolds
the factory + test + Payload TaskConfig, then modifies the feature's
job-symbol, job-bind, and cms job-task anchors to wire the wrapped
job into the per-feature container. Also registers a custom Handlebars
`eq` helper used by the void/typed branch in the job templates.
2026-05-08 16:20:33 +02:00
8e081c2e97 feat(turbo-gen): templates for gen job 2026-05-08 16:18:50 +02:00
31f825a5d7 feat(turbo-gen): wire gen event consume actions
Adds consumeActions for the event generator: scaffolds the handler file
+ test, the Payload event-task that completes the production-bus loop,
modifies the consumer feature's symbols (// <gen:event-handler-symbols>),
both binders (// <gen:event-handlers>), and the cms re-export
(// <gen:job-tasks>). The bind block wraps the handler in span+capture,
binds it into the per-feature container, and subscribes it on the bus.
2026-05-08 16:18:12 +02:00
d53869f712 feat(turbo-gen): templates for gen event consume (handler + Payload task) 2026-05-08 16:16:35 +02:00
5cc6099015 feat(turbo-gen): event generator (publish mode)
Wires `pnpm turbo gen event` with publish/consume mode prompt; publish
branch generates the contract file + test and threads it through the
feature's // <gen:events> anchor. Consume branch is a stub that throws
until Task 40 lands the handler-side templates and modify-blocks.
2026-05-08 16:16:04 +02:00
0801469e89 feat(turbo-gen): templates for gen event publish 2026-05-08 16:13:07 +02:00
cf71547223 feat(turbo-gen): assertAnchors helper 2026-05-08 16:12:52 +02:00
721d373856 chore(generators): add // <gen:*> anchor comments for event/job generators 2026-05-08 14:09:05 +02:00
302b0b860c fix(turbo-gen): add local eslint config + package.json for generators dir
The IDE was reporting eslint errors on turbo/generators/config.ts and
on the generated package because there's no eslint config at the repo
root — when eslint walks up from turbo/generators/, it never finds
one. The CLI didn't surface this (eslint silently exited fine on
files it couldn't config), but the IDE eslint daemon did.

- turbo/generators/eslint.config.js extends @repo/core-eslint/base
  and ignores templates/** (the .hbs partials contain {{...}}
  placeholders that aren't valid TS — never lint them).
- turbo/generators/package.json declares "type": "module" so Node
  doesn't warn about CJS-vs-ESM ambiguity when loading the eslint
  config.

Verified end-to-end:
- `npx eslint . -p tsconfig.json` clean in turbo/generators/.
- `pnpm turbo gen feature --args widgets Widget widgets` →
  pnpm install → @repo/widgets passes lint, typecheck, and 25/25
  tests across 9 files.
- packages/widgets cleaned up before commit; not checked in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 09:39:54 +02:00
bec10fb171 fix(turbo-gen): annotate answers param + add tsconfig for generators dir
Two diagnostics from the IDE on turbo/generators/config.ts:

1. `Cannot find module '@turbo/gen'` — there was no tsconfig in
   turbo/generators/, so the IDE was opening config.ts in loose mode
   without proper module resolution context. Added a small
   tsconfig.json that extends tsconfig.base, sets NodeNext module
   resolution, and includes only ./**/*.ts (templates excluded).

2. `Parameter 'answers' implicitly has an 'any' type` — annotated
   the printNextSteps custom-action function param as
   `Record<string, unknown>` (Plop's runtime answers shape). The
   inner cast to the typed Answers shape was already in place.

`npx tsc --noEmit -p turbo/generators/tsconfig.json` is now clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 01:11:40 +02:00
019d4866a0 feat(turbo): turbo gen feature generator (Phase 1, single-entity)
Adds `pnpm turbo gen feature` to scaffold a Lazar-conformant feature
package matching the navigation reference shape: entity + Zod schema,
single use case (`get<Entity>`), controller, mock + Payload-stub real
repository (with span + capture), DI module/container/symbols, and tRPC
router with full BAD_REQUEST/NOT_FOUND error mapping. The generated
`bind-production.ts` and `bind-dev-seed.ts` compose the post-R44
`withSpan(tracer, opts, withCapture(logger, tags, factory(deps)))`
sandwich at bind time.

Verified by generating a sample `packages/example/` feature and running
`pnpm --filter @repo/example lint typecheck test` — all three pass
(9 test files, 25 tests). Cleaned up after verification so no example
package is committed.

Phase-1 limitations (documented in `docs/guides/scaffolding-a-feature.md`
and printed by the generator on success): no Payload CMS templates, no
React Query helpers, faker-driven factories left as stubs, single
entity / single use case, and aggregator wiring (core-api/root,
apps/web-next bindAll) is left as a manual checklist.

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