@c15t/cli 2.0.0-rc.6 → 2.0.0-rc.8

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.
@@ -142,6 +142,12 @@ export declare const generateMachine: import("xstate").StateMachine<GenerateMach
142
142
  } | {
143
143
  type: "preflightPassed";
144
144
  params: unknown;
145
+ } | {
146
+ type: "installConfirmed";
147
+ params: unknown;
148
+ } | {
149
+ type: "installSucceeded";
150
+ params: unknown;
145
151
  } | {
146
152
  type: "preflightFailed";
147
153
  params: unknown;
@@ -184,12 +190,6 @@ export declare const generateMachine: import("xstate").StateMachine<GenerateMach
184
190
  } | {
185
191
  type: "isExpandedUIStyle";
186
192
  params: unknown;
187
- } | {
188
- type: "installConfirmed";
189
- params: unknown;
190
- } | {
191
- type: "installSucceeded";
192
- params: unknown;
193
193
  } | {
194
194
  type: "hasFilesToRollback";
195
195
  params: unknown;
@@ -208,7 +208,7 @@ export declare const generateMachine: import("xstate").StateMachine<GenerateMach
208
208
  } | {
209
209
  type: "shouldPromptUIStyle";
210
210
  params: unknown;
211
- }, never, "error" | "exited" | "complete" | "preflightError" | "idle" | "preflight" | "modeSelection" | "hostedMode" | "offlineMode" | "customMode" | "backendOptions" | "frontendOptions" | "scriptsOptions" | "fileGeneration" | "dependencyInstall" | "summary" | "skillsInstall" | "githubStar" | "cancelling" | "rollback" | "routeToMode" | "dependencyCheck" | "dependencyConfirm", string, {
211
+ }, never, "error" | "exited" | "complete" | "idle" | "preflight" | "preflightError" | "modeSelection" | "hostedMode" | "offlineMode" | "customMode" | "backendOptions" | "frontendOptions" | "scriptsOptions" | "fileGeneration" | "dependencyInstall" | "summary" | "skillsInstall" | "githubStar" | "cancelling" | "dependencyCheck" | "dependencyConfirm" | "rollback" | "routeToMode", string, {
212
212
  cliContext: CliContext;
213
213
  modeArg?: StorageMode;
214
214
  }, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
@@ -2,6 +2,7 @@
2
2
  * Shared type definitions for the c15t CLI
3
3
  */
4
4
  import type { AvailablePackage as AvailablePackageType, StorageMode as StorageModeType } from './constants';
5
+ import type { CliLogger as SharedCliLogger } from './utils/logger';
5
6
  export type StorageMode = StorageModeType;
6
7
  export type AvailablePackage = AvailablePackageType;
7
8
  export interface CliCommand {
@@ -85,18 +86,7 @@ export interface PackageManagerResult {
85
86
  /** Execute command (npx, bunx, etc.) */
86
87
  execCommand: string;
87
88
  }
88
- export interface CliLogger {
89
- debug(message: string, ...args: unknown[]): void;
90
- info(message: string, ...args: unknown[]): void;
91
- warn(message: string, ...args: unknown[]): void;
92
- error(message: string, ...args: unknown[]): void;
93
- message(message: string): void;
94
- note(content: string, title?: string): void;
95
- success(message: string): void;
96
- failed(message: string): never;
97
- outro(message: string): void;
98
- step(current: number, total: number, label: string): void;
99
- }
89
+ export type CliLogger = SharedCliLogger;
100
90
  export interface ErrorHandlers {
101
91
  /** Handle an error and exit */
102
92
  handleError: (error: unknown, message: string) => never;
@@ -128,7 +118,7 @@ export interface FileSystemUtils {
128
118
  }
129
119
  export interface Telemetry {
130
120
  /** Track an event */
131
- trackEvent: (eventName: string, properties?: Record<string, string | number | boolean | undefined>) => void;
121
+ trackEvent: (eventName: string, properties?: Record<string, unknown>) => void;
132
122
  /** Track a command execution */
133
123
  trackCommand: (command: string, args?: string[], flags?: Record<string, string | number | boolean | undefined>) => void;
134
124
  /** Track an error */
@@ -173,7 +163,7 @@ export interface GenerateOptions {
173
163
  mode: StorageMode;
174
164
  /** Backend URL (for hosted or self-hosted mode) */
175
165
  backendUrl?: string;
176
- /** Instance ID (for hosted mode) */
166
+ /** Project ID (for hosted mode) */
177
167
  instanceId?: string;
178
168
  /** Selected scripts to configure */
179
169
  scripts?: string[];
@@ -215,19 +205,19 @@ export interface PreflightCheck {
215
205
  hint?: string;
216
206
  }
217
207
  export interface Instance {
218
- /** Instance ID */
208
+ /** Project ID */
219
209
  id: string;
220
- /** Instance name */
210
+ /** Project name */
221
211
  name: string;
222
212
  /** Organization slug */
223
213
  organizationSlug?: string;
224
214
  /** Provisioning region */
225
215
  region?: string;
226
- /** Instance URL */
216
+ /** Project backend URL */
227
217
  url: string;
228
218
  /** Created timestamp */
229
219
  createdAt: string;
230
- /** Instance status */
220
+ /** Project status */
231
221
  status: 'active' | 'inactive' | 'pending';
232
222
  }
233
223
  export type RecoveryAction = 'retry' | 'skip' | 'manual' | 'troubleshoot' | 'abort';
@@ -1,13 +1,14 @@
1
- import { type Logger } from '../../../logger/dist-types/index.d.ts';
1
+ import { type Logger } from '@c15t/logger';
2
2
  export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
3
3
  export declare const validLogLevels: LogLevel[];
4
4
  export type CliLogger = Logger & CliExtensions;
5
5
  export interface CliExtensions {
6
- message: (message: string, ...args: unknown[]) => void;
7
- note: (message: string, ...args: unknown[]) => void;
8
- outro: (message: string, ...args: unknown[]) => void;
9
- success: (message: string, ...args: unknown[]) => void;
10
- failed: (message: string, ...args: unknown[]) => void;
6
+ message: (message: string) => void;
7
+ note: (content: string, title?: string) => void;
8
+ outro: (message: string) => void;
9
+ success: (message: string) => void;
10
+ failed: (message: string) => never;
11
+ step: (current: number, total: number, label: string) => void;
11
12
  }
12
13
  /**
13
14
  * Formats a log message with appropriate styling based on log level
@@ -1,5 +1,6 @@
1
- import type { Logger } from '../../../logger/dist-types/index.d.ts';
2
- import { PostHog } from 'posthog-node';
1
+ import { type DrainContext } from 'evlog';
2
+ import { type DrainPipelineOptions } from 'evlog/pipeline';
3
+ import type { CliLogger } from './logger';
3
4
  export declare const TelemetryEventName: {
4
5
  readonly CLI_INVOKED: "cli.invoked";
5
6
  readonly CLI_COMPLETED: "cli.completed";
@@ -17,6 +18,7 @@ export declare const TelemetryEventName: {
17
18
  readonly HELP_DISPLAYED: "help.displayed";
18
19
  readonly VERSION_DISPLAYED: "version.displayed";
19
20
  readonly ONBOARDING_STARTED: "onboarding.started";
21
+ readonly ONBOARDING_STAGE: "onboarding.stage";
20
22
  readonly ONBOARDING_COMPLETED: "onboarding.completed";
21
23
  readonly ONBOARDING_EXITED: "onboarding.exited";
22
24
  readonly ONBOARDING_STORAGE_MODE_SELECTED: "onboarding.storage_mode_selected";
@@ -27,6 +29,13 @@ export declare const TelemetryEventName: {
27
29
  readonly ONBOARDING_DEPENDENCIES_CHOICE: "onboarding.dependencies_choice";
28
30
  readonly ONBOARDING_DEPENDENCIES_INSTALLED: "onboarding.dependencies_installed";
29
31
  readonly ONBOARDING_GITHUB_STAR: "onboarding.github_star";
32
+ readonly AUTH_LOGIN_STARTED: "auth.login.started";
33
+ readonly AUTH_LOGIN_SUCCEEDED: "auth.login.succeeded";
34
+ readonly AUTH_LOGIN_FAILED: "auth.login.failed";
35
+ readonly AUTH_LOGOUT: "auth.logout";
36
+ readonly PROJECTS_LISTED: "projects.listed";
37
+ readonly PROJECT_SELECTED: "project.selected";
38
+ readonly PROJECT_CREATED: "project.created";
30
39
  readonly ERROR_OCCURRED: "error.occurred";
31
40
  readonly MIGRATION_STARTED: "migration.started";
32
41
  readonly MIGRATION_PLANNED: "migration.planned";
@@ -45,133 +54,68 @@ export declare const TelemetryEventName: {
45
54
  readonly CLI_STATE_COMPLETE: "cli.state.complete";
46
55
  };
47
56
  export type TelemetryEventName = (typeof TelemetryEventName)[keyof typeof TelemetryEventName];
57
+ type EventLike = Record<string, unknown>;
48
58
  export interface TelemetryOptions {
49
- /**
50
- * Custom PostHog instance to use instead of the default
51
- */
52
- client?: PostHog;
53
- /**
54
- * Whether telemetry should be disabled
55
- */
56
59
  disabled?: boolean;
57
- /**
58
- * Whether telemetry debugging should be enabled
59
- */
60
60
  debug?: boolean;
61
- /**
62
- * Default properties to add to all telemetry events
63
- */
64
- defaultProperties?: Record<string, string | number | boolean>;
65
- /**
66
- * Logger instance to use for logging telemetry events
67
- */
68
- logger?: Logger;
61
+ defaultProperties?: EventLike;
62
+ logger?: CliLogger;
63
+ endpoint?: string;
64
+ headers?: Record<string, string>;
65
+ fetch?: typeof fetch;
66
+ storageDir?: string;
67
+ drainOptions?: DrainPipelineOptions<DrainContext>;
69
68
  }
70
- /**
71
- * Manages telemetry for the CLI
72
- *
73
- * The Telemetry class provides methods to track CLI usage and errors
74
- * in a privacy-preserving way.
75
- */
76
69
  export declare class Telemetry {
77
- private client;
70
+ private readonly endpoint;
71
+ private readonly fetchImpl;
72
+ private readonly queuePath;
73
+ private readonly statePath;
74
+ private readonly headers;
75
+ private readonly defaultProperties;
76
+ private readonly sessionId;
77
+ private readonly installId;
78
+ private readonly isFirstRun;
79
+ private readonly drain;
80
+ private readonly storageDir;
81
+ private logger;
78
82
  private disabled;
79
- private defaultProperties;
80
- private distinctId;
81
- private apiKey;
82
83
  private debug;
83
- private logger;
84
- /**
85
- * Creates a new telemetry instance
86
- *
87
- * @param options - Configuration options for telemetry
88
- */
84
+ private sequence;
85
+ private activeCommandName?;
86
+ private activeCommandRunId?;
87
+ private flushPromise;
88
+ private queueReplayPromise;
89
+ private queueWritePromise;
89
90
  constructor(options?: TelemetryOptions);
90
- /**
91
- * Track a telemetry event
92
- *
93
- * @param eventName - The event name to track
94
- * @param properties - Properties to include with the event
95
- */
96
- trackEvent(eventName: TelemetryEventName, properties?: Record<string, string | number | boolean | undefined>): void;
97
- /**
98
- * Track a telemetry event synchronously
99
- *
100
- * This method ensures the event is sent before returning
101
- *
102
- * @param eventName - The event name to track
103
- * @param properties - Properties to include with the event
104
- */
105
- trackEventSync(eventName: TelemetryEventName, properties?: Record<string, string | number | boolean | undefined>): void;
106
- /**
107
- * Track a command execution
108
- *
109
- * @param command - The command being executed
110
- * @param args - Command arguments
111
- * @param flags - Command flags
112
- */
91
+ trackEvent(eventName: TelemetryEventName | string, properties?: EventLike): void;
113
92
  trackCommand(command: string, args?: string[], flags?: Record<string, string | number | boolean | undefined>): void;
114
- /**
115
- * Track CLI errors
116
- *
117
- * @param error - The error that occurred
118
- * @param command - The command that was being executed when the error occurred
119
- */
120
93
  trackError(error: Error, command?: string): void;
121
- /**
122
- * Disable telemetry
123
- */
94
+ flushSync(): void;
95
+ shutdown(): Promise<void>;
96
+ isDisabled(): boolean;
124
97
  disable(): void;
125
- /**
126
- * Enable telemetry
127
- */
128
98
  enable(): void;
129
- /**
130
- * Check if telemetry is disabled
131
- *
132
- * @returns Whether telemetry is disabled
133
- */
134
- isDisabled(): boolean;
135
- /**
136
- * Shutdown telemetry client
137
- */
138
- shutdown(): Promise<void>;
139
- /**
140
- * Set the logger instance to use for logging
141
- *
142
- * @param logger - The logger instance to use
143
- */
144
- setLogger(logger: Logger): void;
145
- /**
146
- * Log a debug message using the configured logger or console.debug as fallback
147
- *
148
- * @param message - The message to log
149
- * @param args - Additional arguments to log
150
- */
99
+ setLogger(logger: CliLogger): void;
100
+ private applyLoggerConfig;
101
+ private buildBaseContext;
102
+ private buildHeaders;
103
+ private flushAll;
104
+ private sendBatch;
105
+ private persistDroppedEvents;
106
+ private flushQueuedEvents;
107
+ private readQueuedEvents;
108
+ private writeQueuedEvents;
109
+ private loadOrCreateInstallIdentity;
110
+ private buildErrorMetadata;
111
+ private sanitizeError;
112
+ private sanitizeProperties;
113
+ private sanitizeValue;
114
+ private sanitizePrimitive;
115
+ private getEnvironmentName;
116
+ private isCi;
117
+ private readString;
151
118
  private logDebug;
152
- /**
153
- * Initialize the PostHog client
154
- *
155
- * @param customClient - Optional custom PostHog client
156
- */
157
- private initClient;
158
- /**
159
- * Generate an anonymous ID based on machine info
160
- *
161
- * @returns A hash that uniquely identifies the machine without PII
162
- */
163
- private generateAnonymousId;
164
- /**
165
- * Force immediate flushing of any pending telemetry events
166
- *
167
- * This is useful when you need to ensure events are sent before process exit
168
- */
169
- flushSync(): void;
170
119
  }
171
- /**
172
- * Creates a telemetry instance with sensible defaults
173
- *
174
- * @param options - Configuration options for telemetry
175
- * @returns A configured telemetry instance
176
- */
177
120
  export declare function createTelemetry(options?: TelemetryOptions): Telemetry;
121
+ export {};
@@ -26,7 +26,7 @@ export declare function hasDynamicSegment(value: string): boolean;
26
26
  */
27
27
  export declare function extractDynamicSegment(value: string): string | null;
28
28
  /**
29
- * Validate an instance name
29
+ * Validate a hosted project slug
30
30
  */
31
31
  export declare function isValidInstanceName(value: string): boolean;
32
32
  /**
@@ -54,7 +54,7 @@ export declare const validateUrl: (value: string) => string | undefined;
54
54
  */
55
55
  export declare const validateC15tUrl: (value: string) => string | undefined;
56
56
  /**
57
- * Instance name validator for prompts
57
+ * Project slug validator for prompts
58
58
  */
59
59
  export declare const validateInstanceName: (value: string) => string | undefined;
60
60
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c15t/cli",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0-rc.8",
4
4
  "description": "CLI for rapid c15t setup. Scaffold React and Next.js cookie banners and a preferences centre, generate types and config, and run migration tooling for self-hosted deployments.",
5
5
  "homepage": "https://v2.c15t.com",
6
6
  "repository": {
@@ -22,9 +22,9 @@
22
22
  "dist-types"
23
23
  ],
24
24
  "scripts": {
25
- "build": "rslib build",
25
+ "build": "rslib build && bun ../../scripts/normalize-dist-types.mjs",
26
26
  "check-types": "tsc --noEmit",
27
- "dev": "rslib build",
27
+ "dev": "rslib build && bun ../../scripts/normalize-dist-types.mjs",
28
28
  "fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
29
29
  "knip": "knip",
30
30
  "lint": "bun biome lint ./src",
@@ -33,18 +33,18 @@
33
33
  "test:watch": "vitest"
34
34
  },
35
35
  "dependencies": {
36
- "@c15t/backend": "2.0.0-rc.6",
37
- "@c15t/logger": "1.0.2-rc.0",
36
+ "@c15t/backend": "2.0.0-rc.8",
37
+ "@c15t/logger": "1.0.2-rc.1",
38
38
  "@clack/prompts": "1.1.0",
39
39
  "@modelcontextprotocol/sdk": "^1.29.0",
40
40
  "c12": "3.3.3",
41
41
  "dotenv": "17.3.1",
42
+ "evlog": "^2.11.1",
42
43
  "figlet": "1.11.0",
43
44
  "fs-extra": "11.3.4",
44
45
  "open": "11.0.0",
45
46
  "package-manager-detector": "1.6.0",
46
47
  "picocolors": "1.1.1",
47
- "posthog-node": "5.28.9",
48
48
  "ts-morph": "27.0.2",
49
49
  "xstate": "^5.30.0",
50
50
  "zod": "4.3.6"