contextl 1.1.1 → 1.1.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/bin/contextl.js +1 -1
- package/package.json +1 -1
- package/python/mcp_server.py +32 -1
package/bin/contextl.js
CHANGED
|
@@ -129,7 +129,7 @@ function launchServer(python) {
|
|
|
129
129
|
throw new Error(`mcp_server.py not found at: ${MCP_SERVER}`);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
const child = spawn(python, [MCP_SERVER], {
|
|
132
|
+
const child = spawn(python, [MCP_SERVER, ...process.argv.slice(2)], {
|
|
133
133
|
stdio: "inherit",
|
|
134
134
|
env: {
|
|
135
135
|
...process.env,
|
package/package.json
CHANGED
package/python/mcp_server.py
CHANGED
|
@@ -16,6 +16,7 @@ Tools exposed:
|
|
|
16
16
|
analyze_impact — find every file affected by changing a target file
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
|
+
import argparse
|
|
19
20
|
import asyncio
|
|
20
21
|
import json
|
|
21
22
|
import sys
|
|
@@ -281,4 +282,34 @@ async def main():
|
|
|
281
282
|
|
|
282
283
|
|
|
283
284
|
if __name__ == "__main__":
|
|
284
|
-
|
|
285
|
+
if len(sys.argv) > 1:
|
|
286
|
+
parser = argparse.ArgumentParser(description="ContextL — Repository Intelligence Engine")
|
|
287
|
+
parser.add_argument("repo_path", help="Path to the repository to query")
|
|
288
|
+
parser.add_argument("query", help="Natural language query")
|
|
289
|
+
parser.add_argument("--top", type=int, default=5, help="Maximum number of files to return")
|
|
290
|
+
parser.add_argument("--json", action="store_true", help="Output results in JSON format")
|
|
291
|
+
|
|
292
|
+
args = parser.parse_args()
|
|
293
|
+
|
|
294
|
+
try:
|
|
295
|
+
result = _run_query(args.repo_path, args.query, args.top)
|
|
296
|
+
|
|
297
|
+
if args.json:
|
|
298
|
+
print(json.dumps(result, indent=2))
|
|
299
|
+
else:
|
|
300
|
+
print(f"\n> Query: {args.query}")
|
|
301
|
+
print(f"> Repository: {args.repo_path}\n")
|
|
302
|
+
|
|
303
|
+
for res in result["results"]:
|
|
304
|
+
print(f"[{res['rank']}] {res['path']}")
|
|
305
|
+
print(f" Score: {res['score']} ({res['confidence']})")
|
|
306
|
+
print(f" Terms: {', '.join(res['matched_terms'])}")
|
|
307
|
+
print(f" Reasoning: {res['reasoning']}\n")
|
|
308
|
+
except Exception as e:
|
|
309
|
+
if args.json:
|
|
310
|
+
print(json.dumps({"error": str(e)}, indent=2))
|
|
311
|
+
else:
|
|
312
|
+
print(f"Error: {str(e)}", file=sys.stderr)
|
|
313
|
+
sys.exit(1)
|
|
314
|
+
else:
|
|
315
|
+
asyncio.run(main())
|