Spaces:
Sleeping
Sleeping
File size: 2,415 Bytes
494c89b |
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
"""Dry run test of the patcher - don't actually patch, just verify"""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from services.kiro_patcher_service import KiroPatcherService
patcher = KiroPatcherService()
# Get current status
status = patcher.get_status()
print("=== Current Status ===")
print(f"Kiro version: {status.kiro_version}")
print(f"Is patched: {status.is_patched}")
print(f"Patch version: {status.patch_version}")
print(f"Extension path: {status.extension_js_path}")
print(f"Current machine ID: {status.current_machine_id[:16] if status.current_machine_id else 'None'}...")
# Check patch info file
patch_info = patcher.get_patch_info()
if patch_info:
print(f"\n=== Patch Info File ===")
print(f"Patch version: {patch_info.get('patch_version')}")
print(f"Kiro version: {patch_info.get('kiro_version')}")
print(f"Patched at: {patch_info.get('patched_at')}")
print(f"Patches: {patch_info.get('patches_applied')}")
else:
print("\n=== Patch Info File: NOT FOUND ===")
# Read extension.js and test patch
print("\n=== Testing Patch Application (dry run) ===")
ext_path = patcher.extension_js_path
if ext_path:
content = ext_path.read_text(encoding='utf-8')
# Apply patch to copy
patched = patcher._apply_patch(content)
if patched != content:
print("✓ Patch would be applied successfully!")
# Check what patches were applied
patches = [
('KIRO_BATCH_LOGIN_PATCH', 'getMachineId patch'),
('KIRO_AUTO_SWITCH_PATCH', 'Auto-switch on ban'),
('KIRO_TOKEN_CACHE_PATCH', 'Token cache fix'),
('KIRO_UNIQUEID_PATCH', 'getUniqueId patch'),
('KIRO_OTEL_PATCH', 'OpenTelemetry host.id patch'),
('kiro-manager-wb', 'Custom machineId file path'),
]
for marker, name in patches:
count = patched.count(marker)
if count > 0:
print(f" ✓ {name} ({count}x)")
else:
print(f" ✗ {name} - NOT APPLIED")
# Show diff size
print(f"\nOriginal size: {len(content):,} bytes")
print(f"Patched size: {len(patched):,} bytes")
print(f"Diff: +{len(patched) - len(content):,} bytes")
else:
print("✗ Patch would NOT be applied (no changes)")
else:
print("✗ Extension path not found")
|