@capgo/cli 8.9.1 → 8.10.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 +434 -434
- package/dist/package.json +3 -2
- package/dist/src/api/channels.d.ts +3 -0
- package/dist/src/auth/session.d.ts +71 -0
- package/dist/src/build/onboarding/mcp/onboarding-tools.d.ts +2 -2
- package/dist/src/schemas/auth.d.ts +14 -0
- package/dist/src/schemas/index.d.ts +1 -0
- package/dist/src/sdk.js +204 -204
- package/dist/src/types/supabase.types.d.ts +3 -0
- package/dist/src/utils.d.ts +3 -0
- package/package.json +3 -2
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.10.0",
|
|
5
5
|
"description": "A CLI to upload to capgo servers",
|
|
6
6
|
"author": "Martin martin@capgo.app",
|
|
7
7
|
"license": "Apache 2.0",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"test:init-guardrails": "bun test/test-init-guardrails.mjs",
|
|
112
112
|
"test:prompt-preferences": "bun test/test-prompt-preferences.mjs",
|
|
113
113
|
"test:esm-sdk": "node test/test-sdk-esm.mjs",
|
|
114
|
+
"test:auth-session": "bun test/test-auth-session.mjs",
|
|
114
115
|
"test:mcp": "node test/test-mcp.mjs",
|
|
115
116
|
"test:version-detection": "node test/test-get-installed-version.mjs",
|
|
116
117
|
"test:version-detection:setup": "./test/fixtures/setup-test-projects.sh",
|
|
@@ -151,7 +152,7 @@
|
|
|
151
152
|
"test:ios-verify-app": "bun test/test-ios-verify-app.mjs",
|
|
152
153
|
"test:platform-flow-contract": "bun test/test-platform-flow-contract.mjs",
|
|
153
154
|
"test:tail-engine-shared": "bun test/test-tail-engine-shared.mjs",
|
|
154
|
-
"test": "bun run build && bun run test:helper-dce && 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:fail-on-incompatible && 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:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && 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:project-type-detection && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared",
|
|
155
|
+
"test": "bun run build && bun run test:helper-dce && 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:fail-on-incompatible && 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:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && 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:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared",
|
|
155
156
|
"test:build-platform-selection": "bun test/test-build-platform-selection.mjs",
|
|
156
157
|
"test:ai-log-capture": "bun test/test-ai-log-capture.mjs",
|
|
157
158
|
"test:ai-analyze-flow": "bun test/test-ai-analyze-flow.mjs",
|
|
@@ -1245,6 +1245,7 @@ export declare function delChannelDevices(supabase: SupabaseClient<Database>, ap
|
|
|
1245
1245
|
deleted_at: string | null;
|
|
1246
1246
|
id: number;
|
|
1247
1247
|
owner_org: string;
|
|
1248
|
+
transfer_history: import("../types/supabase.types").Json[] | null;
|
|
1248
1249
|
};
|
|
1249
1250
|
Insert: {
|
|
1250
1251
|
app_id: string;
|
|
@@ -1252,6 +1253,7 @@ export declare function delChannelDevices(supabase: SupabaseClient<Database>, ap
|
|
|
1252
1253
|
deleted_at?: string | null;
|
|
1253
1254
|
id?: number;
|
|
1254
1255
|
owner_org: string;
|
|
1256
|
+
transfer_history?: import("../types/supabase.types").Json[] | null;
|
|
1255
1257
|
};
|
|
1256
1258
|
Update: {
|
|
1257
1259
|
app_id?: string;
|
|
@@ -1259,6 +1261,7 @@ export declare function delChannelDevices(supabase: SupabaseClient<Database>, ap
|
|
|
1259
1261
|
deleted_at?: string | null;
|
|
1260
1262
|
id?: number;
|
|
1261
1263
|
owner_org?: string;
|
|
1264
|
+
transfer_history?: import("../types/supabase.types").Json[] | null;
|
|
1262
1265
|
};
|
|
1263
1266
|
Relationships: [];
|
|
1264
1267
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, UI-free authentication core.
|
|
3
|
+
*
|
|
4
|
+
* `cli/src/login.ts` (the interactive `capgo login` command) and the MCP login
|
|
5
|
+
* tools (`capgo_login` / `capgo_whoami` / `capgo_logout`) all funnel through these
|
|
6
|
+
* helpers so there is a single validate / persist / introspect path — no forked
|
|
7
|
+
* security logic. The user-facing message builders live here too (pure functions)
|
|
8
|
+
* so the tool wording is covered by unit tests rather than only the integration
|
|
9
|
+
* smoke test.
|
|
10
|
+
*/
|
|
11
|
+
export type KeySource = 'env' | 'global' | 'local';
|
|
12
|
+
export interface LoginState {
|
|
13
|
+
loggedIn: boolean;
|
|
14
|
+
/** Resolved user id — only populated when `validate` succeeded. */
|
|
15
|
+
userId?: string;
|
|
16
|
+
/** Where the resolved key came from, if any (also set when a present key fails validation). */
|
|
17
|
+
source?: KeySource;
|
|
18
|
+
/**
|
|
19
|
+
* Only meaningful when `validate` was requested. `true` = confirmed valid this
|
|
20
|
+
* call; `false` = a key is present but could NOT be verified (network/server
|
|
21
|
+
* error), so it is reported as still-logged-in-but-unverified rather than as a
|
|
22
|
+
* definitive sign-out. Undefined when no validation was attempted.
|
|
23
|
+
*/
|
|
24
|
+
verified?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface SaveKeyOptions {
|
|
27
|
+
/** Persist to `./.capgo` (project-local) instead of `~/.capgo` (global). */
|
|
28
|
+
local?: boolean;
|
|
29
|
+
supaHost?: string;
|
|
30
|
+
supaAnon?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validate an API key against Capgo and, if valid, persist it (0o600).
|
|
34
|
+
* Returns the resolved user id. Throws on a missing/invalid key or a disallowed
|
|
35
|
+
* local write (local requires a git repository, mirroring `capgo login --local`).
|
|
36
|
+
*
|
|
37
|
+
* Nothing is written when validation fails.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateAndSaveKey(apikey: string, options?: SaveKeyOptions): Promise<{
|
|
40
|
+
userId: string;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Report whether a saved key exists.
|
|
44
|
+
*
|
|
45
|
+
* Presence-only by default (no network) so it is cheap enough to gate every tool
|
|
46
|
+
* call. Pass `{ validate: true }` (used by `capgo_whoami`) to additionally confirm
|
|
47
|
+
* the key still authenticates and resolve the user id.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getLoginState(options?: {
|
|
50
|
+
validate?: boolean;
|
|
51
|
+
}): Promise<LoginState>;
|
|
52
|
+
/**
|
|
53
|
+
* Remove the saved key. Clears the global key (`~/.capgo`) by default, or the
|
|
54
|
+
* project-local key (`./.capgo`) when `local` is set. Never touches `CAPGO_TOKEN`
|
|
55
|
+
* (an env var is not ours to unset). Returns whether a file was actually removed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function clearSavedKey(options?: {
|
|
58
|
+
local?: boolean;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
cleared: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
/** Success text for capgo_login. */
|
|
63
|
+
export declare function loginSuccessMessage(userId: string, local: boolean): string;
|
|
64
|
+
/** Status text for capgo_whoami, covering verified / unverified / invalid / signed-out. */
|
|
65
|
+
export declare function whoamiMessage(state: LoginState): string;
|
|
66
|
+
/**
|
|
67
|
+
* Honest text for capgo_logout. `remaining` is the post-clear login state: if a
|
|
68
|
+
* credential is still reachable (CAPGO_TOKEN, or the other on-disk scope) we say
|
|
69
|
+
* so explicitly instead of falsely claiming the session is signed out.
|
|
70
|
+
*/
|
|
71
|
+
export declare function logoutMessage(cleared: boolean, removedLocal: boolean, remaining: LoginState): string;
|
|
@@ -24,10 +24,10 @@ interface McpLike {
|
|
|
24
24
|
* Production EngineDeps wiring. Exported for tests that pin production-only
|
|
25
25
|
* behavior (clearBuildRecord wiring, keystore file modes).
|
|
26
26
|
*/
|
|
27
|
-
export declare function buildDeps(
|
|
27
|
+
export declare function buildDeps(getSdk: () => CapgoSDK): EngineDeps;
|
|
28
28
|
/**
|
|
29
29
|
* Register the 2-tool onboarding spine onto an MCP server.
|
|
30
30
|
* `depsOverride` is for tests; production passes only `server` + `sdk`.
|
|
31
31
|
*/
|
|
32
|
-
export declare function registerOnboardingTools(server: McpLike,
|
|
32
|
+
export declare function registerOnboardingTools(server: McpLike, getSdk: () => CapgoSDK, depsOverride?: EngineDeps, buildJobDepsOverride?: BuildJobDeps, credentialsManageDepsOverride?: CredentialsManageDeps): void;
|
|
33
33
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const mcpLoginInputSchema: z.ZodObject<{
|
|
3
|
+
apikey: z.ZodString;
|
|
4
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
local: "local";
|
|
6
|
+
global: "global";
|
|
7
|
+
}>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const mcpLogoutInputSchema: z.ZodObject<{
|
|
10
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
local: "local";
|
|
12
|
+
global: "global";
|
|
13
|
+
}>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { appDebugOptionsSchema, appOptionsSchema, appSettingOptionsSchema } from './app';
|
|
2
2
|
export type { AppDebugOptions, AppOptions, AppSettingOptions } from './app';
|
|
3
|
+
export { mcpLoginInputSchema, mcpLogoutInputSchema } from './auth';
|
|
3
4
|
export { optionsBaseSchema } from './base';
|
|
4
5
|
export type { OptionsBase } from './base';
|
|
5
6
|
export { allCredentialsSchema, buildCredentialsSchema, buildRequestOptionsSchema, buildRequestResultSchema, credentialFileSchema, savedCredentialsSchema, } from './build';
|