synapse-hub 3.0.0 → 3.0.1

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 (65) hide show
  1. package/.agents/rules/communication-style.md +4 -0
  2. package/.agents/rules/context-engineering.md +1 -0
  3. package/.agents/rules/git-push-protocol.md +17 -0
  4. package/.agents/skills/agentless-qa-repair/examples/three_phase_repair_workflow.md +40 -0
  5. package/.agents/skills/antigravity-test-sentinel/examples/sprint_dod_enforcement.md +47 -0
  6. package/.agents/skills/auth-session-and-cookie-manager/examples/multi_role_auth_matrix.md +70 -0
  7. package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +52 -0
  8. package/.agents/skills/failure-autopsy-and-healing/examples/closed_loop_healing_walkthrough.md +48 -0
  9. package/.agents/skills/lean-impact-scoreboard/examples/sample_scoreboard.md +1 -1
  10. package/.agents/skills/mipro-prompt-compiler/examples/dspy_assertion_optimizer_case.md +46 -0
  11. package/.agents/skills/persistent-planning-files/SKILL.md +1 -1
  12. package/.agents/skills/qa-aci-interface/examples/surgical_code_window_walkthrough.md +40 -0
  13. package/.agents/skills/review-spec/examples/pocock_grilling_decision_rubric.md +40 -0
  14. package/.agents/skills/skillspector-security-guard/examples/audit_threat_vectors_report.json +35 -0
  15. package/.agents/skills/surgical-coding-principles/SKILL.md +1 -1
  16. package/.agents/skills/tot-exploratory-testing/examples/payment_gateway_tot_tree.json +62 -0
  17. package/.agents/skills/verification-before-completion/SKILL.md +2 -2
  18. package/.agents/skills/verification-before-completion/examples/evidence_log_example.md +2 -2
  19. package/.agents/skills/web-agent-gym-benchmarking/examples/enterprise_tasks_suite.json +38 -0
  20. package/.agents/skills/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +61 -0
  21. package/AGENTS.md +6 -4
  22. package/CLAUDE.md +1 -0
  23. package/README.en.md +8 -8
  24. package/README.md +3 -3
  25. package/action.yml +1 -1
  26. package/bin/agent-qa.js +2 -2
  27. package/docs/ARCHITECTURE.en.md +192 -0
  28. package/docs/ARCHITECTURE.md +127 -126
  29. package/docs/CI_CD_INTEGRATION.en.md +96 -0
  30. package/docs/CI_CD_INTEGRATION.md +24 -22
  31. package/docs/CLI_REFERENCE.en.md +174 -0
  32. package/docs/CLI_REFERENCE.md +120 -115
  33. package/docs/CONTRIBUTING.en.md +49 -0
  34. package/docs/CONTRIBUTING.md +25 -67
  35. package/docs/QUALITY_GATES.en.md +115 -0
  36. package/docs/QUALITY_GATES.md +82 -80
  37. package/docs/research/agent_skill_training_analysis.md +1 -1
  38. package/package.json +1 -1
  39. package/skills_manifest.json +1 -1
  40. package/synapse.config.json +1 -1
  41. package/templates/ai_bridges/CLAUDE.md +1 -0
  42. package/tools/__init__.py +1 -1
  43. package/tools/auto_heal_reflexion.py +8 -0
  44. package/tools/browser_helpers.js +2 -2
  45. package/tools/bump_version.py +15 -14
  46. package/tools/check_version_sync.py +24 -7
  47. package/tools/cli.py +3 -3
  48. package/tools/contract_validator.py +141 -0
  49. package/tools/dashboard_generator.py +11 -11
  50. package/tools/db_sandbox.py +22 -9
  51. package/tools/generate_allure_report.py +1 -1
  52. package/tools/infer_linter.py +135 -21
  53. package/tools/mcp_excel_server.py +1 -1
  54. package/tools/mcp_server.py +7 -4
  55. package/tools/micro_mutator.py +21 -3
  56. package/tools/reversible_sandbox.py +2 -2
  57. package/tools/senior_code_review.py +2 -1
  58. package/tools/skill_vault.py +82 -3
  59. package/tools/skillspector.py +5 -1
  60. package/tools/sync_agent_rules.py +1 -0
  61. package/tools/test_impact.py +2 -1
  62. package/tools/update_sentinel.py +3 -3
  63. package/tools/verify_all.py +2 -2
  64. package/tools/visual_diff_canvas.py +3 -2
  65. package/tools/welcome_page.py +1 -1
@@ -1,34 +1,34 @@
1
- # Hướng Dẫn Đóng Góp / Contributing to Synapse-Hub
1
+ # Hướng Dẫn Đóng Góp Vào Synapse-Hub
2
2
 
3
- [🇻🇳 Tiếng Việt](#-hướng-dẫn-đóng-góp-tiếng-việt) | [🇬🇧 English Edition](#-english-edition)
3
+ [🇻🇳 Tiếng Việt](CONTRIBUTING.md) | [🇬🇧 English Edition](CONTRIBUTING.en.md)
4
4
 
5
- ---
6
-
7
- ## 🇻🇳 Hướng Dẫn Đóng Góp (Tiếng Việt)
5
+ Chào mừng bạn tham gia đóng góp mở rộng kỹ năng (Skills), công cụ (Tools) và các quy tắc kiểm thử trong hệ sinh thái **Synapse Hub**. Mọi đóng góp đều cần tuân thủ 2 nguyên tắc then chốt: **Truth Anchor** (chống test pass ảo, trung thực kỹ thuật) và **Tiết Kiệm Token Tối Đa**.
8
6
 
9
- Chúng tôi rất hoan nghênh các đóng góp từ cộng đồng nhằm mở rộng kỹ năng (Skills), công cụ (Tools) và các quy chuẩn kiểm thử trong hệ sinh thái **Synapse-Hub**. Mọi đóng góp đều cần tuân thủ triệt để nguyên tắc **Truth Anchor** (chống pass ảo, trung thực kỹ thuật) và **Tiết kiệm Token**.
7
+ ---
10
8
 
11
- ### 1. Quy Chuẩn Viết Kỹ Năng Mới (Skill Standards)
9
+ ## 1. Quy Chuẩn Khi Viết Kỹ Năng Mới (Skill Standards)
12
10
 
13
- Mỗi kỹ năng nằm trong thư mục `.agents/skills/<tên-kỹ-năng>/` và cần đáp ứng:
11
+ Mỗi kỹ năng nằm trong thư mục riêng `.agents/skills/<ten-ky-nang>/` và cần đáp ứng các tiêu chí sau:
14
12
 
15
- 1. **Cấu trúc tệp `SKILL.md`:**
13
+ 1. **Cấu trúc file `SKILL.md`:**
16
14
  - Bắt buộc có phần mở đầu YAML frontmatter chuẩn xác chứa `name` và `description`.
17
- - `name` phải trùng khớp 100% với tên thư mục (dạng `kebab-case`).
18
- - `description` mô tả rõ ràng phạm vi kích hoạt, phân biệt rành mạch với các kỹ năng lân cận để tránh xung đột prompt.
15
+ - `name` phải trùng khớp 100% với tên thư mục (định dạng `kebab-case`).
16
+ - `description` phải nêu rõ phạm vi và ngữ cảnh kích hoạt, phân biệt rõ ràng với các kỹ năng khác để AI không bao giờ gọi nhầm.
19
17
  2. **Ngắn Gọn & Tiết Kiệm Token:**
20
- - Hướng dẫn kỹ thuật viết bằng tiếng Anh ngắn gọn, chuẩn xác để tối ưu hóa lượng token ngữ cảnh cho AI.
21
- - Áp dụng nguyên lý nạp thông tin lũy tiến (Progressive Disclosure): giữ `SKILL.md` trong khoảng 40 đến 150 dòng; các đoạn code mẫu chi tiết đưa vào `examples/` hoặc `references/`.
22
- 3. **Không Ràng Buộc Vào Dự Án Cụ Thể (Decoupled):**
23
- - Tuyệt đối không gán cứng tên dự án riêng tư, domain bí mật, mật khẩu hay endpoint nội bộ.
24
- - Luôn sử dụng định danh mẫu: `https://staging.example.com`, `auto_user_123`.
18
+ - Nội dung chỉ dẫn kỹ thuật viết bằng tiếng Anh ngắn gọn, súc tích để tránh làm đầy ngữ cảnh của AI.
19
+ - Áp dụng nguyên lý tải thông tin lũy tiến (Progressive Disclosure): giữ file `SKILL.md` trong khoảng 40 đến 150 dòng; các đoạn code mẫu dài nên đưa vào thư mục `examples/` hoặc `references/`.
20
+ 3. **Tuyệt Đối Không Phụ Thuộc Vào Dự Án Cụ Thể (Decoupled):**
21
+ - Không được hardcode tên dự án nội bộ, domain riêng tư, mật khẩu hay endpoint bí mật.
22
+ - Luôn dùng định danh mẫu: `https://staging.example.com`, `auto_user_123`.
25
23
 
26
- ### 2. Quy Trình Kiểm Thử Trước Khi Mở Pull Request
24
+ ---
25
+
26
+ ## 2. Quy Trình Kiểm Thử Trước Khi Mở Pull Request
27
27
 
28
- Trước khi gửi PR hoặc đẩy code lên nhánh `develop`:
28
+ Trước khi mở PR hoặc đẩy code lên nhánh `develop`:
29
29
 
30
30
  ```bash
31
- # 1. Chạy toàn bộ 170+ bài kiểm thử đơn vị
31
+ # 1. Chạy toàn bộ 260+ bài unit test
32
32
  python3 -m unittest discover tests
33
33
 
34
34
  # 2. Kiểm định toàn vẹn 10 Cổng Chất Lượng DoD (Gate 0–9)
@@ -38,54 +38,12 @@ python3 tools/verify_all.py
38
38
  python3 tools/lint_ai_docs.py
39
39
  ```
40
40
 
41
- ### 3. Nguyên Tắc Phát Triển Công Cụ (Tools)
42
-
43
- Mọi công cụ tiện ích trong `tools/` cần tuân thủ:
44
- 1. **Ưu Tiên Thư Viện Chuẩn Python (Standard Library):** Hạn chế tối đa thư viện bên ngoài để công cụ chạy được ngay trên máy sạch và CI mà không cần cài đặt phức tạp.
45
- 2. **Tốc Độ Xử Lý Siêu Tốc:** Các phép quét AST và regex phải hoàn tất dưới 500ms.
46
- 3. **Không Ghi Rác Vào Repo:** Khi viết test, bắt buộc sử dụng thư mục tạm `tempfile.TemporaryDirectory()`, không để lại file rác trong repo.
47
- 4. **Thông Báo Lỗi Thân Thiện:** Luôn cung cấp gợi ý sửa lỗi rõ ràng (`Fix Hint`) thay vì chỉ in ra stacktrace thô.
48
-
49
41
  ---
50
42
 
51
- ## 🇬🇧 English Edition
52
-
53
- We welcome contributions to expand and refine skills, tools, and rules in the **Synapse-Hub** ecosystem. All contributions must adhere to our **Truth Anchor** (no fake passes) and **Token-Efficiency** standards.
54
-
55
- ### 1. Skill Authoring Standards
56
-
57
- Every skill resides in `.agents/skills/<skill-name>/` and must satisfy:
58
-
59
- 1. **`SKILL.md` Structure:**
60
- - Must contain valid YAML frontmatter with `name` and `description`.
61
- - `name` must exactly match the directory name in kebab-case.
62
- - `description` must clearly articulate the triggering scope and disambiguate itself from adjacent skills.
63
- 2. **Conciseness & Token Budget:**
64
- - Write instructions in concise technical English to minimize LLM token consumption.
65
- - Use progressive disclosure: keep `SKILL.md` between 40 and 150 lines, and offload deep code patterns to `references/` or `examples/`.
66
- 3. **Zero Project Coupling:**
67
- - Never hardcode specific project names, proprietary URLs, test credentials, or internal namespaces.
68
- - Always use generic placeholders: `<project_namespace>`, `https://app.example.com`, `APP_PASSWORD`.
69
-
70
- ### 2. Integrity Verification Workflow
71
-
72
- Before submitting a pull request or committing changes:
73
-
74
- ```bash
75
- # 1. Run unit test suite (170+ tests)
76
- python3 -m unittest discover tests
77
-
78
- # 2. Verify all 9 DoD Quality Gates
79
- python3 tools/verify_all.py
80
-
81
- # 3. Test documentation and entity references integrity
82
- python3 tools/lint_ai_docs.py
83
- ```
84
-
85
- ### 3. Tool Development Guidelines
43
+ ## 3. Nguyên Tắc Phát Triển Công Cụ Mới (Tools)
86
44
 
87
- All helper scripts in `tools/` must:
88
- 1. **Rely on Standard Libraries:** Minimize third-party package dependencies so tools execute seamlessly across clean host machines and CI pipelines.
89
- 2. **Be Fast & Non-Blocking:** AST scans and regex lookups must complete in under 500ms.
90
- 3. **Zero Test File Pollution:** Tests must use `tempfile.TemporaryDirectory()` and never write temporary test artifacts to the repository tree.
91
- 4. **Handle Errors Gracefully:** Provide clear remedies and pointers rather than dumping raw stack traces.
45
+ Mọi công cụ tiện ích trong thư mục `tools/` cần tuân thủ:
46
+ 1. **Ưu Tiên Thư Viện Chuẩn Python (Standard Library):** Hạn chế tối đa thư viện bên ngoài để công cụ chạy được ngay trên máy sạch và CI mà không cần `pip install` phức tạp.
47
+ 2. **Tốc Độ Xử Lý Phải Nhanh:** Các phép quét AST và regex phải hoàn tất dưới 500ms.
48
+ 3. **Không Làm Bẩn Repo:** Khi viết test cho công cụ, bắt buộc dùng thư mục tạm `tempfile.TemporaryDirectory()`, không được để lại bất kỳ file rác nào trong repo.
49
+ 4. **Báo Lỗi Thân Thiện Kèm Cách Sửa:** Luôn cung cấp gợi ý khắc phục (`Fix Hint`) rõ ràng thay vì chỉ in ra stacktrace thô.
@@ -0,0 +1,115 @@
1
+ # 🛡️ 10 Quality Gates Definition of Done (DoD) Standard
2
+
3
+ [🇻🇳 Tiếng Việt](QUALITY_GATES.md) | [🇬🇧 English Edition](QUALITY_GATES.en.md)
4
+
5
+ > **Scope:** Enterprise automated verification sentinel enforcing 10 non-negotiable Quality Gates across Synapse Hub and target client projects.
6
+ > **Command:** `python3 tools/verify_all.py` or `npx synapse-hub verify`
7
+ > **Integrity Guard:** Synapse Hub created by **Thế Vị (@TeeVee998)** (<https://github.com/TeeVee998/Synapse-Hub>) under MIT License.
8
+
9
+ ---
10
+
11
+ ## 📋 Quality Gates Matrix Overview
12
+
13
+ | Gate | Name | Target Scope | Engine / Tool | Exit Code | Passing Criteria (DoD) |
14
+ | :---: | :--- | :--- | :--- | :---: | :--- |
15
+ | **Gate 0** | **Author Attribution & MIT Integrity** | Repository-wide | `tools/author_integrity.py` | 0 | MIT License notice and author attribution intact across all source files. |
16
+ | **Gate 1** | **UTF-8 No BOM Encoding** | All source & config files | `tools/verify_all.py` | 0 | Zero Byte Order Mark (`0xEF, 0xBB, 0xBF`) bytes across any file. |
17
+ | **Gate 2** | **Path Portability** | All source & test files | `tools/verify_all.py` | 0 | Zero hardcoded personal/machine absolute paths (`/Users/...`, `C:\...`). |
18
+ | **Gate 3** | **Clean POM & Flat Architecture** | Test scripts (`tests/`, `Scripts/`) | `tools/verify_all.py` | 0 | Zero raw XPaths or CSS selectors in test scripts; 100% locators encapsulated in Page Classes. |
19
+ | **Gate 4** | **AI Documentation & Anti-Drift** | `PROJECT_AI_GUIDE.md` & AST | `tools/lint_ai_docs.py` | 0 | 0 hallucinated PageClasses; 100% documented methods exist in codebase AST. |
20
+ | **Gate 5** | **Temporary Files Blacklist** | Repository tree | `tools/verify_all.py` | 0 | Zero scratch files, heap dumps, or temporary artifacts (`*.tmp`, `.ruff_cache`, memory dumps). |
21
+ | **Gate 6** | **Credential & Secret Security** | All files & git index | `tools/verify_all.py` | 0 | Zero plaintext passwords, API keys, private tokens, or AWS/JWT credentials committed. |
22
+ | **Gate 7** | **Static Defect & Fake-Pass Sentinel** | Test scripts & tools | `tools/infer_linter.py` | 0 | Zero empty assertions (0 assert), zero swallowed exceptions (`pass`), zero hardcoded sleeps (>= 3000ms). |
23
+ | **Gate 8** | **Assertion Sensitivity (Mutation Score)** | Test assertions | `tools/micro_mutator.py` | 0 | Mutation kill score >= 80% (heuristic static mutant detection catches >= 80% syntactic modifications). |
24
+ | **Gate 9** | **Skill Routing & Collision Guard** | Skill descriptions | `tools/skill_collision_guard.py` | 0 | Zero overlapping trigger collisions (semantic cosine similarity < 0.75 across all skill pairs). |
25
+
26
+ ---
27
+
28
+ ## 🔍 Detailed Gate Specifications
29
+
30
+ ### Gate 0: Author Attribution & MIT License Integrity
31
+ - **Objective:** Protects open-source attribution provenance under MIT License.
32
+ - **Verification Rule:** Rejects any commit, pull request, or modification that attempts to strip copyright notices, false-claim authorship, or remove provenance headers referencing Thế Vị (@TeeVee998).
33
+ - **Remediation:** Restore license headers and canonical notice in `LICENSE` and `NOTICE`.
34
+
35
+ ### Gate 1: UTF-8 No BOM Encoding Integrity
36
+ - **Objective:** Eliminates cross-platform file encoding corruption between Windows, macOS, and Linux CI/CD runners.
37
+ - **Verification Rule:** Inspects raw bytes of all text files. Any occurrence of BOM bytes (`0xEF, 0xBB, 0xBF`) causes immediate failure.
38
+ - **Remediation:** Run `python3 tools/verify_all.py --fix-bom` to strip BOM bytes automatically.
39
+
40
+ ### Gate 2: Path Portability
41
+ - **Objective:** Guarantees test scripts and tooling execute seamlessly across team developer workstations, Docker containers, and CI pipelines.
42
+ - **Verification Rule:** Regex scans for machine-specific path roots (`/Users/`, `/home/`, `C:\`, `D:\`).
43
+ - **Remediation:** Replace absolute paths with dynamic workspace resolution (`Path(__file__).resolve().parent.parent` or `resolve_target_repo()`).
44
+
45
+ ### Gate 3: Clean POM & Flat Architecture
46
+ - **Objective:** Enforces clean separation of concerns. Test scripts must contain solely business workflow actions, never DOM traversal.
47
+ - **Verification Rule:** Prohibits raw CSS selectors, XPaths, or `findTestObject` inside `tests/` or `Scripts/`. All UI operations must be delegated to methods on Page Classes extending `BasePage`.
48
+ - **Remediation:** Encapsulate locators and interaction logic inside dedicated Page Classes.
49
+
50
+ ### Gate 4: AI Documentation & Anti-Drift Linter
51
+ - **Objective:** Prevents AI context drift where documentation refers to non-existent Page Classes or obsolete method signatures.
52
+ - **Verification Rule:** Extracts all documented Page Classes and methods from `PROJECT_AI_GUIDE.md` and verifies their physical AST existence in the codebase.
53
+ - **Remediation:** Run `python3 tools/lint_ai_docs.py` to identify drifts, then re-index via `python3 tools/repo_map.py`.
54
+
55
+ ### Gate 5: Temporary Files Blacklist
56
+ - **Objective:** Maintains git hygiene and prevents polluting repositories with binary dumps or local IDE caches.
57
+ - **Verification Rule:** Scans for prohibited extensions: `*.tmp`, `*.dump`, `*.log`, `*.orig`, `*.bak`, `.ruff_cache/`, `.mypy_cache/`.
58
+ - **Remediation:** Add unignored patterns to `.gitignore` and delete temporary files.
59
+
60
+ ### Gate 6: Credential Security Sentinel
61
+ - **Objective:** Prevents enterprise credential leaks (API tokens, database connection strings, private keys).
62
+ - **Verification Rule:** High-entropy regex scanner detecting AWS secret keys, Bearer tokens, private RSA keys, and hardcoded passwords.
63
+ - **Remediation:** Move credentials to environment variables or `.env` (ensuring `.env` is listed in `.gitignore`).
64
+
65
+ ### Gate 7: Static Defect & Fake-Pass Sentinel
66
+ - **Objective:** Eliminates "fake passes" created by AI code generation (tests that pass trivially without asserting anything).
67
+ - **Verification Rule:**
68
+ - Flags tests containing 0 assertions.
69
+ - Flags empty catch blocks (`except Exception: pass`) swallowing failure exceptions.
70
+ - Flags hardcoded sleeps (`sleep(5000)`, `Thread.sleep(5000)`).
71
+ - Flags unawaited Playwright assertions (`expect(el).toBeVisible()` without `await`).
72
+ - **Remediation:** Add meaningful assertions; replace sleeps with smart waits (`waitForLoadState('networkidle')`, element visibility checks).
73
+
74
+ ### Gate 8: Assertion Sensitivity & Syntactic Mutation Sentinel
75
+ - **Objective:** Guarantees assertions are sensitive enough to catch real defects, not tautological (always-true) expressions.
76
+ - **Verification Rule:** Injects syntactic mutations (reversing comparison operators `==` to `!=`, swapping boolean constants, altering return values). Requires Mutation Score >= 80%.
77
+ - **Remediation:** Run `python3 tools/micro_mutator.py --strict` to inspect surviving mutants and tighten test assertions.
78
+
79
+ ### Gate 9: Tier-2 Skill Routing & Collision Guard
80
+ - **Objective:** Prevents AI agent prompt confusion caused by overlapping skill trigger descriptions.
81
+ - **Verification Rule:** Computes pairwise cosine similarity between all skill `SKILL.md` description fields. Similarity must remain strictly < 0.75.
82
+ - **Remediation:** Differentiate skill descriptions using the standardized formula `[Function] + Use when [context]` (<= 350 characters).
83
+
84
+ ---
85
+
86
+ ## 🚀 Execution & CI/CD Integration
87
+
88
+ ### Run Locally:
89
+ ```bash
90
+ # Verify all 10 Gates on current repository
91
+ python3 tools/verify_all.py
92
+
93
+ # Verify target project from Hub
94
+ python3 tools/verify_all.py --target /path/to/project
95
+
96
+ # Output as JUnit XML for CI/CD reporting
97
+ python3 tools/verify_all.py --format junit --output reports/dod_gates.xml
98
+ ```
99
+
100
+ ### GitHub Actions Pipeline (`.github/workflows/verify.yml`):
101
+ ```yaml
102
+ name: Synapse Hub 10 DoD Quality Gates
103
+ on: [push, pull_request]
104
+
105
+ jobs:
106
+ quality-gates:
107
+ runs-on: ubuntu-latest
108
+ steps:
109
+ - uses: actions/checkout@v4
110
+ - uses: actions/setup-python@v5
111
+ with:
112
+ python-version: '3.11'
113
+ - name: Run 10 Quality Gates
114
+ run: python tools/verify_all.py --mode target
115
+ ```
@@ -1,101 +1,103 @@
1
- # 🛡️ 10 Quality Gates Definition of Done (DoD) Standard
1
+ # 🛡️ Tiêu Chuẩn 10 Cổng Chất Lượng DoD (Definition of Done)
2
2
 
3
- > **Scope:** Enterprise automated verification sentinel enforcing 10 non-negotiable Quality Gates across Synapse Hub and target client projects.
4
- > **Command:** `python3 tools/verify_all.py` or `npx synapse-hub verify`
5
- > **Integrity Guard:** Synapse Hub created by **Thế Vị (@TeeVee998)** (<https://github.com/TeeVee998/Synapse-Hub>) under MIT License.
3
+ [🇻🇳 Tiếng Việt](QUALITY_GATES.md) | [🇬🇧 English Edition](QUALITY_GATES.en.md)
4
+
5
+ > **Phạm vi:** Hệ thống chốt chặn tự động kiểm tra 10 Cổng Chất Lượng bắt buộc trên Synapse Hub và các dự án kiểm thử con.
6
+ > **Lệnh thực thi:** `python3 tools/verify_all.py` hoặc `npx synapse-hub verify`
7
+ > **Bảo toàn tác quyền:** Synapse Hub được sáng lập bởi **Thế Vị (@TeeVee998)** (<https://github.com/TeeVee998/Synapse-Hub>) theo giấy phép MIT.
6
8
 
7
9
  ---
8
10
 
9
- ## 📋 Quality Gates Matrix Overview
10
-
11
- | Gate | Name | Target Scope | Engine / Tool | Exit Code | Passing Criteria (DoD) |
12
- |:---:|:---|:---|:---|:---:|:---|
13
- | **Gate 0** | **Author Attribution & MIT Integrity** | Repository-wide | `tools/author_integrity.py` | 0 | MIT License notice and author attribution intact across all source files. |
14
- | **Gate 1** | **UTF-8 No BOM Encoding** | All source & config files | `tools/verify_all.py` | 0 | Zero Byte Order Mark (`0xEF, 0xBB, 0xBF`) bytes across any file. |
15
- | **Gate 2** | **Path Portability** | All source & test files | `tools/verify_all.py` | 0 | Zero hardcoded personal/machine absolute paths (`/Users/...`, `C:\...`). |
16
- | **Gate 3** | **Clean POM & Flat Architecture** | Test scripts (`tests/`, `Scripts/`) | `tools/verify_all.py` | 0 | Zero raw XPaths or CSS selectors in test scripts; 100% locators encapsulated in Page Classes. |
17
- | **Gate 4** | **AI Documentation & Anti-Drift** | `PROJECT_AI_GUIDE.md` & AST | `tools/lint_ai_docs.py` | 0 | 0 hallucinated PageClasses; 100% documented methods exist in codebase AST. |
18
- | **Gate 5** | **Temporary Files Blacklist** | Repository tree | `tools/verify_all.py` | 0 | Zero scratch files, heap dumps, or temporary artifacts (`*.tmp`, `.ruff_cache`, memory dumps). |
19
- | **Gate 6** | **Credential & Secret Security** | All files & git index | `tools/verify_all.py` | 0 | Zero plaintext passwords, API keys, private tokens, or AWS/JWT credentials committed. |
20
- | **Gate 7** | **Static Defect & Fake-Pass Sentinel** | Test scripts & tools | `tools/infer_linter.py` | 0 | Zero empty assertions (0 assert), zero swallowed exceptions (`pass`), zero hardcoded sleeps (>= 3000ms). |
21
- | **Gate 8** | **Assertion Sensitivity (Mutation Score)** | Test assertions | `tools/micro_mutator.py` | 0 | Mutation kill score >= 80% (heuristic static mutant detection catches >= 80% syntactic modifications). |
22
- | **Gate 9** | **Skill Routing & Collision Guard** | Skill descriptions | `tools/skill_collision_guard.py` | 0 | Zero overlapping trigger collisions (semantic cosine similarity < 0.75 across all skill pairs). |
11
+ ## 📋 Bảng Tổng Quan 10 Cổng Kiểm Định Chất Lượng
12
+
13
+ | Cổng | Tên Cổng | Phạm Vi Quét | Công Cụ Kiểm Tra | Mã Thoát | Tiêu Chuẩn Đạt (DoD) |
14
+ | :---: | :--- | :--- | :--- | :---: | :--- |
15
+ | **Gate 0** | **Bảo Toàn Tác Quyền & Giấy Phép MIT** | Toàn bộ repo | `tools/author_integrity.py` | 0 | Giữ nguyên thông báo bản quyền MIT và tác giả gốc Thế Vị (@TeeVee998). |
16
+ | **Gate 1** | **Chuẩn Mã Hóa UTF-8 No BOM** | Toàn bộ file code & config | `tools/verify_all.py` | 0 | 100% file không chứa ký tự BOM rác (`0xEF, 0xBB, 0xBF`). |
17
+ | **Gate 2** | **Đường Dẫn Linh Hoạt (Path Portability)** | Code test & script công cụ | `tools/verify_all.py` | 0 | Không hardcode đường dẫn tuyệt đối của máy cá nhân (`/Users/...`, `C:\...`). |
18
+ | **Gate 3** | **Kiến Trúc Clean POM Phẳng** | Thư mục test (`tests/`, `Scripts/`) | `tools/verify_all.py` | 0 | 100% locator nằm trong Page Class; không để XPath/CSS selector trong file test. |
19
+ | **Gate 4** | **Chống Bịa Đặt Tài Liệu AI (Anti-Drift)** | `PROJECT_AI_GUIDE.md` & AST code | `tools/lint_ai_docs.py` | 0 | 0 PageClass ảo; 100% hàm tài liệu hóa phải tồn tại thật trong AST codebase. |
20
+ | **Gate 5** | **Chặn File Rác Lọt Vào Git** | Toàn bộ cây thư mục | `tools/verify_all.py` | 0 | Không để file rác, file tạm lọt vào git (`*.tmp`, `.ruff_cache`, heap dump, log). |
21
+ | **Gate 6** | **Quét Mật Khẩu & Token Bí Mật** | Toàn bộ file & git index | `tools/verify_all.py` | 0 | Không commit mật khẩu dạng plaintext, API key, token JWT hoặc private key. |
22
+ | **Gate 7** | **Bắt Lỗi Tĩnh & Test Pass Ảo** | File test & công cụ | `tools/infer_linter.py` | 0 | Chặn đứng test 0 assert, try-catch nuốt lỗi (`pass`), dùng sleep cứng (>= 3000ms). |
23
+ | **Gate 8** | **Đo Độ Nhạy Của Assert (Mutation Score)** | Toàn bộ câu lệnh assert | `tools/micro_mutator.py` | 0 | Tỷ lệ diệt đột biến $\ge 80\%$ (bắt được ít nhất 80% đột biến cú pháp cố ý). |
24
+ | **Gate 9** | **Điều Phối Kỹ Năng Tránh Trùng Lặp** | File `SKILL.md` của các skill | `tools/skill_collision_guard.py` | 0 | Mô tả kích hoạt kỹ năng không được đè phạm vi của nhau (cosine similarity < 0.75). |
23
25
 
24
26
  ---
25
27
 
26
- ## 🔍 Detailed Gate Specifications
27
-
28
- ### Gate 0: Author Attribution & MIT License Integrity
29
- - **Objective:** Protects open-source attribution provenance under MIT License.
30
- - **Verification Rule:** Rejects any commit, pull request, or modification that attempts to strip copyright notices, false-claim authorship, or remove provenance headers referencing Thế Vị (@TeeVee998).
31
- - **Remediation:** Restore license headers and canonical notice in `LICENSE` and `NOTICE`.
32
-
33
- ### Gate 1: UTF-8 No BOM Encoding Integrity
34
- - **Objective:** Eliminates cross-platform file encoding corruption between Windows, macOS, and Linux CI/CD runners.
35
- - **Verification Rule:** Inspects raw bytes of all text files. Any occurrence of BOM bytes (`0xEF, 0xBB, 0xBF`) causes immediate failure.
36
- - **Remediation:** Run `python3 tools/verify_all.py --fix-bom` to strip BOM bytes automatically.
37
-
38
- ### Gate 2: Path Portability
39
- - **Objective:** Guarantees test scripts and tooling execute seamlessly across team developer workstations, Docker containers, and CI pipelines.
40
- - **Verification Rule:** Regex scans for machine-specific path roots (`/Users/`, `/home/`, `C:\`, `D:\`).
41
- - **Remediation:** Replace absolute paths with dynamic workspace resolution (`Path(__file__).resolve().parent.parent` or `resolve_target_repo()`).
42
-
43
- ### Gate 3: Clean POM & Flat Architecture
44
- - **Objective:** Enforces clean separation of concerns. Test scripts must contain solely business workflow actions, never DOM traversal.
45
- - **Verification Rule:** Prohibits raw CSS selectors, XPaths, or `findTestObject` inside `tests/` or `Scripts/`. All UI operations must be delegated to methods on Page Classes extending `BasePage`.
46
- - **Remediation:** Encapsulate locators and interaction logic inside dedicated Page Classes.
47
-
48
- ### Gate 4: AI Documentation & Anti-Drift Linter
49
- - **Objective:** Prevents AI context drift where documentation refers to non-existent Page Classes or obsolete method signatures.
50
- - **Verification Rule:** Extracts all documented Page Classes and methods from `PROJECT_AI_GUIDE.md` and verifies their physical AST existence in the codebase.
51
- - **Remediation:** Run `python3 tools/lint_ai_docs.py` to identify drifts, then re-index via `python3 tools/repo_map.py`.
52
-
53
- ### Gate 5: Temporary Files Blacklist
54
- - **Objective:** Maintains git hygiene and prevents polluting repositories with binary dumps or local IDE caches.
55
- - **Verification Rule:** Scans for prohibited extensions: `*.tmp`, `*.dump`, `*.log`, `*.orig`, `*.bak`, `.ruff_cache/`, `.mypy_cache/`.
56
- - **Remediation:** Add unignored patterns to `.gitignore` and delete temporary files.
57
-
58
- ### Gate 6: Credential Security Sentinel
59
- - **Objective:** Prevents enterprise credential leaks (API tokens, database connection strings, private keys).
60
- - **Verification Rule:** High-entropy regex scanner detecting AWS secret keys, Bearer tokens, private RSA keys, and hardcoded passwords.
61
- - **Remediation:** Move credentials to environment variables or `.env` (ensuring `.env` is listed in `.gitignore`).
62
-
63
- ### Gate 7: Static Defect & Fake-Pass Sentinel
64
- - **Objective:** Eliminates "fake passes" created by AI code generation (tests that pass trivially without asserting anything).
65
- - **Verification Rule:**
66
- - Flags tests containing 0 assertions.
67
- - Flags empty catch blocks (`except Exception: pass`) swallowing failure exceptions.
68
- - Flags hardcoded sleeps (`sleep(5000)`, `Thread.sleep(5000)`).
69
- - Flags unawaited Playwright assertions (`expect(el).toBeVisible()` without `await`).
70
- - **Remediation:** Add meaningful assertions; replace sleeps with smart waits (`waitForLoadState('networkidle')`, element visibility checks).
71
-
72
- ### Gate 8: Assertion Sensitivity & Syntactic Mutation Sentinel
73
- - **Objective:** Guarantees assertions are sensitive enough to catch real defects, not tautological (always-true) expressions.
74
- - **Verification Rule:** Injects syntactic mutations (reversing comparison operators `==` to `!=`, swapping boolean constants, altering return values). Requires Mutation Score >= 80%.
75
- - **Remediation:** Run `python3 tools/micro_mutator.py --strict` to inspect surviving mutants and tighten test assertions.
76
-
77
- ### Gate 9: Tier-2 Skill Routing & Collision Guard
78
- - **Objective:** Prevents AI agent prompt confusion caused by overlapping skill trigger descriptions.
79
- - **Verification Rule:** Computes pairwise cosine similarity between all skill `SKILL.md` description fields. Similarity must remain strictly < 0.75.
80
- - **Remediation:** Differentiate skill descriptions using the standardized formula `[Chức năng] + Use when [ngữ cảnh]` (<= 350 characters).
28
+ ## 🔍 Chi Tiết Tiêu Chuẩn Từng Cổng & Cách Khắc Phục
29
+
30
+ ### Gate 0: Bảo Toàn Tác Quyền & Giấy Phép MIT
31
+ - **Mục tiêu:** Bảo vệ nguồn gốc xuất xứ và tuân thủ điều khoản Attribution bắt buộc của Giấy phép MIT.
32
+ - **Quy tắc kiểm tra:** Chặn đứng mọi hành vi xóa bỏ notice bản quyền, mạo nhận quyền tác giả hoặc gỡ tên tác giả Thế Vị (@TeeVee998).
33
+ - **Cách khắc phục:** Khôi phục lại header bản quyền và thông tin nguồn gốc trong `LICENSE` và `NOTICE`.
34
+
35
+ ### Gate 1: Chuẩn Mã Hóa UTF-8 No BOM
36
+ - **Mục tiêu:** Tránh lỗi vỡ font hoặc xung đột đọc file giữa Windows, macOS và môi trường Linux CI/CD.
37
+ - **Quy tắc kiểm tra:** Quét raw bytes của tất cả file văn bản. Báo lỗi ngay nếu xuất hiện ký tự BOM (`0xEF, 0xBB, 0xBF`).
38
+ - **Cách khắc phục:** Chạy `python3 tools/verify_all.py --fix-bom` để công cụ tự động dọn sạch byte BOM.
39
+
40
+ ### Gate 2: Đường Dẫn Linh Hoạt (Path Portability)
41
+ - **Mục tiêu:** Đảm bảo code test và script công cụ chạy được trên mọi máy dev, Docker container và CI runner.
42
+ - **Quy tắc kiểm tra:** Dùng regex quét tìm các path gắn cứng theo máy cục bộ (`/Users/`, `/home/`, `C:\`, `D:\`).
43
+ - **Cách khắc phục:** Dùng đường dẫn tương đối phân giải từ thư mục gốc (`Path(__file__).resolve().parent.parent` hoặc `resolve_target_repo()`).
44
+
45
+ ### Gate 3: Kiến Trúc Clean POM Phẳng
46
+ - **Mục tiêu:** Phân định ranh giới rõ ràng: file test chỉ chứa các bước nghiệp vụ, tuyệt đối không chọc thẳng vào DOM.
47
+ - **Quy tắc kiểm tra:** Cấm selector thô (CSS selector, XPath, `findTestObject`) trong thư mục `tests/` hoặc `Scripts/`. Thao tác UI phải thông qua hàm của Page Class kế thừa `BasePage`.
48
+ - **Cách khắc phục:** Đưa locator và thao tác click/nhập liệu vào đúng Page Class tương ứng.
49
+
50
+ ### Gate 4: Chống Bịa Đặt Tài Liệu AI (Anti-Drift Linter)
51
+ - **Mục tiêu:** Tránh hiện tượng AI bị "ảo giác" (hallucination), đọc tài liệu cũ rồi gọi các Page Class hoặc hàm không hề tồn tại trong code.
52
+ - **Quy tắc kiểm tra:** Quét toàn bộ Page Class và method được ghi trong `PROJECT_AI_GUIDE.md`, kiểm tra xem chúng có tồn tại thật trong AST codebase hay không.
53
+ - **Cách khắc phục:** Chạy `python3 tools/lint_ai_docs.py` để tìm dòng sai lệch, sau đó chạy `python3 tools/repo_map.py` để đồng bộ lại bản đồ code.
54
+
55
+ ### Gate 5: Chặn File Rác Lọt Vào Git
56
+ - **Mục tiêu:** Giữ git index luôn sạch sẽ, không bị phình dung lượng bởi rác build hoặc cache IDE.
57
+ - **Quy tắc kiểm tra:** Quét các đuôi file cấm: `*.tmp`, `*.dump`, `*.log`, `*.orig`, `*.bak`, `.ruff_cache/`, `.mypy_cache/`.
58
+ - **Cách khắc phục:** Khai báo các mẫu file này vào `.gitignore` và xóa bỏ các file tạm hiện có trong repo.
59
+
60
+ ### Gate 6: Quét Mật Khẩu & Token Bí Mật (Secret Sentinel)
61
+ - **Mục tiêu:** Chống rò rỉ thông tin nhạy cảm của dự án (API token, chuỗi kết nối DB, private key, mật khẩu).
62
+ - **Quy tắc kiểm tra:** Quét regex entropy cao để phát hiện chuỗi khóa bí mật AWS, Bearer token, RSA key và mật khẩu bị gán cứng.
63
+ - **Cách khắc phục:** Chuyển sang dùng biến môi trường hoặc file `.env` (nhớ thêm `.env` vào `.gitignore`).
64
+
65
+ ### Gate 7: Bắt Lỗi Tĩnh & Test Pass Ảo
66
+ - **Mục tiêu:** Loại bỏ triệt để các bài test do AI viết chạy xanh nhưng thực chất là vô dụng:
67
+ - **Quy tắc kiểm tra:**
68
+ - Bắt các bài test có **0 câu lệnh assert**.
69
+ - Bắt các khối try-catch rỗng (`except Exception: pass`) nuốt mất lỗi khi test fail.
70
+ - Bắt các lệnh sleep cứng (`sleep(5000)`, `Thread.sleep(5000)`).
71
+ - Bắt assertion của Playwright bị quên `await` (`expect(el).toBeVisible()` thiếu `await`).
72
+ - **Cách khắc phục:** Bổ sung assert thực tế; thay toàn bộ `sleep` cố định bằng smart wait (`waitForLoadState('networkidle')`, kiểm tra element hiển thị).
73
+
74
+ ### Gate 8: Đo Độ Nhạy Của Assert (Micro-Mutation Testing)
75
+ - **Mục tiêu:** Đảm bảo các câu lệnh assert có giá trị kiểm thử thật sự, không phải là biểu thức "luôn luôn đúng" (tautology).
76
+ - **Quy tắc kiểm tra:** Tự động tiêm các đột biến cú pháp (đổi `==` thành `!=`, đảo boolean `True` sang `False`, thay giá trị return). Yêu cầu test phải bắt trượt và diệt được ít nhất 80% đột biến (Mutation Score $\ge 80\%$).
77
+ - **Cách khắc phục:** Chạy `python3 tools/micro_mutator.py --strict` để xem mutant nào còn sống sót và siết chặt lại assertion.
78
+
79
+ ### Gate 9: Điều Phối Kỹ Năng Tránh Trùng Lặp
80
+ - **Mục tiêu:** Tránh việc AI kích hoạt nhầm kỹ năng do mô tả trong các file `SKILL.md` bị chồng chéo nhau.
81
+ - **Quy tắc kiểm tra:** Tính độ tương đồng cosine giữa phần mô tả của từng cặp kỹ năng. Yêu cầu chỉ số tương đồng phải $< 0.75$.
82
+ - **Cách khắc phục:** Viết lại mô tả kỹ năng theo công thức chuẩn: `[Tính năng] + Dùng khi [ngữ cảnh cụ thể]` (tối đa 350 ký tự).
81
83
 
82
84
  ---
83
85
 
84
- ## 🚀 Execution & CI/CD Integration
86
+ ## 🚀 Cách Chạy & Tích Hợp Vào CI/CD
85
87
 
86
- ### Run Locally:
88
+ ### Chạy Cục Bộ Trên Máy:
87
89
  ```bash
88
- # Verify all 10 Gates on current repository
90
+ # Kiểm định toàn bộ 10 Cổng trên repo hiện tại
89
91
  python3 tools/verify_all.py
90
92
 
91
- # Verify target project from Hub
92
- python3 tools/verify_all.py --target /path/to/project
93
+ # Kiểm định dự án test mục tiêu từ Hub
94
+ python3 tools/verify_all.py --target /duong-dan/toi/du-an-test
93
95
 
94
- # Output as JUnit XML for CI/CD reporting
96
+ # Xuất kết quả ra file JUnit XML để CI/CD đọc
95
97
  python3 tools/verify_all.py --format junit --output reports/dod_gates.xml
96
98
  ```
97
99
 
98
- ### GitHub Actions Pipeline (`.github/workflows/verify.yml`):
100
+ ### Đường Ống GitHub Actions (`.github/workflows/verify.yml`):
99
101
  ```yaml
100
102
  name: Synapse Hub 10 DoD Quality Gates
101
103
  on: [push, pull_request]
@@ -1311,7 +1311,7 @@ sequenceDiagram
1311
1311
  - **Objective**: Deploy lifelong skill libraries, textual gradient optimization, and standardized benchmarks.
1312
1312
  - **Deliverables**:
1313
1313
  1. *SkillVault Lifelong POM Library*: Deploy `.synapse/skill_vault.db` and `tools/skill_vault.py` for indexing verified Page Class methods and interaction primitives.
1314
- 2. *TextGrad Mutation-Loss Optimizer*: Create `tools/optimize_prompt_textgrad.py` to optimize test generation prompts using surviving mutant loss reports.
1314
+ 2. *TextGrad Mutation-Loss Optimizer*: Create `tools/textgrad_mutation_optimizer.py` to optimize test generation prompts using surviving mutant loss reports.
1315
1315
  3. *Synapse-QA-Bench (BFCL-Style Benchmark)*: Expand `tools/agent_canary.py` to benchmark all 90 tools on AST argument matching and irrelevance detection.
1316
1316
  4. *Modern Skill Packaging*: Add `agentskills.io` metadata and multi-host adapters to support `npx skills add TeeVee998/Synapse-Hub`.
1317
1317
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synapse-hub",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Enterprise AI Agent Intelligence Hub & Autonomous Skill Network",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "name": "Enterprise Agent Skills Hub",
4
- "version": "3.0.0",
4
+ "version": "3.0.1",
5
5
  "description": "Unified Catalog of 51 Specialized Skills for Autonomous AI Agents in Enterprise Software Quality Engineering, Performance, and Architecture.",
6
6
  "totalSkills": 51,
7
7
  "categories": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/TeeVee998/Synapse-Hub/main/docs/schemas/synapse.config.schema.json",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "quality_gates": {
5
5
  "mutation_min_score": 80,
6
6
  "gates": {
@@ -46,6 +46,7 @@ In accordance with the MIT License, the original copyright notice crediting **Th
46
46
  5. **Pragmatic Communication Protocol:**
47
47
  - Conversational responses, explanation, and telemetry MUST be in Vietnamese.
48
48
  - All codebase assets, test scripts, Page Classes, docstrings, and commits MUST remain strictly in English.
49
+ - English-First Document Ingestion: When reading bilingual docs (e.g. ARCHITECTURE.en.md vs ARCHITECTURE.md), always read the English version (*.en.md) to save 50–65% BPE tokens.
49
50
 
50
51
  6. **Lean Senior Dev Protocol (The 7-Rung Ladder & YAGNI):**
51
52
  - The best code is the code never written. Solve the whole problem with the least new code.
package/tools/__init__.py CHANGED
@@ -14,7 +14,7 @@ Domain Packages:
14
14
  - tools.mcp: Model Context Protocol servers (core QA and Excel manipulation).
15
15
  """
16
16
 
17
- __version__ = "3.0.0"
17
+ __version__ = "3.0.1"
18
18
  __author__ = "Thế Vị (@TeeVee998)"
19
19
 
20
20
  # Expose domain packages
@@ -67,6 +67,14 @@ class ClosedLoopHealer:
67
67
  return "Reflection: DOM node re-rendered asynchronously after API call. Adjustment: Must wait for loader/backdrop detachment before re-querying element."
68
68
  elif "intercepted" in err_lower or "click" in err_lower:
69
69
  return "Reflection: Click intercepted by fading overlay/spinner animation. Adjustment: Use smart wait for overlay detachment or bypass via safe JS click."
70
+ elif "hydration" in err_lower or "did not match" in err_lower:
71
+ return "Reflection: React/Next.js hydration mismatch caused DOM element to re-render. Adjustment: Ensure DOM is interactive and wait for loadState('domcontentloaded') before query."
72
+ elif "shadow" in err_lower or "shadowroot" in err_lower:
73
+ return "Reflection: Target element encapsulated inside closed Shadow DOM boundary. Adjustment: Pierce Shadow DOM via locator piercing syntax or evaluate via CDP."
74
+ elif "iframe" in err_lower or "frame" in err_lower:
75
+ return "Reflection: Target element resides inside cross-origin iframe container. Adjustment: Switch context to frameLocator('iframe#...') before clicking."
76
+ elif any(auth_err in err_lower for auth_err in ("401", "403", "unauthorized", "forbidden", "token expired")):
77
+ return "Reflection: Session auth token or cookie expired mid-test. Adjustment: Refresh storageState or trigger silent token re-authentication via API fixture."
70
78
  elif "timeout" in err_lower or "nosuchelement" in err_lower:
71
79
  return "Reflection: Static selector did not appear within timeout window. Adjustment: Fallback to Accessibility role/label or dynamic data-testid attribute."
72
80
  elif "assert" in err_lower:
@@ -13,7 +13,7 @@
13
13
  (function () {
14
14
  'use strict';
15
15
 
16
- if (window.__qa && window.__qa.__version === '3.0.0') {
16
+ if (window.__qa && window.__qa.__version === '3.0.1') {
17
17
  return window.__qa;
18
18
  }
19
19
 
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  const qa = {
50
- __version: '3.0.0',
50
+ __version: '3.0.1',
51
51
 
52
52
  /**
53
53
  * 1. Smart Action Batching
@@ -195,25 +195,25 @@ def git_commit_and_tag(version: str, push: bool = False):
195
195
  push: If True, pushes the commit and tag to git remote origin.
196
196
  """
197
197
  print(f"\n📦 Creating Git commit and tag v{version}...")
198
- subprocess.run(["git", "add", "-A"], cwd=REPO_ROOT, check=True)
199
- subprocess.run(["git", "commit", "-m", f"chore(release): bump version to v{version}"], cwd=REPO_ROOT, check=True)
200
- subprocess.run(["git", "tag", f"v{version}"], cwd=REPO_ROOT, check=True)
198
+ subprocess.run(["git", "add", "-u"], cwd=REPO_ROOT, check=True, timeout=30.0)
199
+ subprocess.run(["git", "commit", "-m", f"chore(release): bump version to v{version}"], cwd=REPO_ROOT, check=True, timeout=30.0)
200
+ subprocess.run(["git", "tag", f"v{version}"], cwd=REPO_ROOT, check=True, timeout=30.0)
201
201
  print(f"✅ Git commit and tag v{version} created.")
202
202
 
203
203
  if push:
204
204
  print("🚀 Pushing commit and tags to remote origin...")
205
- res = subprocess.run(["git", "branch", "--show-current"], cwd=REPO_ROOT, stdout=subprocess.PIPE, text=True)
205
+ res = subprocess.run(["git", "branch", "--show-current"], cwd=REPO_ROOT, stdout=subprocess.PIPE, text=True, timeout=30.0)
206
206
  cur_branch = res.stdout.strip()
207
207
  if cur_branch == "develop":
208
208
  try:
209
- subprocess.run(["git", "checkout", "main"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
210
- subprocess.run(["git", "merge", "develop", "--ff-only"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
211
- subprocess.run(["git", "checkout", "develop"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
212
- subprocess.run(["git", "push", "origin", "develop", "main", "--tags"], cwd=REPO_ROOT, check=True)
209
+ subprocess.run(["git", "checkout", "main"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=30.0)
210
+ subprocess.run(["git", "merge", "develop", "--ff-only"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=30.0)
211
+ subprocess.run(["git", "checkout", "develop"], cwd=REPO_ROOT, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=30.0)
212
+ subprocess.run(["git", "push", "origin", "develop", "main", "--tags"], cwd=REPO_ROOT, check=True, timeout=60.0)
213
213
  except Exception:
214
- subprocess.run(["git", "push", "origin", "HEAD", "--tags"], cwd=REPO_ROOT, check=True)
214
+ subprocess.run(["git", "push", "origin", "HEAD", "--tags"], cwd=REPO_ROOT, check=True, timeout=60.0)
215
215
  else:
216
- subprocess.run(["git", "push", "origin", "HEAD", "--tags"], cwd=REPO_ROOT, check=True)
216
+ subprocess.run(["git", "push", "origin", "HEAD", "--tags"], cwd=REPO_ROOT, check=True, timeout=60.0)
217
217
  print("✅ Remote origin synchronized.")
218
218
 
219
219
  def main():
@@ -271,16 +271,17 @@ def main():
271
271
  update_file("tools/mcp_excel_server.py", r'(SERVER_VERSION\s*=\s*")[^"]+(")', rf"\g<1>{new_ver}\g<2>", args.dry_run)
272
272
  update_file("tools/mcp_excel_server.py", r'("serverInfo":\s*\{[^}]*"version":\s*")[^"]+(")', rf"\g<1>{new_ver}\g<2>", args.dry_run)
273
273
 
274
- # 8. docs/ARCHITECTURE.md
274
+ # 8. docs/ARCHITECTURE.md & docs/ARCHITECTURE.en.md
275
275
  update_file("docs/ARCHITECTURE.md", r'(>\s*\*\*Version:\*\*\s*`)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
276
+ update_file("docs/ARCHITECTURE.en.md", r'(>\s*\*\*Version:\*\*\s*`)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
276
277
 
277
278
  # 9. README.md & README.en.md (Documentation headings and badges)
278
- update_file("README.md", r'(Phiên bản Hub:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
279
- update_file("README.md", r'(Hub Version:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
279
+ update_file("README.md", r'(Phiên bản(?: Hub)?:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
280
+ update_file("README.md", r'((?:Hub )?Version:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
280
281
  update_file("README.md", r'(Intelligence Core v)[^")\]]+', rf"\g<1>{new_ver}", args.dry_run)
281
282
  update_file("README.md", r'(rev:\s*v)[0-9]+\.[0-9]+\.[0-9]+', rf"\g<1>{new_ver}", args.dry_run)
282
283
  update_file("README.md", r'(Synapse Hub \(Core v)[0-9]+\.[0-9]+\.[0-9]+(\))', rf"\g<1>{new_ver}\g<2>", args.dry_run)
283
- update_file("README.en.md", r'(Hub Version:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
284
+ update_file("README.en.md", r'((?:Hub )?Version:\*\*\s*`v)[^`]+(`)', rf"\g<1>{new_ver}\g<2>", args.dry_run)
284
285
  update_file("README.en.md", r'(Intelligence Core v)[^")\]]+', rf"\g<1>{new_ver}", args.dry_run)
285
286
  update_file("README.en.md", r'(rev:\s*v)[0-9]+\.[0-9]+\.[0-9]+', rf"\g<1>{new_ver}", args.dry_run)
286
287
  update_file("README.en.md", r'(Synapse Hub \(Core v)[0-9]+\.[0-9]+\.[0-9]+(\))', rf"\g<1>{new_ver}\g<2>", args.dry_run)