@runa-ai/runa-cli 0.8.0 → 0.10.0

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 (110) hide show
  1. package/dist/{build-HQMSVN6N.js → build-P2A6345N.js} +2 -2
  2. package/dist/{check-PCSQPYDM.js → check-4TZHNOZU.js} +4 -4
  3. package/dist/{chunk-DRSUEMAK.js → chunk-B7C7CLW2.js} +2 -5
  4. package/dist/{chunk-B3POLMII.js → chunk-BQ336L5T.js} +1 -1
  5. package/dist/{chunk-6FAU4IGR.js → chunk-ELXXQIGW.js} +4 -1
  6. package/dist/{chunk-RB2ZUS76.js → chunk-EXR4J2JT.js} +52 -16
  7. package/dist/{chunk-JMJP4A47.js → chunk-GT5DMS5R.js} +20 -2
  8. package/dist/{chunk-3JO6YP3T.js → chunk-IEKYTCYA.js} +1 -1
  9. package/dist/{chunk-WPMR7RQ4.js → chunk-IWVXI5O4.js} +2 -2
  10. package/dist/chunk-KUH3G522.js +72 -0
  11. package/dist/{chunk-VSH3IXDQ.js → chunk-MAFJAA2P.js} +1 -1
  12. package/dist/{chunk-CCKG5R4Y.js → chunk-MILCC3B6.js} +1 -1
  13. package/dist/{chunk-5NKWR4FF.js → chunk-OERS32LW.js} +1 -1
  14. package/dist/{chunk-GHQH6UC5.js → chunk-OXQISY3J.js} +1 -1
  15. package/dist/chunk-QDOR3GTD.js +9043 -0
  16. package/dist/{chunk-2QX7T24B.js → chunk-QKGL6Q2S.js} +1 -1
  17. package/dist/{chunk-OBYZDT2E.js → chunk-URWDB7YL.js} +15 -78
  18. package/dist/{chunk-ZYT7OQJB.js → chunk-WGRVAGSR.js} +6 -6
  19. package/dist/chunk-ZWDWFMOX.js +1514 -0
  20. package/dist/{ci-ZK3LKYFX.js → ci-FLTJ2UXB.js} +992 -849
  21. package/dist/{cli-ZY5VRIJA.js → cli-THEA6T7N.js} +31 -31
  22. package/dist/commands/ci/commands/ci-prod-db-operations.d.ts +12 -17
  23. package/dist/commands/ci/commands/ci-prod-utils.d.ts +7 -0
  24. package/dist/commands/ci/commands/layer4-discovery.d.ts +2 -0
  25. package/dist/commands/ci/machine/actors/db/production-preview.d.ts +4 -3
  26. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +5 -1
  27. package/dist/commands/ci/machine/actors/test/capabilities.d.ts +2 -13
  28. package/dist/commands/ci/machine/actors/test/index.d.ts +1 -0
  29. package/dist/commands/ci/machine/actors/test/layer-content.d.ts +11 -0
  30. package/dist/commands/ci/machine/commands/ci-pr-internal-profile.d.ts +7 -0
  31. package/dist/commands/ci/machine/commands/ci-step-registry.d.ts +25 -0
  32. package/dist/commands/ci/machine/commands/step-telemetry.d.ts +1 -2
  33. package/dist/commands/ci/machine/contract.d.ts +3 -0
  34. package/dist/commands/ci/machine/guards.d.ts +3 -10
  35. package/dist/commands/ci/machine/helpers.d.ts +1 -1
  36. package/dist/commands/ci/machine/machine-execution-helpers.d.ts +5 -2
  37. package/dist/commands/ci/machine/machine.d.ts +24 -30
  38. package/dist/commands/ci/machine/selectors.d.ts +6 -0
  39. package/dist/commands/ci/machine/types.d.ts +3 -1
  40. package/dist/commands/ci/utils/ci-logging.d.ts +16 -0
  41. package/dist/commands/ci/utils/rls-verification.d.ts +3 -2
  42. package/dist/commands/db/apply/actors/pg-schema-diff-actors.d.ts +1 -0
  43. package/dist/commands/db/apply/contract.d.ts +209 -0
  44. package/dist/commands/db/apply/helpers/fresh-db-handler.d.ts +2 -1
  45. package/dist/commands/db/apply/helpers/index.d.ts +3 -1
  46. package/dist/commands/db/apply/helpers/plan-ast-sql-helpers.d.ts +19 -0
  47. package/dist/commands/db/apply/helpers/plan-ast.d.ts +1 -2
  48. package/dist/commands/db/apply/helpers/plan-check-filter.d.ts +0 -14
  49. package/dist/commands/db/apply/helpers/plan-validator.d.ts +34 -0
  50. package/dist/commands/db/apply/helpers/planner-artifact.d.ts +65 -0
  51. package/dist/commands/db/apply/helpers/retry-logic.d.ts +5 -0
  52. package/dist/commands/db/apply/machine.d.ts +50 -15
  53. package/dist/commands/db/commands/db-apply-error.d.ts +6 -1
  54. package/dist/commands/db/commands/db-apply.d.ts +5 -0
  55. package/dist/commands/db/commands/db-plan.d.ts +3 -0
  56. package/dist/commands/db/commands/db-preview-profile.d.ts +23 -0
  57. package/dist/commands/db/commands/db-preview.d.ts +3 -0
  58. package/dist/commands/db/sync/actors.d.ts +1 -0
  59. package/dist/commands/db/sync/contract.d.ts +16 -0
  60. package/dist/commands/db/sync/guardrail-orchestrator.d.ts +15 -0
  61. package/dist/commands/db/sync/guardrail-reporting.d.ts +12 -0
  62. package/dist/commands/db/sync/index.d.ts +4 -0
  63. package/dist/commands/db/sync/machine.d.ts +18 -13
  64. package/dist/commands/db/sync/schema-guardrail-config-test-support.d.ts +15 -0
  65. package/dist/commands/db/sync/schema-guardrail-config.d.ts +11 -0
  66. package/dist/commands/db/sync/schema-guardrail-ddl-order.d.ts +36 -0
  67. package/dist/commands/db/sync/schema-guardrail-graph-guidance.d.ts +15 -0
  68. package/dist/commands/db/sync/schema-guardrail-graph-metadata.d.ts +41 -0
  69. package/dist/commands/db/sync/schema-guardrail-graph-nodes.d.ts +61 -0
  70. package/dist/commands/db/sync/schema-guardrail-graph-sql-helpers.d.ts +31 -0
  71. package/dist/commands/db/sync/schema-guardrail-graph-types.d.ts +56 -0
  72. package/dist/commands/db/sync/schema-guardrail-graph.d.ts +20 -0
  73. package/dist/commands/db/sync/schema-guardrail-local-blockers.d.ts +7 -0
  74. package/dist/commands/db/sync/schema-guardrail-phases.d.ts +26 -0
  75. package/dist/commands/db/sync/schema-guardrail-production-check.d.ts +23 -0
  76. package/dist/commands/db/sync/schema-guardrail-rewrite.d.ts +46 -0
  77. package/dist/commands/db/sync/schema-guardrail-runtime.d.ts +5 -0
  78. package/dist/commands/db/sync/schema-guardrail-semantic-warnings.d.ts +9 -0
  79. package/dist/commands/db/sync/schema-guardrail-types.d.ts +243 -0
  80. package/dist/commands/db/sync/schema-guardrail.d.ts +10 -0
  81. package/dist/commands/db/utils/declarative-dependency-sql-utils.d.ts +1 -1
  82. package/dist/commands/db/utils/duplicate-function-ownership.d.ts +27 -1
  83. package/dist/commands/db/utils/policy-cross-schema-refs.d.ts +12 -0
  84. package/dist/commands/db/utils/sql-table-extractor.d.ts +6 -0
  85. package/dist/commands/test/commands/layer4-prereqs.d.ts +15 -0
  86. package/dist/{config-loader-GT3HAQ7U.js → config-loader-N5ODNMD5.js} +2 -2
  87. package/dist/db-IDKQ44VX.js +12757 -0
  88. package/dist/{dev-GB5ERUVR.js → dev-LGSMDFJN.js} +7 -6
  89. package/dist/{doctor-ROSWSMLH.js → doctor-GYX73IEW.js} +4 -4
  90. package/dist/{env-WP74UUMO.js → env-KYR6Q7WO.js} +15 -10
  91. package/dist/{env-files-HRNUGZ5O.js → env-files-ONBC47I6.js} +3 -3
  92. package/dist/{hotfix-TOSGTVCW.js → hotfix-RJIAPLAM.js} +4 -4
  93. package/dist/index.js +3 -3
  94. package/dist/{init-35JLDFHI.js → init-2O6ODG5Z.js} +2 -2
  95. package/dist/{inject-test-attrs-XN4I2AOR.js → inject-test-attrs-F5A346UV.js} +3 -3
  96. package/dist/{manifest-EGCAZ4TK.js → manifest-CI4BRWEB.js} +2 -2
  97. package/dist/{observability-CJA5UFIC.js → observability-WNSCJ5FV.js} +2 -2
  98. package/dist/pg-schema-diff-helpers-7377FS2D.js +7 -0
  99. package/dist/{sdk-XK6HQU7S.js → sdk-BTIVPEE5.js} +1 -1
  100. package/dist/{template-check-BDFMT6ZO.js → template-check-VNNQQXCX.js} +10 -0
  101. package/dist/{test-V4KQL574.js → test-QCPN6Z47.js} +74 -46
  102. package/dist/{upgrade-7L4JIE4K.js → upgrade-QZKEI3NJ.js} +2 -2
  103. package/dist/utils/db-url-utils.d.ts +4 -77
  104. package/dist/{vuln-check-G6I4YYDC.js → vuln-check-JRPMUHLF.js} +1 -1
  105. package/dist/{vuln-checker-CT2AYPIS.js → vuln-checker-Q7LSHUHJ.js} +1 -1
  106. package/dist/{watch-AL4LCBRM.js → watch-RFVCEQLH.js} +3 -3
  107. package/dist/{workflow-UZIZ2JUS.js → workflow-UOG6ZZMH.js} +3 -3
  108. package/package.json +3 -3
  109. package/dist/chunk-6E2DRXIL.js +0 -452
  110. package/dist/db-EPI2DQYN.js +0 -18275
@@ -9,16 +9,16 @@
9
9
  * 2. [ci-local] setup → dbReset → pullProduction? → syncSchema → applySeeds
10
10
  * → productionPreview → collectSchemaStats → installPgTap → runCoreTests → done
11
11
  * 3. [ci-pr] setup → initialComment → syncSchema → applySeeds → postSeedPr
12
- * execution: setupRoles → staticChecks → buildAndPlaywrightappStart
13
- * → capabilities → runCoreTests → e2ePhase → finalize → done
12
+ * execution: setupRoles → staticChecks → layerContentbuildAndPlaywright
13
+ * → appStart → capabilities → runCoreTests → e2ePhase → finalize → done
14
14
  * observability: productionPreview ∥ collectSchemaStats
15
15
  *
16
16
  * State Flow (detailed):
17
17
  * idle → setup → initialComment? → dbReset? → pullProduction? → syncSchema → applySeeds
18
18
  * → productionPreview → collectSchemaStats → decidePath
19
19
  * → [ci-local] → installPgTap → runCoreTests → done
20
- * → [ci-pr] → setupRoles → staticChecks → buildAndPlaywrightappStart
21
- * → capabilities → runCoreTests → coreTestsComplete
20
+ * → [ci-pr] → setupRoles → staticChecks → layerContentbuildAndPlaywright
21
+ * → appStart → capabilities → runCoreTests → coreTestsComplete
22
22
  * → e2ePhase (parallel: intermediateComment || e2eTests)
23
23
  * → finalize → done
24
24
  *
@@ -45,21 +45,31 @@
45
45
  * - failed → expect(exitCode).toBe(1)
46
46
  */
47
47
  import { type SnapshotFrom } from 'xstate';
48
+ import { type SetupRolesOutput } from './actors/db/index.js';
49
+ import { type CapabilitiesOutput, type LayerContentOutput, type RunLayersOutput } from './actors/test/index.js';
48
50
  import type { CiContext, CiEvent } from './types.js';
49
51
  export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent, {
50
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").StaticChecksOutput, import("./index.js").StaticChecksInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").CapabilitiesOutput, import("./index.js").CapabilitiesInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").AppStartOutput, import("./index.js").AppStartInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").PlaywrightInstallOutput, import("./index.js").PlaywrightInstallInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").SyncSchemaOutput, import("./index.js").SyncSchemaInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ApplySeedsOutput, import("./index.js").ApplySeedsInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ProductionPreviewOutput, import("./index.js").ProductionPreviewInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup/local.js").LocalSetupOutput, import("./actors/setup/local.js").LocalSetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup/pr-local.js").PrLocalSetupOutput, import("./actors/setup/pr-local.js").PrLocalSetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ResetDbOutput, import("./index.js").ResetDbInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").PullProductionOutput, import("./index.js").PullProductionInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").CollectSchemaStatsOutput, import("./index.js").CollectSchemaStatsInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").SetupRolesOutput, import("./index.js").SetupRolesInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").InstallPgTapOutput, import("./index.js").InstallPgTapInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").AppBuildOutput, import("./index.js").AppBuildInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").BuildAndPlaywrightOutput, import("./index.js").BuildAndPlaywrightInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").RunLayersOutput, import("./index.js").RunLayersInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").UpsertCommentOutput, import("./index.js").UpsertCommentInput, import("xstate").EventObject>> | undefined;
52
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").StaticChecksOutput, import("./index.js").StaticChecksInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<CapabilitiesOutput, import("./index.js").CapabilitiesInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").AppStartOutput, import("./index.js").AppStartInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ApplySeedsOutput, import("./index.js").ApplySeedsInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<LayerContentOutput, import("./index.js").LayerContentInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").PlaywrightInstallOutput, import("./index.js").PlaywrightInstallInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").SyncSchemaOutput, import("./index.js").SyncSchemaInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ProductionPreviewOutput, import("./index.js").ProductionPreviewInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup/local.js").LocalSetupOutput, import("./actors/setup/local.js").LocalSetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup/pr-local.js").PrLocalSetupOutput, import("./actors/setup/pr-local.js").PrLocalSetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").ResetDbOutput, import("./index.js").ResetDbInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").PullProductionOutput, import("./index.js").PullProductionInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").CollectSchemaStatsOutput, import("./index.js").CollectSchemaStatsInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<SetupRolesOutput, import("./index.js").SetupRolesInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").InstallPgTapOutput, import("./index.js").InstallPgTapInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").AppBuildOutput, import("./index.js").AppBuildInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").BuildAndPlaywrightOutput, import("./index.js").BuildAndPlaywrightInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<RunLayersOutput, import("./index.js").RunLayersInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./index.js").UpsertCommentOutput, import("./index.js").UpsertCommentInput, import("xstate").EventObject>> | undefined;
51
53
  }, {
52
54
  src: "staticChecks";
53
55
  logic: import("xstate").PromiseActorLogic<import("./index.js").StaticChecksOutput, import("./index.js").StaticChecksInput, import("xstate").EventObject>;
54
56
  id: string | undefined;
55
57
  } | {
56
58
  src: "capabilities";
57
- logic: import("xstate").PromiseActorLogic<import("./index.js").CapabilitiesOutput, import("./index.js").CapabilitiesInput, import("xstate").EventObject>;
59
+ logic: import("xstate").PromiseActorLogic<CapabilitiesOutput, import("./index.js").CapabilitiesInput, import("xstate").EventObject>;
58
60
  id: string | undefined;
59
61
  } | {
60
62
  src: "appStart";
61
63
  logic: import("xstate").PromiseActorLogic<import("./index.js").AppStartOutput, import("./index.js").AppStartInput, import("xstate").EventObject>;
62
64
  id: string | undefined;
65
+ } | {
66
+ src: "applySeeds";
67
+ logic: import("xstate").PromiseActorLogic<import("./index.js").ApplySeedsOutput, import("./index.js").ApplySeedsInput, import("xstate").EventObject>;
68
+ id: string | undefined;
69
+ } | {
70
+ src: "layerContent";
71
+ logic: import("xstate").PromiseActorLogic<LayerContentOutput, import("./index.js").LayerContentInput, import("xstate").EventObject>;
72
+ id: string | undefined;
63
73
  } | {
64
74
  src: "playwrightInstall";
65
75
  logic: import("xstate").PromiseActorLogic<import("./index.js").PlaywrightInstallOutput, import("./index.js").PlaywrightInstallInput, import("xstate").EventObject>;
@@ -68,10 +78,6 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
68
78
  src: "syncSchema";
69
79
  logic: import("xstate").PromiseActorLogic<import("./index.js").SyncSchemaOutput, import("./index.js").SyncSchemaInput, import("xstate").EventObject>;
70
80
  id: string | undefined;
71
- } | {
72
- src: "applySeeds";
73
- logic: import("xstate").PromiseActorLogic<import("./index.js").ApplySeedsOutput, import("./index.js").ApplySeedsInput, import("xstate").EventObject>;
74
- id: string | undefined;
75
81
  } | {
76
82
  src: "productionPreview";
77
83
  logic: import("xstate").PromiseActorLogic<import("./index.js").ProductionPreviewOutput, import("./index.js").ProductionPreviewInput, import("xstate").EventObject>;
@@ -98,7 +104,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
98
104
  id: string | undefined;
99
105
  } | {
100
106
  src: "setupRoles";
101
- logic: import("xstate").PromiseActorLogic<import("./index.js").SetupRolesOutput, import("./index.js").SetupRolesInput, import("xstate").EventObject>;
107
+ logic: import("xstate").PromiseActorLogic<SetupRolesOutput, import("./index.js").SetupRolesInput, import("xstate").EventObject>;
102
108
  id: string | undefined;
103
109
  } | {
104
110
  src: "installPgTap";
@@ -114,7 +120,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
114
120
  id: string | undefined;
115
121
  } | {
116
122
  src: "runLayers";
117
- logic: import("xstate").PromiseActorLogic<import("./index.js").RunLayersOutput, import("./index.js").RunLayersInput, import("xstate").EventObject>;
123
+ logic: import("xstate").PromiseActorLogic<RunLayersOutput, import("./index.js").RunLayersInput, import("xstate").EventObject>;
118
124
  id: string | undefined;
119
125
  } | {
120
126
  src: "upsertComment";
@@ -171,14 +177,14 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
171
177
  } | {
172
178
  type: "allTestsPassed";
173
179
  params: unknown;
174
- }, never, "done" | "failed" | "staticChecks" | "idle" | "capabilities" | "appStart" | "syncSchema" | "applySeeds" | "productionPreview" | "pullProduction" | "collectSchemaStats" | "setupRoles" | "installPgTap" | "buildAndPlaywright" | "initialComment" | "dbReset" | "runCoreTests" | "coreTestsFailed" | "coreTestsComplete" | "decidePath" | {
180
+ }, never, "done" | "failed" | "staticChecks" | "idle" | "capabilities" | "appStart" | "applySeeds" | "layerContent" | "syncSchema" | "productionPreview" | "pullProduction" | "collectSchemaStats" | "setupRoles" | "installPgTap" | "buildAndPlaywright" | "initialComment" | "dbReset" | "runCoreTests" | "coreTestsFailed" | "coreTestsComplete" | "decidePath" | {
175
181
  setup: "local" | "resolving" | "prLocal" | "complete";
176
182
  } | {
177
183
  finalize: "complete" | "writeSummary" | "postComment";
178
184
  } | {
179
185
  postSeedPr: {
180
186
  observability: "done" | "productionPreview" | "collectSchemaStats" | "gate";
181
- execution: "done" | "failed" | "staticChecks" | "capabilities" | "appStart" | "setupRoles" | "buildAndPlaywright" | "gate" | "runCoreTests" | "coreTestsFailed" | "coreTestsComplete" | {
187
+ execution: "done" | "failed" | "staticChecks" | "capabilities" | "appStart" | "layerContent" | "setupRoles" | "buildAndPlaywright" | "gate" | "runCoreTests" | "coreTestsFailed" | "coreTestsComplete" | {
182
188
  e2ePhase: {
183
189
  intermediateComment: "done" | "checking" | "posting";
184
190
  e2eTests: "done" | "running";
@@ -231,6 +237,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
231
237
  playwrightWorkers?: string | undefined;
232
238
  skipGithubComment?: boolean | undefined;
233
239
  layers?: number[] | undefined;
240
+ internalProfile?: "schema-only" | undefined;
234
241
  }, {
235
242
  mode: "ci-local" | "ci-pr-local";
236
243
  status: "success" | "timeout" | "failure" | "cancelled";
@@ -288,6 +295,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
288
295
  readonly gate: {};
289
296
  readonly setupRoles: {};
290
297
  readonly staticChecks: {};
298
+ readonly layerContent: {};
291
299
  readonly buildAndPlaywright: {};
292
300
  readonly appStart: {};
293
301
  readonly capabilities: {};
@@ -331,6 +339,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
331
339
  readonly installPgTap: {};
332
340
  readonly setupRoles: {};
333
341
  readonly staticChecks: {};
342
+ readonly layerContent: {};
334
343
  readonly buildAndPlaywright: {};
335
344
  readonly appStart: {};
336
345
  readonly capabilities: {};
@@ -367,20 +376,5 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
367
376
  }>;
368
377
  export type CiMachine = typeof ciMachine;
369
378
  export type CiSnapshot = SnapshotFrom<typeof ciMachine>;
370
- /**
371
- * Get current state name from snapshot.
372
- */
373
- export declare function getStateName(snapshot: CiSnapshot): string;
374
- /**
375
- * Check if machine is in a final state.
376
- */
377
- export declare function isComplete(snapshot: CiSnapshot): boolean;
378
- /**
379
- * Get error message from snapshot.
380
- */
381
- export declare function getError(snapshot: CiSnapshot): string | null;
382
- /**
383
- * Get exit code from snapshot.
384
- */
385
- export declare function getExitCode(snapshot: CiSnapshot): 0 | 1 | 2;
379
+ export { getError, getExitCode, getStateName, isComplete } from './selectors.js';
386
380
  //# sourceMappingURL=machine.d.ts.map
@@ -0,0 +1,6 @@
1
+ import type { CiSnapshot } from './machine.js';
2
+ export declare function getStateName(snapshot: CiSnapshot): string;
3
+ export declare function isComplete(snapshot: CiSnapshot): boolean;
4
+ export declare function getError(snapshot: CiSnapshot): string | null;
5
+ export declare function getExitCode(snapshot: CiSnapshot): 0 | 1 | 2;
6
+ //# sourceMappingURL=selectors.d.ts.map
@@ -107,13 +107,15 @@ export interface HazardDetail {
107
107
  severity: 'critical' | 'warning' | 'info';
108
108
  }
109
109
  /**
110
- * Production schema preview (dry-run result from `runa db apply production --check`).
110
+ * Production schema preview (dry-run result from `runa db preview production`).
111
111
  *
112
112
  * Used for PR comments to show what SQL will be applied to production.
113
113
  */
114
114
  export interface ProductionPreview {
115
115
  /** Whether the dry-run was executed */
116
116
  executed: boolean;
117
+ /** Preview profile used to generate this result */
118
+ profile?: 'compare-only' | 'full' | null;
117
119
  /** SQL that would be applied to production */
118
120
  planSql: string | null;
119
121
  /** Hazards detected by pg-schema-diff (simple string format) */
@@ -1,8 +1,24 @@
1
1
  /**
2
2
  * AI HINT: CI logging helpers (human + AI readable)
3
3
  *
4
+ * Purpose: Structured logging for CI operations
5
+ * Pattern: All output goes to stderr (stdout reserved for JSON contract mode)
6
+ *
4
7
  * Keep sections consistent to make logs scannable.
5
8
  */
9
+ export interface CILogger {
10
+ debug(message: string): void;
11
+ info(message: string): void;
12
+ warn(message: string): void;
13
+ error(message: string): void;
14
+ }
15
+ /**
16
+ * Create a CI-specific logger that writes to stderr.
17
+ * Prefixes all messages with [prefix] for easy filtering.
18
+ *
19
+ * Debug messages are only emitted when RUNA_DEBUG=true.
20
+ */
21
+ export declare function createCILogger(prefix: string): CILogger;
6
22
  export declare function logSection(title: string): void;
7
23
  export declare function logKeyValueTable(params: {
8
24
  title: string;
@@ -12,6 +12,7 @@
12
12
  * Security (Issue #458):
13
13
  * - Uses getSafeEnv() to avoid passing secrets to child processes
14
14
  */
15
+ import { type CILogger } from './ci-logging.js';
15
16
  export interface QueryScalarParams {
16
17
  repoRoot: string;
17
18
  tmpDir: string;
@@ -41,7 +42,7 @@ export interface VerifyRlsAlignmentParams {
41
42
  *
42
43
  * @param params - Verification parameters
43
44
  */
44
- export declare function verifyDbRlsRoleAlignment(params: VerifyRlsAlignmentParams): Promise<void>;
45
+ export declare function verifyDbRlsRoleAlignment(params: VerifyRlsAlignmentParams, logger?: CILogger): Promise<void>;
45
46
  export interface VerifyServiceTestParams {
46
47
  repoRoot: string;
47
48
  tmpDir: string;
@@ -59,7 +60,7 @@ export interface VerifyServiceTestParams {
59
60
  *
60
61
  * @param params - Verification parameters
61
62
  */
62
- export declare function verifyServiceTestPrerequisites(params: VerifyServiceTestParams): Promise<void>;
63
+ export declare function verifyServiceTestPrerequisites(params: VerifyServiceTestParams, logger?: CILogger): Promise<void>;
63
64
  export interface VerifyPgTapAccessParams {
64
65
  repoRoot: string;
65
66
  tmpDir: string;
@@ -15,6 +15,7 @@ export type { PgSchemaDiffResult } from '../helpers/fresh-db-handler.js';
15
15
  export declare const applyPgSchemaDiff: import("xstate").PromiseActorLogic<PgSchemaDiffResult, {
16
16
  input: DbApplyInput;
17
17
  targetDir: string;
18
+ preIdempotentTargetFingerprint?: string | null;
18
19
  }, import("xstate").EventObject>;
19
20
  /**
20
21
  * Validate that expected partitions (from idempotent/*.sql) exist in the database.
@@ -10,6 +10,26 @@
10
10
  * - Same logic for all environments (local, Branch DB, production)
11
11
  */
12
12
  import { z } from 'zod';
13
+ export declare const DbPreviewProfileSchema: z.ZodEnum<{
14
+ full: "full";
15
+ "compare-only": "compare-only";
16
+ }>;
17
+ export type DbPreviewProfile = z.infer<typeof DbPreviewProfileSchema>;
18
+ export declare const DbApplyPlanSourceSchema: z.ZodEnum<{
19
+ inline: "inline";
20
+ artifact: "artifact";
21
+ }>;
22
+ export type DbApplyPlanSource = z.infer<typeof DbApplyPlanSourceSchema>;
23
+ export declare const DbApplyPlannerReuseReasonSchema: z.ZodEnum<{
24
+ artifact_missing: "artifact_missing";
25
+ artifact_invalid: "artifact_invalid";
26
+ profile_ineligible: "profile_ineligible";
27
+ source_fingerprint_mismatch: "source_fingerprint_mismatch";
28
+ target_fingerprint_unavailable: "target_fingerprint_unavailable";
29
+ target_fingerprint_mismatch: "target_fingerprint_mismatch";
30
+ tool_version_mismatch: "tool_version_mismatch";
31
+ }>;
32
+ export type DbApplyPlannerReuseReason = z.infer<typeof DbApplyPlannerReuseReasonSchema>;
13
33
  export declare const DbApplyInputSchema: z.ZodObject<{
14
34
  env: z.ZodDefault<z.ZodEnum<{
15
35
  local: "local";
@@ -28,6 +48,8 @@ export declare const DbApplyInputSchema: z.ZodObject<{
28
48
  compareOnly: z.ZodDefault<z.ZodBoolean>;
29
49
  maxLockWaitMs: z.ZodDefault<z.ZodNumber>;
30
50
  freshDbCheckSql: z.ZodOptional<z.ZodString>;
51
+ plannerArtifactPath: z.ZodOptional<z.ZodString>;
52
+ plannerArtifactRequired: z.ZodDefault<z.ZodBoolean>;
31
53
  }, z.core.$strict>;
32
54
  export type DbApplyInput = z.infer<typeof DbApplyInputSchema>;
33
55
  /**
@@ -39,6 +61,7 @@ export declare const DbApplyMetricsSchema: z.ZodObject<{
39
61
  applyMs: z.ZodOptional<z.ZodNumber>;
40
62
  seedMs: z.ZodOptional<z.ZodNumber>;
41
63
  retryAttempts: z.ZodOptional<z.ZodNumber>;
64
+ retryWaitMs: z.ZodOptional<z.ZodNumber>;
42
65
  }, z.core.$strip>;
43
66
  export type DbApplyMetrics = z.infer<typeof DbApplyMetricsSchema>;
44
67
  export declare const DbApplyPlanSummarySchema: z.ZodObject<{
@@ -53,6 +76,29 @@ export declare const DbApplyPlanSummarySchema: z.ZodObject<{
53
76
  }, z.core.$strict>;
54
77
  }, z.core.$strict>;
55
78
  export type DbApplyPlanSummary = z.infer<typeof DbApplyPlanSummarySchema>;
79
+ export declare const DbApplyPlannerSchema: z.ZodObject<{
80
+ source: z.ZodEnum<{
81
+ inline: "inline";
82
+ artifact: "artifact";
83
+ }>;
84
+ path: z.ZodOptional<z.ZodString>;
85
+ reuseAttempted: z.ZodOptional<z.ZodBoolean>;
86
+ reuseReason: z.ZodOptional<z.ZodEnum<{
87
+ artifact_missing: "artifact_missing";
88
+ artifact_invalid: "artifact_invalid";
89
+ profile_ineligible: "profile_ineligible";
90
+ source_fingerprint_mismatch: "source_fingerprint_mismatch";
91
+ target_fingerprint_unavailable: "target_fingerprint_unavailable";
92
+ target_fingerprint_mismatch: "target_fingerprint_mismatch";
93
+ tool_version_mismatch: "tool_version_mismatch";
94
+ }>>;
95
+ reuseMessage: z.ZodOptional<z.ZodString>;
96
+ sourceFingerprint: z.ZodOptional<z.ZodString>;
97
+ targetFingerprint: z.ZodOptional<z.ZodString>;
98
+ targetFingerprintMatched: z.ZodOptional<z.ZodBoolean>;
99
+ hasChanges: z.ZodOptional<z.ZodBoolean>;
100
+ }, z.core.$strict>;
101
+ export type DbApplyPlanner = z.infer<typeof DbApplyPlannerSchema>;
56
102
  export declare const DbApplyOutputSchema: z.ZodObject<{
57
103
  success: z.ZodBoolean;
58
104
  idempotentSchemasApplied: z.ZodNumber;
@@ -76,6 +122,10 @@ export declare const DbApplyOutputSchema: z.ZodObject<{
76
122
  }, z.core.$strict>;
77
123
  }, z.core.$strict>>;
78
124
  checkOnly: z.ZodOptional<z.ZodBoolean>;
125
+ previewProfile: z.ZodOptional<z.ZodEnum<{
126
+ full: "full";
127
+ "compare-only": "compare-only";
128
+ }>>;
79
129
  dataViolations: z.ZodOptional<z.ZodNumber>;
80
130
  ssotWarning: z.ZodOptional<z.ZodString>;
81
131
  partitionWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -91,7 +141,30 @@ export declare const DbApplyOutputSchema: z.ZodObject<{
91
141
  applyMs: z.ZodOptional<z.ZodNumber>;
92
142
  seedMs: z.ZodOptional<z.ZodNumber>;
93
143
  retryAttempts: z.ZodOptional<z.ZodNumber>;
144
+ retryWaitMs: z.ZodOptional<z.ZodNumber>;
94
145
  }, z.core.$strip>>;
146
+ planner: z.ZodOptional<z.ZodObject<{
147
+ source: z.ZodEnum<{
148
+ inline: "inline";
149
+ artifact: "artifact";
150
+ }>;
151
+ path: z.ZodOptional<z.ZodString>;
152
+ reuseAttempted: z.ZodOptional<z.ZodBoolean>;
153
+ reuseReason: z.ZodOptional<z.ZodEnum<{
154
+ artifact_missing: "artifact_missing";
155
+ artifact_invalid: "artifact_invalid";
156
+ profile_ineligible: "profile_ineligible";
157
+ source_fingerprint_mismatch: "source_fingerprint_mismatch";
158
+ target_fingerprint_unavailable: "target_fingerprint_unavailable";
159
+ target_fingerprint_mismatch: "target_fingerprint_mismatch";
160
+ tool_version_mismatch: "tool_version_mismatch";
161
+ }>>;
162
+ reuseMessage: z.ZodOptional<z.ZodString>;
163
+ sourceFingerprint: z.ZodOptional<z.ZodString>;
164
+ targetFingerprint: z.ZodOptional<z.ZodString>;
165
+ targetFingerprintMatched: z.ZodOptional<z.ZodBoolean>;
166
+ hasChanges: z.ZodOptional<z.ZodBoolean>;
167
+ }, z.core.$strict>>;
95
168
  outcome: z.ZodObject<{
96
169
  command: z.ZodString;
97
170
  exitMode: z.ZodEnum<{
@@ -165,4 +238,140 @@ export declare const DbApplyOutputSchema: z.ZodObject<{
165
238
  }, z.core.$strict>;
166
239
  }, z.core.$strict>;
167
240
  export type DbApplyOutput = z.infer<typeof DbApplyOutputSchema>;
241
+ export declare const DbPlanOutputSchema: z.ZodObject<{
242
+ success: z.ZodBoolean;
243
+ idempotentSchemasApplied: z.ZodNumber;
244
+ idempotentSchemasSkipped: z.ZodOptional<z.ZodNumber>;
245
+ rolePasswordsSet: z.ZodOptional<z.ZodNumber>;
246
+ schemaChangesApplied: z.ZodBoolean;
247
+ hazards: z.ZodArray<z.ZodString>;
248
+ seedsApplied: z.ZodBoolean;
249
+ error: z.ZodOptional<z.ZodString>;
250
+ planSql: z.ZodOptional<z.ZodString>;
251
+ filteredPlanSql: z.ZodOptional<z.ZodString>;
252
+ planSummary: z.ZodOptional<z.ZodObject<{
253
+ rawStatements: z.ZodNumber;
254
+ effectiveStatements: z.ZodNumber;
255
+ noiseStatements: z.ZodNumber;
256
+ categories: z.ZodObject<{
257
+ idempotentDrop: z.ZodNumber;
258
+ idempotentAuthz: z.ZodNumber;
259
+ idempotentRls: z.ZodNumber;
260
+ suppressedFunction: z.ZodNumber;
261
+ }, z.core.$strict>;
262
+ }, z.core.$strict>>;
263
+ dataViolations: z.ZodOptional<z.ZodNumber>;
264
+ ssotWarning: z.ZodOptional<z.ZodString>;
265
+ partitionWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
266
+ idempotentFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
267
+ idempotentRisks: z.ZodOptional<z.ZodObject<{
268
+ high: z.ZodNumber;
269
+ medium: z.ZodNumber;
270
+ low: z.ZodNumber;
271
+ }, z.core.$strip>>;
272
+ metrics: z.ZodOptional<z.ZodObject<{
273
+ totalMs: z.ZodNumber;
274
+ idempotentMs: z.ZodOptional<z.ZodNumber>;
275
+ applyMs: z.ZodOptional<z.ZodNumber>;
276
+ seedMs: z.ZodOptional<z.ZodNumber>;
277
+ retryAttempts: z.ZodOptional<z.ZodNumber>;
278
+ retryWaitMs: z.ZodOptional<z.ZodNumber>;
279
+ }, z.core.$strip>>;
280
+ outcome: z.ZodObject<{
281
+ command: z.ZodString;
282
+ exitMode: z.ZodEnum<{
283
+ success: "success";
284
+ success_with_warnings: "success_with_warnings";
285
+ failed: "failed";
286
+ timeout: "timeout";
287
+ cancelled: "cancelled";
288
+ }>;
289
+ startedAt: z.ZodString;
290
+ endedAt: z.ZodString;
291
+ durationMs: z.ZodNumber;
292
+ phases: z.ZodArray<z.ZodObject<{
293
+ id: z.ZodString;
294
+ label: z.ZodString;
295
+ status: z.ZodEnum<{
296
+ failed: "failed";
297
+ timeout: "timeout";
298
+ cancelled: "cancelled";
299
+ pending: "pending";
300
+ running: "running";
301
+ passed: "passed";
302
+ warning: "warning";
303
+ skipped: "skipped";
304
+ }>;
305
+ startedAt: z.ZodOptional<z.ZodString>;
306
+ endedAt: z.ZodOptional<z.ZodString>;
307
+ durationMs: z.ZodOptional<z.ZodNumber>;
308
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
309
+ warningCount: z.ZodOptional<z.ZodNumber>;
310
+ error: z.ZodOptional<z.ZodObject<{
311
+ code: z.ZodString;
312
+ message: z.ZodString;
313
+ statusCode: z.ZodOptional<z.ZodNumber>;
314
+ retryable: z.ZodBoolean;
315
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
316
+ phase: z.ZodOptional<z.ZodString>;
317
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
318
+ }, z.core.$strict>>;
319
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
320
+ code: z.ZodString;
321
+ message: z.ZodString;
322
+ phase: z.ZodString;
323
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
324
+ }, z.core.$strict>>>;
325
+ metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
326
+ }, z.core.$strict>>;
327
+ warnings: z.ZodArray<z.ZodObject<{
328
+ code: z.ZodString;
329
+ message: z.ZodString;
330
+ phase: z.ZodString;
331
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
332
+ }, z.core.$strict>>;
333
+ errors: z.ZodArray<z.ZodObject<{
334
+ code: z.ZodString;
335
+ message: z.ZodString;
336
+ statusCode: z.ZodOptional<z.ZodNumber>;
337
+ retryable: z.ZodBoolean;
338
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
339
+ phase: z.ZodOptional<z.ZodString>;
340
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
341
+ }, z.core.$strict>>;
342
+ summary: z.ZodObject<{
343
+ passed: z.ZodNumber;
344
+ warnings: z.ZodNumber;
345
+ failed: z.ZodNumber;
346
+ skipped: z.ZodNumber;
347
+ timedOut: z.ZodNumber;
348
+ }, z.core.$strict>;
349
+ nextActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
350
+ }, z.core.$strict>;
351
+ checkOnly: z.ZodLiteral<true>;
352
+ previewProfile: z.ZodLiteral<"full">;
353
+ planner: z.ZodObject<{
354
+ source: z.ZodEnum<{
355
+ inline: "inline";
356
+ artifact: "artifact";
357
+ }>;
358
+ reuseAttempted: z.ZodOptional<z.ZodBoolean>;
359
+ reuseReason: z.ZodOptional<z.ZodEnum<{
360
+ artifact_missing: "artifact_missing";
361
+ artifact_invalid: "artifact_invalid";
362
+ profile_ineligible: "profile_ineligible";
363
+ source_fingerprint_mismatch: "source_fingerprint_mismatch";
364
+ target_fingerprint_unavailable: "target_fingerprint_unavailable";
365
+ target_fingerprint_mismatch: "target_fingerprint_mismatch";
366
+ tool_version_mismatch: "tool_version_mismatch";
367
+ }>>;
368
+ reuseMessage: z.ZodOptional<z.ZodString>;
369
+ targetFingerprintMatched: z.ZodOptional<z.ZodBoolean>;
370
+ hasChanges: z.ZodOptional<z.ZodBoolean>;
371
+ path: z.ZodString;
372
+ sourceFingerprint: z.ZodString;
373
+ targetFingerprint: z.ZodString;
374
+ }, z.core.$strict>;
375
+ }, z.core.$strict>;
376
+ export type DbPlanOutput = z.infer<typeof DbPlanOutputSchema>;
168
377
  //# sourceMappingURL=contract.d.ts.map
@@ -10,13 +10,14 @@
10
10
  *
11
11
  * Safety: Fail-safe — if all detection fails, assumes existing DB (uses pg-schema-diff).
12
12
  */
13
- import type { DbApplyInput, DbApplyPlanSummary } from '../contract.js';
13
+ import type { DbApplyInput, DbApplyPlanSummary, DbApplyPlanner } from '../contract.js';
14
14
  export interface PgSchemaDiffResult {
15
15
  sql: string;
16
16
  hazards: string[];
17
17
  applied: boolean;
18
18
  filteredPlanSql?: string;
19
19
  planSummary?: DbApplyPlanSummary;
20
+ planner?: DbApplyPlanner;
20
21
  retryAttempts?: number;
21
22
  retryWaitMs?: number;
22
23
  dataViolations?: number;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export { acquireAdvisoryLock, MIGRATION_LOCK_ID, releaseAdvisoryLock, } from './advisory-lock.js';
7
7
  export type { PlanHazard, PlanStatement, ValidatedPlan } from './plan-validator.js';
8
- export { ALLOWED_DDL_PREFIXES, BLOCKED_SQL_PATTERNS, parsePlanOutput, validatePlanForExecution, validateStatementTypes, } from './plan-validator.js';
8
+ export { ALLOWED_DDL_PREFIXES, BLOCKED_SQL_PATTERNS, parsePlanOutput, reorderRawSqlDependencies, validateDependencyOrder, validateDependencyOrderFromRawSql, validatePlanForExecution, validateStatementTypes, } from './plan-validator.js';
9
9
  export { isNoChangePlanOutput } from './no-change-plan.js';
10
10
  export type { FilterResult } from './plan-drop-protection.js';
11
11
  export { filterIdempotentProtectedStatements, isDropStatementForProtectedObject, } from './plan-drop-protection.js';
@@ -35,5 +35,7 @@ export type { PgSchemaDiffResult } from './fresh-db-handler.js';
35
35
  export { handleFreshDbCase, hasAppTables } from './fresh-db-handler.js';
36
36
  export { checkPasswordSecurity, parseDbCredentials, setRolePasswords, } from './rbac-password-manager.js';
37
37
  export { backupIdempotentTables, getTableRowEstimates, verifyDataIntegrity, } from './data-integrity-verifier.js';
38
+ export type { DbPlanArtifact } from './planner-artifact.js';
39
+ export { buildTargetFingerprint, DbPlanArtifactSchema, detectPlannerSchemas, getDbPlanArtifactPath, persistDbPlanArtifact, tryReuseDbPlanArtifact, } from './planner-artifact.js';
38
40
  export { getTransactionStrategy, hasTransactionIncompatibleContent, hasTransactionIncompatibleStatements, wrapInTransaction, } from './idempotent-transaction.js';
39
41
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ export declare function stripLeadingSetStatements(sql: string): string;
2
+ export declare function extractStringValue(node: Record<string, unknown> | undefined): string | undefined;
3
+ export declare function readIdentifierList(items: unknown[] | undefined): string[];
4
+ export declare function qualifyName(parts: readonly string[], fallbackSchema?: string): string | null;
5
+ export declare function rangeVarToQualifiedName(node: Record<string, unknown> | undefined): string | null;
6
+ export declare function relationRecordToQualifiedName(record: Record<string, unknown> | undefined): string | null;
7
+ export declare function optionDefElems(options: unknown[] | undefined): Array<Record<string, unknown>>;
8
+ export declare function walkPgNode(node: unknown, visit: (record: Record<string, unknown>) => void): void;
9
+ export declare function collectReferencedRelations(node: unknown, exclude: ReadonlySet<string>): string[];
10
+ export declare function collectFunctionNames(node: unknown): string[];
11
+ export declare function normalizeDbProconfig(entries: string[]): string;
12
+ export declare function extractFunctionConfigFromSql(sql: string): string;
13
+ export declare function extractFunctionOptions(createFunction: Record<string, unknown>): {
14
+ language: string;
15
+ body: string;
16
+ config: string;
17
+ };
18
+ export declare function extractFunctionIdentity(createFunction: Record<string, unknown>): string | null;
19
+ //# sourceMappingURL=plan-ast-sql-helpers.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import type { PlanStatement, ValidatedPlan } from './plan-validator.js';
2
+ export { stripLeadingSetStatements } from './plan-ast-sql-helpers.js';
2
3
  export type PlanObjectKind = 'schema' | 'relation' | 'function' | 'function-privilege' | 'type' | 'other';
3
4
  export interface AnalyzedPlanStatement {
4
5
  statement: PlanStatement;
@@ -41,7 +42,6 @@ export interface PlanAnalysisSession {
41
42
  analyzePlpgsqlBody(body: string): Promise<CachedPlpgsqlBodyAnalysis>;
42
43
  }
43
44
  export declare function createPlanAnalysisSession(): PlanAnalysisSession;
44
- export declare function stripLeadingSetStatements(sql: string): string;
45
45
  export declare function analyzePlanStatement(statement: PlanStatement, session?: PlanAnalysisSession): Promise<AnalyzedPlanStatement>;
46
46
  export declare function analyzeValidatedPlan(plan: ValidatedPlan, session?: PlanAnalysisSession): Promise<AnalyzedPlan>;
47
47
  export declare function stabilizeAnalyzedPlanOrder(analyzedPlan: AnalyzedPlan): {
@@ -52,5 +52,4 @@ export declare function normalizeFunctionDefinitionAst(analyzed: Pick<AnalyzedPl
52
52
  normalizedDefinition: string;
53
53
  normalizedConfig: string;
54
54
  } | null;
55
- export {};
56
55
  //# sourceMappingURL=plan-ast.d.ts.map
@@ -7,18 +7,7 @@ export interface CheckModeFilterResult {
7
7
  removedAuthzStatements: PlanStatement[];
8
8
  removedRlsStatements: PlanStatement[];
9
9
  }
10
- declare function parseRolesFromAuthzStatement(sql: string): string[];
11
10
  export declare function stripLeadingSessionStatements(sql: string): string;
12
- type AuthzTarget = {
13
- kind: 'function';
14
- schema: string;
15
- fullName: string;
16
- } | {
17
- kind: 'schema' | 'sequence' | 'table';
18
- schema: string;
19
- fullName: string;
20
- } | null;
21
- declare function parseAuthzTarget(sql: string): AuthzTarget;
22
11
  export declare function isIdempotentManagedAuthzStatement(sql: string, schemasDir?: string): boolean;
23
12
  export declare function isIdempotentManagedRlsStatement(sql: string, schemasDir?: string): boolean;
24
13
  export declare function filterCheckModePlanStatements(plan: ValidatedPlan, protectedTables: string[], protectedObjects: IdempotentProtectedObjects, schemasDir?: string): CheckModeFilterResult;
@@ -31,7 +20,4 @@ export declare function buildCheckModePlanSummary(params: {
31
20
  suppressedFunctionStatements?: readonly PlanStatement[];
32
21
  }): DbApplyPlanSummary;
33
22
  export declare function resetManagedAuthzCache(): void;
34
- export declare const _parseRolesFromAuthzStatement: typeof parseRolesFromAuthzStatement;
35
- export declare const _parseAuthzTarget: typeof parseAuthzTarget;
36
- export {};
37
23
  //# sourceMappingURL=plan-check-filter.d.ts.map
@@ -90,6 +90,40 @@ export declare function validateStatementTypes(plan: ValidatedPlan): void;
90
90
  * @throws Error if unresolved hazards are found
91
91
  */
92
92
  export declare function validatePlanForExecution(plan: ValidatedPlan, allowedHazardTypes: string[]): void;
93
+ /**
94
+ * Validate that plan SQL doesn't have ALTER POLICY referencing a function
95
+ * that is CREATE'd later in the same plan.
96
+ *
97
+ * This catches pg-schema-diff ordering bugs where ALTER POLICY (phase 50)
98
+ * is emitted before CREATE FUNCTION (phase 60), causing "function does not exist"
99
+ * errors at execution time.
100
+ *
101
+ * Called during plan generation (check mode) so issues are caught before deploy.
102
+ */
103
+ /**
104
+ * Validate dependency order from raw SQL string.
105
+ * More reliable than ValidatedPlan-based check because it works regardless
106
+ * of how parsePlanOutput splits statements (marker-based vs SET-based).
107
+ */
108
+ export declare function validateDependencyOrderFromRawSql(rawSql: string): string[];
109
+ /**
110
+ * Reorder raw plan SQL to fix ALTER POLICY before CREATE FUNCTION ordering.
111
+ *
112
+ * Moves policy chunks that reference functions created later in the plan
113
+ * to after those function definitions. This is the actual fix that makes
114
+ * deploy succeed, not just detection.
115
+ */
116
+ export declare function reorderRawSqlDependencies(rawSql: string): {
117
+ sql: string;
118
+ reordered: boolean;
119
+ movedCount: number;
120
+ };
121
+ export declare function validateDependencyOrder(plan: ValidatedPlan): string[];
122
+ /**
123
+ * Determine whether pg-schema-diff plan output represents "no changes needed".
124
+ * Returns true if the output is empty, contains "No changes", or has zero statements.
125
+ */
126
+ export declare function isNoChangePlanOutput(planOutput: string): boolean;
93
127
  export type { FilterResult } from './plan-drop-protection.js';
94
128
  export { filterIdempotentProtectedStatements, isDropStatementForProtectedObject, _isDropStatementForProtected, _extractProtectedSchemas, _isDropSchemaForProtected, } from './plan-drop-protection.js';
95
129
  //# sourceMappingURL=plan-validator.d.ts.map