tzero-mcp 11.15.3 → 12.2.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.
- 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 +72 -12
package/src/tzero/tzero_promo.py
CHANGED
|
@@ -23,6 +23,10 @@ if sys.platform == "win32":
|
|
|
23
23
|
|
|
24
24
|
import argparse
|
|
25
25
|
import pathlib
|
|
26
|
+
import sys
|
|
27
|
+
import time
|
|
28
|
+
import urllib.parse
|
|
29
|
+
import webbrowser
|
|
26
30
|
from typing import Dict, List, Any, Optional
|
|
27
31
|
|
|
28
32
|
ROOT_DIR = pathlib.Path(__file__).resolve().parent.parent
|
|
@@ -33,7 +37,7 @@ AUTHOR = "Toprak Ahmet Aydoğmuş"
|
|
|
33
37
|
ORGANIZATION = "Siber Akademi"
|
|
34
38
|
PYPI_PKG = "tzero-mcp"
|
|
35
39
|
NPM_PKG = "tzero-mcp"
|
|
36
|
-
CANONICAL_VERSION = "
|
|
40
|
+
CANONICAL_VERSION = "v12.2.0"
|
|
37
41
|
|
|
38
42
|
|
|
39
43
|
def get_current_version() -> str:
|
|
@@ -66,12 +70,12 @@ Instead of stripping files arbitrarily or relying on heuristic summaries, T-Zero
|
|
|
66
70
|
- **Raw Codebase Context:** 10,910,525 tokens ($32.73 per prompt fill on standard cloud models)
|
|
67
71
|
- **T-Zero 4-Tier Hierarchical AST Tree:** 1,309,263 tokens (**-88.0% token reduction**)
|
|
68
72
|
- **Target File Skeleton (Tier-3):** **-94.6% token reduction**
|
|
69
|
-
- **
|
|
70
|
-
- **
|
|
73
|
+
- **Measurement note:** Results vary by repository, language mix, and selected tier; run the included benchmark locally
|
|
74
|
+
- **Release verification:** The tagged release is validated by the GitHub Actions test suite
|
|
71
75
|
|
|
72
|
-
### Security & Privacy
|
|
76
|
+
### Security & Privacy:
|
|
73
77
|
- Computes in-memory Shannon entropy (H >= 4.75) alongside regex guards to identify and redact API keys, private certificates, and credentials before context is emitted.
|
|
74
|
-
-
|
|
78
|
+
- The local stdio MCP path runs without telemetry or third-party cloud calls; remote AI providers are optional.
|
|
75
79
|
|
|
76
80
|
### Installation & Integrations:
|
|
77
81
|
- **Windows (WinGet):** `winget install SiberAkademi.TZero`
|
|
@@ -94,8 +98,8 @@ I'd appreciate technical critique on our AST extraction heuristics, type bridgin
|
|
|
94
98
|
def build_reddit_localllama(version: str) -> Dict[str, str]:
|
|
95
99
|
"""Generates unslop Reddit r/LocalLLaMA post with clear affiliation disclosure."""
|
|
96
100
|
subreddit = "r/LocalLLaMA"
|
|
97
|
-
title = f"T-Zero:
|
|
98
|
-
body = f"""**Affiliation Disclosure:** I am the author of T-Zero, an open-source project maintained at Siber Akademi. The software is 100% free under the MIT license with no paid tier
|
|
101
|
+
title = f"T-Zero: Local-first AST codebase context pruner for local models (Ollama, LM Studio, Qwen 2.5 Coder, DeepSeek) [Disclosure: Project Author]"
|
|
102
|
+
body = f"""**Affiliation Disclosure:** I am the author of T-Zero, an open-source project maintained at Siber Akademi. The software is 100% free under the MIT license with no paid tier; local MCP mode does not require telemetry or external APIs.
|
|
99
103
|
|
|
100
104
|
---
|
|
101
105
|
|
|
@@ -112,12 +116,12 @@ When running local coding models (Qwen 2.5 Coder 7B/14B/32B, DeepSeek-Coder, Lla
|
|
|
112
116
|
4. **Local BM25 Hybrid Search:** Instant symbol search and call-chain tracing without running a separate vector database or local embedding model.
|
|
113
117
|
5. **Shannon Entropy Zero-Leak:** Scans tokens in memory to prevent accidental exposure of local `.env` keys or tokens.
|
|
114
118
|
|
|
115
|
-
###
|
|
119
|
+
### Example Benchmark Metrics:
|
|
116
120
|
- **Tested Project:** 465 files, ~89,000 LOC
|
|
117
121
|
- **Raw token count:** 10,910,525 tokens
|
|
118
122
|
- **T-Zero AST Tree:** 1,309,263 tokens (-88.0% reduction)
|
|
119
123
|
- **Focused Skeleton Mode:** up to -94.6% reduction
|
|
120
|
-
- **
|
|
124
|
+
- **Measurement note:** Timing depends on repository size and selected operation; reproduce it with the included benchmark command
|
|
121
125
|
|
|
122
126
|
### Limitations & Trade-Offs (Being Honest):
|
|
123
127
|
- AST pruning is designed for **architectural understanding, cross-file navigation, type checking, and interface generation**.
|
|
@@ -144,6 +148,58 @@ Looking forward to hearing feedback from the local model community on how this p
|
|
|
144
148
|
return {"subreddit": subreddit, "title": title, "body": body}
|
|
145
149
|
|
|
146
150
|
|
|
151
|
+
def build_reddit_cursor(version: str) -> Dict[str, str]:
|
|
152
|
+
"""Generates unslop Reddit r/Cursor post with clear affiliation disclosure."""
|
|
153
|
+
subreddit = "r/Cursor"
|
|
154
|
+
title = f"T-Zero: Local-first AST context pruning & MCP server for Cursor Composer (-90% prompt tokens) [Disclosure: Author]"
|
|
155
|
+
body = f"""**Affiliation Disclosure:** I am the author of T-Zero, an open-source project maintained at Siber Akademi. The software is 100% free under the MIT license; local stdio MCP runs completely offline on your CPU with zero telemetry or API keys.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Why AST Pruning in Cursor Composer & Chat?
|
|
160
|
+
When working on large multi-file repositories with Cursor Composer or Chat:
|
|
161
|
+
- **Context Window Pollution:** Mentioning `@Codebase` or adding dozens of files dumps hundreds of thousands of tokens of function implementation bodies into the prompt.
|
|
162
|
+
- **Attention Degradation:** Models (Claude 3.7 Sonnet, GPT-4o, o3-mini) suffer from "lost-in-the-middle" attention blur when reading repetitive implementation bodies instead of typed interfaces and architectural contracts.
|
|
163
|
+
- **Fast Token Exhaustion:** Prompting with full file contents quickly consumes 50k-150k context tokens per turn.
|
|
164
|
+
|
|
165
|
+
### How T-Zero Fixes This
|
|
166
|
+
**T-Zero** ({version}) exposes 21 canonical MCP tools to Cursor:
|
|
167
|
+
1. **Dynamic AST Skeletons (`get_smart_skeleton_context`):** Keeps full implementation of your active edit target, but prunes all 1st-degree dependencies to typed interfaces (`...`), classes, and docstrings.
|
|
168
|
+
2. **Context Tree (`get_project_context_tree`):** Hierarchical 4-tier overview of the whole repo (88% to 95% token reduction).
|
|
169
|
+
3. **In-Memory Secret Guard:** Shannon entropy ($H \\ge 4.75$) scans every emitted chunk to stop accidental `.env` leaks.
|
|
170
|
+
4. **Universal Rules Generator (`tzero rules`):** Generates `.cursorrules` and modular `.cursor/rules/*.mdc` tailored to your repo's AST layers.
|
|
171
|
+
|
|
172
|
+
### 1-Click Cursor Setup:
|
|
173
|
+
```bash
|
|
174
|
+
# Via pip:
|
|
175
|
+
pip install {PYPI_PKG}
|
|
176
|
+
|
|
177
|
+
# 1-Click install into ~/.cursor/mcp.json:
|
|
178
|
+
tzero init --cursor
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Or manually in `~/.cursor/mcp.json`:
|
|
182
|
+
```json
|
|
183
|
+
{{
|
|
184
|
+
"mcpServers": {{
|
|
185
|
+
"tzero": {{
|
|
186
|
+
"command": "tzero-mcp",
|
|
187
|
+
"args": ["--stdio"]
|
|
188
|
+
}}
|
|
189
|
+
}}
|
|
190
|
+
}}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- Repository: {REPO_URL}
|
|
194
|
+
- Live Interactive Benchmark: {BENCHMARK_URL}
|
|
195
|
+
- WinGet: `winget install SiberAkademi.TZero`
|
|
196
|
+
- Homebrew: `brew install toprakahmetaydogmus/tap/tzero`
|
|
197
|
+
|
|
198
|
+
Would love to hear thoughts and feedback from the Cursor community!
|
|
199
|
+
"""
|
|
200
|
+
return {"subreddit": subreddit, "title": title, "body": body}
|
|
201
|
+
|
|
202
|
+
|
|
147
203
|
def build_twitter_thread(version: str) -> List[str]:
|
|
148
204
|
"""Generates 7-tweet technical X/Twitter launch thread (each <= 280 chars)."""
|
|
149
205
|
return [
|
|
@@ -156,16 +212,14 @@ def build_twitter_thread(version: str) -> List[str]:
|
|
|
156
212
|
Meet T-Zero {version}: open-source local MCP server cutting context bloat.
|
|
157
213
|
|
|
158
214
|
Technical breakdown 🧵👇""",
|
|
159
|
-
"""2/7 💡
|
|
160
|
-
|
|
161
|
-
When an AI assistant creates a route or fixes a bug, it doesn't need 200 lines of SQL query bodies from your database driver.
|
|
215
|
+
"""2/7 💡 Raw code context wastes attention.
|
|
162
216
|
|
|
163
|
-
|
|
217
|
+
Coding models usually need:
|
|
164
218
|
• Class inheritance
|
|
165
219
|
• Typed signatures
|
|
166
220
|
• Return types & docstrings
|
|
167
221
|
|
|
168
|
-
T-Zero extracts this
|
|
222
|
+
T-Zero extracts this locally; benchmark your repository and mode.""",
|
|
169
223
|
"""3/7 🌐 True Polyglot AST Engine:
|
|
170
224
|
|
|
171
225
|
Deterministic AST extraction across:
|
|
@@ -178,24 +232,22 @@ Deterministic AST extraction across:
|
|
|
178
232
|
🍎 Swift & Ruby
|
|
179
233
|
|
|
180
234
|
Parsed on your local CPU with zero cloud calls.""",
|
|
181
|
-
"""4/7 🔒
|
|
235
|
+
"""4/7 🔒 Local-First Secret Scanning:
|
|
182
236
|
|
|
183
|
-
|
|
237
|
+
T-Zero detects likely API keys and credentials in memory and redacts them before context leaves the local path.
|
|
184
238
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
100% private & offline.""",
|
|
239
|
+
No cloud calls or telemetry are required in local mode.""",
|
|
188
240
|
f"""5/7 🤖 AI Hallucination Guard:
|
|
189
241
|
|
|
190
242
|
T-Zero {version} inspects AI-suggested code diffs against your workspace AST symbol table.
|
|
191
243
|
|
|
192
244
|
If an LLM invents a nonexistent method or phantom import, T-Zero flags the discrepancy before code is committed to disk.""",
|
|
193
|
-
"""6/7 🚀 Turnkey Local CI
|
|
245
|
+
"""6/7 🚀 Turnkey Local CI:
|
|
194
246
|
|
|
195
247
|
Run the entire verification pipeline on your machine:
|
|
196
248
|
$ tzero local-ci --quick
|
|
197
249
|
|
|
198
|
-
Integrates with Git pre-push hooks (`.git/hooks/pre-push`) to
|
|
250
|
+
Integrates with Git pre-push hooks (`.git/hooks/pre-push`) to flag issues before they reach remote CI.""",
|
|
199
251
|
f"""7/7 📦 Free & Open Source (MIT):
|
|
200
252
|
|
|
201
253
|
Install:
|
|
@@ -217,7 +269,7 @@ def build_product_hunt(version: str) -> Dict[str, str]:
|
|
|
217
269
|
description = (
|
|
218
270
|
"T-Zero is an open-source Model Context Protocol (MCP) server for Cursor, Claude Desktop, "
|
|
219
271
|
"Windsurf, and local LLMs. It deterministically prunes codebase bodies to typed AST skeletons, "
|
|
220
|
-
"reducing prompt tokens by 85–95% with
|
|
272
|
+
"reducing prompt tokens by 85–95% in measured examples, with local secret scanning and redaction."
|
|
221
273
|
)
|
|
222
274
|
maker_comment = f"""Hey Product Hunt community! 👋
|
|
223
275
|
|
|
@@ -236,9 +288,9 @@ The result is **up to 95% token savings** while retaining complete architectural
|
|
|
236
288
|
|
|
237
289
|
### Key Capabilities:
|
|
238
290
|
- ⚡ **1-Click MCP Setup:** Integrates seamlessly into Cursor, Claude Desktop, Windsurf, Copilot, and Antigravity.
|
|
239
|
-
- 🔒 **
|
|
291
|
+
- 🔒 **Local-first secret scanning:** In-memory entropy and pattern checks detect and redact likely credentials.
|
|
240
292
|
- 🤖 **AI Hallucination Guard:** Validates AI code imports against your actual workspace symbol tree.
|
|
241
|
-
- ⏱ **
|
|
293
|
+
- ⏱ **Reproducible local measurements:** Run the included benchmark on your own repository; free under MIT license.
|
|
242
294
|
|
|
243
295
|
We'd love your feedback, questions, and ideas on how to make AI context engineering even more efficient!
|
|
244
296
|
|
|
@@ -272,7 +324,7 @@ T-Zero is a high-performance Model Context Protocol (MCP) server that compresses
|
|
|
272
324
|
2. `get_smart_skeleton_context` — Focus-aware dynamic skeletonizer delivering target implementation + surrounding 1st-degree AST interface skeletons.
|
|
273
325
|
3. `prune_code_snippet` — In-memory AST signature compressor for arbitrary code snippets.
|
|
274
326
|
4. `verify_hallucination_guard` — Verifies AI-generated imports and function signatures against the workspace AST symbol table.
|
|
275
|
-
5. `audit_codebase_quality` — Static AST code smell audit and
|
|
327
|
+
5. `audit_codebase_quality` — Static AST code smell audit and local secret scanner for likely hardcoded credentials.
|
|
276
328
|
6. `estimate_token_cost` — Real-time token and financial cost estimation across OpenAI, Anthropic, Gemini, and DeepSeek.
|
|
277
329
|
|
|
278
330
|
#### ⚙ Quick Configuration:
|
|
@@ -306,7 +358,7 @@ T-Zero is a high-performance Model Context Protocol (MCP) server that compresses
|
|
|
306
358
|
winget install SiberAkademi.TZero
|
|
307
359
|
```
|
|
308
360
|
|
|
309
|
-
*
|
|
361
|
+
*Local mode uses no telemetry or cloud tokens.*
|
|
310
362
|
"""
|
|
311
363
|
return {"title": title, "content": content}
|
|
312
364
|
|
|
@@ -320,7 +372,7 @@ This directory contains clean, high-conversion, unslop organic developer launch
|
|
|
320
372
|
All materials strictly adhere to:
|
|
321
373
|
1. **Unslop Quality:** Technical, grounded, engineer-to-engineer tone without hyperbolic claims or excessive emojis.
|
|
322
374
|
2. **Transparent Affiliation:** Every post includes unambiguous disclosure of authorship and organization affiliation.
|
|
323
|
-
3. **
|
|
375
|
+
3. **Local-first privacy:** No private keys, phone numbers, internal network paths, or confidential credentials are included in the launch copy.
|
|
324
376
|
4. **Reproducible Benchmarks:** Exact metrics and CLI commands to verify token reduction claims.
|
|
325
377
|
|
|
326
378
|
---
|
|
@@ -331,6 +383,7 @@ All materials strictly adhere to:
|
|
|
331
383
|
| :--- | :--- | :--- |
|
|
332
384
|
| **Hacker News** | [`show_hn.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/show_hn.md) | Show HN title, URL, and technical first comment |
|
|
333
385
|
| **Reddit r/LocalLLaMA** | [`reddit_localllama.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/reddit_localllama.md) | Local LLM community post with affiliation disclosure & VRAM analysis |
|
|
386
|
+
| **Reddit r/Cursor** | [`reddit_cursor.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/reddit_cursor.md) | Cursor community post with 1-click MCP setup & Composer guide |
|
|
334
387
|
| **Twitter / X** | [`twitter_thread.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/twitter_thread.md) | 7-tweet viral technical breakdown thread |
|
|
335
388
|
| **Product Hunt** | [`product_hunt.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/product_hunt.md) | Listing title, tagline, description, and maker launch comment |
|
|
336
389
|
| **Discord MCP** | [`discord_mcp_showcase.md`](file:///{ROOT_DIR.as_posix()}/docs/launch/discord_mcp_showcase.md) | Server showcase listing with client configuration JSONs |
|
|
@@ -358,7 +411,7 @@ python scripts/generate_promo_pack.py --print discord
|
|
|
358
411
|
|
|
359
412
|
---
|
|
360
413
|
|
|
361
|
-
*Engineered by Siber Akademi —
|
|
414
|
+
*Engineered by Siber Akademi — benchmark claims are intended to be reproducible locally.*
|
|
362
415
|
"""
|
|
363
416
|
|
|
364
417
|
|
|
@@ -380,7 +433,13 @@ def generate_all_launch_files(output_dir: pathlib.Path) -> Dict[str, pathlib.Pat
|
|
|
380
433
|
reddit_path.write_text(f"# {reddit['title']}\n\n{reddit['body']}\n", encoding="utf-8")
|
|
381
434
|
results["reddit_localllama"] = reddit_path
|
|
382
435
|
|
|
383
|
-
# 3.
|
|
436
|
+
# 3. Reddit r/Cursor
|
|
437
|
+
cursor = build_reddit_cursor(version)
|
|
438
|
+
cursor_path = output_dir / "reddit_cursor.md"
|
|
439
|
+
cursor_path.write_text(f"# {cursor['title']}\n\n{cursor['body']}\n", encoding="utf-8")
|
|
440
|
+
results["reddit_cursor"] = cursor_path
|
|
441
|
+
|
|
442
|
+
# 4. Twitter / X Thread
|
|
384
443
|
x_thread = build_twitter_thread(version)
|
|
385
444
|
x_path = output_dir / "twitter_thread.md"
|
|
386
445
|
x_content = [f"# Twitter / X Launch Thread ({version})\n"]
|
|
@@ -389,7 +448,7 @@ def generate_all_launch_files(output_dir: pathlib.Path) -> Dict[str, pathlib.Pat
|
|
|
389
448
|
x_path.write_text("\n".join(x_content), encoding="utf-8")
|
|
390
449
|
results["twitter_thread"] = x_path
|
|
391
450
|
|
|
392
|
-
#
|
|
451
|
+
# 5. Product Hunt
|
|
393
452
|
ph = build_product_hunt(version)
|
|
394
453
|
ph_path = output_dir / "product_hunt.md"
|
|
395
454
|
ph_content = f"""# Product Hunt Launch Kit ({version})
|
|
@@ -409,13 +468,13 @@ def generate_all_launch_files(output_dir: pathlib.Path) -> Dict[str, pathlib.Pat
|
|
|
409
468
|
ph_path.write_text(ph_content, encoding="utf-8")
|
|
410
469
|
results["product_hunt"] = ph_path
|
|
411
470
|
|
|
412
|
-
#
|
|
471
|
+
# 6. Discord MCP Showcase
|
|
413
472
|
discord = build_discord_showcase(version)
|
|
414
473
|
discord_path = output_dir / "discord_mcp_showcase.md"
|
|
415
474
|
discord_path.write_text(f"# {discord['title']}\n\n{discord['content']}\n", encoding="utf-8")
|
|
416
475
|
results["discord_mcp_showcase"] = discord_path
|
|
417
476
|
|
|
418
|
-
#
|
|
477
|
+
# 7. Master README index
|
|
419
478
|
readme_path = output_dir / "README.md"
|
|
420
479
|
readme_path.write_text(build_readme_index(version), encoding="utf-8")
|
|
421
480
|
results["readme"] = readme_path
|
|
@@ -423,6 +482,60 @@ def generate_all_launch_files(output_dir: pathlib.Path) -> Dict[str, pathlib.Pat
|
|
|
423
482
|
return results
|
|
424
483
|
|
|
425
484
|
|
|
485
|
+
def launch_interactive_browser_hub(
|
|
486
|
+
channel: Optional[str] = None,
|
|
487
|
+
open_all: bool = False,
|
|
488
|
+
open_browser: bool = True,
|
|
489
|
+
) -> Dict[str, Any]:
|
|
490
|
+
"""1-Click launch hub that opens pre-filled submission URLs or prints them."""
|
|
491
|
+
version = get_current_version()
|
|
492
|
+
hn = build_show_hn(version)
|
|
493
|
+
reddit = build_reddit_localllama(version)
|
|
494
|
+
cursor = build_reddit_cursor(version)
|
|
495
|
+
x_thread = build_twitter_thread(version)
|
|
496
|
+
|
|
497
|
+
urls = {
|
|
498
|
+
"hn": f"https://news.ycombinator.com/submitlink?u={urllib.parse.quote_plus(REPO_URL)}&t={urllib.parse.quote_plus(hn['title'])}",
|
|
499
|
+
"reddit": f"https://www.reddit.com/r/LocalLLaMA/submit?title={urllib.parse.quote_plus(reddit['title'])}&text={urllib.parse.quote_plus(reddit['body'])}",
|
|
500
|
+
"cursor": f"https://www.reddit.com/r/Cursor/submit?title={urllib.parse.quote_plus(cursor['title'])}&text={urllib.parse.quote_plus(cursor['body'])}",
|
|
501
|
+
"twitter": f"https://twitter.com/intent/tweet?text={urllib.parse.quote_plus(x_thread[0])}",
|
|
502
|
+
"ph": "https://www.producthunt.com/posts/new",
|
|
503
|
+
"github": f"{REPO_URL}/stargazers",
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
opened: List[str] = []
|
|
507
|
+
ch_key = (channel or "").lower().strip()
|
|
508
|
+
|
|
509
|
+
if open_all or ch_key in ("all", "*"):
|
|
510
|
+
targets = ["hn", "reddit", "cursor", "twitter", "ph", "github"]
|
|
511
|
+
elif ch_key in urls:
|
|
512
|
+
targets = [ch_key]
|
|
513
|
+
else:
|
|
514
|
+
# Default: open github star page and major developer communities
|
|
515
|
+
targets = ["github", "hn", "cursor"]
|
|
516
|
+
|
|
517
|
+
print("\n\033[36m================================================================================")
|
|
518
|
+
print(f"🚀 T-ZERO ORGANIC VIRAL LAUNCH HUB ({version})")
|
|
519
|
+
print("================================================================================\033[0m")
|
|
520
|
+
print("Opening pre-filled submission links in your default web browser...\n")
|
|
521
|
+
|
|
522
|
+
for t in targets:
|
|
523
|
+
url = urls.get(t)
|
|
524
|
+
if url:
|
|
525
|
+
print(f" ⚡ [{t.upper():<7}] -> {url[:70]}...")
|
|
526
|
+
if open_browser:
|
|
527
|
+
try:
|
|
528
|
+
webbrowser.open(url)
|
|
529
|
+
opened.append(t)
|
|
530
|
+
time.sleep(0.3)
|
|
531
|
+
except Exception as exc:
|
|
532
|
+
print(f" (Browser launch warning: {exc})")
|
|
533
|
+
|
|
534
|
+
print("\n\033[32m✔ Launched community submission tabs! Star, upvote, and share with developers.\033[0m")
|
|
535
|
+
print(f"⭐ Target GitHub Repository: {REPO_URL}\n")
|
|
536
|
+
return {"version": version, "urls": urls, "opened": opened}
|
|
537
|
+
|
|
538
|
+
|
|
426
539
|
def main(argv: Optional[List[str]] = None) -> int:
|
|
427
540
|
parser = argparse.ArgumentParser(
|
|
428
541
|
description="T-Zero Zero-Cost Organic Promotion & Launch Toolkit",
|
|
@@ -430,31 +543,73 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
430
543
|
)
|
|
431
544
|
parser.add_argument(
|
|
432
545
|
"--output-dir",
|
|
546
|
+
"--out",
|
|
547
|
+
"--output",
|
|
433
548
|
"-o",
|
|
434
549
|
type=pathlib.Path,
|
|
435
550
|
default=ROOT_DIR / "docs" / "launch",
|
|
436
551
|
help="Target directory for generated launch markdown files (default: docs/launch)",
|
|
437
552
|
)
|
|
553
|
+
parser.add_argument(
|
|
554
|
+
"--dir",
|
|
555
|
+
type=pathlib.Path,
|
|
556
|
+
default=ROOT_DIR,
|
|
557
|
+
help="Workspace root directory (default: repo root)",
|
|
558
|
+
)
|
|
438
559
|
parser.add_argument(
|
|
439
560
|
"--print",
|
|
440
561
|
"-p",
|
|
441
562
|
dest="print_channel",
|
|
442
|
-
choices=["hn", "reddit", "twitter", "ph", "discord", "all"],
|
|
563
|
+
choices=["hn", "reddit", "cursor", "twitter", "ph", "discord", "all"],
|
|
443
564
|
help="Print launch copy directly to console stdout",
|
|
444
565
|
)
|
|
566
|
+
parser.add_argument(
|
|
567
|
+
"--channel",
|
|
568
|
+
"-ch",
|
|
569
|
+
choices=["hn", "reddit", "cursor", "twitter", "ph", "discord", "github", "all"],
|
|
570
|
+
help="Target channel for launch or browser opening",
|
|
571
|
+
)
|
|
445
572
|
parser.add_argument(
|
|
446
573
|
"--check",
|
|
447
574
|
"-c",
|
|
448
575
|
action="store_true",
|
|
449
576
|
help="Verify all launch files exist and contain valid non-empty markdown",
|
|
450
577
|
)
|
|
578
|
+
parser.add_argument(
|
|
579
|
+
"--open",
|
|
580
|
+
"--launch",
|
|
581
|
+
"-b",
|
|
582
|
+
"--browser",
|
|
583
|
+
action="store_true",
|
|
584
|
+
dest="open_browser",
|
|
585
|
+
help="Open pre-filled submission tabs in default web browser",
|
|
586
|
+
)
|
|
587
|
+
parser.add_argument(
|
|
588
|
+
"--promo",
|
|
589
|
+
action="store_true",
|
|
590
|
+
help="Generate zero-cost organic launch kit in docs/launch/",
|
|
591
|
+
)
|
|
451
592
|
|
|
452
|
-
args = parser.
|
|
593
|
+
args, _ = parser.parse_known_args(argv)
|
|
453
594
|
version = get_current_version()
|
|
454
595
|
|
|
596
|
+
if args.open_browser:
|
|
597
|
+
ch = args.channel or args.print_channel
|
|
598
|
+
open_all = (ch == "all")
|
|
599
|
+
launch_interactive_browser_hub(channel=ch, open_all=open_all, open_browser=True)
|
|
600
|
+
return 0
|
|
601
|
+
|
|
455
602
|
if args.check:
|
|
456
603
|
out = args.output_dir
|
|
457
|
-
expected = [
|
|
604
|
+
expected = [
|
|
605
|
+
"README.md",
|
|
606
|
+
"show_hn.md",
|
|
607
|
+
"reddit_localllama.md",
|
|
608
|
+
"reddit_cursor.md",
|
|
609
|
+
"twitter_thread.md",
|
|
610
|
+
"product_hunt.md",
|
|
611
|
+
"discord_mcp_showcase.md",
|
|
612
|
+
]
|
|
458
613
|
missing = [f for f in expected if not (out / f).is_file() or (out / f).stat().st_size == 0]
|
|
459
614
|
if missing:
|
|
460
615
|
print(f"[FAIL] Missing or empty launch files in {out}: {', '.join(missing)}")
|
|
@@ -473,6 +628,11 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
473
628
|
print("REDDIT r/LocalLLaMA:")
|
|
474
629
|
print("=" * 60)
|
|
475
630
|
print(build_reddit_localllama(version)["body"])
|
|
631
|
+
if args.print_channel in ("cursor", "all"):
|
|
632
|
+
print("=" * 60)
|
|
633
|
+
print("REDDIT r/Cursor:")
|
|
634
|
+
print("=" * 60)
|
|
635
|
+
print(build_reddit_cursor(version)["body"])
|
|
476
636
|
if args.print_channel in ("twitter", "all"):
|
|
477
637
|
print("=" * 60)
|
|
478
638
|
print("TWITTER THREAD:")
|
|
@@ -496,7 +656,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
496
656
|
print(f" {args.output_dir}")
|
|
497
657
|
for name, path in results.items():
|
|
498
658
|
print(f" - {path.name:<26} ({path.stat().st_size} bytes)")
|
|
499
|
-
print("\n\033[36m⚡
|
|
659
|
+
print("\n\033[36m⚡ Grounded copy and reproducible benchmark notes verified.\033[0m")
|
|
500
660
|
return 0
|
|
501
661
|
|
|
502
662
|
|