feat(config): trim the public surface and add a compiled build (CLI-2234, CLI-2232) - #6366
Draft
Coly010 wants to merge 7 commits into
Draft
Conversation
….json artifact (CLI-2234, CLI-2232)
…nd check in an API report (CLI-2232)
…onditions (CLI-2234)
Contributor
Superseded by a newer AI review🤖 AI ReviewThis PR is too large for a full AI review (+10567/-520 lines across 118 files). A maintainer can request a review anyway with a |
1 similar comment
Contributor
Superseded by a newer AI review🤖 AI ReviewThis PR is too large for a full AI review (+10567/-520 lines across 118 files). A maintainer can request a review anyway with a |
…d declaration compare (CLI-2234)
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.
Closes CLI-2234
Closes CLI-2232
What changed
Prepares
@supabase/configfor its first npm publish: the export surface is audited and trimmed (CLI-2234) and the package gains a real compiled build (CLI-2232). One PR because the audit decides what the entrypoints contain and the build compiles exactly that, and the audit's type-surface enforcement (API report) only works once the build emits.d.ts.Export-surface audit (CLI-2234)
Every export got an explicit keep / move / trim decision:
apps/cliKONG_LOCAL_CA_CERT(+ its test) — a local-stack TLS asset, not config schema./internalsubpath (explicitly not semver-covered; enforced apps/cli-only)ENV_CAPTURE_REGEX,AUTH_HOOK_NAMES,unmappedSecretApiPaths,projectConfigMappingRows,ProjectConfigMappingRow,ProjectConfigApiAttributes,InternalLoadCliConfigOptions+ goViperCompat-capable typings ofloadCliConfig/resolveCliConfigValue/resolveCliConfigSubtreegoViperCompat(offLoadCliConfigOptions; resolvers lost their options param entirely — re-adding later is non-breaking)MissingCliConfigValueErrordeleted entirely (never constructed anywhere in the package; apps/cli only carried a telemetry mapping entry + a test that fabricated one — both removed),loadCliConfigFile/InternalResolveCliConfigOptionsoff the internal barrel (zero consumers)./io, zero consumers existed)findCliProjectRootFor→findCliProjectRoot,findCliProjectPathsFor→findCliProjectPaths,loadCliProjectEnvironmentFor→loadCliProjectEnvironment,loadFunctionsManifest→inferFunctionsManifest—./ionow mirrors./effect1:1; the subpath conveys Promise-vs-EffectresolveCliConfigValue/resolveCliConfigSubtreeon.(Effect-typed variants deliberately shadow them on./effect);ProjectConfigSchema(runtime, Standard Schema v1 viaSchema.toStandardSchemaV1— one symbol serves Effect-native and~standardconsumers);toProjectConfigJsonSchema;PROJECT_CONFIG_SCHEMA_URLtoProjectConfig,fromConfigDocument,fromApiProjectConfig,attachApiResponse,comparableProjectConfigPaths,unmappedApiFields), errors, functions-manifest modelProjectConfigSchemais derived fromCliConfigSchemaat the AST level (hosted sections → type-side → deep-optional →x-secretleaves dropped → cross-field checks stripped, leaf checks kept) with a two-way compile-time assignability pin against theProjectConfigtype, so the runtime schema and the type cannot drift../io's error channel is narrowed fromunknownto the exact five-member union (verified exact by review: no wider member, none unused).Compiled build (CLI-2232)
tsc(tsgo 7.0.2,nodenext+rewriteRelativeImportExtensions) emits ESM.js+.d.ts+ maps todist/; no bundler.exports: in-repo Bun resolvessrc/*.ts(withcustomConditions: ["bun"]so tsc typechecks against source, not stale dist); external consumers getdistjs + types.files+.npmignore(npm-packlist otherwise applies the root.gitignoreand ships nodist—npm packandpnpm packnow agree); publish metadata (license, repository, publishConfig, engines) added; peers widened to>=4.0.0-rc.111 <5.sideEffects: false, proven by a tree-shake probe with positive + negative controls against the built artifact.dist/project-schema.jsonjoinsdist/schema.json(both draft-2020-12, now with$id/title, and with Effect's non-finite-numberanyOfencoding collapsed so numeric fields keepdescription/default).npm pack→ temp install → realnodeimports every subpath.Enforcement (surface changes stay deliberate)
./internal), purity walker overindex.tsandio-browser.ts.pnpm run check:config-api(root task; advisorycontinue-on-errorCI step) emits declarations for the PR base and head — base source extracted viagit archiveinto the package dir so the current install resolves deps, no second install — and reports the.d.tsdiff in the job summary. Per-PR signal, zero committed artifacts. The hard gate moves to release time (CLI-2233): diff the newdist/*.d.tsagainst the previously published tarball's in the human-approval step.@supabase/config/internalimports enforced apps/cli-only.Review rounds
Three internal reviews (engineer, architect, DX-as-consumer incl. a clean-Node tarball install exercising 23 checks) ran before this PR; all accepted findings are in the final commit. Explicitly rejected, for the record:
@deprecatedmarkers on./internalexports (strikethrough noise across apps/cli's own legitimate call sites; the no-semver contract is documented at the barrel, README, and AGENTS.md).messagegetters on the tagged error classes (would change CLI-visible error output pinned by normalize-error tests; README documents the structured-fields contract instead — candidate follow-up).api-report/.d.tsmirror (53 files + freshness test) existed in earlier commits of this branch and was removed by owner decision — per-PR accept semantics weren't worth 580 KB of generated diff noise. Replaced by the advisory base-vs-head compare above; an api-extractor-style rollup was also considered and skipped (TS7/tsgo compatibility unproven).saveCliConfig's atomic-write rename failure stays a defect (documented); re-channeling it as a typed failure is a behavioral follow-up.KONG_LOCAL_CA_CERTtopackages/stack(single legacy consumer today; speculative second move).Known collateral:
@supabase/pg-topoundercustomConditionscustomConditions: ["bun"]inapps/cli/tsconfig.json(needed so tsc typechecks@supabase/configagainst source instead of gitignoreddist/) also changes resolution for@supabase/pg-topo, whose ownbunexports condition points at unbuiltsrc/*.tscarrying 3 type errors at1.0.0-alpha.5. Worked around with a commentedpathspin to its shippeddist/index.d.ts.1.0.0-alpha.6is published but currently blocked by pnpm'sminimumReleaseAge; once it ages in, bump it inapps/cliand drop the pin (and thebun-condition source errors deserve an upstream fix insupabase/pg-toolbelteither way).Notes for CLI-2233 / CLI-2169 (publish)
dist/*.d.tsagainst the previously published tarball's and surface that diff in the human-approval step — that is the hard semver gate (the PR-time compare above is advisory only; first publish trivially has no compare target).pnpm publish(only pnpm rewrites any residualcatalog:; peers are now literal ranges regardless).effect@latestis still 3.x — README instructseffect@rc; revisit ranges when Effect 4 goes stable.main/types(deliberate ESM + exports-only; node10 resolution unsupported).@supabase/cli-go#lint:checkgosec findings fail localcheck:allon clean develop too — untouched by this PR.