tzero-mcp 12.2.0 → 12.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/addmcp.py +10 -5
- package/src/app.py +3 -9
- package/src/tzero/__init__.py +1 -1
- package/src/tzero/anti_rea/asar_shield.py +3 -1
- package/src/tzero/anti_rea/auditor.py +42 -12
- package/src/tzero/anti_rea/canary_beacon.py +27 -19
- package/src/tzero/anti_rea/cli.py +7 -1
- package/src/tzero/anti_rea/confusables.py +62 -18
- package/src/tzero/anti_rea/engine.py +79 -10
- package/src/tzero/anti_rea/extractor_shield.py +52 -9
- package/src/tzero/anti_rea/gui.py +1 -4
- package/src/tzero/anti_rea/integrity_guard.py +17 -5
- package/src/tzero/anti_rea/rdtsc_guard.py +21 -8
- package/src/tzero/anti_rea/string_vault.py +10 -7
- package/src/tzero/siber_akademi.ico +0 -0
- package/src/tzero/siber_akademi_icon.py +14 -8
- package/src/tzero/tzero_armor.py +27 -5
- package/src/tzero/tzero_benchmark.py +4 -2
- package/src/tzero/tzero_budget.py +14 -5
- package/src/tzero/tzero_ci.py +1 -1
- package/src/tzero/tzero_contracts.py +7 -5
- package/src/tzero/tzero_dashboard.py +28 -9
- package/src/tzero/tzero_debt.py +19 -4
- package/src/tzero/tzero_explain.py +1 -1
- package/src/tzero/tzero_features.py +43 -29
- package/src/tzero/tzero_federation.py +9 -2
- package/src/tzero/tzero_fixer/mcp_server.py +10 -0
- package/src/tzero/tzero_golden.py +37 -9
- package/src/tzero/tzero_growth.py +166 -8
- package/src/tzero/tzero_guard.py +147 -46
- package/src/tzero/tzero_lsp.py +1 -1
- package/src/tzero/tzero_mcp.py +64 -16
- package/src/tzero/tzero_mutation.py +88 -15
- package/src/tzero/tzero_promo.py +1 -1
- package/src/tzero/tzero_proxy.py +105 -12
- package/src/tzero/tzero_scip.py +12 -6
- package/src/tzero/tzero_security.py +375 -60
- package/src/tzero/tzero_task_benchmark.py +2 -2
- package/src/tzero/tzero_traffic.py +35 -10
- package/src/tzero/tzero_tui.py +17 -8
- package/src/tzero/tzero_v3.py +268 -88
- package/src/tzero/tzero_welcome.py +65 -30
|
@@ -6,9 +6,11 @@ License: AGPL-3.0-only
|
|
|
6
6
|
Repository: https://github.com/toprakahmetaydogmus/TZeroAlgorithm
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
import argparse
|
|
9
10
|
import os
|
|
10
|
-
import sys
|
|
11
11
|
import subprocess
|
|
12
|
+
import sys
|
|
13
|
+
import warnings
|
|
12
14
|
from pathlib import Path
|
|
13
15
|
from typing import Optional
|
|
14
16
|
|
|
@@ -36,7 +38,7 @@ except ImportError:
|
|
|
36
38
|
return False
|
|
37
39
|
|
|
38
40
|
REPO_URL = "https://github.com/toprakahmetaydogmus/TZeroAlgorithm"
|
|
39
|
-
VERSION = "12.2.
|
|
41
|
+
VERSION = "12.2.2"
|
|
40
42
|
_BANNER_PRINTED = False
|
|
41
43
|
|
|
42
44
|
|
|
@@ -44,25 +46,33 @@ def find_git_root(start_dir: Optional[Path] = None) -> Optional[Path]:
|
|
|
44
46
|
"""Recursively locates .git root directory starting from start_dir or cwd."""
|
|
45
47
|
curr = (start_dir or Path.cwd()).resolve()
|
|
46
48
|
for p in [curr] + list(curr.parents):
|
|
47
|
-
if (p / ".git").
|
|
49
|
+
if (p / ".git").exists():
|
|
48
50
|
return p
|
|
49
51
|
return None
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
def get_welcome_banner(version: str = VERSION) -> str:
|
|
53
55
|
"""Returns the ANSI styled welcome banner asking developers to star the project."""
|
|
56
|
+
try:
|
|
57
|
+
from tzero.tzero_growth import get_cached_community_stats
|
|
58
|
+
stats = get_cached_community_stats()
|
|
59
|
+
except Exception:
|
|
60
|
+
stats = {"stars": 111, "target_stars": 250, "downloads_label": "22,900+"}
|
|
61
|
+
stars = stats["stars"]
|
|
62
|
+
target = stats["target_stars"]
|
|
63
|
+
dl_label = stats["downloads_label"]
|
|
54
64
|
raw_banner = f"""\033[1;36m
|
|
55
65
|
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
56
66
|
│ ★ WELCOME TO T-ZERO CONTEXT ARCHITECT & MCP SUITE (v{version}) │
|
|
57
67
|
├──────────────────────────────────────────────────────────────────────────────┤
|
|
58
68
|
│ │
|
|
59
69
|
│ Hi! I'm Toprak Ahmet Aydoğmuş (independent engineer at Siber Akademi). │
|
|
60
|
-
│ T-Zero has reached \033[1;
|
|
70
|
+
│ T-Zero has reached \033[1;32m{dl_label} downloads\033[1;36m across PyPI & npm! │
|
|
61
71
|
│ │
|
|
62
72
|
│ T-Zero slashes AI coding prompt tokens by 85–95% using deterministic AST │
|
|
63
|
-
│ signature extraction with 100% Zero-Leak security and
|
|
73
|
+
│ signature extraction with 100% Zero-Leak security and 21 MCP tools. │
|
|
64
74
|
│ │
|
|
65
|
-
│ ★ \033[1;33mHELP US REACH OUR
|
|
75
|
+
│ ★ \033[1;33mHELP US REACH OUR {target} STARS GOAL (Current: {stars}/{target}):\033[1;36m │
|
|
66
76
|
│ \033[1;32m► Run 'tzero star' or visit: {REPO_URL}\033[1;36m │
|
|
67
77
|
│ │
|
|
68
78
|
│ 💖 \033[1;35mSPONSOR & KEEP T-ZERO 100% FREE:\033[1;36m │
|
|
@@ -109,8 +119,6 @@ def print_star_banner(force: bool = False) -> None:
|
|
|
109
119
|
_BANNER_PRINTED = True
|
|
110
120
|
# On first interactive terminal run, open GitHub repository to encourage star
|
|
111
121
|
check_first_launch_repo_open()
|
|
112
|
-
# Silently ensure git hooks are installed if running inside repository
|
|
113
|
-
install_git_star_hooks()
|
|
114
122
|
except Exception:
|
|
115
123
|
pass
|
|
116
124
|
|
|
@@ -143,13 +151,37 @@ def check_first_launch_repo_open(force_open: bool = False, state_path: Optional[
|
|
|
143
151
|
|
|
144
152
|
|
|
145
153
|
def install_git_star_hooks(repo_dir: Optional[Path] = None) -> bool:
|
|
146
|
-
"""
|
|
154
|
+
"""Install reminders only when explicitly called; never change Git configuration.
|
|
155
|
+
|
|
156
|
+
Refuse configured hook managers and existing active hooks. The default Git
|
|
157
|
+
hooks directory also works for linked worktrees; no core.hooksPath is needed.
|
|
158
|
+
"""
|
|
159
|
+
created = []
|
|
147
160
|
try:
|
|
148
161
|
target_dir = find_git_root(repo_dir)
|
|
149
162
|
if not target_dir:
|
|
150
|
-
|
|
163
|
+
raise ValueError("not inside a Git repository")
|
|
151
164
|
|
|
152
|
-
|
|
165
|
+
configured = subprocess.run(
|
|
166
|
+
["git", "config", "--get", "core.hooksPath"], cwd=target_dir,
|
|
167
|
+
capture_output=True, text=True, check=False,
|
|
168
|
+
)
|
|
169
|
+
if configured.returncode == 0:
|
|
170
|
+
raise ValueError("core.hooksPath is already configured; existing hooks preserved")
|
|
171
|
+
if configured.returncode != 1:
|
|
172
|
+
raise ValueError("could not read Git hook configuration")
|
|
173
|
+
|
|
174
|
+
result = subprocess.run(
|
|
175
|
+
["git", "rev-parse", "--path-format=absolute", "--git-path", "hooks"],
|
|
176
|
+
cwd=target_dir, capture_output=True, text=True, check=True,
|
|
177
|
+
)
|
|
178
|
+
githooks_dir = Path(result.stdout.strip())
|
|
179
|
+
if not githooks_dir.is_absolute():
|
|
180
|
+
raise ValueError("Git did not return an absolute hooks directory")
|
|
181
|
+
if githooks_dir.exists() and any(
|
|
182
|
+
not entry.name.endswith(".sample") for entry in githooks_dir.iterdir()
|
|
183
|
+
):
|
|
184
|
+
raise ValueError("existing Git hooks found; no hooks were changed")
|
|
153
185
|
githooks_dir.mkdir(parents=True, exist_ok=True)
|
|
154
186
|
|
|
155
187
|
hook_content = f"""#!/bin/sh
|
|
@@ -162,34 +194,37 @@ exit 0
|
|
|
162
194
|
"""
|
|
163
195
|
for hook_name in ("post-checkout", "post-merge"):
|
|
164
196
|
hook_file = githooks_dir / hook_name
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
# Set core.hooksPath in git config
|
|
172
|
-
subprocess.run(
|
|
173
|
-
["git", "config", "core.hooksPath", ".githooks"],
|
|
174
|
-
cwd=target_dir,
|
|
175
|
-
stdout=subprocess.DEVNULL,
|
|
176
|
-
stderr=subprocess.DEVNULL,
|
|
177
|
-
check=False
|
|
178
|
-
)
|
|
197
|
+
# Exclusive creation also protects hooks created after the checks above.
|
|
198
|
+
with hook_file.open("x", encoding="utf-8", newline="\n") as stream:
|
|
199
|
+
created.append(hook_file)
|
|
200
|
+
stream.write(hook_content)
|
|
201
|
+
hook_file.chmod(0o755)
|
|
179
202
|
return True
|
|
180
|
-
except
|
|
203
|
+
except (OSError, ValueError, subprocess.SubprocessError) as exc:
|
|
204
|
+
for hook_file in created:
|
|
205
|
+
hook_file.unlink(missing_ok=True)
|
|
206
|
+
warnings.warn(f"Star reminder hooks were not installed: {exc}", stacklevel=2)
|
|
181
207
|
return False
|
|
182
208
|
|
|
183
209
|
|
|
184
|
-
def main():
|
|
210
|
+
def main(argv=None) -> int:
|
|
185
211
|
"""CLI entrypoint for scripts/welcome.py."""
|
|
212
|
+
parser = argparse.ArgumentParser(description="T-Zero community welcome")
|
|
213
|
+
parser.add_argument(
|
|
214
|
+
"--install-star-hooks", action="store_true",
|
|
215
|
+
help="Explicitly install star reminders in an unused default Git hooks directory",
|
|
216
|
+
)
|
|
217
|
+
args = parser.parse_args(argv)
|
|
186
218
|
init_terminal()
|
|
187
219
|
print_star_banner(force=True)
|
|
188
|
-
if
|
|
189
|
-
|
|
220
|
+
if args.install_star_hooks:
|
|
221
|
+
if not install_git_star_hooks():
|
|
222
|
+
return 1
|
|
223
|
+
print(sanitize_terminal_text("\033[32m✔ Git community hooks installed\033[0m"))
|
|
190
224
|
info_text = f"\033[36mFor questions or support, visit:\033[0m {REPO_URL}/discussions\n"
|
|
191
225
|
print(sanitize_terminal_text(info_text))
|
|
226
|
+
return 0
|
|
192
227
|
|
|
193
228
|
|
|
194
229
|
if __name__ == "__main__":
|
|
195
|
-
main()
|
|
230
|
+
raise SystemExit(main())
|