tzero-mcp 12.3.5 → 12.3.7
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/README.md +32 -21
- package/package.json +1 -1
- package/src/addmcp.py +2 -2
- package/src/app.py +1 -1
- package/src/tzero/__init__.py +8 -1
- package/src/tzero/tzero_agency.py +2574 -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 +51 -4
- package/src/tzero/tzero_debt.py +1 -1
- package/src/tzero/tzero_explain.py +1 -1
- package/src/tzero/tzero_golden.py +2 -2
- package/src/tzero/tzero_growth.py +1 -1
- package/src/tzero/tzero_lsp.py +1 -1
- package/src/tzero/tzero_mcp.py +100 -96
- package/src/tzero/tzero_promo.py +1 -1
- package/src/tzero/tzero_task_benchmark.py +2 -2
- package/src/tzero/tzero_traffic.py +1 -1
- package/src/tzero/tzero_tui.py +2 -2
- package/src/tzero/tzero_v3.py +788 -387
- package/src/tzero/tzero_welcome.py +1 -1
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.7",
|
|
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.7",
|
|
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):
|
|
@@ -3473,6 +3400,11 @@ class WideSplineChartCard(LuxuryCard):
|
|
|
3473
3400
|
self.anim_task = None
|
|
3474
3401
|
self.c.bind("<Configure>", self._start_anim)
|
|
3475
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
|
+
|
|
3476
3408
|
def _start_anim(self, event=None):
|
|
3477
3409
|
self.anim_progress = 0.0
|
|
3478
3410
|
if self.anim_task:
|
|
@@ -3488,10 +3420,6 @@ class WideSplineChartCard(LuxuryCard):
|
|
|
3488
3420
|
self._draw()
|
|
3489
3421
|
self.anim_task = self.after(20, self._animate)
|
|
3490
3422
|
|
|
3491
|
-
leg = tk.Frame(self.inner, bg=self.card_bg)
|
|
3492
|
-
leg.pack(pady=(4, 0))
|
|
3493
|
-
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)
|
|
3494
|
-
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)
|
|
3495
3423
|
|
|
3496
3424
|
def _draw(self, event=None):
|
|
3497
3425
|
w = max(20, self.c.winfo_width())
|
|
@@ -4491,6 +4419,10 @@ class AdvancedTokenDistributionChart(tk.Canvas):
|
|
|
4491
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")
|
|
4492
4420
|
|
|
4493
4421
|
|
|
4422
|
+
def _run_desktop_git(args, **kwargs):
|
|
4423
|
+
return subprocess.run(args, creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), **kwargs)
|
|
4424
|
+
|
|
4425
|
+
|
|
4494
4426
|
class CustomChangelogManager:
|
|
4495
4427
|
"""Safely retrieves git log history and repository diffs asynchronously."""
|
|
4496
4428
|
def __init__(self, target_dir: str):
|
|
@@ -4502,7 +4434,7 @@ class CustomChangelogManager:
|
|
|
4502
4434
|
callback([])
|
|
4503
4435
|
return
|
|
4504
4436
|
try:
|
|
4505
|
-
res =
|
|
4437
|
+
res = _run_desktop_git(
|
|
4506
4438
|
["git", "rev-parse", "--is-inside-work-tree"],
|
|
4507
4439
|
cwd=self.target_dir,
|
|
4508
4440
|
capture_output=True,
|
|
@@ -4513,7 +4445,7 @@ class CustomChangelogManager:
|
|
|
4513
4445
|
callback([])
|
|
4514
4446
|
return
|
|
4515
4447
|
|
|
4516
|
-
res =
|
|
4448
|
+
res = _run_desktop_git(
|
|
4517
4449
|
["git", "log", "-n", "15", "--pretty=format:%s (%an)"],
|
|
4518
4450
|
cwd=self.target_dir,
|
|
4519
4451
|
capture_output=True,
|
|
@@ -4547,7 +4479,7 @@ class CustomChangelogManager:
|
|
|
4547
4479
|
def get_git_diff_async(self, callback: Callable) -> None:
|
|
4548
4480
|
def run_thread():
|
|
4549
4481
|
try:
|
|
4550
|
-
res =
|
|
4482
|
+
res = _run_desktop_git(
|
|
4551
4483
|
["git", "diff", "HEAD"],
|
|
4552
4484
|
cwd=self.target_dir,
|
|
4553
4485
|
capture_output=True,
|
|
@@ -4650,6 +4582,9 @@ class AutoReadmeGUI:
|
|
|
4650
4582
|
def __init__(self, root: tk.Tk):
|
|
4651
4583
|
self.root = root
|
|
4652
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)
|
|
4653
4588
|
|
|
4654
4589
|
# State parameters
|
|
4655
4590
|
self.scanned_files: List[str] = []
|
|
@@ -4723,66 +4658,35 @@ class AutoReadmeGUI:
|
|
|
4723
4658
|
self.load_saved_credentials()
|
|
4724
4659
|
self.setup_keyboard_shortcuts()
|
|
4725
4660
|
self.start_system_telemetry()
|
|
4726
|
-
self.start_community_stats_refresh()
|
|
4727
|
-
if "unittest" not in sys.modules:
|
|
4728
|
-
self.safe_after(1200, self.check_and_show_startup_popups)
|
|
4729
4661
|
|
|
4730
4662
|
def _attach_tooltip(self, widget, text: str):
|
|
4731
|
-
"""
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
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)
|
|
4735
4667
|
|
|
4736
|
-
def
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
return
|
|
4740
|
-
tw = tk.Toplevel(widget)
|
|
4741
|
-
tw.overrideredirect(True)
|
|
4742
|
-
tw.attributes("-topmost", True)
|
|
4743
|
-
x = widget.winfo_rootx() + widget.winfo_width() + 8
|
|
4744
|
-
y = widget.winfo_rooty() + max(0, (widget.winfo_height() - 24) // 2)
|
|
4745
|
-
tw.geometry(f"+{x}+{y}")
|
|
4746
|
-
lbl = tk.Label(
|
|
4747
|
-
tw,
|
|
4748
|
-
text=text,
|
|
4749
|
-
bg=PALETTE.get("card_bg", "#0f172a"),
|
|
4750
|
-
fg=PALETTE.get("text_main", "#f8fafc"),
|
|
4751
|
-
font=("Segoe UI", 8, "bold"),
|
|
4752
|
-
padx=9,
|
|
4753
|
-
pady=4,
|
|
4754
|
-
highlightthickness=1,
|
|
4755
|
-
highlightbackground=PALETTE.get("accent_cyan", "#38bdf8"),
|
|
4756
|
-
)
|
|
4757
|
-
lbl.pack()
|
|
4758
|
-
tip_win["w"] = tw
|
|
4759
|
-
except Exception:
|
|
4760
|
-
pass
|
|
4668
|
+
def clear_hint(_event):
|
|
4669
|
+
if hasattr(self, "status_hint_lbl"):
|
|
4670
|
+
self.status_hint_lbl.configure(text="")
|
|
4761
4671
|
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
if tw is not None:
|
|
4766
|
-
try:
|
|
4767
|
-
tw.destroy()
|
|
4768
|
-
except Exception:
|
|
4769
|
-
pass
|
|
4672
|
+
widget.bind("<Enter>", show_hint, add="+")
|
|
4673
|
+
widget.bind("<Leave>", clear_hint, add="+")
|
|
4674
|
+
widget.bind("<ButtonPress>", clear_hint, add="+")
|
|
4770
4675
|
|
|
4771
|
-
try:
|
|
4772
|
-
widget.bind("<Enter>", show_tip, add="+")
|
|
4773
|
-
widget.bind("<Leave>", hide_tip, add="+")
|
|
4774
|
-
widget.bind("<ButtonPress>", hide_tip, add="+")
|
|
4775
|
-
except Exception:
|
|
4776
|
-
pass
|
|
4777
|
-
|
|
4778
4676
|
def safe_after(self, ms: int, func, *args):
|
|
4779
|
-
""
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
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)
|
|
4786
4690
|
|
|
4787
4691
|
def setup_keyboard_shortcuts(self):
|
|
4788
4692
|
self.root.bind("<Control-s>", lambda e: self.run_scanner())
|
|
@@ -4814,7 +4718,7 @@ class AutoReadmeGUI:
|
|
|
4814
4718
|
|
|
4815
4719
|
# 7 Tabs with sleek icons
|
|
4816
4720
|
self.tabs = ["overview_tab", "selector_tab", "changelog_tab", "generate_tab", "template_tab", "graph_tab", "settings_tab"]
|
|
4817
|
-
self.tab_icons = ["
|
|
4721
|
+
self.tab_icons = ["⌂", "▤", "⑂", "▷", "◇", "▥", "⚙"]
|
|
4818
4722
|
self.tab_buttons: List[tk.Label] = []
|
|
4819
4723
|
self.tab_containers: List[tk.Frame] = []
|
|
4820
4724
|
self.nav_indicators: List[tk.Frame] = []
|
|
@@ -4870,7 +4774,7 @@ class AutoReadmeGUI:
|
|
|
4870
4774
|
|
|
4871
4775
|
# 2. TOP HEADER BAR
|
|
4872
4776
|
self.header = GlassCard(self.bg_canvas)
|
|
4873
|
-
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)
|
|
4874
4778
|
|
|
4875
4779
|
title_frame = tk.Frame(self.header, bg=PALETTE["card_bg"])
|
|
4876
4780
|
title_frame.pack(side=tk.LEFT, fill=tk.Y, padx=14, pady=2)
|
|
@@ -4878,7 +4782,7 @@ class AutoReadmeGUI:
|
|
|
4878
4782
|
title_row = tk.Frame(title_frame, bg=PALETTE["card_bg"])
|
|
4879
4783
|
title_row.pack(anchor=tk.W)
|
|
4880
4784
|
|
|
4881
|
-
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"])
|
|
4882
4786
|
self.title_lbl.pack(side=tk.LEFT)
|
|
4883
4787
|
|
|
4884
4788
|
self.status_dot = GlowingStatusDot(title_row)
|
|
@@ -4927,7 +4831,7 @@ class AutoReadmeGUI:
|
|
|
4927
4831
|
bg_color=PALETTE["card_border"],
|
|
4928
4832
|
text_color=PALETTE.get("accent_purple", "#6366f1"),
|
|
4929
4833
|
font=("Segoe UI", 7, "bold"),
|
|
4930
|
-
width=
|
|
4834
|
+
width=112
|
|
4931
4835
|
)
|
|
4932
4836
|
self.quick_theme_btn.pack(side=tk.LEFT, padx=3)
|
|
4933
4837
|
|
|
@@ -4940,10 +4844,23 @@ class AutoReadmeGUI:
|
|
|
4940
4844
|
bg_color=PALETTE.get("card_hover", "#e0e7ff"),
|
|
4941
4845
|
text_color=PALETTE.get("accent_cyan", "#3843a0"),
|
|
4942
4846
|
font=("Segoe UI", 7, "bold"),
|
|
4943
|
-
width=
|
|
4847
|
+
width=102
|
|
4944
4848
|
)
|
|
4945
4849
|
self.audit_btn.pack(side=tk.LEFT, padx=3)
|
|
4946
4850
|
|
|
4851
|
+
self.agency_header_btn = CanvasPillButton(
|
|
4852
|
+
header_controls,
|
|
4853
|
+
text="🤖 AGENCY",
|
|
4854
|
+
command=self.open_agency_studio_dialog,
|
|
4855
|
+
height=28,
|
|
4856
|
+
radius=14,
|
|
4857
|
+
bg_color=PALETTE.get("card_hover", "#e0e7ff"),
|
|
4858
|
+
text_color=PALETTE.get("accent_green", "#10b981"),
|
|
4859
|
+
font=("Segoe UI", 7, "bold"),
|
|
4860
|
+
width=96
|
|
4861
|
+
)
|
|
4862
|
+
self.agency_header_btn.pack(side=tk.LEFT, padx=3)
|
|
4863
|
+
|
|
4947
4864
|
self.web_console_btn = CanvasPillButton(
|
|
4948
4865
|
header_controls,
|
|
4949
4866
|
text="🌐 WEB CONSOLE",
|
|
@@ -4953,7 +4870,7 @@ class AutoReadmeGUI:
|
|
|
4953
4870
|
bg_color=PALETTE["card_border"],
|
|
4954
4871
|
text_color=PALETTE.get("accent_cyan", "#38bdf8"),
|
|
4955
4872
|
font=("Segoe UI", 7, "bold"),
|
|
4956
|
-
width=
|
|
4873
|
+
width=108
|
|
4957
4874
|
)
|
|
4958
4875
|
self.web_console_btn.pack(side=tk.LEFT, padx=3)
|
|
4959
4876
|
|
|
@@ -4967,26 +4884,26 @@ class AutoReadmeGUI:
|
|
|
4967
4884
|
hover_color="#fb7185",
|
|
4968
4885
|
text_color="#fb7185" if PALETTE.get("bg_start") != "#edf2fb" else "#be123c",
|
|
4969
4886
|
font=("Segoe UI", 7, "bold"),
|
|
4970
|
-
width=
|
|
4887
|
+
width=92
|
|
4971
4888
|
)
|
|
4972
4889
|
self.sponsor_header_btn.pack(side=tk.LEFT, padx=3)
|
|
4973
4890
|
|
|
4974
4891
|
self.star_header_btn = CanvasPillButton(
|
|
4975
4892
|
header_controls,
|
|
4976
|
-
text=
|
|
4893
|
+
text="★ STAR ON GITHUB",
|
|
4977
4894
|
command=self.open_star_action,
|
|
4978
4895
|
height=28,
|
|
4979
4896
|
radius=14,
|
|
4980
4897
|
bg_color=PALETTE.get("warning", "#eab308"),
|
|
4981
4898
|
text_color="#000000",
|
|
4982
4899
|
font=("Segoe UI", 7, "bold"),
|
|
4983
|
-
width=
|
|
4900
|
+
width=108
|
|
4984
4901
|
)
|
|
4985
4902
|
self.star_header_btn.pack(side=tk.LEFT, padx=3)
|
|
4986
4903
|
|
|
4987
4904
|
# 3. MAIN CONTENT FRAME
|
|
4988
4905
|
self.content = tk.Frame(self.bg_canvas, bg=PALETTE["bg_start"], bd=0)
|
|
4989
|
-
self.content.place(x=82, y=
|
|
4906
|
+
self.content.place(x=82, y=68, relwidth=1.0, width=-92, relheight=1.0, height=-100)
|
|
4990
4907
|
|
|
4991
4908
|
self.tab_frames = [tk.Frame(self.content, bg=PALETTE["bg_start"]) for _ in range(7)]
|
|
4992
4909
|
self.setup_tab_setup()
|
|
@@ -5004,9 +4921,14 @@ class AutoReadmeGUI:
|
|
|
5004
4921
|
s_pill_bot = tk.Frame(self.status_bar, bg=PALETTE["card_bg"], highlightthickness=1, highlightbackground=PALETTE["card_border"])
|
|
5005
4922
|
s_pill_bot.pack(side=tk.LEFT, fill=tk.X, expand=True)
|
|
5006
4923
|
|
|
5007
|
-
tk.Label(s_pill_bot, text="
|
|
5008
|
-
self.status_bar_lbl = tk.Label(s_pill_bot, text="
|
|
4924
|
+
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)
|
|
4925
|
+
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"])
|
|
5009
4926
|
self.status_bar_lbl.pack(side=tk.LEFT, pady=2)
|
|
4927
|
+
self.status_hint_lbl = tk.Label(
|
|
4928
|
+
s_pill_bot, bg=PALETTE["card_bg"], fg=PALETTE["text_muted"],
|
|
4929
|
+
font=("Segoe UI", 8), anchor="e",
|
|
4930
|
+
)
|
|
4931
|
+
self.status_hint_lbl.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=8)
|
|
5010
4932
|
|
|
5011
4933
|
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")
|
|
5012
4934
|
self.status_toggle_lbl.pack(side=tk.RIGHT, padx=8, pady=2)
|
|
@@ -5079,38 +5001,65 @@ class AutoReadmeGUI:
|
|
|
5079
5001
|
self.show_toast(f"Sound effects {'enabled' if SFX_ENABLED else 'disabled'}", "info")
|
|
5080
5002
|
|
|
5081
5003
|
def show_toast(self, message: str, kind: str = "info", duration_ms: int = 2500):
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5004
|
+
"""Show one status message inside the application."""
|
|
5005
|
+
if not hasattr(self, "status_bar_lbl"):
|
|
5006
|
+
return
|
|
5007
|
+
label = self.status_bar_lbl
|
|
5008
|
+
previous = getattr(self, "_status_reset", None)
|
|
5009
|
+
if previous:
|
|
5010
|
+
self.root.after_cancel(previous)
|
|
5011
|
+
color = {"success": PALETTE["success"], "error": PALETTE["error"],
|
|
5012
|
+
"warning": PALETTE["accent_coral"]}.get(kind, PALETTE["text_main"])
|
|
5013
|
+
label.configure(text=message.splitlines()[0] if message else "", fg=color)
|
|
5014
|
+
|
|
5015
|
+
def reset():
|
|
5016
|
+
self._status_reset = None
|
|
5017
|
+
if label.winfo_exists():
|
|
5018
|
+
label.configure(text="Ready", fg=PALETTE["text_main"])
|
|
5019
|
+
self._status_reset = self.root.after(duration_ms, reset)
|
|
5020
|
+
|
|
5021
|
+
def _show_info(self, title, message, **kwargs):
|
|
5022
|
+
self._show_notice(title, message, "info")
|
|
5023
|
+
|
|
5024
|
+
def _show_warning(self, title, message, **kwargs):
|
|
5025
|
+
self._show_notice(title, message, "warning")
|
|
5026
|
+
|
|
5027
|
+
def _show_error(self, title, message, **kwargs):
|
|
5028
|
+
self._show_notice(title, message, "error")
|
|
5029
|
+
|
|
5030
|
+
def _show_notice(self, title, message, kind):
|
|
5031
|
+
self.show_toast(f"{title} · {message}", kind, 8000)
|
|
5032
|
+
if "\n" in str(message):
|
|
5033
|
+
self.log(f"{title}: {message}")
|
|
5099
5034
|
|
|
5100
5035
|
def open_web_console(self):
|
|
5036
|
+
"""Start a loopback-only server once and open its actual address."""
|
|
5101
5037
|
play_sfx("click")
|
|
5102
5038
|
try:
|
|
5103
|
-
|
|
5104
|
-
if
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5039
|
+
server = getattr(self, "_web_server", None)
|
|
5040
|
+
if server is None:
|
|
5041
|
+
from tzero.tzero_dashboard import start_dashboard_server, DASHBOARD_PORT
|
|
5042
|
+
server = start_dashboard_server(DASHBOARD_PORT, open_browser=False)
|
|
5043
|
+
self._web_server = server
|
|
5044
|
+
threading.Thread(target=server.serve_forever, daemon=True).start()
|
|
5045
|
+
|
|
5046
|
+
def close_server(event):
|
|
5047
|
+
if event.widget is self.root and getattr(self, "_web_server", None) is server:
|
|
5048
|
+
self._web_server = None
|
|
5049
|
+
def shutdown():
|
|
5050
|
+
server.shutdown()
|
|
5051
|
+
server.server_close()
|
|
5052
|
+
threading.Thread(target=shutdown, daemon=True).start()
|
|
5053
|
+
|
|
5054
|
+
self.root.bind("<Destroy>", close_server, add="+")
|
|
5055
|
+
url = f"http://127.0.0.1:{server.server_address[1]}/"
|
|
5056
|
+
if webbrowser.open(url):
|
|
5057
|
+
self.show_toast("T-Zero Web Console opened", "success")
|
|
5058
|
+
else:
|
|
5059
|
+
self.show_toast(f"Open {url} in your browser", "info", 6000)
|
|
5060
|
+
except Exception as exc:
|
|
5061
|
+
self.log(f"Web Console could not start: {exc}")
|
|
5062
|
+
self.show_toast(f"Web Console could not start: {exc}", "error", 6000)
|
|
5114
5063
|
|
|
5115
5064
|
def run_quick_security_audit(self):
|
|
5116
5065
|
self.open_security_audit_dialog()
|
|
@@ -5123,6 +5072,20 @@ class AutoReadmeGUI:
|
|
|
5123
5072
|
if not target or not os.path.exists(target):
|
|
5124
5073
|
target = os.getcwd()
|
|
5125
5074
|
|
|
5075
|
+
self.show_toast("Scanning workspace for security findings...", "info")
|
|
5076
|
+
|
|
5077
|
+
def worker():
|
|
5078
|
+
try:
|
|
5079
|
+
result = self._collect_security_audit(target)
|
|
5080
|
+
self.safe_after(0, self._show_security_audit_results, target, result)
|
|
5081
|
+
except Exception as exc:
|
|
5082
|
+
message = str(exc)
|
|
5083
|
+
self.safe_after(0, lambda: self.show_toast(f"Security audit failed: {message}", "error", 6000))
|
|
5084
|
+
|
|
5085
|
+
threading.Thread(target=worker, daemon=True).start()
|
|
5086
|
+
|
|
5087
|
+
def _collect_security_audit(self, target):
|
|
5088
|
+
"""Collect findings away from Tk's event loop."""
|
|
5126
5089
|
key_patterns = [
|
|
5127
5090
|
(re.compile(r"""(?i)(?:api_key|apikey|secret|password|auth_token)\s*=\s*['\"][A-Za-z0-9_\-\.]{16,}['\"]"""), "Hardcoded Secret / API Key"),
|
|
5128
5091
|
(re.compile(r'sk-[a-zA-Z0-9]{20,}'), "OpenAI API Key Pattern"),
|
|
@@ -5202,13 +5165,19 @@ class AutoReadmeGUI:
|
|
|
5202
5165
|
except Exception:
|
|
5203
5166
|
pass
|
|
5204
5167
|
|
|
5168
|
+
return (audit_issues, py_files_count, total_scanned_files,
|
|
5169
|
+
total_lines_count, leaks_count, smells_count, arch_violations_count)
|
|
5170
|
+
|
|
5171
|
+
def _show_security_audit_results(self, target, result):
|
|
5172
|
+
(audit_issues, py_files_count, total_scanned_files, total_lines_count,
|
|
5173
|
+
leaks_count, smells_count, arch_violations_count) = result
|
|
5205
5174
|
# Audio and status feedback
|
|
5206
5175
|
if leaks_count > 0:
|
|
5207
5176
|
play_sfx("error")
|
|
5208
5177
|
self.show_toast(f"🚨 T-001 ALERT: {leaks_count} leak(s) detected!", "error", 5000)
|
|
5209
5178
|
else:
|
|
5210
5179
|
play_sfx("success")
|
|
5211
|
-
self.show_toast(f"
|
|
5180
|
+
self.show_toast(f"No matching secret patterns found ({total_scanned_files} files scanned)", "success", 4000)
|
|
5212
5181
|
|
|
5213
5182
|
self.log(f"T-Zero Security Audit: {total_scanned_files} files scanned, {leaks_count} secrets, {arch_violations_count} arch violations, {smells_count} AST smells.")
|
|
5214
5183
|
|
|
@@ -5449,8 +5418,6 @@ class AutoReadmeGUI:
|
|
|
5449
5418
|
self.search_entry.insert(0, old_search)
|
|
5450
5419
|
if self.has_scanned:
|
|
5451
5420
|
self.rebuild_selector_tree()
|
|
5452
|
-
if old_search:
|
|
5453
|
-
self.filter_files_tree()
|
|
5454
5421
|
if old_preview and self.tree.exists(old_preview):
|
|
5455
5422
|
self.tree.selection_set(old_preview)
|
|
5456
5423
|
self.on_file_select_changed(None)
|
|
@@ -5519,7 +5486,7 @@ class AutoReadmeGUI:
|
|
|
5519
5486
|
if self.active_tab_index == 1 and self.scanned_files:
|
|
5520
5487
|
self.search_entry.delete(0, tk.END)
|
|
5521
5488
|
self.search_entry.insert(0, self.header_search_entry.get())
|
|
5522
|
-
self.
|
|
5489
|
+
self._schedule_file_search()
|
|
5523
5490
|
|
|
5524
5491
|
def open_global_search(self):
|
|
5525
5492
|
self.header_search_entry.focus_set()
|
|
@@ -5681,14 +5648,27 @@ class AutoReadmeGUI:
|
|
|
5681
5648
|
q_inner,
|
|
5682
5649
|
text=get_text("scan_btn", self.lang),
|
|
5683
5650
|
command=self.run_scanner,
|
|
5684
|
-
height=
|
|
5685
|
-
radius=
|
|
5651
|
+
height=30,
|
|
5652
|
+
radius=15,
|
|
5686
5653
|
bg_color=PALETTE["sidebar_bg"],
|
|
5687
5654
|
hover_color=PALETTE["accent_purple"],
|
|
5688
5655
|
text_color="#ffffff",
|
|
5689
5656
|
font=("Segoe UI", 8, "bold")
|
|
5690
5657
|
)
|
|
5691
|
-
self.scan_btn.pack(fill=tk.X, pady=(2,
|
|
5658
|
+
self.scan_btn.pack(fill=tk.X, pady=(2, 4))
|
|
5659
|
+
|
|
5660
|
+
self.open_agency_btn = CanvasPillButton(
|
|
5661
|
+
q_inner,
|
|
5662
|
+
text="🤖 T-ZERO AGENCY (448 READMEs • SWARM)",
|
|
5663
|
+
command=self.open_agency_studio_dialog,
|
|
5664
|
+
height=28,
|
|
5665
|
+
radius=14,
|
|
5666
|
+
bg_color=PALETTE["card_border"],
|
|
5667
|
+
hover_color=PALETTE["accent_cyan"],
|
|
5668
|
+
text_color=PALETTE["accent_cyan"],
|
|
5669
|
+
font=("Segoe UI", 8, "bold")
|
|
5670
|
+
)
|
|
5671
|
+
self.open_agency_btn.pack(fill=tk.X, pady=(0, 0))
|
|
5692
5672
|
|
|
5693
5673
|
# --- ROW 2: Bottom Cards ---
|
|
5694
5674
|
# Card 7: Monthly Stacked Bar Card
|
|
@@ -5900,10 +5880,10 @@ class AutoReadmeGUI:
|
|
|
5900
5880
|
filepath = filedialog.asksaveasfilename(defaultextension=".dat", filetypes=[("Data Files", "*.dat")])
|
|
5901
5881
|
if filepath:
|
|
5902
5882
|
if KeyringSecretsBackupManager.backup_credentials(filepath, key):
|
|
5903
|
-
|
|
5883
|
+
self._show_info("Success", "Credentials backed up securely!")
|
|
5904
5884
|
dialog.destroy()
|
|
5905
5885
|
else:
|
|
5906
|
-
|
|
5886
|
+
self._show_error("Error", "Backup operation failed.")
|
|
5907
5887
|
|
|
5908
5888
|
def run_restore():
|
|
5909
5889
|
key = key_entry.get().strip()
|
|
@@ -5912,10 +5892,10 @@ class AutoReadmeGUI:
|
|
|
5912
5892
|
filepath = filedialog.askopenfilename(filetypes=[("Data Files", "*.dat")])
|
|
5913
5893
|
if filepath:
|
|
5914
5894
|
if KeyringSecretsBackupManager.restore_credentials(filepath, key):
|
|
5915
|
-
|
|
5895
|
+
self._show_info("Success", "Credentials restored securely!")
|
|
5916
5896
|
dialog.destroy()
|
|
5917
5897
|
else:
|
|
5918
|
-
|
|
5898
|
+
self._show_error("Error", "Restore operation failed. Invalid key?")
|
|
5919
5899
|
|
|
5920
5900
|
btn_row = tk.Frame(pad, bg=PALETTE["bg_start"])
|
|
5921
5901
|
btn_row.pack(fill=tk.X, pady=10)
|
|
@@ -5954,7 +5934,7 @@ class AutoReadmeGUI:
|
|
|
5954
5934
|
self.log(f"Saved global scanner thread workers limit: {workers}, tokens limit: {tokens}")
|
|
5955
5935
|
dialog.destroy()
|
|
5956
5936
|
except ValueError:
|
|
5957
|
-
|
|
5937
|
+
self._show_error("Error", "Values must be integer values!")
|
|
5958
5938
|
|
|
5959
5939
|
tk.Button(pad, text="Save configs", bg=PALETTE["success"], fg="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=save).pack()
|
|
5960
5940
|
|
|
@@ -5998,7 +5978,7 @@ class AutoReadmeGUI:
|
|
|
5998
5978
|
self.log(f"Cleared credentials for {provider} from keyring.")
|
|
5999
5979
|
refresh_secrets_tree()
|
|
6000
5980
|
except Exception as e:
|
|
6001
|
-
|
|
5981
|
+
self._show_error("Error", f"Failed: {e}")
|
|
6002
5982
|
|
|
6003
5983
|
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)
|
|
6004
5984
|
|
|
@@ -6012,7 +5992,7 @@ class AutoReadmeGUI:
|
|
|
6012
5992
|
profile["ignored_folders"] = preset["ignored"]
|
|
6013
5993
|
_config_mgr.save()
|
|
6014
5994
|
self.log(f"Applied scan layout preset parameters: {name}")
|
|
6015
|
-
|
|
5995
|
+
self._show_info("Success", f"Preset applied:\n{name}")
|
|
6016
5996
|
|
|
6017
5997
|
def import_profile_json(self):
|
|
6018
5998
|
filepath = filedialog.askopenfilename(filetypes=[("JSON Files", "*.json")])
|
|
@@ -6026,9 +6006,9 @@ class AutoReadmeGUI:
|
|
|
6026
6006
|
self.refresh_profile_listbox()
|
|
6027
6007
|
self.load_saved_credentials()
|
|
6028
6008
|
self.log(f"Imported settings profile from {filepath}")
|
|
6029
|
-
|
|
6009
|
+
self._show_info("Success", f"Successfully imported settings profile: {profile_name}")
|
|
6030
6010
|
else:
|
|
6031
|
-
|
|
6011
|
+
self._show_error("Error", "Invalid profile structure!")
|
|
6032
6012
|
|
|
6033
6013
|
def export_profile_json(self):
|
|
6034
6014
|
filepath = filedialog.asksaveasfilename(defaultextension=".json", filetypes=[("JSON Files", "*.json")])
|
|
@@ -6037,9 +6017,9 @@ class AutoReadmeGUI:
|
|
|
6037
6017
|
profile = _config_mgr.get_profile()
|
|
6038
6018
|
if ProfileImporterExporter.export_profile(profile, filepath):
|
|
6039
6019
|
self.log(f"Exported settings profile details: {filepath}")
|
|
6040
|
-
|
|
6020
|
+
self._show_info("Success", f"Profile exported successfully to:\n{filepath}")
|
|
6041
6021
|
else:
|
|
6042
|
-
|
|
6022
|
+
self._show_error("Error", "Failed to export profile.")
|
|
6043
6023
|
|
|
6044
6024
|
def open_ignored_folders_dialog(self):
|
|
6045
6025
|
dialog = tk.Toplevel(self.root)
|
|
@@ -6127,7 +6107,7 @@ class AutoReadmeGUI:
|
|
|
6127
6107
|
return
|
|
6128
6108
|
val = self.profile_listbox.get(sel[0]).replace(" [Active]", "").strip()
|
|
6129
6109
|
if val == "default":
|
|
6130
|
-
|
|
6110
|
+
self._show_warning("Warning", "Cannot delete the default profile.")
|
|
6131
6111
|
return
|
|
6132
6112
|
if _config_mgr.delete_profile(val):
|
|
6133
6113
|
self.refresh_profile_listbox()
|
|
@@ -6184,7 +6164,7 @@ class AutoReadmeGUI:
|
|
|
6184
6164
|
r_chat = requests.post(chat_url, json=chat_payload, headers=headers, timeout=8)
|
|
6185
6165
|
if r_chat.status_code == 200:
|
|
6186
6166
|
self.safe_after(0, lambda: self.status_dot.set_status("green"))
|
|
6187
|
-
self.safe_after(0, lambda:
|
|
6167
|
+
self.safe_after(0, lambda: self._show_info("Success", get_text("ping_success", self.lang)))
|
|
6188
6168
|
elif r_chat.status_code == 401:
|
|
6189
6169
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6190
6170
|
warn_msg = (
|
|
@@ -6195,7 +6175,7 @@ class AutoReadmeGUI:
|
|
|
6195
6175
|
f"3. Generate a new active API key at https://build.nvidia.com and enter it in the Settings tab.\n\n"
|
|
6196
6176
|
f"⚡ With the T-Zero Local Offline AST Engine, full context generation works 100% free even without an API key!"
|
|
6197
6177
|
)
|
|
6198
|
-
self.safe_after(0, lambda:
|
|
6178
|
+
self.safe_after(0, lambda: self._show_warning("Authorization Error (401)", warn_msg))
|
|
6199
6179
|
elif r_chat.status_code == 403:
|
|
6200
6180
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6201
6181
|
warn_msg = (
|
|
@@ -6205,26 +6185,26 @@ class AutoReadmeGUI:
|
|
|
6205
6185
|
f"1. Create a new API key at https://build.nvidia.com with 'Public API Endpoints' permission enabled.\n"
|
|
6206
6186
|
f"2. Or run T-Zero in Local Offline AST Mode to synthesize 100% complete context without any API key!"
|
|
6207
6187
|
)
|
|
6208
|
-
self.safe_after(0, lambda:
|
|
6188
|
+
self.safe_after(0, lambda: self._show_warning("Partial Permission (403)", warn_msg))
|
|
6209
6189
|
elif r_chat.status_code == 410:
|
|
6210
6190
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6211
|
-
self.safe_after(0, lambda:
|
|
6191
|
+
self.safe_after(0, lambda: self._show_warning(
|
|
6212
6192
|
"Model End of Life (410)",
|
|
6213
6193
|
f"Model '{target_model}' has reached End of Life. Please select 'deepseek-ai/deepseek-v4.1-flash' from the dropdown."
|
|
6214
6194
|
))
|
|
6215
6195
|
else:
|
|
6216
6196
|
self.safe_after(0, lambda: self.status_dot.set_status("yellow"))
|
|
6217
|
-
self.safe_after(0, lambda:
|
|
6197
|
+
self.safe_after(0, lambda: self._show_warning("API Response", f"Remote API status: {r_chat.status_code}\n{r_chat.text[:200]}"))
|
|
6218
6198
|
except Exception:
|
|
6219
6199
|
self.safe_after(0, lambda: self.status_dot.set_status("green"))
|
|
6220
|
-
self.safe_after(0, lambda:
|
|
6200
|
+
self.safe_after(0, lambda: self._show_info("Success", get_text("ping_success", self.lang)))
|
|
6221
6201
|
else:
|
|
6222
6202
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6223
|
-
self.safe_after(0, lambda:
|
|
6203
|
+
self.safe_after(0, lambda: self._show_error("Failure", f"Code: {r.status_code}\n{r.text}"))
|
|
6224
6204
|
except Exception as e:
|
|
6225
6205
|
err_msg = str(e)
|
|
6226
6206
|
self.safe_after(0, lambda: self.status_dot.set_status("red"))
|
|
6227
|
-
self.safe_after(0, lambda msg=err_msg:
|
|
6207
|
+
self.safe_after(0, lambda msg=err_msg: self._show_error("Exception", msg))
|
|
6228
6208
|
threading.Thread(target=run, daemon=True).start()
|
|
6229
6209
|
|
|
6230
6210
|
def browse_dir(self):
|
|
@@ -6241,29 +6221,31 @@ class AutoReadmeGUI:
|
|
|
6241
6221
|
|
|
6242
6222
|
def run_scanner(self):
|
|
6243
6223
|
target = self.dir_entry.get().strip()
|
|
6244
|
-
if not
|
|
6245
|
-
|
|
6224
|
+
if not os.path.isdir(target):
|
|
6225
|
+
self._show_error("Error", "Choose an existing workspace folder.")
|
|
6246
6226
|
return
|
|
6247
6227
|
|
|
6228
|
+
if getattr(self, "_scan_running", False):
|
|
6229
|
+
return
|
|
6230
|
+
self._scan_running = True
|
|
6248
6231
|
self.scan_btn.config(state=tk.DISABLED, text="Scanning...")
|
|
6249
6232
|
self.log(f"Crawling directory signatures: {target}")
|
|
6250
6233
|
|
|
6251
|
-
provider = self.provider_var.get()
|
|
6252
|
-
key = self.api_key_entry.get().strip()
|
|
6253
|
-
if key:
|
|
6254
|
-
_config_mgr.set_credential(provider, key)
|
|
6255
|
-
|
|
6256
6234
|
def run_thread():
|
|
6257
6235
|
try:
|
|
6258
6236
|
files, sizes, snippets = self.scanner.scan_directory(target)
|
|
6259
|
-
self.safe_after(0,
|
|
6260
|
-
except Exception as
|
|
6261
|
-
|
|
6262
|
-
self.safe_after(0, lambda msg=err_msg: messagebox.showerror("Error", msg))
|
|
6263
|
-
self.safe_after(0, lambda: self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang)))
|
|
6237
|
+
self.safe_after(0, self.on_scan_finish, files, sizes, snippets)
|
|
6238
|
+
except Exception as exc:
|
|
6239
|
+
self.safe_after(0, self._on_scan_error, str(exc))
|
|
6264
6240
|
threading.Thread(target=run_thread, daemon=True).start()
|
|
6265
6241
|
|
|
6242
|
+
def _on_scan_error(self, message):
|
|
6243
|
+
self._scan_running = False
|
|
6244
|
+
self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang))
|
|
6245
|
+
self._show_error("Workspace scan failed", message)
|
|
6246
|
+
|
|
6266
6247
|
def on_scan_finish(self, files, sizes, snippets):
|
|
6248
|
+
self._scan_running = False
|
|
6267
6249
|
self.has_scanned = True
|
|
6268
6250
|
self.scanned_files = files
|
|
6269
6251
|
self.file_sizes = sizes
|
|
@@ -6274,9 +6256,6 @@ class AutoReadmeGUI:
|
|
|
6274
6256
|
|
|
6275
6257
|
self.rebuild_selector_tree()
|
|
6276
6258
|
self.scan_btn.config(state=tk.NORMAL, text=get_text("scan_btn", self.lang))
|
|
6277
|
-
if self.search_entry.get().strip():
|
|
6278
|
-
self.filter_files_tree()
|
|
6279
|
-
|
|
6280
6259
|
# Update live KPI chips & circular gauge from reference design
|
|
6281
6260
|
total_tok = sum(len(v) for v in snippets.values()) // 4
|
|
6282
6261
|
scanned_n = len(files)
|
|
@@ -6295,9 +6274,6 @@ class AutoReadmeGUI:
|
|
|
6295
6274
|
executable_dir = os.path.dirname(sys.executable) if getattr(sys, "frozen", False) else None
|
|
6296
6275
|
if not self.dir_entry.get().strip():
|
|
6297
6276
|
self.dir_entry.insert(0, resolve_default_workspace(executable_dir=executable_dir))
|
|
6298
|
-
target = self.dir_entry.get().strip()
|
|
6299
|
-
if target and os.path.isdir(target) and not getattr(self, "has_scanned", False) and "unittest" not in sys.modules:
|
|
6300
|
-
self.safe_after(250, self.run_scanner)
|
|
6301
6277
|
|
|
6302
6278
|
def show_shortcuts_modal(self):
|
|
6303
6279
|
dialog = tk.Toplevel(self.root)
|
|
@@ -6406,7 +6382,7 @@ class AutoReadmeGUI:
|
|
|
6406
6382
|
self.root.clipboard_clear()
|
|
6407
6383
|
self.root.clipboard_append(val)
|
|
6408
6384
|
self.log(f"Copied to clipboard ({label}): {val}")
|
|
6409
|
-
|
|
6385
|
+
self._show_info("Copied", f"{label} address copied to clipboard:\n{val}")
|
|
6410
6386
|
except Exception:
|
|
6411
6387
|
pass
|
|
6412
6388
|
|
|
@@ -6708,7 +6684,7 @@ class AutoReadmeGUI:
|
|
|
6708
6684
|
tk.Label(toolbar, text="🔍", font=("Segoe UI", 9, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"]).pack(side=tk.LEFT, padx=(8, 2))
|
|
6709
6685
|
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"]))
|
|
6710
6686
|
self.search_entry.pack(side=tk.LEFT, ipady=3)
|
|
6711
|
-
self.search_entry.bind("<KeyRelease>", self.
|
|
6687
|
+
self.search_entry.bind("<KeyRelease>", self._schedule_file_search)
|
|
6712
6688
|
|
|
6713
6689
|
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"))
|
|
6714
6690
|
self.extensions_btn.pack(side=tk.LEFT, padx=4)
|
|
@@ -6844,7 +6820,7 @@ class AutoReadmeGUI:
|
|
|
6844
6820
|
except Exception as e:
|
|
6845
6821
|
self.log(f"AST Refactor failed in {filepath}: {e}")
|
|
6846
6822
|
|
|
6847
|
-
|
|
6823
|
+
self._show_info("Success", f"AST refactored successfully in {modified_count} python files.")
|
|
6848
6824
|
dialog.destroy()
|
|
6849
6825
|
self.run_scanner()
|
|
6850
6826
|
|
|
@@ -7005,7 +6981,7 @@ class AutoReadmeGUI:
|
|
|
7005
6981
|
try:
|
|
7006
6982
|
rx = re.compile(pattern)
|
|
7007
6983
|
except Exception as e:
|
|
7008
|
-
|
|
6984
|
+
self._show_error("Error", f"Invalid regex: {e}")
|
|
7009
6985
|
return
|
|
7010
6986
|
|
|
7011
6987
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
@@ -7051,7 +7027,7 @@ class AutoReadmeGUI:
|
|
|
7051
7027
|
self.log(f"Replaced regex pattern in {filepath}")
|
|
7052
7028
|
except Exception as e:
|
|
7053
7029
|
self.log(f"Failed replacement in {filepath}: {e}")
|
|
7054
|
-
|
|
7030
|
+
self._show_info("Success", f"Replaced regex pattern successfully in {len(files_to_modify)} files.")
|
|
7055
7031
|
dialog.destroy()
|
|
7056
7032
|
self.run_scanner()
|
|
7057
7033
|
|
|
@@ -7112,39 +7088,17 @@ class AutoReadmeGUI:
|
|
|
7112
7088
|
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")
|
|
7113
7089
|
del_btn.pack(fill=tk.X, pady=(5, 0))
|
|
7114
7090
|
|
|
7091
|
+
def _schedule_file_search(self, event=None):
|
|
7092
|
+
pending = getattr(self, "_pending_file_search", None)
|
|
7093
|
+
if pending:
|
|
7094
|
+
self.root.after_cancel(pending)
|
|
7095
|
+
self._pending_file_search = self.root.after(150, self.filter_files_tree)
|
|
7096
|
+
|
|
7115
7097
|
def filter_files_tree(self, event=None):
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
self.
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
for item in self.tree.get_children():
|
|
7122
|
-
self.tree.delete(item)
|
|
7123
|
-
|
|
7124
|
-
inserted_dirs = {}
|
|
7125
|
-
for filepath in self.scanned_files:
|
|
7126
|
-
if query not in filepath.lower():
|
|
7127
|
-
continue
|
|
7128
|
-
parts = filepath.replace("\\", "/").split("/")
|
|
7129
|
-
parent = ""
|
|
7130
|
-
for i in range(len(parts) - 1):
|
|
7131
|
-
dir_path = "/".join(parts[:i+1])
|
|
7132
|
-
dir_name = parts[i]
|
|
7133
|
-
if dir_path not in inserted_dirs:
|
|
7134
|
-
display = f"☑ 📁 {dir_name}"
|
|
7135
|
-
iid = self.tree.insert(parent, "end", iid=f"dir:{dir_path}", text=display, open=True)
|
|
7136
|
-
inserted_dirs[dir_path] = iid
|
|
7137
|
-
parent = inserted_dirs[dir_path]
|
|
7138
|
-
|
|
7139
|
-
fname = parts[-1]
|
|
7140
|
-
sz_kb = self.file_sizes.get(filepath, 0) / 1024
|
|
7141
|
-
checked = self.file_checked.get(filepath, True)
|
|
7142
|
-
glyph = "☑" if checked else "☐"
|
|
7143
|
-
status_txt = "Included" if checked else "Excluded"
|
|
7144
|
-
|
|
7145
|
-
self.tree.insert(parent, "end", iid=filepath, text=f"{glyph} 📄 {fname}", values=(f"{sz_kb:.1f} KB", status_txt))
|
|
7146
|
-
self._update_tree_empty_state()
|
|
7147
|
-
self.update_parent_states()
|
|
7098
|
+
if getattr(self, "_pending_file_search", None):
|
|
7099
|
+
self.root.after_cancel(self._pending_file_search)
|
|
7100
|
+
self._pending_file_search = None
|
|
7101
|
+
self.rebuild_selector_tree()
|
|
7148
7102
|
|
|
7149
7103
|
def on_file_select_changed(self, event):
|
|
7150
7104
|
selected_items = self.tree.selection()
|
|
@@ -7186,7 +7140,7 @@ class AutoReadmeGUI:
|
|
|
7186
7140
|
with open(full_path, "w", encoding="utf-8") as f:
|
|
7187
7141
|
f.write(content)
|
|
7188
7142
|
self.log(f"Saved modified file changes directly: {self.active_preview_file}")
|
|
7189
|
-
|
|
7143
|
+
self._show_info("Saved", f"Successfully saved file edits:\n{self.active_preview_file}")
|
|
7190
7144
|
|
|
7191
7145
|
sz = os.path.getsize(full_path)
|
|
7192
7146
|
self.file_sizes[self.active_preview_file] = sz
|
|
@@ -7197,7 +7151,7 @@ class AutoReadmeGUI:
|
|
|
7197
7151
|
|
|
7198
7152
|
self.update_selector_stats()
|
|
7199
7153
|
except Exception as e:
|
|
7200
|
-
|
|
7154
|
+
self._show_error("Error", f"Failed to save file edits: {e}")
|
|
7201
7155
|
|
|
7202
7156
|
def apply_smart_selection_heuristic(self):
|
|
7203
7157
|
code_exts = {".py", ".js", ".ts", ".rs", ".go", ".cpp", ".c", ".h", ".jsx", ".tsx", ".sh", ".bat"}
|
|
@@ -7209,33 +7163,50 @@ class AutoReadmeGUI:
|
|
|
7209
7163
|
self.file_checked[f] = False
|
|
7210
7164
|
|
|
7211
7165
|
def rebuild_selector_tree(self):
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7166
|
+
tree = self.tree
|
|
7167
|
+
query = self.search_entry.get().strip().casefold()
|
|
7168
|
+
paths = [path for path in self.scanned_files if query in path.casefold()]
|
|
7169
|
+
remaining = iter(paths)
|
|
7170
|
+
self._selector_render = remaining
|
|
7171
|
+
selected = tree.selection()
|
|
7172
|
+
tree.delete(*tree.get_children())
|
|
7173
|
+
directories = {}
|
|
7174
|
+
|
|
7175
|
+
def insert_batch():
|
|
7176
|
+
if self._selector_render is not remaining or self.tree is not tree:
|
|
7177
|
+
return
|
|
7178
|
+
|
|
7179
|
+
for _ in range(200):
|
|
7180
|
+
filepath = next(remaining, None)
|
|
7181
|
+
if filepath is None:
|
|
7182
|
+
self._update_tree_empty_state()
|
|
7183
|
+
self.update_selector_stats()
|
|
7184
|
+
self.update_parent_states()
|
|
7185
|
+
if selected and tree.exists(selected[0]):
|
|
7186
|
+
tree.selection_set(selected[0])
|
|
7187
|
+
return
|
|
7188
|
+
parts = filepath.replace("\\", "/").split("/")
|
|
7189
|
+
parent = ""
|
|
7190
|
+
directory = ""
|
|
7191
|
+
for name in parts[:-1]:
|
|
7192
|
+
directory = f"{directory}/{name}" if directory else name
|
|
7193
|
+
if directory not in directories:
|
|
7194
|
+
directories[directory] = tree.insert(
|
|
7195
|
+
parent, "end", iid=f"dir:{directory}", text=f"☑ 📁 {name}", open=True,
|
|
7196
|
+
)
|
|
7197
|
+
parent = directories[directory]
|
|
7198
|
+
|
|
7199
|
+
size_kb = self.file_sizes.get(filepath, 0) / 1024
|
|
7200
|
+
checked = self.file_checked.get(filepath, True)
|
|
7201
|
+
glyph = "☑" if checked else "☐"
|
|
7202
|
+
status = "Included" if checked else "Excluded"
|
|
7203
|
+
tree.insert(parent, "end", iid=filepath, text=f"{glyph} 📄 {parts[-1]}",
|
|
7204
|
+
values=(f"{size_kb:.1f} KB", status))
|
|
7205
|
+
|
|
7206
|
+
self.tree_empty_lbl.place_forget()
|
|
7207
|
+
self.root.after(1, insert_batch)
|
|
7208
|
+
|
|
7209
|
+
insert_batch()
|
|
7239
7210
|
|
|
7240
7211
|
def _update_tree_empty_state(self):
|
|
7241
7212
|
if not hasattr(self, "tree_empty_lbl"):
|
|
@@ -7486,7 +7457,7 @@ class AutoReadmeGUI:
|
|
|
7486
7457
|
|
|
7487
7458
|
def check_status():
|
|
7488
7459
|
try:
|
|
7489
|
-
res =
|
|
7460
|
+
res = _run_desktop_git(["git", "status", "--porcelain"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7490
7461
|
lines = res.stdout.strip().splitlines()
|
|
7491
7462
|
if lines and lines != [""]:
|
|
7492
7463
|
status_lbl.config(text=f"Detected {len(lines)} uncommitted changes.")
|
|
@@ -7500,17 +7471,17 @@ class AutoReadmeGUI:
|
|
|
7500
7471
|
def run_commit():
|
|
7501
7472
|
msg = msg_entry.get().strip()
|
|
7502
7473
|
if not msg:
|
|
7503
|
-
|
|
7474
|
+
self._show_warning("Warning", "Commit message cannot be empty!")
|
|
7504
7475
|
return
|
|
7505
7476
|
try:
|
|
7506
|
-
|
|
7507
|
-
res =
|
|
7477
|
+
_run_desktop_git(["git", "add", "."], cwd=target, check=True)
|
|
7478
|
+
res = _run_desktop_git(["git", "commit", "-m", msg], cwd=target, capture_output=True, text=True)
|
|
7508
7479
|
self.log(res.stdout or res.stderr)
|
|
7509
|
-
|
|
7480
|
+
self._show_info("Success", "Successfully staged and committed workspace changes!")
|
|
7510
7481
|
dialog.destroy()
|
|
7511
7482
|
self.sync_git_commits()
|
|
7512
7483
|
except Exception as e:
|
|
7513
|
-
|
|
7484
|
+
self._show_error("Error", f"Failed to commit: {e}")
|
|
7514
7485
|
|
|
7515
7486
|
btn_row = tk.Frame(pad, bg=PALETTE["bg_start"])
|
|
7516
7487
|
btn_row.pack(fill=tk.X)
|
|
@@ -7539,12 +7510,12 @@ class AutoReadmeGUI:
|
|
|
7539
7510
|
name = entry.get().strip()
|
|
7540
7511
|
if name:
|
|
7541
7512
|
try:
|
|
7542
|
-
res =
|
|
7513
|
+
res = _run_desktop_git(["git", "checkout", "-b", name], cwd=target, capture_output=True, text=True, timeout=10)
|
|
7543
7514
|
self.log(res.stdout or res.stderr)
|
|
7544
7515
|
self.sync_git_commits()
|
|
7545
7516
|
dialog.destroy()
|
|
7546
7517
|
except Exception as e:
|
|
7547
|
-
|
|
7518
|
+
self._show_error("Error", f"Failed to create branch: {e}")
|
|
7548
7519
|
|
|
7549
7520
|
tk.Button(pad, text="Create Branch", bg=PALETTE["success"], fg="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=save).pack()
|
|
7550
7521
|
|
|
@@ -7568,7 +7539,7 @@ class AutoReadmeGUI:
|
|
|
7568
7539
|
text.pack(fill=tk.BOTH, expand=True, pady=(0, 10))
|
|
7569
7540
|
|
|
7570
7541
|
try:
|
|
7571
|
-
res =
|
|
7542
|
+
res = _run_desktop_git(["git", "status", "--short"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7572
7543
|
text.insert(tk.END, res.stdout or "No modifications detected in status.")
|
|
7573
7544
|
except Exception as e:
|
|
7574
7545
|
text.insert(tk.END, f"Error: {e}")
|
|
@@ -7581,14 +7552,15 @@ class AutoReadmeGUI:
|
|
|
7581
7552
|
if not target or not branch:
|
|
7582
7553
|
return
|
|
7583
7554
|
|
|
7555
|
+
self.log(f"Switching to branch {branch}...")
|
|
7584
7556
|
def checkout():
|
|
7585
|
-
self.log(f"Executing branch switch checkout: git checkout {branch}...")
|
|
7586
7557
|
try:
|
|
7587
|
-
res =
|
|
7588
|
-
self.log
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7558
|
+
res = _run_desktop_git(["git", "checkout", branch], cwd=target, capture_output=True, text=True, timeout=10)
|
|
7559
|
+
self.safe_after(0, self.log, res.stdout or res.stderr)
|
|
7560
|
+
if res.returncode == 0:
|
|
7561
|
+
self.safe_after(0, self.sync_git_commits)
|
|
7562
|
+
except Exception as exc:
|
|
7563
|
+
self.safe_after(0, self.log, f"Branch switch failed: {exc}")
|
|
7592
7564
|
threading.Thread(target=checkout, daemon=True).start()
|
|
7593
7565
|
|
|
7594
7566
|
def sync_git_commits(self):
|
|
@@ -7604,7 +7576,7 @@ class AutoReadmeGUI:
|
|
|
7604
7576
|
|
|
7605
7577
|
def load_branches():
|
|
7606
7578
|
try:
|
|
7607
|
-
res =
|
|
7579
|
+
res = _run_desktop_git(["git", "branch", "-a"], cwd=target, capture_output=True, text=True, timeout=5)
|
|
7608
7580
|
branches = []
|
|
7609
7581
|
active = ""
|
|
7610
7582
|
for line in res.stdout.splitlines():
|
|
@@ -7613,9 +7585,9 @@ class AutoReadmeGUI:
|
|
|
7613
7585
|
active = clean
|
|
7614
7586
|
if clean:
|
|
7615
7587
|
branches.append(clean)
|
|
7616
|
-
self.
|
|
7588
|
+
self.safe_after(0, lambda: self.branch_combo.config(values=branches))
|
|
7617
7589
|
if active:
|
|
7618
|
-
self.
|
|
7590
|
+
self.safe_after(0, lambda: self.branch_combo.set(active))
|
|
7619
7591
|
except Exception:
|
|
7620
7592
|
pass
|
|
7621
7593
|
threading.Thread(target=load_branches, daemon=True).start()
|
|
@@ -7624,8 +7596,7 @@ class AutoReadmeGUI:
|
|
|
7624
7596
|
|
|
7625
7597
|
def on_commits_loaded(commits):
|
|
7626
7598
|
try:
|
|
7627
|
-
|
|
7628
|
-
self.root.after(0, lambda: self._render_commits_sync(commits))
|
|
7599
|
+
self.safe_after(0, self._render_commits_sync, commits)
|
|
7629
7600
|
except Exception:
|
|
7630
7601
|
pass
|
|
7631
7602
|
|
|
@@ -7674,7 +7645,7 @@ class AutoReadmeGUI:
|
|
|
7674
7645
|
manager = CustomChangelogManager(target)
|
|
7675
7646
|
|
|
7676
7647
|
def on_diff_loaded(diff_text):
|
|
7677
|
-
self.
|
|
7648
|
+
self.safe_after(0, self._render_diff_sync, diff_text)
|
|
7678
7649
|
|
|
7679
7650
|
manager.get_git_diff_async(on_diff_loaded)
|
|
7680
7651
|
|
|
@@ -7712,10 +7683,10 @@ class AutoReadmeGUI:
|
|
|
7712
7683
|
def setup_tab_generate(self):
|
|
7713
7684
|
f = self.tab_frames[3]
|
|
7714
7685
|
f.columnconfigure(0, weight=1)
|
|
7715
|
-
f.rowconfigure(
|
|
7686
|
+
f.rowconfigure(2, weight=1)
|
|
7716
7687
|
|
|
7717
7688
|
toolbar = GlassCard(f)
|
|
7718
|
-
toolbar.grid(row=0, column=0, sticky="ew", pady=(0,
|
|
7689
|
+
toolbar.grid(row=0, column=0, sticky="ew", pady=(0, 6))
|
|
7719
7690
|
toolbar.config(padx=15, pady=8)
|
|
7720
7691
|
|
|
7721
7692
|
self.gen_btn = apply_modern_hover(tk.Button(toolbar, text=get_text("generate_btn", self.lang), bg=PALETTE["accent_green"], fg="#000000", relief=tk.FLAT, font=("Segoe UI", 10, "bold"), command=self.start_generation, cursor="hand2"), hover_bg="#34d399", hover_fg="#000000")
|
|
@@ -7733,10 +7704,35 @@ class AutoReadmeGUI:
|
|
|
7733
7704
|
|
|
7734
7705
|
self.gen_status_lbl = tk.Label(toolbar, text="Ready", font=("Segoe UI", 9), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"])
|
|
7735
7706
|
self.gen_status_lbl.pack(side=tk.RIGHT)
|
|
7707
|
+
|
|
7708
|
+
# Agency 1-Click README & Squad Strip (448+ Blueprints)
|
|
7709
|
+
agency_bar = GlassCard(f)
|
|
7710
|
+
agency_bar.grid(row=1, column=0, sticky="ew", pady=(0, 8))
|
|
7711
|
+
agency_bar.config(padx=12, pady=6)
|
|
7712
|
+
|
|
7713
|
+
tk.Label(agency_bar, text="🤖 AGENCY README (448 Blueprints):", font=("Segoe UI", 8, "bold"), fg=PALETTE["accent_purple"], bg=PALETTE["card_bg"]).pack(side=tk.LEFT, padx=(0, 6))
|
|
7714
|
+
self.agency_bp_var = tk.StringVar(value="auto")
|
|
7715
|
+
bp_choices = ["auto", "mcp-server/launch-viral", "ai-agent-framework/launch-viral", "python-cli/developer-dx", "python-library/minimalist-zen", "fastapi-backend/enterprise-rfc", "nextjs-saas/launch-viral", "open-source-launch/bilingual-tr-en", "cybersecurity-tool/security-zero-trust"]
|
|
7716
|
+
try:
|
|
7717
|
+
from tzero.tzero_agency import README_BLUEPRINTS
|
|
7718
|
+
bp_choices = ["auto"] + sorted(README_BLUEPRINTS.keys())
|
|
7719
|
+
except Exception:
|
|
7720
|
+
pass
|
|
7721
|
+
self.agency_bp_combo = ttk.Combobox(agency_bar, textvariable=self.agency_bp_var, values=bp_choices, width=32)
|
|
7722
|
+
self.agency_bp_combo.pack(side=tk.LEFT, padx=(0, 8))
|
|
7723
|
+
|
|
7724
|
+
self.agency_readme_btn = apply_modern_hover(tk.Button(agency_bar, text="⚡ 1-Click Agency README", bg=PALETTE["card_border"], fg=PALETTE["accent_green"], relief=tk.FLAT, font=("Segoe UI", 8, "bold"), command=self.run_agency_readme_quick, cursor="hand2"), hover_bg=PALETTE["accent_green"], hover_fg="#000000")
|
|
7725
|
+
self.agency_readme_btn.pack(side=tk.LEFT, padx=3, ipady=2, ipadx=8)
|
|
7726
|
+
|
|
7727
|
+
self.agency_studio_btn = apply_modern_hover(tk.Button(agency_bar, text="🧭 Open Agency Studio (Squads & Skills)", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 8, "bold"), command=self.open_agency_studio_dialog, cursor="hand2"), hover_bg=PALETTE["accent_cyan"], hover_fg="#000000")
|
|
7728
|
+
self.agency_studio_btn.pack(side=tk.LEFT, padx=3, ipady=2, ipadx=8)
|
|
7729
|
+
|
|
7730
|
+
self.agency_hint_lbl = tk.Label(agency_bar, text="0 API key required • 24 Skills • 16 Subagents", font=("Segoe UI", 8), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"])
|
|
7731
|
+
self.agency_hint_lbl.pack(side=tk.RIGHT)
|
|
7736
7732
|
|
|
7737
7733
|
# Split pane in generate tab for raw markdown vs styled markdown preview
|
|
7738
7734
|
paned = tk.PanedWindow(f, orient=tk.HORIZONTAL, bg=PALETTE["bg_start"], bd=0, sashwidth=4, sashrelief=tk.FLAT)
|
|
7739
|
-
paned.grid(row=
|
|
7735
|
+
paned.grid(row=2, column=0, sticky="nsew")
|
|
7740
7736
|
|
|
7741
7737
|
raw_container = GlassCard(paned)
|
|
7742
7738
|
raw_container.rowconfigure(0, weight=1)
|
|
@@ -7767,7 +7763,7 @@ class AutoReadmeGUI:
|
|
|
7767
7763
|
paned.add(render_container, minsize=400)
|
|
7768
7764
|
|
|
7769
7765
|
bottom = GlassCard(f)
|
|
7770
|
-
bottom.grid(row=
|
|
7766
|
+
bottom.grid(row=3, column=0, sticky="ew", pady=(10, 0))
|
|
7771
7767
|
bottom.config(padx=10, pady=6)
|
|
7772
7768
|
|
|
7773
7769
|
self.copy_btn = apply_modern_hover(tk.Button(bottom, text=get_text("copy_btn", self.lang), bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=self.copy_clipboard, cursor="hand2"))
|
|
@@ -7798,7 +7794,7 @@ class AutoReadmeGUI:
|
|
|
7798
7794
|
def run_local_dry_run(self):
|
|
7799
7795
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
7800
7796
|
if not selected_files:
|
|
7801
|
-
|
|
7797
|
+
self._show_warning("Warning", "Please select at least one file for dry-run!")
|
|
7802
7798
|
return
|
|
7803
7799
|
|
|
7804
7800
|
d = self.dir_entry.get().strip() or os.getcwd()
|
|
@@ -7817,16 +7813,416 @@ class AutoReadmeGUI:
|
|
|
7817
7813
|
self.log("Offline AST context tree synthesized successfully.")
|
|
7818
7814
|
self.show_toast("⚡ Local Offline AST Context (100% Free & Zero-Leak) compiled successfully!", "success")
|
|
7819
7815
|
|
|
7816
|
+
def run_agency_readme_quick(self, blueprint_id: Optional[str] = None):
|
|
7817
|
+
"""Generate a repo-grounded README using one of 448 T-Zero Agency blueprints."""
|
|
7818
|
+
play_sfx("click")
|
|
7819
|
+
target_dir = self.dir_entry.get().strip() or os.getcwd()
|
|
7820
|
+
if not os.path.isdir(target_dir):
|
|
7821
|
+
self._show_warning("Warning", "Choose an existing workspace folder first!")
|
|
7822
|
+
return
|
|
7823
|
+
|
|
7824
|
+
chosen_bp = (blueprint_id or (self.agency_bp_var.get() if hasattr(self, "agency_bp_var") else "auto")).strip() or "auto"
|
|
7825
|
+
self.gen_progress["value"] = 25
|
|
7826
|
+
self.gen_status_lbl.config(text=f"Agency profiling workspace ({chosen_bp})...")
|
|
7827
|
+
if hasattr(self, "agency_readme_btn"):
|
|
7828
|
+
self.agency_readme_btn.config(state=tk.DISABLED)
|
|
7829
|
+
|
|
7830
|
+
def worker():
|
|
7831
|
+
try:
|
|
7832
|
+
from tzero.tzero_agency import TZeroAgency
|
|
7833
|
+
res = TZeroAgency.generate_readme(project_dir=target_dir, blueprint_id=chosen_bp)
|
|
7834
|
+
self.safe_after(0, lambda r=res: self._on_agency_readme_done(r))
|
|
7835
|
+
except Exception as exc:
|
|
7836
|
+
err_msg = str(exc)
|
|
7837
|
+
self.safe_after(0, lambda m=err_msg: self._on_agency_readme_error(m))
|
|
7838
|
+
|
|
7839
|
+
threading.Thread(target=worker, daemon=True).start()
|
|
7840
|
+
|
|
7841
|
+
def _on_agency_readme_done(self, result: Dict[str, Any]):
|
|
7842
|
+
if hasattr(self, "agency_readme_btn"):
|
|
7843
|
+
self.agency_readme_btn.config(state=tk.NORMAL)
|
|
7844
|
+
bp = result["blueprint"]
|
|
7845
|
+
prof = result["profile"]
|
|
7846
|
+
self.preview_text.delete("1.0", tk.END)
|
|
7847
|
+
self.preview_text.insert(tk.END, result["markdown"])
|
|
7848
|
+
self.update_rendered_markdown_panel()
|
|
7849
|
+
self.gen_progress["value"] = 100
|
|
7850
|
+
self.gen_status_lbl.config(text=f"Agency README ready: {bp['blueprint_id']}")
|
|
7851
|
+
if hasattr(self, "agency_hint_lbl"):
|
|
7852
|
+
self.agency_hint_lbl.config(text=f"Detected: {prof['primary_domain']} ({prof['primary_language']}) • Used {bp['blueprint_id']}")
|
|
7853
|
+
self.log(f"Agency synthesized README using blueprint '{bp['blueprint_id']}' ({prof['total_files']} files).")
|
|
7854
|
+
self.show_toast(f"🤖 Agency README ready ({bp['blueprint_id']})", "success")
|
|
7855
|
+
|
|
7856
|
+
def _on_agency_readme_error(self, message: str):
|
|
7857
|
+
if hasattr(self, "agency_readme_btn"):
|
|
7858
|
+
self.agency_readme_btn.config(state=tk.NORMAL)
|
|
7859
|
+
self.gen_progress["value"] = 0
|
|
7860
|
+
self.gen_status_lbl.config(text="Agency README failed.")
|
|
7861
|
+
self._show_error("Agency Error", message)
|
|
7862
|
+
|
|
7863
|
+
def open_agency_studio_dialog(self, initial_tab: int = 0):
|
|
7864
|
+
"""Open the interactive T-Zero Agency Studio (448 READMEs, 24 Skills, 16 Subagent Templates)."""
|
|
7865
|
+
play_sfx("click")
|
|
7866
|
+
try:
|
|
7867
|
+
from tzero.tzero_agency import (
|
|
7868
|
+
AGENCY_SKILLS,
|
|
7869
|
+
README_BLUEPRINTS,
|
|
7870
|
+
README_DOMAINS,
|
|
7871
|
+
README_STYLES,
|
|
7872
|
+
SUBAGENT_TEMPLATES,
|
|
7873
|
+
TZeroAgency,
|
|
7874
|
+
list_readme_blueprints,
|
|
7875
|
+
)
|
|
7876
|
+
except Exception as exc:
|
|
7877
|
+
self._show_error("Agency Error", f"Could not load T-Zero Agency: {exc}")
|
|
7878
|
+
return
|
|
7879
|
+
|
|
7880
|
+
target_dir = self.dir_entry.get().strip() or os.getcwd()
|
|
7881
|
+
if not os.path.isdir(target_dir):
|
|
7882
|
+
target_dir = os.getcwd()
|
|
7883
|
+
|
|
7884
|
+
dialog = tk.Toplevel(self.root)
|
|
7885
|
+
if siber_akademi_icon:
|
|
7886
|
+
try:
|
|
7887
|
+
siber_akademi_icon.apply_window_icon(dialog)
|
|
7888
|
+
except Exception:
|
|
7889
|
+
pass
|
|
7890
|
+
dialog.title("🤖 T-Zero Agency Studio — 448 READMEs • 24 Skills • 16 Subagents")
|
|
7891
|
+
dialog.geometry("1040x700")
|
|
7892
|
+
dialog.configure(bg=PALETTE["bg_start"])
|
|
7893
|
+
dialog.transient(self.root)
|
|
7894
|
+
|
|
7895
|
+
root_pad = tk.Frame(dialog, bg=PALETTE["bg_start"], padx=14, pady=12)
|
|
7896
|
+
root_pad.pack(fill=tk.BOTH, expand=True)
|
|
7897
|
+
|
|
7898
|
+
# Top workspace intelligence banner
|
|
7899
|
+
top_bar = GlassCard(root_pad)
|
|
7900
|
+
top_bar.pack(fill=tk.X, pady=(0, 8))
|
|
7901
|
+
top_inner = tk.Frame(top_bar, bg=PALETTE["card_bg"], padx=12, pady=8)
|
|
7902
|
+
top_inner.pack(fill=tk.X)
|
|
7903
|
+
|
|
7904
|
+
tk.Label(
|
|
7905
|
+
top_inner,
|
|
7906
|
+
text=f"🤖 T-ZERO AGENCY STUDIO • {len(README_BLUEPRINTS)} README Blueprints • {len(AGENCY_SKILLS)} Skills • {len(SUBAGENT_TEMPLATES)} Subagent Templates",
|
|
7907
|
+
font=("Segoe UI", 10, "bold"),
|
|
7908
|
+
fg=PALETTE["accent_cyan"],
|
|
7909
|
+
bg=PALETTE["card_bg"],
|
|
7910
|
+
).pack(side=tk.LEFT)
|
|
7911
|
+
|
|
7912
|
+
profile_lbl = tk.Label(
|
|
7913
|
+
top_inner,
|
|
7914
|
+
text=f"Workspace: {os.path.basename(os.path.abspath(target_dir))} (profiling...)",
|
|
7915
|
+
font=("Segoe UI", 8, "bold"),
|
|
7916
|
+
fg=PALETTE["accent_green"],
|
|
7917
|
+
bg=PALETTE["card_bg"],
|
|
7918
|
+
)
|
|
7919
|
+
profile_lbl.pack(side=tk.RIGHT)
|
|
7920
|
+
|
|
7921
|
+
studio_tabs = ttk.Notebook(root_pad)
|
|
7922
|
+
studio_tabs.pack(fill=tk.BOTH, expand=True)
|
|
7923
|
+
|
|
7924
|
+
tab_readme = tk.Frame(studio_tabs, bg=PALETTE["bg_start"], padx=8, pady=8)
|
|
7925
|
+
tab_squad = tk.Frame(studio_tabs, bg=PALETTE["bg_start"], padx=8, pady=8)
|
|
7926
|
+
tab_skills = tk.Frame(studio_tabs, bg=PALETTE["bg_start"], padx=8, pady=8)
|
|
7927
|
+
studio_tabs.add(tab_readme, text=f"📄 {len(README_BLUEPRINTS)} README Blueprints")
|
|
7928
|
+
studio_tabs.add(tab_squad, text=f"🐝 Multi-Agent Squad ({len(SUBAGENT_TEMPLATES)})")
|
|
7929
|
+
studio_tabs.add(tab_skills, text=f"⚡ Agency Skills ({len(AGENCY_SKILLS)})")
|
|
7930
|
+
|
|
7931
|
+
# --- STUDIO TAB 1: 448 README BLUEPRINTS ---
|
|
7932
|
+
filter_row = tk.Frame(tab_readme, bg=PALETTE["bg_start"])
|
|
7933
|
+
filter_row.pack(fill=tk.X, pady=(0, 8))
|
|
7934
|
+
|
|
7935
|
+
tk.Label(filter_row, text="Domain:", font=("Segoe UI", 8, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["bg_start"]).pack(side=tk.LEFT, padx=(0, 4))
|
|
7936
|
+
dom_var = tk.StringVar(value="all")
|
|
7937
|
+
dom_combo = ttk.Combobox(filter_row, textvariable=dom_var, values=["all"] + [d["id"] for d in README_DOMAINS], state="readonly", width=20)
|
|
7938
|
+
dom_combo.pack(side=tk.LEFT, padx=(0, 8))
|
|
7939
|
+
|
|
7940
|
+
tk.Label(filter_row, text="Style:", font=("Segoe UI", 8, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["bg_start"]).pack(side=tk.LEFT, padx=(0, 4))
|
|
7941
|
+
sty_var = tk.StringVar(value="all")
|
|
7942
|
+
sty_combo = ttk.Combobox(filter_row, textvariable=sty_var, values=["all"] + [s["id"] for s in README_STYLES], state="readonly", width=20)
|
|
7943
|
+
sty_combo.pack(side=tk.LEFT, padx=(0, 8))
|
|
7944
|
+
|
|
7945
|
+
tk.Label(filter_row, text="Search:", font=("Segoe UI", 8, "bold"), fg=PALETTE["text_muted"], bg=PALETTE["bg_start"]).pack(side=tk.LEFT, padx=(0, 4))
|
|
7946
|
+
rm_search_entry = tk.Entry(filter_row, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, width=22)
|
|
7947
|
+
rm_search_entry.pack(side=tk.LEFT, ipady=3, padx=(0, 8))
|
|
7948
|
+
|
|
7949
|
+
rm_count_lbl = tk.Label(filter_row, text=f"Showing {len(README_BLUEPRINTS)} / {len(README_BLUEPRINTS)}", font=("Segoe UI", 8, "bold"), fg=PALETTE["accent_cyan"], bg=PALETTE["bg_start"])
|
|
7950
|
+
rm_count_lbl.pack(side=tk.RIGHT)
|
|
7951
|
+
|
|
7952
|
+
rm_paned = tk.PanedWindow(tab_readme, orient=tk.HORIZONTAL, bg=PALETTE["bg_start"], bd=0, sashwidth=4)
|
|
7953
|
+
rm_paned.pack(fill=tk.BOTH, expand=True, pady=(0, 8))
|
|
7954
|
+
|
|
7955
|
+
rm_list_frame = tk.Frame(rm_paned, bg=PALETTE["card_bg"])
|
|
7956
|
+
rm_listbox = tk.Listbox(rm_list_frame, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], selectbackground=PALETTE["sidebar_bg"], relief=tk.FLAT, bd=0, font=("Consolas", 9))
|
|
7957
|
+
rm_scroll = tk.Scrollbar(rm_list_frame, command=rm_listbox.yview)
|
|
7958
|
+
rm_listbox.config(yscrollcommand=rm_scroll.set)
|
|
7959
|
+
rm_listbox.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
|
|
7960
|
+
rm_scroll.pack(side=tk.RIGHT, fill=tk.Y)
|
|
7961
|
+
|
|
7962
|
+
rm_preview = tk.Text(rm_paned, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, font=("Consolas", 9), wrap=tk.WORD)
|
|
7963
|
+
rm_paned.add(rm_list_frame, minsize=310)
|
|
7964
|
+
rm_paned.add(rm_preview, minsize=520)
|
|
7965
|
+
|
|
7966
|
+
filtered_bps: List[str] = []
|
|
7967
|
+
|
|
7968
|
+
def refresh_blueprints(_event=None):
|
|
7969
|
+
bps = list_readme_blueprints(domain=dom_var.get(), style=sty_var.get(), query=rm_search_entry.get())
|
|
7970
|
+
filtered_bps.clear()
|
|
7971
|
+
rm_listbox.delete(0, tk.END)
|
|
7972
|
+
for bp in bps:
|
|
7973
|
+
filtered_bps.append(bp.blueprint_id)
|
|
7974
|
+
rm_listbox.insert(tk.END, f"{bp.blueprint_id} | {bp.title}")
|
|
7975
|
+
rm_count_lbl.config(text=f"Showing {len(bps)} / {len(README_BLUEPRINTS)}")
|
|
7976
|
+
|
|
7977
|
+
def render_selected_bp(bp_id: str):
|
|
7978
|
+
rm_preview.delete("1.0", tk.END)
|
|
7979
|
+
rm_preview.insert("1.0", f"Generating README with '{bp_id}'...\n")
|
|
7980
|
+
|
|
7981
|
+
def work():
|
|
7982
|
+
try:
|
|
7983
|
+
res = TZeroAgency.generate_readme(project_dir=target_dir, blueprint_id=bp_id)
|
|
7984
|
+
self.safe_after(0, lambda r=res: (
|
|
7985
|
+
dialog.winfo_exists() and (
|
|
7986
|
+
rm_preview.delete("1.0", tk.END),
|
|
7987
|
+
rm_preview.insert("1.0", r["markdown"]),
|
|
7988
|
+
self.log(f"Agency Studio generated '{r['blueprint']['blueprint_id']}'."),
|
|
7989
|
+
)
|
|
7990
|
+
))
|
|
7991
|
+
except Exception as exc:
|
|
7992
|
+
self.safe_after(0, lambda m=str(exc): dialog.winfo_exists() and rm_preview.insert(tk.END, f"\n[ERROR] {m}"))
|
|
7993
|
+
|
|
7994
|
+
threading.Thread(target=work, daemon=True).start()
|
|
7995
|
+
|
|
7996
|
+
def on_generate_selected():
|
|
7997
|
+
sel = rm_listbox.curselection()
|
|
7998
|
+
bp_id = filtered_bps[sel[0]] if sel else "auto"
|
|
7999
|
+
render_selected_bp(bp_id)
|
|
8000
|
+
|
|
8001
|
+
def on_send_to_main():
|
|
8002
|
+
txt = rm_preview.get("1.0", tk.END).strip()
|
|
8003
|
+
if not txt:
|
|
8004
|
+
return
|
|
8005
|
+
self.preview_text.delete("1.0", tk.END)
|
|
8006
|
+
self.preview_text.insert(tk.END, txt)
|
|
8007
|
+
self.update_rendered_markdown_panel()
|
|
8008
|
+
self.switch_tab(3)
|
|
8009
|
+
self.show_toast("📥 Agency README loaded into Generate & Preview tab!", "success")
|
|
8010
|
+
|
|
8011
|
+
def on_save_readme_file():
|
|
8012
|
+
txt = rm_preview.get("1.0", tk.END).strip()
|
|
8013
|
+
if not txt:
|
|
8014
|
+
return
|
|
8015
|
+
out_path = filedialog.asksaveasfilename(
|
|
8016
|
+
initialdir=target_dir,
|
|
8017
|
+
initialfile="README.md",
|
|
8018
|
+
defaultextension=".md",
|
|
8019
|
+
filetypes=[("Markdown", "*.md"), ("All Files", "*.*")],
|
|
8020
|
+
)
|
|
8021
|
+
if out_path:
|
|
8022
|
+
with open(out_path, "w", encoding="utf-8") as fp:
|
|
8023
|
+
fp.write(txt + "\n")
|
|
8024
|
+
self.show_toast(f"💾 Saved README to {os.path.basename(out_path)}", "success")
|
|
8025
|
+
|
|
8026
|
+
dom_combo.bind("<<ComboboxSelected>>", refresh_blueprints)
|
|
8027
|
+
sty_combo.bind("<<ComboboxSelected>>", refresh_blueprints)
|
|
8028
|
+
rm_search_entry.bind("<KeyRelease>", refresh_blueprints)
|
|
8029
|
+
rm_listbox.bind("<Double-Button-1>", lambda _e: on_generate_selected())
|
|
8030
|
+
|
|
8031
|
+
rm_actions = tk.Frame(tab_readme, bg=PALETTE["bg_start"])
|
|
8032
|
+
rm_actions.pack(fill=tk.X)
|
|
8033
|
+
tk.Button(rm_actions, text="⚡ Auto-Best Match", bg=PALETTE["accent_green"], fg="#000000", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=lambda: render_selected_bp("auto"), cursor="hand2").pack(side=tk.LEFT, padx=(0, 6), ipady=4, ipadx=10)
|
|
8034
|
+
tk.Button(rm_actions, text="▶ Generate Selected", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_generate_selected, cursor="hand2").pack(side=tk.LEFT, padx=4, ipady=4, ipadx=10)
|
|
8035
|
+
tk.Button(rm_actions, text="📥 Load in Main Preview", bg=PALETTE["card_border"], fg=PALETTE["accent_purple"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_send_to_main, cursor="hand2").pack(side=tk.LEFT, padx=4, ipady=4, ipadx=10)
|
|
8036
|
+
tk.Button(rm_actions, text="💾 Save As...", bg=PALETTE["card_border"], fg=PALETTE["text_main"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_save_readme_file, cursor="hand2").pack(side=tk.RIGHT, ipady=4, ipadx=10)
|
|
8037
|
+
|
|
8038
|
+
refresh_blueprints()
|
|
8039
|
+
|
|
8040
|
+
# --- STUDIO TAB 2: MULTI-AGENT SQUAD & 16 SUBAGENTS ---
|
|
8041
|
+
sq_top = tk.Frame(tab_squad, bg=PALETTE["bg_start"])
|
|
8042
|
+
sq_top.pack(fill=tk.X, pady=(0, 6))
|
|
8043
|
+
tk.Label(sq_top, text="Task / Goal (EN or TR):", font=("Segoe UI", 9, "bold"), fg=PALETTE["accent_cyan"], bg=PALETTE["bg_start"]).pack(side=tk.LEFT, padx=(0, 6))
|
|
8044
|
+
goal_entry = tk.Entry(sq_top, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9))
|
|
8045
|
+
goal_entry.pack(side=tk.LEFT, fill=tk.X, expand=True, ipady=4, padx=(0, 8))
|
|
8046
|
+
goal_entry.insert(0, "Analyze codebase structure, prepare README, security & test plan")
|
|
8047
|
+
|
|
8048
|
+
sq_presets = tk.Frame(tab_squad, bg=PALETTE["bg_start"])
|
|
8049
|
+
sq_presets.pack(fill=tk.X, pady=(0, 8))
|
|
8050
|
+
for label, preset_goal in (
|
|
8051
|
+
("📄 README + Docs", "Analyze project architecture and synthesize optimal README & docs"),
|
|
8052
|
+
("🛡️ Security & Zero-Leak", "Run zero-leak secret audit, boundary checks, and supply-chain verification"),
|
|
8053
|
+
("🔌 API + Tests", "Map API/MCP endpoints, check types, and build test coverage plan"),
|
|
8054
|
+
("🧹 Refactor & Debt", "Find duplicate blocks, dead code, complexity hotspots, and plan cleanup"),
|
|
8055
|
+
("🚀 Release Readiness", "Verify CI workflows, version sync, tests, and release readiness"),
|
|
8056
|
+
):
|
|
8057
|
+
tk.Button(
|
|
8058
|
+
sq_presets,
|
|
8059
|
+
text=label,
|
|
8060
|
+
bg=PALETTE["card_border"],
|
|
8061
|
+
fg=PALETTE["text_main"],
|
|
8062
|
+
relief=tk.FLAT,
|
|
8063
|
+
font=("Segoe UI", 8),
|
|
8064
|
+
cursor="hand2",
|
|
8065
|
+
command=lambda g=preset_goal: (goal_entry.delete(0, tk.END), goal_entry.insert(0, g)),
|
|
8066
|
+
).pack(side=tk.LEFT, padx=3)
|
|
8067
|
+
|
|
8068
|
+
sq_paned = tk.PanedWindow(tab_squad, orient=tk.HORIZONTAL, bg=PALETTE["bg_start"], bd=0, sashwidth=4)
|
|
8069
|
+
sq_paned.pack(fill=tk.BOTH, expand=True, pady=(0, 8))
|
|
8070
|
+
|
|
8071
|
+
sq_list_frame = tk.Frame(sq_paned, bg=PALETTE["card_bg"])
|
|
8072
|
+
sq_listbox = tk.Listbox(sq_list_frame, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], selectbackground=PALETTE["sidebar_bg"], relief=tk.FLAT, bd=0, font=("Consolas", 9))
|
|
8073
|
+
for tmpl in SUBAGENT_TEMPLATES:
|
|
8074
|
+
sq_listbox.insert(tk.END, f"[W{tmpl.wave}|{tmpl.tier}] {tmpl.role_name}")
|
|
8075
|
+
sq_listbox.pack(fill=tk.BOTH, expand=True)
|
|
8076
|
+
|
|
8077
|
+
sq_output = tk.Text(sq_paned, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, font=("Consolas", 9), wrap=tk.WORD)
|
|
8078
|
+
sq_paned.add(sq_list_frame, minsize=290)
|
|
8079
|
+
sq_paned.add(sq_output, minsize=540)
|
|
8080
|
+
|
|
8081
|
+
def on_inspect_template(_e=None):
|
|
8082
|
+
sel = sq_listbox.curselection()
|
|
8083
|
+
if not sel:
|
|
8084
|
+
return
|
|
8085
|
+
tmpl = SUBAGENT_TEMPLATES[sel[0]]
|
|
8086
|
+
sq_output.delete("1.0", tk.END)
|
|
8087
|
+
sq_output.insert("1.0", tmpl.to_skill_markdown())
|
|
8088
|
+
|
|
8089
|
+
sq_listbox.bind("<<TreeviewSelect>>", on_inspect_template)
|
|
8090
|
+
sq_listbox.bind("<<ListboxSelect>>", on_inspect_template)
|
|
8091
|
+
|
|
8092
|
+
def on_run_squad():
|
|
8093
|
+
mission = goal_entry.get().strip() or "Full workspace analysis"
|
|
8094
|
+
sq_output.delete("1.0", tk.END)
|
|
8095
|
+
sq_output.insert("1.0", f"Assembling tailored subagent squad for: {mission}\n")
|
|
8096
|
+
|
|
8097
|
+
def work():
|
|
8098
|
+
try:
|
|
8099
|
+
res = TZeroAgency.run(goal=mission, project_dir=target_dir, generate_readme_flag=True)
|
|
8100
|
+
self.safe_after(0, lambda r=res: (
|
|
8101
|
+
dialog.winfo_exists() and (
|
|
8102
|
+
sq_output.delete("1.0", tk.END),
|
|
8103
|
+
sq_output.insert("1.0", r.summary_markdown),
|
|
8104
|
+
self.show_toast(f"🐝 Agency squad finished ({len(r.agent_reports)} agents in {r.elapsed_ms:.0f}ms)", "success"),
|
|
8105
|
+
)
|
|
8106
|
+
))
|
|
8107
|
+
except Exception as exc:
|
|
8108
|
+
self.safe_after(0, lambda m=str(exc): dialog.winfo_exists() and sq_output.insert(tk.END, f"\n[ERROR] {m}"))
|
|
8109
|
+
|
|
8110
|
+
threading.Thread(target=work, daemon=True).start()
|
|
8111
|
+
|
|
8112
|
+
def on_export_pack():
|
|
8113
|
+
try:
|
|
8114
|
+
exp = TZeroAgency.export_pack(project_dir=target_dir, goal=goal_entry.get().strip())
|
|
8115
|
+
self.show_toast(f"📦 Exported {exp['exported_count']} Agency files to .tzero/agency/", "success")
|
|
8116
|
+
sq_output.insert(tk.END, f"\n\n[EXPORTED] {exp['exported_count']} files -> {os.path.join(exp['workspace_dir'], '.tzero', 'agency')}\n")
|
|
8117
|
+
except Exception as exc:
|
|
8118
|
+
self._show_error("Export Error", str(exc))
|
|
8119
|
+
|
|
8120
|
+
sq_actions = tk.Frame(tab_squad, bg=PALETTE["bg_start"])
|
|
8121
|
+
sq_actions.pack(fill=tk.X)
|
|
8122
|
+
tk.Button(sq_actions, text="🚀 Analyze Structure & Run Squad", bg=PALETTE["accent_green"], fg="#000000", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_run_squad, cursor="hand2").pack(side=tk.LEFT, padx=(0, 6), ipady=4, ipadx=12)
|
|
8123
|
+
tk.Button(sq_actions, text="📦 Export Squad & Skills (.tzero/agency/)", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_export_pack, cursor="hand2").pack(side=tk.LEFT, padx=4, ipady=4, ipadx=10)
|
|
8124
|
+
|
|
8125
|
+
# --- STUDIO TAB 3: 24 AGENCY SKILLS ---
|
|
8126
|
+
sk_top = tk.Frame(tab_skills, bg=PALETTE["bg_start"])
|
|
8127
|
+
sk_top.pack(fill=tk.X, pady=(0, 6))
|
|
8128
|
+
tk.Label(sk_top, text="Search Skills:", font=("Segoe UI", 9, "bold"), fg=PALETTE["accent_purple"], bg=PALETTE["bg_start"]).pack(side=tk.LEFT, padx=(0, 6))
|
|
8129
|
+
sk_search = tk.Entry(sk_top, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, font=("Segoe UI", 9))
|
|
8130
|
+
sk_search.pack(side=tk.LEFT, fill=tk.X, expand=True, ipady=4)
|
|
8131
|
+
|
|
8132
|
+
sk_paned = tk.PanedWindow(tab_skills, orient=tk.HORIZONTAL, bg=PALETTE["bg_start"], bd=0, sashwidth=4)
|
|
8133
|
+
sk_paned.pack(fill=tk.BOTH, expand=True, pady=(0, 8))
|
|
8134
|
+
|
|
8135
|
+
sk_list_frame = tk.Frame(sk_paned, bg=PALETTE["card_bg"])
|
|
8136
|
+
sk_listbox = tk.Listbox(sk_list_frame, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], selectbackground=PALETTE["sidebar_bg"], relief=tk.FLAT, bd=0, font=("Consolas", 9))
|
|
8137
|
+
sk_listbox.pack(fill=tk.BOTH, expand=True)
|
|
8138
|
+
sk_preview = tk.Text(sk_paned, bg=PALETTE["card_bg"], fg=PALETTE["text_main"], insertbackground="#ffffff", relief=tk.FLAT, font=("Consolas", 9), wrap=tk.WORD)
|
|
8139
|
+
sk_paned.add(sk_list_frame, minsize=300)
|
|
8140
|
+
sk_paned.add(sk_preview, minsize=530)
|
|
8141
|
+
|
|
8142
|
+
visible_skills: List[Any] = []
|
|
8143
|
+
|
|
8144
|
+
def refresh_skills(_e=None):
|
|
8145
|
+
q = sk_search.get().strip().lower()
|
|
8146
|
+
visible_skills.clear()
|
|
8147
|
+
sk_listbox.delete(0, tk.END)
|
|
8148
|
+
for sk in AGENCY_SKILLS:
|
|
8149
|
+
if not q or q in sk.skill_id or q in sk.name.lower() or q in sk.summary.lower() or q in sk.category.lower():
|
|
8150
|
+
visible_skills.append(sk)
|
|
8151
|
+
sk_listbox.insert(tk.END, f"[{sk.tier}] {sk.skill_id} — {sk.category}")
|
|
8152
|
+
|
|
8153
|
+
def on_select_skill(_e=None):
|
|
8154
|
+
sel = sk_listbox.curselection()
|
|
8155
|
+
if not sel:
|
|
8156
|
+
return
|
|
8157
|
+
sk = visible_skills[sel[0]]
|
|
8158
|
+
sk_preview.delete("1.0", tk.END)
|
|
8159
|
+
sk_preview.insert("1.0", sk.to_skill_markdown())
|
|
8160
|
+
|
|
8161
|
+
def on_run_skill():
|
|
8162
|
+
sel = sk_listbox.curselection()
|
|
8163
|
+
if not sel:
|
|
8164
|
+
return
|
|
8165
|
+
sk = visible_skills[sel[0]]
|
|
8166
|
+
sk_preview.delete("1.0", tk.END)
|
|
8167
|
+
sk_preview.insert("1.0", f"Running skill '{sk.skill_id}'...\n")
|
|
8168
|
+
|
|
8169
|
+
def work():
|
|
8170
|
+
try:
|
|
8171
|
+
res = TZeroAgency.run_skill(sk.skill_id, project_dir=target_dir)
|
|
8172
|
+
self.safe_after(0, lambda r=res: dialog.winfo_exists() and (
|
|
8173
|
+
sk_preview.delete("1.0", tk.END),
|
|
8174
|
+
sk_preview.insert("1.0", r["markdown"]),
|
|
8175
|
+
))
|
|
8176
|
+
except Exception as exc:
|
|
8177
|
+
self.safe_after(0, lambda m=str(exc): dialog.winfo_exists() and sk_preview.insert(tk.END, f"\n[ERROR] {m}"))
|
|
8178
|
+
|
|
8179
|
+
threading.Thread(target=work, daemon=True).start()
|
|
8180
|
+
|
|
8181
|
+
def on_load_skill_to_workbench():
|
|
8182
|
+
txt = sk_preview.get("1.0", tk.END).strip()
|
|
8183
|
+
if not txt or not hasattr(self, "tmpl_text"):
|
|
8184
|
+
return
|
|
8185
|
+
self.tmpl_text.delete("1.0", tk.END)
|
|
8186
|
+
self.tmpl_text.insert("1.0", txt)
|
|
8187
|
+
self.update_prompt_playground_sandbox()
|
|
8188
|
+
self.switch_tab(4)
|
|
8189
|
+
self.show_toast("📥 Loaded into Prompt & Template Workbench!", "success")
|
|
8190
|
+
|
|
8191
|
+
sk_search.bind("<KeyRelease>", refresh_skills)
|
|
8192
|
+
sk_listbox.bind("<<ListboxSelect>>", on_select_skill)
|
|
8193
|
+
refresh_skills()
|
|
8194
|
+
|
|
8195
|
+
sk_actions = tk.Frame(tab_skills, bg=PALETTE["bg_start"])
|
|
8196
|
+
sk_actions.pack(fill=tk.X)
|
|
8197
|
+
tk.Button(sk_actions, text="▶ Run Selected Skill", bg=PALETTE["accent_green"], fg="#000000", relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_run_skill, cursor="hand2").pack(side=tk.LEFT, padx=(0, 6), ipady=4, ipadx=10)
|
|
8198
|
+
tk.Button(sk_actions, text="📥 Load into Template Workbench", bg=PALETTE["card_border"], fg=PALETTE["accent_purple"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_load_skill_to_workbench, cursor="hand2").pack(side=tk.LEFT, padx=4, ipady=4, ipadx=10)
|
|
8199
|
+
tk.Button(sk_actions, text="📤 Export All 24 Skills", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=on_export_pack, cursor="hand2").pack(side=tk.RIGHT, ipady=4, ipadx=10)
|
|
8200
|
+
|
|
8201
|
+
if 0 <= initial_tab <= 2:
|
|
8202
|
+
studio_tabs.select(initial_tab)
|
|
8203
|
+
|
|
8204
|
+
# Async initial profiling so dialog opens instantaneously
|
|
8205
|
+
def load_initial_profile():
|
|
8206
|
+
try:
|
|
8207
|
+
prof = TZeroAgency.profile(target_dir)
|
|
8208
|
+
self.safe_after(0, lambda p=prof: dialog.winfo_exists() and profile_lbl.config(
|
|
8209
|
+
text=f"{p.project_name} • {p.primary_language} • Domain: {p.primary_domain} • {p.total_files} files"
|
|
8210
|
+
))
|
|
8211
|
+
except Exception:
|
|
8212
|
+
pass
|
|
8213
|
+
|
|
8214
|
+
threading.Thread(target=load_initial_profile, daemon=True).start()
|
|
8215
|
+
|
|
7820
8216
|
def start_generation(self):
|
|
7821
8217
|
url = self.api_url_entry.get().strip()
|
|
7822
8218
|
key = self.api_key_entry.get().strip()
|
|
7823
8219
|
if not url:
|
|
7824
|
-
|
|
8220
|
+
self._show_error("Error", "API Base URL is required!")
|
|
7825
8221
|
return
|
|
7826
8222
|
|
|
7827
8223
|
selected_files = [f for f, v in self.file_checked.items() if v]
|
|
7828
8224
|
if not selected_files:
|
|
7829
|
-
|
|
8225
|
+
self._show_warning("Warning", "Please check at least one codebase file first!")
|
|
7830
8226
|
return
|
|
7831
8227
|
|
|
7832
8228
|
self.cancel_event.clear()
|
|
@@ -7993,7 +8389,7 @@ Custom Requirements:
|
|
|
7993
8389
|
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."
|
|
7994
8390
|
elif "410" in err_str or "end of life" in err_str:
|
|
7995
8391
|
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."
|
|
7996
|
-
|
|
8392
|
+
self._show_error("Error", detail)
|
|
7997
8393
|
|
|
7998
8394
|
def copy_clipboard(self):
|
|
7999
8395
|
txt = self.preview_text.get("1.0", tk.END).strip()
|
|
@@ -8022,7 +8418,7 @@ Custom Requirements:
|
|
|
8022
8418
|
self.log(f"README.md saved to: {p}")
|
|
8023
8419
|
except Exception as e:
|
|
8024
8420
|
play_sfx("error")
|
|
8025
|
-
|
|
8421
|
+
self._show_error("Error", str(e))
|
|
8026
8422
|
|
|
8027
8423
|
def export_agents_md(self):
|
|
8028
8424
|
play_sfx("click")
|
|
@@ -8051,7 +8447,7 @@ Custom Requirements:
|
|
|
8051
8447
|
self.log(f"AGENTS.md blueprint exported: {out_path}")
|
|
8052
8448
|
except Exception as e:
|
|
8053
8449
|
play_sfx("error")
|
|
8054
|
-
|
|
8450
|
+
self._show_error("Error", f"Failed saving AGENTS.md: {e}")
|
|
8055
8451
|
|
|
8056
8452
|
def export_architecture_md(self):
|
|
8057
8453
|
play_sfx("click")
|
|
@@ -8128,7 +8524,7 @@ Custom Requirements:
|
|
|
8128
8524
|
|
|
8129
8525
|
def _on_arch_export_error(self, err_msg: str):
|
|
8130
8526
|
play_sfx("error")
|
|
8131
|
-
|
|
8527
|
+
self._show_error("Error", f"Failed saving ARCHITECTURE.md: {err_msg}")
|
|
8132
8528
|
self.gen_status_lbl.config(text="Architecture export failed.")
|
|
8133
8529
|
|
|
8134
8530
|
def export_repo_map(self):
|
|
@@ -8162,7 +8558,7 @@ Custom Requirements:
|
|
|
8162
8558
|
self.log(f"REPO_MAP.txt exported: {out_path}")
|
|
8163
8559
|
except Exception as e:
|
|
8164
8560
|
play_sfx("error")
|
|
8165
|
-
|
|
8561
|
+
self._show_error("Error", f"Failed saving REPO_MAP.txt: {e}")
|
|
8166
8562
|
|
|
8167
8563
|
def export_html_preview(self):
|
|
8168
8564
|
play_sfx("click")
|
|
@@ -8183,7 +8579,7 @@ Custom Requirements:
|
|
|
8183
8579
|
webbrowser.open(os.path.abspath(out_path))
|
|
8184
8580
|
except Exception as e:
|
|
8185
8581
|
play_sfx("error")
|
|
8186
|
-
|
|
8582
|
+
self._show_error("Error", f"Failed opening HTML preview: {e}")
|
|
8187
8583
|
|
|
8188
8584
|
# --- TAB 5: PROMPT WORKBENCH PLAYGROUND ---
|
|
8189
8585
|
def setup_tab_template(self):
|
|
@@ -8205,6 +8601,9 @@ Custom Requirements:
|
|
|
8205
8601
|
self.optimize_prompt_btn = apply_modern_hover(tk.Button(toolbar, text="🧠 Optimize Prompts Heuristic", bg=PALETTE["card_border"], fg=PALETTE["accent_cyan"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=self.run_prompt_optimization_check, cursor="hand2"), hover_bg=PALETTE["accent_cyan"], hover_fg="#000000")
|
|
8206
8602
|
self.optimize_prompt_btn.pack(side=tk.LEFT, padx=5)
|
|
8207
8603
|
|
|
8604
|
+
self.agency_studio_tmpl_btn = apply_modern_hover(tk.Button(toolbar, text="🤖 Agency Studio (448 READMEs • Skills • Subagents)", bg=PALETTE["card_border"], fg=PALETTE["accent_purple"], relief=tk.FLAT, font=("Segoe UI", 9, "bold"), command=lambda: self.open_agency_studio_dialog(initial_tab=2), cursor="hand2"), hover_bg=PALETTE["accent_purple"], hover_fg="#ffffff")
|
|
8605
|
+
self.agency_studio_tmpl_btn.pack(side=tk.LEFT, padx=5)
|
|
8606
|
+
|
|
8208
8607
|
tk.Label(toolbar, text="Use tokens: {{PROJECT_NAME}}, {{MODULES_REFERENCE}}, {{HALLUCINATION_GUARDRAILS}}", font=("Segoe UI", 9), fg=PALETTE["text_muted"], bg=PALETTE["card_bg"]).pack(side=tk.RIGHT)
|
|
8209
8608
|
|
|
8210
8609
|
paned = tk.PanedWindow(f, orient=tk.HORIZONTAL, bg=PALETTE["bg_start"], bd=0, sashwidth=4, sashrelief=tk.FLAT)
|
|
@@ -8276,7 +8675,7 @@ Custom Requirements:
|
|
|
8276
8675
|
def save_template(self):
|
|
8277
8676
|
self.template_engine.template_content = self.tmpl_text.get("1.0", tk.END)
|
|
8278
8677
|
self.log("Custom template layouts saved.")
|
|
8279
|
-
|
|
8678
|
+
self._show_info("Success", "Template updated successfully!")
|
|
8280
8679
|
|
|
8281
8680
|
def reset_template(self):
|
|
8282
8681
|
self.tmpl_text.delete("1.0", tk.END)
|
|
@@ -8497,59 +8896,11 @@ Custom Requirements:
|
|
|
8497
8896
|
file_node = self.ast_tree.insert("", "end", text=f"📄 {os.path.basename(filepath)} (AST Fail)")
|
|
8498
8897
|
|
|
8499
8898
|
def start_system_telemetry(self):
|
|
8500
|
-
def
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
try:
|
|
8506
|
-
self.root.after(0, lambda c=cpu, m=mem: self.perf_chart.update_values(c, m))
|
|
8507
|
-
except Exception:
|
|
8508
|
-
break
|
|
8509
|
-
threading.Thread(target=telemetry, daemon=True).start()
|
|
8510
|
-
|
|
8511
|
-
def _apply_live_community_stats(self, stats: Dict[str, Any]):
|
|
8512
|
-
"""Apply live GitHub star and registry download counts to header & open dialog."""
|
|
8513
|
-
if not stats:
|
|
8514
|
-
return
|
|
8515
|
-
self.community_stats = stats
|
|
8516
|
-
stars = int(stats.get("stars", 111))
|
|
8517
|
-
target_stars = int(stats.get("target_stars", 250))
|
|
8518
|
-
pct_ratio = max(0.05, min(1.0, stars / max(1, target_stars)))
|
|
8519
|
-
pct_int = int(round(pct_ratio * 100))
|
|
8520
|
-
dl_label = str(stats.get("downloads_label", "22,900+"))
|
|
8521
|
-
saved_label = str(stats.get("saved_tokens_label", "1,120,000+"))
|
|
8522
|
-
|
|
8523
|
-
try:
|
|
8524
|
-
if hasattr(self, "star_header_btn") and self.star_header_btn.winfo_exists():
|
|
8525
|
-
self.star_header_btn.set_text(f"★ STAR ({stars}★)")
|
|
8526
|
-
except Exception:
|
|
8527
|
-
pass
|
|
8528
|
-
|
|
8529
|
-
w = getattr(self, "_star_dialog_widgets", {}) or {}
|
|
8530
|
-
dlg = w.get("dialog")
|
|
8531
|
-
try:
|
|
8532
|
-
if dlg and dlg.winfo_exists():
|
|
8533
|
-
if not w.get("first_launch"):
|
|
8534
|
-
w["hdr_lbl"].config(text=f"⭐ {target_stars} STARS GOAL: JOIN THE COMMUNITY!")
|
|
8535
|
-
w["stats_lbl"].config(
|
|
8536
|
-
text=f"🚀 {dl_label} Downloads (PyPI & npm) | ⚡ {saved_label} Tokens Saved\n⭐ Current Stars: {stars} / {target_stars} Goal (Progress: {pct_int}%)"
|
|
8537
|
-
)
|
|
8538
|
-
w["bar_fill"].place_configure(relwidth=pct_ratio)
|
|
8539
|
-
w["msg_lbl"].config(text=w["build_msg"](stars, target_stars))
|
|
8540
|
-
except Exception:
|
|
8541
|
-
pass
|
|
8542
|
-
|
|
8543
|
-
def start_community_stats_refresh(self):
|
|
8544
|
-
"""Fetch live GitHub star count and download stats asynchronously without blocking UI."""
|
|
8545
|
-
def _worker():
|
|
8546
|
-
try:
|
|
8547
|
-
from tzero.tzero_growth import get_live_community_stats
|
|
8548
|
-
stats = get_live_community_stats(timeout=3.0, force_refresh=True, include_downloads=True)
|
|
8549
|
-
self.safe_after(0, lambda s=stats: self._apply_live_community_stats(s))
|
|
8550
|
-
except Exception:
|
|
8551
|
-
pass
|
|
8552
|
-
threading.Thread(target=_worker, daemon=True).start()
|
|
8899
|
+
def refresh():
|
|
8900
|
+
if self.perf_chart.winfo_viewable():
|
|
8901
|
+
self.perf_chart.update_values(random.uniform(5.0, 30.0), random.uniform(20.0, 45.0))
|
|
8902
|
+
self.root.after(2000, refresh)
|
|
8903
|
+
self.root.after(2000, refresh)
|
|
8553
8904
|
|
|
8554
8905
|
|
|
8555
8906
|
# --- 14. STARTUP ORCHESTRATION & CLI WIZARD ---
|
|
@@ -9561,6 +9912,11 @@ def main():
|
|
|
9561
9912
|
run_system_disk_doctor(clean=True, workspace_dir=target_dir)
|
|
9562
9913
|
sys.exit(0)
|
|
9563
9914
|
|
|
9915
|
+
# Fast path for T-Zero Agency (448 README Blueprints, 24 Skills, 16 Subagent Templates)
|
|
9916
|
+
if len(sys.argv) > 1 and sys.argv[1].lower() in ("agency", "--agency", "-agency"):
|
|
9917
|
+
from tzero.tzero_agency import run_agency_cli
|
|
9918
|
+
sys.exit(run_agency_cli(sys.argv[2:]))
|
|
9919
|
+
|
|
9564
9920
|
parser = argparse.ArgumentParser(
|
|
9565
9921
|
description="Siber Akademi T-Zero Context Architect - Enterprise Codebase Context Builder & Token Reducer",
|
|
9566
9922
|
epilog="""
|
|
@@ -9656,7 +10012,7 @@ def main():
|
|
|
9656
10012
|
default="o200k_base", help="BPE encoding for --symbol-context")
|
|
9657
10013
|
parser.add_argument("--cache-aligned", action="store_true", help="Order context for KV-cache prefix stability (immutable static prefix before dynamic query suffix)")
|
|
9658
10014
|
parser.add_argument("--commit-msg", action="store_true", help="Generate Conventional Commit message from local AST git diff ($0 local engine)")
|
|
9659
|
-
parser.add_argument("--changelog", nargs="?", const="v12.3.
|
|
10015
|
+
parser.add_argument("--changelog", nargs="?", const="v12.3.7", default=None, metavar="VERSION", help="Generate release CHANGELOG markdown from git history")
|
|
9660
10016
|
parser.add_argument("--ci", choices=["github", "gitlab", "pre-commit", "local", "all"], default=None, help="Install CI/CD workflow or run local verification suite")
|
|
9661
10017
|
parser.add_argument("--local-ci", action="store_true", help="Run comprehensive Local CI & Pre-Push verification battery ($0 quota burn)")
|
|
9662
10018
|
parser.add_argument("--quick-ci", action="store_true", help="Run fast Local CI smoke checks in seconds")
|
|
@@ -9720,7 +10076,12 @@ def main():
|
|
|
9720
10076
|
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")
|
|
9721
10077
|
parser.add_argument("--showcase", nargs="?", const="tzero_showcase.html", default=None, metavar="FILE", help="Generate interactive split-screen HTML5 comparison showcase slider")
|
|
9722
10078
|
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")
|
|
9723
|
-
parser.add_argument("--
|
|
10079
|
+
parser.add_argument("--agency-readme", nargs="?", const="auto", default=None, metavar="BLUEPRINT", help="Generate repo-grounded README from 448 T-Zero Agency blueprints")
|
|
10080
|
+
parser.add_argument("--agency-skills", action="store_true", help="List all 24 T-Zero Agency built-in skills")
|
|
10081
|
+
parser.add_argument("--agency-templates", action="store_true", help="List all 16 T-Zero Agency subagent templates")
|
|
10082
|
+
parser.add_argument("--agency-export", action="store_true", help="Export Agency skills and subagent templates to .tzero/agency/")
|
|
10083
|
+
parser.add_argument("--agency-run", nargs="?", const="", default=None, metavar="GOAL", help="Run task-and-structure-aware T-Zero Agency multi-agent squad")
|
|
10084
|
+
parser.add_argument("--version", "-v", action="version", version="T-Zero Context Architect v12.3.7 Master Edition (engine v4.1.0)")
|
|
9724
10085
|
|
|
9725
10086
|
|
|
9726
10087
|
def print_master_tutorial():
|
|
@@ -9829,7 +10190,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
9829
10190
|
def print_quickstart_guide():
|
|
9830
10191
|
print("""
|
|
9831
10192
|
================================================================================
|
|
9832
|
-
⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.3.
|
|
10193
|
+
⚡ SİBER AKADEMİ — T-ZERO CONTEXT ARCHITECT & MCP v12.3.7 MASTER (engine v4.1.0)
|
|
9833
10194
|
================================================================================
|
|
9834
10195
|
🎯 %95'e Varan Token Tasarrufu & Otonom Yapay Zeka Mimari Bağlam Motoru
|
|
9835
10196
|
|
|
@@ -9872,6 +10233,12 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
9872
10233
|
9️⃣ Hugging Face Space & Canlı Web Paneli:
|
|
9873
10234
|
$ tzero hf
|
|
9874
10235
|
|
|
10236
|
+
🤖 T-ZERO AGENCY (448 README Blueprints • 24 Skills • 16 Subagents):
|
|
10237
|
+
$ tzero agency # Yapıyı analiz et, en uygun ekip ve README öner
|
|
10238
|
+
$ tzero agency readme --out README.md # 448 şablondan en uygununu seçip README üret
|
|
10239
|
+
$ tzero agency run "API ve testleri kur" # Göreve özel çoklu ajan ekibini çalıştır
|
|
10240
|
+
$ tzero agency skills / templates / export # 24 skill & 16 subagent şablonunu dışa aktar
|
|
10241
|
+
|
|
9875
10242
|
🔬 v11 FRONTIER CAPABILITIES:
|
|
9876
10243
|
$ tzero --lsp # Zero-Leak Language Server (stdio JSON-RPC)
|
|
9877
10244
|
$ tzero --hook-install all # Install AI lifecycle hook guardrails
|
|
@@ -10785,7 +11152,7 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
10785
11152
|
if not os.path.exists(app_path):
|
|
10786
11153
|
app_path = os.path.join(os.getcwd(), "huggingface-space", "app.py")
|
|
10787
11154
|
print("\033[36m" + "=" * 80)
|
|
10788
|
-
print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.3.
|
|
11155
|
+
print("🤗 SİBER AKADEMİ — T-ZERO HUGGING FACE SPACE & GRADIO COCKPIT (v12.3.7)")
|
|
10789
11156
|
print("=" * 80 + "\033[0m")
|
|
10790
11157
|
print("🌐 Official Live Space : https://huggingface.co/spaces/toprakke4/tzero-token-reducer")
|
|
10791
11158
|
print(f"📁 Local Application : {app_path}")
|
|
@@ -10926,6 +11293,40 @@ If this open-source tool helped you, please consider giving us a ⭐ on GitHub:
|
|
|
10926
11293
|
from tzero.tzero_growth import main as run_marketing
|
|
10927
11294
|
run_marketing()
|
|
10928
11295
|
sys.exit(0)
|
|
11296
|
+
elif getattr(args, "agency_readme", None) is not None:
|
|
11297
|
+
from tzero.tzero_agency import run_agency_cli
|
|
11298
|
+
cli_args = ["readme", args.agency_readme, "--dir", args.dir]
|
|
11299
|
+
if getattr(args, "output", None) and any(f in sys.argv for f in ("--out", "-o", "--output")):
|
|
11300
|
+
cli_args.extend(["--out", args.output])
|
|
11301
|
+
if getattr(args, "force", False):
|
|
11302
|
+
cli_args.append("--force")
|
|
11303
|
+
if getattr(args, "format", "text") == "json":
|
|
11304
|
+
cli_args.append("--json")
|
|
11305
|
+
sys.exit(run_agency_cli(cli_args))
|
|
11306
|
+
elif getattr(args, "agency_skills", False):
|
|
11307
|
+
from tzero.tzero_agency import run_agency_cli
|
|
11308
|
+
cli_args = ["skills", "--dir", args.dir]
|
|
11309
|
+
if getattr(args, "format", "text") == "json":
|
|
11310
|
+
cli_args.append("--json")
|
|
11311
|
+
sys.exit(run_agency_cli(cli_args))
|
|
11312
|
+
elif getattr(args, "agency_templates", False):
|
|
11313
|
+
from tzero.tzero_agency import run_agency_cli
|
|
11314
|
+
cli_args = ["templates", "--dir", args.dir]
|
|
11315
|
+
if getattr(args, "format", "text") == "json":
|
|
11316
|
+
cli_args.append("--json")
|
|
11317
|
+
sys.exit(run_agency_cli(cli_args))
|
|
11318
|
+
elif getattr(args, "agency_export", False):
|
|
11319
|
+
from tzero.tzero_agency import run_agency_cli
|
|
11320
|
+
cli_args = ["export", "--dir", args.dir]
|
|
11321
|
+
if getattr(args, "format", "text") == "json":
|
|
11322
|
+
cli_args.append("--json")
|
|
11323
|
+
sys.exit(run_agency_cli(cli_args))
|
|
11324
|
+
elif getattr(args, "agency_run", None) is not None:
|
|
11325
|
+
from tzero.tzero_agency import run_agency_cli
|
|
11326
|
+
cli_args = ["run", args.agency_run, "--dir", args.dir]
|
|
11327
|
+
if getattr(args, "format", "text") == "json":
|
|
11328
|
+
cli_args.append("--json")
|
|
11329
|
+
sys.exit(run_agency_cli(cli_args))
|
|
10929
11330
|
elif args.audit is not None:
|
|
10930
11331
|
run_audit_cli(args.audit or args.dir, output_format=getattr(args, "format", "text"))
|
|
10931
11332
|
elif args.export_agents is not None:
|