-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprecise_fix.py
More file actions
48 lines (40 loc) · 2.55 KB
/
precise_fix.py
File metadata and controls
48 lines (40 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def fix_app():
with open('App.tsx', 'r') as f:
lines = f.readlines()
new_lines = []
for line in lines:
if 'Vibe coded by Kash' in line:
# Reconstruct this line and the following ones to be correct
new_lines.append(' Vibe coded by Kash <span className="cursor-pointer hover:scale-125 inline-block transition-transform" onClick={handleUnicornClick}>🦄</span> - 2026 - Open Source - Sharing is caring ❤️\n')
new_lines.append(' </p>\n')
new_lines.append(" <button onClick={() => { setShowLegal(true); window.history.pushState({ page: 'legal' }, ''); }} className=\"mt-4 text-[10px] font-bold text-slate-300 hover:text-slate-500 uppercase tracking-widest transition-colors\">{t.legal?.footerLink || 'CGU & Privacy'}</button>\n")
elif '<button onClick={() => { setShowLegal(true)' in line:
# Skip this line as we added it above
continue
elif 'Vibe coded by Kash' in lines[lines.index(line)-1] if lines.index(line)>0 else False:
# This handles the case where the previous line was the broken one and we might have trailing garbage or the next line is the button
# But since I'm iterating, the index lookbehind is risky.
# Simpler approach:
# Just identifying the broken state.
pass
new_lines.append(line)
else:
new_lines.append(line)
# Actually, the logic above is a bit flaky because of the iterator.
# Let's do a read-entire-file and replace approach.
with open('App.tsx', 'r') as f:
content = f.read()
# The broken segment looks like:
# Vibe coded by Kash <span ...>🦄</span> - 2026 - Open Source - \n <button ...
broken_part = 'Vibe coded by Kash <span className="cursor-pointer hover:scale-125 inline-block transition-transform" onClick={handleUnicornClick}>🦄</span> - 2026 - Open Source - \n <button'
fixed_part = 'Vibe coded by Kash <span className="cursor-pointer hover:scale-125 inline-block transition-transform" onClick={handleUnicornClick}>🦄</span> - 2026 - Open Source - Sharing is caring ❤️\n </p>\n <button'
if broken_part in content:
content = content.replace(broken_part, fixed_part)
with open('App.tsx', 'w') as f:
f.write(content)
print("Fixed App.tsx")
else:
print("Could not find the specific broken pattern. Dumping last 500 chars to debug.")
print(content[-500:])
if __name__ == "__main__":
fix_app()