synapse-hub 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/rules/author-integrity-guard.md +28 -0
- package/.cursor/rules/agents.mdc +16 -0
- package/.cursor/rules/language.mdc +7 -0
- package/.cursorrules +19 -0
- package/.windsurfrules +18 -0
- package/AGENTS.md +11 -0
- package/CLAUDE.md +25 -0
- package/README.md +28 -26
- package/package.json +5 -1
- package/skills_manifest.json +2 -2
- package/tools/author_integrity.py +34 -1
- package/tools/browser_helpers.js +2 -2
- package/tools/cache_resolver.py +16 -5
- package/tools/cli.py +4 -4
- package/tools/distill_log.py +19 -10
- package/tools/infer_linter.py +45 -15
- package/tools/mcp_excel_server.ps1 +1 -1
- package/tools/mcp_server.py +1 -1
- package/tools/micro_mutator.py +78 -7
- package/tools/repo_map.py +90 -50
- package/tools/setup_project.py +43 -13
- package/tools/skillspector.py +6 -0
- package/tools/verify_all.py +74 -51
package/tools/verify_all.py
CHANGED
|
@@ -132,13 +132,28 @@ def resolve_target_repo(cli_target=None, cli_repo=None):
|
|
|
132
132
|
def gate_0_author_integrity(repo_root, mode="AUTO"):
|
|
133
133
|
print("\n[GATE 0] Running Author Attribution & Anti-Tamper Integrity Guard...")
|
|
134
134
|
try:
|
|
135
|
-
from author_integrity import
|
|
135
|
+
from author_integrity import (
|
|
136
|
+
verify_author_attribution,
|
|
137
|
+
get_canonical_watermark,
|
|
138
|
+
verify_author_fingerprint,
|
|
139
|
+
DEFAULT_REPO_ROOT,
|
|
140
|
+
)
|
|
136
141
|
except ImportError:
|
|
137
142
|
import sys
|
|
138
143
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
139
|
-
from author_integrity import
|
|
144
|
+
from author_integrity import (
|
|
145
|
+
verify_author_attribution,
|
|
146
|
+
get_canonical_watermark,
|
|
147
|
+
verify_author_fingerprint,
|
|
148
|
+
DEFAULT_REPO_ROOT,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# 1. Cryptographic SHA-256 fingerprint verification
|
|
152
|
+
if not verify_author_fingerprint():
|
|
153
|
+
print("[FAIL] Cryptographic author fingerprint mismatch! Original creator ('Thế Vị @TeeVee998') has been tampered with.")
|
|
154
|
+
return False
|
|
140
155
|
|
|
141
|
-
# In HUB mode, verify the Hub repository itself.
|
|
156
|
+
# 2. In HUB mode, verify the Hub repository itself.
|
|
142
157
|
# In TARGET mode, verify the Hub tools root to guarantee engine integrity.
|
|
143
158
|
check_root = repo_root if mode == "HUB" else DEFAULT_REPO_ROOT
|
|
144
159
|
valid, violations = verify_author_attribution(check_root)
|
|
@@ -148,7 +163,7 @@ def gate_0_author_integrity(repo_root, mode="AUTO"):
|
|
|
148
163
|
print(f" • {v}")
|
|
149
164
|
print(" Under MIT License, original author attribution to 'Thế Vị (@TeeVee998)' must be preserved.")
|
|
150
165
|
return False
|
|
151
|
-
print(f"[PASS] Author Attribution &
|
|
166
|
+
print(f"[PASS] Author Attribution & Cryptographic Provenance verified intact: {get_canonical_watermark()}")
|
|
152
167
|
return True
|
|
153
168
|
|
|
154
169
|
|
|
@@ -222,43 +237,42 @@ def gate_2_path_portability(repo_root, mode="AUTO"):
|
|
|
222
237
|
|
|
223
238
|
|
|
224
239
|
def gate_3_clean_pom(repo_root, mode="AUTO"):
|
|
225
|
-
print("\n[GATE 3] Checking Clean POM & Flat Architecture in Scripts
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
print("\n[GATE 3] Checking Clean POM & Flat Architecture in Test Scripts...")
|
|
241
|
+
effective_mode = detect_repo_mode(repo_root) if mode == "AUTO" else mode
|
|
242
|
+
if effective_mode == "HUB":
|
|
243
|
+
print("[PASS] Hub Mode: Repository contains QA Hub assets; Clean POM applies to target test suites.")
|
|
244
|
+
return True
|
|
245
|
+
|
|
246
|
+
test_dirs = ["Scripts", "tests", "test", "e2e", "specs", "cypress"]
|
|
247
|
+
test_files = []
|
|
248
|
+
for td in test_dirs:
|
|
249
|
+
d = os.path.join(repo_root, td)
|
|
250
|
+
if os.path.isdir(d):
|
|
251
|
+
for ext in ("*.groovy", "*.ts", "*.js", "*.py", "*.java"):
|
|
252
|
+
test_files.extend(glob.glob(os.path.join(d, "**", ext), recursive=True))
|
|
253
|
+
|
|
254
|
+
if not test_files:
|
|
255
|
+
print("[SKIP] No test scripts present in candidate directories (Scripts/, tests/, e2e/).")
|
|
256
|
+
return True
|
|
240
257
|
|
|
241
258
|
violations = []
|
|
242
|
-
for
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
violations.append((rel_path, line_no, "Raw XPath"))
|
|
257
|
-
except Exception:
|
|
258
|
-
pass
|
|
259
|
+
for full_path in sorted(set(test_files)):
|
|
260
|
+
rel_path = os.path.relpath(full_path, repo_root)
|
|
261
|
+
try:
|
|
262
|
+
with open(full_path, "r", encoding="utf-8", errors="ignore") as fp:
|
|
263
|
+
for line_no, line in enumerate(fp, 1):
|
|
264
|
+
stripped = line.strip()
|
|
265
|
+
if stripped.startswith("//") or stripped.startswith("/*") or stripped.startswith("#"):
|
|
266
|
+
continue
|
|
267
|
+
if "findTestObject" in line:
|
|
268
|
+
violations.append((rel_path, line_no, "Raw findTestObject"))
|
|
269
|
+
if "//" in line and ("//table" in line or "//input" in line or "//button" in line):
|
|
270
|
+
violations.append((rel_path, line_no, "Raw XPath"))
|
|
271
|
+
except Exception:
|
|
272
|
+
pass
|
|
259
273
|
|
|
260
274
|
if violations:
|
|
261
|
-
print(f"[FAIL] {len(violations)} Clean POM violations in
|
|
275
|
+
print(f"[FAIL] {len(violations)} Clean POM violations in test scripts:")
|
|
262
276
|
for rel_path, line_no, reason in violations:
|
|
263
277
|
print(f" - {rel_path}:{line_no} ({reason})")
|
|
264
278
|
return False
|
|
@@ -389,26 +403,35 @@ def gate_6_credential_security(repo_root, mode="AUTO"):
|
|
|
389
403
|
|
|
390
404
|
def gate_7_infer_linter(repo_root, mode="AUTO"):
|
|
391
405
|
print("\n[GATE 7] Running Meta Infer-Style Static Defect & Fake-Pass Sentinel...")
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
406
|
+
effective_mode = detect_repo_mode(repo_root) if mode == "AUTO" else mode
|
|
407
|
+
if effective_mode == "HUB":
|
|
408
|
+
print("[PASS] Hub Mode: Static Defect Sentinel active for target projects.")
|
|
409
|
+
return True
|
|
410
|
+
|
|
411
|
+
test_dirs = ["Scripts", "tests", "test", "e2e", "specs", "cypress"]
|
|
412
|
+
has_tests = False
|
|
413
|
+
target_scan_dir = None
|
|
414
|
+
for td in test_dirs:
|
|
415
|
+
d = os.path.join(repo_root, td)
|
|
416
|
+
if os.path.isdir(d):
|
|
417
|
+
for ext in ("*.groovy", "*.ts", "*.js", "*.py", "*.java"):
|
|
418
|
+
if glob.glob(os.path.join(d, "**", ext), recursive=True):
|
|
419
|
+
has_tests = True
|
|
420
|
+
target_scan_dir = d
|
|
421
|
+
break
|
|
422
|
+
if has_tests:
|
|
423
|
+
break
|
|
424
|
+
|
|
425
|
+
if not has_tests:
|
|
426
|
+
print("[SKIP] No test scripts (Groovy/TS/JS/Py) present in candidate test directories.")
|
|
427
|
+
return True
|
|
405
428
|
|
|
406
429
|
infer_script = os.path.join(SCRIPT_DIR, "infer_linter.py")
|
|
407
430
|
if not os.path.exists(infer_script):
|
|
408
431
|
infer_script = os.path.join(repo_root, "tools", "infer_linter.py")
|
|
409
432
|
|
|
410
433
|
if os.path.exists(infer_script):
|
|
411
|
-
res = subprocess.run([sys.executable, infer_script, "--dir",
|
|
434
|
+
res = subprocess.run([sys.executable, infer_script, "--dir", target_scan_dir], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
412
435
|
if res.returncode != 0:
|
|
413
436
|
print("[FAIL] Static Defect Sentinel detected critical issues in test scripts:")
|
|
414
437
|
print(res.stdout)
|