@c15t/cli 2.0.0-rc.5 → 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.
- package/README.md +1 -1
- package/dist/145.mjs +7401 -0
- package/dist/generate-files.mjs +1771 -0
- package/dist/index.mjs +1 -6311
- package/dist-types/auth/base-url.d.ts +1 -1
- package/dist-types/auth/config-store.d.ts +2 -2
- package/dist-types/auth/types.d.ts +1 -1
- package/dist-types/commands/codemods/add-stylesheet-imports.d.ts +54 -0
- package/dist-types/commands/generate/prompts/theme.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/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 +12 -0
- 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 +5 -5
- package/dist-types/core/telemetry.d.ts +2 -77
- package/dist-types/machines/generate/machine.d.ts +7 -7
- 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 +14 -14
- package/dist/642.mjs +0 -1804
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/cli",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
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,21 +33,21 @@
|
|
|
33
33
|
"test:watch": "vitest"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@c15t/backend": "2.0.0-rc.
|
|
37
|
-
"@c15t/logger": "1.0.2-rc.
|
|
38
|
-
"@clack/prompts": "
|
|
39
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
40
|
-
"c12": "3.3.
|
|
41
|
-
"dotenv": "17.
|
|
42
|
-
"
|
|
43
|
-
"
|
|
36
|
+
"@c15t/backend": "2.0.0-rc.8",
|
|
37
|
+
"@c15t/logger": "1.0.2-rc.1",
|
|
38
|
+
"@clack/prompts": "1.1.0",
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
40
|
+
"c12": "3.3.3",
|
|
41
|
+
"dotenv": "17.3.1",
|
|
42
|
+
"evlog": "^2.11.1",
|
|
43
|
+
"figlet": "1.11.0",
|
|
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.17.0",
|
|
48
48
|
"ts-morph": "27.0.2",
|
|
49
|
-
"xstate": "^5.
|
|
50
|
-
"zod": "4.
|
|
49
|
+
"xstate": "^5.30.0",
|
|
50
|
+
"zod": "4.3.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@c15t/typescript-config": "0.0.1-beta.1",
|