synapse-hub 2.7.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.
- package/.agents/agents/live-explorer.md +2 -0
- package/.agents/agents/pom-crafter.md +2 -0
- package/.agents/agents/test-runner.md +3 -0
- package/.agents/rules/communication-style.md +4 -0
- package/.agents/rules/context-engineering.md +1 -0
- package/.agents/rules/git-push-protocol.md +17 -0
- package/.agents/skills/agentless-qa-repair/examples/three_phase_repair_workflow.md +40 -0
- package/.agents/skills/antigravity-test-sentinel/examples/sprint_dod_enforcement.md +47 -0
- package/.agents/skills/auth-session-and-cookie-manager/examples/multi_role_auth_matrix.md +70 -0
- package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +52 -0
- package/.agents/skills/failure-autopsy-and-healing/examples/closed_loop_healing_walkthrough.md +48 -0
- package/.agents/skills/lean-impact-scoreboard/SKILL.md +1 -1
- package/.agents/skills/lean-impact-scoreboard/examples/sample_scoreboard.md +1 -1
- package/.agents/skills/mipro-prompt-compiler/examples/dspy_assertion_optimizer_case.md +46 -0
- package/.agents/skills/persistent-planning-files/SKILL.md +1 -1
- package/.agents/skills/qa-aci-interface/examples/surgical_code_window_walkthrough.md +40 -0
- package/.agents/skills/repo-quality-audit/SKILL.md +1 -1
- package/.agents/skills/review-spec/SKILL.md +1 -1
- package/.agents/skills/review-spec/examples/pocock_grilling_decision_rubric.md +40 -0
- package/.agents/skills/senior-code-review/SKILL.md +1 -1
- package/.agents/skills/skillspector-security-guard/examples/audit_threat_vectors_report.json +35 -0
- package/.agents/skills/surgical-coding-principles/SKILL.md +1 -1
- package/.agents/skills/technical-debt-harvester/SKILL.md +1 -1
- package/.agents/skills/tot-exploratory-testing/examples/payment_gateway_tot_tree.json +62 -0
- package/.agents/skills/verification-before-completion/SKILL.md +2 -2
- package/.agents/skills/verification-before-completion/examples/evidence_log_example.md +2 -2
- package/.agents/skills/web-agent-gym-benchmarking/examples/enterprise_tasks_suite.json +38 -0
- package/.agents/skills/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +61 -0
- package/AGENTS.md +6 -4
- package/CLAUDE.md +2 -1
- package/README.en.md +71 -292
- package/README.md +69 -304
- package/action.yml +1 -1
- package/bin/agent-qa.js +2 -2
- package/docs/ARCHITECTURE.en.md +192 -0
- package/docs/ARCHITECTURE.md +135 -88
- package/docs/CI_CD_INTEGRATION.en.md +96 -0
- package/docs/CI_CD_INTEGRATION.md +24 -22
- package/docs/CLI_REFERENCE.en.md +174 -0
- package/docs/CLI_REFERENCE.md +120 -115
- package/docs/CONTRIBUTING.en.md +49 -0
- package/docs/CONTRIBUTING.md +26 -68
- package/docs/QUALITY_GATES.en.md +115 -0
- package/docs/QUALITY_GATES.md +115 -0
- package/docs/research/agent_skill_training_analysis.md +1 -1
- package/package.json +1 -1
- package/scripts/package_dist.py +2 -1
- package/skills_manifest.json +6 -6
- package/synapse.config.json +1 -1
- package/templates/ai_bridges/CLAUDE.md +2 -1
- package/templates/ai_bridges/copilot-instructions.md +2 -2
- package/tools/__init__.py +18 -1
- package/tools/_openapi_parser.py +1 -1
- package/tools/agent_canary.py +42 -30
- package/tools/agentless_patcher.py +2 -2
- package/tools/analyze_project.py +3 -5
- package/tools/api_drift_sentinel.py +4 -4
- package/tools/api_fuzzer.py +8 -8
- package/tools/auto_heal.py +4 -5
- package/tools/auto_heal_reflexion.py +10 -2
- package/tools/autogen_qa_broker.py +2 -2
- package/tools/browser_helpers.js +2 -2
- package/tools/browsergym_eval.py +2 -3
- package/tools/bug_reporter.py +11 -13
- package/tools/bump_version.py +90 -19
- package/tools/cache_resolver.py +78 -83
- package/tools/check_env.py +9 -1
- package/tools/check_version_sync.py +58 -4
- package/tools/ci_healing_hook.py +4 -6
- package/tools/cli.py +5 -7
- package/tools/config_decoupler.py +2 -3
- package/tools/contract_validator.py +141 -0
- package/tools/core/__init__.py +52 -0
- package/tools/count_tokens.py +22 -20
- package/tools/dashboard_generator.py +629 -1000
- package/tools/db_sandbox.py +87 -62
- package/tools/debt_harvester.py +3 -3
- package/tools/distill_log.py +3 -3
- package/tools/dspy_qa_signatures.py +3 -4
- package/tools/export_postman_collection.py +8 -8
- package/tools/flaky_detector.py +2 -2
- package/tools/fuzz_payloads.py +5 -5
- package/tools/generate_allure_report.py +1 -1
- package/tools/generate_jmx_plan.py +4 -4
- package/tools/gherkin_suite.py +1 -1
- package/tools/git_pre_commit_guard.py +2 -2
- package/tools/goldfish_review.py +2 -2
- package/tools/heal/__init__.py +28 -0
- package/tools/heal_pr_automator.py +6 -6
- package/tools/heuristic_locator_matcher.py +2 -2
- package/tools/infer_linter.py +143 -29
- package/tools/interview_story.py +0 -1
- package/tools/jtl_analyzer.py +11 -11
- package/tools/lint/__init__.py +30 -0
- package/tools/lint_ai_docs.py +42 -0
- package/tools/lookup_tc.py +1 -1
- package/tools/matrix_sharder.py +15 -13
- package/tools/mcp/__init__.py +16 -0
- package/tools/mcp_excel_server.py +2 -2
- package/tools/mcp_server.py +9 -7
- package/tools/md_to_xlsx.py +26 -26
- package/tools/micro_mutator.py +32 -15
- package/tools/network_mock_shield.py +27 -27
- package/tools/newman_analyzer.py +2 -3
- package/tools/omni_emitter.py +5 -8
- package/tools/omni_parser.py +5 -5
- package/tools/omni_transpiler.py +5 -5
- package/tools/output_formatter.py +19 -0
- package/tools/perf/__init__.py +24 -0
- package/tools/pinpoint_failure.py +1 -1
- package/tools/project_state.py +0 -2
- package/tools/qa_event_stream.py +1 -1
- package/tools/repo_map.py +8 -8
- package/tools/report/__init__.py +32 -0
- package/tools/reversible_sandbox.py +3 -4
- package/tools/safety_firewall.py +2 -2
- package/tools/senior_code_review.py +4 -3
- package/tools/setup_project.py +10 -12
- package/tools/skill_collision_guard.py +3 -3
- package/tools/skill_vault.py +94 -6
- package/tools/skillspector.py +10 -8
- package/tools/smart_visual_masker.py +4 -6
- package/tools/spec_drift_sentinel.py +1 -2
- package/tools/swe_qa_aci.py +2 -2
- package/tools/synapse_qa_bench.py +3 -3
- package/tools/sync_agent_rules.py +18 -3
- package/tools/telemetry_correlator.py +3 -2
- package/tools/test_impact.py +2 -1
- package/tools/test_memory_os.py +15 -5
- package/tools/textgrad_mutation_optimizer.py +3 -3
- package/tools/tms_sync_bridge.py +5 -5
- package/tools/tot_exploratory_tester.py +5 -6
- package/tools/traffic_session_converter.py +9 -9
- package/tools/universal_ir.py +2 -3
- package/tools/update_sentinel.py +6 -9
- package/tools/verify_all.py +12 -2
- package/tools/visual_diff_canvas.py +4 -4
- package/tools/visual_som_helper.py +15 -13
- package/tools/watch_mode.py +1 -1
- package/tools/wcag_audit.py +22 -1
- package/tools/welcome_page.py +5 -6
package/docs/CLI_REFERENCE.md
CHANGED
|
@@ -1,151 +1,156 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cẩm Nang Tra Cứu Lệnh CLI & Công Cụ Synapse-Hub
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[🇻🇳 Tiếng Việt](CLI_REFERENCE.md) | [🇬🇧 English Edition](CLI_REFERENCE.en.md)
|
|
4
|
+
|
|
5
|
+
Hệ sinh thái Synapse Hub cung cấp công cụ dòng lệnh `synapse-hub` (hoặc `agent-qa`, cùng các script Python trực tiếp trong `tools/`) để kiểm định chất lượng, lint code test, phân tích tác động và cô đọng log CI.
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
## 1.
|
|
9
|
+
## 1. Điểm Vào Dòng Lệnh Thống Nhất (`synapse-hub` / `agent-qa`)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Sau khi cài đặt qua `npm install -g synapse-hub` hoặc `pip install -e .`, bạn có thể gõ trực tiếp:
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
|
-
|
|
14
|
+
synapse-hub <lệnh> [tùy_chọn]
|
|
15
|
+
# hoặc
|
|
16
|
+
agent-qa <lệnh> [tùy_chọn]
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
###
|
|
19
|
+
### Danh Mục 53 Lệnh Hỗ Trợ
|
|
16
20
|
|
|
17
|
-
#### A.
|
|
18
|
-
|
|
|
21
|
+
#### A. Cốt Lõi Kiểm Định & 10 Cổng DoD
|
|
22
|
+
| Lệnh | Nhóm Chức Năng | Mô Tả Thực Tế | Ví Dụ |
|
|
19
23
|
| :--- | :--- | :--- | :--- |
|
|
20
|
-
| `verify` |
|
|
21
|
-
| `lint` |
|
|
22
|
-
| `mutate` |
|
|
23
|
-
| `watch` | HUD
|
|
24
|
-
| `wcag-audit` |
|
|
25
|
-
| `trace-data-flow` |
|
|
26
|
-
| `verify-author` |
|
|
27
|
-
| `debt` |
|
|
28
|
-
| `review` | Senior Review |
|
|
29
|
-
|
|
30
|
-
#### B.
|
|
31
|
-
|
|
|
24
|
+
| `verify` | Gác Cổng DoD | Chạy toàn diện 10 Cổng Chất Lượng trước khi commit/push | `synapse-hub verify` |
|
|
25
|
+
| `lint` | Bắt Lỗi Tĩnh | Quét lỗi tĩnh, bắt test 0-assert, try-catch nuốt lỗi (TS, Python, Groovy) | `synapse-hub lint ./tests` |
|
|
26
|
+
| `mutate` | Kiểm Thử Đột Biến | Bắn vi đột biến kiểm tra độ nhạy của các câu lệnh assert | `synapse-hub mutate ./tests --min-score 80` |
|
|
27
|
+
| `watch` | HUD Thời Gian Thực | Tự động quét và báo lỗi ngay khi có file code thay đổi | `synapse-hub watch` |
|
|
28
|
+
| `wcag-audit` | Khả Năng Tiếp Cận | Kiểm toán chuẩn accessibility WCAG 2.2 và độ tương phản màu | `synapse-hub wcag-audit ./reports/WELCOME.html` |
|
|
29
|
+
| `trace-data-flow` | Dòng Dữ Liệu | Lần vết vòng đời dữ liệu test để phát hiện rò rỉ cơ sở dữ liệu | `synapse-hub trace-data-flow ./tests` |
|
|
30
|
+
| `verify-author` | Bản Quyền Tác Giả | Kiểm tra tính toàn vẹn của watermark tác giả và giấy phép MIT | `synapse-hub verify-author` |
|
|
31
|
+
| `debt` | Nợ Kỹ Thuật | Gom toàn bộ chú thích `shortcut:` trong code thành sổ cái nợ | `synapse-hub debt` |
|
|
32
|
+
| `review` | Senior Review | Review thay đổi code theo 6 trụ cột (Lỗi, Bảo mật, Quy mô, Test, Tốc độ, Rác) | `synapse-hub review` |
|
|
33
|
+
|
|
34
|
+
#### B. Chẩn Đoán Môi Trường, Khởi Tạo & Tiện Ích
|
|
35
|
+
| Lệnh | Nhóm Chức Năng | Mô Tả Thực Tế | Ví Dụ |
|
|
32
36
|
| :--- | :--- | :--- | :--- |
|
|
33
|
-
| `doctor` |
|
|
34
|
-
| `welcome` |
|
|
35
|
-
| `setup` |
|
|
36
|
-
| `uninstall` |
|
|
37
|
-
| `sync-rules` |
|
|
38
|
-
| `version` |
|
|
39
|
-
| `update` |
|
|
40
|
-
| `clean` |
|
|
41
|
-
|
|
42
|
-
#### C.
|
|
43
|
-
|
|
|
37
|
+
| `doctor` | Kiểm Tra Môi Trường | Chẩn đoán 1-click cho Node.js, Python, Chrome, Git | `synapse-hub doctor` |
|
|
38
|
+
| `welcome` | Trang Hướng Dẫn | Mở trang landing giới thiệu trực quan trên trình duyệt | `synapse-hub welcome` |
|
|
39
|
+
| `setup` | Khởi Tạo Dự Án | Bootstrap dự án test, tự tạo AI Guide và kết nối các AI Bridge | `synapse-hub setup --local-only` |
|
|
40
|
+
| `uninstall` | Gỡ Bỏ Cấu Hình | Gỡ sạch các AI Bridge, git hook và file cấu hình tạm | `synapse-hub uninstall` |
|
|
41
|
+
| `sync-rules` | Đồng Bộ Quy Tắc AI | Đồng bộ nội dung AGENTS.md tới Cursor, Claude, Copilot, Windsurf | `synapse-hub sync-rules` |
|
|
42
|
+
| `version` | Xem Phiên Bản | Hiển thị phiên bản Hub và danh mục kỹ năng hiện có | `synapse-hub version` |
|
|
43
|
+
| `update` | Cập Nhật 1-Click | Tự động kéo bản cập nhật mới nhất từ kho lưu trữ trung tâm | `synapse-hub update` |
|
|
44
|
+
| `clean` | Dọn Dẹp File Rác | Xóa sạch các file tạm thời, cache và log thừa trong repo | `synapse-hub clean` |
|
|
45
|
+
|
|
46
|
+
#### C. Tự Sửa Lỗi, Khám Nghiệm Thất Bại & Nén Log
|
|
47
|
+
| Lệnh | Nhóm Chức Năng | Mô Tả Thực Tế | Ví Dụ |
|
|
44
48
|
| :--- | :--- | :--- | :--- |
|
|
45
|
-
| `heal` |
|
|
46
|
-
| `auto-heal` |
|
|
47
|
-
| `heal-pr` | PR
|
|
48
|
-
| `distill` |
|
|
49
|
-
| `pinpoint-failure` |
|
|
50
|
-
| `flaky` |
|
|
51
|
-
| `lookup-tc` |
|
|
52
|
-
| `lookup-xpath` |
|
|
53
|
-
| `impact` |
|
|
54
|
-
| `canary` |
|
|
55
|
-
| `report-bug` | Bug
|
|
56
|
-
| `ci-hook` |
|
|
57
|
-
| `tokens` | Token
|
|
58
|
-
|
|
59
|
-
#### D. API,
|
|
60
|
-
|
|
|
49
|
+
| `heal` | Bộ Nhớ Tra Cứu | Tra cứu cách sửa lỗi đã được kiểm chứng (0 tốn token AI) | `synapse-hub heal query "StaleElement"` |
|
|
50
|
+
| `auto-heal` | Tự Động Sửa Test | Tự động đọc file JUnit XML lỗi và cập nhật lại locator bị hỏng | `synapse-hub auto-heal` |
|
|
51
|
+
| `heal-pr` | Mở PR Sửa Lỗi | Tự tạo nhánh Git và mở Pull Request kèm bản vá sửa test | `synapse-hub heal-pr --branch heal/fix-login` |
|
|
52
|
+
| `distill` | Nén Log CI | Lọc sạch 95% log thừa, chỉ giữ lại đúng stacktrace nguyên nhân gốc | `synapse-hub distill build.log` |
|
|
53
|
+
| `pinpoint-failure` | Khám Nghiệm Lỗi | Phân tích file JUnit XML, chỉ ra ngay dòng code gây fail trong 0.1s | `synapse-hub pinpoint-failure report.xml` |
|
|
54
|
+
| `flaky` | Cách Ly Test Chập Chờn | Nhận diện test chạy chập chờn (flaky) và đưa vào vùng cách ly | `synapse-hub flaky --detect` |
|
|
55
|
+
| `lookup-tc` | Tra Cứu Test Case | Tìm nhanh test case theo ID, tag, độ ưu tiên hoặc tên luồng | `synapse-hub lookup-tc TC-101` |
|
|
56
|
+
| `lookup-xpath` | Bộ Nhớ Locator | Tìm locator hoặc XPath ổn định đã được cache trong bộ nhớ | `synapse-hub lookup-xpath "Submit"` |
|
|
57
|
+
| `impact` | Đo Bán Kính Ảnh Hưởng | Phân tích AST xem thay đổi git diff ảnh hưởng tới những test nào | `synapse-hub impact --git-diff` |
|
|
58
|
+
| `canary` | Thao Trường Phục Hồi | Thử nghiệm tiêm lỗi để đo tốc độ tự phục hồi MTTR của agent | `synapse-hub canary --run` |
|
|
59
|
+
| `report-bug` | Tạo Báo Cáo Bug | Xuất báo cáo lỗi chuẩn Markdown/Jira từ phân tích nguyên nhân gốc | `synapse-hub report-bug --junit report.xml` |
|
|
60
|
+
| `ci-hook` | Hook Tự Động Trên CI | Chạy tự động phân tích nguyên nhân ngay khi build CI bị fail | `synapse-hub ci-hook --log ci.log` |
|
|
61
|
+
| `tokens` | Đo Đếm Token | Đếm chính xác số lượng token của prompt hoặc tài liệu | `synapse-hub tokens path/to/prompt.md` |
|
|
62
|
+
|
|
63
|
+
#### D. Kiểm Thử API, Hiệu Năng & Bảo Mật
|
|
64
|
+
| Lệnh | Nhóm Chức Năng | Mô Tả Thực Tế | Ví Dụ |
|
|
61
65
|
| :--- | :--- | :--- | :--- |
|
|
62
|
-
| `fuzz-api` |
|
|
63
|
-
| `contract-drift` |
|
|
64
|
-
| `generate-jmx` |
|
|
65
|
-
| `analyze-jtl` |
|
|
66
|
-
| `analyze-newman` | Postman
|
|
67
|
-
| `export-postman` |
|
|
68
|
-
| `mock-shield` | Route
|
|
69
|
-
| `skillspector` | AI
|
|
70
|
-
| `safety-check` |
|
|
71
|
-
|
|
72
|
-
#### E.
|
|
73
|
-
|
|
|
66
|
+
| `fuzz-api` | Fuzzing API | Quét fuzzing bảo mật, boundary & chaos test cho API (chỉ non-prod) | `synapse-hub fuzz-api --spec openapi.json` |
|
|
67
|
+
| `contract-drift` | Bắt Lệch Hợp Đồng API | Phát hiện breaking changes và schema drift so với bản baseline | `synapse-hub contract-drift --baseline v1.json --current v2.json` |
|
|
68
|
+
| `generate-jmx` | Sinh Kịch Bản Tải | Biên dịch User Story / API spec thành kịch bản Apache JMeter JMX | `synapse-hub generate-jmx --threads 50` |
|
|
69
|
+
| `analyze-jtl` | Phân Tích Kết Quả Tải | Đọc log JMeter JTL và kiểm định các ngưỡng SLA thời gian phản hồi | `synapse-hub analyze-jtl results.jtl` |
|
|
70
|
+
| `analyze-newman` | Đánh Giá Chạy Postman | Đọc file JSON kết quả chạy Newman để đánh giá chất lượng API | `synapse-hub analyze-newman newman_run.json` |
|
|
71
|
+
| `export-postman` | Xuất Bộ Sưu Tập Postman | Xuất file đặc tả OpenAPI thành Postman Collection v2.1 | `synapse-hub export-postman --spec swagger.json` |
|
|
72
|
+
| `mock-shield` | Giả Lập Route Mạng | Tự động sinh route mock mạng cho Playwright từ OpenAPI spec | `synapse-hub mock-shield --spec openapi.json` |
|
|
73
|
+
| `skillspector` | Rà Soát Bảo Mật AI | Quét các kỹ năng AI Agent và cấu hình MCP chống prompt injection | `synapse-hub skillspector --dir .agents/skills` |
|
|
74
|
+
| `safety-check` | Tường Lửa Thao Tác | Kiểm tra snippet code để chặn các hành động UI có tính phá hủy | `synapse-hub safety-check --snippet "btn.click()"` |
|
|
75
|
+
|
|
76
|
+
#### E. Sinh Mã, Chuyển Đổi Framework & Báo Cáo
|
|
77
|
+
| Lệnh | Nhóm Chức Năng | Mô Tả Thực Tế | Ví Dụ |
|
|
74
78
|
| :--- | :--- | :--- | :--- |
|
|
75
|
-
| `generate-tc` | Story
|
|
76
|
-
| `export-excel` | Excel
|
|
77
|
-
| `gherkin` | BDD
|
|
78
|
-
| `transpile` |
|
|
79
|
-
| `omni-scan` |
|
|
80
|
-
| `shard` |
|
|
81
|
-
| `visual-mask` |
|
|
82
|
-
| `som` | Vision
|
|
83
|
-
| `decouple-config`|
|
|
84
|
-
| `correlate-telemetry` |
|
|
85
|
-
| `dashboard` |
|
|
86
|
-
| `analyze` |
|
|
87
|
-
| `mcp-serve` | MCP
|
|
79
|
+
| `generate-tc` | Biên Dịch User Story | Chuyển đổi User Story ngôn ngữ tự nhiên thành test case Clean POM | `synapse-hub generate-tc story.md` |
|
|
80
|
+
| `export-excel` | Xuất Báo Cáo Excel | Xuất các test case Markdown thành file Excel 12 cột tiêu chuẩn | `synapse-hub export-excel` |
|
|
81
|
+
| `gherkin` | Biên Dịch BDD | Biên dịch file Gherkin .feature thành kịch bản test thực thi | `synapse-hub gherkin specs/checkout.feature` |
|
|
82
|
+
| `transpile` | Chuyển Đổi Framework | Chuyển đổi mã test qua lại giữa Playwright, Pytest, Katalon | `synapse-hub transpile tests/spec.ts --to pytest` |
|
|
83
|
+
| `omni-scan` | Nhận Diện Framework | Tự động quét repo để nhận diện framework test đang sử dụng | `synapse-hub omni-scan` |
|
|
84
|
+
| `shard` | Phân Mảnh Chạy Song Song | Chia đều test suite thành nhiều phần để chạy song song trên CI | `synapse-hub shard ./tests --runners 4` |
|
|
85
|
+
| `visual-mask` | Tạo Mask Chống Flaky | Tính toán tọa độ che các vùng động khi so sánh screenshot UI | `synapse-hub visual-mask screenshot.png` |
|
|
86
|
+
| `som` | Đánh Dấu UI Cho Vision AI | Tiện ích Set-of-Marks đánh dấu số thứ tự lên phần tử giao diện | `synapse-hub som screen.png` |
|
|
87
|
+
| `decouple-config`| Tách Biệt Cấu Hình | Tách rời biến môi trường và mật khẩu ra khỏi mã nguồn test | `synapse-hub decouple-config config.groovy` |
|
|
88
|
+
| `correlate-telemetry` | Đối Chiếu Log Đa Kênh | Khớp nối dấu vết browser trace, HTTP log và server log khi debug | `synapse-hub correlate-telemetry --trace trace.zip` |
|
|
89
|
+
| `dashboard` | Bảng Điều Khiển HUD | Tạo bảng điều khiển HTML5 tổng quan sức khỏe dự án test | `synapse-hub dashboard` |
|
|
90
|
+
| `analyze` | Kiểm Toán Toàn Diện | Báo cáo sức khỏe dự án 5-trong-1 và kiểm định 10 cổng DoD | `synapse-hub analyze` |
|
|
91
|
+
| `mcp-serve` | Khởi Chạy Máy Chủ MCP | Chạy máy chủ Model Context Protocol (MCP) qua giao thức stdio | `synapse-hub mcp-serve` |
|
|
88
92
|
|
|
89
93
|
---
|
|
90
94
|
|
|
91
|
-
## 2.
|
|
95
|
+
## 2. Hướng Dẫn Chạy Trực Tiếp Qua Script Python
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
Nếu bạn không muốn cài đặt package toàn cục, toàn bộ công cụ đều có thể chạy trực tiếp bằng Python:
|
|
94
98
|
|
|
95
|
-
### 2.1.
|
|
99
|
+
### 2.1. Chạy 10 Cổng Kiểm Định DoD (Gate 0 - Gate 9)
|
|
96
100
|
```bash
|
|
97
|
-
#
|
|
101
|
+
# Tự động nhận diện chế độ (mặc định: tự phát hiện Hub hoặc Dự án test con)
|
|
98
102
|
python tools/verify_all.py
|
|
99
103
|
|
|
100
|
-
#
|
|
101
|
-
python tools/verify_all.py --mode hub # QA Hub
|
|
102
|
-
python tools/verify_all.py --mode target #
|
|
104
|
+
# Chọn chế độ rõ ràng
|
|
105
|
+
python tools/verify_all.py --mode hub # Kiểm tra tính toàn vẹn của QA Hub
|
|
106
|
+
python tools/verify_all.py --mode target # Kiểm định dự án kiểm thử thực tế
|
|
103
107
|
```
|
|
104
|
-
-
|
|
105
|
-
- `--mode hub`:
|
|
106
|
-
- `--mode target`:
|
|
107
|
-
- **Gate 0:**
|
|
108
|
-
- **Gate 1:** 100%
|
|
109
|
-
- **Gate 2:**
|
|
110
|
-
- **Gate 3:** Clean POM
|
|
111
|
-
- **Gate 4:**
|
|
112
|
-
- **Gate 5:**
|
|
113
|
-
- **Gate 6:**
|
|
114
|
-
- **Gate 7:**
|
|
115
|
-
- **Gate 8:**
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
- **Ý Nghĩa Các Chế Độ:**
|
|
109
|
+
- `--mode hub`: Kiểm tra tài nguyên của Hub, tính toàn vẹn của các kỹ năng, công cụ, không byte BOM rác, đường dẫn linh hoạt và bảo mật secret trên toàn bộ repo mà không bắt buộc có file test nghiệp vụ.
|
|
110
|
+
- `--mode target`: Bắt buộc tuân thủ chuẩn kiểm thử cho dự án thực tế: 100% selector nằm trong Page Class (Clean POM) và không lộ mật khẩu.
|
|
111
|
+
- **Gate 0:** Bảo Toàn Tác Quyền & Giấy Phép MIT (giữ thông báo bản quyền của Thế Vị @TeeVee998).
|
|
112
|
+
- **Gate 1:** Quét 100% file không chứa ký tự UTF-8 BOM rác.
|
|
113
|
+
- **Gate 2:** Đường Dẫn Linh Hoạt (không hardcode path máy cá nhân).
|
|
114
|
+
- **Gate 3:** Kiến Trúc Clean POM Phẳng (không chứa XPath/CSS selector trong file test).
|
|
115
|
+
- **Gate 4:** Chống Bịa Đặt Tài Liệu AI (không nhắc tới class hay hàm ảo giác).
|
|
116
|
+
- **Gate 5:** Dọn dẹp sạch file tạm thời, file rác build và sandbox.
|
|
117
|
+
- **Gate 6:** Quét Bảo Mật Thông Tin Nhạy Cảm (chặn mật khẩu và token bị hardcode).
|
|
118
|
+
- **Gate 7:** Bắt Lỗi Tĩnh & Test Pass Ảo (Meta Infer-style).
|
|
119
|
+
- **Gate 8:** Đo Độ Nhạy Assert Bằng Micro-Mutation (yêu cầu điểm diệt mutant >= 80%).
|
|
120
|
+
- **Gate 9:** Điều Phối Kỹ Năng Tránh Trùng Lặp (độ tương đồng cosine < 0.75).
|
|
121
|
+
|
|
122
|
+
### 2.2. Quét Lỗi Tĩnh & Bắt Test Pass Ảo AST
|
|
118
123
|
```bash
|
|
119
124
|
python tools/infer_linter.py
|
|
120
125
|
```
|
|
121
126
|
|
|
122
|
-
### 2.3.
|
|
127
|
+
### 2.3. Bộ Nhớ Ngữ Nghĩa & Danh Sách Đen Chống Lặp Lại Sai Lầm
|
|
123
128
|
```bash
|
|
124
|
-
#
|
|
129
|
+
# Khởi tạo database với giải pháp mẫu và các bản vá cấm kỵ
|
|
125
130
|
python tools/cache_resolver.py init
|
|
126
131
|
|
|
127
|
-
#
|
|
132
|
+
# Tra cứu bản vá đã kiểm chứng VÀ lấy danh sách bản vá cấm kỵ (0 tốn token)
|
|
128
133
|
python tools/cache_resolver.py query --error "ElementClickInterceptedException"
|
|
129
134
|
|
|
130
|
-
#
|
|
135
|
+
# Lưu giải pháp chuẩn khi sửa lỗi thành công (Positive Memory)
|
|
131
136
|
python tools/cache_resolver.py learn --error "Timeout" --cause "Slow API" --patch "waitForNetworkIdle()" --symptom "Spinner"
|
|
132
137
|
|
|
133
|
-
#
|
|
134
|
-
python tools/cache_resolver.py record-failed --error "StaleElement" --patch "sleep(5000)" --reason "
|
|
138
|
+
# Lưu lần thử sửa lỗi thất bại vào danh sách đen (Negative Memory để AI không lặp lại)
|
|
139
|
+
python tools/cache_resolver.py record-failed --error "StaleElement" --patch "sleep(5000)" --reason "Van fail khi mang lag"
|
|
135
140
|
```
|
|
136
141
|
|
|
137
|
-
### 2.4. Log
|
|
142
|
+
### 2.4. Cô Đọng Log Lọc Rác CI
|
|
138
143
|
```bash
|
|
139
144
|
python tools/distill_log.py execution.log
|
|
140
145
|
```
|
|
141
146
|
|
|
142
|
-
### 2.5. Technical Debt
|
|
147
|
+
### 2.5. Thu Hoạch Nợ Kỹ Thuật (Technical Debt)
|
|
143
148
|
```bash
|
|
144
149
|
python tools/debt_harvester.py --scan
|
|
145
150
|
python tools/debt_harvester.py --scan ./src --output DEBT_LEDGER.md
|
|
146
151
|
```
|
|
147
152
|
|
|
148
|
-
### 2.6. Senior Code
|
|
153
|
+
### 2.6. Senior Review Đánh Giá Code (6 Trụ Cột)
|
|
149
154
|
```bash
|
|
150
155
|
python tools/senior_code_review.py
|
|
151
156
|
python tools/senior_code_review.py --staged
|
|
@@ -153,19 +158,19 @@ python tools/senior_code_review.py --staged
|
|
|
153
158
|
|
|
154
159
|
---
|
|
155
160
|
|
|
156
|
-
## 3.
|
|
161
|
+
## 3. Quy Ước Mã Thoát Tiêu Chuẩn (Exit Codes) & Môi Trường Terminal
|
|
157
162
|
|
|
158
|
-
Synapse Hub
|
|
163
|
+
Synapse Hub áp dụng mã thoát tiêu chuẩn UNIX tất định trên toàn bộ công cụ CLI:
|
|
159
164
|
|
|
160
|
-
|
|
|
165
|
+
| Mã Thoát | Hằng Số | Ý Nghĩa Thực Tế | Cách Xử Lý |
|
|
161
166
|
| :---: | :--- | :--- | :--- |
|
|
162
|
-
| **`0`** | `EXIT_SUCCESS` |
|
|
163
|
-
| **`1`** | `EXIT_FAILURE` |
|
|
164
|
-
| **`2`** | `EXIT_USAGE_ERROR` |
|
|
165
|
-
| **`3`** | `EXIT_SECURITY_BLOCK` |
|
|
166
|
-
| **`4`** | `EXIT_ENVIRONMENT_ERROR` |
|
|
167
|
-
|
|
168
|
-
###
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
167
|
+
| **`0`** | `EXIT_SUCCESS` | Thành công; tất cả Cổng Chất Lượng đều đạt; 0 lỗi nghiêm trọng. | Tiến hành bước tiếp theo của pipeline hoặc commit. |
|
|
168
|
+
| **`1`** | `EXIT_FAILURE` | Cổng kiểm định từ chối; test bị fail; phát hiện lỗi tĩnh linter. | Đọc chi tiết báo lỗi; bổ sung câu lệnh assert hoặc gỡ khối nuốt ngoại lệ. |
|
|
169
|
+
| **`2`** | `EXIT_USAGE_ERROR` | Tham số CLI không hợp lệ; gõ sai lệnh; lỗi cú pháp. | Gõ thêm `--help` sau lệnh để xem cú pháp chuẩn. |
|
|
170
|
+
| **`3`** | `EXIT_SECURITY_BLOCK` | Thao tác nguy hiểm bị firewall chặn; lộ token; sửa giấy phép MIT. | Kiểm tra lại vi phạm bảo mật; đặt `ALLOW_DESTRUCTIVE=1` nếu thật sự cố ý. |
|
|
171
|
+
| **`4`** | `EXIT_ENVIRONMENT_ERROR` | Môi trường không tương thích; thiếu công cụ bắt buộc (ví dụ Python < 3.9). | Cài đặt runtime khuyến nghị (Python 3.10+, Node 20+). |
|
|
172
|
+
|
|
173
|
+
### Tiêu Chuẩn Hiển Thị Trên Terminal:
|
|
174
|
+
- **Hỗ Trợ `NO_COLOR`:** Tuân thủ chuẩn [no-color.org](https://no-color.org), khi đặt biến môi trường `NO_COLOR`, hệ thống tự tắt mọi mã màu ANSI.
|
|
175
|
+
- **Cờ `--quiet` / `-q`:** Thêm cờ `-q` để ẩn bớt banner giới thiệu và chỉ in ra kết quả phán quyết hoặc định dạng dữ liệu cho máy đọc.
|
|
176
|
+
- **Định Dạng Dành Cho CI:** Sử dụng `--format json`, `--format sarif`, hoặc `--format junit` để xuất dữ liệu sạch cho các pipeline CI/CD tích hợp tự động.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributing to Synapse-Hub
|
|
2
|
+
|
|
3
|
+
[🇻🇳 Tiếng Việt](CONTRIBUTING.md) | [🇬🇧 English Edition](CONTRIBUTING.en.md)
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Skill Authoring Standards
|
|
10
|
+
|
|
11
|
+
Every skill resides in `.agents/skills/<skill-name>/` and must satisfy:
|
|
12
|
+
|
|
13
|
+
1. **`SKILL.md` Structure:**
|
|
14
|
+
- Must contain valid YAML frontmatter with `name` and `description`.
|
|
15
|
+
- `name` must exactly match the directory name in kebab-case.
|
|
16
|
+
- `description` must clearly articulate the triggering scope and disambiguate itself from adjacent skills.
|
|
17
|
+
2. **Conciseness & Token Budget:**
|
|
18
|
+
- Write instructions in concise technical English to minimize LLM token consumption.
|
|
19
|
+
- Use progressive disclosure: keep `SKILL.md` between 40 and 150 lines, and offload deep code patterns to `references/` or `examples/`.
|
|
20
|
+
3. **Zero Project Coupling:**
|
|
21
|
+
- Never hardcode specific project names, proprietary URLs, test credentials, or internal namespaces.
|
|
22
|
+
- Always use generic placeholders: `<project_namespace>`, `https://app.example.com`, `APP_PASSWORD`.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. Integrity Verification Workflow
|
|
27
|
+
|
|
28
|
+
Before submitting a pull request or committing changes:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 1. Run unit test suite (260+ tests)
|
|
32
|
+
python3 -m unittest discover tests
|
|
33
|
+
|
|
34
|
+
# 2. Verify all 10 DoD Quality Gates (Gate 0–9)
|
|
35
|
+
python3 tools/verify_all.py
|
|
36
|
+
|
|
37
|
+
# 3. Test documentation and entity references integrity
|
|
38
|
+
python3 tools/lint_ai_docs.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 3. Tool Development Guidelines
|
|
44
|
+
|
|
45
|
+
All helper scripts in `tools/` must:
|
|
46
|
+
1. **Rely on Standard Libraries:** Minimize third-party package dependencies so tools execute seamlessly across clean host machines and CI pipelines.
|
|
47
|
+
2. **Be Fast & Non-Blocking:** AST scans and regex lookups must complete in under 500ms.
|
|
48
|
+
3. **Zero Test File Pollution:** Tests must use `tempfile.TemporaryDirectory()` and never write temporary test artifacts to the repository tree.
|
|
49
|
+
4. **Handle Errors Gracefully:** Provide clear remedies and pointers rather than dumping raw stack traces.
|
package/docs/CONTRIBUTING.md
CHANGED
|
@@ -1,91 +1,49 @@
|
|
|
1
|
-
# Hướng Dẫn Đóng Góp
|
|
1
|
+
# Hướng Dẫn Đóng Góp Vào Synapse-Hub
|
|
2
2
|
|
|
3
|
-
[🇻🇳 Tiếng Việt](
|
|
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
|
-
|
|
7
|
+
---
|
|
10
8
|
|
|
11
|
-
|
|
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/<
|
|
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
|
|
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`
|
|
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
|
-
-
|
|
21
|
-
- Áp dụng nguyên lý
|
|
22
|
-
3. **Không
|
|
23
|
-
-
|
|
24
|
-
- Luôn
|
|
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
|
-
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. Quy Trình Kiểm Thử Trước Khi Mở Pull Request
|
|
27
27
|
|
|
28
|
-
Trước khi
|
|
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ộ
|
|
31
|
+
# 1. Chạy toàn bộ 260+ bài unit test
|
|
32
32
|
python3 -m unittest discover tests
|
|
33
33
|
|
|
34
|
-
# 2. Kiểm định toàn vẹn
|
|
34
|
+
# 2. Kiểm định toàn vẹn 10 Cổng Chất Lượng DoD (Gate 0–9)
|
|
35
35
|
python3 tools/verify_all.py
|
|
36
36
|
|
|
37
37
|
# 3. Kiểm tra tính toàn vẹn của tài liệu và công cụ
|
|
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
|
-
##
|
|
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
|
-
|
|
88
|
-
1.
|
|
89
|
-
2. **
|
|
90
|
-
3. **
|
|
91
|
-
4. **
|
|
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ô.
|