@runa-ai/runa-cli 0.5.57 → 0.5.58

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.
@@ -40,6 +40,8 @@ export declare function startAppBackground(params: {
40
40
  mode?: AppMode;
41
41
  /** Stream output to terminal in addition to log file. Default: false */
42
42
  stream?: boolean;
43
+ /** Bundler to use for Next.js dev server (turbopack or webpack). Only applies to Strategy 3. */
44
+ bundler?: 'turbopack' | 'webpack';
43
45
  }): Promise<{
44
46
  pid: number;
45
47
  cleanupStreams: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"app-runtime.d.ts","sourceRoot":"","sources":["../../../../src/commands/ci/utils/app-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+GH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhB;AAiHD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC;AAsEtC;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CA+B5F;AAqBD,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,wEAAwE;IACxE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;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,eAAe,CAAC,MAAM,EAAE;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhB"}
@@ -9,6 +9,8 @@
9
9
  * - runa dev --port 3001 # Custom port
10
10
  * - runa dev --skip-db # Skip Supabase start
11
11
  * - runa dev --skip-app # Supabase only (no app server)
12
+ * - runa dev --replace # Replace existing runa dev process
13
+ * - runa dev --bundler webpack # Use webpack instead of turbopack
12
14
  */
13
15
  import { Command } from 'commander';
14
16
  export declare const devCommand: Command;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuMpC,eAAO,MAAM,UAAU,SAmBnB,CAAC"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/dev/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0MpC,eAAO,MAAM,UAAU,SAuBnB,CAAC"}
@@ -20,6 +20,11 @@ export declare const DevInputSchema: z.ZodObject<{
20
20
  verbose: z.ZodDefault<z.ZodBoolean>;
21
21
  stream: z.ZodDefault<z.ZodBoolean>;
22
22
  targetDir: z.ZodOptional<z.ZodString>;
23
+ replace: z.ZodDefault<z.ZodBoolean>;
24
+ bundler: z.ZodOptional<z.ZodEnum<{
25
+ turbopack: "turbopack";
26
+ webpack: "webpack";
27
+ }>>;
23
28
  }, z.core.$strict>;
24
29
  export type DevInput = z.infer<typeof DevInputSchema>;
25
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;kBAehB,CAAC;AAEZ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAMtD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;EAAgE,CAAC;AAElG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;kBAajB,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;kBAmBhB,CAAC;AAEZ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAMtD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;EAAgE,CAAC;AAElG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;kBAajB,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -10,7 +10,7 @@
10
10
  * 3. Running: Dev server running until SIGINT/SIGTERM
11
11
  *
12
12
  * State Flow:
13
- * idle → START → setup{depsInstall → envCheck → supabaseStart}
13
+ * idle → START → processCheck → setup{depsInstall → envCheck → supabaseStart}
14
14
  * → appStart → running → (STOP) → shutdown → done
15
15
  * Any error → failed
16
16
  *
@@ -25,12 +25,20 @@
25
25
  */
26
26
  import { type SnapshotFrom } from 'xstate';
27
27
  import type { DevContext, DevInput } from './types.js';
28
+ interface ProcessCheckInput {
29
+ repoRoot: string;
30
+ tmpDir: string;
31
+ port: number;
32
+ replace: boolean;
33
+ skipApp: boolean;
34
+ }
28
35
  interface AppStartInput {
29
36
  repoRoot: string;
30
37
  appDir: string;
31
38
  port: number;
32
39
  tmpDir: string;
33
40
  stream: boolean;
41
+ bundler?: 'turbopack' | 'webpack';
34
42
  }
35
43
  interface AppStartOutput {
36
44
  pid: number;
@@ -51,7 +59,7 @@ export declare const devMachine: import("xstate").StateMachine<DevContext, {
51
59
  type: "error.platform";
52
60
  error: Error;
53
61
  }, {
54
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").DepsInstallOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").EnvCheckOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").SupabaseStartOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<AppStartOutput, AppStartInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<void, ShutdownInput, import("xstate").EventObject>> | undefined;
62
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").DepsInstallOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").EnvCheckOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<import("../build/actors/setup.js").SupabaseStartOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<void, ProcessCheckInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<AppStartOutput, AppStartInput, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<void, ShutdownInput, import("xstate").EventObject>> | undefined;
55
63
  }, {
56
64
  src: "depsInstall";
57
65
  logic: import("xstate").PromiseActorLogic<import("../build/actors/setup.js").DepsInstallOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>;
@@ -64,6 +72,10 @@ export declare const devMachine: import("xstate").StateMachine<DevContext, {
64
72
  src: "supabaseStart";
65
73
  logic: import("xstate").PromiseActorLogic<import("../build/actors/setup.js").SupabaseStartOutput, import("../build/actors/setup.js").SetupInput, import("xstate").EventObject>;
66
74
  id: string | undefined;
75
+ } | {
76
+ src: "processCheck";
77
+ logic: import("xstate").PromiseActorLogic<void, ProcessCheckInput, import("xstate").EventObject>;
78
+ id: string | undefined;
67
79
  } | {
68
80
  src: "appStart";
69
81
  logic: import("xstate").PromiseActorLogic<AppStartOutput, AppStartInput, import("xstate").EventObject>;
@@ -78,7 +90,7 @@ export declare const devMachine: import("xstate").StateMachine<DevContext, {
78
90
  } | {
79
91
  type: "shouldSkipApp";
80
92
  params: unknown;
81
- }, never, "failed" | "running" | "done" | "idle" | "appStart" | "shutdown" | {
93
+ }, never, "failed" | "running" | "done" | "idle" | "processCheck" | "appStart" | "shutdown" | {
82
94
  setup: "depsInstall" | "envCheck" | "supabaseStart" | "done";
83
95
  }, string, DevMachineInput, {
84
96
  success: boolean;
@@ -90,6 +102,7 @@ export declare const devMachine: import("xstate").StateMachine<DevContext, {
90
102
  id: "dev";
91
103
  states: {
92
104
  readonly idle: {};
105
+ readonly processCheck: {};
93
106
  readonly setup: {
94
107
  states: {
95
108
  readonly depsInstall: {};
@@ -1 +1 @@
1
- {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/machine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAU1D,OAAO,KAAK,EAAE,UAAU,EAAY,QAAQ,EAAa,MAAM,YAAY,CAAC;AAsF5E,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AA6CD,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAoBD,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAcD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmLrB,CAAC;AAMH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAC3C,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;AAM1D;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAa1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAE7D"}
1
+ {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/machine.ts"],"names":[],"mappings":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,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAE7D"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import * as path11 from 'path';
4
4
  import path11__default, { join, dirname, resolve, isAbsolute, relative, sep, basename, normalize } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import * as fs5 from 'fs';
7
- import fs5__default, { existsSync, rmSync, readFileSync, readdirSync, mkdtempSync, writeFileSync, mkdirSync, copyFileSync, createWriteStream, statSync, realpathSync, promises, lstatSync, accessSync, constants, chmodSync, unlinkSync } from 'fs';
7
+ import fs5__default, { existsSync, readFileSync, unlinkSync, rmSync, readdirSync, mkdtempSync, writeFileSync, mkdirSync, copyFileSync, createWriteStream, statSync, realpathSync, promises, lstatSync, accessSync, constants, chmodSync } from 'fs';
8
8
  import { execSync, spawnSync, execFileSync, exec, spawn } from 'child_process';
9
9
  import { createCLILogger, cacheClear, CacheClearOutputSchema, CLIError, cachePrune, CachePruneOutputSchema, cacheStats, CacheStatsOutputSchema, cacheList, CacheListOutputSchema, cacheInvalidate, CacheInvalidateOutputSchema, syncFromProduction, SUPABASE_SYSTEM_SCHEMAS, dbGenerateDiagram, DbDiagramGenerateOutputSchema, createDbSnapshot, syncDatabase, emitDbPushFailureCapsule, emitDbAnnotations, writeDbPushStepSummary, exportDbReportJson, DbSyncOutputSchema, databasePaths, detectRequiredServices, formatDetectionResults, dbStart, DbLifecycleStartOutputSchema, dbStop, DbLifecycleStopOutputSchema, dbReset, DbLifecycleResetOutputSchema, dbValidateSchemas, DbSchemaValidateOutputSchema, DbSchemaRisksOutputSchema, dbDetectSchemaRisks, dbApplySchemas, DbSchemaApplyOutputSchema, dbGenerateTypes, DbSchemaGenerateOutputSchema, extractSchemaFilter, dbSeedInit, DbSeedInitOutputSchema, dbSeedValidate, DbSeedValidateOutputSchema, dbSeedGenerate, DbSeedGenerateOutputSchema, dbVerifySeeds, DbSeedVerifyOutputSchema, DbSnapshotCreateOutputSchema, restoreDbSnapshot, DbSnapshotRestoreOutputSchema, listDbSnapshots, DbSnapshotListOutputSchema, dbGeneratePgTapTests, DbTestGenOutputSchema, dbUpdateGoldenRecord, DbTestUpdateGoldenOutputSchema, repairRunaConfig, detectExistingInitConfig, initProject, validateInitResult, linkCliGlobally, LinkCliOutputSchema, unlinkCliGlobally, UnlinkCliOutputSchema, checkRepoStatus, CheckRepoStatusOutputSchema, enableTelemetry, disableTelemetry, getTelemetryStatus, uploadTelemetry, TelemetryUploadOutputSchema, runTest, TestRunOutputSchema, runTestService, TestServiceOutputSchema, runTestIntegration, TestIntegrationOutputSchema, runTestStatic, TestStaticOutputSchema, generateOwaspTop10Tests, TestOwaspGenerateOutputSchema, updateGoldenRecord, generateE2ETests, generateSecurityTests, generateUnitTests, generateApiTests, generateComponentTests, generateE2EScaffold, validateConfig, ValidateConfigOutputSchema, deploySchemaToProduction, WorkflowNotifyOutputSchema, devopsSync, workflowSync, validateInfrastructure, emitWorkflowValidateFailureCapsule, emitWorkflowAnnotations, writeWorkflowValidateStepSummary, exportWorkflowReportJson, WorkflowValidateInfrastructureOutputSchema, createSuccessEnvelopeSchema, CLI_CONTRACT_VERSION, runChecks, RunCheckOutputSchema, formatDuration as formatDuration$1, GITHUB_API, loadRunaConfig, getClassificationForProfile, BASE_PORTS, loadRunaConfigOrThrow, recordSchemaAudit, RecordSchemaAuditOutputSchema, createBackup, CreateBackupOutputSchema, listBackups, ListBackupsOutputSchema, getBackupMetadata, restoreBackup, RestoreBackupOutputSchema, deleteBackup, DeleteBackupOutputSchema, detectSchemaNames, resolveAvailablePorts, calculatePortOffset, dbSeedApply, writeDbSeedStepSummary, DbSeedApplyOutputSchema, emitDbSeedFailureCapsule, syncEnvironment, EnvSyncOutputSchema, detectDatabasePackage, findProjectRoot as findProjectRoot$1, TelemetryEnableOutputSchema, TelemetryDisableOutputSchema, TelemetryStatusOutputSchema, workflowNotify, DevOpsSyncOutputSchema, WorkflowSyncOutputSchema, formatCLIError, getStatusIcon as getStatusIcon$1, findWorkspaceRoot as findWorkspaceRoot$1, checkExtensionConfig, getPortsWithOffset, UpgradeTransaction, readRunaVersion, syncTemplates, SyncOutputSchema, DATABASE_PACKAGE_CANDIDATES, ErrorEnvelopeSchema, preCheckSync, findConflictFiles, TestUnitGenOutputSchema, TestE2EGenerateOutputSchema, TestSecurityGenOutputSchema, TestApiGenOutputSchema, TestComponentGenOutputSchema } from '@runa-ai/runa';
10
10
  import { z } from 'zod';
@@ -17,12 +17,12 @@ import { minimatch } from 'minimatch';
17
17
  import { Command } from 'commander';
18
18
  import { fromPromise, setup, assign, createActor } from 'xstate';
19
19
  import { execa } from 'execa';
20
+ import net, { isIP } from 'net';
20
21
  import chalk from 'chalk';
21
22
  import { config } from '@dotenvx/dotenvx';
22
23
  import { parse } from 'dotenv';
23
24
  import { expand } from 'dotenv-expand';
24
25
  import { resolve4 } from 'dns/promises';
25
- import { isIP } from 'net';
26
26
  import postgres from 'postgres';
27
27
  import crypto, { randomBytes } from 'crypto';
28
28
  import os, { tmpdir } from 'os';
@@ -1161,7 +1161,7 @@ var CLI_VERSION, HAS_ADMIN_COMMAND;
1161
1161
  var init_version = __esm({
1162
1162
  "src/version.ts"() {
1163
1163
  init_esm_shims();
1164
- CLI_VERSION = "0.5.57";
1164
+ CLI_VERSION = "0.5.58";
1165
1165
  HAS_ADMIN_COMMAND = false;
1166
1166
  }
1167
1167
  });
@@ -7598,7 +7598,7 @@ function printSummary(logger16, output3) {
7598
7598
  }
7599
7599
  }
7600
7600
  function findRepoRoot(startDir) {
7601
- const { existsSync: existsSync53, readFileSync: readFileSync29 } = __require("fs");
7601
+ const { existsSync: existsSync53, readFileSync: readFileSync30 } = __require("fs");
7602
7602
  const { join: join23, dirname: dirname5 } = __require("path");
7603
7603
  let current = startDir;
7604
7604
  while (current !== dirname5(current)) {
@@ -7608,7 +7608,7 @@ function findRepoRoot(startDir) {
7608
7608
  const pkgPath = join23(current, "package.json");
7609
7609
  if (existsSync53(pkgPath)) {
7610
7610
  try {
7611
- const pkg = JSON.parse(readFileSync29(pkgPath, "utf-8"));
7611
+ const pkg = JSON.parse(readFileSync30(pkgPath, "utf-8"));
7612
7612
  if (pkg.workspaces) {
7613
7613
  return current;
7614
7614
  }
@@ -7809,7 +7809,11 @@ var DevInputSchema = z.object({
7809
7809
  /** Stream app output to terminal (in addition to log file). Default: true */
7810
7810
  stream: z.boolean().default(true),
7811
7811
  /** Target directory (defaults to cwd) */
7812
- targetDir: z.string().optional()
7812
+ targetDir: z.string().optional(),
7813
+ /** Replace existing runa dev process if already running */
7814
+ replace: z.boolean().default(false),
7815
+ /** Bundler to use for Next.js dev server */
7816
+ bundler: z.enum(["turbopack", "webpack"]).optional()
7813
7817
  }).strict();
7814
7818
  z.enum(["pending", "running", "passed", "failed", "skipped"]);
7815
7819
  var DevOutputSchema = z.object({
@@ -7907,8 +7911,8 @@ function readPortFromScripts(appDir) {
7907
7911
  const pkgPath = path11__default.join(appDir, "package.json");
7908
7912
  if (!existsSync(pkgPath)) return 3e3;
7909
7913
  try {
7910
- const { readFileSync: readFileSync29 } = __require("fs");
7911
- const raw = readFileSync29(pkgPath, "utf-8");
7914
+ const { readFileSync: readFileSync30 } = __require("fs");
7915
+ const raw = readFileSync30(pkgPath, "utf-8");
7912
7916
  const parsed = JSON.parse(raw);
7913
7917
  const scripts = parsed.scripts;
7914
7918
  for (const key of ["start:ci", "start", "dev"]) {
@@ -8167,7 +8171,7 @@ async function readPackageScripts(pkgPath) {
8167
8171
  return null;
8168
8172
  }
8169
8173
  }
8170
- function determineAppCommand(mode, isMonorepo2, rootScripts, appScripts, repoRoot, appDir, port) {
8174
+ function determineAppCommand(mode, isMonorepo2, rootScripts, appScripts, repoRoot, appDir, port, bundler) {
8171
8175
  const ciScriptName = mode === "dev" ? "dev:ci" : "start:ci";
8172
8176
  const nextCommand = mode === "dev" ? "dev" : "start";
8173
8177
  const rootHasCiScript = Boolean(rootScripts?.[ciScriptName]);
@@ -8184,8 +8188,9 @@ function determineAppCommand(mode, isMonorepo2, rootScripts, appScripts, repoRoo
8184
8188
  return { command: ["pnpm", ...dirArgs2, scriptName], useRootScript: false };
8185
8189
  }
8186
8190
  const dirArgs = isMonorepo2 ? ["-C", path11__default.relative(repoRoot, appDir)] : [];
8191
+ const bundlerArgs = bundler ? [`--${bundler}`] : [];
8187
8192
  return {
8188
- command: ["pnpm", ...dirArgs, "exec", "next", nextCommand, "-p", String(port)],
8193
+ command: ["pnpm", ...dirArgs, "exec", "next", nextCommand, ...bundlerArgs, "-p", String(port)],
8189
8194
  useRootScript: false
8190
8195
  };
8191
8196
  }
@@ -8203,7 +8208,8 @@ async function startAppBackground(params) {
8203
8208
  appScripts,
8204
8209
  params.repoRoot,
8205
8210
  params.appDir,
8206
- params.port
8211
+ params.port,
8212
+ params.bundler
8207
8213
  );
8208
8214
  const appLog = path11__default.join(params.tmpDir, "app.log");
8209
8215
  const out = createWriteStream(appLog, { flags: "a" });
@@ -8317,7 +8323,16 @@ var e2eMeta2 = {
8317
8323
  log: "Starting dev"
8318
8324
  },
8319
8325
  assertions: ["expect(log).toContain('Starting dev')", "expect(state).toBe('idle')"],
8320
- nextStates: ["setup"]
8326
+ nextStates: ["processCheck"]
8327
+ },
8328
+ processCheck: {
8329
+ description: "Check for existing runa dev process and port availability",
8330
+ severity: "blocking",
8331
+ observables: {
8332
+ log: "Checking for existing processes"
8333
+ },
8334
+ assertions: ["expect(log).toContain('Checking for existing processes')"],
8335
+ nextStates: ["setup", "failed"]
8321
8336
  },
8322
8337
  setup: {
8323
8338
  description: "Setup phase: deps, env, Supabase",
@@ -8377,9 +8392,67 @@ var e2eMeta2 = {
8377
8392
  nextStates: []
8378
8393
  }
8379
8394
  };
8395
+ function isProcessAlive(pid) {
8396
+ try {
8397
+ process.kill(pid, 0);
8398
+ return true;
8399
+ } catch {
8400
+ return false;
8401
+ }
8402
+ }
8403
+ function checkPortAvailable(port) {
8404
+ return new Promise((resolve12, reject) => {
8405
+ const server = net.createServer();
8406
+ server.once("error", (err) => {
8407
+ if (err.code === "EADDRINUSE") {
8408
+ reject(
8409
+ new Error(
8410
+ `Port ${port} is already in use. Use --port <number> to specify a different port, or --replace to restart.`
8411
+ )
8412
+ );
8413
+ } else {
8414
+ reject(err);
8415
+ }
8416
+ });
8417
+ server.once("listening", () => {
8418
+ server.close(() => resolve12());
8419
+ });
8420
+ server.listen(port);
8421
+ });
8422
+ }
8423
+ var processCheckActor = fromPromise(async ({ input: input3 }) => {
8424
+ const pidFile = path11__default.join(input3.repoRoot, input3.tmpDir, "app.pid");
8425
+ let pidFileContent = null;
8426
+ try {
8427
+ pidFileContent = readFileSync(pidFile, "utf-8").trim();
8428
+ } catch {
8429
+ }
8430
+ if (pidFileContent) {
8431
+ const pid = parseInt(pidFileContent, 10);
8432
+ if (!isNaN(pid) && isProcessAlive(pid)) {
8433
+ if (input3.replace) {
8434
+ await terminateAppProcessByPid({
8435
+ pid,
8436
+ logger: { info: console.log, warn: console.warn }
8437
+ });
8438
+ } else {
8439
+ throw new Error(
8440
+ `runa dev is already running (PID: ${pid}). Use --replace to restart, or stop the existing process first.`
8441
+ );
8442
+ }
8443
+ }
8444
+ try {
8445
+ unlinkSync(pidFile);
8446
+ } catch {
8447
+ }
8448
+ }
8449
+ if (!input3.skipApp) {
8450
+ await checkPortAvailable(input3.port);
8451
+ }
8452
+ });
8380
8453
  var appStartActor = fromPromise(
8381
8454
  async ({ input: input3 }) => {
8382
- const { repoRoot, appDir, port, tmpDir, stream } = input3;
8455
+ const { repoRoot, appDir, port, tmpDir, stream, bundler } = input3;
8383
8456
  const fullTmpDir = path11__default.join(repoRoot, tmpDir);
8384
8457
  await mkdir(fullTmpDir, { recursive: true });
8385
8458
  const nextDir = path11__default.join(appDir, ".next");
@@ -8394,7 +8467,8 @@ var appStartActor = fromPromise(
8394
8467
  env: process.env,
8395
8468
  tmpDir: fullTmpDir,
8396
8469
  mode: "dev",
8397
- stream
8470
+ stream,
8471
+ bundler
8398
8472
  });
8399
8473
  await waitForAppReady({
8400
8474
  port,
@@ -8427,6 +8501,7 @@ function normalizeDevMachineInput(input3) {
8427
8501
  var devMachine = setup({
8428
8502
  types: {},
8429
8503
  actors: {
8504
+ processCheck: processCheckActor,
8430
8505
  depsInstall: depsInstallActor,
8431
8506
  envCheck: envCheckActor,
8432
8507
  supabaseStart: supabaseStartActor,
@@ -8461,7 +8536,30 @@ var devMachine = setup({
8461
8536
  idle: {
8462
8537
  meta: { e2e: e2eMeta2.idle },
8463
8538
  on: {
8464
- START: { target: "setup" }
8539
+ START: { target: "processCheck" }
8540
+ }
8541
+ },
8542
+ // ============================================================
8543
+ // Process Check Phase
8544
+ // ============================================================
8545
+ processCheck: {
8546
+ meta: { e2e: e2eMeta2.processCheck },
8547
+ invoke: {
8548
+ src: "processCheck",
8549
+ input: ({ context }) => ({
8550
+ repoRoot: context.repoRoot,
8551
+ tmpDir: context.tmpDir,
8552
+ port: context.input.port,
8553
+ replace: context.input.replace,
8554
+ skipApp: context.input.skipApp
8555
+ }),
8556
+ onDone: { target: "setup" },
8557
+ onError: {
8558
+ target: "failed",
8559
+ actions: assign({
8560
+ error: ({ event }) => event.error instanceof Error ? event.error.message : String(event.error)
8561
+ })
8562
+ }
8465
8563
  }
8466
8564
  },
8467
8565
  // ============================================================
@@ -8537,7 +8635,8 @@ var devMachine = setup({
8537
8635
  appDir: detected?.appDir ?? context.repoRoot,
8538
8636
  port: context.input.port,
8539
8637
  tmpDir: context.tmpDir,
8540
- stream: context.input.stream
8638
+ stream: context.input.stream,
8639
+ bundler: context.input.bundler
8541
8640
  };
8542
8641
  },
8543
8642
  onDone: {
@@ -8615,6 +8714,9 @@ var stateLogHandlers2 = {
8615
8714
  logger16.section("Dev Server");
8616
8715
  logger16.info("Starting development environment...");
8617
8716
  },
8717
+ processCheck: (logger16) => {
8718
+ logger16.info("Checking for existing processes...");
8719
+ },
8618
8720
  setup: (logger16) => {
8619
8721
  logger16.section("Phase 0: Setup");
8620
8722
  logger16.info("Checking environment prerequisites...");
@@ -8740,14 +8842,16 @@ async function runDevAction(options, cmd) {
8740
8842
  );
8741
8843
  }
8742
8844
  }
8743
- var devCommand = new Command("dev").description("Start development server (Supabase + Next.js)").option("--port <number>", "Port for Next.js dev server", (val) => Number.parseInt(val, 10), 3e3).option("--skip-db", "Skip Supabase start").option("--skip-app", "Start Supabase only (no app server)").option("--verbose", "Show detailed output").option("--no-stream", "Disable streaming app output to terminal (log to file only)").option("--target-dir <path>", "Target directory (defaults to repo root)").action(async (options, cmd) => {
8845
+ var devCommand = new Command("dev").description("Start development server (Supabase + Next.js)").option("--port <number>", "Port for Next.js dev server", (val) => Number.parseInt(val, 10), 3e3).option("--skip-db", "Skip Supabase start").option("--skip-app", "Start Supabase only (no app server)").option("--verbose", "Show detailed output").option("--no-stream", "Disable streaming app output to terminal (log to file only)").option("--target-dir <path>", "Target directory (defaults to repo root)").option("--replace", "Replace existing runa dev process if already running").option("--bundler <type>", "Bundler for Next.js dev server (turbopack or webpack)").action(async (options, cmd) => {
8744
8846
  const input3 = {
8745
8847
  port: options.port,
8746
8848
  skipDb: options.skipDb ?? false,
8747
8849
  skipApp: options.skipApp ?? false,
8748
8850
  verbose: options.verbose ?? false,
8749
8851
  stream: options.stream ?? true,
8750
- targetDir: options.targetDir
8852
+ targetDir: options.targetDir,
8853
+ replace: options.replace ?? false,
8854
+ bundler: options.bundler
8751
8855
  };
8752
8856
  await runDevAction(input3, cmd);
8753
8857
  });
@@ -10087,8 +10191,8 @@ async function detectRisks(repoRoot, tmpDir) {
10087
10191
  } catch (error) {
10088
10192
  let logContent = "";
10089
10193
  try {
10090
- const { readFileSync: readFileSync29 } = await import('fs');
10091
- logContent = readFileSync29(logFile, "utf-8");
10194
+ const { readFileSync: readFileSync30 } = await import('fs');
10195
+ logContent = readFileSync30(logFile, "utf-8");
10092
10196
  } catch {
10093
10197
  }
10094
10198
  const isInitialDeployment = logContent.includes("No common ancestor") || logContent.includes("INITIAL DEPLOYMENT");
@@ -10216,8 +10320,8 @@ async function applyProductionSchema(repoRoot, tmpDir, productionDbUrlAdmin, pro
10216
10320
  const totalMs = Date.now() - startTime;
10217
10321
  let logContent = "";
10218
10322
  try {
10219
- const { readFileSync: readFileSync29 } = await import('fs');
10220
- logContent = readFileSync29(logPath, "utf-8");
10323
+ const { readFileSync: readFileSync30 } = await import('fs');
10324
+ logContent = readFileSync30(logPath, "utf-8");
10221
10325
  } catch {
10222
10326
  }
10223
10327
  const parsed = parseApplyLog(logContent);
@@ -35695,7 +35799,7 @@ function printActionsNeeded(logger16, actions) {
35695
35799
  );
35696
35800
  }
35697
35801
  function findRepoRoot3(startDir) {
35698
- const { existsSync: existsSync53, readFileSync: readFileSync29 } = __require("fs");
35802
+ const { existsSync: existsSync53, readFileSync: readFileSync30 } = __require("fs");
35699
35803
  const { join: join23, dirname: dirname5 } = __require("path");
35700
35804
  let current = startDir;
35701
35805
  while (current !== dirname5(current)) {
@@ -35705,7 +35809,7 @@ function findRepoRoot3(startDir) {
35705
35809
  const pkgPath = join23(current, "package.json");
35706
35810
  if (existsSync53(pkgPath)) {
35707
35811
  try {
35708
- const pkg = JSON.parse(readFileSync29(pkgPath, "utf-8"));
35812
+ const pkg = JSON.parse(readFileSync30(pkgPath, "utf-8"));
35709
35813
  if (pkg.workspaces) {
35710
35814
  return current;
35711
35815
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runa-ai/runa-cli",
3
- "version": "0.5.57",
3
+ "version": "0.5.58",
4
4
  "private": false,
5
5
  "description": "AI-powered DevOps CLI",
6
6
  "type": "module",
@@ -53,8 +53,8 @@
53
53
  "typescript": "5.9.3",
54
54
  "xstate": "5.28.0",
55
55
  "zod": "4.3.6",
56
- "@runa-ai/runa": "0.5.57",
57
- "@runa-ai/runa-xstate-test-plugin": "0.5.57"
56
+ "@runa-ai/runa": "0.5.58",
57
+ "@runa-ai/runa-xstate-test-plugin": "0.5.58"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=20.0.0"