@runa-ai/runa-cli 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-BXUJKYHC.js → build-HUDIP6KU.js} +153 -164
- 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-AFY3TX4I.js} +1 -1
- package/dist/{chunk-KWX3JHCY.js → chunk-AKZAN4BC.js} +6 -1
- package/dist/{chunk-XJBQINSA.js → chunk-CCW3PLQY.js} +2 -2
- package/dist/{chunk-IBVVGH6X.js → chunk-EMB6IZFT.js} +17 -4
- 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-XY6IKEDC.js} +1938 -238
- package/dist/cli/contract-output.d.ts +1 -0
- package/dist/{cli-GFRZCJQR.js → cli-UZA4RBNQ.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 +12 -6
- package/dist/commands/ci/machine/actors/db/production-preview.d.ts +10 -0
- package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +77 -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/commands/machine-runner.d.ts +2 -0
- package/dist/commands/ci/machine/formatters/sections/production-schema-status.d.ts +30 -0
- package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
- package/dist/commands/ci/machine/helpers.d.ts +8 -0
- package/dist/commands/ci/machine/machine.d.ts +57 -4
- 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/template-check/commands/template-check.d.ts +1 -0
- package/dist/commands/template-check/contract.d.ts +1 -0
- package/dist/commands/utils/machine-state-logging.d.ts +20 -0
- package/dist/commands/utils/repo-root.d.ts +2 -0
- package/dist/constants/versions.d.ts +1 -1
- package/dist/{db-HR7CREX2.js → db-Q3GF7JWP.js} +518 -2234
- package/dist/{dev-A7RW6XQV.js → dev-5YXNPTCJ.js} +168 -49
- package/dist/doctor-MZLOA53G.js +44 -0
- package/dist/{env-B47Z4747.js → env-GMB3THRG.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-NDTPY2T4.js} +4 -4
- package/dist/index.js +4 -4
- package/dist/{init-ELK5QCWR.js → init-U4VCRHTD.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-FFJVDLBF.js} +63 -35
- 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-7TWORWBV.js} +18 -6
- package/dist/{validate-SM4PXPS7.js → validate-CAAW4Y44.js} +2 -3
- package/dist/{vuln-check-TYQNEFS7.js → vuln-check-6CMNPSBR.js} +3 -4
- package/dist/{vuln-checker-2QXGN5YT.js → vuln-checker-EJJTNDNE.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
|
@@ -9,7 +9,7 @@ init_esm_shims();
|
|
|
9
9
|
var riskDetectorModulePromise = null;
|
|
10
10
|
async function loadRiskDetectorModule() {
|
|
11
11
|
if (!riskDetectorModulePromise) {
|
|
12
|
-
riskDetectorModulePromise = import('./risk-detector-core-
|
|
12
|
+
riskDetectorModulePromise = import('./risk-detector-core-TK4OAI3N.js').catch((error) => {
|
|
13
13
|
riskDetectorModulePromise = null;
|
|
14
14
|
throw error;
|
|
15
15
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { markJsonEmitted } from './chunk-
|
|
4
|
-
import { createSuccessEnvelopeSchema, CLI_CONTRACT_VERSION } from './chunk-JT5SUTWE.js';
|
|
3
|
+
import { createSuccessEnvelopeSchema, CLI_CONTRACT_VERSION, writeJsonEnvelope, markJsonEmitted } from './chunk-WJXC4MVY.js';
|
|
5
4
|
import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
|
|
6
5
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
7
6
|
|
|
@@ -31,7 +30,7 @@ function emitJsonSuccess(cmd, dataSchema, data) {
|
|
|
31
30
|
const parsed = schema.parse(payload);
|
|
32
31
|
process.env.RUNA_JSON_EMITTING = "true";
|
|
33
32
|
try {
|
|
34
|
-
|
|
33
|
+
writeJsonEnvelope(`${JSON.stringify(parsed)}
|
|
35
34
|
`);
|
|
36
35
|
} finally {
|
|
37
36
|
process.env.RUNA_JSON_EMITTING = "false";
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { loadEnvFiles } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-DRSUEMAK.js';
|
|
6
|
-
import { emitJsonSuccess } from './chunk-UU55OH7P.js';
|
|
7
|
-
import './chunk-RRGQCUKT.js';
|
|
8
|
-
import './chunk-JT5SUTWE.js';
|
|
3
|
+
import { loadEnvFiles } from './chunk-644FVGIQ.js';
|
|
4
|
+
import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
|
|
9
5
|
import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
|
|
10
6
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
11
7
|
import { CLIError, createCLILogger } from '@runa-ai/runa/cli-runtime';
|
|
@@ -150,8 +146,8 @@ function renderFinalStatus(logger, output) {
|
|
|
150
146
|
logger.success("All checks passed! Ready for operations.");
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
|
-
async function
|
|
154
|
-
const logger = createCLILogger(
|
|
149
|
+
async function runCheckCommand(options, runOptions) {
|
|
150
|
+
const logger = createCLILogger(runOptions.loggerName);
|
|
155
151
|
const isJsonMode = getOutputFormatFromEnv() === "json";
|
|
156
152
|
loadEnvFiles({ runaEnv: "local", silent: true });
|
|
157
153
|
if (isJsonMode && options.fix) {
|
|
@@ -169,9 +165,12 @@ async function runCheckAction(options) {
|
|
|
169
165
|
verbose: options.verbose || false
|
|
170
166
|
});
|
|
171
167
|
if (isJsonMode) {
|
|
172
|
-
emitJsonSuccess(
|
|
168
|
+
emitJsonSuccess(runOptions.command, RunCheckOutputSchema, output);
|
|
173
169
|
process.exit(output.exitCode);
|
|
174
170
|
}
|
|
171
|
+
if (runOptions.deprecationNotice) {
|
|
172
|
+
logger.warn(runOptions.deprecationNotice);
|
|
173
|
+
}
|
|
175
174
|
logger.section(`Project Health Check (scope: ${options.scope || "all"})`);
|
|
176
175
|
for (const category of output.categories) {
|
|
177
176
|
renderCategory(logger, category, options.verbose || false);
|
|
@@ -187,9 +186,12 @@ var checkCommand = new Command("run").description("Check project configuration a
|
|
|
187
186
|
"-s, --scope <scope>",
|
|
188
187
|
"Check scope: all | build | ci | deploy | testing | layer1 | layer2 | layer3 | layer4",
|
|
189
188
|
"all"
|
|
190
|
-
).option("--fix", "Attempt to auto-fix issues").option("-v, --verbose", "Show detailed output with fix hints").option("--dry-run", "Show what would be checked without running").option("--cwd <path>", "Working directory (default: current directory)").action(async (options) => {
|
|
189
|
+
).option("--fix", "Attempt to auto-fix issues").option("-v, --verbose", "Show detailed output with fix hints").option("--dry-run", "Show what would be checked without running").option("--cwd <path>", "Working directory (default: current directory)").action(async (options, command) => {
|
|
191
190
|
try {
|
|
192
|
-
await
|
|
191
|
+
await runCheckCommand(options, {
|
|
192
|
+
command,
|
|
193
|
+
loggerName: "check"
|
|
194
|
+
});
|
|
193
195
|
} catch (error) {
|
|
194
196
|
if (error instanceof CLIError) {
|
|
195
197
|
throw error;
|
|
@@ -204,4 +206,4 @@ var checkCommand = new Command("run").description("Check project configuration a
|
|
|
204
206
|
}
|
|
205
207
|
});
|
|
206
208
|
|
|
207
|
-
export { checkCommand,
|
|
209
|
+
export { checkCommand, runCheckCommand };
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { createSuccessEnvelopeSchema, CLI_CONTRACT_VERSION } from './chunk-JT5SUTWE.js';
|
|
4
3
|
import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
|
|
5
4
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
|
+
import { createSuccessEnvelopeSchema, CLI_CONTRACT_VERSION } from '@runa-ai/runa';
|
|
6
|
+
export { CLI_CONTRACT_VERSION, ErrorEnvelopeSchema, createSuccessEnvelopeSchema } from '@runa-ai/runa';
|
|
7
|
+
import { writeSync } from 'fs';
|
|
6
8
|
import { z } from 'zod';
|
|
7
9
|
|
|
8
10
|
createRequire(import.meta.url);
|
|
9
11
|
|
|
12
|
+
// src/contracts/envelope.ts
|
|
13
|
+
init_esm_shims();
|
|
14
|
+
|
|
10
15
|
// src/cli/contract-output.ts
|
|
11
16
|
init_esm_shims();
|
|
12
17
|
function getCommandPath(cmd) {
|
|
@@ -24,6 +29,28 @@ function getCommandPath(cmd) {
|
|
|
24
29
|
function markJsonEmitted() {
|
|
25
30
|
process.env.RUNA_JSON_EMITTED = "true";
|
|
26
31
|
}
|
|
32
|
+
function writeJsonEnvelope(payload) {
|
|
33
|
+
const buffer = Buffer.from(payload, "utf-8");
|
|
34
|
+
const waitBuffer = new Int32Array(new SharedArrayBuffer(4));
|
|
35
|
+
let offset = 0;
|
|
36
|
+
while (offset < buffer.length) {
|
|
37
|
+
try {
|
|
38
|
+
const written = writeSync(process.stdout.fd, buffer, offset, buffer.length - offset);
|
|
39
|
+
if (written === 0) {
|
|
40
|
+
Atomics.wait(waitBuffer, 0, 0, 1);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
offset += written;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const code = error instanceof Error && "code" in error ? String(error.code) : null;
|
|
46
|
+
if (code === "EAGAIN" || code === "EINTR") {
|
|
47
|
+
Atomics.wait(waitBuffer, 0, 0, 1);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
27
54
|
function emitDefaultSuccessIfNeeded(cmd) {
|
|
28
55
|
if (getOutputFormatFromEnv() !== "json") return;
|
|
29
56
|
if (process.env.RUNA_JSON_EMITTED === "true") return;
|
|
@@ -37,7 +64,7 @@ function emitDefaultSuccessIfNeeded(cmd) {
|
|
|
37
64
|
try {
|
|
38
65
|
const schema = createSuccessEnvelopeSchema(z.object({}).strict());
|
|
39
66
|
const parsed = schema.parse(payload);
|
|
40
|
-
|
|
67
|
+
writeJsonEnvelope(`${JSON.stringify(parsed)}
|
|
41
68
|
`);
|
|
42
69
|
} finally {
|
|
43
70
|
process.env.RUNA_JSON_EMITTING = "false";
|
|
@@ -45,4 +72,4 @@ function emitDefaultSuccessIfNeeded(cmd) {
|
|
|
45
72
|
markJsonEmitted();
|
|
46
73
|
}
|
|
47
74
|
|
|
48
|
-
export { emitDefaultSuccessIfNeeded, markJsonEmitted };
|
|
75
|
+
export { emitDefaultSuccessIfNeeded, markJsonEmitted, writeJsonEnvelope };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { stripSqlComments } from './chunk-7B5C6U2K.js';
|
|
4
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
|
+
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { execFileSync } from 'child_process';
|
|
8
|
+
import { isIP } from 'net';
|
|
9
|
+
|
|
10
|
+
createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
// src/commands/db/utils/schema-detector.ts
|
|
13
|
+
init_esm_shims();
|
|
14
|
+
var EXCLUDED_SCHEMAS = /* @__PURE__ */ new Set([
|
|
15
|
+
// PostgreSQL system
|
|
16
|
+
"pg_catalog",
|
|
17
|
+
"information_schema",
|
|
18
|
+
"pg_toast",
|
|
19
|
+
// Supabase services
|
|
20
|
+
"auth",
|
|
21
|
+
"storage",
|
|
22
|
+
"realtime",
|
|
23
|
+
"pgsodium",
|
|
24
|
+
"pgsodium_masks",
|
|
25
|
+
// Supabase extensions
|
|
26
|
+
"extensions",
|
|
27
|
+
"graphql",
|
|
28
|
+
"graphql_public",
|
|
29
|
+
"net",
|
|
30
|
+
"vault",
|
|
31
|
+
// Supabase internal
|
|
32
|
+
"supabase_functions",
|
|
33
|
+
"supabase_migrations",
|
|
34
|
+
"pgbouncer",
|
|
35
|
+
"cron"
|
|
36
|
+
]);
|
|
37
|
+
var IDENTIFIER_PATTERN = "[A-Za-z_][A-Za-z0-9_]*";
|
|
38
|
+
var SQL_IDENTIFIER = `(?:"(?:[^"]|"")*"|${IDENTIFIER_PATTERN})`;
|
|
39
|
+
var CREATE_SCHEMA_PATTERN = new RegExp(
|
|
40
|
+
`^\\s*CREATE\\s+SCHEMA\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?(${SQL_IDENTIFIER})`,
|
|
41
|
+
"gim"
|
|
42
|
+
);
|
|
43
|
+
function collectSchemaSqlFiles(schemasDir) {
|
|
44
|
+
const entries = readdirSync(schemasDir, { withFileTypes: true });
|
|
45
|
+
const files = [];
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
const filePath = join(schemasDir, entry.name);
|
|
48
|
+
if (entry.isDirectory()) {
|
|
49
|
+
files.push(...collectSchemaSqlFiles(filePath));
|
|
50
|
+
} else if (entry.isFile() && filePath.endsWith(".sql")) {
|
|
51
|
+
files.push(filePath);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return files;
|
|
55
|
+
}
|
|
56
|
+
function unquoteIdentifier(identifier) {
|
|
57
|
+
const trimmed = identifier.trim();
|
|
58
|
+
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
59
|
+
return trimmed.slice(1, -1).replace(/""/g, '"');
|
|
60
|
+
}
|
|
61
|
+
return trimmed;
|
|
62
|
+
}
|
|
63
|
+
function detectAppSchemas(schemasDir, verbose) {
|
|
64
|
+
const schemas = /* @__PURE__ */ new Set(["public"]);
|
|
65
|
+
if (!existsSync(schemasDir)) {
|
|
66
|
+
return Array.from(schemas);
|
|
67
|
+
}
|
|
68
|
+
const files = collectSchemaSqlFiles(schemasDir).sort();
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
const content = readFileSync(file, "utf-8");
|
|
71
|
+
const contentWithoutComments = stripSqlComments(content);
|
|
72
|
+
CREATE_SCHEMA_PATTERN.lastIndex = 0;
|
|
73
|
+
const matches = contentWithoutComments.matchAll(CREATE_SCHEMA_PATTERN);
|
|
74
|
+
for (const match of Array.from(matches)) {
|
|
75
|
+
const schemaNameRaw = unquoteIdentifier(match[1] ?? "");
|
|
76
|
+
if (!schemaNameRaw) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const schemaName = schemaNameRaw.toLowerCase();
|
|
80
|
+
if (!EXCLUDED_SCHEMAS.has(schemaName)) {
|
|
81
|
+
schemas.add(schemaName);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const result = Array.from(schemas).sort();
|
|
86
|
+
if (verbose) {
|
|
87
|
+
console.log(` \u2192 Detected app schemas: ${result.join(", ")}`);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
var VALID_PG_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
|
|
92
|
+
function formatSchemasForSql(schemas) {
|
|
93
|
+
return schemas.map((s) => {
|
|
94
|
+
if (!VALID_PG_IDENTIFIER.test(s)) {
|
|
95
|
+
throw new Error(`Invalid schema name "${s}": must be a valid PostgreSQL identifier`);
|
|
96
|
+
}
|
|
97
|
+
return `'${s.replace(/'/g, "''")}'`;
|
|
98
|
+
}).join(", ");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/commands/ci/utils/db-url-utils.ts
|
|
102
|
+
init_esm_shims();
|
|
103
|
+
function resolveHostToIPv4(hostname) {
|
|
104
|
+
const ipVersion = isIP(hostname);
|
|
105
|
+
if (ipVersion === 4) return hostname;
|
|
106
|
+
if (ipVersion === 6) return null;
|
|
107
|
+
try {
|
|
108
|
+
const output = execFileSync("getent", ["ahostsv4", hostname], {
|
|
109
|
+
encoding: "utf-8",
|
|
110
|
+
timeout: 5e3,
|
|
111
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
112
|
+
});
|
|
113
|
+
const firstLine = output.split("\n").find((l) => l.trim().length > 0);
|
|
114
|
+
if (!firstLine) return null;
|
|
115
|
+
const ip = firstLine.trim().split(/\s+/u)[0] ?? "";
|
|
116
|
+
return isIP(ip) === 4 ? ip : null;
|
|
117
|
+
} catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function normalizeDatabaseUrlForDdl(databaseUrl) {
|
|
122
|
+
try {
|
|
123
|
+
const url = new URL(databaseUrl);
|
|
124
|
+
const port = url.port ? Number(url.port) : void 0;
|
|
125
|
+
if (port === 6543) url.port = "5432";
|
|
126
|
+
if (url.searchParams.has("pgbouncer")) url.searchParams.delete("pgbouncer");
|
|
127
|
+
if (process.env.CI === "true") {
|
|
128
|
+
const ipv4 = resolveHostToIPv4(url.hostname);
|
|
129
|
+
if (ipv4) {
|
|
130
|
+
url.hostname = ipv4;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return url.toString();
|
|
134
|
+
} catch {
|
|
135
|
+
return databaseUrl;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function parseBoolish(value) {
|
|
139
|
+
return value === "t" || value === "true" || value === "1";
|
|
140
|
+
}
|
|
141
|
+
function isIPv6Only(hostname) {
|
|
142
|
+
const ipVersion = isIP(hostname);
|
|
143
|
+
if (ipVersion === 4) return false;
|
|
144
|
+
if (ipVersion === 6) return true;
|
|
145
|
+
const ipv4 = resolveHostToIPv4(hostname);
|
|
146
|
+
if (ipv4) return false;
|
|
147
|
+
try {
|
|
148
|
+
const output = execFileSync("getent", ["ahosts", hostname], {
|
|
149
|
+
encoding: "utf-8",
|
|
150
|
+
timeout: 5e3,
|
|
151
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
152
|
+
});
|
|
153
|
+
return output.trim().length > 0;
|
|
154
|
+
} catch {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function appendIpv4AddonGuidance(error) {
|
|
159
|
+
return `${error}
|
|
160
|
+
|
|
161
|
+
\u{1F4A1} **\u89E3\u6C7A\u7B56**: Supabase IPv4 Add-on \u3092\u6709\u52B9\u5316\u3057\u3066\u304F\u3060\u3055\u3044 ($4/month)
|
|
162
|
+
Supabase Dashboard \u2192 Project Settings \u2192 Add-ons \u2192 IPv4 Add-on
|
|
163
|
+
(GitHub Actions \u306F IPv6 \u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093)`;
|
|
164
|
+
}
|
|
165
|
+
function appendConnectionRefusedGuidance(error) {
|
|
166
|
+
return `${error}
|
|
167
|
+
|
|
168
|
+
\u{1F4A1} **\u78BA\u8A8D\u4E8B\u9805**:
|
|
169
|
+
1. DATABASE_URL \u304C Direct URL (port 5432) \u3092\u4F7F\u7528\u3057\u3066\u3044\u307E\u3059\u304B\uFF1F
|
|
170
|
+
2. Supabase \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u7A3C\u50CD\u4E2D\u3067\u3059\u304B\uFF1F`;
|
|
171
|
+
}
|
|
172
|
+
function appendAuthFailureGuidance(error) {
|
|
173
|
+
return `${error}
|
|
174
|
+
|
|
175
|
+
\u{1F4A1} **\u78BA\u8A8D\u4E8B\u9805**:
|
|
176
|
+
1. DATABASE_URL \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u6B63\u3057\u3044\u3067\u3059\u304B\uFF1F
|
|
177
|
+
2. Supabase Database Settings \u3067\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8\u3067\u304D\u307E\u3059`;
|
|
178
|
+
}
|
|
179
|
+
function isIpv6ConnectionError(error) {
|
|
180
|
+
return error.includes("Network is unreachable") || error.includes("IPv6");
|
|
181
|
+
}
|
|
182
|
+
function hasIpv6AddressPattern(error) {
|
|
183
|
+
return /\([0-9a-f:]+\)/i.test(error);
|
|
184
|
+
}
|
|
185
|
+
function canDetectIpv6OnlyFromUrl(databaseUrl) {
|
|
186
|
+
try {
|
|
187
|
+
const url = new URL(databaseUrl);
|
|
188
|
+
return isIPv6Only(url.hostname);
|
|
189
|
+
} catch {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function shouldShowIpv4AddonGuidance(error, databaseUrl) {
|
|
194
|
+
if (!isIpv6ConnectionError(error)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
if (databaseUrl && canDetectIpv6OnlyFromUrl(databaseUrl)) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
return hasIpv6AddressPattern(error);
|
|
201
|
+
}
|
|
202
|
+
function enhanceConnectionError(error, databaseUrl) {
|
|
203
|
+
if (shouldShowIpv4AddonGuidance(error, databaseUrl)) {
|
|
204
|
+
return appendIpv4AddonGuidance(error);
|
|
205
|
+
}
|
|
206
|
+
if (error.includes("Connection refused") || error.includes("connection refused")) {
|
|
207
|
+
return appendConnectionRefusedGuidance(error);
|
|
208
|
+
}
|
|
209
|
+
if (error.includes("password authentication failed") || error.includes("FATAL: password")) {
|
|
210
|
+
return appendAuthFailureGuidance(error);
|
|
211
|
+
}
|
|
212
|
+
return error;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { detectAppSchemas, enhanceConnectionError, formatSchemasForSql, normalizeDatabaseUrlForDdl, parseBoolish };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { isPathContained } from './chunk-DRSUEMAK.js';
|
|
4
|
-
import { emitJsonSuccess } from './chunk-
|
|
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';
|
|
7
7
|
import * as path3 from 'path';
|
|
@@ -1146,4 +1146,51 @@ async function injectTestAttrsAction(rawOptions, command) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
|
-
|
|
1149
|
+
// src/commands/inject-test-attrs/defaults.ts
|
|
1150
|
+
init_esm_shims();
|
|
1151
|
+
var DEFAULT_INCLUDE_PATTERNS = [
|
|
1152
|
+
"app/**/*.tsx",
|
|
1153
|
+
"app/**/*.ts",
|
|
1154
|
+
"pages/**/*.tsx",
|
|
1155
|
+
"pages/**/*.ts",
|
|
1156
|
+
"src/**/*.tsx",
|
|
1157
|
+
"src/**/*.ts",
|
|
1158
|
+
"components/**/*.tsx",
|
|
1159
|
+
"components/**/*.ts",
|
|
1160
|
+
"hooks/**/*.tsx",
|
|
1161
|
+
"hooks/**/*.ts",
|
|
1162
|
+
"lib/**/*.tsx",
|
|
1163
|
+
"lib/**/*.ts",
|
|
1164
|
+
"machines/**/*.tsx",
|
|
1165
|
+
"machines/**/*.ts",
|
|
1166
|
+
"features/**/*.tsx",
|
|
1167
|
+
"features/**/*.ts",
|
|
1168
|
+
"modules/**/*.tsx",
|
|
1169
|
+
"modules/**/*.ts",
|
|
1170
|
+
"domain/**/*.tsx",
|
|
1171
|
+
"domain/**/*.ts",
|
|
1172
|
+
"screens/**/*.tsx",
|
|
1173
|
+
"screens/**/*.ts",
|
|
1174
|
+
"views/**/*.tsx",
|
|
1175
|
+
"views/**/*.ts",
|
|
1176
|
+
"routes/**/*.tsx",
|
|
1177
|
+
"routes/**/*.ts",
|
|
1178
|
+
"api/**/*.tsx",
|
|
1179
|
+
"api/**/*.ts",
|
|
1180
|
+
"server/**/*.tsx",
|
|
1181
|
+
"server/**/*.ts",
|
|
1182
|
+
"apps/**/*.tsx",
|
|
1183
|
+
"apps/**/*.ts",
|
|
1184
|
+
"packages/**/*.tsx",
|
|
1185
|
+
"packages/**/*.ts"
|
|
1186
|
+
];
|
|
1187
|
+
var DEFAULT_EXCLUDE_PATTERNS = [
|
|
1188
|
+
"**/node_modules/**",
|
|
1189
|
+
"**/.next/**",
|
|
1190
|
+
"**/dist/**",
|
|
1191
|
+
"**/*.test.*",
|
|
1192
|
+
"**/*.spec.*",
|
|
1193
|
+
"**/*.stories.*"
|
|
1194
|
+
];
|
|
1195
|
+
|
|
1196
|
+
export { DEFAULT_EXCLUDE_PATTERNS, DEFAULT_INCLUDE_PATTERNS, injectTestAttrsAction, processFiles };
|