@@ -239,7 +239,7 @@ export class ArchiveCommand {
239239 // Check if archive already exists
240240 try {
241241 await fs . access ( archivePath ) ;
242- throw new Error ( `Archive '${ archiveName } ' already exists. ` ) ;
242+ throw new Error ( `归档 '${ archiveName } ' 已经存在。 ` ) ;
243243 } catch ( error : any ) {
244244 if ( error . code !== 'ENOENT' ) {
245245 throw error ;
@@ -359,7 +359,7 @@ export class ArchiveCommand {
359359 const name = normalizeRequirementName ( add . name ) ;
360360 if ( addedNames . has ( name ) ) {
361361 throw new Error (
362- `${ specName } validation failed - duplicate requirement in ADDED for header "### Requirement: ${ add . name } "`
362+ `${ specName } 验证失败 - ADDED 中的重复需求,标题为 "███ Requirement: ${ add . name } "`
363363 ) ;
364364 }
365365 addedNames . add ( name ) ;
@@ -369,7 +369,7 @@ export class ArchiveCommand {
369369 const name = normalizeRequirementName ( mod . name ) ;
370370 if ( modifiedNames . has ( name ) ) {
371371 throw new Error (
372- `${ specName } validation failed - duplicate requirement in MODIFIED for header "### Requirement: ${ mod . name } "`
372+ `${ specName } 验证失败 - MODIFIED 中的重复需求,标题为 "### Requirement: ${ mod . name } "`
373373 ) ;
374374 }
375375 modifiedNames . add ( name ) ;
@@ -379,7 +379,7 @@ export class ArchiveCommand {
379379 const name = normalizeRequirementName ( rem ) ;
380380 if ( removedNamesSet . has ( name ) ) {
381381 throw new Error (
382- `${ specName } validation failed - duplicate requirement in REMOVED for header "### Requirement: ${ rem } "`
382+ `${ specName } 验证失败 - REMOVED 中的重复需求,标题为 "### Requirement: ${ rem } "`
383383 ) ;
384384 }
385385 removedNamesSet . add ( name ) ;
@@ -391,12 +391,12 @@ export class ArchiveCommand {
391391 const toNorm = normalizeRequirementName ( to ) ;
392392 if ( renamedFromSet . has ( fromNorm ) ) {
393393 throw new Error (
394- `${ specName } validation failed - duplicate FROM in RENAMED for header "### Requirement: ${ from } "`
394+ `${ specName } 验证失败 - RENAMED 中的重复 FROM,标题为 "### Requirement: ${ from } "`
395395 ) ;
396396 }
397397 if ( renamedToSet . has ( toNorm ) ) {
398398 throw new Error (
399- `${ specName } validation failed - duplicate TO in RENAMED for header "### Requirement: ${ to } "`
399+ `${ specName } 验证失败 - RENAMED 中的重复 TO,标题为 "### Requirement: ${ to } "`
400400 ) ;
401401 }
402402 renamedFromSet . add ( fromNorm ) ;
@@ -418,27 +418,27 @@ export class ArchiveCommand {
418418 const toNorm = normalizeRequirementName ( to ) ;
419419 if ( modifiedNames . has ( fromNorm ) ) {
420420 throw new Error (
421- `${ specName } validation failed - when a rename exists, MODIFIED must reference the NEW header "### Requirement: ${ to } "`
421+ `${ specName } 验证失败 - 当存在重命名时, MODIFIED 必须引用新标题 "### Requirement: ${ to } "`
422422 ) ;
423423 }
424424 // Detect ADDED colliding with a RENAMED TO
425425 if ( addedNames . has ( toNorm ) ) {
426426 throw new Error (
427- `${ specName } validation failed - RENAMED TO header collides with ADDED for "### Requirement: ${ to } "`
427+ `${ specName } 验证失败 - RENAMED TO 标题与 ADDED 冲突,标题为 "### Requirement: ${ to } "`
428428 ) ;
429429 }
430430 }
431431 if ( conflicts . length > 0 ) {
432432 const c = conflicts [ 0 ] ;
433433 throw new Error (
434- `${ specName } validation failed - requirement present in multiple sections ( ${ c . a } and ${ c . b } ) for header "### Requirement: ${ c . name } "`
434+ `${ specName } 验证失败 - 需求出现在多个部分中( ${ c . a } 和 ${ c . b } ),标题为 "### Requirement: ${ c . name } "`
435435 ) ;
436436 }
437437 const hasAnyDelta = ( plan . added . length + plan . modified . length + plan . removed . length + plan . renamed . length ) > 0 ;
438438 if ( ! hasAnyDelta ) {
439439 throw new Error (
440- `Delta parsing found no operations for ${ path . basename ( path . dirname ( update . source ) ) } . ` +
441- `Provide ADDED/MODIFIED/REMOVED/RENAMED sections in change spec. `
440+ `未找到 ${ path . basename ( path . dirname ( update . source ) ) } 的任何操作。 ` +
441+ `请在变更规范中提供 ADDED/MODIFIED/REMOVED/RENAMED 部分。 `
442442 ) ;
443443 }
444444
@@ -450,7 +450,7 @@ export class ArchiveCommand {
450450 // Target spec does not exist; only ADDED operations are permitted
451451 if ( plan . modified . length > 0 || plan . removed . length > 0 || plan . renamed . length > 0 ) {
452452 throw new Error (
453- `${ specName } : target spec does not exist; only ADDED requirements are allowed for new specs. `
453+ `${ specName } : 目标规范不存在;新规范仅允许 ADDED 需求。 `
454454 ) ;
455455 }
456456 targetContent = this . buildSpecSkeleton ( specName , changeName ) ;
@@ -470,12 +470,12 @@ export class ArchiveCommand {
470470 const to = normalizeRequirementName ( r . to ) ;
471471 if ( ! nameToBlock . has ( from ) ) {
472472 throw new Error (
473- `${ specName } RENAMED failed for header "### Requirement: ${ r . from } " - source not found `
473+ `${ specName } RENAMED 失败,标题 "### Requirement: ${ r . from } " - 未找到源 `
474474 ) ;
475475 }
476476 if ( nameToBlock . has ( to ) ) {
477477 throw new Error (
478- `${ specName } RENAMED failed for header "### Requirement: ${ r . to } " - target already exists `
478+ `${ specName } RENAMED 失败,标题 "### Requirement: ${ r . to } " - 目标已经存在 `
479479 ) ;
480480 }
481481 const block = nameToBlock . get ( from ) ! ;
@@ -497,7 +497,7 @@ export class ArchiveCommand {
497497 const key = normalizeRequirementName ( name ) ;
498498 if ( ! nameToBlock . has ( key ) ) {
499499 throw new Error (
500- `${ specName } REMOVED failed for header "### Requirement: ${ name } " - not found `
500+ `${ specName } REMOVED 失败,标题 "### Requirement: ${ name } " - 未找到 `
501501 ) ;
502502 }
503503 nameToBlock . delete ( key ) ;
@@ -508,15 +508,15 @@ export class ArchiveCommand {
508508 const key = normalizeRequirementName ( mod . name ) ;
509509 if ( ! nameToBlock . has ( key ) ) {
510510 throw new Error (
511- `${ specName } MODIFIED failed for header "### Requirement: ${ mod . name } " - not found `
511+ `${ specName } MODIFIED 失败,标题 "### Requirement: ${ mod . name } " - 未找到 `
512512 ) ;
513513 }
514514 // Replace block with provided raw (ensure header line matches key)
515515 const REQUIREMENT_KEYWORD_PATTERN = '(?:Requirement|需求)' ;
516516 const modHeaderMatch = mod . raw . split ( '\n' ) [ 0 ] . match ( new RegExp ( `^###\\s*${ REQUIREMENT_KEYWORD_PATTERN } :\\s*(.+)\\s*$` ) ) ;
517517 if ( ! modHeaderMatch || normalizeRequirementName ( modHeaderMatch [ 1 ] ) !== key ) {
518518 throw new Error (
519- `${ specName } MODIFIED failed for header "### Requirement: ${ mod . name } " - header mismatch in content `
519+ `${ specName } MODIFIED 失败,标题 "### Requirement: ${ mod . name } " - 内容中的标题不匹配 `
520520 ) ;
521521 }
522522 nameToBlock . set ( key , mod ) ;
0 commit comments