@runa-ai/runa-cli 0.10.0 → 0.10.2

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 (59) hide show
  1. package/dist/{chunk-Y5ANTCKE.js → chunk-EZ46JIEO.js} +5 -2
  2. package/dist/{chunk-ZWDWFMOX.js → chunk-HWR5NUUZ.js} +24 -3
  3. package/dist/{chunk-OXQISY3J.js → chunk-IR7SA2ME.js} +1 -1
  4. package/dist/{chunk-QDOR3GTD.js → chunk-LCJNIHZY.js} +82 -14
  5. package/dist/{chunk-JQXOVCOP.js → chunk-NIS77243.js} +8 -5
  6. package/dist/{chunk-URWDB7YL.js → chunk-O3M7A73M.js} +58 -2
  7. package/dist/{chunk-PAWNJA3N.js → chunk-XFXGFUAM.js} +1 -1
  8. package/dist/{chunk-IEKYTCYA.js → chunk-YTQS2O4H.js} +59 -0
  9. package/dist/{ci-FLTJ2UXB.js → ci-6XYG7XNX.js} +5 -5
  10. package/dist/{cli-THEA6T7N.js → cli-2XL3VESS.js} +14 -14
  11. package/dist/commands/build/contract.d.ts +2 -2
  12. package/dist/commands/build/machine.d.ts +6 -6
  13. package/dist/commands/ci/commands/ci-prod-types.d.ts +1 -1
  14. package/dist/commands/ci/machine/contract.d.ts +10 -10
  15. package/dist/commands/ci/machine/machine.d.ts +3 -3
  16. package/dist/commands/ci/utils/ci-summary.d.ts +3 -3
  17. package/dist/commands/db/apply/contract.d.ts +1 -1
  18. package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +6 -0
  19. package/dist/commands/db/apply/helpers/planner-artifact.d.ts +1 -1
  20. package/dist/commands/db/commands/db-preview-profile.d.ts +1 -1
  21. package/dist/commands/db/commands/db-sync/production-precheck.d.ts +0 -8
  22. package/dist/commands/db/preflight/contract.d.ts +1 -1
  23. package/dist/commands/db/sync/contract.d.ts +5 -5
  24. package/dist/commands/db/sync/machine.d.ts +2 -2
  25. package/dist/commands/db/sync/schema-guardrail-graph-guidance.d.ts +18 -1
  26. package/dist/commands/db/sync/schema-guardrail-graph-metadata.d.ts +1 -7
  27. package/dist/commands/db/sync/schema-guardrail-graph-nodes.d.ts +1 -1
  28. package/dist/commands/db/sync/schema-guardrail-graph-sql-helpers.d.ts +1 -1
  29. package/dist/commands/db/sync/schema-guardrail-types.d.ts +4 -2
  30. package/dist/commands/db/utils/changed-files-detector.d.ts +21 -0
  31. package/dist/commands/db/utils/duplicate-function-ownership-allowlist.d.ts +13 -0
  32. package/dist/commands/db/utils/schema-sync.d.ts +12 -0
  33. package/dist/commands/db/utils/sql-boundary-parser.d.ts +13 -0
  34. package/dist/commands/db/utils/sql-file-collector.d.ts +2 -0
  35. package/dist/commands/upgrade.d.ts +36 -0
  36. package/dist/constants/versions.d.ts +9 -0
  37. package/dist/{db-IDKQ44VX.js → db-4AGPISOW.js} +1560 -1006
  38. package/dist/{dev-LGSMDFJN.js → dev-QR55VDNZ.js} +1 -1
  39. package/dist/{error-handler-YRQWRDEF.js → error-handler-XUQOP4TU.js} +1 -2
  40. package/dist/{hotfix-RJIAPLAM.js → hotfix-JYHDY2M6.js} +1 -2
  41. package/dist/index.js +4 -4
  42. package/dist/{init-2O6ODG5Z.js → init-4UAWYY75.js} +1 -1
  43. package/dist/{license-OB7GVJQ2.js → license-M6ODBV4X.js} +140 -154
  44. package/dist/pg-schema-diff-helpers-JZO4GAQG.js +7 -0
  45. package/dist/{risk-detector-S7XQF4I2.js → risk-detector-GDDLISVE.js} +1 -1
  46. package/dist/{risk-detector-core-TGFKWHRS.js → risk-detector-core-YI3M6INI.js} +1 -1
  47. package/dist/{risk-detector-plpgsql-O32TUR34.js → risk-detector-plpgsql-4GWEQXUG.js} +1 -1
  48. package/dist/{template-check-VNNQQXCX.js → template-check-D35F2GDP.js} +4 -0
  49. package/dist/{upgrade-QZKEI3NJ.js → upgrade-X7P6WRD5.js} +190 -20
  50. package/dist/utils/license/index.d.ts +15 -24
  51. package/dist/utils/license/types.d.ts +3 -4
  52. package/dist/utils/template-access.d.ts +20 -0
  53. package/dist/utils/template-fetcher.d.ts +10 -7
  54. package/dist/{vuln-check-JRPMUHLF.js → vuln-check-LMDYYJUE.js} +1 -1
  55. package/dist/{vuln-checker-Q7LSHUHJ.js → vuln-checker-NHXLNZRM.js} +1 -1
  56. package/dist/{watch-RFVCEQLH.js → watch-4RHXVCQ3.js} +1 -1
  57. package/package.json +3 -3
  58. package/dist/chunk-ZZOXM6Q4.js +0 -8
  59. package/dist/pg-schema-diff-helpers-7377FS2D.js +0 -7
@@ -35,7 +35,7 @@ interface BuildMachineInput {
35
35
  repoRoot?: string;
36
36
  }
37
37
  export declare const buildMachine: import("xstate").StateMachine<BuildContext, BuildEvent, {
38
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/clean.js").CleanOutput, import("./actors/clean.js").CleanInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/build.js").BuildOutput, import("./actors/build.js").BuildInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/validate.js").ValidateOutput, import("./actors/validate.js").ValidateInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/manifest.js").ManifestOutput, import("./actors/manifest.js").ManifestInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").DepsInstallOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").EnvCheckOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").SupabaseStartOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/db-sync.js").DbSyncOutput, import("./actors/db-sync.js").DbSyncInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/static-checks.js").StaticChecksOutput, import("./actors/static-checks.js").StaticChecksInput, import("xstate").EventObject>> | undefined;
38
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/clean.js").CleanOutput, import("./actors/clean.js").CleanInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/build.js").BuildOutput, import("./actors/build.js").BuildInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/manifest.js").ManifestOutput, import("./actors/manifest.js").ManifestInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/validate.js").ValidateOutput, import("./actors/validate.js").ValidateInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").DepsInstallOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").EnvCheckOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/setup.js").SupabaseStartOutput, import("./actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/db-sync.js").DbSyncOutput, import("./actors/db-sync.js").DbSyncInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("./actors/static-checks.js").StaticChecksOutput, import("./actors/static-checks.js").StaticChecksInput, import("xstate").EventObject>> | undefined;
39
39
  }, {
40
40
  src: "fresh";
41
41
  logic: import("xstate").PromiseActorLogic<import("./actors/clean.js").CleanOutput, import("./actors/clean.js").CleanInput, import("xstate").EventObject>;
@@ -44,14 +44,14 @@ export declare const buildMachine: import("xstate").StateMachine<BuildContext, B
44
44
  src: "build";
45
45
  logic: import("xstate").PromiseActorLogic<import("./actors/build.js").BuildOutput, import("./actors/build.js").BuildInput, import("xstate").EventObject>;
46
46
  id: string | undefined;
47
- } | {
48
- src: "validate";
49
- logic: import("xstate").PromiseActorLogic<import("./actors/validate.js").ValidateOutput, import("./actors/validate.js").ValidateInput, import("xstate").EventObject>;
50
- id: string | undefined;
51
47
  } | {
52
48
  src: "manifest";
53
49
  logic: import("xstate").PromiseActorLogic<import("./actors/manifest.js").ManifestOutput, import("./actors/manifest.js").ManifestInput, import("xstate").EventObject>;
54
50
  id: string | undefined;
51
+ } | {
52
+ src: "validate";
53
+ logic: import("xstate").PromiseActorLogic<import("./actors/validate.js").ValidateOutput, import("./actors/validate.js").ValidateInput, import("xstate").EventObject>;
54
+ id: string | undefined;
55
55
  } | {
56
56
  src: "clean";
57
57
  logic: import("xstate").PromiseActorLogic<import("./actors/clean.js").CleanOutput, import("./actors/clean.js").CleanInput, import("xstate").EventObject>;
@@ -106,7 +106,7 @@ export declare const buildMachine: import("xstate").StateMachine<BuildContext, B
106
106
  } | {
107
107
  type: "isDryRun";
108
108
  params: unknown;
109
- }, never, "fresh" | "done" | "failed" | "build" | "dryRun" | "validate" | "manifest" | "clean" | "dbSync" | "preClean" | "staticAnalysis" | "idle" | {
109
+ }, never, "fresh" | "done" | "failed" | "build" | "manifest" | "dryRun" | "validate" | "clean" | "dbSync" | "preClean" | "staticAnalysis" | "idle" | {
110
110
  setup: "done" | "depsInstall" | "envCheck" | "supabaseStart";
111
111
  }, string, BuildMachineInput, {
112
112
  success: boolean;
@@ -5,8 +5,8 @@ import { z } from 'zod';
5
5
  */
6
6
  export declare const CiProdApplyActionOptionsSchema: z.ZodObject<{
7
7
  mode: z.ZodOptional<z.ZodEnum<{
8
- local: "local";
9
8
  "github-actions": "github-actions";
9
+ local: "local";
10
10
  }>>;
11
11
  output: z.ZodOptional<z.ZodEnum<{
12
12
  json: "json";
@@ -27,15 +27,15 @@ export declare const CiModeSchema: z.ZodEnum<{
27
27
  }>;
28
28
  export type CiMode = z.infer<typeof CiModeSchema>;
29
29
  export declare const CiExecutionEnvSchema: z.ZodEnum<{
30
- local: "local";
31
30
  "github-actions": "github-actions";
31
+ local: "local";
32
32
  }>;
33
33
  export type CiExecutionEnv = z.infer<typeof CiExecutionEnvSchema>;
34
34
  export declare const CiPhaseSchema: z.ZodEnum<{
35
35
  all: "all";
36
36
  test: "test";
37
- blocking: "blocking";
38
37
  observability: "observability";
38
+ blocking: "blocking";
39
39
  }>;
40
40
  export type CiPhase = z.infer<typeof CiPhaseSchema>;
41
41
  export declare const CiDbModeSchema: z.ZodEnum<{
@@ -100,8 +100,8 @@ export declare const CiInputSchema: z.ZodObject<{
100
100
  check: z.ZodOptional<z.ZodBoolean>;
101
101
  keepDb: z.ZodOptional<z.ZodBoolean>;
102
102
  executionMode: z.ZodOptional<z.ZodEnum<{
103
- local: "local";
104
103
  "github-actions": "github-actions";
104
+ local: "local";
105
105
  }>>;
106
106
  output: z.ZodOptional<z.ZodEnum<{
107
107
  json: "json";
@@ -111,8 +111,8 @@ export declare const CiInputSchema: z.ZodObject<{
111
111
  phase: z.ZodOptional<z.ZodEnum<{
112
112
  all: "all";
113
113
  test: "test";
114
- blocking: "blocking";
115
114
  observability: "observability";
115
+ blocking: "blocking";
116
116
  }>>;
117
117
  dbMode: z.ZodOptional<z.ZodEnum<{
118
118
  auto: "auto";
@@ -148,14 +148,14 @@ export declare const SetupResultSchema: z.ZodObject<{
148
148
  "ci-pr-local": "ci-pr-local";
149
149
  }>;
150
150
  executionEnv: z.ZodEnum<{
151
- local: "local";
152
151
  "github-actions": "github-actions";
152
+ local: "local";
153
153
  }>;
154
154
  phase: z.ZodEnum<{
155
155
  all: "all";
156
156
  test: "test";
157
- blocking: "blocking";
158
157
  observability: "observability";
158
+ blocking: "blocking";
159
159
  }>;
160
160
  repoKind: z.ZodEnum<{
161
161
  unknown: "unknown";
@@ -296,9 +296,9 @@ export declare const StepSummarySchema: z.ZodObject<{
296
296
  db: "db";
297
297
  test: "test";
298
298
  build: "build";
299
- setup: "setup";
300
- github: "github";
301
299
  observability: "observability";
300
+ github: "github";
301
+ setup: "setup";
302
302
  finalize: "finalize";
303
303
  }>>;
304
304
  parentStep: z.ZodOptional<z.ZodString>;
@@ -369,9 +369,9 @@ export declare const CiOutputSchema: z.ZodObject<{
369
369
  db: "db";
370
370
  test: "test";
371
371
  build: "build";
372
- setup: "setup";
373
- github: "github";
374
372
  observability: "observability";
373
+ github: "github";
374
+ setup: "setup";
375
375
  finalize: "finalize";
376
376
  }>>;
377
377
  parentStep: z.ZodOptional<z.ZodString>;
@@ -219,10 +219,10 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
219
219
  layer?: string | undefined;
220
220
  check?: boolean | undefined;
221
221
  keepDb?: boolean | undefined;
222
- executionMode?: "local" | "github-actions" | undefined;
222
+ executionMode?: "github-actions" | "local" | undefined;
223
223
  output?: "json" | "human" | undefined;
224
224
  config?: string | undefined;
225
- phase?: "all" | "test" | "blocking" | "observability" | undefined;
225
+ phase?: "all" | "test" | "observability" | "blocking" | undefined;
226
226
  dbMode?: "auto" | "local" | undefined;
227
227
  branchName?: string | undefined;
228
228
  skipStaticChecks?: boolean | undefined;
@@ -249,7 +249,7 @@ export declare const ciMachine: import("xstate").StateMachine<CiContext, CiEvent
249
249
  error?: string | undefined;
250
250
  reason?: string | undefined;
251
251
  title?: string | undefined;
252
- phase?: "db" | "test" | "build" | "setup" | "github" | "observability" | "finalize" | undefined;
252
+ phase?: "db" | "test" | "build" | "observability" | "github" | "setup" | "finalize" | undefined;
253
253
  parentStep?: string | undefined;
254
254
  optional?: boolean | undefined;
255
255
  startedAt?: string | undefined;
@@ -31,8 +31,8 @@ export type CiStepStatus = z.output<typeof CiStepStatusSchema>;
31
31
  export declare const CiSummarySchema: z.ZodObject<{
32
32
  version: z.ZodString;
33
33
  mode: z.ZodEnum<{
34
- local: "local";
35
34
  "github-actions": "github-actions";
35
+ local: "local";
36
36
  }>;
37
37
  command: z.ZodEnum<{
38
38
  "ci pr": "ci pr";
@@ -100,9 +100,9 @@ export declare const CiSummarySchema: z.ZodObject<{
100
100
  db: "db";
101
101
  test: "test";
102
102
  build: "build";
103
- setup: "setup";
104
- github: "github";
105
103
  observability: "observability";
104
+ github: "github";
105
+ setup: "setup";
106
106
  finalize: "finalize";
107
107
  }>>;
108
108
  parentStep: z.ZodOptional<z.ZodString>;
@@ -32,9 +32,9 @@ export declare const DbApplyPlannerReuseReasonSchema: z.ZodEnum<{
32
32
  export type DbApplyPlannerReuseReason = z.infer<typeof DbApplyPlannerReuseReasonSchema>;
33
33
  export declare const DbApplyInputSchema: z.ZodObject<{
34
34
  env: z.ZodDefault<z.ZodEnum<{
35
- local: "local";
36
35
  preview: "preview";
37
36
  production: "production";
37
+ local: "local";
38
38
  }>>;
39
39
  databaseUrl: z.ZodOptional<z.ZodString>;
40
40
  verbose: z.ZodDefault<z.ZodBoolean>;
@@ -42,8 +42,14 @@ export interface MissingExtensionDetection {
42
42
  * and map them to the required PostgreSQL extensions.
43
43
  */
44
44
  export declare function detectMissingExtensionType(errorOutput: string): MissingExtensionDetection;
45
+ /**
46
+ * Detect the actual extension management SQL file in the project.
47
+ * Falls back to the default path if no extension file is found.
48
+ */
49
+ export declare function detectExtensionFilePath(): string;
45
50
  /**
46
51
  * Format actionable hint for missing extension type errors.
52
+ * Auto-detects the actual extension file path in the project.
47
53
  */
48
54
  export declare function formatExtensionErrorHint(detection: MissingExtensionDetection): string;
49
55
  export interface PartitionPrivilegeDetection {
@@ -4,9 +4,9 @@ import { type DbApplyInput, type DbApplyOutput, type DbApplyPlanner } from '../c
4
4
  export declare const DbPlanArtifactSchema: z.ZodObject<{
5
5
  version: z.ZodLiteral<"1">;
6
6
  environment: z.ZodEnum<{
7
- local: "local";
8
7
  preview: "preview";
9
8
  production: "production";
9
+ local: "local";
10
10
  }>;
11
11
  mode: z.ZodLiteral<"check">;
12
12
  previewProfile: z.ZodEnum<{
@@ -2,9 +2,9 @@ import { z } from 'zod';
2
2
  import { type DbApplyOutput, type DbPreviewProfile } from '../apply/contract.js';
3
3
  export declare const DEFAULT_DB_PREVIEW_PROFILE: DbPreviewProfile;
4
4
  export declare const DbPreviewEnvironmentSchema: z.ZodEnum<{
5
- local: "local";
6
5
  preview: "preview";
7
6
  production: "production";
7
+ local: "local";
8
8
  }>;
9
9
  export declare const LEGACY_DB_APPLY_CHECK_REMOVAL_TARGET = "the next major CLI release";
10
10
  export declare function parseDbPreviewProfile(value: string): DbPreviewProfile;
@@ -1,11 +1,3 @@
1
- /**
2
- * AI HINT: Production apply precheck orchestration
3
- *
4
- * Purpose: Run full production precheck pipeline: local risk checks + plan boundary reconciliation.
5
- * Collects findings, applies strict mode, logs results, and throws on blockers.
6
- *
7
- * Used by: db-sync.ts (maybeRunProductionApplyPrecheck)
8
- */
9
1
  import { type createCLILogger } from '@runa-ai/runa';
10
2
  import type { DbApplyOutput } from '../../apply/contract.js';
11
3
  import type { RunaDbEnv } from '../../utils/db-target.js';
@@ -8,9 +8,9 @@
8
8
  import { z } from 'zod';
9
9
  export declare const DbPreflightInputSchema: z.ZodObject<{
10
10
  env: z.ZodDefault<z.ZodEnum<{
11
- local: "local";
12
11
  preview: "preview";
13
12
  production: "production";
13
+ local: "local";
14
14
  }>>;
15
15
  databaseUrl: z.ZodOptional<z.ZodString>;
16
16
  verbose: z.ZodDefault<z.ZodBoolean>;
@@ -18,9 +18,9 @@ import type { BoundaryGuidanceWarning, LocalBlindSpotBlocker, RuntimeContradicti
18
18
  * Environment type for db sync
19
19
  */
20
20
  export declare const DbSyncEnvSchema: z.ZodEnum<{
21
- local: "local";
22
21
  preview: "preview";
23
22
  production: "production";
23
+ local: "local";
24
24
  }>;
25
25
  export type DbSyncEnv = z.infer<typeof DbSyncEnvSchema>;
26
26
  /**
@@ -28,9 +28,9 @@ export type DbSyncEnv = z.infer<typeof DbSyncEnvSchema>;
28
28
  */
29
29
  export declare const DbSyncInputSchema: z.ZodObject<{
30
30
  env: z.ZodDefault<z.ZodEnum<{
31
- local: "local";
32
31
  preview: "preview";
33
32
  production: "production";
33
+ local: "local";
34
34
  }>>;
35
35
  check: z.ZodDefault<z.ZodBoolean>;
36
36
  force: z.ZodDefault<z.ZodBoolean>;
@@ -104,9 +104,9 @@ export declare const StepContextSchema: z.ZodObject<{
104
104
  databaseUrl: z.ZodString;
105
105
  dbPackagePath: z.ZodString;
106
106
  env: z.ZodEnum<{
107
- local: "local";
108
107
  preview: "preview";
109
108
  production: "production";
109
+ local: "local";
110
110
  }>;
111
111
  check: z.ZodBoolean;
112
112
  force: z.ZodBoolean;
@@ -142,9 +142,9 @@ export type { RuntimeContradictionIssue, RuntimeWarningIssue, SchemaGuardrailRep
142
142
  */
143
143
  export declare const DbSyncOutputSchema: z.ZodObject<{
144
144
  env: z.ZodEnum<{
145
- local: "local";
146
145
  preview: "preview";
147
146
  production: "production";
147
+ local: "local";
148
148
  }>;
149
149
  check: z.ZodBoolean;
150
150
  reconciled: z.ZodBoolean;
@@ -235,9 +235,9 @@ export type DbSyncOutput = z.infer<typeof DbSyncOutputSchema>;
235
235
  */
236
236
  export declare const DbSyncMachineInputSchema: z.ZodObject<{
237
237
  env: z.ZodOptional<z.ZodEnum<{
238
- local: "local";
239
238
  preview: "preview";
240
239
  production: "production";
240
+ local: "local";
241
241
  }>>;
242
242
  check: z.ZodOptional<z.ZodBoolean>;
243
243
  force: z.ZodOptional<z.ZodBoolean>;
@@ -108,7 +108,7 @@ export declare const dbSyncMachine: import("xstate").StateMachine<DbSyncContext,
108
108
  logic: import("xstate").PromiseActorLogic<actors.ReportOutput, actors.ReportInput, import("xstate").EventObject>;
109
109
  id: string | undefined;
110
110
  }, never, never, never, "done" | "failed" | "sync" | "setup" | "idle" | "snapshot" | "reconcile" | "report" | "preflight", string, {
111
- env?: "local" | "preview" | "production" | undefined;
111
+ env?: "preview" | "production" | "local" | undefined;
112
112
  check?: boolean | undefined;
113
113
  force?: boolean | undefined;
114
114
  autoApprove?: boolean | undefined;
@@ -126,7 +126,7 @@ export declare const dbSyncMachine: import("xstate").StateMachine<DbSyncContext,
126
126
  snapshotTimeoutMs?: number | undefined;
127
127
  syncTimeoutMs?: number | undefined;
128
128
  }, {
129
- env: "local" | "preview" | "production";
129
+ env: "preview" | "production" | "local";
130
130
  check: boolean;
131
131
  reconciled: boolean;
132
132
  preflightPassed: boolean;
@@ -4,12 +4,29 @@
4
4
  * Purpose: Generate guidance warnings for schema boundary violations,
5
5
  * security definer issues, trigger ownership, and managed schema access
6
6
  */
7
- import type { SchemaGuardrailReport, SchemaGraphFunctionClaim, SchemaGraphFileNode, SchemaGraphSchemaNode } from './schema-guardrail-types.js';
7
+ import type { BoundaryGuidanceWarning, SchemaGuardrailReport, SchemaGraphFunctionClaim, SchemaGraphFileNode, SchemaGraphSchemaNode, SchemaGraphTableNode, LoadedSqlSources } from './schema-guardrail-types.js';
8
8
  declare function buildBoundaryGuidanceWarnings(params: {
9
9
  fileNodes: SchemaGraphFileNode[];
10
10
  schemaNodes: SchemaGraphSchemaNode[];
11
11
  functionClaims: SchemaGraphFunctionClaim[];
12
12
  ownerFileByTable: Map<string, string>;
13
13
  }): SchemaGuardrailReport['boundaryGuidanceWarnings'];
14
+ /**
15
+ * Detect trigger dispatch coverage gaps.
16
+ *
17
+ * When a trigger calls a dispatch function (e.g., check_org_id_matches_parent)
18
+ * with literal arguments (e.g., 'parent_table'), and the function body has
19
+ * CASE/WHEN branches that don't cover those arguments, report a warning.
20
+ */
21
+ export declare function buildTriggerDispatchGapWarnings(params: {
22
+ tableNodes: Map<string, SchemaGraphTableNode>;
23
+ sources: LoadedSqlSources;
24
+ }): BoundaryGuidanceWarning[];
25
+ /**
26
+ * Detect index names that appear in both declarative and idempotent layers.
27
+ * This is typically redundant — declarative indexes are pg-schema-diff managed,
28
+ * and idempotent IF NOT EXISTS copies create silent redundancy.
29
+ */
30
+ export declare function buildCrossLayerDuplicateIndexWarnings(sources: LoadedSqlSources): BoundaryGuidanceWarning[];
14
31
  export { buildBoundaryGuidanceWarnings };
15
32
  //# sourceMappingURL=schema-guardrail-graph-guidance.d.ts.map
@@ -4,17 +4,11 @@
4
4
  * Purpose: Function ownership hashing, allowlist checking, and
5
5
  * defined function/boundary metadata extraction
6
6
  */
7
- import { type DuplicateFunctionOwnershipFinding } from '../utils/duplicate-function-ownership.js';
7
+ import { isAllowlistedDuplicateFunction } from '../utils/duplicate-function-ownership-allowlist.js';
8
8
  import { type SqlFile } from '../utils/declarative-dependency-sql-utils.js';
9
9
  import { type DefinedFunctionMetadata, type ManagedBoundaryMetadata } from './schema-guardrail-graph-types.js';
10
- import type { SchemaGuardrailConfig } from './schema-guardrail-types.js';
11
10
  declare function normalizeFunctionStatementForHash(statement: string): string;
12
11
  declare function buildFunctionBodyHashMap(files: SqlFile[], layer: 'declarative' | 'idempotent'): Map<string, string>;
13
- declare function isAllowlistedDuplicateFunction(params: {
14
- finding: DuplicateFunctionOwnershipFinding;
15
- allowlist: SchemaGuardrailConfig['allowedDuplicateFunctions'];
16
- bodyHashes: Map<string, string>;
17
- }): boolean;
18
12
  /**
19
13
  * Collect qualified object references from SQL function bodies
20
14
  */
@@ -5,7 +5,7 @@
5
5
  * Includes: Trigger extraction, declarative file parsing,
6
6
  * table/FK/dependency/file node construction
7
7
  */
8
- import { type SqlFile } from '../utils/declarative-dependency-sql-utils.js';
8
+ import type { SqlFile } from '../utils/declarative-dependency-sql-utils.js';
9
9
  import { type DeclarativeFileRecord, type DefinedFunctionMetadata, type ManagedBoundaryMetadata, type IdempotentTouchMetadata } from './schema-guardrail-graph-types.js';
10
10
  import type { SchemaGuardrailConfig, SchemaGraphFileDependencyEdge, SchemaGraphFileNode, SchemaGraphFunctionClaim, SchemaGraphPolicyClaim, SchemaGraphPolicyRef, SchemaGraphTableNode, SchemaGraphTriggerRef, SchemaGuardrailReport } from './schema-guardrail-types.js';
11
11
  declare function parseCreateTriggerStatement(statement: string): {
@@ -4,7 +4,7 @@
4
4
  * Purpose: SQL string sanitization, pattern matching, and metadata extraction
5
5
  * for idempotent file analysis
6
6
  */
7
- import { type SqlFile } from '../utils/declarative-dependency-sql-utils.js';
7
+ import type { SqlFile } from '../utils/declarative-dependency-sql-utils.js';
8
8
  import type { IdempotentTouchMetadata } from './schema-guardrail-graph-types.js';
9
9
  declare function normalizeSqlIdentifier(value: string): string;
10
10
  declare function consumeSingleQuotedLiteral(params: {
@@ -3,8 +3,8 @@ export type SchemaManagedBlockKind = 'file-header' | 'table-header';
3
3
  export type SchemaGuardrailMode = 'check' | 'sync';
4
4
  export type SchemaGraphFileLayer = 'declarative' | 'idempotent';
5
5
  export type SchemaGraphFileAuthoringRole = 'declarative-owner' | 'operational';
6
- export type BoundaryGuidanceWarningKind = 'schema' | 'function' | 'policy' | 'security_definer' | 'trigger_function' | 'managed_boundary';
7
- export type LocalBlindSpotBlockerKind = 'cross-schema-rls' | 'dynamic-sql' | 'extension-placement';
6
+ export type BoundaryGuidanceWarningKind = 'schema' | 'function' | 'policy' | 'security_definer' | 'trigger_function' | 'trigger_dispatch_gap' | 'managed_boundary';
7
+ export type LocalBlindSpotBlockerKind = 'cross-schema-rls' | 'dynamic-sql' | 'dynamic-sql-infra' | 'extension-placement';
8
8
  export type SchemaGuardrailPhaseId = 'load_sources' | 'build_static_graph' | 'validate_ownership' | 'compare_generated_headers' | 'refresh_generated_headers' | 'handoff_db_sync' | 'runtime_reconcile' | 'publish_report';
9
9
  export type SchemaGuardrailFailureCode = 'source_load_failed' | 'duplicate_table_owner' | 'duplicate_function_owner' | 'policy_ownership_conflict' | 'raw_cross_schema_rls_blocked' | 'dynamic_sql_blocked' | 'extension_placement_blocked' | 'stale_generated_header' | 'generated_header_validation_failed' | 'generated_header_rewrite_failed' | 'static_graph_build_failed' | 'critical_runtime_graph_contradiction' | 'sync_apply_failed';
10
10
  export interface SchemaGraphFileNode {
@@ -58,6 +58,8 @@ export interface SchemaGraphTriggerRef {
58
58
  timing: 'BEFORE' | 'AFTER' | 'INSTEAD OF';
59
59
  event: string;
60
60
  functionName?: string;
61
+ /** Literal string arguments passed to the trigger function (e.g., 'parent_table') */
62
+ functionArgs?: string[];
61
63
  }
62
64
  export interface SchemaGraphTableNode {
63
65
  schema: string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * AI HINT: Changed Files Detector for Precheck Scope Separation
3
+ *
4
+ * Purpose: Detect which SQL files have been modified in the current branch
5
+ * to separate "current-change blockers" from "repo-wide baseline blockers".
6
+ *
7
+ * Uses git diff against the merge-base of the current branch and main.
8
+ */
9
+ /**
10
+ * Get list of SQL files changed in the current branch compared to the default branch.
11
+ * Falls back to staged + unstaged changes if merge-base detection fails.
12
+ *
13
+ * Returns relative paths from the repository root.
14
+ */
15
+ export declare function getChangedSqlFiles(): string[];
16
+ /**
17
+ * Classify a blocker message as "from changed files" or "baseline".
18
+ * Extracts file path from blocker message and checks against changed files set.
19
+ */
20
+ export declare function classifyBlockerScope(blockerMessage: string, changedFiles: Set<string>): 'current-change' | 'baseline';
21
+ //# sourceMappingURL=changed-files-detector.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { DuplicateFunctionOwnershipFinding } from './duplicate-function-ownership.js';
2
+ import type { SchemaGuardrailConfig } from '../sync/schema-guardrail-types.js';
3
+ export declare function isAllowlistedDuplicateFunction(params: {
4
+ finding: DuplicateFunctionOwnershipFinding;
5
+ allowlist: SchemaGuardrailConfig['allowedDuplicateFunctions'];
6
+ bodyHashes?: Map<string, string>;
7
+ }): boolean;
8
+ export declare function filterAllowlistedDuplicateFunctions(params: {
9
+ findings: DuplicateFunctionOwnershipFinding[];
10
+ allowlist: SchemaGuardrailConfig['allowedDuplicateFunctions'];
11
+ bodyHashes?: Map<string, string>;
12
+ }): DuplicateFunctionOwnershipFinding[];
13
+ //# sourceMappingURL=duplicate-function-ownership-allowlist.d.ts.map
@@ -99,4 +99,16 @@ export declare function diffSchema(params: {
99
99
  * // Returns: ['public.area_metrics', 'public.floor_metrics', ...]
100
100
  */
101
101
  export declare function extractTablesFromIdempotentSql(idempotentDir: string, projectRoot?: string): string[];
102
+ /**
103
+ * Extract glob patterns for dynamically-created tables from idempotent SQL.
104
+ *
105
+ * Detects patterns like:
106
+ * EXECUTE format('CREATE TABLE %I.%I', schema_var, prefix || suffix)
107
+ * EXECUTE format('CREATE TABLE IF NOT EXISTS %s.%s', ...)
108
+ * EXECUTE 'CREATE TABLE ' || schema || '.' || table_prefix || ...
109
+ *
110
+ * Returns glob patterns (e.g., "analytics._arc_*") suitable for
111
+ * buildTablePatternMatcher in table-source-classifier.
112
+ */
113
+ export declare function extractDynamicTablePatternsFromIdempotentSql(idempotentDir: string, projectRoot?: string): string[];
102
114
  //# sourceMappingURL=schema-sync.d.ts.map
@@ -2,6 +2,19 @@ export type ParsedSqlStatement = {
2
2
  statement: string;
3
3
  line: number;
4
4
  };
5
+ /**
6
+ * Detect `-- runa:allow-dynamic-sql` annotation in SQL file content.
7
+ * When present, dynamic SQL patterns (EXECUTE, FUNCTION DDL in idempotent)
8
+ * are treated as intentional rather than risky.
9
+ *
10
+ * Supports optional role: `-- runa:allow-dynamic-sql reason: partition-helper`
11
+ */
12
+ export declare const ALLOW_DYNAMIC_SQL_ANNOTATION: RegExp;
13
+ /**
14
+ * Extract the reason/role from a `-- runa:allow-dynamic-sql reason: ...` annotation.
15
+ * Returns the reason string if present, undefined otherwise.
16
+ */
17
+ export declare function extractDynamicSqlRole(content: string): string | undefined;
5
18
  export declare function splitSqlStatements(content: string): ParsedSqlStatement[];
6
19
  export declare function isNonDdlMaintenanceStatement(statement: string): boolean;
7
20
  export declare function isNonSchemaOperation(statement: string): boolean;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * Uses queue + index traversal to avoid O(n^2) behavior from shift().
5
5
  * Unreadable directories are ignored so callers can keep precheck resilient.
6
+ * Directories in IGNORED_DIRECTORY_NAMES are skipped to avoid false positives
7
+ * from legacy/archived SQL files.
6
8
  */
7
9
  export declare function collectSqlFilesRecursively(baseDir: string): Generator<string>;
8
10
  //# sourceMappingURL=sql-file-collector.d.ts.map
@@ -33,6 +33,42 @@
33
33
  * runa upgrade --templates-version <version> # Override templates version
34
34
  * runa upgrade --fresh # Clear templates cache before fetching
35
35
  */
36
+ import { type ConflictResolutionRule, type ConflictResolutionStrategy } from '@runa-ai/runa';
36
37
  import { Command } from 'commander';
38
+ interface UpgradeOptions {
39
+ preview?: boolean;
40
+ force?: boolean;
41
+ keepLocal?: boolean;
42
+ yes?: boolean;
43
+ verify?: boolean;
44
+ packages?: boolean;
45
+ /** Keep backup after successful upgrade (for manual rollback) */
46
+ backup?: boolean;
47
+ /** Rollback to a specific transaction ID */
48
+ rollback?: string;
49
+ /** Rollback to the latest backup */
50
+ rollbackLatest?: boolean;
51
+ /** List available backups */
52
+ listBackups?: boolean;
53
+ /** Only sync specific categories */
54
+ only?: string;
55
+ /** Templates version override */
56
+ templatesVersion?: string;
57
+ /** Clear templates cache */
58
+ fresh?: boolean;
59
+ }
60
+ interface UpgradeConflictResolutionConfig {
61
+ defaultStrategy: ConflictResolutionStrategy;
62
+ rules: ConflictResolutionRule[];
63
+ }
64
+ export declare function findFilesWithMergeMarkers(targetDir: string): string[];
65
+ export declare function assertNoExistingMergeMarkers(targetDir: string): void;
66
+ export declare function loadUpgradeConflictResolutionConfig(cwd?: string): UpgradeConflictResolutionConfig;
67
+ export declare function resolveTemplatesVersionForUpgrade(params: {
68
+ cwd: string;
69
+ options: UpgradeOptions;
70
+ shouldUpdatePackages: boolean;
71
+ }): Promise<string | undefined>;
37
72
  export declare const upgradeCommand: Command;
73
+ export {};
38
74
  //# sourceMappingURL=upgrade.d.ts.map
@@ -30,4 +30,13 @@ export declare const TEMPLATES_PACKAGE_NAME = "@r06-dev/runa-templates";
30
30
  * GitHub Packages registry URL.
31
31
  */
32
32
  export declare const GITHUB_PACKAGES_REGISTRY = "https://npm.pkg.github.com";
33
+ /**
34
+ * Source repository that controls template access.
35
+ * Users who can run template operations must be able to access this repository.
36
+ */
37
+ export declare const TEMPLATES_SOURCE_REPOSITORY = "r06-dev/runa";
38
+ /**
39
+ * GitHub API endpoint used to verify template source repository access.
40
+ */
41
+ export declare const TEMPLATES_SOURCE_REPOSITORY_API_URL = "https://api.github.com/repos/r06-dev/runa";
33
42
  //# sourceMappingURL=versions.d.ts.map