fix(nextjs-template): flow-aware degradation + api-<sub> endpoint + scoped tsconfig#25
Draft
yyyyaaa wants to merge 1 commit into
Draft
fix(nextjs-template): flow-aware degradation + api-<sub> endpoint + scoped tsconfig#25yyyyaaa wants to merge 1 commit into
yyyyaaa wants to merge 1 commit into
Conversation
… + scoped tsconfig
Make a freshly-scaffolded constructive-app green-build for a minimal auth:email
flow with NO manual stubbing, while keeping the b2b org surface fully functional
when the admin SDK has it.
F1 — degrade org/invite/members/settings when the admin SDK lacks Org*/Invite*:
- Add src/lib/gql/admin-compat.ts: re-exports @sdk/admin and, for each symbol that
exists only in the b2b admin SDK, exports a value that resolves to the REAL
export when present (sdk[name] ?? stub). Lives outside src/graphql/sdk so codegen
(which wipes the generated SDK dirs) never clobbers it.
- auth:email build → org/invite symbols absent → typed stubs keep the dead
template code type-checking; they are never on the runtime path and throw
loudly if invoked.
- b2b build → symbols present → genuine hooks/fns are used at runtime.
- Repoint the 13 org/invite/app hook + members-route imports of the 23 at-risk
symbols from @sdk/admin to @/lib/gql/admin-compat.
- Annotate 5 derived id arrays as string[] so the where:{id:{in:…}} sites stay
typed when the upstream fetch degrades to any (no-op cast on the b2b path).
- Verified by overlaying the full template src against BOTH a real auth:email SDK
(org symbols absent) and a real b2b/org-roles SDK (org symbols present):
tsc --noEmit = 0 errors in both.
F2 (template half) — app DATA endpoint is api-<sub>, not app-public-<sub>:
- graphql-codegen.config.ts: the app target Host now honors CODEGEN_APP_HOST and
defaults to api-{db}.localhost:3000; endpoint + Host header stay in sync (Host
drives routing, so a URL-only override still 404s). admin/auth gain matching
CODEGEN_*_HOST overrides.
- config-core.ts getAppEndpoint(): default resolves to http://api-{db}.localhost,
still overridable via NEXT_PUBLIC_APP_ENDPOINT.
F11 — scope tsconfig:
- include limited to src/** (+ Next types); add "packages" to exclude so the
provision sub-package isn't greedily compiled by the app's tsc --noEmit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the
nextjs/constructive-apptemplate scaffold cleanly when consuming Constructive Blocks under a minimal auth preset — the template half of the cross-repo Blocks effort (library/docsconstructive-io/dashboard#227, skillconstructive-skills, harnessconstructive-sdk-agentic-flow).Contents (single commit
0c064ff)auth:emailpreset, hard-failingtsc+next buildout of the box. A compat shim lets the scaffold compile under bothauth:emailand b2b.api-<sub>— point codegen + runtime atapi-<sub>(with aCODEGEN_APP_HOSTseam) instead of the deadapp-public-<sub>Host.tsconfig— sonext buildtype-checks the app, not unrelated sibling workspace packages.Status
Draft / WIP. Unblocks the Blocks on-ramp scaffold; in repeated harness runs 8–10 of every fleet's agents hand-wrote these same fixes, so landing them in the template removes that per-build friction. Follow-up: harden the b2b-import degradation (the compat shim currently lives inside the codegen-regenerated dir and must be re-applied after
pnpm codegen).🤖 Generated with Claude Code