File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import chalk from "chalk";
22import type { ChatHistoryItem } from "core/index.js" ;
33import express , { Request , Response } from "express" ;
44
5+ import { posthogService } from "src/telemetry/posthogService.js" ;
6+
57import { getAccessToken , getAssistantSlug } from "../auth/workos.js" ;
68import { runEnvironmentInstallSafe } from "../environment/environmentHandler.js" ;
79import { processCommandFlags } from "../flags/flagProcessor.js" ;
@@ -42,6 +44,8 @@ interface ServeOptions extends ExtendedCommandOptions {
4244
4345// eslint-disable-next-line max-statements
4446export async function serve ( prompt ?: string , options : ServeOptions = { } ) {
47+ await posthogService . capture ( "sessionStart" , { } ) ;
48+
4549 // Check if prompt should come from stdin instead of parameter
4650 let actualPrompt = prompt ;
4751 if ( ! prompt ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import node_machine_id from "node-machine-id";
55import type { PostHog as PostHogType } from "posthog-node" ;
66
77import { isAuthenticatedConfig , loadAuthConfig } from "../auth/workos.js" ;
8- import { isHeadlessMode } from "../util/cli.js" ;
8+ import { isHeadlessMode , isServe } from "../util/cli.js" ;
99import { isGitHubActions } from "../util/git.js" ;
1010import { logger } from "../util/logger.js" ;
1111import { getVersion } from "../version.js" ;
@@ -95,6 +95,7 @@ export class PosthogService {
9595 ideType : "cli" ,
9696 isHeadless : isHeadlessMode ( ) ,
9797 isGitHubCI : isGitHubActions ( ) ,
98+ isServe : isServe ( ) ,
9899 } ;
99100 const payload = {
100101 distinctId : this . uniqueId ,
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ export function isHeadlessMode(): boolean {
99 const args = process . argv . slice ( 2 ) ;
1010 return args . includes ( "-p" ) || args . includes ( "--print" ) ;
1111}
12+
13+ export function isServe ( ) : boolean {
14+ return process . argv ?. includes ( "serve" ) ?? false ;
15+ }
You can’t perform that action at this time.
0 commit comments