@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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { loadEnvFiles } from './chunk-WPMR7RQ4.js';
3
+ import { loadEnvFiles } from './chunk-IWVXI5O4.js';
4
4
  import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
5
5
  import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
6
6
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
3
  import { psqlQuery, stripSqlComments } from './chunk-A6A7JIRD.js';
4
- import { loadRunaConfig } from './chunk-5NKWR4FF.js';
4
+ import { loadRunaConfig } from './chunk-OERS32LW.js';
5
5
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
6
- import { existsSync, writeFileSync, unlinkSync, readdirSync, readFileSync, mkdirSync, realpathSync } from 'fs';
7
- import path2, { join, isAbsolute, relative } from 'path';
6
+ import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync, realpathSync } from 'fs';
7
+ import path, { join, isAbsolute, relative } from 'path';
8
8
  import { SUPABASE_SYSTEM_SCHEMAS, detectSchemaNames } from '@runa-ai/runa';
9
9
  import { isTable, getTableUniqueName, getTableName } from 'drizzle-orm';
10
10
  import { isPgEnum } from 'drizzle-orm/pg-core';
@@ -14,69 +14,6 @@ import { introspectDatabase } from '@runa-ai/runa/test-generators';
14
14
 
15
15
  createRequire(import.meta.url);
16
16
 
17
- // src/utils/env-local-bridge.ts
18
- init_esm_shims();
19
- var DEFAULT_API_PORT = 54321;
20
- var DEFAULT_DB_PORT = 54322;
21
- var RUNA_ENV_LOCAL_MARKER = "# RUNA_AUTO_GENERATED \u2014 do not edit (created by `runa db start`)";
22
- function envLocalPath(projectRoot) {
23
- return path2.join(projectRoot, ".env.local");
24
- }
25
- function isNonDefaultPorts(config) {
26
- return config.api !== DEFAULT_API_PORT || config.db !== DEFAULT_DB_PORT;
27
- }
28
- function buildEnvLocalContent(config) {
29
- const dbUrl = `postgresql://postgres:postgres@${config.host}:${config.db}/postgres`;
30
- return [
31
- RUNA_ENV_LOCAL_MARKER,
32
- `# Supabase is running on non-default ports (default: api=${DEFAULT_API_PORT}, db=${DEFAULT_DB_PORT}).`,
33
- "# This file overrides .env.development so that `pnpm dev` uses correct ports.",
34
- "# Removed automatically by `runa db stop`. Safe to delete manually.",
35
- `DATABASE_URL=${dbUrl}`,
36
- `DATABASE_URL_LISTENER=${dbUrl}`,
37
- `DATABASE_URL_ADMIN=${dbUrl}`,
38
- `DATABASE_URL_SERVICE=${dbUrl}`,
39
- `NEXT_PUBLIC_SUPABASE_URL=http://${config.host}:${config.api}`,
40
- ""
41
- ].join("\n");
42
- }
43
- function isRunaManagedEnvLocal(projectRoot) {
44
- const filePath = envLocalPath(projectRoot);
45
- try {
46
- const content = readFileSync(filePath, "utf-8");
47
- return content.startsWith(RUNA_ENV_LOCAL_MARKER);
48
- } catch {
49
- return false;
50
- }
51
- }
52
- function writeEnvLocalBridge(projectRoot, config) {
53
- const filePath = envLocalPath(projectRoot);
54
- const fileExists = existsSync(filePath);
55
- if (isNonDefaultPorts(config)) {
56
- if (fileExists && !isRunaManagedEnvLocal(projectRoot)) {
57
- return { written: false, reason: "user-managed" };
58
- }
59
- writeFileSync(filePath, buildEnvLocalContent(config), "utf-8");
60
- return { written: true, ports: { api: config.api, db: config.db } };
61
- }
62
- if (fileExists && isRunaManagedEnvLocal(projectRoot)) {
63
- unlinkSync(filePath);
64
- return { written: false, reason: "stale-removed" };
65
- }
66
- return { written: false, reason: "default-ports" };
67
- }
68
- function removeEnvLocalBridge(projectRoot) {
69
- const filePath = envLocalPath(projectRoot);
70
- if (!existsSync(filePath)) {
71
- return { removed: false, reason: "not-found" };
72
- }
73
- if (!isRunaManagedEnvLocal(projectRoot)) {
74
- return { removed: false, reason: "user-managed" };
75
- }
76
- unlinkSync(filePath);
77
- return { removed: true };
78
- }
79
-
80
17
  // src/commands/db/utils/schema-sync.ts
81
18
  init_esm_shims();
82
19
  var VALID_PG_IDENTIFIER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
@@ -112,16 +49,16 @@ var ERROR_MESSAGES = {
112
49
  SCHEMA_NOT_FOUND: "Schema file not found"
113
50
  };
114
51
  function containsPathTraversal(inputPath) {
115
- const normalized = path2.normalize(inputPath);
52
+ const normalized = path.normalize(inputPath);
116
53
  return normalized.includes("..") || inputPath.includes("\0");
117
54
  }
118
55
  function isPathWithinBase(filePath, baseDir) {
119
56
  try {
120
- const resolvedFile = path2.resolve(filePath);
121
- const resolvedBase = path2.resolve(baseDir);
122
- const normalizedFile = path2.normalize(resolvedFile);
123
- const normalizedBase = path2.normalize(resolvedBase);
124
- return normalizedFile === normalizedBase || normalizedFile.startsWith(normalizedBase + path2.sep);
57
+ const resolvedFile = path.resolve(filePath);
58
+ const resolvedBase = path.resolve(baseDir);
59
+ const normalizedFile = path.normalize(resolvedFile);
60
+ const normalizedBase = path.normalize(resolvedBase);
61
+ return normalizedFile === normalizedBase || normalizedFile.startsWith(normalizedBase + path.sep);
125
62
  } catch {
126
63
  return false;
127
64
  }
@@ -130,13 +67,13 @@ function validateSchemaPath(dbPackagePath, projectRoot = process.cwd()) {
130
67
  if (containsPathTraversal(dbPackagePath)) {
131
68
  throw new Error(ERROR_MESSAGES.PATH_TRAVERSAL);
132
69
  }
133
- const schemaEntry = path2.join(dbPackagePath, "src", "schema", "index.ts");
134
- const absoluteSchemaPath = path2.resolve(projectRoot, schemaEntry);
70
+ const schemaEntry = path.join(dbPackagePath, "src", "schema", "index.ts");
71
+ const absoluteSchemaPath = path.resolve(projectRoot, schemaEntry);
135
72
  let resolvedProjectRoot;
136
73
  try {
137
74
  resolvedProjectRoot = realpathSync(projectRoot);
138
75
  } catch {
139
- resolvedProjectRoot = path2.resolve(projectRoot);
76
+ resolvedProjectRoot = path.resolve(projectRoot);
140
77
  }
141
78
  if (!isPathWithinBase(absoluteSchemaPath, resolvedProjectRoot)) {
142
79
  throw new Error(ERROR_MESSAGES.PATH_TRAVERSAL);
@@ -269,7 +206,7 @@ function diffSchema(params) {
269
206
  };
270
207
  }
271
208
  function extractTablesFromIdempotentSql(idempotentDir, projectRoot = process.cwd()) {
272
- const fullPath = path2.resolve(projectRoot, idempotentDir);
209
+ const fullPath = path.resolve(projectRoot, idempotentDir);
273
210
  if (!existsSync(fullPath)) {
274
211
  return [];
275
212
  }
@@ -278,7 +215,7 @@ function extractTablesFromIdempotentSql(idempotentDir, projectRoot = process.cwd
278
215
  try {
279
216
  const files = readdirSync(fullPath).filter((f) => f.endsWith(".sql"));
280
217
  for (const file of files) {
281
- const filePath = path2.join(fullPath, file);
218
+ const filePath = path.join(fullPath, file);
282
219
  const content = readFileSync(filePath, "utf-8");
283
220
  const contentWithoutComments = content.replace(/--.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
284
221
  for (const match of contentWithoutComments.matchAll(createTablePattern)) {
@@ -2038,4 +1975,4 @@ function logManifestSummary(manifest, conflicts) {
2038
1975
  console.log(" Path: .runa/manifests/tables.json\n");
2039
1976
  }
2040
1977
 
2041
- export { diffSchema, extractSchemaTablesAndEnums, extractTablesFromIdempotentSql, fetchDbTablesAndEnums, generateTablesManifest, removeEnvLocalBridge, writeEnvLocalBridge };
1978
+ export { buildTablePatternMatcher, diffSchema, extractSchemaTablesAndEnums, extractTablesFromIdempotentSql, fetchDbTablesAndEnums, generateTablesManifest, getSqlParserUtils };
@@ -15,9 +15,9 @@ function buildProductionDbSuggestions() {
15
15
  return [
16
16
  "Use --env local for local Supabase operations",
17
17
  "Production operations require a remote database URL",
18
- "Try `runa db apply production --check` after loading production env files",
19
- "If you are working in the runa repo, `pnpm runa db apply production --check` also works",
20
- "Or run `dotenvx run -f .env.keys -f .env.production -- runa db apply production --check`",
18
+ "Try `runa db preview production --profile compare-only` after loading production env files",
19
+ "If you are working in the runa repo, `pnpm runa db preview production --profile compare-only` also works",
20
+ "Or run `dotenvx run -f .env.keys -f .env.production -- runa db preview production --profile compare-only`",
21
21
  "Set DATABASE_URL_ADMIN or GH_DATABASE_URL_ADMIN to the production database URL"
22
22
  ];
23
23
  }
@@ -102,9 +102,9 @@ function resolveDatabaseTarget(environment) {
102
102
  throw new CLIError("Production database URL not found", "PRODUCTION_DB_URL_NOT_FOUND", [
103
103
  "Set GH_DATABASE_URL_ADMIN (CI) or DATABASE_URL_ADMIN (local) to a direct postgres URL",
104
104
  "Do not use GH_DATABASE_URL or DATABASE_URL for DDL operations",
105
- "Try `runa db apply production --check` after loading production env files",
106
- "If you are working in the runa repo, `pnpm runa db apply production --check` also works",
107
- "Or run `dotenvx run -f .env.keys -f .env.production -- runa db apply production --check`"
105
+ "Try `runa db preview production --profile compare-only` after loading production env files",
106
+ "If you are working in the runa repo, `pnpm runa db preview production --profile compare-only` also works",
107
+ "Or run `dotenvx run -f .env.keys -f .env.production -- runa db preview production --profile compare-only`"
108
108
  ]);
109
109
  }
110
110
  }