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.
- package/.agents/agents/failure-analyst.md +47 -0
- package/.agents/agents/live-explorer.md +41 -0
- package/.agents/agents/orchestrator.md +43 -0
- package/.agents/agents/pom-crafter.md +81 -0
- package/.agents/agents/quality-gatekeeper.md +47 -0
- package/.agents/agents/test-runner.md +43 -0
- package/.agents/rules/context-engineering.md +88 -0
- package/.agents/rules/git-push-protocol.md +101 -0
- package/.agents/rules/graphify.md +14 -0
- package/.agents/rules/lessons-learned.md +23 -0
- package/.agents/rules/mandatory-playwright-live.md +29 -0
- package/.agents/rules/skill-precedence.md +42 -0
- package/.agents/rules/systematic-debugging.md +99 -0
- package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +239 -0
- package/.agents/skills/antigravity-test-sentinel/SKILL.md +64 -0
- package/.agents/skills/api-network-mocking-interception/SKILL.md +142 -0
- package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +70 -0
- package/.agents/skills/architecture-decision-records/SKILL.md +441 -0
- package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +72 -0
- package/.agents/skills/backend-load-and-stress-patterns/SKILL.md +214 -0
- package/.agents/skills/bats-testing-patterns/SKILL.md +100 -0
- package/.agents/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
- package/.agents/skills/clean-pom-crafter/SKILL.md +75 -0
- package/.agents/skills/clean-pom-crafter/examples/standard_test_case.groovy +28 -0
- package/.agents/skills/clean-pom-crafter/references/pom_patterns.groovy +138 -0
- package/.agents/skills/code-refactoring-refactor-clean/SKILL.md +64 -0
- package/.agents/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +879 -0
- package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +123 -0
- package/.agents/skills/e2e-testing-patterns/SKILL.md +103 -0
- package/.agents/skills/e2e-testing-patterns/resources/implementation-playbook.md +522 -0
- package/.agents/skills/failure-autopsy-and-healing/SKILL.md +54 -0
- package/.agents/skills/failure-autopsy-and-healing/references/healing_matrix.md +64 -0
- package/.agents/skills/failure-autopsy-and-healing/references/qa_investigation_protocol.md +56 -0
- package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +98 -0
- package/.agents/skills/file-and-report-validator/SKILL.md +90 -0
- package/.agents/skills/flaky-test-sentinel-and-quarantine/SKILL.md +114 -0
- package/.agents/skills/github-actions-templates/SKILL.md +334 -0
- package/.agents/skills/graphify-impact-analyzer/SKILL.md +78 -0
- package/.agents/skills/katalon-cli-runner/SKILL.md +76 -0
- package/.agents/skills/katalon-cli-runner/references/groovy-patterns.md +209 -0
- package/.agents/skills/katalon-cli-runner/references/katalon-api.md +155 -0
- package/.agents/skills/katalon-cli-runner/references/runner_commands.md +67 -0
- package/.agents/skills/lam-script-generator/SKILL.md +83 -0
- package/.agents/skills/playwright-live-interaction/SKILL.md +86 -0
- package/.agents/skills/playwright-live-interaction/references/advanced_superpowers.md +160 -0
- package/.agents/skills/playwright-live-interaction/references/compact_accessibility_snapshots.md +75 -0
- package/.agents/skills/playwright-live-interaction/references/recipes.md +388 -0
- package/.agents/skills/playwright-live-interaction/references/swarm_orchestration.md +134 -0
- package/.agents/skills/security-dast-sentinel/SKILL.md +176 -0
- package/.agents/skills/self-healing-locator/SKILL.md +73 -0
- package/.agents/skills/synthetic-test-data-generator/SKILL.md +135 -0
- package/.agents/skills/token-and-context-optimizer/SKILL.md +70 -0
- package/.agents/skills/visual-regression-sentinel/SKILL.md +62 -0
- package/.agents/skills/wcag-audit-patterns/SKILL.md +77 -0
- package/.agents/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
- package/.agents/skills/web-vitals-and-performance-profiler/SKILL.md +65 -0
- package/.agents/templates/completion_report.md +57 -0
- package/.agents/workflows/graphify.md +10 -0
- package/.agents/workflows/test-impact.md +15 -0
- package/.agents/workflows/verify.md +34 -0
- package/AGENTS.md +115 -0
- package/README.md +394 -2
- package/bin/agent-qa.js +90 -0
- package/package.json +59 -4
- package/skills_manifest.json +262 -0
- package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +97 -0
- package/templates/PROJECT_STATE_TEMPLATE.md +20 -0
- package/tools/TOOLS_RUNBOOK.md +298 -0
- package/tools/agent_canary.py +501 -0
- package/tools/analyze_project.py +242 -0
- package/tools/api_drift_sentinel.py +208 -0
- package/tools/auto_heal.py +189 -0
- package/tools/browser_helpers.js +593 -0
- package/tools/bug_reporter.py +224 -0
- package/tools/cache_resolver.py +846 -0
- package/tools/check_env.py +288 -0
- package/tools/ci_healing_hook.py +128 -0
- package/tools/cli.py +402 -0
- package/tools/config_decoupler.py +253 -0
- package/tools/db_sandbox.py +341 -0
- package/tools/distill_log.py +152 -0
- package/tools/e2e_flow_prober.ps1 +65 -0
- package/tools/flaky_detector.py +222 -0
- package/tools/fuzz_payloads.py +197 -0
- package/tools/generate_allure_report.ps1 +30 -0
- package/tools/generate_api_matrix.py +193 -0
- package/tools/generate_tc_from_story.py +182 -0
- package/tools/generate_test_reports.ps1 +135 -0
- package/tools/git_pre_commit_guard.py +203 -0
- package/tools/heal_pr_automator.py +195 -0
- package/tools/heuristic_locator_matcher.py +202 -0
- package/tools/infer_linter.py +238 -0
- package/tools/lint_ai_docs.py +254 -0
- package/tools/lookup_tc.py +165 -0
- package/tools/lookup_xpath.py +167 -0
- package/tools/matrix_sharder.py +146 -0
- package/tools/mcp_excel_server.ps1 +251 -0
- package/tools/mcp_server.py +490 -0
- package/tools/micro_mutator.py +309 -0
- package/tools/network_mock_shield.py +170 -0
- package/tools/omni_emitter.py +500 -0
- package/tools/omni_parser.py +435 -0
- package/tools/omni_transpiler.py +168 -0
- package/tools/pinpoint_failure.py +88 -0
- package/tools/project_state.py +169 -0
- package/tools/repo_map.json +12 -0
- package/tools/repo_map.py +277 -0
- package/tools/repo_map.txt +7 -0
- package/tools/safety_firewall.py +245 -0
- package/tools/setup_project.py +265 -0
- package/tools/smart_visual_masker.py +134 -0
- package/tools/test_impact.py +321 -0
- package/tools/tms_sync_bridge.py +342 -0
- package/tools/trace_data_flow.py +240 -0
- package/tools/traffic_session_converter.py +256 -0
- package/tools/universal_ir.py +480 -0
- package/tools/validate_groovy_scripts.py +173 -0
- package/tools/verify_all.py +496 -0
- package/tools/verify_all.sh +4 -0
- package/tools/visual_diff_canvas.py +142 -0
- package/tools/visual_som_helper.py +418 -0
- package/tools/wcag_audit.py +214 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify
|
|
3
|
+
description: Execute 8 Quality Gates to verify complete codebase integrity and enforce deterministic safety boundaries before handoff.
|
|
4
|
+
trigger: /verify
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Workflow: verify
|
|
8
|
+
|
|
9
|
+
## 1. Pre-execution Safety Hook (Mandatory Action Firewall)
|
|
10
|
+
Before dispatching any UI interaction (`click`, `fill`, `submit`, `drop`) down to a live Playwright or CDP browser context, the command or code must be piped through `tools/safety_firewall.py --dry-run`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Verify single action safety clearance
|
|
14
|
+
python tools/safety_firewall.py --action click --selector "<selector>" --text "<text>" --dry-run
|
|
15
|
+
|
|
16
|
+
# Or pipe code snippet directly
|
|
17
|
+
python tools/safety_firewall.py --code "page.click('<selector>')" --dry-run
|
|
18
|
+
```
|
|
19
|
+
*If safety firewall reports BLOCKED, execution halts immediately unless explicitly forced via `--force` or `ALLOW_DESTRUCTIVE=1`.*
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Hard Quality Gates Verification (8 DoD Gates)
|
|
24
|
+
Execute all 8 Quality Gates (UTF-8 No BOM, Path Portability, Clean POM, AI Docs Linter, Cleanup Blacklist, Credential Security, Infer Linter, and AST Micro-Mutation Testing):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python tools/verify_all.py
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Gate 8 Hard Rejection Rule:
|
|
31
|
+
- Any new or updated test case must achieve an AST Mutation Score of **$\ge 80\%$** via `tools/micro_mutator.py`.
|
|
32
|
+
- If `mutation_score < 80%`, the Gatekeeper strictly rejects the test suite (anti-tautology and anti-fake-pass policy).
|
|
33
|
+
|
|
34
|
+
If any gate returns `FAIL`, pause execution and resolve defects completely before proceeding.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# AGENTS.md — AI Agent Operating Standards & Protocols (Enterprise QA Hub)
|
|
2
|
+
|
|
3
|
+
> **Scope:** Google Antigravity, Cursor, Claude Code, GitHub Copilot, Codex, Windsurf, and all AI/QA engineers working with automated testing suites.
|
|
4
|
+
> All rules below are **MANDATORY** and must be consistently enforced across all projects linking to this Hub.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 0. CONTEXT-AWARE PRE-FLIGHT CONFIRMATION BLOCK (CODE & TEST ACTIONS ONLY)
|
|
9
|
+
|
|
10
|
+
> **Trigger Condition:** This confirmation block is **MANDATORY ONLY** when executing technical tasks: generating code, editing test scripts, refactoring Page Classes, or executing runner tools.
|
|
11
|
+
> **Conversational Exemption:** For general discussions, architecture questions, planning, and Q&A, **DO NOT emit this block** — respond directly and concisely.
|
|
12
|
+
> **Dynamic Context:** The architecture and technique fields must adapt dynamically to the target project's `PROJECT_AI_GUIDE.md` (e.g., Playwright/TS, Clean POM/Groovy, Pytest/Python, REST API).
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
> ✅ **[OK] Skill Hub Loaded:** `agent-skills` & Project Guide (`PROJECT_AI_GUIDE.md`)
|
|
16
|
+
> 🏛️ **[OK] Architecture:** <Target Architecture, e.g.: Clean POM / Flat Architecture>
|
|
17
|
+
> ⚡ **[OK] Target Tech:** <Actual Project Tech, e.g.: Playwright Live / API Mocking / Pytest>
|
|
18
|
+
> 🛡️ **[OK] Discipline:** Truth Anchor (No Fake Pass) + Zero-Token Error Blacklist
|
|
19
|
+
> 🎯 **[OK] Execution Plan:**
|
|
20
|
+
> • <Immediate Action Item 1>
|
|
21
|
+
> • <Immediate Action Item 2>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. CORE ARCHITECTURE & CODE STANDARDS
|
|
27
|
+
|
|
28
|
+
1. **Clean Page Object Model (POM):**
|
|
29
|
+
- Test scripts (`Scripts/` or `tests/`) must contain only business workflow method calls from Page Classes.
|
|
30
|
+
- **Strictly forbidden:** Raw XPaths, CSS selectors, or `findTestObject` calls inside test scripts.
|
|
31
|
+
- All locators and DOM operations must be encapsulated in Page Classes extending `BasePage`.
|
|
32
|
+
|
|
33
|
+
2. **100% UTF-8 No BOM:**
|
|
34
|
+
- All files (`.groovy`, `.java`, `.ts`, `.py`, `.json`, `.md`, `.ps1`, `.sh`) **must not** contain UTF-8 BOM (`0xEF, 0xBB, 0xBF`).
|
|
35
|
+
|
|
36
|
+
3. **Dynamic & Idempotent Test Data:**
|
|
37
|
+
- Always use randomized identifiers with timestamps/prefixes (e.g., `BasePage.uniqueCode("AUTO_")` or `DataGenerator`) to eliminate DB unique key collisions during parallel runs.
|
|
38
|
+
- Every creation test case must be paired with automated Teardown Cleanup.
|
|
39
|
+
|
|
40
|
+
4. **Synchronization & Smart Wait:**
|
|
41
|
+
- Static sleeps (`Thread.sleep`) are strictly prohibited to prevent pipeline flakiness.
|
|
42
|
+
- Use dynamic smart waits: element visibility checks, Angular `zone.isStable()`, or Playwright `waitForLoadState('networkidle')`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2. PLAYWRIGHT LIVE INTERACTION PROTOCOL
|
|
47
|
+
|
|
48
|
+
1. **Mandatory 3-Stage Lifecycle:**
|
|
49
|
+
- **Stage 1 (Discovery):** Survey live DOM/AOM using headless browser. Never guess URLs or selector attributes.
|
|
50
|
+
- **Stage 2 (Script Creation):** Verify selectors on the live browser (100% hit rate under 200ms) before committing to Page Classes.
|
|
51
|
+
- **Stage 3 (In-Place Self-Healing):** When a test fails, pause the browser at the failure point to inspect and heal the locator; do not re-run from scratch.
|
|
52
|
+
2. **Standard Configuration:** Pure headless mode, Full HD resolution `1920x1080`.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. TRUTH ANCHOR & ZERO-HALLUCINATION DISCIPLINE
|
|
57
|
+
|
|
58
|
+
1. **Truth Anchor (No Fake Pass):**
|
|
59
|
+
- If a test fails due to an application bug (AUT Bug), report the defect honestly. **Never relax assertion conditions, skip validation steps, or alter expected results to manufacture a fake pass.**
|
|
60
|
+
2. **No Lazy Truncation:**
|
|
61
|
+
- Always output complete, directly executable code. Never use `// ... existing code ...` or `// TODO` in scripts.
|
|
62
|
+
3. **Strict Credential Security:**
|
|
63
|
+
- Never commit raw plaintext passwords, secret tokens, or private keys to git. Always use environment variables or encrypted profiles.
|
|
64
|
+
4. **Zero-Command Autonomous Proactivity & On-Demand Activation (Situation-Specific — Never Run Blindly):**
|
|
65
|
+
- The user must never be expected to remember or type CLI tool commands (`agent-qa setup`, `agent-qa analyze`, `verify_all.py`...).
|
|
66
|
+
- **On-Demand Principle:** Tools assigned to AI and Subagents are **NOT executed blindly or all at once**. They are activated **strictly on-demand** when the specific situation arises to save tokens and avoid execution overhead:
|
|
67
|
+
* New project / missing `PROJECT_AI_GUIDE.md` -> Autonomously run `tools/setup_project.py`.
|
|
68
|
+
* User asks to analyze / audit project -> Autonomously run `tools/analyze_project.py` and push to git.
|
|
69
|
+
* Test failure occurs in runner -> Autonomously run `tools/pinpoint_failure.py` / `auto_heal.py`.
|
|
70
|
+
* Breaking API change suspected -> Run `tools/api_drift_sentinel.py`.
|
|
71
|
+
* Parallel CI/CD runner setup needed -> Run `tools/matrix_sharder.py`.
|
|
72
|
+
* Verifying test assertion quality -> Run `tools/micro_mutator.py` (reject if Mutation Score < 80%).
|
|
73
|
+
* Before completing code tasks -> Autonomously run `tools/verify_all.py` (8 Quality Gates DoD).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 4. MULTI-AGENT SWARM SYSTEM (AGENT ROLES)
|
|
78
|
+
|
|
79
|
+
This repository defines specialized multi-agent profiles (configured in `.agents/agents/*.md`):
|
|
80
|
+
|
|
81
|
+
1. **Lead QA Orchestrator (`orchestrator`):**
|
|
82
|
+
- Ingests requirements, bootstraps projects (`setup_project.py`), audits health (`analyze_project.py`), scans polyglot test suites (`omni_transpiler.py`), manages state (`project_state.py`), scopes tasks (`test_impact.py`), and serves MCP (`mcp_server.py`).
|
|
83
|
+
2. **Live Interaction Explorer (`live-explorer`):**
|
|
84
|
+
- Utilizes Playwright live DOM/AOM probing, applies Anti-Flake Visual Masking (`smart_visual_masker.py`), injects network mocks (`network_mock_shield.py`), enforces Action Safety Firewall (`safety_firewall.py`), queries cached XPaths (`lookup_xpath.py`), and validates canvas (`visual_diff_canvas.py`).
|
|
85
|
+
3. **Clean POM Crafter (`pom-crafter`):**
|
|
86
|
+
- Designs multi-language Page Classes, transpiles test frameworks (`omni_transpiler.py`, `universal_ir.py`), generates API mocks (`network_mock_shield.py`), checks API breaking changes (`api_drift_sentinel.py`), compiles stories to test suites (`generate_tc_from_story.py`), and maps methods (`repo_map.py`).
|
|
87
|
+
4. **Test Execution Runner (`test-runner`):**
|
|
88
|
+
- Dispatches headless suites, balances parallel CI runners (`matrix_sharder.py`), triggers CI auto-recovery (`ci_healing_hook.py`), filters verbose logs (`distill_log.py`), and isolates failing lines (`pinpoint_failure.py`).
|
|
89
|
+
5. **Failure Autopsy Analyst (`failure-analyst`):**
|
|
90
|
+
- Performs closed-loop diagnosis (`auto_heal.py`), auto-generates Jira/Markdown bug tickets with RCA (`bug_reporter.py`), executes CI self-healing & PR drafting (`ci_healing_hook.py`, `heal_pr_automator.py`), and resolves fixes from SQLite memory (`cache_resolver.py`).
|
|
91
|
+
6. **Quality Gatekeeper & Sentinel (`quality-gatekeeper`):**
|
|
92
|
+
- Enforces 8 Quality Gates (`verify_all.py`), scans fake passes (`infer_linter.py`), injects AST micro-mutants (`micro_mutator.py` requiring >= 80% mutation score), audits visual regression masks (`smart_visual_masker.py`), and checks DB leaks (`trace_data_flow.py`).
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 5. CENTRALIZED TOOLS RUNBOOK
|
|
97
|
+
|
|
98
|
+
All quality control and audit tasks are dispatched via scripts in `tools/` (Refer to `tools/TOOLS_RUNBOOK.md`):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# 1. Run 8 Quality Gates Verification
|
|
102
|
+
python tools/verify_all.py
|
|
103
|
+
|
|
104
|
+
# 2. Run AST linter for fake passes and empty catches
|
|
105
|
+
python tools/infer_linter.py
|
|
106
|
+
|
|
107
|
+
# 3. Analyze code change impact
|
|
108
|
+
python tools/test_impact.py --git-diff
|
|
109
|
+
|
|
110
|
+
# 4. Filter and distill verbose CLI logs by 95%
|
|
111
|
+
python tools/distill_log.py <path_to_log>
|
|
112
|
+
|
|
113
|
+
# 5. Query zero-token error memory cache
|
|
114
|
+
python tools/cache_resolver.py query "<error_message>"
|
|
115
|
+
```
|
package/README.md
CHANGED
|
@@ -1,3 +1,395 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🧠 Synapse Hub — AI Agent Intelligence Core & Skill Network
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **The shared intelligence core and autonomous skill hub empowering AI coding assistants (Google Antigravity / Cursor / Windsurf / Claude Code) across automated testing suites.**
|
|
4
|
+
> **Tác giả / Author:** Thế Vị ([@TeeVee998](https://github.com/TeeVee998))
|
|
5
|
+
> **Phiên bản Hub:** `v2.0.0` (Semantic Versioning) | **Chỉ số toàn vẹn:** 27 Skills, 6 Agent Swarm Roles, 7 Core Rules, 20+ Python Tools.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🌟 1. Tổng quan & Mục đích Kiến trúc
|
|
10
|
+
|
|
11
|
+
**Synapse Hub** là tầng trí tuệ đa tác tử tách rời (**Decoupled Shared Intelligence Core**), đóng vai trò như một **"Bộ não dùng chung"**, tách biệt hoàn toàn khỏi mã nguồn của từng dự án cụ thể. Dự án trang bị cho AI agents các vai trò bầy đàn chuyên biệt (Multi-Agent Swarm), quy trình tự chữa lành (Self-Healing), khả năng thấu hiểu mã nguồn cấp độ AST và các cổng chất lượng nghiêm ngặt (Quality Gates)—cho phép tự động hóa kiểm thử chuẩn xác tuyệt đối trên mọi codebase mà không làm bẩn repository mục tiêu.
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
flowchart TD
|
|
15
|
+
subgraph Hub["🧠 Synapse Hub (Intelligence Core v2.0.0)"]
|
|
16
|
+
Skills[".agents/skills/ (27 Skills)"]
|
|
17
|
+
Agents[".agents/agents/ (6 Specialized Roles)"]
|
|
18
|
+
Rules[".agents/rules/ (7 Core Rules)"]
|
|
19
|
+
Tools["tools/ (20+ Universal Python Tools)"]
|
|
20
|
+
Workflows[".agents/workflows/"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
subgraph ChatSession["💬 AI Agent Workspace / Chat Session"]
|
|
24
|
+
Hub -->|Mount/Add Workspace| ChatSession
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
subgraph Projects["📁 Các Dự Án Mục Tiêu (Target Projects)"]
|
|
28
|
+
ProjectA["Dự án A<br/>(PROJECT_AI_GUIDE.md + Source Code)"]
|
|
29
|
+
ProjectB["Dự án B<br/>(PROJECT_AI_GUIDE.md + Test Code)"]
|
|
30
|
+
ProjectC["Dự án C<br/>(PROJECT_AI_GUIDE.md + App Code)"]
|
|
31
|
+
Other["Dự án khác..."]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
ProjectA -->|Mount Workspace| ChatSession
|
|
35
|
+
ProjectB -.->|Mount Workspace| ChatSession
|
|
36
|
+
ProjectC -.->|Mount Workspace| ChatSession
|
|
37
|
+
Other -.->|Mount Workspace| ChatSession
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Lợi ích cốt lõi:
|
|
41
|
+
1. **Dùng chung đa dự án (Cross-Project Reusability):** Một lần phát triển skill hay tối ưu tool có thể áp dụng ngay cho bất kỳ dự án Web/API nào (React, Angular, Vue, Next.js, Java, Python).
|
|
42
|
+
2. **Bảo mật mã nguồn công ty (Privacy & Clean SCM):** Repository dự án hoàn toàn sạch sẽ, không chứa prompt hay AI skill cá nhân.
|
|
43
|
+
3. **Quản lý tập trung (Single Source of Truth):** Dễ dàng nâng cấp, thêm skill mới, đồng bộ Global Memory Cache tại một nơi duy nhất.
|
|
44
|
+
4. **Nhẹ & Tinh gọn:** Dự án mục tiêu chỉ cần đúng **1 file duy nhất** hướng dẫn AI (`PROJECT_AI_GUIDE.md`).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🚀 2. Cách Sử Dụng (NPM / npx & Workspace Mount)
|
|
49
|
+
|
|
50
|
+
### Cách A: Sử dụng tức thì qua NPM / npx (Khuyên dùng cho Web, Node & Playwright)
|
|
51
|
+
Tại thư mục bất kỳ của dự án đích, bạn có thể thực thi ngay mà không cần clone hay cài đặt trước:
|
|
52
|
+
```bash
|
|
53
|
+
# 1-Click Bootstrap dự án (tự động sinh PROJECT_AI_GUIDE.md, cài pre-push hook, trích xuất AST map)
|
|
54
|
+
npx synapse-hub setup
|
|
55
|
+
|
|
56
|
+
# Chạy kiểm tra 8 Quality Gates DoD
|
|
57
|
+
npx synapse-hub verify
|
|
58
|
+
|
|
59
|
+
# Đánh giá sức khỏe dự án toàn diện (5-in-1 Project Health Report)
|
|
60
|
+
npx synapse-hub analyze
|
|
61
|
+
|
|
62
|
+
# Cài đặt cố định vào devDependencies của dự án mục tiêu
|
|
63
|
+
npm install -D synapse-hub
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Cách B: Mở phiên làm việc đa thư mục (Multi-Root Workspace)
|
|
67
|
+
Trong IDE (Google Antigravity / VS Code / Cursor):
|
|
68
|
+
1. Mở thư mục dự án mục tiêu của bạn.
|
|
69
|
+
2. Thêm thư mục `agent-skills` vào Workspace (`File` -> `Add Folder to Workspace...`).
|
|
70
|
+
|
|
71
|
+
### Bước 2: Khởi tạo hướng dẫn dự án (`PROJECT_AI_GUIDE.md`)
|
|
72
|
+
Copy file mẫu từ `templates/PROJECT_AI_GUIDE_TEMPLATE.md` vào thư mục gốc của dự án mục tiêu, đổi tên thành `PROJECT_AI_GUIDE.md` và điền thông tin cụ thể:
|
|
73
|
+
- URL môi trường test/staging.
|
|
74
|
+
- Tài khoản và cơ chế đăng nhập.
|
|
75
|
+
- Cấu trúc thư mục mã nguồn.
|
|
76
|
+
- Lệnh chạy test headless và công nghệ sử dụng.
|
|
77
|
+
- **Dữ liệu tra cứu nhanh:** Khai báo đường dẫn `testcases.json` và `selectors.json` (hoặc đặt biến môi trường `TC_DATA_FILE` / `XPATH_DATA_FILE`) để công cụ `tools/lookup_tc.py` và `tools/lookup_xpath.py` nạp đúng dữ liệu của dự án.
|
|
78
|
+
|
|
79
|
+
### Bước 3: Cài đặt tự động (One-Click Bootstrap)
|
|
80
|
+
Chạy script cài đặt môi trường và phụ thuộc:
|
|
81
|
+
```powershell
|
|
82
|
+
# Windows PowerShell
|
|
83
|
+
./scripts/install.ps1
|
|
84
|
+
|
|
85
|
+
# Linux / macOS
|
|
86
|
+
./scripts/setup.sh
|
|
87
|
+
```
|
|
88
|
+
Script bootstrap sẽ tự động thiết lập `.venv`, cài dependencies, chạy lint kiểm tra 30 skills, và **khởi tạo nạp seed giải pháp ban đầu** cho SQLite Central Agent Memory (`~/.agent_memory/global_cache.db`).
|
|
89
|
+
|
|
90
|
+
> 💡 **Khởi tạo SQLite Memory trên CI/CD & Docker sạch:**
|
|
91
|
+
> Trên agent runner CI hoặc container Docker mới tinh, chạy lệnh sau để cấp quyền và khởi tạo bộ nhớ 0-token:
|
|
92
|
+
> ```bash
|
|
93
|
+
> agent-qa heal init
|
|
94
|
+
> # hoặc chạy trực tiếp:
|
|
95
|
+
> python tools/cache_resolver.py init
|
|
96
|
+
> ```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 👥 3. Hệ Thống Multi-Agent Swarm (6 Vai Trò Chuyên Biệt)
|
|
101
|
+
|
|
102
|
+
Hub phân chia năng lực rõ ràng cho 6 vai trò Agent, mỗi Agent được gán sẵn các Skills và Tools tương ứng:
|
|
103
|
+
|
|
104
|
+
| Vai Trò Agent | Trách Nhiệm Cốt Lõi | Skills Được Gán | Tools Đi Kèm |
|
|
105
|
+
| :--- | :--- | :--- | :--- |
|
|
106
|
+
| **`orchestrator`** | Trưởng nhóm điều phối, bootstrap dự án, audit sức khỏe, neo state. | `agent-orchestration-multi-agent-optimize`, `graphify-impact-analyzer`, `architecture-decision-records` | `tools/setup_project.py`, `tools/analyze_project.py`, `tools/project_state.py`, `tools/repo_map.py`, `tools/test_impact.py`, `tools/mcp_server.py` |
|
|
107
|
+
| **`live-explorer`** | Thám sát live DOM/AOM qua Playwright, chặn click phá hoại. | `playwright-live-interaction`, `self-healing-locator`, `visual-regression-sentinel`, `auth-session-and-cookie-manager` | `tools/safety_firewall.py`, `tools/lookup_xpath.py`, `tools/visual_diff_canvas.py`, `tools/browser_helpers.js` |
|
|
108
|
+
| **`pom-crafter`** | Kỹ sư Clean POM, kiểm tra API drift, sinh test từ User Story. | `clean-pom-crafter`, `lam-script-generator`, `synthetic-test-data-generator`, `api-spec-to-e2e-matrix`, `file-and-report-validator`, `db-state-verifier-and-seeder` | `tools/generate_tc_from_story.py`, `tools/generate_api_matrix.py`, `tools/api_drift_sentinel.py`, `tools/repo_map.py` |
|
|
109
|
+
| **`test-runner`** | Quản lý chạy test headless CLI, chia tải thời gian chạy trên CI. | `katalon-cli-runner`, `e2e-testing-patterns`, `bats-testing-patterns`, `auth-session-and-cookie-manager`, `flaky-test-sentinel-and-quarantine` | `tools/matrix_sharder.py`, `tools/distill_log.py`, `tools/pinpoint_failure.py`, `tools/flaky_detector.py` |
|
|
110
|
+
| **`failure-analyst`**| Tự động chẩn đoán lỗi, tính điểm tin cậy & tự tạo PR đối soát. | `failure-autopsy-and-healing`, `self-healing-locator`, `file-and-report-validator` | `tools/auto_heal.py`, `tools/heal_pr_automator.py`, `tools/pinpoint_failure.py`, `tools/cache_resolver.py` |
|
|
111
|
+
| **`quality-gatekeeper`**| Gác cổng chất lượng 7 Gates DoD, quét Fake-Pass, bơm mutant. | `antigravity-test-sentinel`, `code-refactoring-refactor-clean`, `wcag-audit-patterns`, `web-vitals-and-performance-profiler`, `db-state-verifier-and-seeder`, `security-dast-sentinel` | `tools/verify_all.py`, `tools/infer_linter.py`, `tools/micro_mutator.py`, `tools/trace_data_flow.py`, `tools/wcag_audit.py`, `tools/lint_ai_docs.py` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 📦 4. Danh Mục 27 Kỹ Năng Chuẩn Hóa (.agents/skills/)
|
|
116
|
+
|
|
117
|
+
| STT | Tên Kỹ Năng (Skill) | Phạm Vi Hoạt Động Cốt Lõi |
|
|
118
|
+
|:---:|---|---|
|
|
119
|
+
| 1 | `agent-orchestration-multi-agent-optimize` | Tối ưu hóa điều phối multi-agent, phân bổ tải và giám sát chi phí token. |
|
|
120
|
+
| 2 | `antigravity-test-sentinel` | Gác cổng Verification-First, khóa hoàn thành task nếu test chưa pass exit code 0. |
|
|
121
|
+
| 3 | `api-network-mocking-interception` | Chặn bắt, mock lưu lượng HTTP/GraphQL và kiểm thử độ bền mạng (Chaos/Resilience). |
|
|
122
|
+
| 4 | `api-spec-to-e2e-matrix` | Phân tích OpenAPI/Swagger để sinh ma trận kiểm thử tương đương, biên và lỗi. |
|
|
123
|
+
| 5 | `architecture-decision-records` | Soạn thảo và quản lý hồ sơ quyết định kiến trúc kỹ thuật (ADR). |
|
|
124
|
+
| 6 | `auth-session-and-cookie-manager` | Quản lý phiên đăng nhập, JWT tokens, storageState cho đăng nhập 0-giây. |
|
|
125
|
+
| 7 | `backend-load-and-stress-patterns` | Kiểm thử tải và stress backend với k6 & Locust, giám sát ngưỡng SLA P95/P99. |
|
|
126
|
+
| 8 | `bats-testing-patterns` | Kiểm thử tự động Shell Scripts, CI/CD pipelines, mock binary CLI và exit code. |
|
|
127
|
+
| 9 | `clean-pom-crafter` | Chuẩn hóa Clean Page Object Model, Flat Architecture, Dynamic `uniqueCode`. |
|
|
128
|
+
| 10 | `code-refactoring-refactor-clean` | Tái cấu trúc code chuyên sâu, khử code smells, nợ kỹ thuật và chuẩn SOLID. |
|
|
129
|
+
| 11 | `db-state-verifier-and-seeder` | Kiểm tra trạng thái DB trực tiếp (PostgreSQL, MySQL, MongoDB, Redis) và seed fixture. |
|
|
130
|
+
| 12 | `e2e-testing-patterns` | Kiến trúc E2E đa trình duyệt (Playwright/Cypress), Typed POM, sharding song song. |
|
|
131
|
+
| 13 | `failure-autopsy-and-healing` | Khám nghiệm tử thi lỗi cấp vĩ mô từ JUnit XML, Allure report và ảnh chụp lỗi. |
|
|
132
|
+
| 14 | `file-and-report-validator` | Kiểm định nội dung file tải về/tải lên (Excel .xlsx, CSV stream, PDF text/layout). |
|
|
133
|
+
| 15 | `flaky-test-sentinel-and-quarantine` | Phát hiện, chấm điểm và cô lập kiểm thử chập chờn (flaky test) vào vùng cách ly. |
|
|
134
|
+
| 16 | `github-actions-templates` | Mẫu pipeline CI/CD GitHub Actions chuẩn sản xuất và sharded testing. |
|
|
135
|
+
| 17 | `graphify-impact-analyzer` | Phân tích đồ thị tri thức AST Knowledge Graph và khoanh vùng ảnh hưởng thay đổi. |
|
|
136
|
+
| 18 | `katalon-cli-runner` | Điều phối thực thi headless KRE CLI, Community mode và dọn dẹp zombie driver. |
|
|
137
|
+
| 19 | `lam-script-generator` | Large Action Model, chuyển đổi User Story sang 100% test script không token replay. |
|
|
138
|
+
| 20 | `playwright-live-interaction` | Thám sát trực tiếp live DOM/AOM qua Playwright MCP, kiểm tra hit-rate < 200ms. |
|
|
139
|
+
| 21 | `security-dast-sentinel` | Kiểm thử bảo mật động DAST, rà soát OWASP Top 10, HTTP Headers, BOLA/IDOR. |
|
|
140
|
+
| 22 | `self-healing-locator` | Tự phục hồi locator vi mô bằng cây Semantic Accessibility (AOM), Role > Label > TestId. |
|
|
141
|
+
| 23 | `synthetic-test-data-generator` | Tự động sinh dữ liệu kiểm thử biên (BVT), chống SQLi/XSS, đa ngôn ngữ, tọa độ GIS. |
|
|
142
|
+
| 24 | `token-and-context-optimizer` | Tối ưu token, lọc log rác, chống suy thoái ngữ cảnh (Lost-in-the-Middle) và scratchpad đĩa. |
|
|
143
|
+
| 25 | `visual-regression-sentinel` | So sánh giao diện mức pixel và SSIM, hỗ trợ dynamic masking chống flaky test. |
|
|
144
|
+
| 26 | `wcag-audit-patterns` | Kiểm toán tiếp cận web WCAG 2.2 Level A/AA tự động qua AST và `@axe-core`. |
|
|
145
|
+
| 27 | `web-vitals-and-performance-profiler` | Đo lường Core Web Vitals (LCP, CLS, TTFB) và giám sát API endpoint chậm qua CDP. |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 📜 5. Danh Mục 7 Quy Tắc Cốt Lõi (.agents/rules/)
|
|
150
|
+
|
|
151
|
+
1. **`context-engineering.md`**: Giao thức lọc log thừa (Observation Masking), khai báo lười (Lazy Loading) và tối ưu hóa KV-Cache.
|
|
152
|
+
2. **`git-push-protocol.md`**: Giao thức Git Push chuẩn hóa cho dự án mục tiêu (Clean SCM by Architecture, loại bỏ hoàn toàn nhu cầu dual-remote/smart-push nhờ tách repo độc lập).
|
|
153
|
+
3. **`graphify.md`**: Điều hướng đồ thị tri thức mã nguồn AST thay vì đọc toàn văn mã nguồn lớn.
|
|
154
|
+
4. **`lessons-learned.md`**: Danh sách bài học kinh nghiệm và anti-patterns (giới hạn cứng < 40 dòng).
|
|
155
|
+
5. **`mandatory-playwright-live.md`**: Quy chuẩn chạy headless Full HD 1920x1080 và khảo sát live DOM trước khi codify.
|
|
156
|
+
6. **`skill-precedence.md`**: Thứ tự ưu tiên kỹ năng cục bộ, chống xung đột trigger với plugin bên ngoài.
|
|
157
|
+
7. **`systematic-debugging.md`**: Kỷ luật điều tra lỗi có căn cứ, cấm đoán mò và verify-first (7 Quality Gates).
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 🛠️ 6. Sổ Tay Công Cụ Tự Động Hóa (tools/ & scripts/)
|
|
162
|
+
|
|
163
|
+
Chi tiết đầy đủ xem tại [tools/TOOLS_RUNBOOK.md](tools/TOOLS_RUNBOOK.md):
|
|
164
|
+
|
|
165
|
+
- `tools/verify_all.py`: Cổng thẩm định 7 Gates DoD (UTF-8, No XPaths, UniqueCode, Clean POM).
|
|
166
|
+
- `tools/infer_linter.py`: Phân tích tĩnh AST phát hiện fake-pass (0 assertion) và khối try-catch nuốt lỗi.
|
|
167
|
+
- `tools/test_impact.py`: Phân tích git diff và khoanh vùng chính xác test cases bị ảnh hưởng.
|
|
168
|
+
- `tools/cache_resolver.py`: Quản lý bộ nhớ đệm lỗi SQLite trung tâm (`~/.agent_memory/global_cache.db`).
|
|
169
|
+
- `tools/distill_log.py`: Lọc bỏ 95% log thừa từ CLI/Gradle/KRE, giữ lại stacktrace và file pointer.
|
|
170
|
+
- `tools/agent_canary.py`: Hệ thống tiêm 8 vector lỗi tự động đánh giá sức phục hồi của Agent (MTTR).
|
|
171
|
+
- `tools/repo_map.py`: Trích xuất bản đồ cấu trúc hàm và Page Class siêu nén (~500 tokens).
|
|
172
|
+
- `tools/visual_diff_canvas.py`: So sánh pixel/SSIM cho màn hình GIS/Canvas không có DOM.
|
|
173
|
+
- `tools/wcag_audit.py`: Quét kiểm toán tự động các tiêu chí tiếp cận WCAG 2.2 Level A/AA.
|
|
174
|
+
- `tools/generate_api_matrix.py`: Tự động sinh ma trận kiểm thử Positive/Boundary/Negative từ Swagger.
|
|
175
|
+
- `tools/generate_tc_from_story.py`: Large Action Model parser sinh khung Clean POM từ User Story.
|
|
176
|
+
- `tools/trace_data_flow.py`: Kiểm tra luồng dữ liệu kiểm thử, phát hiện rác dữ liệu DB (Orphan Data).
|
|
177
|
+
- `scripts/install.ps1` & `scripts/setup.sh`: Script cài đặt 1-click tự động khởi tạo môi trường Hub.
|
|
178
|
+
- `scripts/lint_skills.ps1`: Linter kiểm tra tính toàn vẹn 30 skills và metadata manifest.
|
|
179
|
+
- `pyproject.toml` & `tools/cli.py`: Đóng gói chuẩn PEP 621 cho lệnh CLI toàn cầu `agent-qa`.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📚 7. Tài Liệu Kỹ Thuật Mở Rộng & CLI Package (docs/)
|
|
184
|
+
|
|
185
|
+
1. **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)**: Kiến trúc Hub/Spoke, mô hình 4 tầng kỹ năng, và ma trận phối hợp 6 Subagent Swarm.
|
|
186
|
+
2. **[docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)**: Quy chuẩn đóng góp, nguyên tắc sáng tạo skill mới và quy trình kiểm định toàn vẹn.
|
|
187
|
+
3. **[docs/CLI_REFERENCE.md](docs/CLI_REFERENCE.md)**: Cẩm nang tra cứu toàn bộ tham số lệnh của công cụ dòng lệnh `agent-qa`.
|
|
188
|
+
|
|
189
|
+
### Cài đặt nhanh CLI Package:
|
|
190
|
+
```bash
|
|
191
|
+
pip install -e .
|
|
192
|
+
agent-qa --help
|
|
193
|
+
agent-qa verify
|
|
194
|
+
agent-qa lint
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
# 🌐 English Edition
|
|
200
|
+
|
|
201
|
+
# 🧠 Synapse Hub — AI Agent Intelligence Core & Skill Network
|
|
202
|
+
|
|
203
|
+
> **The shared intelligence core and autonomous skill hub empowering AI coding assistants (Google Antigravity / Cursor / Windsurf / Claude Code) across automated testing suites.**
|
|
204
|
+
> **Author:** Thế Vị ([@TeeVee998](https://github.com/TeeVee998))
|
|
205
|
+
> **Hub Version:** `v2.0.0` (Semantic Versioning) | **Integrity Index:** 27 Skills, 6 Agent Swarm Roles, 7 Core Rules, 20+ Python Tools.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 🌟 1. Overview & Architectural Purpose
|
|
210
|
+
|
|
211
|
+
**Synapse Hub** serves as a **Decoupled Shared Intelligence Core**, acting as an external neural brain completely isolated from target projects' codebases. It equips AI agents with specialized swarm roles, self-healing execution protocols, AST-level code intelligence, and strict Quality Gates—enabling zero-leakage, truth-anchored test automation across any polyglot codebase without polluting target repositories.
|
|
212
|
+
|
|
213
|
+
```mermaid
|
|
214
|
+
flowchart TD
|
|
215
|
+
subgraph Hub["🧠 Synapse Hub (Intelligence Core v2.0.0)"]
|
|
216
|
+
Skills[".agents/skills/ (27 Skills)"]
|
|
217
|
+
Agents[".agents/agents/ (6 Specialized Roles)"]
|
|
218
|
+
Rules[".agents/rules/ (7 Core Rules)"]
|
|
219
|
+
Tools["tools/ (20+ Universal Python Tools)"]
|
|
220
|
+
Workflows[".agents/workflows/"]
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
subgraph ChatSession["💬 AI Agent Workspace / Chat Session"]
|
|
224
|
+
Hub -->|Mount/Add Workspace| ChatSession
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
subgraph Projects["📁 Target Projects"]
|
|
228
|
+
ProjectA["Project A<br/>(PROJECT_AI_GUIDE.md + Source Code)"]
|
|
229
|
+
ProjectB["Project B<br/>(PROJECT_AI_GUIDE.md + Test Code)"]
|
|
230
|
+
ProjectC["Project C<br/>(PROJECT_AI_GUIDE.md + App Code)"]
|
|
231
|
+
Other["Other Projects..."]
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
ProjectA -->|Mount Workspace| ChatSession
|
|
235
|
+
ProjectB -.->|Mount Workspace| ChatSession
|
|
236
|
+
ProjectC -.->|Mount Workspace| ChatSession
|
|
237
|
+
Other -.->|Mount Workspace| ChatSession
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Core Architectural Benefits:
|
|
241
|
+
1. **Cross-Project Reusability:** Develop skills and tools once; reuse universally across any Web/API stack (React, Angular, Vue, Next.js, Java, Python).
|
|
242
|
+
2. **Target Repository Privacy & Clean SCM:** Target project repos remain 100% clean—zero personal AI prompts or agent skills polluting production Git history.
|
|
243
|
+
3. **Single Source of Truth:** Manage, upgrade, add new skills, and synchronize Global Memory Cache in one centralized hub.
|
|
244
|
+
4. **Lean & Lightweight Integration:** Target projects require only **a single markdown guide** (`PROJECT_AI_GUIDE.md`).
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 🚀 2. Getting Started & Usage (NPM / npx & Workspace Mount)
|
|
249
|
+
|
|
250
|
+
### Method A: Instant Execution via NPM / npx (Recommended for Web, Node & Playwright)
|
|
251
|
+
Run commands directly from any target project directory without cloning or prior installation:
|
|
252
|
+
```bash
|
|
253
|
+
# 1-Click Project Bootstrap (generates PROJECT_AI_GUIDE.md, installs pre-push hook, extracts AST repo map)
|
|
254
|
+
npx synapse-hub setup
|
|
255
|
+
|
|
256
|
+
# Run 8 Quality Gates DoD Verification
|
|
257
|
+
npx synapse-hub verify
|
|
258
|
+
|
|
259
|
+
# Comprehensive 5-in-1 Project Health Audit
|
|
260
|
+
npx synapse-hub analyze
|
|
261
|
+
|
|
262
|
+
# Install permanently as a devDependency in target project
|
|
263
|
+
npm install -D synapse-hub
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Method B: Multi-Root Workspace Mounting
|
|
267
|
+
Within your AI IDE (Google Antigravity / VS Code / Cursor):
|
|
268
|
+
1. Open your target project folder.
|
|
269
|
+
2. Add the `synapse-hub` directory to your workspace (`File` -> `Add Folder to Workspace...`).
|
|
270
|
+
|
|
271
|
+
### Step 2: Initialize Project AI Guide (`PROJECT_AI_GUIDE.md`)
|
|
272
|
+
Copy `templates/PROJECT_AI_GUIDE_TEMPLATE.md` to target project root, rename to `PROJECT_AI_GUIDE.md`, and configure:
|
|
273
|
+
- Test/staging environment URLs.
|
|
274
|
+
- Credentials and authentication strategies.
|
|
275
|
+
- Source code directory structure.
|
|
276
|
+
- Headless execution commands and technology stack.
|
|
277
|
+
- **Fast-Lookup Registers:** Point `testcases.json` and `selectors.json` (or set `TC_DATA_FILE` / `XPATH_DATA_FILE` env vars) for instant zero-token query via `tools/lookup_tc.py` and `tools/lookup_xpath.py`.
|
|
278
|
+
|
|
279
|
+
### Step 3: One-Click Environment Bootstrap
|
|
280
|
+
Execute the automated bootstrap script:
|
|
281
|
+
```powershell
|
|
282
|
+
# Windows PowerShell
|
|
283
|
+
./scripts/install.ps1
|
|
284
|
+
|
|
285
|
+
# Linux / macOS
|
|
286
|
+
./scripts/setup.sh
|
|
287
|
+
```
|
|
288
|
+
The bootstrap script automatically configures `.venv`, installs dependencies, lints skills, and seeds initial solutions into the Central SQLite Agent Memory (`~/.agent_memory/global_cache.db`).
|
|
289
|
+
|
|
290
|
+
> 💡 **Initializing SQLite Memory on Clean CI/CD & Docker:**
|
|
291
|
+
> In fresh CI runners or Docker containers, initialize zero-token memory cache via:
|
|
292
|
+
> ```bash
|
|
293
|
+
> agent-qa heal init
|
|
294
|
+
> # or run directly:
|
|
295
|
+
> python tools/cache_resolver.py init
|
|
296
|
+
> ```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## 👥 3. Multi-Agent Swarm System (6 Specialized Roles)
|
|
301
|
+
|
|
302
|
+
Synapse Hub clearly partitions capabilities across 6 specialized AI roles, pre-configured with dedicated skills and tools:
|
|
303
|
+
|
|
304
|
+
| Agent Role | Core Responsibility | Assigned Skills | Included Tools |
|
|
305
|
+
| :--- | :--- | :--- | :--- |
|
|
306
|
+
| **`orchestrator`** | Lead coordinator, project bootstrapping, health auditing, state anchoring. | `agent-orchestration-multi-agent-optimize`, `graphify-impact-analyzer`, `architecture-decision-records` | `tools/setup_project.py`, `tools/analyze_project.py`, `tools/project_state.py`, `tools/repo_map.py`, `tools/test_impact.py`, `tools/mcp_server.py` |
|
|
307
|
+
| **`live-explorer`** | Live DOM/AOM probing via Playwright MCP, destructive click firewall. | `playwright-live-interaction`, `self-healing-locator`, `visual-regression-sentinel`, `auth-session-and-cookie-manager` | `tools/safety_firewall.py`, `tools/lookup_xpath.py`, `tools/visual_diff_canvas.py`, `tools/browser_helpers.js` |
|
|
308
|
+
| **`pom-crafter`** | Clean POM engineer, API drift detection, User Story to test generation. | `clean-pom-crafter`, `lam-script-generator`, `synthetic-test-data-generator`, `api-spec-to-e2e-matrix`, `file-and-report-validator`, `db-state-verifier-and-seeder` | `tools/generate_tc_from_story.py`, `tools/generate_api_matrix.py`, `tools/api_drift_sentinel.py`, `tools/repo_map.py` |
|
|
309
|
+
| **`test-runner`** | Headless CLI suite manager, CI parallel sharding and log distillation. | `katalon-cli-runner`, `e2e-testing-patterns`, `bats-testing-patterns`, `auth-session-and-cookie-manager`, `flaky-test-sentinel-and-quarantine` | `tools/matrix_sharder.py`, `tools/distill_log.py`, `tools/pinpoint_failure.py`, `tools/flaky_detector.py` |
|
|
310
|
+
| **`failure-analyst`**| Automated closed-loop failure triage, MTTR scoring, self-healing PR drafting. | `failure-autopsy-and-healing`, `self-healing-locator`, `file-and-report-validator` | `tools/auto_heal.py`, `tools/heal_pr_automator.py`, `tools/pinpoint_failure.py`, `tools/cache_resolver.py` |
|
|
311
|
+
| **`quality-gatekeeper`**| Enforces 8 Quality Gates DoD, scans fake passes, runs AST mutation testing. | `antigravity-test-sentinel`, `code-refactoring-refactor-clean`, `wcag-audit-patterns`, `web-vitals-and-performance-profiler`, `db-state-verifier-and-seeder`, `security-dast-sentinel` | `tools/verify_all.py`, `tools/infer_linter.py`, `tools/micro_mutator.py`, `tools/trace_data_flow.py`, `tools/wcag_audit.py`, `tools/lint_ai_docs.py` |
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## 📦 4. Standardized 27 Skills Catalog (.agents/skills/)
|
|
316
|
+
|
|
317
|
+
| # | Skill Name | Core Operational Scope |
|
|
318
|
+
|:---:|---|---|
|
|
319
|
+
| 1 | `agent-orchestration-multi-agent-optimize` | Multi-agent coordination profiling, workload distribution, and token cost budgeting. |
|
|
320
|
+
| 2 | `antigravity-test-sentinel` | Verification-First sentinel, locking task completion until exit code 0 is proven. |
|
|
321
|
+
| 3 | `api-network-mocking-interception` | HTTP/GraphQL request interception, route stubbing, and chaos network resilience testing. |
|
|
322
|
+
| 4 | `api-spec-to-e2e-matrix` | Transforms OpenAPI/Swagger specifications into equivalence, boundary, and error test matrices. |
|
|
323
|
+
| 5 | `architecture-decision-records` | Documents and maintains technical Architecture Decision Records (ADR). |
|
|
324
|
+
| 6 | `auth-session-and-cookie-manager` | Manages sessions, JWT tokens, and storageState for zero-second authentications. |
|
|
325
|
+
| 7 | `backend-load-and-stress-patterns` | Backend load/stress testing via k6 & Locust with P95/P99 SLA threshold assertions. |
|
|
326
|
+
| 8 | `bats-testing-patterns` | Automated testing for Shell scripts, CI/CD pipelines, CLI mocks, and exit codes. |
|
|
327
|
+
| 9 | `clean-pom-crafter` | Clean Page Object Model standards, Flat Architecture, and dynamic `uniqueCode` test data. |
|
|
328
|
+
| 10 | `code-refactoring-refactor-clean` | Clean code refactoring, code smells elimination, technical debt remediation, and SOLID. |
|
|
329
|
+
| 11 | `db-state-verifier-and-seeder` | Direct DB state assertions (PostgreSQL, MySQL, MongoDB, Redis) and isolated fixtures. |
|
|
330
|
+
| 12 | `e2e-testing-patterns` | Multi-browser E2E testing architecture (Playwright/Cypress), Typed POM, parallel sharding. |
|
|
331
|
+
| 13 | `failure-autopsy-and-healing` | Automated failure triage from JUnit XML, Allure reports, and visual error screenshots. |
|
|
332
|
+
| 14 | `file-and-report-validator` | Verifies uploaded/downloaded files (Excel .xlsx, streaming CSV, PDF text/layout). |
|
|
333
|
+
| 15 | `flaky-test-sentinel-and-quarantine` | Flaky test detection, flakiness index scoring, and quarantine isolation governance. |
|
|
334
|
+
| 16 | `github-actions-templates` | Production-ready GitHub Actions CI/CD workflows and sharded testing matrix. |
|
|
335
|
+
| 17 | `graphify-impact-analyzer` | AST Knowledge Graph navigation and zero-waste test impact analysis. |
|
|
336
|
+
| 18 | `katalon-cli-runner` | Headless KRE CLI execution coordinator, licensing fallback, and zombie driver cleanup. |
|
|
337
|
+
| 19 | `lam-script-generator` | Large Action Model generator compiling User Stories into 100% test scripts with zero replay. |
|
|
338
|
+
| 20 | `playwright-live-interaction` | Real-time DOM/AOM probing via Playwright MCP with sub-200ms selector verification. |
|
|
339
|
+
| 21 | `security-dast-sentinel` | Dynamic Application Security Testing (DAST), OWASP Top 10, Security Headers, BOLA/IDOR. |
|
|
340
|
+
| 22 | `self-healing-locator` | Micro-locator self-healing via Accessibility Tree (AOM), Role > Label > TestId hierarchy. |
|
|
341
|
+
| 23 | `synthetic-test-data-generator` | Robust synthetic boundary test data generation (BVT, anti-injection, multilingual, GIS). |
|
|
342
|
+
| 24 | `token-and-context-optimizer` | Context engineering, 95% log distillation, anti-degradation, and disk scratchpads. |
|
|
343
|
+
| 25 | `visual-regression-sentinel` | Pixel-level and SSIM visual regression testing with dynamic masking. |
|
|
344
|
+
| 26 | `wcag-audit-patterns` | Automated WCAG 2.2 Level A/AA accessibility auditing via AST and `@axe-core`. |
|
|
345
|
+
| 27 | `web-vitals-and-performance-profiler` | Core Web Vitals (LCP, CLS, TTFB) profiling and slow API endpoint detection via CDP. |
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## 📜 5. 7 Core Rules Catalog (.agents/rules/)
|
|
350
|
+
|
|
351
|
+
1. **`context-engineering.md`**: Observation masking, lazy progressive disclosure, and KV-cache optimization.
|
|
352
|
+
2. **`git-push-protocol.md`**: Clean git push protocol (decoupled architecture guarantees zero AI leakage).
|
|
353
|
+
3. **`graphify.md`**: Navigating the AST knowledge graph over reading entire large source files.
|
|
354
|
+
4. **`lessons-learned.md`**: Episodic anti-pattern blacklist (strictly capped under 40 lines).
|
|
355
|
+
5. **`mandatory-playwright-live.md`**: Mandatory headless Full HD 1920x1080 and live DOM probing before codifying.
|
|
356
|
+
6. **`skill-precedence.md`**: Tier-1 local skill precedence resolving external plugin collisions.
|
|
357
|
+
7. **`systematic-debugging.md`**: Evidence-first debugging discipline; zero guessing; 8 Quality Gates DoD.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 🛠️ 6. Automated Tools Runbook (tools/ & scripts/)
|
|
362
|
+
|
|
363
|
+
For full details, refer to [tools/TOOLS_RUNBOOK.md](tools/TOOLS_RUNBOOK.md):
|
|
364
|
+
|
|
365
|
+
- `tools/verify_all.py`: 8 Quality Gates DoD verification (UTF-8, No XPaths, UniqueCode, Clean POM).
|
|
366
|
+
- `tools/infer_linter.py`: Static AST analysis detecting fake passes (zero asserts) and empty catch blocks.
|
|
367
|
+
- `tools/test_impact.py`: Scopes affected test cases based on git diffs.
|
|
368
|
+
- `tools/cache_resolver.py`: Manages the central SQLite error memory cache (`~/.agent_memory/global_cache.db`).
|
|
369
|
+
- `tools/distill_log.py`: Filters 95% noise from CLI/Gradle/KRE logs, preserving stacktraces and pointers.
|
|
370
|
+
- `tools/agent_canary.py`: Injects 8 failure vectors to benchmark MTTR and autonomous recovery rate.
|
|
371
|
+
- `tools/repo_map.py`: Extracts a compressed method and Page Class map (~500 tokens).
|
|
372
|
+
- `tools/visual_diff_canvas.py`: Pixel/SSIM comparison for canvas/GIS interfaces lacking standard DOM.
|
|
373
|
+
- `tools/wcag_audit.py`: Automated scanning for WCAG 2.2 Level A/AA criteria.
|
|
374
|
+
- `tools/generate_api_matrix.py`: Generates positive, boundary, and negative test matrices from Swagger/OpenAPI.
|
|
375
|
+
- `tools/generate_tc_from_story.py`: Large Action Model parser generating Clean POM skeletons from stories.
|
|
376
|
+
- `tools/trace_data_flow.py`: Taint analysis tracking test data flow and preventing database orphan junk.
|
|
377
|
+
- `scripts/install.ps1` & `scripts/setup.sh`: 1-click bootstrap scripts setting up the hub environment.
|
|
378
|
+
- `scripts/lint_skills.ps1`: Linter verifying skill integrity and metadata manifest.
|
|
379
|
+
- `pyproject.toml` & `tools/cli.py`: PEP 621 packaging for the global `agent-qa` CLI.
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## 📚 7. Extended Technical Documentation & CLI Package (docs/)
|
|
384
|
+
|
|
385
|
+
1. **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)**: Hub/Spoke architecture, 4-tier skill model, and 6-agent swarm coordination.
|
|
386
|
+
2. **[docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)**: Contribution standards, new skill authoring principles, and verification pipelines.
|
|
387
|
+
3. **[docs/CLI_REFERENCE.md](docs/CLI_REFERENCE.md)**: Comprehensive command-line reference for the `agent-qa` CLI.
|
|
388
|
+
|
|
389
|
+
### Quick CLI Installation:
|
|
390
|
+
```bash
|
|
391
|
+
pip install -e .
|
|
392
|
+
agent-qa --help
|
|
393
|
+
agent-qa verify
|
|
394
|
+
agent-qa lint
|
|
395
|
+
```
|
package/bin/agent-qa.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Enterprise Synapse-Hub NPM Launcher
|
|
4
|
+
* ====================================
|
|
5
|
+
* Dispatches CLI subcommands to the underlying Python Standard Library engine (tools/cli.py).
|
|
6
|
+
* Provides cross-platform zero-install execution via `npx synapse-hub <command>`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { spawn, execSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
14
|
+
const CLI_PATH = path.join(REPO_ROOT, 'tools', 'cli.py');
|
|
15
|
+
|
|
16
|
+
// ANSI Color Helpers
|
|
17
|
+
const RED = '\x1b[91m';
|
|
18
|
+
const GREEN = '\x1b[92m';
|
|
19
|
+
const YELLOW = '\x1b[93m';
|
|
20
|
+
const CYAN = '\x1b[96m';
|
|
21
|
+
const BOLD = '\x1b[1m';
|
|
22
|
+
const RESET = '\x1b[0m';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the available Python 3 executable across Windows, macOS, and Linux.
|
|
26
|
+
*/
|
|
27
|
+
function resolvePython() {
|
|
28
|
+
const candidates = process.platform === 'win32'
|
|
29
|
+
? ['python', 'py', 'python3']
|
|
30
|
+
: ['python3', 'python'];
|
|
31
|
+
|
|
32
|
+
for (const cmd of candidates) {
|
|
33
|
+
try {
|
|
34
|
+
const output = execSync(`${cmd} --version`, { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
35
|
+
const match = output.match(/Python\s+(\d+)\.(\d+)/i);
|
|
36
|
+
if (match) {
|
|
37
|
+
const major = parseInt(match[1], 10);
|
|
38
|
+
const minor = parseInt(match[2], 10);
|
|
39
|
+
if (major > 3 || (major === 3 && minor >= 9)) {
|
|
40
|
+
return { command: cmd, version: output };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// Continue checking next candidate
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function main() {
|
|
51
|
+
const python = resolvePython();
|
|
52
|
+
|
|
53
|
+
if (!python) {
|
|
54
|
+
console.error(`\n${BOLD}${RED}[ERROR] Python 3.9+ is required to execute synapse-hub tools.${RESET}`);
|
|
55
|
+
console.error(`Neither ${CYAN}python3${RESET} nor ${CYAN}python${RESET} (>= 3.9) was found on your PATH.`);
|
|
56
|
+
console.error(`👉 Please install Python from: ${BOLD}https://www.python.org/downloads/${RESET}\n`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!fs.existsSync(CLI_PATH)) {
|
|
61
|
+
console.error(`\n${BOLD}${RED}[ERROR] Core CLI engine not found at: ${CLI_PATH}${RESET}\n`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const args = [CLI_PATH, ...process.argv.slice(2)];
|
|
66
|
+
|
|
67
|
+
// Spawn child Python process inheriting standard IO
|
|
68
|
+
const child = spawn(python.command, args, {
|
|
69
|
+
stdio: 'inherit',
|
|
70
|
+
env: { ...process.env, AGENT_QA_INVOKER: 'npm' }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
child.on('error', (err) => {
|
|
74
|
+
console.error(`\n${BOLD}${RED}[ERROR] Failed to start synapse-hub CLI:${RESET}`, err.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
child.on('exit', (code, signal) => {
|
|
79
|
+
if (signal) {
|
|
80
|
+
process.kill(process.pid, signal);
|
|
81
|
+
} else {
|
|
82
|
+
process.exit(code ?? 0);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
process.on('SIGINT', () => child.kill('SIGINT'));
|
|
87
|
+
process.on('SIGTERM', () => child.kill('SIGTERM'));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main();
|