@fern-api/generator-cli 0.5.2 → 0.6.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/dist/api.d.ts +418 -341
- package/dist/api.js +22438 -8264
- package/dist/cli.js +28232 -13572
- package/lib/api.js +9 -0
- package/package.json +21 -12
package/dist/api.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { BootstrapResult, ReplayReport } from '@fern-api/replay';
|
|
2
|
+
export { ConflictDetail, ReplayReport } from '@fern-api/replay';
|
|
1
3
|
import fs from 'fs';
|
|
2
4
|
|
|
3
|
-
/**
|
|
4
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* A unique identifier for a feature (e.g. OPTIONALS). This is typed as a freeform string
|
|
9
7
|
* to allow for arbitrary features, but callers are expected to use the StructuredFeatureId
|
|
@@ -12,13 +10,19 @@ import fs from 'fs';
|
|
|
12
10
|
type FeatureId = string | StructuredFeatureId;
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Unique identifiers for features that can be demonstrated with snippets.
|
|
13
|
+
* A specification for a feature supported by a generator. This includes the
|
|
14
|
+
* feature's ID, a description, and any additional information that should be
|
|
15
|
+
* included in the README.md.
|
|
19
16
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
interface FeatureSpec {
|
|
18
|
+
id: FeatureId;
|
|
19
|
+
description?: string;
|
|
20
|
+
addendum?: string;
|
|
21
|
+
advanced?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Unique identifiers for features that can be demonstrated with snippets. */
|
|
25
|
+
declare const StructuredFeatureIdValues: {
|
|
22
26
|
readonly Authentication: "AUTHENTICATION";
|
|
23
27
|
readonly Errors: "ERRORS";
|
|
24
28
|
readonly Usage: "USAGE";
|
|
@@ -29,7 +33,10 @@ declare const StructuredFeatureId: {
|
|
|
29
33
|
readonly Timeouts: "TIMEOUTS";
|
|
30
34
|
readonly CustomClient: "CUSTOM_CLIENT";
|
|
31
35
|
readonly Contributing: "CONTRIBUTING";
|
|
32
|
-
|
|
36
|
+
};
|
|
37
|
+
type StructuredFeatureId = (typeof StructuredFeatureIdValues)[keyof typeof StructuredFeatureIdValues];
|
|
38
|
+
declare const StructuredFeatureId: typeof StructuredFeatureIdValues & {
|
|
39
|
+
_visit: <R>(value: StructuredFeatureId, visitor: StructuredFeatureId.Visitor<R>) => R;
|
|
33
40
|
};
|
|
34
41
|
declare namespace StructuredFeatureId {
|
|
35
42
|
interface Visitor<R> {
|
|
@@ -47,25 +54,6 @@ declare namespace StructuredFeatureId {
|
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
/**
|
|
51
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A specification for a feature supported by a generator. This includes the
|
|
56
|
-
* feature's ID, a description, and any additional information that should be
|
|
57
|
-
* included in the README.md.
|
|
58
|
-
*/
|
|
59
|
-
interface FeatureSpec {
|
|
60
|
-
id: FeatureId;
|
|
61
|
-
description?: string;
|
|
62
|
-
addendum?: string;
|
|
63
|
-
advanced?: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
68
|
-
*/
|
|
69
57
|
/**
|
|
70
58
|
* The configuration used to interact with a GitHub repository.
|
|
71
59
|
*/
|
|
@@ -80,42 +68,30 @@ interface GitHubConfig {
|
|
|
80
68
|
branch?: string;
|
|
81
69
|
}
|
|
82
70
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
interface CargoPublishInfo {
|
|
72
|
+
packageName: string;
|
|
73
|
+
version: string;
|
|
74
|
+
}
|
|
86
75
|
|
|
87
76
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* (i.e. specified in the generators.yml), and dynamically generated information
|
|
91
|
-
* that comes from each generator (i.e. features, requirements, and more).
|
|
77
|
+
* A code snippet that will be wrapped in a code fence with the specified language.
|
|
78
|
+
* If no language is specified, the generator's language will be used.
|
|
92
79
|
*/
|
|
93
|
-
interface
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
bannerLink?: string;
|
|
100
|
-
introduction?: string;
|
|
101
|
-
apiReferenceLink?: string;
|
|
102
|
-
referenceMarkdownPath?: string;
|
|
103
|
-
requirements?: string[];
|
|
104
|
-
disabledFeatures?: FeatureId[];
|
|
105
|
-
whiteLabel?: boolean;
|
|
106
|
-
customSections?: CustomSection[];
|
|
107
|
-
/**
|
|
108
|
-
* Specifies the list of features supported by a specific generator.
|
|
109
|
-
* The features are rendered in the order they're specified.
|
|
110
|
-
*/
|
|
111
|
-
features?: ReadmeFeature[];
|
|
112
|
-
/** Controls whether usage examples show only required parameters (minimal) or all parameters (comprehensive). Defaults to comprehensive. */
|
|
113
|
-
exampleStyle?: ExampleStyle;
|
|
80
|
+
interface CodeSnippet {
|
|
81
|
+
/** Discriminator field to identify this as a code snippet. */
|
|
82
|
+
type: "code";
|
|
83
|
+
content: string;
|
|
84
|
+
/** The language for the code fence. If not specified, the generator's language will be used. */
|
|
85
|
+
language?: string;
|
|
114
86
|
}
|
|
115
87
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
88
|
+
interface ComposerPublishInfo {
|
|
89
|
+
packageName: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface CsharpInfo {
|
|
93
|
+
publishInfo?: NugetPublishInfo;
|
|
94
|
+
}
|
|
119
95
|
|
|
120
96
|
interface CustomSection {
|
|
121
97
|
name: string;
|
|
@@ -123,36 +99,23 @@ interface CustomSection {
|
|
|
123
99
|
content: string;
|
|
124
100
|
}
|
|
125
101
|
|
|
126
|
-
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
interface _Visitor<_Result> {
|
|
142
|
-
github: (value: GithubRemote) => _Result;
|
|
143
|
-
_other: (value: {
|
|
144
|
-
type: string;
|
|
145
|
-
}) => _Result;
|
|
102
|
+
/** Controls the verbosity of usage examples in README generation */
|
|
103
|
+
declare const ExampleStyleValues: {
|
|
104
|
+
readonly Minimal: "minimal";
|
|
105
|
+
readonly Comprehensive: "comprehensive";
|
|
106
|
+
};
|
|
107
|
+
type ExampleStyle = (typeof ExampleStyleValues)[keyof typeof ExampleStyleValues];
|
|
108
|
+
declare const ExampleStyle: typeof ExampleStyleValues & {
|
|
109
|
+
_visit: <R>(value: ExampleStyle, visitor: ExampleStyle.Visitor<R>) => R;
|
|
110
|
+
};
|
|
111
|
+
declare namespace ExampleStyle {
|
|
112
|
+
interface Visitor<R> {
|
|
113
|
+
minimal: () => R;
|
|
114
|
+
comprehensive: () => R;
|
|
115
|
+
_other: () => R;
|
|
146
116
|
}
|
|
147
117
|
}
|
|
148
|
-
declare const Remote: {
|
|
149
|
-
readonly github: (value: GithubRemote) => Remote.Github;
|
|
150
|
-
readonly _visit: <_Result>(value: Remote, visitor: Remote._Visitor<_Result>) => _Result;
|
|
151
|
-
};
|
|
152
118
|
|
|
153
|
-
/**
|
|
154
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
155
|
-
*/
|
|
156
119
|
interface GithubRemote {
|
|
157
120
|
/** A full repo url (i.e. https://github.com/fern-api/fern) */
|
|
158
121
|
repoUrl: string;
|
|
@@ -162,65 +125,20 @@ interface GithubRemote {
|
|
|
162
125
|
branch?: string;
|
|
163
126
|
}
|
|
164
127
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* A single feature supported by a generator (e.g. PAGINATION).
|
|
171
|
-
*/
|
|
172
|
-
interface ReadmeFeature extends FeatureSpec {
|
|
173
|
-
snippets?: Snippet[];
|
|
174
|
-
/**
|
|
175
|
-
* If true, the feature block should be rendered even if we don't receive a snippet for it.
|
|
176
|
-
* This is useful for features that are always supported, but might not require a snippet
|
|
177
|
-
* to explain.
|
|
178
|
-
*/
|
|
179
|
-
snippetsAreOptional: boolean;
|
|
128
|
+
interface GoInfo {
|
|
129
|
+
publishInfo?: GoPublishInfo;
|
|
180
130
|
}
|
|
181
131
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* A snippet that can be either a plain string (treated as code in the generator's language),
|
|
188
|
-
* markdown content, or a code block with optional language override.
|
|
189
|
-
* Plain strings are supported for backwards compatibility.
|
|
190
|
-
*/
|
|
191
|
-
type Snippet = string | MarkdownSnippet | CodeSnippet;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
195
|
-
*/
|
|
196
|
-
/**
|
|
197
|
-
* A markdown snippet that will be rendered as-is without code fences.
|
|
198
|
-
*/
|
|
199
|
-
interface MarkdownSnippet {
|
|
200
|
-
/** Discriminator field to identify this as a markdown snippet. */
|
|
201
|
-
type: "markdown";
|
|
202
|
-
content: string;
|
|
132
|
+
interface GoPublishInfo {
|
|
133
|
+
owner: string;
|
|
134
|
+
repo: string;
|
|
135
|
+
version: string;
|
|
203
136
|
}
|
|
204
137
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
*/
|
|
208
|
-
/**
|
|
209
|
-
* A code snippet that will be wrapped in a code fence with the specified language.
|
|
210
|
-
* If no language is specified, the generator's language will be used.
|
|
211
|
-
*/
|
|
212
|
-
interface CodeSnippet {
|
|
213
|
-
/** Discriminator field to identify this as a code snippet. */
|
|
214
|
-
type: "code";
|
|
215
|
-
content: string;
|
|
216
|
-
/** The language for the code fence. If not specified, the generator's language will be used. */
|
|
217
|
-
language?: string;
|
|
138
|
+
interface JavaInfo {
|
|
139
|
+
publishInfo?: MavenPublishInfo;
|
|
218
140
|
}
|
|
219
141
|
|
|
220
|
-
/**
|
|
221
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
142
|
/**
|
|
225
143
|
* The language and its associated publish information (if any).
|
|
226
144
|
* This is used to generate badges, the installation guide, and determine what language to
|
|
@@ -287,206 +205,137 @@ declare const LanguageInfo: {
|
|
|
287
205
|
};
|
|
288
206
|
|
|
289
207
|
/**
|
|
290
|
-
*
|
|
291
|
-
*/
|
|
292
|
-
|
|
293
|
-
interface TypescriptInfo {
|
|
294
|
-
publishInfo?: NpmPublishInfo;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
interface PythonInfo {
|
|
302
|
-
publishInfo?: PypiPublishInfo;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
208
|
+
* A markdown snippet that will be rendered as-is without code fences.
|
|
307
209
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
210
|
+
interface MarkdownSnippet {
|
|
211
|
+
/** Discriminator field to identify this as a markdown snippet. */
|
|
212
|
+
type: "markdown";
|
|
213
|
+
content: string;
|
|
311
214
|
}
|
|
312
215
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
interface JavaInfo {
|
|
318
|
-
publishInfo?: MavenPublishInfo;
|
|
216
|
+
interface MavenPublishInfo {
|
|
217
|
+
artifact: string;
|
|
218
|
+
group: string;
|
|
219
|
+
version: string;
|
|
319
220
|
}
|
|
320
221
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
interface RubyInfo {
|
|
326
|
-
publishInfo?: RubyGemsPublishInfo;
|
|
222
|
+
interface NpmPublishInfo {
|
|
223
|
+
packageName: string;
|
|
327
224
|
}
|
|
328
225
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
interface CsharpInfo {
|
|
334
|
-
publishInfo?: NugetPublishInfo;
|
|
226
|
+
interface NugetPublishInfo {
|
|
227
|
+
packageName: string;
|
|
335
228
|
}
|
|
336
229
|
|
|
337
|
-
/**
|
|
338
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
230
|
interface PhpInfo {
|
|
342
231
|
publishInfo?: ComposerPublishInfo;
|
|
343
232
|
}
|
|
344
233
|
|
|
345
|
-
/**
|
|
346
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
interface RustInfo {
|
|
350
|
-
publishInfo?: CargoPublishInfo;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
355
|
-
*/
|
|
356
|
-
|
|
357
|
-
interface SwiftInfo {
|
|
358
|
-
publishInfo?: SwiftPackageManagerPublishInfo;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
363
|
-
*/
|
|
364
|
-
interface ComposerPublishInfo {
|
|
365
|
-
packageName: string;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
370
|
-
*/
|
|
371
|
-
interface NpmPublishInfo {
|
|
372
|
-
packageName: string;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
377
|
-
*/
|
|
378
234
|
interface PypiPublishInfo {
|
|
379
235
|
packageName: string;
|
|
380
236
|
}
|
|
381
237
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
*/
|
|
385
|
-
interface GoPublishInfo {
|
|
386
|
-
owner: string;
|
|
387
|
-
repo: string;
|
|
388
|
-
version: string;
|
|
238
|
+
interface PythonInfo {
|
|
239
|
+
publishInfo?: PypiPublishInfo;
|
|
389
240
|
}
|
|
390
241
|
|
|
391
242
|
/**
|
|
392
|
-
*
|
|
243
|
+
* The configuration used to generate a README.md file.
|
|
244
|
+
* The information described here is a combination of user-defined information
|
|
245
|
+
* (i.e. specified in the generators.yml), and dynamically generated information
|
|
246
|
+
* that comes from each generator (i.e. features, requirements, and more).
|
|
393
247
|
*/
|
|
394
|
-
interface
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
248
|
+
interface ReadmeConfig {
|
|
249
|
+
/** If specified, the original README.md will be fetched from this remote (if it exists). */
|
|
250
|
+
remote?: Remote;
|
|
251
|
+
language: LanguageInfo;
|
|
252
|
+
organization: string;
|
|
253
|
+
apiName?: string;
|
|
254
|
+
bannerLink?: string;
|
|
255
|
+
introduction?: string;
|
|
256
|
+
apiReferenceLink?: string;
|
|
257
|
+
referenceMarkdownPath?: string;
|
|
258
|
+
requirements?: string[];
|
|
259
|
+
disabledFeatures?: FeatureId[];
|
|
260
|
+
whiteLabel?: boolean;
|
|
261
|
+
customSections?: CustomSection[];
|
|
262
|
+
/**
|
|
263
|
+
* Specifies the list of features supported by a specific generator.
|
|
264
|
+
* The features are rendered in the order they're specified.
|
|
265
|
+
*/
|
|
266
|
+
features?: ReadmeFeature[];
|
|
267
|
+
/** Controls whether usage examples show only required parameters (minimal) or all parameters (comprehensive). Defaults to comprehensive. */
|
|
268
|
+
exampleStyle?: ExampleStyle;
|
|
398
269
|
}
|
|
399
270
|
|
|
400
271
|
/**
|
|
401
|
-
*
|
|
272
|
+
* A single feature supported by a generator (e.g. PAGINATION).
|
|
402
273
|
*/
|
|
403
|
-
interface
|
|
404
|
-
|
|
274
|
+
interface ReadmeFeature extends FeatureSpec {
|
|
275
|
+
snippets?: Snippet[];
|
|
276
|
+
/**
|
|
277
|
+
* If true, the feature block should be rendered even if we don't receive a snippet for it.
|
|
278
|
+
* This is useful for features that are always supported, but might not require a snippet
|
|
279
|
+
* to explain.
|
|
280
|
+
*/
|
|
281
|
+
snippetsAreOptional: boolean;
|
|
405
282
|
}
|
|
406
283
|
|
|
407
284
|
/**
|
|
408
|
-
*
|
|
285
|
+
* The remote where the README.md is hosted.
|
|
409
286
|
*/
|
|
410
|
-
|
|
411
|
-
|
|
287
|
+
type Remote = Remote.Github;
|
|
288
|
+
declare namespace Remote {
|
|
289
|
+
interface Github extends GithubRemote, _Utils {
|
|
290
|
+
type: "github";
|
|
291
|
+
}
|
|
292
|
+
interface _Utils {
|
|
293
|
+
_visit: <_Result>(visitor: Remote._Visitor<_Result>) => _Result;
|
|
294
|
+
}
|
|
295
|
+
interface _Visitor<_Result> {
|
|
296
|
+
github: (value: GithubRemote) => _Result;
|
|
297
|
+
_other: (value: {
|
|
298
|
+
type: string;
|
|
299
|
+
}) => _Result;
|
|
300
|
+
}
|
|
412
301
|
}
|
|
302
|
+
declare const Remote: {
|
|
303
|
+
readonly github: (value: GithubRemote) => Remote.Github;
|
|
304
|
+
readonly _visit: <_Result>(value: Remote, visitor: Remote._Visitor<_Result>) => _Result;
|
|
305
|
+
};
|
|
413
306
|
|
|
414
|
-
|
|
415
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
416
|
-
*/
|
|
417
|
-
interface CargoPublishInfo {
|
|
307
|
+
interface RubyGemsPublishInfo {
|
|
418
308
|
packageName: string;
|
|
419
|
-
version: string;
|
|
420
309
|
}
|
|
421
310
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
*/
|
|
425
|
-
interface SwiftPackageManagerPublishInfo {
|
|
426
|
-
gitUrl: string;
|
|
427
|
-
minVersion: string;
|
|
311
|
+
interface RubyInfo {
|
|
312
|
+
publishInfo?: RubyGemsPublishInfo;
|
|
428
313
|
}
|
|
429
314
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
*/
|
|
433
|
-
/**
|
|
434
|
-
* Controls the verbosity of usage examples in README generation
|
|
435
|
-
*/
|
|
436
|
-
type ExampleStyle = "minimal" | "comprehensive";
|
|
437
|
-
declare const ExampleStyle: {
|
|
438
|
-
readonly Minimal: "minimal";
|
|
439
|
-
readonly Comprehensive: "comprehensive";
|
|
440
|
-
readonly _visit: <R>(value: ExampleStyle, visitor: ExampleStyle.Visitor<R>) => R;
|
|
441
|
-
};
|
|
442
|
-
declare namespace ExampleStyle {
|
|
443
|
-
interface Visitor<R> {
|
|
444
|
-
minimal: () => R;
|
|
445
|
-
comprehensive: () => R;
|
|
446
|
-
_other: () => R;
|
|
447
|
-
}
|
|
315
|
+
interface RustInfo {
|
|
316
|
+
publishInfo?: CargoPublishInfo;
|
|
448
317
|
}
|
|
449
318
|
|
|
450
319
|
/**
|
|
451
|
-
*
|
|
320
|
+
* A snippet that can be either a plain string (treated as code in the generator's language),
|
|
321
|
+
* markdown content, or a code block with optional language override.
|
|
322
|
+
* Plain strings are supported for backwards compatibility.
|
|
452
323
|
*/
|
|
324
|
+
type Snippet = string | MarkdownSnippet | CodeSnippet;
|
|
453
325
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
* The information here should really be all defined by the generator, and not user provided.
|
|
457
|
-
* We intentionally keep this a bit flexible in the event SDKs structure their package/module
|
|
458
|
-
* references in a unique way for the same API.
|
|
459
|
-
*/
|
|
460
|
-
interface ReferenceConfig {
|
|
461
|
-
rootSection?: RootPackageReferenceSection;
|
|
462
|
-
sections: ReferenceSection[];
|
|
463
|
-
/** Similar to in README generation, the language property is used to determine the language to use when generating code blocks in markdown. */
|
|
464
|
-
language: Language;
|
|
326
|
+
interface SwiftInfo {
|
|
327
|
+
publishInfo?: SwiftPackageManagerPublishInfo;
|
|
465
328
|
}
|
|
466
329
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
interface RootPackageReferenceSection {
|
|
472
|
-
description?: string;
|
|
473
|
-
endpoints: EndpointReference[];
|
|
330
|
+
interface SwiftPackageManagerPublishInfo {
|
|
331
|
+
gitUrl: string;
|
|
332
|
+
minVersion: string;
|
|
474
333
|
}
|
|
475
334
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
interface ReferenceSection {
|
|
481
|
-
title: string;
|
|
482
|
-
description?: string;
|
|
483
|
-
endpoints: EndpointReference[];
|
|
335
|
+
interface TypescriptInfo {
|
|
336
|
+
publishInfo?: NpmPublishInfo;
|
|
484
337
|
}
|
|
485
338
|
|
|
486
|
-
/**
|
|
487
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
488
|
-
*/
|
|
489
|
-
|
|
490
339
|
interface EndpointReference {
|
|
491
340
|
/**
|
|
492
341
|
* The title is a code snippet that is shown when the endpoint's reference is collapsed.
|
|
@@ -506,9 +355,40 @@ interface EndpointReference {
|
|
|
506
355
|
parameters: ParameterReference[];
|
|
507
356
|
}
|
|
508
357
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
358
|
+
declare const LanguageValues: {
|
|
359
|
+
readonly Java: "JAVA";
|
|
360
|
+
readonly Python: "PYTHON";
|
|
361
|
+
readonly Go: "GO";
|
|
362
|
+
readonly Ruby: "RUBY";
|
|
363
|
+
readonly Csharp: "CSHARP";
|
|
364
|
+
readonly Typescript: "TYPESCRIPT";
|
|
365
|
+
readonly Php: "PHP";
|
|
366
|
+
readonly Rust: "RUST";
|
|
367
|
+
readonly Swift: "SWIFT";
|
|
368
|
+
};
|
|
369
|
+
type Language = (typeof LanguageValues)[keyof typeof LanguageValues];
|
|
370
|
+
declare const Language: typeof LanguageValues & {
|
|
371
|
+
_visit: <R>(value: Language, visitor: Language.Visitor<R>) => R;
|
|
372
|
+
};
|
|
373
|
+
declare namespace Language {
|
|
374
|
+
interface Visitor<R> {
|
|
375
|
+
java: () => R;
|
|
376
|
+
python: () => R;
|
|
377
|
+
go: () => R;
|
|
378
|
+
ruby: () => R;
|
|
379
|
+
csharp: () => R;
|
|
380
|
+
typescript: () => R;
|
|
381
|
+
php: () => R;
|
|
382
|
+
rust: () => R;
|
|
383
|
+
swift: () => R;
|
|
384
|
+
_other: () => R;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
interface LinkedText {
|
|
389
|
+
text: string;
|
|
390
|
+
location?: RelativeLocation;
|
|
391
|
+
}
|
|
512
392
|
|
|
513
393
|
/**
|
|
514
394
|
* The method invocation snippet is one which appears when the endpoint's reference is collapsed.
|
|
@@ -523,19 +403,6 @@ interface MethodInvocationSnippet {
|
|
|
523
403
|
returnValue?: LinkedText;
|
|
524
404
|
}
|
|
525
405
|
|
|
526
|
-
/**
|
|
527
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
528
|
-
*/
|
|
529
|
-
|
|
530
|
-
interface LinkedText {
|
|
531
|
-
text: string;
|
|
532
|
-
location?: RelativeLocation;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
537
|
-
*/
|
|
538
|
-
|
|
539
406
|
interface ParameterReference {
|
|
540
407
|
name: string;
|
|
541
408
|
description?: string;
|
|
@@ -545,8 +412,24 @@ interface ParameterReference {
|
|
|
545
412
|
}
|
|
546
413
|
|
|
547
414
|
/**
|
|
548
|
-
*
|
|
415
|
+
* The information to include within the `reference.md` file generated by the CLI.
|
|
416
|
+
* The information here should really be all defined by the generator, and not user provided.
|
|
417
|
+
* We intentionally keep this a bit flexible in the event SDKs structure their package/module
|
|
418
|
+
* references in a unique way for the same API.
|
|
549
419
|
*/
|
|
420
|
+
interface ReferenceConfig {
|
|
421
|
+
rootSection?: RootPackageReferenceSection;
|
|
422
|
+
sections: ReferenceSection[];
|
|
423
|
+
/** Similar to in README generation, the language property is used to determine the language to use when generating code blocks in markdown. */
|
|
424
|
+
language: Language;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
interface ReferenceSection {
|
|
428
|
+
title: string;
|
|
429
|
+
description?: string;
|
|
430
|
+
endpoints: EndpointReference[];
|
|
431
|
+
}
|
|
432
|
+
|
|
550
433
|
interface RelativeLocation {
|
|
551
434
|
/**
|
|
552
435
|
* A relative location is a path to a file or directory relative to the root of the repository.
|
|
@@ -555,35 +438,9 @@ interface RelativeLocation {
|
|
|
555
438
|
path: string;
|
|
556
439
|
}
|
|
557
440
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
type Language = "JAVA" | "PYTHON" | "GO" | "RUBY" | "CSHARP" | "TYPESCRIPT" | "PHP" | "RUST" | "SWIFT";
|
|
562
|
-
declare const Language: {
|
|
563
|
-
readonly Java: "JAVA";
|
|
564
|
-
readonly Python: "PYTHON";
|
|
565
|
-
readonly Go: "GO";
|
|
566
|
-
readonly Ruby: "RUBY";
|
|
567
|
-
readonly Csharp: "CSHARP";
|
|
568
|
-
readonly Typescript: "TYPESCRIPT";
|
|
569
|
-
readonly Php: "PHP";
|
|
570
|
-
readonly Rust: "RUST";
|
|
571
|
-
readonly Swift: "SWIFT";
|
|
572
|
-
readonly _visit: <R>(value: Language, visitor: Language.Visitor<R>) => R;
|
|
573
|
-
};
|
|
574
|
-
declare namespace Language {
|
|
575
|
-
interface Visitor<R> {
|
|
576
|
-
java: () => R;
|
|
577
|
-
python: () => R;
|
|
578
|
-
go: () => R;
|
|
579
|
-
ruby: () => R;
|
|
580
|
-
csharp: () => R;
|
|
581
|
-
typescript: () => R;
|
|
582
|
-
php: () => R;
|
|
583
|
-
rust: () => R;
|
|
584
|
-
swift: () => R;
|
|
585
|
-
_other: () => R;
|
|
586
|
-
}
|
|
441
|
+
interface RootPackageReferenceSection {
|
|
442
|
+
description?: string;
|
|
443
|
+
endpoints: EndpointReference[];
|
|
587
444
|
}
|
|
588
445
|
|
|
589
446
|
interface GenerateReadmeToStreamParams {
|
|
@@ -623,4 +480,224 @@ interface GithubReleaseParams {
|
|
|
623
480
|
}
|
|
624
481
|
declare function githubRelease(params: GithubReleaseParams): Promise<void>;
|
|
625
482
|
|
|
626
|
-
|
|
483
|
+
/**
|
|
484
|
+
* Logger interface for pipeline steps.
|
|
485
|
+
* Abstracts away the logging implementation so steps work with both
|
|
486
|
+
* the CLI's TaskContext and the standalone CLI subprocess (console).
|
|
487
|
+
*/
|
|
488
|
+
interface PipelineLogger {
|
|
489
|
+
debug(message: string): void;
|
|
490
|
+
info(message: string): void;
|
|
491
|
+
warn(message: string): void;
|
|
492
|
+
error(message: string): void;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Default logger implementation using stderr (to avoid mixing with JSON result output on stdout).
|
|
496
|
+
*/
|
|
497
|
+
declare const consolePipelineLogger: PipelineLogger;
|
|
498
|
+
|
|
499
|
+
interface PipelineConfig {
|
|
500
|
+
outputDir: string;
|
|
501
|
+
replay?: ReplayStepConfig;
|
|
502
|
+
fernignore?: FernignoreStepConfig;
|
|
503
|
+
github?: GithubStepConfig;
|
|
504
|
+
cliVersion?: string;
|
|
505
|
+
generatorVersions?: Record<string, string>;
|
|
506
|
+
generatorName?: string;
|
|
507
|
+
}
|
|
508
|
+
interface PipelineContext {
|
|
509
|
+
previousStepResults: {
|
|
510
|
+
replay?: ReplayStepResult;
|
|
511
|
+
fernignore?: FernignoreStepResult;
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
interface ReplayStepConfig {
|
|
515
|
+
enabled: boolean;
|
|
516
|
+
stageOnly?: boolean;
|
|
517
|
+
skipApplication?: boolean;
|
|
518
|
+
}
|
|
519
|
+
interface FernignoreStepConfig {
|
|
520
|
+
enabled: boolean;
|
|
521
|
+
customContents?: string;
|
|
522
|
+
}
|
|
523
|
+
interface GithubStepConfig {
|
|
524
|
+
enabled: boolean;
|
|
525
|
+
/** GitHub repository URI (e.g. "owner/repo") */
|
|
526
|
+
uri: string;
|
|
527
|
+
/** GitHub auth token */
|
|
528
|
+
token: string;
|
|
529
|
+
/** Output mode */
|
|
530
|
+
mode: "push" | "pull-request";
|
|
531
|
+
/** Target branch (base branch for PRs, push target for push mode) */
|
|
532
|
+
branch?: string;
|
|
533
|
+
/** Commit message for the generation */
|
|
534
|
+
commitMessage?: string;
|
|
535
|
+
/** Skip push/PR creation, just prepare branches locally */
|
|
536
|
+
previewMode?: boolean;
|
|
537
|
+
/** Generator name for namespaced fern-generation-base tag */
|
|
538
|
+
generatorName?: string;
|
|
539
|
+
/** Explicit override: whether replay already created commits (derived from replay context if omitted) */
|
|
540
|
+
skipCommit?: boolean;
|
|
541
|
+
/** Explicit override: replay conflict info (derived from replay context if omitted) */
|
|
542
|
+
replayConflictInfo?: {
|
|
543
|
+
previousGenerationSha: string;
|
|
544
|
+
currentGenerationSha: string;
|
|
545
|
+
hasConflicts: boolean;
|
|
546
|
+
baseBranchHead?: string;
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
interface PipelineResult {
|
|
550
|
+
success: boolean;
|
|
551
|
+
steps: {
|
|
552
|
+
replay?: ReplayStepResult;
|
|
553
|
+
fernignore?: FernignoreStepResult;
|
|
554
|
+
github?: GithubStepResult;
|
|
555
|
+
};
|
|
556
|
+
errors?: string[];
|
|
557
|
+
warnings?: string[];
|
|
558
|
+
}
|
|
559
|
+
interface ReplayStepResult extends StepResult {
|
|
560
|
+
flow?: "first-generation" | "no-patches" | "normal-regeneration" | "skip-application";
|
|
561
|
+
patchesDetected?: number;
|
|
562
|
+
patchesApplied?: number;
|
|
563
|
+
patchesWithConflicts?: number;
|
|
564
|
+
patchesAbsorbed?: number;
|
|
565
|
+
patchesRepointed?: number;
|
|
566
|
+
patchesContentRebased?: number;
|
|
567
|
+
patchesKeptAsUserOwned?: number;
|
|
568
|
+
previousGenerationSha?: string;
|
|
569
|
+
currentGenerationSha?: string;
|
|
570
|
+
baseBranchHead?: string;
|
|
571
|
+
conflicts?: ConflictInfo[];
|
|
572
|
+
conflictDetails?: Array<{
|
|
573
|
+
patchId: string;
|
|
574
|
+
patchMessage: string;
|
|
575
|
+
reason?: string;
|
|
576
|
+
files: Array<{
|
|
577
|
+
file: string;
|
|
578
|
+
status: string;
|
|
579
|
+
conflictReason?: string;
|
|
580
|
+
}>;
|
|
581
|
+
}>;
|
|
582
|
+
warnings?: string[];
|
|
583
|
+
}
|
|
584
|
+
interface ConflictInfo {
|
|
585
|
+
filePath: string;
|
|
586
|
+
conflicts: Array<{
|
|
587
|
+
startLine: number;
|
|
588
|
+
endLine: number;
|
|
589
|
+
ours: string[];
|
|
590
|
+
theirs: string[];
|
|
591
|
+
}>;
|
|
592
|
+
}
|
|
593
|
+
interface FernignoreStepResult extends StepResult {
|
|
594
|
+
pathsPreserved?: string[];
|
|
595
|
+
}
|
|
596
|
+
interface GithubStepResult extends StepResult {
|
|
597
|
+
commitSha?: string;
|
|
598
|
+
branchUrl?: string;
|
|
599
|
+
prUrl?: string;
|
|
600
|
+
prNumber?: number;
|
|
601
|
+
updatedExistingPr?: boolean;
|
|
602
|
+
generationBaseTagSha?: string;
|
|
603
|
+
}
|
|
604
|
+
interface StepResult {
|
|
605
|
+
executed: boolean;
|
|
606
|
+
success: boolean;
|
|
607
|
+
errorMessage?: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare class PostGenerationPipeline {
|
|
611
|
+
private readonly config;
|
|
612
|
+
private readonly logger;
|
|
613
|
+
private steps;
|
|
614
|
+
constructor(config: PipelineConfig, logger?: PipelineLogger);
|
|
615
|
+
run(): Promise<PipelineResult>;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
declare function logReplaySummary(result: ReplayStepResult, logger: PipelineLogger): void;
|
|
619
|
+
declare function formatReplayPrBody(result: ReplayStepResult | undefined, options?: {
|
|
620
|
+
branchName?: string;
|
|
621
|
+
}): string | undefined;
|
|
622
|
+
|
|
623
|
+
interface ReplayInitParams {
|
|
624
|
+
/** GitHub repo URI (e.g., "fern-demo/fern-replay-testbed-java-sdk") */
|
|
625
|
+
githubRepo: string;
|
|
626
|
+
/** GitHub token with push + PR permissions */
|
|
627
|
+
token: string;
|
|
628
|
+
/** Report what would happen but don't create PR */
|
|
629
|
+
dryRun?: boolean;
|
|
630
|
+
/** Max commits to scan for generation history */
|
|
631
|
+
maxCommitsToScan?: number;
|
|
632
|
+
/** Title for the PR */
|
|
633
|
+
prTitle?: string;
|
|
634
|
+
/** Body for the PR */
|
|
635
|
+
prBody?: string;
|
|
636
|
+
/** Overwrite existing lockfile if present. Default: false */
|
|
637
|
+
force?: boolean;
|
|
638
|
+
/** Scan git history for existing patches (migration). Default: false */
|
|
639
|
+
importHistory?: boolean;
|
|
640
|
+
}
|
|
641
|
+
interface ReplayInitResult {
|
|
642
|
+
/** Bootstrap result from fern-replay */
|
|
643
|
+
bootstrap: BootstrapResult;
|
|
644
|
+
/** URL of the created PR, if not dry-run */
|
|
645
|
+
prUrl?: string;
|
|
646
|
+
/** Branch name used for the PR */
|
|
647
|
+
branch?: string;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Initialize Replay for an SDK repository.
|
|
651
|
+
*
|
|
652
|
+
* Creates a branch and opens a PR with the replay lockfile.
|
|
653
|
+
*
|
|
654
|
+
* Flow:
|
|
655
|
+
* 1. Clone the SDK repo
|
|
656
|
+
* 2. Run bootstrap() to scan history and create lockfile
|
|
657
|
+
* 3. Ensure .fernignore has replay entries
|
|
658
|
+
* 4. Commit with [fern-replay] prefix (recognized by isGenerationCommit)
|
|
659
|
+
* 5. Push branch and open PR
|
|
660
|
+
*
|
|
661
|
+
* The [fern-replay] commit message prefix ensures the bootstrap commit
|
|
662
|
+
* is NOT treated as a user customization patch by ReplayDetector.
|
|
663
|
+
*/
|
|
664
|
+
declare function replayInit(params: ReplayInitParams): Promise<ReplayInitResult>;
|
|
665
|
+
interface BootstrapLogEntry {
|
|
666
|
+
level: "info" | "warn";
|
|
667
|
+
message: string;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Formats a BootstrapResult into structured log entries.
|
|
671
|
+
* Used by both the generator-cli CLI and the fern CLI to produce
|
|
672
|
+
* consistent output without duplicating formatting logic.
|
|
673
|
+
*/
|
|
674
|
+
declare function formatBootstrapSummary(result: ReplayInitResult): BootstrapLogEntry[];
|
|
675
|
+
|
|
676
|
+
interface ReplayRunParams {
|
|
677
|
+
outputDir: string;
|
|
678
|
+
cliVersion?: string;
|
|
679
|
+
generatorVersions?: Record<string, string>;
|
|
680
|
+
/** Don't commit, just stage changes. Default: false */
|
|
681
|
+
stageOnly?: boolean;
|
|
682
|
+
/** Generator name for namespaced tag lookup (e.g. "fernapi/fern-typescript-node-sdk") */
|
|
683
|
+
generatorName?: string;
|
|
684
|
+
/** Commit generation + update lockfile, skip patch detection/application */
|
|
685
|
+
skipApplication?: boolean;
|
|
686
|
+
/** Optional logger for diagnostic output */
|
|
687
|
+
logger?: PipelineLogger;
|
|
688
|
+
}
|
|
689
|
+
interface ReplayRunResult {
|
|
690
|
+
/** null if replay wasn't initialized (no lockfile) */
|
|
691
|
+
report: ReplayReport | null;
|
|
692
|
+
/** Whether .fernignore was updated */
|
|
693
|
+
fernignoreUpdated: boolean;
|
|
694
|
+
/** SHA of the [fern-generated] commit before this replay run (null if first generation or unreadable) */
|
|
695
|
+
previousGenerationSha: string | null;
|
|
696
|
+
/** SHA of the [fern-generated] commit created by this replay run (null if replay didn't run or unreadable) */
|
|
697
|
+
currentGenerationSha: string | null;
|
|
698
|
+
/** SHA of main's HEAD before replay ran. Always on main's lineage, stable after squash merges. */
|
|
699
|
+
baseBranchHead: string | null;
|
|
700
|
+
}
|
|
701
|
+
declare function replayRun(params: ReplayRunParams): Promise<ReplayRunResult>;
|
|
702
|
+
|
|
703
|
+
export { type BootstrapLogEntry, type GenerateReadmeParams, type GenerateReadmeToStreamParams, type GenerateReferenceParams, type GenerateReferenceToStreamParams, type GithubPrParams, type GithubPushParams, type GithubReleaseParams, type GithubStepConfig, type GithubStepResult, type PipelineConfig, type PipelineContext, type PipelineLogger, type PipelineResult, PostGenerationPipeline, type ReplayInitParams, type ReplayInitResult, type ReplayRunParams, type ReplayRunResult, type ReplayStepResult, consolePipelineLogger, formatBootstrapSummary, formatReplayPrBody, generateReadme, generateReadmeToStream, generateReference, generateReferenceToStream, githubPr, githubPush, githubRelease, logReplaySummary, replayInit, replayRun };
|