From 86b0ab56e42aab0b9a74cb96362d25fc33dc16f8 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Fri, 30 Jan 2026 07:07:59 +0000 Subject: [PATCH] Add source files: main entry, types, and configuration --- src/types/spec.ts | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/types/spec.ts diff --git a/src/types/spec.ts b/src/types/spec.ts new file mode 100644 index 0000000..f30db75 --- /dev/null +++ b/src/types/spec.ts @@ -0,0 +1,68 @@ +export interface CLISpec { + name: string; + version: string; + description: string; + author?: string; + license?: string; + homepage?: string; + bin?: string; + globalOptions?: Option[]; + commands: Command[]; + examples?: Example[]; +} + +export interface Option { + name: string; + short?: string; + description: string; + type: 'string' | 'number' | 'boolean' | 'array'; + required?: boolean; + default?: string | number | boolean | string[]; + choices?: (string | number)[]; + implies?: string[]; + conflicts?: string[]; +} + +export interface Command { + name: string; + description: string; + aliases?: string[]; + options?: Option[]; + arguments?: Argument[]; + subcommands?: Command[]; + examples?: Example[]; +} + +export interface Argument { + name: string; + description: string; + required?: boolean; + variadic?: boolean; + choices?: string[]; +} + +export interface Example { + description: string; + command: string; + output?: string; +} + +export type LanguageTarget = 'python' | 'go' | 'rust' | 'node-commander' | 'node-yargs'; + +export type ShellType = 'bash' | 'zsh' | 'fish'; + +export interface GeneratorOptions { + language: LanguageTarget; + outputDir?: string; + packageName?: string; + author?: string; +} + +export interface TemplateContext { + spec: CLISpec; + command?: Command; + options?: Option[]; + arguments?: Argument[]; + isSubcommand?: boolean; + indent?: string; +}