@capgo/cli 8.0.0-alpha.5 → 8.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 +733 -84
- package/dist/index.js +1132 -317
- package/dist/keychain-export.swift +351 -0
- package/dist/package.json +120 -30
- package/dist/src/ai/analyze.d.ts +48 -0
- package/dist/src/ai/log-capture.d.ts +14 -0
- package/dist/src/ai/prompt.d.ts +1 -0
- package/dist/src/ai/render-markdown.d.ts +12 -0
- package/dist/src/ai/sse.d.ts +5 -0
- package/dist/src/ai/stream-markdown.d.ts +22 -0
- package/dist/src/ai/telemetry.d.ts +39 -0
- package/dist/src/analytics/error-category.d.ts +11 -0
- package/dist/src/analytics/org-resolver.d.ts +11 -0
- package/dist/src/analytics/supabase-perf.d.ts +48 -0
- package/dist/src/analytics/track.d.ts +70 -0
- package/dist/src/api/app.d.ts +17 -8
- package/dist/src/api/channels.d.ts +2442 -2729
- package/dist/src/api/crypto.d.ts +26 -0
- package/dist/src/api/update.d.ts +7 -1
- package/dist/src/api/versions.d.ts +9 -2
- package/dist/src/app/add.d.ts +6 -4
- package/dist/src/app/debug.d.ts +3 -7
- package/dist/src/app/delete.d.ts +1 -2
- package/dist/src/app/info.d.ts +5 -1
- package/dist/src/app/list.d.ts +23 -2
- package/dist/src/app/set.d.ts +0 -1
- package/dist/src/app/setting.d.ts +3 -9
- package/dist/src/app/updateProbe.d.ts +43 -0
- package/dist/src/build/credentials-command.d.ts +89 -0
- package/dist/src/build/credentials-manage.d.ts +7 -0
- package/dist/src/build/credentials.d.ts +78 -0
- package/dist/src/build/env-render.d.ts +8 -0
- package/dist/src/build/last-output-command.d.ts +6 -0
- package/dist/src/build/mobileprovision-parser.d.ts +35 -0
- package/dist/src/build/needed.d.ts +28 -0
- package/dist/src/build/onboarding/ai-fit.d.ts +110 -0
- package/dist/src/build/onboarding/analytics.d.ts +23 -0
- package/dist/src/build/onboarding/android/gcp-api.d.ts +128 -0
- package/dist/src/build/onboarding/android/gradle-parser.d.ts +19 -0
- package/dist/src/build/onboarding/android/keystore.d.ts +77 -0
- package/dist/src/build/onboarding/android/oauth-config.d.ts +24 -0
- package/dist/src/build/onboarding/android/oauth-google.d.ts +134 -0
- package/dist/src/build/onboarding/android/play-api.d.ts +91 -0
- package/dist/src/build/onboarding/android/progress.d.ts +22 -0
- package/dist/src/build/onboarding/android/service-account-validation.d.ts +58 -0
- package/dist/src/build/onboarding/android/types.d.ts +72 -0
- package/dist/src/build/onboarding/android/ui/app.d.ts +17 -0
- package/dist/src/build/onboarding/app-verification.d.ts +86 -0
- package/dist/src/build/onboarding/apple-api.d.ts +234 -0
- package/dist/src/build/onboarding/build-log.d.ts +10 -0
- package/dist/src/build/onboarding/bundle-id-detector.d.ts +117 -0
- package/dist/src/build/onboarding/ci-secrets.d.ts +87 -0
- package/dist/src/build/onboarding/command.d.ts +6 -0
- package/dist/src/build/onboarding/csr.d.ts +33 -0
- package/dist/src/build/onboarding/diff-utils.d.ts +24 -0
- package/dist/src/build/onboarding/env-export.d.ts +46 -0
- package/dist/src/build/onboarding/error-categories.d.ts +13 -0
- package/dist/src/build/onboarding/file-picker.d.ts +47 -0
- package/dist/src/build/onboarding/macos-signing.d.ts +190 -0
- package/dist/src/build/onboarding/min-terminal-size.d.ts +16 -0
- package/dist/src/build/onboarding/progress.d.ts +51 -0
- package/dist/src/build/onboarding/recovery.d.ts +7 -0
- package/dist/src/build/onboarding/telemetry.d.ts +28 -0
- package/dist/src/build/onboarding/types.d.ts +140 -0
- package/dist/src/build/onboarding/ui/app.d.ts +36 -0
- package/dist/src/build/onboarding/ui/completed-steps-log.d.ts +9 -0
- package/dist/src/build/onboarding/ui/components.d.ts +178 -0
- package/dist/src/build/onboarding/ui/frame-fit.d.ts +10 -0
- package/dist/src/build/onboarding/ui/min-size-gate.d.ts +20 -0
- package/dist/src/build/onboarding/ui/platform-picker.d.ts +19 -0
- package/dist/src/build/onboarding/ui/shell.d.ts +33 -0
- package/dist/src/build/onboarding/ui/steps/android-ci.d.ts +45 -0
- package/dist/src/build/onboarding/ui/steps/android-keystore.d.ts +75 -0
- package/dist/src/build/onboarding/ui/steps/android-sa-gcp.d.ts +85 -0
- package/dist/src/build/onboarding/ui/steps/android-shared.d.ts +67 -0
- package/dist/src/build/onboarding/ui/steps/ios-ci.d.ts +44 -0
- package/dist/src/build/onboarding/ui/steps/ios-credentials.d.ts +66 -0
- package/dist/src/build/onboarding/ui/steps/ios-import.d.ts +79 -0
- package/dist/src/build/onboarding/ui/steps/ios-shared.d.ts +93 -0
- package/dist/src/build/onboarding/workflow-generator.d.ts +48 -0
- package/dist/src/build/onboarding/workflow-ui-helpers.d.ts +18 -0
- package/dist/src/build/onboarding/workflow-writer.d.ts +36 -0
- package/dist/src/build/output-record.d.ts +30 -0
- package/dist/src/build/pbxproj-parser.d.ts +48 -0
- package/dist/src/build/platform-paths.d.ts +20 -0
- package/dist/src/build/qr.d.ts +5 -0
- package/dist/src/build/request.d.ts +102 -43
- package/dist/src/build/telemetry.d.ts +17 -0
- package/dist/src/bundle/builder-cta.d.ts +67 -0
- package/dist/src/bundle/check.d.ts +0 -1
- package/dist/src/bundle/cleanup.d.ts +3 -12
- package/dist/src/bundle/compatibility.d.ts +23 -12
- package/dist/src/bundle/decrypt.d.ts +4 -0
- package/dist/src/bundle/delete.d.ts +3 -8
- package/dist/src/bundle/encrypt.d.ts +4 -0
- package/dist/src/bundle/list.d.ts +5 -2
- package/dist/src/bundle/partial.d.ts +5 -3
- package/dist/src/bundle/releaseType.d.ts +15 -0
- package/dist/src/bundle/unlink.d.ts +6 -5
- package/dist/src/bundle/upload-command.d.ts +8 -0
- package/dist/src/bundle/upload.d.ts +21 -14
- package/dist/src/bundle/upload_interface.d.ts +2 -50
- package/dist/src/bundle/zip.d.ts +4 -19
- package/dist/src/capacitor-cli.d.ts +13 -0
- package/dist/src/channel/add.d.ts +8 -10
- package/dist/src/channel/currentBundle.d.ts +3 -9
- package/dist/src/channel/delete.d.ts +3 -9
- package/dist/src/channel/list.d.ts +31 -4
- package/dist/src/channel/set.d.ts +2 -17
- package/dist/src/checksum.d.ts +1 -2
- package/dist/src/config/index.d.ts +2 -13
- package/dist/src/docs.d.ts +0 -1
- package/dist/src/github-command.d.ts +9 -0
- package/dist/src/github.d.ts +40 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/init/app-conflict.d.ts +2 -0
- package/dist/src/init/command.d.ts +57 -0
- package/dist/src/init/index.d.ts +1 -0
- package/dist/src/init/prompts.d.ts +41 -0
- package/dist/src/init/runtime.d.ts +111 -0
- package/dist/src/init/ui/app.d.ts +9 -0
- package/dist/src/init/ui/components.d.ts +31 -0
- package/dist/src/init/ui.d.ts +12 -0
- package/dist/src/init/updater.d.ts +13 -0
- package/dist/src/key.d.ts +16 -0
- package/dist/src/login.d.ts +0 -1
- package/dist/src/mcp/server.d.ts +5 -0
- package/dist/src/onboarding-support.d.ts +18 -0
- package/dist/src/organization/add.d.ts +26 -0
- package/dist/src/organization/delete.d.ts +3 -0
- package/dist/src/{organisation → organization}/index.d.ts +1 -1
- package/dist/src/{organisation → organization}/list.d.ts +14 -2
- package/dist/src/organization/members.d.ts +12 -0
- package/dist/src/organization/set.d.ts +21 -0
- package/dist/src/posthog.d.ts +13 -0
- package/dist/src/probe.d.ts +20 -0
- package/dist/src/promptPreferences.d.ts +13 -0
- package/dist/src/replicationProgress.d.ts +8 -0
- package/dist/src/run/device.d.ts +5 -0
- package/dist/src/runner-command.d.ts +5 -0
- package/dist/src/schemas/app.d.ts +26 -0
- package/dist/src/schemas/base.d.ts +7 -0
- package/dist/src/schemas/build.d.ts +196 -0
- package/dist/src/schemas/bundle.d.ts +157 -0
- package/dist/src/schemas/channel.d.ts +62 -0
- package/dist/src/schemas/common.d.ts +46 -0
- package/dist/src/schemas/config.d.ts +20 -0
- package/dist/src/schemas/index.d.ts +19 -0
- package/dist/src/schemas/organization.d.ts +41 -0
- package/dist/src/schemas/sdk.d.ts +335 -0
- package/dist/src/schemas/validate.d.ts +12 -0
- package/dist/src/sdk.d.ts +69 -337
- package/dist/src/sdk.js +542 -301
- package/dist/src/terminal-table.d.ts +7 -0
- package/dist/src/types/supabase.types.d.ts +2770 -296
- package/dist/src/updaterConfig.d.ts +8 -0
- package/dist/src/user/account.d.ts +0 -1
- package/dist/src/utils/latest-version.d.ts +0 -1
- package/dist/src/utils/safeWrites.d.ts +21 -0
- package/dist/src/utils/security_policy_errors.d.ts +47 -0
- package/dist/src/utils.d.ts +2869 -341
- package/dist/src/versionHelpers.d.ts +19 -0
- package/package.json +120 -30
- package/skills/native-builds/SKILL.md +255 -0
- package/skills/organization-management/SKILL.md +93 -0
- package/skills/release-management/SKILL.md +225 -0
- package/skills/usage/SKILL.md +92 -0
- package/dist/src/api/app.d.ts.map +0 -1
- package/dist/src/api/channels.d.ts.map +0 -1
- package/dist/src/api/cryptoV2.d.ts +0 -16
- package/dist/src/api/cryptoV2.d.ts.map +0 -1
- package/dist/src/api/update.d.ts.map +0 -1
- package/dist/src/api/versions.d.ts.map +0 -1
- package/dist/src/app/add.d.ts.map +0 -1
- package/dist/src/app/debug.d.ts.map +0 -1
- package/dist/src/app/delete.d.ts.map +0 -1
- package/dist/src/app/info.d.ts.map +0 -1
- package/dist/src/app/list.d.ts.map +0 -1
- package/dist/src/app/set.d.ts.map +0 -1
- package/dist/src/app/setting.d.ts.map +0 -1
- package/dist/src/build/request.d.ts.map +0 -1
- package/dist/src/bundle/check.d.ts.map +0 -1
- package/dist/src/bundle/cleanup.d.ts.map +0 -1
- package/dist/src/bundle/compatibility.d.ts.map +0 -1
- package/dist/src/bundle/decryptV2.d.ts +0 -13
- package/dist/src/bundle/decryptV2.d.ts.map +0 -1
- package/dist/src/bundle/delete.d.ts.map +0 -1
- package/dist/src/bundle/encryptV2.d.ts +0 -14
- package/dist/src/bundle/encryptV2.d.ts.map +0 -1
- package/dist/src/bundle/list.d.ts.map +0 -1
- package/dist/src/bundle/partial.d.ts.map +0 -1
- package/dist/src/bundle/unlink.d.ts.map +0 -1
- package/dist/src/bundle/upload.d.ts.map +0 -1
- package/dist/src/bundle/upload_interface.d.ts.map +0 -1
- package/dist/src/bundle/zip.d.ts.map +0 -1
- package/dist/src/channel/add.d.ts.map +0 -1
- package/dist/src/channel/currentBundle.d.ts.map +0 -1
- package/dist/src/channel/delete.d.ts.map +0 -1
- package/dist/src/channel/list.d.ts.map +0 -1
- package/dist/src/channel/set.d.ts.map +0 -1
- package/dist/src/checksum.d.ts.map +0 -1
- package/dist/src/config/index.d.ts.map +0 -1
- package/dist/src/docs.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/init.d.ts +0 -7
- package/dist/src/init.d.ts.map +0 -1
- package/dist/src/keyV2.d.ts +0 -19
- package/dist/src/keyV2.d.ts.map +0 -1
- package/dist/src/login.d.ts.map +0 -1
- package/dist/src/organisation/add.d.ts +0 -19
- package/dist/src/organisation/add.d.ts.map +0 -1
- package/dist/src/organisation/delete.d.ts +0 -8
- package/dist/src/organisation/delete.d.ts.map +0 -1
- package/dist/src/organisation/index.d.ts.map +0 -1
- package/dist/src/organisation/list.d.ts.map +0 -1
- package/dist/src/organisation/set.d.ts +0 -13
- package/dist/src/organisation/set.d.ts.map +0 -1
- package/dist/src/sdk.d.ts.map +0 -1
- package/dist/src/types/supabase.types.d.ts.map +0 -1
- package/dist/src/user/account.d.ts.map +0 -1
- package/dist/src/utils/latest-version.d.ts.map +0 -1
- package/dist/src/utils.d.ts.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface StreamingMarkdownRenderer {
|
|
2
|
+
/** Feed a decoded text chunk (any split point — mid-line, mid-fence). */
|
|
3
|
+
feed: (text: string) => void;
|
|
4
|
+
/** Render the final line (the text after the last newline, possibly empty). */
|
|
5
|
+
flush: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Incremental wrapper over the line-based markdown renderer, for progressive
|
|
9
|
+
* TTY display of streamed AI analysis chunks.
|
|
10
|
+
*
|
|
11
|
+
* Buffers input until a newline completes a line, renders the completed line
|
|
12
|
+
* through `renderMarkdownLine` (threading the code-fence state), and emits it.
|
|
13
|
+
* Because every line is rendered by the exact same function the buffered
|
|
14
|
+
* `renderMarkdown` uses, the concatenated streamed output is byte-identical
|
|
15
|
+
* to `renderMarkdown(fullText)` — regardless of how the text was chunked.
|
|
16
|
+
* (test-ai-stream-markdown.mjs proves this for every possible split point.)
|
|
17
|
+
*
|
|
18
|
+
* Trade-off: nothing prints until a line completes, so streaming is
|
|
19
|
+
* line-by-line rather than character-by-character. Rewriting a partial line
|
|
20
|
+
* in place would break as soon as the line wraps past the terminal width.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createStreamingMarkdownRenderer(write: (text: string) => void, isTTY: boolean): StreamingMarkdownRenderer;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PostAnalyzeResult } from './analyze.js';
|
|
2
|
+
export type AiAnalysisChoice = 'capgo_ai' | 'local_ai' | 'skip' | 'auto_upload' | 'retry';
|
|
3
|
+
export type AiAnalysisTriggeredBy = 'menu' | 'ci_flag' | 'onboarding';
|
|
4
|
+
export type AiAnalysisResult = 'success' | 'already_analyzed' | 'too_big' | 'error' | 'mid_stream_error' | 'upgrade_required';
|
|
5
|
+
export declare function aiAnalysisResultFromPostAnalyze(result: PostAnalyzeResult): AiAnalysisResult;
|
|
6
|
+
export interface TrackAiAnalysisChoiceInput {
|
|
7
|
+
apikey: string;
|
|
8
|
+
orgId: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
platform: 'ios' | 'android';
|
|
11
|
+
jobId: string;
|
|
12
|
+
choice: AiAnalysisChoice;
|
|
13
|
+
triggeredBy: AiAnalysisTriggeredBy;
|
|
14
|
+
}
|
|
15
|
+
export interface TrackAiAnalysisResultInput {
|
|
16
|
+
apikey: string;
|
|
17
|
+
orgId: string;
|
|
18
|
+
appId: string;
|
|
19
|
+
platform: 'ios' | 'android';
|
|
20
|
+
jobId: string;
|
|
21
|
+
result: AiAnalysisResult;
|
|
22
|
+
errorStatus?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Emit `CLI AI Build Analysis Choice` for every branch the user (or CI flag) selected.
|
|
26
|
+
*
|
|
27
|
+
* Privacy boundary: only closed-enum choice + triggered_by metadata is sent. The
|
|
28
|
+
* AI diagnosis text is never observed at this stage.
|
|
29
|
+
*/
|
|
30
|
+
export declare function trackAiAnalysisChoice(input: TrackAiAnalysisChoiceInput): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Emit `CLI AI Build Analysis Result` only for paths that actually hit the server
|
|
33
|
+
* (capgo_ai or auto_upload).
|
|
34
|
+
*
|
|
35
|
+
* Privacy boundary: the AI analysis text (`result.analysis` in PostAnalyzeResult)
|
|
36
|
+
* MUST NEVER appear in any tag here. Only the closed-enum `result` and optional
|
|
37
|
+
* `error_status` cross the boundary.
|
|
38
|
+
*/
|
|
39
|
+
export declare function trackAiAnalysisResult(input: TrackAiAnalysisResultInput): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type CliErrorCategory = 'network_error' | 'timeout' | 'unauthorized' | 'forbidden' | 'not_found' | 'payload_too_large' | 'rate_limited' | '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;
|
|
7
|
+
/**
|
|
8
|
+
* Maps a non-2xx HTTP status to the same closed enum, for Supabase responses
|
|
9
|
+
* where we have a status code but no thrown Error. Never leaks response bodies.
|
|
10
|
+
*/
|
|
11
|
+
export declare function categorizeHttpStatus(status: number): 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,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tags every Supabase call made inside `fn` with `source`.
|
|
3
|
+
*
|
|
4
|
+
* The Supabase JS query builder is a lazy thenable: it does not call `fetch`
|
|
5
|
+
* until `.then()` is invoked (i.e. when the caller `await`s it). If we only
|
|
6
|
+
* call `run(source, fn)` and return the builder, `.then()` fires *outside* the
|
|
7
|
+
* AsyncLocalStorage context and `getSupabaseSource()` returns `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* To fix this, we wrap the result in `Promise.resolve()` inside the `run()`
|
|
10
|
+
* callback. This schedules the microtask (which calls `.then()` on the builder)
|
|
11
|
+
* while still inside the async context, so the source label propagates through
|
|
12
|
+
* to the actual fetch. For plain Promises and non-thenable values the behaviour
|
|
13
|
+
* is unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withSupabaseSource<T>(source: string, fn: () => T): Promise<Awaited<T>>;
|
|
16
|
+
export declare function getSupabaseSource(): string | undefined;
|
|
17
|
+
export declare function enableSupabaseInstrumentation(): void;
|
|
18
|
+
export declare function isSupabaseInstrumentationEnabled(): boolean;
|
|
19
|
+
export interface SupabaseCallInfo {
|
|
20
|
+
url: string;
|
|
21
|
+
method: string;
|
|
22
|
+
status: number;
|
|
23
|
+
ok: boolean;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
source?: string;
|
|
26
|
+
apikey?: string;
|
|
27
|
+
error?: unknown;
|
|
28
|
+
}
|
|
29
|
+
export type SupabaseCallRecorder = (info: SupabaseCallInfo) => void;
|
|
30
|
+
export declare function setSupabaseCallRecorder(fn: SupabaseCallRecorder): void;
|
|
31
|
+
/** A Supabase call slower than this is flagged `slow` regardless of status. */
|
|
32
|
+
export declare const SLOW_THRESHOLD_MS = 5000;
|
|
33
|
+
/**
|
|
34
|
+
* Parses a Supabase REST/RPC/Functions URL into a low-cardinality operation label.
|
|
35
|
+
* Query strings are discarded so filter values never leak and cardinality
|
|
36
|
+
* stays bounded. `/rest/v1/rpc/get_user_id` => `rpc:get_user_id`;
|
|
37
|
+
* `/rest/v1/apps?...` => `GET apps`;
|
|
38
|
+
* `/functions/v1/files/upload_link` => `POST functions:files/upload_link`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function deriveSupabaseOperation(url: string, method: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* A `fetch` wrapper for supabase-js's `global.fetch`. Times the real request
|
|
43
|
+
* (which runs regardless), captures the active source label, and hands the
|
|
44
|
+
* result to the injected recorder. Returns the real Response / rethrows the
|
|
45
|
+
* real error so supabase-js behavior is never altered. Calls `globalThis.fetch`
|
|
46
|
+
* dynamically (not a captured ref) so it is testable and never self-recurses.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createTimedFetch(): typeof fetch;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { withSupabaseSource } from './supabase-perf';
|
|
2
|
+
type InvocationSource = 'cli' | 'mcp';
|
|
3
|
+
export declare function setInvocationSource(source: InvocationSource): void;
|
|
4
|
+
export declare function getInvocationSource(): InvocationSource;
|
|
5
|
+
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
|
+
export declare function flushAnalytics(timeoutMs?: number): Promise<void>;
|
|
18
|
+
export declare function resolveTrackingContext(apikey: string, signal?: AbortSignal): Promise<{
|
|
19
|
+
appId?: string;
|
|
20
|
+
orgId?: string;
|
|
21
|
+
}>;
|
|
22
|
+
export interface TrackEventInput {
|
|
23
|
+
channel: string;
|
|
24
|
+
event: string;
|
|
25
|
+
icon?: string;
|
|
26
|
+
/** Org id for actor-scoped attribution. Omitted => resolved best-effort. */
|
|
27
|
+
orgId?: string;
|
|
28
|
+
/** App id (also lets the backend verify org ownership). */
|
|
29
|
+
appId?: string;
|
|
30
|
+
/** Explicit key; falls back to the saved key. No key => no event. */
|
|
31
|
+
apikey?: string;
|
|
32
|
+
tags?: Record<string, string | number | boolean>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generic v2 actor-scoped event. Never throws. Does nothing when telemetry is
|
|
36
|
+
* disabled or no API key is resolvable (the accepted unauthenticated gap).
|
|
37
|
+
* When the caller omits appId/orgId, both are resolved best-effort from the
|
|
38
|
+
* local Capacitor config (app_id → owner_org) so local commands still get
|
|
39
|
+
* user + org attribution when the user is logged in.
|
|
40
|
+
*/
|
|
41
|
+
export declare function trackEvent(input: TrackEventInput): Promise<void>;
|
|
42
|
+
export interface CommandContext {
|
|
43
|
+
flags: string[];
|
|
44
|
+
positional_arg_count: number;
|
|
45
|
+
}
|
|
46
|
+
interface CommanderLike {
|
|
47
|
+
args: readonly string[];
|
|
48
|
+
opts: () => Record<string, unknown>;
|
|
49
|
+
getOptionValueSource: (key: string) => string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Pulls only privacy-safe context from a Commander command: the NAMES of
|
|
53
|
+
* user-provided flags (never their values) and the positional arg count.
|
|
54
|
+
*/
|
|
55
|
+
export declare function extractCommandContext(command: CommanderLike): CommandContext;
|
|
56
|
+
export declare function trackCommandInvoked(commandPath: string, ctx: CommandContext): void;
|
|
57
|
+
export declare function trackCommandSucceeded(commandPath: string): void;
|
|
58
|
+
export declare function trackCommandFailed(commandPath: string, opts: {
|
|
59
|
+
errorCategory: string;
|
|
60
|
+
exitCode: number;
|
|
61
|
+
}): void;
|
|
62
|
+
type AnyAsyncFn = (...args: any[]) => Promise<any>;
|
|
63
|
+
/**
|
|
64
|
+
* Wraps an MCP tool handler to emit a `MCP Tool Invoked` event with the tool
|
|
65
|
+
* name, success flag, and duration. Re-throws so behavior is unchanged.
|
|
66
|
+
*/
|
|
67
|
+
export declare function withMcpToolTracking<H extends AnyAsyncFn>(toolName: string, handler: H): H;
|
|
68
|
+
export declare function trackMcpServerStarted(hasApikey: boolean): void;
|
|
69
|
+
export { withSupabaseSource };
|
|
70
|
+
export { enableSupabaseInstrumentation } from './supabase-perf';
|
package/dist/src/api/app.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
import type { Database } from '../types/supabase.types';
|
|
3
|
-
import type { OptionsBase } from '../utils';
|
|
4
3
|
import { OrganizationPerm } from '../utils';
|
|
5
4
|
export declare function checkAppExists(supabase: SupabaseClient<Database>, appid: string): Promise<boolean>;
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
export type PendingOnboardingApp = Pick<Database['public']['Tables']['apps']['Row'], 'app_id' | 'name' | 'icon_url' | 'need_onboarding' | 'existing_app' | 'ios_store_url' | 'android_store_url'>;
|
|
6
|
+
export type ExistingOrganizationApp = Pick<Database['public']['Tables']['apps']['Row'], 'app_id' | 'name' | 'owner_org' | 'need_onboarding'>;
|
|
7
|
+
export declare function listPendingOnboardingApps(supabase: SupabaseClient<Database>, orgId: string): Promise<PendingOnboardingApp[]>;
|
|
8
|
+
export declare function findAppInOrganization(supabase: SupabaseClient<Database>, orgId: string, appId: string): Promise<ExistingOrganizationApp | null>;
|
|
9
|
+
export declare function completePendingOnboardingApp(supabase: SupabaseClient<Database>, orgId: string, appId: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Check multiple app IDs at once for batch validation (e.g., for suggestions)
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkAppIdsExist(supabase: SupabaseClient<Database>, appids: string[]): Promise<{
|
|
14
|
+
appid: string;
|
|
15
|
+
exists: boolean;
|
|
16
|
+
}[]>;
|
|
17
|
+
export declare function check2FAComplianceForApp(supabase: SupabaseClient<Database>, appid: string, silent?: boolean): Promise<void>;
|
|
18
|
+
export declare function checkAppExistsAndHasPermissionOrgErr(supabase: SupabaseClient<Database>, apikey: string, appid: string, requiredPermission: OrganizationPerm, silent?: boolean, skip2FACheck?: boolean): Promise<OrganizationPerm>;
|
|
19
|
+
export type { AppOptions as Options } from '../schemas/app';
|
|
12
20
|
export declare const newIconPath = "assets/icon.png";
|
|
13
|
-
|
|
21
|
+
export declare const defaultAppIconPath = "public/capgo.png";
|
|
22
|
+
export declare function getAppIconStoragePath(organizationUid: string, appId: string): string;
|