@vibecodemax/cli 0.1.12 → 0.1.13

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 (2) hide show
  1. package/dist/cli.js +51 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -473,12 +473,15 @@ function runSupabaseCommand(args, dependencyManager) {
473
473
  fail("SUPABASE_CLI_ERROR", [result.stderr, result.stdout].find(isNonEmptyString) || `Supabase CLI ${args.join(" ")} failed.`, 1, { exitCode: result.status ?? 1 });
474
474
  }
475
475
  }
476
- function runSupabaseCommandCapture(args, dependencyManager) {
476
+ function runSupabaseCommandResult(args, dependencyManager) {
477
477
  const runner = getSupabaseRunnerCommand(dependencyManager);
478
- const result = spawnSync(runner.command, [...runner.args, ...args], {
478
+ return spawnSync(runner.command, [...runner.args, ...args], {
479
479
  cwd: process.cwd(),
480
480
  encoding: "utf8",
481
481
  });
482
+ }
483
+ function runSupabaseCommandCapture(args, dependencyManager) {
484
+ const result = runSupabaseCommandResult(args, dependencyManager);
482
485
  if (result.status !== 0) {
483
486
  fail("SUPABASE_CLI_ERROR", [result.stderr, result.stdout].find(isNonEmptyString) || `Supabase CLI ${args.join(" ")} failed.`, 1, { exitCode: result.status ?? 1 });
484
487
  }
@@ -516,6 +519,36 @@ function collectVersionsFromRows(rows, keyCandidates) {
516
519
  }
517
520
  return Array.from(values).sort();
518
521
  }
522
+ function parseMigrationListTableOutput(raw) {
523
+ const localVersions = new Set();
524
+ const remoteVersions = new Set();
525
+ for (const line of raw.split(/\r?\n/)) {
526
+ if (!line.includes("|"))
527
+ continue;
528
+ const columns = line.split("|").map((value) => value.trim());
529
+ if (columns.length < 2)
530
+ continue;
531
+ const [localCell, remoteCell] = columns;
532
+ const normalizedLocal = localCell.toLowerCase();
533
+ const normalizedRemote = remoteCell.toLowerCase();
534
+ if ((normalizedLocal === "local" && normalizedRemote === "remote")
535
+ || (/^-+$/.test(localCell.replace(/\s/g, "")) && /^-+$/.test(remoteCell.replace(/\s/g, "")))) {
536
+ continue;
537
+ }
538
+ const localVersion = extractMigrationVersion(localCell);
539
+ const remoteVersion = extractMigrationVersion(remoteCell);
540
+ if (localVersion)
541
+ localVersions.add(localVersion);
542
+ if (remoteVersion)
543
+ remoteVersions.add(remoteVersion);
544
+ }
545
+ if (localVersions.size === 0 && remoteVersions.size === 0)
546
+ return null;
547
+ return {
548
+ localVersions: Array.from(localVersions).sort(),
549
+ remoteVersions: Array.from(remoteVersions).sort(),
550
+ };
551
+ }
519
552
  function parseMigrationListOutput(raw) {
520
553
  const trimmed = raw.trim();
521
554
  if (!trimmed) {
@@ -554,11 +587,18 @@ function parseMigrationListOutput(raw) {
554
587
  }
555
588
  catch (error) {
556
589
  if (error instanceof SyntaxError) {
557
- fail("INVALID_MIGRATION_LIST_OUTPUT", "Supabase migration list output was not valid JSON. Upgrade the local Supabase CLI if it does not support --output json for migration list.");
590
+ const fallback = parseMigrationListTableOutput(trimmed);
591
+ if (fallback)
592
+ return fallback;
593
+ fail("INVALID_MIGRATION_LIST_OUTPUT", "Supabase migration list output was neither valid JSON nor a recognizable table. Upgrade the local Supabase CLI if its migration list format is unsupported.");
558
594
  }
559
595
  throw error;
560
596
  }
561
597
  }
598
+ function supportsJsonMigrationListFailure(result) {
599
+ const combined = [result.stderr, result.stdout].filter(isNonEmptyString).join("\n").toLowerCase();
600
+ return combined.includes("--output") || combined.includes("unknown flag") || combined.includes("unknown option");
601
+ }
562
602
  async function supabaseManagementApiRequest(params) {
563
603
  const response = await fetch(`${MANAGEMENT_API_BASE}${params.endpoint}`, {
564
604
  method: params.method,
@@ -841,7 +881,14 @@ async function linkBaseSupabaseProject(flags) {
841
881
  function preflightBaseMigrationState(flags) {
842
882
  const dependencyManager = normalizeDependencyManagerFlag(flags);
843
883
  const localVersions = listLocalMigrationVersions();
844
- const raw = runSupabaseCommandCapture(["migration", "list", "--linked", "--output", "json"], dependencyManager);
884
+ let result = runSupabaseCommandResult(["migration", "list", "--linked", "--output", "json"], dependencyManager);
885
+ if (result.status !== 0 && supportsJsonMigrationListFailure(result)) {
886
+ result = runSupabaseCommandResult(["migration", "list", "--linked"], dependencyManager);
887
+ }
888
+ if (result.status !== 0) {
889
+ fail("SUPABASE_CLI_ERROR", [result.stderr, result.stdout].find(isNonEmptyString) || "Supabase CLI migration list failed.", 1, { exitCode: result.status ?? 1 });
890
+ }
891
+ const raw = result.stdout || "";
845
892
  const parsed = parseMigrationListOutput(raw);
846
893
  const localSet = new Set(localVersions);
847
894
  const remoteSet = new Set(parsed.remoteVersions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecodemax/cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "VibeCodeMax CLI — local provider setup for bootstrap and project configuration",
5
5
  "type": "module",
6
6
  "bin": {