java-codebase-rag 0.1.0__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.
- ast_java.py +2813 -0
- brownfield_events.py +58 -0
- build_ast_graph.py +3081 -0
- chunk_heuristics.py +62 -0
- graph_enrich.py +1681 -0
- index_common.py +10 -0
- java_codebase_rag/__init__.py +1 -0
- java_codebase_rag/cli.py +761 -0
- java_codebase_rag/cli_progress.py +52 -0
- java_codebase_rag/config.py +327 -0
- java_codebase_rag/pipeline.py +189 -0
- java_codebase_rag-0.1.0.dist-info/METADATA +818 -0
- java_codebase_rag-0.1.0.dist-info/RECORD +27 -0
- java_codebase_rag-0.1.0.dist-info/WHEEL +5 -0
- java_codebase_rag-0.1.0.dist-info/entry_points.txt +3 -0
- java_codebase_rag-0.1.0.dist-info/licenses/LICENSE +21 -0
- java_codebase_rag-0.1.0.dist-info/top_level.txt +17 -0
- java_index_flow_lancedb.py +398 -0
- java_index_v1_common.py +33 -0
- java_ontology.py +446 -0
- kuzu_queries.py +1989 -0
- mcp_hints.py +748 -0
- mcp_v2.py +1957 -0
- path_filtering.py +472 -0
- pr_analysis.py +534 -0
- search_lancedb.py +1075 -0
- server.py +578 -0
brownfield_events.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Structured stderr events for brownfield extraction (PR-1 scaffolding; PR-2 wiring).
|
|
2
|
+
|
|
3
|
+
Each call emits one JSON object on a single line to sys.stderr. MCP stdio servers
|
|
4
|
+
must not use this module from tool handlers — graph build / AST paths only.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import sys
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
_VALID_SEVERITIES = frozenset({"INFO", "WARN"})
|
|
13
|
+
_VALID_EVENTS = frozenset(
|
|
14
|
+
{
|
|
15
|
+
"brownfield-exclusivity-shadowing",
|
|
16
|
+
"brownfield-method-string-literal",
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def emit_structured_brownfield_event(
|
|
22
|
+
event_id: str,
|
|
23
|
+
severity_level: str,
|
|
24
|
+
**fields: Any,
|
|
25
|
+
) -> None:
|
|
26
|
+
"""Emit one JSON line to stderr with keys ``event`` and ``severity`` plus ``**fields``.
|
|
27
|
+
|
|
28
|
+
Parameters are named ``event_id`` / ``severity_level`` so ``**fields`` may contain
|
|
29
|
+
keys ``event`` or ``severity`` without a caller TypeError; those keys never override
|
|
30
|
+
the canonical record (reserved keys are merged last).
|
|
31
|
+
"""
|
|
32
|
+
if severity_level not in _VALID_SEVERITIES:
|
|
33
|
+
raise ValueError(
|
|
34
|
+
f"severity must be one of {_VALID_SEVERITIES}, got {severity_level!r}"
|
|
35
|
+
)
|
|
36
|
+
if event_id not in _VALID_EVENTS:
|
|
37
|
+
raise ValueError(f"event must be one of {_VALID_EVENTS}, got {event_id!r}")
|
|
38
|
+
# Fields first so JSON ``event`` / ``severity`` always match event_id / severity_level.
|
|
39
|
+
payload = {**fields, "event": event_id, "severity": severity_level}
|
|
40
|
+
print(json.dumps(payload, ensure_ascii=False), file=sys.stderr, flush=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def emit_brownfield_exclusivity_shadowing(**fields: Any) -> None:
|
|
44
|
+
"""INFO: brownfield HTTP annotation co-present with shadowable framework annotations."""
|
|
45
|
+
emit_structured_brownfield_event(
|
|
46
|
+
"brownfield-exclusivity-shadowing",
|
|
47
|
+
"INFO",
|
|
48
|
+
**fields,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def emit_brownfield_method_string_literal(**fields: Any) -> None:
|
|
53
|
+
"""WARN: HTTP client/route `method` still a string literal (migration / misuse)."""
|
|
54
|
+
emit_structured_brownfield_event(
|
|
55
|
+
"brownfield-method-string-literal",
|
|
56
|
+
"WARN",
|
|
57
|
+
**fields,
|
|
58
|
+
)
|