Want to work on this? Comment .take and it is yours (first comment wins). When your fix is ready, open a PR with Closes #162.
Good first issue. One small, repeated change across three commands. We already use --json elsewhere in the CLI, so there is a pattern to copy.
What's going on
Three CLI commands print a nice table for humans:
voicegw logs
voicegw calls
voicegw projects
Tables are great to read, but you cannot pipe them into another tool. If you want this data from a script (or piped into jq), there is no machine-readable option today.
We add a --json flag to each. With the flag, the command prints raw JSON instead of the table.
What to do
Files:
src/voicegateway/cli/logs_cli.py
src/voicegateway/cli/calls_cli.py
src/voicegateway/cli/projects_cli.py
For each command:
- Add a flag option:
as_json: bool = typer.Option(False, "--json", help="Output raw JSON instead of a table"),
- Right before it builds the Rich
Table, bail out early if the flag is set:
import json
...
if as_json:
print(json.dumps(rows, indent=2, default=str))
return
logs is the easiest place to start: its rows is already a list of dicts (see logs_cli.py, lines 29-31). Do that one first, then calls the same way.
For projects there is no ready-made list, so build one from the config first:
data = [
{"id": pid, "name": p.name, "tags": list(p.tags),
"daily_budget": p.daily_budget, "default_stack": p.default_stack}
for pid, p in sorted(gw.config.projects.items())
]
There is an existing --json option to copy from in src/voicegateway/cli/livekit_cli.py (line 90).
Use plain print(...) for the JSON (not the Rich console), so the output pipes cleanly with no color codes.
How to test
voicegw logs --json | jq .
voicegw calls --json | jq .
voicegw projects --json | jq .
Each should print valid JSON. Without --json, the tables should look exactly as before.
Good first issue. One small, repeated change across three commands. We already use
--jsonelsewhere in the CLI, so there is a pattern to copy.What's going on
Three CLI commands print a nice table for humans:
voicegw logsvoicegw callsvoicegw projectsTables are great to read, but you cannot pipe them into another tool. If you want this data from a script (or piped into
jq), there is no machine-readable option today.We add a
--jsonflag to each. With the flag, the command prints raw JSON instead of the table.What to do
Files:
src/voicegateway/cli/logs_cli.pysrc/voicegateway/cli/calls_cli.pysrc/voicegateway/cli/projects_cli.pyFor each command:
Table, bail out early if the flag is set:logsis the easiest place to start: itsrowsis already a list of dicts (seelogs_cli.py, lines 29-31). Do that one first, thencallsthe same way.For
projectsthere is no ready-made list, so build one from the config first:There is an existing
--jsonoption to copy from insrc/voicegateway/cli/livekit_cli.py(line 90).Use plain
print(...)for the JSON (not the Richconsole), so the output pipes cleanly with no color codes.How to test
Each should print valid JSON. Without
--json, the tables should look exactly as before.