tzero-mcp 12.3.3 → 12.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -0
- package/package.json +3 -4
- package/src/addmcp.py +2 -2
- package/src/app.py +1 -1
- package/src/main.py +4 -0
- package/src/tzero/__init__.py +1 -1
- package/src/tzero/desktop_updater.py +6 -0
- package/src/tzero/tzero_benchmark.py +1 -1
- package/src/tzero/tzero_budget.py +1 -1
- package/src/tzero/tzero_ci.py +1 -1
- package/src/tzero/tzero_contracts.py +2 -2
- package/src/tzero/tzero_dashboard.py +4 -4
- package/src/tzero/tzero_debt.py +1 -1
- package/src/tzero/tzero_deps.py +1 -0
- package/src/tzero/tzero_explain.py +1 -1
- package/src/tzero/tzero_features.py +31 -74
- package/src/tzero/tzero_golden.py +2 -2
- package/src/tzero/tzero_growth.py +1 -1
- package/src/tzero/tzero_jarvis/orchestrator.py +1 -1
- package/src/tzero/tzero_jarvis/workspace_orchestrator.py +10 -21
- package/src/tzero/tzero_lsp.py +1 -1
- package/src/tzero/tzero_mcp.py +47 -215
- package/src/tzero/tzero_promo.py +1 -1
- package/src/tzero/tzero_security.py +3 -3
- package/src/tzero/tzero_sync.py +73 -148
- package/src/tzero/tzero_task_benchmark.py +2 -2
- package/src/tzero/tzero_traffic.py +1 -1
- package/src/tzero/tzero_tui.py +2 -13
- package/src/tzero/tzero_v3.py +322 -556
- package/src/tzero/tzero_welcome.py +1 -1
- package/src/tzero/anti_rea/__init__.py +0 -84
- package/src/tzero/anti_rea/algebraic_mutator.py +0 -107
- package/src/tzero/anti_rea/anti_agent_guard.py +0 -96
- package/src/tzero/anti_rea/anti_debugger.py +0 -272
- package/src/tzero/anti_rea/anti_vm.py +0 -160
- package/src/tzero/anti_rea/asar_shield.py +0 -122
- package/src/tzero/anti_rea/auditor.py +0 -208
- package/src/tzero/anti_rea/bpe_disrupter.py +0 -48
- package/src/tzero/anti_rea/bytecode_trap.py +0 -85
- package/src/tzero/anti_rea/canary_beacon.py +0 -167
- package/src/tzero/anti_rea/cli.py +0 -134
- package/src/tzero/anti_rea/confusables.py +0 -130
- package/src/tzero/anti_rea/crypto_loader.py +0 -132
- package/src/tzero/anti_rea/engine.py +0 -304
- package/src/tzero/anti_rea/extractor_shield.py +0 -180
- package/src/tzero/anti_rea/flattener.py +0 -136
- package/src/tzero/anti_rea/gui.py +0 -264
- package/src/tzero/anti_rea/honeypot.py +0 -58
- package/src/tzero/anti_rea/integrity_guard.py +0 -78
- package/src/tzero/anti_rea/jailbreak_decoy.py +0 -77
- package/src/tzero/anti_rea/mcp_poison.py +0 -41
- package/src/tzero/anti_rea/native_bridge.py +0 -169
- package/src/tzero/anti_rea/rdtsc_guard.py +0 -77
- package/src/tzero/anti_rea/string_vault.py +0 -97
- package/src/tzero/anti_rea/sybil_network.py +0 -53
- package/src/tzero/anti_rea/tier_catalog.py +0 -388
- package/src/tzero/anti_rea/timing_guard.py +0 -46
- package/src/tzero/anti_rea/token_bomb.py +0 -65
- package/src/tzero/anti_rea/traps.py +0 -76
- package/src/tzero/anti_rea/vm_obfuscator.py +0 -182
- package/src/tzero/tzero_armor.py +0 -187
package/src/tzero/tzero_v3.py
CHANGED
|
@@ -109,6 +109,7 @@ if tzero_deps is not None and not tzero_deps.ensure_dependencies():
|
|
|
109
109
|
import keyring
|
|
110
110
|
import requests
|
|
111
111
|
import threading
|
|
112
|
+
from queue import Empty, SimpleQueue
|
|
112
113
|
import subprocess
|
|
113
114
|
import webbrowser
|
|
114
115
|
from typing import Dict, List, Any, Tuple, Optional, Set, Callable
|
|
@@ -218,19 +219,19 @@ THEME_PALETTES = {
|
|
|
218
219
|
"error": "#f43f5e"
|
|
219
220
|
},
|
|
220
221
|
"Luxury Dashboard": {
|
|
221
|
-
"bg_start": "#
|
|
222
|
-
"card_bg": "#
|
|
223
|
-
"card_border": "#
|
|
224
|
-
"card_shadow": "#
|
|
225
|
-
"card_hover": "#
|
|
222
|
+
"bg_start": "#f3f5f9",
|
|
223
|
+
"card_bg": "#ffffff",
|
|
224
|
+
"card_border": "#dce3ee",
|
|
225
|
+
"card_shadow": "#e3e9f2",
|
|
226
|
+
"card_hover": "#eef2f9",
|
|
226
227
|
"sidebar_bg": "#18243b",
|
|
227
228
|
"sidebar_fg": "#f8f5ef",
|
|
228
|
-
"sidebar_muted": "#
|
|
229
|
+
"sidebar_muted": "#bac8dc",
|
|
229
230
|
"sidebar_hover": "#26344d",
|
|
230
231
|
"sidebar_active": "#2d3d57",
|
|
231
232
|
"text_main": "#202633",
|
|
232
233
|
"text_muted": "#687180",
|
|
233
|
-
"accent_cyan": "#
|
|
234
|
+
"accent_cyan": "#2d5ca6",
|
|
234
235
|
"accent_green": "#237d6b",
|
|
235
236
|
"accent_purple": "#7864a6",
|
|
236
237
|
"accent_coral": "#c6784b",
|
|
@@ -493,7 +494,7 @@ def calculate_token_cost(token_count: int, provider_name: str) -> float:
|
|
|
493
494
|
# i18n Translations
|
|
494
495
|
TRANSLATIONS: Dict[str, Dict[str, str]] = {
|
|
495
496
|
"en": {
|
|
496
|
-
"title": "T-Zero Developer Console & Context Architect v12.3.
|
|
497
|
+
"title": "T-Zero Developer Console & Context Architect v12.3.6",
|
|
497
498
|
"subtitle": f"Developer: {DEV_NAME} | {DEV_URL_MAIN} | {DEV_URL_BIO}",
|
|
498
499
|
"overview_tab": "🏠 Overview Dashboard",
|
|
499
500
|
"setup_tab": "⚡ Setup & AI Models",
|
|
@@ -530,7 +531,7 @@ TRANSLATIONS: Dict[str, Dict[str, str]] = {
|
|
|
530
531
|
"audit_btn": "🛡️ SECURITY AUDIT"
|
|
531
532
|
},
|
|
532
533
|
"tr": {
|
|
533
|
-
"title": "T-Zero Developer Console & Context Architect v12.3.
|
|
534
|
+
"title": "T-Zero Developer Console & Context Architect v12.3.6",
|
|
534
535
|
"subtitle": f"Developer: {DEV_NAME} | {DEV_URL_MAIN} | {DEV_URL_BIO}",
|
|
535
536
|
"overview_tab": "🏠 Overview Dashboard",
|
|
536
537
|
"setup_tab": "⚡ Setup & AI Models",
|
|
@@ -607,80 +608,6 @@ def validate_directory(path: str) -> bool:
|
|
|
607
608
|
return os.path.exists(expanded) and os.path.isdir(expanded)
|
|
608
609
|
|
|
609
610
|
|
|
610
|
-
class ToastNotification(tk.Toplevel):
|
|
611
|
-
"""Sleek animated glassmorphism toast notification."""
|
|
612
|
-
def __init__(self, master, title, message, n_type='info'):
|
|
613
|
-
super().__init__(master)
|
|
614
|
-
self.overrideredirect(True)
|
|
615
|
-
self.attributes('-alpha', 0.0)
|
|
616
|
-
self.attributes('-topmost', True)
|
|
617
|
-
|
|
618
|
-
bg_color = PALETTE['card_bg']
|
|
619
|
-
accent = PALETTE['accent_cyan']
|
|
620
|
-
if n_type == 'error': accent = '#ef4444'
|
|
621
|
-
elif n_type == 'success': accent = '#10b981'
|
|
622
|
-
elif n_type == 'warning': accent = '#f59e0b'
|
|
623
|
-
|
|
624
|
-
self.configure(bg=bg_color, highlightthickness=1, highlightbackground=accent)
|
|
625
|
-
|
|
626
|
-
lbl_title = tk.Label(self, text=title, bg=bg_color, fg=accent, font=('Segoe UI', 10, 'bold'))
|
|
627
|
-
lbl_title.pack(anchor='w', padx=16, pady=(12, 2))
|
|
628
|
-
|
|
629
|
-
lbl_msg = tk.Label(self, text=message, bg=bg_color, fg=PALETTE['text_fg'], font=('Segoe UI', 9), justify='left')
|
|
630
|
-
lbl_msg.pack(anchor='w', padx=16, pady=(0, 12))
|
|
631
|
-
|
|
632
|
-
self.update_idletasks()
|
|
633
|
-
w = self.winfo_reqwidth()
|
|
634
|
-
h = self.winfo_reqheight()
|
|
635
|
-
|
|
636
|
-
# Position top right of the master window
|
|
637
|
-
x = master.winfo_rootx() + master.winfo_width() - w - 24
|
|
638
|
-
y = master.winfo_rooty() + 24
|
|
639
|
-
|
|
640
|
-
self.geometry(f'{w}x{h}+{x}+{y}')
|
|
641
|
-
|
|
642
|
-
self.alpha = 0.0
|
|
643
|
-
self.fade_in()
|
|
644
|
-
self.after(4000, self.fade_out)
|
|
645
|
-
|
|
646
|
-
def fade_in(self):
|
|
647
|
-
self.alpha += 0.1
|
|
648
|
-
if self.alpha <= 0.95:
|
|
649
|
-
self.attributes('-alpha', self.alpha)
|
|
650
|
-
self.after(16, self.fade_in)
|
|
651
|
-
|
|
652
|
-
def fade_out(self):
|
|
653
|
-
self.alpha -= 0.1
|
|
654
|
-
if self.alpha > 0:
|
|
655
|
-
self.attributes('-alpha', self.alpha)
|
|
656
|
-
self.after(16, self.fade_out)
|
|
657
|
-
else:
|
|
658
|
-
self.destroy()
|
|
659
|
-
|
|
660
|
-
def _custom_showinfo(title, msg, **kwargs):
|
|
661
|
-
from tkinter import _default_root
|
|
662
|
-
r = _default_root
|
|
663
|
-
if not r: return
|
|
664
|
-
ToastNotification(r, title, msg, 'success')
|
|
665
|
-
|
|
666
|
-
def _custom_showerror(title, msg, **kwargs):
|
|
667
|
-
from tkinter import _default_root
|
|
668
|
-
r = _default_root
|
|
669
|
-
if not r: return
|
|
670
|
-
ToastNotification(r, title, msg, 'error')
|
|
671
|
-
|
|
672
|
-
def _custom_showwarning(title, msg, **kwargs):
|
|
673
|
-
from tkinter import _default_root
|
|
674
|
-
r = _default_root
|
|
675
|
-
if not r: return
|
|
676
|
-
ToastNotification(r, title, msg, 'warning')
|
|
677
|
-
|
|
678
|
-
# Hook into standard messagebox
|
|
679
|
-
messagebox.showinfo = _custom_showinfo
|
|
680
|
-
messagebox.showerror = _custom_showerror
|
|
681
|
-
messagebox.showwarning = _custom_showwarning
|
|
682
|
-
|
|
683
|
-
|
|
684
611
|
class ConfigManager:
|
|
685
612
|
"""Manages profile loading, backups, secure keyring storage and parameter settings."""
|
|
686
613
|
def __init__(self, config_dir: str = DEFAULT_CONFIG_DIR):
|
|
@@ -1986,9 +1913,10 @@ class KeyringSecretsEditor:
|
|
|
1986
1913
|
|
|
1987
1914
|
|
|
1988
1915
|
class KeyringSecretsBackupManager:
|
|
1989
|
-
"""Backs up and restores credentials securely using
|
|
1916
|
+
"""Backs up and restores credentials securely using AES-GCM and reads older authenticated backups."""
|
|
1990
1917
|
|
|
1991
|
-
MAGIC_HEADER = b"
|
|
1918
|
+
MAGIC_HEADER = b"TZB3"
|
|
1919
|
+
LEGACY_AUTH_HEADER = b"TZB2"
|
|
1992
1920
|
PBKDF2_ROUNDS = 600_000
|
|
1993
1921
|
|
|
1994
1922
|
@classmethod
|
|
@@ -2011,7 +1939,10 @@ class KeyringSecretsBackupManager:
|
|
|
2011
1939
|
def backup_credentials(cls, filepath: str, cipher_key: str) -> bool:
|
|
2012
1940
|
try:
|
|
2013
1941
|
import hashlib
|
|
2014
|
-
import
|
|
1942
|
+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|
1943
|
+
|
|
1944
|
+
if not cipher_key:
|
|
1945
|
+
return False
|
|
2015
1946
|
creds = {}
|
|
2016
1947
|
for provider in PROVIDERS.keys():
|
|
2017
1948
|
secret = keyring.get_password(SERVICE_NAME, provider)
|
|
@@ -2020,12 +1951,10 @@ class KeyringSecretsBackupManager:
|
|
|
2020
1951
|
|
|
2021
1952
|
raw_data = json.dumps(creds).encode("utf-8")
|
|
2022
1953
|
salt = os.urandom(16)
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
payload = cls.MAGIC_HEADER + salt + tag + cipher_bytes
|
|
1954
|
+
nonce = os.urandom(12)
|
|
1955
|
+
header = cls.MAGIC_HEADER + salt + nonce
|
|
1956
|
+
key = hashlib.pbkdf2_hmac("sha256", cipher_key.encode("utf-8"), salt, cls.PBKDF2_ROUNDS)
|
|
1957
|
+
payload = header + AESGCM(key).encrypt(nonce, raw_data, header)
|
|
2029
1958
|
with open(filepath, "wb") as f:
|
|
2030
1959
|
f.write(payload)
|
|
2031
1960
|
return True
|
|
@@ -2062,7 +1991,7 @@ class KeyringSecretsBackupManager:
|
|
|
2062
1991
|
try:
|
|
2063
1992
|
with open(filepath, "rb") as f:
|
|
2064
1993
|
data = f.read()
|
|
2065
|
-
if not data or data.startswith(cls.MAGIC_HEADER):
|
|
1994
|
+
if not data or data.startswith((cls.MAGIC_HEADER, cls.LEGACY_AUTH_HEADER)):
|
|
2066
1995
|
return False
|
|
2067
1996
|
encrypted = bytearray(data)
|
|
2068
1997
|
key_bytes = cipher_key.encode("utf-8")
|
|
@@ -2074,7 +2003,7 @@ class KeyringSecretsBackupManager:
|
|
|
2074
2003
|
if not validated:
|
|
2075
2004
|
logger.error("Legacy backup rejected: invalid provider/credential schema")
|
|
2076
2005
|
return False
|
|
2077
|
-
logger.warning("Imported legacy unauthenticated backup; please re-export to
|
|
2006
|
+
logger.warning("Imported legacy unauthenticated backup; please re-export to authenticated AES-GCM TZB3 format.")
|
|
2078
2007
|
for provider, secret in validated.items():
|
|
2079
2008
|
keyring.set_password(SERVICE_NAME, provider, secret)
|
|
2080
2009
|
return True
|
|
@@ -2083,36 +2012,45 @@ class KeyringSecretsBackupManager:
|
|
|
2083
2012
|
return False
|
|
2084
2013
|
|
|
2085
2014
|
@classmethod
|
|
2086
|
-
def restore_credentials(cls, filepath: str, cipher_key: str, allow_legacy: bool =
|
|
2015
|
+
def restore_credentials(cls, filepath: str, cipher_key: str, allow_legacy: bool = False) -> bool:
|
|
2087
2016
|
try:
|
|
2088
2017
|
import hashlib
|
|
2089
2018
|
import hmac
|
|
2090
2019
|
with open(filepath, "rb") as f:
|
|
2091
2020
|
data = f.read()
|
|
2092
2021
|
|
|
2093
|
-
if data.startswith(cls.MAGIC_HEADER)
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2022
|
+
if data.startswith(cls.MAGIC_HEADER):
|
|
2023
|
+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|
2024
|
+
|
|
2025
|
+
if len(data) < 48:
|
|
2026
|
+
return False
|
|
2027
|
+
header = data[:32]
|
|
2028
|
+
salt, nonce = header[4:20], header[20:32]
|
|
2029
|
+
key = hashlib.pbkdf2_hmac("sha256", cipher_key.encode("utf-8"), salt, cls.PBKDF2_ROUNDS)
|
|
2030
|
+
raw_data = AESGCM(key).decrypt(nonce, data[32:], header)
|
|
2031
|
+
elif data.startswith(cls.LEGACY_AUTH_HEADER):
|
|
2032
|
+
if len(data) < 52:
|
|
2033
|
+
return False
|
|
2034
|
+
salt, tag, cipher_bytes = data[4:20], data[20:52], data[52:]
|
|
2097
2035
|
enc_key, mac_key = cls._derive_keys(cipher_key, salt)
|
|
2098
|
-
expected_tag = hmac.new(mac_key, cls.
|
|
2036
|
+
expected_tag = hmac.new(mac_key, cls.LEGACY_AUTH_HEADER + salt + cipher_bytes, hashlib.sha256).digest()
|
|
2099
2037
|
if not hmac.compare_digest(tag, expected_tag):
|
|
2100
2038
|
logger.error("Authentication failed: invalid passphrase or corrupted backup")
|
|
2101
2039
|
return False
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
validated = cls._validate_credential_map(json.loads(raw_data.decode("utf-8")))
|
|
2105
|
-
if not validated:
|
|
2106
|
-
logger.error("Backup payload failed schema validation")
|
|
2107
|
-
return False
|
|
2108
|
-
for provider, secret in validated.items():
|
|
2109
|
-
keyring.set_password(SERVICE_NAME, provider, secret)
|
|
2110
|
-
return True
|
|
2111
|
-
|
|
2112
|
-
if allow_legacy:
|
|
2040
|
+
raw_data = bytes(b ^ k for b, k in zip(cipher_bytes, cls._keystream(enc_key, len(cipher_bytes))))
|
|
2041
|
+
elif allow_legacy:
|
|
2113
2042
|
return cls.import_legacy_credentials(filepath, cipher_key)
|
|
2114
|
-
|
|
2115
|
-
|
|
2043
|
+
else:
|
|
2044
|
+
logger.error("Rejected unauthenticated legacy backup (allow_legacy=False)")
|
|
2045
|
+
return False
|
|
2046
|
+
|
|
2047
|
+
validated = cls._validate_credential_map(json.loads(raw_data.decode("utf-8")))
|
|
2048
|
+
if not validated:
|
|
2049
|
+
logger.error("Backup payload failed schema validation")
|
|
2050
|
+
return False
|
|
2051
|
+
for provider, secret in validated.items():
|
|
2052
|
+
keyring.set_password(SERVICE_NAME, provider, secret)
|
|
2053
|
+
return True
|
|
2116
2054
|
except Exception as e:
|
|
2117
2055
|
logger.error(f"Restore keyring credentials failed: {e}")
|
|
2118
2056
|
return False
|
|
@@ -3462,6 +3400,11 @@ class WideSplineChartCard(LuxuryCard):
|
|
|
3462
3400
|
self.anim_task = None
|
|
3463
3401
|
self.c.bind("<Configure>", self._start_anim)
|
|
3464
3402
|
|
|
3403
|
+
leg = tk.Frame(self.inner, bg=self.card_bg)
|
|
3404
|
+
leg.pack(pady=(4, 0))
|
|
3405
|
+
tk.Label(leg, text="● Original AST Tokens", font=("Segoe UI", 7, "bold"), fg=PALETTE.get("accent_purple", "#6366f1"), bg=self.card_bg).pack(side=tk.LEFT, padx=10)
|
|
3406
|
+
tk.Label(leg, text="● T-Zero Compressed Prompt", font=("Segoe UI", 7, "bold"), fg=PALETTE.get("accent_coral", "#f97316"), bg=self.card_bg).pack(side=tk.LEFT, padx=10)
|
|
3407
|
+
|
|
3465
3408
|
def _start_anim(self, event=None):
|
|
3466
3409
|
self.anim_progress = 0.0
|
|
3467
3410
|
if self.anim_task:
|
|
@@ -3477,10 +3420,6 @@ class WideSplineChartCard(LuxuryCard):
|
|
|
3477
3420
|
self._draw()
|
|
3478
3421
|
self.anim_task = self.after(20, self._animate)
|
|
3479
3422
|
|
|
3480
|
-
leg = tk.Frame(self.inner, bg=self.card_bg)
|
|
3481
|
-
leg.pack(pady=(4, 0))
|
|
3482
|
-
tk.Label(leg, text="● Original AST Tokens", font=("Segoe UI", 7, "bold"), fg=PALETTE.get("accent_purple", "#6366f1"), bg=self.card_bg).pack(side=tk.LEFT, padx=10)
|
|
3483
|
-
tk.Label(leg, text="● T-Zero Compressed Prompt", font=("Segoe UI", 7, "bold"), fg=PALETTE.get("accent_coral", "#f97316"), bg=self.card_bg).pack(side=tk.LEFT, padx=10)
|
|
3484
3423
|
|
|
3485
3424
|
def _draw(self, event=None):
|
|
3486
3425
|
w = max(20, self.c.winfo_width())
|
|
@@ -3603,18 +3542,16 @@ HorizontalProgressBarGroup = MonthlyStackedBarCard
|
|
|
3603
3542
|
|
|
3604
3543
|
|
|
3605
3544
|
class SecurityHubCard(LuxuryCard):
|
|
3606
|
-
"""Siber Akademi security badge & quick audit
|
|
3607
|
-
def __init__(self, parent, action_cmd=None,
|
|
3545
|
+
"""Siber Akademi security badge & quick audit card."""
|
|
3546
|
+
def __init__(self, parent, action_cmd=None, **kwargs):
|
|
3608
3547
|
super().__init__(parent, radius=18, padding=12, **kwargs)
|
|
3609
3548
|
tk.Label(self.inner, text="🛡 SİBER AKADEMİ SECURITY", font=("Segoe UI", 9, "bold"), fg=PALETTE.get("accent_cyan", "#3843a0"), bg=self.card_bg).pack(anchor=tk.W)
|
|
3610
|
-
tk.Label(self.inner, text="
|
|
3549
|
+
tk.Label(self.inner, text="Local source and secret checks", font=("Segoe UI", 7), fg=PALETTE.get("accent_green", "#10b981"), bg=self.card_bg).pack(anchor=tk.W, pady=(1, 6))
|
|
3611
3550
|
btn_row = tk.Frame(self.inner, bg=self.card_bg)
|
|
3612
3551
|
btn_row.pack(fill=tk.X)
|
|
3613
3552
|
self.btn = CanvasPillButton(btn_row, text="VIEW REPORT", command=action_cmd, height=28, radius=14, font=("Segoe UI", 7, "bold"), bg_color=PALETTE.get("card_hover", "#e0e7ff"), text_color=PALETTE.get("accent_cyan", "#3843a0"))
|
|
3614
3553
|
self.btn.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 3))
|
|
3615
|
-
|
|
3616
|
-
self.armor_btn = CanvasPillButton(btn_row, text="🛡️ ANTI-REA", command=armor_cmd, height=28, radius=14, font=("Segoe UI", 7, "bold"), bg_color="#064e3b", text_color="#34d399")
|
|
3617
|
-
self.armor_btn.pack(side=tk.RIGHT, fill=tk.X, expand=True, padx=(3, 0))
|
|
3554
|
+
|
|
3618
3555
|
|
|
3619
3556
|
class GlowingStatusDot(tk.Canvas):
|
|
3620
3557
|
def __init__(self, parent, size: int = 16, **kwargs):
|
|
@@ -4482,6 +4419,10 @@ class AdvancedTokenDistributionChart(tk.Canvas):
|
|
|
4482
4419
|
self.create_text(w - 6, y + 7, text=f"{size_str} ({pct:.0f}%)", fill=PALETTE["text_muted"], font=("Segoe UI", 7, "bold"), anchor="e")
|
|
4483
4420
|
|
|
4484
4421
|
|
|
4422
|
+
def _run_desktop_git(args, **kwargs):
|
|
4423
|
+
return subprocess.run(args, creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), **kwargs)
|
|
4424
|
+
|
|
4425
|
+
|
|
4485
4426
|
class CustomChangelogManager:
|
|
4486
4427
|
"""Safely retrieves git log history and repository diffs asynchronously."""
|
|
4487
4428
|
def __init__(self, target_dir: str):
|
|
@@ -4493,7 +4434,7 @@ class CustomChangelogManager:
|
|
|
4493
4434
|
callback([])
|
|
4494
4435
|
return
|
|
4495
4436
|
try:
|
|
4496
|
-
res =
|
|
4437
|
+
res = _run_desktop_git(
|
|
4497
4438
|
["git", "rev-parse", "--is-inside-work-tree"],
|
|
4498
4439
|
cwd=self.target_dir,
|
|
4499
4440
|
capture_output=True,
|
|
@@ -4504,7 +4445,7 @@ class CustomChangelogManager:
|
|
|
4504
4445
|
callback([])
|
|
4505
4446
|
return
|
|
4506
4447
|
|
|
4507
|
-
res =
|
|
4448
|
+
res = _run_desktop_git(
|
|
4508
4449
|
["git", "log", "-n", "15", "--pretty=format:%s (%an)"],
|
|
4509
4450
|
cwd=self.target_dir,
|
|
4510
4451
|
capture_output=True,
|
|
@@ -4538,7 +4479,7 @@ class CustomChangelogManager:
|
|
|
4538
4479
|
def get_git_diff_async(self, callback: Callable) -> None:
|
|
4539
4480
|
def run_thread():
|
|
4540
4481
|
try:
|
|
4541
|
-
res =
|
|
4482
|
+
res = _run_desktop_git(
|
|
4542
4483
|
["git", "diff", "HEAD"],
|
|
4543
4484
|
cwd=self.target_dir,
|
|
4544
4485
|
capture_output=True,
|
|
@@ -4641,6 +4582,9 @@ class AutoReadmeGUI:
|
|
|
4641
4582
|
def __init__(self, root: tk.Tk):
|
|
4642
4583
|
self.root = root
|
|
4643
4584
|
self.lang = "en"
|
|
4585
|
+
self._ui_thread = threading.get_ident()
|
|
4586
|
+
self._ui_callbacks = SimpleQueue()
|
|
4587
|
+
self.root.after(25, self._drain_ui_callbacks)
|
|
4644
4588
|
|
|
4645
4589
|
# State parameters
|
|
4646
4590
|
self.scanned_files: List[str] = []
|
|
@@ -4714,66 +4658,35 @@ class AutoReadmeGUI:
|
|
|
4714
4658
|
self.load_saved_credentials()
|
|
4715
4659
|
self.setup_keyboard_shortcuts()
|
|
4716
4660
|
self.start_system_telemetry()
|
|
4717
|
-
self.start_community_stats_refresh()
|
|
4718
|
-
if "unittest" not in sys.modules:
|
|
4719
|
-
self.safe_after(1200, self.check_and_show_startup_popups)
|
|
4720
4661
|
|
|
4721
4662
|
def _attach_tooltip(self, widget, text: str):
|
|
4722
|
-
"""
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4663
|
+
"""Show toolbar hints in the status strip without creating a window."""
|
|
4664
|
+
def show_hint(_event):
|
|
4665
|
+
if hasattr(self, "status_hint_lbl"):
|
|
4666
|
+
self.status_hint_lbl.configure(text=text)
|
|
4726
4667
|
|
|
4727
|
-
def
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
return
|
|
4731
|
-
tw = tk.Toplevel(widget)
|
|
4732
|
-
tw.overrideredirect(True)
|
|
4733
|
-
tw.attributes("-topmost", True)
|
|
4734
|
-
x = widget.winfo_rootx() + widget.winfo_width() + 8
|
|
4735
|
-
y = widget.winfo_rooty() + max(0, (widget.winfo_height() - 24) // 2)
|
|
4736
|
-
tw.geometry(f"+{x}+{y}")
|
|
4737
|
-
lbl = tk.Label(
|
|
4738
|
-
tw,
|
|
4739
|
-
text=text,
|
|
4740
|
-
bg=PALETTE.get("card_bg", "#0f172a"),
|
|
4741
|
-
fg=PALETTE.get("text_main", "#f8fafc"),
|
|
4742
|
-
font=("Segoe UI", 8, "bold"),
|
|
4743
|
-
padx=9,
|
|
4744
|
-
pady=4,
|
|
4745
|
-
highlightthickness=1,
|
|
4746
|
-
highlightbackground=PALETTE.get("accent_cyan", "#38bdf8"),
|
|
4747
|
-
)
|
|
4748
|
-
lbl.pack()
|
|
4749
|
-
tip_win["w"] = tw
|
|
4750
|
-
except Exception:
|
|
4751
|
-
pass
|
|
4668
|
+
def clear_hint(_event):
|
|
4669
|
+
if hasattr(self, "status_hint_lbl"):
|
|
4670
|
+
self.status_hint_lbl.configure(text="")
|
|
4752
4671
|
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
if tw is not None:
|
|
4757
|
-
try:
|
|
4758
|
-
tw.destroy()
|
|
4759
|
-
except Exception:
|
|
4760
|
-
pass
|
|
4672
|
+
widget.bind("<Enter>", show_hint, add="+")
|
|
4673
|
+
widget.bind("<Leave>", clear_hint, add="+")
|
|
4674
|
+
widget.bind("<ButtonPress>", clear_hint, add="+")
|
|
4761
4675
|
|
|
4762
|
-
try:
|
|
4763
|
-
widget.bind("<Enter>", show_tip, add="+")
|
|
4764
|
-
widget.bind("<Leave>", hide_tip, add="+")
|
|
4765
|
-
widget.bind("<ButtonPress>", hide_tip, add="+")
|
|
4766
|
-
except Exception:
|
|
4767
|
-
pass
|
|
4768
|
-
|
|
4769
4676
|
def safe_after(self, ms: int, func, *args):
|
|
4770
|
-
""
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4677
|
+
if getattr(self, "_ui_thread", threading.get_ident()) != threading.get_ident():
|
|
4678
|
+
self._ui_callbacks.put((ms, func, args))
|
|
4679
|
+
return None
|
|
4680
|
+
return self.root.after(ms, func, *args)
|
|
4681
|
+
|
|
4682
|
+
def _drain_ui_callbacks(self):
|
|
4683
|
+
self.root.after(25, self._drain_ui_callbacks)
|
|
4684
|
+
for _ in range(32):
|
|
4685
|
+
try:
|
|
4686
|
+
ms, callback, args = self._ui_callbacks.get_nowait()
|
|
4687
|
+
except Empty:
|
|
4688
|
+
break
|
|
4689
|
+
self.root.after(ms, callback, *args)
|
|
4777
4690
|
|
|
4778
4691
|
def setup_keyboard_shortcuts(self):
|
|
4779
4692
|
self.root.bind("<Control-s>", lambda e: self.run_scanner())
|
|
@@ -4805,7 +4718,7 @@ class AutoReadmeGUI:
|
|
|
4805
4718
|
|
|
4806
4719
|
# 7 Tabs with sleek icons
|
|
4807
4720
|
self.tabs = ["overview_tab", "selector_tab", "changelog_tab", "generate_tab", "template_tab", "graph_tab", "settings_tab"]
|
|
4808
|
-
self.tab_icons = ["
|
|
4721
|
+
self.tab_icons = ["⌂", "▤", "⑂", "▷", "◇", "▥", "⚙"]
|
|
4809
4722
|
self.tab_buttons: List[tk.Label] = []
|
|
4810
4723
|
self.tab_containers: List[tk.Frame] = []
|
|
4811
4724
|
self.nav_indicators: List[tk.Frame] = []
|
|
@@ -4861,7 +4774,7 @@ class AutoReadmeGUI:
|
|
|
4861
4774
|
|
|
4862
4775
|
# 2. TOP HEADER BAR
|
|
4863
4776
|
self.header = GlassCard(self.bg_canvas)
|
|
4864
|
-
self.header.place(x=82, y=8, relwidth=1.0, width=-92, height=
|
|
4777
|
+
self.header.place(x=82, y=8, relwidth=1.0, width=-92, height=54)
|
|
4865
4778
|
|
|
4866
4779
|
title_frame = tk.Frame(self.header, bg=PALETTE["card_bg"])
|
|
4867
4780
|
title_frame.pack(side=tk.LEFT, fill=tk.Y, padx=14, pady=2)
|
|
@@ -4869,7 +4782,7 @@ class AutoReadmeGUI:
|
|
|
4869
4782
|
title_row = tk.Frame(title_frame, bg=PALETTE["card_bg"])
|
|
4870
4783
|
title_row.pack(anchor=tk.W)
|
|
4871
4784
|
|
|
4872
|
-
self.title_lbl = tk.Label(title_row, text=get_text("title", self.lang), font=("Segoe UI",
|
|
4785
|
+
self.title_lbl = tk.Label(title_row, text=get_text("title", self.lang), font=("Segoe UI", 12, "bold"), fg=PALETTE.get("accent_cyan", "#3843a0"), bg=PALETTE["card_bg"])
|
|
4873
4786
|
self.title_lbl.pack(side=tk.LEFT)
|
|
4874
4787
|
|
|
4875
4788
|
self.status_dot = GlowingStatusDot(title_row)
|
|
@@ -4964,7 +4877,7 @@ class AutoReadmeGUI:
|
|
|
4964
4877
|
|
|
4965
4878
|
self.star_header_btn = CanvasPillButton(
|
|
4966
4879
|
header_controls,
|
|
4967
|
-
text=
|
|
4880
|
+
text="★ STAR ON GITHUB",
|
|
4968
4881
|
command=self.open_star_action,
|
|
4969
4882
|
height=28,
|
|
4970
4883
|
radius=14,
|
|
@@ -4977,7 +4890,7 @@ class AutoReadmeGUI:
|
|
|
4977
4890
|
|
|
4978
4891
|
# 3. MAIN CONTENT FRAME
|
|
4979
4892
|
self.content = tk.Frame(self.bg_canvas, bg=PALETTE["bg_start"], bd=0)
|
|
4980
|
-
self.content.place(x=82, y=
|
|
4893
|
+
self.content.place(x=82, y=68, relwidth=1.0, width=-92, relheight=1.0, height=-100)
|
|
4981
4894
|
|
|
4982
4895
|
self.tab_frames = [tk.Frame(self.content, bg=PALETTE["bg_start"]) for _ in range(7)]
|
|
4983
4896
|
self.setup_tab_setup()
|
|
@@ -4995,9 +4908,14 @@ class AutoReadmeGUI:
|
|
|
4995
4908
|
s_pill_bot = tk.Frame(self.status_bar, bg=PALETTE["card_bg"], highlightthickness=1, highlightbackground=PALETTE["card_border"])
|
|
4996
4909
|
s_pill_bot.pack(side=tk.LEFT, fill=tk.X, expand=True)
|
|
4997
4910
|
|
|
4998
|
-
tk.Label(s_pill_bot, text="
|
|
4999
|
-
self.status_bar_lbl = tk.Label(s_pill_bot, text="
|
|
4911
|
+
tk.Label(s_pill_bot, text="STATUS", font=("Segoe UI", 7, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"]).pack(side=tk.LEFT, padx=(8, 4), pady=2)
|
|
4912
|
+
self.status_bar_lbl = tk.Label(s_pill_bot, text="Ready", font=("Segoe UI", 9), fg=PALETTE.get("accent_cyan", "#3843a0"), bg=PALETTE["card_bg"])
|
|
5000
4913
|
self.status_bar_lbl.pack(side=tk.LEFT, pady=2)
|
|
4914
|
+
self.status_hint_lbl = tk.Label(
|
|
4915
|
+
s_pill_bot, bg=PALETTE["card_bg"], fg=PALETTE["text_muted"],
|
|
4916
|
+
font=("Segoe UI", 8), anchor="e",
|
|
4917
|
+
)
|
|
4918
|
+
self.status_hint_lbl.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=8)
|
|
5001
4919
|
|
|
5002
4920
|
self.status_toggle_lbl = tk.Label(s_pill_bot, text="▲ Show Console", font=("Segoe UI", 7, "bold"), fg=PALETTE.get("accent_purple", "#6366f1"), bg=PALETTE["card_bg"], cursor="hand2")
|
|
5003
4921
|
self.status_toggle_lbl.pack(side=tk.RIGHT, padx=8, pady=2)
|
|
@@ -5070,59 +4988,69 @@ class AutoReadmeGUI:
|
|
|
5070
4988
|
self.show_toast(f"Sound effects {'enabled' if SFX_ENABLED else 'disabled'}", "info")
|
|
5071
4989
|
|
|
5072
4990
|
def show_toast(self, message: str, kind: str = "info", duration_ms: int = 2500):
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
4991
|
+
"""Show one status message inside the application."""
|
|
4992
|
+
if not hasattr(self, "status_bar_lbl"):
|
|
4993
|
+
return
|
|
4994
|
+
label = self.status_bar_lbl
|
|
4995
|
+
previous = getattr(self, "_status_reset", None)
|
|
4996
|
+
if previous:
|
|
4997
|
+
self.root.after_cancel(previous)
|
|
4998
|
+
color = {"success": PALETTE["success"], "error": PALETTE["error"],
|
|
4999
|
+
"warning": PALETTE["accent_coral"]}.get(kind, PALETTE["text_main"])
|
|
5000
|
+
label.configure(text=message.splitlines()[0] if message else "", fg=color)
|
|
5001
|
+
|
|
5002
|
+
def reset():
|
|
5003
|
+
self._status_reset = None
|
|
5004
|
+
if label.winfo_exists():
|
|
5005
|
+
label.configure(text="Ready", fg=PALETTE["text_main"])
|
|
5006
|
+
self._status_reset = self.root.after(duration_ms, reset)
|
|
5007
|
+
|
|
5008
|
+
def _show_info(self, title, message, **kwargs):
|
|
5009
|
+
self._show_notice(title, message, "info")
|
|
5010
|
+
|
|
5011
|
+
def _show_warning(self, title, message, **kwargs):
|
|
5012
|
+
self._show_notice(title, message, "warning")
|
|
5013
|
+
|
|
5014
|
+
def _show_error(self, title, message, **kwargs):
|
|
5015
|
+
self._show_notice(title, message, "error")
|
|
5016
|
+
|
|
5017
|
+
def _show_notice(self, title, message, kind):
|
|
5018
|
+
self.show_toast(f"{title} · {message}", kind, 8000)
|
|
5019
|
+
if "\n" in str(message):
|
|
5020
|
+
self.log(f"{title}: {message}")
|
|
5090
5021
|
|
|
5091
5022
|
def open_web_console(self):
|
|
5023
|
+
"""Start a loopback-only server once and open its actual address."""
|
|
5092
5024
|
play_sfx("click")
|
|
5093
5025
|
try:
|
|
5094
|
-
|
|
5095
|
-
if
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5026
|
+
server = getattr(self, "_web_server", None)
|
|
5027
|
+
if server is None:
|
|
5028
|
+
from tzero.tzero_dashboard import start_dashboard_server, DASHBOARD_PORT
|
|
5029
|
+
server = start_dashboard_server(DASHBOARD_PORT, open_browser=False)
|
|
5030
|
+
self._web_server = server
|
|
5031
|
+
threading.Thread(target=server.serve_forever, daemon=True).start()
|
|
5032
|
+
|
|
5033
|
+
def close_server(event):
|
|
5034
|
+
if event.widget is self.root and getattr(self, "_web_server", None) is server:
|
|
5035
|
+
self._web_server = None
|
|
5036
|
+
def shutdown():
|
|
5037
|
+
server.shutdown()
|
|
5038
|
+
server.server_close()
|
|
5039
|
+
threading.Thread(target=shutdown, daemon=True).start()
|
|
5040
|
+
|
|
5041
|
+
self.root.bind("<Destroy>", close_server, add="+")
|
|
5042
|
+
url = f"http://127.0.0.1:{server.server_address[1]}/"
|
|
5043
|
+
if webbrowser.open(url):
|
|
5044
|
+
self.show_toast("T-Zero Web Console opened", "success")
|
|
5045
|
+
else:
|
|
5046
|
+
self.show_toast(f"Open {url} in your browser", "info", 6000)
|
|
5047
|
+
except Exception as exc:
|
|
5048
|
+
self.log(f"Web Console could not start: {exc}")
|
|
5049
|
+
self.show_toast(f"Web Console could not start: {exc}", "error", 6000)
|
|
5105
5050
|
|
|
5106
5051
|
def run_quick_security_audit(self):
|
|
5107
5052
|
self.open_security_audit_dialog()
|
|
5108
5053
|
|
|
5109
|
-
def run_quick_anti_rea_armor(self):
|
|
5110
|
-
"""Executes 180-Tier Anti-REA Resistance audit & protection from GUI Security Hub."""
|
|
5111
|
-
target = (self.dir_entry.get().strip() if hasattr(self, "dir_entry") else "") or os.getcwd()
|
|
5112
|
-
try:
|
|
5113
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
5114
|
-
audit = audit_path_rea_resistance(target)
|
|
5115
|
-
score = audit.get("score", 0)
|
|
5116
|
-
rating = audit.get("rating", "UNKNOWN")
|
|
5117
|
-
self.log(f"[ANTI-REA AUDIT] Target: {target} | Score: {score}/100 ({rating})")
|
|
5118
|
-
messagebox.showinfo(
|
|
5119
|
-
"T-Zero 180-Tier Anti-REA Armor",
|
|
5120
|
-
f"Target: {target}\nAI Resistance Score: {score}/100 ({rating})\n"
|
|
5121
|
-
f"Active Defense Matrix: 12 Domains x 15 Sub-Tiers (Crypto Capsule, Opaque CFF, PolyVM, Anti-Debug, Anti-VM, RDTSC).",
|
|
5122
|
-
)
|
|
5123
|
-
except Exception as exc:
|
|
5124
|
-
self.log(f"[ANTI-REA ERROR] {exc}")
|
|
5125
|
-
|
|
5126
5054
|
def open_security_audit_dialog(self, target_dir: Optional[str] = None):
|
|
5127
5055
|
"""Runs a complete T-Zero 4-Tier Security & AST Architecture Audit (T-001 to T-004)
|
|
5128
5056
|
and displays an interactive luxury report dialog with filtering and export capabilities."""
|
|
@@ -5131,6 +5059,20 @@ class AutoReadmeGUI:
|
|
|
5131
5059
|
if not target or not os.path.exists(target):
|
|
5132
5060
|
target = os.getcwd()
|
|
5133
5061
|
|
|
5062
|
+
self.show_toast("Scanning workspace for security findings...", "info")
|
|
5063
|
+
|
|
5064
|
+
def worker():
|
|
5065
|
+
try:
|
|
5066
|
+
result = self._collect_security_audit(target)
|
|
5067
|
+
self.safe_after(0, self._show_security_audit_results, target, result)
|
|
5068
|
+
except Exception as exc:
|
|
5069
|
+
message = str(exc)
|
|
5070
|
+
self.safe_after(0, lambda: self.show_toast(f"Security audit failed: {message}", "error", 6000))
|
|
5071
|
+
|
|
5072
|
+
threading.Thread(target=worker, daemon=True).start()
|
|
5073
|
+
|
|
5074
|
+
def _collect_security_audit(self, target):
|
|
5075
|
+
"""Collect findings away from Tk's event loop."""
|
|
5134
5076
|
key_patterns = [
|
|
5135
5077
|
(re.compile(r"""(?i)(?:api_key|apikey|secret|password|auth_token)\s*=\s*['\"][A-Za-z0-9_\-\.]{16,}['\"]"""), "Hardcoded Secret / API Key"),
|
|
5136
5078
|
(re.compile(r'sk-[a-zA-Z0-9]{20,}'), "OpenAI API Key Pattern"),
|
|
@@ -5210,13 +5152,19 @@ class AutoReadmeGUI:
|
|
|
5210
5152
|
except Exception:
|
|
5211
5153
|
pass
|
|
5212
5154
|
|
|
5155
|
+
return (audit_issues, py_files_count, total_scanned_files,
|
|
5156
|
+
total_lines_count, leaks_count, smells_count, arch_violations_count)
|
|
5157
|
+
|
|
5158
|
+
def _show_security_audit_results(self, target, result):
|
|
5159
|
+
(audit_issues, py_files_count, total_scanned_files, total_lines_count,
|
|
5160
|
+
leaks_count, smells_count, arch_violations_count) = result
|
|
5213
5161
|
# Audio and status feedback
|
|
5214
5162
|
if leaks_count > 0:
|
|
5215
5163
|
play_sfx("error")
|
|
5216
5164
|
self.show_toast(f"🚨 T-001 ALERT: {leaks_count} leak(s) detected!", "error", 5000)
|
|
5217
5165
|
else:
|
|
5218
5166
|
play_sfx("success")
|
|
5219
|
-
self.show_toast(f"
|
|
5167
|
+
self.show_toast(f"No matching secret patterns found ({total_scanned_files} files scanned)", "success", 4000)
|
|
5220
5168
|
|
|
5221
5169
|
self.log(f"T-Zero Security Audit: {total_scanned_files} files scanned, {leaks_count} secrets, {arch_violations_count} arch violations, {smells_count} AST smells.")
|
|
5222
5170
|
|
|
@@ -5457,8 +5405,6 @@ class AutoReadmeGUI:
|
|
|
5457
5405
|
self.search_entry.insert(0, old_search)
|
|
5458
5406
|
if self.has_scanned:
|
|
5459
5407
|
self.rebuild_selector_tree()
|
|
5460
|
-
if old_search:
|
|
5461
|
-
self.filter_files_tree()
|
|
5462
5408
|
if old_preview and self.tree.exists(old_preview):
|
|
5463
5409
|
self.tree.selection_set(old_preview)
|
|
5464
5410
|
self.on_file_select_changed(None)
|
|
@@ -5527,7 +5473,7 @@ class AutoReadmeGUI:
|
|
|
5527
5473
|
if self.active_tab_index == 1 and self.scanned_files:
|
|
5528
5474
|
self.search_entry.delete(0, tk.END)
|
|
5529
5475
|
self.search_entry.insert(0, self.header_search_entry.get())
|
|
5530
|
-
self.
|
|
5476
|
+
self._schedule_file_search()
|
|
5531
5477
|
|
|
5532
5478
|
def open_global_search(self):
|
|
5533
5479
|
self.header_search_entry.focus_set()
|
|
@@ -5708,7 +5654,7 @@ class AutoReadmeGUI:
|
|
|
5708
5654
|
self.daily_card.grid(row=2, column=1, sticky="nsew", padx=4, pady=4)
|
|
5709
5655
|
|
|
5710
5656
|
# Card 9: Siber Akademi Security Hub Card
|
|
5711
|
-
self.security_card = SecurityHubCard(f, action_cmd=self.run_quick_security_audit
|
|
5657
|
+
self.security_card = SecurityHubCard(f, action_cmd=self.run_quick_security_audit)
|
|
5712
5658
|
self.security_card.grid(row=2, column=2, columnspan=2, sticky="nsew", padx=4, pady=4)
|
|
5713
5659
|
|
|
5714
5660
|
# --- TAB 7: SETTINGS & SECRETS MANAGEMENT ---
|
|
@@ -5908,10 +5854,10 @@ class AutoReadmeGUI:
|
|
|
5908
5854
|
filepath = filedialog.asksaveasfilename(defaultextension=".dat", filetypes=[("Data Files", "*.dat")])
|
|
5909
5855
|
if filepath:
|
|
5910
5856
|
if KeyringSecretsBackupManager.backup_credentials(filepath, key):
|
|
5911
|
-
|
|
5857
|
+
self._show_info("Success", "Credentials backed up securely!")
|
|
5912
5858
|
dialog.destroy()
|
|
5913
5859
|
else:
|
|
5914
|
-
|
|
5860
|
+
self._show_error("Error", "Backup operation failed.")
|
|
5915
5861
|
|
|
5916
5862
|
def run_restore():
|
|
5917
5863
|
key = key_entry.get().strip()
|
|
@@ -5920,10 +5866,10 @@ class AutoReadmeGUI:
|
|
|
5920
5866
|
filepath = filedialog.askopenfilename(filetypes=[("Data Files", "*.dat")])
|
|
5921
5867
|
if filepath:
|
|
5922
5868
|
if KeyringSecretsBackupManager.restore_credentials(filepath, key):
|
|
5923
|
-
|
|
5869
|
+
self._show_info("Success", "Credentials restored securely!")
|
|
5924
5870
|
dialog.destroy()
|
|
5925
5871
|
else:
|
|
5926
|
-
|
|
5872
|
+
self._show_error("Error", "Restore operation failed. Invalid key?")
|
|
5927
5873
|
|
|
5928
5874
|
btn_row = tk.Frame(pad, bg=PALETTE["bg_start"])
|
|
5929
5875
|
btn_row.pack(fill=tk.X, pady=10)
|
|
@@ -5962,7 +5908,7 @@ class AutoReadmeGUI:
|
|
|
5962
5908
|
self.log(f"Saved global scanner thread workers limit: {workers}, tokens limit: {tokens}")
|
|
5963
5909
|
dialog.destroy()
|
|
5964
5910
|
except ValueError:
|
|
5965
|
-
|
|
5911
|
+
self._show_error("Error", "Values must be integer values!")
|
|
5966
5912
|
|
|
5967
5913
|
tk.Button(pad, text="Save configs", bg=PALETTE["success"], fg="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=save).pack()
|
|
5968
5914
|
|
|
@@ -6006,7 +5952,7 @@ class AutoReadmeGUI:
|
|
|
6006
5952
|
self.log(f"Cleared credentials for {provider} from keyring.")
|
|
6007
5953
|
refresh_secrets_tree()
|
|
6008
5954
|
except Exception as e:
|
|
6009
|
-
|
|
5955
|
+
self._show_error("Error", f"Failed: {e}")
|
|
6010
5956
|
|
|
6011
5957
|
tk.Button(row, text="❌ Clear Selected Key", bg=PALETTE["card_border"], fg=PALETTE["error"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=delete_secret).pack(fill=tk.X)
|
|
6012
5958
|
|
|
@@ -6020,7 +5966,7 @@ class AutoReadmeGUI:
|
|
|
6020
5966
|
profile["ignored_folders"] = preset["ignored"]
|
|
6021
5967
|
_config_mgr.save()
|
|
6022
5968
|
self.log(f"Applied scan layout preset parameters: {name}")
|
|
6023
|
-
|
|
5969
|
+
self._show_info("Success", f"Preset applied:\n{name}")
|
|
6024
5970
|
|
|
6025
5971
|
def import_profile_json(self):
|
|
6026
5972
|
filepath = filedialog.askopenfilename(filetypes=[("JSON Files", "*.json")])
|
|
@@ -6034,9 +5980,9 @@ class AutoReadmeGUI:
|
|
|
6034
5980
|
self.refresh_profile_listbox()
|
|
6035
5981
|
self.load_saved_credentials()
|
|
6036
5982
|
self.log(f"Imported settings profile from {filepath}")
|
|
6037
|
-
|
|
5983
|
+
self._show_info("Success", f"Successfully imported settings profile: {profile_name}")
|
|
6038
5984
|
else:
|
|
6039
|
-
|
|
5985
|
+
self._show_error("Error", "Invalid profile structure!")
|
|
6040
5986
|
|
|
6041
5987
|
def export_profile_json(self):
|
|
6042
5988
|
filepath = filedialog.asksaveasfilename(defaultextension=".json", filetypes=[("JSON Files", "*.json")])
|
|
@@ -6045,9 +5991,9 @@ class AutoReadmeGUI:
|
|
|
6045
5991
|
profile = _config_mgr.get_profile()
|
|
6046
5992
|
if ProfileImporterExporter.export_profile(profile, filepath):
|
|
6047
5993
|
self.log(f"Exported settings profile details: {filepath}")
|
|
6048
|
-
|
|
5994
|
+
self._show_info("Success", f"Profile exported successfully to:\n{filepath}")
|
|
6049
5995
|
else:
|
|
6050
|
-
|
|
5996
|
+
self._show_error("Error", "Failed to export profile.")
|
|
6051
5997
|
|
|
6052
5998
|
def open_ignored_folders_dialog(self):
|
|
6053
5999
|
dialog = tk.Toplevel(self.root)
|
|
@@ -6135,7 +6081,7 @@ class AutoReadmeGUI:
|
|
|
6135
6081
|
return
|
|
6136
6082
|
val = self.profile_listbox.get(sel[0]).replace(" [Active]", "").strip()
|
|
6137
6083
|
if val == "default":
|
|
6138
|
-
|
|
6084
|
+
self._show_warning("Warning", "Cannot delete the default profile.")
|
|
6139
6085
|
return
|
|
6140
6086
|
if _config_mgr.delete_profile(val):
|
|
6141
6087
|
self.refresh_profile_listbox()
|
|
@@ -6192,7 +6138,7 @@ class AutoReadmeGUI:
|
|
|
6192
6138
|
r_chat = requests.post(chat_url, json=chat_payload, headers=headers, timeout=8)
|
|
6193
6139
|
if r_chat.status_code == 200:
|
|
6194
6140
|
self.safe_after(0, lambda: self.status_dot.set_status("green"))
|
|
6195
|
-
self.safe_after(0, lambda:
|
|
6141
|
+
self.safe_after(0, lambda: self._show_info("Success", get_text("ping_success", self.lang)))
|
|
6196
6142
|
elif r_chat.status_code == 401:
|
|
6197
6143
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6198
6144
|
warn_msg = (
|
|
@@ -6203,7 +6149,7 @@ class AutoReadmeGUI:
|
|
|
6203
6149
|
f"3. Generate a new active API key at https://build.nvidia.com and enter it in the Settings tab.\n\n"
|
|
6204
6150
|
f"⚡ With the T-Zero Local Offline AST Engine, full context generation works 100% free even without an API key!"
|
|
6205
6151
|
)
|
|
6206
|
-
self.safe_after(0, lambda:
|
|
6152
|
+
self.safe_after(0, lambda: self._show_warning("Authorization Error (401)", warn_msg))
|
|
6207
6153
|
elif r_chat.status_code == 403:
|
|
6208
6154
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6209
6155
|
warn_msg = (
|
|
@@ -6213,26 +6159,26 @@ class AutoReadmeGUI:
|
|
|
6213
6159
|
f"1. Create a new API key at https://build.nvidia.com with 'Public API Endpoints' permission enabled.\n"
|
|
6214
6160
|
f"2. Or run T-Zero in Local Offline AST Mode to synthesize 100% complete context without any API key!"
|
|
6215
6161
|
)
|
|
6216
|
-
self.safe_after(0, lambda:
|
|
6162
|
+
self.safe_after(0, lambda: self._show_warning("Partial Permission (403)", warn_msg))
|
|
6217
6163
|
elif r_chat.status_code == 410:
|
|
6218
6164
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6219
|
-
self.safe_after(0, lambda:
|
|
6165
|
+
self.safe_after(0, lambda: self._show_warning(
|
|
6220
6166
|
"Model End of Life (410)",
|
|
6221
6167
|
f"Model '{target_model}' has reached End of Life. Please select 'deepseek-ai/deepseek-v4.1-flash' from the dropdown."
|
|
6222
6168
|
))
|
|
6223
6169
|
else:
|
|
6224
6170
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6225
|
-
self.safe_after(0, lambda:
|
|
6171
|
+
self.safe_after(0, lambda: self._show_warning("API Response", f"Remote API status: {r_chat.status_code}\n{r_chat.text[:200]}"))
|
|
6226
6172
|
except Exception:
|
|
6227
6173
|
self.safe_after(0, lambda: self.status_dot.set_status("green"))
|
|
6228
|
-
self.safe_after(0, lambda:
|
|
6174
|
+
self.safe_after(0, lambda: self._show_info("Success", get_text("ping_success", self.lang)))
|
|
6229
6175
|
else:
|
|
6230
6176
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6231
|
-
self.safe_after(0, lambda:
|
|
6177
|
+
self.safe_after(0, lambda: self._show_error("Failure", f"Code: {r.status_code}\n{r.text}"))
|
|
6232
6178
|
except Exception as e:
|
|
6233
6179
|
err_msg = str(e)
|
|
6234
6180
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6235
|
-
self.safe_after(0, lambda msg=err_msg:
|
|
6181
|
+
self.safe_after(0, lambda msg=err_msg: self._show_error("Exception", msg))
|
|
6236
6182
|
threading.Thread(target=run, daemon=True).start()
|
|
6237
6183
|
|
|
6238
6184
|
def browse_dir(self):
|
|
@@ -6249,29 +6195,31 @@ class AutoReadmeGUI:
|
|
|
6249
6195
|
|
|
6250
6196
|
def run_scanner(self):
|
|
6251
6197
|
target = self.dir_entry.get().strip()
|
|
6252
|
-
if not
|
|
6253
|
-
|
|
6198
|
+
if not os.path.isdir(target):
|
|
6199
|
+
self._show_error("Error", "Choose an existing workspace folder.")
|
|
6254
6200
|
return
|
|
6255
6201
|
|
|
6202
|
+
if getattr(self, "_scan_running", False):
|
|
6203
|
+
return
|
|
6204
|
+
self._scan_running = True
|
|
6256
6205
|
self.scan_btn.config(state=tk.DISABLED, text="Scanning...")
|
|
6257
6206
|
self.log(f"Crawling directory signatures: {target}")
|
|
6258
6207
|
|
|
6259
|
-
provider = self.provider_var.get()
|
|
6260
|
-
key = self.api_key_entry.get().strip()
|
|
6261
|
-
if key:
|
|
6262
|
-
_config_mgr.set_credential(provider, key)
|
|
6263
|
-
|
|
6264
6208
|
def run_thread():
|
|
6265
6209
|
try:
|
|
6266
6210
|
files, sizes, snippets = self.scanner.scan_directory(target)
|
|
6267
|
-
self.safe_after(0,
|
|
6268
|
-
except Exception as
|
|
6269
|
-
|
|
6270
|
-
self.safe_after(0, lambda msg=err_msg: messagebox.showerror("Error", msg))
|
|
6271
|
-
self.safe_after(0, lambda: self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang)))
|
|
6211
|
+
self.safe_after(0, self.on_scan_finish, files, sizes, snippets)
|
|
6212
|
+
except Exception as exc:
|
|
6213
|
+
self.safe_after(0, self._on_scan_error, str(exc))
|
|
6272
6214
|
threading.Thread(target=run_thread, daemon=True).start()
|
|
6273
6215
|
|
|
6216
|
+
def _on_scan_error(self, message):
|
|
6217
|
+
self._scan_running = False
|
|
6218
|
+
self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang))
|
|
6219
|
+
self._show_error("Workspace scan failed", message)
|
|
6220
|
+
|
|
6274
6221
|
def on_scan_finish(self, files, sizes, snippets):
|
|
6222
|
+
self._scan_running = False
|
|
6275
6223
|
self.has_scanned = True
|
|
6276
6224
|
self.scanned_files = files
|
|
6277
6225
|
self.file_sizes = sizes
|
|
@@ -6282,9 +6230,6 @@ class AutoReadmeGUI:
|
|
|
6282
6230
|
|
|
6283
6231
|
self.rebuild_selector_tree()
|
|
6284
6232
|
self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang))
|
|
6285
|
-
if self.search_entry.get().strip():
|
|
6286
|
-
self.filter_files_tree()
|
|
6287
|
-
|
|
6288
6233
|
# Update live KPI chips & circular gauge from reference design
|
|
6289
6234
|
total_tok = sum(len(v) for v in snippets.values()) // 4
|
|
6290
6235
|
scanned_n = len(files)
|
|
@@ -6303,9 +6248,6 @@ class AutoReadmeGUI:
|
|
|
6303
6248
|
executable_dir = os.path.dirname(sys.executable) if getattr(sys, "frozen", False) else None
|
|
6304
6249
|
if not self.dir_entry.get().strip():
|
|
6305
6250
|
self.dir_entry.insert(0, resolve_default_workspace(executable_dir=executable_dir))
|
|
6306
|
-
target = self.dir_entry.get().strip()
|
|
6307
|
-
if target and os.path.isdir(target) and not getattr(self, "has_scanned", False) and "unittest" not in sys.modules:
|
|
6308
|
-
self.safe_after(250, self.run_scanner)
|
|
6309
6251
|
|
|
6310
6252
|
def show_shortcuts_modal(self):
|
|
6311
6253
|
dialog = tk.Toplevel(self.root)
|
|
@@ -6414,7 +6356,7 @@ class AutoReadmeGUI:
|
|
|
6414
6356
|
self.root.clipboard_clear()
|
|
6415
6357
|
self.root.clipboard_append(val)
|
|
6416
6358
|
self.log(f"Copied to clipboard ({label}): {val}")
|
|
6417
|
-
|
|
6359
|
+
self._show_info("Copied", f"{label} address copied to clipboard:\n{val}")
|
|
6418
6360
|
except Exception:
|
|
6419
6361
|
pass
|
|
6420
6362
|
|
|
@@ -6716,7 +6658,7 @@ class AutoReadmeGUI:
|
|
|
6716
6658
|
tk.Label(toolbar, text="🔍", font=("Segoe UI", 9, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"]).pack(side=tk.LEFT, padx=(8, 2))
|
|
6717
6659
|
self.search_entry = apply_entry_focus_glow(tk.Entry(toolbar, bg=PALETTE["bg_start"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, width=15, highlightthickness=1, highlightbackground=PALETTE["card_border"]))
|
|
6718
6660
|
self.search_entry.pack(side=tk.LEFT, ipady=3)
|
|
6719
|
-
self.search_entry.bind("<KeyRelease>", self.
|
|
6661
|
+
self.search_entry.bind("<KeyRelease>", self._schedule_file_search)
|
|
6720
6662
|
|
|
6721
6663
|
self.extensions_btn = apply_modern_hover(tk.Button(toolbar, text="🔍 Filters", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 8, "bold"), command=self.open_extensions_filter_dialog, cursor="hand2"))
|
|
6722
6664
|
self.extensions_btn.pack(side=tk.LEFT, padx=4)
|
|
@@ -6852,7 +6794,7 @@ class AutoReadmeGUI:
|
|
|
6852
6794
|
except Exception as e:
|
|
6853
6795
|
self.log(f"AST Refactor failed in {filepath}: {e}")
|
|
6854
6796
|
|
|
6855
|
-
|
|
6797
|
+
self._show_info("Success", f"AST refactored successfully in {modified_count} python files.")
|
|
6856
6798
|
dialog.destroy()
|
|
6857
6799
|
self.run_scanner()
|
|
6858
6800
|
|
|
@@ -7013,7 +6955,7 @@ class AutoReadmeGUI:
|
|
|
7013
6955
|
try:
|
|
7014
6956
|
rx = re.compile(pattern)
|
|
7015
6957
|
except Exception as e:
|
|
7016
|
-
|
|
6958
|
+
self._show_error("Error", f"Invalid regex: {e}")
|
|
7017
6959
|
return
|
|
7018
6960
|
|
|
7019
6961
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
@@ -7059,7 +7001,7 @@ class AutoReadmeGUI:
|
|
|
7059
7001
|
self.log(f"Replaced regex pattern in {filepath}")
|
|
7060
7002
|
except Exception as e:
|
|
7061
7003
|
self.log(f"Failed replacement in {filepath}: {e}")
|
|
7062
|
-
|
|
7004
|
+
self._show_info("Success", f"Replaced regex pattern successfully in {len(files_to_modify)} files.")
|
|
7063
7005
|
dialog.destroy()
|
|
7064
7006
|
self.run_scanner()
|
|
7065
7007
|
|
|
@@ -7120,39 +7062,17 @@ class AutoReadmeGUI:
|
|
|
7120
7062
|
del_btn = tk.Button(pad, text="❌ Delete Selected", bg=PALETTE["card_border"], fg=PALETTE["error"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=delete, cursor="hand2")
|
|
7121
7063
|
del_btn.pack(fill=tk.X, pady=(5, 0))
|
|
7122
7064
|
|
|
7065
|
+
def _schedule_file_search(self, event=None):
|
|
7066
|
+
pending = getattr(self, "_pending_file_search", None)
|
|
7067
|
+
if pending:
|
|
7068
|
+
self.root.after_cancel(pending)
|
|
7069
|
+
self._pending_file_search = self.root.after(150, self.filter_files_tree)
|
|
7070
|
+
|
|
7123
7071
|
def filter_files_tree(self, event=None):
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
self.
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
for item in self.tree.get_children():
|
|
7130
|
-
self.tree.delete(item)
|
|
7131
|
-
|
|
7132
|
-
inserted_dirs = {}
|
|
7133
|
-
for filepath in self.scanned_files:
|
|
7134
|
-
if query not in filepath.lower():
|
|
7135
|
-
continue
|
|
7136
|
-
parts = filepath.replace("\\", "/").split("/")
|
|
7137
|
-
parent = ""
|
|
7138
|
-
for i in range(len(parts) - 1):
|
|
7139
|
-
dir_path = "/".join(parts[:i+1])
|
|
7140
|
-
dir_name = parts[i]
|
|
7141
|
-
if dir_path not in inserted_dirs:
|
|
7142
|
-
display = f"☑ 📁 {dir_name}"
|
|
7143
|
-
iid = self.tree.insert(parent, "end", iid=f"dir:{dir_path}", text=display, open=True)
|
|
7144
|
-
inserted_dirs[dir_path] = iid
|
|
7145
|
-
parent = inserted_dirs[dir_path]
|
|
7146
|
-
|
|
7147
|
-
fname = parts[-1]
|
|
7148
|
-
sz_kb = self.file_sizes.get(filepath, 0) / 1024
|
|
7149
|
-
checked = self.file_checked.get(filepath, True)
|
|
7150
|
-
glyph = "☑" if checked else "☐"
|
|
7151
|
-
status_txt = "Included" if checked else "Excluded"
|
|
7152
|
-
|
|
7153
|
-
self.tree.insert(parent, "end", iid=filepath, text=f"{glyph} 📄 {fname}", values=(f"{sz_kb:.1f} KB", status_txt))
|
|
7154
|
-
self._update_tree_empty_state()
|
|
7155
|
-
self.update_parent_states()
|
|
7072
|
+
if getattr(self, "_pending_file_search", None):
|
|
7073
|
+
self.root.after_cancel(self._pending_file_search)
|
|
7074
|
+
self._pending_file_search = None
|
|
7075
|
+
self.rebuild_selector_tree()
|
|
7156
7076
|
|
|
7157
7077
|
def on_file_select_changed(self, event):
|
|
7158
7078
|
selected_items = self.tree.selection()
|
|
@@ -7194,7 +7114,7 @@ class AutoReadmeGUI:
|
|
|
7194
7114
|
with open(full_path, "w", encoding="utf-8") as f:
|
|
7195
7115
|
f.write(content)
|
|
7196
7116
|
self.log(f"Saved modified file changes directly: {self.active_preview_file}")
|
|
7197
|
-
|
|
7117
|
+
self._show_info("Saved", f"Successfully saved file edits:\n{self.active_preview_file}")
|
|
7198
7118
|
|
|
7199
7119
|
sz = os.path.getsize(full_path)
|
|
7200
7120
|
self.file_sizes[self.active_preview_file] = sz
|
|
@@ -7205,7 +7125,7 @@ class AutoReadmeGUI:
|
|
|
7205
7125
|
|
|
7206
7126
|
self.update_selector_stats()
|
|
7207
7127
|
except Exception as e:
|
|
7208
|
-
|
|
7128
|
+
self._show_error("Error", f"Failed to save file edits: {e}")
|
|
7209
7129
|
|
|
7210
7130
|
def apply_smart_selection_heuristic(self):
|
|
7211
7131
|
code_exts = {".py", ".js", ".ts", ".rs", ".go", ".cpp", ".c", ".h", ".jsx", ".tsx", ".sh", ".bat"}
|
|
@@ -7217,33 +7137,50 @@ class AutoReadmeGUI:
|
|
|
7217
7137
|
self.file_checked[f] = False
|
|
7218
7138
|
|
|
7219
7139
|
def rebuild_selector_tree(self):
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7140
|
+
tree = self.tree
|
|
7141
|
+
query = self.search_entry.get().strip().casefold()
|
|
7142
|
+
paths = [path for path in self.scanned_files if query in path.casefold()]
|
|
7143
|
+
remaining = iter(paths)
|
|
7144
|
+
self._selector_render = remaining
|
|
7145
|
+
selected = tree.selection()
|
|
7146
|
+
tree.delete(*tree.get_children())
|
|
7147
|
+
directories = {}
|
|
7148
|
+
|
|
7149
|
+
def insert_batch():
|
|
7150
|
+
if self._selector_render is not remaining or self.tree is not tree:
|
|
7151
|
+
return
|
|
7152
|
+
|
|
7153
|
+
for _ in range(200):
|
|
7154
|
+
filepath = next(remaining, None)
|
|
7155
|
+
if filepath is None:
|
|
7156
|
+
self._update_tree_empty_state()
|
|
7157
|
+
self.update_selector_stats()
|
|
7158
|
+
self.update_parent_states()
|
|
7159
|
+
if selected and tree.exists(selected[0]):
|
|
7160
|
+
tree.selection_set(selected[0])
|
|
7161
|
+
return
|
|
7162
|
+
parts = filepath.replace("\\", "/").split("/")
|
|
7163
|
+
parent = ""
|
|
7164
|
+
directory = ""
|
|
7165
|
+
for name in parts[:-1]:
|
|
7166
|
+
directory = f"{directory}/{name}" if directory else name
|
|
7167
|
+
if directory not in directories:
|
|
7168
|
+
directories[directory] = tree.insert(
|
|
7169
|
+
parent, "end", iid=f"dir:{directory}", text=f"☑ 📁 {name}", open=True,
|
|
7170
|
+
)
|
|
7171
|
+
parent = directories[directory]
|
|
7172
|
+
|
|
7173
|
+
size_kb = self.file_sizes.get(filepath, 0) / 1024
|
|
7174
|
+
checked = self.file_checked.get(filepath, True)
|
|
7175
|
+
glyph = "☑" if checked else "☐"
|
|
7176
|
+
status = "Included" if checked else "Excluded"
|
|
7177
|
+
tree.insert(parent, "end", iid=filepath, text=f"{glyph} 📄 {parts[-1]}",
|
|
7178
|
+
values=(f"{size_kb:.1f} KB", status))
|
|
7179
|
+
|
|
7180
|
+
self.tree_empty_lbl.place_forget()
|
|
7181
|
+
self.root.after(1, insert_batch)
|
|
7182
|
+
|
|
7183
|
+
insert_batch()
|
|
7247
7184
|
|
|
7248
7185
|
def _update_tree_empty_state(self):
|
|
7249
7186
|
if not hasattr(self, "tree_empty_lbl"):
|
|
@@ -7494,7 +7431,7 @@ class AutoReadmeGUI:
|
|
|
7494
7431
|
|
|
7495
7432
|
def check_status():
|
|
7496
7433
|
try:
|
|
7497
|
-
res =
|
|
7434
|
+
res = _run_desktop_git(["git", "status", "--porcelain"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7498
7435
|
lines = res.stdout.strip().splitlines()
|
|
7499
7436
|
if lines and lines != [""]:
|
|
7500
7437
|
status_lbl.config(text=f"Detected {len(lines)} uncommitted changes.")
|
|
@@ -7508,17 +7445,17 @@ class AutoReadmeGUI:
|
|
|
7508
7445
|
def run_commit():
|
|
7509
7446
|
msg = msg_entry.get().strip()
|
|
7510
7447
|
if not msg:
|
|
7511
|
-
|
|
7448
|
+
self._show_warning("Warning", "Commit message cannot be empty!")
|
|
7512
7449
|
return
|
|
7513
7450
|
try:
|
|
7514
|
-
|
|
7515
|
-
res =
|
|
7451
|
+
_run_desktop_git(["git", "add", "."], cwd=target, check=True)
|
|
7452
|
+
res = _run_desktop_git(["git", "commit", "-m", msg], cwd=target, capture_output=True, text=True)
|
|
7516
7453
|
self.log(res.stdout or res.stderr)
|
|
7517
|
-
|
|
7454
|
+
self._show_info("Success", "Successfully staged and committed workspace changes!")
|
|
7518
7455
|
dialog.destroy()
|
|
7519
7456
|
self.sync_git_commits()
|
|
7520
7457
|
except Exception as e:
|
|
7521
|
-
|
|
7458
|
+
self._show_error("Error", f"Failed to commit: {e}")
|
|
7522
7459
|
|
|
7523
7460
|
btn_row = tk.Frame(pad, bg=PALETTE["bg_start"])
|
|
7524
7461
|
btn_row.pack(fill=tk.X)
|
|
@@ -7547,12 +7484,12 @@ class AutoReadmeGUI:
|
|
|
7547
7484
|
name = entry.get().strip()
|
|
7548
7485
|
if name:
|
|
7549
7486
|
try:
|
|
7550
|
-
res =
|
|
7487
|
+
res = _run_desktop_git(["git", "checkout", "-b", name], cwd=target, capture_output=True, text=True, timeout=10)
|
|
7551
7488
|
self.log(res.stdout or res.stderr)
|
|
7552
7489
|
self.sync_git_commits()
|
|
7553
7490
|
dialog.destroy()
|
|
7554
7491
|
except Exception as e:
|
|
7555
|
-
|
|
7492
|
+
self._show_error("Error", f"Failed to create branch: {e}")
|
|
7556
7493
|
|
|
7557
7494
|
tk.Button(pad, text="Create Branch", bg=PALETTE["success"], fg="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=save).pack()
|
|
7558
7495
|
|
|
@@ -7576,7 +7513,7 @@ class AutoReadmeGUI:
|
|
|
7576
7513
|
text.pack(fill=tk.BOTH, expand=True, pady=(0, 10))
|
|
7577
7514
|
|
|
7578
7515
|
try:
|
|
7579
|
-
res =
|
|
7516
|
+
res = _run_desktop_git(["git", "status", "--short"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7580
7517
|
text.insert(tk.END, res.stdout or "No modifications detected in status.")
|
|
7581
7518
|
except Exception as e:
|
|
7582
7519
|
text.insert(tk.END, f"Error: {e}")
|
|
@@ -7589,14 +7526,15 @@ class AutoReadmeGUI:
|
|
|
7589
7526
|
if not target or not branch:
|
|
7590
7527
|
return
|
|
7591
7528
|
|
|
7529
|
+
self.log(f"Switching to branch {branch}...")
|
|
7592
7530
|
def checkout():
|
|
7593
|
-
self.log(f"Executing branch switch checkout: git checkout {branch}...")
|
|
7594
7531
|
try:
|
|
7595
|
-
res =
|
|
7596
|
-
self.log
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7532
|
+
res = _run_desktop_git(["git", "checkout", branch], cwd=target, capture_output=True, text=True, timeout=10)
|
|
7533
|
+
self.safe_after(0, self.log, res.stdout or res.stderr)
|
|
7534
|
+
if res.returncode == 0:
|
|
7535
|
+
self.safe_after(0, self.sync_git_commits)
|
|
7536
|
+
except Exception as exc:
|
|
7537
|
+
self.safe_after(0, self.log, f"Branch switch failed: {exc}")
|
|
7600
7538
|
threading.Thread(target=checkout, daemon=True).start()
|
|
7601
7539
|
|
|
7602
7540
|
def sync_git_commits(self):
|
|
@@ -7612,7 +7550,7 @@ class AutoReadmeGUI:
|
|
|
7612
7550
|
|
|
7613
7551
|
def load_branches():
|
|
7614
7552
|
try:
|
|
7615
|
-
res =
|
|
7553
|
+
res = _run_desktop_git(["git", "branch", "-a"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7616
7554
|
branches = []
|
|
7617
7555
|
active = ""
|
|
7618
7556
|
for line in res.stdout.splitlines():
|
|
@@ -7621,9 +7559,9 @@ class AutoReadmeGUI:
|
|
|
7621
7559
|
active = clean
|
|
7622
7560
|
if clean:
|
|
7623
7561
|
branches.append(clean)
|
|
7624
|
-
self.
|
|
7562
|
+
self.safe_after(0, lambda: self.branch_combo.config(values=branches))
|
|
7625
7563
|
if active:
|
|
7626
|
-
self.
|
|
7564
|
+
self.safe_after(0, lambda: self.branch_combo.set(active))
|
|
7627
7565
|
except Exception:
|
|
7628
7566
|
pass
|
|
7629
7567
|
threading.Thread(target=load_branches, daemon=True).start()
|
|
@@ -7632,8 +7570,7 @@ class AutoReadmeGUI:
|
|
|
7632
7570
|
|
|
7633
7571
|
def on_commits_loaded(commits):
|
|
7634
7572
|
try:
|
|
7635
|
-
|
|
7636
|
-
self.root.after(0, lambda: self._render_commits_sync(commits))
|
|
7573
|
+
self.safe_after(0, self._render_commits_sync, commits)
|
|
7637
7574
|
except Exception:
|
|
7638
7575
|
pass
|
|
7639
7576
|
|
|
@@ -7682,7 +7619,7 @@ class AutoReadmeGUI:
|
|
|
7682
7619
|
manager = CustomChangelogManager(target)
|
|
7683
7620
|
|
|
7684
7621
|
def on_diff_loaded(diff_text):
|
|
7685
|
-
self.
|
|
7622
|
+
self.safe_after(0, self._render_diff_sync, diff_text)
|
|
7686
7623
|
|
|
7687
7624
|
manager.get_git_diff_async(on_diff_loaded)
|
|
7688
7625
|
|
|
@@ -7806,7 +7743,7 @@ class AutoReadmeGUI:
|
|
|
7806
7743
|
def run_local_dry_run(self):
|
|
7807
7744
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
7808
7745
|
if not selected_files:
|
|
7809
|
-
|
|
7746
|
+
self._show_warning("Warning", "Please select at least one file for dry-run!")
|
|
7810
7747
|
return
|
|
7811
7748
|
|
|
7812
7749
|
d = self.dir_entry.get().strip() or os.getcwd()
|
|
@@ -7829,12 +7766,12 @@ class AutoReadmeGUI:
|
|
|
7829
7766
|
url = self.api_url_entry.get().strip()
|
|
7830
7767
|
key = self.api_key_entry.get().strip()
|
|
7831
7768
|
if not url:
|
|
7832
|
-
|
|
7769
|
+
self._show_error("Error", "API Base URL is required!")
|
|
7833
7770
|
return
|
|
7834
7771
|
|
|
7835
7772
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
7836
7773
|
if not selected_files:
|
|
7837
|
-
|
|
7774
|
+
self._show_warning("Warning", "Please check at least one codebase file first!")
|
|
7838
7775
|
return
|
|
7839
7776
|
|
|
7840
7777
|
self.cancel_event.clear()
|
|
@@ -8001,7 +7938,7 @@ Custom Requirements:
|
|
|
8001
7938
|
detail += "\n\n💡 Tip: NVIDIA NIM API key authorization failed (403 Forbidden). Please generate a valid API key at https://build.nvidia.com and enter it under Settings > API Keys."
|
|
8002
7939
|
elif "410" in err_str or "end of life" in err_str:
|
|
8003
7940
|
detail += "\n\n💡 Tip: This model has reached End of Life. Please select the latest 'deepseek-ai/deepseek-v4.1-flash' model from the dropdown."
|
|
8004
|
-
|
|
7941
|
+
self._show_error("Error", detail)
|
|
8005
7942
|
|
|
8006
7943
|
def copy_clipboard(self):
|
|
8007
7944
|
txt = self.preview_text.get("1.0", tk.END).strip()
|
|
@@ -8030,7 +7967,7 @@ Custom Requirements:
|
|
|
8030
7967
|
self.log(f"README.md saved to: {p}")
|
|
8031
7968
|
except Exception as e:
|
|
8032
7969
|
play_sfx("error")
|
|
8033
|
-
|
|
7970
|
+
self._show_error("Error", str(e))
|
|
8034
7971
|
|
|
8035
7972
|
def export_agents_md(self):
|
|
8036
7973
|
play_sfx("click")
|
|
@@ -8059,7 +7996,7 @@ Custom Requirements:
|
|
|
8059
7996
|
self.log(f"AGENTS.md blueprint exported: {out_path}")
|
|
8060
7997
|
except Exception as e:
|
|
8061
7998
|
play_sfx("error")
|
|
8062
|
-
|
|
7999
|
+
self._show_error("Error", f"Failed saving AGENTS.md: {e}")
|
|
8063
8000
|
|
|
8064
8001
|
def export_architecture_md(self):
|
|
8065
8002
|
play_sfx("click")
|
|
@@ -8136,7 +8073,7 @@ Custom Requirements:
|
|
|
8136
8073
|
|
|
8137
8074
|
def _on_arch_export_error(self, err_msg: str):
|
|
8138
8075
|
play_sfx("error")
|
|
8139
|
-
|
|
8076
|
+
self._show_error("Error", f"Failed saving ARCHITECTURE.md: {err_msg}")
|
|
8140
8077
|
self.gen_status_lbl.config(text="Architecture export failed.")
|
|
8141
8078
|
|
|
8142
8079
|
def export_repo_map(self):
|
|
@@ -8170,7 +8107,7 @@ Custom Requirements:
|
|
|
8170
8107
|
self.log(f"REPO_MAP.txt exported: {out_path}")
|
|
8171
8108
|
except Exception as e:
|
|
8172
8109
|
play_sfx("error")
|
|
8173
|
-
|
|
8110
|
+
self._show_error("Error", f"Failed saving REPO_MAP.txt: {e}")
|
|
8174
8111
|
|
|
8175
8112
|
def export_html_preview(self):
|
|
8176
8113
|
play_sfx("click")
|
|
@@ -8191,7 +8128,7 @@ Custom Requirements:
|
|
|
8191
8128
|
webbrowser.open(os.path.abspath(out_path))
|
|
8192
8129
|
except Exception as e:
|
|
8193
8130
|
play_sfx("error")
|
|
8194
|
-
|
|
8131
|
+
self._show_error("Error", f"Failed opening HTML preview: {e}")
|
|
8195
8132
|
|
|
8196
8133
|
# --- TAB 5: PROMPT WORKBENCH PLAYGROUND ---
|
|
8197
8134
|
def setup_tab_template(self):
|
|
@@ -8284,7 +8221,7 @@ Custom Requirements:
|
|
|
8284
8221
|
def save_template(self):
|
|
8285
8222
|
self.template_engine.template_content = self.tmpl_text.get("1.0", tk.END)
|
|
8286
8223
|
self.log("Custom template layouts saved.")
|
|
8287
|
-
|
|
8224
|
+
self._show_info("Success", "Template updated successfully!")
|
|
8288
8225
|
|
|
8289
8226
|
def reset_template(self):
|
|
8290
8227
|
self.tmpl_text.delete("1.0", tk.END)
|
|
@@ -8505,59 +8442,11 @@ Custom Requirements:
|
|
|
8505
8442
|
file_node = self.ast_tree.insert("", "end", text=f"📄 {os.path.basename(filepath)} (AST Fail)")
|
|
8506
8443
|
|
|
8507
8444
|
def start_system_telemetry(self):
|
|
8508
|
-
def
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
try:
|
|
8514
|
-
self.root.after(0, lambda c=cpu, m=mem: self.perf_chart.update_values(c, m))
|
|
8515
|
-
except Exception:
|
|
8516
|
-
break
|
|
8517
|
-
threading.Thread(target=telemetry, daemon=True).start()
|
|
8518
|
-
|
|
8519
|
-
def _apply_live_community_stats(self, stats: Dict[str, Any]):
|
|
8520
|
-
"""Apply live GitHub star and registry download counts to header & open dialog."""
|
|
8521
|
-
if not stats:
|
|
8522
|
-
return
|
|
8523
|
-
self.community_stats = stats
|
|
8524
|
-
stars = int(stats.get("stars", 111))
|
|
8525
|
-
target_stars = int(stats.get("target_stars", 250))
|
|
8526
|
-
pct_ratio = max(0.05, min(1.0, stars / max(1, target_stars)))
|
|
8527
|
-
pct_int = int(round(pct_ratio * 100))
|
|
8528
|
-
dl_label = str(stats.get("downloads_label", "22,900+"))
|
|
8529
|
-
saved_label = str(stats.get("saved_tokens_label", "1,120,000+"))
|
|
8530
|
-
|
|
8531
|
-
try:
|
|
8532
|
-
if hasattr(self, "star_header_btn") and self.star_header_btn.winfo_exists():
|
|
8533
|
-
self.star_header_btn.set_text(f"★ STAR ({stars}★)")
|
|
8534
|
-
except Exception:
|
|
8535
|
-
pass
|
|
8536
|
-
|
|
8537
|
-
w = getattr(self, "_star_dialog_widgets", {}) or {}
|
|
8538
|
-
dlg = w.get("dialog")
|
|
8539
|
-
try:
|
|
8540
|
-
if dlg and dlg.winfo_exists():
|
|
8541
|
-
if not w.get("first_launch"):
|
|
8542
|
-
w["hdr_lbl"].config(text=f"⭐ {target_stars} STARS GOAL: JOIN THE COMMUNITY!")
|
|
8543
|
-
w["stats_lbl"].config(
|
|
8544
|
-
text=f"🚀 {dl_label} Downloads (PyPI & npm) | ⚡ {saved_label} Tokens Saved\n⭐ Current Stars: {stars} / {target_stars} Goal (Progress: {pct_int}%)"
|
|
8545
|
-
)
|
|
8546
|
-
w["bar_fill"].place_configure(relwidth=pct_ratio)
|
|
8547
|
-
w["msg_lbl"].config(text=w["build_msg"](stars, target_stars))
|
|
8548
|
-
except Exception:
|
|
8549
|
-
pass
|
|
8550
|
-
|
|
8551
|
-
def start_community_stats_refresh(self):
|
|
8552
|
-
"""Fetch live GitHub star count and download stats asynchronously without blocking UI."""
|
|
8553
|
-
def _worker():
|
|
8554
|
-
try:
|
|
8555
|
-
from tzero.tzero_growth import get_live_community_stats
|
|
8556
|
-
stats = get_live_community_stats(timeout=3.0, force_refresh=True, include_downloads=True)
|
|
8557
|
-
self.safe_after(0, lambda s=stats: self._apply_live_community_stats(s))
|
|
8558
|
-
except Exception:
|
|
8559
|
-
pass
|
|
8560
|
-
threading.Thread(target=_worker, daemon=True).start()
|
|
8445
|
+
def refresh():
|
|
8446
|
+
if self.perf_chart.winfo_viewable():
|
|
8447
|
+
self.perf_chart.update_values(random.uniform(5.0, 30.0), random.uniform(20.0, 45.0))
|
|
8448
|
+
self.root.after(2000, refresh)
|
|
8449
|
+
self.root.after(2000, refresh)
|
|
8561
8450
|
|
|
8562
8451
|
|
|
8563
8452
|
# --- 14. STARTUP ORCHESTRATION & CLI WIZARD ---
|
|
@@ -9569,105 +9458,6 @@ def main():
|
|
|
9569
9458
|
run_system_disk_doctor(clean=True, workspace_dir=target_dir)
|
|
9570
9459
|
sys.exit(0)
|
|
9571
9460
|
|
|
9572
|
-
# Fast path for Anti-REA armor / protection
|
|
9573
|
-
if len(sys.argv) > 1 and sys.argv[1].lower() in ("armor", "anti-rea", "--armor", "--anti-rea"):
|
|
9574
|
-
extra_args = sys.argv[2:]
|
|
9575
|
-
if any(flag in ("-h", "--help") for flag in extra_args):
|
|
9576
|
-
print("Usage: tzero armor [TARGET_PATH] [--audit]")
|
|
9577
|
-
print(" Protect source files against AI reverse engineering (180-Tier TDQS-REA Armor).")
|
|
9578
|
-
print(" --audit, -a Audit AI decompilation resistance without modifying files.")
|
|
9579
|
-
sys.exit(0)
|
|
9580
|
-
target_path = next((a for a in extra_args if not a.startswith("-")), ".")
|
|
9581
|
-
out_path = None
|
|
9582
|
-
for idx_a, a in enumerate(extra_args):
|
|
9583
|
-
if a in ("-o", "--output", "--out") and idx_a + 1 < len(extra_args):
|
|
9584
|
-
out_path = extra_args[idx_a + 1]
|
|
9585
|
-
break
|
|
9586
|
-
if any(flag in ("--audit", "-a") for flag in extra_args):
|
|
9587
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
9588
|
-
audit = audit_path_rea_resistance(target_path)
|
|
9589
|
-
print(json.dumps(audit, indent=2))
|
|
9590
|
-
sys.exit(0 if "error" not in audit else 1)
|
|
9591
|
-
from tzero.tzero_armor import protect_path_with_armor
|
|
9592
|
-
res = protect_path_with_armor(target_path, output_path=out_path)
|
|
9593
|
-
if res.get("success"):
|
|
9594
|
-
print(f"[OK] Applied Anti-REA Armor to: {target_path}")
|
|
9595
|
-
if "score_after" in res:
|
|
9596
|
-
print(f" AI Resistance Score: {res.get('score_before')}/100 -> {res.get('score_after')}/100 [{res.get('tier_rating', res.get('rating'))}]")
|
|
9597
|
-
print(f" Verified Tiers Active: {res.get('tiers_active', 0)}/{res.get('tiers_total', 180)} ({res.get('domains_active', 0)}/{res.get('domains_total', 12)} domains)")
|
|
9598
|
-
elif "files_protected" in res:
|
|
9599
|
-
print(f" Protected {res['files_protected']} files in directory.")
|
|
9600
|
-
else:
|
|
9601
|
-
print(f"[FAIL] Armor protection failed: {res.get('error', 'Unknown error')}", file=sys.stderr)
|
|
9602
|
-
sys.exit(0 if res.get("success") else 1)
|
|
9603
|
-
|
|
9604
|
-
# Fast path for Anti-REA audit
|
|
9605
|
-
if len(sys.argv) > 1 and sys.argv[1].lower() in ("audit-rea", "--audit-rea"):
|
|
9606
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
9607
|
-
target_path = sys.argv[2] if len(sys.argv) > 2 and not sys.argv[2].startswith("-") else "."
|
|
9608
|
-
audit = audit_path_rea_resistance(target_path)
|
|
9609
|
-
if audit.get("error"):
|
|
9610
|
-
print(f"[ERROR] {audit['error']}", file=sys.stderr)
|
|
9611
|
-
sys.exit(1)
|
|
9612
|
-
print("================================================================================")
|
|
9613
|
-
print(" SHIELD AUDIT REPORT: AI REVERSE-ENGINEERING RESISTANCE (TDQS-REA)")
|
|
9614
|
-
print("================================================================================")
|
|
9615
|
-
print(f"Target: {target_path}")
|
|
9616
|
-
print(f"AI Score: {audit.get('score', 0)} / 100 [{audit.get('tier_rating', audit.get('rating', 'UNVERIFIED'))}]")
|
|
9617
|
-
if "tiers_total" in audit:
|
|
9618
|
-
print(f"Tier Matrix: {audit.get('tiers_active', 0)} / {audit.get('tiers_total', 180)} Tiers ({audit.get('domains_active', 0)}/{audit.get('domains_total', 12)} Domains)")
|
|
9619
|
-
print(f"Score Basis: {audit.get('score_kind', 'static_textual_indicator')}")
|
|
9620
|
-
print(f"Status: {audit.get('status', 'N/A')}")
|
|
9621
|
-
if audit.get("defenses_active"):
|
|
9622
|
-
print("\nActive Defenses:")
|
|
9623
|
-
for k, v in audit["defenses_active"].items():
|
|
9624
|
-
print(f" [{'✔' if v else ' '}] {k}")
|
|
9625
|
-
if audit.get("unverified_layers"):
|
|
9626
|
-
print(f"\nUnverified Layers (not measured statically): {', '.join(audit['unverified_layers'])}")
|
|
9627
|
-
recs = audit.get("sample_findings") or audit.get("findings", [])
|
|
9628
|
-
if recs:
|
|
9629
|
-
print("\nRecommendations:")
|
|
9630
|
-
for f in recs:
|
|
9631
|
-
print(f" • {f}")
|
|
9632
|
-
print("================================================================================")
|
|
9633
|
-
sys.exit(0)
|
|
9634
|
-
|
|
9635
|
-
# Fast path for Anti-REA shield-exe
|
|
9636
|
-
if len(sys.argv) > 1 and sys.argv[1].lower() in ("shield-exe", "--shield-exe"):
|
|
9637
|
-
from tzero.tzero_armor import shield_executable
|
|
9638
|
-
target_path = sys.argv[2] if len(sys.argv) > 2 and not sys.argv[2].startswith("-") else ""
|
|
9639
|
-
if not target_path:
|
|
9640
|
-
print("Usage: tzero shield-exe <path_to_binary.exe>", file=sys.stderr)
|
|
9641
|
-
sys.exit(1)
|
|
9642
|
-
res = shield_executable(target_path)
|
|
9643
|
-
if res.get("shielded"):
|
|
9644
|
-
print(f"[OK] Shielded executable against pyinstxtractor: {res.get('output_path', target_path)}")
|
|
9645
|
-
print(f" Decoy archive traps injected: {res.get('decoy_traps_injected', 0)}")
|
|
9646
|
-
else:
|
|
9647
|
-
print(f"[INFO] {res.get('reason', 'Already shielded or not a PyInstaller binary.')}")
|
|
9648
|
-
sys.exit(0 if res.get("shielded") else 1)
|
|
9649
|
-
|
|
9650
|
-
# Fast path for Anti-REA radar / gui
|
|
9651
|
-
if len(sys.argv) > 1 and sys.argv[1].lower() in ("radar", "--radar", "anti-rea-gui"):
|
|
9652
|
-
radar_args = sys.argv[2:]
|
|
9653
|
-
if any(a in ("-h", "--help") for a in radar_args):
|
|
9654
|
-
print("Usage: tzero radar [PATH | --audit PATH | --armor PATH]\n"
|
|
9655
|
-
"Launch Anti-REA Radar GUI or run headless Anti-REA audit/armor on a target path.")
|
|
9656
|
-
sys.exit(0)
|
|
9657
|
-
if radar_args:
|
|
9658
|
-
from tzero.tzero_armor import audit_path_rea_resistance, protect_path_with_armor
|
|
9659
|
-
mode_armor = "--armor" in radar_args
|
|
9660
|
-
target = next((a for a in radar_args if not a.startswith("-")), ".")
|
|
9661
|
-
res = protect_path_with_armor(target) if mode_armor else audit_path_rea_resistance(target)
|
|
9662
|
-
print(json.dumps(res, indent=2))
|
|
9663
|
-
sys.exit(0 if res.get("success", True) else 1)
|
|
9664
|
-
try:
|
|
9665
|
-
from tzero.anti_rea.gui import main as gui_main
|
|
9666
|
-
gui_main()
|
|
9667
|
-
except Exception as e:
|
|
9668
|
-
print(f"Error launching Anti-REA GUI: {e}", file=sys.stderr)
|
|
9669
|
-
sys.exit(0)
|
|
9670
|
-
|
|
9671
9461
|
parser = argparse.ArgumentParser(
|
|
9672
9462
|
description="Siber Akademi T-Zero Context Architect - Enterprise Codebase Context Builder & Token Reducer",
|
|
9673
9463
|
epilog="""
|
|
@@ -9723,7 +9513,8 @@ def main():
|
|
|
9723
9513
|
parser.add_argument("--deep", action="store_true", help="Run deep offline subsystem self-check with all 9 v11 subsystems (use with --doctor)")
|
|
9724
9514
|
parser.add_argument("--pipe", nargs="?", const="", default=None, metavar="FILENAME_HINT", help="Read code/diff/schema from stdin, compress tokens, and output to stdout")
|
|
9725
9515
|
parser.add_argument("--clip", "--copy", nargs="?", const="", default=None, metavar="FILE", help="Prune file AST signatures and copy directly to system clipboard")
|
|
9726
|
-
parser.add_argument("--sync", nargs="?", const=".", default=None, metavar="DIR", help="
|
|
9516
|
+
parser.add_argument("--sync", nargs="?", const=".", default=None, metavar="DIR", help="Preview workspace rules for Cursor, Claude Code and Windsurf")
|
|
9517
|
+
parser.add_argument("--apply-sync", action="store_true", help="With --sync, create missing rule files without replacing existing ones")
|
|
9727
9518
|
parser.add_argument("--cost", nargs="?", const=".", default=None, metavar="DIR", help="Calculate real-time token cost and ROI financial cockpit")
|
|
9728
9519
|
parser.add_argument("--drift", nargs="?", const=".", default=None, metavar="DIR", help="Analyze quantitative instruction adherence and architectural rule drift")
|
|
9729
9520
|
parser.add_argument("--init-hooks", nargs="?", const=".", default=None, metavar="REPO_DIR", dest="init_hooks", help="Install zero-leak & token security pre-commit hook into .git/hooks")
|
|
@@ -9742,8 +9533,6 @@ def main():
|
|
|
9742
9533
|
parser.add_argument("--patch", "--apply-patch", dest="apply_patch", metavar="DIFF_FILE_OR_STR", help="Apply patch with AST-tolerant fuzzy matching (whitespace & line drift agnostic)")
|
|
9743
9534
|
parser.add_argument("--target", default=None, metavar="TARGET_FILE", help="Target file for --patch (optional if patch specifies file header)")
|
|
9744
9535
|
parser.add_argument("--fuzzy", action="store_true", default=True, help="Enable fuzzy AST and whitespace matching for patch application (default: True)")
|
|
9745
|
-
parser.add_argument("--armor", "--anti-rea", nargs="?", const=".", default=None, metavar="PATH", dest="armor", help="Apply military-grade Anti-REA armor against AI reverse engineering (morluto/rea)")
|
|
9746
|
-
parser.add_argument("--audit-rea", nargs="?", const=".", default=None, metavar="PATH", dest="audit_rea", help="Audit code or binary for resistance against AI reverse engineering (0-100)")
|
|
9747
9536
|
parser.add_argument("--telemetry", nargs="?", const=".", default=None, metavar="DIR", help="Show offline SQLite token savings & ROI telemetry report")
|
|
9748
9537
|
parser.add_argument("--no-fuzzy", dest="fuzzy", action="store_false", help="Disable fuzzy matching and enforce exact line matches only")
|
|
9749
9538
|
parser.add_argument("--dry-run-patch", action="store_true", help="Validate patch applicability without modifying files on disk")
|
|
@@ -9764,7 +9553,7 @@ def main():
|
|
|
9764
9553
|
default="o200k_base", help="BPE encoding for --symbol-context")
|
|
9765
9554
|
parser.add_argument("--cache-aligned", action="store_true", help="Order context for KV-cache prefix stability (immutable static prefix before dynamic query suffix)")
|
|
9766
9555
|
parser.add_argument("--commit-msg", action="store_true", help="Generate Conventional Commit message from local AST git diff ($0 local engine)")
|
|
9767
|
-
parser.add_argument("--changelog", nargs="?", const="v12.3.
|
|
9556
|
+
parser.add_argument("--changelog", nargs="?", const="v12.3.6", default=None, metavar="VERSION", help="Generate release CHANGELOG markdown from git history")
|
|
9768
9557
|
parser.add_argument("--ci", choices=["github", "gitlab", "pre-commit", "local", "all"], default=None, help="Install CI/CD workflow or run local verification suite")
|
|
9769
9558
|
parser.add_argument("--local-ci", action="store_true", help="Run comprehensive Local CI & Pre-Push verification battery ($0 quota burn)")
|
|
9770
9559
|
parser.add_argument("--quick-ci", action="store_true", help="Run fast Local CI smoke checks in seconds")
|
|
@@ -9828,7 +9617,7 @@ def main():
|
|
|
9828
9617
|
parser.add_argument("--card", "--badge", nargs="?", const="assets/tzero_badge_card.svg", default=None, metavar="FILE", help="Generate viral dark-mode SVG banner card and GitHub README badges")
|
|
9829
9618
|
parser.add_argument("--showcase", nargs="?", const="tzero_showcase.html", default=None, metavar="FILE", help="Generate interactive split-screen HTML5 comparison showcase slider")
|
|
9830
9619
|
parser.add_argument("--marketing", "--growth", action="store_true", help="Launch $0-budget viral growth engine and export campaign materials for Reddit, HN, X, and Product Hunt")
|
|
9831
|
-
parser.add_argument("--version", "-v", action="version", version="T-Zero Context Architect v12.3.
|
|
9620
|
+
parser.add_argument("--version", "-v", action="version", version="T-Zero Context Architect v12.3.6 Master Edition (engine v4.1.0)")
|
|
9832
9621
|
|
|
9833
9622
|
|
|
9834
9623
|
def print_master_tutorial():
|
|
@@ -9937,7 +9726,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
9937
9726
|
def print_quickstart_guide():
|
|
9938
9727
|
print("""
|
|
9939
9728
|
================================================================================
|
|
9940
|
-
⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.3.
|
|
9729
|
+
⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.3.6 MASTER (engine v4.1.0)
|
|
9941
9730
|
================================================================================
|
|
9942
9731
|
🎯 %95'e Varan Token Tasarrufu & Otonom Yapay Zeka Mimari Bağlam Motoru
|
|
9943
9732
|
|
|
@@ -10147,29 +9936,6 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
10147
9936
|
from tzero.tzero_traffic import run_system_disk_doctor
|
|
10148
9937
|
run_system_disk_doctor(clean=True, workspace_dir=args.dir)
|
|
10149
9938
|
return
|
|
10150
|
-
elif getattr(args, "armor", None):
|
|
10151
|
-
if getattr(args, "audit", None) is not None:
|
|
10152
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
10153
|
-
audit = audit_path_rea_resistance(args.armor)
|
|
10154
|
-
print(json.dumps(audit, indent=2))
|
|
10155
|
-
return
|
|
10156
|
-
from tzero.tzero_armor import protect_path_with_armor
|
|
10157
|
-
res = protect_path_with_armor(args.armor, output_path=getattr(args, "output", None))
|
|
10158
|
-
if res.get("success"):
|
|
10159
|
-
print(f"[OK] Applied Anti-REA Armor to: {args.armor}")
|
|
10160
|
-
if "score_after" in res:
|
|
10161
|
-
print(f" AI Resistance Score: {res.get('score_before')}/100 -> {res.get('score_after')}/100 [{res.get('rating')}]")
|
|
10162
|
-
elif "files_protected" in res:
|
|
10163
|
-
print(f" Protected {res['files_protected']} files in directory.")
|
|
10164
|
-
else:
|
|
10165
|
-
print(f"[FAIL] Armor protection failed: {res.get('error', 'Unknown error')}", file=sys.stderr)
|
|
10166
|
-
sys.exit(1)
|
|
10167
|
-
return
|
|
10168
|
-
elif getattr(args, "audit_rea", None):
|
|
10169
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
10170
|
-
audit = audit_path_rea_resistance(args.audit_rea)
|
|
10171
|
-
print(json.dumps(audit, indent=2))
|
|
10172
|
-
sys.exit(1 if audit.get("error") else 0)
|
|
10173
9939
|
elif getattr(args, "telemetry", None) is not None:
|
|
10174
9940
|
from tzero.tzero_telemetry import get_summary, render_report
|
|
10175
9941
|
ws_dir = args.telemetry if args.telemetry != "." else (getattr(args, "dir", ".") or ".")
|
|
@@ -10266,9 +10032,9 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
10266
10032
|
elif args.sync is not None:
|
|
10267
10033
|
from tzero.tzero_sync import WorkspaceSyncManager
|
|
10268
10034
|
target = args.sync or args.dir
|
|
10269
|
-
res = WorkspaceSyncManager.sync(target)
|
|
10035
|
+
res = WorkspaceSyncManager.sync(target, apply=args.apply_sync)
|
|
10270
10036
|
WorkspaceSyncManager.render_cli(res)
|
|
10271
|
-
sys.exit(0)
|
|
10037
|
+
sys.exit(0 if res.success else 1)
|
|
10272
10038
|
elif args.cost is not None:
|
|
10273
10039
|
from tzero.tzero_cost import TokenCostCalculator
|
|
10274
10040
|
target = args.cost or args.dir
|
|
@@ -10916,7 +10682,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
10916
10682
|
if not os.path.exists(app_path):
|
|
10917
10683
|
app_path = os.path.join(os.getcwd(), "huggingface-space", "app.py")
|
|
10918
10684
|
print("\033[36m" + "=" * 80)
|
|
10919
|
-
print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.3.
|
|
10685
|
+
print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.3.6)")
|
|
10920
10686
|
print("=" * 80 + "\033[0m")
|
|
10921
10687
|
print("🌐 Official Live Space : https://huggingface.co/spaces/toprakke4/tzero-token-reducer")
|
|
10922
10688
|
print(f"📁 Local Application : {app_path}")
|