@teevee98/synapse-hub 3.10.0 → 4.1.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/context-engineering.md +3 -3
- package/.agents/rules/mandatory-playwright-live.md +18 -4
- package/.agents/rules/security_testing_rules.md +8 -5
- 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 +505 -394
- package/synapse.config.json +17 -1
- package/tools/__init__.py +1 -1
- package/tools/ast_cache.py +171 -0
- package/tools/author_integrity.py +7 -2
- package/tools/benchmark_swarm_context.py +242 -151
- package/tools/browser_helpers.js +2 -2
- package/tools/build_consolidated_report.py +6 -6
- package/tools/cache_resolver.py +11 -6
- package/tools/check_version_sync.py +56 -0
- package/tools/cli.py +16 -3
- package/tools/core/file_lock.py +187 -14
- package/tools/core/process_supervisor.py +25 -0
- package/tools/core/telemetry.py +139 -1
- package/tools/core/token_estimator.py +145 -0
- package/tools/count_tokens.py +28 -0
- package/tools/dashboard_generator.py +6 -6
- package/tools/debt_harvester.py +20 -9
- package/tools/diagram_architect.py +0 -1
- package/tools/distill_log.py +266 -89
- package/tools/git_pre_commit_guard.py +6 -4
- package/tools/git_worktree_manager.py +1 -1
- 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/mechanical_ui_gate.py +1 -1
- package/tools/micro_mutator.py +51 -10
- package/tools/pairwise_generator.py +0 -1
- package/tools/pentest_scope_guard.py +328 -0
- package/tools/perf/benchmark_perf_runner.py +226 -0
- package/tools/pinpoint_failure.py +14 -2
- package/tools/rules_router.py +596 -0
- package/tools/token_telemetry.py +224 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/verify_all.py +67 -7
- 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/tools/distill_log.py
CHANGED
|
@@ -1,157 +1,330 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
#
|
|
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
|
+
|
|
3
6
|
"""
|
|
4
|
-
tools/distill_log.py —
|
|
5
|
-
Filters out 90%+ passing step noise and outputs strictly actionable
|
|
6
|
-
|
|
7
|
+
tools/distill_log.py — Enterprise Multi-Framework Log Distiller (Token & Failure Sentinel)
|
|
8
|
+
Filters out 90%+ passing step noise and outputs strictly actionable, evidence-backed
|
|
9
|
+
failure triage blocks without false passes or dropped assertion diffs.
|
|
10
|
+
Supports Pytest, Playwright, Jest/Vitest, Katalon KRE, Gradle, and Python/Node/JVM logs.
|
|
7
11
|
"""
|
|
8
12
|
|
|
9
|
-
import
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
10
16
|
import os
|
|
11
17
|
import re
|
|
12
|
-
import
|
|
18
|
+
import sys
|
|
19
|
+
from typing import Any, Dict, List, Optional, Set, Tuple
|
|
13
20
|
|
|
14
|
-
# Enforce UTF-8 stdout encoding for
|
|
15
|
-
if hasattr(sys.stdout,
|
|
21
|
+
# Enforce UTF-8 stdout encoding for cross-platform compatibility
|
|
22
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
16
23
|
try:
|
|
17
|
-
sys.stdout.reconfigure(encoding=
|
|
18
|
-
sys.stderr.reconfigure(encoding=
|
|
24
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
25
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
19
26
|
except Exception:
|
|
20
27
|
pass
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
# Universal noise patterns (passing steps, zero failures summary, timestamps, system initialization)
|
|
30
|
+
NOISE_PATTERNS = [
|
|
31
|
+
re.compile(r"^\s*$"),
|
|
32
|
+
re.compile(r"\b0\s+failed\b", re.IGNORECASE),
|
|
33
|
+
re.compile(r"\b0\s+failures?\b", re.IGNORECASE),
|
|
34
|
+
re.compile(r"\b0\s+errors?\b", re.IGNORECASE),
|
|
35
|
+
re.compile(r"\b(?:no|zero)\s+failures?\b", re.IGNORECASE),
|
|
36
|
+
re.compile(r"\b(?:no|zero)\s+errors?\b", re.IGNORECASE),
|
|
37
|
+
re.compile(r"\[INFO\b|\bINFO:|\bINFO\s+", re.IGNORECASE),
|
|
38
|
+
re.compile(r"\[DEBUG\b|\bDEBUG:|\bDEBUG\s+", re.IGNORECASE),
|
|
39
|
+
re.compile(r"\[TRACE\b|\bTRACE:|\bTRACE\s+", re.IGNORECASE),
|
|
40
|
+
re.compile(r"^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}.*\b(?:INFO|DEBUG|TRACE)\b", re.IGNORECASE),
|
|
41
|
+
re.compile(r"\bPASSED\b", re.IGNORECASE),
|
|
42
|
+
re.compile(r"> Task :"),
|
|
43
|
+
re.compile(r"SLF4J:"),
|
|
44
|
+
re.compile(r"Loading class `com\.mysql"),
|
|
45
|
+
re.compile(r"Starting ChromeDriver"),
|
|
46
|
+
re.compile(r"Only local connections are allowed"),
|
|
47
|
+
re.compile(r"DevTools listening on"),
|
|
48
|
+
re.compile(r"Fontconfig warning:"),
|
|
49
|
+
re.compile(r"Katalon Studio.*licensed to"),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
# Explicit false-indicator filter (phrases like "without failure", "0 failures")
|
|
53
|
+
PASSING_PHRASES = re.compile(
|
|
54
|
+
r"\b(?:without|zero|0|no)\s+(?:obvious\s+)?(?:failures?|errors?|exceptions?)\b",
|
|
55
|
+
re.IGNORECASE,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Case-insensitive failure indicator patterns
|
|
59
|
+
FAILURE_INDICATORS = [
|
|
60
|
+
re.compile(r"\bFAILED\b", re.IGNORECASE),
|
|
61
|
+
re.compile(r"\bFAILURES?\b", re.IGNORECASE),
|
|
62
|
+
re.compile(r"\bERRORS?\b", re.IGNORECASE),
|
|
63
|
+
re.compile(r"\bExceptions?\b", re.IGNORECASE),
|
|
64
|
+
re.compile(r"\bAssertionError\b", re.IGNORECASE),
|
|
65
|
+
re.compile(r"Caused by:", re.IGNORECASE),
|
|
66
|
+
re.compile(r"at (?:Enterprise\.|Script\d+|com\.kms|\S+\.(?:groovy|ts|js|py|java))", re.IGNORECASE),
|
|
67
|
+
re.compile(r"TC-\d+.*FAILED", re.IGNORECASE),
|
|
68
|
+
re.compile(r"FAIL\s+.*(?:\.spec|\.test)", re.IGNORECASE),
|
|
69
|
+
re.compile(r"===+\s*FAILURES\s*===+", re.IGNORECASE),
|
|
70
|
+
re.compile(r"E\s+assert\b", re.IGNORECASE),
|
|
71
|
+
re.compile(r"assert\s+.*==\s*", re.IGNORECASE),
|
|
72
|
+
re.compile(r"expect\(.*\)\.", re.IGNORECASE),
|
|
73
|
+
re.compile(r"Timeout \d+ms exceeded", re.IGNORECASE),
|
|
74
|
+
re.compile(r"Traceback \(most recent call last\):", re.IGNORECASE),
|
|
75
|
+
re.compile(r"panic:\s+", re.IGNORECASE),
|
|
76
|
+
re.compile(r"fatal(?:\s+error)?:\s+", re.IGNORECASE),
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
# Test Case Identifiers
|
|
80
|
+
TC_PATTERN = re.compile(
|
|
81
|
+
r"([A-Za-z0-9_.-]+::[A-Za-z0-9_]+|TC-\d+[A-Za-z0-9_]*|test_[A-Za-z0-9_]+|"
|
|
82
|
+
r"[A-Za-z0-9_-]+\.(?:spec|test)\.[jt]sx?)"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Line number pattern
|
|
86
|
+
LINE_NUM_PATTERN = re.compile(
|
|
87
|
+
r"((?:Script\d+|\w+Page|\w+\.(?:groovy|ts|js|py|java)):(\d+))|File \"([^\"]+)\", line (\d+)"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def distill(
|
|
92
|
+
log_text: str,
|
|
93
|
+
max_lines: int = 40,
|
|
94
|
+
exit_code: Optional[int] = None,
|
|
95
|
+
raw_log_path: Optional[str] = None,
|
|
96
|
+
token_budget: int = 800,
|
|
97
|
+
) -> str:
|
|
98
|
+
"""
|
|
99
|
+
Distills raw execution logs down to high-signal failure blocks while guaranteeing
|
|
100
|
+
zero false passes and preserving critical assertion diffs, cause chains, and locations.
|
|
101
|
+
"""
|
|
102
|
+
raw_bytes = len(log_text.encode("utf-8"))
|
|
23
103
|
lines = log_text.splitlines()
|
|
24
104
|
total_raw_lines = len(lines)
|
|
25
105
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
re.compile(r'\[INFO\b|\bINFO:|\bINFO\s+', re.IGNORECASE),
|
|
30
|
-
re.compile(r'\[DEBUG\b|\bDEBUG:|\bDEBUG\s+', re.IGNORECASE),
|
|
31
|
-
re.compile(r'\[TRACE\b|\bTRACE:|\bTRACE\s+', re.IGNORECASE),
|
|
32
|
-
re.compile(r'^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}.*\b(?:INFO|DEBUG|TRACE)\b', re.IGNORECASE),
|
|
33
|
-
re.compile(r'\bPASSED\b', re.IGNORECASE),
|
|
34
|
-
re.compile(r'> Task :'),
|
|
35
|
-
re.compile(r'SLF4J:'),
|
|
36
|
-
re.compile(r'Loading class `com\.mysql'),
|
|
37
|
-
re.compile(r'Starting ChromeDriver'),
|
|
38
|
-
re.compile(r'Only local connections are allowed'),
|
|
39
|
-
re.compile(r'DevTools listening on'),
|
|
40
|
-
re.compile(r'Fontconfig warning:'),
|
|
41
|
-
re.compile(r'Katalon Studio.*licensed to'),
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
failure_indicators = [
|
|
45
|
-
re.compile(r'\bFAILED\b'),
|
|
46
|
-
re.compile(r'\bERROR\b'),
|
|
47
|
-
re.compile(r'Exception\b'),
|
|
48
|
-
re.compile(r'AssertionError'),
|
|
49
|
-
re.compile(r'Caused by:'),
|
|
50
|
-
re.compile(r'at (?:Enterprise\.|Script\d+|com\.kms)'),
|
|
51
|
-
re.compile(r'TC-\d+.*FAILED'),
|
|
52
|
-
re.compile(r'FAIL\s+.*(?:\.spec|\.test)'),
|
|
53
|
-
]
|
|
54
|
-
|
|
55
|
-
tc_pattern = re.compile(r'(TC-\d+|test_[A-Za-z0-9_]+|[A-Za-z0-9_-]+\.(?:spec|test)\.[jt]sx?)')
|
|
56
|
-
line_num_pattern = re.compile(r'((?:Script\d+|\w+Page|\w+\.(?:groovy|ts|js|py)):(\d+))|File "([^"]+)", line (\d+)')
|
|
57
|
-
re.compile(r'([A-Za-z0-9_.]*(?:Exception|Error)):?\s*(.*)')
|
|
58
|
-
|
|
59
|
-
captured_failures = []
|
|
60
|
-
failing_tcs = set()
|
|
61
|
-
failing_locs = []
|
|
106
|
+
captured_failures: List[List[str]] = []
|
|
107
|
+
failing_tcs: Set[str] = set()
|
|
108
|
+
failing_locs: List[str] = []
|
|
62
109
|
|
|
63
110
|
in_failure_block = False
|
|
64
|
-
|
|
111
|
+
current_block: List[str] = []
|
|
112
|
+
last_seen_tc: Optional[str] = None
|
|
65
113
|
|
|
66
|
-
for line in lines:
|
|
67
|
-
# Check if line
|
|
68
|
-
|
|
69
|
-
|
|
114
|
+
for i, line in enumerate(lines):
|
|
115
|
+
# Check if line contains a passing phrase like "0 failures" or "without failure"
|
|
116
|
+
if PASSING_PHRASES.search(line):
|
|
117
|
+
continue
|
|
70
118
|
|
|
71
|
-
# Detect TC identifier
|
|
72
|
-
m_tc =
|
|
73
|
-
if m_tc
|
|
74
|
-
|
|
119
|
+
# Detect candidate TC identifier
|
|
120
|
+
m_tc = TC_PATTERN.search(line)
|
|
121
|
+
if m_tc:
|
|
122
|
+
last_seen_tc = m_tc.group(1)
|
|
75
123
|
|
|
76
|
-
#
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
failing_locs.append(m_loc.group(1) or f"{m_loc.group(3)}:{m_loc.group(4)}")
|
|
124
|
+
# Case-insensitive check
|
|
125
|
+
is_fail_line = any(p.search(line) for p in FAILURE_INDICATORS)
|
|
126
|
+
is_noise = any(p.search(line) for p in NOISE_PATTERNS) and not is_fail_line
|
|
80
127
|
|
|
81
128
|
if is_fail_line:
|
|
82
|
-
|
|
83
|
-
|
|
129
|
+
if not in_failure_block:
|
|
130
|
+
in_failure_block = True
|
|
131
|
+
current_block = []
|
|
132
|
+
# Context line: keep previous line if it was a test name or relevant context
|
|
133
|
+
if i > 0:
|
|
134
|
+
prev_line = lines[i - 1].strip()
|
|
135
|
+
if prev_line and not any(p.search(prev_line) for p in NOISE_PATTERNS):
|
|
136
|
+
current_block.append(prev_line)
|
|
137
|
+
m_prev_tc = TC_PATTERN.search(prev_line)
|
|
138
|
+
if m_prev_tc:
|
|
139
|
+
failing_tcs.add(m_prev_tc.group(1))
|
|
140
|
+
|
|
141
|
+
current_block.append(line.rstrip())
|
|
142
|
+
|
|
143
|
+
# Associate failing TC
|
|
144
|
+
if m_tc:
|
|
145
|
+
failing_tcs.add(m_tc.group(1))
|
|
146
|
+
elif last_seen_tc:
|
|
147
|
+
failing_tcs.add(last_seen_tc)
|
|
148
|
+
|
|
149
|
+
# Detect script line numbers strictly within failure blocks
|
|
150
|
+
m_loc = LINE_NUM_PATTERN.search(line)
|
|
151
|
+
if m_loc:
|
|
152
|
+
failing_locs.append(m_loc.group(1) or f"{m_loc.group(3)}:{m_loc.group(4)}")
|
|
153
|
+
|
|
84
154
|
elif in_failure_block:
|
|
85
|
-
|
|
155
|
+
# Check for block exit boundary
|
|
156
|
+
if is_noise or (line.startswith("---") and not line.startswith("--- Distilled")) or line.startswith("==="):
|
|
86
157
|
in_failure_block = False
|
|
87
|
-
if
|
|
88
|
-
captured_failures.append(
|
|
89
|
-
|
|
158
|
+
if current_block:
|
|
159
|
+
captured_failures.append(current_block[:15])
|
|
160
|
+
current_block = []
|
|
90
161
|
else:
|
|
91
|
-
|
|
162
|
+
current_block.append(line.rstrip())
|
|
163
|
+
if m_tc:
|
|
164
|
+
failing_tcs.add(m_tc.group(1))
|
|
165
|
+
|
|
166
|
+
# Line numbers inside trace
|
|
167
|
+
m_loc = LINE_NUM_PATTERN.search(line)
|
|
168
|
+
if m_loc:
|
|
169
|
+
failing_locs.append(m_loc.group(1) or f"{m_loc.group(3)}:{m_loc.group(4)}")
|
|
170
|
+
|
|
171
|
+
# Limit individual block length
|
|
172
|
+
if len(current_block) >= 15:
|
|
173
|
+
in_failure_block = False
|
|
174
|
+
captured_failures.append(current_block)
|
|
175
|
+
current_block = []
|
|
176
|
+
|
|
177
|
+
if current_block:
|
|
178
|
+
captured_failures.append(current_block[:15])
|
|
179
|
+
|
|
180
|
+
# Telemetry Header
|
|
181
|
+
output: List[str] = []
|
|
182
|
+
output.append(f"[LOG DISTILLER] Analyzed {total_raw_lines:,} lines ({raw_bytes:,} bytes).")
|
|
92
183
|
|
|
93
|
-
|
|
94
|
-
|
|
184
|
+
# Invariant: Truth Anchor on Exit Code & Failure Detections
|
|
185
|
+
has_failures = bool(failing_tcs or captured_failures)
|
|
95
186
|
|
|
96
|
-
|
|
97
|
-
|
|
187
|
+
if not has_failures:
|
|
188
|
+
if exit_code is not None and exit_code != 0:
|
|
189
|
+
# Runner exited with error but no standard failure regex matched
|
|
190
|
+
output.append(f"❌ RUNNER_NONZERO_EXIT: Process exited with non-zero code {exit_code}.")
|
|
191
|
+
output.append(" No standard failure keyword matched in log. Attached head and tail of raw log:")
|
|
192
|
+
output.append("\n--- Raw Log Head & Tail ---")
|
|
193
|
+
head_lines = [l.strip() for l in lines[:5] if l.strip()]
|
|
194
|
+
tail_lines = [l.strip() for l in lines[-15:] if l.strip()]
|
|
195
|
+
output.extend(head_lines)
|
|
196
|
+
output.append("... [omitted middle passing steps] ...")
|
|
197
|
+
output.extend(tail_lines)
|
|
198
|
+
elif exit_code is None:
|
|
199
|
+
# Exit code not supplied: DO NOT claim "ALL TESTS PASSED"
|
|
200
|
+
output.append("⚠️ NO_FAILURE_SIGNATURE_DETECTED: No recognized failure patterns found.")
|
|
201
|
+
output.append(" (Exit code unverified; verify test execution status directly).")
|
|
202
|
+
else:
|
|
203
|
+
# Explicit exit_code == 0 AND no failure indicators
|
|
204
|
+
output.append(f"✅ ALL TESTS PASSED (Exit Code: 0): Zero errors or failed steps detected across {total_raw_lines:,} lines.")
|
|
98
205
|
|
|
99
|
-
|
|
100
|
-
|
|
206
|
+
if raw_log_path:
|
|
207
|
+
output.append(f"[RAW LOG ARTIFACT] file://{os.path.abspath(raw_log_path)}")
|
|
101
208
|
return "\n".join(output)
|
|
102
209
|
|
|
210
|
+
# Report failures
|
|
211
|
+
if exit_code is not None:
|
|
212
|
+
exit_badge = f" [Exit Code: {exit_code}]"
|
|
213
|
+
else:
|
|
214
|
+
exit_badge = ""
|
|
215
|
+
|
|
103
216
|
if failing_tcs:
|
|
104
|
-
output.append(f"❌ FAILURES DETECTED: {len(failing_tcs)} Test Case(s) marked FAILED.")
|
|
217
|
+
output.append(f"❌ FAILURES DETECTED{exit_badge}: {len(failing_tcs)} Test Case(s) marked FAILED.")
|
|
105
218
|
output.append(f" Targeted TCs: {', '.join(sorted(failing_tcs))}")
|
|
106
219
|
else:
|
|
107
|
-
output.append(f"❌ FAILURES / ERRORS DETECTED: {len(captured_failures)} failure block(s) isolated.")
|
|
220
|
+
output.append(f"❌ FAILURES / ERRORS DETECTED{exit_badge}: {len(captured_failures)} failure block(s) isolated.")
|
|
108
221
|
|
|
109
222
|
if failing_locs:
|
|
110
223
|
unique_locs = sorted(set(failing_locs))
|
|
111
224
|
output.append(f" Failing Script Location(s): {', '.join(unique_locs[:5])}")
|
|
112
225
|
|
|
113
226
|
output.append("\n--- Distilled Failure Block(s) ---")
|
|
114
|
-
|
|
115
|
-
|
|
227
|
+
|
|
228
|
+
# Assemble failure blocks with line budget constraint
|
|
229
|
+
lines_used = len(output)
|
|
230
|
+
max_payload_lines = max(5, max_lines - lines_used)
|
|
231
|
+
|
|
232
|
+
assembled_blocks: List[str] = []
|
|
233
|
+
current_lines = 0
|
|
234
|
+
truncated = False
|
|
235
|
+
|
|
236
|
+
for block in captured_failures[:5]:
|
|
237
|
+
block_text = "\n".join(block)
|
|
238
|
+
block_lines = len(block)
|
|
239
|
+
if current_lines + block_lines > max_payload_lines:
|
|
240
|
+
# Take what fits
|
|
241
|
+
allowed = max_payload_lines - current_lines
|
|
242
|
+
if allowed > 2:
|
|
243
|
+
assembled_blocks.append("\n".join(block[:allowed]))
|
|
244
|
+
assembled_blocks.append("... [truncated by max_lines budget] ...")
|
|
245
|
+
truncated = True
|
|
246
|
+
break
|
|
247
|
+
assembled_blocks.append(block_text)
|
|
248
|
+
current_lines += block_lines
|
|
249
|
+
|
|
250
|
+
output.append("\n---\n".join(assembled_blocks))
|
|
251
|
+
|
|
252
|
+
# Append provenance and compression telemetry
|
|
253
|
+
distilled_text = "\n".join(output)
|
|
254
|
+
distilled_bytes = len(distilled_text.encode("utf-8"))
|
|
255
|
+
reduction_pct = round(((raw_bytes - distilled_bytes) / max(1, raw_bytes)) * 100, 1)
|
|
256
|
+
|
|
257
|
+
output.append(
|
|
258
|
+
f"\n[DISTILLER METRICS] Distilled: {len(output)} lines ({distilled_bytes:,} bytes) | "
|
|
259
|
+
f"Reduction: {reduction_pct}% | Truncated: {truncated}"
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
if raw_log_path:
|
|
263
|
+
output.append(f"[RAW LOG ARTIFACT] file://{os.path.abspath(raw_log_path)}")
|
|
116
264
|
|
|
117
265
|
return "\n".join(output)
|
|
118
266
|
|
|
267
|
+
|
|
119
268
|
# Public alias for MCP server compatibility
|
|
120
269
|
distill_log_content = distill
|
|
121
270
|
|
|
122
|
-
|
|
271
|
+
|
|
272
|
+
def shrink_tokens(text: str, max_chars_per_line: int = 140) -> str:
|
|
123
273
|
"""
|
|
124
274
|
Caveman / shrink compression: drops verbose metadata, collapses repetitive traces,
|
|
125
275
|
and truncates stack noise while preserving 100% error names, line locations,
|
|
126
|
-
|
|
127
|
-
Achieves 33-65% token drop.
|
|
276
|
+
assertion mismatches, and UUIDs (Julius Brussee caveman/shrink pattern).
|
|
128
277
|
"""
|
|
129
278
|
lines = text.splitlines()
|
|
130
279
|
shrunk_lines = []
|
|
131
280
|
seen_signatures = set()
|
|
132
281
|
|
|
282
|
+
uuid_pattern = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", re.I)
|
|
283
|
+
|
|
133
284
|
for line in lines:
|
|
134
|
-
|
|
135
|
-
if not
|
|
285
|
+
stripped = line.strip()
|
|
286
|
+
if not stripped:
|
|
136
287
|
continue
|
|
288
|
+
|
|
289
|
+
# Keep assertion diffs intact with exact indentation
|
|
290
|
+
is_diff_line = any(stripped.startswith(p) for p in ("E ", "assert ", "Expected:", "Received:", "> ", "- ", "+ "))
|
|
291
|
+
|
|
292
|
+
if is_diff_line:
|
|
293
|
+
shrunk_lines.append(line.rstrip())
|
|
294
|
+
continue
|
|
295
|
+
|
|
296
|
+
cleaned = re.sub(r"\s+", " ", stripped)
|
|
297
|
+
|
|
137
298
|
# Deduplicate repeated identical trace lines
|
|
138
299
|
if cleaned.startswith("at ") or cleaned.startswith("File "):
|
|
139
300
|
sig = cleaned[:60]
|
|
140
301
|
if sig in seen_signatures:
|
|
141
302
|
continue
|
|
142
303
|
seen_signatures.add(sig)
|
|
143
|
-
|
|
144
|
-
|
|
304
|
+
|
|
305
|
+
# Replace non-UUID hex hashes of 16-64 chars with <hash>
|
|
306
|
+
def _replace_hash(match: re.Match[str]) -> str:
|
|
307
|
+
token = match.group(0)
|
|
308
|
+
if uuid_pattern.match(token):
|
|
309
|
+
return token
|
|
310
|
+
return "<hash>"
|
|
311
|
+
|
|
312
|
+
cleaned = re.sub(r"\b[0-9a-fA-F]{16,64}\b", _replace_hash, cleaned)
|
|
313
|
+
|
|
145
314
|
if len(cleaned) > max_chars_per_line:
|
|
146
315
|
cleaned = cleaned[:max_chars_per_line] + "..."
|
|
147
316
|
shrunk_lines.append(cleaned)
|
|
317
|
+
|
|
148
318
|
return "\n".join(shrunk_lines)
|
|
149
319
|
|
|
320
|
+
|
|
150
321
|
def main():
|
|
151
322
|
parser = argparse.ArgumentParser(description="Distill terminal execution logs into high-signal failure blocks.")
|
|
152
323
|
parser.add_argument("--file", "-f", help="Path to raw log file (reads from stdin if omitted).")
|
|
153
|
-
parser.add_argument("--
|
|
154
|
-
parser.add_argument("--
|
|
324
|
+
parser.add_argument("--exit-code", "-e", type=int, default=None, help="Process exit code from test runner.")
|
|
325
|
+
parser.add_argument("--save-raw", "-s", default=None, help="Path to preserve raw log.")
|
|
326
|
+
parser.add_argument("--max-lines", "-m", type=int, default=40, help="Maximum number of output lines.")
|
|
327
|
+
parser.add_argument("--shrink", action="store_true", help="Apply caveman/shrink token compression.")
|
|
155
328
|
args = parser.parse_args()
|
|
156
329
|
|
|
157
330
|
if args.file:
|
|
@@ -175,12 +348,16 @@ def main():
|
|
|
175
348
|
except OSError as err:
|
|
176
349
|
sys.stderr.write(f"Warning: Could not save raw log: {err}\n")
|
|
177
350
|
|
|
178
|
-
summary = distill(
|
|
351
|
+
summary = distill(
|
|
352
|
+
log_text,
|
|
353
|
+
max_lines=args.max_lines,
|
|
354
|
+
exit_code=args.exit_code,
|
|
355
|
+
raw_log_path=args.save_raw,
|
|
356
|
+
)
|
|
179
357
|
if args.shrink:
|
|
180
358
|
summary = shrink_tokens(summary)
|
|
181
359
|
print(summary)
|
|
182
|
-
|
|
183
|
-
print(f"[Full raw log saved to file://{os.path.abspath(args.save_raw)}]")
|
|
360
|
+
|
|
184
361
|
|
|
185
362
|
if __name__ == "__main__":
|
|
186
363
|
main()
|
|
@@ -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.1.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.1.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
|
package/tools/mcp_server.py
CHANGED