petdex 0.3.4 → 0.3.5

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/petdex.js +1 -1
  2. package/package.json +1 -1
package/dist/petdex.js CHANGED
@@ -195,7 +195,7 @@ ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the masco
195
195
  body: ${JSON.stringify(V)},
196
196
  signal: controller.signal,
197
197
  }).catch(() => {}).finally(() => clearTimeout(t));
198
- `;Gz(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",vz="https://clerk.petdex.crafter.run",xz="LcThwEayl6KAA1Qm",$q=["profile","email","openid","offline_access"];async function Sz(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:$q};try{let q=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(q.ok){let V=await q.json(),Y=typeof V.issuer==="string"?V.issuer:null,X=typeof V.clientId==="string"?V.clientId:null,J=Array.isArray(V.scopes)?V.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:$q}}}catch{}return{issuer:$??vz,clientId:Q??xz,scopes:$q}}var I8=null;async function A8(){if(I8)return I8;let $=await Sz();return I8=new j8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),I8}var K$="0.3.4";Ez().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function Ez(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:V}=await Promise.resolve().then(() => (PY(),HY));await V($.slice(1));return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){BY();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))JY();switch(Q){case"login":await yz();break;case"logout":await gz();break;case"whoami":await kz();break;case"submit":await _z($.slice(1));break;case"install":await Dz($.slice(1));break;case"list":await hz();break;case"hooks":await nz($.slice(1));break;case"desktop":await tz($.slice(1));break;case"init":await az();break;case"up":await FY();break;case"down":await RY();break;case"toggle":await sz();break;case"update":await oJ($.slice(1));break;case"doctor":await gJ();break;case"telemetry":ez($.slice(1));break;case"version":case"--version":case"-v":console.log(K$);break;default:console.error(j.default.red(`Unknown command: ${Q}`)),BY(),process.exit(1)}}function BY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${Q(K$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${j.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${j.default.green("(start here)")}`,` ${j.default.bold("login")} Sign in with Clerk OAuth`,` ${j.default.bold("logout")} Clear stored credentials`,` ${j.default.bold("whoami")} Show signed-in user`,` ${j.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${j.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${j.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${j.default.bold("list")} List approved pets`,` ${j.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${j.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${j.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${j.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${j.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${j.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${j.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${j.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${j.default.underline(M1)}`,""].join(`
198
+ `;Gz(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",vz="https://clerk.petdex.crafter.run",xz="LcThwEayl6KAA1Qm",$q=["profile","email","openid","offline_access"];async function Sz(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:$q};try{let q=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(q.ok){let V=await q.json(),Y=typeof V.issuer==="string"?V.issuer:null,X=typeof V.clientId==="string"?V.clientId:null,J=Array.isArray(V.scopes)?V.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:$q}}}catch{}return{issuer:$??vz,clientId:Q??xz,scopes:$q}}var I8=null;async function A8(){if(I8)return I8;let $=await Sz();return I8=new j8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),I8}var K$="0.3.5";Ez().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function Ez(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:V}=await Promise.resolve().then(() => (PY(),HY));await V($.slice(1));return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){BY();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))JY();switch(Q){case"login":await yz();break;case"logout":await gz();break;case"whoami":await kz();break;case"submit":await _z($.slice(1));break;case"install":await Dz($.slice(1));break;case"list":await hz();break;case"hooks":await nz($.slice(1));break;case"desktop":await tz($.slice(1));break;case"init":await az();break;case"up":await FY();break;case"down":await RY();break;case"toggle":await sz();break;case"update":await oJ($.slice(1));break;case"doctor":await gJ();break;case"telemetry":ez($.slice(1));break;case"version":case"--version":case"-v":console.log(K$);break;default:console.error(j.default.red(`Unknown command: ${Q}`)),BY(),process.exit(1)}}function BY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${Q(K$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${j.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${j.default.green("(start here)")}`,` ${j.default.bold("login")} Sign in with Clerk OAuth`,` ${j.default.bold("logout")} Clear stored credentials`,` ${j.default.bold("whoami")} Show signed-in user`,` ${j.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${j.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${j.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${j.default.bold("list")} List approved pets`,` ${j.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${j.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${j.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${j.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${j.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${j.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${j.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${j.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${j.default.underline(M1)}`,""].join(`
199
199
  `))}async function yz(){A1(j.default.bgMagenta(j.default.white(" petdex login ")));let $=z1();$.start("Opening your browser to sign in with Clerk");try{let Q=await A8(),{user:q}=await Q.login(),V=AY(q.email,q.username,q.sub)??"unknown";$.stop(`${j.default.green("✓ ")}Signed in as ${j.default.cyan(V)}`),T1(`Try ${j.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(j.default.red("× login failed")),Error(dz(Q.message))}}async function gz(){await(await A8()).logout(),console.log(`${j.default.green("✓ ")}Signed out`)}async function kz(){try{let Q=await(await A8()).whoami();if(!Q)throw Error("not signed in");let q=[w8(Q.given_name),w8(Q.family_name)].filter(Boolean).join(" ");w1([`${j.default.dim("user: ")}${Q.sub}`,`${j.default.dim("email: ")}${Q.email??"—"}`,`${j.default.dim("name: ")}${q||"—"}`,`${j.default.dim("username:")}${w8(Q.preferred_username)??"—"}`].join(`
200
200
  `),"Signed in")}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}}async function Dz($){let Q=$[0];if(!Q)J1(`Usage: ${j.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await BJ();Y6("cli_install_desktop_success",{cli_version:K$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let q=z1();q.start(`Resolving ${Q}`);let V;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw q.stop(j.default.red("failed")),Error(`manifest fetch ${W.status}`);let z=(await W.json()).pets.find((H)=>H.slug===Q);if(!z)q.stop(j.default.red("not found")),J1(`No pet with slug ${j.default.bold(Q)}. Try ${j.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!i$(z.spritesheetUrl)||!i$(z.petJsonUrl))q.stop(j.default.red("untrusted asset host")),J1(`Refusing to install ${j.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);V=z}catch(W){throw q.stop(j.default.red("failed")),W}let Y=X1.join(OY(),".petdex","pets",Q),X=X1.join(OY(),".codex","pets",Q);q.message(`Downloading ${Q}`),await Promise.all([LY(Y,{recursive:!0}),LY(X,{recursive:!0})]);let J=V.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let Z=await fetch(W);if(!Z.ok)throw Error(`download ${W} → ${Z.status} ${Z.statusText}`);return Z.arrayBuffer()},[U,K]=await Promise.all([G(V.petJsonUrl),G(V.spritesheetUrl)]);await Promise.all([M8(X1.join(Y,"pet.json"),Buffer.from(U)),M8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),M8(X1.join(X,"pet.json"),Buffer.from(U)),M8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),q.stop(`Installed ${j.default.cyan(V.displayName)}`),w1(["Paths:",` ${j.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${j.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${j.default.cyan("Settings → Appearance → Pets")} → select ${j.default.bold(V.displayName)}`].join(`
201
201
  `),"Next steps")}async function hz(){let $=z1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(j.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let q=await Q.json();$.stop(`${q.total} pets`);let V=q.pets.map((Y)=>{let X=Y.submittedBy?j.default.dim(` — by ${Y.submittedBy}`):"";return` ${j.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(V.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "petdex",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "CLI for Petdex — install, browse, and submit Codex pets from your terminal.",
5
5
  "homepage": "https://petdex.crafter.run",
6
6
  "repository": {