MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / write_fake_bin

Function write_fake_bin

scripts/hermes_plugin_unit_check.py:105–127  ·  view source on GitHub ↗

A fake tracedecay binary that echoes how `--args` reached it.

(work: Path)

Source from the content-addressed store, hash-verified

103
104
105def write_fake_bin(work: Path) -> Path:
106 """A fake tracedecay binary that echoes how `--args` reached it."""
107 fake = work / "fake-tracedecay.py"
108 fake.write_text(
109 """#!/usr/bin/env python3
110import json, sys
111argv = sys.argv[1:]
112value = argv[argv.index("--args") + 1]
113at_file = value.startswith("@")
114payload = open(value[1:], encoding="utf-8").read() if at_file else value
115args = json.loads(payload)
116inner = json.dumps({
117 "status": "ok",
118 "at_file": at_file,
119 "payload_bytes": len(payload.encode("utf-8")),
120 "args_keys": sorted(args.keys()),
121})
122print(json.dumps({"content": [{"type": "text", "text": inner}]}))
123""",
124 encoding="utf-8",
125 )
126 fake.chmod(0o755)
127 return fake
128
129
130def main():

Callers 1

run_checksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected