Skip to content

Commit b9ec597

Browse files
committed
remove cross stomp, and shebang corrected
1 parent a81534f commit b9ec597

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

scripts/ctx.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
#!/usr/bin/env python3
12
import re
23
import difflib
3-
4-
#!/usr/bin/env python3
54
"""
65
Context-aware prompt enhancer CLI.
76
@@ -156,9 +155,11 @@ def call_mcp_tool(tool_name: str, params: Dict[str, Any], timeout: int = 30) ->
156155
"params": {"name": tool_name, "arguments": params}
157156
}
158157

159-
# Debug output
160-
sys.stderr.write(f"[DEBUG] Sending payload: {json.dumps(payload, indent=2)}\n")
161-
sys.stderr.flush()
158+
# Debug output (opt-in to avoid leaking queries in normal use)
159+
debug_flag = os.environ.get("CTX_DEBUG", "").strip().lower()
160+
if debug_flag in {"1", "true", "yes", "on"}:
161+
sys.stderr.write(f"[DEBUG] Sending payload: {json.dumps(payload, indent=2)}\n")
162+
sys.stderr.flush()
162163

163164
try:
164165
return call_tool_http(MCP_URL, tool_name, params, timeout=float(timeout))

scripts/mcp_indexer_server.py

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3531,35 +3531,25 @@ def _maybe_dict(val: Any) -> Dict[str, Any]:
35313531

35323532
model_name = os.environ.get("EMBEDDING_MODEL", "BAAI/bge-base-en-v1.5")
35333533
model = _get_embedding_model(model_name)
3534-
prev_coll = os.environ.get("COLLECTION_NAME")
3535-
try:
3536-
os.environ["COLLECTION_NAME"] = coll
3537-
items2 = run_hybrid_search(
3538-
queries=queries,
3539-
limit=int(code_limit),
3540-
per_path=int(per_path_val),
3541-
language=language or None,
3542-
under=under or None,
3543-
kind=kind or None,
3544-
symbol=symbol or None,
3545-
ext=ext or None,
3546-
not_filter=not_ or None,
3547-
case=case or None,
3548-
path_regex=path_regex or None,
3549-
path_glob=path_glob or None,
3550-
not_glob=not_glob or None,
3551-
expand=str(os.environ.get("HYBRID_EXPAND", "0")).strip().lower()
3552-
in {"1", "true", "yes", "on"},
3553-
model=model,
3554-
)
3555-
finally:
3556-
if prev_coll is None:
3557-
try:
3558-
del os.environ["COLLECTION_NAME"]
3559-
except Exception:
3560-
pass
3561-
else:
3562-
os.environ["COLLECTION_NAME"] = prev_coll
3534+
items2 = run_hybrid_search(
3535+
queries=queries,
3536+
limit=int(code_limit),
3537+
per_path=int(per_path_val),
3538+
language=language or None,
3539+
under=under or None,
3540+
kind=kind or None,
3541+
symbol=symbol or None,
3542+
ext=ext or None,
3543+
not_filter=not_ or None,
3544+
case=case or None,
3545+
path_regex=path_regex or None,
3546+
path_glob=path_glob or None,
3547+
not_glob=not_glob or None,
3548+
expand=str(os.environ.get("HYBRID_EXPAND", "0")).strip().lower()
3549+
in {"1", "true", "yes", "on"},
3550+
model=model,
3551+
collection=coll,
3552+
)
35633553
if isinstance(items2, list):
35643554
for obj in items2:
35653555
if isinstance(obj, dict):

0 commit comments

Comments
 (0)