feat: cn serve boolean (#8005)
* feat: cn serve boolean * capture sessionStart for cn serve
This commit is contained in:
parent
775f731293
commit
d135140fb9
3 changed files with 10 additions and 1 deletions
|
|
@ -2,6 +2,8 @@ import chalk from "chalk";
|
|||
import type { ChatHistoryItem } from "core/index.js";
|
||||
import express, { Request, Response } from "express";
|
||||
|
||||
import { posthogService } from "src/telemetry/posthogService.js";
|
||||
|
||||
import { getAccessToken, getAssistantSlug } from "../auth/workos.js";
|
||||
import { runEnvironmentInstallSafe } from "../environment/environmentHandler.js";
|
||||
import { processCommandFlags } from "../flags/flagProcessor.js";
|
||||
|
|
@ -42,6 +44,8 @@ interface ServeOptions extends ExtendedCommandOptions {
|
|||
|
||||
// eslint-disable-next-line max-statements
|
||||
export async function serve(prompt?: string, options: ServeOptions = {}) {
|
||||
await posthogService.capture("sessionStart", {});
|
||||
|
||||
// Check if prompt should come from stdin instead of parameter
|
||||
let actualPrompt = prompt;
|
||||
if (!prompt) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import node_machine_id from "node-machine-id";
|
|||
import type { PostHog as PostHogType } from "posthog-node";
|
||||
|
||||
import { isAuthenticatedConfig, loadAuthConfig } from "../auth/workos.js";
|
||||
import { isHeadlessMode } from "../util/cli.js";
|
||||
import { isHeadlessMode, isServe } from "../util/cli.js";
|
||||
import { isGitHubActions } from "../util/git.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { getVersion } from "../version.js";
|
||||
|
|
@ -95,6 +95,7 @@ export class PosthogService {
|
|||
ideType: "cli",
|
||||
isHeadless: isHeadlessMode(),
|
||||
isGitHubCI: isGitHubActions(),
|
||||
isServe: isServe(),
|
||||
};
|
||||
const payload = {
|
||||
distinctId: this.uniqueId,
|
||||
|
|
|
|||
|
|
@ -9,3 +9,7 @@ export function isHeadlessMode(): boolean {
|
|||
const args = process.argv.slice(2);
|
||||
return args.includes("-p") || args.includes("--print");
|
||||
}
|
||||
|
||||
export function isServe(): boolean {
|
||||
return process.argv?.includes("serve") ?? false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue