You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/product/command-spec.md
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,12 @@ The preview package includes these command groups:
15
15
-`branch`
16
16
-`app`
17
17
18
+
The preview package also includes one top-level utility command:
19
+
20
+
-`version`
21
+
22
+
`version` is intentionally outside the workflow groups: it reports CLI build and environment state, requires no auth, no project context, and no network, and is the canonical answer to "is this CLI installed and on the build I expect?"
23
+
18
24
The Git repository connection slice uses the `git` group. It does not add a
19
25
provider-specific `GitHub` group.
20
26
@@ -29,6 +35,7 @@ Out of scope for the current preview:
29
35
## Global Rules
30
36
31
37
- Canonical shape is `prisma <group> <action>`.
38
+
-`version` is the one top-level command outside that shape (see Scope above).
32
39
- Every command supports `--json`.
33
40
- Shared global flags are:
34
41
-`--json`
@@ -40,6 +47,9 @@ Out of scope for the current preview:
40
47
-`-y`, `--yes`
41
48
-`--color`
42
49
-`--no-color`
50
+
- Universal utility flags also work at the program level:
51
+
-`--help` — prints help for the root program or the named command and exits 0.
52
+
-`--version` — prints the CLI version and exits 0. Honors `--json` for the structured envelope. No short alias (`-v` is reserved for `--verbose`; `-V` is avoided as a near-collision).
43
53
- Long flags use kebab-case.
44
54
- Boolean negation uses `--no-<flag>`.
45
55
-`--json` and non-interactive mode must not block on prompts.
@@ -139,6 +149,78 @@ Rules:
139
149
-`workspace` is the active workspace or `null`
140
150
- signed-out state is an empty auth state, not an error
141
151
152
+
## `prisma-cli version`
153
+
154
+
Purpose:
155
+
156
+
- report the installed CLI build and a small block of host environment metadata
157
+
158
+
Behavior:
159
+
160
+
- requires no auth, no project context, and no network
161
+
- reads the package's own version from its bundled metadata
162
+
- reports CLI name, CLI version, Node.js version, OS platform, OS architecture, and a best-effort `invocation` label (`bunx`, `npx`, `global`, `dev`, or `unknown`)
163
+
- uses the `show` output pattern (see `output-conventions.md`)
164
+
- fails only when the bundled CLI metadata cannot be read; this is treated as `VERSION_UNAVAILABLE` and is not expected in practice
165
+
166
+
In `--json`, `result` uses this shape:
167
+
168
+
```json
169
+
{
170
+
"cli": {
171
+
"name": "prisma-cli",
172
+
"version": "3.0.0-alpha.3"
173
+
},
174
+
"node": {
175
+
"version": "v24.14.1"
176
+
},
177
+
"os": {
178
+
"platform": "darwin",
179
+
"arch": "arm64"
180
+
},
181
+
"invocation": "bunx"
182
+
}
183
+
```
184
+
185
+
Rules:
186
+
187
+
-`cli.name` is the published package's `bin` name (`prisma-cli` in the current preview).
188
+
-`cli.version` is the published package version.
189
+
-`node.version` mirrors `process.version` exactly, including the leading `v`.
190
+
-`os.platform` and `os.arch` mirror `process.platform` and `process.arch`.
191
+
-`invocation` is best-effort and falls back to `"unknown"` when no signal is conclusive.
192
+
193
+
Examples:
194
+
195
+
```bash
196
+
prisma-cli version
197
+
prisma-cli version --json
198
+
```
199
+
200
+
## `prisma-cli --version`
201
+
202
+
Purpose:
203
+
204
+
- universal smoke-test flag at the root of the program
205
+
206
+
Behavior:
207
+
208
+
- prints the CLI version and exits 0
209
+
- requires no auth, no project context, and no network
210
+
- works before any subcommand parsing — bare `prisma-cli --version` is sufficient
211
+
- in human mode, prints a single line to stdout: `prisma-cli <version>`
212
+
- in `--json` mode, emits the standard success envelope (see Command Result Envelopes) with `command: "version"` and `result.version: "<version>"`
213
+
-`--version` is documented as a universal utility flag in Global Rules, not as a shared global flag (it is an early-exit utility, not a per-command modifier)
214
+
215
+
Examples:
216
+
217
+
```bash
218
+
prisma-cli --version
219
+
prisma-cli --version --json
220
+
```
221
+
222
+
`prisma-cli version` is the richer environment report; `prisma-cli --version` is the terse one-liner. Both report the same `cli.version`. Use the flag for quick checks, the subcommand for support tickets and bug reports.
0 commit comments