Add source files: main entry, types, and configuration

This commit is contained in:
2026-01-30 07:07:59 +00:00
parent 81a4905d85
commit 86b0ab56e4

68
src/types/spec.ts Normal file
View File

@@ -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;
}