@@ -58,6 +58,45 @@ def __init__(self, verbose=False):
5858 self ._is_lib_changed = False
5959 self .skip_validation = False
6060
61+ def clean_checksums (self ):
62+ """Delete all .checksum files in main, patterns, options, and lib directories"""
63+ self .console .print ("[yellow]🧹 Cleaning all .checksum files...[/yellow]" )
64+
65+ checksum_paths = [
66+ ".checksum" , # main
67+ "lib/.checksum" , # lib
68+ ]
69+
70+ # Add patterns checksum files
71+ patterns_dir = "patterns"
72+ if os .path .exists (patterns_dir ):
73+ for item in os .listdir (patterns_dir ):
74+ pattern_path = os .path .join (patterns_dir , item )
75+ if os .path .isdir (pattern_path ):
76+ checksum_paths .append (f"{ pattern_path } /.checksum" )
77+
78+ # Add options checksum files
79+ options_dir = "options"
80+ if os .path .exists (options_dir ):
81+ for item in os .listdir (options_dir ):
82+ option_path = os .path .join (options_dir , item )
83+ if os .path .isdir (option_path ):
84+ checksum_paths .append (f"{ option_path } /.checksum" )
85+
86+ deleted_count = 0
87+ for checksum_path in checksum_paths :
88+ if os .path .exists (checksum_path ):
89+ os .remove (checksum_path )
90+ self .console .print (f"[green] ✓ Deleted { checksum_path } [/green]" )
91+ deleted_count += 1
92+
93+ if deleted_count == 0 :
94+ self .console .print ("[dim] No .checksum files found to delete[/dim]" )
95+ else :
96+ self .console .print (
97+ f"[green]✅ Deleted { deleted_count } .checksum files - full rebuild will be triggered[/green]"
98+ )
99+
61100 def log_verbose (self , message , style = "dim" ):
62101 """Log verbose messages if verbose mode is enabled"""
63102 if self .verbose :
@@ -119,7 +158,7 @@ def print_usage(self):
119158 """Print usage information with Rich formatting"""
120159 self .console .print ("\n [bold cyan]Usage:[/bold cyan]" )
121160 self .console .print (
122- " python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose] [--no-validate]"
161+ " python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose] [--no-validate] [--clean-build] "
123162 )
124163
125164 self .console .print ("\n [bold cyan]Parameters:[/bold cyan]" )
@@ -143,6 +182,9 @@ def print_usage(self):
143182 self .console .print (
144183 " [yellow][--no-validate][/yellow]: Optional. Skip CloudFormation template validation"
145184 )
185+ self .console .print (
186+ " [yellow][--clean-build][/yellow]: Optional. Delete all .checksum files to force full rebuild"
187+ )
146188
147189 def check_parameters (self , args ):
148190 """Check and validate input parameters"""
@@ -205,6 +247,8 @@ def check_parameters(self, args):
205247 self .console .print (
206248 "[yellow]CloudFormation template validation will be skipped[/yellow]"
207249 )
250+ elif arg == "--clean-build" :
251+ self .clean_checksums ()
208252 else :
209253 self .console .print (
210254 f"[yellow]Warning: Unknown argument '{ arg } ' ignored[/yellow]"
0 commit comments