@photon-ai/cli 2.3.0 → 3.0.1
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.
- package/LICENSE +202 -21
- package/README.md +21 -332
- package/dist/THIRD_PARTY_NOTICES.txt +26310 -0
- package/dist/bin.js +97333 -0
- package/dist/bin.js.map +7 -0
- package/package.json +86 -59
- package/dist/photon.js +0 -91
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Something Great Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,345 +1,34 @@
|
|
|
1
1
|
# Photon CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Photon CLI is the command-line client for [Photon](https://photon.codes). It
|
|
4
|
+
signs you in, manages your organizations and projects, and calls the Photon API
|
|
5
|
+
from a terminal, a script or an agent.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
npx @photon-ai/cli@legacy login # try it without installing
|
|
7
|
-
npm install -g @photon-ai/cli@legacy # or install for daily use
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Runs on Node.js >= 18. Bun is also supported but not required.
|
|
11
|
-
|
|
12
|
-
This release line is published under npm's `legacy` tag. `photon update` and
|
|
13
|
-
the update notification follow `legacy`, never `latest`.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
### One-off — no install
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npx @photon-ai/cli@legacy login
|
|
23
|
-
npx @photon-ai/cli@legacy projects ls
|
|
24
|
-
yarn dlx --package @photon-ai/cli@legacy photon login
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Each invocation pulls the requested release on demand. Good for scripts,
|
|
28
|
-
throwaway machines, or trying the CLI before committing. Works with `npx`,
|
|
29
|
-
`pnpx`, `bunx`, or `yarn dlx`.
|
|
30
|
-
|
|
31
|
-
### Global install
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
npm install -g @photon-ai/cli@legacy
|
|
35
|
-
photon login
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
After install, both `photon` and the shorter `pho` alias are on your `PATH`.
|
|
39
|
-
|
|
40
|
-
Also works with other package managers (Yarn global installs require Yarn
|
|
41
|
-
Classic 1.x):
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
pnpm add -g @photon-ai/cli@legacy
|
|
45
|
-
yarn global add @photon-ai/cli@legacy
|
|
46
|
-
bun add -g @photon-ai/cli@legacy
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Standalone binary
|
|
50
|
-
|
|
51
|
-
For CI environments or systems where you don't want any runtime. Replace `<version>` with the version on npm's `legacy` tag (`npm view @photon-ai/cli@legacy version`), and `<os>` and `<arch>` with your platform:
|
|
52
|
-
|
|
53
|
-
```sh
|
|
54
|
-
# <os>: darwin | linux <arch>: arm64 | x64
|
|
55
|
-
curl -L -o /usr/local/bin/photon \
|
|
56
|
-
https://github.com/photon-hq/cli/releases/download/v<version>/photon-<os>-<arch>
|
|
57
|
-
chmod +x /usr/local/bin/photon
|
|
58
|
-
photon --version
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Available for macOS (arm64 / x64) and Linux (x64 / arm64). Each binary ships with a corresponding `.sha256` checksum on the same release page.
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Update
|
|
66
|
-
|
|
67
|
-
The CLI shows a notification when a newer release is on npm's `legacy` tag. It can detect
|
|
68
|
-
global npm, pnpm, Yarn Classic, and Bun installs, and securely replace standalone
|
|
69
|
-
binaries after verifying the published SHA-256 checksum:
|
|
70
|
-
|
|
71
|
-
```sh
|
|
72
|
-
photon update
|
|
73
|
-
photon update --check # check without installing
|
|
74
|
-
photon update --force # reinstall even when already current
|
|
75
|
-
photon update --check --json # machine-readable check result
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
`--json` also works during an installation. `--force` cannot be combined with
|
|
79
|
-
`--check`.
|
|
7
|
+
Install it and get started with the [CLI guide](https://photon.codes/docs/cli).
|
|
80
8
|
|
|
81
|
-
|
|
9
|
+
This repository holds the CLI's source as published with each release. Changes
|
|
10
|
+
are made in Photon's private repository and reach this one with the next
|
|
11
|
+
release, so pull requests aren't accepted here; see
|
|
12
|
+
[CONTRIBUTING.md](CONTRIBUTING.md).
|
|
82
13
|
|
|
83
|
-
|
|
84
|
-
photon update --installer npm # npm | pnpm | yarn | bun
|
|
85
|
-
```
|
|
14
|
+
## Photon CLI 1.0
|
|
86
15
|
|
|
87
|
-
|
|
16
|
+
Photon CLI 1.0 is the previous CLI, published as `@photon-ai/cli` versions
|
|
17
|
+
2.x. Its source lives on the
|
|
18
|
+
[`legacy`](https://github.com/photon-hq/cli/tree/legacy) branch. To install
|
|
19
|
+
it:
|
|
88
20
|
|
|
89
21
|
```sh
|
|
90
|
-
npm
|
|
91
|
-
photon --version
|
|
22
|
+
npm i -g @photon-ai/cli@legacy
|
|
92
23
|
```
|
|
93
24
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```sh
|
|
97
|
-
pnpm add -g @photon-ai/cli@legacy
|
|
98
|
-
yarn global add @photon-ai/cli@legacy
|
|
99
|
-
bun add -g @photon-ai/cli@legacy
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
If you're using a standalone binary, re-download the release that
|
|
103
|
-
`photon update --check` names:
|
|
104
|
-
|
|
105
|
-
```sh
|
|
106
|
-
curl -L -o /usr/local/bin/photon \
|
|
107
|
-
https://github.com/photon-hq/cli/releases/download/v<version>/photon-<os>-<arch>
|
|
108
|
-
chmod +x /usr/local/bin/photon
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
`npx` / `pnpx` / `bunx` users can request `@photon-ai/cli@legacy` directly.
|
|
112
|
-
Yarn 2+ users can run
|
|
113
|
-
`yarn dlx --package @photon-ai/cli@legacy photon`, so no self-update is needed.
|
|
114
|
-
If a Yarn 2+ project lists Photon as a local dependency, update it from that
|
|
115
|
-
project with `yarn up @photon-ai/cli@legacy`.
|
|
116
|
-
|
|
117
|
-
To suppress the update notification, set `PHOTON_NO_UPDATE_NOTIFIER=1`.
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Quickstart
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
# 1. Log in (opens a browser to approve the device)
|
|
125
|
-
photon login
|
|
126
|
-
|
|
127
|
-
# 2. Pick a project for this shell session
|
|
128
|
-
photon projects ls
|
|
129
|
-
export PHOTON_PROJECT_ID=<project-id>
|
|
130
|
-
|
|
131
|
-
# 3. Off you go
|
|
132
|
-
photon projects show
|
|
133
|
-
photon spectrum users ls
|
|
134
|
-
photon billing show
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### The `pho` alias
|
|
138
|
-
|
|
139
|
-
`pho` is a shortcut for `photon`, useful for high-frequency commands. Every global install (npm / pnpm / yarn / bun) wires up both `photon` and `pho` automatically — they're declared as sibling `bin` entries that point at the same binary, so no setup is needed:
|
|
140
|
-
|
|
141
|
-
```sh
|
|
142
|
-
pho projects ls # same as: photon projects ls
|
|
143
|
-
pho whoami # same as: photon whoami
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
`pho` is a drop-in alias — it accepts the exact same commands and flags as `photon`, just fewer keystrokes to type. There's no top-level `ls` shortcut; list projects with the full `projects ls` path (`pho projects ls`).
|
|
147
|
-
|
|
148
|
-
For `npx` / `bunx`, the package name itself is what you type, so `npx @photon-ai/cli` runs `photon` (the first declared bin). To run `pho` explicitly through `npx`, use `npx --package=@photon-ai/cli pho`.
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Use with AI agents
|
|
153
|
-
|
|
154
|
-
There's a `photon-cli` [Agent Skill](https://skills.sh/) that teaches AI agents (Claude Code, Cursor, Copilot, OpenCode, and [25+ others](https://skills.sh/)) how to drive this CLI — the login flow, project bootstrapping, billing/upgrades, Spectrum resources, and config/environment resolution. Install it from [`photon-hq/skills`](https://github.com/photon-hq/skills):
|
|
155
|
-
|
|
156
|
-
```sh
|
|
157
|
-
npx skills add photon-hq/skills --skill photon-cli
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
Once installed, supported agents pick it up automatically — try *"log in to Photon, create a project, and tell me its id and secret"* or *"how many Spectrum lines does my project have, and how do I upgrade it to a business line?"*
|
|
161
|
-
|
|
162
|
-
The same collection ships skills for Photon's other SDKs — [`imessage`](https://github.com/photon-hq/skills/tree/main/skills/imessage), [`spectrum`](https://github.com/photon-hq/skills/tree/main/skills/spectrum), [`chat-adapter-imessage`](https://github.com/photon-hq/skills/tree/main/skills/chat-adapter-imessage), and [`buildspace-ci-cd`](https://github.com/photon-hq/skills/tree/main/skills/buildspace-ci-cd). Browse them all at [photon-hq/skills](https://github.com/photon-hq/skills).
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Concepts
|
|
167
|
-
|
|
168
|
-
### Backend host
|
|
169
|
-
|
|
170
|
-
Every command talks to a backend URL. The default — and the only URL baked into the public bundle — is production (`https://app.photon.codes`). To target any other backend (your own deployment, a staging environment, a local dev server), set `PHOTON_API_HOST`:
|
|
171
|
-
|
|
172
|
-
```sh
|
|
173
|
-
export PHOTON_API_HOST=https://your.backend.tld
|
|
174
|
-
photon login
|
|
175
|
-
photon projects ls
|
|
176
|
-
|
|
177
|
-
# Or one-off, per command:
|
|
178
|
-
photon projects ls --api-host https://your.backend.tld
|
|
179
|
-
|
|
180
|
-
# Or inline:
|
|
181
|
-
PHOTON_API_HOST=https://your.backend.tld photon projects ls
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Resolution order: `--api-host <url>` flag → `PHOTON_API_HOST` env var → built-in production.
|
|
185
|
-
|
|
186
|
-
`photon env current` prints the resolved host:
|
|
187
|
-
|
|
188
|
-
```sh
|
|
189
|
-
$ photon env current
|
|
190
|
-
production (https://app.photon.codes)
|
|
191
|
-
$ PHOTON_API_HOST=http://localhost:3000 photon env current
|
|
192
|
-
localhost_3000 (http://localhost:3000)
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Credentials are stored **per host** (`$PHOTON_CONFIG_DIR/credentials/<key>.json` by default — see [config dir](#config-dir) below — mode 600), so you can be logged into multiple backends simultaneously. The `<key>` is derived from the URL — production keeps the literal name `production` for back-compat; other hosts get a sanitized hostname where `.`, `:`, and `%` are replaced with `_` (e.g. `staging-app_photon_codes`, `localhost_3000`). The `_` substitution avoids collisions between distinct hosts like `a-b.com` and `a.b-com`.
|
|
196
|
-
|
|
197
|
-
### Setting an active project
|
|
198
|
-
|
|
199
|
-
Most commands operate on a single project. Two ways to specify it:
|
|
200
|
-
|
|
201
|
-
```sh
|
|
202
|
-
# Per command — explicit, scoped to one invocation
|
|
203
|
-
photon spectrum users ls --project abc123
|
|
204
|
-
|
|
205
|
-
# Per shell — set once, applies to every photon invocation in this shell
|
|
206
|
-
export PHOTON_PROJECT_ID='abc123'
|
|
207
|
-
photon spectrum users ls
|
|
208
|
-
photon projects show
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Resolution order: `--project <id>` flag → `$PHOTON_PROJECT_ID` → friendly error.
|
|
212
|
-
|
|
213
|
-
Put `export PHOTON_PROJECT_ID='…'` in your shell rc, or use [`direnv`](https://direnv.net/) to scope it to a directory. Agents and scripts should pass `--project <id>` explicitly per call (or set the env var on the spawn).
|
|
214
|
-
|
|
215
|
-
**Multi-backend note.** `$PHOTON_PROJECT_ID` is shell-global and single-valued. If you switch `PHOTON_API_HOST` between backends in the same shell, prefer `--project <id>` for the off-default calls, or use a separate shell per backend.
|
|
216
|
-
|
|
217
|
-
### CI / scripting
|
|
218
|
-
|
|
219
|
-
Authenticate once locally, copy the token from your credentials file (under `$PHOTON_CONFIG_DIR/credentials/<key>.json`), and use it in CI:
|
|
220
|
-
|
|
221
|
-
```sh
|
|
222
|
-
photon projects ls --token "$PHOTON_TOKEN"
|
|
223
|
-
# or
|
|
224
|
-
PHOTON_TOKEN=… photon projects ls
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Pair with `--json` for machine-readable output:
|
|
228
|
-
|
|
229
|
-
```sh
|
|
230
|
-
photon projects ls --json | jq '.[] | .id'
|
|
231
|
-
photon billing show --json
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
`PHOTON_TOKEN` reuses the same access token issued by the device flow (default 7d expiry — re-run `photon login` when it expires). A long-lived API-key path is on the roadmap.
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## Command reference
|
|
239
|
-
|
|
240
|
-
```text
|
|
241
|
-
photon
|
|
242
|
-
├── ping hit /api/health
|
|
243
|
-
├── env current print resolved API host
|
|
244
|
-
├── login [--api-host] [--no-browser] device-auth login
|
|
245
|
-
├── logout [--api-host] clear creds
|
|
246
|
-
├── whoami [--api-host] who am I on this backend
|
|
247
|
-
├── auth status login state across backends
|
|
248
|
-
├── config show dump active config
|
|
249
|
-
├── projects
|
|
250
|
-
│ ├── ls list projects
|
|
251
|
-
│ ├── show [id] project detail
|
|
252
|
-
│ ├── create [--name <n> --location <loc> --spectrum] new project
|
|
253
|
-
│ ├── update [id] [...] rename / toggle flags
|
|
254
|
-
│ ├── delete [id] [-y] permanent delete
|
|
255
|
-
│ ├── regenerate-secret [id] [-y] rotate Spectrum secret
|
|
256
|
-
│ ├── open [id] open dashboard in browser
|
|
257
|
-
│ ├── upgrade [id] [tier] subscribe / open Stripe portal
|
|
258
|
-
│ └── check-phone <number> availability check
|
|
259
|
-
├── profile show / init / update developer / org profile
|
|
260
|
-
├── spectrum
|
|
261
|
-
│ ├── users ls / add / remove
|
|
262
|
-
│ ├── lines ls / add / remove
|
|
263
|
-
│ ├── platforms ls / enable / disable
|
|
264
|
-
│ ├── profile show / update
|
|
265
|
-
│ └── avatar upload <file>
|
|
266
|
-
└── billing
|
|
267
|
-
├── plans available plans
|
|
268
|
-
├── show current subscription
|
|
269
|
-
├── checkout [tier] [--plan <price-id>] Stripe Checkout (browser)
|
|
270
|
-
└── manage Stripe Customer Portal
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
Run `photon <cmd> --help` for the full flag list of any command.
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Flags
|
|
278
|
-
|
|
279
|
-
Only `--debug` is truly **program-level** (works in any position). Every other flag is **per-command** and must come after the subcommand:
|
|
280
|
-
|
|
281
|
-
```sh
|
|
282
|
-
photon --debug projects ls --api-host https://x.tld --json # ✓ --debug global, others per-cmd
|
|
283
|
-
photon --api-host https://x.tld projects ls # ✗ won't work (--api-host is per-cmd)
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
| Flag | Env var | Scope | Effect |
|
|
287
|
-
|---|---|---|---|
|
|
288
|
-
| `--debug` | `PHOTON_DEBUG=1` | program | verbose HTTP logs to stderr |
|
|
289
|
-
| `--api-host <url>` | `PHOTON_API_HOST` | per-cmd | override the backend URL |
|
|
290
|
-
| `-p, --project <id>` | `PHOTON_PROJECT_ID` | per-cmd | project id for this command; defaults to `$PHOTON_PROJECT_ID` |
|
|
291
|
-
| `-t, --token <token>` | `PHOTON_TOKEN` | per-cmd | bypass stored creds (CI) |
|
|
292
|
-
| `--json` | — | per-cmd | structured output (opt-in) |
|
|
293
|
-
| `--yes`, `-y` | — | per-cmd | skip destructive-action confirmation |
|
|
294
|
-
| `--no-browser` | — | per-cmd | don't auto-open browser (login, billing, projects open) |
|
|
295
|
-
| `--no-color` | `NO_COLOR=1`, `PHOTON_NO_COLOR=1` | program (env-driven) | disable colors (NO_COLOR standard) |
|
|
296
|
-
|
|
297
|
-
### config dir
|
|
298
|
-
|
|
299
|
-
The CLI's config root is resolved in this order:
|
|
300
|
-
|
|
301
|
-
1. `$PHOTON_CONFIG_DIR` (explicit override)
|
|
302
|
-
2. `$XDG_CONFIG_HOME/photon` (XDG standard)
|
|
303
|
-
3. `~/.config/photon/` (default)
|
|
304
|
-
|
|
305
|
-
If a legacy `~/.config/photon-dashboard/` directory exists from a prior pre-rename install, it migrates automatically to the new path on first run.
|
|
306
|
-
|
|
307
|
-
Other env vars: `PHOTON_NO_UPDATE_NOTIFIER=1` (mute update prompt).
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Development
|
|
312
|
-
|
|
313
|
-
```sh
|
|
314
|
-
git clone https://github.com/photon-hq/cli
|
|
315
|
-
cd cli
|
|
316
|
-
bun install
|
|
317
|
-
|
|
318
|
-
# Run from source
|
|
319
|
-
bun run src/index.ts --help
|
|
320
|
-
|
|
321
|
-
# Watch
|
|
322
|
-
bun run dev
|
|
323
|
-
|
|
324
|
-
# Typecheck
|
|
325
|
-
bun run typecheck
|
|
326
|
-
|
|
327
|
-
# Build (produces dist/photon.js)
|
|
328
|
-
bun run build
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
The CLI's API contract comes from the [`@photon-ai/dashboard-api`](https://www.npmjs.com/package/@photon-ai/dashboard-api) package, a types-only bundle of the dashboard's public API (the `PublicApp` Elysia type, used with `@elysiajs/eden` treaty). To pick up dashboard API changes, bump that dependency — its version tracks the dashboard release tag.
|
|
332
|
-
|
|
333
|
-
See [`docs/cli-design.md`](docs/cli-design.md) and [`docs/cli-build-plan.md`](docs/cli-build-plan.md) for the full architecture notes.
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## Releases
|
|
338
|
-
|
|
339
|
-
Every push to `main` runs the [Release workflow](.github/workflows/release.yaml) to verify and publish a staging candidate through the pinned [Buildspace package workflows](https://github.com/photon-hq/buildspace/tree/c1fb06e4ae457a8e053642a914bd37b8f5ce9e1b/.github/workflows). Manual dispatch defaults to `dry-run`, which verifies and packs without publishing or creating tags or Releases. To release, dispatch `promote` from `main` with the staging version and obtain approval in the `production` environment; promotion publishes the stored candidate under npm's stable `latest` tag without rebuilding or committing a source version bump. A successful new promotion calls [`release-binaries.yaml`](.github/workflows/release-binaries.yaml) and [`docs-reference.yml`](.github/workflows/docs-reference.yml) with that exact stable version, and its `legacy-tag` job, after a second `production` approval, adds npm's `legacy` tag to the same version, which `photon update` and the update notification follow. It only moves `legacy` forward: if `legacy` already points at the same or a newer version, the job leaves it there. These jobs wait in a queue and run one at a time. If `legacy-tag` fails or its approval is rejected, use **Re-run failed jobs** on that run: a new `promote` dispatch finds the version already released and skips the job.
|
|
25
|
+
## Issues and security
|
|
340
26
|
|
|
341
|
-
|
|
27
|
+
Report bugs and request features in
|
|
28
|
+
[issues](https://github.com/photon-hq/cli/issues). Report security problems
|
|
29
|
+
privately, as [SECURITY.md](SECURITY.md) describes.
|
|
342
30
|
|
|
343
|
-
|
|
31
|
+
## License
|
|
344
32
|
|
|
345
|
-
|
|
33
|
+
[Apache-2.0](LICENSE). The npm package and the binaries ship the licenses of the
|
|
34
|
+
packages they bundle in `THIRD_PARTY_NOTICES.txt`.
|