@rehearsal-db/core 0.1.0-beta.15 → 0.1.0-beta.17

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/dist/package.json +10 -9
  3. package/dist/src/application/interactive_task.d.mts +30 -0
  4. package/dist/src/application/interactive_task.mjs +83 -0
  5. package/dist/src/application/session.d.mts +1 -0
  6. package/dist/src/baseline/privacy_contract.d.mts +147 -0
  7. package/dist/src/baseline/privacy_contract.mjs +2 -0
  8. package/dist/src/baseline/privacy_dependency_graph.d.mts +7 -0
  9. package/dist/src/baseline/privacy_dependency_graph.mjs +110 -0
  10. package/dist/src/baseline/privacy_engine.d.mts +5 -162
  11. package/dist/src/baseline/privacy_engine.mjs +4 -1162
  12. package/dist/src/baseline/privacy_key.d.mts +7 -0
  13. package/dist/src/baseline/privacy_key.mjs +42 -0
  14. package/dist/src/baseline/privacy_pipeline.d.mts +7 -0
  15. package/dist/src/baseline/privacy_pipeline.mjs +127 -0
  16. package/dist/src/baseline/privacy_policy.d.mts +6 -0
  17. package/dist/src/baseline/privacy_policy.mjs +237 -0
  18. package/dist/src/baseline/privacy_recipe_validation.d.mts +5 -0
  19. package/dist/src/baseline/privacy_recipe_validation.mjs +289 -0
  20. package/dist/src/baseline/privacy_rule_registry.d.mts +18 -0
  21. package/dist/src/baseline/privacy_rule_registry.mjs +143 -0
  22. package/dist/src/baseline/privacy_transforms.d.mts +18 -0
  23. package/dist/src/baseline/privacy_transforms.mjs +142 -0
  24. package/dist/src/baseline/privacy_validation_shared.d.mts +31 -0
  25. package/dist/src/baseline/privacy_validation_shared.mjs +127 -0
  26. package/dist/src/cli/application_command_handlers.d.mts +8 -0
  27. package/dist/src/cli/application_command_handlers.mjs +52 -0
  28. package/dist/src/cli/arguments.d.mts +0 -5
  29. package/dist/src/cli/arguments.mjs +2 -7
  30. package/dist/src/cli/basic_command_handlers.d.mts +4 -0
  31. package/dist/src/cli/basic_command_handlers.mjs +57 -0
  32. package/dist/src/cli/cli_commands.d.mts +14 -0
  33. package/dist/src/cli/cli_commands.mjs +34 -0
  34. package/dist/src/cli/command_contract.d.mts +57 -0
  35. package/dist/src/cli/command_contract.mjs +39 -0
  36. package/dist/src/cli/command_output.d.mts +12 -0
  37. package/dist/src/cli/command_output.mjs +20 -0
  38. package/dist/src/cli/command_registry.d.mts +7 -0
  39. package/dist/src/cli/command_registry.mjs +14 -0
  40. package/dist/src/cli/guided.d.mts +3 -1
  41. package/dist/src/cli/guided.mjs +21 -7
  42. package/dist/src/cli/identity_command_handlers.d.mts +12 -0
  43. package/dist/src/cli/identity_command_handlers.mjs +239 -0
  44. package/dist/src/cli/identity_renderer.d.mts +8 -0
  45. package/dist/src/cli/identity_renderer.mjs +33 -0
  46. package/dist/src/cli/init_command.d.mts +1 -1
  47. package/dist/src/cli/inspection_command_handlers.d.mts +3 -0
  48. package/dist/src/cli/inspection_command_handlers.mjs +79 -0
  49. package/dist/src/cli/project_command_handlers.d.mts +11 -0
  50. package/dist/src/cli/project_command_handlers.mjs +92 -0
  51. package/dist/src/cli/project_commands.d.mts +131 -5
  52. package/dist/src/cli/project_commands.mjs +17 -8
  53. package/dist/src/cli/rehearsal.d.mts +2 -2
  54. package/dist/src/cli/rehearsal.mjs +51 -567
  55. package/dist/src/cli/runtime_action_handlers.d.mts +12 -0
  56. package/dist/src/cli/runtime_action_handlers.mjs +201 -0
  57. package/dist/src/cli/runtime_commands.d.mts +32 -3
  58. package/dist/src/cli/runtime_commands.mjs +33 -13
  59. package/dist/src/cli/source_command_handlers.d.mts +8 -0
  60. package/dist/src/cli/source_command_handlers.mjs +62 -0
  61. package/dist/src/cli/source_commands.d.mts +5 -1
  62. package/dist/src/cli/source_commands.mjs +3 -1
  63. package/dist/src/identity/claim.d.mts +5 -144
  64. package/dist/src/identity/claim.mjs +4 -947
  65. package/dist/src/identity/claim_contract.d.mts +135 -0
  66. package/dist/src/identity/claim_contract.mjs +6 -0
  67. package/dist/src/identity/claim_executor.d.mts +10 -0
  68. package/dist/src/identity/claim_executor.mjs +358 -0
  69. package/dist/src/identity/claim_identity_lookup.d.mts +23 -0
  70. package/dist/src/identity/claim_identity_lookup.mjs +134 -0
  71. package/dist/src/identity/claim_plan.d.mts +8 -0
  72. package/dist/src/identity/claim_plan.mjs +61 -0
  73. package/dist/src/identity/claim_policy.d.mts +3 -0
  74. package/dist/src/identity/claim_policy.mjs +377 -0
  75. package/dist/src/identity/claim_sql.d.mts +10 -0
  76. package/dist/src/identity/claim_sql.mjs +46 -0
  77. package/dist/src/identity/claim_verification.d.mts +13 -0
  78. package/dist/src/identity/claim_verification.mjs +35 -0
  79. package/dist/src/identity/connect.d.mts +30 -0
  80. package/dist/src/identity/connect.mjs +111 -0
  81. package/dist/src/index.d.mts +1 -1
  82. package/dist/src/project/configuration.d.mts +11 -179
  83. package/dist/src/project/configuration.mjs +7 -956
  84. package/dist/src/project/configuration_contract.d.mts +125 -0
  85. package/dist/src/project/configuration_contract.mjs +27 -0
  86. package/dist/src/project/configuration_discovery.d.mts +7 -0
  87. package/dist/src/project/configuration_discovery.mjs +37 -0
  88. package/dist/src/project/configuration_normalization.d.mts +107 -0
  89. package/dist/src/project/configuration_normalization.mjs +302 -0
  90. package/dist/src/project/configuration_rendering.d.mts +14 -0
  91. package/dist/src/project/configuration_rendering.mjs +226 -0
  92. package/dist/src/project/configuration_resolution.d.mts +125 -0
  93. package/dist/src/project/configuration_resolution.mjs +81 -0
  94. package/dist/src/project/configuration_schema.d.mts +22 -0
  95. package/dist/src/project/configuration_schema.mjs +160 -0
  96. package/dist/src/project/configuration_validation.d.mts +22 -0
  97. package/dist/src/project/configuration_validation.mjs +136 -0
  98. package/dist/src/project/project_detection.d.mts +14 -0
  99. package/dist/src/project/project_detection.mjs +47 -0
  100. package/dist/src/runtime/lifecycle_engine.d.mts +63 -0
  101. package/dist/src/runtime/lifecycle_engine.mjs +114 -0
  102. package/dist/src/runtime/plan.mjs +2 -1
  103. package/dist/src/targets/postgresql.mjs +142 -163
  104. package/dist/src/targets/supabase.mjs +142 -174
  105. package/docs/architecture.md +120 -3
  106. package/docs/commands.md +18 -15
  107. package/docs/configuration.md +1 -0
  108. package/docs/releasing.md +8 -3
  109. package/docs/runtime-policies.md +12 -3
  110. package/docs/troubleshooting.md +17 -0
  111. package/docs/typescript.md +57 -10
  112. package/package.json +10 -9
  113. package/types/configuration.d.mts +5 -164
@@ -10,14 +10,14 @@ import { runRehearsalDoctor } from "../runtime/plan.mjs";
10
10
  import { loadRuntimeTopology } from "../runtime/topology.mjs";
11
11
  const isCleanupStackPlan = (plan) => "targets" in plan;
12
12
  export const createProjectCommands = ({ projectRoot, runManager, }) => {
13
- const runSetup = async ({ flags, planOptions, }) => {
13
+ const runSetup = async ({ flags, planOptions, session, }) => {
14
14
  const setupTarget = flags.target === "supabase" || flags.target === "postgresql"
15
15
  ? flags.target
16
16
  : undefined;
17
17
  if (flags.target !== undefined && setupTarget === undefined) {
18
18
  throw new Error("--target must be supabase or postgresql.");
19
19
  }
20
- const plan = flags.setupPlan ??
20
+ const plan = session?.setupPlan ??
21
21
  (await planRehearsalSetup({
22
22
  projectRoot,
23
23
  ...(planOptions.configPath === undefined
@@ -49,11 +49,11 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
49
49
  ].join("\n"),
50
50
  };
51
51
  };
52
- const runBaselinePreparation = async ({ flags, planOptions, }) => {
52
+ const runBaselinePreparation = async ({ flags, planOptions, session, }) => {
53
53
  if (!flags.recordsPath || !flags.ledgerPath) {
54
54
  throw new Error("baseline prepare requires --records and --ledger input paths.");
55
55
  }
56
- const plan = flags.preparationPlan ??
56
+ const plan = session?.preparationPlan ??
57
57
  (await planBaselinePreparation({
58
58
  ...planOptions,
59
59
  recordsPath: flags.recordsPath,
@@ -98,8 +98,8 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
98
98
  targets,
99
99
  };
100
100
  };
101
- const runCleanup = async ({ flags, planOptions, }) => {
102
- const plan = flags.cleanupPlan ??
101
+ const runCleanup = async ({ flags, planOptions, session, }) => {
102
+ const plan = session?.cleanupPlan ??
103
103
  (await planRuntimeStackCleanup({ flags, planOptions }));
104
104
  if (!flags.write)
105
105
  return { mode: "preview", plan };
@@ -156,15 +156,23 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
156
156
  });
157
157
  return { mode: "written", plan, applied };
158
158
  };
159
- const loadIdentityClaimPlan = async ({ flags, planOptions, }) => {
159
+ const loadIdentityPolicy = async ({ planOptions }) => {
160
160
  const loaded = await loadRehearsalConfig(planOptions);
161
161
  if (!loaded.paths.identityPolicy) {
162
162
  throw new Error("No config.identityPolicy is configured.");
163
163
  }
164
+ const policy = validateIdentityPolicy(JSON.parse(await readFile(loaded.paths.identityPolicy, "utf8")));
165
+ return { loaded, policy };
166
+ };
167
+ const loadIdentityClaimPlan = async ({ flags, planOptions, session, }) => {
168
+ const { loaded, policy } = await loadIdentityPolicy({
169
+ flags,
170
+ planOptions,
171
+ ...(session === undefined ? {} : { session }),
172
+ });
164
173
  if (!flags.identityName) {
165
174
  throw new Error("Choose a declared identity with --identity=<name>.");
166
175
  }
167
- const policy = validateIdentityPolicy(JSON.parse(await readFile(loaded.paths.identityPolicy, "utf8")));
168
176
  return {
169
177
  loaded,
170
178
  plan: createIdentityClaimPlan({
@@ -175,6 +183,7 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
175
183
  };
176
184
  return Object.freeze({
177
185
  loadIdentityClaimPlan,
186
+ loadIdentityPolicy,
178
187
  planRuntimeStackCleanup,
179
188
  runBaselinePreparation,
180
189
  runCleanup,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Purpose: Run the versioned, project-configured Rehearsal developer CLI for
4
- * initialization, readiness, planning, inspection, and verified local execution.
3
+ * Purpose: Parse one CLI request, protect project mutations, and delegate to
4
+ * the typed command registry shared by scripted and guided flows.
5
5
  * Run: `npm run rehearsal -- doctor` or `npm run rehearsal -- explain`.
6
6
  */
7
7
  export {};