@runa-ai/runa-cli 0.8.0 → 0.10.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-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-GHQH6UC5.js → chunk-OXQISY3J.js} +1 -1
- package/dist/chunk-QDOR3GTD.js +9043 -0
- 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-ZWDWFMOX.js +1514 -0
- package/dist/{ci-ZK3LKYFX.js → ci-FLTJ2UXB.js} +992 -849
- package/dist/{cli-ZY5VRIJA.js → cli-THEA6T7N.js} +31 -31
- 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-IDKQ44VX.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/{template-check-BDFMT6ZO.js → template-check-VNNQQXCX.js} +10 -0
- 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-JRPMUHLF.js} +1 -1
- package/dist/{vuln-checker-CT2AYPIS.js → vuln-checker-Q7LSHUHJ.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';
|