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
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# 🛡️ Tiêu Chuẩn 10 Cổng Chất Lượng DoD (Definition of Done)
|
|
2
|
+
|
|
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.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
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). |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
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ự).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🚀 Cách Chạy & Tích Hợp Vào CI/CD
|
|
87
|
+
|
|
88
|
+
### Chạy Cục Bộ Trên Máy:
|
|
89
|
+
```bash
|
|
90
|
+
# Kiểm định toàn bộ 10 Cổng trên repo hiện tại
|
|
91
|
+
python3 tools/verify_all.py
|
|
92
|
+
|
|
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
|
|
95
|
+
|
|
96
|
+
# Xuất kết quả ra file JUnit XML để CI/CD đọc
|
|
97
|
+
python3 tools/verify_all.py --format junit --output reports/dod_gates.xml
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Đường Ống GitHub Actions (`.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
|
+
```
|
|
@@ -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/
|
|
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
package/scripts/package_dist.py
CHANGED
|
@@ -37,6 +37,7 @@ EXCLUDE_DIRS = {
|
|
|
37
37
|
"__pycache__",
|
|
38
38
|
".pytest_cache",
|
|
39
39
|
".mypy_cache",
|
|
40
|
+
".ruff_cache",
|
|
40
41
|
".idea",
|
|
41
42
|
".vscode",
|
|
42
43
|
"agent_qa.egg-info",
|
|
@@ -280,7 +281,7 @@ def create_package(output_zip: str = "agent-skills.zip") -> Path:
|
|
|
280
281
|
total_size += full_path.stat().st_size
|
|
281
282
|
|
|
282
283
|
zip_size_mb = out_path.stat().st_size / (1024 * 1024)
|
|
283
|
-
print(
|
|
284
|
+
print("✅ Packaging complete:")
|
|
284
285
|
print(f" • Total files packaged : {total_files}")
|
|
285
286
|
print(f" • Uncompressed size : {total_size / (1024 * 1024):.2f} MB")
|
|
286
287
|
print(f" • Archive size (.zip) : {zip_size_mb:.2f} MB")
|
package/skills_manifest.json
CHANGED
|
@@ -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": "
|
|
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": {
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
"name": "Senior Code Review",
|
|
493
493
|
"category": "architecture_and_analysis",
|
|
494
494
|
"path": ".agents/skills/senior-code-review/SKILL.md",
|
|
495
|
-
"summary": "
|
|
495
|
+
"summary": "Review code changes across logic, security, concurrency, and test coverage. Use when conducting pull request reviews, diff inspections, or auditing commit changes before merge.",
|
|
496
496
|
"version": "1.0.0"
|
|
497
497
|
},
|
|
498
498
|
{
|
|
@@ -500,7 +500,7 @@
|
|
|
500
500
|
"name": "Repo Quality Audit",
|
|
501
501
|
"category": "architecture_and_analysis",
|
|
502
502
|
"path": ".agents/skills/repo-quality-audit/SKILL.md",
|
|
503
|
-
"summary": "
|
|
503
|
+
"summary": "Comprehensive codebase quality audit covering bugs, security, bottlenecks, and bloat. Use when auditing an entire project, evaluating repository health, or prioritizing technical debt.",
|
|
504
504
|
"version": "1.0.0"
|
|
505
505
|
},
|
|
506
506
|
{
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
"name": "Technical Debt Harvester",
|
|
509
509
|
"category": "architecture_and_analysis",
|
|
510
510
|
"path": ".agents/skills/technical-debt-harvester/SKILL.md",
|
|
511
|
-
"summary": "Harvest shortcut: comments into a tracked debt ledger
|
|
511
|
+
"summary": "Harvest shortcut: comments into a tracked technical debt ledger. Use when auditing code compromises, tracking deferred refactorings, or scanning for shortcut markers.",
|
|
512
512
|
"version": "1.0.0"
|
|
513
513
|
},
|
|
514
514
|
{
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
"name": "Lean Impact Scoreboard",
|
|
517
517
|
"category": "architecture_and_analysis",
|
|
518
518
|
"path": ".agents/skills/lean-impact-scoreboard/SKILL.md",
|
|
519
|
-
"summary": "Display
|
|
519
|
+
"summary": "Display empirical impact scoreboards (code reduction, token savings, mutation rigor). Use when reviewing lean engineering benchmarks, token throughput, or reporting quality metrics.",
|
|
520
520
|
"version": "1.0.0"
|
|
521
521
|
},
|
|
522
522
|
{
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
"name": "Review Spec (Goldfish Protocol)",
|
|
589
589
|
"category": "architecture_and_analysis",
|
|
590
590
|
"path": ".agents/skills/review-spec/SKILL.md",
|
|
591
|
-
"summary": "
|
|
591
|
+
"summary": "Stress-test specifications, user stories, and BDD feature files with zero-context rigor. Use when reviewing requirements, user stories, or acceptance criteria before code generation.",
|
|
592
592
|
"version": "1.0.0"
|
|
593
593
|
}
|
|
594
594
|
]
|
package/synapse.config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CLAUDE.md — Synapse-Hub Guidelines for Claude Code
|
|
2
2
|
|
|
3
|
-
> **Author & Creator:** Thế Vị (@TeeVee998) <https://github.com/TeeVee998/Synapse-Hub>
|
|
3
|
+
> **Author & Creator:** Thế Vị (@TeeVee998) <https://github.com/TeeVee998/Synapse-Hub>
|
|
4
4
|
> **License:** MIT License (Mandatory Attribution Preservation)
|
|
5
5
|
|
|
6
6
|
<!-- ============================================================================== -->
|
|
@@ -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.
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<!-- ============================================================================== -->
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
> **Project:** Synapse-Hub Enterprise QA Automation
|
|
10
|
-
> **Author:** Thế Vị (@TeeVee998) — MIT License
|
|
9
|
+
> **Project:** Synapse-Hub Enterprise QA Automation
|
|
10
|
+
> **Author:** Thế Vị (@TeeVee998) — MIT License
|
|
11
11
|
|
|
12
12
|
## Coding Invariants
|
|
13
13
|
- Enforce Clean Page Object Model (POM) with Flat Architecture.
|
package/tools/__init__.py
CHANGED
|
@@ -4,12 +4,29 @@ Synapse Hub — Enterprise AI Agent Quality Engineering & Automated Testing Tool
|
|
|
4
4
|
Author: Thế Vị (@TeeVee998)
|
|
5
5
|
Repository: https://github.com/TeeVee998/Synapse-Hub
|
|
6
6
|
License: MIT
|
|
7
|
+
|
|
8
|
+
Domain Packages:
|
|
9
|
+
- tools.core: Execution engines, 10 DoD Quality Gates, setup, CLI, AST maps.
|
|
10
|
+
- tools.lint: Static code defect, encoding, author integrity, and AI doc sentinels.
|
|
11
|
+
- tools.report: HTML dashboards, spreadsheets, telemetry correlation, and metrics.
|
|
12
|
+
- tools.heal: Locator healing, episodic Reflexion memory, and agentless patching.
|
|
13
|
+
- tools.perf: Flakiness detection, JMeter plans, BFCL benchmarks, and matrix sharding.
|
|
14
|
+
- tools.mcp: Model Context Protocol servers (core QA and Excel manipulation).
|
|
7
15
|
"""
|
|
8
16
|
|
|
9
|
-
__version__ = "
|
|
17
|
+
__version__ = "3.0.1"
|
|
10
18
|
__author__ = "Thế Vị (@TeeVee998)"
|
|
11
19
|
|
|
20
|
+
# Expose domain packages
|
|
21
|
+
from tools import core, heal, lint, mcp, perf, report # noqa: F401
|
|
22
|
+
|
|
12
23
|
__all__ = [
|
|
24
|
+
"core",
|
|
25
|
+
"heal",
|
|
26
|
+
"lint",
|
|
27
|
+
"mcp",
|
|
28
|
+
"perf",
|
|
29
|
+
"report",
|
|
13
30
|
"verify_all",
|
|
14
31
|
"infer_linter",
|
|
15
32
|
"micro_mutator",
|
package/tools/_openapi_parser.py
CHANGED
package/tools/agent_canary.py
CHANGED
|
@@ -85,15 +85,20 @@ class OverlayInterceptVector(MutationVector):
|
|
|
85
85
|
healed = False
|
|
86
86
|
patch = None
|
|
87
87
|
if os.path.exists(CACHE_DB):
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
try:
|
|
89
|
+
conn = sqlite3.connect(CACHE_DB)
|
|
90
|
+
try:
|
|
91
|
+
cur = conn.cursor()
|
|
92
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%ElementClickIntercepted%' LIMIT 1")
|
|
93
|
+
row = cur.fetchone()
|
|
94
|
+
if row:
|
|
95
|
+
patch = row[0]
|
|
96
|
+
if "click" in patch and ("JavascriptExecutor" in patch or "jsClick" in patch or "clickJS" in patch):
|
|
97
|
+
healed = True
|
|
98
|
+
finally:
|
|
99
|
+
conn.close()
|
|
100
|
+
except sqlite3.Error:
|
|
101
|
+
healed = False
|
|
97
102
|
|
|
98
103
|
elapsed_ms = (time.time() - start) * 1000
|
|
99
104
|
return {
|
|
@@ -121,15 +126,20 @@ class LocatorDriftVector(MutationVector):
|
|
|
121
126
|
healed = False
|
|
122
127
|
patch = None
|
|
123
128
|
if os.path.exists(CACHE_DB):
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
try:
|
|
130
|
+
conn = sqlite3.connect(CACHE_DB)
|
|
131
|
+
try:
|
|
132
|
+
cur = conn.cursor()
|
|
133
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%StaleElement%' LIMIT 1")
|
|
134
|
+
row = cur.fetchone()
|
|
135
|
+
if row:
|
|
136
|
+
patch = row[0]
|
|
137
|
+
if "retry" in patch.lower() or "for (" in patch or "findElement" in patch:
|
|
138
|
+
healed = True
|
|
139
|
+
finally:
|
|
140
|
+
conn.close()
|
|
141
|
+
except sqlite3.Error:
|
|
142
|
+
healed = False
|
|
133
143
|
|
|
134
144
|
elapsed_ms = (time.time() - start) * 1000
|
|
135
145
|
return {
|
|
@@ -201,12 +211,14 @@ class DataCollisionVector(MutationVector):
|
|
|
201
211
|
if os.path.exists(CACHE_DB):
|
|
202
212
|
try:
|
|
203
213
|
conn = sqlite3.connect(CACHE_DB)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
try:
|
|
215
|
+
cur = conn.cursor()
|
|
216
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%Duplicate_Code%'")
|
|
217
|
+
row = cur.fetchone()
|
|
218
|
+
if row and ("uniqueCode" in row[0] or "currentTimeMillis" in row[0]):
|
|
219
|
+
healed = True
|
|
220
|
+
finally:
|
|
221
|
+
conn.close()
|
|
210
222
|
except sqlite3.Error:
|
|
211
223
|
healed = False
|
|
212
224
|
|
|
@@ -247,7 +259,7 @@ class BomContaminationVector(MutationVector):
|
|
|
247
259
|
# 1. Inject BOM
|
|
248
260
|
with open(test_file, "wb") as f:
|
|
249
261
|
f.write(b"\xef\xbb\xbf// Test BOM contamination\n")
|
|
250
|
-
|
|
262
|
+
|
|
251
263
|
# 2. Detect BOM
|
|
252
264
|
with open(test_file, "rb") as f:
|
|
253
265
|
header = f.read(3)
|
|
@@ -261,7 +273,7 @@ class BomContaminationVector(MutationVector):
|
|
|
261
273
|
cleaned = raw[3:]
|
|
262
274
|
with open(test_file, "wb") as f:
|
|
263
275
|
f.write(cleaned)
|
|
264
|
-
|
|
276
|
+
|
|
265
277
|
# Re-verify
|
|
266
278
|
with open(test_file, "rb") as f:
|
|
267
279
|
if f.read(3) != b"\xef\xbb\xbf":
|
|
@@ -297,7 +309,7 @@ class MachinePathLeakVector(MutationVector):
|
|
|
297
309
|
sample_path = "C:\\Workspace\\Project\\tools\\verify_all.py"
|
|
298
310
|
detected = "C:\\" in sample_path or sample_path.startswith("/")
|
|
299
311
|
healed = False
|
|
300
|
-
|
|
312
|
+
|
|
301
313
|
# Simulate relative path conversion
|
|
302
314
|
relative_path = os.path.relpath(os.path.join(REPO_ROOT, "tools", "verify_all.py"), REPO_ROOT)
|
|
303
315
|
if not relative_path.startswith("/") and "C:" not in relative_path:
|
|
@@ -328,7 +340,7 @@ class RawXPathInScriptVector(MutationVector):
|
|
|
328
340
|
start = time.time()
|
|
329
341
|
sample_bad_script = 'WebUI.click(findTestObject("Object Repository/button_Save"))'
|
|
330
342
|
detected = "findTestObject" in sample_bad_script or "By.xpath" in sample_bad_script
|
|
331
|
-
|
|
343
|
+
|
|
332
344
|
# Self-healing translation: convert to Clean POM method call
|
|
333
345
|
healed_script = "CommonCategoryPage.saveCareer(careerCode, careerName)"
|
|
334
346
|
healed = "findTestObject" not in healed_script and "CommonCategoryPage" in healed_script
|
|
@@ -393,7 +405,7 @@ class CanaryArena:
|
|
|
393
405
|
print(f"{BOLD}{CYAN} (Dry-Run Simulation Benchmark - Heuristic Evaluation) {RESET}")
|
|
394
406
|
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
395
407
|
print(f"Target Repository : {REPO_ROOT}")
|
|
396
|
-
print(
|
|
408
|
+
print("Evaluation Mode : Isolated Memory Sandbox & Offline Local Resolvers")
|
|
397
409
|
print(f"Total Vectors : {len(self.vectors)} Failure Vectors")
|
|
398
410
|
print(f"Timestamp : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
399
411
|
|
|
@@ -442,7 +454,7 @@ class CanaryArena:
|
|
|
442
454
|
print(f" Autonomous Healing Rate : {GREEN if resolution_rate == 100 else RED}{resolution_rate:.1f}% ({healed_count}/{len(self.vectors)}){RESET}")
|
|
443
455
|
print(f" Mean Time To Repair (MTTR): {GREEN}{avg_mttr:.2f} ms{RESET} per incident")
|
|
444
456
|
print(f" Total Token Consumption : {GREEN}{total_tokens} tokens{RESET} (100% Offline Local)")
|
|
445
|
-
|
|
457
|
+
|
|
446
458
|
# Run verify_all gate
|
|
447
459
|
print(f"\n{BOLD}[POST-BENCHMARK DoD INTEGRITY CHECK]{RESET}")
|
|
448
460
|
verify_script = os.path.join(SCRIPT_DIR, "verify_all.py")
|
|
@@ -127,8 +127,8 @@ class AgentlessPatcher:
|
|
|
127
127
|
if method_name == "unknown_method":
|
|
128
128
|
# Scan backwards for enclosing def/function
|
|
129
129
|
for idx in range(line_no - 1, -1, -1):
|
|
130
|
-
|
|
131
|
-
fn_m = re.search(r'(?:def|async\s+function|function|public\s+def|\b([a-zA-Z0-9_]+)\s*\([^)]*\)\s*\{?)\s*([a-zA-Z0-9_]+)?',
|
|
130
|
+
line_content = lines[idx]
|
|
131
|
+
fn_m = re.search(r'(?:def|async\s+function|function|public\s+def|\b([a-zA-Z0-9_]+)\s*\([^)]*\)\s*\{?)\s*([a-zA-Z0-9_]+)?', line_content)
|
|
132
132
|
if fn_m:
|
|
133
133
|
method_name = fn_m.group(2) or fn_m.group(1) or "enclosing_scope"
|
|
134
134
|
break
|
package/tools/analyze_project.py
CHANGED
|
@@ -19,10 +19,8 @@ Generates & Updates In-Place inside the Target Project:
|
|
|
19
19
|
|
|
20
20
|
import os
|
|
21
21
|
import sys
|
|
22
|
-
import json
|
|
23
22
|
import argparse
|
|
24
23
|
from datetime import datetime
|
|
25
|
-
from pathlib import Path
|
|
26
24
|
|
|
27
25
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
28
26
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -232,9 +230,9 @@ def run_full_analysis(target_repo):
|
|
|
232
230
|
print(f" In-Project Report Path : {report_in_root if os.path.abspath(target_repo).lower() != os.path.abspath(HUB_ROOT).lower() else report_in_reports}")
|
|
233
231
|
if os.path.abspath(target_repo).lower() != os.path.abspath(HUB_ROOT).lower():
|
|
234
232
|
print(f" {YELLOW}💡 Post-Analysis Action: Push updated files to Git:{RESET}")
|
|
235
|
-
print(
|
|
236
|
-
print(
|
|
237
|
-
print(
|
|
233
|
+
print(" git add PROJECT_HEALTH_REPORT.md repo_map.txt")
|
|
234
|
+
print(" git commit -m \"docs(audit): update project health report and AST repo map\"")
|
|
235
|
+
print(" git push origin <branch>")
|
|
238
236
|
print(f"{BOLD}{CYAN}======================================================================{RESET}\n")
|
|
239
237
|
|
|
240
238
|
return 0 if gates_passed else 1
|
|
@@ -11,7 +11,7 @@ import os
|
|
|
11
11
|
import sys
|
|
12
12
|
import json
|
|
13
13
|
import argparse
|
|
14
|
-
from typing import Dict, List, Any
|
|
14
|
+
from typing import Dict, List, Any
|
|
15
15
|
|
|
16
16
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
17
17
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -91,7 +91,7 @@ def compare_specs(old_spec: Dict[str, Any], new_spec: Dict[str, Any]) -> Dict[st
|
|
|
91
91
|
"path": f"{method.upper()} {path}",
|
|
92
92
|
"detail": f"Parameter '{p_name}' was changed from optional to required"
|
|
93
93
|
})
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
old_type = old_p.get("type") or old_p.get("schema", {}).get("type")
|
|
96
96
|
new_type = new_p.get("type") or new_p.get("schema", {}).get("type")
|
|
97
97
|
if old_type and new_type and old_type != new_type:
|
|
@@ -145,8 +145,8 @@ def generate_markdown_report(analysis: Dict[str, Any], old_path: str, new_path:
|
|
|
145
145
|
f"- **Verdict:** {status_icon} (Health Score: `{analysis['contract_health_score']:.1f}%`)",
|
|
146
146
|
"",
|
|
147
147
|
"## Summary Metrics",
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
"| Breaking Changes | Warnings | Compatible Additions |",
|
|
149
|
+
"| :---: | :---: | :---: |",
|
|
150
150
|
f"| **{analysis['breaking_changes_count']}** | **{analysis['warnings_count']}** | **{analysis['additions_count']}** |",
|
|
151
151
|
""
|
|
152
152
|
]
|