@capgo/cli
Version:
A CLI to upload to capgo servers
58 lines (57 loc) • 2.39 kB
TypeScript
/**
* Build-onboarding helper to write a single-platform .env file with the build
* credentials the user just saved. Used on the "No to GitHub Actions setup, but
* yes to .env export" branch of the wizard.
*
* Reuses the renderer from `build credentials manage` so the file format
* (section comments, .gitignore reminder, provisioning-map base64 fallback)
* stays identical between the two paths.
*
* IMPORTANT (v1 contract): this writes a LOCAL `.env.capgo.<appId>.<platform>`
* file (mode 0o600). The file holds credentials, so it should stay local (add it to `.gitignore`). It performs NO git
* operation — no `git add`, no `git commit`, nothing touches the repo index.
* v1 must NOT add an auto-commit here; the user owns whether/when the file
* lands in version control.
*/
import type { BuildCredentials } from '../../schemas/build.js';
export interface EnvExportOpts {
appId: string;
platform: 'ios' | 'android';
credentials: Partial<BuildCredentials>;
/** Default false — onboarding writes into the global store, not local. */
local?: boolean;
/**
* If absent, defaults to `<cwd>/.env.capgo.<appId>.<platform>`.
*
* This is the path of a LOCAL 0o600 .env file holding credentials — keep it out of version control.
* Writing it performs NO git operation; v1 must not add an auto-commit.
*/
targetPath?: string;
/** When true, write even if the file already exists. */
overwrite?: boolean;
}
export type EnvExportResult = {
kind: 'written';
path: string;
fieldCount: number;
} | {
kind: 'exists';
path: string;
} | {
kind: 'empty';
};
/**
* Resolve where the .env file should land for the given app + platform. Pure —
* callable before deciding to actually write, so the wizard can show the path
* in a confirm prompt without committing to write yet.
*/
export declare function defaultExportPath(appId: string, platform: 'ios' | 'android'): string;
/**
* Write the credentials to a .env file. Caller is responsible for deciding
* whether the user has consented (no prompts in here — pure file I/O so the
* Ink wizard owns the UX).
*
* Returns `kind: 'exists'` if the target file is already present and
* `overwrite` was not set — caller can prompt the user and retry.
*/
export declare function exportCredentialsToEnv(opts: EnvExportOpts): EnvExportResult;