WingVariables for the win

This commit is contained in:
2026-03-31 16:43:28 -04:00
parent 43f2439f29
commit d590d71421
23 changed files with 269 additions and 964 deletions

View File

@@ -2,7 +2,8 @@
"""
Human-friendly MCP test client.
Usage: ue-wingman.py UserManual
Usage: ue-wingman.py <command> [key=value ...]
ue-wingman.py (reads JSON with "command" from stdin)
"""
import sys
@@ -17,27 +18,28 @@ TIMEOUT = 120
def main():
args = sys.argv[1:]
if not args:
print("Usage: ue-wingman.py ShowCommands [key=value ...]")
sys.exit(1)
no_args_commands = {"ShowCommands", "UserManual"}
if len(args) == 1 and args[0] not in no_args_commands:
# No extra arguments: read JSON object from stdin.
# Accumulate lines and try to parse after each one.
# No arguments: read a complete JSON object from stdin.
# The JSON must already contain a "command" key.
decoder = json.JSONDecoder()
raw = ""
msg = None
for line in sys.stdin:
raw += line
stripped = raw.strip()
try:
msg, _ = decoder.raw_decode(raw.lstrip())
msg, _ = decoder.raw_decode(stripped)
break
except json.JSONDecodeError:
except json.JSONDecodeError as e:
if e.pos < len(stripped):
print(f"Malformed JSON: {e.msg}")
sys.exit(1)
continue
if msg is None:
print("Could not parse a complete JSON object from stdin")
sys.exit(1)
msg["command"] = args[0]
if "command" not in msg:
print("JSON object must contain a \"command\" key")
sys.exit(1)
else:
msg = {"command": args[0]}
for arg in args[1:]: