@@ -94,7 +94,7 @@ async function runCli() {
9494 getOrCreateFernRunId ( ) ;
9595
9696 const isLocal = process . argv . includes ( "--local" ) ;
97- const cliContext = new CliContext ( process . stdout , process . stderr , { isLocal } ) ;
97+ const cliContext = await CliContext . create ( process . stdout , process . stderr , { isLocal } ) ;
9898
9999 const exit = async ( ) => {
100100 await cliContext . exit ( ) ;
@@ -134,7 +134,7 @@ async function runCli() {
134134 } ) ;
135135 }
136136 } catch ( error ) {
137- await cliContext . instrumentPostHogEvent ( {
137+ cliContext . instrumentPostHogEvent ( {
138138 command : process . argv . join ( " " ) ,
139139 properties : {
140140 failed : true ,
@@ -535,7 +535,7 @@ function addSdkDiffCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext)
535535 description : "Output result as JSON"
536536 } ) ,
537537 async ( argv ) => {
538- await cliContext . instrumentPostHogEvent ( {
538+ cliContext . instrumentPostHogEvent ( {
539539 command : "fern sdk-diff"
540540 } ) ;
541541
@@ -1350,7 +1350,7 @@ function addUpdateApiSpecCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCon
13501350 default : 2
13511351 } ) ,
13521352 async ( argv ) => {
1353- await cliContext . instrumentPostHogEvent ( {
1353+ cliContext . instrumentPostHogEvent ( {
13541354 command : "fern api update"
13551355 } ) ;
13561356 await updateApiSpec ( {
@@ -1381,7 +1381,7 @@ function addSelfUpdateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
13811381 default : false
13821382 } ) ,
13831383 async ( argv ) => {
1384- await cliContext . instrumentPostHogEvent ( {
1384+ cliContext . instrumentPostHogEvent ( {
13851385 command : "fern self-update"
13861386 } ) ;
13871387 await selfUpdate ( {
@@ -1410,7 +1410,7 @@ function addLoginCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14101410 } ) ,
14111411 async ( argv ) => {
14121412 await cliContext . runTask ( async ( context ) => {
1413- await cliContext . instrumentPostHogEvent ( {
1413+ cliContext . instrumentPostHogEvent ( {
14141414 command : "fern login"
14151415 } ) ;
14161416 await login ( context , { useDeviceCodeFlow : argv . deviceCode , email : argv . email } ) ;
@@ -1426,7 +1426,7 @@ function addLogoutCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14261426 ( yargs ) => yargs ,
14271427 async ( ) => {
14281428 await cliContext . runTask ( async ( context ) => {
1429- await cliContext . instrumentPostHogEvent ( {
1429+ cliContext . instrumentPostHogEvent ( {
14301430 command : "fern logout"
14311431 } ) ;
14321432 await logout ( context ) ;
@@ -1451,7 +1451,7 @@ function addFormatCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14511451 description : "Only run the command on the provided API"
14521452 } ) ,
14531453 async ( argv ) => {
1454- await cliContext . instrumentPostHogEvent ( {
1454+ cliContext . instrumentPostHogEvent ( {
14551455 command : "fern format"
14561456 } ) ;
14571457 await formatWorkspaces ( {
@@ -1485,7 +1485,7 @@ function addTestCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
14851485 description : "Run the tests configured to a specific language"
14861486 } ) ,
14871487 async ( argv ) => {
1488- await cliContext . instrumentPostHogEvent ( {
1488+ cliContext . instrumentPostHogEvent ( {
14891489 command : "fern test"
14901490 } ) ;
14911491 await testOutput ( {
@@ -1518,7 +1518,7 @@ function addMockCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
15181518 description : "The API to mock."
15191519 } ) ,
15201520 async ( argv ) => {
1521- await cliContext . instrumentPostHogEvent ( {
1521+ cliContext . instrumentPostHogEvent ( {
15221522 command : "fern mock"
15231523 } ) ;
15241524 await mockServer ( {
@@ -1563,7 +1563,7 @@ function addOverridesCompareCommand(cli: Argv<GlobalCliOptions>, cliContext: Cli
15631563 description : "Path to write the overrides file (defaults to <original>-overrides.yml)"
15641564 } ) ,
15651565 async ( argv ) => {
1566- await cliContext . instrumentPostHogEvent ( {
1566+ cliContext . instrumentPostHogEvent ( {
15671567 command : "fern overrides compare"
15681568 } ) ;
15691569 const originalPath = resolve ( cwd ( ) , argv . original as string ) ;
@@ -1596,7 +1596,7 @@ function addOverridesWriteCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
15961596 } )
15971597 ] ,
15981598 async ( argv ) => {
1599- await cliContext . instrumentPostHogEvent ( {
1599+ cliContext . instrumentPostHogEvent ( {
16001600 command : "fern overrides write"
16011601 } ) ;
16021602 await writeOverridesForWorkspaces ( {
@@ -1632,7 +1632,7 @@ function addWriteOverridesCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
16321632 ] ,
16331633 async ( argv ) => {
16341634 cliContext . logger . warn ( "The 'write-overrides' command is deprecated. Use 'fern overrides write' instead." ) ;
1635- await cliContext . instrumentPostHogEvent ( {
1635+ cliContext . instrumentPostHogEvent ( {
16361636 command : "fern write-overrides"
16371637 } ) ;
16381638 await writeOverridesForWorkspaces ( {
@@ -1667,7 +1667,7 @@ function addWriteDefinitionCommand(cli: Argv<GlobalCliOptions>, cliContext: CliC
16671667 } ) ,
16681668 async ( argv ) => {
16691669 const preserveSchemaIds = argv . preserveSchemas != null ;
1670- await cliContext . instrumentPostHogEvent ( {
1670+ cliContext . instrumentPostHogEvent ( {
16711671 command : "fern write-definition"
16721672 } ) ;
16731673 await writeDefinitionForWorkspaces ( {
@@ -1716,7 +1716,7 @@ function addDocsMdGenerateCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCo
17161716 description : "Name of a specific library defined in docs.yml to generate docs for"
17171717 } ) ,
17181718 async ( argv ) => {
1719- await cliContext . instrumentPostHogEvent ( {
1719+ cliContext . instrumentPostHogEvent ( {
17201720 command : "fern docs md generate"
17211721 } ) ;
17221722
@@ -1757,7 +1757,7 @@ function addDocsDiffCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext)
17571757 description : "Output directory for diff images"
17581758 } ) ,
17591759 async ( argv ) => {
1760- await cliContext . instrumentPostHogEvent ( {
1760+ cliContext . instrumentPostHogEvent ( {
17611761 command : "fern docs diff"
17621762 } ) ;
17631763
@@ -1802,7 +1802,7 @@ function addDocsPreviewListCommand(cli: Argv<GlobalCliOptions>, cliContext: CliC
18021802 description : "Page number for pagination (starts at 1)"
18031803 } ) ,
18041804 async ( argv ) => {
1805- await cliContext . instrumentPostHogEvent ( {
1805+ cliContext . instrumentPostHogEvent ( {
18061806 command : "fern docs preview list"
18071807 } ) ;
18081808 await listDocsPreview ( {
@@ -1826,7 +1826,7 @@ function addDocsPreviewDeleteCommand(cli: Argv<GlobalCliOptions>, cliContext: Cl
18261826 demandOption : true
18271827 } ) ,
18281828 async ( argv ) => {
1829- await cliContext . instrumentPostHogEvent ( {
1829+ cliContext . instrumentPostHogEvent ( {
18301830 command : "fern docs preview delete"
18311831 } ) ;
18321832 await deleteDocsPreview ( {
@@ -1945,7 +1945,7 @@ function addDocsMdCheckCommand(cli: Argv<GlobalCliOptions>, cliContext: CliConte
19451945 // No additional options for this command
19461946 } ,
19471947 async ( ) => {
1948- await cliContext . instrumentPostHogEvent ( {
1948+ cliContext . instrumentPostHogEvent ( {
19491949 command : "fern docs md check"
19501950 } ) ;
19511951
@@ -2001,7 +2001,7 @@ function addGenerateJsonschemaCommand(cli: Argv<GlobalCliOptions>, cliContext: C
20012001 description : "The type to generate JSON Schema for (e.g. 'MySchema' or 'mypackage.MySchema')"
20022002 } ) ,
20032003 async ( argv ) => {
2004- await cliContext . instrumentPostHogEvent ( {
2004+ cliContext . instrumentPostHogEvent ( {
20052005 command : "fern jsonschema" ,
20062006 properties : {
20072007 output : argv . output
@@ -2031,7 +2031,7 @@ function addWriteDocsDefinitionCommand(cli: Argv<GlobalCliOptions>, cliContext:
20312031 demandOption : true
20322032 } ) ,
20332033 async ( argv ) => {
2034- await cliContext . instrumentPostHogEvent ( {
2034+ cliContext . instrumentPostHogEvent ( {
20352035 command : "fern write-docs-definition" ,
20362036 properties : {
20372037 outputPath : argv . outputPath
@@ -2062,7 +2062,7 @@ function addWriteTranslationCommand(cli: Argv<GlobalCliOptions>, cliContext: Cli
20622062 description : "Return content as-is without calling the translation service"
20632063 } ) ,
20642064 async ( argv ) => {
2065- await cliContext . instrumentPostHogEvent ( {
2065+ cliContext . instrumentPostHogEvent ( {
20662066 command : "fern write-translation"
20672067 } ) ;
20682068
@@ -2099,7 +2099,7 @@ function addExportCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
20992099 default : 2
21002100 } ) ,
21012101 async ( argv ) => {
2102- await cliContext . instrumentPostHogEvent ( {
2102+ cliContext . instrumentPostHogEvent ( {
21032103 command : "fern export" ,
21042104 properties : {
21052105 outputPath : argv . outputPath
@@ -2143,7 +2143,7 @@ function addEnrichCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContext) {
21432143 demandOption : true
21442144 } ) ,
21452145 async ( argv ) => {
2146- await cliContext . instrumentPostHogEvent ( {
2146+ cliContext . instrumentPostHogEvent ( {
21472147 command : "fern api enrich"
21482148 } ) ;
21492149 const openapiPath = resolve ( cwd ( ) , argv . openapi as string ) ;
@@ -2197,7 +2197,7 @@ function addSdkPreviewCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
21972197 "Omit to publish to the default preview registry and write to a temp directory."
21982198 } ) ,
21992199 async ( argv ) => {
2200- await cliContext . instrumentPostHogEvent ( {
2200+ cliContext . instrumentPostHogEvent ( {
22012201 command : "fern sdk preview"
22022202 } ) ;
22032203 const generatorFilter =
@@ -2357,7 +2357,7 @@ function addReplayInitCommand(cli: Argv<GlobalCliOptions>, cliContext: CliContex
23572357 description : "Overwrite existing lockfile if Replay is already initialized"
23582358 } ) ,
23592359 async ( argv ) => {
2360- await cliContext . instrumentPostHogEvent ( {
2360+ cliContext . instrumentPostHogEvent ( {
23612361 command : "fern replay init"
23622362 } ) ;
23632363
@@ -2479,7 +2479,7 @@ function addReplayResolveCommand(cli: Argv<GlobalCliOptions>, cliContext: CliCon
24792479 description : "Skip checking for remaining conflict markers before committing"
24802480 } ) ,
24812481 async ( argv ) => {
2482- await cliContext . instrumentPostHogEvent ( {
2482+ cliContext . instrumentPostHogEvent ( {
24832483 command : "fern replay resolve"
24842484 } ) ;
24852485
0 commit comments