@@ -95,7 +95,7 @@ async function runCli() {
9595 getOrCreateFernRunId ( ) ;
9696
9797 const isLocal = process . argv . includes ( "--local" ) ;
98- const cliContext = new CliContext ( process . stdout , process . stderr , { isLocal } ) ;
98+ const cliContext = await CliContext . create ( process . stdout , process . stderr , { isLocal } ) ;
9999
100100 const exit = async ( ) => {
101101 await cliContext . exit ( ) ;
@@ -135,7 +135,7 @@ async function runCli() {
135135 } ) ;
136136 }
137137 } catch ( error ) {
138- await cliContext . instrumentPostHogEvent ( {
138+ cliContext . instrumentPostHogEvent ( {
139139 command : process . argv . join ( " " ) ,
140140 properties : {
141141 failed : true ,
@@ -537,7 +537,7 @@ function addSdkDiffCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext)
537537 description : "Output result as JSON"
538538 } ) ,
539539 async ( argv ) => {
540- await cliContext . instrumentPostHogEvent ( {
540+ cliContext . instrumentPostHogEvent ( {
541541 command : "fern sdk-diff"
542542 } ) ;
543543
@@ -1355,7 +1355,7 @@ function addUpdateApiSpecCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCon
13551355 default : 2
13561356 } ) ,
13571357 async ( argv ) => {
1358- await cliContext . instrumentPostHogEvent ( {
1358+ cliContext . instrumentPostHogEvent ( {
13591359 command : "fern api update"
13601360 } ) ;
13611361 await updateApiSpec ( {
@@ -1386,7 +1386,7 @@ function addSelfUpdateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
13861386 default : false
13871387 } ) ,
13881388 async ( argv ) => {
1389- await cliContext . instrumentPostHogEvent ( {
1389+ cliContext . instrumentPostHogEvent ( {
13901390 command : "fern self-update"
13911391 } ) ;
13921392 await selfUpdate ( {
@@ -1415,7 +1415,7 @@ function addLoginCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14151415 } ) ,
14161416 async ( argv ) => {
14171417 await cliContext . runTask ( async ( context ) => {
1418- await cliContext . instrumentPostHogEvent ( {
1418+ cliContext . instrumentPostHogEvent ( {
14191419 command : "fern login"
14201420 } ) ;
14211421 await login ( context , { useDeviceCodeFlow : argv . deviceCode , email : argv . email } ) ;
@@ -1431,7 +1431,7 @@ function addLogoutCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14311431 ( yargs ) => yargs ,
14321432 async ( ) => {
14331433 await cliContext . runTask ( async ( context ) => {
1434- await cliContext . instrumentPostHogEvent ( {
1434+ cliContext . instrumentPostHogEvent ( {
14351435 command : "fern logout"
14361436 } ) ;
14371437 await logout ( context ) ;
@@ -1456,7 +1456,7 @@ function addFormatCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14561456 description : "Only run the command on the provided API"
14571457 } ) ,
14581458 async ( argv ) => {
1459- await cliContext . instrumentPostHogEvent ( {
1459+ cliContext . instrumentPostHogEvent ( {
14601460 command : "fern format"
14611461 } ) ;
14621462 await formatWorkspaces ( {
@@ -1490,7 +1490,7 @@ function addTestCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14901490 description : "Run the tests configured to a specific language"
14911491 } ) ,
14921492 async ( argv ) => {
1493- await cliContext . instrumentPostHogEvent ( {
1493+ cliContext . instrumentPostHogEvent ( {
14941494 command : "fern test"
14951495 } ) ;
14961496 await testOutput ( {
@@ -1523,7 +1523,7 @@ function addMockCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
15231523 description : "The API to mock."
15241524 } ) ,
15251525 async ( argv ) => {
1526- await cliContext . instrumentPostHogEvent ( {
1526+ cliContext . instrumentPostHogEvent ( {
15271527 command : "fern mock"
15281528 } ) ;
15291529 await mockServer ( {
@@ -1568,7 +1568,7 @@ function addOverridesCompareCommand(cli: Argv<GlobalCliOptions>, cliContext: Cli
15681568 description : "Path to write the overrides file (defaults to <original>-overrides.yml)"
15691569 } ) ,
15701570 async ( argv ) => {
1571- await cliContext . instrumentPostHogEvent ( {
1571+ cliContext . instrumentPostHogEvent ( {
15721572 command : "fern overrides compare"
15731573 } ) ;
15741574 const originalPath = resolve ( cwd ( ) , argv . original as string ) ;
@@ -1601,7 +1601,7 @@ function addOverridesWriteCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
16011601 } )
16021602 ] ,
16031603 async ( argv ) => {
1604- await cliContext . instrumentPostHogEvent ( {
1604+ cliContext . instrumentPostHogEvent ( {
16051605 command : "fern overrides write"
16061606 } ) ;
16071607 await writeOverridesForWorkspaces ( {
@@ -1637,7 +1637,7 @@ function addWriteOverridesCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
16371637 ] ,
16381638 async ( argv ) => {
16391639 cliContext . logger . warn ( "The 'write-overrides' command is deprecated. Use 'fern overrides write' instead." ) ;
1640- await cliContext . instrumentPostHogEvent ( {
1640+ cliContext . instrumentPostHogEvent ( {
16411641 command : "fern write-overrides"
16421642 } ) ;
16431643 await writeOverridesForWorkspaces ( {
@@ -1672,7 +1672,7 @@ function addWriteDefinitionCommand(cli: Argv<GlobalCliOptions>, cliContext: CliC
16721672 } ) ,
16731673 async ( argv ) => {
16741674 const preserveSchemaIds = argv . preserveSchemas != null ;
1675- await cliContext . instrumentPostHogEvent ( {
1675+ cliContext . instrumentPostHogEvent ( {
16761676 command : "fern write-definition"
16771677 } ) ;
16781678 await writeDefinitionForWorkspaces ( {
@@ -1721,7 +1721,7 @@ function addDocsMdGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
17211721 description : "Name of a specific library defined in docs.yml to generate docs for"
17221722 } ) ,
17231723 async ( argv ) => {
1724- await cliContext . instrumentPostHogEvent ( {
1724+ cliContext . instrumentPostHogEvent ( {
17251725 command : "fern docs md generate"
17261726 } ) ;
17271727
@@ -1762,7 +1762,7 @@ function addDocsDiffCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext)
17621762 description : "Output directory for diff images"
17631763 } ) ,
17641764 async ( argv ) => {
1765- await cliContext . instrumentPostHogEvent ( {
1765+ cliContext . instrumentPostHogEvent ( {
17661766 command : "fern docs diff"
17671767 } ) ;
17681768
@@ -1807,7 +1807,7 @@ function addDocsPreviewListCommand(cli: Argv<GlobalCliOptions>, cliContext: CliC
18071807 description : "Page number for pagination (starts at 1)"
18081808 } ) ,
18091809 async ( argv ) => {
1810- await cliContext . instrumentPostHogEvent ( {
1810+ cliContext . instrumentPostHogEvent ( {
18111811 command : "fern docs preview list"
18121812 } ) ;
18131813 await listDocsPreview ( {
@@ -1831,7 +1831,7 @@ function addDocsPreviewDeleteCommand(cli: Argv<GlobalCliOptions>, cliContext: Cl
18311831 demandOption : true
18321832 } ) ,
18331833 async ( argv ) => {
1834- await cliContext . instrumentPostHogEvent ( {
1834+ cliContext . instrumentPostHogEvent ( {
18351835 command : "fern docs preview delete"
18361836 } ) ;
18371837 await deleteDocsPreview ( {
@@ -1950,7 +1950,7 @@ function addDocsMdCheckCommand(cli: Argv<GlobalCliOptions>, cliContext: CliConte
19501950 // No additional options for this command
19511951 } ,
19521952 async ( ) => {
1953- await cliContext . instrumentPostHogEvent ( {
1953+ cliContext . instrumentPostHogEvent ( {
19541954 command : "fern docs md check"
19551955 } ) ;
19561956
@@ -2006,7 +2006,7 @@ function addGenerateJsonschemaCommand(cli: Argv<GlobalCliOptions>, cliContext: C
20062006 description : "The type to generate JSON Schema for (e.g. 'MySchema' or 'mypackage.MySchema')"
20072007 } ) ,
20082008 async ( argv ) => {
2009- await cliContext . instrumentPostHogEvent ( {
2009+ cliContext . instrumentPostHogEvent ( {
20102010 command : "fern jsonschema" ,
20112011 properties : {
20122012 output : argv . output
@@ -2036,7 +2036,7 @@ function addWriteDocsDefinitionCommand(cli: Argv<GlobalCliOptions>, cliContext:
20362036 demandOption : true
20372037 } ) ,
20382038 async ( argv ) => {
2039- await cliContext . instrumentPostHogEvent ( {
2039+ cliContext . instrumentPostHogEvent ( {
20402040 command : "fern write-docs-definition" ,
20412041 properties : {
20422042 outputPath : argv . outputPath
@@ -2067,7 +2067,7 @@ function addWriteTranslationCommand(cli: Argv<GlobalCliOptions>, cliContext: Cli
20672067 description : "Return content as-is without calling the translation service"
20682068 } ) ,
20692069 async ( argv ) => {
2070- await cliContext . instrumentPostHogEvent ( {
2070+ cliContext . instrumentPostHogEvent ( {
20712071 command : "fern write-translation"
20722072 } ) ;
20732073
@@ -2104,7 +2104,7 @@ function addExportCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
21042104 default : 2
21052105 } ) ,
21062106 async ( argv ) => {
2107- await cliContext . instrumentPostHogEvent ( {
2107+ cliContext . instrumentPostHogEvent ( {
21082108 command : "fern export" ,
21092109 properties : {
21102110 outputPath : argv . outputPath
@@ -2148,7 +2148,7 @@ function addEnrichCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
21482148 demandOption : true
21492149 } ) ,
21502150 async ( argv ) => {
2151- await cliContext . instrumentPostHogEvent ( {
2151+ cliContext . instrumentPostHogEvent ( {
21522152 command : "fern api enrich"
21532153 } ) ;
21542154 const openapiPath = resolve ( cwd ( ) , argv . openapi as string ) ;
@@ -2470,7 +2470,7 @@ function addSdkPreviewCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
24702470 "Cannot be combined with --local."
24712471 } ) ,
24722472 async ( argv ) => {
2473- await cliContext . instrumentPostHogEvent ( {
2473+ cliContext . instrumentPostHogEvent ( {
24742474 command : "fern sdk preview"
24752475 } ) ;
24762476 const generatorFilter =
@@ -2632,7 +2632,7 @@ function addReplayInitCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
26322632 description : "Overwrite existing lockfile if Replay is already initialized"
26332633 } ) ,
26342634 async ( argv ) => {
2635- await cliContext . instrumentPostHogEvent ( {
2635+ cliContext . instrumentPostHogEvent ( {
26362636 command : "fern replay init"
26372637 } ) ;
26382638
@@ -2754,7 +2754,7 @@ function addReplayResolveCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCon
27542754 description : "Skip checking for remaining conflict markers before committing"
27552755 } ) ,
27562756 async ( argv ) => {
2757- await cliContext . instrumentPostHogEvent ( {
2757+ cliContext . instrumentPostHogEvent ( {
27582758 command : "fern replay resolve"
27592759 } ) ;
27602760
0 commit comments