@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.
Files changed (133) hide show
  1. package/.agents/rules/git-push-protocol.md +2 -2
  2. package/.agents/skills/01-web-automation/auth-session-and-cookie-manager/SKILL.md +52 -3
  3. package/.agents/skills/01-web-automation/bats-testing-patterns/SKILL.md +55 -5
  4. package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +62 -67
  5. package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +54 -4
  6. package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +62 -12
  7. package/.agents/skills/01-web-automation/lam-script-generator/SKILL.md +55 -8
  8. package/.agents/skills/01-web-automation/mobile-appium-som/SKILL.md +60 -12
  9. package/.agents/skills/01-web-automation/mobile-appium-som/examples/BaseScreen.java +2 -2
  10. package/.agents/skills/01-web-automation/mobile-appium-som/examples/LoginScreen.java +2 -2
  11. package/.agents/skills/01-web-automation/mobile-appium-som/examples/TC_MobileLogin.java +2 -2
  12. package/.agents/skills/01-web-automation/playwright-live-interaction/SKILL.md +54 -91
  13. package/.agents/skills/01-web-automation/playwright-webapp-testing/SKILL.md +59 -11
  14. package/.agents/skills/01-web-automation/web-agent-gym-benchmarking/SKILL.md +50 -4
  15. package/.agents/skills/02-test-design/architecture-decision-records/SKILL.md +55 -9
  16. package/.agents/skills/02-test-design/gherkin-to-suite/SKILL.md +55 -9
  17. package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +55 -8
  18. package/.agents/skills/02-test-design/review-spec/SKILL.md +50 -6
  19. package/.agents/skills/02-test-design/tot-exploratory-testing/SKILL.md +50 -4
  20. package/.agents/skills/03-api-and-contracts/api-network-mocking-interception/SKILL.md +56 -5
  21. package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +53 -7
  22. package/.agents/skills/03-api-and-contracts/consumer-driven-contract-testing/SKILL.md +86 -36
  23. package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +54 -6
  24. package/.agents/skills/04-performance-and-load/lean-impact-scoreboard/SKILL.md +50 -6
  25. package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +50 -3
  26. package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +63 -14
  27. package/.agents/skills/05-security-and-compliance/skillspector-security-guard/SKILL.md +51 -5
  28. package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +54 -4
  29. package/.agents/skills/06-healing-and-resilience/agentless-qa-repair/SKILL.md +51 -5
  30. package/.agents/skills/06-healing-and-resilience/antigravity-test-sentinel/SKILL.md +53 -6
  31. package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +54 -8
  32. package/.agents/skills/06-healing-and-resilience/flaky-test-sentinel-and-quarantine/SKILL.md +60 -24
  33. package/.agents/skills/06-healing-and-resilience/self-healing-locator/SKILL.md +52 -6
  34. package/.agents/skills/06-healing-and-resilience/systematic-debugging/SKILL.md +56 -10
  35. package/.agents/skills/06-healing-and-resilience/test-driven-development/SKILL.md +58 -12
  36. package/.agents/skills/06-healing-and-resilience/verification-before-completion/SKILL.md +58 -12
  37. package/.agents/skills/06-healing-and-resilience/visual-regression-sentinel/SKILL.md +53 -5
  38. package/.agents/skills/07-data-and-state/db-state-verifier-and-seeder/SKILL.md +56 -5
  39. package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +53 -4
  40. package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +58 -5
  41. package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/SKILL.md +57 -11
  42. package/.agents/skills/08-code-quality/graphify-impact-analyzer/SKILL.md +83 -34
  43. package/.agents/skills/08-code-quality/graphify-impact-analyzer/examples/dependency_blast_radius.json +3 -4
  44. package/.agents/skills/08-code-quality/lean-code-ladder/SKILL.md +55 -10
  45. package/.agents/skills/08-code-quality/repo-quality-audit/SKILL.md +49 -6
  46. package/.agents/skills/08-code-quality/senior-code-review/SKILL.md +52 -7
  47. package/.agents/skills/08-code-quality/surgical-coding-principles/SKILL.md +55 -10
  48. package/.agents/skills/08-code-quality/technical-debt-harvester/SKILL.md +51 -5
  49. package/.agents/skills/09-ci-and-devops/github-actions-templates/SKILL.md +54 -17
  50. package/.agents/skills/09-ci-and-devops/github-actions-templates/examples/matrix_test_pipeline.yml +2 -1
  51. package/.agents/skills/10-agent-orchestration/actor-qa-swarm/SKILL.md +50 -4
  52. package/.agents/skills/10-agent-orchestration/agent-orchestration-multi-agent-optimize/SKILL.md +53 -7
  53. package/.agents/skills/10-agent-orchestration/event-stream-qa-orchestrator/SKILL.md +50 -4
  54. package/.agents/skills/10-agent-orchestration/persistent-planning-files/SKILL.md +58 -13
  55. package/.agents/skills/10-agent-orchestration/qa-memory-os/SKILL.md +51 -5
  56. package/.agents/skills/11-ai-and-prompting/meta-prompt-crafter/SKILL.md +57 -10
  57. package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +50 -4
  58. package/.agents/skills/11-ai-and-prompting/qa-aci-interface/SKILL.md +50 -4
  59. package/.agents/skills/11-ai-and-prompting/token-and-context-optimizer/SKILL.md +55 -9
  60. package/.cursor/rules/synapse-qa.mdc +20 -7
  61. package/.cursorrules +19 -5
  62. package/.windsurfrules +18 -3
  63. package/AGENTS.md +51 -59
  64. package/CLAUDE.md +38 -24
  65. package/LICENSE +5 -5
  66. package/NOTICE +1 -1
  67. package/README.en.md +4 -4
  68. package/README.md +4 -4
  69. package/agentskills.json +1 -1
  70. package/docs/ARCHITECTURE.en.md +2 -2
  71. package/docs/ARCHITECTURE.md +11 -2
  72. package/docs/CLIENT_SUPPORT_MATRIX.md +44 -0
  73. package/docs/CLI_REFERENCE.en.md +6 -4
  74. package/docs/CLI_REFERENCE.md +1 -1
  75. package/docs/CONTRIBUTING.en.md +1 -1
  76. package/docs/CONTRIBUTING.md +2 -2
  77. package/docs/SIDE_EFFECTING_TOOLS_INVENTORY.md +233 -0
  78. package/docs/TOOL_CATALOG.md +6 -2
  79. package/docs/research/agent_skill_training_analysis.md +1 -1
  80. package/package.json +1 -1
  81. package/plugin.json +1 -1
  82. package/skills_manifest.json +320 -55
  83. package/synapse.config.json +1 -1
  84. package/templates/ai_bridges/CLAUDE.md +29 -26
  85. package/templates/ai_bridges/copilot-instructions.md +14 -5
  86. package/templates/ai_bridges/cursor_synapse_qa.mdc +16 -7
  87. package/templates/ai_bridges/windsurfrules +14 -3
  88. package/templates/ui/index.html +2 -2
  89. package/tools/TOOLS_RUNBOOK.md +1 -1
  90. package/tools/TOOL_CATALOG.json +63 -3
  91. package/tools/__init__.py +1 -1
  92. package/tools/api_fuzzer.py +447 -132
  93. package/tools/author_integrity.py +121 -11
  94. package/tools/benchmark_swarm_context.py +130 -22
  95. package/tools/break_ui_generator.py +233 -0
  96. package/tools/browser_helpers.js +2 -2
  97. package/tools/check_version_sync.py +18 -50
  98. package/tools/cli.py +110 -19
  99. package/tools/core/bm25_retriever.py +218 -0
  100. package/tools/core/i18n.py +5 -5
  101. package/tools/core/provider_usage_adapter.py +383 -0
  102. package/tools/core/token_estimator.py +81 -15
  103. package/tools/count_tokens.py +7 -2
  104. package/tools/coverage_reporter.py +245 -0
  105. package/tools/dashboard_generator.py +8 -8
  106. package/tools/db_sandbox.py +290 -9
  107. package/tools/distill_log.py +1 -1
  108. package/tools/distill_skill.py +206 -0
  109. package/tools/git_pre_commit_guard.py +202 -1
  110. package/tools/humanize_linter.py +3 -0
  111. package/tools/mcp_docx_server.py +1 -1
  112. package/tools/mcp_excel_server.py +1 -1
  113. package/tools/mcp_server.py +104 -16
  114. package/tools/micro_mutator.py +114 -15
  115. package/tools/pentest_scope_guard.py +674 -58
  116. package/tools/perf/benchmark_perf_runner.py +42 -0
  117. package/tools/project_state.py +29 -5
  118. package/tools/reversible_sandbox.py +58 -13
  119. package/tools/rules_router.py +473 -60
  120. package/tools/security_scanner.py +80 -0
  121. package/tools/senior_code_review.py +14 -0
  122. package/tools/skill_canonical_digest.py +302 -0
  123. package/tools/skill_profiles.py +77 -7
  124. package/tools/slide_deck_exporter.py +477 -0
  125. package/tools/sync_agent_rules.py +187 -61
  126. package/tools/sync_skills_manifest.py +166 -0
  127. package/tools/task_memory_manager.py +275 -0
  128. package/tools/ui_server.py +3 -1
  129. package/tools/update_sentinel.py +3 -3
  130. package/tools/validate_host_interop.py +485 -0
  131. package/tools/validate_skills_schema.py +575 -0
  132. package/tools/verify_all.py +668 -44
  133. package/tools/welcome_page.py +2 -2
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ # -*- coding: utf-8 -*-
6
+ """
7
+ tools/break_ui_generator.py — Edge-Case UI Stress Testing Data Generator
8
+ Inspired by Emil Kowalski's break-ui skill (emilkowalski/skills).
9
+ Generates extreme data boundaries, unspaced strings, Zalgo, RTL, boundary floats,
10
+ and odd viewports to proactively discover layout breakages, text truncation bugs,
11
+ and visual regressions before production deployment.
12
+ 100% UTF-8 No BOM. Zero external dependencies.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import json
19
+ import sys
20
+ from typing import Any, Dict, List
21
+
22
+ # Enforce UTF-8 stdout encoding
23
+ if hasattr(sys.stdout, "reconfigure"):
24
+ try:
25
+ sys.stdout.reconfigure(encoding="utf-8")
26
+ sys.stderr.reconfigure(encoding="utf-8")
27
+ except Exception:
28
+ pass
29
+
30
+ # 1. Extreme Strings (Zalgo, unspaced overflow, zero-width, markup injection)
31
+ BREAK_STRINGS: List[Dict[str, str]] = [
32
+ {
33
+ "name": "unspaced_500_chars",
34
+ "description": "500-char continuous string to test CSS word-break / overflow-wrap",
35
+ "value": "Supercalifragilisticexpialidocious" * 15,
36
+ },
37
+ {
38
+ "name": "unspaced_2000_chars",
39
+ "description": "2,000-char continuous string to force container overflow",
40
+ "value": "A" * 2000,
41
+ },
42
+ {
43
+ "name": "zero_width_spaces",
44
+ "description": "Invisible zero-width joiners and spaces to test renderer length calculation",
45
+ "value": "Zero\u200BWidth\u200CSpace\u200DTest\uFEFFInvisible",
46
+ },
47
+ {
48
+ "name": "zalgo_corrupted_text",
49
+ "description": "Heavily combining diacritic marks to test vertical line-height clipping",
50
+ "value": "T̶͕͂é̷̯s̴̱͘t̸͙͒ ̸͚̈́Z̷̯̆a̴͖̓l̸͔̐g̶̭͒ỏ̷̱ ̶̦̋C̴̠̃o̶̧͝r̶̠̾r̵͇̈́ǘ̸͎p̸̀ͅẗ̴͚́ì̷̳o̸̭͝n̶̡̈́",
51
+ },
52
+ {
53
+ "name": "html_markup_injection",
54
+ "description": "Unescaped HTML tags to ensure UI framework escapes entities safely",
55
+ "value": "<script>alert('XSS')</script><b>Bold</b>&amp;\"'<svg onload=alert(1)>",
56
+ },
57
+ {
58
+ "name": "sql_syntax_injection",
59
+ "description": "SQL special characters in UI input to verify backend sanitization",
60
+ "value": "' OR '1'='1' -- /* drop table users; */ \";",
61
+ },
62
+ {
63
+ "name": "emoji_complex_graphemes",
64
+ "description": "Multi-codepoint composite emojis testing font glyph rendering",
65
+ "value": "👨‍👩‍👧‍👦 🏳️‍⚧️ 🧑🏾‍🚀 🦾 👁️‍🗨️",
66
+ },
67
+ ]
68
+
69
+ # 2. Localization & Directional Boundaries (RTL, German compounds, CJK, Vietnamese tones)
70
+ BREAK_LOCALIZATION: List[Dict[str, str]] = [
71
+ {
72
+ "name": "rtl_arabic",
73
+ "description": "Right-to-Left Arabic text to test bidirectional layout mirroring",
74
+ "value": "مرحبا بالعالم! هذا اختبار لتخطيط الواجهة من اليمين إلى اليسار.",
75
+ },
76
+ {
77
+ "name": "rtl_hebrew",
78
+ "description": "Right-to-Left Hebrew text with mixed LTR numbers",
79
+ "value": "בדיקת ממשק משתמש בעברית עם מספרים: 12345 וטקست באנגלית ABC.",
80
+ },
81
+ {
82
+ "name": "german_compound_noun",
83
+ "description": "Extremely long German word to test column wrapping",
84
+ "value": "Rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz",
85
+ },
86
+ {
87
+ "name": "vietnamese_complex_tones",
88
+ "description": "Stacked diacritics testing font vertical metrics and accent collisions",
89
+ "value": "Khảo sát tự động hóa kiểm thử: Độc lập - Tự do - Hạnh phúc (Thuở, Nghĩa, Triệu)",
90
+ },
91
+ {
92
+ "name": "cjk_wide_characters",
93
+ "description": "Full-width East Asian glyphs testing monospace alignment and line breaks",
94
+ "value": "日本語のテスト文字列。全角文字と半角文字の混在チェック:12345ABCDE。",
95
+ },
96
+ ]
97
+
98
+ # 3. Numeric Boundaries & Floating Point Edge Cases
99
+ BREAK_NUMBERS: List[Dict[str, Any]] = [
100
+ {
101
+ "name": "max_safe_integer_js",
102
+ "description": "JavaScript Number.MAX_SAFE_INTEGER (2^53 - 1)",
103
+ "value": 9007199254740991,
104
+ },
105
+ {
106
+ "name": "min_safe_integer_js",
107
+ "description": "JavaScript Number.MIN_SAFE_INTEGER -(2^53 - 1)",
108
+ "value": -9007199254740991,
109
+ },
110
+ {
111
+ "name": "int64_max",
112
+ "description": "Signed 64-bit maximum integer (2^63 - 1)",
113
+ "value": 9223372036854775807,
114
+ },
115
+ {
116
+ "name": "extreme_decimal_precision",
117
+ "description": "20-decimal float testing rounding and currency formatting truncation",
118
+ "value": 1234567.12345678901234567890,
119
+ },
120
+ {
121
+ "name": "near_zero_subnormal",
122
+ "description": "Subnormal scientific notation close to zero",
123
+ "value": 1e-15,
124
+ },
125
+ {
126
+ "name": "extreme_large_scientific",
127
+ "description": "Large exponent testing scientific notation formatting",
128
+ "value": 1.7976931348623157e308,
129
+ },
130
+ {
131
+ "name": "zero_and_negative_zero",
132
+ "description": "Zero and boundary float 0.0",
133
+ "value": 0.0,
134
+ },
135
+ ]
136
+
137
+ # 4. Viewport Dimensions for Layout Stress Testing
138
+ BREAK_VIEWPORTS: List[Dict[str, Any]] = [
139
+ {"name": "mobile_compact_se", "width": 320, "height": 568, "device_scale": 2.0},
140
+ {"name": "mobile_modern_tall", "width": 390, "height": 844, "device_scale": 3.0},
141
+ {"name": "tablet_portrait", "width": 768, "height": 1024, "device_scale": 2.0},
142
+ {"name": "tablet_landscape", "width": 1024, "height": 768, "device_scale": 2.0},
143
+ {"name": "desktop_standard_hd", "width": 1366, "height": 768, "device_scale": 1.0},
144
+ {"name": "desktop_full_hd_standard", "width": 1920, "height": 1080, "device_scale": 1.0},
145
+ {"name": "desktop_ultrawide", "width": 3440, "height": 1440, "device_scale": 1.0},
146
+ {"name": "desktop_4k_extreme", "width": 3840, "height": 2160, "device_scale": 2.0},
147
+ ]
148
+
149
+
150
+ def get_break_strings() -> List[Dict[str, str]]:
151
+ """Returns extreme string boundaries for text input and layout testing."""
152
+ return list(BREAK_STRINGS)
153
+
154
+
155
+ def get_break_localization() -> List[Dict[str, str]]:
156
+ """Returns bidirectional, CJK, and complex diacritic strings."""
157
+ return list(BREAK_LOCALIZATION)
158
+
159
+
160
+ def get_break_numbers() -> List[Dict[str, Any]]:
161
+ """Returns numerical edge cases and boundary floats."""
162
+ return list(BREAK_NUMBERS)
163
+
164
+
165
+ def get_break_viewports() -> List[Dict[str, Any]]:
166
+ """Returns standard and extreme responsive viewport configurations."""
167
+ return list(BREAK_VIEWPORTS)
168
+
169
+
170
+ def generate_all_break_payloads() -> Dict[str, Any]:
171
+ """Generates the unified break-ui testing catalog."""
172
+ return {
173
+ "version": "1.0.0",
174
+ "source": "Synapse Hub break-ui generator (Emil Kowalski pattern)",
175
+ "categories": {
176
+ "strings": get_break_strings(),
177
+ "localization": get_break_localization(),
178
+ "numbers": get_break_numbers(),
179
+ "viewports": get_break_viewports(),
180
+ },
181
+ "total_cases": (
182
+ len(BREAK_STRINGS)
183
+ + len(BREAK_LOCALIZATION)
184
+ + len(BREAK_NUMBERS)
185
+ + len(BREAK_VIEWPORTS)
186
+ ),
187
+ }
188
+
189
+
190
+ def main() -> None:
191
+ parser = argparse.ArgumentParser(description="Break-UI Edge-Case Test Data Generator for Synapse Hub")
192
+ parser.add_argument(
193
+ "--category",
194
+ "-c",
195
+ choices=["strings", "localization", "numbers", "viewports", "all"],
196
+ default="all",
197
+ help="Category of edge-case test data to generate (default: all)",
198
+ )
199
+ parser.add_argument("--limit", "-l", type=int, default=0, help="Limit number of items output (0 = all)")
200
+ parser.add_argument("--json", action="store_true", help="Output in machine-readable JSON format")
201
+ args = parser.parse_args()
202
+
203
+ catalog = generate_all_break_payloads()
204
+
205
+ if args.category == "all":
206
+ data: Any = catalog["categories"]
207
+ else:
208
+ data = catalog["categories"][args.category]
209
+ if args.limit > 0:
210
+ data = data[:args.limit]
211
+
212
+ if args.json:
213
+ print(json.dumps(data, indent=2, ensure_ascii=False))
214
+ else:
215
+ print(f"💥 Break-UI Generator (Category: {args.category})")
216
+ if isinstance(data, dict):
217
+ for cat, items in data.items():
218
+ print(f"\n[{cat.upper()}] ({len(items)} items)")
219
+ for item in items[: (args.limit if args.limit > 0 else len(items))]:
220
+ val = str(item.get("value", f"{item.get('width')}x{item.get('height')}"))
221
+ if len(val) > 60:
222
+ val = val[:57] + "..."
223
+ print(f" • {item['name']:<28} : {val}")
224
+ else:
225
+ for item in data:
226
+ val = str(item.get("value", f"{item.get('width')}x{item.get('height')}"))
227
+ if len(val) > 60:
228
+ val = val[:57] + "..."
229
+ print(f" • {item['name']:<28} : {val}")
230
+
231
+
232
+ if __name__ == "__main__":
233
+ main()
@@ -13,7 +13,7 @@
13
13
  (function () {
14
14
  'use strict';
15
15
 
16
- if (window.__qa && window.__qa.__version === '4.1.4') {
16
+ if (window.__qa && window.__qa.__version === '4.2.1') {
17
17
  return window.__qa;
18
18
  }
19
19
 
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  const qa = {
50
- __version: '4.1.4',
50
+ __version: '4.2.1',
51
51
 
52
52
  /**
53
53
  * 1. Smart Action Batching
@@ -192,9 +192,15 @@ def extract_versions(repo_root: str) -> Dict[str, str]:
192
192
  return versions
193
193
 
194
194
 
195
+ from skill_canonical_digest import (
196
+ validate_lockfile_integrity,
197
+ update_skills_lockfile,
198
+ )
199
+
200
+
195
201
  def check_sync(repo_root: str, expected_version: Optional[str] = None) -> Tuple[bool, Dict[str, str], str]:
196
202
  """
197
- Checks if all version definitions match.
203
+ Checks if all version definitions match across manifests and verifies canonical skill lockfile integrity.
198
204
  Returns (is_synced, versions_dict, canonical_version_or_error_msg).
199
205
  """
200
206
  versions = extract_versions(repo_root)
@@ -216,65 +222,27 @@ def check_sync(repo_root: str, expected_version: Optional[str] = None) -> Tuple[
216
222
 
217
223
  if mismatches:
218
224
  return False, versions, target_ver
219
- return True, versions, target_ver
220
225
 
226
+ # Enforce canonical skills lockfile integrity (live content hash validation)
227
+ lock_ok, lock_msg = validate_lockfile_integrity(repo_root, enforce_content_hash=True)
228
+ if not lock_ok:
229
+ return False, versions, f"Lockfile integrity verification failed: {lock_msg}"
221
230
 
222
- def validate_lockfile_integrity(repo_root: str) -> Tuple[bool, str]:
223
- """
224
- Validates canonical lockfile (skills-lock.json), synchronizes .skill-lock.json,
225
- and verifies SHA-256 integrity hash for all registered skills.
226
- """
227
- canonical_lock = os.path.join(repo_root, "skills-lock.json")
228
- secondary_lock = os.path.join(repo_root, ".skill-lock.json")
229
-
230
- if not os.path.exists(canonical_lock):
231
- return False, "Canonical lockfile skills-lock.json is missing!"
232
-
233
- try:
234
- with open(canonical_lock, "r", encoding="utf-8") as f:
235
- lock_data = json.load(f)
236
- except Exception as e:
237
- return False, f"skills-lock.json malformed JSON: {e}"
238
-
239
- skills = lock_data.get("skills", {})
240
- if len(skills) != 53:
241
- return False, f"Expected 53 skills in skills-lock.json, found {len(skills)}"
242
-
243
- for s_name, s_meta in skills.items():
244
- s_path = s_meta.get("skillPath")
245
- if not s_path:
246
- return False, f"Skill '{s_name}' missing skillPath"
247
- full_path = os.path.join(repo_root, s_path)
248
- if not os.path.exists(full_path):
249
- return False, f"Skill '{s_name}' path not found: {s_path}"
250
- s_hash = s_meta.get("skillFolderHash")
251
- if not s_hash or len(s_hash) != 64 or not all(c in "0123456789abcdefABCDEF" for c in s_hash):
252
- return False, f"Skill '{s_name}' has invalid SHA-256 hash: {s_hash}"
253
-
254
- # Auto-sync secondary lockfile .skill-lock.json to maintain atomic parity
255
- try:
256
- with open(canonical_lock, "rb") as cf:
257
- content_bytes = cf.read()
258
- needs_write = True
259
- if os.path.exists(secondary_lock):
260
- with open(secondary_lock, "rb") as sf:
261
- if sf.read() == content_bytes:
262
- needs_write = False
263
- if needs_write:
264
- with open(secondary_lock, "wb") as sf:
265
- sf.write(content_bytes)
266
- except Exception as e:
267
- return False, f"Failed to sync .skill-lock.json: {e}"
268
-
269
- return True, "53/53 skills verified with valid paths & SHA-256 hashes (auto-synced .skill-lock.json)"
231
+ return True, versions, target_ver
270
232
 
271
233
 
272
234
  def main() -> int:
273
235
  parser = argparse.ArgumentParser(description="Verify universal version sync across Synapse Hub files")
274
236
  parser.add_argument("--expected-version", "-e", help="Expected version string (e.g. from git tag)", default=None)
275
237
  parser.add_argument("--repo-root", default=REPO_ROOT, help="Root directory of the repository")
238
+ parser.add_argument("--update-hashes", action="store_true", help="Recalculate and update canonical skill folder hashes in lockfiles")
276
239
  args = parser.parse_args()
277
240
 
241
+ if args.update_hashes:
242
+ ok, msg = update_skills_lockfile(args.repo_root)
243
+ print(f"[{'SUCCESS' if ok else 'FAIL'}] {msg}")
244
+ return 0 if ok else 1
245
+
278
246
  expected = args.expected_version
279
247
  if expected and expected.startswith("v"):
280
248
  expected = expected[1:]
package/tools/cli.py CHANGED
@@ -16,7 +16,7 @@ import json
16
16
  import re
17
17
  import difflib
18
18
  import argparse
19
- from typing import Optional
19
+ from typing import Any, Optional
20
20
 
21
21
  # Enforce UTF-8 stdout encoding for Windows console compatibility
22
22
  if hasattr(sys.stdout, 'reconfigure'):
@@ -96,27 +96,55 @@ def cmd_set_lang(args):
96
96
  sys.exit(0)
97
97
 
98
98
 
99
+ def _resolve_manifest_path(repo_root: Optional[str] = None) -> Optional[str]:
100
+ """
101
+ Fallback manifest resolution:
102
+ 1. REPO_ROOT/skills_manifest.json
103
+ 2. tools/skills_manifest.json
104
+ 3. importlib.resources.files("tools").joinpath("skills_manifest.json")
105
+ """
106
+ root = repo_root or REPO_ROOT
107
+ candidate1 = os.path.join(root, "skills_manifest.json")
108
+ if os.path.isfile(candidate1):
109
+ return candidate1
110
+ candidate2 = os.path.join(SCRIPT_DIR, "skills_manifest.json")
111
+ if os.path.isfile(candidate2):
112
+ return candidate2
113
+ candidate2_alt = os.path.join(root, "tools", "skills_manifest.json")
114
+ if os.path.isfile(candidate2_alt):
115
+ return candidate2_alt
116
+ try:
117
+ import importlib.resources as pkg_resources
118
+ resource = pkg_resources.files("tools").joinpath("skills_manifest.json")
119
+ if resource.is_file():
120
+ try:
121
+ r_str = str(resource)
122
+ if os.path.isfile(r_str):
123
+ return r_str
124
+ except (TypeError, ValueError) as str_err:
125
+ res_str_err = str(str_err)
126
+ with pkg_resources.as_file(resource) as p:
127
+ return str(p)
128
+ except (ImportError, AttributeError, TypeError) as res_err:
129
+ res_load_err = str(res_err)
130
+ return None
131
+
132
+
99
133
  def cmd_version(args):
100
134
  """Displays the current hub version, skill catalog count, and license information."""
101
- manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
102
- version = "4.1.4"
103
- if os.path.exists(manifest_path):
135
+ manifest_path = _resolve_manifest_path()
136
+ version = "4.2.1"
137
+ manifest_skills = 53
138
+ if manifest_path and os.path.exists(manifest_path):
104
139
  try:
105
140
  import json
106
141
  with open(manifest_path, "r", encoding="utf-8") as f:
107
142
  data = json.load(f)
108
143
  version = data.get("version", version)
109
- except (OSError, json.JSONDecodeError):
110
- data = {}
144
+ manifest_skills = data.get("totalSkills", manifest_skills)
145
+ except (OSError, json.JSONDecodeError) as json_err:
146
+ manifest_err = str(json_err)
111
147
  print(f"Agent-QA Hub CLI v{version}")
112
- manifest_skills = 42
113
- if os.path.exists(manifest_path):
114
- try:
115
- import json
116
- with open(manifest_path, "r", encoding="utf-8") as f:
117
- manifest_skills = json.load(f).get("totalSkills", 42)
118
- except (OSError, json.JSONDecodeError):
119
- manifest_skills = 42
120
148
  print(f"Catalog: {manifest_skills} Standardized Skills | 9 Subagent Swarm Profiles")
121
149
  print("Created by: Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>")
122
150
  print("License : MIT (Attribution Required)")
@@ -192,7 +220,7 @@ def cmd_heal(args):
192
220
 
193
221
 
194
222
  def cmd_distill(args):
195
- """Distills and filters high-volume CI/CD test execution logs by ~95%."""
223
+ """Distills and filters high-volume CI/CD test execution logs to actionable failure signals."""
196
224
  from distill_log import main as distill_main
197
225
  sys.argv = _forward_subcommand_args(args)
198
226
  sys.exit(distill_main())
@@ -485,9 +513,70 @@ def cmd_init_config(args):
485
513
  sys.exit(init_cfg_main())
486
514
 
487
515
 
516
+ def get_registered_commands(parser: Optional[argparse.ArgumentParser] = None, lang: str = "en") -> list[dict[str, Any]]:
517
+ """
518
+ Dynamically introspects the CLI parser subparsers action and extracts
519
+ all registered commands, aliases, and localized descriptions directly from the registry.
520
+ """
521
+ if parser is None:
522
+ parser = build_parser(lang)
523
+
524
+ subparsers_action = None
525
+ for action in parser._actions:
526
+ if isinstance(action, argparse._SubParsersAction):
527
+ subparsers_action = action
528
+ break
529
+
530
+ if not subparsers_action:
531
+ return []
532
+
533
+ help_map = {a.dest: a.help for a in getattr(subparsers_action, "_choices_actions", [])}
534
+
535
+ commands = []
536
+ seen_parsers = set()
537
+ for name, subp in subparsers_action.choices.items():
538
+ if id(subp) in seen_parsers:
539
+ continue
540
+ seen_parsers.add(id(subp))
541
+ aliases = [n for n, s in subparsers_action.choices.items() if s is subp and n != name]
542
+ help_text = help_map.get(name) or getattr(subp, "description", None) or getattr(subp, "help", "") or ""
543
+ commands.append({
544
+ "name": name,
545
+ "aliases": aliases,
546
+ "help": help_text,
547
+ "prog": getattr(subp, "prog", f"agent-qa {name}"),
548
+ })
549
+ commands.sort(key=lambda c: c["name"])
550
+ return commands
551
+
552
+
488
553
  def cmd_help(args):
489
554
  """Displays command-line help and usage documentation."""
490
555
  parser = getattr(args, "_parser", None)
556
+ if not parser:
557
+ lang = getattr(args, "lang", None) or resolve_language(_extract_cli_lang())
558
+ parser = build_parser(lang)
559
+
560
+ lang = getattr(parser, "lang", "en")
561
+
562
+ if getattr(args, "json_output", False):
563
+ commands = get_registered_commands(parser, lang)
564
+ print(json.dumps(commands, indent=2, ensure_ascii=False))
565
+ sys.exit(0)
566
+
567
+ if getattr(args, "md_output", False):
568
+ commands = get_registered_commands(parser, lang)
569
+ lines = [
570
+ "| Command | Aliases | Description |",
571
+ "| :--- | :--- | :--- |",
572
+ ]
573
+ for cmd in commands:
574
+ aliases_str = ", ".join(f"`{a}`" for a in cmd["aliases"]) if cmd["aliases"] else "—"
575
+ desc = cmd["help"].replace("\n", " ").strip()
576
+ lines.append(f"| `{cmd['name']}` | {aliases_str} | {desc} |")
577
+ print("\n".join(lines))
578
+ sys.exit(0)
579
+
491
580
  if parser:
492
581
  parser.print_help()
493
582
  sys.exit(0)
@@ -685,15 +774,15 @@ def cmd_trend(args):
685
774
 
686
775
 
687
776
  def _hub_version():
688
- manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
689
- version = "4.1.4"
690
- if os.path.exists(manifest_path):
777
+ manifest_path = _resolve_manifest_path()
778
+ version = "4.2.1"
779
+ if manifest_path and os.path.exists(manifest_path):
691
780
  try:
692
781
  import json
693
782
  with open(manifest_path, "r", encoding="utf-8") as f:
694
783
  version = json.load(f).get("version", version)
695
784
  except (OSError, json.JSONDecodeError):
696
- version = "4.1.4"
785
+ version = "4.2.1"
697
786
  return version
698
787
 
699
788
 
@@ -878,6 +967,8 @@ def _register_core_and_setup_commands(subparsers, lang: Optional[str] = None):
878
967
  # help
879
968
  p_help = subparsers.add_parser("help", help=t("cmd_help", lang=lang))
880
969
  p_help.add_argument("--all", "-a", action="store_true", dest="show_all", help=t("opt_all", lang=lang))
970
+ p_help.add_argument("--json", action="store_true", dest="json_output", help=_lh("Output complete registered command list as JSON", "Xuất toàn bộ danh sách lệnh đã đăng ký dưới dạng JSON", lang))
971
+ p_help.add_argument("--markdown", "--md", action="store_true", dest="md_output", help=_lh("Output complete registered command list as Markdown table", "Xuất toàn bộ danh sách lệnh đã đăng ký dưới dạng bảng Markdown", lang))
881
972
  p_help.set_defaults(func=cmd_help)
882
973
 
883
974
  # set-lang