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
docs(version): spec --version flag and version subcommand
Doc-driven prep for PRO-174.
- command-spec.md: add `prisma-cli version` subcommand section and
`prisma-cli --version` flag section; document `--help` and `--version`
as universal utility flags distinct from per-command shared global flags;
add `version` to the scope listing as the one top-level utility command.
- output-conventions.md: map `version` to the `show` pattern.
- error-conventions.md: register `VERSION_UNAVAILABLE` as a defensive code
used only when the bundled CLI metadata cannot be read.
No code change in this commit. The implementation follows.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
@@ -14,6 +14,12 @@ The preview package includes these command groups:
14
14
-`branch`
15
15
-`app`
16
16
17
+
The preview package also includes one top-level utility command:
18
+
19
+
-`version`
20
+
21
+
`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?"
22
+
17
23
Out of scope for the current preview:
18
24
19
25
-`init`
@@ -25,6 +31,7 @@ Out of scope for the current preview:
25
31
## Global Rules
26
32
27
33
- Canonical shape is `prisma <group> <action>`.
34
+
-`version` is the one top-level command outside that shape (see Scope above).
28
35
- Every command supports `--json`.
29
36
- Shared global flags are:
30
37
-`--json`
@@ -36,6 +43,9 @@ Out of scope for the current preview:
36
43
-`-y`, `--yes`
37
44
-`--color`
38
45
-`--no-color`
46
+
- Universal utility flags also work at the program level:
47
+
-`--help` — prints help for the root program or the named command and exits 0.
48
+
-`--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).
39
49
- Long flags use kebab-case.
40
50
- Boolean negation uses `--no-<flag>`.
41
51
-`--json` and non-interactive mode must not block on prompts.
@@ -124,6 +134,78 @@ Rules:
124
134
-`workspace` is the active workspace or `null`
125
135
- signed-out state is an empty auth state, not an error
126
136
137
+
## `prisma-cli version`
138
+
139
+
Purpose:
140
+
141
+
- report the installed CLI build and a small block of host environment metadata
142
+
143
+
Behavior:
144
+
145
+
- requires no auth, no project context, and no network
146
+
- reads the package's own version from its bundled metadata
147
+
- reports CLI name, CLI version, Node.js version, OS platform, OS architecture, and a best-effort `invocation` label (`bunx`, `npx`, `global`, `dev`, or `unknown`)
148
+
- uses the `show` output pattern (see `output-conventions.md`)
149
+
- fails only when the bundled CLI metadata cannot be read; this is treated as `VERSION_UNAVAILABLE` and is not expected in practice
150
+
151
+
In `--json`, `result` uses this shape:
152
+
153
+
```json
154
+
{
155
+
"cli": {
156
+
"name": "prisma-cli",
157
+
"version": "3.0.0-alpha.3"
158
+
},
159
+
"node": {
160
+
"version": "v24.14.1"
161
+
},
162
+
"os": {
163
+
"platform": "darwin",
164
+
"arch": "arm64"
165
+
},
166
+
"invocation": "bunx"
167
+
}
168
+
```
169
+
170
+
Rules:
171
+
172
+
-`cli.name` is the published package's `bin` name (`prisma-cli` in the current preview).
173
+
-`cli.version` is the published package version.
174
+
-`node.version` mirrors `process.version` exactly, including the leading `v`.
175
+
-`os.platform` and `os.arch` mirror `process.platform` and `process.arch`.
176
+
-`invocation` is best-effort and may be `null` when no signal is conclusive.
177
+
178
+
Examples:
179
+
180
+
```bash
181
+
prisma-cli version
182
+
prisma-cli version --json
183
+
```
184
+
185
+
## `prisma-cli --version`
186
+
187
+
Purpose:
188
+
189
+
- universal smoke-test flag at the root of the program
190
+
191
+
Behavior:
192
+
193
+
- prints the CLI version and exits 0
194
+
- requires no auth, no project context, and no network
195
+
- works before any subcommand parsing — bare `prisma-cli --version` is sufficient
196
+
- in human mode, prints a single line to stdout: `prisma-cli <version>`
197
+
- in `--json` mode, emits the standard success envelope (see Command Result Envelopes) with `command: "version"` and `result.version: "<version>"`
198
+
-`--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)
199
+
200
+
Examples:
201
+
202
+
```bash
203
+
prisma-cli --version
204
+
prisma-cli --version --json
205
+
```
206
+
207
+
`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