Repository navigation
refactor: reorganise folders by topic, import through @/, and keep server/ server-only - #327
Conversation
server/api-routes.ts held all four same-origin JSON routes. Each now lives in the file its path names, so the folder is the route list: routes/api/related-meditations.ts GET /api/related-meditations/:lectureId routes/api/related-lectures.ts GET /api/related-lectures/:meditationId routes/api/submissions.ts POST /api/submissions routes/api/live-preview/populate.ts POST /api/live-preview/populate What more than one route reads moves to _shared.ts (parseLocale, relatedAnswer) and _proxy-failure.ts (upstreamRefusal, reportProxyFailure). index.ts keeps registerApiRoutes, so entry.ts changes by one import. No behaviour changes: every handler body is moved verbatim, and every existing test case is kept, split beside the file it covers. The new index.test.ts fails a route registered outside the file its path names, a route file that registers nothing, and a file index.ts does not register. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wn files Each route is now a folder at its path, holding route.ts, route.test.ts and anything only it reads: related-meditations/route.ts GET /api/related-meditations/:lectureId related-lectures/route.ts GET /api/related-lectures/:meditationId submissions/route.ts, schema.ts POST /api/submissions live-preview/populate/route.ts POST /api/live-preview/populate submissionSchema and SUBMISSION_BODY_LIMIT move from server/validation.ts to submissions/schema.ts, since only that route reads them; the zod-validation rule now also loads for a route's schema.ts. Top-level `_` files stay for what several routes share. index.test.ts now maps a path to `<path>/route.ts`, and also fails a file that sits in no route's folder and is not a shared `_` file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
index.test.ts was a guard — a prose rule held by a test — sitting inside the folder it audits, while the other twenty live in tests/guards/ with shared plumbing in _source-scan.ts and two of them cited by AGENTS.md at that path. Keeping this one next to its subject made a second convention for the same kind of check. It globs ../../server/routes/api/**/*.ts from there and strips that prefix off each key, so a reported path still reads as the folder does. Checked that it still fails on a stray file and on a misplaced route path. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXkzgLHTsVGKfpM6Gf
The section retold what the code and the guard already hold: the path-to-file example, the register signature, and a last sentence listing the three cases the guard fails on. A check that enforces a rule gets one pointer, never its cases. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXkzgLHTsVGKfpM6Gf
parseLocale is isLocale plus a default, and both the narrowing and the 'en' it falls back to already live in sahajcloud-types.ts, where the default is named DEFAULT_LOCALE. It is reusable there by name. What stays behind is relatedAnswer, for the two related-* routes, so the file takes their name: _shared said only that something shared it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXkzgLHTsVGKfpM6Gf
oembed-routes.ts and the related-* answer each held a byte-identical 'public, max-age=300, stale-while-revalidate=1800'. The split built the shared owner for that value and left its twin next door, so both now read JSON_CACHE_CONTROL from server/cache-headers.ts. The sitemap's longer one stays where it is. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXkzgLHTsVGKfpM6Gf
submissions/schema.ts ended on a second newline. Lint went red once #313 set --max-warnings 0, which turns prettier/prettier into a failure. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWhMsP61j5GKkGuVZy
The mechanical half of the reorganisation, written by one script so any branch can replay it: - `@/` is the repo root (tsconfig `paths`, and the alias in vite, both vitest configs and Ladle), matching SahajCloud and SahajAtlasWeb. Imports leave a folder through `@/`; inside one they stay `./`. - SahajCloud types leave server/: types/payload/payload-types.ts (the path SahajAtlasWeb uses), types/sahajcloud.ts, types/atlas.ts. - The SahajCloud client and its transport move to server/sahajcloud/. - oembed, sitemap.xml and manifest.webmanifest get route folders under server/routes/, like the /api routes. - lib/ is grouped by topic: a11y, atlas, content, errors, forms, i18n, media, seo, sentry, urls (live-preview as before). The browser Sentry config moves from the repo root to lib/sentry/browser-config.ts, and AudioPlayer's shared playback types to lib/media/audio.ts. - Each template gets its own folder; DESIGN_SYSTEM.md, STORYBOOK.md and MCP_USAGE.md move to docs/. No code changes beyond import specifiers and the paths that name moved files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…route has a folder Everything the browser needed from server/ moves to lib/: - the locale constants and rules → lib/i18n/locales.ts - WEB_TRANSLATIONS_SELECT and WebTranslations → lib/i18n/web-translations.ts - ErrorType, readStatus and detectErrorType → lib/errors/error-type.ts - isCanonicalOrigin → lib/seo/canonical-origin.ts With no browser importer left, error-utils.ts reports through @sentry/cloudflare like the rest of server/, instead of @sentry/react. The Ladle build therefore bundles no server/ module, so the Smoke (ladle) WATCH list drops its server/ paths, and the guard now asserts the bundle reaches none. robots.txt, sitemap.xml and manifest.webmanifest each get their own route folder (sitemap-routes.ts held all three), sharing ROOT_FILE_CACHE_CONTROL from server/cache-headers.ts. server/routes/ index.ts registers every route, so entry.ts makes one call, and the route-tree guard now covers the whole of server/routes/. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…/sahajcloud/index.ts client.ts held every read in 1,030 lines. It splits into pages, documents, lectures, meditations, related, web-config and web-translations, with the select/populate shapes in selects.ts and the shared options and preview retry in query.ts. index.ts is the one entry point, so callers import from '@/server/sahajcloud'; its test moves with it, unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rts nothing from server/ Co-Authored-By: Claude Opus 5.5 <[email protected]>
… every path the moves changed server/AGENTS.md now covers the route folders, the server-only boundary, the submission proxy and Sentry; the SahajCloud read rules move to server/sahajcloud/AGENTS.md, so they load where the reads are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 22f4d05 | Commit Preview URL Branch Preview URL |
Nov 21 2026, 02:09 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | af05e25 | Commit Preview URL Branch Preview URL |
Nov 21 2026, 12:46 AM |
… replay it scripts/reorg/ is temporary: it goes once no open PR predates this one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
438 files, almost all of them moves, and the diff matches its statement. Nothing is smuggled in, and the server/ boundary earns the churn because lint now enforces what was convention. One real defect: the sync script still writes the old English mirror, silently disabling a CI guard. The cross-repo claim holds — claude-workflow#297 exists and moves contractSync to the new path.
Findings
blocker—scripts/sync-translations.mjs:142writeslib/translations.en.json, notlib/i18n/. Thread on line 144.should-fix—.claude/workflow.json:31namesserver/cms-types.ts, removed in #131. Thread on that line.should-fix—.claude/workflow.json:14:securityReview.triggerPatternends at^sentry\.[a-z]+\.config\.ts, which matched the rootsentry.browser.config.tsthis PR moved tolib/sentry/browser-config.ts. A Sentry browser-config change now fires no security review. Add^lib/sentry/. No hunk covers line 14, hence no thread.consider—tsconfig.json:17:@/is the repo root here,src/in the siblings.
What was checked
- 92 paths exist on
mainand not on the branch. Each was grepped as a literal across the branch: no stale path reference anywhere, prose and skills included. Both defects above are pattern-shaped, which that grep cannot see. - Patterns rather than paths, one by one:
.prettierignore,eslint.config.jsignores,ci.ymlWATCH,vitest.config.ts,tailwind.css@source,docs/rules/*.mdpaths:. OnlysecurityReview.triggerPatternis stale. - The
@/server/*rule was tested, not assumed:ignore().add(['@/server','@/server/*']).ignores('@/server/sahajcloud/pages')istruein the matcher ESLint uses, so it reaches nested files. - Anomaly: the streamliner subagent did not return before the lease deadline, so its piece counts are absent.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review — streamliner pass
Correction: the streamliner did finish, inside the lease. Its findings are the six threads here. Disregard the anomaly line in the body above.
Pieces walked: 99 across 31 files. 84 were confirmed as moves (git grep -w <name> origin/main), so the whole of server/sahajcloud/** and server/routes/**, and the five lib/ extractions, are not new pieces. Kept: 92.
Findings — all should-fix, each on its line
eslint.config.js:20— two consts inserted between a JSDoc and the const it documents, breaking a cross-file sync pointer.server/sahajcloud/web-config.ts:57andserver/routes/api/_proxy-failure.ts:33— two hand-rolled copies ofwarnOnce(server/error-utils.ts:180), which siblings in the same folder already call. Predates the PR.server/sahajcloud/index.ts:2— "import from here, not from a file inside" is false in the diff that writes it: two call sites importatlas.tsdirectly.server/sahajcloud/documents.ts:131— three comments point "above" at code the split moved away.server/sahajcloud/related.ts:7— three files import one module twice.
What held. server/cache-headers.ts de-duplicates one literal from two files. The eight register* wrappers follow a pattern already on main, pinned by route-files.test.ts. selects.ts is a verbatim move of per-collection field lists. The @sentry/react → @sentry/cloudflare switch is correct once detectErrorType moved: ErrorFallback.tsx and pages/_error/+Page.tsx are the only browser readers and both import from lib/ now.
Not verified, so not filed: folding the two near-identical related-* handlers into _related.ts, moving server/content-index.ts into server/sahajcloud/, and cutting server/AGENTS.md:6-13 where it restates routes/index.ts. I ran out of lease to check these.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
#327 reorganised lib/ by topic and moved every cross-folder import to the `@/` alias, which collided with this branch's three import blocks and left its four new files on paths that no longer resolve. Every hunk keeps both sides: main's `@/` spelling, this branch's new imports. `lib/content-blocks` is now `@/lib/content/blocks`, and `blocks.test.ts` keeps the `TextBoxBlock` type the branch added beside main's `ContentIndexBlock`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV83ryJLF6Jfwp8dz8
…n-repo #327 squash-merged as 5d6cbd9, so git's merge base predates it and the same content reaches the merge from both sides. main's tree is identical to this branch's tree at 22f4d05, the commit before the a11y work, so every hunk resolves to this branch. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXcg7NjuuAuuSvDjaq
Four conflicts, all import blocks against #327's folder reorganisation. Each keeps this branch's symbols, spelled the `@/` way main now uses: - Accordion.tsx: `Heading` arrives with the `headingLevel` prop, beside main's `Icon`. - LanguageDropdown.tsx: `DropdownItem` replaces the hand-rolled rows, so the direct `Link` import main added goes with them. - LanguageDropdown.test.tsx: the `importOriginal` mock stays, because `DropdownItem` has to stay real to render the links under test. - page-types.test.tsx: `RunOptions` stays dropped, since `axeOptions` now lives in tests/_helpers/axe.ts. The six files #327 never saw — the five new specs and this branch's edit to the a11y gate — move to `@/` too. `no-restricted-imports` bars `../*` in every aliased folder, so a relative path across folders is now a lint error. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXDjyKLtEiZJVmnxBT
#327's reorg deleted `server/sahajcloud-client.ts` and split it, so this branch's two edits to it move to where they now live: the page populate's `credit` entry to `server/sahajcloud/selects.ts`, and the public-read `reportDroppedImages` call to `server/sahajcloud/pages.ts`. `server/dropped-images.ts` stays at the `server/` root beside `error-utils.ts` — it reports on a read rather than making one — and its imports take the new `lib/content/` paths. `server/dropped-images.test.ts` now mocks `@sentry/cloudflare`: main moved `error-utils.ts` off `@sentry/react` once the browser-shared error classifier left for `lib/errors/error-type.ts`, so the old mock silenced `warnOnce` and three tests saw no report. The three RichText conflicts were import regions only. Each takes main's `@/` paths and keeps this branch's additions: `populatedImage`, `IMAGE_CREDIT_CLASS`, and `@/tests/_helpers/markup`. `nearestAspectRatio` goes, because the upload converter no longer snaps a ratio. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ7B98X5hBMvxoq1m4
#327's repo-wide reorg (5d6cbd9) landed on main ahead of this branch, so every conflict was an import path. - Each conflicted import block takes main's `@/` spelling, and this branch's own imports follow their modules: lib/paragraphs -> lib/content/paragraphs, lib/document-routes -> lib/urls/document-routes, lib/cloudflare-images -> lib/media/cloudflare-images, lib/i18n -> lib/i18n/i18n, server/sahajcloud-types -> types/sahajcloud. - server/sahajcloud-client.ts is gone on main, split into server/sahajcloud/. This branch's one key, `tags` in EMBEDDED_PAGE_SELECT, moves to server/sahajcloud/selects.ts with its comment. - lexical-helpers.ts keeps this branch's removal of the `slugify` re-export, and RichText.tsx imports it from @/lib/urls/slugify. RichText.tsx was the re-export's only reader on both sides. - Blockquote.stories.tsx's `../Link` becomes @/components/atoms/Link, because the reorg makes `../*` a lint error. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUsZj1TrG6xTM3FrzD
#327 made an import that leaves its own folder a lint error, and this story's `../Link` was written while the branch still used relative paths. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUsZj1TrG6xTM3FrzD
main (#327) reorganised the tree by topic, so both conflicts and the breakage underneath them are that refactor meeting this branch's new files. `package.json`: took main's `types:cms`, which now writes `types/payload/payload-types.ts`, and kept this branch's four `redirects:*` scripts beside it. Both sides wanted both. `server/entry.ts`: took main's single `registerRoutes(app)` and kept `registerLegacyRedirects(app)` ahead of it. The middleware is not a route at a path — it acts after `next()` on whatever the site refused — so it stays out of `server/routes/` and keeps its own registration. The refactor also moved what this branch's added files import, which no hunk reports because main never touched those files. `Locale` now comes from `types/sahajcloud`, `DEFAULT_LOCALE` from `lib/i18n/locales`, and the URL helpers from `lib/urls/urls`, each through `@/`. That also puts `lib/legacy-redirects/core.ts` on the right side of the server-only boundary main now lints: it read both names out of `server/` before. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVF8mac9oL3ufMsMW4
#327 reorganised the tree by topic and moved every cross-folder import onto the `@/` alias, which touched all seven files this branch edits. - `Box.stories.tsx`, `Spacer.stories.tsx` (modify/delete): main only re-pointed their imports, so the deletion stands. - `Image.tsx`, `Lightbox.tsx`, `Lightbox.stories.tsx`: main's `@/` paths, with this branch's `lightbox-context` as the source of `LightboxSlide` and `LightboxContext`. `LightboxProvider.tsx` merged clean but kept a `../../atoms` path, which the new lint rule rejects; it reads `@/` now. - `Logo.tsx`: main's `inline` variant, this branch's `HTMLAttributes` props. - `types/sahajcloud.ts`: took main's side. The locale and translation blocks this branch edited moved to `lib/i18n/locales.ts` and `lib/i18n/web-translations.ts`, so the unused `LOCALES` export is removed at its new home instead. - `docs/STORYBOOK.md`: this branch's Badge and Spinner rows, at main's path for the file's move under `docs/`. `tests/guards/atomic-imports.test.ts` read relative specifiers only. Every cross-level import is spelled `@/` now, and lint forbids `../` outside a folder, so the guard had nothing left to see. It resolves both spellings through a `resolveModule` shared with `ladle-watch-paths.test.ts`, which already had its own copy. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVqxmDisHDFCXAMVyL
#327 reorganised the tree while this branch was open. Every conflict was the same shape — main's `@/` paths against one import this branch adds — except three. `server/warn-once.ts` is deleted, and both callers now take `warnOnce` from `server/error-utils.ts`. This branch built `createWarnOnce` there because `error-utils.ts` was reachable from the browser; #327 moved the browser's error helpers to `lib/errors/` and built the same memo in `error-utils.ts`, so the reason for a second module is gone and `server/sahajcloud/AGENTS.md` already names `warnOnce` as the bound. `server/api-routes.ts` and `server/sahajcloud-client.ts` are deleted, as main deletes them: this branch only repointed their comments at the memo, which their successors in `server/routes/api/` and `server/sahajcloud/` already do. The pending-translations overlay follows its consumers — the types into `lib/i18n/web-translations.ts`, the English into `lib/i18n/translations.pending.ts`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXv5NZFJUmYG7dNyNq
#327 reorganised lib/ and server/ by topic and moved imports onto `@/`, so most hunks were paths. Three resolutions were decisions: - lib/live-session.ts lands at lib/content/live-session.ts, beside the blocks.ts and payload-relationships.ts it reads. server/live-session.ts stays at server/ root, like content-index.ts. - PAGE_POPULATE's `events` and `regions` entries, with SESSION_EVENT_SELECT and REGION_ROUTE_SELECT, move to server/sahajcloud/selects.ts, which is where #327 split them out of sahajcloud-client.ts. - main's `warnOnce` fold wins in getWebConfig and in the proxies: it landed upstream while this branch was in flight, so this branch's own fold and its server/api-routes.ts edit are dropped rather than re-applied. The bare-id rule's added sentence follows its section to server/sahajcloud/AGENTS.md. Two specs here measured the pre-#327 shape and are corrected, not relaxed: server/live-session.test.ts mocked @sentry/react, which error-utils.ts no longer reports through, and lib/seo/head.test.tsx read its sibling component paths from one folder up. Lean gate green: lint, tsc --noEmit, 1771 tests, and pnpm build. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVXgAp7bwuSvur2jYk
#327 reorganised the tree by topic and made a cross-folder relative import a lint error. These three files are this branch's own, so that PR never saw them: merging it left them reaching for `server/ sahajcloud-types`, `lib/content-seo`, `lib/seo-head-html` and `lib/i18n`, none of which exist any more. Each now names the post-reorg module through `@/`, the way the branch's own locale spec already did. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYrT8Bs1ug1zbrbqLY
#327 made a retried attempt a breadcrumb and the final failure a `captureException`. A mock carrying only `captureMessage` therefore throws inside `withRetry`'s own catch, which aborts the loop after one attempt and reads as a read that never retried — `server/content-index.test.ts` failed exactly that way on the merge. Also formats the branch's files for the warning-free gate #313 introduced. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXv5NZFJUmYG7dNyNq
The comment on this read's retry claimed the wrapper reports every retried attempt, so one failed 5xx read cost three Sentry events. #327 made a retried attempt a breadcrumb: the cost is the wrapper's one captureException plus this caller's degrade, whatever the attempt count. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm
#327 moved every file this branch touches and closed `lib/** <-> server/**` both ways. Four of the five conflicts are mechanical renames. The fifth is the mechanism: `createT` can no longer call `warnOnce`, because ESLint refuses `lib/**` an `@/server/*` import and `error-utils` now reports through `@sentry/cloudflare`, which no browser bundle can take. Resolved as option 1A, the reviewer's answer on #300: the injected reporter comes back. `lib/i18n/i18n.ts` holds `MissingTranslation`, `reportMissing` and `setMissingTranslationReporter` again, and `server/site-context.ts` installs one that calls `warnOnce`. The boundary holds, the dedupe stays `warnOnce`'s, and the Sentry message, tags and extra are unchanged. The volume-bound test moves back beside the install, in `server/site-context.test.ts`. `lib/i18n/i18n.test.ts` asserts what the accessor hands the reporter, which is all it now decides. The other four: paths and aliases, `WebTranslations` split into `SahajCloudWebTranslations` for a mocked raw read, the `RequiredGroups` doc moved with the type to `lib/i18n/web-translations.ts`, and the `getWebTranslations` doc moved to `server/sahajcloud/web-translations.ts`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVCjeMfw9AMwXe1FJb
Summary
A one-pass reorganisation of WeMeditateWeb's folders. Nearly every file's imports change; almost no runtime code does. This PR includes #326 (a folder per
/apiroute), so #326 can be closed in favour of it, or merged first.Commits are separated so each can be reviewed alone:
refactor: move files to their topic folders and import through @/: mechanical, written by a script, which is kept on the branch atscripts/reorg/so an open PR can replay it (see Open PRs below).@/is the repo root: tsconfigpaths, plus the alias in vite, both vitest configs and Ladle. This matches SahajCloud and SahajAtlasWeb, where@/issrc/; this repo has nosrc/.src/. One prefix then means a different folder in each repo, and that is the cost accepted here. Asrc/move changes every place a top-level folder is named as a pattern rather than imported, and those are what no import rewrite reaches:layouts/tailwind.css's three@sourcelines,eslint.config.js's globs,.prettierignore,vitest.config.ts, theWATCHregex inci.yml, thepaths:of sixdocs/rules/*.mdfiles — and thewemeditate-designWorker's two Builds triggers, which live in the Cloudflare dashboard and cannot move in the same commit (seedocs/cloudflare-previews-ci.md). The one pattern this PR did leave stale,securityReview.triggerPattern, is exactly that class of miss. A later move tosrc/stays possible and would rewrite the imports again; it is a second reorg, not a cheaper version of this one.@/. One that stays inside a folder keeps./.server/:types/payload/payload-types.ts, the same path SahajAtlasWeb uses;types/sahajcloud.ts;types/atlas.ts.server/sahajcloud/:payload-client,fetch,contextandatlas.oembed,sitemap.xmlandmanifest.webmanifestget route folders underserver/routes/.lib/is grouped by topic:a11y,atlas,content,errors,forms,i18n,media,seo,sentry,urls.live-previewis unchanged.sentry.browser.config.tsmoves from the root tolib/sentry/browser-config.ts.lib/media/audio.ts, becauselib/andhooks/imported them from a molecule.DESIGN_SYSTEM.md,STORYBOOK.mdandMCP_USAGE.mdmove todocs/.refactor(server): browser code reads nothing from server/, and every route has a folderserver/tolib/:lib/i18n/locales.ts;WEB_TRANSLATIONS_SELECTandWebTranslations→lib/i18n/web-translations.ts;ErrorType,readStatusanddetectErrorType→lib/errors/error-type.ts;isCanonicalOrigin→lib/seo/canonical-origin.ts.error-utils.tsreports through@sentry/cloudflareinstead of@sentry/react. Both re-export the same@sentry/core, and the tests that spied on@sentry/reactnow spy on@sentry/cloudflare.server/. So theSmoke (ladle)WATCH regex drops itsserver/paths, andladle-watch-paths.test.tsnow asserts the bundle reaches noserver/module.sitemap-routes.tsheld three routes. They split intorobots.txt/,sitemap.xml/andmanifest.webmanifest/, which shareROOT_FILE_CACHE_CONTROL.server/routes/index.tsregisters every route, soentry.tsmakes one call. The route-tree guard (tests/guards/route-files.test.ts) now covers all ofserver/routes/.refactor(server): one file per kind of SahajCloud readclient.ts, at 1,030 lines, splits intopages,documents,lectures,meditations,related,web-configandweb-translations.selects.ts. The shared options and the preview retry go inquery.ts.@/server/sahajcloud(index.ts). The client's test moves toindex.test.ts, unchanged.no-restricted-importsrefuses../imports in the app folders.@/server/*import from code a browser can load. That covers components, hooks, layouts, lib, types,.ladle, and everypages/file except+data.ts,+onBeforeRender.tsand the_loaders those call.server/AGENTS.mdnow covers the routes, the server boundary, the submission proxy and Sentry.server/sahajcloud/AGENTS.md, which has aCLAUDE.mdsymlink.rest-api.mdandzod-validation.mdget newpaths:, and every prose path the moves changed is updated.Cross-repo
loop-config.json: WeMeditateWeb'scontractSyncpath changes fromserver/payload-types.tstotypes/payload/payload-types.ts, in a companion PR. Merge it right after this one.contract-checkpasses in either order. It only regenerates the paths listed in the config, and a deleted copy regenerates as nothing.server/cms-types*andserver/error-utils*. Both are now unneeded (seedocs/cloudflare-previews-ci.md). They're set in the dashboard, and removing them is optional.Open PRs
Every open PR touching a moved file needs a merge of
mainafter this lands. The file moves and import rewrites are replayed by runningscripts/reorg/on each branch — see itsREADME.md. What's left to resolve by hand is real content conflicts:sahajcloud-client.ts,sitemap-routes.ts,sahajcloud-types.ts,error-utils.ts,sitemap.ts;Not changed
layouts/headerDropdown.tsstays inlayouts/, its only consumer.SocialLinkstays aFooterprop type thatlib/seo/site-identity.tsimports as a type. Moving either buys nothing.Test plan
.claude/skills/pr-prep/check.sh --full: lint (0 warnings), tsc, 169 files / 1704 tests,pnpm buildpnpm ladle:build../and@/server/…fromlib/🤖 Generated with Claude Code