@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.
Files changed (81) hide show
  1. package/dist/{build-BXUJKYHC.js → build-HUDIP6KU.js} +153 -164
  2. package/dist/{cache-H63JKFYH.js → cache-N7WNPEYF.js} +2 -3
  3. package/dist/check-LOMVIRHX.js +12 -0
  4. package/dist/{chunk-HPYJPB5Y.js → chunk-2APB25TT.js} +44 -10
  5. package/dist/chunk-3WDV32GA.js +33 -0
  6. package/dist/chunk-5FT3F36G.js +59 -0
  7. package/dist/{chunk-7QV7U6NI.js → chunk-6FAU4IGR.js} +2 -1
  8. package/dist/{chunk-CE3DEYFT.js → chunk-7B5C6U2K.js} +2 -208
  9. package/dist/{chunk-GOGRLQNP.js → chunk-AFY3TX4I.js} +1 -1
  10. package/dist/{chunk-KWX3JHCY.js → chunk-AKZAN4BC.js} +6 -1
  11. package/dist/{chunk-XJBQINSA.js → chunk-CCW3PLQY.js} +2 -2
  12. package/dist/{chunk-IBVVGH6X.js → chunk-EMB6IZFT.js} +17 -4
  13. package/dist/chunk-FHG3ILE4.js +2011 -0
  14. package/dist/{chunk-22CS6EMA.js → chunk-H2AHNI75.js} +1 -1
  15. package/dist/{chunk-UU55OH7P.js → chunk-KE6QJBZG.js} +2 -3
  16. package/dist/{check-6AB5NGWK.js → chunk-QM53IQHM.js} +14 -12
  17. package/dist/{chunk-RRGQCUKT.js → chunk-WJXC4MVY.js} +30 -3
  18. package/dist/chunk-XDCHRVE3.js +215 -0
  19. package/dist/{chunk-P7U52PBY.js → chunk-Z4Z5DNW4.js} +49 -2
  20. package/dist/{ci-V3PIG2GI.js → ci-XY6IKEDC.js} +1938 -238
  21. package/dist/cli/contract-output.d.ts +1 -0
  22. package/dist/{cli-GFRZCJQR.js → cli-UZA4RBNQ.js} +216 -173
  23. package/dist/commands/build/actors/validate.d.ts +2 -0
  24. package/dist/commands/check/commands/check.d.ts +8 -3
  25. package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +12 -6
  26. package/dist/commands/ci/machine/actors/db/production-preview.d.ts +10 -0
  27. package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +77 -0
  28. package/dist/commands/ci/machine/actors/db/schema-stats.d.ts +11 -0
  29. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +9 -1
  30. package/dist/commands/ci/machine/commands/machine-runner.d.ts +2 -0
  31. package/dist/commands/ci/machine/formatters/sections/production-schema-status.d.ts +30 -0
  32. package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
  33. package/dist/commands/ci/machine/helpers.d.ts +8 -0
  34. package/dist/commands/ci/machine/machine.d.ts +57 -4
  35. package/dist/commands/ci/machine/types.d.ts +2 -0
  36. package/dist/commands/ci/utils/execa-helpers.d.ts +1 -0
  37. package/dist/commands/db/commands/db-sync/error-classifier.d.ts +9 -0
  38. package/dist/commands/dev/actors/index.d.ts +5 -0
  39. package/dist/commands/dev/actors/tables-manifest.d.ts +16 -0
  40. package/dist/commands/dev/contract.d.ts +1 -1
  41. package/dist/commands/dev/guards.d.ts +24 -0
  42. package/dist/commands/dev/machine.d.ts +22 -3
  43. package/dist/commands/dev/types.d.ts +2 -0
  44. package/dist/commands/doctor.d.ts +9 -0
  45. package/dist/commands/inject-test-attrs/defaults.d.ts +9 -0
  46. package/dist/commands/template-check/commands/template-check.d.ts +1 -0
  47. package/dist/commands/template-check/contract.d.ts +1 -0
  48. package/dist/commands/utils/machine-state-logging.d.ts +20 -0
  49. package/dist/commands/utils/repo-root.d.ts +2 -0
  50. package/dist/constants/versions.d.ts +1 -1
  51. package/dist/{db-HR7CREX2.js → db-Q3GF7JWP.js} +518 -2234
  52. package/dist/{dev-A7RW6XQV.js → dev-5YXNPTCJ.js} +168 -49
  53. package/dist/doctor-MZLOA53G.js +44 -0
  54. package/dist/{env-B47Z4747.js → env-GMB3THRG.js} +6 -7
  55. package/dist/{env-files-K2C7O7L5.js → env-files-2UIUYLLR.js} +2 -2
  56. package/dist/{error-handler-4EYSDOSE.js → error-handler-HEXBRNVV.js} +2 -2
  57. package/dist/{hotfix-CULKKMGS.js → hotfix-NDTPY2T4.js} +4 -4
  58. package/dist/index.js +4 -4
  59. package/dist/{init-ELK5QCWR.js → init-U4VCRHTD.js} +5 -6
  60. package/dist/{inject-test-attrs-Y5UD5P7Q.js → inject-test-attrs-P44BVTQS.js} +5 -18
  61. package/dist/{link-C43JRZWY.js → link-VSNDVZZD.js} +2 -3
  62. package/dist/manifest-TMFLESHW.js +19 -0
  63. package/dist/{risk-detector-BXUY2WKS.js → risk-detector-4U6ZJ2G5.js} +1 -1
  64. package/dist/{risk-detector-core-O7I7SPR7.js → risk-detector-core-TK4OAI3N.js} +2 -2
  65. package/dist/{risk-detector-plpgsql-SGMVKYJP.js → risk-detector-plpgsql-HWKS4OLR.js} +37 -7
  66. package/dist/{status-IJ4ZWHMX.js → status-UTKS63AB.js} +2 -3
  67. package/dist/{telemetry-FN7V727Y.js → telemetry-P56UBLZ2.js} +2 -3
  68. package/dist/{template-check-PNG5NQ5H.js → template-check-FFJVDLBF.js} +63 -35
  69. package/dist/{test-QYXE5UVW.js → test-V4KQL574.js} +34 -10
  70. package/dist/{test-gen-QPWOIEHU.js → test-gen-FS4CEY3P.js} +2 -3
  71. package/dist/{upgrade-3SLWVNAC.js → upgrade-7TWORWBV.js} +18 -6
  72. package/dist/{validate-SM4PXPS7.js → validate-CAAW4Y44.js} +2 -3
  73. package/dist/{vuln-check-TYQNEFS7.js → vuln-check-6CMNPSBR.js} +3 -4
  74. package/dist/{vuln-checker-2QXGN5YT.js → vuln-checker-EJJTNDNE.js} +413 -140
  75. package/dist/{watch-UCDVOQAH.js → watch-PNTKZYFB.js} +1 -1
  76. package/dist/{workflow-ZB5Q2PFY.js → workflow-H75N4BXX.js} +3 -4
  77. package/package.json +2 -2
  78. package/dist/chunk-JT5SUTWE.js +0 -9
  79. package/dist/chunk-M47WJJVS.js +0 -71
  80. package/dist/manifest-2NOQ2IMK.js +0 -32
  81. package/dist/{chunk-MNPMZERI.js → chunk-644FVGIQ.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, execFileSync } from 'child_process';
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
- // src/commands/db/utils/schema-detector.ts
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 };
@@ -6,7 +6,7 @@ createRequire(import.meta.url);
6
6
 
7
7
  // src/version.ts
8
8
  init_esm_shims();
9
- var CLI_VERSION = "0.6.0";
9
+ var CLI_VERSION = "0.7.1";
10
10
  var HAS_ADMIN_COMMAND = false;
11
11
 
12
12
  export { CLI_VERSION, HAS_ADMIN_COMMAND };
@@ -25,10 +25,15 @@ function isLocalDatabaseUrl(url) {
25
25
  return false;
26
26
  }
27
27
  }
28
+ function getExplicitLocalAdminUrl() {
29
+ const explicitAdminUrl = process.env.DATABASE_URL_ADMIN?.trim();
30
+ if (!explicitAdminUrl) return void 0;
31
+ return isLocalDatabaseUrl(explicitAdminUrl) ? explicitAdminUrl : void 0;
32
+ }
28
33
  function resolveDatabaseUrl(environment) {
29
34
  switch (environment) {
30
35
  case "local": {
31
- const url = process.env.DATABASE_URL_ADMIN || getLocalDatabaseUrl();
36
+ const url = getExplicitLocalAdminUrl() || getLocalDatabaseUrl();
32
37
  if (!isLocalDatabaseUrl(url)) {
33
38
  throw new CLIError("Local database URL appears to be a remote URL", "LOCAL_DB_URL_REMOTE", [
34
39
  "Local operations should use the local Supabase instance",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { secureGh, securePnpm } from './chunk-RZLYEO4U.js';
4
3
  import { isPathContained } from './chunk-DRSUEMAK.js';
4
+ import { secureGh, securePnpm } from './chunk-RZLYEO4U.js';
5
5
  import { init_esm_shims } from './chunk-VRXHCR5K.js';
6
6
  import fs from 'fs';
7
7
  import { rm, mkdir, writeFile, cp, readdir, lstat } from 'fs/promises';
@@ -16,7 +16,7 @@ init_esm_shims();
16
16
 
17
17
  // src/constants/versions.ts
18
18
  init_esm_shims();
19
- var COMPATIBLE_TEMPLATES_VERSION = "0.5.71";
19
+ var COMPATIBLE_TEMPLATES_VERSION = "0.7.1";
20
20
  var TEMPLATES_PACKAGE_NAME = "@r06-dev/runa-templates";
21
21
  var GITHUB_PACKAGES_REGISTRY = "https://npm.pkg.github.com";
22
22
 
@@ -17,11 +17,24 @@ function getSnapshotStateName(snapshot) {
17
17
  if (entries.length === 0) {
18
18
  return "unknown";
19
19
  }
20
- const [parent, child] = entries[0];
21
- if (typeof child === "string") {
22
- return `${parent}.${child}`;
20
+ function flattenState(value) {
21
+ if (typeof value === "string") {
22
+ return value;
23
+ }
24
+ if (!value || typeof value !== "object") {
25
+ return "";
26
+ }
27
+ const childEntries = Object.entries(value);
28
+ if (childEntries.length === 0) {
29
+ return "";
30
+ }
31
+ const [childKey, childValue] = childEntries[0];
32
+ const nested2 = flattenState(childValue);
33
+ return nested2 ? `${childKey}.${nested2}` : childKey;
23
34
  }
24
- return parent;
35
+ const [parent, child] = entries[0];
36
+ const nested = flattenState(child);
37
+ return nested ? `${parent}.${nested}` : parent;
25
38
  }
26
39
  function isSnapshotComplete(snapshot) {
27
40
  return snapshot.status === "done";