@scalar/cli 2.12.2 → 2.13.0

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 (94) hide show
  1. package/README.md +221 -2
  2. package/chunks/{action-JXCU2JKC.js → action-27BJMHFD.js} +38 -6
  3. package/chunks/{action-WLPCBFRE.js → action-4EJA6UEB.js} +16 -16
  4. package/chunks/{action-JDXGQSQN.js → action-5MJTAO5X.js} +36 -23
  5. package/chunks/{action-H5XQIZKX.js → action-6FPGU5SY.js} +51 -24
  6. package/chunks/{action-HMPATNVE.js → action-6RQDLMOM.js} +53 -30
  7. package/chunks/{action-Y7EBKCUU.js → action-ASBFLTOA.js} +1 -1
  8. package/chunks/{action-HRRNN33O.js → action-AWHBOHGW.js} +68 -89
  9. package/chunks/{action-UOH5L2JF.js → action-ENN7KFBZ.js} +93 -54
  10. package/chunks/{action-ZNBXKA7T.js → action-ESVI46KE.js} +4 -4
  11. package/chunks/{action-LCTTNNFD.js → action-EVNUUWR5.js} +33 -17
  12. package/chunks/{action-OWWGJ34K.js → action-F6JSCBEU.js} +34 -16
  13. package/chunks/{action-2RIPHL6V.js → action-FZNFBX6U.js} +23 -6
  14. package/chunks/{action-DJ6FLPXH.js → action-GNYNOFDK.js} +15 -5
  15. package/chunks/{action-HOLFCPUY.js → action-JSYHIEYP.js} +12 -12
  16. package/chunks/action-KTY5ICV5.js +55 -0
  17. package/chunks/{action-IIQMZVRJ.js → action-LRR52RXL.js} +10 -8
  18. package/chunks/{action-Z3UXS5KI.js → action-LVYFHK4D.js} +6 -4
  19. package/chunks/{action-XBTIONQD.js → action-NN7QF6MI.js} +9 -6
  20. package/chunks/{action-2GIOY3HU.js → action-OD4GNHM3.js} +48 -28
  21. package/chunks/{action-OY5LI7TW.js → action-OZWRV54F.js} +9 -8
  22. package/chunks/{action-AZNY2B7G.js → action-QZV6IPK4.js} +26 -11
  23. package/chunks/action-S7PMEFCE.js +423 -0
  24. package/chunks/{action-6IL6KE3L.js → action-SZ6SG3RB.js} +16 -16
  25. package/chunks/{action-PRLW546C.js → action-U3MQZ5ZQ.js} +12 -12
  26. package/chunks/action-UAGYB4ZS.js +48 -0
  27. package/chunks/{action-U3R6AXJY.js → action-UVAYACFA.js} +6 -6
  28. package/chunks/{action-7OJTNQRM.js → action-VXEJNBNR.js} +9 -8
  29. package/chunks/{action-KE53K5EJ.js → action-W24B4YT5.js} +14 -14
  30. package/chunks/{action-QA5ATGWB.js → action-WQICTF7K.js} +67 -45
  31. package/chunks/{action-SFRYHYTZ.js → action-WUWWJGRJ.js} +6 -4
  32. package/chunks/{action-II3OJSGP.js → action-Y4YLWZHL.js} +12 -12
  33. package/chunks/{action-2NJJO35T.js → action-YEAOKB6V.js} +13 -11
  34. package/chunks/{action-LGNWFVEG.js → action-YFTRHKOK.js} +63 -48
  35. package/chunks/{action-QEYNGQXG.js → action-YQSSXJAX.js} +10 -7
  36. package/chunks/{action-IYUOT7XX.js → action-ZL2CXRJR.js} +8 -6
  37. package/chunks/{actions-DKQERAKZ.js → actions-GHHWF4Q2.js} +20 -18
  38. package/chunks/{agent-KQKNJZKK.js → agent-XAHNA4MB.js} +3 -3
  39. package/chunks/{asyncapi-MKBEQYBV.js → asyncapi-TICSLZRM.js} +52 -42
  40. package/chunks/{build.action-EGAOPKSX.js → build.action-AURC6QZ6.js} +37 -20
  41. package/chunks/{chunk-ZZTCEMCG.js → chunk-2AK5O3NQ.js} +2 -2
  42. package/chunks/chunk-2I6V7AI3.js +68 -0
  43. package/chunks/chunk-2XWUFFEZ.js +133 -0
  44. package/chunks/{chunk-7GOHWSPA.js → chunk-62OOT7FY.js} +5 -2
  45. package/chunks/{chunk-W2JGSGIQ.js → chunk-7K6I2GUG.js} +15 -9
  46. package/chunks/{chunk-5VZSFLRO.js → chunk-7O5H2SQP.js} +2 -2
  47. package/chunks/{chunk-FJREFWEE.js → chunk-7S34K2P3.js} +1 -1
  48. package/chunks/{chunk-PIWBFJX3.js → chunk-AOZQPCWI.js} +2 -0
  49. package/chunks/{chunk-EBNFCIKS.js → chunk-APX65SRT.js} +2 -1
  50. package/chunks/{chunk-GZA7GEZW.js → chunk-B3XOSR6W.js} +2 -2
  51. package/chunks/{chunk-VJAVNG6U.js → chunk-CSJIKXUD.js} +1 -1
  52. package/chunks/{chunk-MLBEF6MB.js → chunk-DDDYR2HF.js} +1 -1
  53. package/chunks/{chunk-TQL55CUG.js → chunk-EXJUFF6G.js} +1 -1
  54. package/chunks/{chunk-W6FLDNRM.js → chunk-IRA5BW2J.js} +2 -2
  55. package/chunks/chunk-IRQJDPZE.js +34 -0
  56. package/chunks/{chunk-ZK76AK3B.js → chunk-KPLWZIOV.js} +22 -3
  57. package/chunks/chunk-LK2ZIDHH.js +32 -0
  58. package/chunks/{chunk-3DKOVKCV.js → chunk-M2MMGSLK.js} +5 -5
  59. package/chunks/{chunk-FD364GM7.js → chunk-NRHHB3YY.js} +1 -1
  60. package/chunks/{chunk-W3Y5X3X3.js → chunk-OVKTA5CX.js} +12 -5
  61. package/chunks/chunk-PVDORWEM.js +167 -0
  62. package/chunks/chunk-RAJM56L7.js +60 -0
  63. package/chunks/{chunk-UJU2ORWU.js → chunk-RAU5KE6F.js} +1 -1
  64. package/chunks/{chunk-V6LUKXBV.js → chunk-RE5Z56QD.js} +2 -2
  65. package/chunks/chunk-SNQFFEYH.js +11 -0
  66. package/chunks/{chunk-GUF4PKDL.js → chunk-TI4NDKQC.js} +6 -5
  67. package/chunks/{chunk-VRZRTOZF.js → chunk-TKT5UW3G.js} +2 -2
  68. package/chunks/{chunk-A27OERJM.js → chunk-TVPVXL73.js} +7 -7
  69. package/chunks/{chunk-4RF2NKQN.js → chunk-TYNF7ROW.js} +1 -1
  70. package/chunks/{chunk-HDNCXPCZ.js → chunk-VNF2GRZA.js} +2 -2
  71. package/chunks/chunk-WDFZ7WYJ.js +16 -0
  72. package/chunks/{chunk-672Y6REB.js → chunk-WKW5W2ZP.js} +1 -1
  73. package/chunks/chunk-XUX6JXU5.js +58 -0
  74. package/chunks/{chunk-6YOXEMMX.js → chunk-Y2OQOAY7.js} +1 -1
  75. package/chunks/{create.action-UUDVWZ3F.js → create.action-O3HN6GV2.js} +32 -23
  76. package/chunks/{delete.action-XRP3VU5C.js → delete.action-2L2RWLPI.js} +36 -22
  77. package/chunks/{delete.action-EUQ4ESLJ.js → delete.action-KEBI2QCS.js} +38 -22
  78. package/chunks/{get.action-IYA5Q3RI.js → get.action-BUNTDW54.js} +13 -11
  79. package/chunks/{get.action-UHCFOKUQ.js → get.action-WDMTCZZR.js} +14 -14
  80. package/chunks/{list.action-3CCWEEAM.js → list.action-JNSEJVHX.js} +14 -14
  81. package/chunks/{list.action-D3GHA6S5.js → list.action-NSK7OBRH.js} +16 -16
  82. package/chunks/{publish.action-HIVWJ7QE.js → publish.action-ZRZQUL7S.js} +49 -29
  83. package/chunks/{update.action-NSKVEZES.js → update.action-7TA46AE6.js} +36 -22
  84. package/chunks/{update.action-VOZNA7BV.js → update.action-O2R5ODGG.js} +47 -27
  85. package/index.js +226 -149
  86. package/package.json +1 -1
  87. package/skills/scalar-cli/SKILL.md +4 -2
  88. package/template.md +220 -1
  89. package/chunks/action-RNVV27ET.js +0 -165
  90. package/chunks/action-ZHDGAUGG.js +0 -38
  91. package/chunks/chunk-AC62V47N.js +0 -38
  92. package/chunks/chunk-EGOXR5FB.js +0 -15
  93. package/chunks/chunk-JFIXNSPP.js +0 -26
  94. package/chunks/{action-UHXBY3RD.js → action-3P66ZSL3.js} +1 -1
package/README.md CHANGED
@@ -38,7 +38,19 @@ scalar document bundle openapi.yaml --output - > openapi.bundled.yaml
38
38
 
39
39
  Pulls every external `$ref` into a single file. `--treeShake` drops components nothing uses. The input can be a URL.
40
40
 
41
- Use `--output -` (or `-o -`) to write YAML to stdout for piping. Timings, diagnostics, and upgrade notices go to stderr. Without `--output`, local input requires an interactive overwrite confirmation; URL and non-interactive input require an explicit output destination.
41
+ Use `--output -` (or `-o -`) to write to stdout for piping, preserving the root document’s JSON or YAML format. The format is detected from the document contents, including for URLs. Timings, diagnostics, and upgrade notices go to stderr. Without `--output`, local input requires an interactive overwrite confirmation; URL and non-interactive input require an explicit output destination.
42
+
43
+ ### Format files or piped input
44
+
45
+ ```bash
46
+ scalar document format openapi.yaml
47
+ scalar document format openapi.json --output -
48
+ cat openapi.yaml | scalar document format - --output openapi.json
49
+ cat openapi.json | scalar document format -
50
+ cat openapi.json | scalar document format - --output -
51
+ ```
52
+
53
+ Use `-` to read JSON or YAML from stdin and `--output -` to write only document content to stdout in the input’s JSON or YAML format, with diagnostics and timings on stderr. Without `--output`, stdin is formatted to stdout in its original JSON or YAML format. JSON input produces two-space JSON; YAML input produces YAML. URL inputs require an explicit output destination. Named output files use YAML for `.yaml` or `.yml` extensions (case-insensitive), and two-space JSON otherwise. Without `--output`, a local input file is overwritten in place. Use `./-` to refer to a file literally named `-`.
42
54
 
43
55
  ### Preview the API reference
44
56
 
@@ -115,6 +127,22 @@ mkdir -p .claude/skills
115
127
  cp -r "$(npm root -g)/@scalar/cli/skills/scalar-cli" .claude/skills/
116
128
  ```
117
129
 
130
+ ## Noninteractive execution
131
+
132
+ Pass `--no-input` in scripts and agent commands, including when a pseudo-terminal (PTY) is attached:
133
+
134
+ ```sh
135
+ scalar --no-input project create --name "My docs"
136
+ scalar project rollback --slug my-docs --yes --no-input
137
+ scalar document bundle openapi.yaml --output - --no-input
138
+ ```
139
+
140
+ The flag works before or after subcommands. It disables prompts and browser launches. Supply required arguments or options; missing input exits with code 1 and explains what to provide. Optional values retain their defaults, including the generated project slug. Piped data is never read as confirmation.
141
+
142
+ `--no-input` does not imply `--yes` (confirm an action) or `--force` (override a specific protection). Neither flag chooses an unspecified target. Prompt cancellation, Ctrl-C during a prompt, and EOF exit with code 1 and “Operation cancelled.”
143
+
144
+ For `auth login`, supply a personal token using the existing `SCALAR_API_KEY` source or `--token`; without one, noninteractive login fails before starting a browser or callback server. `project preview` still runs the requested preview server but never opens its browser under `--no-input`, even with an opening option. `readme` prints the documentation URL without launching a browser.
145
+
118
146
  ## Use in CI
119
147
 
120
148
  ```yml
@@ -142,7 +170,7 @@ jobs:
142
170
  | [`scalar auth`](https://scalar.com/tools/cli/commands/auth) | Log in to Scalar and manage your session | `login`, `whoami`, `logout` |
143
171
  | [`scalar access-group`](https://scalar.com/tools/cli/commands/access-group) | Manage access groups and allowed email domains for the current team | `list`, `create`, `get`, `update`, `delete`, `domain add`, `domain remove` |
144
172
  | [`scalar document`](https://scalar.com/tools/cli/commands/document) | Work with OpenAPI and AsyncAPI descriptions | `bundle`, `split`, `join`, `format`, `convert`, `markdown`, `mock`, `serve`, `share`, `validate`, `void`, `lint`, `upgrade` |
145
- | [`scalar project`](https://scalar.com/tools/cli/commands/project) | Manage Scalar Docs projects | `list`, `get`, `init`, `check-config`, `create`, `preview`, `publish`, `rollback`, `deployments list`, `upgrade` |
173
+ | [`scalar project`](https://scalar.com/tools/cli/commands/project) | Manage Scalar Docs projects | `list`, `get`, `init`, `check-config`, `create`, `preview`, `publish`, `rollback`, `deployments list`, `deployments get`, `upgrade` |
146
174
  | [`scalar registry`](https://scalar.com/tools/cli/commands/registry) | Manage API descriptions in the Scalar Registry | `publish`, `update`, `delete`, `list`, `get` |
147
175
  | [`scalar team`](https://scalar.com/tools/cli/commands/team) | List and switch between your Scalar teams | `list`, `get`, `set` |
148
176
  | [`scalar sdk`](https://scalar.com/tools/cli/commands/sdk) | Manage Scalar SDKs (Enterprise only) | `list`, `get`, `create`, `update`, `delete`, `build` |
@@ -163,3 +191,194 @@ authentication method (browser session or personal token). Use
163
191
  `personal_token`). If the team name cannot be loaded, the team ID remains
164
192
  available and JSON returns `null` for the name. Missing email or role values
165
193
  also return `null`. Credentials are never included.
194
+
195
+ ### Recover a project publish
196
+
197
+ `scalar project publish --slug my-docs` prints the accepted Build ID before waiting up to 600 seconds for deployment. Use `--timeout <seconds>` to change the wait (positive seconds, at most 2147483), or `--no-wait` to return immediately after acceptance. Do not combine `--no-wait` with `--timeout`.
198
+
199
+ Inspect the same production or preview build with the original team selected, without publishing again:
200
+
201
+ ```sh
202
+ scalar project deployments get BUILD_ID
203
+ scalar project deployments get BUILD_ID --wait --timeout 600
204
+ ```
205
+
206
+ A one-shot inspection waits at most 30 seconds for its request unless overridden. It exits zero when the record was read, even if that record reports a failed build. With `--wait`, zero means deployed; a failed build, unavailable status, or expired deadline exits nonzero. `publish --no-wait` exits zero for acceptance, not completed deployment.
207
+
208
+ A status-query error or timeout means the outcome is unknown. Stopping local waiting, including Ctrl-C, does not cancel the remote build. Use the printed Build ID to inspect it later instead of resubmitting.
209
+
210
+ With `publish --json`, successful waiting returns one deployment result. With `--json --no-wait`, acceptance returns `{uid: string, status: "accepted"}`. JSON mode writes no progress to stdout; failures and recovery instructions go to stderr.
211
+
212
+ ### Structured command results
213
+
214
+ Pass `--json` explicitly for machine output. Human output remains the default,
215
+ including when redirected. Success writes one newline-terminated JSON value to
216
+ stdout with exit code 0. Empty lists write `[]`. Failures write human-readable
217
+ diagnostics to stderr, exit nonzero, and do not write a success result to stdout.
218
+ JSON output contains no progress, colors, links, or upgrade notices. In JSON
219
+ mutation mode, missing inputs fail with the required flag instead of prompting,
220
+ even in a terminal.
221
+
222
+ #### List contracts
223
+
224
+ | Command | JSON value |
225
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------- |
226
+ | `team list --json` | Array of `{uid: string, name: string, current: boolean}` |
227
+ | `registry list --json` | Array of `{namespace: string, slug: string, title: string, version: string, isPrivate: boolean}` |
228
+ | `schema list --json` | Array of `{namespace: string, slug: string, title: string, version: string \| null, isPrivate: boolean}` |
229
+ | `sdk list --json` | Array of SDK metadata objects described below |
230
+ | `sdk get --slug <slug> --json` | One SDK metadata object |
231
+
232
+ Schema `version` is the greatest version by semantic-version comparison, or
233
+ `null` when no version exists. Registry `version` is the current version.
234
+ List order is unspecified. These list commands have no pagination flags,
235
+ continuation tokens, or incremental output: each invocation returns a single
236
+ array from the selected team or namespace. Do not interpret an empty array as
237
+ an authentication failure; authentication failures exit nonzero.
238
+
239
+ SDK metadata fields:
240
+
241
+ | Field | Type |
242
+ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
243
+ | `uid`, `namespace`, `slug`, `title`, `description`, `currentVersion` | string |
244
+ | `isPrivate` | boolean |
245
+ | `createdAt`, `updatedAt` | number, Unix seconds |
246
+ | `api` | `null` or `{uid: string, trackedVersion: string \| null, namespace: string \| null, slug: string \| null}` |
247
+ | `targets` | Array of `{language: string, slug?: string}` |
248
+ | `versions` | Array of version objects below |
249
+ | `latestBuild` | Latest build by creation time, or `null` when no build exists |
250
+
251
+ Each version has `version: string`, `apiVersion: string`, `status: string`,
252
+ `languages: string[]`, `createdAt: number | null`,
253
+ `publishedAt: number | null`, and `targets`, an array of
254
+ `{language: string, activeBuild: string | null, builtAt: number | null}`.
255
+ Each latest build has `uid: string`, `version: string`, `createdAt: number`,
256
+ `api: {uid: string, namespace: string, slug: string, version: string}`, and
257
+ `targets`, an array of
258
+ `{language: string, slug?: string, buildStatus: string, gitStatus: string | null}`.
259
+ All timestamps are Unix seconds. Optional target slugs are omitted when absent;
260
+ nullable fields are emitted as `null`. Source API coordinates are `null` when
261
+ the linked API no longer exists. SDK JSON fails if required build or source
262
+ metadata cannot be loaded. It excludes configuration, credentials, repository
263
+ authentication bindings, and build log messages.
264
+
265
+ #### Mutation contracts
266
+
267
+ | Command with `--json` | Success object |
268
+ | ------------------------------------ | ---------------------------------------------------- |
269
+ | `registry publish`, `schema publish` | `{uid, namespace, slug, version}` |
270
+ | `registry update` | `{namespace, slug, status: "updated"}` |
271
+ | `registry delete` | `{namespace, slug, deleted: true}` |
272
+ | `schema update`, `sdk update` | `{uid, namespace, slug, status: "updated"}` |
273
+ | `schema delete`, `sdk delete` | `{uid, namespace, slug, deleted: true}` |
274
+ | `sdk create` | `{uid}` |
275
+ | `sdk build` | `{uid, namespace, slug, version, status: "started"}` |
276
+
277
+ All identifiers, coordinates, versions and status values are strings, except
278
+ SDK build `version`, which can be `null` if the server does not return its
279
+ resolved version. `deleted` is a boolean. Fields shown in each success object
280
+ are always present. A build receipt means the server accepted the build request,
281
+ not that generation finished; no build ID is returned by that endpoint.
282
+ SDK create returns the new SDK UID without an additional metadata request.
283
+ Updates and deletes acknowledge the resolved target; they are not resource
284
+ snapshots. A transport failure can leave a mutation's outcome unknown, so inspect
285
+ the resource before retrying a write.
286
+
287
+ Supply the existing targeting flags and arguments, for example:
288
+
289
+ ```sh
290
+ scalar registry list --namespace acme --json
291
+ scalar registry update acme widgets --title "Widgets API" --json
292
+ scalar schema publish schema.json --namespace acme --slug widget --title Widget --version 1.0.0 --json
293
+ scalar sdk create --namespace acme --api widgets --language typescript --json
294
+ scalar sdk build --namespace acme --slug widgets --json
295
+ ```
296
+
297
+ Team list UIDs can be passed directly to `scalar team set --team <uid>` when
298
+ using browser-session authentication. Personal tokens belong to one team and
299
+ cannot switch teams. Registry/schema list coordinates and SDK list slugs can
300
+ likewise be passed to their mutation commands.
301
+
302
+ #### Team and project results
303
+
304
+ The same explicit JSON mode, stdout/stderr separation, and noninteractive input
305
+ rules apply to the following commands. Existing team and project list/get output
306
+ is preserved.
307
+
308
+ | Command with `--json` | Result |
309
+ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
310
+ | `team set --team <uid>` | `{uid: string, name: string, current: true}` after switching the session |
311
+ | `project create --name <name>` | `{uid: string, slug: string, name: string}`; an omitted slug is generated by the server |
312
+ | `project init --subdomain <name>` | `{configPath: string, subdomain: string, files: string[], availabilityChecked: boolean}` |
313
+ | `project upgrade [config]` | `{configPath: string, changed: boolean, files: string[], dropped: string[]}` |
314
+ | `project publish --slug <slug>` | `{uid: string, status: "deployed", url: string \| null, preview: boolean, hasWarnings: boolean}` |
315
+ | `project rollback --slug <slug> --yes` | `{uid: string, projectUid: string, slug: string, status: "redeployed" \| "already-live"}` |
316
+ | `project deployments list --slug <slug>` | Array of `{uid: string, status: string, current: boolean, createdAt: number, deployedAt: number \| null, commitSha: string \| null}` |
317
+
318
+ Project init and upgrade return absolute paths. `files` lists the files written.
319
+ Initialization's `availabilityChecked: false` means no authenticated subdomain
320
+ availability check was performed, not that the subdomain was reserved.
321
+ Initialization still requires `--force` to overwrite an existing configuration.
322
+ An already-current config upgrade returns `changed: false`, `files: []`, and
323
+ `dropped: []`. A completed upgrade reports settings without a v2 equivalent in
324
+ `dropped`.
325
+
326
+ By default, project publish waits for the deployment to finish in both output modes.
327
+ With `--no-wait`, it returns after acceptance; JSON output is `{uid: string, status: "accepted"}`.
328
+ Its `uid` is the build ID. `url` is null when no public URL can be resolved.
329
+ Warnings about local configuration are sent to stderr; build warnings are
330
+ reported by `hasWarnings`. Failed or cancelled builds exit nonzero without a
331
+ success object. The behavior also applies to `--github` and `--preview`.
332
+
333
+ Rollback requires `--yes` before changing the live deployment. JSON does not
334
+ supply confirmation. `already-live` is a successful no-op and performs no
335
+ redeploy request; `redeployed` acknowledges a successful redeploy request.
336
+ Deployment history includes production builds only, newest creation time first,
337
+ with no pagination flags or continuation tokens. Empty history is `[]`.
338
+ Timestamps are Unix seconds; older records without a deployment timestamp use
339
+ `deployedAt: null`. The full `uid` can be passed to rollback's `--to`:
340
+
341
+ ```sh
342
+ scalar project deployments list --slug docs --json
343
+ scalar project rollback --slug docs --to <build-id> --yes --json
344
+ ```
345
+
346
+ Existing `project list --json` returns an array sorted by slug, while
347
+ `project get <slug> --json` returns one object. Each object contains
348
+ `uid`, `name`, and `slug` (strings), `isPrivate` (boolean), `provider`
349
+ (`github`, `forgejo`, `bitbucket`, or `unlinked`), `repository` (null or
350
+ `{name: string, branch: string, configPath: string}`), and `activeDeployment`
351
+ (null or `{uid: string, domain: string, publishedAt: number}`, with Unix seconds).
352
+ Project listing follows service continuation cursors internally and prints no
353
+ partial list if a cursor or fetch fails. It merges legacy projects, preferring
354
+ unified projects with the same UID or slug.
355
+
356
+ #### Existing access-group contracts
357
+
358
+ Access-group JSON formats remain unchanged:
359
+
360
+ | Command with `--json` | Result |
361
+ | -------------------------------------------- | ----------------------------------------------------------------------- |
362
+ | `access-group list` | Array of group metadata objects; empty `[]` |
363
+ | `access-group get <slug>` | One group metadata object |
364
+ | `access-group create <slug>` | Group metadata plus `createdAt` and `updatedAt` (numbers, Unix seconds) |
365
+ | `access-group update <slug>` | `null` after success |
366
+ | `access-group delete <slug> --yes` | `null` after success |
367
+ | `access-group domain add <slug> <domain>` | `null` after success |
368
+ | `access-group domain remove <slug> <domain>` | `null` after success |
369
+
370
+ Group metadata is `{uid: string, name: string, slug: string,
371
+ allowedDomains: string[], allowedEmails: string[]}`. Ordering is unspecified;
372
+ no pagination flags or continuation tokens are exposed. Deletion requires
373
+ `--yes` in JSON mode even in a terminal. A successful `null` response is an
374
+ acknowledgement, not an empty list or a failed lookup; failures use stderr and a
375
+ nonzero exit status.
376
+
377
+ Long-running project preview, configuration validation, and raw file downloads
378
+ are not mutation-result streams and do not gain `--json` from this feature.
379
+
380
+ ## File and download failures
381
+
382
+ URL input for `document format`, `upgrade`, `markdown`, `mock`, `serve`, `postman`, and `share`, plus Registry and schema publish input, has a 10-second download deadline. `registry get` and `schema get` use the same deadline. It includes reading the response body, but is not a total command runtime limit. Downloads are not automatically retried.
383
+
384
+ File and download failures report the input, a known cause when available, and a recovery step on stderr, with exit code 1. Diagnostic URLs omit credentials, query strings, and fragments. Remote error bodies are not echoed because they may contain credentials; HTTP status remains available. Successful document output is unchanged.
@@ -13,13 +13,21 @@ import {
13
13
  findConfig,
14
14
  legacyTo2_0_0
15
15
  } from "./chunk-MQ65WBVF.js";
16
- import "./chunk-5ENKYZA4.js";
16
+ import {
17
+ writeJson
18
+ } from "./chunk-SNQFFEYH.js";
17
19
  import {
18
20
  ConfigVersion
19
21
  } from "./chunk-VRZSDUZK.js";
22
+ import {
23
+ requireInteractive,
24
+ text
25
+ } from "./chunk-XUX6JXU5.js";
26
+ import "./chunk-IRQJDPZE.js";
20
27
  import {
21
28
  output
22
29
  } from "./chunk-T5HJUAWB.js";
30
+ import "./chunk-5ENKYZA4.js";
23
31
  import "./chunk-I57ID5K7.js";
24
32
  import "./chunk-3MZYUBJ6.js";
25
33
 
@@ -28,11 +36,14 @@ import { spawnSync } from "node:child_process";
28
36
  import { existsSync } from "node:fs";
29
37
  import fs from "node:fs/promises";
30
38
  import path from "node:path";
31
- import { text } from "@clack/prompts";
32
39
  import as from "ansis";
33
40
  import { n } from "neverpanic";
34
- async function upgradeAction(__configPath) {
35
- const configPath = __configPath || findConfig() || await text({
41
+ async function upgradeAction(providedConfigPath, args = {}) {
42
+ const foundConfigPath = providedConfigPath || findConfig();
43
+ if (!foundConfigPath) {
44
+ requireInteractive("Provide the configuration file path.", args.json);
45
+ }
46
+ const configPath = foundConfigPath || await text({
36
47
  message: "Where is your configuration file located?",
37
48
  defaultValue: CONFIG_FILE_DEFAULT,
38
49
  placeholder: CONFIG_FILE_DEFAULT
@@ -41,13 +52,22 @@ async function upgradeAction(__configPath) {
41
52
  if (!parseConfigResult.success) {
42
53
  renderConfigError(parseConfigResult.error);
43
54
  }
44
- if (parseConfigResult.success) {
55
+ if (parseConfigResult.success && !args.json) {
45
56
  output.info().line(
46
57
  `${as.green("[SUCCESS]")} ${as.green("Configuration is valid:")} ${as.green(parseConfigResult.filePath)}`
47
58
  ).print();
48
59
  }
49
60
  const { config } = parseConfigResult;
50
61
  if (config.version === ConfigVersion.V2) {
62
+ if (args.json) {
63
+ writeJson({
64
+ configPath: path.resolve(parseConfigResult.filePath),
65
+ changed: false,
66
+ files: [],
67
+ dropped: []
68
+ });
69
+ return;
70
+ }
51
71
  return output.info().title("Your Scalar configuration is already upgraded").message(
52
72
  "You are already on the latest Scalar docs version. No further action required."
53
73
  ).exit("success");
@@ -101,7 +121,7 @@ async function upgradeAction(__configPath) {
101
121
  return output.error().title(`Could not save ${sideFile.path}`).message(writeSideFileResult.error.code).message(displayError(writeSideFileResult.error.detail)).exit("error");
102
122
  }
103
123
  }
104
- if (dropped.length) {
124
+ if (dropped.length && !args.json) {
105
125
  output.warn().title("Some settings have no V2 equivalent and were not carried over:").message(dropped.join(", ")).print();
106
126
  }
107
127
  const writeUpgradedConfigResult = await n.fromUnsafe(
@@ -114,6 +134,18 @@ async function upgradeAction(__configPath) {
114
134
  if (!writeUpgradedConfigResult.success) {
115
135
  return output.error().title("Could not save the upgraded configuration").message(writeUpgradedConfigResult.error.code).message(displayError(writeUpgradedConfigResult.error.detail)).exit("error");
116
136
  }
137
+ if (args.json) {
138
+ writeJson({
139
+ configPath: path.resolve(parseConfigResult.filePath),
140
+ changed: true,
141
+ files: [
142
+ path.resolve(parseConfigResult.filePath),
143
+ ...sideFiles.map((file) => path.resolve(projectRootDir, file.path))
144
+ ],
145
+ dropped
146
+ });
147
+ return;
148
+ }
117
149
  return output.info().title("Scalar Docs configuration upgraded").message("Run `scalar project preview` to preview your project.").exit("success");
118
150
  }
119
151
  function listGitFiles(projectRootDir) {
@@ -1,30 +1,29 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  dashboardUrl
4
- } from "./chunk-5VZSFLRO.js";
4
+ } from "./chunk-7O5H2SQP.js";
5
5
  import {
6
6
  BaseCollections
7
- } from "./chunk-GUF4PKDL.js";
7
+ } from "./chunk-TI4NDKQC.js";
8
8
  import {
9
9
  getDatabaseClient
10
- } from "./chunk-W3Y5X3X3.js";
10
+ } from "./chunk-OVKTA5CX.js";
11
11
  import {
12
12
  apiService
13
- } from "./chunk-A27OERJM.js";
14
- import "./chunk-ZZTCEMCG.js";
15
- import "./chunk-ZK76AK3B.js";
13
+ } from "./chunk-TVPVXL73.js";
14
+ import "./chunk-2AK5O3NQ.js";
15
+ import "./chunk-KPLWZIOV.js";
16
16
  import "./chunk-YTTDYTVB.js";
17
- import "./chunk-6YOXEMMX.js";
18
- import "./chunk-5ENKYZA4.js";
19
- import "./chunk-W6FLDNRM.js";
20
- import "./chunk-TQL55CUG.js";
21
- import "./chunk-V6LUKXBV.js";
17
+ import "./chunk-Y2OQOAY7.js";
18
+ import "./chunk-IRA5BW2J.js";
19
+ import "./chunk-EXJUFF6G.js";
20
+ import "./chunk-RE5Z56QD.js";
22
21
  import "./chunk-VUXPDHTQ.js";
23
22
  import {
24
23
  getAuthData
25
- } from "./chunk-MLBEF6MB.js";
26
- import "./chunk-VJAVNG6U.js";
27
- import "./chunk-FD364GM7.js";
24
+ } from "./chunk-DDDYR2HF.js";
25
+ import "./chunk-CSJIKXUD.js";
26
+ import "./chunk-NRHHB3YY.js";
28
27
  import {
29
28
  teamSchema
30
29
  } from "./chunk-F3TQHNSQ.js";
@@ -32,12 +31,13 @@ import "./chunk-VRZSDUZK.js";
32
31
  import "./chunk-4ORL4MST.js";
33
32
  import {
34
33
  RegistryAsset
35
- } from "./chunk-4RF2NKQN.js";
34
+ } from "./chunk-TYNF7ROW.js";
36
35
  import {
37
36
  output,
38
37
  printTable
39
38
  } from "./chunk-T5HJUAWB.js";
40
- import "./chunk-PIWBFJX3.js";
39
+ import "./chunk-5ENKYZA4.js";
40
+ import "./chunk-AOZQPCWI.js";
41
41
  import "./chunk-Q26DFKTY.js";
42
42
  import {
43
43
  external_exports,
@@ -1,44 +1,51 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ writeJson
4
+ } from "./chunk-SNQFFEYH.js";
2
5
  import {
3
6
  apiService
4
- } from "./chunk-A27OERJM.js";
5
- import "./chunk-ZZTCEMCG.js";
6
- import "./chunk-ZK76AK3B.js";
7
+ } from "./chunk-TVPVXL73.js";
8
+ import "./chunk-2AK5O3NQ.js";
9
+ import "./chunk-KPLWZIOV.js";
7
10
  import "./chunk-YTTDYTVB.js";
8
- import "./chunk-6YOXEMMX.js";
9
- import "./chunk-5ENKYZA4.js";
10
- import "./chunk-W6FLDNRM.js";
11
- import "./chunk-TQL55CUG.js";
12
- import "./chunk-MLBEF6MB.js";
13
- import "./chunk-VJAVNG6U.js";
14
- import "./chunk-FD364GM7.js";
11
+ import "./chunk-Y2OQOAY7.js";
12
+ import "./chunk-IRA5BW2J.js";
13
+ import "./chunk-EXJUFF6G.js";
14
+ import "./chunk-DDDYR2HF.js";
15
+ import "./chunk-CSJIKXUD.js";
16
+ import "./chunk-NRHHB3YY.js";
15
17
  import "./chunk-F3TQHNSQ.js";
16
18
  import "./chunk-VRZSDUZK.js";
17
19
  import {
18
- requireInteractive
19
- } from "./chunk-EGOXR5FB.js";
20
- import "./chunk-4RF2NKQN.js";
20
+ canPrompt,
21
+ requireInteractive,
22
+ text
23
+ } from "./chunk-XUX6JXU5.js";
24
+ import "./chunk-IRQJDPZE.js";
25
+ import "./chunk-TYNF7ROW.js";
21
26
  import {
22
27
  output
23
28
  } from "./chunk-T5HJUAWB.js";
24
- import "./chunk-PIWBFJX3.js";
29
+ import "./chunk-5ENKYZA4.js";
30
+ import "./chunk-AOZQPCWI.js";
25
31
  import "./chunk-Q26DFKTY.js";
26
32
  import "./chunk-I57ID5K7.js";
27
33
  import "./chunk-3MZYUBJ6.js";
28
34
 
29
35
  // src/domains/project/create/action.ts
30
- import { isCancel, text } from "@clack/prompts";
31
36
  import as from "ansis";
32
37
  async function createAction({
33
38
  name,
34
- slug
39
+ slug,
40
+ json
35
41
  }) {
36
42
  const apiClient = await apiService();
37
43
  let nameValue = name;
38
44
  let slugValue = slug;
39
45
  if (!nameValue) {
40
46
  requireInteractive(
41
- "Pass --name <name> to create a project non-interactively."
47
+ "Pass --name <name> to create a project non-interactively.",
48
+ json
42
49
  );
43
50
  const response2 = await text({
44
51
  message: "Enter the project name",
@@ -46,18 +53,16 @@ async function createAction({
46
53
  if (!value.trim()) return "Provide a project name.";
47
54
  }
48
55
  });
49
- if (isCancel(response2)) return;
50
56
  nameValue = response2;
51
57
  }
52
- if (!slugValue && process.stdin.isTTY) {
58
+ if (!json && !slugValue && canPrompt()) {
53
59
  const response2 = await text({
54
60
  message: "Enter the project slug (optional)",
55
61
  defaultValue: ""
56
62
  });
57
- if (isCancel(response2)) return;
58
63
  slugValue = response2 || void 0;
59
64
  }
60
- const logger = output.info().loader("Creating project\u2026");
65
+ const logger = json ? void 0 : output.info().loader("Creating project\u2026");
61
66
  const response = await apiClient.docsProject.createProject({
62
67
  provider: "forgejo",
63
68
  blank: true,
@@ -67,8 +72,16 @@ async function createAction({
67
72
  if (response.error) {
68
73
  return output.error().title("Could not create the project").message(response.message).exit("error");
69
74
  }
70
- logger.update("loader", 0, { content: "Project created." });
71
- logger.message(
75
+ if (json) {
76
+ writeJson({
77
+ uid: response.data.uid,
78
+ slug: response.data.slug,
79
+ name: nameValue
80
+ });
81
+ return;
82
+ }
83
+ logger?.update("loader", 0, { content: "Project created." });
84
+ logger?.message(
72
85
  `Project ID: ${as.cyan(response.data.uid)}
73
86
  Project slug: ${as.cyan(response.data.slug)}`
74
87
  ).exit("success");
@@ -1,36 +1,52 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ normalizeVisibility
4
+ } from "./chunk-LK2ZIDHH.js";
5
+ import "./chunk-NAC63XJF.js";
6
+ import {
7
+ writeJson
8
+ } from "./chunk-SNQFFEYH.js";
2
9
  import {
3
10
  apiService
4
- } from "./chunk-A27OERJM.js";
5
- import "./chunk-ZZTCEMCG.js";
6
- import "./chunk-ZK76AK3B.js";
11
+ } from "./chunk-TVPVXL73.js";
12
+ import "./chunk-2AK5O3NQ.js";
13
+ import "./chunk-KPLWZIOV.js";
7
14
  import "./chunk-YTTDYTVB.js";
8
- import "./chunk-6YOXEMMX.js";
9
- import "./chunk-5ENKYZA4.js";
10
- import "./chunk-W6FLDNRM.js";
11
- import "./chunk-TQL55CUG.js";
12
- import "./chunk-MLBEF6MB.js";
13
- import "./chunk-VJAVNG6U.js";
14
- import "./chunk-FD364GM7.js";
15
+ import "./chunk-Y2OQOAY7.js";
16
+ import "./chunk-IRA5BW2J.js";
17
+ import "./chunk-EXJUFF6G.js";
18
+ import "./chunk-DDDYR2HF.js";
19
+ import "./chunk-CSJIKXUD.js";
20
+ import "./chunk-NRHHB3YY.js";
15
21
  import "./chunk-F3TQHNSQ.js";
16
22
  import "./chunk-VRZSDUZK.js";
17
23
  import {
18
- requireInteractive
19
- } from "./chunk-EGOXR5FB.js";
20
- import "./chunk-4RF2NKQN.js";
24
+ requireInteractive,
25
+ text
26
+ } from "./chunk-XUX6JXU5.js";
27
+ import "./chunk-IRQJDPZE.js";
28
+ import "./chunk-TYNF7ROW.js";
21
29
  import {
22
30
  output
23
31
  } from "./chunk-T5HJUAWB.js";
24
- import "./chunk-PIWBFJX3.js";
32
+ import "./chunk-5ENKYZA4.js";
33
+ import "./chunk-AOZQPCWI.js";
25
34
  import "./chunk-Q26DFKTY.js";
26
35
  import "./chunk-I57ID5K7.js";
27
36
  import "./chunk-3MZYUBJ6.js";
28
37
 
29
38
  // src/domains/registry/update/action.ts
30
- import { text } from "@clack/prompts";
31
39
  import as from "ansis";
32
- async function updateAction(namespace, slug, { title, description }) {
33
- const client = await apiService();
40
+ async function updateAction(namespace, slug, {
41
+ title,
42
+ description,
43
+ json,
44
+ ...options
45
+ }) {
46
+ const visibility = normalizeVisibility(options);
47
+ if (!visibility.ok) {
48
+ return output.error().title("Invalid input").message(visibility.error).exit("error");
49
+ }
34
50
  if (!namespace) {
35
51
  return output.error().title("Invalid input").message("Provide the team namespace as the first argument.").exit("error");
36
52
  }
@@ -39,9 +55,14 @@ async function updateAction(namespace, slug, { title, description }) {
39
55
  }
40
56
  let titleValue = title;
41
57
  let descriptionValue = description;
42
- const shouldPrompt = ![title, description].some((it) => it !== void 0);
58
+ const shouldPrompt = ![title, description, visibility.data].some(
59
+ (it) => it !== void 0
60
+ );
43
61
  if (shouldPrompt) {
44
- requireInteractive("Provide --title or --description.");
62
+ requireInteractive(
63
+ "Provide --title, --description, --public, or --private.",
64
+ json
65
+ );
45
66
  }
46
67
  if (!titleValue && shouldPrompt) {
47
68
  titleValue = await text({
@@ -53,20 +74,26 @@ async function updateAction(namespace, slug, { title, description }) {
53
74
  message: `Enter the new API description summary ${as.grey("(optional)")}`
54
75
  });
55
76
  }
56
- if (!titleValue && !descriptionValue) {
77
+ if (!titleValue && !descriptionValue && visibility.data === void 0) {
57
78
  return output.error().title("Invalid input").message(
58
- "Provide --title or --description to update the API description."
79
+ "Provide --title, --description, --public, or --private to update the API description."
59
80
  ).exit("error");
60
81
  }
61
- const logger = output.info().line().loader("Updating the API description\u2026");
82
+ const client = await apiService();
83
+ const logger = json ? void 0 : output.info().line().loader("Updating the API description\u2026");
62
84
  const updateDocument = await client.managedDocs.update(namespace, slug, {
63
85
  title: titleValue,
64
- description: descriptionValue
86
+ description: descriptionValue,
87
+ ...visibility.data === void 0 ? {} : { isPrivate: visibility.data }
65
88
  });
66
89
  if (updateDocument.error) {
67
90
  return output.error().title(updateDocument.message).exit("error");
68
91
  }
69
- logger.update("loader", 0, {
92
+ if (json) {
93
+ writeJson({ namespace, slug, status: "updated" });
94
+ return;
95
+ }
96
+ logger?.update("loader", 0, {
70
97
  content: "API description metadata updated."
71
98
  }).print();
72
99
  }