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
@@ -24,7 +24,7 @@ from dataclasses import dataclass, field
24
24
  from pathlib import Path
25
25
  from typing import Dict, List, Optional, Tuple, Any
26
26
 
27
- from tzero_fixer.models import (
27
+ from tzero.tzero_fixer.models import (
28
28
  DiagnosticCategory,
29
29
  DiagnosticIssue,
30
30
  HealAction,
@@ -0,0 +1,319 @@
1
+ # -*- coding: utf-8 -*-
2
+ """T-Zero Autonomous Golden Baseline & AST Regression Engine.
3
+
4
+ Captures a cryptographically signed baseline snapshot of all public AST signatures
5
+ across the workspace and verifies against accidental regressions in CI/CD pipelines.
6
+
7
+ Capabilities:
8
+ - Zero-drift public API golden snapshot generation (.tzero/goldens.json).
9
+ - Deterministic signature diffing (removed symbols, altered parameters, return type drift).
10
+ - Pre-merge regression guard: fails CI if public contract breaks without explicit baseline update.
11
+ - 100% Offline, $0 cost, zero cloud dependencies (Python standard library only).
12
+
13
+ Author: Toprak Ahmet Aydoğmuş (Siber Akademi)
14
+ Part of T-Zero Context Architect v11.11.0 Master Edition.
15
+ """
16
+
17
+ import ast
18
+ import hashlib
19
+ import json
20
+ import os
21
+ import sys
22
+ import time
23
+ from dataclasses import dataclass, asdict
24
+ from typing import Dict, List, Optional, Tuple, Any
25
+
26
+ if sys.stdout and hasattr(sys.stdout, "reconfigure"):
27
+ try:
28
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
29
+ except Exception:
30
+ pass
31
+
32
+
33
+ @dataclass
34
+ class SymbolSignature:
35
+ file_path: str
36
+ symbol_name: str
37
+ kind: str # "function", "class", "method"
38
+ signature: str
39
+ return_type: Optional[str] = None
40
+ docstring_hash: str = ""
41
+
42
+
43
+ @dataclass
44
+ class GoldenBaseline:
45
+ workspace_root: str
46
+ version: str
47
+ created_at: float
48
+ symbols: Dict[str, Dict[str, Any]]
49
+ total_symbols: int
50
+ sha256_checksum: str
51
+
52
+
53
+ class ASTGoldenRegressionEngine:
54
+ """Extracts and verifies golden AST signature baselines for zero-drift CI pipelines."""
55
+
56
+ @classmethod
57
+ def extract_file_signatures(cls, file_path: str, code: str) -> List[SymbolSignature]:
58
+ """Extracts all public function, class, and method signatures from Python code."""
59
+ try:
60
+ tree = ast.parse(code)
61
+ except Exception:
62
+ return []
63
+
64
+ signatures: List[SymbolSignature] = []
65
+ rel_p = file_path.replace("\\", "/")
66
+
67
+ for node in tree.body:
68
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
69
+ if node.name.startswith("_") and not node.name.startswith("__"):
70
+ continue
71
+ sig = cls._extract_function_signature(node)
72
+ ret = ast.unparse(node.returns) if getattr(node, "returns", None) else None
73
+ doc = ast.get_docstring(node) or ""
74
+ doc_h = hashlib.sha256(doc.encode("utf-8")).hexdigest()[:12]
75
+ signatures.append(SymbolSignature(
76
+ file_path=rel_p,
77
+ symbol_name=node.name,
78
+ kind="function",
79
+ signature=sig,
80
+ return_type=ret,
81
+ docstring_hash=doc_h
82
+ ))
83
+
84
+ elif isinstance(node, ast.ClassDef):
85
+ if node.name.startswith("_"):
86
+ continue
87
+ bases = ", ".join(ast.unparse(b) for b in node.bases)
88
+ cls_sig = f"class {node.name}({bases})" if bases else f"class {node.name}"
89
+ doc = ast.get_docstring(node) or ""
90
+ doc_h = hashlib.sha256(doc.encode("utf-8")).hexdigest()[:12]
91
+ signatures.append(SymbolSignature(
92
+ file_path=rel_p,
93
+ symbol_name=node.name,
94
+ kind="class",
95
+ signature=cls_sig,
96
+ return_type=None,
97
+ docstring_hash=doc_h
98
+ ))
99
+
100
+ for item in node.body:
101
+ if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)):
102
+ if item.name.startswith("_") and not item.name.startswith("__"):
103
+ continue
104
+ m_sig = cls._extract_function_signature(item)
105
+ m_ret = ast.unparse(item.returns) if getattr(item, "returns", None) else None
106
+ m_doc = ast.get_docstring(item) or ""
107
+ m_doc_h = hashlib.sha256(m_doc.encode("utf-8")).hexdigest()[:12]
108
+ signatures.append(SymbolSignature(
109
+ file_path=rel_p,
110
+ symbol_name=f"{node.name}.{item.name}",
111
+ kind="method",
112
+ signature=m_sig,
113
+ return_type=m_ret,
114
+ docstring_hash=m_doc_h
115
+ ))
116
+
117
+ return signatures
118
+
119
+ @classmethod
120
+ def _extract_function_signature(cls, node: Any) -> str:
121
+ params = []
122
+ args = node.args
123
+
124
+ num_defaults = len(args.defaults)
125
+ num_pos = len(args.args)
126
+ defaults_start = num_pos - num_defaults
127
+
128
+ for i, a in enumerate(args.args):
129
+ p_str = a.arg
130
+ if getattr(a, "annotation", None):
131
+ p_str += f": {ast.unparse(a.annotation)}"
132
+ if i >= defaults_start:
133
+ def_node = args.defaults[i - defaults_start]
134
+ p_str += f" = {ast.unparse(def_node)}"
135
+ params.append(p_str)
136
+
137
+ if args.vararg:
138
+ v_str = f"*{args.vararg.arg}"
139
+ if getattr(args.vararg, "annotation", None):
140
+ v_str += f": {ast.unparse(args.vararg.annotation)}"
141
+ params.append(v_str)
142
+
143
+ for i, a in enumerate(args.kwonlyargs):
144
+ kw_str = a.arg
145
+ if getattr(a, "annotation", None):
146
+ kw_str += f": {ast.unparse(a.annotation)}"
147
+ if i < len(args.kw_defaults) and args.kw_defaults[i] is not None:
148
+ kw_str += f" = {ast.unparse(args.kw_defaults[i])}"
149
+ params.append(kw_str)
150
+
151
+ if args.kwarg:
152
+ kwarg_str = f"**{args.kwarg.arg}"
153
+ if getattr(args.kwarg, "annotation", None):
154
+ kwarg_str += f": {ast.unparse(args.kwarg.annotation)}"
155
+ params.append(kwarg_str)
156
+
157
+ prefix = "async def " if isinstance(node, ast.AsyncFunctionDef) else "def "
158
+ return f"{prefix}{node.name}({', '.join(params)})"
159
+
160
+ @classmethod
161
+ def generate_baseline(cls, workspace_root: str = ".", max_files: int = 300) -> GoldenBaseline:
162
+ """Scans workspace and generates the golden contract baseline."""
163
+ abs_root = os.path.abspath(workspace_root)
164
+ all_sigs: Dict[str, Dict[str, Any]] = {}
165
+ hasher = hashlib.sha256()
166
+
167
+ ignore_dirs = {".git", ".venv", "venv", "__pycache__", "node_modules", "dist", "build", ".pytest_cache"}
168
+
169
+ file_count = 0
170
+ for root, dirs, files in os.walk(abs_root):
171
+ dirs[:] = [d for d in dirs if d not in ignore_dirs and not d.startswith(".")]
172
+ for f in files:
173
+ if f.endswith(".py"):
174
+ full_p = os.path.join(root, f)
175
+ rel_p = os.path.relpath(full_p, abs_root).replace("\\", "/")
176
+ try:
177
+ with open(full_p, "r", encoding="utf-8", errors="replace") as fp:
178
+ code = fp.read()
179
+ sigs = cls.extract_file_signatures(rel_p, code)
180
+ for s in sigs:
181
+ key = f"{s.file_path}:{s.symbol_name}"
182
+ d = asdict(s)
183
+ all_sigs[key] = d
184
+ hasher.update(f"{key}:{s.signature}:{s.return_type}".encode("utf-8"))
185
+ file_count += 1
186
+ if file_count >= max_files:
187
+ break
188
+ except Exception:
189
+ pass
190
+ if file_count >= max_files:
191
+ break
192
+
193
+ return GoldenBaseline(
194
+ workspace_root=abs_root,
195
+ version="11.11.0",
196
+ created_at=time.time(),
197
+ symbols=all_sigs,
198
+ total_symbols=len(all_sigs),
199
+ sha256_checksum=hasher.hexdigest()
200
+ )
201
+
202
+ @classmethod
203
+ def save_baseline(cls, baseline: GoldenBaseline, file_path: Optional[str] = None) -> str:
204
+ out_p = file_path or os.path.join(baseline.workspace_root, ".tzero", "goldens.json")
205
+ os.makedirs(os.path.dirname(out_p), exist_ok=True)
206
+ with open(out_p, "w", encoding="utf-8") as f:
207
+ json.dump(asdict(baseline), f, indent=2)
208
+ return out_p
209
+
210
+ @classmethod
211
+ def verify_against_golden(cls, workspace_root: str = ".", golden_path: Optional[str] = None) -> Dict[str, Any]:
212
+ """Compares current working tree AST signatures against the golden baseline."""
213
+ abs_root = os.path.abspath(workspace_root)
214
+ g_path = golden_path or os.path.join(abs_root, ".tzero", "goldens.json")
215
+
216
+ if not os.path.isfile(g_path):
217
+ return {
218
+ "success": False,
219
+ "error": f"Golden baseline file not found at: {g_path}. Run 'tzero golden' first to establish baseline."
220
+ }
221
+
222
+ try:
223
+ with open(g_path, "r", encoding="utf-8") as f:
224
+ baseline_data = json.load(f)
225
+ baseline_symbols = baseline_data.get("symbols", {})
226
+ except Exception as e:
227
+ return {"success": False, "error": f"Corrupt golden file: {e}"}
228
+
229
+ current_baseline = cls.generate_baseline(abs_root)
230
+ curr_symbols = current_baseline.symbols
231
+
232
+ removed_symbols = []
233
+ modified_signatures = []
234
+ added_symbols = []
235
+
236
+ for key, base_s in baseline_symbols.items():
237
+ if key not in curr_symbols:
238
+ removed_symbols.append({
239
+ "symbol": key,
240
+ "kind": base_s.get("kind"),
241
+ "last_known_signature": base_s.get("signature")
242
+ })
243
+ else:
244
+ curr_s = curr_symbols[key]
245
+ if base_s.get("signature") != curr_s.get("signature") or base_s.get("return_type") != curr_s.get("return_type"):
246
+ modified_signatures.append({
247
+ "symbol": key,
248
+ "old_signature": base_s.get("signature"),
249
+ "new_signature": curr_s.get("signature"),
250
+ "old_return": base_s.get("return_type"),
251
+ "new_return": curr_s.get("return_type")
252
+ })
253
+
254
+ for key, curr_s in curr_symbols.items():
255
+ if key not in baseline_symbols:
256
+ added_symbols.append({
257
+ "symbol": key,
258
+ "kind": curr_s.get("kind"),
259
+ "signature": curr_s.get("signature")
260
+ })
261
+
262
+ clean = len(removed_symbols) == 0 and len(modified_signatures) == 0
263
+
264
+ return {
265
+ "success": clean,
266
+ "total_baseline_symbols": len(baseline_symbols),
267
+ "total_current_symbols": len(curr_symbols),
268
+ "removed_symbols": removed_symbols,
269
+ "modified_signatures": modified_signatures,
270
+ "added_symbols": added_symbols,
271
+ "clean": clean
272
+ }
273
+
274
+ @classmethod
275
+ def format_markdown_report(cls, report: Dict[str, Any]) -> str:
276
+ """Formats the golden regression comparison into a clear Markdown document."""
277
+ if not report.get("success", False) and "error" in report:
278
+ return f"❌ **T-Zero Golden Verification Error:** {report['error']}"
279
+
280
+ clean = report.get("clean", False)
281
+ status_badge = "🟢 ZERO REGRESSIONS (PASS)" if clean else "🔴 CONTRACT DRIFT DETECTED (REGRESSION)"
282
+
283
+ lines = [
284
+ "# 🏆 T-Zero Golden Baseline & AST Regression Report",
285
+ f"**Status:** {status_badge}",
286
+ f"- **Baseline Symbols:** `{report.get('total_baseline_symbols', 0)}`",
287
+ f"- **Current Symbols:** `{report.get('total_current_symbols', 0)}`",
288
+ ""
289
+ ]
290
+
291
+ if report.get("removed_symbols"):
292
+ lines.append("## ❌ Removed Public Symbols (Breaking Regressions)")
293
+ for r in report["removed_symbols"]:
294
+ lines.append(f"- **`{r['symbol']}`** (`{r['kind']}`): Last signature was `{r['last_known_signature']}`")
295
+ lines.append("")
296
+
297
+ if report.get("modified_signatures"):
298
+ lines.append("## ⚠️ Modified Public Signatures")
299
+ for m in report["modified_signatures"]:
300
+ lines.append(f"- **`{m['symbol']}`**:")
301
+ lines.append(f" - 🔴 Previous: `{m['old_signature']}` -> `{m['old_return']}`")
302
+ lines.append(f" - 🟢 Current: `{m['new_signature']}` -> `{m['new_return']}`")
303
+ lines.append("")
304
+
305
+ if report.get("added_symbols"):
306
+ lines.append(f"## ✨ New Public Symbols (`{len(report['added_symbols'])}` added)")
307
+ for a in report["added_symbols"][:10]:
308
+ lines.append(f"- ➕ `{a['symbol']}`: `{a['signature']}`")
309
+ if len(report["added_symbols"]) > 10:
310
+ lines.append(f"- ... and {len(report['added_symbols']) - 10} more additions.")
311
+ lines.append("")
312
+
313
+ if clean:
314
+ lines.append("✅ **All public AST signatures strictly adhere to the established Golden Baseline.**")
315
+ else:
316
+ lines.append("💡 **To update the golden baseline deliberately:** run `tzero golden --update`.")
317
+
318
+ return "\n".join(lines).strip()
319
+
@@ -0,0 +1,338 @@
1
+ <!DOCTYPE html>
2
+ <html lang="tr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>T-ZERO JARVIS KNOWLEDGE & CAUSAL GRAPH</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+ body {
10
+ background: #090d16;
11
+ color: #f8fafc;
12
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
13
+ overflow: hidden;
14
+ height: 100vh;
15
+ width: 100vw;
16
+ }
17
+ #header {
18
+ position: absolute;
19
+ top: 15px;
20
+ left: 20px;
21
+ z-index: 100;
22
+ background: rgba(15, 23, 42, 0.88);
23
+ backdrop-filter: blur(8px);
24
+ padding: 12px 20px;
25
+ border: 1px solid #1e293b;
26
+ border-radius: 8px;
27
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
28
+ pointer-events: auto;
29
+ }
30
+ #header h1 { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; color: #f8fafc; }
31
+ #header p { font-size: 12px; color: #94a3b8; margin-top: 4px; }
32
+ #controls {
33
+ position: absolute;
34
+ top: 15px;
35
+ right: 20px;
36
+ z-index: 100;
37
+ background: rgba(15, 23, 42, 0.88);
38
+ backdrop-filter: blur(8px);
39
+ padding: 10px 15px;
40
+ border: 1px solid #1e293b;
41
+ border-radius: 8px;
42
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
43
+ }
44
+ input[type="text"] {
45
+ background: #0b1120;
46
+ border: 1px solid #334155;
47
+ color: #f8fafc;
48
+ padding: 7px 12px;
49
+ border-radius: 6px;
50
+ font-family: monospace;
51
+ font-size: 12px;
52
+ outline: none;
53
+ transition: border-color 0.15s ease;
54
+ }
55
+ input[type="text"]:focus {
56
+ border-color: #38bdf8;
57
+ }
58
+ #stats-bar {
59
+ position: absolute;
60
+ bottom: 15px;
61
+ left: 20px;
62
+ z-index: 100;
63
+ background: rgba(15, 23, 42, 0.88);
64
+ backdrop-filter: blur(8px);
65
+ padding: 8px 16px;
66
+ border: 1px solid #1e293b;
67
+ font-size: 12px;
68
+ color: #94a3b8;
69
+ border-radius: 6px;
70
+ }
71
+ #inspector {
72
+ position: absolute;
73
+ bottom: 15px;
74
+ right: 20px;
75
+ z-index: 100;
76
+ width: 320px;
77
+ max-height: 250px;
78
+ overflow-y: auto;
79
+ background: rgba(15, 23, 42, 0.95);
80
+ backdrop-filter: blur(10px);
81
+ border: 1px solid #334155;
82
+ padding: 14px;
83
+ font-size: 12px;
84
+ border-radius: 8px;
85
+ display: none;
86
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
87
+ }
88
+ canvas { display: block; width: 100%; height: 100%; }
89
+ </style>
90
+ </head>
91
+ <body>
92
+ <div id="header">
93
+ <h1>⚡ T-ZERO 4D KNOWLEDGE & CAUSAL GRAPH</h1>
94
+ <p>Developer: Toprak Ahmet Aydoğmuş | Zero-Cost Neural Engine</p>
95
+ </div>
96
+
97
+ <div id="controls">
98
+ <input type="text" id="searchInput" placeholder="Düğüm / Kod ara (örn: ESP32, #8421)..." oninput="filterGraph()">
99
+ </div>
100
+
101
+ <div id="stats-bar">
102
+ Düğümler: <span id="nodeCount" style="color:#38bdf8">0</span> |
103
+ Bağlar: <span id="edgeCount" style="color:#818cf8">0</span> |
104
+ FPS: <span id="fpsCount" style="color:#fbbf24">60</span>
105
+ </div>
106
+
107
+ <div id="inspector">
108
+ <h3 id="insTitle" style="color:#38bdf8; margin-bottom:6px;">Detay</h3>
109
+ <p id="insBody" style="color:#cbd5e1; line-height:1.5;"></p>
110
+ </div>
111
+
112
+ <canvas id="graphCanvas"></canvas>
113
+
114
+ <script>
115
+ const graphData = {"nodes": [{"id": "node_8421", "label": "Code #8421: (Toprak)->[test_etti]->(ESP32:HARDWARE + nRF24L01:HARDWARE | SPI:PROTOCOL | laboratuvar)", "group": "HARDWARE", "code": 8421, "timestamp": 1794235166.5280156}, {"id": "node_8422", "label": "Code #8422: (Geliştirici)->[deploy_etti]->(Kubernetes:SOFTWARE + PostgreSQL:SOFTWARE | Docker:SOFTWARE | production)", "group": "SOFTWARE", "code": 8422, "timestamp": 1794235166.5280206}, {"id": "node_8423", "label": "Code #8423: (Analist)->[tespit_etti]->(CVE-2024-1234:VULN + BufferOverflow:VULN | DMZ | Exploit:SOFTWARE)", "group": "VULN", "code": 8423, "timestamp": 1794235166.5280232}, {"id": "node_8424", "label": "Code #8424: (Fizikçi)->[dolaşıklaştırdı]->(Qubit:QUANTUM + BellState:QUANTUM | Kriyostat:QUANTUM | Qiskit:QUANTUM)", "group": "QUANTUM", "code": 8424, "timestamp": 1794235166.5280252}, {"id": "node_8425", "label": "Code #8425: (Genetikçi)->[modifiye_etti]->(CRISPR:BIO + Exon:BIO | AlphaFold:BIO | hücre:BIO)", "group": "BIO", "code": 8425, "timestamp": 1794235166.5280273}, {"id": "node_8426", "label": "Code #8426: (Mühendis)->[kalibre_etti]->(Telemetry:AEROSPACE + Gyroscope:AEROSPACE | yörünge:AEROSPACE | Uydu:AEROSPACE)", "group": "AEROSPACE", "code": 8426, "timestamp": 1794235166.5280292}, {"id": "node_8427", "label": "Code #8427: (Sürücü_Yazılımı)->[denetledi]->(ECU:AUTOMOTIVE + LiDAR:AUTOMOTIVE | CAN:PROTOCOL | otoyol:AUTOMOTIVE)", "group": "AUTOMOTIVE", "code": 8427, "timestamp": 1794235166.5280316}, {"id": "node_8428", "label": "Code #8428: (AlgoTrader)->[arbitraj_yaptı]->(OrderBook:FINANCE + Derivative:FINANCE | Borsa:FINANCE | NASDAQ:FINANCE)", "group": "FINANCE", "code": 8428, "timestamp": 1794235166.5280337}, {"id": "node_8429", "label": "Code #8429: (Kontrolcü)->[harekete_geçirdi]->(Actuator:ROBOTICS + Manipulator:ROBOTICS | ROS:SOFTWARE | fabrika:ROBOTICS)", "group": "ROBOTICS", "code": 8429, "timestamp": 1794235166.5280356}, {"id": "node_8430", "label": "Code #8430: (Kriptograf)->[doğruladı]->(ZK-SNARK:CRYPTO + SHA-256:CRYPTO | TLS:PROTOCOL | Blockchain:CRYPTO)", "group": "CRYPTO", "code": 8430, "timestamp": 1794235166.5280375}, {"id": "node_8431", "label": "Code #8431: (Araştırmacı)->[fine_tune_etti]->(Transformer:SOFTWARE + Weights:SOFTWARE | LoRA:SOFTWARE | GPU_Cluster:HARDWARE)", "group": "SOFTWARE", "code": 8431, "timestamp": 1794235166.5280397}, {"id": "node_8432", "label": "Code #8432: (İnsan)->[araştırdı]->(Bilgi + Hipotez | Evren | Kütüphane)", "group": "GENERIC", "code": 8432, "timestamp": 1794235166.5280423}, {"id": "node_5093", "label": "Code #5093: (Developer)->[islem_yapti]->(implemented + token + reduction)", "group": "GENERIC", "code": 5093, "timestamp": 1794235166.5280442}, {"id": "node_10562", "label": "Code #10562: (Audit)->[islem_yapti]->(project)", "group": "GENERIC", "code": 10562, "timestamp": 1794235166.5280466}, {"id": "node_21144", "label": "Code #21144: (Paragraph)->[islem_yapti]->(1 + about)", "group": "GENERIC", "code": 21144, "timestamp": 1794235166.5280488}, {"id": "node_14518", "label": "Code #14518: (Paragraph)->[islem_yapti]->(2 + about)", "group": "GENERIC", "code": 14518, "timestamp": 1794235166.5280507}, {"id": "node_4168", "label": "Code #4168: (SecuritySentinel)->[test_etti]->(Verify + swarm + orchestration + güvenliğin)", "group": "GENERIC", "code": 4168, "timestamp": 1794235166.528053}, {"id": "node_39813", "label": "Code #39813: (EmbeddedHardwar)->[yapilandirdi]->(Verify + swarm + orchestration + donanım + mimarisin)", "group": "GENERIC", "code": 39813, "timestamp": 1794235166.5280552}, {"id": "node_75051", "label": "Code #75051: (ASTOptimizer)->[islem_yapti]->(Verify + swarm + orchestration + token + mimarisin)", "group": "GENERIC", "code": 75051, "timestamp": 1794235166.5280576}, {"id": "node_28308", "label": "Code #28308: (AutonomousDevOps)->[test_etti]->(Verify + swarm + orchestration + test + build | ortamın)", "group": "GENERIC", "code": 28308, "timestamp": 1794235166.5280604}], "links": [], "stats": {"total_nodes": 20, "total_edges": 0, "timeline_events": 20}};
116
+ const domainColors = {"HARDWARE": "#38bdf8", "PROTOCOL": "#818cf8", "SOFTWARE": "#60a5fa", "VULN": "#f43f5e", "BIO": "#34d399", "CRYPTO": "#fbbf24", "QUANTUM": "#a78bfa", "AEROSPACE": "#fb923c", "AUTOMOTIVE": "#38bdf8", "FINANCE": "#4ade80", "ROBOTICS": "#f87171", "GENERIC": "#94a3b8"};
117
+
118
+ const canvas = document.getElementById('graphCanvas');
119
+ const ctx = canvas.getContext('2d');
120
+ let width = canvas.width = window.innerWidth;
121
+ let height = canvas.height = window.innerHeight;
122
+
123
+ window.addEventListener('resize', () => {
124
+ width = canvas.width = window.innerWidth;
125
+ height = canvas.height = window.innerHeight;
126
+ });
127
+
128
+ document.getElementById('nodeCount').innerText = graphData.nodes.length;
129
+ document.getElementById('edgeCount').innerText = graphData.links.length;
130
+
131
+ // Düğümleri rastgele pozisyonlara yerleştir
132
+ const nodes = graphData.nodes.map((n, i) => {
133
+ const angle = (i / Math.max(1, graphData.nodes.length)) * 2 * Math.PI;
134
+ const radius = 150 + Math.random() * 200;
135
+ return {
136
+ ...n,
137
+ x: width / 2 + Math.cos(angle) * radius,
138
+ y: height / 2 + Math.sin(angle) * radius,
139
+ vx: 0,
140
+ vy: 0,
141
+ radius: n.code ? 18 : 12,
142
+ color: domainColors[n.group] || '#00ffcc'
143
+ };
144
+ });
145
+
146
+ const nodeMap = new Map();
147
+ nodes.forEach(n => nodeMap.set(n.id, n));
148
+
149
+ const links = graphData.links.map(l => ({
150
+ ...l,
151
+ sourceNode: nodeMap.get(l.source),
152
+ targetNode: nodeMap.get(l.target)
153
+ })).filter(l => l.sourceNode && l.targetNode);
154
+
155
+ // Basit Force-Directed Fizik Simülasyonu
156
+ let zoom = 1.0;
157
+ let panX = 0, panY = 0;
158
+ let selectedNode = null;
159
+ let isDragging = false;
160
+ let dragNode = null;
161
+
162
+ function simulate() {
163
+ // İtme kuvveti
164
+ for (let i = 0; i < nodes.length; i++) {
165
+ for (let j = i + 1; j < nodes.length; j++) {
166
+ const dx = nodes[j].x - nodes[i].x;
167
+ const dy = nodes[j].y - nodes[i].y;
168
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
169
+ if (dist < 300) {
170
+ const force = (300 - dist) / (dist * 15);
171
+ nodes[i].vx -= dx * force;
172
+ nodes[i].vy -= dy * force;
173
+ nodes[j].vx += dx * force;
174
+ nodes[j].vy += dy * force;
175
+ }
176
+ }
177
+ }
178
+
179
+ // Bağ çekme kuvveti
180
+ links.forEach(l => {
181
+ const dx = l.targetNode.x - l.sourceNode.x;
182
+ const dy = l.targetNode.y - l.sourceNode.y;
183
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
184
+ const force = (dist - 120) * 0.02;
185
+ l.sourceNode.vx += dx * force;
186
+ l.sourceNode.vy += dy * force;
187
+ l.targetNode.vx -= dx * force;
188
+ l.targetNode.vy -= dy * force;
189
+ });
190
+
191
+ // Merkeze çekim ve sürtünme
192
+ nodes.forEach(n => {
193
+ if (n === dragNode) return;
194
+ n.vx += (width / 2 - n.x) * 0.002;
195
+ n.vy += (height / 2 - n.y) * 0.002;
196
+ n.vx *= 0.85;
197
+ n.vy *= 0.85;
198
+ n.x += n.vx;
199
+ n.y += n.vy;
200
+ });
201
+ }
202
+
203
+ let lastFrameTime = performance.now();
204
+ let frameCount = 0;
205
+
206
+ function render() {
207
+ simulate();
208
+
209
+ ctx.clearRect(0, 0, width, height);
210
+ ctx.save();
211
+ ctx.translate(panX, panY);
212
+ ctx.scale(zoom, zoom);
213
+
214
+ // Bağları çiz
215
+ links.forEach(l => {
216
+ ctx.beginPath();
217
+ ctx.moveTo(l.sourceNode.x, l.sourceNode.y);
218
+ ctx.lineTo(l.targetNode.x, l.targetNode.y);
219
+ ctx.strokeStyle = l.relation === 'causes' ? 'rgba(255, 0, 85, 0.6)' : 'rgba(0, 229, 255, 0.4)';
220
+ ctx.lineWidth = l.relation === 'causes' ? 2 : 1;
221
+ ctx.stroke();
222
+
223
+ // İlişki etiketi
224
+ const midX = (l.sourceNode.x + l.targetNode.x) / 2;
225
+ const midY = (l.sourceNode.y + l.targetNode.y) / 2;
226
+ ctx.font = '9px monospace';
227
+ ctx.fillStyle = '#80d8ff';
228
+ ctx.fillText(l.relation, midX, midY);
229
+ });
230
+
231
+ // Düğümleri çiz
232
+ nodes.forEach(n => {
233
+ ctx.save();
234
+ ctx.shadowColor = n.color;
235
+ ctx.shadowBlur = 12;
236
+
237
+ ctx.beginPath();
238
+ ctx.arc(n.x, n.y, n.radius, 0, 2 * Math.PI);
239
+ ctx.fillStyle = n.color;
240
+ ctx.fill();
241
+
242
+ ctx.restore();
243
+
244
+ // Düğüm halkası
245
+ ctx.beginPath();
246
+ ctx.arc(n.x, n.y, n.radius + 3, 0, 2 * Math.PI);
247
+ ctx.strokeStyle = '#ffffff';
248
+ ctx.lineWidth = 1;
249
+ ctx.stroke();
250
+
251
+ // Metin etiketi
252
+ ctx.font = '10px Consolas, monospace';
253
+ ctx.fillStyle = '#ffffff';
254
+ ctx.textAlign = 'center';
255
+ const labelText = n.code ? `[#${n.code}] ${n.label}` : n.label;
256
+ ctx.fillText(labelText, n.x, n.y + n.radius + 14);
257
+ });
258
+
259
+ ctx.restore();
260
+
261
+ // FPS sayacı
262
+ frameCount++;
263
+ const now = performance.now();
264
+ if (now - lastFrameTime >= 1000) {
265
+ document.getElementById('fpsCount').innerText = frameCount;
266
+ frameCount = 0;
267
+ lastFrameTime = now;
268
+ }
269
+
270
+ requestAnimationFrame(render);
271
+ }
272
+
273
+ // Mouse Etkileşimi
274
+ canvas.addEventListener('mousedown', e => {
275
+ const mx = (e.clientX - panX) / zoom;
276
+ const my = (e.clientY - panY) / zoom;
277
+ for (let n of nodes) {
278
+ const dx = n.x - mx;
279
+ const dy = n.y - my;
280
+ if (Math.sqrt(dx * dx + dy * dy) < n.radius + 5) {
281
+ dragNode = n;
282
+ selectedNode = n;
283
+ showInspector(n);
284
+ return;
285
+ }
286
+ }
287
+ isDragging = true;
288
+ dragStartX = e.clientX - panX;
289
+ dragStartY = e.clientY - panY;
290
+ });
291
+
292
+ canvas.addEventListener('mousemove', e => {
293
+ if (dragNode) {
294
+ dragNode.x = (e.clientX - panX) / zoom;
295
+ dragNode.y = (e.clientY - panY) / zoom;
296
+ } else if (isDragging) {
297
+ panX = e.clientX - dragStartX;
298
+ panY = e.clientY - dragStartY;
299
+ }
300
+ });
301
+
302
+ canvas.addEventListener('mouseup', () => {
303
+ dragNode = null;
304
+ isDragging = false;
305
+ });
306
+
307
+ canvas.addEventListener('wheel', e => {
308
+ e.preventDefault();
309
+ const factor = e.deltaY < 0 ? 1.1 : 0.9;
310
+ zoom *= factor;
311
+ zoom = Math.min(Math.max(0.2, zoom), 4.0);
312
+ });
313
+
314
+ function showInspector(node) {
315
+ const ins = document.getElementById('inspector');
316
+ ins.style.display = 'block';
317
+ document.getElementById('insTitle').innerText = `${node.group}: ${node.label}`;
318
+ document.getElementById('insBody').innerHTML = `
319
+ <b>ID:</b> ${node.id}<br>
320
+ <b>Latent Code:</b> ${node.code ? '#' + node.code : 'None'}<br>
321
+ <b>Domain:</b> ${node.group}<br>
322
+ <b>Timestamp:</b> ${new Date(node.timestamp * 1000).toLocaleTimeString()}
323
+ `;
324
+ }
325
+
326
+ function filterGraph() {
327
+ const query = document.getElementById('searchInput').value.toLowerCase();
328
+ nodes.forEach(n => {
329
+ const match = n.label.toLowerCase().includes(query) || (n.code && n.code.toString().includes(query));
330
+ n.color = match ? (domainColors[n.group] || '#00ffcc') : '#334155';
331
+ n.radius = match ? (n.code ? 20 : 14) : 8;
332
+ });
333
+ }
334
+
335
+ requestAnimationFrame(render);
336
+ </script>
337
+ </body>
338
+ </html>