@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,770 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Enterprise QA Autonomous Project Setup & Bootstrap Engine
4
+ ----------------------------------------------------------
5
+ Transforms any target test project into an AI-Ready Enterprise Suite in 1-click.
6
+ Dispatched automatically by AI Agents (Zero-Command Protocol) or via 'agent-qa setup'.
7
+
8
+ Automated actions:
9
+ 1. Detects project tech stack (Katalon, Playwright, Cypress, Pytest).
10
+ 2. Generates tailored 'PROJECT_AI_GUIDE.md' if missing.
11
+ 3. Deploys Universal AI Bridges (.cursor/rules, CLAUDE.md, .github/copilot-instructions.md, .windsurfrules).
12
+ 4. Injects Antigravity Global Plugin (~/.gemini/config/plugins/synapse-hub).
13
+ 5. Installs automated Git Pre-Push Hook (.git/hooks/pre-push) for zero-leakage protection.
14
+ 6. Triggers 5-in-1 Health Audit (tools/analyze_project.py):
15
+ - Maps AST method signatures (repo_map.txt).
16
+ - Scans fake passes (infer_linter).
17
+ - Audits database teardown hygiene (trace_data_flow).
18
+ - Generates in-project health report (PROJECT_HEALTH_REPORT.md).
19
+ """
20
+
21
+ import os
22
+ import sys
23
+ import json
24
+ import shutil
25
+ import argparse
26
+ from pathlib import Path
27
+
28
+ # Enforce UTF-8 stdout encoding for Windows console compatibility
29
+ if hasattr(sys.stdout, 'reconfigure'):
30
+ try:
31
+ sys.stdout.reconfigure(encoding='utf-8')
32
+ sys.stderr.reconfigure(encoding='utf-8')
33
+ except Exception:
34
+ pass
35
+
36
+ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
37
+ HUB_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
38
+ TEMPLATES_DIR = os.path.join(HUB_ROOT, "templates")
39
+ sys.path.insert(0, SCRIPT_DIR)
40
+
41
+ import analyze_project # noqa: E402
42
+ import project_state # noqa: E402
43
+
44
+ GREEN = "\033[92m"
45
+ RED = "\033[91m"
46
+ YELLOW = "\033[93m"
47
+ CYAN = "\033[96m"
48
+ BOLD = "\033[1m"
49
+ RESET = "\033[0m"
50
+
51
+
52
+ def resolve_target_repo(cli_target=None, cli_repo=None):
53
+ chosen = cli_repo or cli_target
54
+ if chosen:
55
+ resolved = os.path.abspath(chosen)
56
+ if not os.path.exists(resolved):
57
+ raise FileNotFoundError(f"Target repository path not found: {resolved}")
58
+ if resolved.lower() == HUB_ROOT.lower():
59
+ print(f"{RED}{BOLD}X [CWD CONFUSION GUARD] Target repository cannot be Synapse-Hub itself!{RESET}")
60
+ print(" Synapse-Hub is the centralized skill hub, not an automation target project.")
61
+ print(" Please specify a target project: python tools/setup_project.py --target /path/to/target-project")
62
+ sys.exit(1)
63
+ return resolved
64
+
65
+ env_dir = os.environ.get("TARGET_PROJECT_DIR")
66
+ if env_dir and os.path.exists(env_dir):
67
+ resolved_env = os.path.abspath(env_dir)
68
+ if resolved_env.lower() == HUB_ROOT.lower():
69
+ print(f"{RED}{BOLD}X [CWD CONFUSION GUARD] TARGET_PROJECT_DIR points to Synapse-Hub itself!{RESET}")
70
+ sys.exit(1)
71
+ return resolved_env
72
+
73
+ cwd = os.path.abspath(os.getcwd())
74
+ if cwd.lower() != HUB_ROOT.lower():
75
+ return cwd
76
+
77
+ print(f"{RED}{BOLD}X [CWD CONFUSION GUARD] Current working directory is Synapse-Hub!{RESET}")
78
+ print(" You must run setup inside your target project folder or supply --target:")
79
+ print(" python tools/setup_project.py --target <path_to_target_project>")
80
+ sys.exit(1)
81
+
82
+
83
+ def detect_tech_stack(target_dir):
84
+ """Detects target project automation framework and script language."""
85
+ target_path = Path(target_dir)
86
+
87
+ # 1. Katalon Studio check
88
+ prj_files = list(target_path.glob("*.prj"))
89
+ if prj_files or (target_path / "Keywords").is_dir() or (target_path / "Scripts").is_dir():
90
+ prj_name = prj_files[0].stem if prj_files else target_path.name
91
+ return {
92
+ "name": prj_name,
93
+ "framework": "Katalon Studio (Enterprise Web)",
94
+ "language": "Groovy",
95
+ "page_dir": "Keywords/pages",
96
+ "test_dir": "Scripts",
97
+ "run_cmd": "katalonc -noSplash -runMode=console"
98
+ }
99
+
100
+ # 2. Playwright check
101
+ if (target_path / "playwright.config.ts").exists() or (target_path / "playwright.config.js").exists():
102
+ is_ts = (target_path / "playwright.config.ts").exists() or (target_path / "tsconfig.json").exists()
103
+ return {
104
+ "name": target_path.name,
105
+ "framework": "Playwright Test",
106
+ "language": "TypeScript" if is_ts else "JavaScript",
107
+ "page_dir": "src/pages" if (target_path / "src" / "pages").exists() else "pages",
108
+ "test_dir": "tests",
109
+ "run_cmd": "npx playwright test --project=chromium"
110
+ }
111
+
112
+ # 3. Cypress check
113
+ if (target_path / "cypress.config.ts").exists() or (target_path / "cypress.config.js").exists():
114
+ return {
115
+ "name": target_path.name,
116
+ "framework": "Cypress E2E",
117
+ "language": "TypeScript" if (target_path / "cypress.config.ts").exists() else "JavaScript",
118
+ "page_dir": "cypress/pages",
119
+ "test_dir": "cypress/e2e",
120
+ "run_cmd": "npx cypress run --headless"
121
+ }
122
+
123
+ # 4. Selenium WebDriver check
124
+ req_txt = target_path / "requirements.txt"
125
+ has_selenium_req = req_txt.exists() and "selenium" in req_txt.read_text(encoding="utf-8", errors="ignore").lower()
126
+ has_selenium_code = any("selenium" in f.read_text(encoding="utf-8", errors="ignore") for f in list(target_path.glob("**/*.py"))[:10]) if list(target_path.glob("**/*.py")) else False
127
+ if has_selenium_req or has_selenium_code:
128
+ return {
129
+ "name": target_path.name,
130
+ "framework": "Selenium WebDriver",
131
+ "language": "Python",
132
+ "page_dir": "pages",
133
+ "test_dir": "tests",
134
+ "run_cmd": "pytest tests/ -v"
135
+ }
136
+
137
+ # 5. Pytest check
138
+ if (target_path / "pytest.ini").exists() or list(target_path.glob("test_*.py")):
139
+ return {
140
+ "name": target_path.name,
141
+ "framework": "Pytest",
142
+ "language": "Python",
143
+ "page_dir": "pages",
144
+ "test_dir": "tests",
145
+ "run_cmd": "pytest tests/ -v"
146
+ }
147
+
148
+ # Default fallback
149
+ return {
150
+ "name": target_path.name,
151
+ "framework": "Enterprise Test Automation",
152
+ "language": "TypeScript / Groovy",
153
+ "page_dir": "pages",
154
+ "test_dir": "tests",
155
+ "run_cmd": "npm test"
156
+ }
157
+
158
+
159
+ def ensure_project_ai_guide(target_dir, stack_info, profile="full"):
160
+ """Generates PROJECT_AI_GUIDE.md tailored to the target project if missing."""
161
+ guide_path = os.path.join(target_dir, "PROJECT_AI_GUIDE.md")
162
+ if os.path.exists(guide_path):
163
+ print(f" [PASS] PROJECT_AI_GUIDE.md already exists: {guide_path}")
164
+ return False
165
+
166
+ template_path = os.path.join(TEMPLATES_DIR, "PROJECT_AI_GUIDE_TEMPLATE.md")
167
+ content = ""
168
+ if os.path.exists(template_path):
169
+ with open(template_path, "r", encoding="utf-8") as f:
170
+ content = f.read()
171
+ else:
172
+ content = f"# PROJECT AI GUIDE: {stack_info['name']}\n\n## 1. General System Under Test\n"
173
+
174
+ # Populate template placeholders with detected project metadata
175
+ content = content.replace("[TARGET_PROJECT_NAME]", stack_info["name"])
176
+ content = content.replace("[e.g., Enterprise Billing Platform / Customer Portal]", stack_info["name"])
177
+ content = content.replace("[e.g., Playwright Test, Katalon Studio 10.x, Cypress, Selenium]", stack_info["framework"])
178
+ content = content.replace("[e.g., TypeScript, Groovy, Python, JavaScript]", stack_info["language"])
179
+ content = content.replace("src/pages/... or Keywords/pages/...", stack_info["page_dir"])
180
+ content = content.replace("tests/e2e/... or Scripts/...", stack_info["test_dir"])
181
+ content = content.replace("[e.g., npx playwright test --project=chromium --reporter=html,junit:results.xml]", stack_info["run_cmd"])
182
+
183
+ profile_line = f"- **Active Skills Profile:** `{profile.upper()}`"
184
+ if profile_line not in content:
185
+ lang_target = f"- **Script Language:** `{stack_info['language']}`"
186
+ if lang_target in content:
187
+ content = content.replace(lang_target, f"{lang_target}\n{profile_line}")
188
+ else:
189
+ content = content.replace("## 1. General System Under Test", f"## 1. General System Under Test\n{profile_line}")
190
+
191
+ with open(guide_path, "w", encoding="utf-8") as f:
192
+ f.write(content)
193
+
194
+ print(f" {GREEN}[OK] Generated PROJECT_AI_GUIDE.md tailored to {stack_info['framework']}:{RESET} {guide_path}")
195
+ return True
196
+
197
+
198
+ def ensure_synapse_config(target_dir):
199
+ """Auto-generates canonical .synapse.json if it does not already exist."""
200
+ cfg_file = os.path.join(target_dir, ".synapse.json")
201
+ if os.path.isfile(cfg_file):
202
+ return True
203
+ try:
204
+ import init_config
205
+ prj_name = os.path.basename(os.path.abspath(target_dir))
206
+ res = init_config.init_config(target_dir=target_dir, project_name=prj_name, force=False, interactive=False)
207
+ return res == 0
208
+ except Exception as e:
209
+ print(f" ⚠️ Could not auto-generate .synapse.json: {e}")
210
+ return False
211
+
212
+
213
+ def install_git_pre_push_hook(target_dir):
214
+ """
215
+ Installs or appends an automated pre-push hook into target project's .git repository.
216
+ Safely backs up any existing pre-push hook (e.g. Husky, Lefthook) to prevent side-effects.
217
+ """
218
+ git_dir = os.path.join(target_dir, ".git")
219
+ if not os.path.isdir(git_dir):
220
+ print(" [SKIP] Not a Git repository root (.git folder not found). Skipped Git Hook installation.")
221
+ return False
222
+
223
+ hooks_dir = os.path.join(git_dir, "hooks")
224
+ os.makedirs(hooks_dir, exist_ok=True)
225
+ hook_file = os.path.join(hooks_dir, "pre-push")
226
+
227
+ # Resolve pinned package version
228
+ manifest_file = os.path.join(HUB_ROOT, "skills_manifest.json")
229
+ pkg_ver = "2.2.2"
230
+ if os.path.exists(manifest_file):
231
+ try:
232
+ with open(manifest_file, "r", encoding="utf-8") as f:
233
+ pkg_ver = json.load(f).get("version", pkg_ver)
234
+ except (IOError, json.JSONDecodeError, KeyError):
235
+ pkg_ver = "2.4.3"
236
+
237
+ verify_all_script = os.path.join(SCRIPT_DIR, "verify_all.py").replace("\\", "/")
238
+ analyze_script = os.path.join(SCRIPT_DIR, "analyze_project.py").replace("\\", "/")
239
+
240
+ hook_snippet = f"""
241
+ # --- Synapse-Hub Pre-Push Quality Gate (v{pkg_ver}) ---
242
+ echo "\\n[AI-GUARD] Running Pre-Push Verification (Quality Gates DoD)..."
243
+ # Prioritize local tool execution to run offline without network latency or registry dependency
244
+ if [ -f "{verify_all_script}" ]; then
245
+ python3 "{verify_all_script}" || python "{verify_all_script}"
246
+ elif command -v synapse-hub >/dev/null 2>&1; then
247
+ synapse-hub verify
248
+ elif command -v agent-qa >/dev/null 2>&1; then
249
+ agent-qa verify
250
+ elif command -v npx >/dev/null 2>&1; then
251
+ npx --no-install synapse-hub verify 2>/dev/null || npx synapse-hub@{pkg_ver} verify
252
+ else
253
+ echo "\\n[AI-GUARD - REJECTED] No verification engine found (synapse-hub, agent-qa, npx missing)."
254
+ exit 1
255
+ fi
256
+ if [ $? -ne 0 ]; then
257
+ echo "\\n[AI-GUARD - REJECTED] Git Push aborted: Quality Gates verification failed!"
258
+ echo "Please fix defects or run 'python tools/verify_all.py' locally before pushing.\\n"
259
+ exit 1
260
+ fi
261
+
262
+ echo "[AI-GUARD - PASSED] Quality Gates satisfied. Syncing project health report..."
263
+ if [ -f "{analyze_script}" ]; then
264
+ python3 "{analyze_script}" || python "{analyze_script}"
265
+ elif command -v synapse-hub >/dev/null 2>&1; then
266
+ synapse-hub analyze
267
+ elif command -v agent-qa >/dev/null 2>&1; then
268
+ agent-qa analyze
269
+ elif command -v npx >/dev/null 2>&1; then
270
+ npx --no-install synapse-hub analyze 2>/dev/null || npx synapse-hub@{pkg_ver} analyze
271
+ fi
272
+ echo "[AI-GUARD - READY] Pushing to remote...\\n"
273
+ # --- End Synapse-Hub Quality Gate ---
274
+ """
275
+
276
+ try:
277
+ if os.path.exists(hook_file):
278
+ with open(hook_file, "r", encoding="utf-8", errors="ignore") as f:
279
+ existing_content = f.read()
280
+
281
+ if "Synapse-Hub" in existing_content or "synapse-hub" in existing_content:
282
+ print(f" {CYAN}[SKIP] Pre-Push Git Hook already present:{RESET} {hook_file}")
283
+ return True
284
+
285
+ # Safely backup existing hook (e.g. Husky, Lefthook)
286
+ backup_file = f"{hook_file}.backup"
287
+ shutil.copy2(hook_file, backup_file)
288
+ print(f" {YELLOW}[BACKUP] Existing pre-push hook backed up to:{RESET} {backup_file}")
289
+
290
+ # Append non-destructively
291
+ final_content = existing_content.rstrip() + "\n" + hook_snippet
292
+ else:
293
+ final_content = "#!/bin/sh\n" + hook_snippet
294
+
295
+ with open(hook_file, "w", encoding="utf-8", newline="\n") as f:
296
+ f.write(final_content)
297
+
298
+ # Attempt to make executable on Unix-like environments
299
+ try:
300
+ os.chmod(hook_file, 0o755) # nosec B103
301
+ except OSError:
302
+ pass
303
+
304
+ print(f" {GREEN}[OK] Configured automated Pre-Push Git Hook:{RESET} {hook_file} (pinned to v{pkg_ver})")
305
+ return True
306
+ except Exception as e:
307
+ print(f" ⚠️ Could not install Git hook: {e}")
308
+ return False
309
+
310
+
311
+ def ensure_gitignore_protection(target_dir):
312
+ """Ensures local cache and generated AST intelligence artifacts are ignored in target repo."""
313
+ gitignore_path = os.path.join(target_dir, ".gitignore")
314
+ entries = [".synapse/", "repo_map.txt", "repo_map.json"]
315
+ try:
316
+ existing = ""
317
+ if os.path.exists(gitignore_path):
318
+ with open(gitignore_path, "r", encoding="utf-8", errors="ignore") as f:
319
+ existing = f.read()
320
+ missing = [e for e in entries if e not in existing]
321
+ if missing:
322
+ with open(gitignore_path, "a", encoding="utf-8") as f:
323
+ if existing and not existing.endswith("\n"):
324
+ f.write("\n")
325
+ f.write("\n# Synapse-Hub Local Cache & AST Intelligence\n")
326
+ for e in missing:
327
+ f.write(f"{e}\n")
328
+ print(f" {GREEN}[OK] Protected local cache in .gitignore:{RESET} {gitignore_path}")
329
+ return True
330
+ except OSError as err:
331
+ sys.stderr.write(f"Notice: .gitignore update skipped: {err}\n")
332
+ return False
333
+
334
+
335
+ def install_git_post_merge_hook(target_dir):
336
+ """
337
+ Installs or appends an automated post-merge hook into target project's .git repository.
338
+ When a developer pulls code for the first time via 'git pull', this triggers the
339
+ welcome landing page once, then silently records it as completed.
340
+ """
341
+ git_dir = os.path.join(target_dir, ".git")
342
+ if not os.path.isdir(git_dir):
343
+ return False
344
+
345
+ hooks_dir = os.path.join(git_dir, "hooks")
346
+ os.makedirs(hooks_dir, exist_ok=True)
347
+ hook_file = os.path.join(hooks_dir, "post-merge")
348
+
349
+ welcome_script = os.path.join(SCRIPT_DIR, "welcome_page.py").replace("\\", "/")
350
+
351
+ hook_snippet = f"""# --- Synapse-Hub Post-Merge First-Pull Sentinel ---
352
+ # Security invariant: Never execute relative scripts from target repository
353
+ if [ -f "{welcome_script}" ]; then
354
+ python3 "{welcome_script}" --first-run 2>/dev/null || python "{welcome_script}" --first-run 2>/dev/null || true
355
+ elif command -v synapse-hub >/dev/null 2>&1; then
356
+ synapse-hub welcome --first-run 2>/dev/null || true
357
+ elif command -v agent-qa >/dev/null 2>&1; then
358
+ agent-qa welcome --first-run 2>/dev/null || true
359
+ fi
360
+ """
361
+ try:
362
+ if os.path.exists(hook_file):
363
+ with open(hook_file, "r", encoding="utf-8", errors="ignore") as f:
364
+ existing_content = f.read()
365
+
366
+ if "Synapse-Hub Post-Merge" in existing_content:
367
+ return True
368
+
369
+ final_content = existing_content.rstrip() + "\n" + hook_snippet
370
+ else:
371
+ final_content = "#!/bin/sh\n" + hook_snippet
372
+
373
+ with open(hook_file, "w", encoding="utf-8", newline="\n") as f:
374
+ f.write(final_content)
375
+
376
+ try:
377
+ os.chmod(hook_file, 0o755) # nosec B103
378
+ except OSError:
379
+ pass
380
+
381
+ print(f" {GREEN}[OK] Configured Post-Merge First-Pull Git Hook:{RESET} {hook_file}")
382
+ return True
383
+ except (OSError, UnicodeDecodeError):
384
+ return False
385
+
386
+
387
+ def inject_antigravity_global_plugin():
388
+ """
389
+ Automatically injects Synapse-Hub into Antigravity's Global Plugin Directory
390
+ (~/.gemini/config/plugins/synapse-hub).
391
+ Ensures that running `npx synapse-hub setup` activates the 53 skills and 9 subagents
392
+ globally across ALL projects in Google Antigravity.
393
+ """
394
+ try:
395
+ plugins_dir = os.path.expanduser("~/.gemini/config/plugins")
396
+ target_plugin_dir = os.path.join(plugins_dir, "synapse-hub")
397
+ os.makedirs(target_plugin_dir, exist_ok=True)
398
+
399
+ # 1. plugin.json
400
+ src_plugin_json = os.path.join(HUB_ROOT, "plugin.json")
401
+ dst_plugin_json = os.path.join(target_plugin_dir, "plugin.json")
402
+ if os.path.exists(src_plugin_json):
403
+ if not os.path.exists(dst_plugin_json) or not os.path.samefile(src_plugin_json, dst_plugin_json):
404
+ shutil.copy2(src_plugin_json, dst_plugin_json)
405
+
406
+ # 2. README.md
407
+ src_readme = os.path.join(HUB_ROOT, "README.md")
408
+ dst_readme = os.path.join(target_plugin_dir, "README.md")
409
+ if os.path.exists(src_readme):
410
+ if not os.path.exists(dst_readme) or not os.path.samefile(src_readme, dst_readme):
411
+ shutil.copy2(src_readme, dst_readme)
412
+
413
+ # 3. LICENSE & NOTICE (MIT License Provenance & Author Attribution)
414
+ for meta_file in ("LICENSE", "NOTICE"):
415
+ src_meta = os.path.join(HUB_ROOT, meta_file)
416
+ dst_meta = os.path.join(target_plugin_dir, meta_file)
417
+ if os.path.exists(src_meta):
418
+ if not os.path.exists(dst_meta) or not os.path.samefile(src_meta, dst_meta):
419
+ shutil.copy2(src_meta, dst_meta)
420
+
421
+ # Helper to sync directory (junction or copy)
422
+ def sync_dir(src, dst):
423
+ if not os.path.exists(src):
424
+ return
425
+ if os.path.exists(dst) and os.path.samefile(src, dst):
426
+ return
427
+ if os.path.islink(dst):
428
+ try:
429
+ os.unlink(dst)
430
+ except OSError:
431
+ _ = False
432
+ if sys.platform == "win32":
433
+ try:
434
+ import _winapi
435
+ if not os.path.exists(dst):
436
+ _winapi.CreateJunction(src, dst)
437
+ return
438
+ except (OSError, ImportError, AttributeError):
439
+ _ = False
440
+ shutil.copytree(src, dst, dirs_exist_ok=True, ignore=shutil.ignore_patterns("__pycache__", "*.pyc", "*.tmp"))
441
+
442
+ sync_dir(os.path.join(HUB_ROOT, ".agents", "skills"), os.path.join(target_plugin_dir, "skills"))
443
+ sync_dir(os.path.join(HUB_ROOT, ".agents", "agents"), os.path.join(target_plugin_dir, "agents"))
444
+ sync_dir(os.path.join(HUB_ROOT, "tools"), os.path.join(target_plugin_dir, "tools"))
445
+
446
+ # 3. Rules (AGENTS.md)
447
+ dst_rules = os.path.join(target_plugin_dir, "rules")
448
+ os.makedirs(dst_rules, exist_ok=True)
449
+ src_agents_md = os.path.join(HUB_ROOT, "AGENTS.md")
450
+ dst_agents_md = os.path.join(dst_rules, "AGENTS.md")
451
+ if os.path.exists(src_agents_md):
452
+ if not os.path.exists(dst_agents_md) or not os.path.samefile(src_agents_md, dst_agents_md):
453
+ shutil.copy2(src_agents_md, dst_agents_md)
454
+
455
+ print(f" {GREEN}[OK] Injected Antigravity Global Plugin:{RESET} {target_plugin_dir}")
456
+ return True
457
+ except Exception as e:
458
+ print(f" ⚠️ Antigravity Global Plugin notice: {e}")
459
+ return False
460
+
461
+
462
+ def install_universal_ai_bridges(target_dir):
463
+ """
464
+ Deploys Universal AI Bridge configuration files into the target project workspace
465
+ for seamless integration with Cursor, Claude Code, GitHub Copilot, and Windsurf.
466
+ """
467
+ bridges_dir = os.path.join(TEMPLATES_DIR, "ai_bridges")
468
+ if not os.path.exists(bridges_dir):
469
+ return False
470
+
471
+ deployed = []
472
+
473
+ # 1. Cursor (.cursor/rules/synapse-qa.mdc)
474
+ cursor_dir = os.path.join(target_dir, ".cursor", "rules")
475
+ os.makedirs(cursor_dir, exist_ok=True)
476
+ src_cursor = os.path.join(bridges_dir, "cursor_synapse_qa.mdc")
477
+ dst_cursor = os.path.join(cursor_dir, "synapse-qa.mdc")
478
+ if os.path.exists(src_cursor):
479
+ shutil.copy2(src_cursor, dst_cursor)
480
+ deployed.append("Cursor (.cursor/rules/synapse-qa.mdc)")
481
+
482
+ # 2. Claude Code (CLAUDE.md)
483
+ dst_claude = os.path.join(target_dir, "CLAUDE.md")
484
+ src_claude = os.path.join(bridges_dir, "CLAUDE.md")
485
+ if os.path.exists(src_claude):
486
+ if not os.path.exists(dst_claude):
487
+ shutil.copy2(src_claude, dst_claude)
488
+ deployed.append("Claude Code (CLAUDE.md)")
489
+ else:
490
+ with open(dst_claude, "r", encoding="utf-8", errors="ignore") as f:
491
+ c_content = f.read()
492
+ if "Synapse-Hub" not in c_content:
493
+ with open(src_claude, "r", encoding="utf-8") as f:
494
+ append_data = f.read()
495
+ with open(dst_claude, "a", encoding="utf-8") as f:
496
+ f.write("\n\n" + append_data)
497
+ deployed.append("Claude Code (appended to CLAUDE.md)")
498
+
499
+ # 3. GitHub Copilot (.github/copilot-instructions.md)
500
+ github_dir = os.path.join(target_dir, ".github")
501
+ os.makedirs(github_dir, exist_ok=True)
502
+ dst_copilot = os.path.join(github_dir, "copilot-instructions.md")
503
+ src_copilot = os.path.join(bridges_dir, "copilot-instructions.md")
504
+ if os.path.exists(src_copilot):
505
+ if not os.path.exists(dst_copilot):
506
+ shutil.copy2(src_copilot, dst_copilot)
507
+ deployed.append("GitHub Copilot (.github/copilot-instructions.md)")
508
+ else:
509
+ with open(dst_copilot, "r", encoding="utf-8", errors="ignore") as f:
510
+ cp_content = f.read()
511
+ if "Synapse-Hub" not in cp_content:
512
+ with open(src_copilot, "r", encoding="utf-8") as f:
513
+ append_data = f.read()
514
+ with open(dst_copilot, "a", encoding="utf-8") as f:
515
+ f.write("\n\n" + append_data)
516
+ deployed.append("GitHub Copilot (appended to copilot-instructions.md)")
517
+
518
+ # 4. Windsurf (.windsurfrules)
519
+ dst_windsurf = os.path.join(target_dir, ".windsurfrules")
520
+ src_windsurf = os.path.join(bridges_dir, "windsurfrules")
521
+ if os.path.exists(src_windsurf):
522
+ if not os.path.exists(dst_windsurf):
523
+ shutil.copy2(src_windsurf, dst_windsurf)
524
+ deployed.append("Windsurf (.windsurfrules)")
525
+ else:
526
+ with open(dst_windsurf, "r", encoding="utf-8", errors="ignore") as f:
527
+ w_content = f.read()
528
+ if "Synapse-Hub" not in w_content:
529
+ with open(src_windsurf, "r", encoding="utf-8") as f:
530
+ append_data = f.read()
531
+ with open(dst_windsurf, "a", encoding="utf-8") as f:
532
+ f.write("\n\n" + append_data)
533
+ deployed.append("Windsurf (appended to .windsurfrules)")
534
+
535
+ if deployed:
536
+ print(f" {GREEN}[OK] Deployed Universal AI Bridges:{RESET} {', '.join(deployed)}")
537
+ return True
538
+
539
+
540
+ def uninstall_setup(target_repo: str) -> int:
541
+ """Safely reverts and removes files installed by setup_project in the target repo."""
542
+ print(f"\n{BOLD}{YELLOW}======================================================================{RESET}")
543
+ print(f"{BOLD}{YELLOW} SYNAPSE HUB — REVERT & UNINSTALL SETUP {RESET}")
544
+ print(f"{BOLD}{YELLOW}======================================================================{RESET}")
545
+ print(f"Target Repository: {target_repo}")
546
+
547
+ reverted_items = 0
548
+
549
+ # 1. Remove PROJECT_AI_GUIDE.md
550
+ guide_file = os.path.join(target_repo, "PROJECT_AI_GUIDE.md")
551
+ if os.path.exists(guide_file):
552
+ os.remove(guide_file)
553
+ print(f" {GREEN}[REMOVED]{RESET} {guide_file}")
554
+ reverted_items += 1
555
+
556
+ # 2. Restore/Remove Git Pre-Push Hook
557
+ hook_file = os.path.join(target_repo, ".git", "hooks", "pre-push")
558
+ backup_file = os.path.join(target_repo, ".git", "hooks", "pre-push.bak")
559
+ if os.path.exists(backup_file):
560
+ if os.path.exists(hook_file):
561
+ os.remove(hook_file)
562
+ shutil.move(backup_file, hook_file)
563
+ print(f" {GREEN}[RESTORED]{RESET} Restored original pre-push hook from backup")
564
+ reverted_items += 1
565
+ elif os.path.exists(hook_file):
566
+ with open(hook_file, "r", encoding="utf-8", errors="ignore") as f:
567
+ content = f.read()
568
+ if "Synapse-Hub" in content or "synapse-hub" in content:
569
+ os.remove(hook_file)
570
+ print(f" {GREEN}[REMOVED]{RESET} Cleaned Synapse-Hub pre-push hook")
571
+ reverted_items += 1
572
+
573
+ # 3. Remove Cursor rule
574
+ cursor_rule = os.path.join(target_repo, ".cursor", "rules", "synapse-qa.mdc")
575
+ if os.path.exists(cursor_rule):
576
+ os.remove(cursor_rule)
577
+ print(f" {GREEN}[REMOVED]{RESET} {cursor_rule}")
578
+ reverted_items += 1
579
+
580
+ # 4. Remove Copilot instruction
581
+ copilot_file = os.path.join(target_repo, ".github", "copilot-instructions.md")
582
+ if os.path.exists(copilot_file):
583
+ os.remove(copilot_file)
584
+ print(f" {GREEN}[REMOVED]{RESET} {copilot_file}")
585
+ reverted_items += 1
586
+
587
+ # 5. Remove Windsurf rules
588
+ windsurf_file = os.path.join(target_repo, ".windsurfrules")
589
+ if os.path.exists(windsurf_file):
590
+ os.remove(windsurf_file)
591
+ print(f" {GREEN}[REMOVED]{RESET} {windsurf_file}")
592
+ reverted_items += 1
593
+
594
+ print(f"\n{GREEN}✅ Uninstall complete! Cleaned {reverted_items} configuration files/hooks.{RESET}\n")
595
+ return 0
596
+
597
+
598
+ def run_setup(target_repo, dry_run=False, profile="auto", no_global=True, no_git_hook=False, no_browser=True, open_browser=False):
599
+ """Main execution entrypoint for automated project setup."""
600
+ print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
601
+ print(f"{BOLD}{CYAN} AUTONOMOUS ZERO-COMMAND PROJECT BOOTSTRAP (AI-READY SETUP) {RESET}")
602
+ print(f"{BOLD}{CYAN}======================================================================{RESET}")
603
+ print(f"📁 Target Project : {target_repo}")
604
+
605
+ # 1. Detect Stack
606
+ stack_info = detect_tech_stack(target_repo)
607
+ print(f"🔍 Detected Stack : {BOLD}{stack_info['framework']}{RESET} ({stack_info['language']})")
608
+ print(f"📂 Structure Scope : Pages: `{stack_info['page_dir']}` | Tests: `{stack_info['test_dir']}`\n")
609
+
610
+ # Resolve active profile
611
+ if profile == "auto":
612
+ fw = stack_info.get("framework", "").lower()
613
+ lang = stack_info.get("language", "").lower()
614
+ if "playwright" in fw:
615
+ profile = "playwright"
616
+ elif "selenium" in fw:
617
+ profile = "selenium"
618
+ elif "cypress" in fw:
619
+ profile = "cypress"
620
+ elif "katalon" in fw:
621
+ profile = "katalon"
622
+ elif "pytest" in fw or "python" in lang:
623
+ profile = "pytest"
624
+ else:
625
+ profile = "full"
626
+
627
+ print(f"🎯 Selected Profile: {BOLD}{profile.upper()}{RESET}")
628
+ if dry_run:
629
+ print(f"Operational Mode : {YELLOW}DRY-RUN (Simulating without modifying files on disk){RESET}\n")
630
+ else:
631
+ print("Operational Mode : APPLY CHANGES\n")
632
+
633
+ if dry_run:
634
+ print(f"{YELLOW}[DRY-RUN PREVIEW]{RESET}")
635
+ print(f" • Profile: {profile.upper()}")
636
+ print(f" • Would generate: {os.path.join(target_repo, 'PROJECT_AI_GUIDE.md')}")
637
+ print(" • Would deploy AI bridges: .cursor/rules/synapse-qa.mdc, .github/copilot-instructions.md, .windsurfrules")
638
+ print(f" • Would install pre-push hook: {os.path.join(target_repo, '.git', 'hooks', 'pre-push')}")
639
+ print(f" • Would auto-generate: {os.path.join(target_repo, '.synapse.json')} (if missing)")
640
+ print(" • Would initialize: Central Agent Memory (~/.agent_memory/global_cache.db)")
641
+ print(f"\n{GREEN}✅ Dry-run completed successfully. Zero changes written to disk.{RESET}\n")
642
+ return 0
643
+
644
+ # 2. Ensure PROJECT_AI_GUIDE.md, PROJECT_STATE.md & .synapse.json
645
+ print(f"{BOLD}[1/5] Checking Project AI Guide, State Anchor & Default Config...{RESET}")
646
+ ensure_project_ai_guide(target_repo, stack_info, profile=profile)
647
+ project_state.init_state(target_repo)
648
+ ensure_synapse_config(target_repo)
649
+
650
+ # 3. Deploy Universal AI Bridges (Cursor, Claude Code, GitHub Copilot, Windsurf)
651
+ print(f"\n{BOLD}[2/5] Deploying Universal AI Bridges (Cursor, Claude, Copilot, Windsurf)...{RESET}")
652
+ install_universal_ai_bridges(target_repo)
653
+
654
+ # 4. Inject Antigravity Global Plugin
655
+ plugin_injected = False
656
+ if no_global:
657
+ print(f"\n{BOLD}[3/5] Checking Antigravity Global Plugin (~/.gemini/config/plugins)...{RESET}")
658
+ print(f" {YELLOW}[SKIP] Local-only mode (default). Skipped global plugin injection (pass --global to install globally).{RESET}")
659
+ else:
660
+ print(f"\n{BOLD}[3/5] Injecting Antigravity Global Plugin (~/.gemini/config/plugins)...{RESET}")
661
+ plugin_injected = inject_antigravity_global_plugin()
662
+
663
+ # 4.1 Initialize Central Agent Memory (SQLite Cache)
664
+ try:
665
+ import cache_resolver
666
+ cache_resolver.init_db(seed=True)
667
+ print(f" {GREEN}[OK] Initialized Central Agent Memory (SQLite):{RESET} ~/.agent_memory/global_cache.db")
668
+ except Exception as e:
669
+ print(f" ⚠️ Could not initialize memory cache: {e}")
670
+
671
+ # 4.2 Protect local cache in .gitignore
672
+ ensure_gitignore_protection(target_repo)
673
+
674
+ # 5. Install Pre-Push & Post-Merge Git Hooks
675
+ hook_installed = False
676
+ if no_git_hook:
677
+ print(f"\n{BOLD}[4/5] Installing Zero-Leakage Git Hooks...{RESET}")
678
+ print(f" {YELLOW}[SKIP] Skipped Git hook installation (--no-git-hook).{RESET}")
679
+ else:
680
+ print(f"\n{BOLD}[4/5] Installing Zero-Leakage Git Hooks...{RESET}")
681
+ hook_installed = install_git_pre_push_hook(target_repo)
682
+ install_git_post_merge_hook(target_repo)
683
+
684
+ # 6. Run 5-in-1 Comprehensive Health & AST Analysis
685
+ print(f"\n{BOLD}[5/5] Executing Initial Health Audit & AST Mapping...{RESET}")
686
+ analysis_code = analyze_project.run_full_analysis(target_repo)
687
+
688
+ # 7. Generate & Launch Interactive Visual Landing Page (Silent by default unless --open)
689
+ welcome_url = None
690
+ try:
691
+ from welcome_page import generate_welcome_page
692
+ should_open = (not no_browser) and open_browser and (not os.environ.get("CI")) and (not os.environ.get("HEADLESS")) and ("unittest" not in sys.modules) and ("pytest" not in sys.modules)
693
+ welcome_file = generate_welcome_page(
694
+ target_repo=target_repo,
695
+ stack_info=stack_info,
696
+ open_browser=should_open
697
+ )
698
+ welcome_url = f"file://{welcome_file}"
699
+ except (ImportError, OSError, ValueError):
700
+ welcome_url = ""
701
+
702
+ print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
703
+ print(f"{BOLD}{CYAN} 🎉 PROJECT IS NOW 100% AI-READY (LEVEL 5 SETUP) {RESET}")
704
+ print(f"{BOLD}{CYAN}======================================================================{RESET}")
705
+ print(f" Target Framework : {stack_info['framework']}")
706
+ print(f" Active Profile : {profile.upper()}")
707
+ print(f" AI Project Guide : {os.path.join(target_repo, 'PROJECT_AI_GUIDE.md')}")
708
+ print(" Universal Bridges : Cursor (.cursor/rules), Claude Code, Copilot, Windsurf")
709
+ print(f" Antigravity Plugin : {'ACTIVE (~/.gemini/config/plugins/synapse-hub)' if plugin_injected else 'STANDALONE'}")
710
+ print(f" AST Method Map : {os.path.join(target_repo, 'repo_map.txt')}")
711
+ print(f" Health Report : {os.path.join(target_repo, 'PROJECT_HEALTH_REPORT.md')}")
712
+ print(f" Pre-Push Sentinel : {'ACTIVE (.git/hooks/pre-push)' if hook_installed else 'MANUAL (No .git folder)'}")
713
+ if welcome_url:
714
+ print(f" Visual Landing Page : {welcome_url}")
715
+ print(f"{BOLD}{CYAN}======================================================================{RESET}\n")
716
+
717
+ return analysis_code
718
+
719
+
720
+ def main():
721
+ parser = argparse.ArgumentParser(description="Autonomous Enterprise QA Project Setup")
722
+ parser.add_argument("target", nargs="?", default=None, help="Target repository path to setup")
723
+ parser.add_argument("--target", "--repo", "--path", dest="repo_path", default=None, help="Target repository path")
724
+ parser.add_argument(
725
+ "--profile",
726
+ default="auto",
727
+ choices=["auto", "core", "web-e2e", "api-perf", "full", "playwright", "pytest", "cypress", "katalon"],
728
+ help="Skills profile to install (auto, core, web-e2e, api-perf, full, playwright, pytest, cypress, katalon)"
729
+ )
730
+ parser.add_argument("--dry-run", action="store_true", help="Simulate setup actions without modifying disk")
731
+ parser.add_argument("--uninstall", action="store_true", help="Revert and remove files installed by setup_project")
732
+ parser.add_argument("--global", action="store_true", dest="enable_global", default=False,
733
+ help="Inject Synapse-Hub into Antigravity global plugins (~/.gemini/config/plugins) and central memory")
734
+ parser.add_argument("--local-only", "--no-global", action="store_true", dest="no_global", default=True,
735
+ help="Only configure project-local assets (PROJECT_AI_GUIDE.md, bridges), do not touch ~/.gemini (default: True)")
736
+ parser.add_argument("--no-git-hook", action="store_true",
737
+ help="Skip installing automated .git/hooks/pre-push")
738
+ parser.add_argument("--open", action="store_true", dest="open_browser",
739
+ help="Launch landing page in web browser")
740
+ parser.add_argument("--no-browser", "--no-open", action="store_true", dest="no_browser", default=True,
741
+ help="Do not automatically launch landing page in web browser (default: True)")
742
+ args = parser.parse_args()
743
+
744
+ try:
745
+ target_repo = resolve_target_repo(cli_target=args.target, cli_repo=args.repo_path)
746
+ except FileNotFoundError as e:
747
+ print(f"❌ Error: {e}")
748
+ return 1
749
+
750
+ if args.uninstall:
751
+ return uninstall_setup(target_repo)
752
+
753
+ # When --open is explicitly requested, honor it
754
+ no_browser = False if getattr(args, "open_browser", False) else True
755
+ open_browser = bool(getattr(args, "open_browser", False))
756
+ use_no_global = False if getattr(args, "enable_global", False) else True
757
+
758
+ return run_setup(
759
+ target_repo,
760
+ dry_run=args.dry_run,
761
+ profile=args.profile,
762
+ no_global=use_no_global,
763
+ no_git_hook=args.no_git_hook,
764
+ no_browser=no_browser,
765
+ open_browser=open_browser
766
+ )
767
+
768
+
769
+ if __name__ == "__main__":
770
+ sys.exit(main())