@runa-ai/runa-cli 0.6.0 → 0.7.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.
- package/dist/{build-BXUJKYHC.js → build-V66FAQXB.js} +152 -163
- package/dist/{cache-H63JKFYH.js → cache-N7WNPEYF.js} +2 -3
- package/dist/check-LOMVIRHX.js +12 -0
- package/dist/{chunk-HPYJPB5Y.js → chunk-2APB25TT.js} +44 -10
- package/dist/chunk-3WDV32GA.js +33 -0
- package/dist/chunk-5FT3F36G.js +59 -0
- package/dist/{chunk-7QV7U6NI.js → chunk-6FAU4IGR.js} +2 -1
- package/dist/{chunk-CE3DEYFT.js → chunk-7B5C6U2K.js} +2 -208
- package/dist/{chunk-GOGRLQNP.js → chunk-AIP6MR42.js} +1 -1
- package/dist/chunk-FHG3ILE4.js +2011 -0
- package/dist/{chunk-22CS6EMA.js → chunk-H2AHNI75.js} +1 -1
- package/dist/{chunk-UU55OH7P.js → chunk-KE6QJBZG.js} +2 -3
- package/dist/{check-6AB5NGWK.js → chunk-QM53IQHM.js} +14 -12
- package/dist/{chunk-RRGQCUKT.js → chunk-WJXC4MVY.js} +30 -3
- package/dist/chunk-XDCHRVE3.js +215 -0
- package/dist/{chunk-P7U52PBY.js → chunk-Z4Z5DNW4.js} +49 -2
- package/dist/{ci-V3PIG2GI.js → ci-ZWRVWNFX.js} +1108 -132
- package/dist/cli/contract-output.d.ts +1 -0
- package/dist/{cli-GFRZCJQR.js → cli-2JNBJUBB.js} +216 -173
- package/dist/commands/build/actors/validate.d.ts +2 -0
- package/dist/commands/check/commands/check.d.ts +8 -3
- package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +9 -6
- package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +55 -0
- package/dist/commands/ci/machine/actors/db/schema-stats.d.ts +11 -0
- package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +9 -1
- package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
- package/dist/commands/ci/machine/types.d.ts +2 -0
- package/dist/commands/ci/utils/execa-helpers.d.ts +1 -0
- package/dist/commands/db/commands/db-sync/error-classifier.d.ts +9 -0
- package/dist/commands/dev/actors/index.d.ts +5 -0
- package/dist/commands/dev/actors/tables-manifest.d.ts +16 -0
- package/dist/commands/dev/contract.d.ts +1 -1
- package/dist/commands/dev/guards.d.ts +24 -0
- package/dist/commands/dev/machine.d.ts +22 -3
- package/dist/commands/dev/types.d.ts +2 -0
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/inject-test-attrs/defaults.d.ts +9 -0
- package/dist/commands/utils/machine-state-logging.d.ts +20 -0
- package/dist/commands/utils/repo-root.d.ts +2 -0
- package/dist/{db-HR7CREX2.js → db-XULCILOU.js} +440 -2216
- package/dist/{dev-A7RW6XQV.js → dev-5YXNPTCJ.js} +168 -49
- package/dist/doctor-MZLOA53G.js +44 -0
- package/dist/{env-B47Z4747.js → env-SS66PZ4B.js} +6 -7
- package/dist/{env-files-K2C7O7L5.js → env-files-2UIUYLLR.js} +2 -2
- package/dist/{error-handler-4EYSDOSE.js → error-handler-HEXBRNVV.js} +2 -2
- package/dist/{hotfix-CULKKMGS.js → hotfix-YA3DGLOM.js} +3 -3
- package/dist/index.js +4 -4
- package/dist/{init-ELK5QCWR.js → init-ZIL6LRFO.js} +5 -6
- package/dist/{inject-test-attrs-Y5UD5P7Q.js → inject-test-attrs-P44BVTQS.js} +5 -18
- package/dist/{link-C43JRZWY.js → link-VSNDVZZD.js} +2 -3
- package/dist/manifest-TMFLESHW.js +19 -0
- package/dist/{risk-detector-BXUY2WKS.js → risk-detector-4U6ZJ2G5.js} +1 -1
- package/dist/{risk-detector-core-O7I7SPR7.js → risk-detector-core-TK4OAI3N.js} +2 -2
- package/dist/{risk-detector-plpgsql-SGMVKYJP.js → risk-detector-plpgsql-HWKS4OLR.js} +37 -7
- package/dist/{status-IJ4ZWHMX.js → status-UTKS63AB.js} +2 -3
- package/dist/{telemetry-FN7V727Y.js → telemetry-P56UBLZ2.js} +2 -3
- package/dist/{template-check-PNG5NQ5H.js → template-check-3P4HZXVY.js} +40 -29
- package/dist/{test-QYXE5UVW.js → test-V4KQL574.js} +34 -10
- package/dist/{test-gen-QPWOIEHU.js → test-gen-FS4CEY3P.js} +2 -3
- package/dist/{upgrade-3SLWVNAC.js → upgrade-NUK3ZBCL.js} +18 -6
- package/dist/{validate-SM4PXPS7.js → validate-CAAW4Y44.js} +2 -3
- package/dist/{vuln-check-TYQNEFS7.js → vuln-check-2W7N5TA2.js} +3 -4
- package/dist/{vuln-checker-2QXGN5YT.js → vuln-checker-IQJ56RUV.js} +413 -140
- package/dist/{watch-UCDVOQAH.js → watch-PNTKZYFB.js} +1 -1
- package/dist/{workflow-ZB5Q2PFY.js → workflow-H75N4BXX.js} +3 -4
- package/package.json +2 -2
- package/dist/chunk-JT5SUTWE.js +0 -9
- package/dist/chunk-M47WJJVS.js +0 -71
- package/dist/manifest-2NOQ2IMK.js +0 -32
- package/dist/{chunk-MNPMZERI.js → chunk-644FVGIQ.js} +1 -1
- package/dist/{chunk-XJBQINSA.js → chunk-SGJG3BKD.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
4
|
import { getSnapshotStateName, isSnapshotComplete } from './chunk-IBVVGH6X.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-
|
|
11
|
-
import './chunk-
|
|
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
|
|
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 =
|
|
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(
|
|
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:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
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(
|
|
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 =
|
|
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:
|
|
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:
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
573
|
+
const buildOutputsExist = hasAnyBuildOutput(repoRoot);
|
|
565
574
|
let manifestsExist = true;
|
|
566
|
-
|
|
567
|
-
|
|
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
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
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:
|
|
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(
|
|
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
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
logger
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
logger
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
logger
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
logger
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
logger
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
logger
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
logger
|
|
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
|
-
|
|
1560
|
-
|
|
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-
|
|
4
|
-
import './chunk-
|
|
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
|
|
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 =
|
|
370
|
+
const configPath = path2.join(repoRoot, "runa.config.ts");
|
|
337
371
|
if (!existsSync(configPath)) {
|
|
338
|
-
const jsConfigPath =
|
|
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 =
|
|
377
|
+
const supabaseDir = path2.join(repoRoot, "supabase");
|
|
344
378
|
if (existsSync(supabaseDir)) {
|
|
345
379
|
return true;
|
|
346
380
|
}
|
|
347
|
-
const databasePkg =
|
|
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 =
|
|
388
|
+
const runaConfigPath = path2.join(repoRoot, "runa.config.ts");
|
|
355
389
|
if (existsSync(runaConfigPath)) {
|
|
356
390
|
return true;
|
|
357
391
|
}
|
|
358
|
-
const rootPkgPath =
|
|
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 =
|
|
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 =
|
|
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 };
|