Skip to content

Commit dd1d6aa

Browse files
committed
hackorum-patch: keep original patch files and metadata available
1 parent af907ce commit dd1d6aa

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

public/scripts/hackorum-patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class HackorumPatch
8686
else
8787
apply_patches(patch_files)
8888
end
89+
copy_files_to_git_dir(patch_files)
8990
cleanup_temp_files
9091

9192
print_success_message(use_worktree ? worktree_path : nil)
@@ -716,6 +717,30 @@ class HackorumPatch
716717
FileUtils.rm_rf(@temp_dir) if @temp_dir && File.exist?(@temp_dir)
717718
end
718719

720+
def copy_files_to_git_dir(patch_files)
721+
hackorum_dir = File.join(Dir.pwd, '.hackorum')
722+
print "Copying patch files to #{hackorum_dir}... "
723+
724+
FileUtils.rm_rf(hackorum_dir) if File.exist?(hackorum_dir)
725+
FileUtils.mkdir_p(hackorum_dir)
726+
727+
# Copy all patch/diff files
728+
patch_files.each do |patch_file|
729+
dest = File.join(hackorum_dir, File.basename(patch_file))
730+
FileUtils.cp(patch_file, dest)
731+
end
732+
733+
# Write metadata if available
734+
if @metadata
735+
metadata_file = File.join(hackorum_dir, "#{@topic_id}.json")
736+
File.write(metadata_file, JSON.pretty_generate(@metadata))
737+
end
738+
739+
puts "[OK]"
740+
puts " Saved #{patch_files.size} files to .hackorum/"
741+
puts ""
742+
end
743+
719744
def print_success_message(worktree_path = nil)
720745
puts "[SUCCESS]"
721746
puts "=========="
@@ -728,6 +753,8 @@ class HackorumPatch
728753
puts " cd #{worktree_path}"
729754
end
730755
puts ""
756+
puts "Original patch files and metadata saved to: #{File.join(Dir.pwd, '.hackorum')}"
757+
puts ""
731758
end
732759
end
733760

public/scripts/hackorum-patch.changelog.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"date": "2026-02-04",
77
"changes": [
88
"Improved base commit detection using submission date from archive metadata",
9-
"Added --verbose option for detailed base commit detection debugging"
9+
"Added --verbose option for detailed base commit detection debugging",
10+
"Copy extracted patch files and metadata to .hackorum/ directory for inspection"
1011
]
1112
},
1213
{

0 commit comments

Comments
 (0)