@teevee98/synapse-hub 4.1.2 → 4.1.4
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/skills/01-web-automation/clean-pom-crafter/examples/standard_test_case.groovy +3 -0
- package/.agents/skills/01-web-automation/clean-pom-crafter/references/pom_patterns.groovy +3 -0
- package/.agents/skills/01-web-automation/e2e-testing-patterns/examples/playwright_sharded_config.ts +3 -0
- package/.agents/skills/01-web-automation/playwright-webapp-testing/examples/server_lifecycle_playwright.py +3 -0
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +3 -0
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/references/dast_recipes.ts +3 -0
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +3 -0
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +3 -0
- package/.agents/skills/11-ai-and-prompting/qa-aci-interface/examples/surgical_code_window_walkthrough.md +1 -1
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/PERFORMANCE_AUDIT_REPORT.md +2 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/generate_skill_examples.py +3 -0
- package/scripts/package_dist.py +3 -0
- package/skills_manifest.json +1 -1
- package/synapse.config.json +1 -1
- package/tools/.infer_baseline.json +3 -796
- package/tools/__init__.py +4 -1
- package/tools/agent_canary.py +3 -0
- package/tools/analyze_project.py +3 -0
- package/tools/api_drift_sentinel.py +3 -0
- package/tools/api_fuzzer.py +3 -0
- package/tools/ast_cache.py +4 -2
- package/tools/author_integrity.py +53 -1
- package/tools/auto_heal.py +7 -2
- package/tools/autogen_qa_broker.py +14 -15
- package/tools/benchmark_swarm_context.py +10 -2
- package/tools/browser_helpers.js +2 -2
- package/tools/bug_reporter.py +3 -0
- package/tools/build_consolidated_report.py +3 -0
- package/tools/bump_version.py +4 -1
- package/tools/cache_resolver.py +7 -3
- package/tools/check_env.py +3 -0
- package/tools/check_version_sync.py +3 -0
- package/tools/ci_healing_hook.py +3 -0
- package/tools/cli.py +10 -7
- package/tools/config_decoupler.py +3 -0
- package/tools/core/__init__.py +3 -0
- package/tools/core/file_lock.py +23 -14
- package/tools/core/i18n.py +9 -7
- package/tools/core/memory_bus.py +6 -3
- package/tools/core/process_supervisor.py +28 -18
- package/tools/core/token_estimator.py +55 -18
- package/tools/count_tokens.py +11 -7
- package/tools/create_mock_docx.py +3 -0
- package/tools/dashboard_generator.py +17 -15
- package/tools/db_sandbox.py +4 -1
- package/tools/debt_harvester.py +2 -2
- package/tools/diagram_architect.py +3 -0
- package/tools/distill_log.py +119 -26
- package/tools/e2e_flow_prober.py +3 -0
- package/tools/export_postman_collection.py +3 -0
- package/tools/flaky_detector.py +3 -0
- package/tools/fsm_enforcer.py +2 -2
- package/tools/fuzz_payloads.py +3 -0
- package/tools/generate_allure_report.py +3 -0
- package/tools/generate_api_matrix.py +3 -0
- package/tools/generate_jmx_plan.py +3 -0
- package/tools/generate_tc_from_story.py +3 -0
- package/tools/generate_test_reports.py +3 -0
- package/tools/git_pre_commit_guard.py +13 -3
- package/tools/git_worktree_manager.py +3 -0
- package/tools/heal/__init__.py +3 -0
- package/tools/heal_pr_automator.py +3 -0
- package/tools/heuristic_locator_matcher.py +3 -0
- package/tools/hub_publisher.py +3 -3
- package/tools/infer_linter.py +19 -9
- package/tools/init_config.py +6 -9
- package/tools/jtl_analyzer.py +3 -0
- package/tools/lint/__init__.py +3 -0
- package/tools/lint_ai_docs.py +3 -0
- package/tools/lookup_tc.py +3 -0
- package/tools/lookup_xpath.py +3 -0
- package/tools/matrix_sharder.py +3 -0
- package/tools/mcp/__init__.py +3 -0
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +4 -1
- package/tools/mcp_server.py +4 -1
- package/tools/md_to_xlsx.py +3 -0
- package/tools/mechanical_ui_gate.py +3 -0
- package/tools/micro_mutator.py +9 -5
- package/tools/network_mock_shield.py +3 -0
- package/tools/newman_analyzer.py +3 -0
- package/tools/omni_emitter.py +3 -0
- package/tools/omni_parser.py +3 -0
- package/tools/omni_transpiler.py +3 -0
- package/tools/output_formatter.py +3 -0
- package/tools/package_release.py +6 -6
- package/tools/pairwise_generator.py +3 -0
- package/tools/pentest_scope_guard.py +2 -2
- package/tools/perf/__init__.py +3 -0
- package/tools/pinpoint_failure.py +3 -0
- package/tools/project_state.py +3 -0
- package/tools/repo_map.py +3 -0
- package/tools/report/__init__.py +3 -0
- package/tools/rules_router.py +42 -10
- package/tools/runaway_stopper.py +3 -0
- package/tools/safety_firewall.py +3 -0
- package/tools/setup_project.py +9 -4
- package/tools/skill_collision_guard.py +2 -2
- package/tools/skillspector.py +2 -1
- package/tools/smart_visual_masker.py +3 -0
- package/tools/telemetry_correlator.py +3 -0
- package/tools/template_excel_exporter.py +2 -2
- package/tools/test_impact.py +3 -0
- package/tools/trace_data_flow.py +3 -0
- package/tools/traffic_session_converter.py +3 -0
- package/tools/ui_server.py +2 -2
- package/tools/universal_ir.py +3 -0
- package/tools/update_sentinel.py +15 -9
- package/tools/validate_groovy_scripts.py +3 -0
- package/tools/verify_all.py +27 -20
- package/tools/visual_diff_canvas.py +3 -0
- package/tools/visual_som_helper.py +3 -0
- package/tools/watch_mode.py +4 -4
- package/tools/wcag_audit.py +3 -0
- package/tools/welcome_page.py +1 -1
package/tools/distill_log.py
CHANGED
|
@@ -49,6 +49,33 @@ except ImportError:
|
|
|
49
49
|
def count_tokens(text: str, model_hint: str = "cl100k") -> int:
|
|
50
50
|
return max(1, len(text) // 4)
|
|
51
51
|
|
|
52
|
+
|
|
53
|
+
def truncate_to_tokens(text: str, max_tokens: int) -> str:
|
|
54
|
+
"""Hard token truncate guaranteeing count_tokens(result) <= max_tokens."""
|
|
55
|
+
if max_tokens <= 0:
|
|
56
|
+
return ""
|
|
57
|
+
if max_tokens == 1:
|
|
58
|
+
return "!"
|
|
59
|
+
if count_tokens(text) <= max_tokens:
|
|
60
|
+
return text
|
|
61
|
+
try:
|
|
62
|
+
import tiktoken
|
|
63
|
+
enc = tiktoken.get_encoding("cl100k_base")
|
|
64
|
+
toks = enc.encode(text)
|
|
65
|
+
return enc.decode(toks[:max_tokens], errors="ignore")
|
|
66
|
+
except Exception:
|
|
67
|
+
lines = text.splitlines(keepends=True)
|
|
68
|
+
curr: List[str] = []
|
|
69
|
+
for line in lines:
|
|
70
|
+
curr.append(line)
|
|
71
|
+
if count_tokens("".join(curr)) > max_tokens:
|
|
72
|
+
curr.pop()
|
|
73
|
+
break
|
|
74
|
+
res = "".join(curr)
|
|
75
|
+
while res and count_tokens(res) > max_tokens:
|
|
76
|
+
res = res[:-1]
|
|
77
|
+
return res
|
|
78
|
+
|
|
52
79
|
# Universal noise patterns (passing steps, zero failures summary, timestamps, system initialization)
|
|
53
80
|
NOISE_PATTERNS = [
|
|
54
81
|
re.compile(r"^\s*$"),
|
|
@@ -122,12 +149,16 @@ def distill(
|
|
|
122
149
|
max_lines: int = 40,
|
|
123
150
|
exit_code: Optional[int] = None,
|
|
124
151
|
raw_log_path: Optional[str] = None,
|
|
125
|
-
token_budget: int = 800,
|
|
152
|
+
token_budget: Optional[int] = 800,
|
|
126
153
|
) -> str:
|
|
127
154
|
"""
|
|
128
155
|
Distills raw execution logs down to high-signal failure blocks while guaranteeing
|
|
129
156
|
zero false passes, zero false-positive assertions on info logs, and enforcing token budgets.
|
|
130
157
|
"""
|
|
158
|
+
if token_budget is not None:
|
|
159
|
+
if isinstance(token_budget, bool) or not isinstance(token_budget, int) or token_budget < 0:
|
|
160
|
+
raise ValueError(f"token_budget must be a non-negative integer (>= 0), got {token_budget}")
|
|
161
|
+
|
|
131
162
|
raw_bytes = len(log_text.encode("utf-8"))
|
|
132
163
|
lines = log_text.splitlines()
|
|
133
164
|
total_raw_lines = len(lines)
|
|
@@ -237,12 +268,32 @@ def distill(
|
|
|
237
268
|
|
|
238
269
|
if raw_log_path:
|
|
239
270
|
output.append(f"[RAW LOG ARTIFACT] file://{os.path.abspath(raw_log_path)}")
|
|
240
|
-
|
|
271
|
+
clean_text = "\n".join(output)
|
|
272
|
+
if token_budget is not None and token_budget >= 0 and count_tokens(clean_text) > token_budget:
|
|
273
|
+
clean_text = truncate_to_tokens(clean_text, token_budget)
|
|
274
|
+
return clean_text
|
|
275
|
+
|
|
276
|
+
# Hard Cap Scope Invariant: Extremely constrained budgets below minimum envelope
|
|
277
|
+
if token_budget is not None and token_budget >= 0:
|
|
278
|
+
if token_budget == 0:
|
|
279
|
+
return ""
|
|
280
|
+
if token_budget < 35:
|
|
281
|
+
tc_info = f": {', '.join(sorted(failing_tcs)[:2])}" if failing_tcs else ""
|
|
282
|
+
summary = f"❌ [BUDGET_BELOW_MINIMUM: budget={token_budget}]{tc_info}"
|
|
283
|
+
if raw_log_path and count_tokens(summary + f" | log: {raw_log_path}") <= token_budget:
|
|
284
|
+
summary += f" | log: {raw_log_path}"
|
|
285
|
+
return truncate_to_tokens(summary, token_budget)
|
|
286
|
+
|
|
287
|
+
is_compact_envelope = token_budget is not None and token_budget > 0 and token_budget < 90
|
|
241
288
|
|
|
242
289
|
# Invariant: Conflicting Signals Handling when exit_code == 0 but failure keywords present
|
|
243
290
|
if exit_code == 0:
|
|
244
291
|
output.append("⚠️ CONFLICTING_SIGNALS [Exit Code: 0]: Test runner exited with code 0, but failure indicators were detected in log.")
|
|
245
292
|
output.append(" (Check whether failures were swallowed by an outer test harness, or if informational text matched failure patterns).")
|
|
293
|
+
elif is_compact_envelope:
|
|
294
|
+
exit_badge = f" [Exit Code: {exit_code}]" if exit_code is not None else ""
|
|
295
|
+
tcs_hint = f": {sorted(failing_tcs)[0]}" if failing_tcs else ""
|
|
296
|
+
output = [f"❌ FAILURES DETECTED{exit_badge}{tcs_hint}"]
|
|
246
297
|
elif exit_code is not None:
|
|
247
298
|
exit_badge = f" [Exit Code: {exit_code}]"
|
|
248
299
|
if failing_tcs:
|
|
@@ -255,25 +306,39 @@ def distill(
|
|
|
255
306
|
else:
|
|
256
307
|
output.append(f"❌ FAILURES / ERRORS DETECTED: {len(captured_failures)} failure block(s) isolated.")
|
|
257
308
|
|
|
258
|
-
if
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
309
|
+
if not is_compact_envelope:
|
|
310
|
+
if failing_tcs:
|
|
311
|
+
output.append(f" Targeted TCs: {', '.join(sorted(failing_tcs))}")
|
|
312
|
+
if failing_locs:
|
|
313
|
+
unique_locs = sorted(set(failing_locs))
|
|
314
|
+
output.append(f" Failing Script Location(s): {', '.join(unique_locs[:5])}")
|
|
263
315
|
|
|
264
316
|
output.append("\n--- Distilled Failure Block(s) ---")
|
|
265
317
|
|
|
266
|
-
# Assemble failure blocks with line budget constraint
|
|
318
|
+
# Assemble failure blocks with line budget and token reservation constraint
|
|
267
319
|
lines_used = len(output)
|
|
268
320
|
max_payload_lines = max(5, max_lines - lines_used)
|
|
269
321
|
|
|
322
|
+
# Reserve tokens for header and footer metadata so failure blocks don't blowout budget
|
|
323
|
+
footer_reserve = (20 if is_compact_envelope else 35) + (15 if raw_log_path else 0)
|
|
324
|
+
header_tokens = count_tokens("\n".join(output) + "\n\n--- Distilled Failure Block(s) ---\n")
|
|
325
|
+
max_payload_tokens = (
|
|
326
|
+
max(10, token_budget - header_tokens - footer_reserve)
|
|
327
|
+
if (token_budget is not None and token_budget > 0)
|
|
328
|
+
else 999999
|
|
329
|
+
)
|
|
330
|
+
|
|
270
331
|
assembled_blocks: List[str] = []
|
|
271
332
|
current_lines = 0
|
|
333
|
+
current_payload_tokens = 0
|
|
272
334
|
truncated = False
|
|
273
335
|
|
|
274
336
|
for block in captured_failures[:5]:
|
|
275
337
|
block_text = "\n".join(block)
|
|
276
338
|
block_lines = len(block)
|
|
339
|
+
block_tokens = count_tokens(block_text)
|
|
340
|
+
|
|
341
|
+
# Check line budget constraint
|
|
277
342
|
if current_lines + block_lines > max_payload_lines:
|
|
278
343
|
allowed = max_payload_lines - current_lines
|
|
279
344
|
if allowed > 2:
|
|
@@ -281,21 +346,23 @@ def distill(
|
|
|
281
346
|
assembled_blocks.append("... [truncated by max_lines budget] ...")
|
|
282
347
|
truncated = True
|
|
283
348
|
break
|
|
349
|
+
|
|
350
|
+
# Check token budget constraint
|
|
351
|
+
if token_budget is not None and token_budget > 0 and (current_payload_tokens + block_tokens > max_payload_tokens):
|
|
352
|
+
avail = max(0, max_payload_tokens - current_payload_tokens - 18)
|
|
353
|
+
if avail > 5:
|
|
354
|
+
truncated_block = truncate_to_tokens(block_text, avail)
|
|
355
|
+
assembled_blocks.append(truncated_block)
|
|
356
|
+
assembled_blocks.append(f"... [truncated: constrained by token_budget={token_budget} tokens] ...")
|
|
357
|
+
truncated = True
|
|
358
|
+
break
|
|
359
|
+
|
|
284
360
|
assembled_blocks.append(block_text)
|
|
285
361
|
current_lines += block_lines
|
|
362
|
+
current_payload_tokens += block_tokens
|
|
286
363
|
|
|
287
364
|
output.append("\n---\n".join(assembled_blocks))
|
|
288
365
|
|
|
289
|
-
# Genuine Token Budget Constraint Enforcement
|
|
290
|
-
if token_budget > 0:
|
|
291
|
-
current_tokens = count_tokens("\n".join(output))
|
|
292
|
-
if current_tokens > token_budget:
|
|
293
|
-
truncated = True
|
|
294
|
-
# Pop lines from the end of the output body until within token budget
|
|
295
|
-
while len(output) > 4 and count_tokens("\n".join(output)) > max(20, token_budget - 25):
|
|
296
|
-
output.pop()
|
|
297
|
-
output.append(f"... [truncated: constrained by token_budget={token_budget} tokens] ...")
|
|
298
|
-
|
|
299
366
|
# Measure distilled body before appending metadata footer
|
|
300
367
|
body_lines = len(output)
|
|
301
368
|
distilled_body_text = "\n".join(output)
|
|
@@ -303,15 +370,25 @@ def distill(
|
|
|
303
370
|
distilled_tokens = count_tokens(distilled_body_text)
|
|
304
371
|
reduction_pct = round(((raw_bytes - distilled_body_bytes) / max(1, raw_bytes)) * 100, 1)
|
|
305
372
|
|
|
306
|
-
|
|
307
|
-
f"\n[DISTILLER METRICS]
|
|
308
|
-
|
|
309
|
-
|
|
373
|
+
if is_compact_envelope:
|
|
374
|
+
output.append(f"\n[DISTILLER METRICS] Truncated: {truncated} | Token Budget: {token_budget}")
|
|
375
|
+
if raw_log_path and count_tokens("\n".join(output) + f"\n[RAW LOG ARTIFACT] {raw_log_path}") <= token_budget:
|
|
376
|
+
output.append(f"[RAW LOG ARTIFACT] file://{os.path.abspath(raw_log_path)}")
|
|
377
|
+
else:
|
|
378
|
+
output.append(
|
|
379
|
+
f"\n[DISTILLER METRICS] Distilled Body: {body_lines} lines ({distilled_body_bytes:,} bytes, ~{distilled_tokens} tokens) | "
|
|
380
|
+
f"Reduction: {reduction_pct}% | Truncated: {truncated} | Token Budget: {token_budget if token_budget is not None else 'unlimited'}"
|
|
381
|
+
)
|
|
382
|
+
if raw_log_path:
|
|
383
|
+
output.append(f"[RAW LOG ARTIFACT] file://{os.path.abspath(raw_log_path)}")
|
|
384
|
+
|
|
385
|
+
final_result = "\n".join(output)
|
|
310
386
|
|
|
311
|
-
|
|
312
|
-
|
|
387
|
+
# Hard Invariant Guarantee: Entire output must never exceed token_budget
|
|
388
|
+
if token_budget is not None and token_budget > 0 and count_tokens(final_result) > token_budget:
|
|
389
|
+
final_result = truncate_to_tokens(final_result, token_budget)
|
|
313
390
|
|
|
314
|
-
return
|
|
391
|
+
return final_result
|
|
315
392
|
|
|
316
393
|
|
|
317
394
|
# Public alias for MCP server compatibility
|
|
@@ -367,13 +444,29 @@ def shrink_tokens(text: str, max_chars_per_line: int = 140) -> str:
|
|
|
367
444
|
return "\n".join(shrunk_lines)
|
|
368
445
|
|
|
369
446
|
|
|
447
|
+
def _non_negative_int(val: str) -> int:
|
|
448
|
+
try:
|
|
449
|
+
ival = int(val)
|
|
450
|
+
except ValueError:
|
|
451
|
+
raise argparse.ArgumentTypeError(f"Invalid integer value: {val!r}")
|
|
452
|
+
if ival < 0:
|
|
453
|
+
raise argparse.ArgumentTypeError(f"token-budget must be a non-negative integer (>= 0), got {ival}")
|
|
454
|
+
return ival
|
|
455
|
+
|
|
456
|
+
|
|
370
457
|
def main():
|
|
371
458
|
parser = argparse.ArgumentParser(description="Distill terminal execution logs into high-signal failure blocks.")
|
|
372
459
|
parser.add_argument("--file", "-f", help="Path to raw log file (reads from stdin if omitted).")
|
|
373
460
|
parser.add_argument("--exit-code", "-e", type=int, default=None, help="Process exit code from test runner.")
|
|
374
461
|
parser.add_argument("--save-raw", "-s", default=None, help="Path to preserve raw log.")
|
|
375
462
|
parser.add_argument("--max-lines", "-m", type=int, default=40, help="Maximum number of output lines.")
|
|
376
|
-
parser.add_argument(
|
|
463
|
+
parser.add_argument(
|
|
464
|
+
"--token-budget",
|
|
465
|
+
"-b",
|
|
466
|
+
type=_non_negative_int,
|
|
467
|
+
default=800,
|
|
468
|
+
help="Maximum token budget for distilled output (must be >= 0).",
|
|
469
|
+
)
|
|
377
470
|
parser.add_argument("--shrink", action="store_true", help="Apply caveman/shrink token compression.")
|
|
378
471
|
args = parser.parse_args()
|
|
379
472
|
|
package/tools/e2e_flow_prober.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise E2E Flow Prober & XPath Crawler Dispatcher (Cross-Platform)
|
|
4
7
|
----------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/export_postman_collection.py — Enterprise API to Postman Collection v2.1.0 Exporter (Postman Pinnacle)
|
package/tools/flaky_detector.py
CHANGED
package/tools/fsm_enforcer.py
CHANGED
|
@@ -135,8 +135,8 @@ def compute_artifact_hashes(artifacts: List[str], base_dir: Optional[str] = None
|
|
|
135
135
|
with open(target, "rb") as f:
|
|
136
136
|
file_bytes = f.read()
|
|
137
137
|
hashes[item] = hashlib.sha256(file_bytes).hexdigest()
|
|
138
|
-
except OSError
|
|
139
|
-
|
|
138
|
+
except OSError:
|
|
139
|
+
continue
|
|
140
140
|
return hashes
|
|
141
141
|
|
|
142
142
|
|
package/tools/fuzz_payloads.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Edge-Case Fuzzing & Input Sanitization Payload Catalog
|
|
4
7
|
------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Allure HTML Report Generator (Cross-Platform)
|
|
4
7
|
---------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/generate_api_matrix.py — OpenAPI / Swagger to E2E Testing Matrix Generator
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/generate_jmx_plan.py — Enterprise Apache JMeter 5.x Test Plan XML Generator (JMeter 360° Pinnacle)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Test Report Aggregator & summaryTemp Generator (Cross-Platform)
|
|
4
7
|
-------------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Git Pre-Commit Architecture & Discipline Guard
|
|
4
7
|
--------------------------------------------------
|
|
@@ -23,7 +26,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
23
26
|
except Exception:
|
|
24
27
|
pass
|
|
25
28
|
|
|
26
|
-
FORBIDDEN_PATHS = ["/Users/", "C:\\Workspace\\", "D:\\Workspace\\", "file:///c:", "file:///d:"]
|
|
29
|
+
FORBIDDEN_PATHS = ["/Users/", "/home/", "C:\\Workspace\\", "D:\\Workspace\\", "file:///c:", "file:///d:"]
|
|
27
30
|
FORBIDDEN_HUB_PREFIXES = (
|
|
28
31
|
"Scripts/", "Keywords/", "Object Repository/", "Test Suites/", "Data Files/", "Include/",
|
|
29
32
|
"e2e/", "pages/", "cypress/"
|
|
@@ -94,13 +97,15 @@ def check_forbidden_paths(files):
|
|
|
94
97
|
if not os.path.exists(f) or os.path.isdir(f):
|
|
95
98
|
continue
|
|
96
99
|
# Skip this guard script itself and binary files
|
|
97
|
-
if
|
|
100
|
+
if os.path.basename(f) == "git_pre_commit_guard.py" or f.endswith(
|
|
101
|
+
(".db", ".png", ".jpg", ".jpeg", ".zip", ".tar", ".gz", ".ico", ".bin")
|
|
102
|
+
):
|
|
98
103
|
continue
|
|
99
104
|
try:
|
|
100
105
|
with open(f, "r", encoding="utf-8", errors="ignore") as fp:
|
|
101
106
|
for line_no, line in enumerate(fp, 1):
|
|
102
107
|
# Allow mention in historical report or gitignore
|
|
103
|
-
if "FINAL_REPORT.md" in f or ".gitignore" in f:
|
|
108
|
+
if "FINAL_REPORT.md" in f or "AUDIT_REPORT.md" in f or "PROJECT_HEALTH_REPORT.md" in f or ".gitignore" in f:
|
|
104
109
|
continue
|
|
105
110
|
for forbidden in FORBIDDEN_PATHS:
|
|
106
111
|
if forbidden in line:
|
|
@@ -115,6 +120,9 @@ def check_scripts_clean_pom(files):
|
|
|
115
120
|
xpath_pattern = re.compile(
|
|
116
121
|
r'(?<!:)//(?:\*|table|input|button|div|span|form|select|textarea|a(?=[\[/@\s\'"]|$))'
|
|
117
122
|
)
|
|
123
|
+
semantic_locator_pattern = re.compile(
|
|
124
|
+
r'(?:page|frame)\.(?:getByRole|getByLabel|getByPlaceholder|getByText|getByTestId|getByAltText|getByTitle)\s*\('
|
|
125
|
+
)
|
|
118
126
|
for f in files:
|
|
119
127
|
if not os.path.exists(f):
|
|
120
128
|
continue
|
|
@@ -133,6 +141,8 @@ def check_scripts_clean_pom(files):
|
|
|
133
141
|
violations.append((f, line_no, "Raw findTestObject is forbidden in test scripts"))
|
|
134
142
|
if "xpath=" in line:
|
|
135
143
|
violations.append((f, line_no, "Explicit xpath= locator is forbidden in test scripts"))
|
|
144
|
+
if semantic_locator_pattern.search(line):
|
|
145
|
+
violations.append((f, line_no, "Raw Playwright semantic locator is forbidden in test scripts (encapsulate in Page Class)"))
|
|
136
146
|
# Strip standard HTTP/HTTPS URLs before checking XPath syntax
|
|
137
147
|
line_no_urls = re.sub(r'https?://[^\s\'"]+', '', line)
|
|
138
148
|
if "//" in line_no_urls and xpath_pattern.search(line_no_urls):
|
package/tools/heal/__init__.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Synapse Hub — Self-Healing & Autonomous Repair Engines (tools.heal)
|
|
3
6
|
-------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Self-Healing Confidence Scorer & PR Automator
|
|
4
7
|
---------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
3-Layer Heuristic Locator Matcher (0-Token Autonomous Recovery)
|
|
4
7
|
--------------------------------------------------------------
|
package/tools/hub_publisher.py
CHANGED
|
@@ -409,7 +409,7 @@ def check_npm_registry_live_version(package_name: Optional[str] = None) -> Optio
|
|
|
409
409
|
data = json.loads(resp.read().decode("utf-8"))
|
|
410
410
|
return data.get("version")
|
|
411
411
|
except Exception as exc:
|
|
412
|
-
|
|
412
|
+
log_warn(f"npm HTTP probe skipped: {exc}")
|
|
413
413
|
return None
|
|
414
414
|
|
|
415
415
|
|
|
@@ -465,10 +465,10 @@ def step_4_and_5_monitor_packages_and_npm(owner: str, repo: str, version: str, t
|
|
|
465
465
|
log_warn(f"GitHub Actions publish_npm.yml completed with conclusion: {conclusion}")
|
|
466
466
|
break
|
|
467
467
|
except Exception as exc:
|
|
468
|
-
|
|
468
|
+
log_warn(f"GitHub Actions poll skipped: {exc}")
|
|
469
469
|
|
|
470
470
|
print(f" Waiting for NPM registry replication... ({int(time.time() - start_time)}s/{wait_timeout}s)")
|
|
471
|
-
time.sleep(poll_interval)
|
|
471
|
+
time.sleep(poll_interval) # synapse-ignore: HARD_DELAY_ANTI_PATTERN
|
|
472
472
|
|
|
473
473
|
if not npm_verified:
|
|
474
474
|
# Final fallback check
|
package/tools/infer_linter.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Universal QA Static Defect & Assertion Sentinel (Inspired by facebook/infer)
|
|
4
7
|
-------------------------------------------------------------------
|
|
@@ -19,6 +22,7 @@ import glob
|
|
|
19
22
|
import ast
|
|
20
23
|
import html as html_lib
|
|
21
24
|
import argparse
|
|
25
|
+
import logging
|
|
22
26
|
from datetime import datetime
|
|
23
27
|
|
|
24
28
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
@@ -222,8 +226,8 @@ def load_config(repo_root=None, config_path=None):
|
|
|
222
226
|
try:
|
|
223
227
|
with open(config_path, "r", encoding="utf-8") as f:
|
|
224
228
|
return json.load(f)
|
|
225
|
-
except (OSError, json.JSONDecodeError):
|
|
226
|
-
|
|
229
|
+
except (OSError, json.JSONDecodeError) as err:
|
|
230
|
+
logging.getLogger("infer_linter").debug("Failed to read config from %s: %s", config_path, err)
|
|
227
231
|
|
|
228
232
|
root = repo_root or REPO_ROOT
|
|
229
233
|
candidates = [
|
|
@@ -255,9 +259,11 @@ def load_baseline(baseline_path):
|
|
|
255
259
|
f_path = it.get("file", "").replace("\\", "/")
|
|
256
260
|
d_type = it.get("type", "").upper()
|
|
257
261
|
d_line = it.get("line")
|
|
258
|
-
signatures.add((f_path, d_type))
|
|
259
262
|
if d_line is not None:
|
|
260
|
-
|
|
263
|
+
try:
|
|
264
|
+
signatures.add((f_path, d_type, int(d_line)))
|
|
265
|
+
except (ValueError, TypeError):
|
|
266
|
+
signatures.add((f_path, d_type, d_line))
|
|
261
267
|
return signatures
|
|
262
268
|
except (OSError, json.JSONDecodeError):
|
|
263
269
|
return set()
|
|
@@ -611,8 +617,8 @@ def analyze_script(file_path, baseline_set=None, disabled_rules=None):
|
|
|
611
617
|
"line": line_no,
|
|
612
618
|
"message": f"Test data creation detected without paired teardown cleanup ('{raw_line}'). Risk of DB state pollution per AGENTS.md Rule 1.3."
|
|
613
619
|
})
|
|
614
|
-
except SyntaxError:
|
|
615
|
-
|
|
620
|
+
except SyntaxError as err:
|
|
621
|
+
logging.getLogger("infer_linter").debug("AST parse skipped due to syntax error: %s", err)
|
|
616
622
|
|
|
617
623
|
# Rule 5 (L4): Unawaited Playwright Assertions in JS/TS
|
|
618
624
|
if file_path.endswith((".ts", ".tsx", ".js", ".jsx")):
|
|
@@ -727,7 +733,8 @@ def analyze_script(file_path, baseline_set=None, disabled_rules=None):
|
|
|
727
733
|
|
|
728
734
|
# Check baseline suppression
|
|
729
735
|
if baseline_set:
|
|
730
|
-
|
|
736
|
+
norm_abs = os.path.abspath(file_path).replace("\\", "/")
|
|
737
|
+
if (norm_rel, d_type, line_idx) in baseline_set or (norm_abs, d_type, line_idx) in baseline_set:
|
|
731
738
|
continue
|
|
732
739
|
|
|
733
740
|
active_defects.append(d)
|
|
@@ -940,8 +947,11 @@ def run_infer_linter(target_dir=None, output_path=None, strict: bool = False,
|
|
|
940
947
|
print(f"Detailed audit saved to: {dest_json}\n")
|
|
941
948
|
|
|
942
949
|
if strict:
|
|
943
|
-
|
|
944
|
-
|
|
950
|
+
anti_pattern_count = sum(1 for r in results for d in r["defects"] if d["type"] in (
|
|
951
|
+
"FAKE_PASS_NO_ASSERTION", "NO_ASSERTION_IN_TEST", "DANGLING_ASSERTION_NO_MATCHER",
|
|
952
|
+
"HARD_DELAY_ANTI_PATTERN", "EXCESSIVE_HARD_DELAY"
|
|
953
|
+
))
|
|
954
|
+
return 0 if (critical_count == 0 and anti_pattern_count == 0) else 1
|
|
945
955
|
return 0 if critical_count == 0 else 1
|
|
946
956
|
|
|
947
957
|
|
package/tools/init_config.py
CHANGED
|
@@ -50,9 +50,8 @@ def is_hub_directory(target_path: Path) -> bool:
|
|
|
50
50
|
return True
|
|
51
51
|
if (resolved / "skills_manifest.json").is_file() and (resolved / "AGENTS.md").is_file():
|
|
52
52
|
return True
|
|
53
|
-
except (OSError, ValueError)
|
|
54
|
-
|
|
55
|
-
return False
|
|
53
|
+
except (OSError, ValueError):
|
|
54
|
+
return False
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
def get_hub_version() -> str:
|
|
@@ -62,9 +61,8 @@ def get_hub_version() -> str:
|
|
|
62
61
|
if pkg_file.is_file():
|
|
63
62
|
with open(pkg_file, "r", encoding="utf-8") as f:
|
|
64
63
|
return json.load(f).get("version", "3.2.1")
|
|
65
|
-
except (OSError, json.JSONDecodeError)
|
|
66
|
-
|
|
67
|
-
return "3.2.1"
|
|
64
|
+
except (OSError, json.JSONDecodeError):
|
|
65
|
+
return "3.2.1"
|
|
68
66
|
|
|
69
67
|
|
|
70
68
|
def detect_git_user_name() -> Optional[str]:
|
|
@@ -78,9 +76,8 @@ def detect_git_user_name() -> Optional[str]:
|
|
|
78
76
|
)
|
|
79
77
|
if res.returncode == 0 and res.stdout.strip():
|
|
80
78
|
return res.stdout.strip()
|
|
81
|
-
except (subprocess.SubprocessError, OSError)
|
|
82
|
-
|
|
83
|
-
return None
|
|
79
|
+
except (subprocess.SubprocessError, OSError):
|
|
80
|
+
return None
|
|
84
81
|
|
|
85
82
|
|
|
86
83
|
def build_default_config(
|
package/tools/jtl_analyzer.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/jtl_analyzer.py — Enterprise Apache JMeter JTL Results Analyzer & CI/CD Gatekeeper
|
package/tools/lint/__init__.py
CHANGED
package/tools/lint_ai_docs.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise AI Documentation & Artifact Linter (Anti-Drift Guard v2.0)
|
|
4
7
|
---------------------------------------------------------------
|
package/tools/lookup_tc.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise QA: Fast Test Case Metadata Lookup (lookup_tc.py)
|
|
4
7
|
-------------------------------------------------------------
|
package/tools/lookup_xpath.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise QA: Fast XPath / Selector Lookup (lookup_xpath.py)
|
|
4
7
|
-------------------------------------------------------------
|
package/tools/matrix_sharder.py
CHANGED
package/tools/mcp/__init__.py
CHANGED
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 = "4.1.
|
|
63
|
+
SERVER_VERSION = "4.1.4"
|
|
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
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Cross-Platform MCP Excel Server (Zero-Dependency)
|
|
4
7
|
-----------------------------------------------------------
|
|
@@ -52,7 +55,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
52
55
|
except Exception:
|
|
53
56
|
pass
|
|
54
57
|
|
|
55
|
-
SERVER_VERSION = "4.1.
|
|
58
|
+
SERVER_VERSION = "4.1.4"
|
|
56
59
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
57
60
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
58
61
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|