@capgo/cli
Version:
A CLI to upload to capgo servers
81 lines (80 loc) • 2.83 kB
TypeScript
import type { LiveUpdateNextStepInput } from '../../schemas/live-update-onboarding.js';
import type { NextStepResult, Platform } from './contract.js';
import type { LiveUpdateProgress } from './progress.js';
export interface GitRepoStatus {
inRepo: boolean;
clean: boolean;
entries: string[];
}
export interface EngineDeps {
cwd: string;
hasSavedKey: () => boolean;
getAppId: () => Promise<string | undefined>;
detectPlatforms: () => Promise<Platform[]>;
isAppRegistered: (appId: string) => Promise<boolean>;
loadProgress: () => LiveUpdateProgress | null;
saveProgress: (data: LiveUpdateProgress) => void;
clearProgress: () => void;
registerApp: (appId: string) => Promise<{
ok: boolean;
alreadyExists?: boolean;
error?: string;
}>;
ensureChannel: (appId: string, channelName: string) => Promise<{
ok: boolean;
error?: string;
}>;
installUpdater: (appId: string) => Promise<{
ok: boolean;
delta?: boolean;
currentVersion?: string;
error?: string;
}>;
addIntegrationCode: (appId: string) => Promise<{
ok: boolean;
error?: string;
}>;
setupEncryption: (appId: string, enable: boolean) => Promise<{
ok: boolean;
enabled: boolean;
error?: string;
}>;
buildProject: (appId: string, platform: Platform) => Promise<{
ok: boolean;
error?: string;
}>;
applyTestChange: (appId: string, baseVersion?: string) => Promise<{
ok: boolean;
version?: string;
error?: string;
}>;
uploadBundle: (appId: string, opts: {
channelName: string;
version: string;
delta?: boolean;
encrypt?: boolean;
}) => Promise<{
ok: boolean;
error?: string;
}>;
getRunDeviceCommand: (platform: Platform) => {
command: string;
};
getGitStatus: (cwd?: string) => GitRepoStatus;
}
export interface LiveUpdateFacts {
capacitorProject: boolean;
appId?: string;
authenticated: boolean;
appRegistered: boolean;
platformsDetected: Platform[];
progress: LiveUpdateProgress | null;
}
export declare function gatherFacts(deps: EngineDeps): Promise<LiveUpdateFacts>;
export declare function decideStart(facts: LiveUpdateFacts, deps: EngineDeps): Promise<NextStepResult>;
export declare function decideAdvance(facts: LiveUpdateFacts, deps: EngineDeps, input?: LiveUpdateNextStepInput): Promise<NextStepResult>;
export declare function runStart(deps: EngineDeps): Promise<NextStepResult>;
export declare function runAdvance(deps: EngineDeps, input?: LiveUpdateNextStepInput): Promise<NextStepResult>;
export declare function explainLiveUpdateOnboarding(deps: EngineDeps, input?: {
state?: string;
}): Promise<string>;