@fern-api/generator-cli 0.9.11 → 0.9.14
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 +101 -31
- package/dist/api.js +1694 -276
- package/dist/cli.js +17473 -11396
- package/package.json +4 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ForgetOptions, ForgetResult, BootstrapResult, ResolveResult,
|
|
1
|
+
import { ReplayService, ReplayPreparation, ReplayReport, ForgetOptions, ForgetResult, BootstrapResult, ResolveResult, StatusResult } from '@fern-api/replay';
|
|
2
2
|
export { ConflictDetail, DiffStat, ForgetOptions, ForgetResult, MatchedPatch, ReplayReport, ResolveResult, StatusGeneration, StatusPatch, StatusResult } from '@fern-api/replay';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
|
|
@@ -496,6 +496,65 @@ interface PipelineLogger {
|
|
|
496
496
|
*/
|
|
497
497
|
declare const consolePipelineLogger: PipelineLogger;
|
|
498
498
|
|
|
499
|
+
interface ReplayRunParams {
|
|
500
|
+
outputDir: string;
|
|
501
|
+
cliVersion?: string;
|
|
502
|
+
generatorVersions?: Record<string, string>;
|
|
503
|
+
/** Don't commit, just stage changes. Default: false */
|
|
504
|
+
stageOnly?: boolean;
|
|
505
|
+
/** Generator name for namespaced tag lookup (e.g. "fernapi/fern-typescript-node-sdk") */
|
|
506
|
+
generatorName?: string;
|
|
507
|
+
/** Commit generation + update lockfile, skip patch detection/application */
|
|
508
|
+
skipApplication?: boolean;
|
|
509
|
+
/** Optional logger for diagnostic output */
|
|
510
|
+
logger?: PipelineLogger;
|
|
511
|
+
}
|
|
512
|
+
interface ReplayRunResult {
|
|
513
|
+
/** null if replay wasn't initialized (no lockfile) */
|
|
514
|
+
report: ReplayReport | null;
|
|
515
|
+
/** Whether .fernignore was updated */
|
|
516
|
+
fernignoreUpdated: boolean;
|
|
517
|
+
/** SHA of the [fern-generated] commit before this replay run (null if first generation or unreadable) */
|
|
518
|
+
previousGenerationSha: string | null;
|
|
519
|
+
/** SHA of the [fern-generated] commit created by this replay run (null if replay didn't run or unreadable) */
|
|
520
|
+
currentGenerationSha: string | null;
|
|
521
|
+
/** SHA of main's HEAD before replay ran. Always on main's lineage, stable after squash merges. */
|
|
522
|
+
baseBranchHead: string | null;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Opaque handle returned by `replayPrepare()` and consumed by `replayApply()`.
|
|
526
|
+
*
|
|
527
|
+
* Between prepare and apply, HEAD is at the new `[fern-generated]` commit (or unchanged
|
|
528
|
+
* for dry-run / skip-application terminals). Consumers MAY land additional commits on
|
|
529
|
+
* HEAD (e.g. `[fern-autoversion]`) — apply will run patches on top of current HEAD at
|
|
530
|
+
* call time while rebasing stored patches against the pure `[fern-generated]` tree.
|
|
531
|
+
*
|
|
532
|
+
* If apply is never reached, the working tree has the new `[fern-generated]` commit
|
|
533
|
+
* but the lockfile is stale. Callers MUST either call apply (which advances the
|
|
534
|
+
* lockfile) or reset HEAD to `previousGenerationSha`.
|
|
535
|
+
*/
|
|
536
|
+
interface PreparedReplay {
|
|
537
|
+
/** @internal Service instance carrying in-memory state across phases. */
|
|
538
|
+
_service: ReplayService;
|
|
539
|
+
/** @internal Preparation state handed to the service's apply phase. */
|
|
540
|
+
_preparation: ReplayPreparation;
|
|
541
|
+
/** Working tree / git repo the replay operates on. */
|
|
542
|
+
outputDir: string;
|
|
543
|
+
/** Flow selected by the service during prepare. */
|
|
544
|
+
flow: ReplayPreparation["flow"];
|
|
545
|
+
/** SHA of the `[fern-generated]` commit before this run; null if no prior generation. */
|
|
546
|
+
previousGenerationSha: string | null;
|
|
547
|
+
/** SHA of the new `[fern-generated]` commit created by prepare (or prior HEAD for dry-run terminals). */
|
|
548
|
+
currentGenerationSha: string;
|
|
549
|
+
/** SHA of main's HEAD captured before prepare mutated anything. */
|
|
550
|
+
baseBranchHead: string | null;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Backwards-compatible atomic entry point. Composes `replayPrepare` +
|
|
554
|
+
* `replayApply` with byte-identical behavior for existing callers.
|
|
555
|
+
*/
|
|
556
|
+
declare function replayRun(params: ReplayRunParams): Promise<ReplayRunResult>;
|
|
557
|
+
|
|
499
558
|
interface PipelineConfig {
|
|
500
559
|
outputDir: string;
|
|
501
560
|
replay?: ReplayStepConfig;
|
|
@@ -508,11 +567,29 @@ interface PipelineConfig {
|
|
|
508
567
|
}
|
|
509
568
|
interface PipelineContext {
|
|
510
569
|
previousStepResults: {
|
|
570
|
+
generationCommit?: GenerationCommitStepResult;
|
|
511
571
|
replay?: ReplayStepResult;
|
|
512
572
|
autoVersion?: AutoVersionStepResult;
|
|
513
573
|
fernignore?: FernignoreStepResult;
|
|
514
574
|
};
|
|
515
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Result of running replayPrepare(). Holds the opaque PreparedReplay handle that
|
|
578
|
+
* downstream steps (AutoVersionStep, ReplayStep) consume.
|
|
579
|
+
*
|
|
580
|
+
* `preparedReplay` is null when replay isn't initialized for this repo (no
|
|
581
|
+
* lockfile) or when prepare failed — the pipeline proceeds without replay in
|
|
582
|
+
* both cases.
|
|
583
|
+
*/
|
|
584
|
+
interface GenerationCommitStepResult extends StepResult {
|
|
585
|
+
/** Opaque handle consumed by ReplayStep's apply phase. Imported at the import site to avoid circular deps. */
|
|
586
|
+
preparedReplay?: PreparedReplay | null;
|
|
587
|
+
previousGenerationSha?: string;
|
|
588
|
+
currentGenerationSha?: string;
|
|
589
|
+
baseBranchHead?: string;
|
|
590
|
+
/** Flow selected by the replay service during prepare. */
|
|
591
|
+
flow?: "first-generation" | "no-patches" | "normal-regeneration" | "skip-application";
|
|
592
|
+
}
|
|
516
593
|
interface ReplayStepConfig {
|
|
517
594
|
enabled: boolean;
|
|
518
595
|
stageOnly?: boolean;
|
|
@@ -524,10 +601,29 @@ interface AutoVersionStepConfig {
|
|
|
524
601
|
language: string;
|
|
525
602
|
/** Existing changelog content passed to the AI for context. */
|
|
526
603
|
priorChangelog?: string;
|
|
527
|
-
/** Fallback version when no prior generation exists (first run). */
|
|
604
|
+
/** Fallback version when no prior generation exists (first run). Defaults to "0.0.1" (or "v0.0.1" for Go). */
|
|
528
605
|
baseVersion?: string;
|
|
529
|
-
/**
|
|
530
|
-
|
|
606
|
+
/**
|
|
607
|
+
* BAML AI service configuration (provider + model). Required when `enabled: true` — without it,
|
|
608
|
+
* AnalyzeSdkDiff calls will fail and the step will fall back to a PATCH bump.
|
|
609
|
+
* Shape matches `generatorsYml.AiServicesSchema` from @fern-api/configuration; typed structurally
|
|
610
|
+
* to avoid pulling the configuration package into generator-cli's dep graph.
|
|
611
|
+
*/
|
|
612
|
+
ai?: AutoVersionAiConfig;
|
|
613
|
+
/** Optional Fern API token passed through to BAML client configuration if needed by the provider. */
|
|
614
|
+
fernToken?: string;
|
|
615
|
+
/** Spec repository commit message included as additional AI context. */
|
|
616
|
+
specCommitMessage?: string;
|
|
617
|
+
/** When true, strips "🌿 Generated with Fern" trailers from commit messages (whitelabel customers). */
|
|
618
|
+
isWhitelabel?: boolean;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Minimal shape for the BAML AI service configuration. Structural equivalent of
|
|
622
|
+
* `generatorsYml.AiServicesSchema` from @fern-api/configuration.
|
|
623
|
+
*/
|
|
624
|
+
interface AutoVersionAiConfig {
|
|
625
|
+
provider: string;
|
|
626
|
+
model: string;
|
|
531
627
|
}
|
|
532
628
|
interface FernignoreStepConfig {
|
|
533
629
|
enabled: boolean;
|
|
@@ -584,6 +680,7 @@ interface GithubStepConfig {
|
|
|
584
680
|
interface PipelineResult {
|
|
585
681
|
success: boolean;
|
|
586
682
|
steps: {
|
|
683
|
+
generationCommit?: GenerationCommitStepResult;
|
|
587
684
|
replay?: ReplayStepResult;
|
|
588
685
|
autoVersion?: AutoVersionStepResult;
|
|
589
686
|
fernignore?: FernignoreStepResult;
|
|
@@ -734,33 +831,6 @@ interface ReplayResolveParams {
|
|
|
734
831
|
}
|
|
735
832
|
declare function replayResolve(params: ReplayResolveParams): Promise<ResolveResult>;
|
|
736
833
|
|
|
737
|
-
interface ReplayRunParams {
|
|
738
|
-
outputDir: string;
|
|
739
|
-
cliVersion?: string;
|
|
740
|
-
generatorVersions?: Record<string, string>;
|
|
741
|
-
/** Don't commit, just stage changes. Default: false */
|
|
742
|
-
stageOnly?: boolean;
|
|
743
|
-
/** Generator name for namespaced tag lookup (e.g. "fernapi/fern-typescript-node-sdk") */
|
|
744
|
-
generatorName?: string;
|
|
745
|
-
/** Commit generation + update lockfile, skip patch detection/application */
|
|
746
|
-
skipApplication?: boolean;
|
|
747
|
-
/** Optional logger for diagnostic output */
|
|
748
|
-
logger?: PipelineLogger;
|
|
749
|
-
}
|
|
750
|
-
interface ReplayRunResult {
|
|
751
|
-
/** null if replay wasn't initialized (no lockfile) */
|
|
752
|
-
report: ReplayReport | null;
|
|
753
|
-
/** Whether .fernignore was updated */
|
|
754
|
-
fernignoreUpdated: boolean;
|
|
755
|
-
/** SHA of the [fern-generated] commit before this replay run (null if first generation or unreadable) */
|
|
756
|
-
previousGenerationSha: string | null;
|
|
757
|
-
/** SHA of the [fern-generated] commit created by this replay run (null if replay didn't run or unreadable) */
|
|
758
|
-
currentGenerationSha: string | null;
|
|
759
|
-
/** SHA of main's HEAD before replay ran. Always on main's lineage, stable after squash merges. */
|
|
760
|
-
baseBranchHead: string | null;
|
|
761
|
-
}
|
|
762
|
-
declare function replayRun(params: ReplayRunParams): Promise<ReplayRunResult>;
|
|
763
|
-
|
|
764
834
|
interface ReplayStatusParams {
|
|
765
835
|
/** Directory containing the SDK (where .fern/replay.lock lives) */
|
|
766
836
|
outputDir: string;
|