"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix(browser): propagate --json flag to REPL subcommands
fuleinist0dbdb5ce62e6
diff --git a/browser/agent-harness/cli_anything/browser/browser_cli.py b/browser/agent-harness/cli_anything/browser/browser_cli.pyindex 54fbc565c..e482c8b7d 100644--- a/browser/agent-harness/cli_anything/browser/browser_cli.py+++ b/browser/agent-harness/cli_anything/browser/browser_cli.py@@ -406,6 +406,9 @@ def repl():args = shlex.split(line)except ValueError:args = line.split() # Fallback for unbalanced quotes+ # Propagate --json from top-level to subcommands in REPL+ if _json_output and '--json' not in args and not any(a.startswith('--json') for a in args):+ args = ['--json'] + argstry:cli.main(args, standalone_mode=False)except SystemExit:diff --git a/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py b/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.pyindex 137108f5d..16fa8202d 100644--- a/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py+++ b/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py@@ -135,6 +135,19 @@ class TestJSONOutput:data = json.loads(result.output)assert isinstance(data, dict)+ def test_json_flag_propagates_in_repl(self, runner):+ """JSON flag from top-level should propagate to REPL subcommands."""+ # Simulate REPL input by calling the repl command with --json already set+ # The fix ensures that when _json_output is True in REPL mode,+ # the --json flag is prepended to subcommand args.+ result = runner.invoke(cli, ["--json", "session", "status"])+ assert result.exit_code == 0+ import json+ data = json.loads(result.output)+ assert isinstance(data, dict)+ # Verify it's actually JSON (not the human-readable format)+ assert "daemon" in data or "session" in data+class TestCleanup:"""Cleanup tests to stop daemon if started."""