@scalar/cli 2.13.2 → 2.14.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 (93) hide show
  1. package/README.md +42 -8
  2. package/chunks/{action-MHBMWRU4.js → action-2BGAMGXU.js} +7 -6
  3. package/chunks/{action-KCJTUKNF.js → action-2HPMP473.js} +4 -4
  4. package/chunks/{action-O4WDOJVV.js → action-3KP3WVPZ.js} +8 -7
  5. package/chunks/{action-E7EK6TJJ.js → action-4HXB3YQR.js} +12 -11
  6. package/chunks/{action-6LNC6MMJ.js → action-4HYLZRYW.js} +22 -21
  7. package/chunks/{action-AQCSAFDU.js → action-4MJXPSQU.js} +16 -15
  8. package/chunks/{action-4U36CMZG.js → action-57SV3ZBM.js} +7 -6
  9. package/chunks/{action-BIEKRF2X.js → action-6HFH7DAW.js} +7 -6
  10. package/chunks/{action-ZSUVSURQ.js → action-APBLB3IU.js} +7 -6
  11. package/chunks/{action-YH3KB4NR.js → action-APTGKF4W.js} +38 -36
  12. package/chunks/{action-XZDNARAW.js → action-BL5PWLFV.js} +21 -20
  13. package/chunks/{action-MHJOOGII.js → action-C7CNI7TP.js} +10 -10
  14. package/chunks/{action-Q7OD2QHZ.js → action-DJXZWPL7.js} +8 -7
  15. package/chunks/{action-D7D3YH2N.js → action-EPGLU5E3.js} +16 -15
  16. package/chunks/{action-YXAOA3TJ.js → action-EYOZ457H.js} +17 -16
  17. package/chunks/{action-BVORONSB.js → action-FLX3ESH7.js} +22 -21
  18. package/chunks/{action-VK6HFIZ5.js → action-FOITEQNQ.js} +16 -15
  19. package/chunks/{action-WMOLIVXC.js → action-GOFCT7XK.js} +21 -20
  20. package/chunks/{action-3OYAJ5F6.js → action-MJI3TI3W.js} +19 -18
  21. package/chunks/{action-3QTDQRAO.js → action-OP5DCAHN.js} +18 -16
  22. package/chunks/{action-LKMBK3MO.js → action-P2QEJUBK.js} +11 -11
  23. package/chunks/{action-JOKVK5PP.js → action-RRQNVUFW.js} +8 -8
  24. package/chunks/{action-2LFAO27S.js → action-SCOJRZKD.js} +11 -10
  25. package/chunks/{action-IN7SNSSI.js → action-TR2T2UYB.js} +7 -6
  26. package/chunks/{action-NY2R6VH2.js → action-U2RJ3ZAU.js} +4 -4
  27. package/chunks/{action-V2B42324.js → action-VAJSWBMD.js} +14 -14
  28. package/chunks/{action-ZYQEUYF7.js → action-VEP7LZPN.js} +4 -4
  29. package/chunks/{action-RDG3SJ2G.js → action-VS22CPVB.js} +17 -16
  30. package/chunks/{action-4DEIYLOW.js → action-VW2POHCL.js} +15 -15
  31. package/chunks/{action-WJMC3TDN.js → action-VY3DRAO4.js} +7 -7
  32. package/chunks/{action-FIKVZPFG.js → action-WOLNPEUQ.js} +10 -8
  33. package/chunks/{action-6WWWTCCB.js → action-XA4MEYFP.js} +14 -14
  34. package/chunks/{action-HGPGL624.js → action-Y4MKBDRC.js} +18 -17
  35. package/chunks/{action-S7NCRXKS.js → action-ZOU7EPX5.js} +19 -18
  36. package/chunks/{actions-K2RSZCU4.js → actions-PBYTDEMH.js} +16 -15
  37. package/chunks/{agent-YNVT6RJ6.js → agent-NA3QFKJX.js} +5 -5
  38. package/chunks/{asyncapi-XLHXPF2X.js → asyncapi-KCA6ZH3Q.js} +23 -18
  39. package/chunks/{build.action-TAMUO3F2.js → build.action-54FHG7VL.js} +18 -17
  40. package/chunks/{chunk-ORHGCCJR.js → chunk-2KSOARE4.js} +2 -2
  41. package/chunks/{chunk-UPYLTC2Z.js → chunk-2SBHCZPG.js} +1 -1
  42. package/chunks/{chunk-VMRXSVEE.js → chunk-3CRO6NY4.js} +3 -1
  43. package/chunks/{chunk-UXCQFVXG.js → chunk-42YF4H6W.js} +2 -2
  44. package/chunks/{chunk-5ENKYZA4.js → chunk-4S3DGMMZ.js} +1 -1
  45. package/chunks/chunk-5D3T63G4.js +14 -0
  46. package/chunks/{chunk-DRXJRWZA.js → chunk-6BQHLHBE.js} +4 -2
  47. package/chunks/{chunk-NEB25B57.js → chunk-7FS7BAUX.js} +3 -3
  48. package/chunks/{chunk-JA7EIRUB.js → chunk-7PNOYE6B.js} +1 -1
  49. package/chunks/{chunk-7UKLAB2Q.js → chunk-7ZDC34NA.js} +28 -8
  50. package/chunks/{chunk-KAKAN5X3.js → chunk-AAWPGVMG.js} +2 -2
  51. package/chunks/{chunk-MQNTUZ2B.js → chunk-BLY2CF4S.js} +3 -1
  52. package/chunks/{chunk-4T5XUXTP.js → chunk-BOCMOHQA.js} +3 -1
  53. package/chunks/chunk-BY4NGQ5D.js +15 -0
  54. package/chunks/{chunk-66POUWQA.js → chunk-DTZBE4ZX.js} +3 -3
  55. package/chunks/{chunk-2XWUFFEZ.js → chunk-E24BNP6E.js} +1 -1
  56. package/chunks/{chunk-NDCXYF5Q.js → chunk-EOTD7HAV.js} +1 -1
  57. package/chunks/{chunk-PFP35UAF.js → chunk-F5Q7FJRG.js} +1 -1
  58. package/chunks/chunk-GO3TSREI.js +27 -0
  59. package/chunks/{chunk-I2JLVALT.js → chunk-H5AMMMQ3.js} +10 -10
  60. package/chunks/{chunk-RAJM56L7.js → chunk-HIDIW2FN.js} +1 -1
  61. package/chunks/{chunk-LK2ZIDHH.js → chunk-IDGT5RAQ.js} +1 -1
  62. package/chunks/chunk-IPUJEBMI.js +9 -0
  63. package/chunks/{chunk-Z2NUKRKG.js → chunk-KKHTS43A.js} +3 -3
  64. package/chunks/{chunk-OBJCYCIV.js → chunk-KXMZXTLK.js} +1 -1
  65. package/chunks/{chunk-JQJSNCGD.js → chunk-KZSM2SUL.js} +4 -4
  66. package/chunks/{chunk-ZO7KDO3C.js → chunk-PIDLENYN.js} +7192 -6436
  67. package/chunks/{chunk-DDTGQKVB.js → chunk-PRW5TKYS.js} +1 -1
  68. package/chunks/{chunk-3CZG44E4.js → chunk-QMERQSPM.js} +2 -2
  69. package/chunks/{chunk-AP2O742I.js → chunk-QTMJ3VUZ.js} +2 -2
  70. package/chunks/{chunk-KYJLZCM3.js → chunk-RRYUCZYO.js} +2 -2
  71. package/chunks/{chunk-TWTUSPPI.js → chunk-S3U2VMVL.js} +2 -2
  72. package/chunks/{chunk-PFUJVZFI.js → chunk-UM3WZUGF.js} +4 -12
  73. package/chunks/{chunk-G7DFH6WK.js → chunk-USVU6AC2.js} +21 -5
  74. package/chunks/{chunk-RQOKASNF.js → chunk-VJ7FHLN4.js} +2 -2
  75. package/chunks/{chunk-3MKTCEUX.js → chunk-W7P6VTCG.js} +25 -2
  76. package/chunks/{chunk-KVK4LNTB.js → chunk-WKMOUBQJ.js} +7884 -3730
  77. package/chunks/{chunk-QHR5X4FO.js → chunk-WZSU45SV.js} +1 -1
  78. package/chunks/{chunk-XG6WXQFN.js → chunk-WZUA7IAV.js} +2 -2
  79. package/chunks/{create.action-UX5TVHST.js → create.action-NB3YYZ7K.js} +18 -17
  80. package/chunks/{delete.action-UMVF2N4A.js → delete.action-5BT3TXVZ.js} +18 -17
  81. package/chunks/{delete.action-C3ZGIXJX.js → delete.action-DWMQYW62.js} +18 -17
  82. package/chunks/diff.action-ENOOLRRB.js +324 -0
  83. package/chunks/{get.action-KIEUFN4D.js → get.action-2ASGSZW3.js} +17 -16
  84. package/chunks/{get.action-KFLT4UUT.js → get.action-55JDC2MJ.js} +21 -27
  85. package/chunks/{list.action-F3M4XJFC.js → list.action-6QBQFGVR.js} +17 -16
  86. package/chunks/{list.action-QK5DK5X3.js → list.action-NCG6Q6S2.js} +21 -20
  87. package/chunks/{publish.action-GZ2TSAPE.js → publish.action-4Y5EXBOY.js} +38 -36
  88. package/chunks/{update.action-DNINDNBT.js → update.action-4V6MQMWG.js} +19 -18
  89. package/chunks/{update.action-OTRO76PF.js → update.action-6OE54B5O.js} +18 -17
  90. package/index.js +262 -203
  91. package/package.json +13 -12
  92. package/skills/scalar-cli/SKILL.md +2 -1
  93. package/template.md +41 -7
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "engines": {
6
6
  "node": ">=24"
7
7
  },
8
- "version": "2.13.2",
8
+ "version": "2.14.0",
9
9
  "keywords": [
10
10
  "scalar",
11
11
  "openapi",
@@ -22,16 +22,16 @@
22
22
  "@clack/prompts": "0.7.0",
23
23
  "@hono/node-server": "2.1.1",
24
24
  "@quobix/vacuum": "0.30.1",
25
- "@scalar/asyncapi-upgrader": "0.1.15",
26
- "@scalar/asyncapi-validator": "0.1.10",
27
- "@scalar/json-magic": "0.15.5",
28
- "@scalar/mock-server": "0.17.4",
29
- "@scalar/openapi-to-markdown": "1.5.2",
30
- "@scalar/openapi-upgrader": "0.4.2",
31
- "@scalar/openapi-validator": "0.1.10",
32
- "@scalar/postman-to-openapi": "0.7.25",
33
- "@scalar/void-server": "2.5.15",
34
- "@scalar/workspace-store": "0.68.1",
25
+ "@scalar/asyncapi-upgrader": "0.1.18",
26
+ "@scalar/asyncapi-validator": "0.1.17",
27
+ "@scalar/json-magic": "0.17.0",
28
+ "@scalar/mock-server": "0.20.3",
29
+ "@scalar/openapi-to-markdown": "1.7.3",
30
+ "@scalar/openapi-upgrader": "0.4.6",
31
+ "@scalar/openapi-validator": "0.1.17",
32
+ "@scalar/postman-to-openapi": "0.7.28",
33
+ "@scalar/void-server": "2.5.19",
34
+ "@scalar/workspace-store": "0.69.3",
35
35
  "@stoplight/spectral-core": "1.22.0",
36
36
  "@stoplight/spectral-parsers": "1.0.5",
37
37
  "@stoplight/spectral-ruleset-bundler": "1.7.0",
@@ -41,7 +41,7 @@
41
41
  "commander": "13.1.0",
42
42
  "console-table-printer": "2.16.1",
43
43
  "get-port": "7.2.0",
44
- "hono": "^4.12.25",
44
+ "hono": "^4.13.13",
45
45
  "ignore": "7.0.5",
46
46
  "jsonc-parser": "3.2.1",
47
47
  "nanoid": "6.0.1",
@@ -51,6 +51,7 @@
51
51
  "stdout-update": "4.0.1",
52
52
  "tar-fs": "3.1.2",
53
53
  "undici": "8.10.2",
54
+ "ws": "^8.21.0",
54
55
  "yaml": "2.8.3"
55
56
  }
56
57
  }
@@ -5,7 +5,7 @@ description: "Operate the Scalar CLI (`scalar`, or `npx @scalar/cli`) to validat
5
5
 
6
6
  # Scalar CLI
7
7
 
8
- Validate, lint, bundle, mock, and preview OpenAPI and AsyncAPI descriptions, and publish them to Scalar (`@scalar/cli` 2.13.2).
8
+ Validate, lint, bundle, mock, and preview OpenAPI and AsyncAPI descriptions, and publish them to Scalar (`@scalar/cli` 2.14.0).
9
9
 
10
10
  ## Operating notes
11
11
 
@@ -83,3 +83,4 @@ Run `scalar context` for the arguments, options, defaults, and choices of each c
83
83
  - `scalar schema list [options]`: List shared schemas in a team namespace
84
84
  - `scalar schema get [options] [namespace] [slug]`: Download a shared schema version from the Scalar Registry
85
85
  - `scalar schema publish [options] [file]`: Publish a shared schema to the Scalar Registry
86
+ - `scalar schema diff [options] <from> <to>`: Compare two schema versions, files, or URLs
package/template.md CHANGED
@@ -88,6 +88,20 @@ scalar project publish --slug my-docs
88
88
 
89
89
  Push API descriptions to the [Scalar Registry](https://scalar.com/products/registry/getting-started), preview a Scalar Docs project locally, and publish it. In CI, run `scalar auth login --token <token>`, or set `SCALAR_API_KEY` and run `scalar auth login`.
90
90
 
91
+ ### Compare schemas
92
+
93
+ ```bash
94
+ scalar schema diff acme/widget@1.0.0 acme/widget@2.0.0
95
+ scalar schema diff acme/widget@1.0.0 acme/widget@2.0.0 --verbose
96
+ scalar schema diff acme/widget@1.0.0 acme/widget@latest --json
97
+
98
+ # CI: fail the job if the local schema drifted from what is published
99
+ scalar schema diff acme/widget@latest ./widget.json --check --verbose
100
+ scalar schema diff acme/widget@latest ./widget.json --check --quiet --ignore /description /examples
101
+ ```
102
+
103
+ Each side is a published schema (`namespace/slug@version`, where the version defaults to `latest`), a file, or a URL. Both sides are parsed and compared structurally, so formatting, key order, and JSON versus YAML never count as changes. The order of items in an array, including `required`, `enum`, and `type`, does count. Changes are listed by JSON Pointer into the documents as written. An existing path always counts as a file: prefix `./` to force a file, or add `@latest` to force the Scalar Registry. `--ignore <pointer...>` skips changes at or under a JSON Pointer, so `/properties/legacy` also skips `/properties/legacy/type` but not `/properties/legacyId`. A change above the pointer, such as all of `/properties` being added, is still reported in full. Put it after the two schemas.
104
+
91
105
  ## Install
92
106
 
93
107
  Standalone binary, no Node.js required:
@@ -167,6 +181,25 @@ jobs:
167
181
 
168
182
  `--format github-actions` turns findings into annotations on the pull request. [JSON output, JUnit reports, and lint baselines →](https://scalar.com/tools/cli/ci-and-scripting)
169
183
 
184
+ To fail a job when a schema in the repository drifts from the published version, run `schema diff` with `--check`. `--verbose` prints every changed value to the job log, and a distinct exit code such as `--check 2` lets the job tell schema drift apart from an authentication or network error, which exit 1:
185
+
186
+ ```yml
187
+ steps:
188
+ - uses: actions/checkout@v6
189
+ - run: npx --yes @scalar/cli auth login
190
+ env:
191
+ SCALAR_API_KEY: ${{ secrets.SCALAR_API_KEY }}
192
+ - run: npx --yes @scalar/cli schema diff acme/widget@latest ./widget.json --check 2 --verbose
193
+ ```
194
+
195
+ | `schema diff` invocation | Identical | Differ | Error (authentication, download, parse, bad input) |
196
+ | ------------------------ | --------- | ------ | -------------------------------------------------- |
197
+ | no `--check` | exit 0 | exit 0 | exit 1 |
198
+ | `--check` | exit 0 | exit 1 | exit 1 |
199
+ | `--check <n>` (1–125) | exit 0 | exit n | exit 1 |
200
+
201
+ Put `--check` after the two schemas, or write `--check=<n>`: an optional value takes the next argument, so `--check acme/widget@1.0.0 …` is rejected. Errors always print to stderr, even with `--quiet`. To tell a difference from an error without a distinct code, read `identical` from `--json`.
202
+
170
203
  ## Commands
171
204
 
172
205
  <COMMANDS>
@@ -212,13 +245,14 @@ even in a terminal.
212
245
 
213
246
  #### List contracts
214
247
 
215
- | Command | JSON value |
216
- | ------------------------------ | -------------------------------------------------------------------------------------------------------- |
217
- | `team list --json` | Array of `{uid: string, name: string, current: boolean}` |
218
- | `registry list --json` | Array of `{namespace: string, slug: string, title: string, version: string, isPrivate: boolean}` |
219
- | `schema list --json` | Array of `{namespace: string, slug: string, title: string, version: string \| null, isPrivate: boolean}` |
220
- | `sdk list --json` | Array of SDK metadata objects described below |
221
- | `sdk get --slug <slug> --json` | One SDK metadata object |
248
+ | Command | JSON value |
249
+ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
250
+ | `team list --json` | Array of `{uid: string, name: string, current: boolean}` |
251
+ | `registry list --json` | Array of `{namespace: string, slug: string, title: string, version: string, isPrivate: boolean}` |
252
+ | `schema list --json` | Array of `{namespace: string, slug: string, title: string, version: string \| null, isPrivate: boolean}` |
253
+ | `sdk list --json` | Array of SDK metadata objects described below |
254
+ | `sdk get --slug <slug> --json` | One SDK metadata object |
255
+ | `schema diff <from> <to> --json` | `{from: string, to: string, identical: boolean, changes: Array<{type: "added" \| "removed" \| "changed", path: string, before?: unknown, after?: unknown}>}` |
222
256
 
223
257
  Schema `version` is the greatest version by semantic-version comparison, or
224
258
  `null` when no version exists. Registry `version` is the current version.