@calo-design/cli 0.12.0 → 0.12.2

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 -5
  2. package/package.json +1 -1
@@ -106,7 +106,12 @@ function extractEasGroup(captured) {
106
106
  // party — CLI, broker page, Mirror launcher — can derive it, but it's also stored in
107
107
  // artifact.easBranch so the convention can evolve without re-deriving. EAS channel
108
108
  // names share the slug charset; slug ≤63 + "--g" + 8 = ≤74, under EAS's limits.
109
- const versionBranchOf = (slug, group) => `${slug}--g${String(group).slice(0, 8).toLowerCase()}`;
109
+ // A hoisted `function` on purpose: it's called from cmdPush, which runs ABOVE this
110
+ // definition — a `const` here sat in the TDZ and silently killed the pin (the
111
+ // best-effort catch ate the ReferenceError; caught only by live-push verification).
112
+ function versionBranchOf(slug, group) {
113
+ return `${slug}--g${String(group).slice(0, 8).toLowerCase()}`;
114
+ }
110
115
 
111
116
  function runtimeDir() {
112
117
  const home = process.env.DESIGNCHEF_HOME || path.join(os.homedir(), ".designchef");
@@ -500,17 +505,38 @@ export function handleLauncherPath(path: string): string | null {
500
505
  return launcherSlug(path) === null ? null : "/";
501
506
  }
502
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
+
503
521
  // The launcher-URL store is handle-once: after acting on a URL, clear it so a
504
522
  // context created later (e.g. by a feed tap, which carries no URL) can't
505
- // 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.
506
525
  function sweepLinkingURL(): void {
507
526
  let url: string | null = null;
508
527
  try { url = ExpoLinking.getLinkingURL() ?? null; } catch { return; }
509
528
  if (!url) return;
510
529
  const slug = launcherSlug(url);
511
530
  if (slug === null) return; // the prototype's own deep link — not ours to touch
512
- try { ExpoLinking.clearInitialURL(); } catch {}
513
- if (slug && slug !== PROTOTYPE) switchToChannel(slug);
531
+ if (!slug || slug === PROTOTYPE) {
532
+ try { ExpoLinking.clearInitialURL(); } catch {}
533
+ return;
534
+ }
535
+ const target = channelForRef(slug);
536
+ if (!target.viaLauncher) {
537
+ try { ExpoLinking.clearInitialURL(); } catch {}
538
+ }
539
+ switchToChannel(target.channel);
514
540
  }
515
541
 
516
542
  export function subscribeLauncherLinks(): { remove: () => void } {
@@ -890,7 +916,8 @@ async function cmdPush(args) {
890
916
  }
891
917
  await require("./checkpoints").autoCheckpoint({
892
918
  root: process.cwd(),
893
- note: flag(args, "note") || `pushed to the Mirror (${slug})`,
919
+ // NB: mirror-push's flag() takes the full "--name" (unlike share.js's bare-name helper).
920
+ note: flag(args, "--note") || `pushed to the Mirror (${slug})`,
894
921
  publishedUrl: `designchef://open/${slug}`,
895
922
  artifact: {
896
923
  kind: "mirror",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calo-design/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
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"