@cto.ai/ops
Version:
💻 CTO.ai Ops - The CLI built for Teams 🚀
90 lines (89 loc) • 3.63 kB
TypeScript
import Command from '../base';
import { OpCommand, Config, OpWorkflow, RunCommandArgs, OpsYml } from '../types';
export interface RunInputs {
parsedArgs: RunCommandArgs;
teamName: string;
opName: string;
opVersion: string;
config: Config;
opsAndWorkflows: (OpCommand | OpWorkflow)[];
opOrWorkflow: OpCommand | 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>;
};
static strict: boolean;
static args: {
name: string;
description: string;
parse: (input: string) => string;
}[];
opsAndWorkflows: (OpCommand | OpWorkflow)[];
customParse: (options: typeof Run, argv: string[]) => {
args: any;
flags: any;
opParams: string[];
};
checkPathOpsYmlExists: (nameOrPath: string) => boolean;
parseYamlFile: (relativePathToOpsYml: string) => Promise<OpsYml | null>;
logResolvedLocalMessage: (inputs: RunInputs) => RunInputs;
getOpsAndWorkflowsFromFileSystem: (relativePathToOpsYml: string) => (inputs: RunInputs) => Promise<RunInputs>;
addMissingApiFieldsToLocalOps: (inputs: RunInputs) => Promise<RunInputs>;
filterLocalOps: (inputs: RunInputs) => RunInputs;
formatOpOrWorkflowEmoji: (opOrWorkflow: OpCommand | OpWorkflow) => string;
formatOpOrWorkflowName: (opOrWorkflow: OpCommand | OpWorkflow) => string;
fuzzyFilterParams: () => {
list: {
name: string;
value: OpCommand | OpWorkflow;
}[];
options: {
extract: (el: any) => any;
};
};
autocompleteSearch: (_: Record<string, any>, input?: string) => Promise<{
value: OpCommand | OpWorkflow;
name: string;
}[]>;
selectOpOrWorkflowToRun: (inputs: RunInputs) => Promise<RunInputs>;
printCustomHelp: (op: OpCommand) => void;
checkForHelpMessage: (inputs: RunInputs) => void | RunInputs;
executeOpOrWorkflowService: (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;
parsedArgs: RunCommandArgs;
config: Config;
opsAndWorkflows: (OpCommand | OpWorkflow)[];
opOrWorkflow: OpCommand | OpWorkflow;
};
/**
* Extracts the version and op name from input argument.
* github -> { opName: 'github', opVersion: '' }
* github:0.1.0 -> { opName: 'github', opVersion: '0.1.0' }
* github:: -> InvalidOpName
*/
parseOpNameAndVersion: (opNameAndVersion: string) => {
opName: string;
opVersion: string;
};
getApiOps: (inputs: RunInputs) => Promise<RunInputs>;
sendAnalytics: (inputs: RunInputs) => Promise<RunInputs>;
run(): Promise<void>;
}