@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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
+
|
|
5
|
+
createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
// src/commands/utils/machine-state-logging.ts
|
|
8
|
+
init_esm_shims();
|
|
9
|
+
function createMachineStateChangeLogger(options) {
|
|
10
|
+
const {
|
|
11
|
+
getState,
|
|
12
|
+
getContext,
|
|
13
|
+
handlers,
|
|
14
|
+
useParentState = false,
|
|
15
|
+
shouldSkipState,
|
|
16
|
+
onUnknownState,
|
|
17
|
+
handlerArgumentOrder = "logger-first"
|
|
18
|
+
} = options;
|
|
19
|
+
function resolveHandler(state) {
|
|
20
|
+
const exact = handlers[state];
|
|
21
|
+
if (exact) return exact;
|
|
22
|
+
if (!useParentState) return void 0;
|
|
23
|
+
const parent = state.includes(".") ? state.split(".")[0] : void 0;
|
|
24
|
+
return parent ? handlers[parent] : void 0;
|
|
25
|
+
}
|
|
26
|
+
function invokeHandler(handler, context, logger, extra) {
|
|
27
|
+
if (handlerArgumentOrder === "context-first") {
|
|
28
|
+
handler(
|
|
29
|
+
context,
|
|
30
|
+
logger,
|
|
31
|
+
extra
|
|
32
|
+
);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
handler(
|
|
36
|
+
logger,
|
|
37
|
+
context,
|
|
38
|
+
extra
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return (snapshot, prevState, logger, extra) => {
|
|
42
|
+
const state = getState(snapshot);
|
|
43
|
+
if (state === prevState) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const context = getContext(snapshot);
|
|
47
|
+
if (shouldSkipState?.(state, prevState, context, extra)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const handler = resolveHandler(state);
|
|
51
|
+
if (handler) {
|
|
52
|
+
invokeHandler(handler, context, logger, extra);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
onUnknownState?.(state, logger, context, extra, prevState);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { createMachineStateChangeLogger };
|
|
@@ -50,7 +50,8 @@ function runLogged(params) {
|
|
|
50
50
|
env: { DOTENVX_QUIET: "1", ...params.env },
|
|
51
51
|
stdio: ["ignore", "pipe", "pipe"],
|
|
52
52
|
shell: false,
|
|
53
|
-
timeout: params.timeoutMs
|
|
53
|
+
timeout: params.timeoutMs,
|
|
54
|
+
reject: params.reject
|
|
54
55
|
});
|
|
55
56
|
const stream = createWriteStream(params.logFile, { flags: "a" });
|
|
56
57
|
if (proc.stdout) proc.stdout.pipe(process.stdout, { end: false });
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
-
import { spawnSync
|
|
4
|
+
import { spawnSync } from 'child_process';
|
|
5
5
|
import { execa } from 'execa';
|
|
6
|
-
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import { isIP } from 'net';
|
|
9
6
|
|
|
10
7
|
createRequire(import.meta.url);
|
|
11
8
|
|
|
@@ -274,207 +271,4 @@ function consumeDollarQuotedBody(content, index) {
|
|
|
274
271
|
};
|
|
275
272
|
}
|
|
276
273
|
|
|
277
|
-
|
|
278
|
-
init_esm_shims();
|
|
279
|
-
var EXCLUDED_SCHEMAS = /* @__PURE__ */ new Set([
|
|
280
|
-
// PostgreSQL system
|
|
281
|
-
"pg_catalog",
|
|
282
|
-
"information_schema",
|
|
283
|
-
"pg_toast",
|
|
284
|
-
// Supabase services
|
|
285
|
-
"auth",
|
|
286
|
-
"storage",
|
|
287
|
-
"realtime",
|
|
288
|
-
"pgsodium",
|
|
289
|
-
"pgsodium_masks",
|
|
290
|
-
// Supabase extensions
|
|
291
|
-
"extensions",
|
|
292
|
-
"graphql",
|
|
293
|
-
"graphql_public",
|
|
294
|
-
"net",
|
|
295
|
-
"vault",
|
|
296
|
-
// Supabase internal
|
|
297
|
-
"supabase_functions",
|
|
298
|
-
"supabase_migrations",
|
|
299
|
-
"pgbouncer",
|
|
300
|
-
"cron"
|
|
301
|
-
]);
|
|
302
|
-
var IDENTIFIER_PATTERN = "[A-Za-z_][A-Za-z0-9_]*";
|
|
303
|
-
var SQL_IDENTIFIER = `(?:"(?:[^"]|"")*"|${IDENTIFIER_PATTERN})`;
|
|
304
|
-
var CREATE_SCHEMA_PATTERN = new RegExp(
|
|
305
|
-
`^\\s*CREATE\\s+SCHEMA\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?(${SQL_IDENTIFIER})`,
|
|
306
|
-
"gim"
|
|
307
|
-
);
|
|
308
|
-
function collectSchemaSqlFiles(schemasDir) {
|
|
309
|
-
const entries = readdirSync(schemasDir, { withFileTypes: true });
|
|
310
|
-
const files = [];
|
|
311
|
-
for (const entry of entries) {
|
|
312
|
-
const filePath = join(schemasDir, entry.name);
|
|
313
|
-
if (entry.isDirectory()) {
|
|
314
|
-
files.push(...collectSchemaSqlFiles(filePath));
|
|
315
|
-
} else if (entry.isFile() && filePath.endsWith(".sql")) {
|
|
316
|
-
files.push(filePath);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return files;
|
|
320
|
-
}
|
|
321
|
-
function unquoteIdentifier(identifier) {
|
|
322
|
-
const trimmed = identifier.trim();
|
|
323
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
324
|
-
return trimmed.slice(1, -1).replace(/""/g, '"');
|
|
325
|
-
}
|
|
326
|
-
return trimmed;
|
|
327
|
-
}
|
|
328
|
-
function detectAppSchemas(schemasDir, verbose) {
|
|
329
|
-
const schemas = /* @__PURE__ */ new Set(["public"]);
|
|
330
|
-
if (!existsSync(schemasDir)) {
|
|
331
|
-
return Array.from(schemas);
|
|
332
|
-
}
|
|
333
|
-
const files = collectSchemaSqlFiles(schemasDir).sort();
|
|
334
|
-
for (const file of files) {
|
|
335
|
-
const content = readFileSync(file, "utf-8");
|
|
336
|
-
const contentWithoutComments = stripSqlComments(content);
|
|
337
|
-
CREATE_SCHEMA_PATTERN.lastIndex = 0;
|
|
338
|
-
const matches = contentWithoutComments.matchAll(CREATE_SCHEMA_PATTERN);
|
|
339
|
-
for (const match of Array.from(matches)) {
|
|
340
|
-
const schemaNameRaw = unquoteIdentifier(match[1] ?? "");
|
|
341
|
-
if (!schemaNameRaw) {
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
const schemaName = schemaNameRaw.toLowerCase();
|
|
345
|
-
if (!EXCLUDED_SCHEMAS.has(schemaName)) {
|
|
346
|
-
schemas.add(schemaName);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
const result = Array.from(schemas).sort();
|
|
351
|
-
if (verbose) {
|
|
352
|
-
console.log(` \u2192 Detected app schemas: ${result.join(", ")}`);
|
|
353
|
-
}
|
|
354
|
-
return result;
|
|
355
|
-
}
|
|
356
|
-
var VALID_PG_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
|
|
357
|
-
function formatSchemasForSql(schemas) {
|
|
358
|
-
return schemas.map((s) => {
|
|
359
|
-
if (!VALID_PG_IDENTIFIER.test(s)) {
|
|
360
|
-
throw new Error(`Invalid schema name "${s}": must be a valid PostgreSQL identifier`);
|
|
361
|
-
}
|
|
362
|
-
return `'${s.replace(/'/g, "''")}'`;
|
|
363
|
-
}).join(", ");
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// src/commands/ci/utils/db-url-utils.ts
|
|
367
|
-
init_esm_shims();
|
|
368
|
-
function resolveHostToIPv4(hostname) {
|
|
369
|
-
const ipVersion = isIP(hostname);
|
|
370
|
-
if (ipVersion === 4) return hostname;
|
|
371
|
-
if (ipVersion === 6) return null;
|
|
372
|
-
try {
|
|
373
|
-
const output = execFileSync("getent", ["ahostsv4", hostname], {
|
|
374
|
-
encoding: "utf-8",
|
|
375
|
-
timeout: 5e3,
|
|
376
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
377
|
-
});
|
|
378
|
-
const firstLine = output.split("\n").find((l) => l.trim().length > 0);
|
|
379
|
-
if (!firstLine) return null;
|
|
380
|
-
const ip = firstLine.trim().split(/\s+/u)[0] ?? "";
|
|
381
|
-
return isIP(ip) === 4 ? ip : null;
|
|
382
|
-
} catch {
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function normalizeDatabaseUrlForDdl(databaseUrl) {
|
|
387
|
-
try {
|
|
388
|
-
const url = new URL(databaseUrl);
|
|
389
|
-
const port = url.port ? Number(url.port) : void 0;
|
|
390
|
-
if (port === 6543) url.port = "5432";
|
|
391
|
-
if (url.searchParams.has("pgbouncer")) url.searchParams.delete("pgbouncer");
|
|
392
|
-
if (process.env.CI === "true") {
|
|
393
|
-
const ipv4 = resolveHostToIPv4(url.hostname);
|
|
394
|
-
if (ipv4) {
|
|
395
|
-
url.hostname = ipv4;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
return url.toString();
|
|
399
|
-
} catch {
|
|
400
|
-
return databaseUrl;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function parseBoolish(value) {
|
|
404
|
-
return value === "t" || value === "true" || value === "1";
|
|
405
|
-
}
|
|
406
|
-
function isIPv6Only(hostname) {
|
|
407
|
-
const ipVersion = isIP(hostname);
|
|
408
|
-
if (ipVersion === 4) return false;
|
|
409
|
-
if (ipVersion === 6) return true;
|
|
410
|
-
const ipv4 = resolveHostToIPv4(hostname);
|
|
411
|
-
if (ipv4) return false;
|
|
412
|
-
try {
|
|
413
|
-
const output = execFileSync("getent", ["ahosts", hostname], {
|
|
414
|
-
encoding: "utf-8",
|
|
415
|
-
timeout: 5e3,
|
|
416
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
417
|
-
});
|
|
418
|
-
return output.trim().length > 0;
|
|
419
|
-
} catch {
|
|
420
|
-
return false;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
function appendIpv4AddonGuidance(error) {
|
|
424
|
-
return `${error}
|
|
425
|
-
|
|
426
|
-
\u{1F4A1} **\u89E3\u6C7A\u7B56**: Supabase IPv4 Add-on \u3092\u6709\u52B9\u5316\u3057\u3066\u304F\u3060\u3055\u3044 ($4/month)
|
|
427
|
-
Supabase Dashboard \u2192 Project Settings \u2192 Add-ons \u2192 IPv4 Add-on
|
|
428
|
-
(GitHub Actions \u306F IPv6 \u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093)`;
|
|
429
|
-
}
|
|
430
|
-
function appendConnectionRefusedGuidance(error) {
|
|
431
|
-
return `${error}
|
|
432
|
-
|
|
433
|
-
\u{1F4A1} **\u78BA\u8A8D\u4E8B\u9805**:
|
|
434
|
-
1. DATABASE_URL \u304C Direct URL (port 5432) \u3092\u4F7F\u7528\u3057\u3066\u3044\u307E\u3059\u304B\uFF1F
|
|
435
|
-
2. Supabase \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u7A3C\u50CD\u4E2D\u3067\u3059\u304B\uFF1F`;
|
|
436
|
-
}
|
|
437
|
-
function appendAuthFailureGuidance(error) {
|
|
438
|
-
return `${error}
|
|
439
|
-
|
|
440
|
-
\u{1F4A1} **\u78BA\u8A8D\u4E8B\u9805**:
|
|
441
|
-
1. DATABASE_URL \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u6B63\u3057\u3044\u3067\u3059\u304B\uFF1F
|
|
442
|
-
2. Supabase Database Settings \u3067\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8\u3067\u304D\u307E\u3059`;
|
|
443
|
-
}
|
|
444
|
-
function isIpv6ConnectionError(error) {
|
|
445
|
-
return error.includes("Network is unreachable") || error.includes("IPv6");
|
|
446
|
-
}
|
|
447
|
-
function hasIpv6AddressPattern(error) {
|
|
448
|
-
return /\([0-9a-f:]+\)/i.test(error);
|
|
449
|
-
}
|
|
450
|
-
function canDetectIpv6OnlyFromUrl(databaseUrl) {
|
|
451
|
-
try {
|
|
452
|
-
const url = new URL(databaseUrl);
|
|
453
|
-
return isIPv6Only(url.hostname);
|
|
454
|
-
} catch {
|
|
455
|
-
return false;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
function shouldShowIpv4AddonGuidance(error, databaseUrl) {
|
|
459
|
-
if (!isIpv6ConnectionError(error)) {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
if (databaseUrl && canDetectIpv6OnlyFromUrl(databaseUrl)) {
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
return hasIpv6AddressPattern(error);
|
|
466
|
-
}
|
|
467
|
-
function enhanceConnectionError(error, databaseUrl) {
|
|
468
|
-
if (shouldShowIpv4AddonGuidance(error, databaseUrl)) {
|
|
469
|
-
return appendIpv4AddonGuidance(error);
|
|
470
|
-
}
|
|
471
|
-
if (error.includes("Connection refused") || error.includes("connection refused")) {
|
|
472
|
-
return appendConnectionRefusedGuidance(error);
|
|
473
|
-
}
|
|
474
|
-
if (error.includes("password authentication failed") || error.includes("FATAL: password")) {
|
|
475
|
-
return appendAuthFailureGuidance(error);
|
|
476
|
-
}
|
|
477
|
-
return error;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
export { blankDollarQuotedBodies, buildPsqlArgs, buildPsqlEnv, detectAppSchemas, enhanceConnectionError, formatSchemasForSql, normalizeDatabaseUrlForDdl, parseBoolish, parsePostgresUrl, psqlExec, psqlQuery, psqlSyncFile, psqlSyncQuery, stripSqlComments };
|
|
274
|
+
export { blankDollarQuotedBodies, buildPsqlArgs, buildPsqlEnv, parsePostgresUrl, psqlExec, psqlQuery, psqlSyncFile, psqlSyncQuery, stripSqlComments };
|