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,138 @@
1
+ package com.enterprise.pages
2
+
3
+ import org.openqa.selenium.By
4
+ import org.openqa.selenium.JavascriptExecutor
5
+ import org.openqa.selenium.Keys
6
+ import org.openqa.selenium.WebDriver
7
+ import org.openqa.selenium.WebElement
8
+ import com.kms.katalon.core.webui.driver.DriverFactory
9
+
10
+ /**
11
+ * Enterprise Clean POM common methods reusable across Page Classes.
12
+ * Kế thừa trực tiếp từ BasePage.
13
+ */
14
+ class PomPatterns extends BasePage {
15
+
16
+ /**
17
+ * Hành vi tìm kiếm 2 pha: Bấm Search -> Điền từ khóa -> Enter -> Chờ bảng cập nhật
18
+ */
19
+ public static void searchRecord(String keyword) {
20
+ WebDriver driver = DriverFactory.getWebDriver()
21
+ List<WebElement> inputs = driver.findElements(By.cssSelector("input.p-inputtext[placeholder*='Tìm kiếm'], input[placeholder*='tên'], input[placeholder*='mã']"))
22
+ if (inputs.isEmpty() || !inputs.get(0).isDisplayed()) {
23
+ WebElement searchToggle = findElement(By.cssSelector("button.p-button-icon-only[icon*='search'], button[title*='Tìm kiếm']"))
24
+ searchToggle.click()
25
+ waitForElementVisible(By.cssSelector("input.p-inputtext[placeholder*='Tìm kiếm'], input[placeholder*='tên'], input[placeholder*='mã']"), 5)
26
+ }
27
+ WebElement input = findElement(By.cssSelector("input.p-inputtext[placeholder*='Tìm kiếm'], input[placeholder*='tên'], input[placeholder*='mã']"))
28
+ jsSetInput(input, keyword)
29
+ input.sendKeys(Keys.ENTER)
30
+ waitForAngular(5)
31
+ waitForElementVisible(By.cssSelector("p-table table tbody tr"), 5)
32
+ }
33
+
34
+ /**
35
+ * Chỉnh sửa bản ghi tại dòng đầu tiên và xác thực theo tên mới
36
+ */
37
+ public static void editRecord(String oldKeyword, String newName) {
38
+ searchRecord(oldKeyword)
39
+ WebElement editBtn = findElement(By.cssSelector("p-table tbody tr:first-child button[icon*='pencil'], p-table tbody tr:first-child button[icon*='edit']"))
40
+ clickElement(editBtn)
41
+ waitForElementVisible(By.cssSelector("input[formcontrolname='name'], input[name='name']"), 5)
42
+
43
+ WebElement nameInput = findElement(By.cssSelector("input[formcontrolname='name'], input[name='name']"))
44
+ jsSetInput(nameInput, newName)
45
+
46
+ WebElement saveBtn = findElement(By.xpath("//button[@title='Xác nhận' or contains(.,'Lưu') or contains(.,'Xác nhận')]"))
47
+ clickElement(saveBtn)
48
+ waitForAngular(5)
49
+
50
+ searchRecord(newName)
51
+ WebElement firstRow = findElement(By.cssSelector("p-table tbody tr:first-child"))
52
+ assert firstRow.getText().contains(newName) : "Lỗi: Bản ghi chưa cập nhật tên mới!"
53
+ }
54
+
55
+ /**
56
+ * Xóa bản ghi tại dòng đầu tiên và xác nhận p-confirmdialog
57
+ */
58
+ public static void deleteRecord(String keyword) {
59
+ WebDriver driver = DriverFactory.getWebDriver()
60
+ searchRecord(keyword)
61
+ WebElement deleteBtn = findElement(By.cssSelector("p-table tbody tr:first-child button.p-button-danger, p-table tbody tr:first-child button[icon*='trash']"))
62
+ clickElement(deleteBtn)
63
+ waitForElementVisible(By.xpath("//div[contains(@class,'p-dialog-footer') or contains(@class,'p-confirm-dialog')]//button[contains(@class,'p-confirm-dialog-accept') or contains(.,'Xóa') or contains(.,'Đồng ý') or contains(.,'Xác nhận')]"), 5)
64
+
65
+ WebElement confirmBtn = findElement(By.xpath("//div[contains(@class,'p-dialog-footer') or contains(@class,'p-confirm-dialog')]//button[contains(@class,'p-confirm-dialog-accept') or contains(.,'Xóa') or contains(.,'Đồng ý') or contains(.,'Xác nhận')]"))
66
+ clickElement(confirmBtn)
67
+ waitForAngular(5)
68
+
69
+ verifyRecordNotExists(keyword)
70
+ }
71
+
72
+ /**
73
+ * Điền ngày vào p-calendar an toàn với Angular
74
+ */
75
+ public static void setCalendarDate(WebElement element, String dateStr) {
76
+ WebDriver driver = DriverFactory.getWebDriver()
77
+ JavascriptExecutor js = (JavascriptExecutor) driver
78
+ js.executeScript("""
79
+ arguments[0].value = arguments[1];
80
+ arguments[0].dispatchEvent(new Event('input', { bubbles: true }));
81
+ arguments[0].dispatchEvent(new Event('change', { bubbles: true }));
82
+ arguments[0].dispatchEvent(new Event('blur', { bubbles: true }));
83
+ """, element, dateStr)
84
+ }
85
+
86
+ /**
87
+ * Chọn nhiều lựa chọn trong p-multiselect
88
+ */
89
+ public static void selectMultiOptions(WebElement multiSelectEl, List<String> optionTexts) {
90
+ clickElement(multiSelectEl)
91
+ waitForElementVisible(By.cssSelector(".p-multiselect-panel"), 5)
92
+ WebDriver driver = DriverFactory.getWebDriver()
93
+ for (String opt : optionTexts) {
94
+ WebElement item = driver.findElement(By.xpath("//li[contains(@class, 'p-multiselect-item') and contains(., '" + opt + "')]"))
95
+ clickElement(item)
96
+ }
97
+ WebElement closeBtn = driver.findElement(By.cssSelector(".p-multiselect-close"))
98
+ if (closeBtn != null && closeBtn.isDisplayed()) {
99
+ closeBtn.click()
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Kiểm tra bản ghi tồn tại trong bảng p-table
105
+ */
106
+ public static void verifyRecordExists(String keyword) {
107
+ WebDriver driver = DriverFactory.getWebDriver()
108
+ List<WebElement> rows = driver.findElements(By.cssSelector("p-table table tbody tr"))
109
+ assert !rows.isEmpty() : "Lỗi: Bảng không có dữ liệu nào!"
110
+ String firstRowText = rows.get(0).getText()
111
+ assert firstRowText.contains(keyword) : "Lỗi: Không tìm thấy từ khóa '${keyword}' trong hàng đầu tiên!"
112
+ }
113
+
114
+ /**
115
+ * Kiểm tra bản ghi đã bị xóa hoàn toàn khỏi bảng
116
+ */
117
+ public static void verifyRecordNotExists(String keyword) {
118
+ WebDriver driver = DriverFactory.getWebDriver()
119
+ searchRecord(keyword)
120
+ List<WebElement> rows = driver.findElements(By.cssSelector("p-table table tbody tr"))
121
+ if (rows.isEmpty()) return
122
+ String firstRowText = rows.get(0).getText()
123
+ assert !firstRowText.contains(keyword) || firstRowText.contains("Không có dữ liệu") : "Lỗi: Bản ghi '${keyword}' vẫn còn tồn tại trong bảng!"
124
+ }
125
+
126
+ /**
127
+ * Gán giá trị an toàn kích hoạt Angular Change Detection
128
+ */
129
+ public static void jsSetInput(WebElement element, String value) {
130
+ WebDriver driver = DriverFactory.getWebDriver()
131
+ JavascriptExecutor js = (JavascriptExecutor) driver
132
+ js.executeScript("""
133
+ arguments[0].value = arguments[1];
134
+ arguments[0].dispatchEvent(new Event('input', { bubbles: true }));
135
+ arguments[0].dispatchEvent(new Event('change', { bubbles: true }));
136
+ """, element, value)
137
+ }
138
+ }
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: code-refactoring-refactor-clean
3
+ description: "Master code refactoring and technical debt remediation. Enforces clean code principles, SOLID patterns, code smell elimination, dead code cleanup, and measurable debt reduction."
4
+ ---
5
+
6
+ # Refactor, Clean Code & Technical Debt Remediation
7
+
8
+ You are a code refactoring and technical debt expert specializing in clean code principles, SOLID design patterns, tech debt inventory, and modern software engineering best practices. Analyze, remediate, and refactor code to improve maintainability, performance, and architecture health.
9
+
10
+ ## Use this skill when
11
+
12
+ - Refactoring tangled, overly complex, or hard-to-maintain code
13
+ - Identifying, quantifying, and prioritizing technical debt and code smells
14
+ - Eliminating duplication, dead code, long methods, and God classes
15
+ - Preparing modules for new features safely without regression
16
+ - Establishing automated quality gates and debt reduction roadmaps
17
+
18
+ ## Do not use this skill when
19
+
20
+ - You only need a small one-line fix
21
+ - Refactoring is prohibited due to production freeze
22
+ - The request is for documentation only
23
+
24
+ ## Context
25
+ The user needs actionable code refactoring and technical debt remediation. Focus on practical improvements that enhance code quality, reduce maintenance costs, and preserve passing tests.
26
+
27
+ ## Instructions
28
+
29
+ - Assess code smells, dependencies, risky hotspots, and technical debt metrics.
30
+ - Propose a refactor plan with incremental steps and clear ROI.
31
+ - Apply changes in small slices and keep external behavior stable.
32
+ - Update tests, verify regressions, and maintain backward compatibility.
33
+ - If detailed patterns are required, refer to `resources/implementation-playbook.md`.
34
+
35
+ ## Technical Debt & Code Smell Checklist
36
+
37
+ 1. **Code Debt:**
38
+ - Duplication: identical logic, copy-paste snippets, repeated business rules.
39
+ - Complexity: cyclomatic complexity > 10, deep nesting > 3 levels, methods > 50 lines.
40
+ - God Classes: classes > 500 lines or > 20 methods (e.g. legacy Page Classes).
41
+ 2. **Architecture Debt:**
42
+ - Missing or leaky abstractions, violated layer boundaries, high coupling.
43
+ 3. **Testing Debt:**
44
+ - Missing assertions, flaky synchronization, untracked test data collisions.
45
+
46
+ ## Safety & Verification
47
+
48
+ - Never alter business logic without explicit confirmation.
49
+ - Keep diffs minimal, reviewable, and run verification gates:
50
+ ```bash
51
+ python3 tools/verify_all.py
52
+ ```
53
+
54
+ ## Output Format
55
+
56
+ - Summary of identified issues, code smells, and technical debt
57
+ - Incremental refactoring roadmap with risk assessment
58
+ - Code changes with before/after comparisons and verification results
59
+ - Proposed changes and expected impact
60
+ - Test/verification notes
61
+
62
+ ## Resources
63
+
64
+ - `resources/implementation-playbook.md` for detailed patterns and examples.