@teevee98/synapse-hub 4.1.4 → 4.2.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/git-push-protocol.md +2 -2
- package/.agents/skills/01-web-automation/auth-session-and-cookie-manager/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/bats-testing-patterns/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +8 -3
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/lam-script-generator/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/mobile-appium-som/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/BaseScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/LoginScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/TC_MobileLogin.java +2 -2
- package/.agents/skills/01-web-automation/playwright-live-interaction/SKILL.md +7 -2
- package/.agents/skills/01-web-automation/playwright-webapp-testing/SKILL.md +6 -1
- package/.agents/skills/01-web-automation/web-agent-gym-benchmarking/SKILL.md +6 -1
- package/.agents/skills/02-test-design/architecture-decision-records/SKILL.md +6 -1
- package/.agents/skills/02-test-design/gherkin-to-suite/SKILL.md +6 -1
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +6 -1
- package/.agents/skills/02-test-design/review-spec/SKILL.md +4 -1
- package/.agents/skills/02-test-design/tot-exploratory-testing/SKILL.md +6 -1
- package/.agents/skills/03-api-and-contracts/api-network-mocking-interception/SKILL.md +6 -1
- package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +6 -1
- package/.agents/skills/03-api-and-contracts/consumer-driven-contract-testing/SKILL.md +7 -2
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +7 -2
- package/.agents/skills/04-performance-and-load/lean-impact-scoreboard/SKILL.md +4 -1
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +6 -1
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +6 -1
- package/.agents/skills/05-security-and-compliance/skillspector-security-guard/SKILL.md +6 -1
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/agentless-qa-repair/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/antigravity-test-sentinel/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +7 -2
- package/.agents/skills/06-healing-and-resilience/flaky-test-sentinel-and-quarantine/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/self-healing-locator/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/systematic-debugging/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/test-driven-development/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/verification-before-completion/SKILL.md +6 -1
- package/.agents/skills/06-healing-and-resilience/visual-regression-sentinel/SKILL.md +6 -1
- package/.agents/skills/07-data-and-state/db-state-verifier-and-seeder/SKILL.md +6 -1
- package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +6 -1
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +6 -1
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/SKILL.md +6 -1
- package/.agents/skills/08-code-quality/graphify-impact-analyzer/SKILL.md +6 -1
- package/.agents/skills/08-code-quality/lean-code-ladder/SKILL.md +6 -1
- package/.agents/skills/08-code-quality/repo-quality-audit/SKILL.md +4 -1
- package/.agents/skills/08-code-quality/senior-code-review/SKILL.md +4 -1
- package/.agents/skills/08-code-quality/surgical-coding-principles/SKILL.md +6 -1
- package/.agents/skills/08-code-quality/technical-debt-harvester/SKILL.md +4 -1
- package/.agents/skills/09-ci-and-devops/github-actions-templates/SKILL.md +6 -1
- package/.agents/skills/10-agent-orchestration/actor-qa-swarm/SKILL.md +6 -1
- package/.agents/skills/10-agent-orchestration/agent-orchestration-multi-agent-optimize/SKILL.md +6 -1
- package/.agents/skills/10-agent-orchestration/event-stream-qa-orchestrator/SKILL.md +6 -1
- package/.agents/skills/10-agent-orchestration/persistent-planning-files/SKILL.md +6 -1
- package/.agents/skills/10-agent-orchestration/qa-memory-os/SKILL.md +6 -1
- package/.agents/skills/11-ai-and-prompting/meta-prompt-crafter/SKILL.md +6 -1
- package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +6 -1
- package/.agents/skills/11-ai-and-prompting/qa-aci-interface/SKILL.md +6 -1
- package/.agents/skills/11-ai-and-prompting/token-and-context-optimizer/SKILL.md +6 -1
- package/AGENTS.md +7 -1
- package/LICENSE +5 -5
- package/NOTICE +1 -1
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +2 -2
- package/docs/ARCHITECTURE.md +11 -2
- package/docs/CLI_REFERENCE.en.md +6 -4
- package/docs/CLI_REFERENCE.md +1 -1
- package/docs/CONTRIBUTING.en.md +1 -1
- package/docs/CONTRIBUTING.md +2 -2
- package/docs/TOOL_CATALOG.md +6 -2
- package/docs/research/agent_skill_training_analysis.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +320 -55
- package/synapse.config.json +1 -1
- package/templates/ui/index.html +2 -2
- package/tools/TOOL_CATALOG.json +63 -3
- package/tools/__init__.py +1 -1
- package/tools/api_fuzzer.py +179 -118
- package/tools/author_integrity.py +121 -11
- package/tools/benchmark_swarm_context.py +119 -18
- package/tools/break_ui_generator.py +233 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/check_version_sync.py +18 -50
- package/tools/cli.py +109 -18
- package/tools/core/bm25_retriever.py +218 -0
- package/tools/core/i18n.py +4 -4
- package/tools/core/provider_usage_adapter.py +317 -0
- package/tools/core/token_estimator.py +42 -14
- package/tools/count_tokens.py +5 -0
- package/tools/coverage_reporter.py +245 -0
- package/tools/dashboard_generator.py +6 -6
- package/tools/db_sandbox.py +146 -4
- package/tools/distill_skill.py +191 -0
- package/tools/git_pre_commit_guard.py +12 -0
- package/tools/humanize_linter.py +3 -0
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +75 -15
- package/tools/micro_mutator.py +84 -14
- package/tools/pentest_scope_guard.py +399 -56
- package/tools/perf/benchmark_perf_runner.py +42 -0
- package/tools/rules_router.py +401 -41
- package/tools/security_scanner.py +80 -0
- package/tools/senior_code_review.py +14 -0
- package/tools/skill_canonical_digest.py +244 -0
- package/tools/skill_profiles.py +77 -7
- package/tools/slide_deck_exporter.py +477 -0
- package/tools/sync_skills_manifest.py +166 -0
- package/tools/task_memory_manager.py +260 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/validate_host_interop.py +485 -0
- package/tools/validate_skills_schema.py +282 -0
- package/tools/verify_all.py +572 -42
- package/tools/welcome_page.py +2 -2
|
@@ -1350,7 +1350,7 @@ def _build_target_translations(
|
|
|
1350
1350
|
"th_step_status": "Trạng Thái",
|
|
1351
1351
|
"th_step_details": "Chi Tiết Kỹ Thuật (OTel & AST)",
|
|
1352
1352
|
|
|
1353
|
-
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.
|
|
1353
|
+
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.2.0 • Bản quyền © Thế Vị (@TeeVee98) • Chuẩn Clean POM & Kiểm Thử Tự Chủ",
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
1356
|
translations_en = {
|
|
@@ -1428,7 +1428,7 @@ def _build_target_translations(
|
|
|
1428
1428
|
"th_step_status": "Status",
|
|
1429
1429
|
"th_step_details": "Technical Details (OTel & AST)",
|
|
1430
1430
|
|
|
1431
|
-
"footer_text": "Generated automatically by Synapse-Hub v4.
|
|
1431
|
+
"footer_text": "Generated automatically by Synapse-Hub v4.2.0 • Copyright © Thế Vị (@TeeVee98) • Clean POM & Autonomous Testing",
|
|
1432
1432
|
}
|
|
1433
1433
|
|
|
1434
1434
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -1917,7 +1917,7 @@ def _build_hub_translations(
|
|
|
1917
1917
|
"""Builds bilingual dictionaries for Hub Dashboard."""
|
|
1918
1918
|
translations_vi = {
|
|
1919
1919
|
"header_title": "Bảng Điều Hành Chất Lượng Doanh Nghiệp",
|
|
1920
|
-
"header_subtitle": "Synapse-Hub v4.
|
|
1920
|
+
"header_subtitle": "Synapse-Hub v4.2.0 • Hệ Sinh Thái Kiểm Thử AI Agent Tự Chủ",
|
|
1921
1921
|
"nav_welcome": "Giới Thiệu",
|
|
1922
1922
|
"meta_mode": "🏷️ Chế độ: <strong>HỆ SINH THÁI QA HUB</strong>",
|
|
1923
1923
|
"meta_gen": f"🕒 Khởi tạo: <strong>{now_str}</strong>",
|
|
@@ -1987,12 +1987,12 @@ def _build_hub_translations(
|
|
|
1987
1987
|
"th_sk_ver": "Phiên Bản",
|
|
1988
1988
|
"th_sk_cap": "Khả Năng Nghiệp Vụ Cốt Lõi",
|
|
1989
1989
|
|
|
1990
|
-
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.
|
|
1990
|
+
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.2.0 • Bản quyền © Thế Vị (@TeeVee98) • Hệ Thống Kiểm Thử AI Agent Tự Chủ",
|
|
1991
1991
|
}
|
|
1992
1992
|
|
|
1993
1993
|
translations_en = {
|
|
1994
1994
|
"header_title": "Enterprise QA Executive Dashboard",
|
|
1995
|
-
"header_subtitle": "Synapse-Hub v4.
|
|
1995
|
+
"header_subtitle": "Synapse-Hub v4.2.0 • Autonomous AI Agent Testing Ecosystem",
|
|
1996
1996
|
"nav_welcome": "Welcome",
|
|
1997
1997
|
"meta_mode": "🏷️ Mode: <strong>QA HUB ECOSYSTEM</strong>",
|
|
1998
1998
|
"meta_gen": f"🕒 Generated: <strong>{now_str}</strong>",
|
|
@@ -2062,7 +2062,7 @@ def _build_hub_translations(
|
|
|
2062
2062
|
"th_sk_ver": "Version",
|
|
2063
2063
|
"th_sk_cap": "Core Capabilities",
|
|
2064
2064
|
|
|
2065
|
-
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.
|
|
2065
|
+
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.2.0 • Copyright © Thế Vị (@TeeVee98) • Autonomous AI Agent Testing Ecosystem",
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
2068
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
package/tools/db_sandbox.py
CHANGED
|
@@ -194,9 +194,16 @@ class DBSandbox:
|
|
|
194
194
|
|
|
195
195
|
return metadata
|
|
196
196
|
|
|
197
|
-
def restore_snapshot(
|
|
197
|
+
def restore_snapshot(
|
|
198
|
+
self,
|
|
199
|
+
snapshot_id: str = "pristine_baseline",
|
|
200
|
+
consent: Any = False,
|
|
201
|
+
dry_run: bool = False
|
|
202
|
+
) -> Dict[str, Any]:
|
|
198
203
|
"""
|
|
199
204
|
Restores database to pristine baseline, wiping 100% of test data junk.
|
|
205
|
+
Requires explicit consent when dry_run=False. Consent can be a boolean or a
|
|
206
|
+
scoped dictionary bound to target_sandbox.
|
|
200
207
|
"""
|
|
201
208
|
start_time = time.perf_counter()
|
|
202
209
|
try:
|
|
@@ -204,6 +211,58 @@ class DBSandbox:
|
|
|
204
211
|
except ValueError as e:
|
|
205
212
|
return {"status": "ERROR", "message": str(e)}
|
|
206
213
|
|
|
214
|
+
target_path = self.db_path or os.path.join(self.snapshot_dir, "active_test.db")
|
|
215
|
+
|
|
216
|
+
# 1. Dry run preview (Default-safe, zero side effects)
|
|
217
|
+
if dry_run:
|
|
218
|
+
return {
|
|
219
|
+
"status": "dry_run_preview",
|
|
220
|
+
"action": "restore",
|
|
221
|
+
"snapshot_id": clean_id,
|
|
222
|
+
"target_db": target_path,
|
|
223
|
+
"dry_run": True,
|
|
224
|
+
"message": f"DRY-RUN PREVIEW: Would restore database snapshot '{clean_id}' to '{target_path}'. Pass dry_run=False and consent=True to execute."
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
# 2. Authorization / Consent enforcement at action execution boundary
|
|
228
|
+
has_consent = (
|
|
229
|
+
bool(consent)
|
|
230
|
+
or os.environ.get("SYNAPSE_FORCE_RESTORE", "").strip().lower() in ("1", "true", "yes")
|
|
231
|
+
or os.environ.get("PENTEST_CONSENT_ACKNOWLEDGED", "").strip().lower() in ("1", "true", "yes")
|
|
232
|
+
)
|
|
233
|
+
if not has_consent:
|
|
234
|
+
return {
|
|
235
|
+
"status": "ERROR",
|
|
236
|
+
"message": "Destructive database restore requires explicit consent bound to target sandbox. Pass consent=True (or scoped consent dict) or set SYNAPSE_FORCE_RESTORE=1.",
|
|
237
|
+
"snapshot_id": clean_id,
|
|
238
|
+
"target_db": target_path,
|
|
239
|
+
"zero_pollution_guaranteed": False
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
# Scoped consent check: ensure consent for Sandbox A cannot be reused to restore Sandbox B
|
|
243
|
+
if isinstance(consent, dict):
|
|
244
|
+
c_target = consent.get("target_sandbox") or consent.get("target_db")
|
|
245
|
+
if c_target:
|
|
246
|
+
norm_c = os.path.realpath(os.path.abspath(c_target)).lower()
|
|
247
|
+
norm_target = os.path.realpath(os.path.abspath(target_path)).lower()
|
|
248
|
+
if norm_c != norm_target:
|
|
249
|
+
return {
|
|
250
|
+
"status": "ERROR",
|
|
251
|
+
"message": f"Consent target sandbox mismatch: consent granted for '{c_target}', but target is '{target_path}'.",
|
|
252
|
+
"snapshot_id": clean_id,
|
|
253
|
+
"target_db": target_path,
|
|
254
|
+
"zero_pollution_guaranteed": False
|
|
255
|
+
}
|
|
256
|
+
c_action = consent.get("operation") or consent.get("action")
|
|
257
|
+
if c_action and c_action.lower() != "restore":
|
|
258
|
+
return {
|
|
259
|
+
"status": "ERROR",
|
|
260
|
+
"message": f"Consent operation mismatch: consent granted for '{c_action}', but requested operation is 'restore'.",
|
|
261
|
+
"snapshot_id": clean_id,
|
|
262
|
+
"target_db": target_path,
|
|
263
|
+
"zero_pollution_guaranteed": False
|
|
264
|
+
}
|
|
265
|
+
|
|
207
266
|
if os.path.exists(meta_file):
|
|
208
267
|
try:
|
|
209
268
|
with open(meta_file, "r", encoding="utf-8") as f:
|
|
@@ -388,13 +447,61 @@ class DBSandbox:
|
|
|
388
447
|
def audit_and_purge_pollution(
|
|
389
448
|
self,
|
|
390
449
|
known_test_prefixes: Tuple[str, ...] = ("AUTO_", "TEST_", "TEMP_"),
|
|
391
|
-
dry_run: bool = True
|
|
450
|
+
dry_run: bool = True,
|
|
451
|
+
consent: Any = False
|
|
392
452
|
) -> Dict[str, Any]:
|
|
393
453
|
"""
|
|
394
454
|
Scans all tables for orphan records carrying test prefixes and purges them.
|
|
395
455
|
Properly escapes SQL LIKE wildcards ('_' and '%') with an explicit ESCAPE clause
|
|
396
456
|
to avoid deleting real business data (e.g. 'Automotive', 'Tester', 'Tempest').
|
|
457
|
+
Requires explicit consent bound to target sandbox when dry_run=False.
|
|
397
458
|
"""
|
|
459
|
+
target_path = self.db_path or os.path.join(self.snapshot_dir, "active_test.db")
|
|
460
|
+
if not dry_run:
|
|
461
|
+
has_consent = (
|
|
462
|
+
bool(consent)
|
|
463
|
+
or os.environ.get("SYNAPSE_FORCE_PURGE", "").strip().lower() in ("1", "true", "yes")
|
|
464
|
+
or os.environ.get("SYNAPSE_FORCE_RESTORE", "").strip().lower() in ("1", "true", "yes")
|
|
465
|
+
or os.environ.get("PENTEST_CONSENT_ACKNOWLEDGED", "").strip().lower() in ("1", "true", "yes")
|
|
466
|
+
)
|
|
467
|
+
if not has_consent:
|
|
468
|
+
return {
|
|
469
|
+
"status": "ERROR",
|
|
470
|
+
"message": "Destructive database purge requires explicit consent bound to target sandbox. Pass consent=True, --confirm, or set SYNAPSE_FORCE_PURGE=1.",
|
|
471
|
+
"tables_audited": 0,
|
|
472
|
+
"total_purged_rows": 0,
|
|
473
|
+
"purge_details": [],
|
|
474
|
+
"zero_pollution_achieved": False,
|
|
475
|
+
"dry_run": False
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
# Scoped consent check: ensure consent for Sandbox A cannot be reused to purge Sandbox B
|
|
479
|
+
if isinstance(consent, dict):
|
|
480
|
+
c_target = consent.get("target_sandbox") or consent.get("target_db")
|
|
481
|
+
if c_target:
|
|
482
|
+
norm_c = os.path.realpath(os.path.abspath(c_target)).lower()
|
|
483
|
+
norm_target = os.path.realpath(os.path.abspath(target_path)).lower()
|
|
484
|
+
if norm_c != norm_target:
|
|
485
|
+
return {
|
|
486
|
+
"status": "ERROR",
|
|
487
|
+
"message": f"Consent target sandbox mismatch: consent granted for '{c_target}', but target is '{target_path}'.",
|
|
488
|
+
"tables_audited": 0,
|
|
489
|
+
"total_purged_rows": 0,
|
|
490
|
+
"purge_details": [],
|
|
491
|
+
"zero_pollution_achieved": False,
|
|
492
|
+
"dry_run": False
|
|
493
|
+
}
|
|
494
|
+
c_action = consent.get("operation") or consent.get("action")
|
|
495
|
+
if c_action and c_action.lower() not in ("purge", "audit_and_purge"):
|
|
496
|
+
return {
|
|
497
|
+
"status": "ERROR",
|
|
498
|
+
"message": f"Consent operation mismatch: consent granted for '{c_action}', but requested operation is 'purge'.",
|
|
499
|
+
"tables_audited": 0,
|
|
500
|
+
"total_purged_rows": 0,
|
|
501
|
+
"purge_details": [],
|
|
502
|
+
"zero_pollution_achieved": False,
|
|
503
|
+
"dry_run": False
|
|
504
|
+
}
|
|
398
505
|
if not self.db_path:
|
|
399
506
|
candidate = os.path.join(self.snapshot_dir, "active_test.db")
|
|
400
507
|
if os.path.exists(candidate):
|
|
@@ -601,6 +708,8 @@ def main():
|
|
|
601
708
|
help="Preview test records to purge without deleting (default: True)")
|
|
602
709
|
aud_p.add_argument("--apply", "--force", dest="apply", action="store_true", default=False,
|
|
603
710
|
help="Explicitly apply destructive purge to delete matching test records")
|
|
711
|
+
aud_p.add_argument("--confirm", action="store_true", default=False,
|
|
712
|
+
help="Explicit confirmation for destructive purge operation")
|
|
604
713
|
aud_p.add_argument("--json", action="store_true", help="Output JSON format")
|
|
605
714
|
|
|
606
715
|
# Command: wait-ready (Testcontainers-style readiness gate)
|
|
@@ -668,7 +777,7 @@ def main():
|
|
|
668
777
|
print(f"❌ [DB RESTORE BLOCKED] ID: {args.id}")
|
|
669
778
|
print(f" Error: {err_msg}")
|
|
670
779
|
return 1
|
|
671
|
-
res = sandbox.restore_snapshot(args.id)
|
|
780
|
+
res = sandbox.restore_snapshot(args.id, consent=args.confirm or bool(os.environ.get("SYNAPSE_FORCE_RESTORE")))
|
|
672
781
|
if args.json:
|
|
673
782
|
print(json.dumps(res, indent=2))
|
|
674
783
|
else:
|
|
@@ -700,10 +809,43 @@ def main():
|
|
|
700
809
|
effective_dry_run = True if args.dry_run is None else args.dry_run
|
|
701
810
|
if args.apply:
|
|
702
811
|
effective_dry_run = False
|
|
703
|
-
|
|
812
|
+
|
|
813
|
+
if not effective_dry_run:
|
|
814
|
+
has_confirm = (
|
|
815
|
+
args.confirm
|
|
816
|
+
or os.environ.get("SYNAPSE_FORCE_PURGE", "").strip().lower() in ("1", "true", "yes")
|
|
817
|
+
or os.environ.get("SYNAPSE_FORCE_RESTORE", "").strip().lower() in ("1", "true", "yes")
|
|
818
|
+
or os.environ.get("PENTEST_CONSENT_ACKNOWLEDGED", "").strip().lower() in ("1", "true", "yes")
|
|
819
|
+
)
|
|
820
|
+
if not has_confirm:
|
|
821
|
+
err_msg = (
|
|
822
|
+
"Refusing to execute destructive database purge without explicit confirmation. "
|
|
823
|
+
"Pass --confirm (or set SYNAPSE_FORCE_PURGE=1) if target is an isolated sandbox."
|
|
824
|
+
)
|
|
825
|
+
res = {
|
|
826
|
+
"status": "ERROR",
|
|
827
|
+
"message": err_msg,
|
|
828
|
+
"tables_audited": 0,
|
|
829
|
+
"total_purged_rows": 0,
|
|
830
|
+
"purge_details": [],
|
|
831
|
+
"zero_pollution_achieved": False,
|
|
832
|
+
"dry_run": False
|
|
833
|
+
}
|
|
834
|
+
if args.json:
|
|
835
|
+
print(json.dumps(res, indent=2))
|
|
836
|
+
else:
|
|
837
|
+
print("❌ [DB PURGE BLOCKED]")
|
|
838
|
+
print(f" Error: {err_msg}")
|
|
839
|
+
return 1
|
|
840
|
+
|
|
841
|
+
res = sandbox.audit_and_purge_pollution(dry_run=effective_dry_run, consent=args.confirm)
|
|
704
842
|
if args.json:
|
|
705
843
|
print(json.dumps(res, indent=2))
|
|
706
844
|
else:
|
|
845
|
+
if res.get("status") == "ERROR":
|
|
846
|
+
print("❌ [DB PURGE FAILED]")
|
|
847
|
+
print(f" Error: {res.get('message')}")
|
|
848
|
+
return 1
|
|
707
849
|
action_label = "Previewed" if effective_dry_run else "Purged"
|
|
708
850
|
print(f"🧹 [TAINT POLLUTION AUDIT] {action_label} {res['total_purged_rows']} orphan test records.")
|
|
709
851
|
for detail in res.get("purge_details", []):
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# -*- coding: utf-8 -*-
|
|
6
|
+
"""
|
|
7
|
+
tools/distill_skill.py — Dual-Skill Distillation Engine
|
|
8
|
+
Inspired by titanwings/distilly (26.6k ⭐).
|
|
9
|
+
|
|
10
|
+
Distills unified agent skills and guidelines into two decoupled artifacts:
|
|
11
|
+
1. work_skill.md: Concrete procedures, CLI commands, step sequences, and DoD gates.
|
|
12
|
+
2. persona_skill.md: Cognitive heuristics, identity, communication style, and invariants.
|
|
13
|
+
|
|
14
|
+
Prevents persona drift and execution ambiguity across multi-agent swarms.
|
|
15
|
+
100% Python Standard Library (zero external dependencies).
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import argparse
|
|
19
|
+
import os
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
from typing import Dict, List, Optional, Tuple
|
|
23
|
+
|
|
24
|
+
PERSONA_KEYWORDS = {
|
|
25
|
+
"identity", "role", "tone", "communication", "telemetry", "badge",
|
|
26
|
+
"heuristic", "ruling", "philosophy", "senior dev", "protocol",
|
|
27
|
+
"style", "mindset", "falsification", "anti-pattern", "blacklist",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
PROCEDURE_KEYWORDS = {
|
|
31
|
+
"command", "cli", "run", "step", "execute", "workflow", "script",
|
|
32
|
+
"verification", "dod", "gate", "curl", "test", "matrix", "schema",
|
|
33
|
+
"setup", "install", "teardown", "mutation", "assertion",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def parse_frontmatter(content: str) -> Tuple[Dict[str, str], str]:
|
|
38
|
+
"""Extracts YAML frontmatter if present and returns (frontmatter_dict, remaining_body)."""
|
|
39
|
+
match = re.match(r"^---\s*\n(.*?)\n---\s*\n(.*)$", content, re.DOTALL)
|
|
40
|
+
if not match:
|
|
41
|
+
return {}, content
|
|
42
|
+
|
|
43
|
+
raw_yaml = match.group(1)
|
|
44
|
+
body = match.group(2)
|
|
45
|
+
meta = {}
|
|
46
|
+
for line in raw_yaml.splitlines():
|
|
47
|
+
if ":" in line:
|
|
48
|
+
key, val = line.split(":", 1)
|
|
49
|
+
meta[key.strip()] = val.strip().strip("\"'")
|
|
50
|
+
return meta, body
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def split_markdown_sections(body: str) -> List[Tuple[str, str]]:
|
|
54
|
+
"""Splits markdown content into a list of (heading_title, section_text)."""
|
|
55
|
+
lines = body.splitlines()
|
|
56
|
+
sections: List[Tuple[str, str]] = []
|
|
57
|
+
current_title = "Introduction"
|
|
58
|
+
current_lines: List[str] = []
|
|
59
|
+
in_code_block = False
|
|
60
|
+
|
|
61
|
+
for line in lines:
|
|
62
|
+
stripped = line.strip()
|
|
63
|
+
if stripped.startswith("```"):
|
|
64
|
+
in_code_block = not in_code_block
|
|
65
|
+
|
|
66
|
+
heading_match = re.match(r"^(#{1,3})\s+(.*)$", line)
|
|
67
|
+
if heading_match and not in_code_block:
|
|
68
|
+
if current_lines:
|
|
69
|
+
sections.append((current_title, "\n".join(current_lines)))
|
|
70
|
+
current_lines = []
|
|
71
|
+
current_title = heading_match.group(2).strip()
|
|
72
|
+
current_lines.append(line)
|
|
73
|
+
else:
|
|
74
|
+
current_lines.append(line)
|
|
75
|
+
|
|
76
|
+
if current_lines:
|
|
77
|
+
sections.append((current_title, "\n".join(current_lines)))
|
|
78
|
+
|
|
79
|
+
return sections
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def classify_section(title: str, text: str) -> str:
|
|
83
|
+
"""Classifies a section as 'work', 'persona', or 'shared'."""
|
|
84
|
+
lower_title = title.lower()
|
|
85
|
+
lower_text = text.lower()
|
|
86
|
+
|
|
87
|
+
persona_score = sum(1 for kw in PERSONA_KEYWORDS if kw in lower_title) * 3
|
|
88
|
+
persona_score += sum(1 for kw in PERSONA_KEYWORDS if kw in lower_text)
|
|
89
|
+
|
|
90
|
+
proc_score = sum(1 for kw in PROCEDURE_KEYWORDS if kw in lower_title) * 3
|
|
91
|
+
proc_score += sum(1 for kw in PROCEDURE_KEYWORDS if kw in lower_text)
|
|
92
|
+
|
|
93
|
+
# Code blocks strongly indicate procedural work
|
|
94
|
+
code_blocks = len(re.findall(r"```[a-zA-Z0-9_-]*", text))
|
|
95
|
+
proc_score += code_blocks * 2
|
|
96
|
+
|
|
97
|
+
if persona_score > proc_score * 1.5:
|
|
98
|
+
return "persona"
|
|
99
|
+
if proc_score > persona_score * 1.2:
|
|
100
|
+
return "work"
|
|
101
|
+
return "shared"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def distill_skill(content: str, base_name: str = "agent-skill") -> Tuple[str, str]:
|
|
105
|
+
"""
|
|
106
|
+
Distills skill content into (work_skill_markdown, persona_skill_markdown).
|
|
107
|
+
"""
|
|
108
|
+
meta, body = parse_frontmatter(content)
|
|
109
|
+
sections = split_markdown_sections(body)
|
|
110
|
+
|
|
111
|
+
work_sections: List[str] = []
|
|
112
|
+
persona_sections: List[str] = []
|
|
113
|
+
|
|
114
|
+
for title, text in sections:
|
|
115
|
+
classification = classify_section(title, text)
|
|
116
|
+
if classification == "persona":
|
|
117
|
+
persona_sections.append(text)
|
|
118
|
+
elif classification == "work":
|
|
119
|
+
work_sections.append(text)
|
|
120
|
+
else:
|
|
121
|
+
# Shared: include in both if relevant
|
|
122
|
+
work_sections.append(text)
|
|
123
|
+
persona_sections.append(text)
|
|
124
|
+
|
|
125
|
+
skill_title = meta.get("name", base_name)
|
|
126
|
+
skill_desc = meta.get("description", "Distilled Agent Skill")
|
|
127
|
+
|
|
128
|
+
work_skill_md = (
|
|
129
|
+
f"---\n"
|
|
130
|
+
f"name: {skill_title}-work\n"
|
|
131
|
+
f"description: \"Procedural execution guide for {skill_desc}\"\n"
|
|
132
|
+
f"type: procedural_work_skill\n"
|
|
133
|
+
f"---\n\n"
|
|
134
|
+
f"# {skill_title} — Procedural Work Skill\n\n"
|
|
135
|
+
+ "\n\n".join(work_sections).strip() + "\n"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
persona_skill_md = (
|
|
139
|
+
f"---\n"
|
|
140
|
+
f"name: {skill_title}-persona\n"
|
|
141
|
+
f"description: \"Cognitive heuristics, persona invariants and communication for {skill_desc}\"\n"
|
|
142
|
+
f"type: cognitive_persona_skill\n"
|
|
143
|
+
f"---\n\n"
|
|
144
|
+
f"# {skill_title} — Cognitive Persona Skill\n\n"
|
|
145
|
+
+ "\n\n".join(persona_sections).strip() + "\n"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
return work_skill_md, persona_skill_md
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def distill_file(input_path: str, output_dir: Optional[str] = None) -> Tuple[str, str]:
|
|
152
|
+
"""Reads a file, distills it, and writes work_skill.md & persona_skill.md."""
|
|
153
|
+
if not os.path.isfile(input_path):
|
|
154
|
+
raise FileNotFoundError(f"Input skill file not found: {input_path}")
|
|
155
|
+
|
|
156
|
+
with open(input_path, "r", encoding="utf-8") as f:
|
|
157
|
+
content = f.read()
|
|
158
|
+
|
|
159
|
+
base_name = os.path.splitext(os.path.basename(input_path))[0]
|
|
160
|
+
out_dir = output_dir or os.path.dirname(os.path.abspath(input_path))
|
|
161
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
162
|
+
|
|
163
|
+
work_md, persona_md = distill_skill(content, base_name=base_name)
|
|
164
|
+
|
|
165
|
+
work_path = os.path.join(out_dir, "work_skill.md")
|
|
166
|
+
persona_path = os.path.join(out_dir, "persona_skill.md")
|
|
167
|
+
|
|
168
|
+
with open(work_path, "w", encoding="utf-8") as f:
|
|
169
|
+
f.write(work_md)
|
|
170
|
+
|
|
171
|
+
with open(persona_path, "w", encoding="utf-8") as f:
|
|
172
|
+
f.write(persona_md)
|
|
173
|
+
|
|
174
|
+
return work_path, persona_path
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def main() -> int:
|
|
178
|
+
parser = argparse.ArgumentParser(description="Dual-Skill Distillation Engine (titanwings/distilly pattern)")
|
|
179
|
+
parser.add_argument("input", help="Path to input SKILL.md or guideline file")
|
|
180
|
+
parser.add_argument("--out-dir", default=None, help="Output directory for work_skill.md and persona_skill.md")
|
|
181
|
+
args = parser.parse_args()
|
|
182
|
+
|
|
183
|
+
work_p, persona_p = distill_file(args.input, args.out_dir)
|
|
184
|
+
print("✅ Successfully distilled dual skills:")
|
|
185
|
+
print(f" - Procedural Work Skill: {work_p}")
|
|
186
|
+
print(f" - Cognitive Persona: {persona_p}")
|
|
187
|
+
return 0
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
if __name__ == "__main__":
|
|
191
|
+
sys.exit(main())
|
|
@@ -32,6 +32,14 @@ FORBIDDEN_HUB_PREFIXES = (
|
|
|
32
32
|
"e2e/", "pages/", "cypress/"
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
+
def check_no_verify_attempt(args: list) -> bool:
|
|
36
|
+
"""Block any bypass attempt using --no-verify flag (Inspired by wshobson block-no-verify)."""
|
|
37
|
+
if any(arg in ("--no-verify", "-n") for arg in args):
|
|
38
|
+
print("❌ [CRITICAL SECURITY BLOCKED] Git pre-commit bypass flag (--no-verify / -n) is strictly forbidden in Synapse Hub.")
|
|
39
|
+
print(" All commits must adhere to the 10 DoD Quality Gates without exception.")
|
|
40
|
+
return False
|
|
41
|
+
return True
|
|
42
|
+
|
|
35
43
|
def is_test_script(file_path: str) -> bool:
|
|
36
44
|
"""
|
|
37
45
|
Identifies test scripts across polyglot test frameworks:
|
|
@@ -204,6 +212,10 @@ def main():
|
|
|
204
212
|
print(f" - Pre-push: {pre_push_path} (Auto-runs cache_resolver.py sync on git push)")
|
|
205
213
|
sys.exit(0)
|
|
206
214
|
|
|
215
|
+
# Block --no-verify attempt
|
|
216
|
+
if not check_no_verify_attempt(sys.argv[1:]):
|
|
217
|
+
sys.exit(1)
|
|
218
|
+
|
|
207
219
|
# Get staged files
|
|
208
220
|
res = run_cmd("git diff --cached --name-only")
|
|
209
221
|
staged_files = [f.strip() for f in res.stdout.splitlines() if f.strip()]
|
package/tools/humanize_linter.py
CHANGED
|
@@ -180,6 +180,9 @@ CLICHE_PHRASES: List[Tuple[str, str]] = [
|
|
|
180
180
|
(r"\bwithout further ado\b", "dive directly into technical content"),
|
|
181
181
|
(r"\bi hope this helps\b", "omit conversational fluff"),
|
|
182
182
|
(r"\bhere is the updated code\b", "deliver code directly"),
|
|
183
|
+
(r"\byou(?:'re| are) absolutely right\b", "omit sycophantic praise (Coder rule)"),
|
|
184
|
+
(r"\bi apologize for the confusion\b", "omit conversational apology; state factual fix (Ruff rule)"),
|
|
185
|
+
(r"\bgreat question\b", "omit sycophantic opener; answer directly"),
|
|
183
186
|
]
|
|
184
187
|
|
|
185
188
|
# Words that are fine in isolation, but suspicious when piled up (>= 3 times)
|
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.
|
|
63
|
+
SERVER_VERSION = "4.2.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
|
|
@@ -55,7 +55,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
55
55
|
except Exception:
|
|
56
56
|
pass
|
|
57
57
|
|
|
58
|
-
SERVER_VERSION = "4.
|
|
58
|
+
SERVER_VERSION = "4.2.0"
|
|
59
59
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
60
60
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
61
61
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|