@rehearsal-db/core 0.1.0-beta.7 → 0.1.0-beta.8

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 CHANGED
@@ -5,6 +5,14 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [0.1.0-beta.8] - 2026-10-02
9
+
10
+ ### Fixed
11
+
12
+ - Lifecycle commands now preserve an explicit `--config=<path>` through runtime
13
+ selection and execution. A command cannot silently operate on the default config's
14
+ baseline, runtime identity, ports, or cleanup target instead.
15
+
8
16
  ## [0.1.0-beta.7] - 2026-10-02
9
17
 
10
18
  ### Added
@@ -194,7 +202,8 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
194
202
  publication uses short-lived trusted OIDC, and every release tag must already exist on
195
203
  protected `main`.
196
204
 
197
- [Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.7...HEAD
205
+ [Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.8...HEAD
206
+ [0.1.0-beta.8]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.7...v0.1.0-beta.8
198
207
  [0.1.0-beta.7]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.6...v0.1.0-beta.7
199
208
  [0.1.0-beta.6]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.5...v0.1.0-beta.6
200
209
  [0.1.0-beta.5]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.4...v0.1.0-beta.5
package/docs/commands.md CHANGED
@@ -97,7 +97,7 @@ belonging to other projects are never included. This follows
97
97
  | `--verbose` | Show more safe detail. |
98
98
  | `--debug` | Show the most diagnostic detail; still review it before sharing. |
99
99
  | `--plain` | Disable decorative interactive prompts. |
100
- | `--config=<path>` | Use a specific config file inside the project. |
100
+ | `--config=<path>` | Use only this config for planning and every runtime action. |
101
101
  | `--target=supabase\|postgresql` | Choose the setup target. |
102
102
  | `--include-runtime` | Include this project's runtime in a cleanup preview. |
103
103
  | `--include-images` | Include older unused Supabase images in a cleanup preview. |
@@ -105,3 +105,8 @@ belonging to other projects are never included. This follows
105
105
  | `--write` | Apply a setup, policy, or cleanup preview. |
106
106
 
107
107
  Run `npx rehearsal --help` to print the command list available in your installed version.
108
+
109
+ When a project has more than one config, pass `--config=<path>` on every command for the
110
+ non-default one. Rehearsal keeps that exact config selected through status, run, reset,
111
+ start, migrate, verify, stop, discard, and cleanup; it will not fall back to
112
+ `rehearsal.config.mjs` during a runtime action.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rehearsal-db/core",
3
- "version": "0.1.0-beta.7",
3
+ "version": "0.1.0-beta.8",
4
4
  "private": false,
5
5
  "description": "Safely rehearse PostgreSQL and Supabase migrations against sanitized, production-shaped data.",
6
6
  "repository": {
@@ -7,7 +7,7 @@
7
7
  import { createHash } from "node:crypto";
8
8
 
9
9
  export const REHEARSAL_RESULT_VERSION = 1;
10
- export const REHEARSAL_VERSION = "0.1.0-beta.7";
10
+ export const REHEARSAL_VERSION = "0.1.0-beta.8";
11
11
 
12
12
  export const REHEARSAL_EXIT_CODES = Object.freeze({
13
13
  success: 0,
@@ -28,10 +28,13 @@ import {
28
28
  } from "../rehearsal/runtime_restore.mjs";
29
29
  import { readBoundRuntimeSanitizationPolicy } from "../rehearsal/sanitization_policy.mjs";
30
30
  import { ensureLocalContainerRuntime } from "../environment/local_supabase.mjs";
31
+ import { parseRuntimeInvocation } from "./runtime_target.mjs";
31
32
 
32
33
  const repositoryRoot = process.cwd();
34
+ const invocation = parseRuntimeInvocation();
33
35
  const loadedConfiguration = await loadRehearsalConfig({
34
36
  projectRoot: repositoryRoot,
37
+ configPath: invocation.configPath,
35
38
  });
36
39
  const { config, paths: configuredPaths } = loadedConfiguration;
37
40
  const artifactRoot = configuredPaths.artifactDirectory;
@@ -51,7 +54,7 @@ const image = config.postgresql.image;
51
54
  const database = config.postgresql.database;
52
55
  const databaseUser = config.postgresql.user;
53
56
  const databasePort = config.runtime.ports.database;
54
- const action = process.argv[2] ?? "status";
57
+ const action = invocation.action;
55
58
  const applicationMigrations = new URL(
56
59
  "./",
57
60
  pathToFileURL(`${configuredPaths.migrationDirectory}/`),
@@ -650,9 +653,7 @@ const migrateRuntime = async () => {
650
653
  const { baseline } = await readActive();
651
654
  await startRuntime();
652
655
  const receipt = await readCandidateReceipt(baseline);
653
- const confirmation = process.argv
654
- .find((argument) => argument.startsWith("--confirm-candidates="))
655
- ?.slice("--confirm-candidates=".length);
656
+ const confirmation = invocation.confirmation;
656
657
  if (confirmation !== receipt.candidateSha256) {
657
658
  throw new Error(
658
659
  "Candidate migration confirmation is missing or does not match the exact SHA-256.",
@@ -17,6 +17,31 @@ const TARGETS = Object.freeze({
17
17
 
18
18
  export const REHEARSAL_RUNTIME_TARGETS = Object.freeze(Object.keys(TARGETS));
19
19
 
20
+ export const parseRuntimeInvocation = (arguments_ = process.argv.slice(2)) => {
21
+ const action = arguments_.find((argument) => !argument.startsWith("--"));
22
+ const valueAfter = (prefix) =>
23
+ arguments_
24
+ .find((argument) => argument.startsWith(prefix))
25
+ ?.slice(prefix.length);
26
+ return Object.freeze({
27
+ action: action ?? "status",
28
+ configPath: valueAfter("--config="),
29
+ confirmation: valueAfter("--confirm-candidates="),
30
+ });
31
+ };
32
+
33
+ export const buildRuntimeManagerArguments = ({
34
+ managerPath,
35
+ action,
36
+ configPath,
37
+ confirmation,
38
+ }) => [
39
+ managerPath,
40
+ action,
41
+ ...(configPath ? [`--config=${configPath}`] : []),
42
+ ...(confirmation ? [`--confirm-candidates=${confirmation}`] : []),
43
+ ];
44
+
20
45
  export const resolveRuntimeTarget = (value = "supabase") => {
21
46
  if (typeof value !== "string" || !Object.hasOwn(TARGETS, value)) {
22
47
  throw new Error(
@@ -50,10 +50,13 @@ import {
50
50
  compareProductionSchemaDumps,
51
51
  } from "../rehearsal/schema_snapshot.mjs";
52
52
  import { formatCount } from "../rehearsal/human_output.mjs";
53
+ import { parseRuntimeInvocation } from "./runtime_target.mjs";
53
54
 
54
55
  const repositoryRoot = process.cwd();
56
+ const invocation = parseRuntimeInvocation();
55
57
  const loadedConfiguration = await loadRehearsalConfig({
56
58
  projectRoot: repositoryRoot,
59
+ configPath: invocation.configPath,
57
60
  });
58
61
  const { config, paths: configuredPaths } = loadedConfiguration;
59
62
  const artifactRoot = configuredPaths.artifactDirectory;
@@ -76,7 +79,7 @@ const runtimeAdapter = configuredPaths.runtimeAdapter
76
79
  ? await import(pathToFileURL(configuredPaths.runtimeAdapter).href)
77
80
  : null;
78
81
  const environmentKeyPattern = /^[A-Z][A-Z0-9_]*$/u;
79
- const action = process.argv[2] ?? "status";
82
+ const action = invocation.action;
80
83
 
81
84
  const readServiceEnvironment = () =>
82
85
  readRehearsalServiceEnvironment({
@@ -662,9 +665,7 @@ const migrateRuntime = async () => {
662
665
  console.log(
663
666
  `${receipt.candidates.length === 1 ? "Candidate migration" : "Candidate migrations"} (${receipt.candidateSha256}): ${receipt.candidates.map((candidate) => candidate.filename).join(", ")}`,
664
667
  );
665
- const confirmation = process.argv
666
- .find((argument) => argument.startsWith("--confirm-candidates="))
667
- ?.slice("--confirm-candidates=".length);
668
+ const confirmation = invocation.confirmation;
668
669
  if (confirmation !== receipt.candidateSha256) {
669
670
  throw new Error(
670
671
  "Candidate migration confirmation is missing or does not match the exact SHA-256.",
@@ -5,7 +5,14 @@
5
5
  */
6
6
 
7
7
  import { loadRehearsalConfig } from "../../lib/rehearsal/configuration.mjs";
8
- import { runRuntimeTarget } from "../../lib/runtime/runtime_target.mjs";
8
+ import {
9
+ parseRuntimeInvocation,
10
+ runRuntimeTarget,
11
+ } from "../../lib/runtime/runtime_target.mjs";
9
12
 
10
- const { config } = await loadRehearsalConfig({ projectRoot: process.cwd() });
13
+ const invocation = parseRuntimeInvocation();
14
+ const { config } = await loadRehearsalConfig({
15
+ projectRoot: process.cwd(),
16
+ configPath: invocation.configPath,
17
+ });
11
18
  await runRuntimeTarget(config.runtime.target);
@@ -60,6 +60,7 @@ import {
60
60
  applyRehearsalCleanup,
61
61
  planRehearsalCleanup,
62
62
  } from "../../lib/rehearsal/cleanup.mjs";
63
+ import { buildRuntimeManagerArguments } from "../../lib/runtime/runtime_target.mjs";
63
64
 
64
65
  const packageRoot = fileURLToPath(new URL("../../..", import.meta.url));
65
66
  const projectRoot = process.cwd();
@@ -1283,10 +1284,12 @@ const emit = ({ command, data, flags, render, status = "success" }) => {
1283
1284
  };
1284
1285
 
1285
1286
  const runManager = ({ action, flags }) => {
1286
- const args = [managerPath, action];
1287
- if (flags.confirmation) {
1288
- args.push(`--confirm-candidates=${flags.confirmation}`);
1289
- }
1287
+ const args = buildRuntimeManagerArguments({
1288
+ managerPath,
1289
+ action,
1290
+ configPath: flags.configPath,
1291
+ confirmation: flags.confirmation,
1292
+ });
1290
1293
  const environment = Object.fromEntries(
1291
1294
  [
1292
1295
  "CI",