@runa-ai/runa-cli 0.10.1 → 0.10.3

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 (37) hide show
  1. package/dist/{chunk-Y5ANTCKE.js → chunk-EZ46JIEO.js} +5 -2
  2. package/dist/{chunk-XRLIZKB2.js → chunk-S7VGVFYF.js} +4934 -4289
  3. package/dist/{chunk-ZPE52NEK.js → chunk-SS7RIWW3.js} +1 -1
  4. package/dist/{chunk-PAWNJA3N.js → chunk-XFXGFUAM.js} +1 -1
  5. package/dist/{ci-3HZWUQFN.js → ci-6P7VK6WB.js} +3 -3
  6. package/dist/{cli-RES5QRC2.js → cli-Q665YRVT.js} +8 -8
  7. package/dist/commands/build/contract.d.ts +2 -2
  8. package/dist/commands/build/machine.d.ts +6 -6
  9. package/dist/commands/ci/commands/ci-prod-types.d.ts +1 -1
  10. package/dist/commands/ci/machine/contract.d.ts +10 -10
  11. package/dist/commands/ci/machine/machine.d.ts +3 -3
  12. package/dist/commands/ci/utils/ci-summary.d.ts +3 -3
  13. package/dist/commands/db/apply/contract.d.ts +1 -1
  14. package/dist/commands/db/apply/helpers/plan-check-filter.d.ts +1 -1
  15. package/dist/commands/db/apply/helpers/planner-artifact.d.ts +1 -1
  16. package/dist/commands/db/commands/db-preview-profile.d.ts +1 -1
  17. package/dist/commands/db/preflight/contract.d.ts +1 -1
  18. package/dist/commands/db/sync/contract.d.ts +5 -5
  19. package/dist/commands/db/sync/machine.d.ts +2 -2
  20. package/dist/commands/db/sync/schema-guardrail-graph-metadata.d.ts +1 -7
  21. package/dist/commands/db/sync/schema-guardrail-graph.d.ts +2 -0
  22. package/dist/commands/db/sync/schema-guardrail-rewrite.d.ts +8 -0
  23. package/dist/commands/db/sync/schema-guardrail-types.d.ts +2 -2
  24. package/dist/commands/db/utils/duplicate-function-ownership-allowlist.d.ts +13 -0
  25. package/dist/commands/db/utils/function-acl-manifest.d.ts +39 -0
  26. package/dist/commands/upgrade.d.ts +36 -0
  27. package/dist/{db-PRGL7PBX.js → db-BQOVOQXU.js} +816 -732
  28. package/dist/index.js +3 -3
  29. package/dist/{risk-detector-S7XQF4I2.js → risk-detector-GDDLISVE.js} +1 -1
  30. package/dist/{risk-detector-core-TGFKWHRS.js → risk-detector-core-YI3M6INI.js} +1 -1
  31. package/dist/{risk-detector-plpgsql-O32TUR34.js → risk-detector-plpgsql-4GWEQXUG.js} +1 -1
  32. package/dist/{template-check-VNNQQXCX.js → template-check-D35F2GDP.js} +4 -0
  33. package/dist/{upgrade-LBO3Z3J7.js → upgrade-X7P6WRD5.js} +189 -19
  34. package/dist/{vuln-check-5JJ2YAJW.js → vuln-check-WW43E7PS.js} +1 -1
  35. package/dist/{vuln-checker-JF5234BL.js → vuln-checker-BC3ZAXJ3.js} +1 -1
  36. package/dist/{watch-RFVCEQLH.js → watch-4RHXVCQ3.js} +1 -1
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
3
  import { getRequestedCommandNameFromArgv } from './chunk-UWWSAPDR.js';
4
- import { CLI_VERSION } from './chunk-ZPE52NEK.js';
4
+ import { CLI_VERSION } from './chunk-SS7RIWW3.js';
5
5
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
6
6
  import { realpathSync } from 'fs';
7
7
  import { fileURLToPath } from 'url';
@@ -36,7 +36,7 @@ async function getProgram(options) {
36
36
  };
37
37
  const nextKey = getProgramCacheKey(resolvedOptions);
38
38
  if (!programInstance || programCacheKey !== nextKey) {
39
- const { createProgram } = await import('./cli-RES5QRC2.js');
39
+ const { createProgram } = await import('./cli-Q665YRVT.js');
40
40
  programInstance = await createProgram(resolvedOptions);
41
41
  programCacheKey = nextKey;
42
42
  }
@@ -60,7 +60,7 @@ async function runCliFromProcessArgv() {
60
60
  return;
61
61
  }
62
62
  const { setupSignalHandlers } = await import('./signal-handler-DO3OANW5.js');
63
- const { executeProgram } = await import('./cli-RES5QRC2.js');
63
+ const { executeProgram } = await import('./cli-Q665YRVT.js');
64
64
  setupSignalHandlers();
65
65
  const options = getProgramLoadOptions(argv);
66
66
  const program = await getProgram(options);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- export { categorizeRisks, detectSchemaRisks } from './chunk-PAWNJA3N.js';
3
+ export { categorizeRisks, detectSchemaRisks } from './chunk-XFXGFUAM.js';
4
4
  import './chunk-VRXHCR5K.js';
5
5
 
6
6
  createRequire(import.meta.url);
@@ -54,7 +54,7 @@ var UNQUALIFIED_EXTENSION_REFERENCE_PATTERNS = [
54
54
  var plpgsqlModulePromise = null;
55
55
  async function loadPlpgsqlRiskDetectorModule() {
56
56
  if (!plpgsqlModulePromise) {
57
- plpgsqlModulePromise = import('./risk-detector-plpgsql-O32TUR34.js').catch((error) => {
57
+ plpgsqlModulePromise = import('./risk-detector-plpgsql-4GWEQXUG.js').catch((error) => {
58
58
  plpgsqlModulePromise = null;
59
59
  throw error;
60
60
  });
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { splitPlpgsqlStatementsWithOffsets, parseTopLevelAssignment, extractExecuteExpressions, skipWhitespace, extractStaticSqlFromExpression, mergeStringEnvValue, skipIdentifier } from './chunk-Y5ANTCKE.js';
3
+ import { splitPlpgsqlStatementsWithOffsets, parseTopLevelAssignment, extractExecuteExpressions, skipWhitespace, extractStaticSqlFromExpression, mergeStringEnvValue, skipIdentifier } from './chunk-EZ46JIEO.js';
4
4
  import { stripSqlCommentsPreserveLines, buildLineStarts, lineNumberFromIndex, stripSqlStringsPreserveLines, detectRisksFromContent, stripSqlForPatternMatching } from './chunk-3FDQW524.js';
5
5
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
6
6
 
@@ -138,6 +138,10 @@ var RUNA_ONLY_FILES = [
138
138
  "packages/database/scripts/db-sync-db-state.test.ts",
139
139
  "packages/database/scripts/db-sync-local-url.test.ts",
140
140
  "packages/database/scripts/db-sync-pg-schema-diff.test.ts",
141
+ "packages/database/scripts/db-sync-shadow-db.ts",
142
+ // Shadow DB diffing helper (runa-repo internal)
143
+ "packages/database/scripts/db-sync-shadow-db.test.ts",
144
+ // Shadow DB tests (runa-repo internal)
141
145
  "packages/database/scripts/db-sync-schema-discovery.test.ts",
142
146
  "packages/database/scripts/db-sync-schema-sort.ts",
143
147
  "packages/database/scripts/db-sync-seeds-runtime.test.ts",
@@ -8,7 +8,9 @@ import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
8
8
  import './chunk-WJXC4MVY.js';
9
9
  import './chunk-HKUWEGUX.js';
10
10
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
11
- import { createCLILogger, CLIError, UpgradeTransaction, readRunaVersion, syncTemplates, SyncOutputSchema, findConflictFiles, preCheckSync } from '@runa-ai/runa';
11
+ import { existsSync, readdirSync, statSync, readFileSync } from 'fs';
12
+ import { join, extname } from 'path';
13
+ import { createCLILogger, CLIError, loadRunaConfig, UpgradeTransaction, readRunaVersion, syncTemplates, SyncOutputSchema, findConflictFiles, preCheckSync } from '@runa-ai/runa';
12
14
  import { Command } from 'commander';
13
15
  import { execa } from 'execa';
14
16
 
@@ -36,6 +38,154 @@ function parseOnlyOption(only) {
36
38
  }
37
39
  return valid;
38
40
  }
41
+ var MERGE_MARKER_PATTERN = /^<{7}\s|^={7}$|^>{7}\s/m;
42
+ var MERGE_MARKER_SCAN_EXTENSIONS = [
43
+ ".ts",
44
+ ".tsx",
45
+ ".js",
46
+ ".jsx",
47
+ ".md",
48
+ ".yml",
49
+ ".yaml",
50
+ ".json",
51
+ ".toml"
52
+ ];
53
+ var MERGE_MARKER_SCAN_DIRS = [".claude", ".codex", ".github", "supabase"];
54
+ var MERGE_MARKER_SKIP_DIRS = ["node_modules", ".git", "dist"];
55
+ var MERGE_MARKER_ROOT_FILES = [
56
+ "AGENTS.md",
57
+ "CLAUDE.md",
58
+ "runa.config.ts",
59
+ "biome.json",
60
+ "turbo.json",
61
+ "vercel.json",
62
+ ".env.example",
63
+ ".npmrc"
64
+ ];
65
+ function fileHasMergeMarkers(filePath) {
66
+ try {
67
+ return MERGE_MARKER_PATTERN.test(readFileSync(filePath, "utf-8"));
68
+ } catch {
69
+ return false;
70
+ }
71
+ }
72
+ function shouldScanMergeMarkerEntry(entry) {
73
+ return MERGE_MARKER_SCAN_EXTENSIONS.includes(extname(entry).toLowerCase());
74
+ }
75
+ function scanDirForMergeMarkers(dir, relativePath, results) {
76
+ let entries;
77
+ try {
78
+ entries = readdirSync(dir);
79
+ } catch {
80
+ return;
81
+ }
82
+ for (const entry of entries) {
83
+ if (MERGE_MARKER_SKIP_DIRS.includes(entry)) continue;
84
+ const fullPath = join(dir, entry);
85
+ const relPath = join(relativePath, entry);
86
+ try {
87
+ const stats = statSync(fullPath);
88
+ if (stats.isDirectory()) {
89
+ scanDirForMergeMarkers(fullPath, relPath, results);
90
+ continue;
91
+ }
92
+ if (stats.isFile() && shouldScanMergeMarkerEntry(entry) && fileHasMergeMarkers(fullPath)) {
93
+ results.push(relPath);
94
+ }
95
+ } catch {
96
+ }
97
+ }
98
+ }
99
+ function findFilesWithMergeMarkers(targetDir) {
100
+ const filesWithMarkers = [];
101
+ for (const checkDir of MERGE_MARKER_SCAN_DIRS) {
102
+ const dirPath = join(targetDir, checkDir);
103
+ if (existsSync(dirPath)) {
104
+ scanDirForMergeMarkers(dirPath, checkDir, filesWithMarkers);
105
+ }
106
+ }
107
+ for (const file of MERGE_MARKER_ROOT_FILES) {
108
+ const filePath = join(targetDir, file);
109
+ if (existsSync(filePath) && fileHasMergeMarkers(filePath)) {
110
+ filesWithMarkers.push(file);
111
+ }
112
+ }
113
+ return filesWithMarkers.sort();
114
+ }
115
+ function assertNoExistingMergeMarkers(targetDir) {
116
+ const filesWithMarkers = findFilesWithMergeMarkers(targetDir);
117
+ if (filesWithMarkers.length === 0) return;
118
+ throw new CLIError(
119
+ `${filesWithMarkers.length} file(s) have unresolved or partial merge markers`,
120
+ "UPGRADE_EXISTING_MERGE_MARKERS",
121
+ [
122
+ `Files: ${filesWithMarkers.slice(0, 5).join(", ")}${filesWithMarkers.length > 5 ? ` and ${filesWithMarkers.length - 5} more` : ""}`,
123
+ "Resolve previous merge markers before running `runa upgrade` again",
124
+ "Then run: runa check"
125
+ ]
126
+ );
127
+ }
128
+ function loadUpgradeConflictResolutionConfig(cwd = process.cwd()) {
129
+ const loaded = loadRunaConfig(cwd);
130
+ const conflictResolution = loaded?.config.upgrade?.conflictResolution;
131
+ return {
132
+ defaultStrategy: conflictResolution?.default ?? "manual",
133
+ rules: conflictResolution?.rules ?? []
134
+ };
135
+ }
136
+ async function resolveInstalledCliTemplatesVersion(cwd = process.cwd()) {
137
+ const script = `
138
+ const fs = require('node:fs');
139
+ const path = require('node:path');
140
+ const entry = require.resolve('@runa-ai/runa-cli');
141
+ const versionsPath = path.join(path.dirname(entry), 'constants', 'versions.js');
142
+ const content = fs.readFileSync(versionsPath, 'utf-8');
143
+ const match = content.match(/COMPATIBLE_TEMPLATES_VERSION\\s*=\\s*['"]([^'"]+)['"]/);
144
+ if (!match) process.exit(2);
145
+ process.stdout.write(match[1]);
146
+ `;
147
+ try {
148
+ const result = await execa("pnpm", ["exec", "node", "-e", script], {
149
+ cwd,
150
+ stdio: "pipe"
151
+ });
152
+ return result.stdout.trim() || null;
153
+ } catch {
154
+ return null;
155
+ }
156
+ }
157
+ async function resolveTemplatesVersionForUpgrade(params) {
158
+ if (params.options.templatesVersion) {
159
+ return params.options.templatesVersion;
160
+ }
161
+ if (params.options.preview && params.shouldUpdatePackages) {
162
+ throw new CLIError(
163
+ "Preview cannot determine target template compatibility before package installation",
164
+ "UPGRADE_PREVIEW_TEMPLATE_PARITY_UNKNOWN",
165
+ [
166
+ "Run without --preview to install packages first",
167
+ "Or pass --templates-version <version> explicitly",
168
+ "Or run with --no-packages for template-only preview"
169
+ ]
170
+ );
171
+ }
172
+ const installedVersion = await resolveInstalledCliTemplatesVersion(params.cwd);
173
+ if (installedVersion) {
174
+ return installedVersion;
175
+ }
176
+ if (params.shouldUpdatePackages) {
177
+ throw new CLIError(
178
+ "Could not determine compatible templates version from the installed local CLI",
179
+ "UPGRADE_TEMPLATE_PARITY_UNRESOLVED",
180
+ [
181
+ "Ensure @runa-ai/runa-cli is installed locally",
182
+ "Re-run `runa upgrade` after package installation succeeds",
183
+ "Or pass --templates-version <version> explicitly"
184
+ ]
185
+ );
186
+ }
187
+ return void 0;
188
+ }
39
189
  function logVersionInfo(logger, preCheck) {
40
190
  if (preCheck.versionJump) {
41
191
  const { from, to, isMajor, distance } = preCheck.versionJump;
@@ -381,12 +531,16 @@ async function getInstalledVersion(packageName) {
381
531
  return "unknown";
382
532
  }
383
533
  }
384
- async function runPreCheck(logger, options, isNonInteractive, templatesDir) {
534
+ async function runPreCheck(logger, options, isNonInteractive, templatesDir, conflictResolution) {
385
535
  if (options.force || options.keepLocal) return;
386
536
  const preCheck = await preCheckSync({
387
537
  targetDir: process.cwd(),
388
538
  mode: "sync",
389
- templatesDir
539
+ templatesDir,
540
+ conflictResolution: {
541
+ defaultStrategy: conflictResolution.defaultStrategy,
542
+ rules: conflictResolution.rules
543
+ }
390
544
  });
391
545
  logVersionInfo(logger, preCheck);
392
546
  logConflictSummary(logger, preCheck, isNonInteractive, options.preview === true);
@@ -451,9 +605,9 @@ async function executePackageUpdate(logger, options) {
451
605
  }
452
606
  }
453
607
  async function executeTemplateSync(ctx, templatesDir) {
454
- const { logger, options, onlyCategories, isNonInteractive } = ctx;
608
+ const { logger, options, onlyCategories, isNonInteractive, conflictResolution } = ctx;
455
609
  logger.section("Upgrade SDK Templates");
456
- await runPreCheck(logger, options, isNonInteractive, templatesDir);
610
+ await runPreCheck(logger, options, isNonInteractive, templatesDir, conflictResolution);
457
611
  logModeInfo(logger, options, onlyCategories);
458
612
  const result = await syncTemplates({
459
613
  targetDir: process.cwd(),
@@ -463,7 +617,11 @@ async function executeTemplateSync(ctx, templatesDir) {
463
617
  keepLocal: options.keepLocal === true,
464
618
  keepBackup: options.backup === true,
465
619
  only: onlyCategories.length > 0 ? onlyCategories : void 0,
466
- templatesDir
620
+ templatesDir,
621
+ conflictResolution: {
622
+ defaultStrategy: conflictResolution.defaultStrategy,
623
+ rules: conflictResolution.rules
624
+ }
467
625
  });
468
626
  emitJsonSuccess(upgradeCommand, SyncOutputSchema, result);
469
627
  logHumanOutput(logger, result, options);
@@ -492,20 +650,28 @@ async function executeVerification(logger) {
492
650
  }
493
651
  }
494
652
  async function executeUpgrade(ctx) {
495
- const { logger, options, shouldUpdatePackages } = ctx;
496
- logger.section("Fetching Templates");
497
- const templateResult = await fetchTemplates({
498
- version: options.templatesVersion,
499
- fresh: options.fresh,
500
- verbose: process.env.DEBUG === "true"
501
- });
502
- logger.info(
503
- templateResult.cached ? `Using ${templateResult.version === "workspace" ? "workspace" : "cached"} templates v${templateResult.version}` : `Fetched templates v${templateResult.version}`
504
- );
653
+ const { logger, options, shouldUpdatePackages, shouldSyncTemplates } = ctx;
654
+ assertNoExistingMergeMarkers(process.cwd());
505
655
  if (shouldUpdatePackages) {
506
656
  await executePackageUpdate(logger, options);
507
657
  }
508
- await executeTemplateSync(ctx, templateResult.templatesDir);
658
+ if (shouldSyncTemplates) {
659
+ const templatesVersion = await resolveTemplatesVersionForUpgrade({
660
+ cwd: process.cwd(),
661
+ options,
662
+ shouldUpdatePackages
663
+ });
664
+ logger.section("Fetching Templates");
665
+ const templateResult = await fetchTemplates({
666
+ version: templatesVersion,
667
+ fresh: options.fresh,
668
+ verbose: process.env.DEBUG === "true"
669
+ });
670
+ logger.info(
671
+ templateResult.cached ? `Using ${templateResult.version === "workspace" ? "workspace" : "cached"} templates v${templateResult.version}` : `Fetched templates v${templateResult.version}`
672
+ );
673
+ await executeTemplateSync(ctx, templateResult.templatesDir);
674
+ }
509
675
  if (options.verify && !options.preview) {
510
676
  await executeVerification(logger);
511
677
  }
@@ -607,14 +773,18 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SDK packages an
607
773
  }
608
774
  const onlyCategories = parseOnlyOption(options.only);
609
775
  const shouldUpdatePackages = options.packages !== false && (onlyCategories.length === 0 || onlyCategories.includes("packages"));
776
+ const shouldSyncTemplates = onlyCategories.length === 0 || onlyCategories.some((category) => category !== "packages");
610
777
  const isJsonMode = process.env.RUNA_OUTPUT_FORMAT === "json";
611
778
  const isNonInteractive = options.yes || isJsonMode || !process.stdin.isTTY;
779
+ const conflictResolution = loadUpgradeConflictResolutionConfig(process.cwd());
612
780
  const ctx = {
613
781
  logger,
614
782
  options,
615
783
  onlyCategories,
616
784
  shouldUpdatePackages,
617
- isNonInteractive
785
+ shouldSyncTemplates,
786
+ isNonInteractive,
787
+ conflictResolution
618
788
  };
619
789
  try {
620
790
  await executeUpgrade(ctx);
@@ -634,4 +804,4 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SDK packages an
634
804
  }
635
805
  });
636
806
 
637
- export { upgradeCommand };
807
+ export { assertNoExistingMergeMarkers, findFilesWithMergeMarkers, loadUpgradeConflictResolutionConfig, resolveTemplatesVersionForUpgrade, upgradeCommand };
@@ -71,7 +71,7 @@ var vulnCheckCommand = new Command("vuln-check").description("Run comprehensive
71
71
  const logger = createCLILogger("vuln-check");
72
72
  const isJsonMode = getOutputFormatFromEnv() === "json" || options.format === "json";
73
73
  try {
74
- const { VulnChecker } = await import('./vuln-checker-JF5234BL.js');
74
+ const { VulnChecker } = await import('./vuln-checker-BC3ZAXJ3.js');
75
75
  const categoryMap = {
76
76
  code: ["injection", "auth", "crypto"],
77
77
  deps: ["dependency"],
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { CLI_VERSION } from './chunk-ZPE52NEK.js';
3
+ import { CLI_VERSION } from './chunk-SS7RIWW3.js';
4
4
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
5
5
  import { glob } from 'glob';
6
6
  import { exec } from 'child_process';
@@ -284,7 +284,7 @@ function validateSqlSchema(content, errors, warnings) {
284
284
  var riskDetectorLoader = null;
285
285
  function loadRiskDetectorModule() {
286
286
  if (!riskDetectorLoader) {
287
- riskDetectorLoader = import('./risk-detector-S7XQF4I2.js').then((module) => ({
287
+ riskDetectorLoader = import('./risk-detector-GDDLISVE.js').then((module) => ({
288
288
  detectSchemaRisks: module.detectSchemaRisks
289
289
  })).catch((error) => {
290
290
  riskDetectorLoader = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runa-ai/runa-cli",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "private": false,
5
5
  "description": "AI-powered DevOps CLI",
6
6
  "type": "module",