sourcecode 1.31.2__py3-none-any.whl → 1.31.3__py3-none-any.whl

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.
sourcecode/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """sourcecode — Deterministic codebase context maps for AI coding agents."""
2
2
 
3
- __version__ = "1.31.2"
3
+ __version__ = "1.31.3"
sourcecode/cli.py CHANGED
@@ -2467,6 +2467,8 @@ def _extract_java_endpoints(root: "Path") -> "dict[str, Any]":
2467
2467
  _CLASS_PATH_RE = _re.compile(
2468
2468
  r'@RequestMapping\s*\(\s*(?:value\s*=\s*)?["\']([^"\']+)["\']',
2469
2469
  )
2470
+ _REQUEST_METHOD_VERB_RE = _re.compile(r'method\s*=\s*RequestMethod\.([A-Z]+)')
2471
+ _VALUE_PATH_RE = _re.compile(r'value\s*=\s*"([^"]+)"')
2470
2472
 
2471
2473
  _HTTP_METHOD_MAP = {
2472
2474
  "Get": "GET", "Post": "POST", "Put": "PUT",
@@ -2502,12 +2504,24 @@ def _extract_java_endpoints(root: "Path") -> "dict[str, Any]":
2502
2504
  cls_m = _CLASS_RE.search(content)
2503
2505
  class_name = cls_m.group(1) if cls_m else java_file.stem
2504
2506
 
2505
- # Extract class-level base path from @RequestMapping on the class
2507
+ # Extract class-level base path and locate class body start
2506
2508
  class_base = ""
2507
2509
  lines = content.splitlines()
2510
+
2511
+ # First pass: find class/interface declaration line index
2512
+ class_body_start = 0
2508
2513
  for i, line in enumerate(lines):
2509
- if "@RequestMapping" in line and i < len(lines) - 1:
2510
- # Check if next non-blank line is class declaration or it's on same block
2514
+ stripped_l = line.strip()
2515
+ if (not stripped_l.startswith("//") and not stripped_l.startswith("*")
2516
+ and ("class " in stripped_l or "interface " in stripped_l)
2517
+ and _CLASS_RE.search(stripped_l)):
2518
+ class_body_start = i + 1
2519
+ break
2520
+
2521
+ # Second pass: extract class-level @RequestMapping path (only before class body)
2522
+ search_end = class_body_start if class_body_start else len(lines)
2523
+ for i in range(search_end):
2524
+ if "@RequestMapping" in lines[i]:
2511
2525
  block = "\n".join(lines[max(0, i - 1): i + 5])
2512
2526
  if "class " in block or "interface " in block:
2513
2527
  path_m = _CLASS_PATH_RE.search(block)
@@ -2515,12 +2529,13 @@ def _extract_java_endpoints(root: "Path") -> "dict[str, Any]":
2515
2529
  class_base = path_m.group(1).rstrip("/")
2516
2530
  break
2517
2531
 
2518
- # Extract method-level endpoints
2519
- # Parse line-by-line to associate annotations with methods
2532
+ # Extract method-level endpoints starting from inside class body
2533
+ # (skipping class-level annotations that appear before the class declaration)
2520
2534
  pending_annotations: list[tuple[str, str]] = [] # (http_verb, path_suffix)
2521
2535
  pending_filtro: Optional[str] = None
2522
2536
 
2523
- for i, line in enumerate(lines):
2537
+ for i in range(class_body_start, len(lines)):
2538
+ line = lines[i]
2524
2539
  stripped = line.strip()
2525
2540
 
2526
2541
  # Check for @M3FiltroSeguridad
@@ -2535,6 +2550,19 @@ def _extract_java_endpoints(root: "Path") -> "dict[str, Any]":
2535
2550
  verb_key = hm.group(1)
2536
2551
  http_verb = _HTTP_METHOD_MAP.get(verb_key, "GET")
2537
2552
  path_suffix = (hm.group(2) or "").strip()
2553
+
2554
+ # For @RequestMapping: resolve HTTP method from method= attribute
2555
+ if verb_key == "Request":
2556
+ annotation_block = "\n".join(lines[i:min(i + 5, len(lines))])
2557
+ vm = _REQUEST_METHOD_VERB_RE.search(annotation_block)
2558
+ if vm:
2559
+ http_verb = vm.group(1)
2560
+ # If path not captured (method= precedes value=), try value= extraction
2561
+ if not path_suffix:
2562
+ vp = _VALUE_PATH_RE.search(annotation_block)
2563
+ if vp:
2564
+ path_suffix = vp.group(1)
2565
+
2538
2566
  pending_annotations.append((http_verb, path_suffix))
2539
2567
  continue
2540
2568
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 1.31.2
3
+ Version: 1.31.3
4
4
  Summary: Deterministic codebase context for AI coding agents
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -225,7 +225,7 @@ Description-Content-Type: text/markdown
225
225
 
226
226
  **Deterministic, behavior-aware codebase context for AI agents and PR review.**
227
227
 
228
- ![Version](https://img.shields.io/badge/version-1.31.2-blue)
228
+ ![Version](https://img.shields.io/badge/version-1.31.3-blue)
229
229
  ![Python](https://img.shields.io/badge/python-3.10%2B-green)
230
230
 
231
231
  ---
@@ -261,7 +261,7 @@ pipx install sourcecode
261
261
 
262
262
  ```bash
263
263
  sourcecode version
264
- # sourcecode 1.31.2
264
+ # sourcecode 1.31.3
265
265
  ```
266
266
 
267
267
  ---
@@ -1,10 +1,10 @@
1
- sourcecode/__init__.py,sha256=BlIGNpIZ2KvAHJhMqzRGPET0plDw5AYOTlGs0F8h4hU,103
1
+ sourcecode/__init__.py,sha256=Zwj-cw3HMz8MfEorZc3F97_v2iTtVJkQvukyDMDifCo,103
2
2
  sourcecode/adaptive_scanner.py,sha256=XffluXKzJUXrMtjEiAOnSNPZnztdIcts17T9ouHeID0,10521
3
3
  sourcecode/architecture_analyzer.py,sha256=MyBa0Hf5HmkudZQDLKrjcWDKETXETXl0mQX1swtTwAA,39091
4
4
  sourcecode/architecture_summary.py,sha256=z34_6v7cSwy98cof2UVciGho7SCrZ93tiqMmq5WNzRQ,20405
5
5
  sourcecode/ast_extractor.py,sha256=XgrZg2DcWcUm9r87cRG3KGO7IK2TIL_N-CvhSbUmmh4,49901
6
6
  sourcecode/classifier.py,sha256=-0t0HLc9L9UleMLfclfLM3AXhBjUb_AYyBPDbvgWtac,7755
7
- sourcecode/cli.py,sha256=qYMuo7DY6erJD5HwjU1Rot07xR54kXil4YzVytyU1Po,120897
7
+ sourcecode/cli.py,sha256=GPVCT1u_Ouhxb2louOgU7gUN_Fil5xLyrWsUCD0qzGM,122301
8
8
  sourcecode/code_notes_analyzer.py,sha256=y1MJBnPZHYp4i6cQCXUb9ATIyifS_qMQWjw_8lPkpsU,9215
9
9
  sourcecode/confidence_analyzer.py,sha256=ZUn-Nywi5TEQcuozqK_vfOyPT-a1dYYO42elAtVFV-k,16412
10
10
  sourcecode/context_scorer.py,sha256=QpChSpsmaAYz91rXA4Ue5xzQmNz_ZboZN09YOHScq1U,14679
@@ -72,8 +72,8 @@ sourcecode/telemetry/consent.py,sha256=wLMvGNJeSSyZoNkQXpoUioY6mMv4Qdvuw7S9jAEWn
72
72
  sourcecode/telemetry/events.py,sha256=oEvvulfsv5GIDWG2174gSS6tNB95w38AIYiYeifGKlE,2294
73
73
  sourcecode/telemetry/filters.py,sha256=Asa71oRl7q3Wt_FMwuufIZJFzSYdgRNKS8LHCIyFeYE,4805
74
74
  sourcecode/telemetry/transport.py,sha256=KJeIPCPWMdmbCP3ySGs2iUlia34U6vWne2dZsUezesw,1560
75
- sourcecode-1.31.2.dist-info/METADATA,sha256=CaHPC5ti8mv3vU8hOaq1vV5lvAHw8kPIH4IEvbk3x2k,29083
76
- sourcecode-1.31.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
77
- sourcecode-1.31.2.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
78
- sourcecode-1.31.2.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
79
- sourcecode-1.31.2.dist-info/RECORD,,
75
+ sourcecode-1.31.3.dist-info/METADATA,sha256=qkeU1Wlk-c1QwoQib99ICFezeqXS7XsFUnvf2uS4wj0,29083
76
+ sourcecode-1.31.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
77
+ sourcecode-1.31.3.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
78
+ sourcecode-1.31.3.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
79
+ sourcecode-1.31.3.dist-info/RECORD,,