From 57f70c63cddb55832ee1f7f6e93e34da7374d916 Mon Sep 17 00:00:00 2001 From: citron <45784494+lcandy2@users.noreply.github.com> Date: Wed, 6 May 2026 02:04:59 +0800 Subject: [PATCH] refactor: rename package to @photon-ai/cli MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligns with industry convention (@vercel/cli, @supabase/cli, @dokploy/cli, etc.) and matches the binary's role rather than duplicating the name. The previous reasoning behind @photon-ai/photon (PR #11) was that the post-scope segment must match the bin name for unpinned `npx ` to auto-resolve. That turns out to have been an overly strict reading of PR #12's findings — the actual rule npm 11 uses is "single bin auto-resolves regardless of name match." Confirmed empirically against @dokploy/cli, which has bin `dokploy` (not `cli`) and works unpinned. Bin shape switches from string-form to single-key object: "bin": "./dist/photon.js" → "bin": { "photon": "./dist/photon.js" } This keeps the binary registered as `photon` (string form would have made it `cli`, breaking every existing user invocation). Verified locally against @photon-ai/cli@0.1.3 tarball: - bun add -g: installs `photon`, lazy `pho` symlink fires on first run - npm install (local): same - `npx --yes ` resolves to 0.1.3 via single-bin auto-resolve Existing `@photon-ai/photon` users will keep getting 0.1.3 (final version on the old name). Migration path: re-install with `bun add -g @photon-ai/cli`. --- .github/workflows/release.yaml | 2 +- README.md | 10 +++++----- package.json | 6 ++++-- src/lib/pho-alias.ts | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 40e1143..d08fe38 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,7 @@ jobs: contents: write pull-requests: read with: - service-name: "@photon-ai/photon" + service-name: "@photon-ai/cli" build-command: "bun run build" release: ${{ github.event_name == 'workflow_dispatch' && inputs.release || false }} dry-run: ${{ github.event_name == 'workflow_dispatch' && inputs['dry-run'] || false }} diff --git a/README.md b/README.md index 779a360..74f68ec 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Typed terminal UI for the [Photon Dashboard](https://photon.codes). Replaces the web UI for everyday work — manage projects, Spectrum users / lines / platforms, billing, and your developer profile from a terminal. ```sh -npx @photon-ai/photon login # try it without installing -bun add -g @photon-ai/photon # or install for daily use +npx @photon-ai/cli login # try it without installing +bun add -g @photon-ai/cli # or install for daily use ``` --- @@ -16,8 +16,8 @@ Three options. Pick whichever fits. ### 1. One-off — no install (`npx` / `bunx`) ```sh -npx @photon-ai/photon login -bunx @photon-ai/photon projects ls +npx @photon-ai/cli login +bunx @photon-ai/cli projects ls ``` Each invocation pulls the latest release on demand. Good for scripts, throwaway machines, or trying the CLI before committing. Requires Bun on `PATH` (the bundle has a `#!/usr/bin/env bun` shebang) — install it once with: @@ -29,7 +29,7 @@ curl -fsSL https://bun.sh/install | bash ### 2. Global install — daily use (`bun add -g`) ```sh -bun add -g @photon-ai/photon +bun add -g @photon-ai/cli photon login ``` diff --git a/package.json b/package.json index 1186856..1b86f79 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@photon-ai/photon", + "name": "@photon-ai/cli", "version": "0.1.3", "description": "Photon CLI — typed terminal UI for the Photon Dashboard. Binary: `photon` (alias `pho`).", "keywords": [ @@ -21,7 +21,9 @@ "url": "https://github.com/photon-hq/cli/issues" }, "type": "module", - "bin": "./dist/photon.js", + "bin": { + "photon": "./dist/photon.js" + }, "files": [ "dist", "README.md" diff --git a/src/lib/pho-alias.ts b/src/lib/pho-alias.ts index 0b287e3..d037dca 100644 --- a/src/lib/pho-alias.ts +++ b/src/lib/pho-alias.ts @@ -7,7 +7,8 @@ import { join, resolve, sep } from "node:path"; * * Why not declare both bins in package.json? npm 11's `npx ` * (no version) skips bin auto-resolve when `bin` has multiple keys. Keeping - * `bin` as a single string preserves clean `npx @photon-ai/photon` usage. + * `bin` as a single entry (`{ photon: "./dist/photon.js" }`) preserves clean + * `npx @photon-ai/cli` usage. * * Why not a `postinstall` script? Bun blocks postinstall by default — that * would silently strip `pho` from `bun add -g` (our primary install path).