| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 | |
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 | |
feat: Project Configuration & Multi-Stack Management (#7) # Project Configuration & Multi-Stack Management ## Summary This branch introduces the full project management lifecycle to the TypeScript CLI — from initialization through linking, version management, and multi-stack local development. It replaces the old `jsonv-ts`-based config schema with an Effect V4 Schema system and redesigns state management to cleanly separate committed project config, per-checkout state, and ephemeral runtime state. ## What changed ### New CLI commands | Command | Purpose | |---------|---------| | `supabase init` | Creates `supabase/config.json` with a `$schema` reference and adds `.supabase/` to `.gitignore` | | `supabase link [--project-ref]` | Binds the local project to a remote Supabase project, caches service versions in `.supabase/project.json` | | `supabase unlink` | Removes the cached remote link metadata | | `supabase stack list` | Lists all named stacks for the current project with ports and status | | `supabase stack update` | Refreshes pinned service versions from the linked project or CLI defaults | Top-level aliases `start`, `stop`, `status`, `logs` are preserved. A new `stack` command group exposes the full surface: `stack start`, `stack stop`, `stack status`, `stack list`, `stack update`. ### `@supabase/config` — Schema & IO rewrite - **Effect V4 Schema migration** — Every config section (`auth`, `db`, `api`, `storage`, `realtime`, `analytics`, `studio`, `edge_runtime`, `functions`, `experimental`, `inbucket`) rewritten from `jsonv-ts` to `Schema.Struct` with annotations for descriptions, defaults, tags, links, and secret markers. - **Dual-format config** — Loads `supabase/config.json` or `supabase/config.toml` (JSON takes precedence when both exist). Saves preserve the existing format. - **Minimal config semantics** — Default values are applied at the schema level; saved configs only include non-default values. - **Lazy `env(NAME)` resolution** — Raw configs preserve literal `env(NAME)` strings. Resolution is explicit and on-demand via `resolveProjectValue()` / `resolveProjectSubtree()`. Missing env vars produce typed `MissingProjectEnvVarError`. - **Secret redaction** — Schema annotations (`x-secret`) drive automatic wrapping in `Redacted<string>` at resolution time. - **Environment loading** — Merges `supabase/.env`, `supabase/.env.local`, and `process.env` with source tracking. - **Project discovery** — Upward filesystem walk from cwd to find `supabase/config.json` or `supabase/config.toml`. - **Platform-agnostic service layer** — `ProjectConfigStore` Effect Service with `bun.ts` and `node.ts` runtime adapters. - **JSON Schema generation** — Build script now produces `dist/schema.json` via `Schema.toJsonSchemaDocument()` for editor autocomplete. - **New entrypoints** — `@supabase/config` (core), `@supabase/config/bun`, `@supabase/config/node`. ### `@supabase/stack` — State management redesign - **Dual-file state model** — `stack.json` (durable metadata: pinned versions, ports, schema version) is separated from `state.json` (ephemeral runtime: PID, connection info, running service versions). - **`StackMetadata` schema** — New typed schema with `STACK_METADATA_SCHEMA_VERSION = 1` and version validation at read time. - **Project-scoped paths** — Stacks are now scoped to `(projectDir, stackName)` pairs instead of being globally identified. New path helpers: `projectStateManagerPaths`, `projectStateManagerPathsFromRoot`, `singleStackStateManagerPaths`. - **Stack discovery** — `listStacks()` scans metadata, overlays live state from running daemons with PID validation. `resolveStackSummary()` finds a specific stack. - **RemoteStack rewrite** — Full `Stack` service implementation over HTTP/SSE including `/status/stream`, `/logs`, `/logs/:service`, `/logs/:service/history`, with transparent interface matching in-process `LocalStack`. - **Platform entrypoints** — `bun.ts` and `node.ts` with `UnixHttpClient` abstraction for Unix socket communication. - **Metadata persistence in createStack** — Reads existing `stack.json` for port reuse across daemon restarts. ### `apps/cli` — Config infrastructure - **`ProjectContext`** — Loads project config and environment from `@supabase/config`. - **`ProjectHome`** — Centralized paths provider for all per-checkout state (`.supabase/project.json`, `stacks/<name>/stack.json`, etc.) with project root discovery. - **`ProjectLinkState`** — Persists/loads cached remote project metadata with legacy path migration. - **`ProjectLinkRemote`** — Fetches accessible projects and live service versions from platform (Management API + tenant HTTP probes for postgrest, auth, storage). - **`ProjectLocalServiceVersions`** — Loads power-user checkout-local version overrides from `.supabase/local-versions.json`. - **`ProjectStackStateManager`** — Provides `StateManager` from `@supabase/stack` wired to project-local paths. - **Service version resolution** — Three-tier precedence: per-run flags → checkout-local overrides → pinned baseline → CLI defaults. Update fingerprinting to notify once per unique diff set. - **Gitignore management** — Automatic `.supabase/` addition to `.gitignore` on `init` and `link`. ### Existing command changes - **`start`** — New flags: `--stack NAME`, `--exclude SERVICE`, `--service-version service=version`. Resolves versions via 3-tier precedence, creates/updates `stack.json` metadata, warns about active overrides and available updates. - **`stop`** — Now passes `projectDir`, `projectStateRoot`, `name` for multi-stack support. - **`status`** — Shows stack name, all service versions (sorted), update availability against candidate baseline. JSON output includes `up_to_date` boolean and structured `available_updates`. - **`logs`** — Scoped to named stack with `--stack` flag. ### State layout ``` my-project/ ├── supabase/ # committed to git │ ├── config.json # project configuration │ ├── .env # shared env vars │ └── .env.local # local-only env vars (gitignored) └── .supabase/ # gitignored, per-checkout ├── project.json # cached remote link metadata ├── local-versions.json # checkout-local version overrides └── stacks/ └── default/ ├── stack.json # pinned baseline versions + ports ├── state.json # ephemeral daemon runtime state ├── data/ # persisted service data (volumes) └── logs/ # service logs ``` ### Documentation - **New:** `apps/cli/docs/supabase-home.md` — State layout architecture and ownership rules - **New:** `packages/config/docs/project-config-loading.md` — Config discovery, loading, and resolution architecture - **Updated:** `packages/stack/docs/detach-mode.md` — Rewritten with new state model, metadata schema, and multi-stack support - **Updated:** `packages/stack/docs/service-versioning.md` — Consolidated with current TypeScript resolution model - **Updated:** `apps/cli/docs/go-cli-porting-status.md` — Reflects new commands (`init`, `link`, `unlink`, completions via framework) - **Updated:** `packages/config/README.md` — Reflects Effect Schema migration and new entrypoints ### Testing - **Integration tests** for all new commands (`init`, `link`, `unlink`, `list`, `update`) following the `it.live` + mock-layer pattern - **Integration tests** updated for refactored commands (`start`, `stop`, `status`, `logs`) - **E2e tests** for `init` and `link` (happy-path subprocess coverage) - **Unit tests** for config IO (`io.test.ts`, 676 lines), project discovery/resolution (`project.test.ts`, 311 lines), version resolution, CLI config layer, project home layer, project link state layer, local service versions layer - **Stack package** — Extended `StateManager.test.ts` (metadata ops), `discovery.test.ts` (listing/resolution), `createStack.test.ts` (metadata persistence) - **E2e cleanup** — Removed redundant platform e2e tests, consolidated startup-timing tests - **New test helpers** — `running-stack.ts` fixture builder for stack integration tests, `stack-e2e-cleanup.ts` for reliable daemon teardown | 6 个月前 | |
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 | |
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 | |
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 | |
chore(repo): refresh reference repositories (#6620) Refresh the reference repository revisions so implementation work uses current upstream sources. Effect V4 now follows the canonical `Effect-TS/effect` repository on `main`, while the V3 reference explicitly follows `v3`. Advance the other references to their upstream branch tips; `effect-patterns` already points to the latest revision. Synchronize submodule URLs before installation or updates, and initialize these top-level source references without traversing upstream development dependencies. This also avoids a broken nested-submodule mapping in the latest `t3code` reference. Document how to inspect the matching Effect release tag when upstream source is ahead of the installed dependencies. | 1 个月前 |