@rehearsal-db/core 0.1.0-beta.1 → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +244 -1
- package/COMPATIBILITY.md +17 -0
- package/README.md +139 -346
- package/SECURITY.md +2 -1
- package/SUPPORT.md +5 -0
- package/docs/README.md +29 -0
- package/docs/adapters.md +20 -6
- package/docs/architecture.md +58 -0
- package/docs/baselines.md +102 -22
- package/docs/commands.md +196 -33
- package/docs/configuration.md +258 -13
- package/docs/getting-started.md +106 -182
- package/docs/glossary.md +11 -8
- package/docs/production-source.md +176 -33
- package/docs/releasing.md +28 -38
- package/docs/roadmap.md +41 -0
- package/docs/runtime-policies.md +193 -0
- package/docs/sanitization.md +43 -8
- package/docs/security-model.md +34 -9
- package/docs/standalone-workflow.md +107 -0
- package/docs/troubleshooting.md +102 -2
- package/docs/tutorial.md +70 -59
- package/package.json +30 -22
- package/scripts/runtime/manage_database.mjs +18 -0
- package/src/README.md +17 -0
- package/src/application/session.mjs +435 -0
- package/{scripts/lib/rehearsal/baseline_artifact.mjs → src/baseline/artifact.mjs} +142 -17
- package/{scripts/lib/rehearsal/baseline_builder.mjs → src/baseline/builder.mjs} +19 -10
- package/src/baseline/input_discovery.mjs +155 -0
- package/src/baseline/policy_review.mjs +92 -0
- package/src/baseline/preparation.mjs +323 -0
- package/src/baseline/privacy_engine.mjs +413 -0
- package/{scripts/lib/rehearsal → src/baseline}/sanitization_policy.mjs +133 -3
- package/{scripts/lib/rehearsal → src/baseline}/schema_snapshot.mjs +1 -1
- package/src/cli/arguments.mjs +123 -0
- package/src/cli/guided.mjs +812 -0
- package/src/cli/rehearsal.mjs +997 -0
- package/src/cli/renderers.mjs +584 -0
- package/src/cli/runtime_commands.mjs +624 -0
- package/src/cli/source_commands.mjs +326 -0
- package/src/cli/terminal.mjs +275 -0
- package/src/identity/claim.mjs +975 -0
- package/src/identity/storage.mjs +165 -0
- package/{scripts/lib/rehearsal → src/project}/configuration.d.mts +72 -4
- package/src/project/configuration.mjs +1199 -0
- package/src/project/setup.mjs +379 -0
- package/src/project/support_report.mjs +105 -0
- package/src/runtime/cleanup.mjs +381 -0
- package/{scripts/lib/rehearsal → src/runtime}/plan.mjs +118 -20
- package/src/runtime/policy.mjs +438 -0
- package/{scripts/lib/rehearsal/runtime_restore.mjs → src/runtime/restore.mjs} +46 -27
- package/src/runtime/topology.mjs +177 -0
- package/{scripts/lib/rehearsal → src/shared}/diagnostics.mjs +10 -3
- package/src/shared/human_output.mjs +4 -0
- package/src/shared/operation_guard.mjs +162 -0
- package/{scripts/lib/rehearsal → src/shared}/process_environment.mjs +5 -1
- package/src/source/access.mjs +578 -0
- package/src/source/asset_transfer.mjs +177 -0
- package/src/source/baseline.mjs +446 -0
- package/src/source/postgresql_access.mjs +480 -0
- package/src/targets/postgresql.mjs +808 -0
- package/{scripts/operations/database/manage_rehearsal_database.mjs → src/targets/supabase.mjs} +66 -20
- package/{scripts/lib/environment/local_supabase.mjs → src/targets/supabase_environment.mjs} +60 -28
- package/src/targets/target.mjs +66 -0
- package/scripts/lib/rehearsal/configuration.mjs +0 -559
- package/scripts/operations/rehearsal/rehearsal_cli.mjs +0 -565
- /package/{scripts/lib/rehearsal → src/runtime}/migration_history.mjs +0 -0
- /package/{scripts/lib/rehearsal → src/runtime}/service_environment.mjs +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Repository architecture
|
|
2
|
+
|
|
3
|
+
Rehearsal separates shipped product code, repository automation, tests, fixtures, and
|
|
4
|
+
documentation so each file has one obvious home.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
rehearsal-db/
|
|
8
|
+
├── src/ shipped package code
|
|
9
|
+
│ ├── application/ application lifecycle and HTTP proofs
|
|
10
|
+
│ ├── baseline/ sanitized baseline creation and validation
|
|
11
|
+
│ ├── cli/ the `rehearsal` executable
|
|
12
|
+
│ ├── identity/ local account and Storage association
|
|
13
|
+
│ ├── project/ configuration, setup, and support
|
|
14
|
+
│ ├── runtime/ plans and disposable-runtime lifecycle
|
|
15
|
+
│ ├── shared/ small target-neutral utilities
|
|
16
|
+
│ ├── source/ approved source access and refresh
|
|
17
|
+
│ └── targets/ PostgreSQL and Supabase adapters
|
|
18
|
+
├── scripts/
|
|
19
|
+
│ ├── runtime/ shipped internal runtime launcher
|
|
20
|
+
│ └── verification/ repository-only package and fixture proofs
|
|
21
|
+
├── tests/
|
|
22
|
+
│ ├── unit/ mirrors the `src/` domains
|
|
23
|
+
│ ├── integration/ multi-module and terminal behavior
|
|
24
|
+
│ ├── contracts/ public documentation and package promises
|
|
25
|
+
│ └── fixtures/ disposable example projects
|
|
26
|
+
└── docs/ user and maintainer documentation
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Boundaries
|
|
30
|
+
|
|
31
|
+
- `src/` must never import from tests or repository-only verification scripts.
|
|
32
|
+
- Database-specific lifecycle behavior belongs in `src/targets/`.
|
|
33
|
+
- `scripts/verification/` is never included in the npm package.
|
|
34
|
+
- Public consumers use only the paths declared in `package.json#exports`.
|
|
35
|
+
- Unit tests mirror their source domain. Cross-domain workflows belong in
|
|
36
|
+
`tests/integration/`; durable public promises belong in `tests/contracts/`.
|
|
37
|
+
|
|
38
|
+
## CLI modules
|
|
39
|
+
|
|
40
|
+
The executable is split by responsibility so no command file becomes a second
|
|
41
|
+
application layer:
|
|
42
|
+
|
|
43
|
+
- `rehearsal.mjs` starts the process and dispatches commands.
|
|
44
|
+
- `arguments.mjs` owns the command-line contract and mutation classification.
|
|
45
|
+
- `guided.mjs` owns the interactive home screen and first-run questions.
|
|
46
|
+
- `runtime_commands.mjs` coordinates local runtimes and project proofs.
|
|
47
|
+
- `source_commands.mjs` coordinates approved source access and refresh.
|
|
48
|
+
- `renderers.mjs` formats human-readable results without changing state.
|
|
49
|
+
- `terminal.mjs` owns prompts, colors, and terminal exit behavior.
|
|
50
|
+
|
|
51
|
+
## Adding something new
|
|
52
|
+
|
|
53
|
+
1. Put policy and reusable behavior in the domain that owns it.
|
|
54
|
+
2. Put target-specific implementation behind the target boundary.
|
|
55
|
+
3. Add its focused test under the matching `tests/unit/` domain.
|
|
56
|
+
4. Add an integration or contract test only when behavior crosses domains or becomes a
|
|
57
|
+
public promise.
|
|
58
|
+
5. Update the documentation map when adding a new guide.
|
package/docs/baselines.md
CHANGED
|
@@ -1,33 +1,113 @@
|
|
|
1
1
|
# Baselines
|
|
2
2
|
|
|
3
|
-
A baseline is
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A baseline is the locked starting point for every rehearsal. It combines safe rows with
|
|
4
|
+
the exact historical migrations that created their schema. Resetting the runtime always
|
|
5
|
+
returns to this point.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Required inputs
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
and made read-only. A complete manifest is verified before an atomic `current` symlink
|
|
11
|
-
selects the generation. An interrupted build cannot replace the active baseline.
|
|
9
|
+
### Records
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Records use NDJSON: one complete JSON object per line. Each object names a table and one
|
|
12
|
+
safe row.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
```json
|
|
15
|
+
{ "table": "widgets", "row": { "id": 1, "name": "Synthetic Widget" } }
|
|
16
|
+
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
`public` is the default schema. Name another schema explicitly when needed:
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"schema": "app_api",
|
|
23
|
+
"table": "publication_products",
|
|
24
|
+
"row": { "id": 1 }
|
|
25
|
+
}
|
|
26
|
+
```
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Use the same optional `schema` on that table in the sanitization policy. Rehearsal keeps
|
|
29
|
+
same-named tables in different schemas separate. An undeclared schema or table is
|
|
30
|
+
rejected.
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`reset` to discard sandbox changes and return to the exact baseline.
|
|
32
|
+
Use synthetic or reviewed sanitized values. A `.json` array is not NDJSON and will be
|
|
33
|
+
rejected.
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
### Migration ledger
|
|
36
|
+
|
|
37
|
+
The ledger is a JSON array in migration order:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
[
|
|
41
|
+
{
|
|
42
|
+
"version": "20260101000000",
|
|
43
|
+
"name": "create_widgets",
|
|
44
|
+
"statements": [
|
|
45
|
+
"create table public.widgets (id bigint primary key, name text not null)"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Each entry must match the version, name, order, and SQL represented by the historical
|
|
52
|
+
migration. Equivalent-looking SQL is not enough. Generate this evidence with reviewed
|
|
53
|
+
project tooling for a real migration history; do not reconstruct a large ledger by hand.
|
|
54
|
+
|
|
55
|
+
### Sanitization policy
|
|
56
|
+
|
|
57
|
+
The policy records the approved treatment of every included table and column. The guide
|
|
58
|
+
can create a shape-only draft from the records and walk you through its review. A draft
|
|
59
|
+
with undecided fields cannot become a baseline. See [Sanitization](sanitization.md).
|
|
60
|
+
|
|
61
|
+
### Storage manifest (optional)
|
|
62
|
+
|
|
63
|
+
Supabase projects may include a bounded set of approved local Storage files. Plain
|
|
64
|
+
PostgreSQL projects do not support Supabase Storage. Every file is checksum-verified and
|
|
65
|
+
must remain inside the project.
|
|
66
|
+
|
|
67
|
+
## Create a baseline
|
|
68
|
+
|
|
69
|
+
The guided action is recommended:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx rehearsal
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For automation, use explicit safe local paths:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx rehearsal baseline create \
|
|
79
|
+
--records=rehearsal/sanitized-data.ndjson \
|
|
80
|
+
--ledger=rehearsal/migration-ledger.json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Add `--assets=rehearsal/assets.json` only when using approved Supabase Storage files.
|
|
84
|
+
Rehearsal validates everything and shows counts before activation. These commands read
|
|
85
|
+
project-local files only.
|
|
86
|
+
|
|
87
|
+
The separately enabled `baseline refresh` command can stream a reviewed source through
|
|
88
|
+
privacy policy version 2. It stages a private generation, verifies capacity, counts,
|
|
89
|
+
checksums, source schema, migration evidence, privacy coverage, and drift, then switches
|
|
90
|
+
the active symlink atomically. Failure or interruption removes the staged generation and
|
|
91
|
+
preserves the prior active baseline and edited runtime.
|
|
92
|
+
|
|
93
|
+
## Why historical migrations are locked
|
|
94
|
+
|
|
95
|
+
The baseline records the exact ordered historical migration files. If a file keeps the
|
|
96
|
+
same timestamp but its bytes change, Rehearsal reports modified history instead of
|
|
97
|
+
treating it as a new candidate. New migrations must form an ordered suffix after the
|
|
98
|
+
baseline cutoff.
|
|
99
|
+
|
|
100
|
+
## What reset does
|
|
101
|
+
|
|
102
|
+
`reset` removes only the exactly labeled local runtime, rebuilds the represented schema,
|
|
103
|
+
loads the safe rows, restores approved Storage files when present, and verifies counts and
|
|
104
|
+
relationships. A failed restore cannot produce a successful receipt.
|
|
105
|
+
|
|
106
|
+
The baseline itself never changes during normal use. Runtime edits persist until you
|
|
107
|
+
reset or discard that runtime.
|
|
108
|
+
|
|
109
|
+
## Storage and privacy
|
|
110
|
+
|
|
111
|
+
Baseline files can still be sensitive after sanitization. Rehearsal stores them under the
|
|
112
|
+
ignored `.rehearsal/` directory with checksums and read-only files. Keep them off shared
|
|
113
|
+
drives, use encrypted disks, retain them only as long as needed, and never commit them.
|
package/docs/commands.md
CHANGED
|
@@ -1,35 +1,198 @@
|
|
|
1
1
|
# CLI commands
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
| `rehearsal
|
|
24
|
-
| `rehearsal
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`baseline create
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
Run commands from the project directory containing `rehearsal.config.mjs`. The examples
|
|
4
|
+
use `npx`, so a global install is not required.
|
|
5
|
+
|
|
6
|
+
## Guided mode
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx rehearsal
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The guide reads the current project state and recommends the next useful action. It stays
|
|
13
|
+
open after each action. Press `Ctrl+Z` at a prompt to exit the entire session.
|
|
14
|
+
|
|
15
|
+
Use `npx rehearsal guide` for the same screen or add `--plain` to use numbered menus
|
|
16
|
+
without decorative terminal styling. When input or output is not an interactive terminal,
|
|
17
|
+
bare `npx rehearsal` prints help instead of waiting for input.
|
|
18
|
+
|
|
19
|
+
## Setup and baseline
|
|
20
|
+
|
|
21
|
+
| Command | What it does |
|
|
22
|
+
| ----------------------------------------------------------------- | ------------------------------------------------------ |
|
|
23
|
+
| `npx rehearsal setup --target=supabase` | Preview Supabase setup files. |
|
|
24
|
+
| `npx rehearsal setup --target=postgresql` | Preview PostgreSQL setup files. |
|
|
25
|
+
| Add `--write` to either setup command | Create the previewed files without overwriting. |
|
|
26
|
+
| `npx rehearsal init` | Preview only `rehearsal.config.mjs`. |
|
|
27
|
+
| `npx rehearsal init --write` | Create only `rehearsal.config.mjs`. |
|
|
28
|
+
| `npx rehearsal baseline prepare --records=<path> --ledger=<path>` | Preview a sanitization-policy draft. |
|
|
29
|
+
| Add `--write` to `baseline prepare` | Write the draft for human review. |
|
|
30
|
+
| `npx rehearsal baseline create --records=<path> --ledger=<path>` | Create and activate a baseline from safe local inputs. |
|
|
31
|
+
|
|
32
|
+
Add `--assets=<manifest.json>` to `baseline create` only for approved local Supabase
|
|
33
|
+
Storage files. `baseline create` and `baseline prepare` are local-only.
|
|
34
|
+
|
|
35
|
+
## Optional source preparation
|
|
36
|
+
|
|
37
|
+
These commands are separate from ordinary rehearsals. Configure `preparation` only after
|
|
38
|
+
reviewing [the standalone security contract](standalone-workflow.md).
|
|
39
|
+
|
|
40
|
+
| Command | What it does |
|
|
41
|
+
| ------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
42
|
+
| `npx rehearsal privacy key` | Preview the owner-only pseudonym-key path. |
|
|
43
|
+
| `npx rehearsal privacy key --write` | Create the key once; refuses to replace an existing key. |
|
|
44
|
+
| `npx rehearsal source plan` | Preview the exact temporary reader, views, columns, and asset scope. |
|
|
45
|
+
| `npx rehearsal source apply --confirm-source-access=<sha256>` | Create only the reviewed, time-limited source access. |
|
|
46
|
+
| `npx rehearsal baseline refresh` | Replace only the baseline from a reviewed source. |
|
|
47
|
+
| `npx rehearsal refresh` | Preview a complete safe refresh of the baseline and local runtime. |
|
|
48
|
+
| Add `--confirm-refresh=<sha256>` | Create the replacement, reset locally, and prune listed old copies. |
|
|
49
|
+
| `npx rehearsal source retire` | Preview exact reader/view/credential retirement. |
|
|
50
|
+
| Add `--confirm-source-retirement=<sha256>` | Apply that retirement plan and verify the exact object inventory. |
|
|
51
|
+
|
|
52
|
+
Source credentials are read from environment variables named in the reviewed source
|
|
53
|
+
policy. Never paste a connection string into an argument. `baseline refresh` leaves the
|
|
54
|
+
previous active baseline and edited runtime untouched when it fails. It does not reset
|
|
55
|
+
the runtime.
|
|
56
|
+
|
|
57
|
+
Use `refresh` for the normal end-to-end job. It first previews the exact source receipt,
|
|
58
|
+
configuration receipts, runtime targets, retention rule, and old generations that may be
|
|
59
|
+
removed. After exact confirmation, it builds and verifies a replacement beside the
|
|
60
|
+
current baseline, resets the complete local runtime stack, then removes only the listed
|
|
61
|
+
old generations. If replacement or runtime verification fails, Rehearsal reactivates the
|
|
62
|
+
previous baseline and restores the previous runtime. Source-access retirement remains a
|
|
63
|
+
separate approval.
|
|
64
|
+
|
|
65
|
+
In short: `refresh` gets a new source copy; `reset` restores the copy you already have;
|
|
66
|
+
`run` tests pending migrations against that copy.
|
|
67
|
+
|
|
68
|
+
## Local identity association
|
|
69
|
+
|
|
70
|
+
For a reviewed Google identity, use this sequence:
|
|
71
|
+
|
|
72
|
+
1. Run a successful rehearsal, then start the persistent app:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx rehearsal open
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Open the printed local URL and complete the normal Google sign-in. Press `Ctrl+C`
|
|
79
|
+
after the callback returns. This closes only the app; the databases and Storage stay
|
|
80
|
+
running with their current data.
|
|
81
|
+
|
|
82
|
+
3. Preview and confirm the reviewed association:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx rehearsal identity plan --identity=approved-owner
|
|
86
|
+
npx rehearsal identity claim --identity=approved-owner \
|
|
87
|
+
--confirm-identity=<sha256>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
4. Run `npx rehearsal open` again. Sign out and sign in again so the browser receives a
|
|
91
|
+
fresh session, then check the copied account. Rehearsal does not bypass application
|
|
92
|
+
role checks, account blocks, RLS, or MFA.
|
|
93
|
+
|
|
94
|
+
The first command shows only hashes and declared reference counts. The second updates
|
|
95
|
+
only the reviewed local relational, JSON, Storage-owner, and claim locations in one
|
|
96
|
+
transaction. It rejects hosted database URLs, wrong or unverified people, ambiguity, and
|
|
97
|
+
stale confirmation digests.
|
|
98
|
+
|
|
99
|
+
If a runtime-policy seed moves with that identity, declare its `identityAssociation` in
|
|
100
|
+
the runtime policy. Later `verify` calls then require the transferred row instead of the
|
|
101
|
+
obsolete placeholder key.
|
|
102
|
+
|
|
103
|
+
## Check and inspect
|
|
104
|
+
|
|
105
|
+
| Command | What it does |
|
|
106
|
+
| ---------------------------------- | ----------------------------------------------------- |
|
|
107
|
+
| `npx rehearsal doctor` | Check dependencies, inputs, and safety rules. |
|
|
108
|
+
| `npx rehearsal support` | Print a privacy-safe report for a support request. |
|
|
109
|
+
| `npx rehearsal explain` | Show the exact plan without changing anything. |
|
|
110
|
+
| `npx rehearsal run --dry-run` | Show the same non-mutating plan. |
|
|
111
|
+
| `npx rehearsal candidates` | List pending migrations and their approval digest. |
|
|
112
|
+
| `npx rehearsal inspect baseline` | Show baseline metadata without row values. |
|
|
113
|
+
| `npx rehearsal inspect migrations` | Classify every historical and candidate migration. |
|
|
114
|
+
| `npx rehearsal status` | Report baseline, candidates, and local runtime state. |
|
|
115
|
+
|
|
116
|
+
State-reporting commands accept `--json` for scripts. Scripts should use the JSON fields
|
|
117
|
+
and process exit code, not parse human-facing text.
|
|
118
|
+
|
|
119
|
+
## Run and manage the local sandbox
|
|
120
|
+
|
|
121
|
+
| Command | What it does |
|
|
122
|
+
| ----------------------------------------------------- | ------------------------------------------------------------------- |
|
|
123
|
+
| `npx rehearsal run --confirm-candidates=<sha256>` | Reset, apply exact candidates, launch the app, and run its proofs. |
|
|
124
|
+
| `npx rehearsal open` | Start, verify, and keep the configured application open. |
|
|
125
|
+
| `npx rehearsal migrate --confirm-candidates=<sha256>` | Apply the exact candidates without resetting existing runtime data. |
|
|
126
|
+
| `npx rehearsal start` | Start an existing verified runtime. |
|
|
127
|
+
| `npx rehearsal verify` | Verify the current runtime and receipt. |
|
|
128
|
+
| `npx rehearsal reset` | Discard runtime edits and restore the baseline. |
|
|
129
|
+
| `npx rehearsal stop` | Stop the runtime but keep its local state. |
|
|
130
|
+
| `npx rehearsal discard` | Remove this project's disposable runtime and volume. |
|
|
131
|
+
| `npx rehearsal cleanup` | Preview conservative cleanup without removing anything. |
|
|
132
|
+
|
|
133
|
+
In a terminal, the guide displays candidate filenames and asks for confirmation. In a
|
|
134
|
+
script, copy the digest from `candidates` into `--confirm-candidates`. Adding, removing,
|
|
135
|
+
reordering, or editing a migration changes that digest.
|
|
136
|
+
|
|
137
|
+
`open` does not reset the runtime or apply migrations. It starts and verifies every
|
|
138
|
+
configured database target, runs dependent preparation commands, and launches
|
|
139
|
+
`application.startCommand` with the declared local environment mappings. It waits for
|
|
140
|
+
`application.readiness`, then stays attached until `Ctrl+C` or `Ctrl+Z`. On exit it stops
|
|
141
|
+
only the application process group it launched. Use `stop` separately when you also want
|
|
142
|
+
to stop the databases; a later `open` preserves their database and Storage changes.
|
|
143
|
+
|
|
144
|
+
## Clean up disk space
|
|
145
|
+
|
|
146
|
+
Start with a preview:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx rehearsal cleanup
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
By default, cleanup selects only old baseline generations beyond the retention setting
|
|
153
|
+
in `rehearsal.config.mjs`. Add options to broaden the preview:
|
|
154
|
+
|
|
155
|
+
| Command option | Additional resources considered |
|
|
156
|
+
| ------------------- | ---------------------------------------------------------------------- |
|
|
157
|
+
| `--include-runtime` | This project's disposable runtime and its database volumes. |
|
|
158
|
+
| `--include-images` | Older unused Supabase images; the newest image for each service stays. |
|
|
159
|
+
| `--write` | Apply the exact freshly verified preview. |
|
|
160
|
+
| `--confirm-cleanup` | Full cleanup digest printed by the preview; required with `--write`. |
|
|
161
|
+
|
|
162
|
+
Image cleanup never removes an image used by any running or stopped container and never
|
|
163
|
+
runs a global Docker prune. Images may be shared by projects and can be downloaded again,
|
|
164
|
+
so they remain excluded unless you explicitly add `--include-images`. Database volumes
|
|
165
|
+
belonging to other projects are never included. This follows
|
|
166
|
+
[Docker's conservative pruning guidance](https://docs.docker.com/engine/manage-resources/pruning/).
|
|
167
|
+
|
|
168
|
+
## Common options
|
|
169
|
+
|
|
170
|
+
| Option | Meaning |
|
|
171
|
+
| -------------------------------------- | ---------------------------------------------------------------- |
|
|
172
|
+
| `--json` | Return the versioned machine-readable result. |
|
|
173
|
+
| `--verbose` | Show more safe detail. |
|
|
174
|
+
| `--debug` | Show the most diagnostic detail; still review it before sharing. |
|
|
175
|
+
| `--plain` | Disable decorative interactive prompts. |
|
|
176
|
+
| `--config=<path>` | Use only this config for planning and every runtime action. |
|
|
177
|
+
| `--target=supabase\|postgresql` | Choose the setup target. |
|
|
178
|
+
| `--include-runtime` | Include this project's runtime in a cleanup preview. |
|
|
179
|
+
| `--include-images` | Include older unused Supabase images in a cleanup preview. |
|
|
180
|
+
| `--confirm-cleanup=<digest>` | Confirm the exact cleanup set printed by the preview. |
|
|
181
|
+
| `--confirm-source-access=<digest>` | Confirm one exact temporary source-access plan. |
|
|
182
|
+
| `--confirm-source-retirement=<digest>` | Confirm exact source-access retirement. |
|
|
183
|
+
| `--confirm-refresh=<digest>` | Confirm an exact refresh, runtime reset, and old-copy removal. |
|
|
184
|
+
| `--identity=<name>` | Choose one declared local identity association. |
|
|
185
|
+
| `--confirm-identity=<digest>` | Confirm that exact local identity plan. |
|
|
186
|
+
| `--write` | Apply a setup, policy, or cleanup preview. |
|
|
187
|
+
|
|
188
|
+
Run `npx rehearsal --help` to print the command list available in your installed version.
|
|
189
|
+
|
|
190
|
+
When a project has more than one config, pass `--config=<path>` on every command for the
|
|
191
|
+
non-default one. Rehearsal keeps that exact config selected through status, run, reset,
|
|
192
|
+
start, migrate, verify, stop, discard, and cleanup; it will not fall back to
|
|
193
|
+
`rehearsal.config.mjs` during a runtime action.
|
|
194
|
+
|
|
195
|
+
When the selected config declares `dependentTargets`, the ordinary `doctor`, `explain`,
|
|
196
|
+
`candidates`, `run`, `start`, `migrate`, `reset`, `status`, `verify`, `stop`, `discard`,
|
|
197
|
+
and `cleanup` commands cover the complete runtime stack. Candidate and cleanup changes
|
|
198
|
+
use one combined digest, so automation approves the exact cross-target set.
|