Commit Graph

201 Commits

Author SHA1 Message Date
53c2fbb9e1 feat(features): add test factories to all 5 features
Adds src/__factories__/<entity>.factory.ts to auth, blog, marketing-pages,
navigation, media. Each factory uses defineFactory from @repo/core-testing
with stable date defaults (2026-01-01) so snapshot diffs reflect SUT
behavior only. Refactors mechanical inline-fixture tests to use factories.

Also adds vitest.config.ts and tsconfig path alias to @repo/media (lacked
both), and adds @repo/core-testing devDependency to @repo/media.

Spec: §5.1, §6.3
2026-05-05 14:56:50 +02:00
52ac978027 fix(core-typescript): tighten jsdom config tests + document cycle avoidance
- Replace arrayContaining with toEqual on setupFiles + include — captures
  actual mergeConfig array-concatenation behavior so future changes to
  setup/node.ts surface in this test.
- Document in core-typescript/AGENTS.md why @repo/core-testing is not a
  devDep here (would create a circular dependency with core-testing).

Reviewer: superpowers:code-reviewer (Task 2 of Plan 7).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 14:48:20 +02:00
bf6affd404 feat(core-typescript): split vitest base into node + jsdom flavors
Adds vitest.base.node and vitest.base.jsdom with safety defaults
(clearMocks, restoreMocks, mockReset, unstubGlobals, sequence.shuffle)
and coverage thresholds (80/75/80/80). Migrates all feature configs
to the new base. Existing baseVitestConfig kept as backwards-compat
re-export of nodeVitestConfig.

Spec: §6.2
2026-05-05 14:04:19 +02:00
a533be3c3a fix(core-testing): address code review feedback for Task 1
- Remove unused @trpc/tanstack-react-query dependency
- Document renderWithProviders tRPC provider omission (boundary constraint)
- Implement deep merge in defineFactory (preserves nested sibling keys)
- Document httpBatchLink<any> rationale in mock-trpc.ts
- Align core-testing's own vitest.config with safety defaults (mockReset, unstubGlobals)
- Add createMockTrpcClient usage example to AGENTS.md

Reviewer: superpowers:code-reviewer (Task 1 of Plan 7).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 13:50:32 +02:00
4ca083690f feat(core-testing): scaffold shared testing utilities package
Adds @repo/core-testing (tag: tooling) with:
- factory/defineFactory: monotonic-sequence object factories with overrides
- contract/defineContractSuite: shared test suites runnable against multiple impls
- react/renderWithProviders + createMockTrpcClient: RTL helpers
- payload/stubPayloadConfig + mockPayloadModule: Payload mocking helpers
- setup/{jsdom,node}: vitest setup files

Spec: docs/superpowers/specs/2026-05-05-tdd-foundation-design.md §5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 13:37:35 +02:00
1ab3a3274f docs(plan): Plan 7 — TDD foundation (12 tasks, TDD-driven, subagent-ready)
Twelve self-contained tasks closing all 10 gaps from the spec:
1. Scaffold @repo/core-testing
2. Vitest base configs (jsdom + node) in core-typescript
3. Factories per feature
4. Contract suites per repository interface
5. core-ui jsdom + RTL tests
6. core-api / core-cms / core-trpc composition tests
7. App unit tests (web-next, web-tanstack, cms)
8. Storybook test-runner integration
9. tdd-workflow.md + adding-a-feature.md restructure
10. ADR-011 + per-feature AGENTS.md
11. CI workflow
12. Per-directory coverage thresholds

Each task TDD'd, single-commit-scoped, ready for subagent dispatch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 12:53:13 +02:00
a21935c3aa docs(spec): TDD foundation design — close 10 gaps for agentic TDD
Catalogues the ten gaps that prevent reliable TDD by agents and humans
in this monorepo, and specifies the closure plan: a new @repo/core-testing
package (factories + contract suites + RTL helpers + payload mocks),
jsdom + safety defaults in core-typescript Vitest bases, tests in core-*
and apps, Storybook test-runner, coverage thresholds, CI workflow, and
two new docs (tdd-workflow.md plus a restructured adding-a-feature.md
that interleaves tests with implementation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 12:46:53 +02:00
00922894ee chore: remove empty root tests/ folder
Vertical-feature architecture places tests in three locations (per spec §13B):
- Unit + component tests: colocated `src/**/*.test.{ts,tsx}`
- Feature-level integration: `packages/<feature>/tests/*.feature.test.ts`
- Browser e2e: `apps/<app>/e2e/*.spec.ts`

The root `tests/{unit,integration,e2e}/` scaffolding was a leftover from
the horizontal Clean Architecture template. Spec §13B.5 explicitly
recommends against a global root tests folder unless used for true
cross-application harnesses (which we don't have).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 12:32:46 +02:00
2c2375920f docs: reflect tooling-package rename + Turbo boundaries enforcement
- Rename eslint-config → core-eslint, typescript-config → core-typescript
  in all docs (package map, AGENTS.md, overview.md, dependency-flow.md, etc.)
- Document the five-tag model (app, feature, core, core-composition,
  tooling) — refinement of ADR-006's three-tag mention
- Document core-trpc's core-composition tag (transitively reaches features
  through core-api's AppRouter type)
- Note Turborepo boundaries as a second enforcement layer alongside ESLint
- Add ADR-010 explaining the two-layer enforcement decision and
  five-tag refinement

Files updated:
- docs/architecture/overview.md: package map, enforcement layers, five-tag section
- docs/architecture/dependency-flow.md: boundary rules, enforcement strategy
- docs/architecture/vertical-feature-spec.md: package names, five-tag model
- AGENTS.md: package map, boundary rules, commands
- CLAUDE.md: tooling package names, quick-start command
- packages/core-eslint/AGENTS.md: tag clarification
- packages/core-typescript/AGENTS.md: tag clarification
- packages/core-api/AGENTS.md: core-composition tag
- packages/core-cms/AGENTS.md: core-composition tag
- packages/core-trpc/AGENTS.md: core-composition tag + rationale
- docs/decisions/adr-010-turbo-boundaries.md: new ADR

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 12:24:04 +02:00
eb55a698f3 fix(turbo-boundaries): resolve 32 violations
- Re-tag core-trpc as core-composition (transitively reaches features
  through core-api's AppRouter type) and allow core-composition packages
  to depend on other core-composition packages in turbo.json
- Add @payloadcms/richtext-lexical as direct dep of apps/cms (was pulled
  transitively via core-cms; Payload's importMap.js imports it directly)
- Add @storybook/react as devDep of core-ui and apps/storybook (stories
  belong with components per Atomic Design)
- Update apps/storybook .storybook/{main,preview}.ts to point at
  packages/core-ui (was still referencing deleted packages/ui) and export
  CSS via package exports instead of direct file import
- Add JSDoc type annotation to Payload-generated importMap.js to suppress
  TypeScript's TS2742 error from complex inferred types
- Add storybook-static to eslint ignores in core-eslint base config

pnpm turbo boundaries now reports zero violations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 12:12:27 +02:00
9899e213ca build(turbo): add boundaries enforcement matching ESLint dependency graph
Per-package tags + root boundaries block now enforce the same three-tag
model as eslint-plugin-boundaries:
- app          → may depend on: app, core, core-composition, feature, tooling
- feature      → may depend on: core, tooling
- core         → may depend on: core, core-composition, tooling
- core-composition (core-api, core-cms) → may depend on: core, feature, tooling
- tooling (core-eslint, core-typescript) → may depend on: tooling

Tags applied: 4 apps (app), 3 core foundation packages (core),
2 core composition packages (core-composition), 5 features (feature),
2 tooling packages (tooling). All test suites pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 11:59:44 +02:00
0972645ebb refactor: rename eslint-config + typescript-config to core-eslint + core-typescript
Aligns tooling packages with the core-* naming convention used by all
other foundation packages (core-shared, core-cms, core-api, core-trpc,
core-ui). Updates ~50 files: package.json names, devDependencies,
tsconfig extends, eslint.config imports, vitest.config imports, AGENTS.md
references, and the boundaries plugin patterns to match the new paths.

The tooling-specific patterns in boundaries/elements are now ordered BEFORE
the broader core-* pattern to ensure correct first-match-wins behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 10:37:07 +02:00
1f089b0ac7 Merge branch 'refactor/vertical-features' into main
Vertical-feature monorepo refactor — 188 commits across 6 plans.

Architecture pivot: dissolve packages/core into vertical feature packages
(auth, blog, media, marketing-pages, navigation) with full Clean
Architecture layers per feature; 5 core-* foundation packages
(core-shared, core-cms, core-api, core-trpc, core-ui) handle
non-business concerns. Per-feature InversifyJS containers.
@payload-config swapped for constructor-injected SanitizedConfig.
Three-tag boundary model enforced by eslint-plugin-boundaries.

State at merge:
- 12 packages (5 core + 5 feature + 2 tooling)
- 4 apps (cms, storybook, web-next, web-tanstack)
- 96 unit/feature tests + 4 e2e tests
- 9 ADRs (5 existing updated/superseded + 4 new)
- Root + per-package + per-app AGENTS.md rewritten
- pnpm install/typecheck/lint/test/test:e2e all green

See docs/architecture/vertical-feature-spec.md for the design and
docs/superpowers/plans/2026-05-04-plan-{1..6}-*.md for the execution
record.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 10:22:52 +02:00
3856701252 fix(lint): exempt next-env.d.ts triple-slash + declare globalEnv vars
next-env.d.ts is a generated file using triple-slash references that
TypeScript requires. ESLint exemption added in apps/web-next config only.
Also declare CI, DATABASE_URL, PAYLOAD_SECRET, NODE_ENV in turbo.json
globalEnv so turbo/no-undeclared-env-vars stops warning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 10:02:33 +02:00
2c6c836206 docs(agents): write per-app AGENTS.md for cms, web-next, web-tanstack, storybook 2026-05-05 10:00:28 +02:00
0ede53998f docs(agents): add per-package AGENTS.md for eslint-config + typescript-config 2026-05-05 09:59:08 +02:00
440315a4c1 docs(agents): add per-package AGENTS.md for all feature packages 2026-05-05 09:58:42 +02:00
956b38fb00 docs(agents): add per-package AGENTS.md for all core-* packages 2026-05-05 09:37:47 +02:00
19805fb0df docs(claude): update Read First + add vertical feature conventions 2026-05-05 09:37:11 +02:00
1a2a293b84 docs(agents): rewrite root AGENTS.md for vertical feature architecture 2026-05-05 09:36:44 +02:00
588f47affa docs(plans): delete six stale 2026-04-06 plan docs (superseded by 2026-05-04-plan-{1..6}) 2026-05-05 09:34:44 +02:00
8dac1929dc docs(adr): add ADRs 006-009 for vertical refactor 2026-05-05 09:34:33 +02:00
e5b1ea720e docs(adr): update 002/003/005 with vertical-refactor notes; supersede 004 2026-05-05 09:34:03 +02:00
a4d6fa0cb5 docs(guides): rewrite testing-strategy for vertical features (per-feature DI, colocated tests, Playwright) 2026-05-05 09:33:23 +02:00
49d74adc35 docs(guides): rewrite adding-a-feature for vertical canonical pattern 2026-05-05 09:33:02 +02:00
590543fb65 docs(architecture): rewrite dependency-flow for vertical features + boundary rules 2026-05-05 09:32:25 +02:00
f6e86cf55e docs(architecture): rewrite overview for vertical feature architecture 2026-05-05 09:32:10 +02:00
d4969d2fb5 docs(architecture): copy refactor design spec into in-tree reference 2026-05-05 09:31:41 +02:00
520749c4e3 build: add root test:e2e task aggregating per-app Playwright suites 2026-05-05 09:29:37 +02:00
a7b9890db5 test(web-tanstack): add Playwright scaffold + skipped home spec 2026-05-05 09:26:19 +02:00
106e5c2737 test(web-next): add Playwright config + smoke specs (home, about, blog 404) 2026-05-05 09:25:42 +02:00
22bee5362f feat(eslint-config): add boundaries plugin enforcing app→feature→core graph
- Install eslint-plugin-boundaries@^4.2.2 to enforce three-tag boundary model
- Configure element types: app, core-composition (core-api/core-cms), core, feature, tooling
- Enforce unidirectional dependency graph: apps→features→core, core-composition→features
- Add eslint.config.js to all 17 packages and apps (required for ESLint 9 flat config)
- Fix pre-existing linting issues to achieve clean lint pass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 09:21:01 +02:00
acae859773 chore: delete legacy packages (api, api-client, cms-client, cms-core, core, ui) 2026-05-05 09:13:08 +02:00
f17f24e8f9 build(cms): drop legacy @repo/cms-core dep (now uses @repo/core-cms only) 2026-05-05 09:11:46 +02:00
346e77ed0c build(storybook): migrate from @repo/ui to @repo/core-ui 2026-05-05 09:11:23 +02:00
a7d37d8a0f feat(core-ui): migrate atoms/molecules/templates from packages/ui 2026-05-05 09:10:45 +02:00
1f0a6e73bf docs(plan): add Plan 6 (cleanup + enforcement + e2e + docs)
20 tasks in 5 phases: A) migrate ui→core-ui, repoint apps/cms+storybook,
delete 6 legacy packages; B) eslint-plugin-boundaries with three-tag
model + composition exceptions; C) Playwright in both apps with smoke
specs + root test:e2e task; D) full doc rewrite (overview, dependency
flow, guides, root+per-package AGENTS.md, 4 new ADRs, 4 updated/
superseded ADRs, delete 6 stale plans); E) all-green final check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 09:09:41 +02:00
f1da728482 feat(web-tanstack): consume marketingPages.siteSettings + navigation.header via tRPC client 2026-05-05 09:02:50 +02:00
a9e64569eb build(web-tanstack): swap deps + use TanstackTrpcProvider against shared backend 2026-05-05 09:01:47 +02:00
1308fe4644 fix: enable overrideAccess=true for public Payload repository reads
All public pages (site settings, header, pages, articles) now bypass
Payload's access control checks when reading, as they should be publicly
accessible without authentication. This fixes 403 Forbidden errors on
homepage and article rendering.
2026-05-05 08:59:18 +02:00
7809f21151 feat(web-next): render /blog/[slug] article detail via blog.articleBySlug 2026-05-05 08:55:41 +02:00
293d855d06 feat(web-next): render /about marketing page via marketingPages.pageBySlug 2026-05-05 08:54:41 +02:00
5f0a66581a feat(web-next): render homepage with siteSettings + header + article list 2026-05-05 08:54:20 +02:00
8403bfee7f feat(web-next): wire tRPC route handler against core-api + new TrpcProvider 2026-05-05 08:54:04 +02:00
bd1a348340 feat(web-next): add server bindAllProduction() aggregator with idempotent guard 2026-05-05 08:53:03 +02:00
9d5f4fca33 build(web-next): swap deps to core-* + feature packages, transpile new workspaces 2026-05-05 08:52:37 +02:00
5620fae116 feat(navigation): add bindProductionNavigation(config) DI helper 2026-05-05 08:50:47 +02:00
02aee1ec23 feat(marketing-pages): add bindProductionMarketingPages(config) DI helper 2026-05-05 08:50:30 +02:00
ef42abb3e1 feat(auth): add bindProductionAuth(config) helper (no-op pending payload-users repo) 2026-05-05 08:50:08 +02:00
f981266fd5 feat(blog): add bindProductionBlog(config) DI helper for app boot 2026-05-05 08:49:55 +02:00