@cto.ai/ops
Version:
💻 CTO.ai Ops - The CLI built for Teams 🚀
101 lines (100 loc) • 3.69 kB
TypeScript
import * as yaml from 'yaml';
import Command from '../base';
import { Container, InitParams, InitPaths, Question } from '../types';
import { OpTypes } from '../constants/opConfig';
export default class Init extends Command {
static description: string;
static flags: {
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
};
questions: object[];
srcDir: string;
destDir: string;
initPrompts: Container<Question>;
determineTemplate: (prompts: Container<Question<Record<string, any>>>) => Promise<{
prompts: Container<Question<Record<string, any>>>;
templates: OpTypes[] | undefined;
}>;
determineQuestions: ({ prompts, templates, }: {
prompts: Container<Question<Record<string, any>>>;
templates: OpTypes[];
}) => {
questions: Question<Record<string, any>>[];
templates: OpTypes[];
};
askQuestions: ({ questions, templates, }: {
questions: Question<Record<string, any>>[];
templates: OpTypes[];
}) => Promise<{
answers: Partial<InitParams>;
templates: OpTypes[];
}>;
determineInitPaths: ({ answers, templates, }: {
answers: Partial<InitParams>;
templates: OpTypes[];
}) => {
initPaths: {
sharedDir: string;
destDir: string;
};
initParams: {
templates: OpTypes[];
commandName?: string | undefined;
commandDescription?: string | undefined;
commandVersion?: string | undefined;
workflowName?: string | undefined;
workflowDescription?: string | undefined;
workflowVersion?: string | undefined;
help?: void | undefined;
};
};
copyTemplateFiles: ({ initPaths, initParams, }: {
initPaths: InitPaths;
initParams: InitParams;
}) => Promise<{
initPaths: InitPaths;
initParams: InitParams;
}>;
customizePackageJson: ({ initPaths, initParams, }: {
initPaths: InitPaths;
initParams: InitParams;
}) => Promise<{
initPaths: InitPaths;
initParams: InitParams;
}>;
customizeYaml: ({ initPaths, initParams, }: {
initPaths: InitPaths;
initParams: InitParams;
}) => Promise<{
initPaths: InitPaths;
initParams: InitParams;
}>;
addHelpCommentsFor: (key: string, yamlDoc: yaml.ast.Document) => void;
customizeOpsYaml: (initParams: InitParams, yamlDoc: yaml.ast.Document) => Promise<void>;
customizeWorkflowYaml: (initParams: InitParams, yamlDoc: yaml.ast.Document) => Promise<void>;
logMessages: ({ initPaths, initParams, }: {
initPaths: InitPaths;
initParams: InitParams;
}) => Promise<{
initPaths: InitPaths;
initParams: InitParams;
}>;
logCommandMessage: (initParams: InitParams) => void;
logWorkflowMessage: (initParams: InitParams) => void;
logSuccessMessage: (templates: OpTypes[]) => void;
sendAnalytics: ({ initPaths, initParams, }: {
initPaths: InitPaths;
initParams: InitParams;
}) => Promise<{
initPaths: InitPaths;
initParams: InitParams;
}>;
getNameAndDescription: (initParams: Partial<InitParams>) => {
name: string | undefined;
description: string | undefined;
};
_validateName(input: string): true | "You need name your op before you can continue" | "Sorry, please name the Op using only numbers, letters, -, or _";
_validateDescription(input: string): true | "You need to provide a description of your op before continuing";
private _validateVersion;
run(): Promise<void>;
}