Skip to content

Commit 1e80750

Browse files
authored
feat(config): export diffProjectConfig from the public entrypoint (#6447)
## What changed `diffProjectConfig` and its supporting types (`ConfigChange`, `ConfigChangeClass`, `ConfigChangeCounts`, `ConfigChangeSet`, `DiffProjectConfigOptions`) move from `@supabase/config/internal` to the package's public `.` entrypoint. ## Why ADR 0022 deliberately deferred exporting the config-diff classification engine publicly until a second real consumer needed it, rather than exporting it speculatively. Studio is now that second consumer, so this promotes the (already pure/synchronous) engine to the public surface `apps/cli` and Studio can both read. ## Notes for reviewers - `config-diff.ts` itself is newly added to `index.ts`'s pure runtime graph, but every module it transitively depends on (`config-document.ts`, `project-config/project-config.ts`, `project-config/registry.ts`, `sparse.ts`) was already reachable from that graph, so no new transitive module or bare specifier enters it. - `apps/cli`'s `config diff` command (`diff.handler.ts`, `diff.format.ts`, and their test) are updated to import `diffProjectConfig`/`ConfigChange*` from `@supabase/config` instead of `@supabase/config/internal`; other internal-only imports in those files (`loadCliConfig`, `projectConfigApiBlockKeys`) are unaffected. - `packages/config/AGENTS.md`, `packages/config/README.md`, and ADR 0022 are updated to reflect the new entrypoint.
1 parent ace845a commit 1e80750

17 files changed

Lines changed: 59 additions & 38 deletions

apps/cli/src/legacy/commands/config/config.format.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { type ConfigChange, projectConfigApiBlockKeys } from "@supabase/config/internal";
1+
import type { ConfigChange } from "@supabase/config";
2+
import { projectConfigApiBlockKeys } from "@supabase/config/internal";
23

34
import { LEGACY_BRANCH_UUID_PATTERN } from "../../shared/legacy-ref-patterns.ts";
45
import { legacySanitizeInlineName } from "../../shared/legacy-http-errors.ts";

apps/cli/src/legacy/commands/config/diff/diff.format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConfigChange, ConfigChangeSet } from "@supabase/config/internal";
1+
import type { ConfigChange, ConfigChangeSet } from "@supabase/config";
22

33
import { legacySanitizeInlineName } from "../../../shared/legacy-http-errors.ts";
44
import {

apps/cli/src/legacy/commands/config/diff/diff.format.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConfigChangeSet } from "@supabase/config/internal";
1+
import type { ConfigChangeSet } from "@supabase/config";
22
import { describe, expect, test } from "vitest";
33

44
import { legacyConfigApiScope, legacyConfigScopeLine } from "../config.format.ts";

apps/cli/src/legacy/commands/config/diff/diff.handler.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import {
22
CLI_CONFIG_SCHEMA_URL,
3+
diffProjectConfig,
34
fromApiProjectConfig,
45
ProjectConfigParseError,
5-
} from "@supabase/config";
6-
import {
7-
diffProjectConfig,
8-
loadCliConfig,
9-
remoteNameForProjectRef,
10-
} from "@supabase/config/internal";
6+
} from "@supabase/config/effect";
7+
import { loadCliConfig, remoteNameForProjectRef } from "@supabase/config/internal";
118
import { operationDefinitions } from "@supabase/api/effect";
129
import { Effect, Option } from "effect";
1310

apps/cli/src/legacy/commands/config/diff/diff.live.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { type ConfigChangeClass, projectConfigMappingRows } from "@supabase/config/internal";
1+
import type { ConfigChangeClass } from "@supabase/config";
2+
import { projectConfigMappingRows } from "@supabase/config/internal";
23
import { expect } from "vitest";
34

45
import { requireLiveSuccess, test } from "../../../../../tests/helpers/live.ts";

apps/cli/src/legacy/commands/config/pull/pull.format.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { ConfigFormat } from "@supabase/config";
2-
import type { ConfigChange, ConfigChangeSet } from "@supabase/config/internal";
1+
import type { ConfigChange, ConfigChangeSet, ConfigFormat } from "@supabase/config";
32

43
import { legacySanitizeInlineName } from "../../../shared/legacy-http-errors.ts";
54
import {

apps/cli/src/legacy/commands/config/pull/pull.format.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConfigChange, ConfigChangeSet } from "@supabase/config/internal";
1+
import type { ConfigChange, ConfigChangeSet } from "@supabase/config";
22
import { describe, expect, test } from "vitest";
33

44
import {

apps/cli/src/legacy/commands/config/pull/pull.handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import {
22
CLI_CONFIG_SCHEMA_URL,
3+
diffProjectConfig,
34
fromApiProjectConfig,
45
ProjectConfigParseError,
56
type CliConfigParseError,
7+
type ConfigChangeSet,
68
type ConfigFormat,
79
type LoadedCliConfig,
8-
} from "@supabase/config";
10+
} from "@supabase/config/effect";
911
import {
1012
applyConfigEdits,
1113
decodeCliConfigDocumentForValidationEffect,
12-
type ConfigChangeSet,
14+
loadCliConfig,
15+
writeCliConfigDocumentText,
1316
type ConfigEdit,
1417
type ConfigEditRefusalReason,
1518
type DecodeCliConfigDocumentForValidationEffectOptions,
16-
diffProjectConfig,
17-
loadCliConfig,
18-
writeCliConfigDocumentText,
1919
} from "@supabase/config/internal";
2020
import { operationDefinitions } from "@supabase/api/effect";
2121
import { Effect, FileSystem, Option, Result, Schema, SchemaIssue } from "effect";

apps/cli/src/legacy/commands/config/pull/pull.plan.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import {
2+
type CliConfigValueOrigin,
23
type ConfigChange,
34
type ConfigChangeSet,
5+
diffProjectConfig,
6+
type EffectiveConfig,
7+
type ProjectConfig,
8+
} from "@supabase/config";
9+
import {
410
type ConfigEditValue,
511
dualScopeProjectConfigPaths,
6-
diffProjectConfig,
712
ENV_CAPTURE_REGEX,
813
} from "@supabase/config/internal";
9-
import type { CliConfigValueOrigin, EffectiveConfig, ProjectConfig } from "@supabase/config";
1014

1115
import type { LegacyConfigPullDestination } from "./pull.scope.ts";
1216

apps/cli/src/legacy/commands/config/pull/pull.plan.unit.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {
2-
diffProjectConfig,
2+
type CliConfigValueOrigin,
33
type ConfigChange,
44
type ConfigChangeSet,
5-
} from "@supabase/config/internal";
6-
import type { CliConfigValueOrigin, EffectiveConfig, ProjectConfig } from "@supabase/config";
5+
diffProjectConfig,
6+
type EffectiveConfig,
7+
type ProjectConfig,
8+
} from "@supabase/config";
79
import { describe, expect, test } from "vitest";
810

911
import {

0 commit comments

Comments
 (0)