UNPKG

forest-cli

Version:

The Lumberjacks' toolbelt is the Forest CLI which makes easy to manage your back office application directly from the terminal.

69 lines 3.3 kB
import type { LayoutDomain, PlannedOp } from '../../services/layout/types'; import type { Config } from '@oclif/core'; import AbstractAuthenticatedCommand from '../../abstract-authenticated-command'; type RawOp = { op: string; path: string; value?: unknown; }; type PatchInput = Partial<Record<LayoutDomain, RawOp[]>>; export declare function toPlannedOps(domain: Exclude<LayoutDomain, 'workflows'>, rawOps: RawOp[]): PlannedOp[]; export declare function buildAllOps(input: PatchInput): PlannedOp[]; /** * When stdin is not an interactive terminal — the patch is piped, or the * command runs in CI / spawned by an agent, even with a file argument — no * inquirer prompt (project, environment, team, confirmation) can run: it would * read from a pipe and hang or crash. Non-TTY runs therefore require the full * scope and `--force` up front — fail fast, listing exactly what is missing. * * `FOREST_ENV_SECRET` only stands in for `-p/--projectId`: scope resolution * derives the project from the secret (`withCurrentProject`) but NEVER the * environment — without `-e/--env` it would still prompt. */ export declare function assertNonInteractiveFlags(flags: { env?: string; force?: boolean; projectId?: number; team?: string; }, hasEnvSecret: boolean): void; export declare function formatOps(allOps: PlannedOp[]): string; /** * `forest layout patch` — send a JSON-Patch array straight to the environment, * exactly like the frontend does when you tweak a collection: a single * `PATCH /api/:domain` per domain, no `pull`/`diff`/`apply` round-trip. * * Scope: the layout-only domains (`layout`, `folders`). `workflows` is out of * scope here — see {@link buildAllOps}. * * Input format (file or stdin): * { * "layout": [{ "op": "replace", "path": "/collections/orders/displayName", "value": "Orders" }], * "folders": [{ "op": "add", "path": "/folders/<mainId>/children/-", "value": {...} }] * } * * Any non-TTY run (piped input, CI, spawned by an agent) is non-interactive by * construction: it requires the full scope flags and `--force` — see * {@link assertNonInteractiveFlags}. */ export default class LayoutPatchCommand extends AbstractAuthenticatedCommand { private readonly env; private readonly inquirer; static args: { file: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>; }; static description: string; static flags: { 'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; env: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>; force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; projectId: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>; team: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>; }; constructor(argv: string[], config: Config, plan?: any); protected runAuthenticated(): Promise<void>; /** One atomic PATCH per domain, in stable order. Exits 2 on a recoverable API error. */ private sendPatches; private confirm; } export {}; //# sourceMappingURL=patch.d.ts.map