@teevee98/synapse-hub 4.1.3 → 4.1.4

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 (121) hide show
  1. package/.agents/skills/01-web-automation/clean-pom-crafter/examples/standard_test_case.groovy +3 -0
  2. package/.agents/skills/01-web-automation/clean-pom-crafter/references/pom_patterns.groovy +3 -0
  3. package/.agents/skills/01-web-automation/e2e-testing-patterns/examples/playwright_sharded_config.ts +3 -0
  4. package/.agents/skills/01-web-automation/playwright-webapp-testing/examples/server_lifecycle_playwright.py +3 -0
  5. package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +3 -0
  6. package/.agents/skills/05-security-and-compliance/security-dast-sentinel/references/dast_recipes.ts +3 -0
  7. package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +3 -0
  8. package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +3 -0
  9. package/.agents/skills/11-ai-and-prompting/qa-aci-interface/examples/surgical_code_window_walkthrough.md +1 -1
  10. package/README.en.md +2 -2
  11. package/README.md +2 -2
  12. package/agentskills.json +1 -1
  13. package/docs/ARCHITECTURE.en.md +1 -1
  14. package/docs/ARCHITECTURE.md +1 -1
  15. package/docs/PERFORMANCE_AUDIT_REPORT.md +2 -2
  16. package/package.json +1 -1
  17. package/plugin.json +1 -1
  18. package/scripts/generate_skill_examples.py +3 -0
  19. package/scripts/package_dist.py +3 -0
  20. package/skills_manifest.json +1 -1
  21. package/synapse.config.json +1 -1
  22. package/tools/.infer_baseline.json +3 -796
  23. package/tools/__init__.py +4 -1
  24. package/tools/agent_canary.py +3 -0
  25. package/tools/analyze_project.py +3 -0
  26. package/tools/api_drift_sentinel.py +3 -0
  27. package/tools/api_fuzzer.py +3 -0
  28. package/tools/ast_cache.py +4 -2
  29. package/tools/author_integrity.py +53 -1
  30. package/tools/auto_heal.py +7 -2
  31. package/tools/autogen_qa_broker.py +14 -15
  32. package/tools/browser_helpers.js +2 -2
  33. package/tools/bug_reporter.py +3 -0
  34. package/tools/build_consolidated_report.py +3 -0
  35. package/tools/bump_version.py +4 -1
  36. package/tools/cache_resolver.py +7 -3
  37. package/tools/check_env.py +3 -0
  38. package/tools/check_version_sync.py +3 -0
  39. package/tools/ci_healing_hook.py +3 -0
  40. package/tools/cli.py +10 -7
  41. package/tools/config_decoupler.py +3 -0
  42. package/tools/core/__init__.py +3 -0
  43. package/tools/core/file_lock.py +23 -14
  44. package/tools/core/i18n.py +9 -7
  45. package/tools/core/memory_bus.py +6 -3
  46. package/tools/core/process_supervisor.py +28 -18
  47. package/tools/core/token_estimator.py +55 -18
  48. package/tools/count_tokens.py +11 -7
  49. package/tools/create_mock_docx.py +3 -0
  50. package/tools/dashboard_generator.py +17 -15
  51. package/tools/db_sandbox.py +4 -1
  52. package/tools/debt_harvester.py +2 -2
  53. package/tools/diagram_architect.py +3 -0
  54. package/tools/distill_log.py +22 -2
  55. package/tools/e2e_flow_prober.py +3 -0
  56. package/tools/export_postman_collection.py +3 -0
  57. package/tools/flaky_detector.py +3 -0
  58. package/tools/fsm_enforcer.py +2 -2
  59. package/tools/fuzz_payloads.py +3 -0
  60. package/tools/generate_allure_report.py +3 -0
  61. package/tools/generate_api_matrix.py +3 -0
  62. package/tools/generate_jmx_plan.py +3 -0
  63. package/tools/generate_tc_from_story.py +3 -0
  64. package/tools/generate_test_reports.py +3 -0
  65. package/tools/git_pre_commit_guard.py +13 -3
  66. package/tools/git_worktree_manager.py +3 -0
  67. package/tools/heal/__init__.py +3 -0
  68. package/tools/heal_pr_automator.py +3 -0
  69. package/tools/heuristic_locator_matcher.py +3 -0
  70. package/tools/hub_publisher.py +3 -3
  71. package/tools/infer_linter.py +19 -9
  72. package/tools/init_config.py +6 -9
  73. package/tools/jtl_analyzer.py +3 -0
  74. package/tools/lint/__init__.py +3 -0
  75. package/tools/lint_ai_docs.py +3 -0
  76. package/tools/lookup_tc.py +3 -0
  77. package/tools/lookup_xpath.py +3 -0
  78. package/tools/matrix_sharder.py +3 -0
  79. package/tools/mcp/__init__.py +3 -0
  80. package/tools/mcp_docx_server.py +1 -1
  81. package/tools/mcp_excel_server.py +4 -1
  82. package/tools/mcp_server.py +4 -1
  83. package/tools/md_to_xlsx.py +3 -0
  84. package/tools/mechanical_ui_gate.py +3 -0
  85. package/tools/micro_mutator.py +9 -5
  86. package/tools/network_mock_shield.py +3 -0
  87. package/tools/newman_analyzer.py +3 -0
  88. package/tools/omni_emitter.py +3 -0
  89. package/tools/omni_parser.py +3 -0
  90. package/tools/omni_transpiler.py +3 -0
  91. package/tools/output_formatter.py +3 -0
  92. package/tools/package_release.py +6 -6
  93. package/tools/pairwise_generator.py +3 -0
  94. package/tools/pentest_scope_guard.py +2 -2
  95. package/tools/perf/__init__.py +3 -0
  96. package/tools/pinpoint_failure.py +3 -0
  97. package/tools/project_state.py +3 -0
  98. package/tools/repo_map.py +3 -0
  99. package/tools/report/__init__.py +3 -0
  100. package/tools/rules_router.py +42 -10
  101. package/tools/runaway_stopper.py +3 -0
  102. package/tools/safety_firewall.py +3 -0
  103. package/tools/setup_project.py +9 -4
  104. package/tools/skill_collision_guard.py +2 -2
  105. package/tools/skillspector.py +2 -1
  106. package/tools/smart_visual_masker.py +3 -0
  107. package/tools/telemetry_correlator.py +3 -0
  108. package/tools/template_excel_exporter.py +2 -2
  109. package/tools/test_impact.py +3 -0
  110. package/tools/trace_data_flow.py +3 -0
  111. package/tools/traffic_session_converter.py +3 -0
  112. package/tools/ui_server.py +2 -2
  113. package/tools/universal_ir.py +3 -0
  114. package/tools/update_sentinel.py +15 -9
  115. package/tools/validate_groovy_scripts.py +3 -0
  116. package/tools/verify_all.py +27 -20
  117. package/tools/visual_diff_canvas.py +3 -0
  118. package/tools/visual_som_helper.py +3 -0
  119. package/tools/watch_mode.py +4 -4
  120. package/tools/wcag_audit.py +3 -0
  121. package/tools/welcome_page.py +1 -1
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Self-Healing Confidence Scorer & PR Automator
4
7
  ---------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  3-Layer Heuristic Locator Matcher (0-Token Autonomous Recovery)
4
7
  --------------------------------------------------------------
@@ -409,7 +409,7 @@ def check_npm_registry_live_version(package_name: Optional[str] = None) -> Optio
409
409
  data = json.loads(resp.read().decode("utf-8"))
410
410
  return data.get("version")
411
411
  except Exception as exc:
412
- _ = f"npm HTTP probe skipped: {exc}"
412
+ log_warn(f"npm HTTP probe skipped: {exc}")
413
413
  return None
414
414
 
415
415
 
@@ -465,10 +465,10 @@ def step_4_and_5_monitor_packages_and_npm(owner: str, repo: str, version: str, t
465
465
  log_warn(f"GitHub Actions publish_npm.yml completed with conclusion: {conclusion}")
466
466
  break
467
467
  except Exception as exc:
468
- _ = f"GitHub Actions poll skipped: {exc}"
468
+ log_warn(f"GitHub Actions poll skipped: {exc}")
469
469
 
470
470
  print(f" Waiting for NPM registry replication... ({int(time.time() - start_time)}s/{wait_timeout}s)")
471
- time.sleep(poll_interval)
471
+ time.sleep(poll_interval) # synapse-ignore: HARD_DELAY_ANTI_PATTERN
472
472
 
473
473
  if not npm_verified:
474
474
  # Final fallback check
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Universal QA Static Defect & Assertion Sentinel (Inspired by facebook/infer)
4
7
  -------------------------------------------------------------------
@@ -19,6 +22,7 @@ import glob
19
22
  import ast
20
23
  import html as html_lib
21
24
  import argparse
25
+ import logging
22
26
  from datetime import datetime
23
27
 
24
28
  # Enforce UTF-8 stdout encoding for Windows console compatibility
@@ -222,8 +226,8 @@ def load_config(repo_root=None, config_path=None):
222
226
  try:
223
227
  with open(config_path, "r", encoding="utf-8") as f:
224
228
  return json.load(f)
225
- except (OSError, json.JSONDecodeError):
226
- _ = False
229
+ except (OSError, json.JSONDecodeError) as err:
230
+ logging.getLogger("infer_linter").debug("Failed to read config from %s: %s", config_path, err)
227
231
 
228
232
  root = repo_root or REPO_ROOT
229
233
  candidates = [
@@ -255,9 +259,11 @@ def load_baseline(baseline_path):
255
259
  f_path = it.get("file", "").replace("\\", "/")
256
260
  d_type = it.get("type", "").upper()
257
261
  d_line = it.get("line")
258
- signatures.add((f_path, d_type))
259
262
  if d_line is not None:
260
- signatures.add((f_path, d_type, d_line))
263
+ try:
264
+ signatures.add((f_path, d_type, int(d_line)))
265
+ except (ValueError, TypeError):
266
+ signatures.add((f_path, d_type, d_line))
261
267
  return signatures
262
268
  except (OSError, json.JSONDecodeError):
263
269
  return set()
@@ -611,8 +617,8 @@ def analyze_script(file_path, baseline_set=None, disabled_rules=None):
611
617
  "line": line_no,
612
618
  "message": f"Test data creation detected without paired teardown cleanup ('{raw_line}'). Risk of DB state pollution per AGENTS.md Rule 1.3."
613
619
  })
614
- except SyntaxError:
615
- _ = False # synapse-ignore
620
+ except SyntaxError as err:
621
+ logging.getLogger("infer_linter").debug("AST parse skipped due to syntax error: %s", err)
616
622
 
617
623
  # Rule 5 (L4): Unawaited Playwright Assertions in JS/TS
618
624
  if file_path.endswith((".ts", ".tsx", ".js", ".jsx")):
@@ -727,7 +733,8 @@ def analyze_script(file_path, baseline_set=None, disabled_rules=None):
727
733
 
728
734
  # Check baseline suppression
729
735
  if baseline_set:
730
- if (norm_rel, d_type) in baseline_set or (norm_rel, d_type, line_idx) in baseline_set:
736
+ norm_abs = os.path.abspath(file_path).replace("\\", "/")
737
+ if (norm_rel, d_type, line_idx) in baseline_set or (norm_abs, d_type, line_idx) in baseline_set:
731
738
  continue
732
739
 
733
740
  active_defects.append(d)
@@ -940,8 +947,11 @@ def run_infer_linter(target_dir=None, output_path=None, strict: bool = False,
940
947
  print(f"Detailed audit saved to: {dest_json}\n")
941
948
 
942
949
  if strict:
943
- fake_pass_count = sum(1 for r in results for d in r["defects"] if d["type"] in ("FAKE_PASS_NO_ASSERTION", "NO_ASSERTION_IN_TEST", "DANGLING_ASSERTION_NO_MATCHER"))
944
- return 0 if (critical_count == 0 and fake_pass_count == 0) else 1
950
+ anti_pattern_count = sum(1 for r in results for d in r["defects"] if d["type"] in (
951
+ "FAKE_PASS_NO_ASSERTION", "NO_ASSERTION_IN_TEST", "DANGLING_ASSERTION_NO_MATCHER",
952
+ "HARD_DELAY_ANTI_PATTERN", "EXCESSIVE_HARD_DELAY"
953
+ ))
954
+ return 0 if (critical_count == 0 and anti_pattern_count == 0) else 1
945
955
  return 0 if critical_count == 0 else 1
946
956
 
947
957
 
@@ -50,9 +50,8 @@ def is_hub_directory(target_path: Path) -> bool:
50
50
  return True
51
51
  if (resolved / "skills_manifest.json").is_file() and (resolved / "AGENTS.md").is_file():
52
52
  return True
53
- except (OSError, ValueError) as _err:
54
- _ = _err
55
- return False
53
+ except (OSError, ValueError):
54
+ return False
56
55
 
57
56
 
58
57
  def get_hub_version() -> str:
@@ -62,9 +61,8 @@ def get_hub_version() -> str:
62
61
  if pkg_file.is_file():
63
62
  with open(pkg_file, "r", encoding="utf-8") as f:
64
63
  return json.load(f).get("version", "3.2.1")
65
- except (OSError, json.JSONDecodeError) as _err:
66
- _ = _err
67
- return "3.2.1"
64
+ except (OSError, json.JSONDecodeError):
65
+ return "3.2.1"
68
66
 
69
67
 
70
68
  def detect_git_user_name() -> Optional[str]:
@@ -78,9 +76,8 @@ def detect_git_user_name() -> Optional[str]:
78
76
  )
79
77
  if res.returncode == 0 and res.stdout.strip():
80
78
  return res.stdout.strip()
81
- except (subprocess.SubprocessError, OSError) as _err:
82
- _ = _err
83
- return None
79
+ except (subprocess.SubprocessError, OSError):
80
+ return None
84
81
 
85
82
 
86
83
  def build_default_config(
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  # -*- coding: utf-8 -*-
3
6
  """
4
7
  tools/jtl_analyzer.py — Enterprise Apache JMeter JTL Results Analyzer & CI/CD Gatekeeper
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  """
2
5
  Synapse Hub — Static Quality & Policy Sentinels (tools.lint)
3
6
  -----------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise AI Documentation & Artifact Linter (Anti-Drift Guard v2.0)
4
7
  ---------------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise QA: Fast Test Case Metadata Lookup (lookup_tc.py)
4
7
  -------------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise QA: Fast XPath / Selector Lookup (lookup_xpath.py)
4
7
  -------------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Duration-Balanced Test Matrix Sharder
4
7
  ------------------------------------------------
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  """
2
5
  Synapse Hub — Model Context Protocol (MCP) Servers (tools.mcp)
3
6
  --------------------------------------------------------------
@@ -60,7 +60,7 @@ if hasattr(sys.stdout, 'reconfigure'):
60
60
  except Exception:
61
61
  pass
62
62
 
63
- SERVER_VERSION = "4.1.3"
63
+ SERVER_VERSION = "4.1.4"
64
64
  MAX_DOCX_SIZE = 50 * 1024 * 1024 # 50 MB
65
65
  MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
66
66
  MAX_RATIO = 100 # 100:1 compression ratio limit
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Cross-Platform MCP Excel Server (Zero-Dependency)
4
7
  -----------------------------------------------------------
@@ -52,7 +55,7 @@ if hasattr(sys.stdout, 'reconfigure'):
52
55
  except Exception:
53
56
  pass
54
57
 
55
- SERVER_VERSION = "4.1.3"
58
+ SERVER_VERSION = "4.1.4"
56
59
  MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
57
60
  MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
58
61
  MAX_RATIO = 100 # 100:1 compression ratio limit
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Model Context Protocol (MCP) Standard Server
4
7
  -------------------------------------------------------
@@ -46,7 +49,7 @@ import gherkin_suite
46
49
  import api_fuzzer
47
50
 
48
51
  SERVER_NAME = "enterprise-agent-qa"
49
- SERVER_VERSION = "4.1.3"
52
+ SERVER_VERSION = "4.1.4"
50
53
 
51
54
  MCP_TOOLS = [
52
55
  {
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Markdown to Excel (.xlsx) Enterprise Converter
4
7
  ------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  # -*- coding: utf-8 -*-
3
6
  """
4
7
  tools/mechanical_ui_gate.py — Headless Chrome Mechanical Layout & Contrast Gate
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Assertion Sensitivity & Syntactic Micro-Mutation Sentinel (Heuristic)
4
7
  ---------------------------------------------------------------------
@@ -35,13 +38,13 @@ for stream in (sys.stdout, sys.stderr):
35
38
  if hasattr(stream, 'fileno'):
36
39
  try:
37
40
  os.set_blocking(stream.fileno(), True)
38
- except Exception as exc:
39
- _ = exc
41
+ except Exception:
42
+ pass
40
43
  if hasattr(stream, 'reconfigure'):
41
44
  try:
42
45
  stream.reconfigure(encoding='utf-8')
43
- except Exception as exc:
44
- _ = exc
46
+ except Exception:
47
+ pass
45
48
 
46
49
  SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
47
50
  HUB_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
@@ -868,7 +871,8 @@ def main():
868
871
  with open(mutation_run_file, "w", encoding="utf-8") as mrf:
869
872
  json.dump(report, mrf, indent=2)
870
873
  except Exception as err:
871
- _ = err
874
+ import logging
875
+ logging.getLogger("micro_mutator").debug("Failed to write mutation run report: %s", err)
872
876
 
873
877
  output_format = "json" if args.json else args.format
874
878
 
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  API Network Mocking & Chaos Fault Injection Shield
4
7
  --------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  # -*- coding: utf-8 -*-
3
6
  """
4
7
  tools/newman_analyzer.py — Enterprise Newman Test Results Analyzer & CI/CD Quality Gate
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Omni-Emitter: Universal Polyglot Code Generator & Transpiler
4
7
  ------------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Omni-Parser: Universal Polyglot AST & Structure Parser
4
7
  ------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Omni-Transpiler & Repository Scanner
4
7
  -----------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Standardized Output Formatter & Exit Code Specification
4
7
  ------------------------------------------------------------------
@@ -239,21 +239,21 @@ def package_synapse_hub(
239
239
  if re.match(r"^synapse-hub-v\d+\.\d+\.\d+.*", f, re.IGNORECASE) and f.endswith((".zip", ".tar.gz", ".sha256")):
240
240
  try:
241
241
  os.remove(os.path.join(out_dir, f))
242
- except OSError as err:
243
- _ = err
242
+ except OSError:
243
+ continue
244
244
  elif not is_same_as_root and f.endswith((".zip", ".tar.gz", ".sha256")) and f.lower().startswith("synapse-hub"):
245
245
  try:
246
246
  os.remove(os.path.join(out_dir, f))
247
- except OSError as err:
248
- _ = err
247
+ except OSError:
248
+ continue
249
249
 
250
250
  if not is_same_as_root:
251
251
  for f in os.listdir(repo_root):
252
252
  if re.match(r"^synapse-hub-v\d+\.\d+\.\d+.*", f, re.IGNORECASE) and f.endswith((".zip", ".tar.gz", ".sha256")):
253
253
  try:
254
254
  os.remove(os.path.join(repo_root, f))
255
- except OSError as err:
256
- _ = err
255
+ except OSError:
256
+ continue
257
257
 
258
258
  files = collect_package_files(repo_root)
259
259
  base_name = f"synapse-hub-v{version}"
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  # -*- coding: utf-8 -*-
3
6
  """
4
7
  tools/pairwise_generator.py — Pairwise (2-Way) Combinatorial Test Case Generator
@@ -38,8 +38,8 @@ if hasattr(sys.stdout, "reconfigure"):
38
38
  try:
39
39
  sys.stdout.reconfigure(encoding="utf-8")
40
40
  sys.stderr.reconfigure(encoding="utf-8")
41
- except Exception as exc:
42
- _ = exc
41
+ except Exception:
42
+ pass
43
43
 
44
44
  REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
45
45
  DEFAULT_AUDIT_LOG = os.path.join(REPO_ROOT, ".synapse", "pentest_audit.log")
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  """
2
5
  Synapse Hub — Performance, Stress & Flakiness Profilers (tools.perf)
3
6
  ---------------------------------------------------------------------
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Fast Zero-Token Failure Pinpointer for Katalon & Jenkins Reports.
4
7
  Scans the latest Reports/**/JUnit_Report.xml, extracts failed Test Cases,
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Project State Machine & Token-Capped Memory Anchor
4
7
  --------------------------------------------------------------
package/tools/repo_map.py CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Repository Map Compressor (Inspired by Aider-AI/aider)
4
7
  -----------------------------------------------------------
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  """
2
5
  Synapse Hub — Reporting & Telemetry Engines (tools.report)
3
6
  ----------------------------------------------------------
@@ -21,9 +21,12 @@ from __future__ import annotations
21
21
 
22
22
  import argparse
23
23
  import json
24
+ import logging
24
25
  import os
25
26
  import sys
26
- from typing import Any, Dict, List, Set, Tuple
27
+
28
+ logger = logging.getLogger("rules_router")
29
+ from typing import Any, Dict, List, Optional, Set, Tuple
27
30
 
28
31
  if hasattr(sys.stdout, "reconfigure"):
29
32
  try:
@@ -225,7 +228,7 @@ def _scan_directory_markers(target_dir: str, prefix: str = "") -> Tuple[Dict[str
225
228
  detected["performance"].append(f"{prefix}package.json (perf)")
226
229
  confidence["performance"] = max(confidence["performance"], 0.90)
227
230
  except Exception as err:
228
- _ = err
231
+ logger.debug("Failed to inspect package.json: %s", err)
229
232
 
230
233
  # 2. Inspect Python requirements / pyproject / Pipfile
231
234
  for py_cfg_name in ("requirements.txt", "requirements-dev.txt", "pyproject.toml", "Pipfile", "setup.py"):
@@ -253,7 +256,8 @@ def _scan_directory_markers(target_dir: str, prefix: str = "") -> Tuple[Dict[str
253
256
  detected["security"].append(f"{prefix}{py_cfg_name} (security)")
254
257
  confidence["security"] = max(confidence["security"], 0.80)
255
258
  except Exception as err:
256
- _ = err
259
+ logger.debug("Failed to inspect configuration: %s", err)
260
+ continue
257
261
 
258
262
  # 3. Inspect JVM build markers (build.gradle, pom.xml)
259
263
  for jvm_cfg_name in ("build.gradle", "build.gradle.kts", "pom.xml"):
@@ -278,7 +282,8 @@ def _scan_directory_markers(target_dir: str, prefix: str = "") -> Tuple[Dict[str
278
282
  detected["performance"].append(f"{prefix}{jvm_cfg_name} (perf)")
279
283
  confidence["performance"] = max(confidence["performance"], 0.85)
280
284
  except Exception as err:
281
- _ = err
285
+ logger.debug("Failed to inspect configuration: %s", err)
286
+ continue
282
287
 
283
288
  # 4. Walk directory structure up to depth 2
284
289
  ignored = {".git", "node_modules", ".venv", "venv", "__pycache__", "dist", "build", "target", ".gradle"}
@@ -320,7 +325,8 @@ def _scan_directory_markers(target_dir: str, prefix: str = "") -> Tuple[Dict[str
320
325
  detected["selenium"].append(full_evidence_path)
321
326
  confidence["selenium"] = max(confidence["selenium"], 0.80)
322
327
  except Exception as err:
323
- _ = err
328
+ logger.debug("Failed to inspect file: %s", err)
329
+ continue
324
330
  else:
325
331
  detected["selenium"].append(full_evidence_path)
326
332
  confidence["selenium"] = max(confidence["selenium"], 0.95)
@@ -357,7 +363,8 @@ def _scan_directory_markers(target_dir: str, prefix: str = "") -> Tuple[Dict[str
357
363
  detected["selenium"].append(full_evidence_path)
358
364
  confidence["selenium"] = max(confidence["selenium"], 0.80)
359
365
  except Exception as err:
360
- _ = err
366
+ logger.debug("Failed to inspect python file: %s", err)
367
+ continue
361
368
 
362
369
  # Directory-level markers (Katalon Keywords/Profiles)
363
370
  for d in dirs:
@@ -389,7 +396,7 @@ def detect_workspace_stacks(workspace_dir: str) -> Dict[str, Any]:
389
396
  if "include" in f.read().lower():
390
397
  is_monorepo = True
391
398
  except Exception as err:
392
- _ = err
399
+ logger.debug("Failed to read settings.gradle: %s", err)
393
400
 
394
401
  if is_monorepo:
395
402
  # Traverse subpackages in packages/, apps/, services/, modules/
@@ -406,7 +413,7 @@ def detect_workspace_stacks(workspace_dir: str) -> Dict[str, Any]:
406
413
  detected[stack].extend(evs)
407
414
  confidence[stack] = max(confidence[stack], sub_conf[stack])
408
415
  except OSError as err:
409
- _ = err
416
+ logger.debug("Failed to inspect subpackage: %s", err)
410
417
 
411
418
  # Filter active stacks where confidence >= 0.50
412
419
  active_stacks = [s for s, evs in detected.items() if evs and confidence[s] >= 0.50]
@@ -419,7 +426,7 @@ def detect_workspace_stacks(workspace_dir: str) -> Dict[str, Any]:
419
426
  }
420
427
 
421
428
 
422
- def route_rules(workspace_dir: str = ".") -> Dict[str, Any]:
429
+ def route_rules(workspace_dir: str = ".", minimal: bool = False, task_type: Optional[str] = None) -> Dict[str, Any]:
423
430
  """
424
431
  Determines minimal rules and skills for target workspace, with dual-tier token hydration
425
432
  accounting and strict truth-anchoring for unknown stacks.
@@ -442,6 +449,15 @@ def route_rules(workspace_dir: str = ".") -> Dict[str, Any]:
442
449
  for s in STACK_SKILL_MAPPINGS.get(stack, []):
443
450
  skills_set.add(s)
444
451
 
452
+ if task_type == "locator":
453
+ minimal = True
454
+ skills_set = {"clean-pom-crafter", "self-healing-locator"}
455
+ elif task_type == "triage":
456
+ minimal = True
457
+ skills_set = {"failure-autopsy-and-healing", "systematic-debugging"}
458
+ elif minimal:
459
+ skills_set = set(sorted(skills_set)[:1])
460
+
445
461
  # Resolve rules directory
446
462
  rules_dir = os.path.join(repo_root, ".agents", "rules")
447
463
  valid_rules = sorted(rules_set)
@@ -461,6 +477,9 @@ def route_rules(workspace_dir: str = ".") -> Dict[str, Any]:
461
477
  if is_unknown_stack:
462
478
  return {
463
479
  "workspace": os.path.abspath(workspace_dir),
480
+ "task_mode": "minimal" if (minimal or task_type) else "full",
481
+ "token_cap": 6000 if (minimal or task_type) else None,
482
+ "task_type": task_type,
464
483
  "status": "UNCLASSIFIED_WORKSPACE",
465
484
  "detected_stacks": ["unknown"],
466
485
  "classification": "UNCLASSIFIED_WORKSPACE (Fallback Core Base Rules)",
@@ -513,6 +532,9 @@ def route_rules(workspace_dir: str = ".") -> Dict[str, Any]:
513
532
 
514
533
  return {
515
534
  "workspace": os.path.abspath(workspace_dir),
535
+ "task_mode": "minimal" if (minimal or task_type) else "full",
536
+ "token_cap": 6000 if (minimal or task_type) else None,
537
+ "task_type": task_type,
516
538
  "status": "CLASSIFIED",
517
539
  "detected_stacks": active_stacks,
518
540
  "classification": f"CLASSIFIED ({', '.join(active_stacks)})",
@@ -620,9 +642,19 @@ def main():
620
642
  action="store_true",
621
643
  help="Print single-line summary of routed rules and tokens saved",
622
644
  )
645
+ parser.add_argument(
646
+ "--minimal",
647
+ action="store_true",
648
+ help="Enforce minimal mode payload <= 6,000 tokens",
649
+ )
650
+ parser.add_argument(
651
+ "--task-type",
652
+ choices=["locator", "triage", "api", "perf", "security"],
653
+ help="Target task intent profile",
654
+ )
623
655
  args = parser.parse_args()
624
656
 
625
- result = route_rules(args.workspace)
657
+ result = route_rules(args.workspace, minimal=args.minimal, task_type=args.task_type)
626
658
 
627
659
  if args.json:
628
660
  print(format_routing_report(result, fmt="json"))
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  # -*- coding: utf-8 -*-
3
6
  """
4
7
  tools/runaway_stopper.py — Agent Runaway & Token Loop Sentinel
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
2
5
  """
3
6
  Enterprise Action Safety Firewall & Blast Radius Containment Engine
4
7
  --------------------------------------------------------------------