@capgo/cli 7.113.0 → 7.114.1
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 +450 -450
- package/dist/package.json +8 -2
- package/dist/src/analytics/error-category.d.ts +6 -0
- package/dist/src/analytics/org-resolver.d.ts +11 -0
- package/dist/src/analytics/track.d.ts +68 -0
- package/dist/src/app/add.d.ts +3 -1
- package/dist/src/app/info.d.ts +5 -0
- package/dist/src/posthog.d.ts +1 -0
- package/dist/src/sdk.js +269 -269
- package/dist/src/utils.d.ts +2 -2
- package/package.json +8 -2
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.114.1",
|
|
5
5
|
"description": "A CLI to upload to capgo servers",
|
|
6
6
|
"author": "Martin martin@capgo.app",
|
|
7
7
|
"license": "Apache 2.0",
|
|
@@ -81,6 +81,12 @@
|
|
|
81
81
|
"test:android-onboarding-progress": "bun test/test-android-onboarding-progress.mjs",
|
|
82
82
|
"test:onboarding-telemetry": "bun test/test-onboarding-telemetry.mjs",
|
|
83
83
|
"test:v2-event-migration": "bun test/test-v2-event-migration.mjs",
|
|
84
|
+
"test:analytics": "bun test/test-analytics.mjs",
|
|
85
|
+
"test:analytics-error-category": "bun test/test-analytics-error-category.mjs",
|
|
86
|
+
"test:analytics-org-resolver": "bun test/test-analytics-org-resolver.mjs",
|
|
87
|
+
"test:mcp-analytics": "bun test/test-mcp-analytics.mjs",
|
|
88
|
+
"test:app-created-source": "bun test/test-app-created-source.mjs",
|
|
89
|
+
"test:doctor-analytics": "bun test/test-doctor-analytics.mjs",
|
|
84
90
|
"test:posthog-exception": "bun test/test-posthog-exception.mjs",
|
|
85
91
|
"test:onboarding-recovery": "bun test/test-onboarding-recovery.mjs",
|
|
86
92
|
"test:onboarding-progress": "bun test/test-onboarding-progress.mjs",
|
|
@@ -98,7 +104,7 @@
|
|
|
98
104
|
"test:macos-signing": "bun test/test-macos-signing.mjs",
|
|
99
105
|
"test:apple-api-import-helpers": "bun test/test-apple-api-import-helpers.mjs",
|
|
100
106
|
"test:manifest-path-encoding": "bun test/test-manifest-path-encoding.mjs",
|
|
101
|
-
"test": "bun run build && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-render-markdown",
|
|
107
|
+
"test": "bun run build && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-render-markdown",
|
|
102
108
|
"test:build-platform-selection": "bun test/test-build-platform-selection.mjs",
|
|
103
109
|
"test:ai-log-capture": "bun test/test-ai-log-capture.mjs",
|
|
104
110
|
"test:ai-analyze-flow": "bun test/test-ai-analyze-flow.mjs",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type CliErrorCategory = 'network_error' | 'timeout' | 'unauthorized' | 'forbidden' | 'not_found' | 'payload_too_large' | 'validation_error' | 'server_error' | 'commander' | 'unknown';
|
|
2
|
+
/**
|
|
3
|
+
* Maps an arbitrary thrown value to a closed enum so telemetry never leaks
|
|
4
|
+
* error text, paths, or user input. Returns 'unknown' for anything unmatched.
|
|
5
|
+
*/
|
|
6
|
+
export declare function categorizeCliError(error: unknown): CliErrorCategory;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createSupabaseClient } from '../utils';
|
|
2
|
+
export interface OrgResolverDeps {
|
|
3
|
+
/** Injectable for tests; defaults to the real Supabase client factory. */
|
|
4
|
+
createClient?: typeof createSupabaseClient;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolves an app's owner organization id (`apps.owner_org`), promise-cached
|
|
8
|
+
* per `(apikey, appId)`. Returns undefined on any error — never throws.
|
|
9
|
+
* Extracted so the analytics layer and onboarding analytics share one path.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveOwnerOrgId(apikey: string, appId: string, deps?: OrgResolverDeps, signal?: AbortSignal): Promise<string | undefined>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
type InvocationSource = 'cli' | 'mcp';
|
|
2
|
+
export declare function setInvocationSource(source: InvocationSource): void;
|
|
3
|
+
export declare function getInvocationSource(): InvocationSource;
|
|
4
|
+
export declare function isTelemetryDisabled(): boolean;
|
|
5
|
+
export interface GlobalAnalyticsProps {
|
|
6
|
+
cli_version: string;
|
|
7
|
+
node_version: string;
|
|
8
|
+
os_platform: string;
|
|
9
|
+
os_arch: string;
|
|
10
|
+
is_ci: boolean;
|
|
11
|
+
is_tty: boolean;
|
|
12
|
+
invocation_source: InvocationSource;
|
|
13
|
+
ci_provider?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function getGlobalAnalyticsProps(): GlobalAnalyticsProps;
|
|
16
|
+
export declare function flushAnalytics(timeoutMs?: number): Promise<void>;
|
|
17
|
+
export declare function resolveTrackingContext(apikey: string, signal?: AbortSignal): Promise<{
|
|
18
|
+
appId?: string;
|
|
19
|
+
orgId?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export interface TrackEventInput {
|
|
22
|
+
channel: string;
|
|
23
|
+
event: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
/** Org id for actor-scoped attribution. Omitted => resolved best-effort. */
|
|
26
|
+
orgId?: string;
|
|
27
|
+
/** App id (also lets the backend verify org ownership). */
|
|
28
|
+
appId?: string;
|
|
29
|
+
/** Explicit key; falls back to the saved key. No key => no event. */
|
|
30
|
+
apikey?: string;
|
|
31
|
+
tags?: Record<string, string | number | boolean>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generic v2 actor-scoped event. Never throws. Does nothing when telemetry is
|
|
35
|
+
* disabled or no API key is resolvable (the accepted unauthenticated gap).
|
|
36
|
+
* When the caller omits appId/orgId, both are resolved best-effort from the
|
|
37
|
+
* local Capacitor config (app_id → owner_org) so local commands still get
|
|
38
|
+
* user + org attribution when the user is logged in.
|
|
39
|
+
*/
|
|
40
|
+
export declare function trackEvent(input: TrackEventInput): Promise<void>;
|
|
41
|
+
export interface CommandContext {
|
|
42
|
+
flags: string[];
|
|
43
|
+
positional_arg_count: number;
|
|
44
|
+
}
|
|
45
|
+
interface CommanderLike {
|
|
46
|
+
args: readonly string[];
|
|
47
|
+
opts: () => Record<string, unknown>;
|
|
48
|
+
getOptionValueSource: (key: string) => string | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Pulls only privacy-safe context from a Commander command: the NAMES of
|
|
52
|
+
* user-provided flags (never their values) and the positional arg count.
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractCommandContext(command: CommanderLike): CommandContext;
|
|
55
|
+
export declare function trackCommandInvoked(commandPath: string, ctx: CommandContext): void;
|
|
56
|
+
export declare function trackCommandSucceeded(commandPath: string): void;
|
|
57
|
+
export declare function trackCommandFailed(commandPath: string, opts: {
|
|
58
|
+
errorCategory: string;
|
|
59
|
+
exitCode: number;
|
|
60
|
+
}): void;
|
|
61
|
+
type AnyAsyncFn = (...args: any[]) => Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Wraps an MCP tool handler to emit a `MCP Tool Invoked` event with the tool
|
|
64
|
+
* name, success flag, and duration. Re-throws so behavior is unchanged.
|
|
65
|
+
*/
|
|
66
|
+
export declare function withMcpToolTracking<H extends AnyAsyncFn>(toolName: string, handler: H): H;
|
|
67
|
+
export declare function trackMcpServerStarted(hasApikey: boolean): void;
|
|
68
|
+
export {};
|
package/dist/src/app/add.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { AppOptions } from '../schemas/app';
|
|
2
2
|
import type { Organization } from '../utils';
|
|
3
3
|
export declare const reverseDomainRegex: RegExp;
|
|
4
|
-
export
|
|
4
|
+
export type AppCreateSource = 'cli-direct' | 'onboarding' | 'mcp';
|
|
5
|
+
export declare function resolveAppCreateSource(explicit?: AppCreateSource): AppCreateSource;
|
|
6
|
+
export declare function addAppInternal(initialAppId: string, options: AppOptions, organization?: Organization, silent?: boolean, source?: AppCreateSource): Promise<{
|
|
5
7
|
appId: any;
|
|
6
8
|
organizationUid: string;
|
|
7
9
|
userId: string;
|
package/dist/src/app/info.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
interface DoctorInfoOptions {
|
|
2
2
|
packageJson?: string;
|
|
3
3
|
}
|
|
4
|
+
export declare function computeDoctorAnalyticsTags(installed: Record<string, string>, latest: Record<string, string>): {
|
|
5
|
+
is_outdated: boolean;
|
|
6
|
+
dependency_count: number;
|
|
7
|
+
outdated_count: number;
|
|
8
|
+
};
|
|
4
9
|
export declare function getInfoInternal(options: DoctorInfoOptions, silent?: boolean): Promise<{
|
|
5
10
|
appName: string;
|
|
6
11
|
appId: any;
|
package/dist/src/posthog.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ interface CapturePosthogExceptionPayload {
|
|
|
6
6
|
kind: CliPosthogExceptionKind;
|
|
7
7
|
status?: number;
|
|
8
8
|
}
|
|
9
|
+
export declare function isTruthyEnvValue(value: string | undefined): boolean;
|
|
9
10
|
export declare function shouldCapturePosthogException(error: unknown): boolean;
|
|
10
11
|
export declare function getCommandPath(command: Command): string;
|
|
11
12
|
export declare function capturePosthogException(payload: CapturePosthogExceptionPayload): Promise<boolean>;
|