@scalar/cli 2.8.0 → 2.10.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.
- package/README.md +281 -65
- package/chunks/action-4GZI2M5B.js +62 -0
- package/chunks/action-4W5GUGEG.js +63 -0
- package/chunks/{action-FCAYFPVR.js → action-5LF4XYHX.js} +10 -7
- package/chunks/{action-XIUO64C7.js → action-5N3P43MD.js} +17 -12
- package/chunks/{action-Y7OUGD56.js → action-5RL4NWUZ.js} +17 -17
- package/chunks/{action-LXGXKXZZ.js → action-657A4K2D.js} +16 -16
- package/chunks/{action-EOAVVL52.js → action-7XOHYWYM.js} +11 -14
- package/chunks/{action-AQRPFQKI.js → action-CABLS46Q.js} +9 -7
- package/chunks/{action-F7A2K74G.js → action-CB55NWAU.js} +9 -13
- package/chunks/{action-5SK5NE7E.js → action-DKDRAIKV.js} +11 -14
- package/chunks/{action-7PEQXDWT.js → action-DTEO4YNX.js} +127 -20
- package/chunks/{action-UIKH4SZX.js → action-EAUTQ77U.js} +27 -23
- package/chunks/{action-YLF2G4G5.js → action-FBRY5JKU.js} +16 -16
- package/chunks/{action-VOFDW3U2.js → action-GFLRD7LO.js} +6 -5
- package/chunks/{action-GWXLHL2Z.js → action-GWYYTUTM.js} +4 -3
- package/chunks/{action-6BYGBXRC.js → action-HT42NUUX.js} +27 -22
- package/chunks/action-JEYDBB3P.js +147 -0
- package/chunks/{action-LLH4QPXM.js → action-KDUFU7TZ.js} +11 -13
- package/chunks/{action-W3C53GPH.js → action-LYCNT3KA.js} +29 -10
- package/chunks/{action-CA4QYPI6.js → action-OJ2NK25F.js} +4 -8
- package/chunks/{action-NVI5DWFP.js → action-PAM2EZ22.js} +4 -8
- package/chunks/action-PPTFYZWD.js +1552 -0
- package/chunks/{action-43YBNBDR.js → action-R4PGILN4.js} +28 -24
- package/chunks/{action-QQZLPI42.js → action-TOBU74JH.js} +23 -19
- package/chunks/action-U2L5DCFG.js +91 -0
- package/chunks/{action-H6OUJWWM.js → action-UUL6SWV4.js} +11 -14
- package/chunks/{action-354TUG4H.js → action-X7BA7PQQ.js} +10 -8
- package/chunks/{action-WFDNRA7D.js → action-XLE37MZL.js} +16 -16
- package/chunks/{action-Y6NXJQ4H.js → action-XOADBXSX.js} +16 -12
- package/chunks/{action-LEUD5P2U.js → action-YSVTZVKV.js} +36 -17
- package/chunks/{action-YRX6SN5F.js → action-ZFI77WA5.js} +8 -6
- package/chunks/{action-HT2DJ34Z.js → action-ZKA3RR3S.js} +15 -11
- package/chunks/{actions-OGIVBQC7.js → actions-3SAMH7A5.js} +41 -17
- package/chunks/{agent-ASPV3R5U.js → agent-2ESZI7NO.js} +7 -5
- package/chunks/{asyncapi-QNFKXHEI.js → asyncapi-4HGVM3PR.js} +14 -10
- package/chunks/{build.action-NM6CAE5F.js → build.action-VBGFGACM.js} +19 -17
- package/chunks/chunk-35Z7VTJT.js +453 -0
- package/chunks/chunk-36LXIJIZ.js +52 -0
- package/chunks/{chunk-KKRGBXCE.js → chunk-43WALAW3.js} +248 -103
- package/chunks/{chunk-C2KAWRIX.js → chunk-5ENKYZA4.js} +1 -1
- package/chunks/{chunk-GTV2BVXV.js → chunk-5SMP756H.js} +2 -2
- package/chunks/{chunk-5JLVQVKO.js → chunk-6M7TL2G2.js} +146 -148
- package/chunks/chunk-6PSYZO3U.js +24 -0
- package/chunks/{chunk-EXY3ZTV4.js → chunk-ATNTXKMS.js} +36 -274
- package/chunks/{chunk-PH3WFNXJ.js → chunk-BIMLCGKS.js} +1 -1
- package/chunks/{chunk-HGOD6THU.js → chunk-CWVYOXXM.js} +2 -19
- package/chunks/chunk-DFOZG7ZV.js +15 -0
- package/chunks/chunk-DHZW7Q7U.js +133 -0
- package/chunks/{chunk-R5LK6VPY.js → chunk-G4HRW2FZ.js} +13 -20
- package/chunks/{chunk-KCCFN4F7.js → chunk-GLWTVLKM.js} +29 -29
- package/chunks/{chunk-5UHLAJQD.js → chunk-GYRQPDTK.js} +24 -10
- package/chunks/chunk-H467HDVV.js +24 -0
- package/chunks/chunk-IPZP3VRA.js +327 -0
- package/chunks/{chunk-2OCWX42S.js → chunk-JXGF5EHC.js} +152 -18
- package/chunks/chunk-K2HIB5BA.js +92 -0
- package/chunks/{chunk-FDC2IESH.js → chunk-KHF2QXBG.js} +1352 -8327
- package/chunks/{chunk-IMG35UXX.js → chunk-KZNRQVMY.js} +1 -1
- package/chunks/{chunk-OJ2EWIJH.js → chunk-MC4EMNOR.js} +5 -1
- package/chunks/{chunk-YILQODZF.js → chunk-MMWSCTDB.js} +7 -4
- package/chunks/{chunk-6XWCMJDB.js → chunk-MNNGUUKJ.js} +12 -11
- package/chunks/chunk-NAC63XJF.js +10 -0
- package/chunks/{chunk-XXSQUBXS.js → chunk-UDBSV3CK.js} +107 -453
- package/chunks/{chunk-IKT5F47M.js → chunk-VVRUSQCY.js} +11 -11
- package/chunks/{chunk-BPGFSSUH.js → chunk-VYFGRLVQ.js} +1 -1
- package/chunks/{chunk-UXJ753NV.js → chunk-WB6PWTMU.js} +5 -13
- package/chunks/{chunk-5DEU2DVL.js → chunk-WDIWLXLV.js} +3 -15
- package/chunks/{chunk-6YPQGVF4.js → chunk-WIEXQUTD.js} +1 -1
- package/chunks/{chunk-W24BETFG.js → chunk-XAGJJNQW.js} +3 -3
- package/chunks/{chunk-22HYZ7LE.js → chunk-ZGNDXPLU.js} +3 -3
- package/chunks/{chunk-XEDGMZJD.js → chunk-ZGVZU6L2.js} +81 -25
- package/chunks/{chunk-L3UXDCBI.js → chunk-ZKJPLWRJ.js} +2 -2
- package/chunks/{chunk-MLSZVVTT.js → chunk-ZYBLQ5CT.js} +13 -7
- package/chunks/{create.action-FUQ2BVJA.js → create.action-DBNIS665.js} +19 -17
- package/chunks/{delete.action-BTDFH7WY.js → delete.action-GBOZC45K.js} +19 -17
- package/chunks/{delete.action-47E66R3I.js → delete.action-K7BLK7DK.js} +19 -17
- package/chunks/{get.action-XC7KC2JO.js → get.action-N3JOY3OU.js} +17 -12
- package/chunks/get.action-QHKMYZBK.js +91 -0
- package/chunks/{list.action-LXKEUYKO.js → list.action-6SSO3JVN.js} +45 -15
- package/chunks/{list.action-OFGLMRE7.js → list.action-TJCS6UEY.js} +39 -19
- package/chunks/{publish.action-OS27XOX4.js → publish.action-T24VHRMR.js} +27 -22
- package/chunks/query-WKATAJJ6.js +129 -0
- package/chunks/scripts-VIBLGKYG.js +102 -0
- package/chunks/{update.action-ZMS4CQ3T.js → update.action-OGYNBXRU.js} +23 -18
- package/chunks/{update.action-AEIBLCWD.js → update.action-VOE6PH5F.js} +23 -18
- package/docs.html +941 -209
- package/index.js +374 -182
- package/package.json +14 -13
- package/skills/scalar-cli/SKILL.md +7 -1
- package/template.md +148 -26
- package/chunks/action-JAHFRYWZ.js +0 -423
- package/chunks/action-KTYOCA2V.js +0 -229
- package/chunks/chunk-K74E42RV.js +0 -7311
- package/chunks/chunk-QVQ4PNVL.js +0 -610
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.10.0",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"scalar",
|
|
11
11
|
"openapi",
|
|
@@ -22,18 +22,18 @@
|
|
|
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.
|
|
26
|
-
"@scalar/asyncapi-validator": "0.1.
|
|
27
|
-
"@scalar/json-magic": "0.15.
|
|
28
|
-
"@scalar/mock-server": "0.17.
|
|
29
|
-
"@scalar/openapi-
|
|
30
|
-
"@scalar/openapi-
|
|
31
|
-
"@scalar/openapi-
|
|
32
|
-
"@scalar/openapi
|
|
33
|
-
"@scalar/
|
|
34
|
-
"@scalar/
|
|
35
|
-
"@scalar/workspace-store": "0.67.0",
|
|
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",
|
|
36
35
|
"@stoplight/spectral-core": "1.22.0",
|
|
36
|
+
"@stoplight/spectral-parsers": "1.0.5",
|
|
37
37
|
"@stoplight/spectral-ruleset-bundler": "1.7.0",
|
|
38
38
|
"@stoplight/spectral-rulesets": "1.22.1",
|
|
39
39
|
"ansis": "3.16.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"semver": "7.6.3",
|
|
51
51
|
"stdout-update": "4.0.1",
|
|
52
52
|
"tar-fs": "3.1.2",
|
|
53
|
-
"undici": "8.10.2"
|
|
53
|
+
"undici": "8.10.2",
|
|
54
|
+
"yaml": "2.8.3"
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -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
|
-
CLI to work with your OpenAPI files (`@scalar/cli` 2.
|
|
8
|
+
CLI to work with your OpenAPI files (`@scalar/cli` 2.10.0).
|
|
9
9
|
|
|
10
10
|
## Operating notes
|
|
11
11
|
|
|
@@ -28,9 +28,11 @@ Run `scalar context` for the arguments, options, defaults, and choices of each c
|
|
|
28
28
|
- `scalar readme generate [options]`: Self generate documentation for the cli
|
|
29
29
|
- `scalar upgrade [options]`: Upgrade current version of your cli
|
|
30
30
|
- `scalar context [options]`: Print every command, argument, and option as JSON for AI agents
|
|
31
|
+
- `scalar completion [options] <shell>`: Generate shell completion definitions
|
|
31
32
|
- `scalar auth login [options]`: Login to scalar
|
|
32
33
|
- `scalar auth whoami [options]`: Display the current user
|
|
33
34
|
- `scalar auth logout [options]`: Logout from scalar
|
|
35
|
+
- `scalar access-group list [options]`: List access groups for the current team
|
|
34
36
|
- `scalar access-group create [options] <slug>`: Create an access group (Pro or above)
|
|
35
37
|
- `scalar access-group get [options] <slug>`: Get an access group and its allowlists
|
|
36
38
|
- `scalar access-group update [options] <slug>`: Update access group metadata
|
|
@@ -50,6 +52,8 @@ Run `scalar context` for the arguments, options, defaults, and choices of each c
|
|
|
50
52
|
- `scalar document void [options]`: Boot a server to mirror HTTP requests
|
|
51
53
|
- `scalar document lint [options] [file|url]`: Lint your OpenAPI or AsyncAPI file using spectral rules
|
|
52
54
|
- `scalar document upgrade [options] [file|url]`: Upgrade an OpenAPI or AsyncAPI document to version 3.1
|
|
55
|
+
- `scalar project list [options]`: List projects and their slugs for the current team.
|
|
56
|
+
- `scalar project get [options] <slug>`: Get project details for the current team.
|
|
53
57
|
- `scalar project init [options]`: Create a new Scalar Docs project.
|
|
54
58
|
- `scalar project check-config [options] [file]`: Check a Scalar Configuration file
|
|
55
59
|
- `scalar project create [options]`: Create a new project that is not linked to a github project.
|
|
@@ -64,8 +68,10 @@ Run `scalar context` for the arguments, options, defaults, and choices of each c
|
|
|
64
68
|
- `scalar registry list [options]`: List all registry APIs for a team namespace
|
|
65
69
|
- `scalar registry get [options] [namespace] [slug]`: Get a document version from scalar registry
|
|
66
70
|
- `scalar team list [options]`: List all teams current user is part of
|
|
71
|
+
- `scalar team get [options]`: Get the current team and its namespaces
|
|
67
72
|
- `scalar team set [options]`: Set current active team for the user
|
|
68
73
|
- `scalar sdk list [options]`: List all SDKs for a team namespace
|
|
74
|
+
- `scalar sdk get [options]`: Inspect SDK metadata, API source, versions, and build status
|
|
69
75
|
- `scalar sdk create [options]`: Create a new SDK. The SDK is created in the namespace of the API it is built from.
|
|
70
76
|
- `scalar sdk update [options]`: Update SDK metadata.
|
|
71
77
|
- `scalar sdk delete [options]`: Delete an SDK.
|
package/template.md
CHANGED
|
@@ -15,25 +15,22 @@ Command-line interface to work with OpenAPI files
|
|
|
15
15
|
- Preview your API reference
|
|
16
16
|
- Bundle multiple OpenAPI files
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Projects
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Discover project slugs and inspect project details without opening the Dashboard:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
scalar auth login
|
|
24
|
-
scalar
|
|
25
|
-
scalar
|
|
26
|
-
scalar
|
|
27
|
-
scalar access-group domain add partners partner.com
|
|
28
|
-
scalar access-group domain remove partners partner.com
|
|
29
|
-
scalar access-group delete partners --yes
|
|
24
|
+
scalar project list
|
|
25
|
+
scalar project get my-docs
|
|
26
|
+
scalar project deployments list --slug my-docs
|
|
30
27
|
```
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
These commands use your existing login and current team. The list includes unified docs projects and legacy sync or unlinked projects, with migrated projects shown once. Older Dashboard editor projects are not included.
|
|
33
30
|
|
|
34
|
-
Use
|
|
31
|
+
Use `scalar project list --json` for an array of project details and `scalar project get my-docs --json` for one object. Both include `uid`, `name`, `slug`, `provider`, `isPrivate`, `repository`, and `activeDeployment`. An unlinked repository or absent live deployment is `null`; the provider is `forgejo`, `github`, `bitbucket`, or `unlinked`. The live deployment describes the active build, not a failed or pending publish attempt.
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
Project listing retrieves every page. On older servers that truncate the list without a continuation cursor, it exits with an error instead of printing an incomplete list. Errors go to stderr and exit nonzero.
|
|
37
34
|
|
|
38
35
|
## Documentation
|
|
39
36
|
|
|
@@ -97,6 +94,55 @@ npx @scalar/cli help
|
|
|
97
94
|
pnpm dlx @scalar/cli help
|
|
98
95
|
```
|
|
99
96
|
|
|
97
|
+
## Shell completion
|
|
98
|
+
|
|
99
|
+
Generate completions for Bash, Zsh, or Fish with the installed CLI on PATH. These instructions work for both `npm -g install @scalar/cli` and the standalone installer. Completion runs locally, needs no login or network access, and discovers commands, nested commands, flags, and finite option values from the installed CLI. File arguments and file options retain native filesystem completion.
|
|
100
|
+
|
|
101
|
+
### Bash
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
mkdir -p ~/.local/share/scalar
|
|
105
|
+
scalar completion bash > ~/.local/share/scalar/completion.bash
|
|
106
|
+
source ~/.local/share/scalar/completion.bash
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add `source ~/.local/share/scalar/completion.bash` to `~/.bashrc`, or `~/.bash_profile` for a macOS login shell. Bash 3.2 and newer are supported. The script registers both `scalar` and `scalar-cli`.
|
|
110
|
+
|
|
111
|
+
### Zsh
|
|
112
|
+
|
|
113
|
+
```zsh
|
|
114
|
+
mkdir -p ~/.zsh/completions
|
|
115
|
+
scalar completion zsh > ~/.zsh/completions/_scalar
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Add the following to `~/.zshrc`, placing the `fpath` line before your existing `compinit` setup. If your shell already initializes completion, keep that setup instead of calling `compinit` twice.
|
|
119
|
+
|
|
120
|
+
```zsh
|
|
121
|
+
fpath=(~/.zsh/completions $fpath)
|
|
122
|
+
autoload -Uz compinit
|
|
123
|
+
compinit
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Open a new shell. Both `scalar` and `scalar-cli` use the same completion function.
|
|
127
|
+
|
|
128
|
+
### Fish
|
|
129
|
+
|
|
130
|
+
```fish
|
|
131
|
+
mkdir -p ~/.config/fish/completions
|
|
132
|
+
scalar completion fish > ~/.config/fish/completions/scalar.fish
|
|
133
|
+
cp ~/.config/fish/completions/scalar.fish ~/.config/fish/completions/scalar-cli.fish
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Open a new shell. The second file enables autoloading when using `scalar-cli`; it is optional for standalone installs that only provide `scalar`.
|
|
137
|
+
|
|
138
|
+
### Upgrades and removal
|
|
139
|
+
|
|
140
|
+
Completion reads the installed executable's command definitions on each Tab press, so new commands and options appear after an upgrade. Regenerate your script by repeating the generation command with `>` after upgrading with npm or re-running the standalone installer, then open a new shell. This also refreshes any improvements to the shell adapter. Avoid appending scripts with `>>`.
|
|
141
|
+
|
|
142
|
+
To remove completion, delete the generated file (both files for Fish) and remove the `source` line for Bash or the Scalar `fpath` entry for Zsh, then open a new shell. Keep shared `compinit` setup used by other tools.
|
|
143
|
+
|
|
144
|
+
These scripts target installed `scalar` and `scalar-cli` executables, not `npx` or `pnpm dlx` invocations. If Git's unrelated `scalar` executable takes precedence on PATH, use npm's `scalar-cli` alias or correct your PATH before installing completions. Standalone installations provide `scalar`.
|
|
145
|
+
|
|
100
146
|
## API Reference configuration
|
|
101
147
|
|
|
102
148
|
Pass API Reference options as a JSON object:
|
|
@@ -126,6 +172,19 @@ precedence over `--token`. Unset it to use a different explicit token.
|
|
|
126
172
|
Supply required options in automation instead of relying on interactive prompts.
|
|
127
173
|
For example, pass `--output` for document transformations.
|
|
128
174
|
|
|
175
|
+
## Team discovery
|
|
176
|
+
|
|
177
|
+
After logging in, run `scalar team list` to see your teams and their copyable UIDs. The current team is marked as the default. Use a UID with `scalar team set --team <uid>` to switch teams.
|
|
178
|
+
|
|
179
|
+
Run `scalar team get` to see the current team's UID, name, slug, and namespaces. Both discovery commands support `--json` for scripts:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
scalar team list --json
|
|
183
|
+
scalar team get --json
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`team list --json` returns an array of `{ uid, name, current }` objects. `team get --json` returns `{ uid, name, slug, namespaces }`. Empty lists and namespace arrays remain empty arrays in JSON output. Personal-token logins can inspect their current team, but switching teams still requires logging in with a token for that team.
|
|
187
|
+
|
|
129
188
|
## Commands
|
|
130
189
|
|
|
131
190
|
<COMMANDS>
|
|
@@ -152,6 +211,36 @@ cp -r "$(dirname "$(readlink "$(command -v scalar)")")/app/skills/scalar-cli" .c
|
|
|
152
211
|
|
|
153
212
|
With the standalone CLI on Windows, the skill is in `%LOCALAPPDATA%\Scalar\current\app\skills\scalar-cli`.
|
|
154
213
|
|
|
214
|
+
## Inspect SDKs
|
|
215
|
+
|
|
216
|
+
Use your current team login to inspect an SDK by slug. The namespace defaults to the team's first namespace.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
scalar sdk get --slug widgets --namespace acme
|
|
220
|
+
scalar sdk get --slug widgets --namespace acme --json
|
|
221
|
+
scalar sdk list --namespace acme --json
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
JSON output is a metadata object for `get` and an array for `list` (including `[]` when empty). It includes the linked registry API, tracked API version, target languages and slugs, current SDK version, version history with active build IDs, and the latest attempted build with per-language generation and Git sync status. The latest attempt may be a different version or have failed; it does not replace the current version or active artifacts. Timestamps are Unix seconds; absent builds and unlinked API sources are `null`. Generator configuration, repository auth bindings, and raw build messages are excluded.
|
|
225
|
+
|
|
226
|
+
## Registry metadata for scripts
|
|
227
|
+
|
|
228
|
+
Use `scalar registry list --json` to write a JSON array to stdout. Without
|
|
229
|
+
`--namespace`, the command uses the first namespace of your current team, just
|
|
230
|
+
like the default table output. You must be logged in; errors go to stderr and
|
|
231
|
+
exit with a nonzero status.
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
scalar registry list --namespace scalar --json > registry-apis.json
|
|
235
|
+
scalar registry get scalar demo-api --version 1.2.3 > openapi.json
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Each array entry contains `namespace` and `slug` (the coordinates accepted by
|
|
239
|
+
`registry get`), `title` (a string, which may be empty), `version` (the current
|
|
240
|
+
version served by default), and `isPrivate` (a boolean). JSON output includes
|
|
241
|
+
only these metadata fields, without document content or credentials. An empty
|
|
242
|
+
namespace returns `[]`. Omit `--json` for the human-readable table.
|
|
243
|
+
|
|
155
244
|
## GitHub Actions
|
|
156
245
|
|
|
157
246
|
To validate your OpenAPI file in GitHub Actions, add this workflow:
|
|
@@ -183,30 +272,63 @@ jobs:
|
|
|
183
272
|
run: npx @scalar/cli document validate ./my-openapi-file.yaml
|
|
184
273
|
```
|
|
185
274
|
|
|
186
|
-
##
|
|
275
|
+
## CI lint reports and baselines
|
|
187
276
|
|
|
188
|
-
|
|
277
|
+
Lint reports support CI annotations, test-report viewers, and readable reviews:
|
|
189
278
|
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
279
|
+
```sh
|
|
280
|
+
scalar document lint openapi.yaml --format codeframe
|
|
281
|
+
scalar document lint openapi.yaml --format markdown --output lint-results.md
|
|
282
|
+
scalar document lint openapi.yaml --format summary
|
|
283
|
+
scalar document lint openapi.yaml --format github-actions
|
|
284
|
+
scalar document lint openapi.yaml --format json --output lint-results.json
|
|
285
|
+
scalar document lint openapi.yaml --format junit --output lint-results.xml
|
|
193
286
|
```
|
|
194
287
|
|
|
195
|
-
|
|
288
|
+
The default is `codeframe`, which shows source excerpts with severity colors and highlighted carets when terminal colors are enabled. `NO_COLOR=1` disables colors, and reports saved with `--output` are always plain text. Use `--format text` for the native report. `markdown` produces tables grouped by source, and `summary` counts findings by rule and severity. Machine-readable reports use 1-based locations; text retains engine-native coordinates. Codeframes omit excerpts for unavailable sources.
|
|
196
289
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
290
|
+
`--max-problems <number>` limits displayed findings to 100 by default. Findings are ordered by severity, with errors first. Use `--max-problems 0` to hide all findings. Counts and the exit status always include every active finding, and baseline generation records all findings regardless of this limit. Summary rule counts cover the displayed findings; its final error/warning totals cover all findings. Truncation notices go to stderr, keeping JSON and XML valid.
|
|
291
|
+
|
|
292
|
+
Reports go to stdout unless `--output` is given. Status, upgrade, and truncation notices go to stderr. Reports are written even when lint findings cause a nonzero exit. Both shell redirection and `--output` work:
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
scalar document lint openapi.yaml --format json > lint-results.json
|
|
296
|
+
scalar document lint openapi.yaml --format json --output lint-results.json
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Prefer `--output` in scripts when you want Scalar to check the destination against the input, custom ruleset, baseline, and referenced source files (including clean nested references and file aliases). Shell redirection is convenient for piping; the shell opens or truncates the destination before Scalar starts, so Scalar cannot protect that destination. Parent directories for `--output` must already exist.
|
|
300
|
+
|
|
301
|
+
JSON follows Redocly's report shape: `totals` contains error, warning, and ignored counts; `version` is the Scalar CLI version; `problems` is the displayed findings array. Each problem includes `ruleId`, `severity` (`error`, `warn`, `info`, or `hint`), `message`, `suggest`, optional rule `reference`, and a `location` array. Locations contain `source.ref`, a JSON `pointer`, and 1-based `start`/`end` positions with `line` and `col`. Local sources are relative to the current directory; URLs remain absolute. Rule IDs and findings still come from Scalar's Vacuum/Spectral engines. Duplicate-operation-ID findings include the participating definitions, including referenced path items and callbacks. Reports preserve additional locations when supplied by the engine; totals and JUnit still count one testcase per finding, and ignore matching uses the primary location, with legacy native paths retained as matching candidates. Scalar does not yet provide Redocly's typo suggestions.
|
|
302
|
+
|
|
303
|
+
GitHub Actions reports use error, warning, and notice annotations with start and end positions and available rule documentation links. Local files are relative to `GITHUB_WORKSPACE`, or the current directory outside Actions. Remote sources appear in the message without a repository file attachment. When saved with `--output`, annotations must subsequently be printed to the runner's stdout to become visible.
|
|
304
|
+
|
|
305
|
+
JUnit groups findings into suites by source, with one testcase per displayed finding. To match Redocly, lint errors become XML `error` entries, warnings become `failure` entries, and information/hints become `system-out`. Warnings still do not make the lint command exit nonzero, and JUnit viewers classify those testcases as failed. The CLI lint report compatibility workflow verifies this behavior using the Java JUnit viewer in `dorny/test-reporter`. The `Scalar lint totals` suite records full error, warning, ignored, and hidden counts as properties. A clean run produces a valid zero-test report. Configure CI to upload reports even when the lint step fails.
|
|
306
|
+
|
|
307
|
+
To adopt linting with existing findings:
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
scalar document lint openapi.yaml --generate-ignore-file
|
|
311
|
+
scalar document lint openapi.yaml --format github-actions
|
|
200
312
|
```
|
|
201
313
|
|
|
202
|
-
|
|
314
|
+
Commit the generated `.scalar.lint-ignore.yaml`. Subsequent runs automatically read it from the current directory. `--ignore-file <file>` overrides that location for generation and linting, including an existing `.redocly.lint-ignore.yaml`. Relative paths resolve from the current directory; no parent-directory search is performed. If Scalar's file is absent, linting automatically falls back to `.redocly.lint-ignore.yaml`. You can also rename a Redocly ignore file to `.scalar.lint-ignore.yaml`; Scalar's file always wins when both exist. Generation defaults to Scalar's filename and leaves Redocly's file intact. Scalar does not read `redocly.yaml`.
|
|
315
|
+
|
|
316
|
+
For OpenAPI with the default ruleset, imported mappings support the audited Redocly rules `info-contact`, `info-license`, `operation-description`, `operation-operationId`, `operation-operationId-url-safe` (mapped to Scalar's `operation-operationId-valid-in-url`), `no-path-trailing-slash` (`path-keys-no-trailing-slash`), `path-declaration-must-exist` (`path-declarations-must-exist`), `path-not-include-query`, `tag-description`, and `operation-singular-tag`. Missing-field pointers are adapted where the engines report the containing object. This does not enable rules that Scalar's default engine disables. Unsupported rules produce a notice on stderr; only exact Scalar rule/pointer matches apply to those entries. Severity-only overrides of these audited built-in rules retain migration support. Custom definitions, unknown inheritance, and AsyncAPI use exact Scalar identities. Redocly’s `operation-2xx-response` is not mapped to Scalar’s `operation-success-response`, which also accepts 3xx responses. Full custom-rule compatibility would require running Redocly itself.
|
|
317
|
+
|
|
318
|
+
The YAML mapping uses Redocly's source → rule → JSON-pointer structure:
|
|
319
|
+
|
|
320
|
+
```yaml
|
|
321
|
+
openapi.yaml:
|
|
322
|
+
info-description:
|
|
323
|
+
- '#/info'
|
|
324
|
+
```
|
|
203
325
|
|
|
204
|
-
|
|
326
|
+
Local source paths are relative to the baseline directory. Matching ignores message, severity, and line changes. Mounted reference paths are resolved to physical source pointers, including nested references; older Scalar baselines using native mount paths continue to match. Path-key findings use the key location to distinguish specific path entries. Root pointers use `#`; `/` and `~` in property names use RFC 6901 escaping. Numeric and string path segments with the same pointer identify the same location.
|
|
205
327
|
|
|
206
|
-
|
|
328
|
+
Generation records all current findings and exits successfully after writing the baseline. Generation serializes baseline reads and writes to preserve concurrent updates. A leftover `.lock` directory after an interrupted process must be removed only when no generator is running. Regeneration replaces only the selected input document's entries and preserves other inputs, including shared references. Scalar stores input ownership in a YAML comment (`scalar-owners`) that Redocly ignores. Keep that comment to retain shared-reference ownership; without it, imported entries belong to their source file. Manual edits to the mapping take precedence over comment metadata. Legacy Scalar version 1 baselines remain readable and are migrated to this mapping on regeneration.
|
|
207
329
|
|
|
208
|
-
|
|
330
|
+
Matched findings are omitted from reports. Only unmatched errors cause exit 1; warnings, information, and hints do not fail lint. Operational failures, malformed baselines, and missing explicitly selected baselines exit nonzero. A missing default baseline is allowed. Multiple findings at the same source/rule/pointer share one entry. Resolved entries remain harmless until regeneration but can suppress a recurrence; array reordering, document renames, or rule changes may produce new identities.
|
|
209
331
|
|
|
210
|
-
|
|
332
|
+
### Schema metadata
|
|
211
333
|
|
|
212
|
-
|
|
334
|
+
Use `scalar schema list --json` to discover schemas in the current team namespace, or pass `--namespace <namespace>` to choose one. The output is an array of objects with `namespace`, `slug`, `title`, `version`, and `isPrivate`. `version` is the latest semantic version, or `null` when there are no versions. An empty namespace returns `[]`. Schema content is omitted; use `scalar schema get` to download it.
|