@redocly/cli 2.65.1 → 2.66.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 +5 -1
- package/THIRD_PARTY_NOTICES +1 -1
- package/lib/chunks/{3JAAMD2R.js → 36DQZK3T.js} +1 -1
- package/lib/chunks/{Q4UXM33T.js → 3XQNPUP7.js} +1 -1
- package/lib/chunks/{LLF5CY3L.js → 46YO7ZAG.js} +8 -8
- package/lib/chunks/{VAWGDT2W.js → 4ABWBH3W.js} +1 -1
- package/lib/chunks/{PTPIZYEL.js → 4WRQYZGD.js} +2 -2
- package/lib/chunks/{RC2SP4YD.js → 4WZNKPF4.js} +1 -1
- package/lib/chunks/{7XEJIRRE.js → 4Y4YV5TG.js} +1 -1
- package/lib/chunks/{6IEALFNR.js → 5DD7WY23.js} +1 -1
- package/lib/chunks/{LVTNHX3K.js → 5EHUKG3I.js} +1 -1
- package/lib/chunks/{TNOMHRE3.js → 6JHVGOS4.js} +1 -1
- package/lib/chunks/{PFDVXHFS.js → 6KF4UNVM.js} +1 -1
- package/lib/chunks/{5UVEGDN5.js → 7NPQH3V7.js} +1 -1
- package/lib/chunks/{7HX75VPL.js → AVUOPIXP.js} +1 -1
- package/lib/chunks/{K7YR4ZCE.js → B4Z2Z4FS.js} +1 -1
- package/lib/chunks/{F6CK2H55.js → BY6DKJ2R.js} +1 -1
- package/lib/chunks/{GPHT4S2M.js → CK2FG2DD.js} +1 -1
- package/lib/chunks/{4JADC334.js → DRSH6QBU.js} +1 -1
- package/lib/chunks/{QRGB7OHQ.js → E3YDJXL6.js} +1 -1
- package/lib/chunks/{UFQAPCO4.js → EDTY75R2.js} +1 -1
- package/lib/chunks/{YW65CIDB.js → EOXNJQ4F.js} +1 -1
- package/lib/chunks/{XLDZKMWY.js → EP53BWBM.js} +1 -1
- package/lib/chunks/ERBLCNSR.js +9 -0
- package/lib/chunks/{N7DGFIVS.js → F7K3O6UM.js} +1 -1
- package/lib/chunks/{Z4H5FLK2.js → FHDBQIEB.js} +1 -1
- package/lib/chunks/{SCSGALAM.js → FNQMGCDF.js} +1 -1
- package/lib/chunks/{PDRYPWBF.js → FOXOWXSK.js} +1 -1
- package/lib/chunks/{Y3UYQPDY.js → FP63LRP5.js} +1 -1
- package/lib/chunks/{2AC4OXSZ.js → FTPZZ6BG.js} +1 -1
- package/lib/chunks/{W7XDH65E.js → GLUPJCQU.js} +1 -1
- package/lib/chunks/HHCU6T2V.js +7 -0
- package/lib/chunks/{BM3HLVGR.js → HKVSCF3J.js} +1 -1
- package/lib/chunks/{ZHVZ22LO.js → HXPCC4OG.js} +1 -1
- package/lib/chunks/{AHV2L4AT.js → IAAYM25M.js} +1 -1
- package/lib/chunks/{SDI3BFVE.js → IH6TBN5D.js} +1 -1
- package/lib/chunks/{GY5LIRXF.js → ILGMLL46.js} +1 -1
- package/lib/chunks/{GJJKLLSJ.js → JGSM4NRA.js} +1 -1
- package/lib/chunks/{TWAEUQN5.js → JZPKVDJA.js} +1 -1
- package/lib/chunks/{YUBO3M45.js → K4IZRPJV.js} +77 -77
- package/lib/chunks/{PDOJBUHH.js → KOEA2NZG.js} +2 -2
- package/lib/chunks/{6O4EZZCB.js → L3SH4LDY.js} +1 -1
- package/lib/chunks/{NCJ56PXB.js → LJTGHAPA.js} +1 -1
- package/lib/chunks/{M6USEZHV.js → LSFJCPZH.js} +1 -1
- package/lib/chunks/{QET7LMPQ.js → M3VAMERP.js} +1 -1
- package/lib/chunks/{YMEXZJK4.js → MOGSSUQO.js} +1 -1
- package/lib/chunks/{WJHTYCZL.js → MOQAQ5M7.js} +1 -1
- package/lib/chunks/{EGRWOCUZ.js → NFCO7FU3.js} +1 -1
- package/lib/chunks/{XLPP6YHU.js → NHOPECWM.js} +1 -1
- package/lib/chunks/{YWLFGM2W.js → NUBOB7QM.js} +2 -2
- package/lib/chunks/{L7EAVWQA.js → OMDMN4SS.js} +1 -1
- package/lib/chunks/{GMPZCENU.js → ON2YZD5C.js} +1 -1
- package/lib/chunks/{QLVSL5ZF.js → OSFU2PWJ.js} +1 -1
- package/lib/chunks/{LMOHVXBG.js → OYDBXGWA.js} +1 -1
- package/lib/chunks/{M3F2P6PS.js → PBSA7HOV.js} +1 -1
- package/lib/chunks/{25STMLZM.js → PGX27JIK.js} +1 -1
- package/lib/chunks/{OAZXHMUB.js → PVBX7API.js} +1 -1
- package/lib/chunks/{Z3O5AH5W.js → Q7Y4MUA7.js} +1 -1
- package/lib/chunks/{XGUY3CME.js → QAEXHBKV.js} +1 -1
- package/lib/chunks/{HTZ66OYY.js → R3ZIINV3.js} +1 -1
- package/lib/chunks/{FTJ2GLND.js → RALPAYEE.js} +1 -1
- package/lib/chunks/{4ZSE2QKC.js → ROLEKKAB.js} +1 -1
- package/lib/chunks/{DLTGH5OY.js → TLDUEX6A.js} +1 -1
- package/lib/chunks/{VMZQPXC5.js → TOBKCE6P.js} +1 -1
- package/lib/chunks/{2IWPVA32.js → U5IK2ZXU.js} +1 -1
- package/lib/chunks/{5LDTRSKM.js → U7CHKSVN.js} +3 -3
- package/lib/chunks/{AVRP5K2W.js → USAJ5FBD.js} +1 -1
- package/lib/chunks/{2Y42T65U.js → UYF7BOSD.js} +1 -1
- package/lib/chunks/{76L5Y4E5.js → VL2MPFWQ.js} +1 -1
- package/lib/chunks/VOLUJUI5.js +7 -0
- package/lib/chunks/{Q3SW35UY.js → W2AAAE7A.js} +1 -1
- package/lib/chunks/{6OKAMFUS.js → WLLP4IZS.js} +1 -1
- package/lib/chunks/{KTG4J5LM.js → YCJL4ZHF.js} +1 -1
- package/lib/chunks/{XVSKACRN.js → YVEWM3DE.js} +1 -1
- package/lib/chunks/{5LKBZN75.js → YY44N7JX.js} +1 -1
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +1 -1
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/index.js +80 -70
- package/lib/skills/recheck-config/SKILL.md +116 -0
- package/lib/skills/recheck-lint/SKILL.md +73 -0
- package/lib/skills/redocly-cli/SKILL.md +214 -0
- package/lib/skills/redocly-lint-rules/SKILL.md +554 -0
- package/package.json +1 -1
- package/lib/chunks/GHSNC2OX.js +0 -9
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: recheck-config
|
|
3
|
+
description: Use when you create or tune the recheck block and recheck/* presets in redocly.yaml for a project — choose presets, set severities from measured counts, add exceptions, adopt a baseline, and validate the result.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configure recheck in redocly.yaml
|
|
7
|
+
|
|
8
|
+
Configure `redocly recheck` for a project the way its maintainers would: measure first, decide per rule, and record intent.
|
|
9
|
+
The documentation is at [redocly.com/docs/cli/recheck](https://redocly.com/docs/cli/recheck); favor it over memory for rule names and options.
|
|
10
|
+
|
|
11
|
+
## How the configuration is shaped
|
|
12
|
+
|
|
13
|
+
Presets go in the root `extends`.
|
|
14
|
+
Adjustments go in the `recheck` block, with rules nested under `rules`.
|
|
15
|
+
The `lint` command ignores both, so they live next to the API ruleset:
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
extends:
|
|
19
|
+
- recommended
|
|
20
|
+
- recheck/markdown
|
|
21
|
+
- recheck/prose
|
|
22
|
+
recheck:
|
|
23
|
+
excludes:
|
|
24
|
+
- CHANGELOG.md
|
|
25
|
+
rules:
|
|
26
|
+
recheck/line-length: off
|
|
27
|
+
recheck/no-duplicate-heading:
|
|
28
|
+
severity: warn
|
|
29
|
+
assertions:
|
|
30
|
+
no-duplicate-heading:
|
|
31
|
+
siblingsOnly: true
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Rules of the shape:
|
|
35
|
+
|
|
36
|
+
- A rule key is `<namespace>/<name>`: `recheck/line-length`, `google/no-via`, or your own, such as `acme/product-names`.
|
|
37
|
+
- A severity string (`off`, `info`, `warn`, `error`) adjusts a rule that a preset defines.
|
|
38
|
+
For a key no preset defines, it is a configuration error, because the rule has no assertions.
|
|
39
|
+
- A rule object merges over the preset's rule, but its `assertions` merge by assertion id: one option you set on a `swap` or `pattern` assertion replaces the preset's whole word list.
|
|
40
|
+
To reject one term from a preset's list, turn the rule off, restate the full list, or use an inline directive.
|
|
41
|
+
- A new prose rule needs `severity`, `message`, and `assertions`.
|
|
42
|
+
A new Markdown rule, such as `recheck/list-length`, needs only `severity` and `assertions`.
|
|
43
|
+
- The block does not accept `extends` or `baseline`; both are configuration errors.
|
|
44
|
+
- The command reads the root block only.
|
|
45
|
+
A `recheck` block under `apis.<name>` does nothing and prints a warning.
|
|
46
|
+
|
|
47
|
+
## Start a new config
|
|
48
|
+
|
|
49
|
+
1. Begin with the structural preset, and run recheck to validate it:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
extends:
|
|
53
|
+
- recheck/markdown
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx @redocly/cli recheck docs
|
|
58
|
+
npx @redocly/cli check-config
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The `recheck` command reports configuration errors before it lints anything, and `check-config` validates the block's shape.
|
|
62
|
+
|
|
63
|
+
2. Add prose presets deliberately, not wholesale.
|
|
64
|
+
`recheck/prose` is a small starter at `warn`.
|
|
65
|
+
`recheck/google` and `recheck/microsoft` are large style guides, detection-only, that need tuning before they help.
|
|
66
|
+
`recheck/plain-language`, `recheck/inclusive-language`, and `recheck/technical-english` compose onto either.
|
|
67
|
+
|
|
68
|
+
3. If the project writes Markdoc tags, add `recheck/markdoc` to `extends` and `markdoc: true` to the block.
|
|
69
|
+
Without the flag, the Markdoc rules never report.
|
|
70
|
+
|
|
71
|
+
## Tune severities from measurements, not taste
|
|
72
|
+
|
|
73
|
+
1. Run the whole document set and count findings per rule:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx @redocly/cli recheck docs --summary=json --summary-path=recheck-summary.json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The summary's `breakdown` has the count per rule and severity.
|
|
80
|
+
For examples of each rule's findings, run `--rule=<name>` and read a few.
|
|
81
|
+
|
|
82
|
+
2. Decide per rule from the counts:
|
|
83
|
+
- `error` — enforce now; the document set is clean or you fix it in the same change.
|
|
84
|
+
- `warn` — a worklist; visible, not blocking.
|
|
85
|
+
- `off` — decided against; keep a YAML comment that says why, or the decision is lost.
|
|
86
|
+
|
|
87
|
+
3. Prefer fixing content over configuring around it.
|
|
88
|
+
Run `--fix` first; most structural findings repair themselves.
|
|
89
|
+
Review the fix list before you commit: fixes that re-indent lines can move content out of an indented Markdoc tag body.
|
|
90
|
+
|
|
91
|
+
## Exceptions, in order of preference
|
|
92
|
+
|
|
93
|
+
1. Fix the content.
|
|
94
|
+
2. The top-level `excludes` list, or a rule's `excludes` or `appliesTo`, for generated or frozen content such as archives and vendored docs — with a comment naming the reason.
|
|
95
|
+
3. `exceptions.lines` for a recurring true positive that must stay as written.
|
|
96
|
+
4. An inline `<!-- recheck-disable-next-line rule-name -->` for a single line.
|
|
97
|
+
|
|
98
|
+
## Adopt strictness on a large document set with a baseline
|
|
99
|
+
|
|
100
|
+
When the document set has too many errors to fix at once, record them and gate only new ones:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx @redocly/cli recheck docs --generate-baseline
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Commit `.redocly.recheck-baseline.yaml`.
|
|
107
|
+
The command writes it next to `redocly.yaml`, and later runs pick it up by presence; there is no configuration key.
|
|
108
|
+
It records errors only, as one count per file per rule.
|
|
109
|
+
|
|
110
|
+
Counts only step down: when findings get fixed, the run reports stale entries, so regenerate the baseline and commit the diff.
|
|
111
|
+
|
|
112
|
+
## Finish
|
|
113
|
+
|
|
114
|
+
- `npx @redocly/cli recheck docs` and `npx @redocly/cli check-config` report no configuration errors.
|
|
115
|
+
- Every `off` and every exception carries a comment with its reason.
|
|
116
|
+
- The project's contributing docs say how contributors run recheck locally, and CI runs it with `--format=github-actions`.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: recheck-lint
|
|
3
|
+
description: Use when you write or edit Markdown in a project whose redocly.yaml has a recheck block or a recheck/* preset in extends — run redocly recheck on the touched files before you commit them or hand them over, and fix what it finds.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lint Markdown with recheck before you commit it
|
|
7
|
+
|
|
8
|
+
This project lints Markdown structure and prose with `redocly recheck`.
|
|
9
|
+
Your Markdown must pass it, the same as code must pass its tests.
|
|
10
|
+
|
|
11
|
+
## When this applies
|
|
12
|
+
|
|
13
|
+
Look for a `redocly.yaml` in the project root or above the files you touched.
|
|
14
|
+
This skill applies when that file has a `recheck` block, or a `recheck/*` preset in its root `extends`, for example:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
extends:
|
|
18
|
+
- recommended
|
|
19
|
+
- recheck/markdown
|
|
20
|
+
recheck:
|
|
21
|
+
rules:
|
|
22
|
+
recheck/line-length: off
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If neither exists, skip this skill.
|
|
26
|
+
The command checks nothing in that case and says so.
|
|
27
|
+
|
|
28
|
+
## What to do
|
|
29
|
+
|
|
30
|
+
1. After you write or edit Markdown files, run recheck on them:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @redocly/cli recheck <file-or-directory>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Pass the files you touched, not the whole repository, so the report is yours to act on.
|
|
37
|
+
|
|
38
|
+
2. If it reports errors, run the auto-fix first — most structural findings repair themselves:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx @redocly/cli recheck <file-or-directory> --fix
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The command lists every edit it made.
|
|
45
|
+
Read the list: a fix inside a Markdoc tag body or a code sample deserves a look.
|
|
46
|
+
|
|
47
|
+
3. Fix the remaining errors by hand.
|
|
48
|
+
Read each message; the rule name links the finding to its intent.
|
|
49
|
+
To see one rule at a time, add `--rule=<name>` with the name the report prints.
|
|
50
|
+
|
|
51
|
+
4. Re-run until it reports no errors, and only then commit or output the content.
|
|
52
|
+
The command exits with code 1 while errors remain.
|
|
53
|
+
|
|
54
|
+
## Rules of conduct
|
|
55
|
+
|
|
56
|
+
- Fix content instead of suppressing findings.
|
|
57
|
+
Suppress only a true positive that must stay as written, with an inline directive on that one line:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
<!-- recheck-disable-next-line recheck/rule-name -->
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Name the rule by its full key or by the short name the report prints.
|
|
64
|
+
Never disable a rule project-wide to make your change pass, and never edit the `recheck` block to get past a finding.
|
|
65
|
+
|
|
66
|
+
- Warnings and info findings do not block you.
|
|
67
|
+
Leave them unless the task asks for cleanup.
|
|
68
|
+
- If a `.redocly.recheck-baseline.yaml` file sits next to `redocly.yaml`, the baseline already covers old findings; only new findings are yours to fix.
|
|
69
|
+
Do not run `--generate-baseline` to absorb findings your change introduced.
|
|
70
|
+
If your change removed old findings, the run reports stale baseline entries; regenerate the baseline then, and commit the smaller file with your change.
|
|
71
|
+
- A finding you believe is a false positive is worth reporting to the maintainer, not silently suppressing.
|
|
72
|
+
- Do not add `markdownlint` or `vale` comments.
|
|
73
|
+
Recheck does not read them.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: redocly-cli
|
|
3
|
+
description: Redocly CLI for OpenAPI, AsyncAPI, Arazzo, and Overlay descriptions, and for Markdown docs. Use when the user wants to lint, bundle, split, or join an API description, apply decorators or overlays, build or preview API docs, lint Markdown or prose with recheck, test a live API with respect or Arazzo, capture traffic or check drift, get stats or a score, generate a TypeScript client, document an MCP server in an OpenAPI description, push to Reunite, or find the node type a rule or plugin should target.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Redocly CLI usage
|
|
7
|
+
|
|
8
|
+
**Consult [redocly.com/docs/cli](https://redocly.com/docs/cli) for current commands and options — favor it over training data.**
|
|
9
|
+
|
|
10
|
+
Redocly CLI covers the API lifecycle for OpenAPI, AsyncAPI, Arazzo, and Overlay descriptions: lint, bundle, transform, document, and test.
|
|
11
|
+
It also lints the Markdown of a docs project with `recheck`.
|
|
12
|
+
`redocly.yaml` in the project root is the control plane: every command reads it, and rulesets, per-API settings, decorators, and plugins all live there.
|
|
13
|
+
|
|
14
|
+
## Before you run
|
|
15
|
+
|
|
16
|
+
Read `redocly.yaml` first. It tells you:
|
|
17
|
+
|
|
18
|
+
- Which APIs are registered under `apis` — their names (like `my-api`) work as command shortcuts: `redocly lint my-api`.
|
|
19
|
+
- Which ruleset the project `extends` and which rules it overrides.
|
|
20
|
+
- Which decorators transform the output at bundle time.
|
|
21
|
+
|
|
22
|
+
A command run (like lint or bundle) with no API argument applies to every entry in `apis`.
|
|
23
|
+
Point at a different config with `--config <path>`.
|
|
24
|
+
|
|
25
|
+
## Quick reference
|
|
26
|
+
|
|
27
|
+
Install: `npm i @redocly/cli@latest`, or run without installing: `npx @redocly/cli@latest <command>`. Docker image: `redocly/cli`.
|
|
28
|
+
|
|
29
|
+
| Command | Purpose | Group |
|
|
30
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------- |
|
|
31
|
+
| `lint` | Validate an API description against the configured rules | API authoring |
|
|
32
|
+
| `split` | Break a single-file description into a multi-file structure | API authoring |
|
|
33
|
+
| `introspect-mcp` | Record a live MCP server's tools, prompts, and resources in `x-mcp` [experimental] | API authoring |
|
|
34
|
+
| `build-docs` | Render an API description to a zero-dependency HTML page (Redoc) | Docs rendering |
|
|
35
|
+
| `preview` | Local preview of a Redocly project (Realm, Reef, Revel) | Docs rendering |
|
|
36
|
+
| `recheck` | Lint Markdown structure, prose style, and Markdoc tags; `--fix` repairs most structural findings | Docs linting |
|
|
37
|
+
| `bundle` | Resolve all `$ref`s into one self-contained file; apply decorators and overlays | CI and delivery |
|
|
38
|
+
| `join` | Merge several API descriptions into one [experimental] | CI and delivery |
|
|
39
|
+
| `respect` | Run API tests described in an Arazzo description against a live API | API testing and drift |
|
|
40
|
+
| `generate-arazzo` | Scaffold an Arazzo description from an OpenAPI description | API testing and drift |
|
|
41
|
+
| `proxy` | Capture live HTTP traffic into a HAR file, with optional validation [experimental] | API testing and drift |
|
|
42
|
+
| `drift` | Report differences between recorded traffic and an OpenAPI description, with optional `--coverage` [experimental] | API testing and drift |
|
|
43
|
+
| `generate-spec` | Infer an OpenAPI 3.2 description from recorded traffic; `--openapi-version 3.1` targets 3.1 [experimental] | API testing and drift |
|
|
44
|
+
| `stats` | Count operations, schemas, refs, and other metrics | Quality reports |
|
|
45
|
+
| `score` | Score an OpenAPI description for AI-agent readiness [experimental] | Quality reports |
|
|
46
|
+
| `generate-client` | Generate a typed, zero-dependency TypeScript client [experimental] | SDK generation |
|
|
47
|
+
| `eject-generator` | Copy a built-in generator into the repo to edit it [experimental] | SDK generation |
|
|
48
|
+
| `check-config` | Lint `redocly.yaml` itself | Redocly configuration |
|
|
49
|
+
| `inspect-node-types` | Show the node type at a pointer, or list every node with its type [experimental] | Redocly configuration |
|
|
50
|
+
| `push` | Push an API description to Reunite | Reunite platform |
|
|
51
|
+
| `push-status` | Track an in-progress push to Reunite | Reunite platform |
|
|
52
|
+
| `skills` | Install the Redocly CLI agent skills into `.agents/skills/` and detected agent folders | Agent setup |
|
|
53
|
+
| `completion` | Generate shell autocomplete commands | Shell setup |
|
|
54
|
+
|
|
55
|
+
Exit codes: `0` success, `1` problems found or execution failed, `2` configuration error.
|
|
56
|
+
|
|
57
|
+
## Configure with redocly.yaml
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
extends:
|
|
61
|
+
- recommended # or: minimal, recommended-strict, spec
|
|
62
|
+
|
|
63
|
+
apis:
|
|
64
|
+
my-api:
|
|
65
|
+
root: ./openapi/openapi.yaml
|
|
66
|
+
rules:
|
|
67
|
+
no-ambiguous-paths: error # per-API override
|
|
68
|
+
decorators:
|
|
69
|
+
remove-x-internal: on # applies to this API only
|
|
70
|
+
|
|
71
|
+
rules:
|
|
72
|
+
info-license: off
|
|
73
|
+
operation-operationId: error
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`extends` sets the base ruleset; later `rules`, `preprocessors`, and `decorators` in the same file override it.
|
|
77
|
+
Rule severities: `error` (fails validation), `warn` (reported, still valid), `off`.
|
|
78
|
+
|
|
79
|
+
### Configurable rules
|
|
80
|
+
|
|
81
|
+
When a governance requirement has no built-in rule, declare one under `rule/<name>` in `redocly.yaml`.
|
|
82
|
+
Use the `redocly-lint-rules` skill for that: it picks the cheapest rung (built-in, configurable rule, or custom plugin), takes node types from `redocly inspect-node-types`, and verifies the rule against fixtures.
|
|
83
|
+
|
|
84
|
+
## Lint Markdown with recheck
|
|
85
|
+
|
|
86
|
+
`recheck <paths>` lints the Markdown files under the given paths for structure (the markdownlint rule set), prose (banned terms, spelling, heading case, sentence length, readability), and Markdoc tag syntax.
|
|
87
|
+
Presets go in the root `extends` and adjustments in the `recheck` block; the `lint` command ignores both:
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
extends:
|
|
91
|
+
- recommended
|
|
92
|
+
- recheck/markdown # every markdownlint rule; also recheck/prose, recheck/markdoc, recheck/google, recheck/microsoft
|
|
93
|
+
recheck:
|
|
94
|
+
excludes: [CHANGELOG.md]
|
|
95
|
+
rules:
|
|
96
|
+
recheck/line-length: off
|
|
97
|
+
acme/no-via:
|
|
98
|
+
severity: warn
|
|
99
|
+
scope: sentence
|
|
100
|
+
message: 'Use "through" instead of "via".'
|
|
101
|
+
assertions:
|
|
102
|
+
pattern: { ignoreCase: true, tokens: ['\bvia\b'] }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
With no `redocly.yaml`, the command uses `recheck/markdown`.
|
|
106
|
+
With a `redocly.yaml` that has neither a preset nor a block, it checks nothing.
|
|
107
|
+
For a path that is an API description, or an alias from `apis`, the command lints the `description` fields of that API.
|
|
108
|
+
An existing file or folder wins over an alias with the same name.
|
|
109
|
+
Useful flags: `--fix`, `--rule=<name>` to work one rule at a time, `--format=github-actions|json|sarif`, `--max-problems=<n>`, `--generate-baseline` to record existing errors in `.redocly.recheck-baseline.yaml` and fail only on new ones, and `--readability` for per-file scores.
|
|
110
|
+
Silence one line with `<!-- recheck-disable-next-line <rule> -->` rather than turning the rule off.
|
|
111
|
+
The `recheck-lint` skill covers running it on touched files, and `recheck-config` covers tuning the block.
|
|
112
|
+
|
|
113
|
+
## Transform with decorators
|
|
114
|
+
|
|
115
|
+
Decorators rewrite the description at bundle time — `lint` checks the source as written; `bundle`, `build-docs`, and `push` see the decorated output.
|
|
116
|
+
Built-ins include `remove-x-internal`, `filter-in` / `filter-out`, `info-override`, `remove-unused-components`, and the `*-description-override` family.
|
|
117
|
+
|
|
118
|
+
## Apply overlays
|
|
119
|
+
|
|
120
|
+
`bundle` applies Overlay 1.0, 1.1, and 1.2 files to the bundled description, before decorators: pass `--overlay <file>` (repeatable, applied in order), or list them under `overlays` in an `apis` entry, with paths relative to `redocly.yaml`.
|
|
121
|
+
`--overlay` replaces the configured list.
|
|
122
|
+
Action targets run against the bundled output, so check them against `redocly bundle <api>` without overlays; a target that matches nothing changes nothing and isn't reported.
|
|
123
|
+
File `$ref`s in overlay values are relative to the overlay file and get bundled; decorators such as `remove-x-internal` see the overlay's changes.
|
|
124
|
+
Two `apis` entries with the same `root` and different `overlays` and `output` publish two versions of one API.
|
|
125
|
+
|
|
126
|
+
## Extend with custom plugins
|
|
127
|
+
|
|
128
|
+
When configurable rules and built-in decorators can't express the requirement, escalate to a [custom plugin](https://redocly.com/docs/cli/custom-plugins): a JavaScript module exporting rules, decorators, preprocessors, or config, keyed by document format:
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
export default function myPlugin() {
|
|
132
|
+
return {
|
|
133
|
+
id: 'my-plugin',
|
|
134
|
+
rules: {
|
|
135
|
+
oas3: {
|
|
136
|
+
'operation-id-not-test': () => ({
|
|
137
|
+
Operation(operation, { report, location }) {
|
|
138
|
+
if (operation.operationId === 'test') {
|
|
139
|
+
report({ message: 'operationId must not be "test".', location });
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Visitor keys are node types: confirm them with `redocly inspect-node-types <api>`.
|
|
150
|
+
Register it in `redocly.yaml` (paths relative to the config file) and reference its rules as `<plugin-id>/<rule-name>`:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
plugins:
|
|
154
|
+
- ./plugins/my-plugin.js
|
|
155
|
+
rules:
|
|
156
|
+
my-plugin/operation-id-not-test: error
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Generate a TypeScript client
|
|
160
|
+
|
|
161
|
+
`generate-client <api> --output client.ts` turns an OpenAPI description into a typed client — one self-contained file with zero runtime dependencies (auth, retries, middleware, typed SSE, pagination included).
|
|
162
|
+
Configure it durably under a `client` block in `redocly.yaml` instead of flags:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
client:
|
|
166
|
+
generators: [typescript, zod] # add-ons: tanstack-query, swr, mock, transformers, or a plugin path
|
|
167
|
+
outputMode: split
|
|
168
|
+
pagination: # config-only, no CLI flag
|
|
169
|
+
style: cursor
|
|
170
|
+
cursorParam: after
|
|
171
|
+
nextCursor: /page/endCursor
|
|
172
|
+
items: /items
|
|
173
|
+
apis:
|
|
174
|
+
my-api:
|
|
175
|
+
root: ./openapi/openapi.yaml
|
|
176
|
+
clientOutput: ./src/api/client.ts
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
With `apis.<name>.clientOutput` set, a bare `redocly generate-client` generates every opted-in API.
|
|
180
|
+
`client.telemetry: on` (config-only) makes the `typescript` generator also write `<output>.telemetry.ts`: register `use(telemetry({ sdkName, sdkVersion, client }))` to count calls per operation and send the counts once a minute (no request data; `REDOCLY_SDK_TELEMETRY=off` or `DO_NOT_TRACK=1` turns sending off).
|
|
181
|
+
An API's own `client` block replaces the top-level one wholesale — repeat the shared fields in it.
|
|
182
|
+
With `client.codeSamples: true`, it also writes `<output>.code-samples.yaml`, an overlay that adds `x-codeSamples`; add it to the API's `overlays` (or pass `--overlay`) so `bundle` puts the samples in the description.
|
|
183
|
+
|
|
184
|
+
## Test a live API
|
|
185
|
+
|
|
186
|
+
`respect` executes an [Arazzo](https://spec.openapis.org/arazzo/latest.html) description as a test suite against a running API, asserting real responses match the description.
|
|
187
|
+
Start from `generate-arazzo <openapi>` to scaffold the workflows, then refine the steps and success criteria by hand.
|
|
188
|
+
|
|
189
|
+
## Workflow
|
|
190
|
+
|
|
191
|
+
1. Read `redocly.yaml` to learn the registered APIs, ruleset, and decorators.
|
|
192
|
+
2. Make the change — spec edit, rule config, or decorator.
|
|
193
|
+
3. Verify:
|
|
194
|
+
- `redocly lint` exits `0` (or reports only warnings you expected).
|
|
195
|
+
- After editing Markdown in a project with a `recheck` block or preset: `redocly recheck <files>` exits `0`.
|
|
196
|
+
- After editing `redocly.yaml`: `redocly check-config` reports no problems.
|
|
197
|
+
- After changing `$ref` structure or decorators: `redocly bundle -o /tmp/bundled.yaml` succeeds and the output contains what you intended.
|
|
198
|
+
|
|
199
|
+
## Gotchas
|
|
200
|
+
|
|
201
|
+
- v2 is ESM-only: Node.js v22.12.0+ (or v20.19.0+).
|
|
202
|
+
- `bundle` and `join` differ: `bundle` collapses one multi-file API into one file; `join` merges separate APIs into one description.
|
|
203
|
+
- `respect` currently covers only synchronous HTTP flow.
|
|
204
|
+
- Any `redocly.yaml` in the working directory configures every command — a stray one changes lint results silently.
|
|
205
|
+
- `--extends` on the command line sets the base ruleset for that run; useful for a quick `--extends=spec` conformance check.
|
|
206
|
+
- `generate-client` needs the `typescript` package (6.x) available at generation time; the generated client itself compiles with any TypeScript, including 7.
|
|
207
|
+
|
|
208
|
+
## Resources
|
|
209
|
+
|
|
210
|
+
- [Command reference](https://redocly.com/docs/cli/commands)
|
|
211
|
+
- [Built-in rules](https://redocly.com/docs/cli/rules)
|
|
212
|
+
- [Decorators](https://redocly.com/docs/cli/decorators)
|
|
213
|
+
- [Configuration](https://redocly.com/docs/cli/configuration)
|
|
214
|
+
- [Markdown and prose linting](https://redocly.com/docs/cli/recheck)
|