Commit c1f3144
authored
chore(cli): consolidate small CliError migration branches (#15013)
## Description
Consolidates CliError migrations for multiple smaller CLI packages into a single PR: `@fern-api/init`, `@fern-api/project-loader`, `@fern-api/auth`, `@fern-api/api-workspace-validator`, `@fern-api/workspace-loader`, `@fern-api/docs-resolver`, `@fern-api/fern-definition-formatter`, `@fern-api/ir-to-jsonschema`, `@fern-api/login`, `@fern-api/api-workspace-commons`, and others.
This is one of the package migration PRs that follow the error classification system introduced in #14749.
## Changes Made
Assigned typed error codes across call sites in multiple smaller CLI packages. Also added missing `CliError` imports to all files that reference `CliError.Code`.
### Error codes used
| Code | Usage |
|------|-------|
| `CONFIG_ERROR` | Missing fern directory, invalid project structure, workspace configuration errors |
| `AUTH_ERROR` | Organization membership checks, user authentication, login flows |
| `NETWORK_ERROR` | API call failures, Auth0 device authorization errors |
| `VALIDATION_ERROR` | API workspace validation, docs validation |
| `PARSE_ERROR` | OpenAPI/AsyncAPI file loading failures, schema parsing errors |
| `REFERENCE_ERROR` | Unresolvable API references in docs |
| `VERSION_ERROR` | Version existence checks |
### Files touched (grouped by area)
- **Init**: `createFernDirectoryAndOrganization.ts`, `initializeWithMintlify.ts`, `initializeWithReadme.ts`
- **Project loader**: `loadProject.ts`
- **Auth**: `orgs/createOrganizationIfDoesNotExist.ts`, `users/getCurrentUser.ts`
- **Workspace**: `api-workspace-validator/validateAPIWorkspaceAndLogIssues.ts`, `loader/loadAsyncAPIFile.ts`, `loader/loadOpenAPIFile.ts`
- **Docs**: `docs-resolver/ApiReferenceNodeConverter.ts`
- **Fern definition**: `formatter/formatWorkspace.ts`, `ir-to-jsonschema/JsonSchemaConverterContext.ts`
- **Login**: `auth0-login/doAuth0DeviceAuthorizationFlow.ts`, `askToLogin.ts`
- **Commons**: `api-workspace-commons/checkVersionExists.ts`
## Testing
- [x] Existing tests pass (`pnpm test`, excluding e2e and pre-existing environment failures)1 parent 70a7da3 commit c1f3144
69 files changed
Lines changed: 479 additions & 184 deletions
File tree
- packages
- cli
- api-importers
- asyncapi-to-ir
- src/3.0/channel
- commons/src/utils
- conjure/conjure-to-fern
- src
- openapi/openapi-ir-to-fern/src
- utils
- v3-importer-commons
- src/utils
- cli/src
- commands
- docs-preview
- upgrade/migrations/__test__
- docs-importers
- commons/src
- mintlify/src
- readme/src
- utils
- files
- docs-preview/src
- docs-resolver/src
- utils
- fern-definition
- formatter/src
- ir-to-jsonschema/src
- validator/src/rules
- valid-pagination
- generation
- ir-generator-tests/src
- ir-migrations/src
- migrations
- v55-to-v54
- v63-to-v62
- init/src
- __test__
- library-docs-generator
- cpp/src/renderers
- src
- login/src
- auth0-login
- project-loader/src
- workspace
- api-workspace-validator/src
- browser-compatible-fern-workspace/src
- loader/src
- oss-validator/src/testing-utils
- yaml
- docs-validator/src
- rules/valid-markdown-link
- testing-utils
- generators-validator/src/rules/compatible-ir-versions
- loader
- src
- commons/api-workspace-commons/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | | - | |
342 | | - | |
343 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
286 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments