@runa-ai/runa-cli 0.8.0 → 0.9.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-HQMSVN6N.js → build-P2A6345N.js} +2 -2
- package/dist/{check-PCSQPYDM.js → check-4TZHNOZU.js} +4 -4
- package/dist/{chunk-DRSUEMAK.js → chunk-B7C7CLW2.js} +2 -5
- package/dist/{chunk-B3POLMII.js → chunk-BQ336L5T.js} +1 -1
- package/dist/{chunk-6FAU4IGR.js → chunk-ELXXQIGW.js} +4 -1
- package/dist/{chunk-RB2ZUS76.js → chunk-EXR4J2JT.js} +52 -16
- package/dist/{chunk-GHQH6UC5.js → chunk-GKBE7EIE.js} +1 -1
- package/dist/{chunk-JMJP4A47.js → chunk-GT5DMS5R.js} +20 -2
- package/dist/{chunk-3JO6YP3T.js → chunk-IEKYTCYA.js} +1 -1
- package/dist/{chunk-WPMR7RQ4.js → chunk-IWVXI5O4.js} +2 -2
- package/dist/chunk-KUH3G522.js +72 -0
- package/dist/{chunk-VSH3IXDQ.js → chunk-MAFJAA2P.js} +1 -1
- package/dist/{chunk-CCKG5R4Y.js → chunk-MILCC3B6.js} +1 -1
- package/dist/{chunk-5NKWR4FF.js → chunk-OERS32LW.js} +1 -1
- package/dist/{chunk-2QX7T24B.js → chunk-QKGL6Q2S.js} +1 -1
- package/dist/{chunk-OBYZDT2E.js → chunk-URWDB7YL.js} +15 -78
- package/dist/{chunk-ZYT7OQJB.js → chunk-WGRVAGSR.js} +6 -6
- package/dist/chunk-YRNQEJQW.js +9043 -0
- package/dist/chunk-ZWDWFMOX.js +1514 -0
- package/dist/{ci-ZK3LKYFX.js → ci-S5KSBECX.js} +992 -849
- package/dist/{cli-ZY5VRIJA.js → cli-TJZCAMB2.js} +30 -30
- package/dist/commands/ci/commands/ci-prod-db-operations.d.ts +12 -17
- package/dist/commands/ci/commands/ci-prod-utils.d.ts +7 -0
- package/dist/commands/ci/commands/layer4-discovery.d.ts +2 -0
- package/dist/commands/ci/machine/actors/db/production-preview.d.ts +4 -3
- package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +5 -1
- package/dist/commands/ci/machine/actors/test/capabilities.d.ts +2 -13
- package/dist/commands/ci/machine/actors/test/index.d.ts +1 -0
- package/dist/commands/ci/machine/actors/test/layer-content.d.ts +11 -0
- package/dist/commands/ci/machine/commands/ci-pr-internal-profile.d.ts +7 -0
- package/dist/commands/ci/machine/commands/ci-step-registry.d.ts +25 -0
- package/dist/commands/ci/machine/commands/step-telemetry.d.ts +1 -2
- package/dist/commands/ci/machine/contract.d.ts +3 -0
- package/dist/commands/ci/machine/guards.d.ts +3 -10
- package/dist/commands/ci/machine/helpers.d.ts +1 -1
- package/dist/commands/ci/machine/machine-execution-helpers.d.ts +5 -2
- package/dist/commands/ci/machine/machine.d.ts +24 -30
- package/dist/commands/ci/machine/selectors.d.ts +6 -0
- package/dist/commands/ci/machine/types.d.ts +3 -1
- package/dist/commands/ci/utils/ci-logging.d.ts +16 -0
- package/dist/commands/ci/utils/rls-verification.d.ts +3 -2
- package/dist/commands/db/apply/actors/pg-schema-diff-actors.d.ts +1 -0
- package/dist/commands/db/apply/contract.d.ts +209 -0
- package/dist/commands/db/apply/helpers/fresh-db-handler.d.ts +2 -1
- package/dist/commands/db/apply/helpers/index.d.ts +3 -1
- package/dist/commands/db/apply/helpers/plan-ast-sql-helpers.d.ts +19 -0
- package/dist/commands/db/apply/helpers/plan-ast.d.ts +1 -2
- package/dist/commands/db/apply/helpers/plan-check-filter.d.ts +0 -14
- package/dist/commands/db/apply/helpers/plan-validator.d.ts +34 -0
- package/dist/commands/db/apply/helpers/planner-artifact.d.ts +65 -0
- package/dist/commands/db/apply/helpers/retry-logic.d.ts +5 -0
- package/dist/commands/db/apply/machine.d.ts +50 -15
- package/dist/commands/db/commands/db-apply-error.d.ts +6 -1
- package/dist/commands/db/commands/db-apply.d.ts +5 -0
- package/dist/commands/db/commands/db-plan.d.ts +3 -0
- package/dist/commands/db/commands/db-preview-profile.d.ts +23 -0
- package/dist/commands/db/commands/db-preview.d.ts +3 -0
- package/dist/commands/db/sync/actors.d.ts +1 -0
- package/dist/commands/db/sync/contract.d.ts +16 -0
- package/dist/commands/db/sync/guardrail-orchestrator.d.ts +15 -0
- package/dist/commands/db/sync/guardrail-reporting.d.ts +12 -0
- package/dist/commands/db/sync/index.d.ts +4 -0
- package/dist/commands/db/sync/machine.d.ts +18 -13
- package/dist/commands/db/sync/schema-guardrail-config-test-support.d.ts +15 -0
- package/dist/commands/db/sync/schema-guardrail-config.d.ts +11 -0
- package/dist/commands/db/sync/schema-guardrail-ddl-order.d.ts +36 -0
- package/dist/commands/db/sync/schema-guardrail-graph-guidance.d.ts +15 -0
- package/dist/commands/db/sync/schema-guardrail-graph-metadata.d.ts +41 -0
- package/dist/commands/db/sync/schema-guardrail-graph-nodes.d.ts +61 -0
- package/dist/commands/db/sync/schema-guardrail-graph-sql-helpers.d.ts +31 -0
- package/dist/commands/db/sync/schema-guardrail-graph-types.d.ts +56 -0
- package/dist/commands/db/sync/schema-guardrail-graph.d.ts +20 -0
- package/dist/commands/db/sync/schema-guardrail-local-blockers.d.ts +7 -0
- package/dist/commands/db/sync/schema-guardrail-phases.d.ts +26 -0
- package/dist/commands/db/sync/schema-guardrail-production-check.d.ts +23 -0
- package/dist/commands/db/sync/schema-guardrail-rewrite.d.ts +46 -0
- package/dist/commands/db/sync/schema-guardrail-runtime.d.ts +5 -0
- package/dist/commands/db/sync/schema-guardrail-semantic-warnings.d.ts +9 -0
- package/dist/commands/db/sync/schema-guardrail-types.d.ts +243 -0
- package/dist/commands/db/sync/schema-guardrail.d.ts +10 -0
- package/dist/commands/db/utils/declarative-dependency-sql-utils.d.ts +1 -1
- package/dist/commands/db/utils/duplicate-function-ownership.d.ts +27 -1
- package/dist/commands/db/utils/policy-cross-schema-refs.d.ts +12 -0
- package/dist/commands/db/utils/sql-table-extractor.d.ts +6 -0
- package/dist/commands/test/commands/layer4-prereqs.d.ts +15 -0
- package/dist/{config-loader-GT3HAQ7U.js → config-loader-N5ODNMD5.js} +2 -2
- package/dist/db-D2OLJDYW.js +12757 -0
- package/dist/{dev-GB5ERUVR.js → dev-LGSMDFJN.js} +7 -6
- package/dist/{doctor-ROSWSMLH.js → doctor-GYX73IEW.js} +4 -4
- package/dist/{env-WP74UUMO.js → env-KYR6Q7WO.js} +15 -10
- package/dist/{env-files-HRNUGZ5O.js → env-files-ONBC47I6.js} +3 -3
- package/dist/{hotfix-TOSGTVCW.js → hotfix-RJIAPLAM.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{init-35JLDFHI.js → init-2O6ODG5Z.js} +2 -2
- package/dist/{inject-test-attrs-XN4I2AOR.js → inject-test-attrs-F5A346UV.js} +3 -3
- package/dist/{manifest-EGCAZ4TK.js → manifest-CI4BRWEB.js} +2 -2
- package/dist/{observability-CJA5UFIC.js → observability-WNSCJ5FV.js} +2 -2
- package/dist/pg-schema-diff-helpers-7377FS2D.js +7 -0
- package/dist/{sdk-XK6HQU7S.js → sdk-BTIVPEE5.js} +1 -1
- package/dist/{test-V4KQL574.js → test-QCPN6Z47.js} +74 -46
- package/dist/{upgrade-7L4JIE4K.js → upgrade-QZKEI3NJ.js} +2 -2
- package/dist/utils/db-url-utils.d.ts +4 -77
- package/dist/{vuln-check-G6I4YYDC.js → vuln-check-5NUTETPW.js} +1 -1
- package/dist/{vuln-checker-CT2AYPIS.js → vuln-checker-UV342N66.js} +1 -1
- package/dist/{watch-AL4LCBRM.js → watch-RFVCEQLH.js} +3 -3
- package/dist/{workflow-UZIZ2JUS.js → workflow-UOG6ZZMH.js} +3 -3
- package/package.json +3 -3
- package/dist/chunk-6E2DRXIL.js +0 -452
- package/dist/db-EPI2DQYN.js +0 -18275
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import './chunk-QDF7QXBL.js';
|
|
4
4
|
import { getSnapshotStateName, isSnapshotComplete } from './chunk-XVNDDHAF.js';
|
|
5
|
-
import { guards, manifestActor, supabaseStartActor, envCheckActor, depsInstallActor, detectTurbo, detectManifestTask, detectDatabase, checkSupabaseStatus } from './chunk-
|
|
5
|
+
import { guards, manifestActor, supabaseStartActor, envCheckActor, depsInstallActor, detectTurbo, detectManifestTask, detectDatabase, checkSupabaseStatus } from './chunk-MAFJAA2P.js';
|
|
6
6
|
import { findRepoRoot } from './chunk-3WDV32GA.js';
|
|
7
|
-
import { runLogged } from './chunk-
|
|
7
|
+
import { runLogged } from './chunk-ELXXQIGW.js';
|
|
8
8
|
import { createMachineStateChangeLogger } from './chunk-5FT3F36G.js';
|
|
9
9
|
import './chunk-II7VYQEM.js';
|
|
10
10
|
import './chunk-QSEF4T3Y.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
export { checkCommand, runCheckCommand } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
export { checkCommand, runCheckCommand } from './chunk-QKGL6Q2S.js';
|
|
4
|
+
import './chunk-IWVXI5O4.js';
|
|
5
|
+
import './chunk-B7C7CLW2.js';
|
|
6
6
|
import './chunk-KE6QJBZG.js';
|
|
7
7
|
import './chunk-WJXC4MVY.js';
|
|
8
8
|
import './chunk-HKUWEGUX.js';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-GT5DMS5R.js';
|
|
10
10
|
import './chunk-VRXHCR5K.js';
|
|
11
11
|
|
|
12
12
|
createRequire(import.meta.url);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
-
import {
|
|
4
|
+
import { realpathSync } from 'fs';
|
|
5
5
|
import { resolve, sep, isAbsolute, relative, normalize } from 'path';
|
|
6
6
|
|
|
7
7
|
createRequire(import.meta.url);
|
|
@@ -10,10 +10,7 @@ createRequire(import.meta.url);
|
|
|
10
10
|
init_esm_shims();
|
|
11
11
|
function safeRealpath(targetPath) {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
return realpathSync(targetPath);
|
|
15
|
-
}
|
|
16
|
-
return targetPath;
|
|
13
|
+
return realpathSync(targetPath);
|
|
17
14
|
} catch {
|
|
18
15
|
return targetPath;
|
|
19
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { isPathContained } from './chunk-
|
|
3
|
+
import { isPathContained } from './chunk-B7C7CLW2.js';
|
|
4
4
|
import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
|
|
5
5
|
import { init_esm_shims, __dirname as __dirname$1 } from './chunk-VRXHCR5K.js';
|
|
6
6
|
import * as fs2 from 'fs';
|
|
@@ -44,7 +44,10 @@ async function ensureRunaTmpDir(cwd) {
|
|
|
44
44
|
return dir;
|
|
45
45
|
}
|
|
46
46
|
function runLogged(params) {
|
|
47
|
-
|
|
47
|
+
process.stderr.write(
|
|
48
|
+
`\u25B6 ${params.label}: ${params.command} ${redactArgsForLog(params.args).join(" ")}
|
|
49
|
+
`
|
|
50
|
+
);
|
|
48
51
|
const proc = execa(params.command, params.args, {
|
|
49
52
|
cwd: params.cwd,
|
|
50
53
|
env: { DOTENVX_QUIET: "1", ...params.env },
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { detectEnvironment } from './chunk-
|
|
4
|
-
import { init_esm_shims
|
|
3
|
+
import { detectEnvironment } from './chunk-GT5DMS5R.js';
|
|
4
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
5
|
import { appendFile, writeFile, readFile } from 'fs/promises';
|
|
6
6
|
import { CLIError, formatDuration, loadRunaConfig } from '@runa-ai/runa';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { existsSync, createWriteStream } from 'fs';
|
|
8
|
+
import { existsSync, createWriteStream, readFileSync, readdirSync } from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
|
|
11
11
|
createRequire(import.meta.url);
|
|
@@ -96,21 +96,43 @@ function resolveProdApplyInputs() {
|
|
|
96
96
|
githubRepository: process.env.GITHUB_REPOSITORY ?? "unknown"
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function classifyCiProdApplyError(error) {
|
|
100
100
|
if (error instanceof CLIError) {
|
|
101
|
-
|
|
101
|
+
return {
|
|
102
102
|
code: error.code ?? "CI_ERROR",
|
|
103
103
|
message: error.message,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
return;
|
|
104
|
+
retryable: false
|
|
105
|
+
};
|
|
108
106
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return
|
|
107
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
108
|
+
if (message.startsWith("artifact_retry_requires_replan:")) {
|
|
109
|
+
return {
|
|
110
|
+
code: "artifact_retry_requires_replan",
|
|
111
|
+
message,
|
|
112
|
+
retryable: false
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (/timed out|timeout/i.test(message)) {
|
|
116
|
+
return {
|
|
117
|
+
code: "PHASE_TIMEOUT",
|
|
118
|
+
message,
|
|
119
|
+
retryable: true
|
|
120
|
+
};
|
|
112
121
|
}
|
|
113
|
-
|
|
122
|
+
return {
|
|
123
|
+
code: "CI_ERROR",
|
|
124
|
+
message,
|
|
125
|
+
retryable: false
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function setSummaryErrorFromUnknown(summary, error) {
|
|
129
|
+
const classified = classifyCiProdApplyError(error);
|
|
130
|
+
summary.errors.push({
|
|
131
|
+
code: classified.code,
|
|
132
|
+
message: classified.message,
|
|
133
|
+
step: "ci prod-apply",
|
|
134
|
+
details: error instanceof CLIError && error.cause instanceof Error ? error.cause.message : void 0
|
|
135
|
+
});
|
|
114
136
|
}
|
|
115
137
|
function buildCiProdApplyStepSummaryMarkdown(params) {
|
|
116
138
|
const { summary } = params;
|
|
@@ -136,6 +158,22 @@ function buildCiProdApplyStepSummaryMarkdown(params) {
|
|
|
136
158
|
}
|
|
137
159
|
lines.push("");
|
|
138
160
|
}
|
|
161
|
+
const planSource = typeof summary.detected.dbPlanSource === "string" ? summary.detected.dbPlanSource : null;
|
|
162
|
+
const planReuseReason = typeof summary.detected.dbPlanReuseReason === "string" ? summary.detected.dbPlanReuseReason : null;
|
|
163
|
+
const planReuseMessage = typeof summary.detected.dbPlanReuseMessage === "string" ? summary.detected.dbPlanReuseMessage : null;
|
|
164
|
+
const planHasChanges = typeof summary.detected.dbPlanHasChanges === "boolean" ? summary.detected.dbPlanHasChanges : void 0;
|
|
165
|
+
if (planSource) {
|
|
166
|
+
lines.push(`**Plan source**: \`${planSource}\``);
|
|
167
|
+
if (planReuseReason) {
|
|
168
|
+
lines.push(
|
|
169
|
+
`**Plan reuse fallback**: \`${planReuseReason}\`${planReuseMessage ? ` \u2014 ${planReuseMessage}` : ""}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
if (planHasChanges === false) {
|
|
173
|
+
lines.push("**Plan result**: `no_changes`");
|
|
174
|
+
}
|
|
175
|
+
lines.push("");
|
|
176
|
+
}
|
|
139
177
|
if (summary.errors.length > 0) {
|
|
140
178
|
lines.push("### \u274C Errors");
|
|
141
179
|
lines.push("");
|
|
@@ -308,7 +346,6 @@ function hasPackageJson(dir) {
|
|
|
308
346
|
}
|
|
309
347
|
function readAppsSubdirectoryNames(appsDir) {
|
|
310
348
|
try {
|
|
311
|
-
const { readdirSync } = __require("fs");
|
|
312
349
|
const entries = readdirSync(appsDir, { withFileTypes: true });
|
|
313
350
|
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
314
351
|
} catch {
|
|
@@ -352,7 +389,6 @@ function readPortFromScripts(appDir) {
|
|
|
352
389
|
const pkgPath = path.join(appDir, "package.json");
|
|
353
390
|
if (!existsSync(pkgPath)) return 3e3;
|
|
354
391
|
try {
|
|
355
|
-
const { readFileSync } = __require("fs");
|
|
356
392
|
const raw = readFileSync(pkgPath, "utf-8");
|
|
357
393
|
const parsed = JSON.parse(raw);
|
|
358
394
|
const scripts = parsed.scripts;
|
|
@@ -695,4 +731,4 @@ async function waitForAppReady(params) {
|
|
|
695
731
|
});
|
|
696
732
|
}
|
|
697
733
|
|
|
698
|
-
export { addGithubMask, appendGithubStepSummary, buildCiProdApplyStepSummaryMarkdown, createErrorOutput, createInitialSummary, detectApp, executePrSetupBase, parseIntOr, requireCiAutoApprove, resolveMode, resolveProdApplyInputs, setSummaryErrorFromUnknown, startAppBackground, waitForAppReady, writeEnvLocal };
|
|
734
|
+
export { addGithubMask, appendGithubStepSummary, buildCiProdApplyStepSummaryMarkdown, classifyCiProdApplyError, createErrorOutput, createInitialSummary, detectApp, executePrSetupBase, parseIntOr, requireCiAutoApprove, resolveMode, resolveProdApplyInputs, setSummaryErrorFromUnknown, startAppBackground, waitForAppReady, writeEnvLocal };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
4
|
import { existsSync, readFileSync, realpathSync } from 'fs';
|
|
5
|
-
import { join, isAbsolute, normalize,
|
|
5
|
+
import { join, resolve, dirname, isAbsolute, normalize, relative } from 'path';
|
|
6
6
|
import { findWorkspaceRoot as findWorkspaceRoot$1 } from '@runa-ai/runa';
|
|
7
7
|
|
|
8
8
|
createRequire(import.meta.url);
|
|
@@ -200,5 +200,23 @@ function detectEnvironment(from = process.cwd()) {
|
|
|
200
200
|
}
|
|
201
201
|
return "unknown";
|
|
202
202
|
}
|
|
203
|
+
function findRunaConfig(from = process.cwd()) {
|
|
204
|
+
let current = resolve(from);
|
|
205
|
+
while (true) {
|
|
206
|
+
const configPath = join(current, "runa.config.ts");
|
|
207
|
+
if (existsSync(configPath)) {
|
|
208
|
+
return configPath;
|
|
209
|
+
}
|
|
210
|
+
if (existsSync(join(current, ".git"))) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
const parent = dirname(current);
|
|
214
|
+
if (parent === current) {
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
current = parent;
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
203
221
|
|
|
204
|
-
export { detectEnvironment, findPackage, findWorkspaceRoot };
|
|
222
|
+
export { detectEnvironment, findPackage, findRunaConfig, findWorkspaceRoot };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { isPathContained } from './chunk-
|
|
3
|
+
import { isPathContained } from './chunk-B7C7CLW2.js';
|
|
4
4
|
import { secureGh, securePnpm } from './chunk-RZLYEO4U.js';
|
|
5
5
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
6
6
|
import fs from 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { validateEnvSuffix, isPathContained, MAX_DIRECTORY_TRAVERSAL_DEPTH } from './chunk-
|
|
4
|
-
import { findWorkspaceRoot } from './chunk-
|
|
3
|
+
import { validateEnvSuffix, isPathContained, MAX_DIRECTORY_TRAVERSAL_DEPTH } from './chunk-B7C7CLW2.js';
|
|
4
|
+
import { findWorkspaceRoot } from './chunk-GT5DMS5R.js';
|
|
5
5
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
6
6
|
import { existsSync, readFileSync } from 'fs';
|
|
7
7
|
import path from 'path';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
+
import { existsSync, writeFileSync, unlinkSync, readFileSync } from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// src/utils/env-local-bridge.ts
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
var DEFAULT_API_PORT = 54321;
|
|
12
|
+
var DEFAULT_DB_PORT = 54322;
|
|
13
|
+
var RUNA_ENV_LOCAL_MARKER = "# RUNA_AUTO_GENERATED \u2014 do not edit (created by `runa db start`)";
|
|
14
|
+
function envLocalPath(projectRoot) {
|
|
15
|
+
return path.join(projectRoot, ".env.local");
|
|
16
|
+
}
|
|
17
|
+
function isNonDefaultPorts(config) {
|
|
18
|
+
return config.api !== DEFAULT_API_PORT || config.db !== DEFAULT_DB_PORT;
|
|
19
|
+
}
|
|
20
|
+
function buildEnvLocalContent(config) {
|
|
21
|
+
const dbUrl = `postgresql://postgres:postgres@${config.host}:${config.db}/postgres`;
|
|
22
|
+
return [
|
|
23
|
+
RUNA_ENV_LOCAL_MARKER,
|
|
24
|
+
`# Supabase is running on non-default ports (default: api=${DEFAULT_API_PORT}, db=${DEFAULT_DB_PORT}).`,
|
|
25
|
+
"# This file overrides .env.development so that `pnpm dev` uses correct ports.",
|
|
26
|
+
"# Removed automatically by `runa db stop`. Safe to delete manually.",
|
|
27
|
+
`DATABASE_URL=${dbUrl}`,
|
|
28
|
+
`DATABASE_URL_LISTENER=${dbUrl}`,
|
|
29
|
+
`DATABASE_URL_ADMIN=${dbUrl}`,
|
|
30
|
+
`DATABASE_URL_SERVICE=${dbUrl}`,
|
|
31
|
+
`NEXT_PUBLIC_SUPABASE_URL=http://${config.host}:${config.api}`,
|
|
32
|
+
""
|
|
33
|
+
].join("\n");
|
|
34
|
+
}
|
|
35
|
+
function isRunaManagedEnvLocal(projectRoot) {
|
|
36
|
+
const filePath = envLocalPath(projectRoot);
|
|
37
|
+
try {
|
|
38
|
+
const content = readFileSync(filePath, "utf-8");
|
|
39
|
+
return content.startsWith(RUNA_ENV_LOCAL_MARKER);
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function writeEnvLocalBridge(projectRoot, config) {
|
|
45
|
+
const filePath = envLocalPath(projectRoot);
|
|
46
|
+
const fileExists = existsSync(filePath);
|
|
47
|
+
if (isNonDefaultPorts(config)) {
|
|
48
|
+
if (fileExists && !isRunaManagedEnvLocal(projectRoot)) {
|
|
49
|
+
return { written: false, reason: "user-managed" };
|
|
50
|
+
}
|
|
51
|
+
writeFileSync(filePath, buildEnvLocalContent(config), "utf-8");
|
|
52
|
+
return { written: true, ports: { api: config.api, db: config.db } };
|
|
53
|
+
}
|
|
54
|
+
if (fileExists && isRunaManagedEnvLocal(projectRoot)) {
|
|
55
|
+
unlinkSync(filePath);
|
|
56
|
+
return { written: false, reason: "stale-removed" };
|
|
57
|
+
}
|
|
58
|
+
return { written: false, reason: "default-ports" };
|
|
59
|
+
}
|
|
60
|
+
function removeEnvLocalBridge(projectRoot) {
|
|
61
|
+
const filePath = envLocalPath(projectRoot);
|
|
62
|
+
if (!existsSync(filePath)) {
|
|
63
|
+
return { removed: false, reason: "not-found" };
|
|
64
|
+
}
|
|
65
|
+
if (!isRunaManagedEnvLocal(projectRoot)) {
|
|
66
|
+
return { removed: false, reason: "user-managed" };
|
|
67
|
+
}
|
|
68
|
+
unlinkSync(filePath);
|
|
69
|
+
return { removed: true };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { removeEnvLocalBridge, writeEnvLocalBridge };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { runLogged } from './chunk-
|
|
3
|
+
import { runLogged } from './chunk-ELXXQIGW.js';
|
|
4
4
|
import { init_constants, detectSupabasePorts } from './chunk-QSEF4T3Y.js';
|
|
5
5
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
6
6
|
import { execSync, spawnSync } from 'child_process';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { getDatabasePackagePath } from './chunk-
|
|
3
|
+
import { getDatabasePackagePath } from './chunk-OERS32LW.js';
|
|
4
4
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { join } from 'path';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { findPackage, findWorkspaceRoot } from './chunk-
|
|
3
|
+
import { findPackage, findWorkspaceRoot } from './chunk-GT5DMS5R.js';
|
|
4
4
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
5
|
import { existsSync, readFileSync } from 'fs';
|
|
6
6
|
import path, { join } from 'path';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { loadEnvFiles } from './chunk-
|
|
3
|
+
import { loadEnvFiles } from './chunk-IWVXI5O4.js';
|
|
4
4
|
import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
|
|
5
5
|
import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
|
|
6
6
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { psqlQuery, stripSqlComments } from './chunk-A6A7JIRD.js';
|
|
4
|
-
import { loadRunaConfig } from './chunk-
|
|
4
|
+
import { loadRunaConfig } from './chunk-OERS32LW.js';
|
|
5
5
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
6
|
-
import { existsSync,
|
|
7
|
-
import
|
|
6
|
+
import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync, realpathSync } from 'fs';
|
|
7
|
+
import path, { join, isAbsolute, relative } from 'path';
|
|
8
8
|
import { SUPABASE_SYSTEM_SCHEMAS, detectSchemaNames } from '@runa-ai/runa';
|
|
9
9
|
import { isTable, getTableUniqueName, getTableName } from 'drizzle-orm';
|
|
10
10
|
import { isPgEnum } from 'drizzle-orm/pg-core';
|
|
@@ -14,69 +14,6 @@ import { introspectDatabase } from '@runa-ai/runa/test-generators';
|
|
|
14
14
|
|
|
15
15
|
createRequire(import.meta.url);
|
|
16
16
|
|
|
17
|
-
// src/utils/env-local-bridge.ts
|
|
18
|
-
init_esm_shims();
|
|
19
|
-
var DEFAULT_API_PORT = 54321;
|
|
20
|
-
var DEFAULT_DB_PORT = 54322;
|
|
21
|
-
var RUNA_ENV_LOCAL_MARKER = "# RUNA_AUTO_GENERATED \u2014 do not edit (created by `runa db start`)";
|
|
22
|
-
function envLocalPath(projectRoot) {
|
|
23
|
-
return path2.join(projectRoot, ".env.local");
|
|
24
|
-
}
|
|
25
|
-
function isNonDefaultPorts(config) {
|
|
26
|
-
return config.api !== DEFAULT_API_PORT || config.db !== DEFAULT_DB_PORT;
|
|
27
|
-
}
|
|
28
|
-
function buildEnvLocalContent(config) {
|
|
29
|
-
const dbUrl = `postgresql://postgres:postgres@${config.host}:${config.db}/postgres`;
|
|
30
|
-
return [
|
|
31
|
-
RUNA_ENV_LOCAL_MARKER,
|
|
32
|
-
`# Supabase is running on non-default ports (default: api=${DEFAULT_API_PORT}, db=${DEFAULT_DB_PORT}).`,
|
|
33
|
-
"# This file overrides .env.development so that `pnpm dev` uses correct ports.",
|
|
34
|
-
"# Removed automatically by `runa db stop`. Safe to delete manually.",
|
|
35
|
-
`DATABASE_URL=${dbUrl}`,
|
|
36
|
-
`DATABASE_URL_LISTENER=${dbUrl}`,
|
|
37
|
-
`DATABASE_URL_ADMIN=${dbUrl}`,
|
|
38
|
-
`DATABASE_URL_SERVICE=${dbUrl}`,
|
|
39
|
-
`NEXT_PUBLIC_SUPABASE_URL=http://${config.host}:${config.api}`,
|
|
40
|
-
""
|
|
41
|
-
].join("\n");
|
|
42
|
-
}
|
|
43
|
-
function isRunaManagedEnvLocal(projectRoot) {
|
|
44
|
-
const filePath = envLocalPath(projectRoot);
|
|
45
|
-
try {
|
|
46
|
-
const content = readFileSync(filePath, "utf-8");
|
|
47
|
-
return content.startsWith(RUNA_ENV_LOCAL_MARKER);
|
|
48
|
-
} catch {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function writeEnvLocalBridge(projectRoot, config) {
|
|
53
|
-
const filePath = envLocalPath(projectRoot);
|
|
54
|
-
const fileExists = existsSync(filePath);
|
|
55
|
-
if (isNonDefaultPorts(config)) {
|
|
56
|
-
if (fileExists && !isRunaManagedEnvLocal(projectRoot)) {
|
|
57
|
-
return { written: false, reason: "user-managed" };
|
|
58
|
-
}
|
|
59
|
-
writeFileSync(filePath, buildEnvLocalContent(config), "utf-8");
|
|
60
|
-
return { written: true, ports: { api: config.api, db: config.db } };
|
|
61
|
-
}
|
|
62
|
-
if (fileExists && isRunaManagedEnvLocal(projectRoot)) {
|
|
63
|
-
unlinkSync(filePath);
|
|
64
|
-
return { written: false, reason: "stale-removed" };
|
|
65
|
-
}
|
|
66
|
-
return { written: false, reason: "default-ports" };
|
|
67
|
-
}
|
|
68
|
-
function removeEnvLocalBridge(projectRoot) {
|
|
69
|
-
const filePath = envLocalPath(projectRoot);
|
|
70
|
-
if (!existsSync(filePath)) {
|
|
71
|
-
return { removed: false, reason: "not-found" };
|
|
72
|
-
}
|
|
73
|
-
if (!isRunaManagedEnvLocal(projectRoot)) {
|
|
74
|
-
return { removed: false, reason: "user-managed" };
|
|
75
|
-
}
|
|
76
|
-
unlinkSync(filePath);
|
|
77
|
-
return { removed: true };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
17
|
// src/commands/db/utils/schema-sync.ts
|
|
81
18
|
init_esm_shims();
|
|
82
19
|
var VALID_PG_IDENTIFIER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
|
|
@@ -112,16 +49,16 @@ var ERROR_MESSAGES = {
|
|
|
112
49
|
SCHEMA_NOT_FOUND: "Schema file not found"
|
|
113
50
|
};
|
|
114
51
|
function containsPathTraversal(inputPath) {
|
|
115
|
-
const normalized =
|
|
52
|
+
const normalized = path.normalize(inputPath);
|
|
116
53
|
return normalized.includes("..") || inputPath.includes("\0");
|
|
117
54
|
}
|
|
118
55
|
function isPathWithinBase(filePath, baseDir) {
|
|
119
56
|
try {
|
|
120
|
-
const resolvedFile =
|
|
121
|
-
const resolvedBase =
|
|
122
|
-
const normalizedFile =
|
|
123
|
-
const normalizedBase =
|
|
124
|
-
return normalizedFile === normalizedBase || normalizedFile.startsWith(normalizedBase +
|
|
57
|
+
const resolvedFile = path.resolve(filePath);
|
|
58
|
+
const resolvedBase = path.resolve(baseDir);
|
|
59
|
+
const normalizedFile = path.normalize(resolvedFile);
|
|
60
|
+
const normalizedBase = path.normalize(resolvedBase);
|
|
61
|
+
return normalizedFile === normalizedBase || normalizedFile.startsWith(normalizedBase + path.sep);
|
|
125
62
|
} catch {
|
|
126
63
|
return false;
|
|
127
64
|
}
|
|
@@ -130,13 +67,13 @@ function validateSchemaPath(dbPackagePath, projectRoot = process.cwd()) {
|
|
|
130
67
|
if (containsPathTraversal(dbPackagePath)) {
|
|
131
68
|
throw new Error(ERROR_MESSAGES.PATH_TRAVERSAL);
|
|
132
69
|
}
|
|
133
|
-
const schemaEntry =
|
|
134
|
-
const absoluteSchemaPath =
|
|
70
|
+
const schemaEntry = path.join(dbPackagePath, "src", "schema", "index.ts");
|
|
71
|
+
const absoluteSchemaPath = path.resolve(projectRoot, schemaEntry);
|
|
135
72
|
let resolvedProjectRoot;
|
|
136
73
|
try {
|
|
137
74
|
resolvedProjectRoot = realpathSync(projectRoot);
|
|
138
75
|
} catch {
|
|
139
|
-
resolvedProjectRoot =
|
|
76
|
+
resolvedProjectRoot = path.resolve(projectRoot);
|
|
140
77
|
}
|
|
141
78
|
if (!isPathWithinBase(absoluteSchemaPath, resolvedProjectRoot)) {
|
|
142
79
|
throw new Error(ERROR_MESSAGES.PATH_TRAVERSAL);
|
|
@@ -269,7 +206,7 @@ function diffSchema(params) {
|
|
|
269
206
|
};
|
|
270
207
|
}
|
|
271
208
|
function extractTablesFromIdempotentSql(idempotentDir, projectRoot = process.cwd()) {
|
|
272
|
-
const fullPath =
|
|
209
|
+
const fullPath = path.resolve(projectRoot, idempotentDir);
|
|
273
210
|
if (!existsSync(fullPath)) {
|
|
274
211
|
return [];
|
|
275
212
|
}
|
|
@@ -278,7 +215,7 @@ function extractTablesFromIdempotentSql(idempotentDir, projectRoot = process.cwd
|
|
|
278
215
|
try {
|
|
279
216
|
const files = readdirSync(fullPath).filter((f) => f.endsWith(".sql"));
|
|
280
217
|
for (const file of files) {
|
|
281
|
-
const filePath =
|
|
218
|
+
const filePath = path.join(fullPath, file);
|
|
282
219
|
const content = readFileSync(filePath, "utf-8");
|
|
283
220
|
const contentWithoutComments = content.replace(/--.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
284
221
|
for (const match of contentWithoutComments.matchAll(createTablePattern)) {
|
|
@@ -2038,4 +1975,4 @@ function logManifestSummary(manifest, conflicts) {
|
|
|
2038
1975
|
console.log(" Path: .runa/manifests/tables.json\n");
|
|
2039
1976
|
}
|
|
2040
1977
|
|
|
2041
|
-
export { diffSchema, extractSchemaTablesAndEnums, extractTablesFromIdempotentSql, fetchDbTablesAndEnums, generateTablesManifest,
|
|
1978
|
+
export { buildTablePatternMatcher, diffSchema, extractSchemaTablesAndEnums, extractTablesFromIdempotentSql, fetchDbTablesAndEnums, generateTablesManifest, getSqlParserUtils };
|
|
@@ -15,9 +15,9 @@ function buildProductionDbSuggestions() {
|
|
|
15
15
|
return [
|
|
16
16
|
"Use --env local for local Supabase operations",
|
|
17
17
|
"Production operations require a remote database URL",
|
|
18
|
-
"Try `runa db
|
|
19
|
-
"If you are working in the runa repo, `pnpm runa db
|
|
20
|
-
"Or run `dotenvx run -f .env.keys -f .env.production -- runa db
|
|
18
|
+
"Try `runa db preview production --profile compare-only` after loading production env files",
|
|
19
|
+
"If you are working in the runa repo, `pnpm runa db preview production --profile compare-only` also works",
|
|
20
|
+
"Or run `dotenvx run -f .env.keys -f .env.production -- runa db preview production --profile compare-only`",
|
|
21
21
|
"Set DATABASE_URL_ADMIN or GH_DATABASE_URL_ADMIN to the production database URL"
|
|
22
22
|
];
|
|
23
23
|
}
|
|
@@ -102,9 +102,9 @@ function resolveDatabaseTarget(environment) {
|
|
|
102
102
|
throw new CLIError("Production database URL not found", "PRODUCTION_DB_URL_NOT_FOUND", [
|
|
103
103
|
"Set GH_DATABASE_URL_ADMIN (CI) or DATABASE_URL_ADMIN (local) to a direct postgres URL",
|
|
104
104
|
"Do not use GH_DATABASE_URL or DATABASE_URL for DDL operations",
|
|
105
|
-
"Try `runa db
|
|
106
|
-
"If you are working in the runa repo, `pnpm runa db
|
|
107
|
-
"Or run `dotenvx run -f .env.keys -f .env.production -- runa db
|
|
105
|
+
"Try `runa db preview production --profile compare-only` after loading production env files",
|
|
106
|
+
"If you are working in the runa repo, `pnpm runa db preview production --profile compare-only` also works",
|
|
107
|
+
"Or run `dotenvx run -f .env.keys -f .env.production -- runa db preview production --profile compare-only`"
|
|
108
108
|
]);
|
|
109
109
|
}
|
|
110
110
|
}
|