@runa-ai/runa-cli 0.6.0 → 0.7.1

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 (81) hide show
  1. package/dist/{build-BXUJKYHC.js → build-HUDIP6KU.js} +153 -164
  2. package/dist/{cache-H63JKFYH.js → cache-N7WNPEYF.js} +2 -3
  3. package/dist/check-LOMVIRHX.js +12 -0
  4. package/dist/{chunk-HPYJPB5Y.js → chunk-2APB25TT.js} +44 -10
  5. package/dist/chunk-3WDV32GA.js +33 -0
  6. package/dist/chunk-5FT3F36G.js +59 -0
  7. package/dist/{chunk-7QV7U6NI.js → chunk-6FAU4IGR.js} +2 -1
  8. package/dist/{chunk-CE3DEYFT.js → chunk-7B5C6U2K.js} +2 -208
  9. package/dist/{chunk-GOGRLQNP.js → chunk-AFY3TX4I.js} +1 -1
  10. package/dist/{chunk-KWX3JHCY.js → chunk-AKZAN4BC.js} +6 -1
  11. package/dist/{chunk-XJBQINSA.js → chunk-CCW3PLQY.js} +2 -2
  12. package/dist/{chunk-IBVVGH6X.js → chunk-EMB6IZFT.js} +17 -4
  13. package/dist/chunk-FHG3ILE4.js +2011 -0
  14. package/dist/{chunk-22CS6EMA.js → chunk-H2AHNI75.js} +1 -1
  15. package/dist/{chunk-UU55OH7P.js → chunk-KE6QJBZG.js} +2 -3
  16. package/dist/{check-6AB5NGWK.js → chunk-QM53IQHM.js} +14 -12
  17. package/dist/{chunk-RRGQCUKT.js → chunk-WJXC4MVY.js} +30 -3
  18. package/dist/chunk-XDCHRVE3.js +215 -0
  19. package/dist/{chunk-P7U52PBY.js → chunk-Z4Z5DNW4.js} +49 -2
  20. package/dist/{ci-V3PIG2GI.js → ci-XY6IKEDC.js} +1938 -238
  21. package/dist/cli/contract-output.d.ts +1 -0
  22. package/dist/{cli-GFRZCJQR.js → cli-UZA4RBNQ.js} +216 -173
  23. package/dist/commands/build/actors/validate.d.ts +2 -0
  24. package/dist/commands/check/commands/check.d.ts +8 -3
  25. package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +12 -6
  26. package/dist/commands/ci/machine/actors/db/production-preview.d.ts +10 -0
  27. package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +77 -0
  28. package/dist/commands/ci/machine/actors/db/schema-stats.d.ts +11 -0
  29. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +9 -1
  30. package/dist/commands/ci/machine/commands/machine-runner.d.ts +2 -0
  31. package/dist/commands/ci/machine/formatters/sections/production-schema-status.d.ts +30 -0
  32. package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
  33. package/dist/commands/ci/machine/helpers.d.ts +8 -0
  34. package/dist/commands/ci/machine/machine.d.ts +57 -4
  35. package/dist/commands/ci/machine/types.d.ts +2 -0
  36. package/dist/commands/ci/utils/execa-helpers.d.ts +1 -0
  37. package/dist/commands/db/commands/db-sync/error-classifier.d.ts +9 -0
  38. package/dist/commands/dev/actors/index.d.ts +5 -0
  39. package/dist/commands/dev/actors/tables-manifest.d.ts +16 -0
  40. package/dist/commands/dev/contract.d.ts +1 -1
  41. package/dist/commands/dev/guards.d.ts +24 -0
  42. package/dist/commands/dev/machine.d.ts +22 -3
  43. package/dist/commands/dev/types.d.ts +2 -0
  44. package/dist/commands/doctor.d.ts +9 -0
  45. package/dist/commands/inject-test-attrs/defaults.d.ts +9 -0
  46. package/dist/commands/template-check/commands/template-check.d.ts +1 -0
  47. package/dist/commands/template-check/contract.d.ts +1 -0
  48. package/dist/commands/utils/machine-state-logging.d.ts +20 -0
  49. package/dist/commands/utils/repo-root.d.ts +2 -0
  50. package/dist/constants/versions.d.ts +1 -1
  51. package/dist/{db-HR7CREX2.js → db-Q3GF7JWP.js} +518 -2234
  52. package/dist/{dev-A7RW6XQV.js → dev-5YXNPTCJ.js} +168 -49
  53. package/dist/doctor-MZLOA53G.js +44 -0
  54. package/dist/{env-B47Z4747.js → env-GMB3THRG.js} +6 -7
  55. package/dist/{env-files-K2C7O7L5.js → env-files-2UIUYLLR.js} +2 -2
  56. package/dist/{error-handler-4EYSDOSE.js → error-handler-HEXBRNVV.js} +2 -2
  57. package/dist/{hotfix-CULKKMGS.js → hotfix-NDTPY2T4.js} +4 -4
  58. package/dist/index.js +4 -4
  59. package/dist/{init-ELK5QCWR.js → init-U4VCRHTD.js} +5 -6
  60. package/dist/{inject-test-attrs-Y5UD5P7Q.js → inject-test-attrs-P44BVTQS.js} +5 -18
  61. package/dist/{link-C43JRZWY.js → link-VSNDVZZD.js} +2 -3
  62. package/dist/manifest-TMFLESHW.js +19 -0
  63. package/dist/{risk-detector-BXUY2WKS.js → risk-detector-4U6ZJ2G5.js} +1 -1
  64. package/dist/{risk-detector-core-O7I7SPR7.js → risk-detector-core-TK4OAI3N.js} +2 -2
  65. package/dist/{risk-detector-plpgsql-SGMVKYJP.js → risk-detector-plpgsql-HWKS4OLR.js} +37 -7
  66. package/dist/{status-IJ4ZWHMX.js → status-UTKS63AB.js} +2 -3
  67. package/dist/{telemetry-FN7V727Y.js → telemetry-P56UBLZ2.js} +2 -3
  68. package/dist/{template-check-PNG5NQ5H.js → template-check-FFJVDLBF.js} +63 -35
  69. package/dist/{test-QYXE5UVW.js → test-V4KQL574.js} +34 -10
  70. package/dist/{test-gen-QPWOIEHU.js → test-gen-FS4CEY3P.js} +2 -3
  71. package/dist/{upgrade-3SLWVNAC.js → upgrade-7TWORWBV.js} +18 -6
  72. package/dist/{validate-SM4PXPS7.js → validate-CAAW4Y44.js} +2 -3
  73. package/dist/{vuln-check-TYQNEFS7.js → vuln-check-6CMNPSBR.js} +3 -4
  74. package/dist/{vuln-checker-2QXGN5YT.js → vuln-checker-EJJTNDNE.js} +413 -140
  75. package/dist/{watch-UCDVOQAH.js → watch-PNTKZYFB.js} +1 -1
  76. package/dist/{workflow-ZB5Q2PFY.js → workflow-H75N4BXX.js} +3 -4
  77. package/package.json +2 -2
  78. package/dist/chunk-JT5SUTWE.js +0 -9
  79. package/dist/chunk-M47WJJVS.js +0 -71
  80. package/dist/manifest-2NOQ2IMK.js +0 -32
  81. package/dist/{chunk-MNPMZERI.js → chunk-644FVGIQ.js} +1 -1
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { runLogged } from './chunk-7QV7U6NI.js';
4
3
  import './chunk-QDF7QXBL.js';
5
- import { getSnapshotStateName, isSnapshotComplete } from './chunk-IBVVGH6X.js';
4
+ import { getSnapshotStateName, isSnapshotComplete } from './chunk-EMB6IZFT.js';
5
+ import { guards, manifestActor, supabaseStartActor, envCheckActor, depsInstallActor, detectTurbo, detectManifestTask, detectDatabase, checkSupabaseStatus } from './chunk-2APB25TT.js';
6
+ import { findRepoRoot } from './chunk-3WDV32GA.js';
7
+ import { runLogged } from './chunk-6FAU4IGR.js';
8
+ import { createMachineStateChangeLogger } from './chunk-5FT3F36G.js';
6
9
  import './chunk-II7VYQEM.js';
7
- import { guards, supabaseStartActor, envCheckActor, depsInstallActor, detectTurbo, detectManifestTask, detectDatabase, checkSupabaseStatus } from './chunk-HPYJPB5Y.js';
8
10
  import './chunk-VM3IWOT5.js';
9
11
  import { securePnpm } from './chunk-RZLYEO4U.js';
10
- import { emitJsonSuccess } from './chunk-UU55OH7P.js';
11
- import './chunk-RRGQCUKT.js';
12
- import './chunk-JT5SUTWE.js';
12
+ import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
13
+ import './chunk-WJXC4MVY.js';
13
14
  import './chunk-HKUWEGUX.js';
14
15
  import { init_esm_shims, __require } from './chunk-VRXHCR5K.js';
15
16
  import { CLIError, createCLILogger } from '@runa-ai/runa';
@@ -18,7 +19,8 @@ import { fromPromise, setup, assign, createActor } from 'xstate';
18
19
  import { z } from 'zod';
19
20
  import { existsSync, rmSync } from 'fs';
20
21
  import { mkdir } from 'fs/promises';
21
- import path6 from 'path';
22
+ import path5 from 'path';
23
+ import { loadManifestSafe, validateUnifiedManifest, validateTablesManifest } from '@runa-ai/runa/manifests';
22
24
 
23
25
  createRequire(import.meta.url);
24
26
 
@@ -103,7 +105,7 @@ var buildActor = fromPromise(
103
105
  const { repoRoot, tmpDir, hasTurbo, e2e, env = process.env } = input;
104
106
  const startTime = Date.now();
105
107
  try {
106
- const fullTmpDir = path6.join(repoRoot, tmpDir);
108
+ const fullTmpDir = path5.join(repoRoot, tmpDir);
107
109
  await mkdir(fullTmpDir, { recursive: true });
108
110
  const buildEnv = { ...env };
109
111
  if (e2e) {
@@ -111,7 +113,7 @@ var buildActor = fromPromise(
111
113
  buildEnv.E2E_TEST = "true";
112
114
  console.log(" E2E mode enabled: NEXT_PUBLIC_E2E_TEST=true");
113
115
  }
114
- const hasApps = existsSync(path6.join(repoRoot, "apps"));
116
+ const hasApps = existsSync(path5.join(repoRoot, "apps"));
115
117
  let args;
116
118
  if (hasTurbo) {
117
119
  args = hasApps ? ["turbo", "run", "build", "--filter=./apps/*", "--filter=./packages/*"] : ["turbo", "run", "build"];
@@ -124,7 +126,7 @@ var buildActor = fromPromise(
124
126
  label: "build",
125
127
  command: "pnpm",
126
128
  args,
127
- logFile: path6.join(fullTmpDir, "build.log")
129
+ logFile: path5.join(fullTmpDir, "build.log")
128
130
  });
129
131
  return {
130
132
  passed: true,
@@ -157,7 +159,7 @@ function deleteIfExists(fullPath, displayPath, verbose) {
157
159
  function deleteRootDirectories(repoRoot, dirs, verbose) {
158
160
  const deleted = [];
159
161
  for (const dir of dirs) {
160
- const fullPath = path6.join(repoRoot, dir);
162
+ const fullPath = path5.join(repoRoot, dir);
161
163
  if (deleteIfExists(fullPath, dir, verbose)) {
162
164
  deleted.push(dir);
163
165
  }
@@ -168,13 +170,13 @@ function cleanMonorepoPackages(repoRoot, dirs, verbose) {
168
170
  const deleted = [];
169
171
  const subdirs = ["apps", "packages"];
170
172
  for (const subdir of subdirs) {
171
- const subdirPath = path6.join(repoRoot, subdir);
173
+ const subdirPath = path5.join(repoRoot, subdir);
172
174
  if (!existsSync(subdirPath)) continue;
173
175
  const entries = __require("fs").readdirSync(subdirPath, { withFileTypes: true });
174
176
  for (const entry of entries) {
175
177
  if (!entry.isDirectory()) continue;
176
178
  for (const dir of dirs) {
177
- const targetPath = path6.join(subdirPath, entry.name, dir);
179
+ const targetPath = path5.join(subdirPath, entry.name, dir);
178
180
  const displayPath = `${subdir}/${entry.name}/${dir}`;
179
181
  if (deleteIfExists(targetPath, displayPath, verbose)) {
180
182
  deleted.push(displayPath);
@@ -193,7 +195,7 @@ var cleanActor = fromPromise(
193
195
  async ({ input }) => {
194
196
  const { repoRoot, tmpDir, verbose = false } = input;
195
197
  try {
196
- await mkdir(path6.join(repoRoot, tmpDir), { recursive: true });
198
+ await mkdir(path5.join(repoRoot, tmpDir), { recursive: true });
197
199
  if (verbose) {
198
200
  console.log("Cleaning build caches...");
199
201
  }
@@ -215,7 +217,7 @@ var freshActor = fromPromise(
215
217
  async ({ input }) => {
216
218
  const { repoRoot, tmpDir, verbose = false } = input;
217
219
  try {
218
- await mkdir(path6.join(repoRoot, tmpDir), { recursive: true });
220
+ await mkdir(path5.join(repoRoot, tmpDir), { recursive: true });
219
221
  if (verbose) {
220
222
  console.log("Fresh install: cleaning all caches and node_modules...");
221
223
  }
@@ -349,7 +351,7 @@ var dbSyncActor = fromPromise(
349
351
  warning: supabaseSkipWarning
350
352
  };
351
353
  }
352
- const fullTmpDir = path6.join(repoRoot, tmpDir);
354
+ const fullTmpDir = path5.join(repoRoot, tmpDir);
353
355
  await mkdir(fullTmpDir, { recursive: true });
354
356
  await runLogged({
355
357
  cwd: repoRoot,
@@ -357,7 +359,7 @@ var dbSyncActor = fromPromise(
357
359
  label: "db-sync",
358
360
  command: "pnpm",
359
361
  args: ["exec", "runa", "db", "sync", "--auto-approve"],
360
- logFile: path6.join(fullTmpDir, "db-sync.log"),
362
+ logFile: path5.join(fullTmpDir, "db-sync.log"),
361
363
  timeoutMs
362
364
  });
363
365
  return {
@@ -392,38 +394,6 @@ var dbSyncActor = fromPromise(
392
394
  }
393
395
  );
394
396
 
395
- // src/commands/build/actors/manifest.ts
396
- init_esm_shims();
397
- var manifestActor = fromPromise(
398
- async ({ input }) => {
399
- const { repoRoot, tmpDir, env = process.env } = input;
400
- const startTime = Date.now();
401
- try {
402
- const fullTmpDir = path6.join(repoRoot, tmpDir);
403
- await mkdir(fullTmpDir, { recursive: true });
404
- await runLogged({
405
- cwd: repoRoot,
406
- env,
407
- label: "manifest",
408
- command: "pnpm",
409
- args: ["exec", "runa", "manifest"],
410
- logFile: path6.join(fullTmpDir, "manifest.log")
411
- });
412
- return {
413
- passed: true,
414
- durationMs: Date.now() - startTime
415
- };
416
- } catch (error) {
417
- const errorMessage = error instanceof Error ? error.message : String(error);
418
- return {
419
- passed: false,
420
- durationMs: Date.now() - startTime,
421
- error: `Manifest generation failed: ${errorMessage}. Run 'runa manifest --verbose' for details.`
422
- };
423
- }
424
- }
425
- );
426
-
427
397
  // src/commands/build/actors/static-checks.ts
428
398
  init_esm_shims();
429
399
  function getCommand(hasTurbo, task) {
@@ -466,7 +436,7 @@ async function runTurboStaticChecksIfApplicable(params) {
466
436
  label: "static-checks",
467
437
  command: "pnpm",
468
438
  args: ["turbo", "run", "type-check", "lint"],
469
- logFile: path6.join(params.fullTmpDir, "static-checks.log")
439
+ logFile: path5.join(params.fullTmpDir, "static-checks.log")
470
440
  });
471
441
  const durationMs = Date.now() - params.startTime;
472
442
  return buildOutput(true, true, durationMs, durationMs, []);
@@ -488,7 +458,7 @@ async function runSingleStaticCheck(params) {
488
458
  label: params.label,
489
459
  command: cmd.command,
490
460
  args: cmd.args,
491
- logFile: path6.join(params.fullTmpDir, `${params.label}.log`)
461
+ logFile: path5.join(params.fullTmpDir, `${params.label}.log`)
492
462
  });
493
463
  return { passed: true };
494
464
  } catch (error) {
@@ -498,7 +468,7 @@ async function runSingleStaticCheck(params) {
498
468
  var staticChecksActor = fromPromise(
499
469
  async ({ input }) => {
500
470
  const { repoRoot, tmpDir, hasTurbo, env = process.env, skipTypes, skipLint } = input;
501
- const fullTmpDir = path6.join(repoRoot, tmpDir);
471
+ const fullTmpDir = path5.join(repoRoot, tmpDir);
502
472
  await mkdir(fullTmpDir, { recursive: true });
503
473
  const startTime = Date.now();
504
474
  const turboOutput = await runTurboStaticChecksIfApplicable({
@@ -557,49 +527,87 @@ var staticChecksActor = fromPromise(
557
527
 
558
528
  // src/commands/build/actors/validate.ts
559
529
  init_esm_shims();
530
+ function appendValidationWarnings(warnings, prefix, validationWarnings) {
531
+ for (const warning of validationWarnings) {
532
+ warnings.push(`${prefix}: ${warning.message}`);
533
+ }
534
+ }
535
+ function hasAnyBuildOutput(repoRoot) {
536
+ const buildOutputPaths = [
537
+ path5.join(repoRoot, ".next"),
538
+ path5.join(repoRoot, "dist"),
539
+ path5.join(repoRoot, "apps", "web", ".next"),
540
+ path5.join(repoRoot, "apps", "dashboard", ".next"),
541
+ path5.join(repoRoot, "packages", "cli", "dist"),
542
+ path5.join(repoRoot, "packages", "sdk", "dist")
543
+ ];
544
+ return buildOutputPaths.some((outputPath) => existsSync(outputPath));
545
+ }
546
+ function applyManifestValidationResult(loadResult, warnings, errors) {
547
+ if (!loadResult.success) {
548
+ errors.push(loadResult.error.toUserMessage());
549
+ return false;
550
+ }
551
+ const validation = validateUnifiedManifest(loadResult.manifest);
552
+ return appendValidationOutcome("manifest.json", validation, warnings, errors);
553
+ }
554
+ function applyTablesValidationResult(loadResult, warnings, errors) {
555
+ if (!loadResult.success) {
556
+ errors.push(loadResult.error.toUserMessage());
557
+ return false;
558
+ }
559
+ const validation = validateTablesManifest(loadResult.manifest);
560
+ return appendValidationOutcome("tables.json", validation, warnings, errors);
561
+ }
562
+ function appendValidationOutcome(label, validation, warnings, errors) {
563
+ if (!validation.valid) {
564
+ errors.push(...validation.errors.map((error) => `${label}: ${error.code} - ${error.message}`));
565
+ }
566
+ appendValidationWarnings(warnings, label, validation.warnings);
567
+ return validation.valid;
568
+ }
560
569
  var validateActor = fromPromise(
561
570
  async ({ input }) => {
562
- const { repoRoot, skipManifest } = input;
571
+ const { repoRoot, skipManifest, skipTables } = input;
563
572
  const warnings = [];
564
- let buildOutputsExist = false;
573
+ const buildOutputsExist = hasAnyBuildOutput(repoRoot);
565
574
  let manifestsExist = true;
566
- const buildOutputPaths = [
567
- // Single app
568
- path6.join(repoRoot, ".next"),
569
- path6.join(repoRoot, "dist"),
570
- // Monorepo apps
571
- path6.join(repoRoot, "apps", "web", ".next"),
572
- path6.join(repoRoot, "apps", "dashboard", ".next"),
573
- // Packages
574
- path6.join(repoRoot, "packages", "cli", "dist"),
575
- path6.join(repoRoot, "packages", "sdk", "dist")
576
- ];
577
- for (const outputPath of buildOutputPaths) {
578
- if (existsSync(outputPath)) {
579
- buildOutputsExist = true;
580
- break;
581
- }
582
- }
575
+ let tablesExist = true;
576
+ const errors = [];
583
577
  if (!buildOutputsExist) {
584
578
  warnings.push(
585
579
  "No build outputs found. Build may have failed or project structure is non-standard."
586
580
  );
587
581
  }
588
582
  if (!skipManifest) {
589
- const manifestPath = path6.join(repoRoot, ".runa", "manifests", "manifest.json");
590
- if (!existsSync(manifestPath)) {
591
- manifestsExist = false;
592
- warnings.push("No manifest.json found. E2E test generation may be affected.");
593
- }
583
+ manifestsExist = applyManifestValidationResult(
584
+ loadManifestSafe("unified", {
585
+ cwd: repoRoot,
586
+ useCache: false
587
+ }),
588
+ warnings,
589
+ errors
590
+ );
591
+ }
592
+ if (!skipTables) {
593
+ tablesExist = applyTablesValidationResult(
594
+ loadManifestSafe("tables", {
595
+ cwd: repoRoot,
596
+ useCache: false
597
+ }),
598
+ warnings,
599
+ errors
600
+ );
594
601
  }
595
602
  return {
596
- passed: true,
597
- // Validation is always "passed" - it just reports warnings
603
+ passed: errors.length === 0,
598
604
  checks: {
599
605
  buildOutputs: buildOutputsExist,
600
- manifests: manifestsExist
606
+ manifests: manifestsExist,
607
+ tables: tablesExist
601
608
  },
602
- warnings
609
+ warnings,
610
+ error: errors.length > 0 ? errors.join("\n") : void 0
603
611
  };
604
612
  }
605
613
  );
@@ -1404,6 +1412,7 @@ var buildMachine = setup({
1404
1412
  event.output.error
1405
1413
  )
1406
1414
  }),
1415
+ error: ({ context, event }) => !event.output.passed ? event.output.error ?? context.error : context.error,
1407
1416
  warnings: ({ context, event }) => event.output.warning ? [...context.warnings, event.output.warning] : context.warnings
1408
1417
  })
1409
1418
  },
@@ -1436,15 +1445,21 @@ var buildMachine = setup({
1436
1445
  src: "validate",
1437
1446
  input: ({ context }) => ({
1438
1447
  repoRoot: context.repoRoot,
1439
- skipManifest: context.input.skipManifest || !context.hasManifestTask
1448
+ skipManifest: context.input.skipManifest || !context.hasManifestTask,
1449
+ skipTables: context.input.skipDb || !context.hasDatabase
1440
1450
  }),
1441
1451
  onDone: {
1442
1452
  target: "done",
1443
1453
  actions: assign({
1444
- phases: ({ context }) => ({
1454
+ phases: ({ context, event }) => ({
1445
1455
  ...context.phases,
1446
- validate: createPhaseResult("passed", 0)
1456
+ validate: createPhaseResult(
1457
+ event.output.passed ? "passed" : "failed",
1458
+ 0,
1459
+ event.output.error
1460
+ )
1447
1461
  }),
1462
+ error: ({ context, event }) => !event.output.passed ? event.output.error ?? context.error : context.error,
1448
1463
  warnings: ({ context, event }) => [...context.warnings, ...event.output.warnings]
1449
1464
  })
1450
1465
  },
@@ -1509,66 +1524,62 @@ function parseOnlyOption(only) {
1509
1524
  }
1510
1525
  return valid.length > 0 ? valid : void 0;
1511
1526
  }
1512
- var stateLogHandlers = {
1513
- idle: (logger) => {
1514
- logger.section("Build");
1515
- logger.info("Starting smart build...");
1516
- },
1517
- dryRun: (_logger) => {
1518
- },
1519
- // Setup phase (auto-detect and fix prerequisites)
1520
- setup: (logger) => {
1521
- logger.section("Phase 0: Auto-Setup");
1522
- logger.info("Checking environment prerequisites...");
1523
- },
1524
- "setup.depsInstall": (logger) => {
1525
- logger.info(" Checking dependencies...");
1526
- },
1527
- "setup.envCheck": (logger) => {
1528
- logger.info(" Checking environment variables...");
1529
- },
1530
- "setup.supabaseStart": (logger) => {
1531
- logger.info(" Checking Supabase...");
1532
- },
1533
- preClean: (_logger) => {
1534
- },
1535
- clean: (logger) => {
1536
- logger.section("Phase 1: Clean");
1537
- logger.info("Cleaning build caches...");
1538
- },
1539
- fresh: (logger) => {
1540
- logger.section("Phase 1: Fresh Install");
1541
- logger.info("Cleaning all caches and reinstalling dependencies...");
1542
- },
1543
- staticAnalysis: (logger) => {
1544
- logger.section("Phase 2: Static Analysis");
1545
- logger.info("Running type-check and lint in parallel...");
1546
- },
1547
- build: (logger) => {
1548
- logger.section("Phase 3: Build");
1549
- logger.info("Building project...");
1550
- },
1551
- dbSync: (logger) => {
1552
- logger.section("Phase 4: Database Sync");
1553
- logger.info("Syncing database schema and generating types...");
1554
- },
1555
- manifest: (logger) => {
1556
- logger.section("Phase 5: Manifest Generation");
1557
- logger.info("Generating manifests for E2E tests...");
1527
+ var handleStateChange = createMachineStateChangeLogger({
1528
+ getState: getStateName,
1529
+ getContext: (snapshot) => snapshot.context,
1530
+ handlers: {
1531
+ idle: (logger) => {
1532
+ logger.section("Build");
1533
+ logger.info("Starting smart build...");
1534
+ },
1535
+ dryRun: (_logger) => {
1536
+ },
1537
+ setup: (logger) => {
1538
+ logger.section("Phase 0: Auto-Setup");
1539
+ logger.info("Checking environment prerequisites...");
1540
+ },
1541
+ "setup.depsInstall": (logger) => {
1542
+ logger.info(" Checking dependencies...");
1543
+ },
1544
+ "setup.envCheck": (logger) => {
1545
+ logger.info(" Checking environment variables...");
1546
+ },
1547
+ "setup.supabaseStart": (logger) => {
1548
+ logger.info(" Checking Supabase...");
1549
+ },
1550
+ preClean: (_logger) => {
1551
+ },
1552
+ clean: (logger) => {
1553
+ logger.section("Phase 1: Clean");
1554
+ logger.info("Cleaning build caches...");
1555
+ },
1556
+ fresh: (logger) => {
1557
+ logger.section("Phase 1: Fresh Install");
1558
+ logger.info("Cleaning all caches and reinstalling dependencies...");
1559
+ },
1560
+ staticAnalysis: (logger) => {
1561
+ logger.section("Phase 2: Static Analysis");
1562
+ logger.info("Running type-check and lint in parallel...");
1563
+ },
1564
+ build: (logger) => {
1565
+ logger.section("Phase 3: Build");
1566
+ logger.info("Building project...");
1567
+ },
1568
+ dbSync: (logger) => {
1569
+ logger.section("Phase 4: Database Sync");
1570
+ logger.info("Syncing database schema and generating types...");
1571
+ },
1572
+ manifest: (logger) => {
1573
+ logger.section("Phase 5: Manifest Generation");
1574
+ logger.info("Generating manifests for E2E tests...");
1575
+ },
1576
+ validate: (logger) => {
1577
+ logger.section("Phase 6: Validation");
1578
+ logger.info("Validating build outputs...");
1579
+ }
1558
1580
  },
1559
- validate: (logger) => {
1560
- logger.section("Phase 6: Validation");
1561
- logger.info("Validating build outputs...");
1562
- }
1563
- };
1564
- function handleStateChange(snapshot, prevState, logger) {
1565
- const state = getStateName(snapshot);
1566
- if (state === prevState) return;
1567
- const handler = stateLogHandlers[state] ?? stateLogHandlers[state.split(".")[0]];
1568
- if (handler) {
1569
- handler(logger);
1570
- }
1571
- }
1581
+ useParentState: true
1582
+ });
1572
1583
  function formatDuration(ms) {
1573
1584
  if (ms < 1e3) return `${ms}ms`;
1574
1585
  const seconds = Math.floor(ms / 1e3);
@@ -1630,28 +1641,6 @@ function printSummary(logger, output) {
1630
1641
  logger.error(`Build failed: ${output.error}`);
1631
1642
  }
1632
1643
  }
1633
- function findRepoRoot(startDir) {
1634
- const { existsSync: existsSync4, readFileSync } = __require("fs");
1635
- const { join, dirname } = __require("path");
1636
- let current = startDir;
1637
- while (current !== dirname(current)) {
1638
- if (existsSync4(join(current, "turbo.json"))) {
1639
- return current;
1640
- }
1641
- const pkgPath = join(current, "package.json");
1642
- if (existsSync4(pkgPath)) {
1643
- try {
1644
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
1645
- if (pkg.workspaces) {
1646
- return current;
1647
- }
1648
- } catch {
1649
- }
1650
- }
1651
- current = dirname(current);
1652
- }
1653
- return startDir;
1654
- }
1655
1644
  async function runBuildMachine(input, logger) {
1656
1645
  const repoRoot = input.targetDir ?? findRepoRoot(process.cwd());
1657
1646
  return new Promise((resolve, reject) => {
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { emitJsonSuccess } from './chunk-UU55OH7P.js';
4
- import './chunk-RRGQCUKT.js';
5
- import './chunk-JT5SUTWE.js';
3
+ import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
4
+ import './chunk-WJXC4MVY.js';
6
5
  import './chunk-HKUWEGUX.js';
7
6
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
8
7
  import { cacheClear, CacheClearOutputSchema, cachePrune, CachePruneOutputSchema, cacheStats, CacheStatsOutputSchema, cacheList, CacheListOutputSchema, cacheInvalidate, CacheInvalidateOutputSchema } from '@runa-ai/runa/cache';
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ export { checkCommand, runCheckCommand } from './chunk-QM53IQHM.js';
4
+ import './chunk-644FVGIQ.js';
5
+ import './chunk-DRSUEMAK.js';
6
+ import './chunk-KE6QJBZG.js';
7
+ import './chunk-WJXC4MVY.js';
8
+ import './chunk-HKUWEGUX.js';
9
+ import './chunk-JMJP4A47.js';
10
+ import './chunk-VRXHCR5K.js';
11
+
12
+ createRequire(import.meta.url);
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
+ import { runLogged } from './chunk-6FAU4IGR.js';
3
4
  import { init_constants, detectSupabasePorts } from './chunk-VM3IWOT5.js';
4
5
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
5
6
  import { execSync, spawnSync } from 'child_process';
6
7
  import { existsSync, statSync, readFileSync } from 'fs';
7
- import path, { join } from 'path';
8
+ import path2, { join } from 'path';
8
9
  import { fromPromise } from 'xstate';
10
+ import { mkdir } from 'fs/promises';
9
11
 
10
12
  createRequire(import.meta.url);
11
13
 
@@ -292,6 +294,38 @@ var supabaseStartActor = fromPromise(
292
294
  }
293
295
  );
294
296
 
297
+ // src/commands/build/actors/manifest.ts
298
+ init_esm_shims();
299
+ var manifestActor = fromPromise(
300
+ async ({ input }) => {
301
+ const { repoRoot, tmpDir, env = process.env } = input;
302
+ const startTime = Date.now();
303
+ try {
304
+ const fullTmpDir = path2.join(repoRoot, tmpDir);
305
+ await mkdir(fullTmpDir, { recursive: true });
306
+ await runLogged({
307
+ cwd: repoRoot,
308
+ env,
309
+ label: "manifest",
310
+ command: "pnpm",
311
+ args: ["exec", "runa", "manifest"],
312
+ logFile: path2.join(fullTmpDir, "manifest.log")
313
+ });
314
+ return {
315
+ passed: true,
316
+ durationMs: Date.now() - startTime
317
+ };
318
+ } catch (error) {
319
+ const errorMessage = error instanceof Error ? error.message : String(error);
320
+ return {
321
+ passed: false,
322
+ durationMs: Date.now() - startTime,
323
+ error: `Manifest generation failed: ${errorMessage}. Run 'runa manifest --verbose' for details.`
324
+ };
325
+ }
326
+ }
327
+ );
328
+
295
329
  // src/commands/build/guards.ts
296
330
  init_esm_shims();
297
331
  function shouldClean({ context }) {
@@ -333,35 +367,35 @@ function isE2EMode({ context }) {
333
367
  return context.input.e2e;
334
368
  }
335
369
  function detectDatabase(repoRoot) {
336
- const configPath = path.join(repoRoot, "runa.config.ts");
370
+ const configPath = path2.join(repoRoot, "runa.config.ts");
337
371
  if (!existsSync(configPath)) {
338
- const jsConfigPath = path.join(repoRoot, "runa.config.js");
372
+ const jsConfigPath = path2.join(repoRoot, "runa.config.js");
339
373
  if (!existsSync(jsConfigPath)) {
340
374
  return false;
341
375
  }
342
376
  }
343
- const supabaseDir = path.join(repoRoot, "supabase");
377
+ const supabaseDir = path2.join(repoRoot, "supabase");
344
378
  if (existsSync(supabaseDir)) {
345
379
  return true;
346
380
  }
347
- const databasePkg = path.join(repoRoot, "packages", "database");
381
+ const databasePkg = path2.join(repoRoot, "packages", "database");
348
382
  if (existsSync(databasePkg)) {
349
383
  return true;
350
384
  }
351
385
  return false;
352
386
  }
353
387
  function detectManifestTask(repoRoot) {
354
- const runaConfigPath = path.join(repoRoot, "runa.config.ts");
388
+ const runaConfigPath = path2.join(repoRoot, "runa.config.ts");
355
389
  if (existsSync(runaConfigPath)) {
356
390
  return true;
357
391
  }
358
- const rootPkgPath = path.join(repoRoot, "package.json");
392
+ const rootPkgPath = path2.join(repoRoot, "package.json");
359
393
  if (hasXStateDependency(rootPkgPath)) {
360
394
  return true;
361
395
  }
362
396
  const appDirs = ["apps/web", "apps/app", "apps/dashboard", "app"];
363
397
  for (const appDir of appDirs) {
364
- const appPkgPath = path.join(repoRoot, appDir, "package.json");
398
+ const appPkgPath = path2.join(repoRoot, appDir, "package.json");
365
399
  if (hasXStateDependency(appPkgPath)) {
366
400
  return true;
367
401
  }
@@ -388,7 +422,7 @@ function hasXStateDependency(pkgPath) {
388
422
  }
389
423
  }
390
424
  function detectTurbo(repoRoot) {
391
- const turboJsonPath = path.join(repoRoot, "turbo.json");
425
+ const turboJsonPath = path2.join(repoRoot, "turbo.json");
392
426
  return existsSync(turboJsonPath);
393
427
  }
394
428
  var guards = {
@@ -405,4 +439,4 @@ var guards = {
405
439
  isE2EMode
406
440
  };
407
441
 
408
- export { checkSupabaseStatus, depsInstallActor, detectDatabase, detectManifestTask, detectTurbo, envCheckActor, guards, supabaseStartActor };
442
+ export { checkSupabaseStatus, depsInstallActor, detectDatabase, detectManifestTask, detectTurbo, envCheckActor, guards, manifestActor, supabaseStartActor };
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ import { init_esm_shims } from './chunk-VRXHCR5K.js';
4
+ import { existsSync, readFileSync } from 'fs';
5
+ import path from 'path';
6
+
7
+ createRequire(import.meta.url);
8
+
9
+ // src/commands/utils/repo-root.ts
10
+ init_esm_shims();
11
+ function findRepoRoot(startDir) {
12
+ let current = startDir;
13
+ while (current !== path.dirname(current)) {
14
+ if (existsSync(path.join(current, "turbo.json"))) {
15
+ return current;
16
+ }
17
+ const pkgPath = path.join(current, "package.json");
18
+ if (existsSync(pkgPath)) {
19
+ try {
20
+ const rawPackage = readFileSync(pkgPath, "utf-8");
21
+ const pkg = JSON.parse(rawPackage);
22
+ if (pkg.workspaces) {
23
+ return current;
24
+ }
25
+ } catch (error) {
26
+ }
27
+ }
28
+ current = path.dirname(current);
29
+ }
30
+ return startDir;
31
+ }
32
+
33
+ export { findRepoRoot };