@c15t/cli 2.0.0-rc.6 → 2.0.0
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.
- package/README.md +8 -8
- package/dist/145.mjs +1223 -332
- package/dist/generate-files.mjs +64 -90
- package/dist-types/auth/base-url.d.ts +2 -2
- package/dist-types/auth/config-store.d.ts +2 -2
- package/dist-types/auth/types.d.ts +1 -1
- package/dist-types/commands/generate/prompts/mode-select.d.ts +1 -1
- package/dist-types/commands/generate/templates/css.d.ts +10 -11
- package/dist-types/commands/generate/templates/shared/components.d.ts +1 -1
- package/dist-types/commands/generate/templates/shared/framework-config.d.ts +0 -4
- package/dist-types/commands/index.d.ts +1 -1
- package/dist-types/commands/instances/index.d.ts +13 -8
- package/dist-types/commands/self-host/migrate/migrator-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/orm-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/read-config.d.ts +1 -1
- package/dist-types/commands/shared/stylesheets.d.ts +19 -0
- package/dist-types/constants.d.ts +19 -7
- package/dist-types/context/types.d.ts +3 -1
- package/dist-types/control-plane/client.d.ts +6 -6
- package/dist-types/control-plane/types.d.ts +5 -5
- package/dist-types/core/errors.d.ts +10 -10
- package/dist-types/core/telemetry.d.ts +2 -77
- package/dist-types/machines/generate/actors/prompts.d.ts +1 -1
- package/dist-types/machines/generate/machine.d.ts +7 -7
- package/dist-types/machines/generate/types.d.ts +2 -2
- package/dist-types/types.d.ts +8 -18
- package/dist-types/utils/logger.d.ts +7 -6
- package/dist-types/utils/telemetry.d.ts +61 -117
- package/dist-types/utils/validation.d.ts +2 -2
- package/package.json +9 -9
- package/readme.json +2 -2
|
@@ -10,7 +10,7 @@ export declare const ERROR_CATALOG: {
|
|
|
10
10
|
readonly code: "AUTH_FAILED";
|
|
11
11
|
readonly message: "Authentication failed";
|
|
12
12
|
readonly hint: "Try running `c15t login` again";
|
|
13
|
-
readonly docs: "https://
|
|
13
|
+
readonly docs: "https://c15t.com/docs/cli/auth";
|
|
14
14
|
};
|
|
15
15
|
readonly AUTH_EXPIRED: {
|
|
16
16
|
readonly code: "AUTH_EXPIRED";
|
|
@@ -51,7 +51,7 @@ export declare const ERROR_CATALOG: {
|
|
|
51
51
|
readonly code: "FRAMEWORK_NOT_DETECTED";
|
|
52
52
|
readonly message: "Could not detect framework";
|
|
53
53
|
readonly hint: "Supported frameworks: Next.js, React, Remix, Vite";
|
|
54
|
-
readonly docs: "https://
|
|
54
|
+
readonly docs: "https://c15t.com/docs/cli/frameworks";
|
|
55
55
|
};
|
|
56
56
|
readonly LAYOUT_NOT_FOUND: {
|
|
57
57
|
readonly code: "LAYOUT_NOT_FOUND";
|
|
@@ -72,7 +72,7 @@ export declare const ERROR_CATALOG: {
|
|
|
72
72
|
readonly code: "CONFIG_INVALID";
|
|
73
73
|
readonly message: "Invalid c15t configuration";
|
|
74
74
|
readonly hint: "Check your c15t.config.ts file for errors";
|
|
75
|
-
readonly docs: "https://
|
|
75
|
+
readonly docs: "https://c15t.com/docs/configuration";
|
|
76
76
|
};
|
|
77
77
|
readonly NETWORK_ERROR: {
|
|
78
78
|
readonly code: "NETWORK_ERROR";
|
|
@@ -81,8 +81,8 @@ export declare const ERROR_CATALOG: {
|
|
|
81
81
|
};
|
|
82
82
|
readonly CONTROL_PLANE_CONNECTION_FAILED: {
|
|
83
83
|
readonly code: "CONTROL_PLANE_CONNECTION_FAILED";
|
|
84
|
-
readonly message: "Could not connect to
|
|
85
|
-
readonly hint: "Check if https://
|
|
84
|
+
readonly message: "Could not connect to inth.com";
|
|
85
|
+
readonly hint: "Check if https://inth.com is accessible";
|
|
86
86
|
};
|
|
87
87
|
readonly API_ERROR: {
|
|
88
88
|
readonly code: "API_ERROR";
|
|
@@ -92,17 +92,17 @@ export declare const ERROR_CATALOG: {
|
|
|
92
92
|
readonly URL_INVALID: {
|
|
93
93
|
readonly code: "URL_INVALID";
|
|
94
94
|
readonly message: "Invalid URL format";
|
|
95
|
-
readonly hint: "Expected format: https://your-
|
|
95
|
+
readonly hint: "Expected format: https://your-project.inth.app";
|
|
96
96
|
};
|
|
97
97
|
readonly INSTANCE_NOT_FOUND: {
|
|
98
98
|
readonly code: "INSTANCE_NOT_FOUND";
|
|
99
|
-
readonly message: "
|
|
100
|
-
readonly hint: "Run `c15t
|
|
99
|
+
readonly message: "Project not found";
|
|
100
|
+
readonly hint: "Run `c15t projects list` to see available projects";
|
|
101
101
|
};
|
|
102
102
|
readonly INSTANCE_NAME_INVALID: {
|
|
103
103
|
readonly code: "INSTANCE_NAME_INVALID";
|
|
104
|
-
readonly message: "Invalid
|
|
105
|
-
readonly hint: "
|
|
104
|
+
readonly message: "Invalid project slug";
|
|
105
|
+
readonly hint: "Project slugs must be alphanumeric with hyphens";
|
|
106
106
|
};
|
|
107
107
|
readonly FILE_NOT_FOUND: {
|
|
108
108
|
readonly code: "FILE_NOT_FOUND";
|
|
@@ -1,77 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Provides anonymous usage tracking to help improve the CLI.
|
|
5
|
-
* Respects user preferences and can be disabled via --no-telemetry flag
|
|
6
|
-
* or C15T_TELEMETRY_DISABLED environment variable.
|
|
7
|
-
*/
|
|
8
|
-
import { PostHog } from 'posthog-node';
|
|
9
|
-
import type { CliLogger, Telemetry } from '../types';
|
|
10
|
-
export declare const TelemetryEventName: {
|
|
11
|
-
readonly CLI_INVOKED: "cli.invoked";
|
|
12
|
-
readonly CLI_COMPLETED: "cli.completed";
|
|
13
|
-
readonly CLI_EXITED: "cli.exited";
|
|
14
|
-
readonly CLI_ENVIRONMENT_DETECTED: "cli.environment_detected";
|
|
15
|
-
readonly COMMAND_EXECUTED: "command.executed";
|
|
16
|
-
readonly COMMAND_SUCCEEDED: "command.succeeded";
|
|
17
|
-
readonly COMMAND_FAILED: "command.failed";
|
|
18
|
-
readonly COMMAND_UNKNOWN: "command.unknown";
|
|
19
|
-
readonly INTERACTIVE_MENU_OPENED: "ui.menu.opened";
|
|
20
|
-
readonly INTERACTIVE_MENU_EXITED: "ui.menu.exited";
|
|
21
|
-
readonly AUTH_LOGIN_STARTED: "auth.login.started";
|
|
22
|
-
readonly AUTH_LOGIN_SUCCEEDED: "auth.login.succeeded";
|
|
23
|
-
readonly AUTH_LOGIN_FAILED: "auth.login.failed";
|
|
24
|
-
readonly AUTH_LOGOUT: "auth.logout";
|
|
25
|
-
readonly CONFIG_LOADED: "config.loaded";
|
|
26
|
-
readonly CONFIG_ERROR: "config.error";
|
|
27
|
-
readonly CONFIG_UPDATED: "config.updated";
|
|
28
|
-
readonly HELP_DISPLAYED: "help.displayed";
|
|
29
|
-
readonly VERSION_DISPLAYED: "version.displayed";
|
|
30
|
-
readonly ONBOARDING_STARTED: "onboarding.started";
|
|
31
|
-
readonly ONBOARDING_COMPLETED: "onboarding.completed";
|
|
32
|
-
readonly ONBOARDING_EXITED: "onboarding.exited";
|
|
33
|
-
readonly ONBOARDING_STORAGE_MODE_SELECTED: "onboarding.storage_mode_selected";
|
|
34
|
-
readonly ONBOARDING_C15T_MODE_CONFIGURED: "onboarding.c15t_mode_configured";
|
|
35
|
-
readonly ONBOARDING_OFFLINE_MODE_CONFIGURED: "onboarding.offline_mode_configured";
|
|
36
|
-
readonly ONBOARDING_SELF_HOSTED_CONFIGURED: "onboarding.self_hosted_configured";
|
|
37
|
-
readonly ONBOARDING_CUSTOM_MODE_CONFIGURED: "onboarding.custom_mode_configured";
|
|
38
|
-
readonly ONBOARDING_DEPENDENCIES_CHOICE: "onboarding.dependencies_choice";
|
|
39
|
-
readonly ONBOARDING_DEPENDENCIES_INSTALLED: "onboarding.dependencies_installed";
|
|
40
|
-
readonly ONBOARDING_GITHUB_STAR: "onboarding.github_star";
|
|
41
|
-
readonly INSTANCES_LISTED: "instances.listed";
|
|
42
|
-
readonly INSTANCE_SELECTED: "instance.selected";
|
|
43
|
-
readonly INSTANCE_CREATED: "instance.created";
|
|
44
|
-
readonly ERROR_OCCURRED: "error.occurred";
|
|
45
|
-
readonly MIGRATION_STARTED: "migration.started";
|
|
46
|
-
readonly MIGRATION_PLANNED: "migration.planned";
|
|
47
|
-
readonly MIGRATION_EXECUTED: "migration.executed";
|
|
48
|
-
readonly MIGRATION_COMPLETED: "migration.completed";
|
|
49
|
-
readonly MIGRATION_FAILED: "migration.failed";
|
|
50
|
-
readonly GENERATE_STARTED: "generate.started";
|
|
51
|
-
readonly GENERATE_COMPLETED: "generate.completed";
|
|
52
|
-
readonly GENERATE_FAILED: "generate.failed";
|
|
53
|
-
readonly SELF_HOST_STARTED: "self-host.started";
|
|
54
|
-
readonly SELF_HOST_COMPLETED: "self-host.completed";
|
|
55
|
-
readonly SELF_HOST_FAILED: "self-host.failed";
|
|
56
|
-
};
|
|
57
|
-
export type TelemetryEventNameType = (typeof TelemetryEventName)[keyof typeof TelemetryEventName];
|
|
58
|
-
export interface TelemetryOptions {
|
|
59
|
-
/** Custom PostHog client instance */
|
|
60
|
-
client?: PostHog;
|
|
61
|
-
/** Disable telemetry */
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/** Enable debug mode */
|
|
64
|
-
debug?: boolean;
|
|
65
|
-
/** Default properties for all events */
|
|
66
|
-
defaultProperties?: Record<string, string | number | boolean>;
|
|
67
|
-
/** Logger instance */
|
|
68
|
-
logger?: CliLogger;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create a telemetry instance
|
|
72
|
-
*/
|
|
73
|
-
export declare function createTelemetry(options?: TelemetryOptions): Telemetry;
|
|
74
|
-
/**
|
|
75
|
-
* Create a disabled telemetry instance (for testing)
|
|
76
|
-
*/
|
|
77
|
-
export declare function createDisabledTelemetry(): Telemetry;
|
|
1
|
+
export { createTelemetry, Telemetry, TelemetryEventName, type TelemetryEventName as TelemetryEventNameType, type TelemetryOptions, } from '../utils/telemetry';
|
|
2
|
+
export declare function createDisabledTelemetry(): import("./telemetry").Telemetry;
|
|
@@ -19,7 +19,7 @@ export interface ModeSelectionOutput {
|
|
|
19
19
|
mode: StorageMode;
|
|
20
20
|
}
|
|
21
21
|
export declare const modeSelectionActor: import("xstate").PromiseActorLogic<ModeSelectionOutput, ModeSelectionInput, import("xstate").EventObject>;
|
|
22
|
-
type HostedProvider = '
|
|
22
|
+
type HostedProvider = 'inth.com' | 'self-hosted';
|
|
23
23
|
export interface HostedModeInput {
|
|
24
24
|
cliContext: CliContext;
|
|
25
25
|
initialURL?: string;
|
|
@@ -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" | "
|
|
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, {
|
|
@@ -44,8 +44,8 @@ export interface GenerateMachineContext extends BaseMachineContext {
|
|
|
44
44
|
/** Mode passed as CLI argument */
|
|
45
45
|
modeArg: StorageMode | null;
|
|
46
46
|
/** Hosted provider selection when mode is hosted */
|
|
47
|
-
hostedProvider: '
|
|
48
|
-
/** Backend URL for hosted mode (
|
|
47
|
+
hostedProvider: 'inth.com' | 'self-hosted' | null;
|
|
48
|
+
/** Backend URL for hosted mode (inth.com or self-hosted provider) */
|
|
49
49
|
backendURL: string | null;
|
|
50
50
|
/** Whether to store backend URL in .env file */
|
|
51
51
|
useEnvFile: boolean;
|
package/dist-types/types.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
208
|
+
/** Project ID */
|
|
219
209
|
id: string;
|
|
220
|
-
/**
|
|
210
|
+
/** Project name */
|
|
221
211
|
name: string;
|
|
222
212
|
/** Organization slug */
|
|
223
213
|
organizationSlug?: string;
|
|
224
214
|
/** Provisioning region */
|
|
225
215
|
region?: string;
|
|
226
|
-
/**
|
|
216
|
+
/** Project backend URL */
|
|
227
217
|
url: string;
|
|
228
218
|
/** Created timestamp */
|
|
229
219
|
createdAt: string;
|
|
230
|
-
/**
|
|
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 '
|
|
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
|
|
7
|
-
note: (
|
|
8
|
-
outro: (message: string
|
|
9
|
-
success: (message: string
|
|
10
|
-
failed: (message: string
|
|
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
|
|
2
|
-
import {
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|
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
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
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
|
-
*
|
|
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,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/cli",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
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
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://c15t.com",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/c15t/c15t.git",
|
|
9
9
|
"directory": "packages/cli"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": "./dist/index.mjs",
|
|
14
14
|
"main": "./dist/index.mjs",
|
|
@@ -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,24 +33,24 @@
|
|
|
33
33
|
"test:watch": "vitest"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@c15t/backend": "2.0.0
|
|
37
|
-
"@c15t/logger": "
|
|
36
|
+
"@c15t/backend": "2.0.0",
|
|
37
|
+
"@c15t/logger": "2.0.0",
|
|
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"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@c15t/typescript-config": "0.0.1
|
|
53
|
+
"@c15t/typescript-config": "0.0.1",
|
|
54
54
|
"@c15t/vitest-config": "1.0.0",
|
|
55
55
|
"@types/figlet": "1.7.0",
|
|
56
56
|
"@types/fs-extra": "11.0.4",
|
package/readme.json
CHANGED
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"Set `C15T_TELEMETRY_DISABLED=1` in your environment"
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
|
-
"docsLink": "https://
|
|
81
|
-
"quickStartLink": "https://
|
|
80
|
+
"docsLink": "https://c15t.com/docs/cli/overview",
|
|
81
|
+
"quickStartLink": "https://c15t.com/docs/cli/quickstart",
|
|
82
82
|
"githubLink": "https://github.com/c15t/c15t",
|
|
83
83
|
"showCLIGeneration": true
|
|
84
84
|
}
|