From 085133e1b87d56edc9f0542ea830ca0a385204c0 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sun, 11 Oct 2026 14:57:58 +0300 Subject: feat: mypy action --- actions.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actions.py') diff --git a/actions.py b/actions.py index dfeebc3..589dd51 100644 --- a/actions.py +++ b/actions.py @@ -106,6 +106,20 @@ def _shell(args: JSON, config: AgentConfig) -> JSON: } +def _mypy(args: JSON, config: AgentConfig) -> JSON: + '{"action": "mypy", "path": PATH} - run mypy type checking on PATH' + try: + res = subprocess.run( + ["mypy", args["path"]], + cwd=config.workdir, + capture_output=True, + text=True, + ) + return {"status": "success", "stdout": res.stdout, "stderr": res.stderr} + except Exception as e: + return {"status": "error", "reason": f"An unexpected error occurred: {e}"} + + ls = Action("ls", _ls.__doc__ or "", _ls) read = Action("read", _read.__doc__ or "", _read) write = Action( @@ -121,3 +135,4 @@ shell = Action( _shell, formatter=lambda args: f"shell command `{args['command']}`", ) +mypy = Action("mypy", _mypy.__doc__ or "", _mypy) -- cgit v1.3.1