synapse-hub 0.0.0-stage → 2.0.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 (122) hide show
  1. package/.agents/agents/failure-analyst.md +47 -0
  2. package/.agents/agents/live-explorer.md +41 -0
  3. package/.agents/agents/orchestrator.md +43 -0
  4. package/.agents/agents/pom-crafter.md +81 -0
  5. package/.agents/agents/quality-gatekeeper.md +47 -0
  6. package/.agents/agents/test-runner.md +43 -0
  7. package/.agents/rules/context-engineering.md +88 -0
  8. package/.agents/rules/git-push-protocol.md +101 -0
  9. package/.agents/rules/graphify.md +14 -0
  10. package/.agents/rules/lessons-learned.md +23 -0
  11. package/.agents/rules/mandatory-playwright-live.md +29 -0
  12. package/.agents/rules/skill-precedence.md +42 -0
  13. package/.agents/rules/systematic-debugging.md +99 -0
  14. package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +239 -0
  15. package/.agents/skills/antigravity-test-sentinel/SKILL.md +64 -0
  16. package/.agents/skills/api-network-mocking-interception/SKILL.md +142 -0
  17. package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +70 -0
  18. package/.agents/skills/architecture-decision-records/SKILL.md +441 -0
  19. package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +72 -0
  20. package/.agents/skills/backend-load-and-stress-patterns/SKILL.md +214 -0
  21. package/.agents/skills/bats-testing-patterns/SKILL.md +100 -0
  22. package/.agents/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
  23. package/.agents/skills/clean-pom-crafter/SKILL.md +75 -0
  24. package/.agents/skills/clean-pom-crafter/examples/standard_test_case.groovy +28 -0
  25. package/.agents/skills/clean-pom-crafter/references/pom_patterns.groovy +138 -0
  26. package/.agents/skills/code-refactoring-refactor-clean/SKILL.md +64 -0
  27. package/.agents/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +879 -0
  28. package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +123 -0
  29. package/.agents/skills/e2e-testing-patterns/SKILL.md +103 -0
  30. package/.agents/skills/e2e-testing-patterns/resources/implementation-playbook.md +522 -0
  31. package/.agents/skills/failure-autopsy-and-healing/SKILL.md +54 -0
  32. package/.agents/skills/failure-autopsy-and-healing/references/healing_matrix.md +64 -0
  33. package/.agents/skills/failure-autopsy-and-healing/references/qa_investigation_protocol.md +56 -0
  34. package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +98 -0
  35. package/.agents/skills/file-and-report-validator/SKILL.md +90 -0
  36. package/.agents/skills/flaky-test-sentinel-and-quarantine/SKILL.md +114 -0
  37. package/.agents/skills/github-actions-templates/SKILL.md +334 -0
  38. package/.agents/skills/graphify-impact-analyzer/SKILL.md +78 -0
  39. package/.agents/skills/katalon-cli-runner/SKILL.md +76 -0
  40. package/.agents/skills/katalon-cli-runner/references/groovy-patterns.md +209 -0
  41. package/.agents/skills/katalon-cli-runner/references/katalon-api.md +155 -0
  42. package/.agents/skills/katalon-cli-runner/references/runner_commands.md +67 -0
  43. package/.agents/skills/lam-script-generator/SKILL.md +83 -0
  44. package/.agents/skills/playwright-live-interaction/SKILL.md +86 -0
  45. package/.agents/skills/playwright-live-interaction/references/advanced_superpowers.md +160 -0
  46. package/.agents/skills/playwright-live-interaction/references/compact_accessibility_snapshots.md +75 -0
  47. package/.agents/skills/playwright-live-interaction/references/recipes.md +388 -0
  48. package/.agents/skills/playwright-live-interaction/references/swarm_orchestration.md +134 -0
  49. package/.agents/skills/security-dast-sentinel/SKILL.md +176 -0
  50. package/.agents/skills/self-healing-locator/SKILL.md +73 -0
  51. package/.agents/skills/synthetic-test-data-generator/SKILL.md +135 -0
  52. package/.agents/skills/token-and-context-optimizer/SKILL.md +70 -0
  53. package/.agents/skills/visual-regression-sentinel/SKILL.md +62 -0
  54. package/.agents/skills/wcag-audit-patterns/SKILL.md +77 -0
  55. package/.agents/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
  56. package/.agents/skills/web-vitals-and-performance-profiler/SKILL.md +65 -0
  57. package/.agents/templates/completion_report.md +57 -0
  58. package/.agents/workflows/graphify.md +10 -0
  59. package/.agents/workflows/test-impact.md +15 -0
  60. package/.agents/workflows/verify.md +34 -0
  61. package/AGENTS.md +115 -0
  62. package/README.md +394 -2
  63. package/bin/agent-qa.js +90 -0
  64. package/package.json +59 -4
  65. package/skills_manifest.json +262 -0
  66. package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +97 -0
  67. package/templates/PROJECT_STATE_TEMPLATE.md +20 -0
  68. package/tools/TOOLS_RUNBOOK.md +298 -0
  69. package/tools/agent_canary.py +501 -0
  70. package/tools/analyze_project.py +242 -0
  71. package/tools/api_drift_sentinel.py +208 -0
  72. package/tools/auto_heal.py +189 -0
  73. package/tools/browser_helpers.js +593 -0
  74. package/tools/bug_reporter.py +224 -0
  75. package/tools/cache_resolver.py +846 -0
  76. package/tools/check_env.py +288 -0
  77. package/tools/ci_healing_hook.py +128 -0
  78. package/tools/cli.py +402 -0
  79. package/tools/config_decoupler.py +253 -0
  80. package/tools/db_sandbox.py +341 -0
  81. package/tools/distill_log.py +152 -0
  82. package/tools/e2e_flow_prober.ps1 +65 -0
  83. package/tools/flaky_detector.py +222 -0
  84. package/tools/fuzz_payloads.py +197 -0
  85. package/tools/generate_allure_report.ps1 +30 -0
  86. package/tools/generate_api_matrix.py +193 -0
  87. package/tools/generate_tc_from_story.py +182 -0
  88. package/tools/generate_test_reports.ps1 +135 -0
  89. package/tools/git_pre_commit_guard.py +203 -0
  90. package/tools/heal_pr_automator.py +195 -0
  91. package/tools/heuristic_locator_matcher.py +202 -0
  92. package/tools/infer_linter.py +238 -0
  93. package/tools/lint_ai_docs.py +254 -0
  94. package/tools/lookup_tc.py +165 -0
  95. package/tools/lookup_xpath.py +167 -0
  96. package/tools/matrix_sharder.py +146 -0
  97. package/tools/mcp_excel_server.ps1 +251 -0
  98. package/tools/mcp_server.py +490 -0
  99. package/tools/micro_mutator.py +309 -0
  100. package/tools/network_mock_shield.py +170 -0
  101. package/tools/omni_emitter.py +500 -0
  102. package/tools/omni_parser.py +435 -0
  103. package/tools/omni_transpiler.py +168 -0
  104. package/tools/pinpoint_failure.py +88 -0
  105. package/tools/project_state.py +169 -0
  106. package/tools/repo_map.json +12 -0
  107. package/tools/repo_map.py +277 -0
  108. package/tools/repo_map.txt +7 -0
  109. package/tools/safety_firewall.py +245 -0
  110. package/tools/setup_project.py +265 -0
  111. package/tools/smart_visual_masker.py +134 -0
  112. package/tools/test_impact.py +321 -0
  113. package/tools/tms_sync_bridge.py +342 -0
  114. package/tools/trace_data_flow.py +240 -0
  115. package/tools/traffic_session_converter.py +256 -0
  116. package/tools/universal_ir.py +480 -0
  117. package/tools/validate_groovy_scripts.py +173 -0
  118. package/tools/verify_all.py +496 -0
  119. package/tools/verify_all.sh +4 -0
  120. package/tools/visual_diff_canvas.py +142 -0
  121. package/tools/visual_som_helper.py +418 -0
  122. package/tools/wcag_audit.py +214 -0
@@ -0,0 +1,224 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Auto-Bug Reporter & Root Cause Analysis (RCA) Ticket Generator
4
+ --------------------------------------------------------------
5
+ Transforms automated test failures into enterprise-ready Bug Reports
6
+ compatible with Jira, GitHub Issues, and Markdown.
7
+ Automatically performs RCA (AUT Bug vs Test Script Bug), extracts
8
+ reproduction steps, distills stacktraces (0 noise), and attaches evidence.
9
+ """
10
+
11
+ import os
12
+ import re
13
+ import sys
14
+ import json
15
+ import argparse
16
+ from typing import Dict, List, Optional, Any
17
+ from datetime import datetime
18
+
19
+
20
+ class BugReporter:
21
+ """Enterprise Automated Bug Ticket & RCA Generator."""
22
+
23
+ @staticmethod
24
+ def classify_root_cause(error_message: str, stack_trace: str) -> Dict[str, str]:
25
+ """
26
+ Classifies whether the failure is an Application Bug (AUT Bug)
27
+ or an Automation Test Maintenance Bug (Test Bug).
28
+ """
29
+ combined = (error_message + " " + stack_trace).lower()
30
+
31
+ # Application / Backend / Frontend Bugs
32
+ if any(err in combined for err in ["500 internal server error", "502 bad gateway", "503 service unavailable", "504 gateway timeout"]):
33
+ return {
34
+ "type": "AUT_BACKEND_CRASH",
35
+ "label": "AUT Bug (Backend Crash / Server 5xx)",
36
+ "severity": "Blocker",
37
+ "suggested_team": "Backend Engineering"
38
+ }
39
+ if any(err in combined for err in ["uncaught typeerror", "undefined is not a function", "cannot read property", "referenceerror", "uncaught syntaxerror"]):
40
+ return {
41
+ "type": "AUT_FRONTEND_EXCEPTION",
42
+ "label": "AUT Bug (Unhandled Frontend Exception)",
43
+ "severity": "Critical",
44
+ "suggested_team": "Frontend Engineering"
45
+ }
46
+ if any(err in combined for err in ["assertionerror", "expected value", "expected condition failed", "verifyequal failed"]):
47
+ return {
48
+ "type": "AUT_BUSINESS_LOGIC_MISMATCH",
49
+ "label": "AUT Bug (Business Logic / Assertion Mismatch)",
50
+ "severity": "Major",
51
+ "suggested_team": "Product / Dev Team"
52
+ }
53
+
54
+ # Automation Script Issues
55
+ if any(err in combined for err in ["nosuchelementexception", "elementnotfound", "waiting for locator", "timeout 30000ms exceeded"]):
56
+ return {
57
+ "type": "TEST_LOCATOR_DRIFT",
58
+ "label": "Test Script Bug (Locator Drift or Timeout)",
59
+ "severity": "Minor",
60
+ "suggested_team": "QA Automation"
61
+ }
62
+ if "staleelementreferenceexception" in combined:
63
+ return {
64
+ "type": "TEST_STALE_ELEMENT",
65
+ "label": "Test Script Bug (DOM Re-render Race Condition)",
66
+ "severity": "Minor",
67
+ "suggested_team": "QA Automation"
68
+ }
69
+
70
+ return {
71
+ "type": "AUT_DEFECT_SUSPECTED",
72
+ "label": "Suspected Application Defect",
73
+ "severity": "Major",
74
+ "suggested_team": "Dev & QA Team"
75
+ }
76
+
77
+ @staticmethod
78
+ def distill_stack_trace(raw_stack: str, max_lines: int = 5) -> str:
79
+ """Filters noisy framework stack trace down to actionable lines."""
80
+ lines = [l.strip() for l in raw_stack.splitlines() if l.strip()]
81
+ actionable = []
82
+ for l in lines:
83
+ # Filter standard framework internals
84
+ if any(internal in l for internal in ["at Module.", "node_modules", "org.gradle", "sun.reflect", "jdk.internal"]):
85
+ continue
86
+ actionable.append(l)
87
+ if len(actionable) >= max_lines:
88
+ break
89
+ return "\n".join(actionable) if actionable else raw_stack[:300]
90
+
91
+ @classmethod
92
+ def generate_report(
93
+ cls,
94
+ test_id: str,
95
+ test_title: str,
96
+ error_message: str,
97
+ stack_trace: str = "",
98
+ screenshot_path: Optional[str] = None,
99
+ steps_executed: Optional[List[str]] = None,
100
+ environment: str = "Staging / Chrome Headless",
101
+ format_type: str = "jira"
102
+ ) -> str:
103
+ """Generates a complete bug ticket string in Jira or Markdown format."""
104
+ rca = cls.classify_root_cause(error_message, stack_trace)
105
+ distilled_stack = cls.distill_stack_trace(stack_trace)
106
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
107
+
108
+ steps = steps_executed or [
109
+ f"1. Navigate to target application under test",
110
+ f"2. Execute test workflow for {test_title}",
111
+ f"3. Trigger operation causing failure: {error_message[:80]}"
112
+ ]
113
+
114
+ if format_type.lower() == "jira":
115
+ report = [
116
+ f"h2. [BUG][{rca['severity'].upper()}] {test_id}: {test_title} - {error_message[:90]}",
117
+ "",
118
+ f"* *Issue Type:* Bug",
119
+ f"* *Root Cause Category:* {rca['label']}",
120
+ f"* *Severity / Priority:* {rca['severity']}",
121
+ f"* *Assigned Team:* {rca['suggested_team']}",
122
+ f"* *Environment:* {environment}",
123
+ f"* *Detected At:* {timestamp}",
124
+ "",
125
+ "h3. 1. Steps to Reproduce",
126
+ ]
127
+ for s in steps:
128
+ report.append(f"# {s}")
129
+
130
+ report.extend([
131
+ "",
132
+ "h3. 2. Expected Result",
133
+ f"Operation completes successfully without errors, assertions pass.",
134
+ "",
135
+ "h3. 3. Actual Result",
136
+ f"{{color:red}}*Failure:* {error_message}{{color}}",
137
+ "",
138
+ "h3. 4. Distilled Diagnostic Stack Trace",
139
+ "{code:java}",
140
+ distilled_stack,
141
+ "{code}",
142
+ ])
143
+
144
+ if screenshot_path:
145
+ report.extend([
146
+ "",
147
+ "h3. 5. Visual Evidence",
148
+ f"!{os.path.basename(screenshot_path)}|thumbnail!",
149
+ f"Local file: [^{screenshot_path}]"
150
+ ])
151
+
152
+ return "\n".join(report)
153
+
154
+ # Markdown / GitHub Issues format
155
+ md = [
156
+ f"# [BUG][{rca['severity'].upper()}] {test_id}: {test_title}",
157
+ "",
158
+ f"> **Root Cause Analysis:** `{rca['label']}` ",
159
+ f"> **Severity:** **{rca['severity']}** | **Assigned To:** `{rca['suggested_team']}` | **Detected:** {timestamp}",
160
+ "",
161
+ "## 📌 1. Steps to Reproduce",
162
+ ]
163
+ for s in steps:
164
+ md.append(f"- {s}")
165
+
166
+ md.extend([
167
+ "",
168
+ "## 🎯 2. Expected Result",
169
+ "Application executes workflow smoothly and passes all validations.",
170
+ "",
171
+ "## ❌ 3. Actual Result",
172
+ f"**Error Encountered:**",
173
+ f"```text\n{error_message}\n```",
174
+ "",
175
+ "## 🔍 4. Distilled Stack Trace (0-Noise)",
176
+ f"```text\n{distilled_stack}\n```",
177
+ ])
178
+
179
+ if screenshot_path:
180
+ md.extend([
181
+ "",
182
+ "## 📸 5. Visual Evidence",
183
+ f"![Failure Evidence]({screenshot_path})"
184
+ ])
185
+
186
+ return "\n".join(md)
187
+
188
+
189
+ def main():
190
+ parser = argparse.ArgumentParser(description="Autonomous Bug Reporter & RCA Ticket Generator")
191
+ parser.add_argument("--test-id", default="TC_AUTO_001", help="Test Case Identifier")
192
+ parser.add_argument("--title", required=True, help="Test Case Title")
193
+ parser.add_argument("--error", required=True, help="Error message / exception")
194
+ parser.add_argument("--stack", default="", help="Raw stack trace string or file path")
195
+ parser.add_argument("--screenshot", default=None, help="Path to error screenshot")
196
+ parser.add_argument("--format", choices=["jira", "md", "json"], default="jira", help="Output format")
197
+ parser.add_argument("--out", default=None, help="Output file path")
198
+
199
+ args = parser.parse_args()
200
+
201
+ stack = args.stack
202
+ if os.path.exists(stack):
203
+ with open(stack, "r", encoding="utf-8", errors="replace") as f:
204
+ stack = f.read()
205
+
206
+ report = BugReporter.generate_report(
207
+ test_id=args.test_id,
208
+ test_title=args.title,
209
+ error_message=args.error,
210
+ stack_trace=stack,
211
+ screenshot_path=args.screenshot,
212
+ format_type=args.format
213
+ )
214
+
215
+ if args.out:
216
+ with open(args.out, "w", encoding="utf-8") as f:
217
+ f.write(report)
218
+ print(f"✅ Bug report generated and saved to: {args.out}")
219
+ else:
220
+ print(report)
221
+
222
+
223
+ if __name__ == "__main__":
224
+ main()