tzero-mcp 11.15.3 → 12.2.1
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/CONTRIBUTING.md +4 -4
- package/README.md +5 -5
- package/bin/postinstall.js +10 -2
- package/bin/tzero-mcp.js +1 -1
- package/bin/tzero.js +17 -0
- package/package.json +1 -1
- package/src/addmcp.py +34 -23
- package/src/app.py +1 -1
- package/src/main.py +6 -0
- package/src/tzero/__init__.py +10 -0
- package/src/tzero/anti_rea/__init__.py +70 -0
- package/src/tzero/anti_rea/algebraic_mutator.py +86 -0
- package/src/tzero/anti_rea/anti_agent_guard.py +96 -0
- package/src/tzero/anti_rea/anti_debugger.py +239 -0
- package/src/tzero/anti_rea/anti_vm.py +160 -0
- package/src/tzero/anti_rea/asar_shield.py +99 -0
- package/src/tzero/anti_rea/auditor.py +158 -0
- package/src/tzero/anti_rea/bpe_disrupter.py +48 -0
- package/src/tzero/anti_rea/bytecode_trap.py +85 -0
- package/src/tzero/anti_rea/canary_beacon.py +187 -0
- package/src/tzero/anti_rea/cli.py +102 -0
- package/src/tzero/anti_rea/confusables.py +86 -0
- package/src/tzero/anti_rea/engine.py +204 -0
- package/src/tzero/anti_rea/extractor_shield.py +102 -0
- package/src/tzero/anti_rea/flattener.py +136 -0
- package/src/tzero/anti_rea/gui.py +267 -0
- package/src/tzero/anti_rea/honeypot.py +58 -0
- package/src/tzero/anti_rea/integrity_guard.py +66 -0
- package/src/tzero/anti_rea/jailbreak_decoy.py +77 -0
- package/src/tzero/anti_rea/mcp_poison.py +41 -0
- package/src/tzero/anti_rea/native_bridge.py +169 -0
- package/src/tzero/anti_rea/rdtsc_guard.py +64 -0
- package/src/tzero/anti_rea/string_vault.py +94 -0
- package/src/tzero/anti_rea/sybil_network.py +53 -0
- package/src/tzero/anti_rea/timing_guard.py +46 -0
- package/src/tzero/anti_rea/token_bomb.py +65 -0
- package/src/tzero/anti_rea/traps.py +76 -0
- package/src/tzero/anti_rea/vm_obfuscator.py +182 -0
- package/src/tzero/siber_akademi.ico +0 -0
- package/src/tzero/siber_akademi_icon.py +1 -1
- package/src/tzero/tzero_armor.py +165 -0
- package/src/tzero/tzero_bridge.py +28 -15
- package/src/tzero/tzero_budget.py +10 -3
- package/src/tzero/tzero_card.py +7 -5
- package/src/tzero/tzero_ci.py +1 -0
- package/src/tzero/tzero_contracts.py +30 -11
- package/src/tzero/tzero_dashboard.py +34 -14
- package/src/tzero/tzero_debt.py +14 -5
- package/src/tzero/tzero_federation.py +11 -6
- package/src/tzero/tzero_fixer/security_zero_leak.py +21 -3
- package/src/tzero/tzero_golden.py +11 -6
- package/src/tzero/tzero_graph_hud.html +1 -1
- package/src/tzero/tzero_growth.py +10 -10
- package/src/tzero/tzero_jarvis/agent_guard.py +16 -10
- package/src/tzero/tzero_jarvis/workspace_orchestrator.py +34 -23
- package/src/tzero/tzero_lsp.py +1 -1
- package/src/tzero/tzero_mcp.py +89 -31
- package/src/tzero/tzero_mutation.py +44 -16
- package/src/tzero/tzero_neural_cortex.py +1 -1
- package/src/tzero/tzero_pc_fixer.py +21 -3
- package/src/tzero/tzero_promo.py +196 -36
- package/src/tzero/tzero_rust_bridge.py +1086 -42
- package/src/tzero/tzero_scip.py +15 -2
- package/src/tzero/tzero_semantic_merge.py +34 -10
- package/src/tzero/tzero_task_benchmark.py +2 -2
- package/src/tzero/tzero_telemetry.py +146 -0
- package/src/tzero/tzero_terminal.py +366 -0
- package/src/tzero/tzero_traffic.py +350 -0
- package/src/tzero/tzero_tui.py +342 -133
- package/src/tzero/tzero_v3.py +652 -29
- package/src/tzero/tzero_welcome.py +124 -37
|
@@ -6,14 +6,39 @@ 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
|
|
|
17
|
+
try:
|
|
18
|
+
from tzero.tzero_terminal import (
|
|
19
|
+
init_terminal,
|
|
20
|
+
sanitize_terminal_text,
|
|
21
|
+
supports_ansi,
|
|
22
|
+
)
|
|
23
|
+
except ImportError:
|
|
24
|
+
try:
|
|
25
|
+
from tzero_terminal import (
|
|
26
|
+
init_terminal,
|
|
27
|
+
sanitize_terminal_text,
|
|
28
|
+
supports_ansi,
|
|
29
|
+
)
|
|
30
|
+
except ImportError:
|
|
31
|
+
def init_terminal(*args, **kwargs):
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
def sanitize_terminal_text(text, *args, **kwargs):
|
|
35
|
+
return text
|
|
36
|
+
|
|
37
|
+
def supports_ansi(*args, **kwargs):
|
|
38
|
+
return False
|
|
39
|
+
|
|
15
40
|
REPO_URL = "https://github.com/toprakahmetaydogmus/TZeroAlgorithm"
|
|
16
|
-
VERSION = "
|
|
41
|
+
VERSION = "12.2.1"
|
|
17
42
|
_BANNER_PRINTED = False
|
|
18
43
|
|
|
19
44
|
|
|
@@ -21,32 +46,37 @@ def find_git_root(start_dir: Optional[Path] = None) -> Optional[Path]:
|
|
|
21
46
|
"""Recursively locates .git root directory starting from start_dir or cwd."""
|
|
22
47
|
curr = (start_dir or Path.cwd()).resolve()
|
|
23
48
|
for p in [curr] + list(curr.parents):
|
|
24
|
-
if (p / ".git").
|
|
49
|
+
if (p / ".git").exists():
|
|
25
50
|
return p
|
|
26
51
|
return None
|
|
27
52
|
|
|
28
53
|
|
|
29
54
|
def get_welcome_banner(version: str = VERSION) -> str:
|
|
30
55
|
"""Returns the ANSI styled welcome banner asking developers to star the project."""
|
|
31
|
-
|
|
56
|
+
raw_banner = f"""\033[1;36m
|
|
32
57
|
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
33
|
-
│
|
|
58
|
+
│ ★ WELCOME TO T-ZERO CONTEXT ARCHITECT & MCP SUITE (v{version}) │
|
|
34
59
|
├──────────────────────────────────────────────────────────────────────────────┤
|
|
35
60
|
│ │
|
|
36
61
|
│ Hi! I'm Toprak Ahmet Aydoğmuş (independent engineer at Siber Akademi). │
|
|
37
|
-
│
|
|
62
|
+
│ T-Zero has reached \033[1;32m20,880+ downloads\033[1;36m across PyPI & npm! │
|
|
38
63
|
│ │
|
|
39
64
|
│ T-Zero slashes AI coding prompt tokens by 85–95% using deterministic AST │
|
|
40
65
|
│ signature extraction with 100% Zero-Leak security and 20 MCP tools. │
|
|
41
66
|
│ │
|
|
42
|
-
│
|
|
43
|
-
│ \033[1;32m
|
|
67
|
+
│ ★ \033[1;33mHELP US REACH OUR 100 STARS GOAL (Current: 45/100):\033[1;36m │
|
|
68
|
+
│ \033[1;32m► Run 'tzero star' or visit: {REPO_URL}\033[1;36m │
|
|
69
|
+
│ │
|
|
70
|
+
│ 💖 \033[1;35mSPONSOR & KEEP T-ZERO 100% FREE:\033[1;36m │
|
|
71
|
+
│ \033[1;32m► https://github.com/sponsors/toprakahmetaydogmus\033[1;36m │
|
|
44
72
|
│ │
|
|
45
|
-
│
|
|
73
|
+
│ • Quick Commands: │
|
|
74
|
+
│ \033[1;37mtzero star\033[1;36m 1-Click open GitHub & star the project │
|
|
46
75
|
│ \033[1;37mtzero install-ide\033[1;36m 1-Click install into Cursor, Claude, Windsurf │
|
|
47
76
|
│ \033[1;37mtzero-mcp\033[1;36m Start local Model Context Protocol server │
|
|
48
|
-
│ \033[1;37mtzero
|
|
77
|
+
│ \033[1;37mtzero roi\033[1;36m View live token & dollar ($) savings dashboard │
|
|
49
78
|
└──────────────────────────────────────────────────────────────────────────────┘\033[0m"""
|
|
79
|
+
return sanitize_terminal_text(raw_banner)
|
|
50
80
|
|
|
51
81
|
|
|
52
82
|
def print_star_banner(force: bool = False) -> None:
|
|
@@ -76,60 +106,117 @@ def print_star_banner(force: bool = False) -> None:
|
|
|
76
106
|
return
|
|
77
107
|
|
|
78
108
|
try:
|
|
109
|
+
init_terminal()
|
|
79
110
|
print(get_welcome_banner())
|
|
80
111
|
_BANNER_PRINTED = True
|
|
81
|
-
#
|
|
82
|
-
|
|
112
|
+
# On first interactive terminal run, open GitHub repository to encourage star
|
|
113
|
+
check_first_launch_repo_open()
|
|
83
114
|
except Exception:
|
|
84
115
|
pass
|
|
85
116
|
|
|
86
117
|
|
|
118
|
+
def check_first_launch_repo_open(force_open: bool = False, state_path: Optional[Path] = None) -> bool:
|
|
119
|
+
"""On first interactive launch, opens the GitHub repository in browser and prompts to star."""
|
|
120
|
+
state_file = state_path or (Path.home() / ".tzero" / "welcome_state.json")
|
|
121
|
+
try:
|
|
122
|
+
if state_file.is_file() and not force_open:
|
|
123
|
+
import json
|
|
124
|
+
data = json.loads(state_file.read_text(encoding="utf-8"))
|
|
125
|
+
if data.get("first_launch_repo_opened_v12"):
|
|
126
|
+
return False
|
|
127
|
+
|
|
128
|
+
if not force_open:
|
|
129
|
+
if not sys.stdout.isatty():
|
|
130
|
+
return False
|
|
131
|
+
if os.environ.get("CI") == "true" or os.environ.get("TZERO_NO_BANNER") == "1":
|
|
132
|
+
return False
|
|
133
|
+
|
|
134
|
+
import webbrowser
|
|
135
|
+
webbrowser.open(REPO_URL)
|
|
136
|
+
|
|
137
|
+
state_file.parent.mkdir(parents=True, exist_ok=True)
|
|
138
|
+
import json
|
|
139
|
+
state_file.write_text(json.dumps({"first_launch_repo_opened_v12": True}), encoding="utf-8")
|
|
140
|
+
return True
|
|
141
|
+
except Exception:
|
|
142
|
+
return False
|
|
143
|
+
|
|
144
|
+
|
|
87
145
|
def install_git_star_hooks(repo_dir: Optional[Path] = None) -> bool:
|
|
88
|
-
"""
|
|
146
|
+
"""Install reminders only when explicitly called; never change Git configuration.
|
|
147
|
+
|
|
148
|
+
Refuse configured hook managers and existing active hooks. The default Git
|
|
149
|
+
hooks directory also works for linked worktrees; no core.hooksPath is needed.
|
|
150
|
+
"""
|
|
151
|
+
created = []
|
|
89
152
|
try:
|
|
90
153
|
target_dir = find_git_root(repo_dir)
|
|
91
154
|
if not target_dir:
|
|
92
|
-
|
|
155
|
+
raise ValueError("not inside a Git repository")
|
|
93
156
|
|
|
94
|
-
|
|
157
|
+
configured = subprocess.run(
|
|
158
|
+
["git", "config", "--get", "core.hooksPath"], cwd=target_dir,
|
|
159
|
+
capture_output=True, text=True, check=False,
|
|
160
|
+
)
|
|
161
|
+
if configured.returncode == 0:
|
|
162
|
+
raise ValueError("core.hooksPath is already configured; existing hooks preserved")
|
|
163
|
+
if configured.returncode != 1:
|
|
164
|
+
raise ValueError("could not read Git hook configuration")
|
|
165
|
+
|
|
166
|
+
result = subprocess.run(
|
|
167
|
+
["git", "rev-parse", "--path-format=absolute", "--git-path", "hooks"],
|
|
168
|
+
cwd=target_dir, capture_output=True, text=True, check=True,
|
|
169
|
+
)
|
|
170
|
+
githooks_dir = Path(result.stdout.strip())
|
|
171
|
+
if not githooks_dir.is_absolute():
|
|
172
|
+
raise ValueError("Git did not return an absolute hooks directory")
|
|
173
|
+
if githooks_dir.exists() and any(
|
|
174
|
+
not entry.name.endswith(".sample") for entry in githooks_dir.iterdir()
|
|
175
|
+
):
|
|
176
|
+
raise ValueError("existing Git hooks found; no hooks were changed")
|
|
95
177
|
githooks_dir.mkdir(parents=True, exist_ok=True)
|
|
96
178
|
|
|
97
179
|
hook_content = f"""#!/bin/sh
|
|
98
180
|
# T-Zero GitHub Star & Community Reminder
|
|
99
181
|
if [ -z "$TZERO_NO_BANNER" ] && [ -z "$CI" ]; then
|
|
100
|
-
printf "\\n\\033[1;33m
|
|
101
|
-
printf "\\033[1;36m
|
|
182
|
+
printf "\\n\\033[1;33m★ Enjoying T-Zero Context Architect?\\033[0m\\n"
|
|
183
|
+
printf "\\033[1;36m► Please star the repository on GitHub: {REPO_URL}\\033[0m\\n\\n"
|
|
102
184
|
fi
|
|
103
185
|
exit 0
|
|
104
186
|
"""
|
|
105
187
|
for hook_name in ("post-checkout", "post-merge"):
|
|
106
188
|
hook_file = githooks_dir / hook_name
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# Set core.hooksPath in git config
|
|
114
|
-
subprocess.run(
|
|
115
|
-
["git", "config", "core.hooksPath", ".githooks"],
|
|
116
|
-
cwd=target_dir,
|
|
117
|
-
stdout=subprocess.DEVNULL,
|
|
118
|
-
stderr=subprocess.DEVNULL,
|
|
119
|
-
check=False
|
|
120
|
-
)
|
|
189
|
+
# Exclusive creation also protects hooks created after the checks above.
|
|
190
|
+
with hook_file.open("x", encoding="utf-8", newline="\n") as stream:
|
|
191
|
+
created.append(hook_file)
|
|
192
|
+
stream.write(hook_content)
|
|
193
|
+
hook_file.chmod(0o755)
|
|
121
194
|
return True
|
|
122
|
-
except
|
|
195
|
+
except (OSError, ValueError, subprocess.SubprocessError) as exc:
|
|
196
|
+
for hook_file in created:
|
|
197
|
+
hook_file.unlink(missing_ok=True)
|
|
198
|
+
warnings.warn(f"Star reminder hooks were not installed: {exc}", stacklevel=2)
|
|
123
199
|
return False
|
|
124
200
|
|
|
125
201
|
|
|
126
|
-
def main():
|
|
202
|
+
def main(argv=None) -> int:
|
|
127
203
|
"""CLI entrypoint for scripts/welcome.py."""
|
|
204
|
+
parser = argparse.ArgumentParser(description="T-Zero community welcome")
|
|
205
|
+
parser.add_argument(
|
|
206
|
+
"--install-star-hooks", action="store_true",
|
|
207
|
+
help="Explicitly install star reminders in an unused default Git hooks directory",
|
|
208
|
+
)
|
|
209
|
+
args = parser.parse_args(argv)
|
|
210
|
+
init_terminal()
|
|
128
211
|
print_star_banner(force=True)
|
|
129
|
-
if
|
|
130
|
-
|
|
131
|
-
|
|
212
|
+
if args.install_star_hooks:
|
|
213
|
+
if not install_git_star_hooks():
|
|
214
|
+
return 1
|
|
215
|
+
print(sanitize_terminal_text("\033[32m✔ Git community hooks installed\033[0m"))
|
|
216
|
+
info_text = f"\033[36mFor questions or support, visit:\033[0m {REPO_URL}/discussions\n"
|
|
217
|
+
print(sanitize_terminal_text(info_text))
|
|
218
|
+
return 0
|
|
132
219
|
|
|
133
220
|
|
|
134
221
|
if __name__ == "__main__":
|
|
135
|
-
main()
|
|
222
|
+
raise SystemExit(main())
|