tzero-mcp 10.7.4 → 11.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -21
  3. package/README.md +3 -3
  4. package/bin/tzero-mcp.js +7 -11
  5. package/bin/tzero.js +7 -11
  6. package/index.js +3 -3
  7. package/package.json +3 -2
  8. package/src/addmcp.py +1203 -1194
  9. package/src/app.py +1810 -0
  10. package/src/main.py +60 -60
  11. package/src/pc_fixer_mcp.py +25 -0
  12. package/src/tzero/__init__.py +54 -0
  13. package/src/tzero/__main__.py +6 -0
  14. package/src/tzero/siber_akademi.ico +0 -0
  15. package/src/{siber_akademi_icon.py → tzero/siber_akademi_icon.py} +77 -77
  16. package/src/tzero/tzero_arch_test.py +463 -0
  17. package/src/{tzero_benchmark.py → tzero/tzero_benchmark.py} +2 -2
  18. package/src/tzero/tzero_blackboard.py +257 -0
  19. package/src/{tzero_bridge.py → tzero/tzero_bridge.py} +184 -0
  20. package/src/tzero/tzero_budget.py +195 -0
  21. package/src/tzero/tzero_card.py +431 -0
  22. package/src/{tzero_ci.py → tzero/tzero_ci.py} +7 -7
  23. package/src/{tzero_commit.py → tzero/tzero_commit.py} +1 -1
  24. package/src/tzero/tzero_contracts.py +1093 -0
  25. package/src/{tzero_cost.py → tzero/tzero_cost.py} +4 -1
  26. package/src/{tzero_dashboard.py → tzero/tzero_dashboard.py} +1960 -1448
  27. package/src/tzero/tzero_debt.py +461 -0
  28. package/src/{tzero_deps.py → tzero/tzero_deps.py} +462 -287
  29. package/src/{tzero_drift.py → tzero/tzero_drift.py} +1 -1
  30. package/src/{tzero_explain.py → tzero/tzero_explain.py} +306 -240
  31. package/src/{tzero_features.py → tzero/tzero_features.py} +3024 -3022
  32. package/src/tzero/tzero_federation.py +299 -0
  33. package/src/tzero/tzero_fix.py +557 -0
  34. package/src/{tzero_fixer → tzero/tzero_fixer}/amalgamation.py +334 -334
  35. package/src/{tzero_fixer → tzero/tzero_fixer}/async_io_modernizer.py +1 -1
  36. package/src/{tzero_fixer → tzero/tzero_fixer}/automated_regression_suite.py +8 -8
  37. package/src/{tzero_fixer → tzero/tzero_fixer}/ci_cd_self_healing_gate.py +1 -1
  38. package/src/{tzero_fixer → tzero/tzero_fixer}/code_duplicity_and_refactorer.py +1 -1
  39. package/src/{tzero_fixer → tzero/tzero_fixer}/cwe_remediator.py +1 -1
  40. package/src/{tzero_fixer → tzero/tzero_fixer}/dead_code_eliminator.py +1 -1
  41. package/src/{tzero_fixer → tzero/tzero_fixer}/dependency_vulnerability_auditor.py +1 -1
  42. package/src/{tzero_fixer → tzero/tzero_fixer}/git_advanced_surgeon.py +280 -280
  43. package/src/{tzero_fixer → tzero/tzero_fixer}/hardware_and_disk_doctor.py +325 -325
  44. package/src/{tzero_fixer → tzero/tzero_fixer}/mcp_server.py +489 -447
  45. package/src/{tzero_fixer → tzero/tzero_fixer}/models.py +385 -385
  46. package/src/{tzero_fixer → tzero/tzero_fixer}/orchestrator.py +375 -375
  47. package/src/{tzero_fixer → tzero/tzero_fixer}/packaging_abi_surgeon.py +323 -323
  48. package/src/{tzero_fixer → tzero/tzero_fixer}/pc_fixer_doctor.py +2 -1
  49. package/src/{tzero_fixer → tzero/tzero_fixer}/performance_and_memory_profiler.py +1 -1
  50. package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_ast_parsers.py +1 -1
  51. package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_build_healer.py +364 -364
  52. package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_linters.py +619 -619
  53. package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_schema_validator.py +1 -1
  54. package/src/{tzero_fixer → tzero/tzero_fixer}/smart_patch_recommender.py +1 -1
  55. package/src/{tzero_fixer → tzero/tzero_fixer}/synthetic_workspace_generator.py +2 -2
  56. package/src/{tzero_fixer → tzero/tzero_fixer}/system_diagnostics_extended.py +493 -493
  57. package/src/{tzero_fixer → tzero/tzero_fixer}/system_repair_recipes.py +1 -1
  58. package/src/tzero/tzero_golden.py +319 -0
  59. package/src/tzero/tzero_graph_hud.html +338 -0
  60. package/src/tzero/tzero_graph_rag.py +263 -0
  61. package/src/tzero/tzero_growth.py +415 -0
  62. package/src/{tzero_guard.py → tzero/tzero_guard.py} +11 -3
  63. package/src/tzero/tzero_hooks.py +565 -0
  64. package/src/{tzero_jarvis → tzero/tzero_jarvis}/__init__.py +11 -1
  65. package/src/{tzero_jarvis → tzero/tzero_jarvis}/causal_graph.py +1 -1
  66. package/src/tzero/tzero_jarvis/creative_director.py +333 -0
  67. package/src/{tzero_jarvis → tzero/tzero_jarvis}/graph_visualizer.py +1 -1
  68. package/src/{tzero_jarvis → tzero/tzero_jarvis}/latent_press.py +2 -2
  69. package/src/{tzero_jarvis → tzero/tzero_jarvis}/memory_consolidation.py +1 -1
  70. package/src/{tzero_jarvis → tzero/tzero_jarvis}/minhash_lsh.py +1 -1
  71. package/src/{tzero_jarvis → tzero/tzero_jarvis}/orchestrator.py +2 -2
  72. package/src/{tzero_jarvis → tzero/tzero_jarvis}/self_healing.py +1 -1
  73. package/src/{tzero_jarvis → tzero/tzero_jarvis}/swarm.py +3 -3
  74. package/src/{tzero_jarvis → tzero/tzero_jarvis}/swarm_bft.py +1 -1
  75. package/src/{tzero_jarvis → tzero/tzero_jarvis}/workspace_orchestrator.py +6 -6
  76. package/src/tzero/tzero_lsp.py +634 -0
  77. package/src/tzero/tzero_mcp.py +5314 -0
  78. package/src/tzero/tzero_mutation.py +358 -0
  79. package/src/{tzero_neural_cortex.py → tzero/tzero_neural_cortex.py} +1425 -1425
  80. package/src/tzero/tzero_packer.py +577 -0
  81. package/src/{tzero_pc_fixer.py → tzero/tzero_pc_fixer.py} +42 -0
  82. package/src/{tzero_pipe.py → tzero/tzero_pipe.py} +1 -1
  83. package/src/tzero/tzero_polyglot.py +799 -0
  84. package/src/tzero/tzero_proxy.py +127 -0
  85. package/src/tzero/tzero_rust_bridge.py +198 -0
  86. package/src/tzero/tzero_scip.py +368 -0
  87. package/src/{tzero_security.py → tzero/tzero_security.py} +573 -570
  88. package/src/tzero/tzero_semantic_merge.py +189 -0
  89. package/src/tzero/tzero_snapshot.py +471 -0
  90. package/src/{tzero_stubs.py → tzero/tzero_stubs.py} +1 -1
  91. package/src/tzero/tzero_subagent_engine.py +459 -0
  92. package/src/{tzero_sync.py → tzero/tzero_sync.py} +2 -2
  93. package/src/{tzero_task_benchmark.py → tzero/tzero_task_benchmark.py} +174 -31
  94. package/src/{tzero_tui.py → tzero/tzero_tui.py} +313 -244
  95. package/src/tzero/tzero_turbo.py +264 -0
  96. package/src/{tzero_v3.py → tzero/tzero_v3.py} +9997 -9435
  97. package/src/tzero.py +6 -58
  98. package/src/tzero_mcp.py +25 -4858
  99. package/test/package.test.js +14 -2
  100. package/src/tzero/jarvis/semantic_compressor.py +0 -373
  101. package/src/tzero_fix.py +0 -228
  102. package/src/tzero_gateway.py +0 -885
  103. package/src/tzero_packer.py +0 -370
  104. package/src/tzero_polyglot.py +0 -422
  105. package/src/tzero_snapshot.py +0 -258
  106. /package/src/{tzero_fixer → tzero/tzero_fixer}/__init__.py +0 -0
  107. /package/src/{tzero_fixer → tzero/tzero_fixer}/ast_syntax_healer.py +0 -0
  108. /package/src/{tzero_fixer → tzero/tzero_fixer}/ast_type_modernizer.py +0 -0
  109. /package/src/{tzero_fixer → tzero/tzero_fixer}/benchmarks_and_diagnostics.py +0 -0
  110. /package/src/{tzero_fixer → tzero/tzero_fixer}/code_smells_healer.py +0 -0
  111. /package/src/{tzero_fixer → tzero/tzero_fixer}/import_graph_healer.py +0 -0
  112. /package/src/{tzero_fixer → tzero/tzero_fixer}/interactive_tui.py +0 -0
  113. /package/src/{tzero_fixer → tzero/tzero_fixer}/knowledge_base.py +0 -0
  114. /package/src/{tzero_fixer → tzero/tzero_fixer}/knowledge_base_extended.py +0 -0
  115. /package/src/{tzero_fixer → tzero/tzero_fixer}/linters_and_static_analyzer.py +0 -0
  116. /package/src/{tzero_fixer → tzero/tzero_fixer}/os_doctor.py +0 -0
  117. /package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_config_healer.py +0 -0
  118. /package/src/{tzero_fixer → tzero/tzero_fixer}/polyglot_doctor.py +0 -0
  119. /package/src/{tzero_fixer → tzero/tzero_fixer}/security_cwe_database.py +0 -0
  120. /package/src/{tzero_fixer → tzero/tzero_fixer}/security_deep_rules.py +0 -0
  121. /package/src/{tzero_fixer → tzero/tzero_fixer}/security_rules_catalog.py +0 -0
  122. /package/src/{tzero_fixer → tzero/tzero_fixer}/security_zero_leak.py +0 -0
  123. /package/src/{tzero_fixer → tzero/tzero_fixer}/venv_doctor.py +0 -0
  124. /package/src/{tzero_infra.py → tzero/tzero_infra.py} +0 -0
  125. /package/src/{tzero_jarvis → tzero/tzero_jarvis}/hybrid_search.py +0 -0
  126. /package/src/{tzero_jarvis → tzero/tzero_jarvis}/semantic_compressor.py +0 -0
  127. /package/src/{tzero_jarvis → tzero/tzero_jarvis}/zero_key_router.py +0 -0
  128. /package/src/{tzero_patch.py → tzero/tzero_patch.py} +0 -0
  129. /package/src/{tzero_reachability.py → tzero/tzero_reachability.py} +0 -0
  130. /package/src/{tzero_replay.py → tzero/tzero_replay.py} +0 -0
  131. /package/src/{tzero_superdesign.py → tzero/tzero_superdesign.py} +0 -0
@@ -0,0 +1,263 @@
1
+ # -*- coding: utf-8 -*-
2
+ """T-Zero Vectorless Semantic Graph & Local Code-RAG Engine (100% Offline, Zero-Cost).
3
+
4
+ Combines lexical BM25 token relevance, AST structural symbols, and PageRank
5
+ graph centrality into a unified hybrid retrieval pipeline without external embeddings.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import collections
11
+ import dataclasses
12
+ import math
13
+ import os
14
+ import re
15
+ from typing import Any, Dict, List, Optional, Set, Tuple
16
+
17
+
18
+ @dataclasses.dataclass
19
+ class GraphRagChunk:
20
+ chunk_id: str
21
+ file_path: str
22
+ name: str
23
+ kind: str # function, class, interface, module
24
+ signature: str
25
+ content: str
26
+ docstring: str
27
+ line_start: int
28
+ line_end: int
29
+ dependencies: List[str] = dataclasses.field(default_factory=list)
30
+ tokens: List[str] = dataclasses.field(default_factory=list)
31
+ bm25_score: float = 0.0
32
+ graph_centrality: float = 0.0
33
+ hybrid_score: float = 0.0
34
+
35
+
36
+ class VectorlessGraphRAG:
37
+ """100% Offline, private Graph RAG combining BM25, AST Call Graph, and Centrality."""
38
+
39
+ def __init__(self, workspace_dir: str):
40
+ self.workspace_dir = os.path.abspath(workspace_dir)
41
+ self.chunks: List[GraphRagChunk] = []
42
+ self.doc_freqs: Dict[str, int] = collections.defaultdict(int)
43
+ self.total_docs: int = 0
44
+ self.avg_doc_len: float = 0.0
45
+ self.call_graph: Dict[str, Set[str]] = collections.defaultdict(set)
46
+ self.reverse_call_graph: Dict[str, Set[str]] = collections.defaultdict(set)
47
+ self.centrality_scores: Dict[str, float] = {}
48
+
49
+ @staticmethod
50
+ def tokenize(text: str) -> List[str]:
51
+ """Sub-word aware identifier tokenization."""
52
+ if not text:
53
+ return []
54
+ raw_words = re.findall(r"[A-Za-z0-9_]+", text)
55
+ tokens: List[str] = []
56
+ for word in raw_words:
57
+ tokens.append(word.lower())
58
+ # split camelCase and PascalCase
59
+ parts = re.findall(r"[A-Z]?[a-z]+|[A-Z]+(?=[A-Z][a-z]|\d|\W|$)|\d+", word)
60
+ if len(parts) > 1:
61
+ for p in parts:
62
+ clean = p.lower().strip("_")
63
+ if len(clean) >= 2:
64
+ tokens.append(clean)
65
+ # split snake_case
66
+ if "_" in word:
67
+ for sub in word.split("_"):
68
+ clean = sub.lower()
69
+ if len(clean) >= 2:
70
+ tokens.append(clean)
71
+ return [t for t in tokens if len(t) >= 2]
72
+
73
+ def index_workspace(self, file_limit: int = 500) -> int:
74
+ """Scan workspace and index code structures into graph RAG nodes."""
75
+ from tzero.tzero_snapshot import SnapshotEngine
76
+
77
+ snap = SnapshotEngine.create_snapshot(self.workspace_dir)
78
+ self.chunks.clear()
79
+ self.doc_freqs.clear()
80
+ self.call_graph.clear()
81
+ self.reverse_call_graph.clear()
82
+
83
+ total_tokens = 0
84
+ file_count = 0
85
+
86
+ for rel_path, file_snap in sorted(snap.files.items()):
87
+ file_count += 1
88
+ if file_count > file_limit:
89
+ break
90
+
91
+ full_path = os.path.join(self.workspace_dir, rel_path)
92
+ # 1. Module chunk
93
+ mod_text = f"{rel_path} " + " ".join(file_snap.imports)
94
+ mod_tokens = self.tokenize(mod_text)
95
+ mod_chunk = GraphRagChunk(
96
+ chunk_id=f"mod::{rel_path}",
97
+ file_path=rel_path,
98
+ name=os.path.basename(rel_path),
99
+ kind="module",
100
+ signature=f"module {rel_path}",
101
+ content=mod_text,
102
+ docstring="",
103
+ line_start=1,
104
+ line_end=1,
105
+ dependencies=list(file_snap.imports),
106
+ tokens=mod_tokens,
107
+ )
108
+ self.chunks.append(mod_chunk)
109
+ total_tokens += len(mod_tokens)
110
+
111
+ # Record dependency edges
112
+ for imp in file_snap.imports:
113
+ imp_stem = os.path.splitext(os.path.basename(imp))[0]
114
+ self.call_graph[rel_path].add(imp_stem)
115
+ self.reverse_call_graph[imp_stem].add(rel_path)
116
+
117
+ # 2. Function / Class chunks
118
+ for fn_name in file_snap.functions:
119
+ sig_text = f"def {fn_name}() in {rel_path}"
120
+ fn_tokens = self.tokenize(f"{fn_name} {rel_path}")
121
+ fn_chunk = GraphRagChunk(
122
+ chunk_id=f"fn::{rel_path}::{fn_name}",
123
+ file_path=rel_path,
124
+ name=fn_name,
125
+ kind="function",
126
+ signature=sig_text,
127
+ content=sig_text,
128
+ docstring="",
129
+ line_start=1,
130
+ line_end=1,
131
+ dependencies=list(file_snap.imports),
132
+ tokens=fn_tokens,
133
+ )
134
+ self.chunks.append(fn_chunk)
135
+ total_tokens += len(fn_tokens)
136
+
137
+ for cls_name in file_snap.classes:
138
+ sig_text = f"class {cls_name} in {rel_path}"
139
+ cls_tokens = self.tokenize(f"{cls_name} {rel_path}")
140
+ cls_chunk = GraphRagChunk(
141
+ chunk_id=f"cls::{rel_path}::{cls_name}",
142
+ file_path=rel_path,
143
+ name=cls_name,
144
+ kind="class",
145
+ signature=sig_text,
146
+ content=sig_text,
147
+ docstring="",
148
+ line_start=1,
149
+ line_end=1,
150
+ dependencies=list(file_snap.imports),
151
+ tokens=cls_tokens,
152
+ )
153
+ self.chunks.append(cls_chunk)
154
+ total_tokens += len(cls_tokens)
155
+
156
+ self.total_docs = len(self.chunks)
157
+ self.avg_doc_len = (total_tokens / self.total_docs) if self.total_docs > 0 else 1.0
158
+
159
+ # Build Document Frequency
160
+ for chunk in self.chunks:
161
+ seen_terms = set(chunk.tokens)
162
+ for term in seen_terms:
163
+ self.doc_freqs[term] += 1
164
+
165
+ # Compute PageRank Centrality across nodes
166
+ self._compute_graph_centrality()
167
+ return self.total_docs
168
+
169
+ def _compute_graph_centrality(self, damping: float = 0.85, iterations: int = 25) -> None:
170
+ """Compute node centrality for connected files."""
171
+ nodes = list(self.call_graph.keys() | self.reverse_call_graph.keys())
172
+ if not nodes:
173
+ return
174
+ n = len(nodes)
175
+ scores = {node: 1.0 / n for node in nodes}
176
+
177
+ for _ in range(iterations):
178
+ new_scores = {}
179
+ for node in nodes:
180
+ incoming_sum = 0.0
181
+ for pred in self.reverse_call_graph.get(node, set()):
182
+ out_deg = len(self.call_graph.get(pred, set()))
183
+ if out_deg > 0:
184
+ incoming_sum += scores.get(pred, 0.0) / out_deg
185
+ new_scores[node] = (1.0 - damping) / n + damping * incoming_sum
186
+ scores = new_scores
187
+
188
+ self.centrality_scores = scores
189
+ for chunk in self.chunks:
190
+ stem = os.path.splitext(os.path.basename(chunk.file_path))[0]
191
+ chunk.graph_centrality = self.centrality_scores.get(stem, self.centrality_scores.get(chunk.file_path, 0.05))
192
+
193
+ def _score_bm25(self, query_tokens: List[str], chunk_tokens: List[str], k1: float = 1.2, b: float = 0.75) -> float:
194
+ """Standard BM25 scoring for query tokens against chunk tokens."""
195
+ if not query_tokens or not chunk_tokens:
196
+ return 0.0
197
+ doc_len = len(chunk_tokens)
198
+ counts = collections.Counter(chunk_tokens)
199
+ score = 0.0
200
+
201
+ for q in query_tokens:
202
+ if q not in counts:
203
+ continue
204
+ df = self.doc_freqs.get(q, 0)
205
+ idf = math.log(1.0 + (self.total_docs - df + 0.5) / (df + 0.5))
206
+ tf = counts[q]
207
+ denom = tf + k1 * (1.0 - b + b * (doc_len / (self.avg_doc_len or 1.0)))
208
+ score += idf * (tf * (k1 + 1.0)) / denom
209
+ return max(0.0, score)
210
+
211
+ def query(
212
+ self,
213
+ query_text: str,
214
+ top_k: int = 5,
215
+ graph_weight: float = 0.35,
216
+ bm25_weight: float = 0.65,
217
+ ) -> List[Dict[str, Any]]:
218
+ """Execute hybrid search combining BM25 and graph centrality ranking."""
219
+ if not self.chunks:
220
+ self.index_workspace()
221
+
222
+ q_tokens = self.tokenize(query_text)
223
+ if not q_tokens:
224
+ return []
225
+
226
+ scored_chunks: List[GraphRagChunk] = []
227
+ max_bm25 = 0.0001
228
+ for chunk in self.chunks:
229
+ b_score = self._score_bm25(q_tokens, chunk.tokens)
230
+ chunk.bm25_score = b_score
231
+ if b_score > max_bm25:
232
+ max_bm25 = b_score
233
+
234
+ # Normalize and blend
235
+ for chunk in self.chunks:
236
+ norm_bm25 = chunk.bm25_score / max_bm25
237
+ # Graph centrality boost
238
+ hybrid = (norm_bm25 * bm25_weight) + (chunk.graph_centrality * graph_weight)
239
+ # Exact symbol name match boost
240
+ if any(q == chunk.name.lower() for q in q_tokens):
241
+ hybrid += 0.5
242
+ chunk.hybrid_score = hybrid
243
+ if chunk.bm25_score > 0.0 or chunk.hybrid_score > 0.2:
244
+ scored_chunks.append(chunk)
245
+
246
+ scored_chunks.sort(key=lambda c: c.hybrid_score, reverse=True)
247
+ top = scored_chunks[:top_k]
248
+
249
+ return [
250
+ {
251
+ "chunk_id": c.chunk_id,
252
+ "file_path": c.file_path,
253
+ "name": c.name,
254
+ "kind": c.kind,
255
+ "signature": c.signature,
256
+ "hybrid_score": round(c.hybrid_score, 4),
257
+ "bm25_score": round(c.bm25_score, 4),
258
+ "centrality": round(c.graph_centrality, 4),
259
+ "dependencies": c.dependencies[:5],
260
+ }
261
+ for c in top
262
+ ]
263
+
@@ -0,0 +1,415 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ T-ZERO $0.00 BUDGET VIRAL MARKETING & COMMUNITY GROWTH ENGINE
4
+ -------------------------------------------------------------
5
+ Developer: Toprak Ahmet Aydoğmuş (Siber Akademi)
6
+ License: MIT | Version: 11.11.0
7
+
8
+ Strictly $0.00 budget: Zero paid ads, zero paid APIs, zero cloud tokens.
9
+ Pure organic developer-to-developer growth engine engineered to drive 100+ GitHub stars.
10
+ Generates tailored, high-converting launch copy for Reddit, Hacker News, Product Hunt,
11
+ Twitter/X, LinkedIn, Dev.to, Turkish Tech Hubs, and Awesome-Lists.
12
+ """
13
+
14
+ import sys
15
+ import os
16
+ import json
17
+ import urllib.request
18
+ from pathlib import Path
19
+ from typing import Dict, Any, List
20
+
21
+ REPO_URL = "https://github.com/toprakahmetaydogmus/TZeroAlgorithm"
22
+ WEB_URL = "https://tzero-indol.vercel.app"
23
+ AUTHOR = "Toprak Ahmet Aydoğmuş"
24
+ ORGANIZATION = "Siber Akademi"
25
+ VERSION = "v11.11.0"
26
+ PYPI_PKG = "tzero-mcp"
27
+ NPM_PKG = "tzero-mcp"
28
+
29
+
30
+ def get_live_github_stars() -> int:
31
+ """Fetch current GitHub stargazers count."""
32
+ try:
33
+ url = "https://api.github.com/repos/toprakahmetaydogmus/TZeroAlgorithm"
34
+ req = urllib.request.Request(url, headers={"User-Agent": "T-Zero-Growth-Engine"})
35
+ with urllib.request.urlopen(req, timeout=5) as resp:
36
+ data = json.loads(resp.read().decode("utf-8"))
37
+ return int(data.get("stargazers_count", 16))
38
+ except Exception:
39
+ return 16
40
+
41
+
42
+ def render_progress_bar(current: int, target: int = 100, length: int = 30) -> str:
43
+ """Renders visual ASCII progress bar."""
44
+ pct = min(1.0, current / target)
45
+ filled = int(pct * length)
46
+ bar = "█" * filled + "░" * (length - filled)
47
+ return f"[{bar}] {current}/{target} Stars ({pct*100:.1f}%)"
48
+
49
+
50
+ def generate_reddit_posts() -> Dict[str, Dict[str, str]]:
51
+ """Generates copy-paste ready Reddit launch posts."""
52
+ return {
53
+ "r/Cursor": {
54
+ "title": "I built an open-source MCP server that cuts Cursor context tokens by 85-95% using AST pruning (100% local, no API keys, $0)",
55
+ "body": f"""Hey Cursor developers!
56
+
57
+ Like many of you, I kept hitting Cursor Composer context degradation and rate limits on medium-to-large repositories (100+ files). When you ingest an entire project, 90% of the token payload consists of function execution bodies that the LLM does not need to understand your architecture.
58
+
59
+ To solve this, I spent the last several months engineering **T-Zero** ({VERSION}) — an open-source Model Context Protocol (MCP) server that deterministically prunes multi-language codebases down to their exact AST interfaces, type annotations, and docstrings before feeding them to Cursor.
60
+
61
+ ### 📊 Real Benchmark on 481-File Repository:
62
+ - **Raw Codebase Context:** 10,998,573 tokens (causes instant truncation / extreme lag)
63
+ - **T-Zero 4-Tier AST Tree:** 1,319,828 tokens (**-88.0% token reduction**)
64
+ - **Focus File Skeleton (T-3):** **-94.6% token reduction**
65
+ - **AST Visitor Speed:** <400ms (100% offline via local Python AST parser)
66
+ - **Unit & E2E Tests:** 537 automated tests passing with 0 errors
67
+
68
+ ### 🤖 New in {VERSION} — AI Godfather Auto-Corrector:
69
+ - Catches AI coding hallucinations before code is committed.
70
+ - Statically validates imported symbols against your project's AST and auto-heals misspelled or imaginary functions.
71
+ - Injects missing stdlib modules and typing imports automatically.
72
+
73
+ ### ⚡ Add to Cursor in 30 Seconds:
74
+ Add this to your Cursor MCP settings (`~/.cursor/mcp.json`):
75
+
76
+ ```json
77
+ {{
78
+ "mcpServers": {{
79
+ "tzero": {{
80
+ "command": "python",
81
+ "args": ["-m", "tzero.tzero_mcp"]
82
+ }}
83
+ }}
84
+ }}
85
+ ```
86
+ *(Or install via pip: `pip install {PYPI_PKG}` or npm: `npx {NPM_PKG}`)*
87
+
88
+ ### 🔒 100% Zero-Leak Security & Privacy:
89
+ - Zero external LLM calls or cloud telemetry.
90
+ - Built-in Shannon Entropy scanner (H >= 4.75) detects and redacts hardcoded API keys and credentials locally.
91
+
92
+ I'm 15 years old and building this as a solo open-source engineer at {ORGANIZATION}. Everything is 100% free under MIT.
93
+
94
+ If this saves your Cursor context budget, **I'd genuinely appreciate a star on GitHub ⭐** — we are on the road to our first 100 stars!
95
+
96
+ 👉 **GitHub:** {REPO_URL}
97
+ 👉 **Live Benchmark:** {WEB_URL}
98
+ 👉 **PyPI:** https://pypi.org/project/{PYPI_PKG}/
99
+ """
100
+ },
101
+ "r/ClaudeAI": {
102
+ "title": "Stop hitting Claude Desktop & Claude Code 200K token limits: Open-source local AST context pruning (-88% to -95%)",
103
+ "body": f"""If you use Claude Desktop or Claude Code with complex multi-module codebases, you know how fast the 200K token window fills up. Once context fills up, Claude begins suffering from "lost-in-the-middle" attention degradation or hits expensive per-prompt costs.
104
+
105
+ **T-Zero** ({VERSION}) is a 100% local, offline MCP server that parses your codebase into an AST and strips implementation bodies while keeping 100% of the type signatures, classes, docstrings, and imports across 12+ programming languages.
106
+
107
+ ### 💡 Why AST Beats Naive File Dumping:
108
+ When Claude writes a new endpoint or fixes a bug, it doesn't need 200 lines of SQL query builder boilerplate from your database driver. It just needs:
109
+ 1. Class inheritance structures
110
+ 2. Typed function signatures & return types
111
+ 3. Docstrings & interface contracts
112
+
113
+ Claude gets 100% of the architectural context needed to produce zero-defect code, while consuming **up to 95% fewer tokens**.
114
+
115
+ ### ⚡ 1-Click Setup for Claude Desktop:
116
+ Add to your `claude_desktop_config.json`:
117
+ ```json
118
+ {{
119
+ "mcpServers": {{
120
+ "tzero": {{
121
+ "command": "python",
122
+ "args": ["-m", "tzero.tzero_mcp"]
123
+ }}
124
+ }}
125
+ }}
126
+ ```
127
+
128
+ - **Cost:** $0.00 (Zero paid APIs, runs 100% offline)
129
+ - **Security:** In-memory Shannon entropy scanner redacts API keys
130
+ - **License:** MIT Open Source
131
+
132
+ Check it out and drop a star if you find it useful! ⭐
133
+ 👉 **GitHub:** {REPO_URL}
134
+ 👉 **Web Playground:** {WEB_URL}
135
+ """
136
+ },
137
+ "r/LocalLLaMA": {
138
+ "title": "T-Zero: 100% offline, zero-cloud AST codebase context pruner for local models (Ollama, LM Studio, Qwen 2.5 Coder, DeepSeek)",
139
+ "body": f"""When running local coding models (Qwen 2.5 Coder 7B/14B/32B, DeepSeek-Coder, Llama 3.1) on consumer GPUs, VRAM context window limits (8K–32K) make it impossible to feed full multi-file codebases into prompts.
140
+
141
+ **T-Zero** ({VERSION}) is a zero-cloud AST token reducer that fits whole multi-tier codebases into compact local context windows:
142
+ 1. **Deterministic AST pruning:** Collapses function bodies to `...` while retaining full signatures and type annotations.
143
+ 2. **PageRank Module Centrality:** Graph-theory ranking automatically prioritizes architectural backbone files when strict token caps are enforced.
144
+ 3. **Shannon Entropy Zero-Leak:** Ensures no private keys or tokens leak into model prompts.
145
+ 4. **Local BM25 Hybrid Search:** Instant semantic symbol lookup with 0 cloud embeddings.
146
+
147
+ - **Zero Cloud Calls:** 100% air-gapped stdio server.
148
+ - **Install:** `pip install {PYPI_PKG}`
149
+ - **GitHub:** {REPO_URL} (Stars welcome! ⭐)
150
+ """
151
+ },
152
+ "r/Turkey": {
153
+ "title": f"15 yaşındayım, Cursor ve Claude için geliştirdiğim açık kaynaklı context motoru {VERSION} ile yayında! 🇹🇷",
154
+ "body": f"""Merhaba Türk yazılımcı topluluğu!
155
+
156
+ Ben Toprak Ahmet Aydoğmuş, 15 yaşındayım ve {ORGANIZATION} bünyesinde bağımsız açık kaynaklı yazılımlar geliştiriyorum.
157
+
158
+ Yapay zeka kodlama araçlarıyla (Cursor, Claude Desktop, Antigravity, Windsurf) büyük projelerde çalışırken en büyük darboğaz **token sınırları ve yüksek context maliyetleri**. Tüm dosyaları yapay zekaya yüklediğinizde binlerce satır gereksiz gövde kodu yapay zekanın dikkatini dağıtıyor ve pencereyi tüketiyor.
159
+
160
+ Bu problemi çözmek için geliştirdiğim **T-Zero (Token Zero)** projesini {VERSION} sürümüyle tamamen ücretsiz ve açık kaynak olarak yayınladım!
161
+
162
+ ### 🌟 Temel Yetenekleri:
163
+ - Python, TypeScript, Go, Rust, Java vb. dillerde kodları AST (Abstract Syntax Tree) ile inceleyip fonksiyon gövdelerini buduyor ve token tüketimini **%85-%95 oranında azaltıyor**.
164
+ - Model Context Protocol (MCP) standardında çalıştığı için Cursor ve Claude Desktop'a tek tıkla ekleniyor.
165
+ - %100 yerel ve çevrimdışı çalışıyor; hiçbir harici ücretli API veya sunucuya bağlanmıyor ($0 maliyet).
166
+ - Yeni {VERSION} sürümünde eklenen **AI Godfather Süpervizörü** sayesinde yapay zekanın uydurduğu (hallucinated) sahte fonksiyon çağrılarını ve eksik importları otomatik düzeltiyor.
167
+ - 537 otomatik testten %100 başarıyla geçmektedir.
168
+
169
+ Projeyi GitHub'da yıldızlayarak (Star ⭐) ilk 100 yıldız hedefimize ulaşmamıza destek olursanız çok sevinirim!
170
+
171
+ 🔗 **GitHub:** {REPO_URL}
172
+ 🔗 **Web Benchmark:** {WEB_URL}
173
+ 🔗 **PyPI:** https://pypi.org/project/{PYPI_PKG}/
174
+ """
175
+ }
176
+ }
177
+
178
+
179
+ def generate_show_hn() -> Dict[str, str]:
180
+ """Generates Hacker News Show HN submission."""
181
+ return {
182
+ "title": f"Show HN: T-Zero – Local AST context pruning for LLMs with 88-95% token reduction",
183
+ "url": REPO_URL,
184
+ "first_comment": f"""Hi HN! I'm Toprak ({AUTHOR}), a 15-year-old software engineer from Turkey. I built T-Zero to solve a fundamental efficiency problem in AI-assisted software engineering: prompt context bloat.
185
+
186
+ ### The Problem:
187
+ When developers feed large repositories into Cursor, Claude Desktop, or Claude Code, they either:
188
+ 1. Rely on vector embeddings (RAG), which frequently misses cross-file caller/callee contracts and exact type signatures, or
189
+ 2. Dump entire source files into the context window, burning hundreds of thousands of tokens, triggering rate limits, and degrading model attention ("lost in the middle").
190
+
191
+ ### The AST Pruning Approach:
192
+ T-Zero parses multi-language source trees into Abstract Syntax Trees (AST) and deterministically extracts interface contracts (class hierarchies, method signatures, argument types, return types, docstrings, imports) while pruning execution bodies.
193
+
194
+ On our benchmark repository of 481 files (~86,000 lines of code):
195
+ - Raw Codebase: 10,998,573 tokens ($32.99 per single Claude 3.5 Sonnet context fill)
196
+ - T-Zero 4-Tier AST Tree: 1,319,828 tokens (-88.0% reduction)
197
+ - Focus Skeleton (T-3): -94.6% reduction
198
+ - Processing Latency: <400ms locally
199
+
200
+ ### Security & Privacy:
201
+ - **100% Zero-Leak:** Calculates in-memory Shannon entropy (H >= 4.75) alongside regex patterns to detect and redact API keys, JWTs, and private keys locally before any context is emitted.
202
+ - **Zero Cloud Telemetry:** Operates 100% offline via local stdio MCP protocol.
203
+
204
+ The codebase is open source under MIT: {REPO_URL}
205
+ Web Playground: {WEB_URL}
206
+
207
+ I would love to hear thoughts, critique, and feedback on our AST pruning heuristics and MCP server architecture!
208
+ """
209
+ }
210
+
211
+
212
+ def generate_twitter_thread() -> List[str]:
213
+ """Generates 7-tweet viral X/Twitter thread."""
214
+ return [
215
+ f"""1/7 🚨 We ran a 481-file codebase through Claude 3.5 Sonnet:
216
+
217
+ 🔴 Raw codebase: 10.9M tokens ($32.99 / prompt fill)
218
+ 🟢 With T-Zero AST pruning: 1.3M tokens (-88% reduction)
219
+
220
+ Meet T-Zero {VERSION}: an open-source local MCP server that eliminates context window bloat for Cursor, Claude & local LLMs.
221
+
222
+ 🧵 A thread on how it works: 👇""",
223
+ """2/7 💡 The Problem with Raw Code Context:
224
+
225
+ When your AI coding assistant writes an API endpoint or fixes a bug, it doesn't need the 150-line implementation body of your database connection pool.
226
+
227
+ It only needs the class structure, method signatures, parameter types, and docstrings.
228
+
229
+ T-Zero extracts that exact skeleton in <400ms.""",
230
+ """3/7 🌐 True Polyglot Support:
231
+
232
+ 🐍 Python (native ast parser)
233
+ 🟨 TypeScript & JavaScript
234
+ 🐹 Go
235
+ 🦀 Rust
236
+ ☕ Java & Kotlin
237
+ 🔷 C# & C++
238
+ 🍎 Swift & Ruby
239
+
240
+ All parsed deterministically on your local CPU with 0 cloud dependencies.""",
241
+ """4/7 🔒 100% Zero-Leak Security Guarantee:
242
+
243
+ Accidentally leaking API keys into LLM prompts is an enterprise nightmare.
244
+
245
+ T-Zero includes an in-memory Shannon Entropy scanner (H >= 4.75) that detects high-entropy secrets and redacts them *before* any text leaves your computer.
246
+
247
+ 100% private, 100% offline.""",
248
+ f"""5/7 🤖 New in {VERSION}: AI Godfather Hallucination Healer:
249
+
250
+ T-Zero now statically inspects AI-generated code against your workspace AST.
251
+
252
+ If the AI invents a nonexistent method or misspells an import, T-Zero catches it and auto-rewrites it to the real local symbol with 0 human intervention.""",
253
+ f"""6/7 ⚡ 30-Second Setup:
254
+
255
+ Option A (pip):
256
+ $ pip install {PYPI_PKG}
257
+
258
+ Option B (npx zero-install):
259
+ $ npx {NPM_PKG}
260
+
261
+ Option C (Standalone .exe):
262
+ Download precompiled Windows 64-bit binaries from our GitHub Releases!""",
263
+ f"""7/7 🌟 We are on a mission to reach our first 100 stars on GitHub!
264
+
265
+ Built by Toprak Ahmet Aydoğmuş (15-year-old solo engineer at Siber Akademi). 100% free under MIT.
266
+
267
+ If you care about AI efficiency and open source tooling, please drop a star ⭐:
268
+
269
+ 👉 {REPO_URL}
270
+ 👉 {WEB_URL}
271
+
272
+ RTs appreciated! 🔁 #CursorAI #ClaudeAI #Python #OpenSource"""
273
+ ]
274
+
275
+
276
+ def generate_product_hunt() -> Dict[str, str]:
277
+ """Generates Product Hunt launch kit."""
278
+ return {
279
+ "name": "T-Zero Context Architect",
280
+ "tagline": "Cut AI coding context tokens by up to 95% using AST pruning",
281
+ "topics": "Developer Tools, Artificial Intelligence, Open Source, Productivity, Python",
282
+ "description": "T-Zero is a local Model Context Protocol (MCP) server for Cursor, Claude Desktop, Antigravity IDE, and Windsurf that deterministically prunes codebase bodies to typed AST skeletons, reducing LLM token consumption by 85–95% with 100% Zero-Leak security.",
283
+ "maker_comment": f"""Hey Product Hunt community! 👋
284
+
285
+ I'm Toprak ({AUTHOR}), 15 years old, and I've spent the past few months building **T-Zero** at {ORGANIZATION}.
286
+
287
+ ### The Problem We Solved:
288
+ AI coding assistants like Cursor and Claude are transformative, but as soon as you open a repository with 50+ files, you run into:
289
+ 1. Massive context window consumption (millions of tokens)
290
+ 2. Cost spikes ($20–$50 per developer daily)
291
+ 3. Model degradation ("lost in the middle" hallucinations)
292
+
293
+ ### The Solution:
294
+ Instead of dumping raw source code, T-Zero parses your project using Abstract Syntax Trees (AST). It removes function implementation bodies while retaining 100% of the class hierarchies, signatures, types, and docstrings.
295
+
296
+ The result? **Up to 95% token savings** while providing the LLM with pristine architectural context.
297
+
298
+ ### Highlights:
299
+ - ⚡ 1-Click setup for Cursor, Claude, Antigravity & Windsurf
300
+ - 🔒 100% Zero-Leak: Local Shannon entropy scanner stops credential leaks
301
+ - 🤖 AI Godfather Supervisor: Auto-corrects hallucinated method names
302
+ - 💸 100% Free & Open Source under MIT
303
+
304
+ I'd love your feedback, reviews, and feature ideas! Check out the repo and give us a star if you find it valuable:
305
+ {REPO_URL}
306
+ """
307
+ }
308
+
309
+
310
+ def generate_awesome_lists_prs() -> Dict[str, str]:
311
+ """Generates Markdown entries ready to submit as PRs to curated awesome lists."""
312
+ return {
313
+ "awesome-mcp-servers": f"""### Add T-Zero Context Architect
314
+
315
+ - **Name:** [T-Zero Context Architect]({REPO_URL})
316
+ - **Description:** Deterministic AST codebase context compressor & MCP server reducing prompt tokens by 80–95% for Cursor, Claude, and local LLMs. Includes Zero-Leak credential protection and AI hallucination auto-corrector.
317
+ - **Category:** Code Intelligence / Developer Tools
318
+ - **License:** MIT
319
+ """,
320
+ "awesome-cursorrules": f"""### Add T-Zero Context Engine for Cursor
321
+
322
+ - **Name:** [T-Zero for Cursor]({REPO_URL})
323
+ - **Description:** Dynamic AST context optimizer and boundary enforcement MCP server for Cursor Composer. Cuts context token bloat by up to 94.6% on large codebases.
324
+ """
325
+ }
326
+
327
+
328
+ def export_all_marketing_materials(output_dir: Path) -> None:
329
+ """Exports all marketing copy to markdown files organized by platform."""
330
+ output_dir.mkdir(parents=True, exist_ok=True)
331
+
332
+ # 1. Reddit
333
+ reddit_path = output_dir / "REDDIT_POSTS.md"
334
+ reddit_content = ["# 📢 Ready-To-Post Reddit Launch Materials\n"]
335
+ for sub, post in generate_reddit_posts().items():
336
+ reddit_content.append(f"## Subreddit: `{sub}`\n")
337
+ reddit_content.append(f"**Title:**\n> {post['title']}\n")
338
+ reddit_content.append("**Body:**\n```markdown\n" + post["body"] + "\n```\n---\n")
339
+ reddit_path.write_text("\n".join(reddit_content), encoding="utf-8")
340
+
341
+ # 2. Hacker News
342
+ hn_path = output_dir / "HACKER_NEWS_SHOW_HN.md"
343
+ hn_data = generate_show_hn()
344
+ hn_content = f"""# 📢 Hacker News Show HN Launch
345
+
346
+ **Submission Title:**
347
+ > {hn_data['title']}
348
+
349
+ **Target URL:**
350
+ `{hn_data['url']}`
351
+
352
+ **First Comment (by Author):**
353
+ ```markdown
354
+ {hn_data['first_comment']}
355
+ ```
356
+ """
357
+ hn_path.write_text(hn_content, encoding="utf-8")
358
+
359
+ # 3. Twitter / X Thread
360
+ x_path = output_dir / "TWITTER_THREAD.md"
361
+ x_tweets = generate_twitter_thread()
362
+ x_content = ["# 📢 Twitter / X 7-Tweet Viral Thread\n"]
363
+ for i, tweet in enumerate(x_tweets, 1):
364
+ x_content.append(f"### Tweet {i}:\n```text\n{tweet}\n```\n")
365
+ x_path.write_text("\n".join(x_content), encoding="utf-8")
366
+
367
+ # 4. Product Hunt
368
+ ph_path = output_dir / "PRODUCT_HUNT_LAUNCH.md"
369
+ ph_data = generate_product_hunt()
370
+ ph_content = f"""# 📢 Product Hunt Launch Kit
371
+
372
+ **Product Name:** {ph_data['name']}
373
+ **Tagline:** {ph_data['tagline']}
374
+ **Topics:** {ph_data['topics']}
375
+
376
+ **Description:**
377
+ {ph_data['description']}
378
+
379
+ **First Maker Comment:**
380
+ ```markdown
381
+ {ph_data['maker_comment']}
382
+ ```
383
+ """
384
+ ph_path.write_text(ph_content, encoding="utf-8")
385
+
386
+ # 5. Awesome Lists PRs
387
+ awesome_path = output_dir / "AWESOME_LISTS_PRS.md"
388
+ awesome_data = generate_awesome_lists_prs()
389
+ awesome_content = ["# 📢 Curated Awesome-Lists PR Submissions\n"]
390
+ for list_name, snippet in awesome_data.items():
391
+ awesome_content.append(f"## Repository: `{list_name}`\n```markdown\n{snippet}\n```\n")
392
+ awesome_path.write_text("\n".join(awesome_content), encoding="utf-8")
393
+
394
+ print(f"✔ Exported all marketing materials to: {output_dir}")
395
+
396
+
397
+ def main():
398
+ stars = get_live_github_stars()
399
+ print("=" * 70)
400
+ print("⚡ T-ZERO $0.00 BUDGET VIRAL MARKETING & GROWTH AUTOMATION ENGINE")
401
+ print(f"🎯 Milestone Progress: {render_progress_bar(stars, 100)}")
402
+ print(f"📦 Active Release : {VERSION} (PyPI: {PYPI_PKG} | npm: {NPM_PKG})")
403
+ print(f"🌐 Web Benchmark : {WEB_URL}")
404
+ print(f"⭐ Repository : {REPO_URL}")
405
+ print("=" * 70)
406
+
407
+ export_dir = Path.cwd() / "docs" / "marketing_pack"
408
+ export_all_marketing_materials(export_dir)
409
+
410
+ print("\n🚀 All campaign materials are 100% copy-paste ready in 'docs/marketing_pack/'!")
411
+
412
+
413
+ if __name__ == "__main__":
414
+ main()
415
+