tzero-mcp 12.3.3 → 12.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -0
- package/package.json +3 -4
- package/src/addmcp.py +2 -2
- package/src/app.py +1 -1
- package/src/main.py +4 -0
- package/src/tzero/__init__.py +1 -1
- package/src/tzero/desktop_updater.py +6 -0
- package/src/tzero/tzero_benchmark.py +1 -1
- package/src/tzero/tzero_budget.py +1 -1
- package/src/tzero/tzero_ci.py +1 -1
- package/src/tzero/tzero_contracts.py +2 -2
- package/src/tzero/tzero_dashboard.py +4 -4
- package/src/tzero/tzero_debt.py +1 -1
- package/src/tzero/tzero_deps.py +1 -0
- package/src/tzero/tzero_explain.py +1 -1
- package/src/tzero/tzero_features.py +31 -74
- package/src/tzero/tzero_golden.py +2 -2
- package/src/tzero/tzero_growth.py +1 -1
- package/src/tzero/tzero_jarvis/orchestrator.py +1 -1
- package/src/tzero/tzero_jarvis/workspace_orchestrator.py +10 -21
- package/src/tzero/tzero_lsp.py +1 -1
- package/src/tzero/tzero_mcp.py +47 -215
- package/src/tzero/tzero_promo.py +1 -1
- package/src/tzero/tzero_security.py +3 -3
- package/src/tzero/tzero_sync.py +73 -148
- package/src/tzero/tzero_task_benchmark.py +2 -2
- package/src/tzero/tzero_traffic.py +1 -1
- package/src/tzero/tzero_tui.py +2 -13
- package/src/tzero/tzero_v3.py +322 -556
- package/src/tzero/tzero_welcome.py +1 -1
- package/src/tzero/anti_rea/__init__.py +0 -84
- package/src/tzero/anti_rea/algebraic_mutator.py +0 -107
- package/src/tzero/anti_rea/anti_agent_guard.py +0 -96
- package/src/tzero/anti_rea/anti_debugger.py +0 -272
- package/src/tzero/anti_rea/anti_vm.py +0 -160
- package/src/tzero/anti_rea/asar_shield.py +0 -122
- package/src/tzero/anti_rea/auditor.py +0 -208
- package/src/tzero/anti_rea/bpe_disrupter.py +0 -48
- package/src/tzero/anti_rea/bytecode_trap.py +0 -85
- package/src/tzero/anti_rea/canary_beacon.py +0 -167
- package/src/tzero/anti_rea/cli.py +0 -134
- package/src/tzero/anti_rea/confusables.py +0 -130
- package/src/tzero/anti_rea/crypto_loader.py +0 -132
- package/src/tzero/anti_rea/engine.py +0 -304
- package/src/tzero/anti_rea/extractor_shield.py +0 -180
- package/src/tzero/anti_rea/flattener.py +0 -136
- package/src/tzero/anti_rea/gui.py +0 -264
- package/src/tzero/anti_rea/honeypot.py +0 -58
- package/src/tzero/anti_rea/integrity_guard.py +0 -78
- package/src/tzero/anti_rea/jailbreak_decoy.py +0 -77
- package/src/tzero/anti_rea/mcp_poison.py +0 -41
- package/src/tzero/anti_rea/native_bridge.py +0 -169
- package/src/tzero/anti_rea/rdtsc_guard.py +0 -77
- package/src/tzero/anti_rea/string_vault.py +0 -97
- package/src/tzero/anti_rea/sybil_network.py +0 -53
- package/src/tzero/anti_rea/tier_catalog.py +0 -388
- package/src/tzero/anti_rea/timing_guard.py +0 -46
- package/src/tzero/anti_rea/token_bomb.py +0 -65
- package/src/tzero/anti_rea/traps.py +0 -76
- package/src/tzero/anti_rea/vm_obfuscator.py +0 -182
- package/src/tzero/tzero_armor.py +0 -187
package/src/tzero/tzero_mcp.py
CHANGED
|
@@ -33,7 +33,7 @@ import ast
|
|
|
33
33
|
import inspect
|
|
34
34
|
import logging
|
|
35
35
|
|
|
36
|
-
SERVER_VERSION = "12.3.
|
|
36
|
+
SERVER_VERSION = "12.3.6"
|
|
37
37
|
|
|
38
38
|
# Version checks must not initialize the MCP SDK or dependency bootstrap. Besides
|
|
39
39
|
# being needlessly expensive, that path may wait on package discovery/network
|
|
@@ -1156,22 +1156,22 @@ def create_mcp_server():
|
|
|
1156
1156
|
name="export_agent_rules",
|
|
1157
1157
|
title="Export Cursor and Cline Agent Rule Configurations",
|
|
1158
1158
|
description=(
|
|
1159
|
-
"Generates and writes standardized AI agent rule specifications into workspace root, distinguishing from 'query_architecture_boundaries'
|
|
1159
|
+
"Generates and writes standardized AI agent rule specifications into workspace root, distinguishing from 'query_architecture_boundaries' by writing editor-ready governance files (.cursorrules, AGENT.md, .clinerules).\n"
|
|
1160
1160
|
"\n"
|
|
1161
1161
|
"Parameters:\n"
|
|
1162
1162
|
"- `project_root` (str, optional, default='.'): Target workspace directory where agent rule files will be created.\n"
|
|
1163
1163
|
"- `target` (str, optional, default='all'): Target editor format: 'cursor', 'cline', 'windsurf', 'claude', 'copilot', or 'all'.\n"
|
|
1164
1164
|
"\n"
|
|
1165
1165
|
"Behavior:\n"
|
|
1166
|
-
"- Mutating: Creates
|
|
1167
|
-
"- Idempotent:
|
|
1166
|
+
"- Mutating: Creates missing configuration files in the target workspace directory.\n"
|
|
1167
|
+
"- Idempotent: Leaves existing files untouched.\n"
|
|
1168
1168
|
"- 100% Offline: Generates rule files locally using built-in templates with zero network requests.\n"
|
|
1169
1169
|
"- Auth & Rate Limits: Zero authentication or cloud credentials required; completes in <50ms.\n"
|
|
1170
1170
|
"- Error Handling: Defaults to standard T-Zero engineering templates if workspace configuration is empty.\n"
|
|
1171
1171
|
"\n"
|
|
1172
1172
|
"Usage Guidelines:\n"
|
|
1173
1173
|
"- When to use: Run when setting up a repository for AI pair-programming with Cursor, Claude Code, Cline, Windsurf, or GitHub Copilot.\n"
|
|
1174
|
-
"- When NOT to use: Do not use to view architectural boundaries without writing files to disk (use 'query_architecture_boundaries' instead)
|
|
1174
|
+
"- When NOT to use: Do not use to view architectural boundaries without writing files to disk (use 'query_architecture_boundaries' instead).\n"
|
|
1175
1175
|
"\n"
|
|
1176
1176
|
"Returns: Confirmation Markdown message listing all generated rule file paths and active directives."
|
|
1177
1177
|
),
|
|
@@ -1183,45 +1183,7 @@ def create_mcp_server():
|
|
|
1183
1183
|
) -> str:
|
|
1184
1184
|
"""Exports AI coding agent rules into workspace."""
|
|
1185
1185
|
from tzero.tzero_features import AgentRulesGenerator
|
|
1186
|
-
|
|
1187
|
-
t = (target or "all").lower().strip()
|
|
1188
|
-
created = []
|
|
1189
|
-
if t in ("cursor", "cursorrules"):
|
|
1190
|
-
cr_path = os.path.join(project_root, ".cursorrules")
|
|
1191
|
-
with open(cr_path, "w", encoding="utf-8") as f:
|
|
1192
|
-
f.write(AgentRulesGenerator.generate_cursorrules(p_name))
|
|
1193
|
-
created.append(cr_path)
|
|
1194
|
-
c_rules_dir = os.path.join(project_root, ".cursor", "rules")
|
|
1195
|
-
os.makedirs(c_rules_dir, exist_ok=True)
|
|
1196
|
-
for mdc_name, content in AgentRulesGenerator.generate_cursor_mdc_rules(p_name, project_dir=project_root).items():
|
|
1197
|
-
mdc_path = os.path.join(c_rules_dir, mdc_name)
|
|
1198
|
-
with open(mdc_path, "w", encoding="utf-8") as f:
|
|
1199
|
-
f.write(content)
|
|
1200
|
-
created.append(mdc_path)
|
|
1201
|
-
elif t in ("cline", "clinerules"):
|
|
1202
|
-
cl_path = os.path.join(project_root, ".clinerules")
|
|
1203
|
-
with open(cl_path, "w", encoding="utf-8") as f:
|
|
1204
|
-
f.write(AgentRulesGenerator.generate_clinerules(p_name))
|
|
1205
|
-
created.append(cl_path)
|
|
1206
|
-
elif t in ("windsurf", "windsurfrules"):
|
|
1207
|
-
ws_path = os.path.join(project_root, ".windsurfrules")
|
|
1208
|
-
with open(ws_path, "w", encoding="utf-8") as f:
|
|
1209
|
-
f.write(AgentRulesGenerator.generate_windsurfrules(p_name))
|
|
1210
|
-
created.append(ws_path)
|
|
1211
|
-
elif t in ("claude", "claudemd"):
|
|
1212
|
-
claude_path = os.path.join(project_root, "CLAUDE.md")
|
|
1213
|
-
with open(claude_path, "w", encoding="utf-8") as f:
|
|
1214
|
-
f.write(AgentRulesGenerator.generate_claude_instructions(p_name))
|
|
1215
|
-
created.append(claude_path)
|
|
1216
|
-
elif t in ("copilot", "github"):
|
|
1217
|
-
gh_dir = os.path.join(project_root, ".github")
|
|
1218
|
-
os.makedirs(gh_dir, exist_ok=True)
|
|
1219
|
-
copilot_path = os.path.join(gh_dir, "copilot-instructions.md")
|
|
1220
|
-
with open(copilot_path, "w", encoding="utf-8") as f:
|
|
1221
|
-
f.write(AgentRulesGenerator.generate_copilot_instructions(p_name))
|
|
1222
|
-
created.append(copilot_path)
|
|
1223
|
-
else:
|
|
1224
|
-
created = AgentRulesGenerator.export_all(project_root)
|
|
1186
|
+
created = AgentRulesGenerator.export_all(project_root, target)
|
|
1225
1187
|
rel_paths = [os.path.relpath(p, project_root) for p in created]
|
|
1226
1188
|
return "✅ Generated AI Agent rule files:\n" + "\n".join(f"- `{p}`" for p in rel_paths)
|
|
1227
1189
|
|
|
@@ -1395,7 +1357,7 @@ def create_mcp_server():
|
|
|
1395
1357
|
"\n"
|
|
1396
1358
|
"Usage Guidelines:\n"
|
|
1397
1359
|
"- When to use: Verify that proposed code edits, diffs, or commits contain zero leaked API keys (cloud provider keys, AWS secrets, GitHub tokens, Stripe keys, SSH keys).\n"
|
|
1398
|
-
"- When NOT to use: Do not use for detecting hallucinated methods or imports (use 'verify_hallucination_guard' instead)
|
|
1360
|
+
"- When NOT to use: Do not use for detecting hallucinated methods or imports (use 'verify_hallucination_guard' instead).\n"
|
|
1399
1361
|
"\n"
|
|
1400
1362
|
"Returns: Markdown report with Zero-Leak certification badge, list of detected secrets with line numbers and masked previews, and remediation guidance."
|
|
1401
1363
|
),
|
|
@@ -2798,50 +2760,6 @@ def create_mcp_server():
|
|
|
2798
2760
|
f"```text\n{compressed}\n```"
|
|
2799
2761
|
)
|
|
2800
2762
|
|
|
2801
|
-
# -------------------------------------------------------------------------
|
|
2802
|
-
# TOOL 42: install_git_security_guard
|
|
2803
|
-
# -------------------------------------------------------------------------
|
|
2804
|
-
@_maybe_tool(
|
|
2805
|
-
name="install_git_security_guard",
|
|
2806
|
-
title="Install Automated Git Pre-Commit Security Guard",
|
|
2807
|
-
description=(
|
|
2808
|
-
"Installs the automated T-Zero Git Pre-Commit Security Guard hook in the local repository, distinguishing from 'verify_zero_leak_security' and 'export_agent_rules' by installing executable git hooks into '.git/hooks' rather than running one-time scans or writing editor rules.\n"
|
|
2809
|
-
"\n"
|
|
2810
|
-
"Parameters:\n"
|
|
2811
|
-
"- `repo_dir` (str, optional, default='.'): Target git repository root directory where the pre-commit hook will be installed.\n"
|
|
2812
|
-
"\n"
|
|
2813
|
-
"Behavior:\n"
|
|
2814
|
-
"- File-Creation: Writes executable pre-commit script to '.git/hooks/pre-commit' in the target repository.\n"
|
|
2815
|
-
"- Idempotent: Safely installs or updates the hook without breaking existing git hook chains.\n"
|
|
2816
|
-
"- 100% Offline: Generates hook locally from embedded template; operates strictly offline.\n"
|
|
2817
|
-
"- Auth & Rate Limits: Zero credentials or accounts required; completes in <20ms.\n"
|
|
2818
|
-
"- Error Handling: Returns descriptive error notice if target directory is not a git repository.\n"
|
|
2819
|
-
"\n"
|
|
2820
|
-
"Usage Guidelines:\n"
|
|
2821
|
-
"- When to use: Protect repositories from accidental credential leaks by automatically scanning all staged commits for API keys and secrets.\n"
|
|
2822
|
-
"- When NOT to use: Do not use for running a one-time manual security scan (use 'verify_zero_leak_security' instead); do not use for configuring IDE agent rules (use 'export_agent_rules' instead).\n"
|
|
2823
|
-
"\n"
|
|
2824
|
-
"Returns: Confirmation Markdown message indicating successful installation of the pre-commit hook and active protection patterns."
|
|
2825
|
-
),
|
|
2826
|
-
annotations=ToolAnnotations(read_only_hint=False, destructive_hint=False, idempotent_hint=True, open_world_hint=False)
|
|
2827
|
-
)
|
|
2828
|
-
def _legacy_install_git_security_guard(
|
|
2829
|
-
repo_dir: Annotated[str, Field(default=".", description="Target git repository root directory where the pre-commit hook will be installed (default: '.').")] = "."
|
|
2830
|
-
) -> str:
|
|
2831
|
-
"""Installs the pre-commit zero-leak and token optimization guard."""
|
|
2832
|
-
from tzero.tzero_guard import GitSecurityGuard
|
|
2833
|
-
res = GitSecurityGuard.install_hook(repo_dir)
|
|
2834
|
-
if res.get("success"):
|
|
2835
|
-
return (
|
|
2836
|
-
f"### 🛡️ T-Zero Pre-Commit Guard Installed Successfully\n"
|
|
2837
|
-
f"- **Hook Path:** `{res.get('hook_path')}`\n"
|
|
2838
|
-
f"- **Status:** Active\n"
|
|
2839
|
-
f"- **Features:** Zero-Leak Credential Blocker, Token Bloat Warning, Staged Diff Analysis\n"
|
|
2840
|
-
f"Future `git commit` actions in this repository will now be automatically protected!"
|
|
2841
|
-
)
|
|
2842
|
-
else:
|
|
2843
|
-
return f"❌ **Failed to install pre-commit guard:** {res.get('message')}"
|
|
2844
|
-
|
|
2845
2763
|
# -------------------------------------------------------------------------
|
|
2846
2764
|
# TOOL 43: suggest_reusable_helpers
|
|
2847
2765
|
# -------------------------------------------------------------------------
|
|
@@ -2978,8 +2896,6 @@ def create_mcp_server():
|
|
|
2978
2896
|
generate_zero_waste_prompt_context = _legacy_generate_zero_waste_prompt_context
|
|
2979
2897
|
_LEGACY_DISPATCH['compress_stream_tokens'] = _legacy_compress_stream_tokens
|
|
2980
2898
|
compress_stream_tokens = _legacy_compress_stream_tokens
|
|
2981
|
-
_LEGACY_DISPATCH['install_git_security_guard'] = _legacy_install_git_security_guard
|
|
2982
|
-
install_git_security_guard = _legacy_install_git_security_guard
|
|
2983
2899
|
|
|
2984
2900
|
# =========================================================================
|
|
2985
2901
|
# T-ZERO TDQS 5/5 CERTIFIED CANONICAL TOOL SUITE (14 FOCUSED TOOLS)
|
|
@@ -3425,7 +3341,7 @@ def create_mcp_server():
|
|
|
3425
3341
|
"\n"
|
|
3426
3342
|
"Usage Guidelines:\n"
|
|
3427
3343
|
"- When to use: Run before submitting PRs, merging branches, or refactoring code to detect complex methods, missing docstrings, duplicate code blocks, or invalid hallucinated imports.\n"
|
|
3428
|
-
"- When NOT to use: Do not use for detecting hardcoded secrets
|
|
3344
|
+
"- When NOT to use: Do not use for detecting hardcoded secrets (use 'verify_security_guard' instead); do not use for mapping whole-repository module dependencies (use 'analyze_code_dependencies' instead).\n"
|
|
3429
3345
|
"\n"
|
|
3430
3346
|
"Returns: Comprehensive diagnostic report with severity ratings (T-001 to T-004), exact file line references, and remediation guidance.\n"
|
|
3431
3347
|
),
|
|
@@ -3469,43 +3385,29 @@ def create_mcp_server():
|
|
|
3469
3385
|
# -------------------------------------------------------------------------
|
|
3470
3386
|
@_canon_tool(
|
|
3471
3387
|
name="verify_security_guard",
|
|
3472
|
-
title="
|
|
3388
|
+
title="Scan for exposed credentials",
|
|
3473
3389
|
description=(
|
|
3474
|
-
"Scans workspace
|
|
3475
|
-
"\n"
|
|
3390
|
+
"Scans a workspace or supplied text for possible credential exposure, unlike audit_code_quality, which checks code structure.\n"
|
|
3476
3391
|
"Parameters:\n"
|
|
3477
|
-
"- `action`:
|
|
3478
|
-
"- `project_root`:
|
|
3479
|
-
"- `content`: Optional
|
|
3480
|
-
"
|
|
3481
|
-
"
|
|
3482
|
-
"
|
|
3483
|
-
"
|
|
3484
|
-
"- Privacy & Network: 100% offline local regex and Shannon entropy calculation; zero secret tokens are ever transmitted over the network.\n"
|
|
3485
|
-
"- Performance & Resources: Scans 1,000 files in <100ms using <30MB RAM; hook execution completes in <50ms.\n"
|
|
3486
|
-
"- Auth: Zero authentication or cloud credentials required.\n"
|
|
3487
|
-
"- Return Structure: Emits security audit report showing 100% Zero-Leak pass status or lists detected secret leaks with file names, line numbers, and redacted tokens.\n"
|
|
3488
|
-
"- Error Handling: Gracefully reports if directory is not a git repository when attempting pre-commit installation.\n"
|
|
3489
|
-
"\n"
|
|
3490
|
-
"Usage Guidelines:\n"
|
|
3491
|
-
"- When to use: Ensure zero confidential credentials (OpenAI, Anthropic, Gemini, GitHub tokens, AWS keys, private certificates) are committed to git or exposed in LLM prompt contexts.\n"
|
|
3492
|
-
"- When NOT to use: Do not use for checking code quality, cyclomatic complexity, or duplicate code (use 'audit_code_quality' instead); do not use for enforcing architectural layer boundaries (use 'enforce_architecture_rules' instead).\n"
|
|
3493
|
-
"\n"
|
|
3494
|
-
"Returns: Security audit report showing 100% Zero-Leak certification or list of detected secret leaks with line numbers, or hook installation confirmation.\n"
|
|
3392
|
+
"- `action`: Supported action is 'scan'.\n"
|
|
3393
|
+
"- `project_root`: Directory to scan.\n"
|
|
3394
|
+
"- `content`: Optional text to scan instead of workspace files.\n"
|
|
3395
|
+
"Behavior: Local read-only pattern and entropy checks. Requires no credentials or network requests.\n"
|
|
3396
|
+
"When to use: Check source or configuration for accidentally exposed credentials.\n"
|
|
3397
|
+
"When NOT to use: Use audit_code_quality for code quality checks instead. Manage Git hooks through the local CLI.\n"
|
|
3398
|
+
"Returns: An audit report with locations and redacted findings."
|
|
3495
3399
|
),
|
|
3496
|
-
annotations=ToolAnnotations(read_only_hint=
|
|
3400
|
+
annotations=ToolAnnotations(read_only_hint=True, destructive_hint=False, idempotent_hint=True, open_world_hint=False),
|
|
3497
3401
|
)
|
|
3498
3402
|
def verify_security_guard(
|
|
3499
|
-
action: Annotated[str, Field(default="scan", description="
|
|
3500
|
-
project_root: Annotated[str, Field(default=".", description="Target
|
|
3501
|
-
content: Annotated[str, Field(default="", description="Optional
|
|
3403
|
+
action: Annotated[str, Field(default="scan", description="Supported action: scan.")] = "scan",
|
|
3404
|
+
project_root: Annotated[str, Field(default=".", description="Target directory to scan.")] = ".",
|
|
3405
|
+
content: Annotated[str, Field(default="", description="Optional text to scan instead of workspace files.")] = "",
|
|
3502
3406
|
) -> str:
|
|
3503
|
-
"""
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
else:
|
|
3508
|
-
return _legacy_verify_zero_leak_security(project_root=project_root, target_file="", code_snippet=content)
|
|
3407
|
+
"""Scan for possible credential exposures."""
|
|
3408
|
+
if (action or "scan").lower().strip() != "scan":
|
|
3409
|
+
return "Unsupported security action. MCP supports scanning only. Manage Git hooks using the local CLI."
|
|
3410
|
+
return _legacy_verify_zero_leak_security(project_root=project_root, target_file="", code_snippet=content)
|
|
3509
3411
|
|
|
3510
3412
|
# -------------------------------------------------------------------------
|
|
3511
3413
|
# CANONICAL TOOL 11: estimate_token_cost
|
|
@@ -3545,7 +3447,7 @@ def create_mcp_server():
|
|
|
3545
3447
|
) -> str:
|
|
3546
3448
|
"""Calculates token counts, commercial provider pricing estimates, and developer ROI savings."""
|
|
3547
3449
|
if export_agent_rules:
|
|
3548
|
-
return _legacy_export_agent_rules(
|
|
3450
|
+
return _legacy_export_agent_rules(target=export_agent_rules, project_root=project_root)
|
|
3549
3451
|
return _legacy_estimate_token_cost(text=text, project_root=project_root, reduction_mode="ultra")
|
|
3550
3452
|
|
|
3551
3453
|
# -------------------------------------------------------------------------
|
|
@@ -3949,42 +3851,33 @@ def create_mcp_server():
|
|
|
3949
3851
|
|
|
3950
3852
|
@_maybe_tool(
|
|
3951
3853
|
name="sync_workspace_rules",
|
|
3952
|
-
title="
|
|
3854
|
+
title="Preview Multi-Agent Rule Synchronization",
|
|
3953
3855
|
description=(
|
|
3954
|
-
"
|
|
3955
|
-
"\n"
|
|
3956
|
-
"
|
|
3957
|
-
"
|
|
3958
|
-
"
|
|
3959
|
-
"
|
|
3960
|
-
"
|
|
3961
|
-
"-
|
|
3962
|
-
"-
|
|
3963
|
-
"
|
|
3964
|
-
"- Error Handling: Skips unparseable modules gracefully while indexing valid symbols.\n"
|
|
3965
|
-
"\n"
|
|
3966
|
-
"Usage Guidelines:\n"
|
|
3967
|
-
"- When to use: Use when syncing fresh codebase AST symbols into Cursor, Claude Code, Windsurf, and Git hooks.\n"
|
|
3968
|
-
"- When NOT to use: Do not use if you only want to generate static rules without installing Git hooks (use 'export_agent_rules' instead).\n"
|
|
3969
|
-
"\n"
|
|
3970
|
-
"Returns: Formatted Markdown summary of synchronized files and indexed AST symbols."
|
|
3856
|
+
"Previews workspace rule generation, distinguishing from 'export_agent_rules', which can create missing rule files.\n"
|
|
3857
|
+
"\nParameters:\n"
|
|
3858
|
+
"- `workspace_dir` (str, optional, default='.'): Workspace directory to scan.\n"
|
|
3859
|
+
"\nBehavior:\n"
|
|
3860
|
+
"- Read-only: Scans local Python symbols, writes no rule files, and installs no Git hooks.\n"
|
|
3861
|
+
"- Auth & Rate Limits: Uses no network or external credentials.\n"
|
|
3862
|
+
"\nUsage Guidelines:\n"
|
|
3863
|
+
"- When to use: Check which rule files a workspace sync could create.\n"
|
|
3864
|
+
"- When NOT to use: To create missing files, use the CLI with --apply-sync.\n"
|
|
3865
|
+
"\nReturns: Markdown with candidate files and AST symbol counts."
|
|
3971
3866
|
),
|
|
3972
|
-
annotations=ToolAnnotations(read_only_hint=
|
|
3867
|
+
annotations=ToolAnnotations(read_only_hint=True, destructive_hint=False, idempotent_hint=True, open_world_hint=False)
|
|
3973
3868
|
)
|
|
3974
3869
|
def sync_workspace_rules(
|
|
3975
3870
|
workspace_dir: Annotated[str, Field(default=".", description="Target repository root directory (default: current directory).")] = "."
|
|
3976
3871
|
) -> str:
|
|
3977
|
-
"""
|
|
3872
|
+
"""Preview workspace rule generation."""
|
|
3978
3873
|
from tzero.tzero_sync import WorkspaceSyncManager
|
|
3979
3874
|
res = WorkspaceSyncManager.sync(workspace_dir)
|
|
3980
|
-
files_str = "\n".join(f"- `{f}`" for f in res.synced_files)
|
|
3981
3875
|
return (
|
|
3982
3876
|
f"# ⚡ T-Zero Autonomous Rules Synchronization\n\n"
|
|
3983
3877
|
f"- **Workspace:** `{res.workspace_dir}`\n"
|
|
3984
3878
|
f"- **Modules Scanned:** {res.modules_scanned}\n"
|
|
3985
3879
|
f"- **AST Symbols Indexed:** {res.symbols_indexed}\n"
|
|
3986
3880
|
f"- **Zero-Leak Security:** {res.zero_leak_status}\n\n"
|
|
3987
|
-
f"### Synchronized Directives:\n{files_str}\n\n"
|
|
3988
3881
|
f"**Status:** {res.summary_message}"
|
|
3989
3882
|
)
|
|
3990
3883
|
|
|
@@ -4420,7 +4313,7 @@ def create_mcp_server():
|
|
|
4420
4313
|
"- `options` (optional, default=''): Optional JSON string specifying extra configuration parameters (e.g. {\"reduction_mode\": \"ultra\", \"max_tokens\": 32000, \"depth\": 4}).\n"
|
|
4421
4314
|
"\n"
|
|
4422
4315
|
"Behavior:\n"
|
|
4423
|
-
"- Mutability: Depends on action and options. Security
|
|
4316
|
+
"- Mutability: Depends on action and options. Security and workspace rule sync are read-only; rule export, memory, healing, merge, and generated tests can modify files.\n"
|
|
4424
4317
|
"- Idempotency: Not guaranteed for state-changing operations.\n"
|
|
4425
4318
|
"- Privacy & Network: Most analysis is local, but blueprint with use_ai can contact a configured provider and transmit context.\n"
|
|
4426
4319
|
"- Performance & Resources: Runtime and memory depend on workspace size and selected operation.\n"
|
|
@@ -4589,13 +4482,13 @@ def create_mcp_server():
|
|
|
4589
4482
|
elif act in ("drift", "drift_analysis", "instruction_drift", "attention_drift"):
|
|
4590
4483
|
return analyze_instruction_drift(workspace_dir=target if os.path.isdir(target) else ".")
|
|
4591
4484
|
|
|
4592
|
-
elif act in ("ci", "local_ci", "local-ci", "run_local_ci"):
|
|
4485
|
+
elif act in ("ci", "local_ci", "local-ci", "run_local_ci", "execute_local_ci"):
|
|
4486
|
+
if "install_hook" in opts or "uninstall_hook" in opts:
|
|
4487
|
+
return "MCP cannot manage Git hooks. Use the local CLI to install or remove them."
|
|
4593
4488
|
return run_local_ci(
|
|
4594
4489
|
quick=bool(opts.get("quick", False)),
|
|
4595
4490
|
auto_fix=bool(opts.get("auto_fix", False)),
|
|
4596
|
-
|
|
4597
|
-
uninstall_hook=bool(opts.get("uninstall_hook", False)),
|
|
4598
|
-
project_root=target if os.path.isdir(target) else "."
|
|
4491
|
+
project_root=target if os.path.isdir(target) else ".",
|
|
4599
4492
|
)
|
|
4600
4493
|
|
|
4601
4494
|
elif act in ("merge_heal", "semantic_merge", "merge", "conflict_heal"):
|
|
@@ -4810,19 +4703,12 @@ def create_mcp_server():
|
|
|
4810
4703
|
f"Supported actions: 'auto', 'context', 'audit', 'security', 'blueprint', 'dependencies', "
|
|
4811
4704
|
f"'impact', 'search', 'prune', 'rules', 'enforce', 'cost', 'memory', 'swarm', 'heal', 'design', "
|
|
4812
4705
|
f"'patch', 'pagerank', 'dead_code', 'duplicity', 'call_chain', 'sync', 'roi', 'drift', 'telemetry', 'ci', 'local_ci', "
|
|
4813
|
-
f"
|
|
4706
|
+
f"See the tool list for available actions."
|
|
4814
4707
|
)
|
|
4815
4708
|
|
|
4816
|
-
def run_local_ci(quick: bool = False, auto_fix: bool = False,
|
|
4817
|
-
"""
|
|
4709
|
+
def run_local_ci(quick: bool = False, auto_fix: bool = False, project_root: str = ".") -> str:
|
|
4710
|
+
"""Execute the T-Zero Local CI suite."""
|
|
4818
4711
|
from tzero.tzero_ci import LocalCIRunner
|
|
4819
|
-
if install_hook:
|
|
4820
|
-
ok, msg = LocalCIRunner.install_git_pre_push_hook(project_root)
|
|
4821
|
-
return f"### T-Zero Pre-Push Git Hook Installation\n- Status: {'SUCCESS' if ok else 'FAILED'}\n- Message: {msg}\n"
|
|
4822
|
-
if uninstall_hook:
|
|
4823
|
-
ok, msg = LocalCIRunner.uninstall_git_pre_push_hook(project_root)
|
|
4824
|
-
return f"### T-Zero Pre-Push Git Hook Removal\n- Status: {'SUCCESS' if ok else 'FAILED'}\n- Message: {msg}\n"
|
|
4825
|
-
|
|
4826
4712
|
runner = LocalCIRunner(repo_dir=project_root, quick=quick, auto_fix=auto_fix)
|
|
4827
4713
|
report = runner.run()
|
|
4828
4714
|
return (
|
|
@@ -4833,63 +4719,9 @@ def create_mcp_server():
|
|
|
4833
4719
|
+ "\n".join([f"- [{'PASS' if s.passed else 'FAIL'}] **{s.name}** ({s.duration:.2f}s): {s.output or s.error}" for s in report.steps])
|
|
4834
4720
|
)
|
|
4835
4721
|
|
|
4836
|
-
def armor_against_ai_reverse_engineering(target: str = ".", output_path: str = "") -> str:
|
|
4837
|
-
"""Applies military-grade Anti-REA code and binary protection against AI reverse-engineering agents."""
|
|
4838
|
-
from tzero.tzero_armor import protect_path_with_armor
|
|
4839
|
-
res = protect_path_with_armor(target, output_path=output_path or None)
|
|
4840
|
-
if not res.get("success"):
|
|
4841
|
-
return f"❌ Anti-REA protection failed: {res.get('error', 'Unknown error')}"
|
|
4842
|
-
|
|
4843
|
-
if "score_after" in res:
|
|
4844
|
-
return (
|
|
4845
|
-
f"### 🛡️ T-Zero Anti-REA Military Armor Report\n"
|
|
4846
|
-
f"- **Target File:** `{res['output_file']}`\n"
|
|
4847
|
-
f"- **AI Resistance Score:** `{res['score_before']}/100` ➔ `{res['score_after']}/100`\n"
|
|
4848
|
-
f"- **Rating:** `{res['rating']}`\n"
|
|
4849
|
-
f"- **Status:** `ACTIVE` (Protected against morluto/rea, Ghidra MCP, pyinstxtractor)\n"
|
|
4850
|
-
)
|
|
4851
|
-
elif "files_protected" in res:
|
|
4852
|
-
return (
|
|
4853
|
-
f"### 🛡️ T-Zero Anti-REA Codebase Armor Report\n"
|
|
4854
|
-
f"- **Directory:** `{res['directory']}`\n"
|
|
4855
|
-
f"- **Files Protected:** `{res['files_protected']}`\n"
|
|
4856
|
-
f"- **Status:** `ACTIVE` (All Python modules hardened with Anti-REA defense matrix)\n"
|
|
4857
|
-
)
|
|
4858
|
-
return json.dumps(res, indent=2)
|
|
4859
|
-
|
|
4860
|
-
def audit_ai_decompilation_resistance(target: str = ".") -> str:
|
|
4861
|
-
"""Audits target code or binary for resistance against AI reverse engineering (0-100 score)."""
|
|
4862
|
-
from tzero.tzero_armor import audit_path_rea_resistance
|
|
4863
|
-
audit = audit_path_rea_resistance(target)
|
|
4864
|
-
if not audit.get("success", True):
|
|
4865
|
-
return f"❌ Audit failed: {audit.get('error', 'Unknown error')}"
|
|
4866
|
-
|
|
4867
|
-
report = [
|
|
4868
|
-
f"### 🛡️ AI Reverse-Engineering Resistance Audit (TDQS-REA)",
|
|
4869
|
-
f"- **Target:** `{target}`",
|
|
4870
|
-
f"- **Resistance Score:** `{audit.get('score', 0)} / 100` (`{audit.get('rating', 'UNKNOWN')}`)",
|
|
4871
|
-
f"- **Status:** `{audit.get('status', 'N/A')}`\n",
|
|
4872
|
-
f"#### Active Defenses:",
|
|
4873
|
-
]
|
|
4874
|
-
for k, v in audit.get("defenses_active", {}).items():
|
|
4875
|
-
report.append(f"- [{'✔' if v else ' '}] **{k}**")
|
|
4876
|
-
|
|
4877
|
-
recs = audit.get("sample_findings") or audit.get("findings", [])
|
|
4878
|
-
if recs:
|
|
4879
|
-
report.append("\n#### Hardening Recommendations:")
|
|
4880
|
-
for r in recs:
|
|
4881
|
-
report.append(f"- ⚠️ {r}")
|
|
4882
|
-
|
|
4883
|
-
return "\n".join(report)
|
|
4884
|
-
|
|
4885
4722
|
# Register canonical mappings
|
|
4886
4723
|
_CANONICAL_DISPATCH['execute_codebase_workflow'] = execute_codebase_workflow
|
|
4887
4724
|
_CANONICAL_DISPATCH['run_codebase_autopilot'] = execute_codebase_workflow
|
|
4888
|
-
_CANONICAL_DISPATCH['armor_against_ai_reverse_engineering'] = armor_against_ai_reverse_engineering
|
|
4889
|
-
_CANONICAL_DISPATCH['armor'] = armor_against_ai_reverse_engineering
|
|
4890
|
-
_CANONICAL_DISPATCH['anti_rea'] = armor_against_ai_reverse_engineering
|
|
4891
|
-
_CANONICAL_DISPATCH['audit_ai_decompilation_resistance'] = audit_ai_decompilation_resistance
|
|
4892
|
-
_CANONICAL_DISPATCH['audit_rea'] = audit_ai_decompilation_resistance
|
|
4893
4725
|
_CANONICAL_DISPATCH['build_project_context'] = build_project_context
|
|
4894
4726
|
_CANONICAL_DISPATCH['prune_code_snippet'] = prune_code_snippet
|
|
4895
4727
|
_CANONICAL_DISPATCH['manage_architecture_rules'] = manage_architecture_rules
|
package/src/tzero/tzero_promo.py
CHANGED
|
@@ -55,7 +55,7 @@ PLACEHOLDER_SUBSTRINGS = (
|
|
|
55
55
|
"YOUR_API_KEY", "YOUR-API-KEY", "YOUR_SECRET", "YOUR_TOKEN",
|
|
56
56
|
"YOUR-", "YOUR_", "ENTER_YOUR", "PLACEHOLDER", "CHANGEME", "INSERT_HERE",
|
|
57
57
|
"000000000000", "EXAMPLE_KEY", "EXAMPLEKEY", "EXAMPLE_SECRET",
|
|
58
|
-
"MOCK_KEY_PLACEHOLDER"
|
|
58
|
+
"MOCK_KEY_PLACEHOLDER"
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
|
|
@@ -302,7 +302,7 @@ class ZeroLeakEngine:
|
|
|
302
302
|
def is_placeholder(cls, s: str) -> bool:
|
|
303
303
|
"""Determines if a candidate string is an intentional placeholder/mock."""
|
|
304
304
|
up = s.upper()
|
|
305
|
-
return any(ph in up for ph in PLACEHOLDER_SUBSTRINGS)
|
|
305
|
+
return up in {"MOCK", "DEMO"} or any(ph in up for ph in PLACEHOLDER_SUBSTRINGS)
|
|
306
306
|
|
|
307
307
|
@classmethod
|
|
308
308
|
def is_natural_or_identifier(cls, s: str) -> bool:
|
|
@@ -387,7 +387,7 @@ class ZeroLeakEngine:
|
|
|
387
387
|
val = match.group(1)
|
|
388
388
|
else:
|
|
389
389
|
val = match.group(0)
|
|
390
|
-
if cls.is_placeholder(val)
|
|
390
|
+
if cls.is_placeholder(val):
|
|
391
391
|
continue
|
|
392
392
|
|
|
393
393
|
ent = calculate_shannon_entropy(val)
|