@@ -20,11 +20,11 @@ const { version } = require('../../package.json');
2020
2121program
2222 . name ( 'openspec' )
23- . description ( 'AI-native system for spec-driven development ' )
23+ . description ( '基于规范驱动开发的AI原生系统 ' )
2424 . version ( version ) ;
2525
2626// Global options
27- program . option ( '--no-color' , 'Disable color output ' ) ;
27+ program . option ( '--no-color' , '禁用彩色输出 ' ) ;
2828
2929// Apply global flags before any command runs
3030program . hook ( 'preAction' , ( thisCommand ) => {
@@ -35,11 +35,11 @@ program.hook('preAction', (thisCommand) => {
3535} ) ;
3636
3737const availableToolIds = AI_TOOLS . filter ( ( tool ) => tool . available ) . map ( ( tool ) => tool . value ) ;
38- const toolsOptionDescription = `Configure AI tools non-interactively. Use "all", "none", or a comma-separated list of: ${ availableToolIds . join ( ', ' ) } ` ;
38+ const toolsOptionDescription = `非交互式配置AI工具。使用 "all"、 "none" 或逗号分隔的列表: ${ availableToolIds . join ( ', ' ) } ` ;
3939
4040program
4141 . command ( 'init [path]' )
42- . description ( 'Initialize OpenSpec in your project ' )
42+ . description ( '在您的项目中初始化OpenSpec ' )
4343 . option ( '--tools <tools>' , toolsOptionDescription )
4444 . action ( async ( targetPath = '.' , options ?: { tools ?: string } ) => {
4545 try {
@@ -54,7 +54,7 @@ program
5454 } catch ( error : any ) {
5555 if ( error . code === 'ENOENT' ) {
5656 // Directory doesn't exist, but we can create it
57- console . log ( `Directory "${ targetPath } " doesn't exist, it will be created. ` ) ;
57+ console . log ( `目录 "${ targetPath } " 不存在,将被创建。 ` ) ;
5858 } else if ( error . message && error . message . includes ( 'not a directory' ) ) {
5959 throw error ;
6060 } else {
@@ -68,70 +68,70 @@ program
6868 await initCommand . execute ( targetPath ) ;
6969 } catch ( error ) {
7070 console . log ( ) ; // Empty line for spacing
71- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
71+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
7272 process . exit ( 1 ) ;
7373 }
7474 } ) ;
7575
7676program
7777 . command ( 'update [path]' )
78- . description ( 'Update OpenSpec instruction files ' )
78+ . description ( '更新OpenSpec指令文件 ' )
7979 . action ( async ( targetPath = '.' ) => {
8080 try {
8181 const resolvedPath = path . resolve ( targetPath ) ;
8282 const updateCommand = new UpdateCommand ( ) ;
8383 await updateCommand . execute ( resolvedPath ) ;
8484 } catch ( error ) {
8585 console . log ( ) ; // Empty line for spacing
86- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
86+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
8787 process . exit ( 1 ) ;
8888 }
8989 } ) ;
9090
9191program
9292 . command ( 'list' )
93- . description ( 'List items (changes by default). Use --specs to list specs. ' )
94- . option ( '--specs' , 'List specs instead of changes ' )
95- . option ( '--changes' , 'List changes explicitly (default) ' )
93+ . description ( '列出项目(默认显示更改)。使用 --specs 列出规范。 ' )
94+ . option ( '--specs' , '列出规范而非更改 ' )
95+ . option ( '--changes' , '明确列出更改(默认) ' )
9696 . action ( async ( options ?: { specs ?: boolean ; changes ?: boolean } ) => {
9797 try {
9898 const listCommand = new ListCommand ( ) ;
9999 const mode : 'changes' | 'specs' = options ?. specs ? 'specs' : 'changes' ;
100100 await listCommand . execute ( '.' , mode ) ;
101101 } catch ( error ) {
102102 console . log ( ) ; // Empty line for spacing
103- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
103+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
104104 process . exit ( 1 ) ;
105105 }
106106 } ) ;
107107
108108program
109109 . command ( 'view' )
110- . description ( 'Display an interactive dashboard of specs and changes ' )
110+ . description ( '显示规范和更改的交互式仪表板 ' )
111111 . action ( async ( ) => {
112112 try {
113113 const viewCommand = new ViewCommand ( ) ;
114114 await viewCommand . execute ( '.' ) ;
115115 } catch ( error ) {
116116 console . log ( ) ; // Empty line for spacing
117- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
117+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
118118 process . exit ( 1 ) ;
119119 }
120120 } ) ;
121121
122122// Change command with subcommands
123123const changeCmd = program
124124 . command ( 'change' )
125- . description ( 'Manage OpenSpec change proposals ' ) ;
125+ . description ( '管理OpenSpec变更提案 ' ) ;
126126
127127// Deprecation notice for noun-based commands
128128changeCmd . hook ( 'preAction' , ( ) => {
129- console . error ( 'Warning: The "openspec change ..." commands are deprecated. Prefer verb-first commands (e.g., "openspec list", "openspec validate --changes"). ' ) ;
129+ console . error ( '警告: "openspec change ..." 命令已弃用。请优先使用动词开头的命令(例如 "openspec list", "openspec validate --changes")。 ' ) ;
130130} ) ;
131131
132132changeCmd
133133 . command ( 'show [change-name]' )
134- . description ( 'Show a change proposal in JSON or markdown format ' )
134+ . description ( '以JSON或markdown格式显示变更提案 ' )
135135 . option ( '--json' , 'Output as JSON' )
136136 . option ( '--deltas-only' , 'Show only deltas (JSON only)' )
137137 . option ( '--requirements-only' , 'Alias for --deltas-only (deprecated)' )
@@ -141,30 +141,30 @@ changeCmd
141141 const changeCommand = new ChangeCommand ( ) ;
142142 await changeCommand . show ( changeName , options ) ;
143143 } catch ( error ) {
144- console . error ( `Error: ${ ( error as Error ) . message } ` ) ;
144+ console . error ( `错误: ${ ( error as Error ) . message } ` ) ;
145145 process . exitCode = 1 ;
146146 }
147147 } ) ;
148148
149149changeCmd
150150 . command ( 'list' )
151- . description ( 'List all active changes (DEPRECATED: use "openspec list" instead) ' )
151+ . description ( '列出所有活动更改(已弃用:请使用 "openspec list") ' )
152152 . option ( '--json' , 'Output as JSON' )
153153 . option ( '--long' , 'Show id and title with counts' )
154154 . action ( async ( options ?: { json ?: boolean ; long ?: boolean } ) => {
155155 try {
156- console . error ( 'Warning: "openspec change list" is deprecated. Use "openspec list". ' ) ;
156+ console . error ( '警告: "openspec change list" 已弃用。请使用 "openspec list"。 ' ) ;
157157 const changeCommand = new ChangeCommand ( ) ;
158158 await changeCommand . list ( options ) ;
159159 } catch ( error ) {
160- console . error ( `Error: ${ ( error as Error ) . message } ` ) ;
160+ console . error ( `错误: ${ ( error as Error ) . message } ` ) ;
161161 process . exitCode = 1 ;
162162 }
163163 } ) ;
164164
165165changeCmd
166166 . command ( 'validate [change-name]' )
167- . description ( 'Validate a change proposal ' )
167+ . description ( '验证变更提案 ' )
168168 . option ( '--strict' , 'Enable strict validation mode' )
169169 . option ( '--json' , 'Output validation report as JSON' )
170170 . option ( '--no-interactive' , 'Disable interactive prompts' )
@@ -176,24 +176,24 @@ changeCmd
176176 process . exit ( process . exitCode ) ;
177177 }
178178 } catch ( error ) {
179- console . error ( `Error: ${ ( error as Error ) . message } ` ) ;
179+ console . error ( `错误: ${ ( error as Error ) . message } ` ) ;
180180 process . exitCode = 1 ;
181181 }
182182 } ) ;
183183
184184program
185185 . command ( 'archive [change-name]' )
186- . description ( 'Archive a completed change and update main specs ' )
187- . option ( '-y, --yes' , 'Skip confirmation prompts ' )
188- . option ( '--skip-specs' , 'Skip spec update operations (useful for infrastructure, tooling, or doc-only changes) ' )
189- . option ( '--no-validate' , 'Skip validation (not recommended, requires confirmation) ' )
186+ . description ( '归档已完成的更改并更新主规范 ' )
187+ . option ( '-y, --yes' , '跳过确认提示 ' )
188+ . option ( '--skip-specs' , '跳过规范更新操作(适用于基础设施、工具或仅文档更改) ' )
189+ . option ( '--no-validate' , '跳过验证(不推荐,需要确认) ' )
190190 . action ( async ( changeName ?: string , options ?: { yes ?: boolean ; skipSpecs ?: boolean ; noValidate ?: boolean ; validate ?: boolean } ) => {
191191 try {
192192 const archiveCommand = new ArchiveCommand ( ) ;
193193 await archiveCommand . execute ( changeName , options ) ;
194194 } catch ( error ) {
195195 console . log ( ) ; // Empty line for spacing
196- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
196+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
197197 process . exit ( 1 ) ;
198198 }
199199 } ) ;
@@ -203,11 +203,11 @@ registerSpecCommand(program);
203203// Top-level validate command
204204program
205205 . command ( 'validate [item-name]' )
206- . description ( 'Validate changes and specs ' )
207- . option ( '--all' , 'Validate all changes and specs ' )
208- . option ( '--changes' , 'Validate all changes ' )
209- . option ( '--specs' , 'Validate all specs ' )
210- . option ( '--type <type>' , 'Specify item type when ambiguous: change|spec' )
206+ . description ( '验证更改和规范 ' )
207+ . option ( '--all' , '验证所有更改和规范 ' )
208+ . option ( '--changes' , '验证所有更改 ' )
209+ . option ( '--specs' , '验证所有规范 ' )
210+ . option ( '--type <type>' , '当项目类型不明确时指定类型: change|spec' )
211211 . option ( '--strict' , 'Enable strict validation mode' )
212212 . option ( '--json' , 'Output validation results as JSON' )
213213 . option ( '--concurrency <n>' , 'Max concurrent validations (defaults to env OPENSPEC_CONCURRENCY or 6)' )
@@ -218,17 +218,17 @@ program
218218 await validateCommand . execute ( itemName , options ) ;
219219 } catch ( error ) {
220220 console . log ( ) ;
221- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
221+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
222222 process . exit ( 1 ) ;
223223 }
224224 } ) ;
225225
226226// Top-level show command
227227program
228228 . command ( 'show [item-name]' )
229- . description ( 'Show a change or spec ' )
229+ . description ( '显示更改或规范 ' )
230230 . option ( '--json' , 'Output as JSON' )
231- . option ( '--type <type>' , 'Specify item type when ambiguous: change|spec' )
231+ . option ( '--type <type>' , '当项目类型不明确时指定类型: change|spec' )
232232 . option ( '--no-interactive' , 'Disable interactive prompts' )
233233 // change-only flags
234234 . option ( '--deltas-only' , 'Show only deltas (JSON only, change)' )
@@ -245,7 +245,7 @@ program
245245 await showCommand . execute ( itemName , options ?? { } ) ;
246246 } catch ( error ) {
247247 console . log ( ) ;
248- ora ( ) . fail ( `Error: ${ ( error as Error ) . message } ` ) ;
248+ ora ( ) . fail ( `错误: ${ ( error as Error ) . message } ` ) ;
249249 process . exit ( 1 ) ;
250250 }
251251 } ) ;
0 commit comments