@@ -7,7 +7,9 @@ export default class MainCli {
77
88 private projectName : string ;
99
10- private planFile : string ;
10+ private inputFile : string ;
11+
12+ private fileType : 'plan' | 'state' = 'plan' ;
1113
1214 public args : arg . Result < any > ;
1315
@@ -18,11 +20,27 @@ export default class MainCli {
1820
1921 if ( ! this . args [ '--project-name' ] ) throw new Error ( 'Specify project name --project-name' ) ;
2022
21- if ( ! this . args [ '--plan-file' ] ) throw new Error ( 'Specify plan file --plan-file <path>' ) ;
23+ // Determine input file - prefer new --file, fallback to legacy options
24+ const file = this . args [ '--file' ] ;
25+ const planFile = this . args [ '--plan-file' ] ;
26+ const stateFile = this . args [ '--state-file' ] ;
27+
28+ // Count how many file options are provided
29+ const fileOptions = [ file , planFile , stateFile ] . filter ( Boolean ) ;
30+
31+ if ( fileOptions . length === 0 ) {
32+ throw new Error ( 'Specify input file with --file <path> (or legacy --plan-file/--state-file)' ) ;
33+ }
34+
35+ if ( fileOptions . length > 1 ) {
36+ throw new Error ( 'Specify only one input file option' ) ;
37+ }
38+
39+ // Use whichever file option was provided
40+ this . inputFile = file || planFile || stateFile ! ;
2241
2342 this . token = this . args [ '--token' ] ;
2443 this . breakdown = this . args [ '--breakdown' ] ?? false ;
25- this . planFile = this . args [ '--plan-file' ] ;
2644 this . projectName = this . args [ '--project-name' ] ;
2745 }
2846
@@ -38,7 +56,24 @@ export default class MainCli {
3856 return this . breakdown ;
3957 }
4058
41- getPlanFile ( ) : string {
42- return this . planFile ;
59+ getInputFile ( ) : string {
60+ return this . inputFile ;
61+ }
62+
63+ // Legacy methods for backward compatibility
64+ getPlanFile ( ) : string | null {
65+ return this . args [ '--plan-file' ] || null ;
66+ }
67+
68+ getStateFile ( ) : string | null {
69+ return this . args [ '--state-file' ] || null ;
70+ }
71+
72+ getFileType ( ) : 'plan' | 'state' {
73+ return this . fileType ;
74+ }
75+
76+ setFileType ( fileType : 'plan' | 'state' ) {
77+ this . fileType = fileType ;
4378 }
4479}
0 commit comments