@cto.ai/ops
Version:
💻 CTO.ai - The CLI built for Teams 🚀
55 lines (54 loc) • 2.14 kB
TypeScript
import Command, { flags } from './../base';
import { Container, Config, OpCommand, OpPipeline, OpService } from './../types';
type TemplateDefinition = {
kind: string;
name: string;
priority: boolean;
path: string;
specialFiles: TemplateSpecialFiles;
};
type TemplateSpecialFiles = {
pjson: boolean;
};
type NewOpMetadata = {
name: string;
description: string;
version: string;
};
export default class Init extends Command {
static description: string;
static flags: flags.Input<any>;
static args: {
name: string;
description: string;
}[];
srcDir: string;
destDir: string;
readTemplates: () => Promise<Container<Container<TemplateDefinition>>>;
selectKind: (kinds: string[], flagKind: string | undefined) => Promise<string>;
selectTemplateName: (templates: string[], flagTemplate: string | undefined) => Promise<string>;
/**
* Returns the list of templates available for the user based provided flags
* and selected languague.
*
* @remarks
* This method will ignore any template directory prefixed with `_`
*
* @param templates - Available templates for the given Ops type
* @param flags - The cli flags provided by the user
* @returns Promise<TemplateDefinition> The selected template
*
*/
selectTemplate: (templates: Container<Container<TemplateDefinition>>, flags: {
kind?: string;
template?: string;
}) => Promise<TemplateDefinition>;
promptForName: (name: string | undefined, kind: string) => Promise<string>;
promptForMetadata: (template: TemplateDefinition, nameParam: string) => Promise<NewOpMetadata>;
customizeSpecialFiles: (template: TemplateDefinition, metadata: NewOpMetadata, targetPath: string) => Promise<void>;
sendAnalytics: (config: Config, kind: string, metadata: NewOpMetadata, targetPath: string) => void;
selectOpToBuild: (ops: OpCommand[]) => Promise<OpCommand[]>;
convertOpsToCommands: (opsToBuild: Array<OpCommand | OpPipeline | OpService>, opPath: string) => Promise<OpCommand[]>;
run(): Promise<void>;
}
export {};