@cto.ai/ops-rc
Version:
💻 CTO.ai Ops - The CLI built for Teams 🚀
81 lines (80 loc) • 3.71 kB
TypeScript
import Command from './../base';
import { Answers, OpCommand, Config, OpWorkflow, OpPipeline, RunCommandArgs, OpsYml } from './../types';
export interface RunInputs {
parsedArgs: RunCommandArgs;
teamName: string;
opName: string;
opVersion: string;
config: Config;
commands: (OpCommand | OpPipeline | OpWorkflow)[];
pipelines: OpPipeline[];
selectedOp: OpCommand | OpPipeline | OpWorkflow;
}
export default class Run extends Command {
static description: string;
static flags: {
help: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
build: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
batch: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};
static strict: boolean;
static args: {
name: string;
description: string;
parse: (input: string) => string;
}[];
customParse: (options: typeof Run, argv: string[]) => {
args: any;
flags: any;
opParams: string[];
};
parseYamlFile: (relativePathToOpsYml: string) => Promise<OpsYml>;
logResolvedLocalMessage: (inputs: RunInputs) => RunInputs;
readOpsFromLocalManifest: (relativePathToOpsYml: string) => (inputs: RunInputs) => Promise<RunInputs>;
addMissingApiFieldsToLocalOps: (inputs: RunInputs) => Promise<RunInputs>;
filterLocalOps: (inputs: RunInputs) => RunInputs;
formatOpEmoji: (op: OpCommand) => string;
formatOpName: (op: OpCommand | OpPipeline | OpWorkflow) => string;
fuzzyFilterParams: (ops: (OpCommand | OpPipeline | OpWorkflow)[]) => {
name: string;
value: OpCommand | OpPipeline | OpWorkflow;
}[];
autocompleteSearch: (ops: (OpCommand | OpPipeline | OpWorkflow)[]) => (_: Answers, input?: string) => Promise<{
name: string;
value: OpCommand | OpPipeline | OpWorkflow;
}[]>;
selectOpOrWorkflowToRun: (inputs: RunInputs) => Promise<RunInputs>;
printCustomHelp: (op: OpCommand) => void;
checkForHelpMessage: (inputs: RunInputs) => RunInputs | void;
buildPipelineJobs: (inputs: RunInputs) => Promise<RunInputs>;
runPipeline: (inputs: RunInputs) => Promise<RunInputs>;
getPublishedPipelines: (inputs: RunInputs) => Promise<(OpCommand | OpWorkflow)[]>;
isPipelinePublished: (inputs: RunInputs) => Promise<Boolean>;
getPipelineJob: (teamName: string, opName: string, opVersion: String) => Promise<OpCommand | undefined>;
executeOpService: (inputs: RunInputs) => Promise<RunInputs>;
/**
* Extracts the Op Team and Name from the input argument
* @cto.ai/github -> { teamName: cto.ai, opname: github, opVersion: '' }
* cto.ai/github -> { teamName: cto.ai, opname: github, opVersion: '' }
* github -> { teamName: '', opname: github, opVersion: '' }
* @cto.ai/github:0.1.0 -> { teamName: cto.ai, opname: github, opVersion: '0.1.0' }
* cto.ai/github:customVersion -> { teamName: cto.ai, opname: github, opVersion: 'customVersion' }
* github:myVersion -> { teamName: '', opname: github, opVersion: 'myVersion' }
* cto.ai/extra/blah -> InvalidOpName
* cto.ai/extra:version1:version2 -> InvalidOpName
* null -> InvalidOpName
*/
parseTeamOpNameVersion: (inputs: RunInputs) => {
teamName: string;
opName: string;
opVersion: string | undefined;
parsedArgs: RunCommandArgs;
config: Config;
commands: (OpCommand | OpPipeline | OpWorkflow)[];
pipelines: OpPipeline[];
selectedOp: OpCommand | OpPipeline | OpWorkflow;
};
getApiOps: (inputs: RunInputs) => Promise<RunInputs>;
sendAnalytics: (inputs: RunInputs) => Promise<RunInputs>;
run(): Promise<void>;
}