tzero-mcp 12.2.1 → 12.3.2

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.
Files changed (55) hide show
  1. package/README.md +6 -30
  2. package/bin/tzero-mcp.js +2 -2
  3. package/bin/tzero.js +11 -6
  4. package/package.json +1 -2
  5. package/src/addmcp.py +10 -5
  6. package/src/app.py +3 -9
  7. package/src/tzero/__init__.py +1 -1
  8. package/src/tzero/anti_rea/__init__.py +16 -2
  9. package/src/tzero/anti_rea/algebraic_mutator.py +65 -44
  10. package/src/tzero/anti_rea/anti_debugger.py +51 -18
  11. package/src/tzero/anti_rea/asar_shield.py +24 -1
  12. package/src/tzero/anti_rea/auditor.py +62 -12
  13. package/src/tzero/anti_rea/canary_beacon.py +56 -76
  14. package/src/tzero/anti_rea/cli.py +37 -5
  15. package/src/tzero/anti_rea/confusables.py +62 -18
  16. package/src/tzero/anti_rea/crypto_loader.py +132 -0
  17. package/src/tzero/anti_rea/engine.py +129 -29
  18. package/src/tzero/anti_rea/extractor_shield.py +91 -13
  19. package/src/tzero/anti_rea/gui.py +1 -4
  20. package/src/tzero/anti_rea/integrity_guard.py +17 -5
  21. package/src/tzero/anti_rea/rdtsc_guard.py +21 -8
  22. package/src/tzero/anti_rea/string_vault.py +10 -7
  23. package/src/tzero/anti_rea/tier_catalog.py +388 -0
  24. package/src/tzero/siber_akademi.ico +0 -0
  25. package/src/tzero/siber_akademi_icon.py +14 -8
  26. package/src/tzero/tzero_armor.py +29 -7
  27. package/src/tzero/tzero_benchmark.py +4 -2
  28. package/src/tzero/tzero_budget.py +14 -5
  29. package/src/tzero/tzero_ci.py +2 -2
  30. package/src/tzero/tzero_contracts.py +7 -5
  31. package/src/tzero/tzero_dashboard.py +28 -9
  32. package/src/tzero/tzero_debt.py +19 -4
  33. package/src/tzero/tzero_deps.py +109 -87
  34. package/src/tzero/tzero_explain.py +1 -1
  35. package/src/tzero/tzero_features.py +43 -29
  36. package/src/tzero/tzero_federation.py +9 -2
  37. package/src/tzero/tzero_fixer/mcp_server.py +10 -0
  38. package/src/tzero/tzero_golden.py +37 -9
  39. package/src/tzero/tzero_growth.py +166 -8
  40. package/src/tzero/tzero_guard.py +147 -46
  41. package/src/tzero/tzero_jarvis/workspace_orchestrator.py +1 -1
  42. package/src/tzero/tzero_jarvis/zero_key_router.py +10 -78
  43. package/src/tzero/tzero_lsp.py +1 -1
  44. package/src/tzero/tzero_mcp.py +71 -23
  45. package/src/tzero/tzero_mutation.py +92 -15
  46. package/src/tzero/tzero_promo.py +1 -1
  47. package/src/tzero/tzero_proxy.py +105 -12
  48. package/src/tzero/tzero_scip.py +12 -6
  49. package/src/tzero/tzero_security.py +404 -60
  50. package/src/tzero/tzero_task_benchmark.py +2 -2
  51. package/src/tzero/tzero_traffic.py +35 -10
  52. package/src/tzero/tzero_tui.py +20 -11
  53. package/src/tzero/tzero_v3.py +304 -153
  54. package/src/tzero/tzero_welcome.py +12 -4
  55. package/bin/postinstall.js +0 -30
@@ -493,7 +493,7 @@ def calculate_token_cost(token_count: int, provider_name: str) -> float:
493
493
  # i18n Translations
494
494
  TRANSLATIONS: Dict[str, Dict[str, str]] = {
495
495
  "en": {
496
- "title": "T-Zero Developer Console & Context Architect v12.2.1",
496
+ "title": "T-Zero Developer Console & Context Architect v12.3.2",
497
497
  "subtitle": f"Developer: {DEV_NAME} | {DEV_URL_MAIN} | {DEV_URL_BIO}",
498
498
  "overview_tab": "🏠 Overview Dashboard",
499
499
  "setup_tab": "⚡ Setup & AI Models",
@@ -530,7 +530,7 @@ TRANSLATIONS: Dict[str, Dict[str, str]] = {
530
530
  "audit_btn": "🛡️ SECURITY AUDIT"
531
531
  },
532
532
  "tr": {
533
- "title": "T-Zero Geliştirici Konsolu & Bağlam Mimarı v12.2.1",
533
+ "title": "T-Zero Geliştirici Konsolu & Bağlam Mimarı v12.3.2",
534
534
  "subtitle": f"Geliştirici: {DEV_NAME} | {DEV_URL_MAIN} | {DEV_URL_BIO}",
535
535
  "overview_tab": "🏠 Genel Bakış",
536
536
  "setup_tab": "⚡ Kurulum & Model",
@@ -1094,23 +1094,7 @@ class LocalOllamaProvider(BaseProvider):
1094
1094
  }
1095
1095
 
1096
1096
 
1097
- class FreePollinationsProvider(BaseProvider):
1098
- def __init__(self):
1099
- super().__init__(
1100
- "Free AI Cloud (No Key Required)",
1101
- "https://text.pollinations.ai/openai",
1102
- ["openai", "mistral", "qwen-coder", "deepseek"]
1103
- )
1104
-
1105
- def get_headers(self, api_key: str = "") -> Dict[str, str]:
1106
- return {
1107
- "Content-Type": "application/json",
1108
- "User-Agent": f"TZeroAlgorithmV4/4.1 (Toprak Ahmet Aydogmus; {DEV_URL_GITHUB})"
1109
- }
1110
-
1111
-
1112
1097
  PROVIDERS: Dict[str, BaseProvider] = {
1113
- "Free AI Cloud (No Key Required)": FreePollinationsProvider(),
1114
1098
  "NVIDIA NIM": NvidiaProvider(),
1115
1099
  "OpenAI": OpenAIProvider(),
1116
1100
  "Google Gemini": GeminiProvider(),
@@ -2050,7 +2034,56 @@ class KeyringSecretsBackupManager:
2050
2034
  return False
2051
2035
 
2052
2036
  @classmethod
2053
- def restore_credentials(cls, filepath: str, cipher_key: str) -> bool:
2037
+ def _validate_credential_map(cls, creds: Any) -> Optional[Dict[str, str]]:
2038
+ """Validate backup credential schema strictly before touching OS keyring."""
2039
+ if not isinstance(creds, dict) or not creds:
2040
+ return None
2041
+ known_providers = set(globals().get("AI_PROVIDERS", {}).keys()) | {
2042
+ "OpenAI", "Anthropic", "NVIDIA NIM", "Google Gemini", "OpenRouter",
2043
+ "Groq", "DeepSeek", "HuggingFace", "GitHub", "Ollama",
2044
+ }
2045
+ validated: Dict[str, str] = {}
2046
+ for provider, secret in creds.items():
2047
+ if not isinstance(provider, str) or not isinstance(secret, str):
2048
+ return None
2049
+ p_clean = provider.strip()
2050
+ if not p_clean or len(p_clean) > 64 or any(ord(c) < 32 for c in p_clean):
2051
+ return None
2052
+ if p_clean not in known_providers and not re.fullmatch(r"[A-Za-z0-9 _.\-]{2,48}", p_clean):
2053
+ return None
2054
+ if not secret or len(secret) > 4096:
2055
+ return None
2056
+ validated[p_clean] = secret
2057
+ return validated
2058
+
2059
+ @classmethod
2060
+ def import_legacy_credentials(cls, filepath: str, cipher_key: str) -> bool:
2061
+ """Import a legacy unauthenticated XOR backup after strict schema validation."""
2062
+ try:
2063
+ with open(filepath, "rb") as f:
2064
+ data = f.read()
2065
+ if not data or data.startswith(cls.MAGIC_HEADER):
2066
+ return False
2067
+ encrypted = bytearray(data)
2068
+ key_bytes = cipher_key.encode("utf-8")
2069
+ if key_bytes:
2070
+ for i in range(len(encrypted)):
2071
+ encrypted[i] ^= key_bytes[i % len(key_bytes)]
2072
+ raw_obj = json.loads(encrypted.decode("utf-8"))
2073
+ validated = cls._validate_credential_map(raw_obj)
2074
+ if not validated:
2075
+ logger.error("Legacy backup rejected: invalid provider/credential schema")
2076
+ return False
2077
+ logger.warning("Imported legacy unauthenticated backup; please re-export to modern HMAC TZB2 format.")
2078
+ for provider, secret in validated.items():
2079
+ keyring.set_password(SERVICE_NAME, provider, secret)
2080
+ return True
2081
+ except Exception as e:
2082
+ logger.error(f"Legacy backup import failed: {e}")
2083
+ return False
2084
+
2085
+ @classmethod
2086
+ def restore_credentials(cls, filepath: str, cipher_key: str, allow_legacy: bool = True) -> bool:
2054
2087
  try:
2055
2088
  import hashlib
2056
2089
  import hmac
@@ -2068,19 +2101,18 @@ class KeyringSecretsBackupManager:
2068
2101
  return False
2069
2102
  kstream = cls._keystream(enc_key, len(cipher_bytes))
2070
2103
  raw_data = bytes([b ^ k for b, k in zip(cipher_bytes, kstream)])
2071
- creds = json.loads(raw_data.decode("utf-8"))
2072
- else:
2073
- # Legacy XOR fallback for backward compatibility
2074
- encrypted = bytearray(data)
2075
- key_bytes = cipher_key.encode("utf-8")
2076
- if key_bytes:
2077
- for i in range(len(encrypted)):
2078
- encrypted[i] ^= key_bytes[i % len(key_bytes)]
2079
- creds = json.loads(encrypted.decode("utf-8"))
2080
-
2081
- for provider, secret in creds.items():
2082
- keyring.set_password(SERVICE_NAME, provider, secret)
2083
- return True
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:
2113
+ return cls.import_legacy_credentials(filepath, cipher_key)
2114
+ logger.error("Rejected unauthenticated legacy backup (allow_legacy=False)")
2115
+ return False
2084
2116
  except Exception as e:
2085
2117
  logger.error(f"Restore keyring credentials failed: {e}")
2086
2118
  return False
@@ -2411,7 +2443,8 @@ class ContextExportManager:
2411
2443
  """Generates ARCHITECTURE.md with Mermaid diagrams and module specs.
2412
2444
 
2413
2445
  Supports live 3rd-party AI synthesis (NVIDIA NIM, OpenAI, Gemini, Anthropic, OpenRouter,
2414
- Local Ollama, or Free AI Cloud) and seamless fallback to the local offline AST architecture engine.
2446
+ or Local Ollama) and falls back locally to the AST architecture engine on missing
2447
+ credentials or provider errors without silent cloud retries.
2415
2448
  """
2416
2449
  if use_ai:
2417
2450
  try:
@@ -2430,11 +2463,22 @@ class ContextExportManager:
2430
2463
  if not active_model and active_prov:
2431
2464
  active_model = prof.get("model") or active_prov.get_models()[0]
2432
2465
 
2433
- if not active_key and (not active_prov or active_prov.name != "Free AI Cloud (No Key Required)"):
2434
- active_prov = FreePollinationsProvider()
2435
- active_url = active_prov.get_base_url()
2436
- active_key = ""
2437
- active_model = "openai"
2466
+ if not active_prov:
2467
+ if progress_cb:
2468
+ progress_cb(50, "No remote provider configured. Using Local AST Architecture Engine...")
2469
+ return ContextExportManager.generate_offline_architecture_blueprint(
2470
+ project_name, files, deps, snippets
2471
+ )
2472
+
2473
+ if not active_key and active_prov.name != "Local Ollama":
2474
+ if progress_cb:
2475
+ progress_cb(
2476
+ 50,
2477
+ f"No API credential configured for {active_prov.name}. Using Local AST Architecture Engine...",
2478
+ )
2479
+ return ContextExportManager.generate_offline_architecture_blueprint(
2480
+ project_name, files, deps, snippets
2481
+ )
2438
2482
 
2439
2483
  if progress_cb:
2440
2484
  progress_cb(30, f"Synthesizing architecture with {active_prov.name} ({active_model})...")
@@ -3495,7 +3539,6 @@ class MonthlyStackedBarCard(LuxuryCard):
3495
3539
 
3496
3540
  def _draw(self, event=None):
3497
3541
  w = max(20, self.c.winfo_width())
3498
- h = max(20, self.c.winfo_height())
3499
3542
  self.c.delete("all")
3500
3543
  months = ["EKI", "KAS", "ARA", "OCA"]
3501
3544
  ratios = [0.75, 0.55, 0.85, 0.65]
@@ -3564,7 +3607,7 @@ class SecurityHubCard(LuxuryCard):
3564
3607
  def __init__(self, parent, action_cmd=None, armor_cmd=None, **kwargs):
3565
3608
  super().__init__(parent, radius=18, padding=12, **kwargs)
3566
3609
  tk.Label(self.inner, text="🛡 SİBER AKADEMİ GÜVENLİK", font=("Segoe UI", 9, "bold"), fg=PALETTE.get("accent_cyan", "#3843a0"), bg=self.card_bg).pack(anchor=tk.W)
3567
- tk.Label(self.inner, text="100% Zero-Leak + 26-Tier Anti-REA Armor", font=("Segoe UI", 7), fg=PALETTE.get("accent_green", "#10b981"), bg=self.card_bg).pack(anchor=tk.W, pady=(1, 6))
3610
+ tk.Label(self.inner, text="100% Zero-Leak + 180-Tier Anti-REA Armor", font=("Segoe UI", 7), fg=PALETTE.get("accent_green", "#10b981"), bg=self.card_bg).pack(anchor=tk.W, pady=(1, 6))
3568
3611
  btn_row = tk.Frame(self.inner, bg=self.card_bg)
3569
3612
  btn_row.pack(fill=tk.X)
3570
3613
  self.btn = CanvasPillButton(btn_row, text="RAPORU İNCELE", 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"))
@@ -4017,7 +4060,6 @@ class NodeGraphCanvas(tk.Canvas):
4017
4060
  h = max(380, self.winfo_height())
4018
4061
 
4019
4062
  card_bg = PALETTE.get("card_bg", "#0f172a")
4020
- card_border = PALETTE.get("card_border", "#1e293b")
4021
4063
  text_main = PALETTE.get("text_main", "#f8fafc")
4022
4064
  text_muted = PALETTE.get("text_muted", "#64748b")
4023
4065
  accent_cyan = PALETTE.get("accent_cyan", "#38bdf8")
@@ -4593,8 +4635,8 @@ class AutoReadmeGUI:
4593
4635
  if siber_akademi_icon:
4594
4636
  try:
4595
4637
  siber_akademi_icon.apply_window_icon(self.root)
4596
- self.logo_img = siber_akademi_icon.get_logo_photo_image((36, 36))
4597
- self.logo_sm = siber_akademi_icon.get_logo_photo_image((22, 22))
4638
+ self.logo_img = siber_akademi_icon.get_logo_photo_image((36, 36), circle=True)
4639
+ self.logo_sm = siber_akademi_icon.get_logo_photo_image((38, 38), circle=True)
4598
4640
  except Exception:
4599
4641
  pass
4600
4642
  if not self.logo_img:
@@ -4606,6 +4648,21 @@ class AutoReadmeGUI:
4606
4648
  except Exception:
4607
4649
  pass
4608
4650
 
4651
+ try:
4652
+ from tzero.tzero_growth import get_cached_community_stats
4653
+ self.community_stats = get_cached_community_stats()
4654
+ except Exception:
4655
+ self.community_stats = {
4656
+ "stars": 111,
4657
+ "target_stars": 250,
4658
+ "progress_pct": 44.4,
4659
+ "downloads": 22900,
4660
+ "downloads_label": "22,900+",
4661
+ "saved_tokens_label": "1,120,000+",
4662
+ "source": "fallback",
4663
+ }
4664
+ self._star_dialog_widgets = {}
4665
+
4609
4666
  saved_theme = _config_mgr.get_profile().get("theme", "Slate 950 (Linear Standard)")
4610
4667
  if saved_theme in THEME_PALETTES:
4611
4668
  update_colors(saved_theme)
@@ -4619,6 +4676,7 @@ class AutoReadmeGUI:
4619
4676
  self.load_saved_credentials()
4620
4677
  self.setup_keyboard_shortcuts()
4621
4678
  self.start_system_telemetry()
4679
+ self.start_community_stats_refresh()
4622
4680
  self.safe_after(1200, self.check_and_show_star_welcome_popup)
4623
4681
 
4624
4682
  def safe_after(self, ms: int, func, *args):
@@ -4641,7 +4699,6 @@ class AutoReadmeGUI:
4641
4699
  self.bg_canvas.pack(fill=tk.BOTH, expand=True)
4642
4700
 
4643
4701
  sidebar_bg = PALETTE.get("sidebar_bg", "#3843a0")
4644
- sidebar_fg = PALETTE.get("sidebar_fg", "#ffffff")
4645
4702
  sidebar_muted = PALETTE.get("sidebar_muted", "#a5b4fc")
4646
4703
  sidebar_hover = PALETTE.get("sidebar_hover", "#4a55ab")
4647
4704
  sidebar_active = PALETTE.get("sidebar_active", "#2b3478")
@@ -4650,10 +4707,10 @@ class AutoReadmeGUI:
4650
4707
  self.sidebar = GlassCard(self.bg_canvas, bg=sidebar_bg, highlightbackground=sidebar_bg)
4651
4708
  self.sidebar.place(x=8, y=8, width=66, relheight=0.98)
4652
4709
 
4653
- # Top Avatar Circle
4710
+ # Top Siber Akademi Logo Badge
4654
4711
  avatar_canvas = tk.Canvas(self.sidebar, width=44, height=44, bg=sidebar_bg, highlightthickness=0)
4655
4712
  avatar_canvas.pack(pady=(12, 14))
4656
- avatar_canvas.create_oval(2, 2, 42, 42, fill=PALETTE.get("accent_coral", "#f97316"), outline="#ffffff", width=2)
4713
+ avatar_canvas.create_oval(2, 2, 42, 42, fill="#181c24", outline=PALETTE.get("accent_cyan", "#38bdf8"), width=2)
4657
4714
  if self.logo_sm:
4658
4715
  avatar_canvas.create_image(22, 22, image=self.logo_sm)
4659
4716
  else:
@@ -4804,14 +4861,14 @@ class AutoReadmeGUI:
4804
4861
 
4805
4862
  self.star_header_btn = CanvasPillButton(
4806
4863
  header_controls,
4807
- text="★ STAR (45★)",
4864
+ text=f"★ STAR ({self.community_stats['stars']}★)",
4808
4865
  command=self.open_star_action,
4809
4866
  height=28,
4810
4867
  radius=14,
4811
4868
  bg_color=PALETTE.get("warning", "#eab308"),
4812
4869
  text_color="#000000",
4813
4870
  font=("Segoe UI", 7, "bold"),
4814
- width=100
4871
+ width=114
4815
4872
  )
4816
4873
  self.star_header_btn.pack(side=tk.LEFT, padx=3)
4817
4874
 
@@ -4947,7 +5004,7 @@ class AutoReadmeGUI:
4947
5004
  self.open_security_audit_dialog()
4948
5005
 
4949
5006
  def run_quick_anti_rea_armor(self):
4950
- """Executes 26-Tier Anti-REA Resistance audit & protection from GUI Security Hub."""
5007
+ """Executes 180-Tier Anti-REA Resistance audit & protection from GUI Security Hub."""
4951
5008
  target = (self.dir_entry.get().strip() if hasattr(self, "dir_entry") else "") or os.getcwd()
4952
5009
  try:
4953
5010
  from tzero.tzero_armor import audit_path_rea_resistance
@@ -4956,9 +5013,9 @@ class AutoReadmeGUI:
4956
5013
  rating = audit.get("rating", "UNKNOWN")
4957
5014
  self.log(f"[ANTI-REA AUDIT] Target: {target} | Score: {score}/100 ({rating})")
4958
5015
  messagebox.showinfo(
4959
- "T-Zero 26-Tier Anti-REA Armor",
5016
+ "T-Zero 180-Tier Anti-REA Armor",
4960
5017
  f"Target: {target}\nAI Resistance Score: {score}/100 ({rating})\n"
4961
- f"Active Tiers: Anti-VM (25), RDTSC Guard (26), Ring-3 Anti-Debug, Opaque CFF, PolyVM.",
5018
+ f"Active Defense Matrix: 12 Domains x 15 Sub-Tiers (Crypto Capsule, Opaque CFF, PolyVM, Anti-Debug, Anti-VM, RDTSC).",
4962
5019
  )
4963
5020
  except Exception as exc:
4964
5021
  self.log(f"[ANTI-REA ERROR] {exc}")
@@ -6138,7 +6195,6 @@ class AutoReadmeGUI:
6138
6195
  self.sync_git_commits()
6139
6196
 
6140
6197
  def load_saved_credentials(self):
6141
- pname = self.provider_var.get()
6142
6198
  self.on_provider_select()
6143
6199
  executable_dir = os.path.dirname(sys.executable) if getattr(sys, "frozen", False) else None
6144
6200
  if not self.dir_entry.get().strip():
@@ -6184,7 +6240,7 @@ class AutoReadmeGUI:
6184
6240
  CRYPTO_BTC = "bc1q9k4hvd6c2g8l9w3z7v8f2k3j5l8n9m1p4q7r0s"
6185
6241
  REPO_URL = "https://github.com/toprakahmetaydogmus/TZeroAlgorithm"
6186
6242
  BIO_URL = "https://hopp.bio/siberegitim"
6187
- CURRENT_VERSION = "12.0.0"
6243
+ from tzero import __version__ as CURRENT_VERSION
6188
6244
 
6189
6245
  dialog = tk.Toplevel(self.root)
6190
6246
  dialog.title(f"T-Zero v{CURRENT_VERSION} — Destek & Sürüm Merkezi")
@@ -6277,7 +6333,7 @@ class AutoReadmeGUI:
6277
6333
  from tzero.tzero_traffic import REPO_URL, CURRENT_VERSION
6278
6334
  except Exception:
6279
6335
  REPO_URL = "https://github.com/toprakahmetaydogmus/TZeroAlgorithm"
6280
- CURRENT_VERSION = "12.1.4"
6336
+ from tzero import __version__ as CURRENT_VERSION
6281
6337
 
6282
6338
  # On first launch, automatically open the GitHub repo in browser and ask to star!
6283
6339
  first_launch = not profile.get("first_launch_repo_opened_v12", False)
@@ -6289,8 +6345,21 @@ class AutoReadmeGUI:
6289
6345
  except Exception:
6290
6346
  pass
6291
6347
 
6348
+ stats = dict(getattr(self, "community_stats", {}) or {})
6349
+ stars = int(stats.get("stars", 111))
6350
+ target_stars = int(stats.get("target_stars", 250))
6351
+ pct_ratio = max(0.05, min(1.0, stars / max(1, target_stars)))
6352
+ pct_int = int(round(pct_ratio * 100))
6353
+ dl_label = str(stats.get("downloads_label", "22,900+"))
6354
+ saved_label = str(stats.get("saved_tokens_label", "1,120,000+"))
6355
+
6292
6356
  dialog = tk.Toplevel(self.root)
6293
- dialog_title = f"⭐ T-Zero v{CURRENT_VERSION} — Lütfen Star Verin!" if first_launch else f"⭐ T-Zero v{CURRENT_VERSION} — 100 Yıldız Hedefi!"
6357
+ if siber_akademi_icon:
6358
+ try:
6359
+ siber_akademi_icon.apply_window_icon(dialog)
6360
+ except Exception:
6361
+ pass
6362
+ dialog_title = f"⭐ T-Zero v{CURRENT_VERSION} — Lütfen Star Verin!" if first_launch else f"⭐ T-Zero v{CURRENT_VERSION} — {target_stars} Yıldız Hedefi!"
6294
6363
  dialog.title(dialog_title)
6295
6364
  dialog.geometry("560x430")
6296
6365
  dialog.configure(bg=PALETTE["bg_start"])
@@ -6306,61 +6375,75 @@ class AutoReadmeGUI:
6306
6375
  header_text = (
6307
6376
  "🚀 TARAYICINIZDA GITHUB AÇILDI: LÜTFEN STAR VERİN! ⭐"
6308
6377
  if first_launch
6309
- else "⭐ 100 YILDIZ HEDEFİ: TOPLULUĞA KATILIN!"
6378
+ else f"⭐ {target_stars} YILDIZ HEDEFİ: TOPLULUĞA KATILIN!"
6310
6379
  )
6311
- tk.Label(
6380
+ hdr_lbl = tk.Label(
6312
6381
  h_frame,
6313
6382
  text=header_text,
6314
6383
  font=("Segoe UI", 12, "bold"),
6315
6384
  fg=PALETTE.get("warning", "#fbbf24"),
6316
6385
  bg=PALETTE["bg_start"]
6317
- ).pack(side=tk.LEFT)
6386
+ )
6387
+ hdr_lbl.pack(side=tk.LEFT)
6318
6388
 
6319
6389
  # Stats Badge
6320
6390
  stats_frame = tk.Frame(pad, bg=PALETTE["card_bg"], highlightthickness=1, highlightbackground=PALETTE["card_border"], padx=14, pady=10)
6321
6391
  stats_frame.pack(fill=tk.X, pady=(0, 12))
6322
- tk.Label(
6392
+ stats_lbl = tk.Label(
6323
6393
  stats_frame,
6324
- text="🚀 20,880+ İndirme (PyPI & npm) | ⚡ 1,120,000+ Kurtarılan Token\n⭐ Mevcut Yıldız: 45 / 100 Hedef (İlerleme: %45)",
6394
+ text=f"🚀 {dl_label} İndirme (PyPI & npm) | ⚡ {saved_label} Kurtarılan Token\n⭐ Mevcut Yıldız: {stars} / {target_stars} Hedef (İlerleme: %{pct_int})",
6325
6395
  font=("Segoe UI", 9, "bold"),
6326
6396
  fg=PALETTE.get("accent_cyan", "#38bdf8"),
6327
6397
  bg=PALETTE["card_bg"],
6328
6398
  justify=tk.CENTER
6329
- ).pack()
6399
+ )
6400
+ stats_lbl.pack()
6330
6401
 
6331
6402
  # Visual Progress Bar
6332
6403
  bar_container = tk.Frame(pad, bg=PALETTE["card_border"], height=14)
6333
6404
  bar_container.pack(fill=tk.X, pady=(0, 14))
6334
6405
  bar_container.pack_propagate(False)
6335
- bar_fill = tk.Frame(bar_container, bg=PALETTE.get("warning", "#fbbf24"), width=int(508 * 0.45), height=14)
6336
- bar_fill.place(x=0, y=0, relheight=1.0, relwidth=0.45)
6406
+ bar_fill = tk.Frame(bar_container, bg=PALETTE.get("warning", "#fbbf24"), width=int(508 * pct_ratio), height=14)
6407
+ bar_fill.place(x=0, y=0, relheight=1.0, relwidth=pct_ratio)
6337
6408
 
6338
6409
  # Message
6339
- if first_launch:
6340
- msg = (
6341
- "Merhaba! Ben Toprak Ahmet Aydoğmuş (Siber Akademi).\n"
6342
- "T-Zero'yu başlattığınız için GitHub depomuz tarayıcınızda açıldı!\n\n"
6343
- "Projemizin bağımsız kalabilmesi ve herkese %100 BEDAVA sunulabilmesi için\n"
6344
- "lütfen açılan GitHub sayfasında sağ üstteki ★ STAR butonuna tıklayarak\n"
6345
- "projemize destek olun! ⭐ (100 Yıldız Hedefi: 45/100)\n\n"
6346
- "Yıldızınız projemizin büyümesi ve daha fazla geliştiriciye ulaşması için çok değerli!"
6347
- )
6348
- else:
6349
- msg = (
6410
+ def _build_star_msg(cur_s: int, tgt_s: int) -> str:
6411
+ if first_launch:
6412
+ return (
6413
+ "Merhaba! Ben Toprak Ahmet Aydoğmuş (Siber Akademi).\n"
6414
+ "T-Zero'yu başlattığınız için GitHub depomuz tarayıcınızda açıldı!\n\n"
6415
+ "Projemizin bağımsız kalabilmesi ve herkese %100 BEDAVA sunulabilmesi için\n"
6416
+ "lütfen açılan GitHub sayfasında sağ üstteki ★ STAR butonuna tıklayarak\n"
6417
+ f"projemize destek olun! ⭐ ({tgt_s} Yıldız Hedefi: {cur_s}/{tgt_s})\n\n"
6418
+ "Yıldızınız projemizin büyümesi ve daha fazla geliştiriciye ulaşması için çok değerli!"
6419
+ )
6420
+ return (
6350
6421
  "Merhaba! Ben Toprak Ahmet Aydoğmuş (Siber Akademi).\n"
6351
6422
  "T-Zero'yu yapay zeka araçlarındaki token maliyetini ve context israfını\n"
6352
6423
  "önlemek için sıfırdan geliştirdim ve herkese %100 BEDAVA sunuyorum.\n\n"
6353
6424
  "Projemizin bağımsız kalabilmesi ve daha fazla geliştiriciye ulaşabilmesi için\n"
6354
6425
  "GitHub depomuza vereceğiniz TEK BİR YILDIZ çok büyük bir fark yaratıyor!"
6355
6426
  )
6356
- tk.Label(
6427
+
6428
+ msg = _build_star_msg(stars, target_stars)
6429
+ msg_lbl = tk.Label(
6357
6430
  pad,
6358
6431
  text=msg,
6359
6432
  font=("Segoe UI", 9),
6360
6433
  fg=PALETTE["text_main"],
6361
6434
  bg=PALETTE["bg_start"],
6362
6435
  justify=tk.LEFT
6363
- ).pack(anchor=tk.W, pady=(0, 16))
6436
+ )
6437
+ msg_lbl.pack(anchor=tk.W, pady=(0, 16))
6438
+ self._star_dialog_widgets = {
6439
+ "dialog": dialog,
6440
+ "hdr_lbl": hdr_lbl,
6441
+ "stats_lbl": stats_lbl,
6442
+ "bar_fill": bar_fill,
6443
+ "msg_lbl": msg_lbl,
6444
+ "first_launch": first_launch,
6445
+ "build_msg": _build_star_msg,
6446
+ }
6364
6447
 
6365
6448
  # Star Action Button (Big Golden Button)
6366
6449
  def on_star_click():
@@ -7661,32 +7744,21 @@ Custom Requirements:
7661
7744
  generator = ContextGenerator(self.cancel_event)
7662
7745
  target_dir = self.dir_entry.get().strip() or os.getcwd()
7663
7746
 
7664
- # If commercial provider has no key at all, skip doomed HTTP failure and auto-heal immediately!
7665
- if not key and p.name not in ("Free AI Cloud (No Key Required)", "Local Ollama"):
7666
- self.log(f"Harici API anahtarı girilmedi ({provider_name}). Otomatik Siber Free AI Cloud ve Yerel AST Motoruna aktarılıyor...")
7667
- free_p = FreePollinationsProvider()
7668
- free_url = f"{free_p.get_base_url().rstrip('/')}/chat/completions"
7669
- free_headers = free_p.get_headers("")
7747
+ # If commercial provider has no key at all, stay strictly local via the AST engine (no cloud fallback)
7748
+ if not key and p.name != "Local Ollama":
7749
+ self.log(
7750
+ f"Harici API anahtarı girilmedi ({provider_name}). Veriler dışarı gönderilmeden Yerel Çevrimdışı AST Motoru çalıştırılıyor..."
7751
+ )
7670
7752
  try:
7671
- content = generator.generate_readme(
7672
- free_url, "", free_headers, "openai", messages, update_prog, provider=free_p, timeout=12
7673
- )
7674
- self.log("Canlı AI mimari analizi Ücretsiz Siber AI Cloud ile başarıyla üretildi.")
7675
- self.safe_after(0, lambda: self.on_gen_success(content))
7676
- self.safe_after(0, lambda: self.show_toast(
7677
- "⚡ API anahtarı gerekmeden Ücretsiz Siber AI Cloud ile canlı bağlam üretildi!",
7678
- "info"
7679
- ))
7680
- return
7681
- except Exception as free_err:
7682
- self.log(f"Ücretsiz Bulut yanıt vermedi ({free_err}). Yerel Çevrimdışı AST Motoru (%100 Ücretsiz & Sıfır Sızıntı) çalıştırılıyor...")
7683
7753
  offline_content = generate_offline_context(target_dir, selected_files, self.file_snippets)
7684
7754
  self.safe_after(0, lambda: self.on_gen_success(offline_content))
7685
7755
  self.safe_after(0, lambda: self.show_toast(
7686
- "⚡ Yerel Çevrimdışı AST Motoru (%100 Ücretsiz & Sıfır Sızıntı) ile eksiksiz bağlam derlendi!",
7756
+ "⚡ API anahtarı olmadan Yerel Çevrimdışı AST Motoru ile eksiksiz bağlam derlendi!",
7687
7757
  "success"
7688
7758
  ))
7689
- return
7759
+ except Exception as offline_err:
7760
+ self.safe_after(0, lambda msg=f"Offline Error: {offline_err}": self.on_gen_fail(msg))
7761
+ return
7690
7762
 
7691
7763
  headers = p.get_headers(key)
7692
7764
  try:
@@ -7701,24 +7773,7 @@ Custom Requirements:
7701
7773
  raw_err = str(e)
7702
7774
  clean_err = re.sub(r'(Bearer\s+|key[:=]\s*)[A-Za-z0-9_\-\.]{8,}', r'\1[PROTECTED]', raw_err)
7703
7775
  self.log(f"Uzak API yanıtı: {clean_err}")
7704
- self.log("Otomatik İyileştirme Devrede: Siber Free AI Cloud & Yerel AST Motoruna aktarılıyor...")
7705
- try:
7706
- free_p = FreePollinationsProvider()
7707
- free_url = f"{free_p.get_base_url().rstrip('/')}/chat/completions"
7708
- free_headers = free_p.get_headers("")
7709
- content = generator.generate_readme(
7710
- free_url, "", free_headers, "openai", messages, update_prog, provider=free_p, timeout=12
7711
- )
7712
- self.log("Canlı AI mimari analizi Ücretsiz Siber AI Cloud ile başarıyla tamamlandı.")
7713
- self.safe_after(0, lambda: self.on_gen_success(content))
7714
- self.safe_after(0, lambda: self.show_toast(
7715
- "⚡ Harici API bağlantısı yerine Ücretsiz Siber AI Cloud ile canlı bağlam üretildi!",
7716
- "info"
7717
- ))
7718
- return
7719
- except Exception as free_err:
7720
- clean_free_err = re.sub(r'(Bearer\s+|key[:=]\s*)[A-Za-z0-9_\-\.]{8,}', r'\1[PROTECTED]', str(free_err))
7721
- self.log(f"Ücretsiz Bulut yanıt vermedi ({clean_free_err}). Yerel Çevrimdışı AST Motoru devrede (%100 Free & Sıfır Sızıntı)...")
7776
+ self.log("Başka bir bulut sağlayıcıya yönlendirilmeden Yerel Çevrimdışı AST Motoru devrede...")
7722
7777
 
7723
7778
  try:
7724
7779
  offline_content = generate_offline_context(target_dir, selected_files, self.file_snippets)
@@ -8273,7 +8328,7 @@ Custom Requirements:
8273
8328
  else:
8274
8329
  args = ", ".join(item["args"])
8275
8330
  self.ast_tree.insert(file_node, "end", text=f"⚙ def {item['name']}({args})")
8276
- except Exception as e:
8331
+ except Exception:
8277
8332
  # Fallback to simple label
8278
8333
  file_node = self.ast_tree.insert("", "end", text=f"📄 {os.path.basename(filepath)} (AST Fail)")
8279
8334
 
@@ -8289,6 +8344,49 @@ Custom Requirements:
8289
8344
  break
8290
8345
  threading.Thread(target=telemetry, daemon=True).start()
8291
8346
 
8347
+ def _apply_live_community_stats(self, stats: Dict[str, Any]):
8348
+ """Apply live GitHub star and registry download counts to header & open dialog."""
8349
+ if not stats:
8350
+ return
8351
+ self.community_stats = stats
8352
+ stars = int(stats.get("stars", 111))
8353
+ target_stars = int(stats.get("target_stars", 250))
8354
+ pct_ratio = max(0.05, min(1.0, stars / max(1, target_stars)))
8355
+ pct_int = int(round(pct_ratio * 100))
8356
+ dl_label = str(stats.get("downloads_label", "22,900+"))
8357
+ saved_label = str(stats.get("saved_tokens_label", "1,120,000+"))
8358
+
8359
+ try:
8360
+ if hasattr(self, "star_header_btn") and self.star_header_btn.winfo_exists():
8361
+ self.star_header_btn.set_text(f"★ STAR ({stars}★)")
8362
+ except Exception:
8363
+ pass
8364
+
8365
+ w = getattr(self, "_star_dialog_widgets", {}) or {}
8366
+ dlg = w.get("dialog")
8367
+ try:
8368
+ if dlg and dlg.winfo_exists():
8369
+ if not w.get("first_launch"):
8370
+ w["hdr_lbl"].config(text=f"⭐ {target_stars} YILDIZ HEDEFİ: TOPLULUĞA KATILIN!")
8371
+ w["stats_lbl"].config(
8372
+ text=f"🚀 {dl_label} İndirme (PyPI & npm) | ⚡ {saved_label} Kurtarılan Token\n⭐ Mevcut Yıldız: {stars} / {target_stars} Hedef (İlerleme: %{pct_int})"
8373
+ )
8374
+ w["bar_fill"].place_configure(relwidth=pct_ratio)
8375
+ w["msg_lbl"].config(text=w["build_msg"](stars, target_stars))
8376
+ except Exception:
8377
+ pass
8378
+
8379
+ def start_community_stats_refresh(self):
8380
+ """Fetch live GitHub star count and download stats asynchronously without blocking UI."""
8381
+ def _worker():
8382
+ try:
8383
+ from tzero.tzero_growth import get_live_community_stats
8384
+ stats = get_live_community_stats(timeout=3.0, force_refresh=True, include_downloads=True)
8385
+ self.safe_after(0, lambda s=stats: self._apply_live_community_stats(s))
8386
+ except Exception:
8387
+ pass
8388
+ threading.Thread(target=_worker, daemon=True).start()
8389
+
8292
8390
 
8293
8391
  # --- 14. STARTUP ORCHESTRATION & CLI WIZARD ---
8294
8392
 
@@ -8377,7 +8475,7 @@ def launch_gui():
8377
8475
  except Exception:
8378
8476
  pass
8379
8477
 
8380
- app = AutoReadmeGUI(root)
8478
+ AutoReadmeGUI(root)
8381
8479
  root.mainloop()
8382
8480
 
8383
8481
 
@@ -8549,8 +8647,12 @@ def run_pr_report_cli(target_dir: str, base_ref: str = "HEAD~1"):
8549
8647
  analyzer = ChangeImpactAnalyzer(target_dir)
8550
8648
  impact_items = []
8551
8649
  for f in modified_files:
8650
+ if len(impact_items) >= 10:
8651
+ break
8552
8652
  symbols = analyzer.extract_symbols_from_file(f)
8553
8653
  for s in symbols[:3]:
8654
+ if len(impact_items) >= 10:
8655
+ break
8554
8656
  imp = analyzer.analyze_symbol(s)
8555
8657
  impact_items.append((s, imp["score"], imp["dependents_count"], imp["risk_level"]))
8556
8658
 
@@ -8650,7 +8752,6 @@ def run_review_cli(target_dir: str = ".", ref: str = "auto") -> bool:
8650
8752
  added_code_lines.append(content)
8651
8753
 
8652
8754
  full_added_text = "\n".join(added_lines)
8653
- full_added_code = "\n".join(added_code_lines)
8654
8755
 
8655
8756
  sec_findings = ZeroLeakEngine.scan_text(full_added_text)
8656
8757
 
@@ -9298,13 +9399,30 @@ def main():
9298
9399
 
9299
9400
  # Fast path for Anti-REA armor / protection
9300
9401
  if len(sys.argv) > 1 and sys.argv[1].lower() in ("armor", "anti-rea", "--armor", "--anti-rea"):
9402
+ extra_args = sys.argv[2:]
9403
+ if any(flag in ("-h", "--help") for flag in extra_args):
9404
+ print("Usage: tzero armor [TARGET_PATH] [--audit]")
9405
+ print(" Protect source files against AI reverse engineering (180-Tier TDQS-REA Armor).")
9406
+ print(" --audit, -a Audit AI decompilation resistance without modifying files.")
9407
+ sys.exit(0)
9408
+ target_path = next((a for a in extra_args if not a.startswith("-")), ".")
9409
+ out_path = None
9410
+ for idx_a, a in enumerate(extra_args):
9411
+ if a in ("-o", "--output", "--out") and idx_a + 1 < len(extra_args):
9412
+ out_path = extra_args[idx_a + 1]
9413
+ break
9414
+ if any(flag in ("--audit", "-a") for flag in extra_args):
9415
+ from tzero.tzero_armor import audit_path_rea_resistance
9416
+ audit = audit_path_rea_resistance(target_path)
9417
+ print(json.dumps(audit, indent=2))
9418
+ sys.exit(0 if "error" not in audit else 1)
9301
9419
  from tzero.tzero_armor import protect_path_with_armor
9302
- target_path = sys.argv[2] if len(sys.argv) > 2 and not sys.argv[2].startswith("-") else "."
9303
- res = protect_path_with_armor(target_path)
9420
+ res = protect_path_with_armor(target_path, output_path=out_path)
9304
9421
  if res.get("success"):
9305
9422
  print(f"[OK] Applied Anti-REA Armor to: {target_path}")
9306
9423
  if "score_after" in res:
9307
- print(f" AI Resistance Score: {res.get('score_before')}/100 -> {res.get('score_after')}/100 [{res.get('rating')}]")
9424
+ print(f" AI Resistance Score: {res.get('score_before')}/100 -> {res.get('score_after')}/100 [{res.get('tier_rating', res.get('rating'))}]")
9425
+ 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)")
9308
9426
  elif "files_protected" in res:
9309
9427
  print(f" Protected {res['files_protected']} files in directory.")
9310
9428
  else:
@@ -9316,16 +9434,24 @@ def main():
9316
9434
  from tzero.tzero_armor import audit_path_rea_resistance
9317
9435
  target_path = sys.argv[2] if len(sys.argv) > 2 and not sys.argv[2].startswith("-") else "."
9318
9436
  audit = audit_path_rea_resistance(target_path)
9437
+ if audit.get("error"):
9438
+ print(f"[ERROR] {audit['error']}", file=sys.stderr)
9439
+ sys.exit(1)
9319
9440
  print("================================================================================")
9320
9441
  print(" SHIELD AUDIT REPORT: AI REVERSE-ENGINEERING RESISTANCE (TDQS-REA)")
9321
9442
  print("================================================================================")
9322
9443
  print(f"Target: {target_path}")
9323
- print(f"AI Score: {audit.get('score', 0)} / 100 [{audit.get('rating', 'UNKNOWN')}]")
9444
+ print(f"AI Score: {audit.get('score', 0)} / 100 [{audit.get('tier_rating', audit.get('rating', 'UNVERIFIED'))}]")
9445
+ if "tiers_total" in audit:
9446
+ 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)")
9447
+ print(f"Score Basis: {audit.get('score_kind', 'static_textual_indicator')}")
9324
9448
  print(f"Status: {audit.get('status', 'N/A')}")
9325
9449
  if audit.get("defenses_active"):
9326
9450
  print("\nActive Defenses:")
9327
9451
  for k, v in audit["defenses_active"].items():
9328
9452
  print(f" [{'✔' if v else ' '}] {k}")
9453
+ if audit.get("unverified_layers"):
9454
+ print(f"\nUnverified Layers (not measured statically): {', '.join(audit['unverified_layers'])}")
9329
9455
  recs = audit.get("sample_findings") or audit.get("findings", [])
9330
9456
  if recs:
9331
9457
  print("\nRecommendations:")
@@ -9351,6 +9477,18 @@ def main():
9351
9477
 
9352
9478
  # Fast path for Anti-REA radar / gui
9353
9479
  if len(sys.argv) > 1 and sys.argv[1].lower() in ("radar", "--radar", "anti-rea-gui"):
9480
+ radar_args = sys.argv[2:]
9481
+ if any(a in ("-h", "--help") for a in radar_args):
9482
+ print("Usage: tzero radar [PATH | --audit PATH | --armor PATH]\n"
9483
+ "Launch Anti-REA Radar GUI or run headless Anti-REA audit/armor on a target path.")
9484
+ sys.exit(0)
9485
+ if radar_args:
9486
+ from tzero.tzero_armor import audit_path_rea_resistance, protect_path_with_armor
9487
+ mode_armor = "--armor" in radar_args
9488
+ target = next((a for a in radar_args if not a.startswith("-")), ".")
9489
+ res = protect_path_with_armor(target) if mode_armor else audit_path_rea_resistance(target)
9490
+ print(json.dumps(res, indent=2))
9491
+ sys.exit(0 if res.get("success", True) else 1)
9354
9492
  try:
9355
9493
  from tzero.anti_rea.gui import main as gui_main
9356
9494
  gui_main()
@@ -9378,6 +9516,7 @@ def main():
9378
9516
  parser.add_argument("--cli", "-c", action="store_true", help="Run interactive guided terminal wizard")
9379
9517
  parser.add_argument("--install-ide", "--install-mcp", nargs="?", const="all", default=None, metavar="CLIENT", dest="install_ide", help="1-Click MCP installer for Cursor, Claude, Windsurf, Antigravity, VS Code, etc. (e.g. --install-ide cursor, --install-ide all)")
9380
9518
  parser.add_argument("--scan", "-s", nargs="?", const=".", default=None, metavar="DIR", help="Scan codebase directory and print summary metrics")
9519
+ parser.add_argument("--tree", "--context", nargs="?", const=".", default=None, metavar="DIR", dest="tree", help="Generate complete AST skeleton context tree offline")
9381
9520
  parser.add_argument("--watch", "-w", nargs="?", const=".", default=None, metavar="DIR", help="Continuous background AST context watcher (auto-reindexes on file save for Cursor/Claude)")
9382
9521
  parser.add_argument("--audit", "-a", nargs="?", const=".", default=None, metavar="DIR", help="Run AST static code analysis & audit for code smells")
9383
9522
  parser.add_argument("--dry-run", "-d", action="store_true", help="Generate complete context tree offline without API call (100%% free)")
@@ -9386,7 +9525,7 @@ def main():
9386
9525
  parser.add_argument("--export-repomap", nargs="?", const="REPO_MAP.txt", default=None, metavar="FILE", help="Generate compact token repository map (REPO_MAP.txt)")
9387
9526
  parser.add_argument("--export-html", nargs="?", const="README.html", default=None, metavar="FILE", help="Generate styled dark-mode HTML architecture preview")
9388
9527
  parser.add_argument("--dir", default=".", help="Target project workspace directory (default: current dir)")
9389
- parser.add_argument("--output", "-o", default="README.md", help="Output filepath for generated markdown (default: README.md)")
9528
+ parser.add_argument("--output", "--out", "-o", default="README.md", dest="output", help="Output filepath for generated markdown (default: README.md)")
9390
9529
  parser.add_argument("--force", action="store_true", help="Allow the guided context wizard to overwrite an existing output file")
9391
9530
  parser.add_argument("--provider", "-p", choices=list(PROVIDERS.keys()), help="AI Provider to use (default: active profile)")
9392
9531
  parser.add_argument("--impact", metavar="SYMBOL", help="Analyze blast radius and change impact for a symbol")
@@ -9433,7 +9572,7 @@ def main():
9433
9572
  parser.add_argument("--fuzzy", action="store_true", default=True, help="Enable fuzzy AST and whitespace matching for patch application (default: True)")
9434
9573
  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)")
9435
9574
  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)")
9436
- parser.add_argument("--telemetry", action="store_true", help="Show offline SQLite token savings & ROI telemetry report")
9575
+ parser.add_argument("--telemetry", nargs="?", const=".", default=None, metavar="DIR", help="Show offline SQLite token savings & ROI telemetry report")
9437
9576
  parser.add_argument("--no-fuzzy", dest="fuzzy", action="store_false", help="Disable fuzzy matching and enforce exact line matches only")
9438
9577
  parser.add_argument("--dry-run-patch", action="store_true", help="Validate patch applicability without modifying files on disk")
9439
9578
  parser.add_argument("--reverse-patch", action="store_true", help="Un-apply / revert patch changes")
@@ -9453,7 +9592,7 @@ def main():
9453
9592
  default="o200k_base", help="BPE encoding for --symbol-context")
9454
9593
  parser.add_argument("--cache-aligned", action="store_true", help="Order context for KV-cache prefix stability (immutable static prefix before dynamic query suffix)")
9455
9594
  parser.add_argument("--commit-msg", action="store_true", help="Generate Conventional Commit message from local AST git diff ($0 local engine)")
9456
- parser.add_argument("--changelog", nargs="?", const="v12.2.1", default=None, metavar="VERSION", help="Generate release CHANGELOG markdown from git history")
9595
+ parser.add_argument("--changelog", nargs="?", const="v12.3.2", default=None, metavar="VERSION", help="Generate release CHANGELOG markdown from git history")
9457
9596
  parser.add_argument("--ci", choices=["github", "gitlab", "pre-commit", "local", "all"], default=None, help="Install CI/CD workflow or run local verification suite")
9458
9597
  parser.add_argument("--local-ci", action="store_true", help="Run comprehensive Local CI & Pre-Push verification battery ($0 quota burn)")
9459
9598
  parser.add_argument("--quick-ci", action="store_true", help="Run fast Local CI smoke checks in seconds")
@@ -9517,7 +9656,7 @@ def main():
9517
9656
  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")
9518
9657
  parser.add_argument("--showcase", nargs="?", const="tzero_showcase.html", default=None, metavar="FILE", help="Generate interactive split-screen HTML5 comparison showcase slider")
9519
9658
  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")
9520
- parser.add_argument("--version", "-v", action="version", version="T-Zero Context Architect v12.2.1 Master Edition (engine v4.1.0)")
9659
+ parser.add_argument("--version", "-v", action="version", version="T-Zero Context Architect v12.3.2 Master Edition (engine v4.1.0)")
9521
9660
 
9522
9661
 
9523
9662
  def print_master_tutorial():
@@ -9626,7 +9765,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
9626
9765
  def print_quickstart_guide():
9627
9766
  print("""
9628
9767
  ================================================================================
9629
- ⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.2.1 MASTER (engine v4.1.0)
9768
+ ⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.3.2 MASTER (engine v4.1.0)
9630
9769
  ================================================================================
9631
9770
  🎯 %95'e Varan Token Tasarrufu & Otonom Yapay Zeka Mimari Bağlam Motoru
9632
9771
 
@@ -9837,8 +9976,13 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
9837
9976
  run_system_disk_doctor(clean=True, workspace_dir=args.dir)
9838
9977
  return
9839
9978
  elif getattr(args, "armor", None):
9979
+ if getattr(args, "audit", None) is not None:
9980
+ from tzero.tzero_armor import audit_path_rea_resistance
9981
+ audit = audit_path_rea_resistance(args.armor)
9982
+ print(json.dumps(audit, indent=2))
9983
+ return
9840
9984
  from tzero.tzero_armor import protect_path_with_armor
9841
- res = protect_path_with_armor(args.armor)
9985
+ res = protect_path_with_armor(args.armor, output_path=getattr(args, "output", None))
9842
9986
  if res.get("success"):
9843
9987
  print(f"[OK] Applied Anti-REA Armor to: {args.armor}")
9844
9988
  if "score_after" in res:
@@ -9853,10 +9997,10 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
9853
9997
  from tzero.tzero_armor import audit_path_rea_resistance
9854
9998
  audit = audit_path_rea_resistance(args.audit_rea)
9855
9999
  print(json.dumps(audit, indent=2))
9856
- return
9857
- elif getattr(args, "telemetry", False):
10000
+ sys.exit(1 if audit.get("error") else 0)
10001
+ elif getattr(args, "telemetry", None) is not None:
9858
10002
  from tzero.tzero_telemetry import get_summary, render_report
9859
- ws_dir = getattr(args, "dir", ".") or "."
10003
+ ws_dir = args.telemetry if args.telemetry != "." else (getattr(args, "dir", ".") or ".")
9860
10004
  if getattr(args, "format", "text") == "json":
9861
10005
  print(json.dumps(get_summary(workspace_dir=ws_dir), indent=2))
9862
10006
  else:
@@ -10600,7 +10744,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
10600
10744
  if not os.path.exists(app_path):
10601
10745
  app_path = os.path.join(os.getcwd(), "huggingface-space", "app.py")
10602
10746
  print("\033[36m" + "=" * 80)
10603
- print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.2.1)")
10747
+ print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.3.2)")
10604
10748
  print("=" * 80 + "\033[0m")
10605
10749
  print("🌐 Official Live Space : https://huggingface.co/spaces/toprakke4/tzero-token-reducer")
10606
10750
  print(f"📁 Local Application : {app_path}")
@@ -10626,20 +10770,28 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
10626
10770
  elif getattr(args, "vault", None) is not None:
10627
10771
  from tzero.tzero_security import ZeroLeakEngine
10628
10772
  target = args.vault or args.dir
10773
+ if not os.path.exists(target):
10774
+ print(f"[AUTO-VAULT ERROR] Target path not found: {target}", file=sys.stderr)
10775
+ sys.exit(1)
10776
+ proj_root = ZeroLeakEngine.resolve_project_root(target)
10777
+ env_path = os.path.join(proj_root, ".env")
10778
+ gi_path = os.path.join(proj_root, ".gitignore")
10629
10779
  if os.path.isfile(target):
10630
10780
  with open(target, "r", encoding="utf-8", errors="ignore") as f:
10631
10781
  c = f.read()
10632
10782
  migrated_code, env_file, count, report = ZeroLeakEngine.auto_migrate_to_env(
10633
- c,
10634
- env_file_path=".env" if args.migrate else None,
10635
- gitignore_path=".gitignore" if args.migrate else None
10783
+ c, env_file_path=env_path, gitignore_path=gi_path, dry_run=True
10636
10784
  )
10637
10785
  if args.migrate:
10638
- with open(target, "w", encoding="utf-8") as f:
10639
- f.write(migrated_code)
10640
- print(f"[AUTO-VAULT] Successfully migrated {count} secret(s) into .env and updated code.")
10786
+ res = ZeroLeakEngine.migrate_files_atomically([target], env_file_path=env_path, gitignore_path=gi_path)
10787
+ if not res.get("success"):
10788
+ print(f"[AUTO-VAULT ERROR] Migration aborted safely (files preserved): {res.get('error')}", file=sys.stderr)
10789
+ sys.exit(1)
10790
+ if res.get("warning"):
10791
+ print(f"[AUTO-VAULT WARNING] {res['warning']}", file=sys.stderr)
10792
+ print(f"[AUTO-VAULT] Successfully migrated {res.get('migrated_count', 0)} secret(s) into {env_path} and updated code.")
10641
10793
  else:
10642
- print(f"[AUTO-VAULT DRY-RUN] Detected {count} hardcoded credential(s) ready for .env migration. Re-run with --migrate to apply.")
10794
+ print(f"[AUTO-VAULT DRY-RUN] Detected {count} hardcoded credential(s) ready for {env_path} migration. Re-run with --migrate to apply.")
10643
10795
  else:
10644
10796
  findings = ZeroLeakEngine.scan_workspace(target)
10645
10797
  violations = findings.get("violations", [])
@@ -10651,21 +10803,18 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
10651
10803
  for idx, _ in enumerate(violations, 1):
10652
10804
  print(f" - [FINDING #{idx}] Credential pattern detected (redacted).")
10653
10805
  if args.migrate:
10654
- total_migrated = 0
10655
- violating_files = sorted({v.get("file", "") for v in violations if v.get("file")})
10656
- for vf in violating_files:
10657
- if os.path.isfile(vf):
10658
- with open(vf, "r", encoding="utf-8", errors="ignore") as f:
10659
- sc = f.read()
10660
- mc, ef, c_cnt, _ = ZeroLeakEngine.auto_migrate_to_env(
10661
- sc,
10662
- env_file_path=os.path.join(target, ".env"),
10663
- gitignore_path=os.path.join(target, ".gitignore")
10664
- )
10665
- with open(vf, "w", encoding="utf-8") as f:
10666
- f.write(mc)
10667
- total_migrated += c_cnt
10668
- print(f"[AUTO-VAULT] Successfully secured and migrated {total_migrated} secret(s) into {os.path.join(target, '.env')}.")
10806
+ violating_files = sorted({v.get("file", "") for v in violations if v.get("file") and os.path.isfile(v.get("file", ""))})
10807
+ res = ZeroLeakEngine.migrate_files_atomically(
10808
+ violating_files,
10809
+ env_file_path=os.path.join(target, ".env"),
10810
+ gitignore_path=os.path.join(target, ".gitignore"),
10811
+ )
10812
+ if not res.get("success"):
10813
+ print(f"[AUTO-VAULT ERROR] Migration aborted cleanly (all files preserved): {res.get('error')}", file=sys.stderr)
10814
+ sys.exit(1)
10815
+ if res.get("warning"):
10816
+ print(f"[AUTO-VAULT WARNING] {res['warning']}", file=sys.stderr)
10817
+ print(f"[AUTO-VAULT] Successfully secured and migrated {res.get('migrated_count', 0)} secret(s) into {os.path.join(target, '.env')}.")
10669
10818
  else:
10670
10819
  print("\n[TIP] Run with --migrate to automatically extract these secrets into .env and refactor source files.")
10671
10820
  sys.exit(0)
@@ -10746,6 +10895,8 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
10746
10895
  run_export_cli(args.dir, "repomap", args.export_repomap)
10747
10896
  elif args.export_html is not None:
10748
10897
  run_export_cli(args.dir, "html", args.export_html)
10898
+ elif getattr(args, "tree", None) is not None:
10899
+ run_dry_run_cli(args.tree or args.dir, args.output, args.force)
10749
10900
  elif args.dry_run:
10750
10901
  run_dry_run_cli(args.dir, args.output, args.force)
10751
10902
  elif args.cli: