@capgo/cli 8.5.3 → 8.7.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/dist/index.js +523 -523
- package/dist/package.json +1 -1
- package/dist/src/analytics/global-props.d.ts +22 -0
- package/dist/src/analytics/track.d.ts +2 -14
- package/dist/src/build/onboarding/analytics.d.ts +2 -0
- package/dist/src/build/onboarding/android/ui/app.d.ts +5 -0
- package/dist/src/build/onboarding/journey.d.ts +16 -0
- package/dist/src/build/onboarding/telemetry.d.ts +37 -0
- package/dist/src/build/onboarding/ui/app.d.ts +5 -0
- package/dist/src/build/onboarding/ui/shell.d.ts +5 -0
- package/dist/src/schemas/build.d.ts +1 -0
- package/dist/src/sdk.js +225 -225
- package/dist/src/utils.d.ts +27 -6
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type InvocationSource = 'cli' | 'mcp';
|
|
2
|
+
export declare function setInvocationSource(source: InvocationSource): void;
|
|
3
|
+
export declare function getInvocationSource(): InvocationSource;
|
|
4
|
+
export interface GlobalAnalyticsProps {
|
|
5
|
+
cli_version: string;
|
|
6
|
+
node_version: string;
|
|
7
|
+
os_platform: string;
|
|
8
|
+
os_arch: string;
|
|
9
|
+
os_release: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
is_ci: boolean;
|
|
12
|
+
is_tty: boolean;
|
|
13
|
+
invocation_source: InvocationSource;
|
|
14
|
+
ci_provider?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Properties attached to every CLI telemetry event. Injected at the shared
|
|
18
|
+
* sendEvent() send path (see cli/src/utils.ts) so both trackEvent() and the
|
|
19
|
+
* many direct sendEvent() callers are tagged with the runtime OS, arch, OS
|
|
20
|
+
* release, timezone, CLI/Node versions and CI context.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getGlobalAnalyticsProps(): GlobalAnalyticsProps;
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { withSupabaseSource } from './supabase-perf';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare function getInvocationSource(): InvocationSource;
|
|
2
|
+
export { getGlobalAnalyticsProps, getInvocationSource, setInvocationSource } from './global-props';
|
|
3
|
+
export type { GlobalAnalyticsProps, InvocationSource } from './global-props';
|
|
5
4
|
export declare function isTelemetryDisabled(): boolean;
|
|
6
|
-
export interface GlobalAnalyticsProps {
|
|
7
|
-
cli_version: string;
|
|
8
|
-
node_version: string;
|
|
9
|
-
os_platform: string;
|
|
10
|
-
os_arch: string;
|
|
11
|
-
is_ci: boolean;
|
|
12
|
-
is_tty: boolean;
|
|
13
|
-
invocation_source: InvocationSource;
|
|
14
|
-
ci_provider?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function getGlobalAnalyticsProps(): GlobalAnalyticsProps;
|
|
17
5
|
export declare function flushAnalytics(timeoutMs?: number): Promise<void>;
|
|
18
6
|
export declare function resolveTrackingContext(apikey: string, signal?: AbortSignal): Promise<{
|
|
19
7
|
appId?: string;
|
|
@@ -14,6 +14,8 @@ interface TrackBuildOnboardingWorkflowOptions extends WorkflowDiffTelemetry {
|
|
|
14
14
|
appId: string;
|
|
15
15
|
platform: 'ios' | 'android';
|
|
16
16
|
apikey?: string;
|
|
17
|
+
/** Correlation id tying every event from one onboarding run together. */
|
|
18
|
+
journeyId?: string;
|
|
17
19
|
decision?: BuildOnboardingWorkflowDecision;
|
|
18
20
|
packageManager?: PackageManager;
|
|
19
21
|
buildScriptType?: BuildScriptChoice['type'];
|
|
@@ -8,6 +8,11 @@ interface AppProps {
|
|
|
8
8
|
/** Optional Capgo API key passed via -a/--apikey flag; takes precedence over saved key. */
|
|
9
9
|
apikey?: string;
|
|
10
10
|
supaHost?: string;
|
|
11
|
+
/** Correlation id for this onboarding run; emitted as `journey_id` on every analytics event. */
|
|
12
|
+
journeyId: string;
|
|
13
|
+
/** Reports the current step to the shell on every transition, so the caller can
|
|
14
|
+
* record where the user dropped off for the quit event. */
|
|
15
|
+
onStep?: (step: string) => void;
|
|
11
16
|
/** Reports the wizard outcome to the shell when it reaches build-complete, so
|
|
12
17
|
* the caller prints an accurate post-exit message + durable summary instead of
|
|
13
18
|
* always claiming success. Never fires on cancel/missing-platform exits. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A correlation id for a single Builder onboarding journey.
|
|
3
|
+
*
|
|
4
|
+
* Generated once per `build init` / onboarding process (in command.ts) and
|
|
5
|
+
* threaded through every analytics event the wizard emits — per-step funnel
|
|
6
|
+
* events, named action events, workflow-file events, and the terminal
|
|
7
|
+
* quit/cancel event. Without it, the events from one user's run are
|
|
8
|
+
* indistinguishable from another's in PostHog, so a "journey" can't be
|
|
9
|
+
* reconstructed when several runs overlap in the same window.
|
|
10
|
+
*
|
|
11
|
+
* The `bj_` prefix (Builder Journey) makes the id self-identifying in raw
|
|
12
|
+
* analytics payloads and easy to grep for. Scope is one process: a
|
|
13
|
+
* quit-and-resume starts a fresh journey id (cross-run stitching is a possible
|
|
14
|
+
* future enhancement, but each run is still fully correlated on its own).
|
|
15
|
+
*/
|
|
16
|
+
export declare function newBuilderJourneyId(): string;
|
|
@@ -4,6 +4,8 @@ export interface TrackBuilderOnboardingStepInput {
|
|
|
4
4
|
apikey: string;
|
|
5
5
|
appId: string;
|
|
6
6
|
orgId: string;
|
|
7
|
+
/** Correlation id tying every event from one onboarding run together. */
|
|
8
|
+
journeyId: string;
|
|
7
9
|
platform: Platform;
|
|
8
10
|
step: OnboardingStep | AndroidOnboardingStep;
|
|
9
11
|
durationMs?: number;
|
|
@@ -19,6 +21,8 @@ export interface TrackBuilderOnboardingActionInput {
|
|
|
19
21
|
apikey: string;
|
|
20
22
|
appId: string;
|
|
21
23
|
orgId: string;
|
|
24
|
+
/** Correlation id tying every event from one onboarding run together. */
|
|
25
|
+
journeyId: string;
|
|
22
26
|
platform: Platform;
|
|
23
27
|
step: OnboardingStep | AndroidOnboardingStep;
|
|
24
28
|
action: BuilderOnboardingAction;
|
|
@@ -26,3 +30,36 @@ export interface TrackBuilderOnboardingActionInput {
|
|
|
26
30
|
}
|
|
27
31
|
export declare function trackBuilderOnboardingStep(input: TrackBuilderOnboardingStepInput): Promise<void>;
|
|
28
32
|
export declare function trackBuilderOnboardingAction(input: TrackBuilderOnboardingActionInput): Promise<void>;
|
|
33
|
+
export interface TrackBuilderOnboardingCancelledInput {
|
|
34
|
+
apikey: string;
|
|
35
|
+
appId: string;
|
|
36
|
+
/** May be undefined when the owner org couldn't be resolved post-exit. */
|
|
37
|
+
orgId?: string;
|
|
38
|
+
/** Correlation id tying every event from one onboarding run together. */
|
|
39
|
+
journeyId: string;
|
|
40
|
+
/**
|
|
41
|
+
* The platform being onboarded, or undefined when the user quit BEFORE
|
|
42
|
+
* choosing one (e.g. on the platform picker). The undefined case is itself a
|
|
43
|
+
* useful signal — it isolates "left at the very first screen" drop-off.
|
|
44
|
+
*/
|
|
45
|
+
platform?: Platform;
|
|
46
|
+
/** The step the user was on when they quit, when known. */
|
|
47
|
+
lastStep?: string;
|
|
48
|
+
/** Total wall-clock duration of the journey, from launch to quit. */
|
|
49
|
+
durationMs?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Abort signal used to time-box the post-quit flush so a stalled network
|
|
52
|
+
* can't keep the CLI alive after the user has already exited the wizard.
|
|
53
|
+
*/
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Emits the terminal "Builder Onboarding Quit" event when a journey ends
|
|
58
|
+
* without reaching build-complete (user cancel, Ctrl+C, missing platform, or a
|
|
59
|
+
* fatal error that exits). Fired ONCE from command.ts after the wizard tears
|
|
60
|
+
* down — never mid-flow — so each journey has at most one quit marker. Unlike
|
|
61
|
+
* the per-step events this carries no org-scoped requirement: it sends with
|
|
62
|
+
* whatever org id could be resolved (possibly none) rather than dropping the
|
|
63
|
+
* event, because a quit is exactly when we most want the funnel exit recorded.
|
|
64
|
+
*/
|
|
65
|
+
export declare function trackBuilderOnboardingCancelled(input: TrackBuilderOnboardingCancelledInput): Promise<void>;
|
|
@@ -36,6 +36,11 @@ interface AppProps {
|
|
|
36
36
|
/** Optional Capgo API key passed via -a/--apikey flag; takes precedence over saved key */
|
|
37
37
|
apikey?: string;
|
|
38
38
|
supaHost?: string;
|
|
39
|
+
/** Correlation id for this onboarding run; emitted as `journey_id` on every analytics event. */
|
|
40
|
+
journeyId: string;
|
|
41
|
+
/** Reports the current step to the shell on every transition, so the caller can
|
|
42
|
+
* record where the user dropped off for the quit event. */
|
|
43
|
+
onStep?: (step: string) => void;
|
|
39
44
|
/**
|
|
40
45
|
* Reports the wizard outcome to the shell when it reaches build-complete, so
|
|
41
46
|
* the caller prints an accurate post-exit message + durable summary instead of
|
|
@@ -25,6 +25,8 @@ export interface OnboardingShellProps {
|
|
|
25
25
|
guidedHelperUsable: boolean;
|
|
26
26
|
apikey?: string;
|
|
27
27
|
supaHost?: string;
|
|
28
|
+
/** Correlation id for this onboarding run; threaded into every analytics event the apps emit. */
|
|
29
|
+
journeyId: string;
|
|
28
30
|
/** Pre-resolved platform (--platform flag or the single existing native dir); skips the picker. */
|
|
29
31
|
initialPlatform?: Platform;
|
|
30
32
|
/**
|
|
@@ -38,6 +40,9 @@ export interface OnboardingShellProps {
|
|
|
38
40
|
};
|
|
39
41
|
/** Called once a platform is chosen so the caller can print the completion breadcrumb. */
|
|
40
42
|
onResolvePlatform?: (platform: Platform) => void;
|
|
43
|
+
/** Called by the mounted app on every step transition, so the caller can record
|
|
44
|
+
* where the user dropped off for the quit event. */
|
|
45
|
+
onStep?: (step: string) => void;
|
|
41
46
|
/** Called by the mounted app when it reaches the build-complete screen, so the
|
|
42
47
|
* caller prints the accurate post-exit message + durable summary. If the wizard
|
|
43
48
|
* exits any other way (cancel / missing platform), this never fires and the
|
|
@@ -64,6 +64,7 @@ export declare const buildRequestOptionsSchema: z.ZodObject<{
|
|
|
64
64
|
"auto-prompt": "auto-prompt";
|
|
65
65
|
"caller-handled": "caller-handled";
|
|
66
66
|
}>>;
|
|
67
|
+
builderJourneyId: z.ZodOptional<z.ZodString>;
|
|
67
68
|
}, z.core.$strip>;
|
|
68
69
|
export type BuildRequestOptions = z.infer<typeof buildRequestOptionsSchema>;
|
|
69
70
|
export declare const buildNeededOptionsSchema: z.ZodObject<{
|