@teevee98/synapse-hub 4.1.4 → 4.2.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/rules/git-push-protocol.md +2 -2
- package/.agents/skills/01-web-automation/auth-session-and-cookie-manager/SKILL.md +52 -3
- package/.agents/skills/01-web-automation/bats-testing-patterns/SKILL.md +55 -5
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +62 -67
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +54 -4
- package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +62 -12
- package/.agents/skills/01-web-automation/lam-script-generator/SKILL.md +55 -8
- package/.agents/skills/01-web-automation/mobile-appium-som/SKILL.md +60 -12
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/BaseScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/LoginScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/TC_MobileLogin.java +2 -2
- package/.agents/skills/01-web-automation/playwright-live-interaction/SKILL.md +54 -91
- package/.agents/skills/01-web-automation/playwright-webapp-testing/SKILL.md +59 -11
- package/.agents/skills/01-web-automation/web-agent-gym-benchmarking/SKILL.md +50 -4
- package/.agents/skills/02-test-design/architecture-decision-records/SKILL.md +55 -9
- package/.agents/skills/02-test-design/gherkin-to-suite/SKILL.md +55 -9
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +55 -8
- package/.agents/skills/02-test-design/review-spec/SKILL.md +50 -6
- package/.agents/skills/02-test-design/tot-exploratory-testing/SKILL.md +50 -4
- package/.agents/skills/03-api-and-contracts/api-network-mocking-interception/SKILL.md +56 -5
- package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +53 -7
- package/.agents/skills/03-api-and-contracts/consumer-driven-contract-testing/SKILL.md +86 -36
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +54 -6
- package/.agents/skills/04-performance-and-load/lean-impact-scoreboard/SKILL.md +50 -6
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +50 -3
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +63 -14
- package/.agents/skills/05-security-and-compliance/skillspector-security-guard/SKILL.md +51 -5
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +54 -4
- package/.agents/skills/06-healing-and-resilience/agentless-qa-repair/SKILL.md +51 -5
- package/.agents/skills/06-healing-and-resilience/antigravity-test-sentinel/SKILL.md +53 -6
- package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +54 -8
- package/.agents/skills/06-healing-and-resilience/flaky-test-sentinel-and-quarantine/SKILL.md +60 -24
- package/.agents/skills/06-healing-and-resilience/self-healing-locator/SKILL.md +52 -6
- package/.agents/skills/06-healing-and-resilience/systematic-debugging/SKILL.md +56 -10
- package/.agents/skills/06-healing-and-resilience/test-driven-development/SKILL.md +58 -12
- package/.agents/skills/06-healing-and-resilience/verification-before-completion/SKILL.md +58 -12
- package/.agents/skills/06-healing-and-resilience/visual-regression-sentinel/SKILL.md +53 -5
- package/.agents/skills/07-data-and-state/db-state-verifier-and-seeder/SKILL.md +56 -5
- package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +53 -4
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +58 -5
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/SKILL.md +57 -11
- package/.agents/skills/08-code-quality/graphify-impact-analyzer/SKILL.md +83 -34
- package/.agents/skills/08-code-quality/graphify-impact-analyzer/examples/dependency_blast_radius.json +3 -4
- package/.agents/skills/08-code-quality/lean-code-ladder/SKILL.md +55 -10
- package/.agents/skills/08-code-quality/repo-quality-audit/SKILL.md +49 -6
- package/.agents/skills/08-code-quality/senior-code-review/SKILL.md +52 -7
- package/.agents/skills/08-code-quality/surgical-coding-principles/SKILL.md +55 -10
- package/.agents/skills/08-code-quality/technical-debt-harvester/SKILL.md +51 -5
- package/.agents/skills/09-ci-and-devops/github-actions-templates/SKILL.md +54 -17
- package/.agents/skills/09-ci-and-devops/github-actions-templates/examples/matrix_test_pipeline.yml +2 -1
- package/.agents/skills/10-agent-orchestration/actor-qa-swarm/SKILL.md +50 -4
- package/.agents/skills/10-agent-orchestration/agent-orchestration-multi-agent-optimize/SKILL.md +53 -7
- package/.agents/skills/10-agent-orchestration/event-stream-qa-orchestrator/SKILL.md +50 -4
- package/.agents/skills/10-agent-orchestration/persistent-planning-files/SKILL.md +58 -13
- package/.agents/skills/10-agent-orchestration/qa-memory-os/SKILL.md +51 -5
- package/.agents/skills/11-ai-and-prompting/meta-prompt-crafter/SKILL.md +57 -10
- package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +50 -4
- package/.agents/skills/11-ai-and-prompting/qa-aci-interface/SKILL.md +50 -4
- package/.agents/skills/11-ai-and-prompting/token-and-context-optimizer/SKILL.md +55 -9
- package/.cursor/rules/synapse-qa.mdc +20 -7
- package/.cursorrules +19 -5
- package/.windsurfrules +18 -3
- package/AGENTS.md +51 -59
- package/CLAUDE.md +38 -24
- package/LICENSE +5 -5
- package/NOTICE +1 -1
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +2 -2
- package/docs/ARCHITECTURE.md +11 -2
- package/docs/CLIENT_SUPPORT_MATRIX.md +44 -0
- package/docs/CLI_REFERENCE.en.md +6 -4
- package/docs/CLI_REFERENCE.md +1 -1
- package/docs/CONTRIBUTING.en.md +1 -1
- package/docs/CONTRIBUTING.md +2 -2
- package/docs/SIDE_EFFECTING_TOOLS_INVENTORY.md +233 -0
- package/docs/TOOL_CATALOG.md +6 -2
- package/docs/research/agent_skill_training_analysis.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +320 -55
- package/synapse.config.json +1 -1
- package/templates/ai_bridges/CLAUDE.md +29 -26
- package/templates/ai_bridges/copilot-instructions.md +14 -5
- package/templates/ai_bridges/cursor_synapse_qa.mdc +16 -7
- package/templates/ai_bridges/windsurfrules +14 -3
- package/templates/ui/index.html +2 -2
- package/tools/TOOLS_RUNBOOK.md +1 -1
- package/tools/TOOL_CATALOG.json +63 -3
- package/tools/__init__.py +1 -1
- package/tools/api_fuzzer.py +447 -132
- package/tools/author_integrity.py +121 -11
- package/tools/benchmark_swarm_context.py +130 -22
- package/tools/break_ui_generator.py +233 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/check_version_sync.py +18 -50
- package/tools/cli.py +110 -19
- package/tools/core/bm25_retriever.py +218 -0
- package/tools/core/i18n.py +5 -5
- package/tools/core/provider_usage_adapter.py +383 -0
- package/tools/core/token_estimator.py +81 -15
- package/tools/count_tokens.py +7 -2
- package/tools/coverage_reporter.py +245 -0
- package/tools/dashboard_generator.py +8 -8
- package/tools/db_sandbox.py +290 -9
- package/tools/distill_log.py +1 -1
- package/tools/distill_skill.py +206 -0
- package/tools/git_pre_commit_guard.py +202 -1
- package/tools/humanize_linter.py +3 -0
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +104 -16
- package/tools/micro_mutator.py +114 -15
- package/tools/pentest_scope_guard.py +674 -58
- package/tools/perf/benchmark_perf_runner.py +42 -0
- package/tools/project_state.py +29 -5
- package/tools/reversible_sandbox.py +58 -13
- package/tools/rules_router.py +473 -60
- package/tools/security_scanner.py +80 -0
- package/tools/senior_code_review.py +14 -0
- package/tools/skill_canonical_digest.py +302 -0
- package/tools/skill_profiles.py +77 -7
- package/tools/slide_deck_exporter.py +477 -0
- package/tools/sync_agent_rules.py +187 -61
- package/tools/sync_skills_manifest.py +166 -0
- package/tools/task_memory_manager.py +275 -0
- package/tools/ui_server.py +3 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/validate_host_interop.py +485 -0
- package/tools/validate_skills_schema.py +575 -0
- package/tools/verify_all.py +668 -44
- package/tools/welcome_page.py +2 -2
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
"""
|
|
7
7
|
tools/sync_agent_rules.py — Synchronizes AGENTS.md single-source rules to all AI bridges
|
|
8
8
|
--------------------------------------------------------------------------------------
|
|
9
|
-
Enforces F1: Eliminates prompt rule drift by compiling the single source of truth (AGENTS.md)
|
|
9
|
+
Enforces F1 & R5: Eliminates prompt rule drift by compiling the single source of truth (AGENTS.md)
|
|
10
10
|
into individual IDE/Assistant bridge files:
|
|
11
11
|
- CLAUDE.md & templates/ai_bridges/CLAUDE.md
|
|
12
12
|
- .cursorrules
|
|
13
13
|
- .windsurfrules & templates/ai_bridges/windsurfrules
|
|
14
14
|
- .cursor/rules/synapse-qa.mdc & templates/ai_bridges/cursor_synapse_qa.mdc
|
|
15
|
-
- templates/ai_bridges/copilot-instructions.md
|
|
15
|
+
- .github/copilot-instructions.md & templates/ai_bridges/copilot-instructions.md
|
|
16
|
+
- .github/instructions/clean-pom.instructions.md
|
|
16
17
|
|
|
17
18
|
Usage:
|
|
18
19
|
python3 tools/sync_agent_rules.py # Regenerates all bridge files
|
|
@@ -46,8 +47,28 @@ HEADER_HASH_TEMPLATE = """# ====================================================
|
|
|
46
47
|
"""
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
def generate_claude_md():
|
|
50
|
+
def generate_claude_md(is_template=False):
|
|
50
51
|
"""Generates the unified CLAUDE.md file compiling agent rules and standards."""
|
|
52
|
+
quick_commands = """## ⚡ Quick Commands
|
|
53
|
+
- Native Test Suite: `npm test` (or `pytest`)
|
|
54
|
+
- End-to-End Suite: `npx playwright test`
|
|
55
|
+
- Code Linter: `npm run lint` (or `ruff check .`)""" if is_template else """## ⚡ Quick Commands
|
|
56
|
+
- Verify 10 Quality Gates: `python tools/verify_all.py --mode hub` (or `npx @teevee98/synapse-hub verify`)
|
|
57
|
+
- Project Health Audit: `python tools/analyze_project.py`
|
|
58
|
+
- Code Linter & Fake-Pass Sentinel: `python tools/infer_linter.py`
|
|
59
|
+
- Verify Author Attribution: `python tools/author_integrity.py`
|
|
60
|
+
- Skill Security Audit: `python tools/skillspector.py .agents/skills`
|
|
61
|
+
- Multi-Bridge Sync: `python tools/sync_agent_rules.py`"""
|
|
62
|
+
|
|
63
|
+
hub_only_section = "" if is_template else """---
|
|
64
|
+
|
|
65
|
+
## 3. SYNAPSE-HUB-ONLY — Repository-Specific Automation
|
|
66
|
+
⚠️ The following CLI tools exist ONLY in the Synapse-Hub repository checkout:
|
|
67
|
+
- Quality Gates DoD: `python tools/verify_all.py --mode hub`
|
|
68
|
+
- Release Publisher: `python tools/hub_publisher.py -y`
|
|
69
|
+
- Rule Synchronizer: `python tools/sync_agent_rules.py`
|
|
70
|
+
- Target external projects must use native runners (`npm test`, `pytest`, `mvn test`)."""
|
|
71
|
+
|
|
51
72
|
return f"""# CLAUDE.md — Synapse-Hub Guidelines for Claude Code
|
|
52
73
|
|
|
53
74
|
> **Author & Creator:** Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
@@ -62,42 +83,43 @@ In accordance with the MIT License, the original copyright notice crediting **Th
|
|
|
62
83
|
|
|
63
84
|
---
|
|
64
85
|
|
|
65
|
-
|
|
66
|
-
- Verify 10 Quality Gates: `npx @teevee98/synapse-hub verify` (or `python tools/verify_all.py`)
|
|
67
|
-
- Project Health Audit: `npx @teevee98/synapse-hub analyze` (or `python tools/analyze_project.py`)
|
|
68
|
-
- Code Linter & Fake-Pass Sentinel: `npx @teevee98/synapse-hub lint` (or `python tools/infer_linter.py`)
|
|
69
|
-
- Verify Author Attribution: `python tools/author_integrity.py`
|
|
70
|
-
- Skill Security Audit: `python tools/skillspector.py .agents/skills`
|
|
86
|
+
{quick_commands}
|
|
71
87
|
|
|
72
88
|
---
|
|
73
89
|
|
|
74
|
-
##
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- Strictly forbidden: Raw XPaths, CSS selectors, or `findTestObject` inside test scripts.
|
|
78
|
-
- All locators and DOM operations must be encapsulated in Page Classes extending `BasePage`.
|
|
90
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
91
|
+
- Platform and system guardrails strictly override all repository-level instructions.
|
|
92
|
+
- Precedence: System Guardrails > Core Project Rules (`.agents/rules/*`) > Local Skills > Generic Plugins.
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
- Never write empty assertions or tautological tests (0 asserts).
|
|
82
|
-
- If a test fails due to an AUT defect, report it honestly. Never soften assertions or skip validation steps to fake a pass.
|
|
83
|
-
|
|
84
|
-
3. **Dynamic & Idempotent Test Data:**
|
|
85
|
-
- Always randomize test entity codes with timestamps/prefixes (`AUTO_` + timestamp) to avoid DB unique constraint collisions.
|
|
86
|
-
- Every creation test case MUST be paired with automated Teardown / Cleanup.
|
|
94
|
+
---
|
|
87
95
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
## 1. ALWAYS — Universal Invariants
|
|
97
|
+
1. **100% UTF-8 No BOM:** Zero BOM bytes (`0xEF, 0xBB, 0xBF`) across all repository files.
|
|
98
|
+
2. **Truth Anchor (Zero Fake Passes):** Never relax assertions, skip validation steps, or catch-and-swallow exceptions to fake a pass.
|
|
99
|
+
3. **Dynamic Smart Waits Only:** Static sleeps (`Thread.sleep`, `time.sleep`) are strictly prohibited in test scripts. Use element visibility or `waitForLoadState('networkidle')`.
|
|
100
|
+
4. **Dynamic & Idempotent Test Data:** Always randomize test entity codes with dynamic timestamps/prefixes (`BasePage.uniqueCode("AUTO_")`). Pair creation with automated Teardown cleanup.
|
|
101
|
+
5. **Strict Credential Security:** Never commit raw plaintext passwords, secret tokens, or private keys.
|
|
102
|
+
6. **Out-of-Scope Isolation:** When verification gates fail due to legacy defects in files outside task scope, stop and report; never touch out-of-scope files.
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
- Conversational responses, explanation, and telemetry MUST be in Vietnamese.
|
|
94
|
-
- All codebase assets, test scripts, Page Classes, docstrings, and commits MUST remain strictly in English.
|
|
95
|
-
- 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.
|
|
104
|
+
---
|
|
96
105
|
|
|
97
|
-
|
|
106
|
+
## 2. RECOMMENDED — Best Practices
|
|
107
|
+
1. **Clean Page Object Model (POM) Flat Architecture:**
|
|
108
|
+
- Test scripts (`tests/`, `Scripts/`) must contain ONLY business workflow method calls on Page Classes.
|
|
109
|
+
- Strictly forbidden: Raw XPaths, CSS selectors, or `findTestObject` inside test scripts.
|
|
110
|
+
- All locators and DOM operations belong in Page Classes extending `BasePage`. Keep inheritance flat (max 1 level).
|
|
111
|
+
2. **Lean Senior Dev Protocol (7-Rung Ladder & YAGNI):**
|
|
98
112
|
- The best code is the code never written. Solve the whole problem with the least new code.
|
|
99
113
|
- Descend the 7-rung ladder: 1. Need to exist? 2. Already in codebase? 3. Standard library? 4. Platform native? 5. Installed dependency? 6. One clear line? 7. Minimum working code.
|
|
100
|
-
-
|
|
114
|
+
- Deliberate simplifications get an inline comment: `shortcut: <the limit>, <when to upgrade>`.
|
|
115
|
+
3. **Risk-Conditioned Autonomous Ceremonies:**
|
|
116
|
+
- Jesse Vincent Rulings (`Ruling:`): Mandatory for architectural forks, breaking changes, or non-trivial tradeoffs. Omit for trivial doc/typo fixes.
|
|
117
|
+
- Addy Osmani Falsification (3 failure scenarios): Mandatory before certifying core test cases or complex locators.
|
|
118
|
+
4. **Bilingual Communication & English-First Ingestion:**
|
|
119
|
+
- Conversational responses, explanation, and telemetry in Vietnamese.
|
|
120
|
+
- Codebase files, test scripts, Page Classes, docstrings, and commits strictly in English.
|
|
121
|
+
- Read English versions (`*.en.md`) when bilingual docs exist to preserve tokens.
|
|
122
|
+
{hub_only_section}
|
|
101
123
|
"""
|
|
102
124
|
|
|
103
125
|
|
|
@@ -120,17 +142,36 @@ def generate_cursorrules():
|
|
|
120
142
|
# of the MIT License for Synapse Hub (Created by Thế Vị @TeeVee98)."
|
|
121
143
|
# ==============================================================================
|
|
122
144
|
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
145
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
146
|
+
- Platform and system guardrails strictly supersede all repository instructions.
|
|
147
|
+
|
|
148
|
+
## 1. ALWAYS — Universal Invariants
|
|
149
|
+
- 100% UTF-8 No BOM across all repository and test files.
|
|
127
150
|
- Zero fake passes: test assertions must strictly validate real state.
|
|
128
|
-
-
|
|
151
|
+
- Dynamic smart waits only: static sleeps (Thread.sleep, time.sleep) strictly prohibited.
|
|
152
|
+
- Dynamic & idempotent test data: unique timestamped codes with automated teardown.
|
|
153
|
+
- Strict credential security: never commit plaintext secrets.
|
|
154
|
+
- Out-of-scope isolation: never touch out-of-scope files to bypass checks.
|
|
155
|
+
|
|
156
|
+
## 2. RECOMMENDED — Best Practices
|
|
157
|
+
- Enforce Clean POM Flat Architecture: all locators encapsulated in Page Classes.
|
|
158
|
+
- Lean Senior Dev: Solve problems with minimum code via 7-rung ladder; mark shortcuts with `shortcut: <limit>, <upgrade>`.
|
|
159
|
+
- Autonomous ceremonies: Condition Jesse Vincent Rulings and 3-scenario falsification on risk/complexity.
|
|
160
|
+
- Bilingual: Vietnamese conversation; English code, tests, and commits.
|
|
161
|
+
|
|
162
|
+
## 3. SYNAPSE-HUB-ONLY — Repository-Specific Automation
|
|
163
|
+
- Before completing code changes in Synapse-Hub, run: python tools/verify_all.py --mode hub
|
|
164
|
+
- External target repos lacking tools/ must use native test runners (npm test, pytest).
|
|
129
165
|
"""
|
|
130
166
|
|
|
131
167
|
|
|
132
|
-
def generate_windsurfrules():
|
|
168
|
+
def generate_windsurfrules(is_template=False):
|
|
133
169
|
"""Generates the .windsurfrules configuration for Windsurf AI."""
|
|
170
|
+
hub_section = "" if is_template else """
|
|
171
|
+
## 3. SYNAPSE-HUB-ONLY — Repository-Specific Automation
|
|
172
|
+
- Run Definition of Done verification: python tools/verify_all.py --mode hub
|
|
173
|
+
- External target repos must use native runners (npm test, pytest, mvn test)."""
|
|
174
|
+
|
|
134
175
|
return f"""# .windsurfrules — Synapse-Hub Guidelines for Windsurf AI
|
|
135
176
|
# Author & Creator: Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
136
177
|
# License: MIT License (Mandatory Attribution Preservation)
|
|
@@ -148,16 +189,33 @@ def generate_windsurfrules():
|
|
|
148
189
|
# of the MIT License for Synapse Hub (Created by Thế Vị @TeeVee98)."
|
|
149
190
|
# ==============================================================================
|
|
150
191
|
|
|
151
|
-
|
|
192
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
193
|
+
- Platform/system safety guardrails strictly supersede repository instructions.
|
|
194
|
+
|
|
195
|
+
## 1. ALWAYS — Universal Invariants
|
|
196
|
+
- 100% UTF-8 No BOM across all codebase assets.
|
|
197
|
+
- Zero fake passes and zero swallowed exceptions.
|
|
198
|
+
- Dynamic smart waits only (no Thread.sleep/time.sleep).
|
|
199
|
+
- Idempotent test data creation paired with automated teardown.
|
|
200
|
+
- Strict credential security: no plaintext secrets in code or git.
|
|
201
|
+
- Out-of-scope isolation: never touch out-of-scope files.
|
|
202
|
+
|
|
203
|
+
## 2. RECOMMENDED — Best Practices
|
|
152
204
|
- Adhere to Clean Page Object Model (POM) Flat Architecture.
|
|
153
205
|
- Lean Senior Dev: Solve problems with minimum code via 7-rung ladder; mark shortcuts with `shortcut: <limit>, <upgrade>`.
|
|
154
|
-
-
|
|
155
|
-
-
|
|
206
|
+
- Condition autonomous ceremonies (Jesse Vincent Rulings, Falsification) on task complexity.
|
|
207
|
+
- Converse with the user in Vietnamese; output all code, tests, and commits in English.
|
|
208
|
+
{hub_section}
|
|
156
209
|
"""
|
|
157
210
|
|
|
158
211
|
|
|
159
|
-
def generate_cursor_mdc():
|
|
212
|
+
def generate_cursor_mdc(is_template=False):
|
|
160
213
|
"""Generates the .cursor/rules/synapse-qa.mdc file for Cursor IDE."""
|
|
214
|
+
hub_section = "" if is_template else """
|
|
215
|
+
## 3. SYNAPSE-HUB-ONLY — Repository-Specific Automation
|
|
216
|
+
- Quality Gates DoD verification: `python tools/verify_all.py --mode hub`.
|
|
217
|
+
- External target projects must use native runners (`npm test`, `pytest`, `mvn test`)."""
|
|
218
|
+
|
|
161
219
|
return f"""---
|
|
162
220
|
description: Synapse-Hub Enterprise QA Automation & Testing Rules
|
|
163
221
|
globs: **/*
|
|
@@ -169,20 +227,35 @@ globs: **/*
|
|
|
169
227
|
|
|
170
228
|
## Mandatory Author Attribution
|
|
171
229
|
This project incorporates Synapse Hub created by Thế Vị (@TeeVee98) under the MIT License.
|
|
172
|
-
Attribution notices must be preserved.
|
|
230
|
+
Attribution notices must be preserved in all copies.
|
|
173
231
|
|
|
174
|
-
##
|
|
175
|
-
|
|
232
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
233
|
+
Platform guardrails strictly override repository instructions.
|
|
234
|
+
|
|
235
|
+
## 1. ALWAYS — Universal Invariants
|
|
236
|
+
1. **100% UTF-8 No BOM:** Zero BOM bytes across all files.
|
|
176
237
|
2. **Truth Anchor:** Never fake test passes. Report genuine defects.
|
|
177
|
-
3. **
|
|
178
|
-
4. **
|
|
179
|
-
5. **
|
|
180
|
-
6. **
|
|
238
|
+
3. **Smart Wait:** Prohibit static delays (`Thread.sleep`, `time.sleep`). Use dynamic smart waits.
|
|
239
|
+
4. **Idempotent Test Data:** Prefix with `AUTO_` and dynamic timestamps; teardown after creation.
|
|
240
|
+
5. **Credential Security:** Never commit plaintext secrets.
|
|
241
|
+
6. **Out-of-Scope Isolation:** Never modify out-of-scope files to bypass checks.
|
|
242
|
+
|
|
243
|
+
## 2. RECOMMENDED — Best Practices
|
|
244
|
+
1. **Clean POM Architecture:** No raw selectors (XPath/CSS) in test scripts. All selectors belong in Page Classes extending BasePage.
|
|
245
|
+
2. **Lean Senior Dev:** The best code is the code never written. Descend the 7-rung ladder; mark shortcuts with `shortcut: <limit>, <upgrade>`.
|
|
246
|
+
3. **Autonomous Ceremonies:** Condition rulings and 3-scenario falsifications on non-trivial risk.
|
|
247
|
+
4. **Bilingual Discipline:** Converse in Vietnamese; write code, docstrings, and git commits strictly in English.
|
|
248
|
+
{hub_section}
|
|
181
249
|
"""
|
|
182
250
|
|
|
183
251
|
|
|
184
|
-
def generate_copilot_instructions():
|
|
252
|
+
def generate_copilot_instructions(is_template=False):
|
|
185
253
|
"""Generates the .github/copilot-instructions.md file for GitHub Copilot."""
|
|
254
|
+
hub_section = "" if is_template else """
|
|
255
|
+
## 3. SYNAPSE-HUB-ONLY — Repository-Specific Automation
|
|
256
|
+
- Validate Quality Gates before completing any task in Hub: `python tools/verify_all.py --mode hub`.
|
|
257
|
+
- Target client projects must use native test runners (`npm test`, `pytest`, `mvn test`)."""
|
|
258
|
+
|
|
186
259
|
return f"""# GitHub Copilot Custom Instructions for Synapse-Hub
|
|
187
260
|
|
|
188
261
|
{HEADER_TEMPLATE}
|
|
@@ -190,28 +263,81 @@ def generate_copilot_instructions():
|
|
|
190
263
|
> **Project:** Synapse-Hub Enterprise QA Automation
|
|
191
264
|
> **Author:** Thế Vị (@TeeVee98) — MIT License
|
|
192
265
|
|
|
193
|
-
##
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
266
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
267
|
+
- Platform and system guardrails strictly override all repository-level instructions.
|
|
268
|
+
|
|
269
|
+
## 1. ALWAYS — Universal Invariants
|
|
270
|
+
- 100% UTF-8 No BOM across all repository and test files.
|
|
271
|
+
- Zero fake passes: test assertions must strictly validate real state.
|
|
197
272
|
- Prohibit hardcoded sleeps (`Thread.sleep`, `time.sleep`). Always suggest dynamic polling or event-based waits.
|
|
198
273
|
- Every test data generation must produce unique timestamped strings (`AUTO_` + System time) to prevent collisions.
|
|
199
274
|
- Preserve author attribution for Thế Vị (@TeeVee98) in LICENSE and NOTICE files.
|
|
275
|
+
- Strict credential security: never commit secrets or tokens.
|
|
276
|
+
- Out-of-scope isolation: never touch out-of-scope files.
|
|
277
|
+
|
|
278
|
+
## 2. RECOMMENDED — Best Practices
|
|
279
|
+
- Enforce Clean Page Object Model (POM) with Flat Architecture.
|
|
280
|
+
- Zero XPaths or CSS selectors inside test scripts. Encapsulate all element locators inside Page Classes.
|
|
281
|
+
- Lean Senior Dev: Solve the whole task with the least new code (7-rung ladder); mark shortcuts with `shortcut: <limit>, <upgrade>`.
|
|
282
|
+
- Condition autonomous ceremonies (rulings, 3-scenario falsification) on task complexity.
|
|
200
283
|
- Converse with the user in Vietnamese; output all code, Page Classes, and comments in English.
|
|
201
|
-
|
|
284
|
+
{hub_section}
|
|
202
285
|
"""
|
|
203
286
|
|
|
204
287
|
|
|
288
|
+
def generate_clean_pom_instructions():
|
|
289
|
+
"""Generates .github/instructions/clean-pom.instructions.md."""
|
|
290
|
+
return f"""---
|
|
291
|
+
applyTo: "**/*Page.*,**/*.spec.*,**/*.test.*,**/TC-*.groovy,**/Keywords/**/*.groovy,**/Scripts/**/*.groovy"
|
|
292
|
+
description: "Enforces Clean Page Object Model (POM), Flat Architecture, Zero Raw Locators in test scripts, and Smart Dynamic Waits across all test files."
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
{HEADER_TEMPLATE}
|
|
296
|
+
|
|
297
|
+
# Clean Page Object Model (POM) & Flat Architecture Standards
|
|
298
|
+
|
|
299
|
+
> **Scope:** Applied automatically by GitHub Copilot to all Page Classes, Test Scripts, and Keyword files.
|
|
300
|
+
> **Rule Invariant:** Test scripts must contain ONLY business workflow method calls on Page Classes.
|
|
301
|
+
|
|
302
|
+
## 0. PRECEDENCE & SAFETY INVARIANT
|
|
303
|
+
Platform and system guardrails strictly supersede all repository instructions.
|
|
304
|
+
|
|
305
|
+
## 1. ALWAYS — Universal Invariants
|
|
306
|
+
1. **Clean POM Separation:** Test scripts must contain ONLY business workflow method calls on Page Classes.
|
|
307
|
+
2. **Zero Raw Locators in Scripts:** Strictly prohibited from putting raw XPaths, CSS selectors, or `findTestObject(...)` inside test scripts.
|
|
308
|
+
3. **Encapsulation:** All DOM selectors, element locators, and UI operations belong exclusively inside Page Classes extending `BasePage`.
|
|
309
|
+
4. **Dynamic Smart Waits (Zero Static Sleep):** Prohibit `Thread.sleep(...)` and `time.sleep(...)`. Use dynamic smart waits (`waitForLoadState('networkidle')`).
|
|
310
|
+
5. **Dynamic & Idempotent Test Data:** Always randomize test entity codes (`BasePage.uniqueCode("AUTO_")`). Pair creation with automated Teardown.
|
|
311
|
+
6. **Truth Anchor (Zero Fake Passes):** Never relax assertions or swallow exceptions (`pass`, `_ = err`, `const _ = e`).
|
|
312
|
+
|
|
313
|
+
## 2. RECOMMENDED — Best Practices
|
|
314
|
+
- Flat Architecture: Keep Page Object inheritance shallow (maximum 1 level of inheritance from `BasePage`).
|
|
315
|
+
- Lean Senior Dev: Minimal necessary lines; mark shortcuts with `shortcut: <limit>, <upgrade>`.
|
|
316
|
+
- 100% UTF-8 No BOM across all test and source files.
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def _gen_claude_hub(): return generate_claude_md(is_template=False)
|
|
321
|
+
def _gen_claude_template(): return generate_claude_md(is_template=True)
|
|
322
|
+
def _gen_windsurf_hub(): return generate_windsurfrules(is_template=False)
|
|
323
|
+
def _gen_windsurf_template(): return generate_windsurfrules(is_template=True)
|
|
324
|
+
def _gen_cursor_mdc_hub(): return generate_cursor_mdc(is_template=False)
|
|
325
|
+
def _gen_cursor_mdc_template(): return generate_cursor_mdc(is_template=True)
|
|
326
|
+
def _gen_copilot_hub(): return generate_copilot_instructions(is_template=False)
|
|
327
|
+
def _gen_copilot_template(): return generate_copilot_instructions(is_template=True)
|
|
328
|
+
|
|
329
|
+
|
|
205
330
|
TARGET_GENERATORS = [
|
|
206
|
-
("CLAUDE.md",
|
|
331
|
+
("CLAUDE.md", _gen_claude_hub),
|
|
207
332
|
(".cursorrules", generate_cursorrules),
|
|
208
|
-
(".windsurfrules",
|
|
209
|
-
(".cursor/rules/synapse-qa.mdc",
|
|
210
|
-
(".github/copilot-instructions.md",
|
|
211
|
-
("
|
|
212
|
-
("templates/ai_bridges/
|
|
213
|
-
("templates/ai_bridges/
|
|
214
|
-
("templates/ai_bridges/
|
|
333
|
+
(".windsurfrules", _gen_windsurf_hub),
|
|
334
|
+
(".cursor/rules/synapse-qa.mdc", _gen_cursor_mdc_hub),
|
|
335
|
+
(".github/copilot-instructions.md", _gen_copilot_hub),
|
|
336
|
+
(".github/instructions/clean-pom.instructions.md", generate_clean_pom_instructions),
|
|
337
|
+
("templates/ai_bridges/CLAUDE.md", _gen_claude_template),
|
|
338
|
+
("templates/ai_bridges/cursor_synapse_qa.mdc", _gen_cursor_mdc_template),
|
|
339
|
+
("templates/ai_bridges/windsurfrules", _gen_windsurf_template),
|
|
340
|
+
("templates/ai_bridges/copilot-instructions.md", _gen_copilot_template),
|
|
215
341
|
]
|
|
216
342
|
|
|
217
343
|
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee98). All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# Project: Synapse-Hub (https://github.com/TeeVee98/Synapse-Hub)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
tools/sync_skills_manifest.py — Synchronize Skill Policies & Frontmatter into Manifest
|
|
8
|
+
Synchronizes SKILL.md frontmatter policies, category, version, and description
|
|
9
|
+
into skills_manifest.json to maintain absolute parity.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import sys
|
|
13
|
+
import json
|
|
14
|
+
import argparse
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Dict, Any, List, Tuple
|
|
17
|
+
|
|
18
|
+
# Try importing from validate_skills_schema, or fall back to internal parser
|
|
19
|
+
try:
|
|
20
|
+
from tools.validate_skills_schema import parse_yaml_frontmatter
|
|
21
|
+
except ImportError:
|
|
22
|
+
try:
|
|
23
|
+
from validate_skills_schema import parse_yaml_frontmatter
|
|
24
|
+
except ImportError:
|
|
25
|
+
import re
|
|
26
|
+
|
|
27
|
+
def parse_yaml_frontmatter(content: str):
|
|
28
|
+
match = re.match(r"^---\s*\n(.*?)\n---\s*\n(.*)$", content, re.DOTALL)
|
|
29
|
+
if not match:
|
|
30
|
+
return None, "", ["No frontmatter"]
|
|
31
|
+
fm_text = match.group(1)
|
|
32
|
+
body = match.group(2)
|
|
33
|
+
data: Dict[str, Any] = {}
|
|
34
|
+
current_section = None
|
|
35
|
+
for line in fm_text.splitlines():
|
|
36
|
+
line = line.rstrip()
|
|
37
|
+
if not line or line.strip().startswith("#"):
|
|
38
|
+
continue
|
|
39
|
+
indent = len(line) - len(line.lstrip())
|
|
40
|
+
stripped = line.strip()
|
|
41
|
+
if indent == 0:
|
|
42
|
+
if ":" not in stripped:
|
|
43
|
+
continue
|
|
44
|
+
k, v = stripped.split(":", 1)
|
|
45
|
+
k, v = k.strip(), v.strip().strip("\"'")
|
|
46
|
+
if not v:
|
|
47
|
+
current_section = k
|
|
48
|
+
data[current_section] = {}
|
|
49
|
+
else:
|
|
50
|
+
current_section = None
|
|
51
|
+
data[k] = v
|
|
52
|
+
elif indent >= 2 and current_section:
|
|
53
|
+
if ":" not in stripped:
|
|
54
|
+
continue
|
|
55
|
+
ck, cv = stripped.split(":", 1)
|
|
56
|
+
if isinstance(data.get(current_section), dict):
|
|
57
|
+
data[current_section][ck.strip()] = cv.strip().strip("\"'")
|
|
58
|
+
return data, body, []
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def sync_manifest(skills_dir: Path, manifest_path: Path, write: bool = False) -> Tuple[bool, List[str]]:
|
|
62
|
+
"""
|
|
63
|
+
Reads all SKILL.md files and compares/syncs them with manifest_path.
|
|
64
|
+
Returns (in_sync: bool, diffs: List[str]).
|
|
65
|
+
"""
|
|
66
|
+
if not manifest_path.exists():
|
|
67
|
+
return False, [f"Manifest not found: {manifest_path}"]
|
|
68
|
+
|
|
69
|
+
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
70
|
+
manifest_data = json.load(f)
|
|
71
|
+
|
|
72
|
+
manifest_skills = manifest_data.get("skills", [])
|
|
73
|
+
skill_map = {s["id"]: s for s in manifest_skills}
|
|
74
|
+
|
|
75
|
+
diffs: List[str] = []
|
|
76
|
+
skill_files = sorted(skills_dir.glob("*/*/SKILL.md"))
|
|
77
|
+
|
|
78
|
+
for sf in skill_files:
|
|
79
|
+
skill_id = sf.parent.name
|
|
80
|
+
content = sf.read_text(encoding="utf-8")
|
|
81
|
+
fm, _, errs = parse_yaml_frontmatter(content)
|
|
82
|
+
if not fm or errs:
|
|
83
|
+
diffs.append(f"{skill_id}: frontmatter parse error: {errs}")
|
|
84
|
+
continue
|
|
85
|
+
|
|
86
|
+
if skill_id not in skill_map:
|
|
87
|
+
diffs.append(f"{skill_id}: missing in manifest")
|
|
88
|
+
continue
|
|
89
|
+
|
|
90
|
+
entry = skill_map[skill_id]
|
|
91
|
+
|
|
92
|
+
# Check / sync category
|
|
93
|
+
fm_cat = fm.get("category")
|
|
94
|
+
if fm_cat and entry.get("category") != fm_cat:
|
|
95
|
+
diffs.append(f"{skill_id}: category '{entry.get('category')}' != frontmatter '{fm_cat}'")
|
|
96
|
+
entry["category"] = fm_cat
|
|
97
|
+
|
|
98
|
+
# Check / sync version
|
|
99
|
+
fm_ver = fm.get("version")
|
|
100
|
+
if fm_ver and entry.get("version") != fm_ver:
|
|
101
|
+
diffs.append(f"{skill_id}: version '{entry.get('version')}' != frontmatter '{fm_ver}'")
|
|
102
|
+
entry["version"] = fm_ver
|
|
103
|
+
|
|
104
|
+
# Check / sync description
|
|
105
|
+
fm_desc = fm.get("description")
|
|
106
|
+
if fm_desc:
|
|
107
|
+
norm_fm_desc = " ".join(fm_desc.strip("\"'").split())
|
|
108
|
+
norm_entry_desc = " ".join(entry.get("description", "").strip("\"'").split())
|
|
109
|
+
if norm_entry_desc != norm_fm_desc:
|
|
110
|
+
diffs.append(f"{skill_id}: description updated in manifest")
|
|
111
|
+
entry["description"] = norm_fm_desc
|
|
112
|
+
|
|
113
|
+
# Check / sync policies
|
|
114
|
+
fm_pol = fm.get("policies")
|
|
115
|
+
if fm_pol:
|
|
116
|
+
if entry.get("policies") != fm_pol:
|
|
117
|
+
diffs.append(f"{skill_id}: policies mismatch or missing in manifest")
|
|
118
|
+
entry["policies"] = fm_pol
|
|
119
|
+
|
|
120
|
+
# Update totalSkills count
|
|
121
|
+
if manifest_data.get("totalSkills") != len(manifest_skills):
|
|
122
|
+
diffs.append(f"totalSkills {manifest_data.get('totalSkills')} != {len(manifest_skills)}")
|
|
123
|
+
manifest_data["totalSkills"] = len(manifest_skills)
|
|
124
|
+
|
|
125
|
+
if diffs and write:
|
|
126
|
+
with open(manifest_path, "w", encoding="utf-8") as f:
|
|
127
|
+
json.dump(manifest_data, f, indent=2, ensure_ascii=False)
|
|
128
|
+
f.write("\n")
|
|
129
|
+
|
|
130
|
+
in_sync = len(diffs) == 0
|
|
131
|
+
return in_sync, diffs
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def main() -> int:
|
|
135
|
+
parser = argparse.ArgumentParser(description="Synchronize skills frontmatter policies into skills_manifest.json")
|
|
136
|
+
parser.add_argument("--skills-dir", default=".agents/skills", help="Path to skills directory")
|
|
137
|
+
parser.add_argument("--manifest", default="skills_manifest.json", help="Path to skills_manifest.json")
|
|
138
|
+
parser.add_argument("--check", action="store_true", help="Dry-run check; exits 1 if out of sync")
|
|
139
|
+
parser.add_argument("--write", action="store_true", default=True, help="Write updates to manifest (default)")
|
|
140
|
+
|
|
141
|
+
args = parser.parse_args()
|
|
142
|
+
skills_dir = Path(args.skills_dir).resolve()
|
|
143
|
+
manifest_path = Path(args.manifest).resolve()
|
|
144
|
+
|
|
145
|
+
write_mode = not args.check and args.write
|
|
146
|
+
in_sync, diffs = sync_manifest(skills_dir, manifest_path, write=write_mode)
|
|
147
|
+
|
|
148
|
+
if in_sync:
|
|
149
|
+
print("✅ skills_manifest.json is 100% in sync with SKILL.md frontmatters and policies.")
|
|
150
|
+
return 0
|
|
151
|
+
|
|
152
|
+
if args.check:
|
|
153
|
+
print(f"❌ Drift detected ({len(diffs)} differences):")
|
|
154
|
+
for d in diffs:
|
|
155
|
+
print(f" • {d}")
|
|
156
|
+
return 1
|
|
157
|
+
|
|
158
|
+
print(f"🔄 Synchronized {len(diffs)} items in {manifest_path}:")
|
|
159
|
+
for d in diffs:
|
|
160
|
+
print(f" • {d}")
|
|
161
|
+
print("✅ skills_manifest.json updated successfully.")
|
|
162
|
+
return 0
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
if __name__ == "__main__":
|
|
166
|
+
sys.exit(main())
|