@teevee98/synapse-hub 3.8.3 → 3.8.5

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.
Files changed (54) hide show
  1. package/.agents/rules/author-integrity-guard.md +13 -10
  2. package/.agents/rules/skill-precedence.md +6 -4
  3. package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +1 -1
  4. package/.agents/skills/agentless-qa-repair/SKILL.md +1 -1
  5. package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +22 -2
  6. package/.agents/skills/qa-memory-os/SKILL.md +21 -4
  7. package/.agents/skills/security-dast-sentinel/SKILL.md +1 -1
  8. package/.agents/skills/token-and-context-optimizer/SKILL.md +1 -1
  9. package/.agents/skills/verification-before-completion/SKILL.md +1 -1
  10. package/AGENTS.md +3 -2
  11. package/CLAUDE.md +3 -3
  12. package/README.en.md +9 -9
  13. package/README.md +9 -9
  14. package/agentskills.json +2 -2
  15. package/bin/agent-qa.js +1 -1
  16. package/docs/ARCHITECTURE.en.md +3 -3
  17. package/docs/ARCHITECTURE.md +2 -2
  18. package/docs/CI_CD_INTEGRATION.en.md +6 -6
  19. package/docs/CI_CD_INTEGRATION.md +6 -6
  20. package/docs/CLI_REFERENCE.md +1 -1
  21. package/docs/PERFORMANCE_AUDIT_REPORT.md +1 -1
  22. package/docs/QUALITY_GATES.en.md +1 -1
  23. package/docs/QUALITY_GATES.md +1 -1
  24. package/package.json +1 -1
  25. package/plugin.json +1 -1
  26. package/skills_manifest.json +103 -54
  27. package/synapse.config.json +1 -1
  28. package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +3 -3
  29. package/templates/ai_bridges/CLAUDE.md +3 -3
  30. package/templates/ci/github-actions-synapse.yml +2 -2
  31. package/templates/ci/gitlab-ci-synapse.yml +1 -1
  32. package/templates/ui/index.html +16 -16
  33. package/templates/welcome.html.tmpl +26 -26
  34. package/tools/TOOLS_RUNBOOK.md +8 -8
  35. package/tools/__init__.py +1 -1
  36. package/tools/analyze_project.py +2 -2
  37. package/tools/browser_helpers.js +2 -2
  38. package/tools/bump_version.py +5 -15
  39. package/tools/cli.py +3 -3
  40. package/tools/count_tokens.py +29 -5
  41. package/tools/dashboard_generator.py +12 -12
  42. package/tools/distill_log.py +2 -8
  43. package/tools/fsm_enforcer.py +1 -1
  44. package/tools/hub_publisher.py +38 -0
  45. package/tools/mcp_docx_server.py +1 -1
  46. package/tools/mcp_excel_server.py +1 -1
  47. package/tools/mcp_server.py +1 -1
  48. package/tools/repo_map.py +308 -106
  49. package/tools/setup_project.py +3 -3
  50. package/tools/sync_agent_rules.py +3 -3
  51. package/tools/ui_server.py +1 -1
  52. package/tools/update_sentinel.py +6 -6
  53. package/tools/verify_all.py +10 -5
  54. package/tools/welcome_page.py +2 -2
@@ -93,16 +93,11 @@ def distill(log_text, max_lines=40):
93
93
  if failure_block:
94
94
  captured_failures.append("\n".join(failure_block[:10]))
95
95
 
96
- # Distillation Report
97
- output = []
98
- output.append("======================================================================")
99
- output.append(" 🔍 LOG DISTILLER — AUTOMATED FAILURE TRIAGE SUMMARY ")
100
- output.append("======================================================================")
101
- output.append(f"Total Raw Lines: {total_raw_lines:,} lines analyzed.")
96
+ # Distillation Report (Lean Unix-style format saving ~150 tokens per block)
97
+ output = [f"[LOG DISTILLER] Analyzed {total_raw_lines:,} lines."]
102
98
 
103
99
  if not failing_tcs and not captured_failures:
104
100
  output.append("✅ ALL TESTS PASSED: Zero errors or failed steps detected.")
105
- output.append("======================================================================")
106
101
  return "\n".join(output)
107
102
 
108
103
  if failing_tcs:
@@ -119,7 +114,6 @@ def distill(log_text, max_lines=40):
119
114
  joined_blocks = "\n---\n".join(captured_failures[:3])
120
115
  output.append(joined_blocks[:2000])
121
116
 
122
- output.append("======================================================================")
123
117
  return "\n".join(output)
124
118
 
125
119
  # Public alias for MCP server compatibility
@@ -20,7 +20,7 @@ Usage:
20
20
  python tools/fsm_enforcer.py advance --stage CODE_SYNTHESIS --actor pom-crafter --evidence '{"files": ["LoginPage.ts"]}'
21
21
  python tools/fsm_enforcer.py advance --stage HEADLESS_EXEC --actor test-runner --evidence '{"exit_code": 0}'
22
22
  python tools/fsm_enforcer.py advance --stage AUTOPSY_HEAL --actor failure-analyst --evidence '{"status": "PASSED"}'
23
- python tools/fsm_enforcer.py advance --stage ACCEPTANCE_DOD --actor quality-gatekeeper --evidence '{"gates": 11}'
23
+ python tools/fsm_enforcer.py advance --stage ACCEPTANCE_DOD --actor quality-gatekeeper --evidence '{"gates": 10}'
24
24
  python tools/fsm_enforcer.py verify-compliance
25
25
  """
26
26
 
@@ -484,6 +484,39 @@ def step_4_and_5_monitor_packages_and_npm(owner: str, repo: str, version: str, t
484
484
  return True
485
485
 
486
486
 
487
+ def confirm_release(version: str, owner: str, repo: str, yes: bool = False, dry_run: bool = False) -> bool:
488
+ """
489
+ Prompts for user confirmation before pushing to remote, tagging, or publishing to NPM.
490
+ In interactive sessions, requires explicit 'y' or 'yes' confirmation.
491
+ In non-interactive environments, requires the --yes / --force flag.
492
+ """
493
+ if dry_run or yes:
494
+ return True
495
+
496
+ is_interactive = (
497
+ hasattr(sys.stdin, "isatty")
498
+ and sys.stdin.isatty()
499
+ and not os.environ.get("CI")
500
+ and not os.environ.get("SYNAPSE_NON_INTERACTIVE")
501
+ )
502
+
503
+ if is_interactive:
504
+ try:
505
+ prompt = f"\n⚠️ Are you sure you want to release v{version} to {owner}/{repo} and publish to NPM? [y/N]: "
506
+ choice = input(prompt).strip().lower()
507
+ if choice in ("y", "yes"):
508
+ return True
509
+ print("Release aborted by user.")
510
+ return False
511
+ except (KeyboardInterrupt, EOFError):
512
+ print("\nRelease aborted.")
513
+ return False
514
+
515
+ # In non-interactive environments, require explicit confirmation flag
516
+ log_error("Non-interactive release requires explicit approval flag: --yes (or -y / --force).")
517
+ return False
518
+
519
+
487
520
  def main() -> int:
488
521
  parser = argparse.ArgumentParser(
489
522
  description="Autonomous 1-Click Release & Publishing Pipeline for Synapse Hub"
@@ -496,6 +529,7 @@ def main() -> int:
496
529
  parser.add_argument("--auto-rollback", action="store_true", help="Automatically rollback remote tag and GitHub Release if NPM publication verification fails")
497
530
  parser.add_argument("--rollback", action="store_true", help="Immediately rollback remote tag and GitHub Release for the current version")
498
531
  parser.add_argument("--timeout", type=int, default=180, help="Maximum seconds to wait for npm publication (default 180s)")
532
+ parser.add_argument("--yes", "-y", "--force", dest="yes", action="store_true", help="Confirm release without interactive prompt (required for non-interactive execution)")
499
533
  args = parser.parse_args()
500
534
 
501
535
  print("=" * 68)
@@ -522,6 +556,10 @@ def main() -> int:
522
556
  log_error("Pre-flight verification failed. Pipeline aborted to protect release integrity.")
523
557
  return 1
524
558
 
559
+ # Confirm release before external actions (pushing, tagging, publishing)
560
+ if not confirm_release(version, owner, repo, yes=args.yes, dry_run=args.dry_run):
561
+ return 1
562
+
525
563
  # Stage & Commit
526
564
  if not stage_and_commit_changes(message=args.message, dry_run=args.dry_run):
527
565
  log_error("Failed to prepare clean Git working state.")
@@ -60,7 +60,7 @@ if hasattr(sys.stdout, 'reconfigure'):
60
60
  except Exception:
61
61
  pass
62
62
 
63
- SERVER_VERSION = "3.8.3"
63
+ SERVER_VERSION = "3.8.5"
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 = "3.8.3"
55
+ SERVER_VERSION = "3.8.5"
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
@@ -46,7 +46,7 @@ import gherkin_suite
46
46
  import api_fuzzer
47
47
 
48
48
  SERVER_NAME = "enterprise-agent-qa"
49
- SERVER_VERSION = "3.8.3"
49
+ SERVER_VERSION = "3.8.5"
50
50
 
51
51
  MCP_TOOLS = [
52
52
  {
package/tools/repo_map.py CHANGED
@@ -14,6 +14,8 @@ import sys
14
14
  import re
15
15
  import json
16
16
  import argparse
17
+ import ast
18
+ import copy
17
19
  from datetime import datetime
18
20
 
19
21
  SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -21,14 +23,12 @@ HUB_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
21
23
  OUTPUT_TXT = os.path.join(SCRIPT_DIR, "repo_map.txt")
22
24
  OUTPUT_JSON = os.path.join(SCRIPT_DIR, "repo_map.json")
23
25
 
24
- # Regex patterns for Groovy/Java classes and methods
25
- CLASS_PATTERN = re.compile(r'^\s*(?:public\s+|export\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?', re.MULTILINE)
26
- PY_CLASS_PATTERN = re.compile(r'^\s*class\s+(\w+)(?:\(([^)]*)\))?\s*:', re.MULTILINE)
27
- METHOD_PATTERN = re.compile(
28
- r'^\s*(?:@\w+\s+)*(?:public\s+|protected\s+|private\s+)?(?:static\s+)?(?:async\s+)?(?:def\s+|void\s+|[\w<>\[\],]+\s+)?(\w+)\s*\(([^)]*)\)\s*(?:throws\s+[\w,\s]+)?\s*\{',
26
+ # Regex patterns for Groovy/Java/TS/JS classes and methods
27
+ CLASS_DECL_PATTERN = re.compile(
28
+ r'(?:^|\s)(?:export\s+|public\s+|default\s+|abstract\s+|final\s+)*class\s+([A-Za-z0-9_]+)(?:\s*<[^>]*>)?(?:\s+extends\s+([A-Za-z0-9_]+)(?:<[^>]*>)?)?',
29
29
  re.MULTILINE
30
30
  )
31
- DOC_PATTERN = re.compile(r'/\*\*(.*?)\*/', re.DOTALL)
31
+ CONTROL_KEYWORDS = {"if", "for", "while", "switch", "catch", "synchronized", "constructor"}
32
32
 
33
33
 
34
34
  def resolve_target_repo(cli_target=None, cli_repo=None):
@@ -59,8 +59,282 @@ def resolve_target_repo(cli_target=None, cli_repo=None):
59
59
  return HUB_ROOT
60
60
 
61
61
 
62
+ def strip_comments_and_strings(source_code: str) -> str:
63
+ """Strips comments, string literals, and template strings preserving line numbers and string length."""
64
+ pattern = re.compile(
65
+ r'(?P<BLOCK_COMMENT>/\*[\s\S]*?\*/)|'
66
+ r'(?P<LINE_COMMENT>//[^\r\n]*)|'
67
+ r'(?P<TRIPLE_DOUBLE>"""[\s\S]*?""")|'
68
+ r'(?P<TRIPLE_SINGLE>\'\'\'[\s\S]*?\'\'\')|'
69
+ r'(?P<DOLLAR_SLASHY>\$/[\s\S]*?/\$)|'
70
+ r'(?P<DOUBLE_STRING>"(?:\\.|[^"\\])*")|'
71
+ r'(?P<SINGLE_STRING>\'(?:\\.|[^\'\\])*\')|'
72
+ r'(?P<BACKTICK_STRING>`(?:\\.|[^`\\])*`)',
73
+ re.DOTALL
74
+ )
75
+ return pattern.sub(lambda m: re.sub(r'[^\r\n]', ' ', m.group(0)), source_code)
76
+
77
+
78
+ def clean_param_sig(p: str) -> str:
79
+ """Simplifies parameter list for compact, token-budgeted method signatures."""
80
+ if not p:
81
+ return ""
82
+ params = []
83
+ current = []
84
+ bracket_depth = 0
85
+ for char in p:
86
+ if char in "([<":
87
+ bracket_depth += 1
88
+ current.append(char)
89
+ elif char in ")]>":
90
+ bracket_depth = max(0, bracket_depth - 1)
91
+ current.append(char)
92
+ elif char == "," and bracket_depth == 0:
93
+ params.append("".join(current).strip())
94
+ current = []
95
+ else:
96
+ current.append(char)
97
+ if current:
98
+ params.append("".join(current).strip())
99
+
100
+ res = []
101
+ for item in params:
102
+ if not item:
103
+ continue
104
+ if "=" in item:
105
+ item = item.split("=")[0].strip()
106
+ if ":" in item:
107
+ item = item.split(":")[0].strip()
108
+ parts = item.split()
109
+ if len(parts) > 1:
110
+ item = parts[-1]
111
+ res.append(item)
112
+ return ", ".join(res)
113
+
114
+
115
+ def _extract_classes_py(content: str, rel_path: str, raw_size_bytes: int, line_count: int) -> list:
116
+ """Uses Python built-in AST to extract class definitions and direct methods, ignoring nested local functions."""
117
+ try:
118
+ tree = ast.parse(content)
119
+ except Exception:
120
+ return []
121
+
122
+ classes = []
123
+ for node in tree.body:
124
+ if isinstance(node, ast.ClassDef):
125
+ class_name = node.name
126
+ extends_name = ""
127
+ if node.bases:
128
+ base = node.bases[0]
129
+ if isinstance(base, ast.Name):
130
+ extends_name = base.id
131
+ elif isinstance(base, ast.Attribute):
132
+ extends_name = base.attr
133
+ elif hasattr(ast, "unparse"):
134
+ extends_name = ast.unparse(base)
135
+
136
+ methods = []
137
+ for item in node.body:
138
+ if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)):
139
+ name = item.name
140
+ if name.startswith("__") or name in CONTROL_KEYWORDS:
141
+ continue
142
+ args_copy = copy.deepcopy(item.args)
143
+ if getattr(args_copy, "posonlyargs", None) and args_copy.posonlyargs and args_copy.posonlyargs[0].arg in ("self", "cls"):
144
+ args_copy.posonlyargs.pop(0)
145
+ elif args_copy.args and args_copy.args[0].arg in ("self", "cls"):
146
+ args_copy.args.pop(0)
147
+ raw_params = ast.unparse(args_copy) if hasattr(ast, "unparse") else ""
148
+ doc = ast.get_docstring(item) or ""
149
+ first_doc = doc.strip().splitlines()[0] if doc.strip() else ""
150
+ methods.append({
151
+ "name": name,
152
+ "params": clean_param_sig(re.sub(r'\s+', ' ', raw_params)),
153
+ "comment": first_doc
154
+ })
155
+
156
+ seen = set()
157
+ unique_methods = []
158
+ for meth in methods:
159
+ sig = f"{meth['name']}({meth['params']})"
160
+ if sig not in seen:
161
+ seen.add(sig)
162
+ unique_methods.append(meth)
163
+
164
+ classes.append({
165
+ "rel_path": rel_path,
166
+ "class_name": class_name,
167
+ "extends": extends_name,
168
+ "raw_size_bytes": raw_size_bytes,
169
+ "line_count": line_count,
170
+ "methods": unique_methods
171
+ })
172
+ return classes
173
+
174
+
175
+ def _extract_classes_brace(content: str, rel_path: str, raw_size_bytes: int, line_count: int) -> list:
176
+ """
177
+ Parses TS, JS, Groovy, Java tracking brace depth to only capture methods at direct class body level (depth 1).
178
+ Eliminates false-positive method calls inside function bodies.
179
+ Supports multiple classes per file, multiline method declarations, and multiline class headers.
180
+ """
181
+ clean = strip_comments_and_strings(content)
182
+ orig_lines = content.splitlines()
183
+ clean_lines = clean.splitlines()
184
+ classes = []
185
+
186
+ current_class = None
187
+ pending_class = None
188
+ class_depth = 0
189
+ depth = 0
190
+ pending_method = None
191
+ in_multiline_annotation = False
192
+
193
+ for idx, (orig_line, clean_line) in enumerate(zip(orig_lines, clean_lines)):
194
+ clean_strip = clean_line.strip()
195
+
196
+ # Check for class declaration when not in class
197
+ if current_class is None and pending_class is None:
198
+ m = CLASS_DECL_PATTERN.search(clean_line)
199
+ if m:
200
+ eq_pos = clean_line.find("=")
201
+ cls_pos = m.start()
202
+ if eq_pos == -1 or cls_pos < eq_pos:
203
+ pending_class = {
204
+ "rel_path": rel_path,
205
+ "class_name": m.group(1),
206
+ "extends": m.group(2) or "",
207
+ "raw_size_bytes": raw_size_bytes,
208
+ "line_count": line_count,
209
+ "methods": [],
210
+ "decl_depth": depth
211
+ }
212
+
213
+ if pending_class is not None and current_class is None:
214
+ if not pending_class["extends"]:
215
+ ext_m = re.search(r'\bextends\s+([A-Za-z0-9_]+)', clean_line)
216
+ if ext_m:
217
+ pending_class["extends"] = ext_m.group(1)
218
+ if "{" in clean_line:
219
+ current_class = pending_class
220
+ pending_class = None
221
+ class_depth = current_class["decl_depth"] + 1
222
+
223
+ if current_class is not None:
224
+ # Handle multiline annotations
225
+ if in_multiline_annotation:
226
+ if ")" in clean_strip:
227
+ in_multiline_annotation = False
228
+ clean_strip = clean_strip[clean_strip.find(")") + 1:].strip()
229
+ else:
230
+ clean_strip = ""
231
+
232
+ # Check and strip annotations (e.g. @Keyword(...), @Step(...))
233
+ if clean_strip.startswith("@"):
234
+ open_p = clean_strip.count("(")
235
+ close_p = clean_strip.count(")")
236
+ if open_p > close_p:
237
+ in_multiline_annotation = True
238
+ clean_strip = ""
239
+ else:
240
+ clean_strip = re.sub(r'^\s*@\w+(?:\([^)]*\))?\s*', '', clean_strip).strip()
241
+
242
+ if pending_method is not None:
243
+ # Accumulate multiline parameters
244
+ for char in clean_line:
245
+ if char == "(":
246
+ pending_method["paren_depth"] += 1
247
+ pending_method["param_parts"].append(char)
248
+ elif char == ")":
249
+ pending_method["paren_depth"] -= 1
250
+ if pending_method["paren_depth"] == 0:
251
+ raw_params = "".join(pending_method["param_parts"]).strip()
252
+ current_class["methods"].append({
253
+ "name": pending_method["name"],
254
+ "params": clean_param_sig(re.sub(r'\s+', ' ', raw_params)),
255
+ "comment": pending_method["comment"]
256
+ })
257
+ pending_method = None
258
+ break
259
+ else:
260
+ pending_method["param_parts"].append(char)
261
+ else:
262
+ pending_method["param_parts"].append(char)
263
+
264
+ elif depth == class_depth and clean_strip:
265
+ eq_pos = clean_strip.find("=")
266
+ paren_pos = clean_strip.find("(")
267
+ if paren_pos != -1 and (eq_pos == -1 or paren_pos < eq_pos):
268
+ meth_start_m = re.search(
269
+ r'(?:public\s+|protected\s+|private\s+|static\s+|async\s+|def\s+|void\s+|[\w<>\[\],]+\s+)*([a-zA-Z_]\w*)\s*\(',
270
+ clean_strip
271
+ )
272
+ if meth_start_m:
273
+ name = meth_start_m.group(1)
274
+ if name not in CONTROL_KEYWORDS and name != current_class["class_name"]:
275
+ start_p = meth_start_m.end() - 1
276
+ paren_depth = 0
277
+ param_parts = []
278
+ finished = False
279
+ for char in clean_strip[start_p:]:
280
+ if char == "(":
281
+ paren_depth += 1
282
+ if paren_depth > 1:
283
+ param_parts.append(char)
284
+ elif char == ")":
285
+ paren_depth -= 1
286
+ if paren_depth == 0:
287
+ finished = True
288
+ break
289
+ else:
290
+ param_parts.append(char)
291
+ else:
292
+ param_parts.append(char)
293
+
294
+ comment = ""
295
+ if idx > 0 and orig_lines[idx - 1].strip().startswith("//"):
296
+ comment = orig_lines[idx - 1].strip().lstrip("/ ").strip()
297
+
298
+ if finished:
299
+ raw_params = "".join(param_parts).strip()
300
+ current_class["methods"].append({
301
+ "name": name,
302
+ "params": clean_param_sig(re.sub(r'\s+', ' ', raw_params)),
303
+ "comment": comment
304
+ })
305
+ else:
306
+ pending_method = {
307
+ "name": name,
308
+ "comment": comment,
309
+ "paren_depth": paren_depth,
310
+ "param_parts": param_parts
311
+ }
312
+
313
+ open_braces = clean_line.count("{")
314
+ close_braces = clean_line.count("}")
315
+ depth += (open_braces - close_braces)
316
+
317
+ if depth < class_depth:
318
+ seen = set()
319
+ unique_methods = []
320
+ for meth in current_class["methods"]:
321
+ sig = f"{meth['name']}({meth['params']})"
322
+ if sig not in seen:
323
+ seen.add(sig)
324
+ unique_methods.append(meth)
325
+ current_class["methods"] = unique_methods
326
+ if "decl_depth" in current_class:
327
+ del current_class["decl_depth"]
328
+ classes.append(current_class)
329
+ current_class = None
330
+ class_depth = 0
331
+ pending_method = None
332
+
333
+ return classes
334
+
335
+
62
336
  def extract_class_info(file_path, repo_root=None):
63
- """Parses a Groovy, TypeScript, JavaScript, or Python file and extracts class name and methods."""
337
+ """Parses a Groovy, TypeScript, JavaScript, or Python file and extracts class names and direct methods."""
64
338
  with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
65
339
  content = f.read()
66
340
 
@@ -71,90 +345,15 @@ def extract_class_info(file_path, repo_root=None):
71
345
  rel_path = os.path.abspath(file_path)
72
346
 
73
347
  ext = os.path.splitext(file_path)[1].lower()
74
- methods = []
75
- control_keywords = {"if", "for", "while", "switch", "catch", "synchronized", "constructor"}
348
+ raw_size_bytes = len(content.encode("utf-8"))
349
+ lines = content.splitlines()
350
+ line_count = len(lines)
76
351
 
77
352
  if ext in (".groovy", ".java", ".ts", ".js"):
78
- class_match = CLASS_PATTERN.search(content)
79
- if not class_match:
80
- return None
81
- class_name = class_match.group(1)
82
- extends_name = class_match.group(2) or ""
83
-
84
- lines = content.splitlines()
85
- for idx, line in enumerate(lines):
86
- line_clean = line.strip()
87
- if not line_clean or line_clean.startswith(("//", "/*", "*")):
88
- continue
89
-
90
- if "=" in line_clean:
91
- eq_pos = line_clean.find("=")
92
- paren_pos = line_clean.find("(")
93
- if paren_pos != -1 and eq_pos < paren_pos:
94
- continue
95
-
96
- if "(" in line_clean and ")" in line_clean:
97
- has_brace = "{" in line_clean or (idx + 1 < len(lines) and lines[idx + 1].strip().startswith("{"))
98
- if has_brace:
99
- m = re.search(r'(?:public\s+|protected\s+|private\s+|static\s+|async\s+|def\s+|void\s+|[\w<>\[\],]+\s+)*([a-zA-Z_]\w*)\s*\(([^)]*)\)', line_clean)
100
- if m:
101
- name = m.group(1)
102
- params = m.group(2).strip()
103
- if name not in control_keywords and name != class_name:
104
- comment = ""
105
- if idx > 0 and lines[idx - 1].strip().startswith("//"):
106
- comment = lines[idx - 1].strip().lstrip("/ ").strip()
107
- methods.append({
108
- "name": name,
109
- "params": re.sub(r'\s+', ' ', params),
110
- "comment": comment
111
- })
112
-
353
+ return _extract_classes_brace(content, rel_path, raw_size_bytes, line_count)
113
354
  elif ext == ".py":
114
- class_match = PY_CLASS_PATTERN.search(content)
115
- if not class_match:
116
- return None
117
- class_name = class_match.group(1)
118
- extends_name = class_match.group(2) or ""
119
-
120
- lines = content.splitlines()
121
- for idx, line in enumerate(lines):
122
- line_clean = line.strip()
123
- if line_clean.startswith("def "):
124
- m = re.search(r'def\s+([a-zA-Z_]\w*)\s*\(([^)]*)\):', line_clean)
125
- if m:
126
- name = m.group(1)
127
- params = m.group(2).replace("self,", "").replace("self", "").strip()
128
- if not name.startswith("__") and name not in control_keywords:
129
- comment = ""
130
- if idx + 1 < len(lines) and '"""' in lines[idx + 1]:
131
- comment = lines[idx + 1].replace('"""', '').strip()
132
- methods.append({
133
- "name": name,
134
- "params": re.sub(r'\s+', ' ', params),
135
- "comment": comment
136
- })
137
- else:
138
- return None
139
-
140
- # Deduplicate methods preserving order
141
- seen = set()
142
- unique_methods = []
143
- for meth in methods:
144
- sig = f"{meth['name']}({meth['params']})"
145
- if sig not in seen:
146
- seen.add(sig)
147
- unique_methods.append(meth)
148
-
149
- lines = content.splitlines()
150
- return {
151
- "rel_path": rel_path,
152
- "class_name": class_name,
153
- "extends": extends_name,
154
- "raw_size_bytes": len(content.encode("utf-8")),
155
- "line_count": len(lines),
156
- "methods": unique_methods
157
- }
355
+ return _extract_classes_py(content, rel_path, raw_size_bytes, line_count)
356
+ return []
158
357
 
159
358
 
160
359
  def build_repo_map(target_repo=None, output_txt=None, output_json=None):
@@ -198,36 +397,39 @@ def build_repo_map(target_repo=None, output_txt=None, output_json=None):
198
397
  full_path = os.path.join(root, fname)
199
398
  if full_path not in scanned_files:
200
399
  scanned_files.add(full_path)
201
- info = extract_class_info(full_path, repo_root=repo)
202
- if info and info.get("methods"):
203
- classes.append(info)
204
- total_raw_bytes += info["raw_size_bytes"]
205
- total_raw_lines += info["line_count"]
400
+ file_classes = extract_class_info(full_path, repo_root=repo)
401
+ if isinstance(file_classes, dict):
402
+ file_classes = [file_classes]
403
+ file_counted = False
404
+ for info in (file_classes or []):
405
+ if info and info.get("methods"):
406
+ classes.append(info)
407
+ if not file_counted:
408
+ total_raw_bytes += info["raw_size_bytes"]
409
+ total_raw_lines += info["line_count"]
410
+ file_counted = True
206
411
 
207
412
  # Sort classes: BasePage first, then alphabetical
208
413
  classes.sort(key=lambda c: (0 if c["class_name"] == "BasePage" else 1, c["class_name"]))
209
414
 
210
- # Render text map
415
+ # Render text map (< 500 tokens budget)
211
416
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
417
+ target_name = os.path.basename(repo) or repo
212
418
  out_lines = [
213
- "# ==============================================================================",
214
- "# ENTERPRISE AUTOMATION REPOSITORY MAP (Aider-Style AST Compression)",
215
- f"# Generated : {timestamp}",
216
- f"# Target : {repo}",
217
- f"# Scope : {len(classes)} Classes ({total_raw_lines} source lines, {total_raw_bytes / 1024:.1f} KB)",
218
- "# Purpose : Token-budgeted index (< 600 tokens) for instant method lookup",
219
- "# ==============================================================================\n"
419
+ f"# AST REPO MAP | Target: {target_name} | < 500 tokens\n"
220
420
  ]
221
421
 
222
422
  total_methods = 0
223
423
  for cls in classes:
224
- ext_str = f" extends {cls['extends']}" if cls['extends'] else ""
225
- out_lines.append(f"{cls['rel_path']} ({cls['line_count']} lines)")
226
- out_lines.append(f" class {cls['class_name']}{ext_str}:")
424
+ display_path = cls["rel_path"]
425
+ if display_path.startswith("examples/"):
426
+ display_path = display_path[len("examples/"):]
427
+ ext_str = f" extends {cls['extends']}" if (cls["extends"] and cls["extends"] != "BasePage") else ""
428
+ out_lines.append(f"{display_path} ({cls['line_count']} lines)")
429
+ out_lines.append(f"class {cls['class_name']}{ext_str}:")
227
430
  for m in cls["methods"]:
228
431
  total_methods += 1
229
- cmt = f" # {m['comment']}" if m['comment'] else ""
230
- out_lines.append(f" def {m['name']}({m['params']}){cmt}")
432
+ out_lines.append(f" {m['name']}({m['params']})")
231
433
  out_lines.append("")
232
434
 
233
435
  rendered_text = "\n".join(out_lines)
@@ -248,7 +248,7 @@ elif command -v synapse-hub >/dev/null 2>&1; then
248
248
  elif command -v agent-qa >/dev/null 2>&1; then
249
249
  agent-qa verify
250
250
  elif command -v npx >/dev/null 2>&1; then
251
- npx --no-install synapse-hub verify 2>/dev/null || npx synapse-hub@{pkg_ver} verify
251
+ npx --no-install @teevee98/synapse-hub verify 2>/dev/null || npx @teevee98/synapse-hub@{pkg_ver} verify
252
252
  else
253
253
  echo "\\n[AI-GUARD - REJECTED] No verification engine found (synapse-hub, agent-qa, npx missing)."
254
254
  exit 1
@@ -267,7 +267,7 @@ elif command -v synapse-hub >/dev/null 2>&1; then
267
267
  elif command -v agent-qa >/dev/null 2>&1; then
268
268
  agent-qa analyze
269
269
  elif command -v npx >/dev/null 2>&1; then
270
- npx --no-install synapse-hub analyze 2>/dev/null || npx synapse-hub@{pkg_ver} analyze
270
+ npx --no-install @teevee98/synapse-hub analyze 2>/dev/null || npx @teevee98/synapse-hub@{pkg_ver} analyze
271
271
  fi
272
272
  echo "[AI-GUARD - READY] Pushing to remote...\\n"
273
273
  # --- End Synapse-Hub Quality Gate ---
@@ -388,7 +388,7 @@ def inject_antigravity_global_plugin():
388
388
  """
389
389
  Automatically injects Synapse-Hub into Antigravity's Global Plugin Directory
390
390
  (~/.gemini/config/plugins/synapse-hub).
391
- Ensures that running `npx synapse-hub setup` activates the 53 skills and 9 subagents
391
+ Ensures that running `npx @teevee98/synapse-hub setup` activates the 53 skills and 9 subagents
392
392
  globally across ALL projects in Google Antigravity.
393
393
  """
394
394
  try:
@@ -63,9 +63,9 @@ In accordance with the MIT License, the original copyright notice crediting **Th
63
63
  ---
64
64
 
65
65
  ## ⚡ Quick Commands
66
- - Verify 10 Quality Gates: `npx synapse-hub verify` (or `python tools/verify_all.py`)
67
- - Project Health Audit: `npx synapse-hub analyze` (or `python tools/analyze_project.py`)
68
- - Code Linter & Fake-Pass Sentinel: `npx synapse-hub lint` (or `python tools/infer_linter.py`)
66
+ - Verify 10 Quality Gates: `npx @teevee98/synapse-hub verify` (or `python tools/verify_all.py`)
67
+ - Project Health Audit: `npx @teevee98/synapse-hub analyze` (or `python tools/analyze_project.py`)
68
+ - Code Linter & Fake-Pass Sentinel: `npx @teevee98/synapse-hub lint` (or `python tools/infer_linter.py`)
69
69
  - Verify Author Attribution: `python tools/author_integrity.py`
70
70
  - Skill Security Audit: `python tools/skillspector.py .agents/skills`
71
71
 
@@ -236,7 +236,7 @@ class SynapseUiHandler(BaseHTTPRequestHandler):
236
236
  if path == "/api/status":
237
237
  active_target = JOB_MANAGER.target_dir or REPO_ROOT
238
238
  self.send_json(200, {
239
- "version": "3.8.3",
239
+ "version": "3.8.5",
240
240
  "status": "ONLINE",
241
241
  "os": sys.platform,
242
242
  "workspace": active_target,