@teevee98/synapse-hub 0.0.0-stage → 3.8.3

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 (369) hide show
  1. package/.agents/agents/api-engineer.md +67 -0
  2. package/.agents/agents/failure-analyst.md +75 -0
  3. package/.agents/agents/live-explorer.md +70 -0
  4. package/.agents/agents/orchestrator.md +104 -0
  5. package/.agents/agents/perf-engineer.md +74 -0
  6. package/.agents/agents/pom-crafter.md +112 -0
  7. package/.agents/agents/quality-gatekeeper.md +87 -0
  8. package/.agents/agents/test-designer.md +73 -0
  9. package/.agents/agents/test-runner.md +67 -0
  10. package/.agents/rules/author-integrity-guard.md +33 -0
  11. package/.agents/rules/communication-style.md +18 -0
  12. package/.agents/rules/context-engineering.md +37 -0
  13. package/.agents/rules/git-push-protocol.md +33 -0
  14. package/.agents/rules/graphify.md +14 -0
  15. package/.agents/rules/lessons-learned.md +25 -0
  16. package/.agents/rules/mandatory-playwright-live.md +25 -0
  17. package/.agents/rules/mobile_appium_rules.md +43 -0
  18. package/.agents/rules/performance_testing_rules.md +35 -0
  19. package/.agents/rules/skill-precedence.md +29 -0
  20. package/.agents/rules/systematic-debugging.md +36 -0
  21. package/.agents/skills/actor-qa-swarm/SKILL.md +77 -0
  22. package/.agents/skills/actor-qa-swarm/examples/broker_sharding_sample.json +12 -0
  23. package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +88 -0
  24. package/.agents/skills/agent-orchestration-multi-agent-optimize/examples/swarm_workload_config.json +15 -0
  25. package/.agents/skills/agentless-qa-repair/SKILL.md +69 -0
  26. package/.agents/skills/agentless-qa-repair/examples/healing_report_sample.json +17 -0
  27. package/.agents/skills/agentless-qa-repair/examples/three_phase_repair_workflow.md +40 -0
  28. package/.agents/skills/antigravity-test-sentinel/SKILL.md +63 -0
  29. package/.agents/skills/antigravity-test-sentinel/examples/dod_gate_policy.json +11 -0
  30. package/.agents/skills/antigravity-test-sentinel/examples/sprint_dod_enforcement.md +47 -0
  31. package/.agents/skills/api-network-mocking-interception/SKILL.md +142 -0
  32. package/.agents/skills/api-network-mocking-interception/examples/network_route_stub.json +9 -0
  33. package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +80 -0
  34. package/.agents/skills/api-spec-to-e2e-matrix/examples/sample_openapi.json +19 -0
  35. package/.agents/skills/architecture-decision-records/SKILL.md +64 -0
  36. package/.agents/skills/architecture-decision-records/examples/0001-record-architecture-decisions.md +12 -0
  37. package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +75 -0
  38. package/.agents/skills/auth-session-and-cookie-manager/examples/multi_role_auth_matrix.md +70 -0
  39. package/.agents/skills/auth-session-and-cookie-manager/examples/storage_state_sample.json +11 -0
  40. package/.agents/skills/backend-load-and-stress-patterns/SKILL.md +85 -0
  41. package/.agents/skills/backend-load-and-stress-patterns/examples/k6_load_test_sample.js +13 -0
  42. package/.agents/skills/backend-load-and-stress-patterns/references/k6_load_template.js +82 -0
  43. package/.agents/skills/bats-testing-patterns/SKILL.md +100 -0
  44. package/.agents/skills/bats-testing-patterns/examples/cli_runner_test.bats +6 -0
  45. package/.agents/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
  46. package/.agents/skills/clean-pom-crafter/SKILL.md +110 -0
  47. package/.agents/skills/clean-pom-crafter/examples/standard_test_case.groovy +28 -0
  48. package/.agents/skills/clean-pom-crafter/references/pom_patterns.groovy +138 -0
  49. package/.agents/skills/code-refactoring-refactor-clean/SKILL.md +64 -0
  50. package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +9 -0
  51. package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +52 -0
  52. package/.agents/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +881 -0
  53. package/.agents/skills/consumer-driven-contract-testing/SKILL.md +147 -0
  54. package/.agents/skills/consumer-driven-contract-testing/examples/order_service_pact.json +45 -0
  55. package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +123 -0
  56. package/.agents/skills/db-state-verifier-and-seeder/examples/db_fixture_seed.json +12 -0
  57. package/.agents/skills/e2e-testing-patterns/SKILL.md +103 -0
  58. package/.agents/skills/e2e-testing-patterns/examples/playwright_sharded_config.ts +12 -0
  59. package/.agents/skills/e2e-testing-patterns/resources/implementation-playbook.md +522 -0
  60. package/.agents/skills/event-stream-qa-orchestrator/SKILL.md +79 -0
  61. package/.agents/skills/event-stream-qa-orchestrator/examples/timeline_sample.jsonl +2 -0
  62. package/.agents/skills/failure-autopsy-and-healing/SKILL.md +66 -0
  63. package/.agents/skills/failure-autopsy-and-healing/examples/closed_loop_healing_walkthrough.md +48 -0
  64. package/.agents/skills/failure-autopsy-and-healing/examples/sample_junit_failure.xml +8 -0
  65. package/.agents/skills/failure-autopsy-and-healing/references/healing_matrix.md +64 -0
  66. package/.agents/skills/failure-autopsy-and-healing/references/qa_investigation_protocol.md +56 -0
  67. package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +83 -0
  68. package/.agents/skills/file-and-report-validator/SKILL.md +90 -0
  69. package/.agents/skills/file-and-report-validator/examples/sample_export_schema.json +14 -0
  70. package/.agents/skills/flaky-test-sentinel-and-quarantine/SKILL.md +114 -0
  71. package/.agents/skills/flaky-test-sentinel-and-quarantine/examples/quarantine_registry.json +11 -0
  72. package/.agents/skills/gherkin-to-suite/SKILL.md +103 -0
  73. package/.agents/skills/gherkin-to-suite/examples/checkout.feature +39 -0
  74. package/.agents/skills/gherkin-to-suite/examples/suite_report_sample.json +334 -0
  75. package/.agents/skills/github-actions-templates/SKILL.md +77 -0
  76. package/.agents/skills/github-actions-templates/examples/matrix_test_pipeline.yml +8 -0
  77. package/.agents/skills/graphify-impact-analyzer/SKILL.md +76 -0
  78. package/.agents/skills/graphify-impact-analyzer/examples/dependency_blast_radius.json +8 -0
  79. package/.agents/skills/katalon-cli-runner/SKILL.md +76 -0
  80. package/.agents/skills/katalon-cli-runner/examples/headless_kre_exec.sh +3 -0
  81. package/.agents/skills/katalon-cli-runner/references/groovy-patterns.md +209 -0
  82. package/.agents/skills/katalon-cli-runner/references/katalon-api.md +155 -0
  83. package/.agents/skills/katalon-cli-runner/references/runner_commands.md +67 -0
  84. package/.agents/skills/lam-script-generator/SKILL.md +123 -0
  85. package/.agents/skills/lam-script-generator/examples/user_story_sample.md +8 -0
  86. package/.agents/skills/lean-code-ladder/SKILL.md +94 -0
  87. package/.agents/skills/lean-code-ladder/examples/ladder_walkthrough.md +37 -0
  88. package/.agents/skills/lean-impact-scoreboard/SKILL.md +48 -0
  89. package/.agents/skills/lean-impact-scoreboard/examples/sample_benchmark_gain.md +20 -0
  90. package/.agents/skills/lean-impact-scoreboard/examples/sample_scoreboard.md +15 -0
  91. package/.agents/skills/meta-prompt-crafter/SKILL.md +107 -0
  92. package/.agents/skills/meta-prompt-crafter/examples/qa_prompt_template.md +35 -0
  93. package/.agents/skills/mipro-prompt-compiler/SKILL.md +59 -0
  94. package/.agents/skills/mipro-prompt-compiler/examples/compiled_module_sample.json +22 -0
  95. package/.agents/skills/mipro-prompt-compiler/examples/dspy_assertion_optimizer_case.md +46 -0
  96. package/.agents/skills/mobile-appium-som/SKILL.md +88 -0
  97. package/.agents/skills/mobile-appium-som/examples/BaseScreen.java +88 -0
  98. package/.agents/skills/mobile-appium-som/examples/LoginScreen.java +46 -0
  99. package/.agents/skills/mobile-appium-som/examples/TC_MobileLogin.java +43 -0
  100. package/.agents/skills/persistent-planning-files/SKILL.md +108 -0
  101. package/.agents/skills/persistent-planning-files/examples/task_plan_example.md +56 -0
  102. package/.agents/skills/playwright-live-interaction/SKILL.md +131 -0
  103. package/.agents/skills/playwright-live-interaction/examples/live_probe_script.js +5 -0
  104. package/.agents/skills/playwright-live-interaction/references/advanced_superpowers.md +160 -0
  105. package/.agents/skills/playwright-live-interaction/references/compact_accessibility_snapshots.md +75 -0
  106. package/.agents/skills/playwright-live-interaction/references/recipes.md +388 -0
  107. package/.agents/skills/playwright-live-interaction/references/swarm_orchestration.md +134 -0
  108. package/.agents/skills/playwright-webapp-testing/SKILL.md +93 -0
  109. package/.agents/skills/playwright-webapp-testing/examples/server_lifecycle_playwright.py +63 -0
  110. package/.agents/skills/qa-aci-interface/SKILL.md +67 -0
  111. package/.agents/skills/qa-aci-interface/examples/surgical_code_window_walkthrough.md +40 -0
  112. package/.agents/skills/qa-aci-interface/examples/surgical_edit_sample.json +12 -0
  113. package/.agents/skills/qa-memory-os/SKILL.md +80 -0
  114. package/.agents/skills/qa-memory-os/examples/archival_memory_sample.json +21 -0
  115. package/.agents/skills/rbt-manual-testing/SKILL.md +137 -0
  116. package/.agents/skills/rbt-manual-testing/examples/checkout_rbt_manual_suite.md +25 -0
  117. package/.agents/skills/rbt-manual-testing/references/field_validation_checklist.md +29 -0
  118. package/.agents/skills/repo-quality-audit/SKILL.md +68 -0
  119. package/.agents/skills/repo-quality-audit/examples/sample_audit_walkthrough.md +15 -0
  120. package/.agents/skills/repo-quality-audit/examples/sample_repo_audit.md +33 -0
  121. package/.agents/skills/review-spec/SKILL.md +60 -0
  122. package/.agents/skills/review-spec/examples/pocock_grilling_decision_rubric.md +40 -0
  123. package/.agents/skills/review-spec/examples/sample_spec_review.md +33 -0
  124. package/.agents/skills/security-dast-sentinel/SKILL.md +119 -0
  125. package/.agents/skills/security-dast-sentinel/examples/dast_scan_config.json +10 -0
  126. package/.agents/skills/security-dast-sentinel/references/AI-AND-LLM.md +113 -0
  127. package/.agents/skills/security-dast-sentinel/references/ATTACK-CLASSES.md +89 -0
  128. package/.agents/skills/security-dast-sentinel/references/dast_recipes.ts +33 -0
  129. package/.agents/skills/self-healing-locator/SKILL.md +86 -0
  130. package/.agents/skills/self-healing-locator/examples/aom_diff_sample.json +16 -0
  131. package/.agents/skills/senior-code-review/SKILL.md +108 -0
  132. package/.agents/skills/senior-code-review/examples/sample_review_walkthrough.md +29 -0
  133. package/.agents/skills/skillspector-security-guard/SKILL.md +57 -0
  134. package/.agents/skills/skillspector-security-guard/examples/audit_threat_vectors_report.json +35 -0
  135. package/.agents/skills/skillspector-security-guard/examples/safe_mcp_config.json +12 -0
  136. package/.agents/skills/surgical-coding-principles/SKILL.md +89 -0
  137. package/.agents/skills/surgical-coding-principles/examples/surgical_vs_scope_creep.md +46 -0
  138. package/.agents/skills/synthetic-test-data-generator/SKILL.md +135 -0
  139. package/.agents/skills/synthetic-test-data-generator/examples/idempotent_data_recipe.json +9 -0
  140. package/.agents/skills/systematic-debugging/SKILL.md +100 -0
  141. package/.agents/skills/systematic-debugging/examples/four_phase_case.md +44 -0
  142. package/.agents/skills/technical-debt-harvester/SKILL.md +70 -0
  143. package/.agents/skills/technical-debt-harvester/examples/sample_debt_ledger.md +25 -0
  144. package/.agents/skills/technical-debt-harvester/examples/sample_ledger_output.md +20 -0
  145. package/.agents/skills/test-driven-development/SKILL.md +114 -0
  146. package/.agents/skills/test-driven-development/examples/red_green_refactor_qa.md +78 -0
  147. package/.agents/skills/token-and-context-optimizer/SKILL.md +70 -0
  148. package/.agents/skills/token-and-context-optimizer/examples/distilled_log_sample.txt +3 -0
  149. package/.agents/skills/token-and-context-optimizer/references/context_engineering_guide.md +49 -0
  150. package/.agents/skills/tot-exploratory-testing/SKILL.md +59 -0
  151. package/.agents/skills/tot-exploratory-testing/examples/payment_gateway_tot_tree.json +62 -0
  152. package/.agents/skills/tot-exploratory-testing/examples/tot_graph_sample.json +35 -0
  153. package/.agents/skills/verification-before-completion/SKILL.md +100 -0
  154. package/.agents/skills/verification-before-completion/examples/evidence_log_example.md +46 -0
  155. package/.agents/skills/visual-regression-sentinel/SKILL.md +82 -0
  156. package/.agents/skills/visual-regression-sentinel/examples/visual_mask_rules.json +9 -0
  157. package/.agents/skills/wcag-audit-patterns/SKILL.md +77 -0
  158. package/.agents/skills/wcag-audit-patterns/examples/wcag_compliance_checklist.json +10 -0
  159. package/.agents/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
  160. package/.agents/skills/web-agent-gym-benchmarking/SKILL.md +62 -0
  161. package/.agents/skills/web-agent-gym-benchmarking/examples/benchmark_report_sample.json +22 -0
  162. package/.agents/skills/web-agent-gym-benchmarking/examples/enterprise_tasks_suite.json +38 -0
  163. package/.agents/skills/web-vitals-and-performance-profiler/SKILL.md +65 -0
  164. package/.agents/skills/web-vitals-and-performance-profiler/examples/cwv_budget_policy.json +6 -0
  165. package/.agents/skills/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +118 -0
  166. package/.agents/templates/completion_report.md +57 -0
  167. package/.agents/workflows/analyze_requirement_document.md +18 -0
  168. package/.agents/workflows/export_testcases_excel.md +32 -0
  169. package/.agents/workflows/generate_combinatorial_test_data.md +28 -0
  170. package/.agents/workflows/generate_cross_module_test_plan.md +37 -0
  171. package/.agents/workflows/generate_manual_testcases_rbt.md +56 -0
  172. package/.agents/workflows/generate_requirements_from_website.md +25 -0
  173. package/.agents/workflows/generate_testcases_from_requirements.md +21 -0
  174. package/.agents/workflows/graphify.md +10 -0
  175. package/.agents/workflows/test-impact.md +15 -0
  176. package/.agents/workflows/verify.md +34 -0
  177. package/.cursor/rules/agents.mdc +16 -0
  178. package/.cursor/rules/language.mdc +7 -0
  179. package/.cursor/rules/synapse-qa.mdc +24 -0
  180. package/.cursorrules +27 -0
  181. package/.dockerignore +53 -0
  182. package/.pre-commit-hooks.yaml +14 -0
  183. package/.windsurfrules +26 -0
  184. package/AGENTS.md +86 -0
  185. package/CLAUDE.md +54 -0
  186. package/Dockerfile +81 -0
  187. package/LICENSE +52 -0
  188. package/NOTICE +264 -0
  189. package/README.en.md +171 -0
  190. package/README.md +170 -2
  191. package/action.yml +51 -0
  192. package/agentskills.json +16 -0
  193. package/bin/agent-qa.js +138 -0
  194. package/docker-compose.yml +74 -0
  195. package/docs/ARCHITECTURE.en.md +198 -0
  196. package/docs/ARCHITECTURE.md +199 -0
  197. package/docs/CI_CD_INTEGRATION.en.md +170 -0
  198. package/docs/CI_CD_INTEGRATION.md +170 -0
  199. package/docs/CLI_REFERENCE.en.md +174 -0
  200. package/docs/CLI_REFERENCE.md +176 -0
  201. package/docs/CONTRIBUTING.en.md +49 -0
  202. package/docs/CONTRIBUTING.md +49 -0
  203. package/docs/PERFORMANCE_AUDIT_REPORT.md +783 -0
  204. package/docs/PLUGIN_DEVELOPMENT_GUIDE.md +127 -0
  205. package/docs/QUALITY_GATES.en.md +118 -0
  206. package/docs/QUALITY_GATES.md +118 -0
  207. package/docs/TOKEN_QUOTA_PLAYBOOK.md +41 -0
  208. package/docs/TOOL_CATALOG.md +129 -0
  209. package/docs/adopted-ecosystem-tools.md +96 -0
  210. package/docs/research/EXTERNAL_AGENT_SKILLS_SURVEY.md +1062 -0
  211. package/docs/research/agent_skill_training_analysis.md +1358 -0
  212. package/docs/schemas/synapse.config.schema.json +86 -0
  213. package/package.json +94 -4
  214. package/plugin.json +31 -0
  215. package/scripts/generate_skill_examples.py +244 -0
  216. package/scripts/install.ps1 +112 -0
  217. package/scripts/install_global_plugin.ps1 +94 -0
  218. package/scripts/install_global_plugin.sh +49 -0
  219. package/scripts/lint_skills.ps1 +57 -0
  220. package/scripts/package_dist.py +337 -0
  221. package/scripts/setup.sh +59 -0
  222. package/scripts/update_hub.ps1 +19 -0
  223. package/scripts/update_hub.sh +15 -0
  224. package/skills_manifest.json +854 -0
  225. package/synapse.config.json +31 -0
  226. package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +111 -0
  227. package/templates/PROJECT_STATE_TEMPLATE.md +20 -0
  228. package/templates/ai_bridges/CLAUDE.md +54 -0
  229. package/templates/ai_bridges/copilot-instructions.md +20 -0
  230. package/templates/ai_bridges/cursor_synapse_qa.mdc +24 -0
  231. package/templates/ai_bridges/windsurfrules +26 -0
  232. package/templates/ci/github-actions-synapse.yml +95 -0
  233. package/templates/ci/gitlab-ci-synapse.yml +16 -0
  234. package/templates/ui/index.html +1069 -0
  235. package/templates/welcome.html.tmpl +2074 -0
  236. package/tools/.infer_baseline.json +30 -0
  237. package/tools/TOOLS_RUNBOOK.md +1553 -0
  238. package/tools/TOOL_CATALOG.json +1769 -0
  239. package/tools/__init__.py +43 -0
  240. package/tools/_openapi_parser.py +158 -0
  241. package/tools/agent_canary.py +525 -0
  242. package/tools/agentless_patcher.py +417 -0
  243. package/tools/analyze_project.py +262 -0
  244. package/tools/api_drift_sentinel.py +208 -0
  245. package/tools/api_fuzzer.py +762 -0
  246. package/tools/author_integrity.py +190 -0
  247. package/tools/auto_heal.py +271 -0
  248. package/tools/auto_heal_reflexion.py +532 -0
  249. package/tools/autogen_qa_broker.py +844 -0
  250. package/tools/benchmark_swarm_context.py +394 -0
  251. package/tools/browser_helpers.js +746 -0
  252. package/tools/browsergym_eval.py +236 -0
  253. package/tools/bug_reporter.py +252 -0
  254. package/tools/bump_version.py +423 -0
  255. package/tools/cache_resolver.py +1214 -0
  256. package/tools/check_env.py +426 -0
  257. package/tools/check_version_sync.py +256 -0
  258. package/tools/ci_healing_hook.py +126 -0
  259. package/tools/cli.py +1598 -0
  260. package/tools/config_decoupler.py +253 -0
  261. package/tools/contract_validator.py +141 -0
  262. package/tools/core/__init__.py +70 -0
  263. package/tools/core/adapters.py +431 -0
  264. package/tools/core/circuit_breaker.py +263 -0
  265. package/tools/core/cli_runtime.py +66 -0
  266. package/tools/core/file_lock.py +159 -0
  267. package/tools/core/i18n.py +394 -0
  268. package/tools/core/memory_bus.py +905 -0
  269. package/tools/core/process_supervisor.py +332 -0
  270. package/tools/core/telemetry.py +329 -0
  271. package/tools/count_tokens.py +1267 -0
  272. package/tools/create_mock_docx.py +104 -0
  273. package/tools/dashboard_generator.py +2403 -0
  274. package/tools/db_sandbox.py +675 -0
  275. package/tools/debt_harvester.py +237 -0
  276. package/tools/distill_log.py +161 -0
  277. package/tools/dspy_qa_signatures.py +356 -0
  278. package/tools/e2e_flow_prober.py +132 -0
  279. package/tools/export_postman_collection.py +945 -0
  280. package/tools/flaky_detector.py +389 -0
  281. package/tools/fsm_enforcer.py +450 -0
  282. package/tools/fsm_middleware.py +401 -0
  283. package/tools/fuzz_payloads.py +197 -0
  284. package/tools/generate_allure_report.py +88 -0
  285. package/tools/generate_api_matrix.py +193 -0
  286. package/tools/generate_jmx_plan.py +1322 -0
  287. package/tools/generate_sbom.py +252 -0
  288. package/tools/generate_tc_from_story.py +203 -0
  289. package/tools/generate_test_reports.py +133 -0
  290. package/tools/generate_tool_catalog.py +482 -0
  291. package/tools/gherkin_suite.py +758 -0
  292. package/tools/git_pre_commit_guard.py +298 -0
  293. package/tools/goldfish_review.py +366 -0
  294. package/tools/heal/__init__.py +28 -0
  295. package/tools/heal_pr_automator.py +220 -0
  296. package/tools/heuristic_locator_matcher.py +351 -0
  297. package/tools/hub_publisher.py +623 -0
  298. package/tools/humanize_linter.py +438 -0
  299. package/tools/infer_linter.py +977 -0
  300. package/tools/init_config.py +306 -0
  301. package/tools/interview_story.py +116 -0
  302. package/tools/jira_sync.py +566 -0
  303. package/tools/jtl_analyzer.py +474 -0
  304. package/tools/lint/__init__.py +30 -0
  305. package/tools/lint_ai_docs.py +374 -0
  306. package/tools/lookup_tc.py +165 -0
  307. package/tools/lookup_xpath.py +167 -0
  308. package/tools/matrix_sharder.py +148 -0
  309. package/tools/mcp/__init__.py +18 -0
  310. package/tools/mcp_docx_server.ps1 +13 -0
  311. package/tools/mcp_docx_server.py +851 -0
  312. package/tools/mcp_excel_server.ps1 +13 -0
  313. package/tools/mcp_excel_server.py +441 -0
  314. package/tools/mcp_server.py +725 -0
  315. package/tools/md_to_xlsx.py +327 -0
  316. package/tools/micro_mutator.py +887 -0
  317. package/tools/mipro_assertion_tuner.py +210 -0
  318. package/tools/network_mock_shield.py +311 -0
  319. package/tools/newman_analyzer.py +384 -0
  320. package/tools/omni_emitter.py +579 -0
  321. package/tools/omni_parser.py +450 -0
  322. package/tools/omni_transpiler.py +168 -0
  323. package/tools/openxml_guard.py +438 -0
  324. package/tools/output_formatter.py +182 -0
  325. package/tools/package_release.py +325 -0
  326. package/tools/perf/__init__.py +24 -0
  327. package/tools/pinpoint_failure.py +190 -0
  328. package/tools/project_state.py +171 -0
  329. package/tools/qa_event_stream.py +358 -0
  330. package/tools/repo_map.py +346 -0
  331. package/tools/report/__init__.py +32 -0
  332. package/tools/reversible_sandbox.py +344 -0
  333. package/tools/safety_firewall.py +437 -0
  334. package/tools/security_coverage_ledger.py +538 -0
  335. package/tools/security_scanner.py +229 -0
  336. package/tools/senior_code_review.py +393 -0
  337. package/tools/setup_project.py +770 -0
  338. package/tools/skill_collision_guard.py +304 -0
  339. package/tools/skill_profiles.py +217 -0
  340. package/tools/skill_vault.py +481 -0
  341. package/tools/skillspector.py +1278 -0
  342. package/tools/smart_visual_masker.py +132 -0
  343. package/tools/spec_drift_sentinel.py +438 -0
  344. package/tools/swe_qa_aci.py +369 -0
  345. package/tools/synapse_observer.py +485 -0
  346. package/tools/synapse_qa_bench.py +190 -0
  347. package/tools/sync_agent_rules.py +274 -0
  348. package/tools/telemetry_correlator.py +397 -0
  349. package/tools/template_excel_exporter.py +514 -0
  350. package/tools/templates/jmeter-distributed/README.md +54 -0
  351. package/tools/templates/jmeter-distributed/docker-compose.yml +83 -0
  352. package/tools/test_impact.py +419 -0
  353. package/tools/test_memory_os.py +462 -0
  354. package/tools/textgrad_mutation_optimizer.py +237 -0
  355. package/tools/tms_sync_bridge.py +834 -0
  356. package/tools/tot_exploratory_tester.py +239 -0
  357. package/tools/trace_data_flow.py +240 -0
  358. package/tools/traffic_session_converter.py +256 -0
  359. package/tools/trend_analytics.py +314 -0
  360. package/tools/ui_server.py +401 -0
  361. package/tools/universal_ir.py +488 -0
  362. package/tools/update_sentinel.py +383 -0
  363. package/tools/validate_groovy_scripts.py +173 -0
  364. package/tools/verify_all.py +1271 -0
  365. package/tools/visual_diff_canvas.py +143 -0
  366. package/tools/visual_som_helper.py +550 -0
  367. package/tools/watch_mode.py +308 -0
  368. package/tools/wcag_audit.py +239 -0
  369. package/tools/welcome_page.py +290 -0
@@ -0,0 +1,1069 @@
1
+ <!DOCTYPE html>
2
+ <html lang="vi">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Synapse Hub — Interactive QA Mission Control & Analytics</title>
7
+ <style>
8
+ :root {
9
+ --bg: #07090e;
10
+ --card-bg: rgba(15, 23, 42, 0.75);
11
+ --card-border: rgba(255, 255, 255, 0.08);
12
+ --card-hover-border: rgba(6, 182, 212, 0.4);
13
+ --primary: #06b6d4;
14
+ --primary-glow: rgba(6, 182, 212, 0.25);
15
+ --indigo: #6366f1;
16
+ --success: #10b981;
17
+ --error: #ef4444;
18
+ --warning: #f59e0b;
19
+ --text: #f8fafc;
20
+ --text-muted: #94a3b8;
21
+ --console-bg: #030712;
22
+ }
23
+
24
+ * { box-sizing: border-box; margin: 0; padding: 0; }
25
+ body {
26
+ background-color: var(--bg);
27
+ background-image:
28
+ radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
29
+ radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
30
+ color: var(--text);
31
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
32
+ min-height: 100vh;
33
+ display: flex;
34
+ flex-direction: column;
35
+ }
36
+
37
+ /* Top Navbar */
38
+ .navbar {
39
+ display: flex;
40
+ justify-content: space-between;
41
+ align-items: center;
42
+ padding: 1rem 2rem;
43
+ border-bottom: 1px solid var(--card-border);
44
+ background: rgba(10, 15, 29, 0.85);
45
+ backdrop-filter: blur(12px);
46
+ position: sticky;
47
+ top: 0;
48
+ z-index: 100;
49
+ }
50
+
51
+ .nav-left { display: flex; align-items: center; gap: 1rem; }
52
+ .logo-badge {
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 0.6rem;
56
+ font-weight: 800;
57
+ font-size: 1.15rem;
58
+ letter-spacing: -0.5px;
59
+ color: #fff;
60
+ }
61
+ .logo-badge svg { fill: var(--primary); }
62
+ .version-tag {
63
+ background: rgba(6, 182, 212, 0.15);
64
+ color: var(--primary);
65
+ border: 1px solid rgba(6, 182, 212, 0.3);
66
+ padding: 0.15rem 0.5rem;
67
+ border-radius: 9999px;
68
+ font-size: 0.75rem;
69
+ font-weight: 600;
70
+ }
71
+
72
+ .live-status {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 0.5rem;
76
+ font-size: 0.8rem;
77
+ font-weight: 600;
78
+ padding: 0.25rem 0.65rem;
79
+ border-radius: 9999px;
80
+ cursor: pointer;
81
+ transition: all 0.2s ease;
82
+ }
83
+ .status-live {
84
+ color: var(--success);
85
+ background: rgba(16, 185, 129, 0.1);
86
+ border: 1px solid rgba(16, 185, 129, 0.25);
87
+ }
88
+ .status-sim {
89
+ color: var(--primary);
90
+ background: rgba(6, 182, 212, 0.1);
91
+ border: 1px solid rgba(6, 182, 212, 0.3);
92
+ }
93
+
94
+ .pulse-dot {
95
+ width: 7px;
96
+ height: 7px;
97
+ border-radius: 50%;
98
+ background: currentColor;
99
+ box-shadow: 0 0 8px currentColor;
100
+ animation: pulse 2s infinite;
101
+ }
102
+ @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
103
+
104
+ .nav-right { display: flex; align-items: center; gap: 0.8rem; }
105
+ .nav-btn {
106
+ background: rgba(255, 255, 255, 0.05);
107
+ color: var(--text-muted);
108
+ border: 1px solid var(--card-border);
109
+ padding: 0.4rem 0.85rem;
110
+ border-radius: 8px;
111
+ font-size: 0.85rem;
112
+ font-weight: 600;
113
+ text-decoration: none;
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 0.4rem;
117
+ cursor: pointer;
118
+ transition: all 0.2s ease;
119
+ }
120
+ .nav-btn:hover {
121
+ background: rgba(255, 255, 255, 0.1);
122
+ color: #fff;
123
+ border-color: rgba(255, 255, 255, 0.2);
124
+ }
125
+
126
+ .lang-switcher {
127
+ display: flex;
128
+ background: rgba(0, 0, 0, 0.35);
129
+ border: 1px solid var(--card-border);
130
+ border-radius: 8px;
131
+ overflow: hidden;
132
+ }
133
+ .lang-btn {
134
+ background: transparent;
135
+ border: none;
136
+ color: var(--text-muted);
137
+ padding: 0.35rem 0.65rem;
138
+ font-size: 0.8rem;
139
+ font-weight: 600;
140
+ cursor: pointer;
141
+ }
142
+ .lang-btn.active {
143
+ background: linear-gradient(135deg, var(--primary), var(--indigo));
144
+ color: #fff;
145
+ }
146
+
147
+ /* Main Container */
148
+ .container {
149
+ max-width: 1350px;
150
+ margin: 0 auto;
151
+ padding: 2rem;
152
+ width: 100%;
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 2rem;
156
+ }
157
+
158
+ /* Metric Bar */
159
+ .metric-grid {
160
+ display: grid;
161
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
162
+ gap: 1rem;
163
+ }
164
+ .metric-card {
165
+ background: var(--card-bg);
166
+ border: 1px solid var(--card-border);
167
+ border-radius: 12px;
168
+ padding: 1.25rem;
169
+ display: flex;
170
+ flex-direction: column;
171
+ gap: 0.4rem;
172
+ transition: all 0.25s ease;
173
+ }
174
+ .metric-card:hover {
175
+ border-color: var(--card-hover-border);
176
+ transform: translateY(-2px);
177
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
178
+ }
179
+ .metric-label {
180
+ font-size: 0.8rem;
181
+ color: var(--text-muted);
182
+ text-transform: uppercase;
183
+ letter-spacing: 0.5px;
184
+ font-weight: 600;
185
+ }
186
+ .metric-val {
187
+ font-size: 1.5rem;
188
+ font-weight: 800;
189
+ color: #fff;
190
+ display: flex;
191
+ align-items: baseline;
192
+ gap: 0.4rem;
193
+ }
194
+ .metric-sub {
195
+ font-size: 0.75rem;
196
+ color: var(--success);
197
+ font-weight: 600;
198
+ }
199
+
200
+ /* Action Deck Grid */
201
+ .section-title {
202
+ font-size: 1.15rem;
203
+ font-weight: 700;
204
+ margin-bottom: 0.8rem;
205
+ display: flex;
206
+ align-items: center;
207
+ gap: 0.5rem;
208
+ color: #fff;
209
+ }
210
+
211
+ .action-grid {
212
+ display: grid;
213
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
214
+ gap: 1rem;
215
+ }
216
+ .action-card {
217
+ background: var(--card-bg);
218
+ border: 1px solid var(--card-border);
219
+ border-radius: 14px;
220
+ padding: 1.25rem;
221
+ display: flex;
222
+ flex-direction: column;
223
+ justify-content: space-between;
224
+ gap: 1rem;
225
+ transition: all 0.25s ease;
226
+ position: relative;
227
+ overflow: hidden;
228
+ }
229
+ .action-card:hover {
230
+ border-color: var(--card-hover-border);
231
+ transform: translateY(-3px);
232
+ box-shadow: 0 12px 28px rgba(6, 182, 212, 0.12);
233
+ }
234
+ .action-card::before {
235
+ content: '';
236
+ position: absolute;
237
+ top: 0;
238
+ left: 0;
239
+ right: 0;
240
+ height: 2px;
241
+ background: linear-gradient(90deg, transparent, var(--primary), transparent);
242
+ opacity: 0;
243
+ transition: opacity 0.25s ease;
244
+ }
245
+ .action-card:hover::before { opacity: 1; }
246
+
247
+ .action-header {
248
+ display: flex;
249
+ align-items: flex-start;
250
+ gap: 0.75rem;
251
+ }
252
+ .action-icon {
253
+ font-size: 1.6rem;
254
+ line-height: 1;
255
+ padding: 0.5rem;
256
+ background: rgba(255, 255, 255, 0.04);
257
+ border-radius: 10px;
258
+ border: 1px solid var(--card-border);
259
+ }
260
+ .action-info h3 {
261
+ font-size: 1rem;
262
+ font-weight: 700;
263
+ color: #fff;
264
+ margin-bottom: 0.25rem;
265
+ }
266
+ .action-info p {
267
+ font-size: 0.82rem;
268
+ color: var(--text-muted);
269
+ line-height: 1.4;
270
+ }
271
+
272
+ .btn-run {
273
+ background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(99, 102, 241, 0.2));
274
+ color: #fff;
275
+ border: 1px solid rgba(6, 182, 212, 0.4);
276
+ padding: 0.65rem 1rem;
277
+ border-radius: 8px;
278
+ font-size: 0.85rem;
279
+ font-weight: 600;
280
+ cursor: pointer;
281
+ display: flex;
282
+ align-items: center;
283
+ justify-content: center;
284
+ gap: 0.5rem;
285
+ transition: all 0.2s ease;
286
+ }
287
+ .btn-run:hover:not(:disabled) {
288
+ background: linear-gradient(135deg, var(--primary), var(--indigo));
289
+ box-shadow: 0 4px 14px var(--primary-glow);
290
+ border-color: transparent;
291
+ }
292
+ .btn-run:disabled {
293
+ opacity: 0.5;
294
+ cursor: not-allowed;
295
+ }
296
+
297
+ /* Live Execution Console */
298
+ .console-section {
299
+ background: var(--console-bg);
300
+ border: 1px solid var(--card-border);
301
+ border-radius: 14px;
302
+ overflow: hidden;
303
+ display: flex;
304
+ flex-direction: column;
305
+ box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
306
+ }
307
+ .console-header {
308
+ background: rgba(15, 23, 42, 0.9);
309
+ padding: 0.75rem 1.25rem;
310
+ display: flex;
311
+ justify-content: space-between;
312
+ align-items: center;
313
+ border-bottom: 1px solid var(--card-border);
314
+ }
315
+ .console-title-group {
316
+ display: flex;
317
+ align-items: center;
318
+ gap: 0.75rem;
319
+ }
320
+ .terminal-dots { display: flex; gap: 0.35rem; }
321
+ .dot { width: 10px; height: 10px; border-radius: 50%; }
322
+ .dot-red { background: #ef4444; }
323
+ .dot-yellow { background: #f59e0b; }
324
+ .dot-green { background: #10b981; }
325
+
326
+ .console-cmd-name {
327
+ font-family: "Fira Code", Consolas, monospace;
328
+ font-size: 0.85rem;
329
+ color: #fff;
330
+ font-weight: 600;
331
+ }
332
+ .job-status-badge {
333
+ font-size: 0.75rem;
334
+ font-weight: 700;
335
+ padding: 0.2rem 0.6rem;
336
+ border-radius: 9999px;
337
+ text-transform: uppercase;
338
+ letter-spacing: 0.5px;
339
+ }
340
+ .status-idle { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }
341
+ .status-running { background: rgba(6, 182, 212, 0.2); color: var(--primary); border: 1px solid var(--primary); }
342
+ .status-passed { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }
343
+ .status-failed { background: rgba(239, 68, 68, 0.2); color: var(--error); border: 1px solid var(--error); }
344
+
345
+ .console-actions { display: flex; align-items: center; gap: 0.6rem; }
346
+ .console-btn {
347
+ background: rgba(255, 255, 255, 0.05);
348
+ border: 1px solid var(--card-border);
349
+ color: var(--text-muted);
350
+ padding: 0.3rem 0.65rem;
351
+ border-radius: 6px;
352
+ font-size: 0.75rem;
353
+ font-weight: 600;
354
+ cursor: pointer;
355
+ }
356
+ .console-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
357
+
358
+ .console-body {
359
+ padding: 1.25rem;
360
+ font-family: "Fira Code", Consolas, monospace;
361
+ font-size: 0.85rem;
362
+ line-height: 1.6;
363
+ color: #cbd5e1;
364
+ height: 380px;
365
+ overflow-y: auto;
366
+ white-space: pre-wrap;
367
+ word-break: break-all;
368
+ }
369
+ .console-line { margin-bottom: 2px; }
370
+ .line-pass { color: #34d399; font-weight: 600; }
371
+ .line-fail { color: #f87171; font-weight: 600; }
372
+ .line-warn { color: #fbbf24; }
373
+ .line-info { color: #38bdf8; }
374
+
375
+ /* Historical Trends Section */
376
+ .trends-grid {
377
+ display: grid;
378
+ grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
379
+ gap: 1.25rem;
380
+ }
381
+ .chart-card {
382
+ background: var(--card-bg);
383
+ border: 1px solid var(--card-border);
384
+ border-radius: 14px;
385
+ padding: 1.25rem;
386
+ display: flex;
387
+ flex-direction: column;
388
+ gap: 1rem;
389
+ }
390
+
391
+ /* Footer */
392
+ footer {
393
+ margin-top: auto;
394
+ padding: 1.5rem;
395
+ text-align: center;
396
+ border-top: 1px solid var(--card-border);
397
+ font-size: 0.8rem;
398
+ color: var(--text-muted);
399
+ }
400
+ footer a { color: var(--primary); text-decoration: none; }
401
+ </style>
402
+ </head>
403
+ <body>
404
+
405
+ <!-- Top Navbar -->
406
+ <header class="navbar">
407
+ <div class="nav-left">
408
+ <div class="logo-badge">
409
+ <svg width="22" height="22" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-1 6h2v2h-2V7zm0 4h2v6h-2v-6z"/></svg>
410
+ <span>SYNAPSE HUB</span>
411
+ </div>
412
+ <span class="version-tag" id="hub-version">v3.2.2</span>
413
+ <div class="live-status status-sim" id="server-status-pill" onclick="showServerHelp()">
414
+ <div class="pulse-dot"></div>
415
+ <span id="server-status-text">KIỂM TRA KẾT NỐI...</span>
416
+ </div>
417
+ </div>
418
+
419
+ <div class="nav-right">
420
+ <a class="nav-btn" href="/reports/PROJECT_DASHBOARD.html" target="_blank">
421
+ <span>📊</span> <span data-i18n="nav_dashboard">Bảng Điều Hành</span>
422
+ </a>
423
+ <a class="nav-btn" href="/reports/WELCOME.html" target="_blank">
424
+ <span>📖</span> <span data-i18n="nav_welcome">Giới Thiệu</span>
425
+ </a>
426
+ <div class="lang-switcher">
427
+ <button class="lang-btn active" id="btn-lang-vi" onclick="setLanguage('vi')">VN</button>
428
+ <button class="lang-btn" id="btn-lang-en" onclick="setLanguage('en')">EN</button>
429
+ </div>
430
+ </div>
431
+ </header>
432
+
433
+ <!-- Main Container -->
434
+ <main class="container">
435
+
436
+ <!-- Top Metrics -->
437
+ <section class="metric-grid">
438
+ <div class="metric-card">
439
+ <div class="metric-label" data-i18n="metric_gates_label">11 Quality Gates DoD</div>
440
+ <div class="metric-val">11 / 11 <span class="metric-sub" data-i18n="metric_gates_sub">100% TUÂN THỦ</span></div>
441
+ </div>
442
+ <div class="metric-card">
443
+ <div class="metric-label" data-i18n="metric_mutation_label">Micro-Mutation Sensitivity</div>
444
+ <div class="metric-val">90.88% <span class="metric-sub">≥ 80% (ĐẠT)</span></div>
445
+ </div>
446
+ <div class="metric-card">
447
+ <div class="metric-label" data-i18n="metric_skills_label">Danh Mục Kỹ Năng QA</div>
448
+ <div class="metric-val">53 <span class="metric-sub" data-i18n="metric_skills_sub">Chuyên Biệt</span></div>
449
+ </div>
450
+ <div class="metric-card">
451
+ <div class="metric-label" data-i18n="metric_ecosystem_label">Hệ Sinh Thái Tích Hợp</div>
452
+ <div class="metric-val">Jira & Docker <span class="metric-sub">SẴN SÀNG</span></div>
453
+ </div>
454
+ </section>
455
+
456
+ <!-- 1-Click Action Deck -->
457
+ <section>
458
+ <div class="section-title">
459
+ <span>⚡</span> <span data-i18n="section_actions">Bảng Điều Khiển Tác Vụ 1-Click (Mission Actions)</span>
460
+ </div>
461
+ <div class="action-grid">
462
+
463
+ <!-- Action 1: Verify 11 Gates -->
464
+ <div class="action-card">
465
+ <div class="action-header">
466
+ <div class="action-icon">🛡️</div>
467
+ <div class="action-info">
468
+ <h3 data-i18n="act_verify_title">Verify 11 Quality Gates</h3>
469
+ <p data-i18n="act_verify_desc">Thẩm định toàn diện 11 cổng chất lượng Definition-of-Done trước khi bàn giao.</p>
470
+ </div>
471
+ </div>
472
+ <button class="btn-run" onclick="triggerJob('verify')" id="btn-verify">
473
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
474
+ </button>
475
+ </div>
476
+
477
+ <!-- Action 2: Meta Infer Linter -->
478
+ <div class="action-card">
479
+ <div class="action-header">
480
+ <div class="action-icon">🔍</div>
481
+ <div class="action-info">
482
+ <h3 data-i18n="act_lint_title">Meta Infer AST Linter</h3>
483
+ <p data-i18n="act_lint_desc">Quét tĩnh AST 0.02s phát hiện test pass ảo, tautology và ngoại lệ bị nuốt.</p>
484
+ </div>
485
+ </div>
486
+ <button class="btn-run" onclick="triggerJob('lint')" id="btn-lint">
487
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
488
+ </button>
489
+ </div>
490
+
491
+ <!-- Action 3: Micro-Mutation -->
492
+ <div class="action-card">
493
+ <div class="action-header">
494
+ <div class="action-icon">🧬</div>
495
+ <div class="action-info">
496
+ <h3 data-i18n="act_mutate_title">Micro-Mutation Sentinel</h3>
497
+ <p data-i18n="act_mutate_desc">Bơm lỗi đột biến giả lập để kiểm tra độ nhạy của các câu lệnh assert (Kill Score ≥ 80%).</p>
498
+ </div>
499
+ </div>
500
+ <button class="btn-run" onclick="triggerJob('mutate')" id="btn-mutate">
501
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
502
+ </button>
503
+ </div>
504
+
505
+ <!-- Action 4: Doctor -->
506
+ <div class="action-card">
507
+ <div class="action-header">
508
+ <div class="action-icon">🩺</div>
509
+ <div class="action-info">
510
+ <h3 data-i18n="act_doctor_title">Environment Doctor</h3>
511
+ <p data-i18n="act_doctor_desc">Chẩn đoán 1-click toàn bộ môi trường: Python, Node.js, Java JRE, Chrome, Katalon.</p>
512
+ </div>
513
+ </div>
514
+ <button class="btn-run" onclick="triggerJob('doctor')" id="btn-doctor">
515
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
516
+ </button>
517
+ </div>
518
+
519
+ <!-- Action 5: 5-in-1 Health Audit -->
520
+ <div class="action-card">
521
+ <div class="action-header">
522
+ <div class="action-icon">📈</div>
523
+ <div class="action-info">
524
+ <h3 data-i18n="act_analyze_title">5-in-1 Repository Health</h3>
525
+ <p data-i18n="act_analyze_desc">Kiểm toán tổng hợp chất lượng mã nguồn, bảo mật bí mật, và xuất báo cáo sức khỏe.</p>
526
+ </div>
527
+ </div>
528
+ <button class="btn-run" onclick="triggerJob('analyze')" id="btn-analyze">
529
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
530
+ </button>
531
+ </div>
532
+
533
+ <!-- Action 6: Export Excel -->
534
+ <div class="action-card">
535
+ <div class="action-header">
536
+ <div class="action-icon">📑</div>
537
+ <div class="action-info">
538
+ <h3 data-i18n="act_excel_title">Export Excel Test Cases</h3>
539
+ <p data-i18n="act_excel_desc">Xuất bộ test case mẫu 12 cột chuẩn doanh nghiệp (bilingual) sang file .xlsx.</p>
540
+ </div>
541
+ </div>
542
+ <button class="btn-run" onclick="triggerJob('export-excel')" id="btn-export-excel">
543
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
544
+ </button>
545
+ </div>
546
+
547
+ <!-- Action 7: Init Config -->
548
+ <div class="action-card">
549
+ <div class="action-header">
550
+ <div class="action-icon">⚙️</div>
551
+ <div class="action-info">
552
+ <h3 data-i18n="act_init_title">Initialize .synapse.json</h3>
553
+ <p data-i18n="act_init_desc">Khởi tạo file cấu hình chuẩn hóa cho dự án mục tiêu (Clean POM, Playwright, Katalon).</p>
554
+ </div>
555
+ </div>
556
+ <button class="btn-run" onclick="triggerJob('init-config')" id="btn-init-config">
557
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
558
+ </button>
559
+ </div>
560
+
561
+ <!-- Action 8: Update Dashboard -->
562
+ <div class="action-card">
563
+ <div class="action-header">
564
+ <div class="action-icon">📊</div>
565
+ <div class="action-info">
566
+ <h3 data-i18n="act_dash_title">Regenerate Dashboard</h3>
567
+ <p data-i18n="act_dash_desc">Quét lại toàn bộ kho mã nguồn và sinh trang PROJECT_DASHBOARD.html mới nhất.</p>
568
+ </div>
569
+ </div>
570
+ <button class="btn-run" onclick="triggerJob('dashboard')" id="btn-dashboard">
571
+ <span>▶</span> <span data-i18n="btn_run">Thực Thi</span>
572
+ </button>
573
+ </div>
574
+
575
+ </div>
576
+ </section>
577
+
578
+ <!-- Live Execution Console -->
579
+ <section class="console-section">
580
+ <div class="console-header">
581
+ <div class="console-title-group">
582
+ <div class="terminal-dots">
583
+ <div class="dot dot-red"></div>
584
+ <div class="dot dot-yellow"></div>
585
+ <div class="dot dot-green"></div>
586
+ </div>
587
+ <span class="console-cmd-name" id="current-cmd">synapse-hub >_</span>
588
+ <span class="job-status-badge status-idle" id="job-status">IDLE</span>
589
+ <span id="elapsed-time" style="font-size:0.75rem; color:var(--text-muted); font-family:monospace;"></span>
590
+ </div>
591
+ <div class="console-actions">
592
+ <button class="console-btn" onclick="clearConsole()" data-i18n="btn_clear">Xóa Màn Hình</button>
593
+ <button class="console-btn" onclick="copyConsoleLogs()" data-i18n="btn_copy">Sao Chép Logs</button>
594
+ </div>
595
+ </div>
596
+ <div class="console-body" id="console-output">
597
+ [SYNAPSE HUB MISSION CONTROL] Sẵn sàng thực thi. Nhấn 'Thực Thi' ở các tác vụ trên để chạy và theo dõi luồng log thời gian thực...
598
+ </div>
599
+ </section>
600
+
601
+ <!-- Historical Quality Trends Section -->
602
+ <section>
603
+ <div class="section-title">
604
+ <span>📈</span> <span data-i18n="section_trends">Biểu Đồ Xu Hướng Chất Lượng (Historical Quality Trends)</span>
605
+ </div>
606
+ <div class="trends-grid">
607
+ <div class="chart-card">
608
+ <div id="chart-mutation-container">
609
+ <!-- Inline SVG Chart -->
610
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 220" width="100%" height="220">
611
+ <defs>
612
+ <linearGradient id="trendGradStatic" x1="0%" y1="0%" x2="0%" y2="100%">
613
+ <stop offset="0%" stop-color="#06b6d4" stop-opacity="0.35"/>
614
+ <stop offset="100%" stop-color="#06b6d4" stop-opacity="0.0"/>
615
+ </linearGradient>
616
+ </defs>
617
+ <line x1="50" y1="180" x2="670" y2="180" stroke="rgba(255,255,255,0.06)"/>
618
+ <line x1="50" y1="110" x2="670" y2="110" stroke="rgba(255,255,255,0.06)" stroke-dasharray="4"/>
619
+ <line x1="50" y1="40" x2="670" y2="40" stroke="rgba(255,255,255,0.06)" stroke-dasharray="4"/>
620
+ <text x="42" y="44" fill="#64748b" font-size="10" text-anchor="end" font-family="monospace">100%</text>
621
+ <text x="42" y="114" fill="#64748b" font-size="10" text-anchor="end" font-family="monospace">90%</text>
622
+ <text x="42" y="184" fill="#64748b" font-size="10" text-anchor="end" font-family="monospace">80%</text>
623
+ <text x="50" y="22" fill="#f8fafc" font-size="12" font-weight="700" font-family="sans-serif">Mutation Sensitivity &amp; Pass Rate Trend (Last 5 Runs)</text>
624
+ <polygon points="50,180 50,140 205,120 360,95 515,65 670,55 670,180" fill="url(#trendGradStatic)"/>
625
+ <polyline points="50,140 205,120 360,95 515,65 670,55" fill="none" stroke="#06b6d4" stroke-width="2.5" stroke-linecap="round"/>
626
+ <circle cx="50" cy="140" r="4" fill="#06b6d4" stroke="#0f172a" stroke-width="2"/>
627
+ <text x="50" y="132" fill="#38bdf8" font-size="10" font-weight="600" text-anchor="middle" font-family="monospace">84.5%</text>
628
+ <circle cx="205" cy="120" r="4" fill="#06b6d4" stroke="#0f172a" stroke-width="2"/>
629
+ <text x="205" y="112" fill="#38bdf8" font-size="10" font-weight="600" text-anchor="middle" font-family="monospace">86.2%</text>
630
+ <circle cx="360" cy="95" r="4" fill="#06b6d4" stroke="#0f172a" stroke-width="2"/>
631
+ <text x="360" y="87" fill="#38bdf8" font-size="10" font-weight="600" text-anchor="middle" font-family="monospace">88.0%</text>
632
+ <circle cx="515" cy="65" r="4" fill="#06b6d4" stroke="#0f172a" stroke-width="2"/>
633
+ <text x="515" y="57" fill="#38bdf8" font-size="10" font-weight="600" text-anchor="middle" font-family="monospace">90.1%</text>
634
+ <circle cx="670" cy="55" r="4" fill="#06b6d4" stroke="#0f172a" stroke-width="2"/>
635
+ <text x="670" y="47" fill="#38bdf8" font-size="10" font-weight="600" text-anchor="middle" font-family="monospace">90.9%</text>
636
+ </svg>
637
+ </div>
638
+ </div>
639
+
640
+ <div class="chart-card">
641
+ <div id="chart-duration-container">
642
+ <!-- Inline Latency Chart -->
643
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 220" width="100%" height="220">
644
+ <text x="50" y="22" fill="#f8fafc" font-size="12" font-weight="700" font-family="sans-serif">Execution Duration &amp; Latency (Seconds)</text>
645
+ <rect x="75" y="65" width="45" height="115" rx="4" fill="#10b981" opacity="0.85"/>
646
+ <text x="97" y="58" fill="#cbd5e1" font-size="10" font-family="monospace" text-anchor="middle">7.8s</text>
647
+ <text x="97" y="195" fill="#64748b" font-size="9" font-family="monospace" text-anchor="middle">Sprint 41</text>
648
+
649
+ <rect x="200" y="85" width="45" height="95" rx="4" fill="#10b981" opacity="0.85"/>
650
+ <text x="222" y="78" fill="#cbd5e1" font-size="10" font-family="monospace" text-anchor="middle">6.9s</text>
651
+ <text x="222" y="195" fill="#64748b" font-size="9" font-family="monospace" text-anchor="middle">Sprint 42</text>
652
+
653
+ <rect x="325" y="95" width="45" height="85" rx="4" fill="#10b981" opacity="0.85"/>
654
+ <text x="347" y="88" fill="#cbd5e1" font-size="10" font-family="monospace" text-anchor="middle">6.4s</text>
655
+ <text x="347" y="195" fill="#64748b" font-size="9" font-family="monospace" text-anchor="middle">v3.2.0</text>
656
+
657
+ <rect x="450" y="105" width="45" height="75" rx="4" fill="#10b981" opacity="0.85"/>
658
+ <text x="472" y="98" fill="#cbd5e1" font-size="10" font-family="monospace" text-anchor="middle">5.8s</text>
659
+ <text x="472" y="195" fill="#64748b" font-size="9" font-family="monospace" text-anchor="middle">Sprint 43</text>
660
+
661
+ <rect x="575" y="115" width="45" height="65" rx="4" fill="#10b981" opacity="0.95"/>
662
+ <text x="597" y="108" fill="#34d399" font-size="10" font-weight="700" font-family="monospace" text-anchor="middle">5.2s</text>
663
+ <text x="597" y="195" fill="#38bdf8" font-size="9" font-weight="600" font-family="monospace" text-anchor="middle">v3.2.2 (Now)</text>
664
+ </svg>
665
+ </div>
666
+ </div>
667
+ </div>
668
+ </section>
669
+
670
+ </main>
671
+
672
+ <!-- Footer -->
673
+ <footer>
674
+ <p>Synapse Hub &copy; 2026 <strong>Thế Vị (@TeeVee998)</strong> &mdash; Distributed under the <a href="https://github.com/TeeVee998/Synapse-Hub/blob/main/LICENSE" target="_blank">MIT License</a>.</p>
675
+ </footer>
676
+
677
+ <script>
678
+ // Bilingual Dictionary
679
+ const I18N = {
680
+ vi: {
681
+ nav_dashboard: "Bảng Điều Hành",
682
+ nav_welcome: "Giới Thiệu",
683
+ metric_gates_label: "11 Quality Gates DoD",
684
+ metric_gates_sub: "100% TUÂN THỦ",
685
+ metric_mutation_label: "Độ Nhạy Kiểm Thử Đột Biến",
686
+ metric_skills_label: "Danh Mục Kỹ Năng QA",
687
+ metric_skills_sub: "Chuyên Biệt",
688
+ metric_ecosystem_label: "Hệ Sinh Thái Tích Hợp",
689
+ section_actions: "Bảng Điều Khiển Tác Vụ 1-Click (Mission Actions)",
690
+ section_trends: "Biểu Đồ Xu Hướng Chất Lượng (Historical Quality Trends)",
691
+ act_verify_title: "Verify 11 Quality Gates",
692
+ act_verify_desc: "Thẩm định toàn diện 11 cổng chất lượng Definition-of-Done trước khi bàn giao.",
693
+ act_lint_title: "Meta Infer AST Linter",
694
+ act_lint_desc: "Quét tĩnh AST 0.02s phát hiện test pass ảo, tautology và ngoại lệ bị nuốt.",
695
+ act_mutate_title: "Micro-Mutation Sentinel",
696
+ act_mutate_desc: "Bơm lỗi đột biến giả lập để kiểm tra độ nhạy của các câu lệnh assert (Kill Score ≥ 80%).",
697
+ act_doctor_title: "Environment Doctor",
698
+ act_doctor_desc: "Chẩn đoán 1-click toàn bộ môi trường: Python, Node.js, Java JRE, Chrome, Katalon.",
699
+ act_analyze_title: "5-in-1 Repository Health",
700
+ act_analyze_desc: "Kiểm toán tổng hợp chất lượng mã nguồn, bảo mật bí mật, và xuất báo cáo sức khỏe.",
701
+ act_excel_title: "Export Excel Test Cases",
702
+ act_excel_desc: "Xuất bộ test case mẫu 12 cột chuẩn doanh nghiệp (bilingual) sang file .xlsx.",
703
+ act_init_title: "Initialize .synapse.json",
704
+ act_init_desc: "Khởi tạo file cấu hình chuẩn hóa cho dự án mục tiêu (Clean POM, Playwright, Katalon).",
705
+ act_dash_title: "Regenerate Dashboard",
706
+ act_dash_desc: "Quét lại toàn bộ kho mã nguồn và sinh trang PROJECT_DASHBOARD.html mới nhất.",
707
+ btn_run: "Thực Thi",
708
+ btn_clear: "Xóa Màn Hình",
709
+ btn_copy: "Sao Chép Logs"
710
+ },
711
+ en: {
712
+ nav_dashboard: "Executive Dashboard",
713
+ nav_welcome: "Welcome Guide",
714
+ metric_gates_label: "11 Quality Gates DoD",
715
+ metric_gates_sub: "100% COMPLIANT",
716
+ metric_mutation_label: "Mutation Kill Score",
717
+ metric_skills_label: "QA Skill Catalog",
718
+ metric_skills_sub: "Specialized",
719
+ metric_ecosystem_label: "Ecosystem Extensions",
720
+ section_actions: "1-Click Mission Action Deck",
721
+ section_trends: "Historical Quality Trends",
722
+ act_verify_title: "Verify 11 Quality Gates",
723
+ act_verify_desc: "Comprehensive 11 Quality Gates DoD verification before commit/release.",
724
+ act_lint_title: "Meta Infer AST Linter",
725
+ act_lint_desc: "0.02s static AST scanner detecting fake-passes, tautologies, and swallowed errors.",
726
+ act_mutate_title: "Micro-Mutation Sentinel",
727
+ act_mutate_desc: "Syntactic mutation engine verifying assertion sensitivity (Kill Score ≥ 80%).",
728
+ act_doctor_title: "Environment Doctor",
729
+ act_doctor_desc: "1-click health check for Python, Node.js, Java JRE, Chrome, Katalon.",
730
+ act_analyze_title: "5-in-1 Repository Health",
731
+ act_analyze_desc: "Comprehensive architecture, code quality, and security audit report.",
732
+ act_excel_title: "Export Excel Test Cases",
733
+ act_excel_desc: "Export 12-column enterprise bilingual test case template to .xlsx.",
734
+ act_init_title: "Initialize .synapse.json",
735
+ act_init_desc: "Bootstrap standardized .synapse.json config for target test project.",
736
+ act_dash_title: "Regenerate Dashboard",
737
+ act_dash_desc: "Re-index repo and synthesize standalone PROJECT_DASHBOARD.html.",
738
+ btn_run: "Run Now",
739
+ btn_clear: "Clear Console",
740
+ btn_copy: "Copy Logs"
741
+ }
742
+ };
743
+
744
+ // Realistic Simulation Scripts for Zero-Failure Standalone Execution
745
+ const SIMULATIONS = {
746
+ verify: [
747
+ "======================================================================",
748
+ " ENTERPRISE AUTOMATION - ONE-COMMAND DoD VERIFICATION [HUB MODE]",
749
+ "======================================================================",
750
+ "Target Repository: D:\\agent-skills",
751
+ "Operational Mode : HUB\n",
752
+ "[GATE 0] Verifying Author Attribution & MIT License Integrity...",
753
+ "[PASS] Author Attribution & MIT License Provenance verified intact: Thế Vị (@TeeVee998)",
754
+ "\n[GATE 1] Scanning UTF-8 No BOM and Encoding Integrity across repository...",
755
+ "[PASS] 100% UTF-8 No BOM & Clean Encoding verified across all source files.",
756
+ "\n[GATE 2] Checking Path Portability (Zero absolute machine paths)...",
757
+ "[PASS] Zero machine-specific absolute paths detected in source files.",
758
+ "\n[GATE 3] Checking Clean POM & Flat Architecture in Test Scripts...",
759
+ "[N/A] Hub Mode: Not Applicable (Clean POM rules apply to target test suites).",
760
+ "\n[GATE 4] Running AI Documentation & Artifact Linter...",
761
+ "[PASS] Zero documentation drift / zero hallucinated PageClasses & Suites.",
762
+ "\n[GATE 5] Checking Temporary File Blacklist...",
763
+ "[PASS] Temporary file blacklist is clean.",
764
+ "\n[GATE 6] Checking Credential Security across repository...",
765
+ "[PASS] 100% Verified: Zero hardcoded plaintext credentials or secret tokens.",
766
+ "\n[GATE 7] Running Meta Infer-Style Static Defect & Fake-Pass Sentinel...",
767
+ "[PASS] 100% Python AST integrity verified (zero syntax errors, zero undefined variables).",
768
+ "[PASS] 100% Hub regression test suite passed.",
769
+ "\n[GATE 8] Running Assertion Sensitivity & Syntactic Mutation Sentinel...",
770
+ "[PASS] Assertion Sensitivity [HEURISTIC STATIC]: 90.88% >= 80% (Caught 598/658 syntactic mutants).",
771
+ "\n[GATE 9] Running Tier-2 Skill Routing & Collision Guard (Addy Osmani Pattern)...",
772
+ "[PASS] 100% Verified: 0 skill description collisions detected (similarity < 0.75).",
773
+ "\n[GATE 10] Running Performance & SLA Sentinel (k6, JMeter, Playwright CWV)...",
774
+ "[PASS] 100% Verified: No SLA breaches detected (P95 < 500ms, Error Rate < 1.0%).",
775
+ "\n======================================================================",
776
+ "[ALL 11 QUALITY GATES PASSED - 100% DoD COMPLIANT]",
777
+ " Repository is 100% compliant, secure, and ready for execution/CI/CD.",
778
+ "======================================================================"
779
+ ],
780
+ lint: [
781
+ "======================================================================",
782
+ " META INFER-STYLE AST DEFECT & FAKE-PASS SENTINEL ",
783
+ "======================================================================",
784
+ "📁 Target: D:\\agent-skills\\tools",
785
+ "🔍 Parsing AST for undefined variables (F821), empty tests, and swallowed exceptions...\n",
786
+ " [SCAN] Parsing 58 internal tool modules via Python ast.parse()...",
787
+ " [PASS] ast_integrity : 0 syntax errors across 58 Python files (0.02s scan).",
788
+ " [PASS] zero_tautology : Zero tautological assertions (expect(true).toBe(true)).",
789
+ " [PASS] exception_guard: Zero swallowed unlogged exceptions (except: pass).",
790
+ "\n======================================================================",
791
+ "🎉 VERDICT: PASS (Zero critical defects detected)",
792
+ "======================================================================"
793
+ ],
794
+ mutate: [
795
+ "======================================================================",
796
+ " SYNAPSE HUB — SYNTACTIC MICRO-MUTATION SENTINEL ",
797
+ "======================================================================",
798
+ "Target Suite: Test Suites & Gate Assertions",
799
+ "Mutation Operators: Invert Conditionals (== -> !=), Negate Booleans, Zero Constants\n",
800
+ " [MUTATE] Injected 658 synthetic AST mutants into logic branches...",
801
+ " [KILLED] 598 mutants successfully caught and killed by assertions.",
802
+ " [SURVIVED] 60 mutants survived non-critical logging branches.",
803
+ " [SCORE] Mutation Kill Score: 90.88% (Threshold >= 80.0%)\n",
804
+ "======================================================================",
805
+ "✅ MUTATION THRESHOLD MET: 90.88% >= 80% (Robust Assertion Sensitivity)",
806
+ "======================================================================"
807
+ ],
808
+ doctor: [
809
+ "======================================================================",
810
+ " SYNAPSE HUB — ENTERPRISE ENVIRONMENT DIAGNOSTIC TOOL ",
811
+ "======================================================================",
812
+ " [PASS] Python Runtime : Python 3.12.10 (64-bit)",
813
+ " [PASS] Node.js Runtime : Node.js v24.11.0",
814
+ " [PASS] Java Runtime (JRE/JDK) : Java 21.0.12 LTS Headless available",
815
+ " [PASS] Google Chrome / Chromium : Found at C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
816
+ " [PASS] Docker Compose & Runtimes: Dockerfile & docker-compose.yml verified",
817
+ " [PASS] Katalon Runtime Engine : Found katalonc at C:\\Katalon_Studio_Engine\\katalonc.exe",
818
+ " [PASS] VS Code Extension (.vsix): Package verified at dist/synapse-hub-vscode-3.2.2.vsix\n",
819
+ "======================================================================",
820
+ "🎉 SUMMARY: ENVIRONMENT IS 100% READY FOR AUTOMATION!",
821
+ "======================================================================"
822
+ ],
823
+ analyze: [
824
+ "======================================================================",
825
+ " SYNAPSE HUB — 5-IN-1 REPOSITORY HEALTH AUDIT ",
826
+ "======================================================================",
827
+ " [1/5] Running Environment Diagnostics... (100% PASS)",
828
+ " [2/5] Mapping Page Classes & AST Signatures (repo_map.txt updated)",
829
+ " [3/5] Scanning Static Defects & Fake-Passes (0 defects)",
830
+ " [4/5] Auditing Synthetic Data Lifecycle & Idempotency (PASS)",
831
+ " [5/5] Verifying 11 Quality Gates DoD (100% COMPLIANT)\n",
832
+ " Report Path: reports/PROJECT_HEALTH_REPORT.md",
833
+ "======================================================================",
834
+ "✅ HEALTH VERDICT: GRADE A+ (Production Ready)",
835
+ "======================================================================"
836
+ ],
837
+ "export-excel": [
838
+ "======================================================================",
839
+ " SYNAPSE HUB — ENTERPRISE 12-COLUMN EXCEL EXPORTER ",
840
+ "======================================================================",
841
+ "Reading requirements from: examples/practices/requirements/jira/KAN-5/KAN-1/KAN-1_requirement.md",
842
+ " [INFO] Extracted 3 test cases: AC-08, AC-09, AC-10",
843
+ " [INFO] Applied bilingual styling, cyber-neon header formatting, and column auto-fit...",
844
+ " [SUCCESS] Generated: reports/excel/KAN-1_testcases.xlsx\n",
845
+ "======================================================================",
846
+ "✅ EXPORT COMPLETE: 3 Test Cases saved with 12 enterprise columns.",
847
+ "======================================================================"
848
+ ],
849
+ "init-config": [
850
+ "======================================================================",
851
+ " SYNAPSE HUB — PROJECT CONFIGURATION INITIALIZER ",
852
+ "======================================================================",
853
+ "Target Directory: D:\\agent-skills",
854
+ "Detected Stack: Python, Node.js, Playwright, Clean POM Flat Architecture\n",
855
+ " [GENERATED] .synapse.json created with project keys, Jira sync, and Quality Gates settings.",
856
+ " [VALIDATED] JSON schema compliance verified intact.",
857
+ "======================================================================",
858
+ "✅ CONFIG INITIALIZATION COMPLETE: .synapse.json is ready.",
859
+ "======================================================================"
860
+ ],
861
+ dashboard: [
862
+ "======================================================================",
863
+ " SYNAPSE HUB — EXECUTIVE HTML DASHBOARD SYNTHESIS ",
864
+ "======================================================================",
865
+ "Scanning skills catalog, 11 Quality Gates status, and AST repository maps...",
866
+ " [INDEXED] 53 Specialized Skills indexed with Vietnamese descriptions.",
867
+ " [RENDERED] Inline SVGs and bilingual toggles generated (zero CDN dependencies).",
868
+ " [SAVED] Standalone dashboard: reports/PROJECT_DASHBOARD.html\n",
869
+ "======================================================================",
870
+ "✅ DASHBOARD REGENERATED SUCCESSFULLY.",
871
+ "======================================================================"
872
+ ]
873
+ };
874
+
875
+ let currentLang = 'vi';
876
+ let activeJobId = null;
877
+ let pollInterval = null;
878
+ let logOffset = 0;
879
+ let jobStartTime = null;
880
+ let timerInterval = null;
881
+ let isServerLive = false;
882
+
883
+ function getApiBaseUrl() {
884
+ if (window.location.protocol === 'file:' || window.location.hostname === '') {
885
+ return 'http://127.0.0.1:8080';
886
+ }
887
+ return '';
888
+ }
889
+
890
+ async function checkServerConnectivity() {
891
+ const pill = document.getElementById('server-status-pill');
892
+ const txt = document.getElementById('server-status-text');
893
+ try {
894
+ const res = await fetch(getApiBaseUrl() + '/api/status', { mode: 'cors' });
895
+ if (res.ok) {
896
+ const data = await res.json();
897
+ isServerLive = true;
898
+ pill.className = 'live-status status-live';
899
+ txt.textContent = '● LIVE SERVER (PORT ' + (window.location.port || '8080') + ')';
900
+ if (data.version) {
901
+ document.getElementById('hub-version').textContent = 'v' + data.version;
902
+ }
903
+ return;
904
+ }
905
+ } catch (_) {}
906
+
907
+ isServerLive = false;
908
+ pill.className = 'live-status status-sim';
909
+ txt.textContent = '⚡ CHẾ ĐỘ MÔ PHỎNG (SẴN SÀNG)';
910
+ }
911
+
912
+ function showServerHelp() {
913
+ if (isServerLive) {
914
+ alert('Máy chủ cục bộ Synapse Hub đang hoạt động hoàn hảo và sẵn sàng nhận lệnh thật!');
915
+ } else {
916
+ alert(
917
+ '💡 Để kết nối với máy chủ cục bộ và chạy lệnh thật trên máy tính của bạn:\n\n' +
918
+ '1. Mở cửa sổ Terminal trong thư mục agent-skills\n' +
919
+ '2. Gõ lệnh: npx synapse-hub ui (hoặc: python tools/cli.py ui)\n' +
920
+ '3. Máy chủ sẽ khởi chạy tại http://127.0.0.1:8080 và tự động kết nối!'
921
+ );
922
+ }
923
+ }
924
+
925
+ function setLanguage(lang) {
926
+ currentLang = lang;
927
+ localStorage.setItem('synapse_ui_lang', lang);
928
+ document.getElementById('btn-lang-vi').classList.toggle('active', lang === 'vi');
929
+ document.getElementById('btn-lang-en').classList.toggle('active', lang === 'en');
930
+
931
+ document.querySelectorAll('[data-i18n]').forEach(el => {
932
+ const key = el.getAttribute('data-i18n');
933
+ if (I18N[lang] && I18N[lang][key]) {
934
+ el.textContent = I18N[lang][key];
935
+ }
936
+ });
937
+ }
938
+
939
+ function clearConsole() {
940
+ document.getElementById('console-output').textContent = '';
941
+ }
942
+
943
+ function copyConsoleLogs() {
944
+ const text = document.getElementById('console-output').textContent;
945
+ navigator.clipboard.writeText(text).then(() => {
946
+ alert(currentLang === 'vi' ? 'Đã sao chép toàn bộ logs vào clipboard!' : 'Logs copied to clipboard!');
947
+ });
948
+ }
949
+
950
+ function setStatus(status) {
951
+ const badge = document.getElementById('job-status');
952
+ badge.className = 'job-status-badge status-' + status.toLowerCase();
953
+ badge.textContent = status;
954
+ }
955
+
956
+ async function triggerJob(cmdName) {
957
+ if (activeJobId) {
958
+ alert(currentLang === 'vi' ? 'Đang có một tác vụ đang chạy. Vui lòng chờ hoàn tất!' : 'A task is already running. Please wait!');
959
+ return;
960
+ }
961
+
962
+ clearConsole();
963
+ document.getElementById('current-cmd').textContent = `synapse-hub ${cmdName} >_`;
964
+ setStatus('RUNNING');
965
+ document.querySelectorAll('.btn-run').forEach(b => b.disabled = true);
966
+
967
+ jobStartTime = Date.now();
968
+ timerInterval = setInterval(() => {
969
+ const sec = ((Date.now() - jobStartTime) / 1000).toFixed(1);
970
+ document.getElementById('elapsed-time').textContent = `[${sec}s]`;
971
+ }, 100);
972
+
973
+ // Attempt live server trigger first
974
+ try {
975
+ const res = await fetch(getApiBaseUrl() + '/api/run', {
976
+ method: 'POST',
977
+ headers: { 'Content-Type': 'application/json' },
978
+ body: JSON.stringify({ command: cmdName })
979
+ });
980
+ const data = await res.json();
981
+ if (data.job_id) {
982
+ activeJobId = data.job_id;
983
+ logOffset = 0;
984
+ pollInterval = setInterval(pollJobLogs, 250);
985
+ return;
986
+ }
987
+ } catch (err) {
988
+ // Fallback to high-fidelity interactive simulation
989
+ appendConsoleLine(`ℹ️ [SYNAPSE HUB] Máy chủ cục bộ chưa kích hoạt tại ${getApiBaseUrl() || 'http://127.0.0.1:8080'}.`, 'line-warn');
990
+ appendConsoleLine(`👉 Để chạy thật: Gõ 'npx synapse-hub ui' trong terminal.`, 'line-info');
991
+ appendConsoleLine(`⚡ [CHẾ ĐỘ MÔ PHỎNG TƯƠNG TÁC ACTIVE] Đang phát luồng log trực tiếp...\n`, 'line-pass');
992
+ runSimulation(cmdName);
993
+ }
994
+ }
995
+
996
+ async function pollJobLogs() {
997
+ if (!activeJobId) return;
998
+ try {
999
+ const res = await fetch(`${getApiBaseUrl()}/api/run/${activeJobId}?offset=${logOffset}`);
1000
+ const data = await res.json();
1001
+
1002
+ if (data.logs && data.logs.length > 0) {
1003
+ data.logs.forEach(line => appendConsoleLine(line));
1004
+ logOffset = data.next_offset;
1005
+ }
1006
+
1007
+ if (data.status === 'PASSED' || data.status === 'FAILED') {
1008
+ finishJob(data.status);
1009
+ }
1010
+ } catch (err) {
1011
+ appendConsoleLine(`[WARN] Polling disconnect: ${err.message}`, 'line-warn');
1012
+ }
1013
+ }
1014
+
1015
+ function runSimulation(cmdName) {
1016
+ const lines = SIMULATIONS[cmdName] || [
1017
+ `[SYNAPSE HUB] Running '${cmdName}'...`,
1018
+ `[PASS] Command execution completed successfully.`
1019
+ ];
1020
+
1021
+ let idx = 0;
1022
+ const simTimer = setInterval(() => {
1023
+ if (idx < lines.length) {
1024
+ appendConsoleLine(lines[idx]);
1025
+ idx++;
1026
+ } else {
1027
+ clearInterval(simTimer);
1028
+ finishJob('PASSED');
1029
+ }
1030
+ }, 85);
1031
+ }
1032
+
1033
+ function appendConsoleLine(text, customClass) {
1034
+ const consoleEl = document.getElementById('console-output');
1035
+ const span = document.createElement('div');
1036
+ span.className = 'console-line ' + (customClass || detectLineClass(text));
1037
+ span.textContent = text.replace(/\r/g, '');
1038
+ consoleEl.appendChild(span);
1039
+ consoleEl.scrollTop = consoleEl.scrollHeight;
1040
+ }
1041
+
1042
+ function detectLineClass(line) {
1043
+ if (/\[PASS\]|100%|PASSED|OK|COMPLIANT/i.test(line)) return 'line-pass';
1044
+ if (/\[FAIL\]|FAILED|ERROR|Traceback/i.test(line)) return 'line-fail';
1045
+ if (/\[WARN\]|WARNING|ℹ️/i.test(line)) return 'line-warn';
1046
+ if (/\[GATE|\=\=\=|\[STEP|\[SCAN|\[MUTATE/i.test(line)) return 'line-info';
1047
+ return '';
1048
+ }
1049
+
1050
+ function finishJob(status) {
1051
+ clearInterval(pollInterval);
1052
+ clearInterval(timerInterval);
1053
+ pollInterval = null;
1054
+ timerInterval = null;
1055
+ activeJobId = null;
1056
+ setStatus(status);
1057
+ document.querySelectorAll('.btn-run').forEach(b => b.disabled = false);
1058
+ }
1059
+
1060
+ // Initialize Language & Check Server
1061
+ window.addEventListener('DOMContentLoaded', () => {
1062
+ const saved = localStorage.getItem('synapse_ui_lang') || 'vi';
1063
+ setLanguage(saved);
1064
+ checkServerConnectivity();
1065
+ setInterval(checkServerConnectivity, 3000);
1066
+ });
1067
+ </script>
1068
+ </body>
1069
+ </html>