@teevee98/synapse-hub 3.10.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/rules/mandatory-playwright-live.md +18 -4
- package/.agents/rules/stack-auto-router.md +11 -4
- package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/SKILL.md +18 -1
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +116 -0
- package/.agents/workflows/generate_manual_testcases_rbt.md +1 -1
- package/Dockerfile +14 -6
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +16 -2
- package/docs/ARCHITECTURE.en.md +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +514 -511
- package/synapse.config.json +1 -1
- package/tools/__init__.py +1 -1
- package/tools/ast_cache.py +173 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/build_consolidated_report.py +1 -1
- package/tools/cache_resolver.py +11 -6
- package/tools/cli.py +16 -3
- package/tools/core/file_lock.py +106 -8
- package/tools/core/process_supervisor.py +25 -0
- package/tools/dashboard_generator.py +6 -6
- package/tools/git_pre_commit_guard.py +6 -4
- package/tools/infer_linter.py +2 -2
- package/tools/lint_ai_docs.py +19 -5
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +1 -1
- package/tools/pinpoint_failure.py +14 -2
- package/tools/rules_router.py +373 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/verify_all.py +43 -1
- package/tools/wcag_audit.py +1 -1
- package/tools/welcome_page.py +1 -1
- package/.agents/skills/wcag-audit-patterns/SKILL.md +0 -77
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/SKILL.md +0 -0
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/multi_role_auth_matrix.md +0 -0
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/storage_state_sample.json +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/examples/cli_runner_test.bats +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/SKILL.md +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/examples/standard_test_case.groovy +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/references/pom_patterns.groovy +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/examples/playwright_sharded_config.ts +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/SKILL.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/examples/headless_kre_exec.sh +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/groovy-patterns.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/katalon-api.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/runner_commands.md +0 -0
- /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/SKILL.md +0 -0
- /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/examples/user_story_sample.md +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/SKILL.md +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/BaseScreen.java +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/LoginScreen.java +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/TC_MobileLogin.java +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/SKILL.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/examples/live_probe_script.js +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/advanced_superpowers.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/compact_accessibility_snapshots.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/recipes.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/swarm_orchestration.md +0 -0
- /package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/examples/server_lifecycle_playwright.py +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/SKILL.md +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/benchmark_report_sample.json +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/enterprise_tasks_suite.json +0 -0
- /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/SKILL.md +0 -0
- /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/examples/0001-record-architecture-decisions.md +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/SKILL.md +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/checkout.feature +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/suite_report_sample.json +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/SKILL.md +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/examples/checkout_rbt_manual_suite.md +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/references/field_validation_checklist.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/SKILL.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/pocock_grilling_decision_rubric.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/sample_spec_review.md +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/SKILL.md +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/payment_gateway_tot_tree.json +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/tot_graph_sample.json +0 -0
- /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/SKILL.md +0 -0
- /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/examples/network_route_stub.json +0 -0
- /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/SKILL.md +0 -0
- /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/examples/sample_openapi.json +0 -0
- /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/SKILL.md +0 -0
- /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/examples/order_service_pact.json +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/examples/k6_load_test_sample.js +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/references/k6_load_template.js +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/SKILL.md +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_benchmark_gain.md +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_scoreboard.md +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/SKILL.md +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/cwv_budget_policy.json +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/playwright_cwv_profiler_fixture.ts +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/examples/dast_scan_config.json +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/AI-AND-LLM.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/ATTACK-CLASSES.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/dast_recipes.ts +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/SKILL.md +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/audit_threat_vectors_report.json +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/safe_mcp_config.json +0 -0
- /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/examples/wcag_compliance_checklist.json +0 -0
- /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/SKILL.md +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/healing_report_sample.json +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/three_phase_repair_workflow.md +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/dod_gate_policy.json +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/sprint_dod_enforcement.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/SKILL.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/closed_loop_healing_walkthrough.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/sample_junit_failure.xml +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/healing_matrix.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/qa_investigation_protocol.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/scripts/triage_failures.sh +0 -0
- /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/SKILL.md +0 -0
- /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/examples/quarantine_registry.json +0 -0
- /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/SKILL.md +0 -0
- /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/examples/aom_diff_sample.json +0 -0
- /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/SKILL.md +0 -0
- /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/examples/four_phase_case.md +0 -0
- /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/SKILL.md +0 -0
- /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/examples/red_green_refactor_qa.md +0 -0
- /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/SKILL.md +0 -0
- /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/examples/evidence_log_example.md +0 -0
- /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/examples/visual_mask_rules.json +0 -0
- /package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/SKILL.md +0 -0
- /package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/examples/db_fixture_seed.json +0 -0
- /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/SKILL.md +0 -0
- /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/examples/sample_export_schema.json +0 -0
- /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/SKILL.md +0 -0
- /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/examples/idempotent_data_recipe.json +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/SKILL.md +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_page_sample.groovy +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_playwright_pom.ts +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/SKILL.md +0 -0
- /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/examples/dependency_blast_radius.json +0 -0
- /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/SKILL.md +0 -0
- /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/examples/ladder_walkthrough.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/SKILL.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_audit_walkthrough.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_repo_audit.md +0 -0
- /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/SKILL.md +0 -0
- /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/examples/sample_review_walkthrough.md +0 -0
- /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/SKILL.md +0 -0
- /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/examples/surgical_vs_scope_creep.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/SKILL.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_debt_ledger.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_ledger_output.md +0 -0
- /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/SKILL.md +0 -0
- /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/examples/matrix_test_pipeline.yml +0 -0
- /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/SKILL.md +0 -0
- /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/examples/broker_sharding_sample.json +0 -0
- /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/SKILL.md +0 -0
- /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/examples/swarm_workload_config.json +0 -0
- /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/SKILL.md +0 -0
- /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/examples/timeline_sample.jsonl +0 -0
- /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/SKILL.md +0 -0
- /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/examples/task_plan_example.md +0 -0
- /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/SKILL.md +0 -0
- /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/examples/archival_memory_sample.json +0 -0
- /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/SKILL.md +0 -0
- /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/examples/qa_prompt_template.md +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/SKILL.md +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/compiled_module_sample.json +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/dspy_assertion_optimizer_case.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/SKILL.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_code_window_walkthrough.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_edit_sample.json +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/SKILL.md +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/examples/distilled_log_sample.txt +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/references/context_engineering_guide.md +0 -0
package/synapse.config.json
CHANGED
package/tools/__init__.py
CHANGED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee98). All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# Project: Synapse-Hub (https://github.com/TeeVee98/Synapse-Hub)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
tools/ast_cache.py — AST Dataflow Pre-Validation Cache (Boost B3)
|
|
8
|
+
----------------------------------------------------------------
|
|
9
|
+
Provides high-speed persistent caching for AST syntax integrity, undefined variable
|
|
10
|
+
checks (F821), and syntactic mutation scans.
|
|
11
|
+
Uses mtime_ns + file size fast invalidation with SHA-256 fallback to eliminate
|
|
12
|
+
redundant AST parsing across recurring verification runs.
|
|
13
|
+
Uses cross-platform file locking to guarantee concurrency safety under multi-agent swarms.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import argparse
|
|
19
|
+
import hashlib
|
|
20
|
+
import json
|
|
21
|
+
import os
|
|
22
|
+
import sys
|
|
23
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
24
|
+
|
|
25
|
+
# Ensure repository root is on sys.path for direct script execution
|
|
26
|
+
_REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
27
|
+
if _REPO_ROOT not in sys.path:
|
|
28
|
+
sys.path.insert(0, _REPO_ROOT)
|
|
29
|
+
|
|
30
|
+
# Import cross-platform advisory file lock
|
|
31
|
+
try:
|
|
32
|
+
from tools.core.file_lock import locked_json_read, locked_json_write
|
|
33
|
+
except ImportError:
|
|
34
|
+
try:
|
|
35
|
+
from core.file_lock import locked_json_read, locked_json_write
|
|
36
|
+
except ImportError:
|
|
37
|
+
# Fallback in case tools is executed without root in sys.path
|
|
38
|
+
sys.path.insert(0, os.path.dirname(__file__))
|
|
39
|
+
from core.file_lock import locked_json_read, locked_json_write
|
|
40
|
+
|
|
41
|
+
DEFAULT_CACHE_REL = os.path.join(".synapse", "ast_cache.json")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ASTValidationCache:
|
|
45
|
+
"""
|
|
46
|
+
Persistent key-value cache for Python AST verification results.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def __init__(self, repo_root: Optional[str] = None, cache_path: Optional[str] = None):
|
|
50
|
+
if repo_root is None:
|
|
51
|
+
repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
52
|
+
self.repo_root = os.path.abspath(repo_root)
|
|
53
|
+
|
|
54
|
+
if cache_path is None:
|
|
55
|
+
self.cache_path = os.path.join(self.repo_root, DEFAULT_CACHE_REL)
|
|
56
|
+
else:
|
|
57
|
+
self.cache_path = os.path.abspath(cache_path)
|
|
58
|
+
|
|
59
|
+
self._entries: Dict[str, Dict[str, Any]] = {}
|
|
60
|
+
self._dirty = False
|
|
61
|
+
self.load()
|
|
62
|
+
|
|
63
|
+
def load(self) -> None:
|
|
64
|
+
"""Loads cached AST records from disk under advisory shared lock."""
|
|
65
|
+
if os.path.isfile(self.cache_path):
|
|
66
|
+
try:
|
|
67
|
+
data = locked_json_read(self.cache_path, timeout=5.0)
|
|
68
|
+
if isinstance(data, dict):
|
|
69
|
+
self._entries = data.get("entries", {})
|
|
70
|
+
except Exception:
|
|
71
|
+
self._entries = {}
|
|
72
|
+
else:
|
|
73
|
+
self._entries = {}
|
|
74
|
+
self._dirty = False
|
|
75
|
+
|
|
76
|
+
def save(self) -> None:
|
|
77
|
+
"""Flushes modified cache records to disk under exclusive atomic lock with disk-merge."""
|
|
78
|
+
if not self._dirty:
|
|
79
|
+
return
|
|
80
|
+
os.makedirs(os.path.dirname(self.cache_path), exist_ok=True)
|
|
81
|
+
# Read and merge existing entries to prevent concurrent worker/swarm overwrites
|
|
82
|
+
current_entries: Dict[str, Any] = {}
|
|
83
|
+
if os.path.isfile(self.cache_path):
|
|
84
|
+
try:
|
|
85
|
+
disk_data = locked_json_read(self.cache_path, timeout=5.0)
|
|
86
|
+
if isinstance(disk_data, dict):
|
|
87
|
+
current_entries = disk_data.get("entries", {})
|
|
88
|
+
except Exception:
|
|
89
|
+
current_entries = {}
|
|
90
|
+
current_entries.update(self._entries)
|
|
91
|
+
payload = {
|
|
92
|
+
"version": "1.0",
|
|
93
|
+
"repo_root": self.repo_root,
|
|
94
|
+
"entries": current_entries,
|
|
95
|
+
}
|
|
96
|
+
try:
|
|
97
|
+
locked_json_write(self.cache_path, payload, indent=2, timeout=5.0, atomic=True)
|
|
98
|
+
self._entries = current_entries
|
|
99
|
+
self._dirty = False
|
|
100
|
+
except Exception as err:
|
|
101
|
+
_ = err
|
|
102
|
+
|
|
103
|
+
def get_signature(self, file_path: str) -> Optional[Tuple[int, int]]:
|
|
104
|
+
"""Returns (mtime_ns, size) for fast freshness check."""
|
|
105
|
+
try:
|
|
106
|
+
st = os.stat(file_path)
|
|
107
|
+
return (st.st_mtime_ns, st.st_size)
|
|
108
|
+
except OSError:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
def get_cached_result(self, rel_path: str, mtime_ns: int, size: int) -> Optional[Dict[str, Any]]:
|
|
112
|
+
"""Retrieves cached result if signature matches."""
|
|
113
|
+
entry = self._entries.get(rel_path)
|
|
114
|
+
if entry is None:
|
|
115
|
+
return None
|
|
116
|
+
if entry.get("mtime_ns") == mtime_ns and entry.get("size") == size:
|
|
117
|
+
return entry.get("data")
|
|
118
|
+
return None
|
|
119
|
+
|
|
120
|
+
def put_result(self, rel_path: str, mtime_ns: int, size: int, data: Dict[str, Any]) -> None:
|
|
121
|
+
"""Records a new validation outcome in memory."""
|
|
122
|
+
self._entries[rel_path] = {
|
|
123
|
+
"mtime_ns": mtime_ns,
|
|
124
|
+
"size": size,
|
|
125
|
+
"data": data,
|
|
126
|
+
}
|
|
127
|
+
self._dirty = True
|
|
128
|
+
|
|
129
|
+
def clear(self) -> None:
|
|
130
|
+
"""Clears memory and persisted cache."""
|
|
131
|
+
self._entries.clear()
|
|
132
|
+
self._dirty = False
|
|
133
|
+
os.makedirs(os.path.dirname(self.cache_path), exist_ok=True)
|
|
134
|
+
payload = {
|
|
135
|
+
"version": "1.0",
|
|
136
|
+
"repo_root": self.repo_root,
|
|
137
|
+
"entries": {},
|
|
138
|
+
}
|
|
139
|
+
try:
|
|
140
|
+
locked_json_write(self.cache_path, payload, indent=2, timeout=5.0, atomic=True)
|
|
141
|
+
except Exception as err:
|
|
142
|
+
_ = err
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# Module-level singleton helper
|
|
146
|
+
_GLOBAL_CACHE: Optional[ASTValidationCache] = None
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def get_ast_cache(repo_root: Optional[str] = None) -> ASTValidationCache:
|
|
150
|
+
"""Returns or initializes the process-wide AST cache."""
|
|
151
|
+
global _GLOBAL_CACHE
|
|
152
|
+
if _GLOBAL_CACHE is None:
|
|
153
|
+
_GLOBAL_CACHE = ASTValidationCache(repo_root=repo_root)
|
|
154
|
+
return _GLOBAL_CACHE
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def main():
|
|
158
|
+
parser = argparse.ArgumentParser(description="AST Dataflow Pre-Validation Cache (Boost B3)")
|
|
159
|
+
parser.add_argument("--clear", action="store_true", help="Clear persisted AST cache")
|
|
160
|
+
parser.add_argument("--stats", action="store_true", help="Print cache statistics")
|
|
161
|
+
args = parser.parse_args()
|
|
162
|
+
|
|
163
|
+
cache = get_ast_cache()
|
|
164
|
+
if args.clear:
|
|
165
|
+
cache.clear()
|
|
166
|
+
print("[AST CACHE] Cache cleared successfully.")
|
|
167
|
+
else:
|
|
168
|
+
entries = cache._entries
|
|
169
|
+
print(f"[AST CACHE] Path: {cache.cache_path} | Entries: {len(entries)}")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if __name__ == "__main__":
|
|
173
|
+
main()
|
package/tools/browser_helpers.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
(function () {
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
if (window.__qa && window.__qa.__version === '
|
|
16
|
+
if (window.__qa && window.__qa.__version === '4.0.0') {
|
|
17
17
|
return window.__qa;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const qa = {
|
|
50
|
-
__version: '
|
|
50
|
+
__version: '4.0.0',
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 1. Smart Action Batching
|
|
@@ -165,7 +165,7 @@ def build_consolidated_html():
|
|
|
165
165
|
5: "<code>tools/runaway_stopper.py</code> (RunawaySentinel) · Bất biến Pure Headless Playwright CDP 1920x1080 (AGENTS.md)",
|
|
166
166
|
6: "<code>tools/skill_collision_guard.py</code> (Gate 9 Addy Osmani Pattern) · Phân cấp 4 Persona FSM trong <code>.agents/skills/</code>",
|
|
167
167
|
7: "<code>tools/mechanical_ui_gate.py</code> (Kiểm toán WCAG AA >= 4.5:1, thang chữ typographic) · <code>tests/test_ecosystem_integrations.py</code>",
|
|
168
|
-
8: "<code>.agents/skills/wcag-audit-patterns</code> · <code>.agents/skills/backend-load-and-stress-patterns</code>",
|
|
168
|
+
8: "<code>.agents/skills/05-security-and-compliance/wcag-audit-patterns</code> · <code>.agents/skills/04-performance-and-load/backend-load-and-stress-patterns</code>",
|
|
169
169
|
9: "<code>.github/copilot-instructions.md</code> (Quy tắc Clean POM và Smart Wait theo phạm vi file hẹp)",
|
|
170
170
|
10: "<code>skills-lock.json</code> & <code>.skill-lock.json</code> v3 (Đăng ký 53 skills cho Vercel/Cursor/Antigravity)",
|
|
171
171
|
11: "Bảng màu Dark Studio chuẩn WCAG AA và Typography Scale tích hợp trong báo cáo hợp nhất",
|
package/tools/cache_resolver.py
CHANGED
|
@@ -96,24 +96,29 @@ def djb2_hash(s: str) -> str:
|
|
|
96
96
|
|
|
97
97
|
def compute_error_fingerprint(error_type: str, error_msg: str, stack_anchor: str = "") -> str:
|
|
98
98
|
"""
|
|
99
|
-
Computes a deterministic, normalized fingerprint hash for an error.
|
|
100
|
-
Strips volatile elements (timestamps, hex addresses, line numbers) so semantically
|
|
101
|
-
identical errors across test runs produce the identical fingerprint.
|
|
99
|
+
Computes a deterministic, normalized fingerprint hash for an error (Boost B5).
|
|
100
|
+
Strips volatile elements (timestamps, hex addresses, line numbers, durations) so semantically
|
|
101
|
+
identical errors across test runs produce the identical deterministic DJB2 fingerprint.
|
|
102
102
|
"""
|
|
103
103
|
norm_type = (error_type or "").strip().lower()
|
|
104
104
|
msg = error_msg or ""
|
|
105
105
|
# Strip hex memory addresses
|
|
106
106
|
msg = re.sub(r'0x[0-9a-fA-F]+', '0xADDR', msg)
|
|
107
|
-
# Strip ISO/standard timestamps
|
|
107
|
+
# Strip ISO/standard timestamps (with or without date)
|
|
108
108
|
msg = re.sub(r'\b\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?\b', 'TIMESTAMP', msg)
|
|
109
|
-
|
|
109
|
+
msg = re.sub(r'\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b', 'TIMESTAMP', msg)
|
|
110
|
+
# Strip execution durations like 3000ms or 2.5s
|
|
111
|
+
msg = re.sub(r'\b\d+(?:\.\d+)?(?:ms|s)\b', 'DUR', msg)
|
|
112
|
+
# Strip variable line numbers in filenames like "file.py:123" or "line 42"
|
|
110
113
|
msg = re.sub(r':\d+\b', ':LINE', msg)
|
|
114
|
+
msg = re.sub(r'\bline \d+\b', 'line LINE', msg, flags=re.IGNORECASE)
|
|
111
115
|
# Collapse whitespace
|
|
112
116
|
msg = re.sub(r'\s+', ' ', msg).strip()[:200]
|
|
113
117
|
|
|
114
|
-
anchor = (stack_anchor or "").strip().lower()
|
|
118
|
+
anchor = (stack_anchor or "").strip().lower().replace('\\', '/')
|
|
115
119
|
if anchor:
|
|
116
120
|
anchor = re.sub(r':\d+\b', ':LINE', anchor)
|
|
121
|
+
anchor = re.sub(r'\bline \d+\b', 'line LINE', anchor, flags=re.IGNORECASE)
|
|
117
122
|
raw = f"{norm_type}:{msg}@{anchor}"
|
|
118
123
|
else:
|
|
119
124
|
raw = f"{norm_type}:{msg}"
|
package/tools/cli.py
CHANGED
|
@@ -99,7 +99,7 @@ def cmd_set_lang(args):
|
|
|
99
99
|
def cmd_version(args):
|
|
100
100
|
"""Displays the current hub version, skill catalog count, and license information."""
|
|
101
101
|
manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
|
|
102
|
-
version = "
|
|
102
|
+
version = "4.0.0"
|
|
103
103
|
if os.path.exists(manifest_path):
|
|
104
104
|
try:
|
|
105
105
|
import json
|
|
@@ -552,6 +552,12 @@ def cmd_wcag_audit(args):
|
|
|
552
552
|
sys.exit(wcag_main())
|
|
553
553
|
|
|
554
554
|
|
|
555
|
+
def cmd_rules_router(args):
|
|
556
|
+
from rules_router import main as router_main
|
|
557
|
+
sys.argv = _forward_subcommand_args(args)
|
|
558
|
+
sys.exit(router_main())
|
|
559
|
+
|
|
560
|
+
|
|
555
561
|
def cmd_lookup_tc(args):
|
|
556
562
|
from lookup_tc import main as tc_main
|
|
557
563
|
sys.argv = _forward_subcommand_args(args)
|
|
@@ -680,14 +686,14 @@ def cmd_trend(args):
|
|
|
680
686
|
|
|
681
687
|
def _hub_version():
|
|
682
688
|
manifest_path = os.path.join(REPO_ROOT, "skills_manifest.json")
|
|
683
|
-
version = "
|
|
689
|
+
version = "4.0.0"
|
|
684
690
|
if os.path.exists(manifest_path):
|
|
685
691
|
try:
|
|
686
692
|
import json
|
|
687
693
|
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
688
694
|
version = json.load(f).get("version", version)
|
|
689
695
|
except (OSError, json.JSONDecodeError):
|
|
690
|
-
version = "
|
|
696
|
+
version = "4.0.0"
|
|
691
697
|
return version
|
|
692
698
|
|
|
693
699
|
|
|
@@ -1189,6 +1195,13 @@ def _register_audit_and_inspection_commands(subparsers, lang: Optional[str] = No
|
|
|
1189
1195
|
p_wcag.add_argument("target", nargs="?", default=".", help=_lh("Target HTML file or directory to audit", "Tệp HTML hoặc thư mục cần kiểm toán WCAG", lang))
|
|
1190
1196
|
p_wcag.set_defaults(func=cmd_wcag_audit)
|
|
1191
1197
|
|
|
1198
|
+
# rules-router (Boost B2)
|
|
1199
|
+
p_router = subparsers.add_parser("rules-router", aliases=["route-rules"], help=_lh("Progressive Rules Router & Token Optimizer", "Định tuyến quy tắc thông minh & tối ưu token", lang))
|
|
1200
|
+
p_router.add_argument("workspace", nargs="?", default=".", help=_lh("Target workspace directory to inspect", "Thư mục dự án cần phân tích stack", lang))
|
|
1201
|
+
p_router.add_argument("--json", action="store_true", help=_lh("Output machine-readable JSON format", "Xuất định dạng JSON cho máy đọc", lang))
|
|
1202
|
+
p_router.add_argument("--summary", action="store_true", help=_lh("Output concise 1-line summary", "Xuất tóm tắt 1 dòng ngắn gọn", lang))
|
|
1203
|
+
p_router.set_defaults(func=cmd_rules_router)
|
|
1204
|
+
|
|
1192
1205
|
# impact
|
|
1193
1206
|
p_impact = subparsers.add_parser("impact", help=t("cmd_impact", lang=lang))
|
|
1194
1207
|
p_impact.set_defaults(func=cmd_impact)
|
package/tools/core/file_lock.py
CHANGED
|
@@ -30,6 +30,105 @@ if sys.platform != "win32":
|
|
|
30
30
|
else:
|
|
31
31
|
import msvcrt # type: ignore
|
|
32
32
|
|
|
33
|
+
# Win32 Native Locking Constants (Boost B1)
|
|
34
|
+
LOCKFILE_FAIL_IMMEDIATELY = 0x00000001
|
|
35
|
+
LOCKFILE_EXCLUSIVE_LOCK = 0x00000002
|
|
36
|
+
|
|
37
|
+
try:
|
|
38
|
+
import ctypes
|
|
39
|
+
from ctypes import wintypes
|
|
40
|
+
_HAS_CTYPES = True
|
|
41
|
+
except ImportError:
|
|
42
|
+
ctypes = None # type: ignore
|
|
43
|
+
wintypes = None # type: ignore
|
|
44
|
+
_HAS_CTYPES = False
|
|
45
|
+
|
|
46
|
+
if _HAS_CTYPES:
|
|
47
|
+
class _OVERLAPPED(ctypes.Structure):
|
|
48
|
+
_fields_ = [
|
|
49
|
+
("Internal", getattr(wintypes, "ULONG_PTR", ctypes.c_size_t)),
|
|
50
|
+
("InternalHigh", getattr(wintypes, "ULONG_PTR", ctypes.c_size_t)),
|
|
51
|
+
("Offset", getattr(wintypes, "DWORD", ctypes.c_ulong)),
|
|
52
|
+
("OffsetHigh", getattr(wintypes, "DWORD", ctypes.c_ulong)),
|
|
53
|
+
("hEvent", getattr(wintypes, "HANDLE", ctypes.c_void_p)),
|
|
54
|
+
]
|
|
55
|
+
else:
|
|
56
|
+
_OVERLAPPED = None # type: ignore
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _win32_lock(fd: int, shared: bool = False) -> bool:
|
|
60
|
+
"""
|
|
61
|
+
Acquires an advisory file lock on Windows using native Win32 LockFileEx via ctypes.
|
|
62
|
+
Provides genuine shared (LOCKFILE_FAIL_IMMEDIATELY) and exclusive
|
|
63
|
+
(LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY) locks with an OVERLAPPED structure.
|
|
64
|
+
Gracefully falls back to msvcrt.locking if ctypes or LockFileEx is unavailable.
|
|
65
|
+
"""
|
|
66
|
+
msvcrt_mod = sys.modules.get("msvcrt")
|
|
67
|
+
use_ctypes = _HAS_CTYPES and hasattr(ctypes, "windll") and hasattr(ctypes.windll, "kernel32")
|
|
68
|
+
if use_ctypes:
|
|
69
|
+
try:
|
|
70
|
+
handle = msvcrt_mod.get_osfhandle(fd) if msvcrt_mod and hasattr(msvcrt_mod, "get_osfhandle") else fd
|
|
71
|
+
flags = LOCKFILE_FAIL_IMMEDIATELY
|
|
72
|
+
if not shared:
|
|
73
|
+
flags |= LOCKFILE_EXCLUSIVE_LOCK
|
|
74
|
+
overlapped = _OVERLAPPED()
|
|
75
|
+
res = ctypes.windll.kernel32.LockFileEx(
|
|
76
|
+
ctypes.c_void_p(handle),
|
|
77
|
+
ctypes.c_ulong(flags),
|
|
78
|
+
ctypes.c_ulong(0),
|
|
79
|
+
ctypes.c_ulong(1),
|
|
80
|
+
ctypes.c_ulong(0),
|
|
81
|
+
ctypes.byref(overlapped),
|
|
82
|
+
)
|
|
83
|
+
if not res:
|
|
84
|
+
get_last_error = getattr(ctypes, "GetLastError", lambda: 0)
|
|
85
|
+
err = get_last_error()
|
|
86
|
+
raise OSError(err, f"LockFileEx failed with error code {err}")
|
|
87
|
+
return True
|
|
88
|
+
except (AttributeError, TypeError, ValueError) as exc:
|
|
89
|
+
# Fall through to msvcrt fallback if ctypes kernel32 LockFileEx is missing or incompatible
|
|
90
|
+
_ = exc
|
|
91
|
+
|
|
92
|
+
# Graceful fallback to msvcrt.locking (exclusive lock only)
|
|
93
|
+
if msvcrt_mod is not None:
|
|
94
|
+
os.lseek(fd, 0, os.SEEK_SET)
|
|
95
|
+
msvcrt_mod.locking(fd, msvcrt_mod.LK_NBLCK, 1)
|
|
96
|
+
return True
|
|
97
|
+
raise OSError("Neither Win32 ctypes nor msvcrt is available for file locking.")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _win32_unlock(fd: int) -> bool:
|
|
101
|
+
"""
|
|
102
|
+
Releases an advisory file lock on Windows using native Win32 UnlockFileEx via ctypes.
|
|
103
|
+
Falls back to msvcrt.locking with LK_UNLCK if ctypes is unavailable.
|
|
104
|
+
"""
|
|
105
|
+
msvcrt_mod = sys.modules.get("msvcrt")
|
|
106
|
+
use_ctypes = _HAS_CTYPES and hasattr(ctypes, "windll") and hasattr(ctypes.windll, "kernel32")
|
|
107
|
+
if use_ctypes:
|
|
108
|
+
try:
|
|
109
|
+
handle = msvcrt_mod.get_osfhandle(fd) if msvcrt_mod and hasattr(msvcrt_mod, "get_osfhandle") else fd
|
|
110
|
+
overlapped = _OVERLAPPED()
|
|
111
|
+
res = ctypes.windll.kernel32.UnlockFileEx(
|
|
112
|
+
ctypes.c_void_p(handle),
|
|
113
|
+
ctypes.c_ulong(0),
|
|
114
|
+
ctypes.c_ulong(1),
|
|
115
|
+
ctypes.c_ulong(0),
|
|
116
|
+
ctypes.byref(overlapped),
|
|
117
|
+
)
|
|
118
|
+
return bool(res)
|
|
119
|
+
except (AttributeError, TypeError, ValueError) as exc:
|
|
120
|
+
_ = exc
|
|
121
|
+
|
|
122
|
+
# Graceful fallback to msvcrt.locking
|
|
123
|
+
if msvcrt_mod is not None:
|
|
124
|
+
try:
|
|
125
|
+
os.lseek(fd, 0, os.SEEK_SET)
|
|
126
|
+
msvcrt_mod.locking(fd, msvcrt_mod.LK_UNLCK, 1)
|
|
127
|
+
return True
|
|
128
|
+
except OSError:
|
|
129
|
+
return False
|
|
130
|
+
return False
|
|
131
|
+
|
|
33
132
|
|
|
34
133
|
class FileLockTimeoutError(TimeoutError):
|
|
35
134
|
"""Raised when acquiring a file lock exceeds the allocated timeout."""
|
|
@@ -69,10 +168,13 @@ class FileLock:
|
|
|
69
168
|
fcntl.flock(self._fd, mode | fcntl.LOCK_NB)
|
|
70
169
|
else:
|
|
71
170
|
# Ensure at least 1 byte exists to lock on Windows
|
|
72
|
-
|
|
73
|
-
os.
|
|
171
|
+
try:
|
|
172
|
+
if os.fstat(self._fd).st_size == 0:
|
|
173
|
+
os.write(self._fd, b"\x00")
|
|
174
|
+
except (OSError, PermissionError) as err:
|
|
175
|
+
_ = err
|
|
74
176
|
os.lseek(self._fd, 0, os.SEEK_SET)
|
|
75
|
-
|
|
177
|
+
_win32_lock(self._fd, shared=self.shared)
|
|
76
178
|
return self
|
|
77
179
|
except (BlockingIOError, OSError, PermissionError):
|
|
78
180
|
if self._fd is not None:
|
|
@@ -94,11 +196,7 @@ class FileLock:
|
|
|
94
196
|
if sys.platform != "win32":
|
|
95
197
|
fcntl.flock(self._fd, fcntl.LOCK_UN)
|
|
96
198
|
else:
|
|
97
|
-
|
|
98
|
-
os.lseek(self._fd, 0, os.SEEK_SET)
|
|
99
|
-
msvcrt.locking(self._fd, msvcrt.LK_UNLCK, 1)
|
|
100
|
-
except OSError as err:
|
|
101
|
-
_ = err
|
|
199
|
+
_win32_unlock(self._fd)
|
|
102
200
|
os.close(self._fd)
|
|
103
201
|
except OSError as err:
|
|
104
202
|
_ = err
|
|
@@ -369,3 +369,28 @@ class ProcessSupervisor:
|
|
|
369
369
|
|
|
370
370
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
371
371
|
self.cleanup_all()
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def run_supervised(
|
|
375
|
+
cmd: List[str],
|
|
376
|
+
timeout: float = 60.0,
|
|
377
|
+
cwd: Optional[str] = None,
|
|
378
|
+
env: Optional[Dict[str, str]] = None,
|
|
379
|
+
capture_output: bool = True,
|
|
380
|
+
text: bool = True,
|
|
381
|
+
input_data: Optional[str] = None,
|
|
382
|
+
) -> SupervisedResult:
|
|
383
|
+
"""
|
|
384
|
+
Convenience function to execute a command under a governed ProcessSupervisor session.
|
|
385
|
+
Guarantees strict execution timeout, process group isolation, and zombie process cleanup (Boost B4).
|
|
386
|
+
"""
|
|
387
|
+
with ProcessSupervisor(default_timeout=timeout) as supervisor:
|
|
388
|
+
return supervisor.run(
|
|
389
|
+
cmd=cmd,
|
|
390
|
+
timeout=timeout,
|
|
391
|
+
cwd=cwd,
|
|
392
|
+
env=env,
|
|
393
|
+
capture_output=capture_output,
|
|
394
|
+
text=text,
|
|
395
|
+
input_data=input_data,
|
|
396
|
+
)
|
|
@@ -1348,7 +1348,7 @@ def _build_target_translations(
|
|
|
1348
1348
|
"th_step_status": "Trạng Thái",
|
|
1349
1349
|
"th_step_details": "Chi Tiết Kỹ Thuật (OTel & AST)",
|
|
1350
1350
|
|
|
1351
|
-
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub
|
|
1351
|
+
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.0.0 • Bản quyền © Thế Vị (@TeeVee98) • Chuẩn Clean POM & Kiểm Thử Tự Chủ",
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
1354
|
translations_en = {
|
|
@@ -1426,7 +1426,7 @@ def _build_target_translations(
|
|
|
1426
1426
|
"th_step_status": "Status",
|
|
1427
1427
|
"th_step_details": "Technical Details (OTel & AST)",
|
|
1428
1428
|
|
|
1429
|
-
"footer_text": "Generated automatically by Synapse-Hub
|
|
1429
|
+
"footer_text": "Generated automatically by Synapse-Hub v4.0.0 • Copyright © Thế Vị (@TeeVee98) • Clean POM & Autonomous Testing",
|
|
1430
1430
|
}
|
|
1431
1431
|
|
|
1432
1432
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -1915,7 +1915,7 @@ def _build_hub_translations(
|
|
|
1915
1915
|
"""Builds bilingual dictionaries for Hub Dashboard."""
|
|
1916
1916
|
translations_vi = {
|
|
1917
1917
|
"header_title": "Bảng Điều Hành Chất Lượng Doanh Nghiệp",
|
|
1918
|
-
"header_subtitle": "Synapse-Hub
|
|
1918
|
+
"header_subtitle": "Synapse-Hub v4.0.0 • Hệ Sinh Thái Kiểm Thử AI Agent Tự Chủ",
|
|
1919
1919
|
"nav_welcome": "Giới Thiệu",
|
|
1920
1920
|
"meta_mode": "🏷️ Chế độ: <strong>HỆ SINH THÁI QA HUB</strong>",
|
|
1921
1921
|
"meta_gen": f"🕒 Khởi tạo: <strong>{now_str}</strong>",
|
|
@@ -1985,12 +1985,12 @@ def _build_hub_translations(
|
|
|
1985
1985
|
"th_sk_ver": "Phiên Bản",
|
|
1986
1986
|
"th_sk_cap": "Khả Năng Nghiệp Vụ Cốt Lõi",
|
|
1987
1987
|
|
|
1988
|
-
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub
|
|
1988
|
+
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.0.0 • Bản quyền © Thế Vị (@TeeVee98) • Hệ Thống Kiểm Thử AI Agent Tự Chủ",
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
1991
|
translations_en = {
|
|
1992
1992
|
"header_title": "Enterprise QA Executive Dashboard",
|
|
1993
|
-
"header_subtitle": "Synapse-Hub
|
|
1993
|
+
"header_subtitle": "Synapse-Hub v4.0.0 • Autonomous AI Agent Testing Ecosystem",
|
|
1994
1994
|
"nav_welcome": "Welcome",
|
|
1995
1995
|
"meta_mode": "🏷️ Mode: <strong>QA HUB ECOSYSTEM</strong>",
|
|
1996
1996
|
"meta_gen": f"🕒 Generated: <strong>{now_str}</strong>",
|
|
@@ -2060,7 +2060,7 @@ def _build_hub_translations(
|
|
|
2060
2060
|
"th_sk_ver": "Version",
|
|
2061
2061
|
"th_sk_cap": "Core Capabilities",
|
|
2062
2062
|
|
|
2063
|
-
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub
|
|
2063
|
+
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.0.0 • Copyright © Thế Vị (@TeeVee98) • Autonomous AI Agent Testing Ecosystem",
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
2066
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -276,14 +276,16 @@ def main():
|
|
|
276
276
|
# Stage updated repo_map files
|
|
277
277
|
run_cmd(["git", "add", "tools/repo_map.txt", "tools/repo_map.json"], timeout=30.0)
|
|
278
278
|
|
|
279
|
-
# 6.
|
|
280
|
-
|
|
279
|
+
# 6. Test scripts change -> Static Defect Linter (Zero-Sleep & Smart Wait Sentinel - Boost B6)
|
|
280
|
+
test_prefixes = ("Scripts/", "tests/", "test/", "e2e/", "specs/", "cypress/")
|
|
281
|
+
test_exts = (".groovy", ".py", ".ts", ".js")
|
|
282
|
+
scripts_affected = any(f.startswith(test_prefixes) and f.endswith(test_exts) for f in staged_files)
|
|
281
283
|
if scripts_affected:
|
|
282
284
|
infer_script = os.path.join(os.path.dirname(__file__), "infer_linter.py")
|
|
283
285
|
if os.path.exists(infer_script):
|
|
284
|
-
res = run_cmd([sys.executable, infer_script], timeout=60.0)
|
|
286
|
+
res = run_cmd([sys.executable, infer_script, "--strict"], timeout=60.0)
|
|
285
287
|
if res.returncode != 0:
|
|
286
|
-
print("❌ [PRE-COMMIT BLOCKED] Static Defect Sentinel detected critical issues in staged scripts:")
|
|
288
|
+
print("❌ [PRE-COMMIT BLOCKED] Static Defect Sentinel detected critical issues in staged scripts (Zero-Sleep / Fake Pass):")
|
|
287
289
|
print(res.stdout.strip())
|
|
288
290
|
errors_found = True
|
|
289
291
|
|
package/tools/infer_linter.py
CHANGED
|
@@ -161,9 +161,9 @@ MS_DELAY_PATTERN = re.compile(
|
|
|
161
161
|
r'(?:Thread\.sleep|(?:page\.)?waitForTimeout|(?:page\.)?wait_for_timeout|cy\.wait)\s*\(\s*([^)]+)\s*\)'
|
|
162
162
|
)
|
|
163
163
|
|
|
164
|
-
# Second-based delays: WebUI.delay(sec), time.sleep(sec)
|
|
164
|
+
# Second-based delays: WebUI.delay(sec), time.sleep(sec), asyncio.sleep(sec)
|
|
165
165
|
SEC_DELAY_PATTERN = re.compile(
|
|
166
|
-
r'(?:WebUI\.delay|time\.sleep)\s*\(\s*([^)]+)\s*\)'
|
|
166
|
+
r'(?:WebUI\.delay|time\.sleep|asyncio\.sleep)\s*\(\s*([^)]+)\s*\)'
|
|
167
167
|
)
|
|
168
168
|
|
|
169
169
|
# Backward-compatibility alias
|
package/tools/lint_ai_docs.py
CHANGED
|
@@ -152,10 +152,16 @@ def lint_docs(repo_root):
|
|
|
152
152
|
with open(manifest_path, "r", encoding="utf-8") as mf:
|
|
153
153
|
manifest_data = json.load(mf)
|
|
154
154
|
manifest_skill_ids = set(s.get("id") for s in manifest_data.get("skills", []))
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
# v4.0: skills are 2 levels deep (domain/skill-id/SKILL.md)
|
|
156
|
+
actual_skill_dirs = set()
|
|
157
|
+
for domain_entry in os.listdir(skills_dir):
|
|
158
|
+
domain_path = os.path.join(skills_dir, domain_entry)
|
|
159
|
+
if not os.path.isdir(domain_path):
|
|
160
|
+
continue
|
|
161
|
+
for skill_entry in os.listdir(domain_path):
|
|
162
|
+
skill_path = os.path.join(domain_path, skill_entry)
|
|
163
|
+
if os.path.isdir(skill_path):
|
|
164
|
+
actual_skill_dirs.add(skill_entry)
|
|
159
165
|
unregistered = actual_skill_dirs - manifest_skill_ids
|
|
160
166
|
if unregistered:
|
|
161
167
|
errors.append(f"[skills_manifest.json] Skills on disk not in manifest: {sorted(unregistered)}")
|
|
@@ -310,7 +316,15 @@ def check_doc_metrics_consistency(repo_root):
|
|
|
310
316
|
if not os.path.isdir(skills_dir) or not os.path.isdir(tools_dir):
|
|
311
317
|
return errors
|
|
312
318
|
|
|
313
|
-
|
|
319
|
+
# v4.0: skills are 2 levels deep (domain/skill-id/SKILL.md)
|
|
320
|
+
skills_count = sum(
|
|
321
|
+
1
|
|
322
|
+
for domain_entry in os.listdir(skills_dir)
|
|
323
|
+
if os.path.isdir(os.path.join(skills_dir, domain_entry))
|
|
324
|
+
for skill_entry in os.listdir(os.path.join(skills_dir, domain_entry))
|
|
325
|
+
if os.path.isdir(os.path.join(skills_dir, domain_entry, skill_entry))
|
|
326
|
+
and os.path.exists(os.path.join(skills_dir, domain_entry, skill_entry, "SKILL.md"))
|
|
327
|
+
)
|
|
314
328
|
tools_count = len([f for f in os.listdir(tools_dir) if f.endswith(".py") and f != "__init__.py"])
|
|
315
329
|
|
|
316
330
|
obsolete_patterns = [
|
package/tools/mcp_docx_server.py
CHANGED
|
@@ -60,7 +60,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
60
60
|
except Exception:
|
|
61
61
|
pass
|
|
62
62
|
|
|
63
|
-
SERVER_VERSION = "
|
|
63
|
+
SERVER_VERSION = "4.0.0"
|
|
64
64
|
MAX_DOCX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
65
65
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
66
66
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|
|
@@ -52,7 +52,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
52
52
|
except Exception:
|
|
53
53
|
pass
|
|
54
54
|
|
|
55
|
-
SERVER_VERSION = "
|
|
55
|
+
SERVER_VERSION = "4.0.0"
|
|
56
56
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
57
57
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
58
58
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|