@calo-design/cli 0.12.1 → 0.12.3

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/bin/mirror-push.js +32 -3
  2. package/package.json +1 -1
@@ -505,17 +505,46 @@ export function handleLauncherPath(path: string): string | null {
505
505
  return launcherSlug(path) === null ? null : "/";
506
506
  }
507
507
 
508
+ // A launcher URL can carry a VERSION ref (calo-design checkpoints):
509
+ // "<slug>@g<group8>" — a pinned version; its EAS channel (slug--g<group8>) is
510
+ // derivable right here, no registry needed.
511
+ // "<slug>@<n>" — needs the checkpoints registry to resolve; this bundle can't
512
+ // do that, so bounce to the launcher WITHOUT clearing the URL store — the
513
+ // launcher's own sweep re-reads the ref and resolves it properly.
514
+ function channelForRef(ref: string): { channel: string; viaLauncher: boolean } {
515
+ const g = ref.match(/^([a-z0-9][a-z0-9-]{0,63})@g([0-9a-fA-F]{8})$/);
516
+ if (g) return { channel: g[1] + "--g" + g[2].toLowerCase(), viaLauncher: false };
517
+ if (/^[a-z0-9][a-z0-9-]{0,63}@\\d{1,6}$/.test(ref)) return { channel: "mirror", viaLauncher: true };
518
+ return { channel: ref, viaLauncher: false }; // plain slug — raw channel switch as before
519
+ }
520
+
508
521
  // The launcher-URL store is handle-once: after acting on a URL, clear it so a
509
522
  // context created later (e.g. by a feed tap, which carries no URL) can't
510
- // replay it as a phantom switch.
523
+ // replay it as a phantom switch. Exception: a ref we bounce to the launcher
524
+ // stays in the store on purpose — the launcher consumes (and clears) it.
525
+ //
526
+ // NO slug-based self no-op: with version pinning, one slug spans MANY channels
527
+ // (head + every pinned version), and this same bundle serves several of them —
528
+ // so "slug === PROTOTYPE" cannot mean "already here". A plain self-link now
529
+ // switches to the HEAD channel (the escape hatch out of a pinned version; from
530
+ // the head it's a redundant refresh-to-latest, which is harmless and even
531
+ // useful). Ping-pong protection comes from the handle-once clearing + the
532
+ // switching latch, not from slug comparison.
511
533
  function sweepLinkingURL(): void {
512
534
  let url: string | null = null;
513
535
  try { url = ExpoLinking.getLinkingURL() ?? null; } catch { return; }
514
536
  if (!url) return;
515
537
  const slug = launcherSlug(url);
516
538
  if (slug === null) return; // the prototype's own deep link — not ours to touch
517
- try { ExpoLinking.clearInitialURL(); } catch {}
518
- if (slug && slug !== PROTOTYPE) switchToChannel(slug);
539
+ if (!slug) {
540
+ try { ExpoLinking.clearInitialURL(); } catch {}
541
+ return; // bare /open — nothing to switch to
542
+ }
543
+ const target = channelForRef(slug);
544
+ if (!target.viaLauncher) {
545
+ try { ExpoLinking.clearInitialURL(); } catch {}
546
+ }
547
+ switchToChannel(target.channel);
519
548
  }
520
549
 
521
550
  export function subscribeLauncherLinks(): { remove: () => void } {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calo-design/cli",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "One-line setup for Calo design tooling: logs in with your Calo email and installs the calo-design skill + design-system packages. No GitHub account needed.",
5
5
  "bin": {
6
6
  "calo-design": "bin/cli.js"