Feature: `--json` for Kiri's own commands (domains, k8s status, machine list, usb list, registry)

Open
#748 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
cli, docker, json, kubernetes, linux, macos, rust
Domain
cli, devtools

Research direction

Start with the CLI argument parsing for kiri domains, kiri k8s status, kiri machine list, kiri usb list and kiri registry, and the daemon report functions the issue names: domains::report(), machine::list() and usb::list(). Add a --json flag that serializes those existing structures as one line of compact JSON, leaving exit codes unchanged. Done when each listed command prints valid JSON under --json and the existing kiri share --json behaviour still holds.

Written by the indexing model from the issue text.

Description

What I would like

kiri share already has --json. The rest of Kiri's own commands print only for a person, which makes them awkward in scripts:

  • kiri domains — parse the port and state out of padded columns
  • kiri k8s status — the context, port and LAN setting
  • kiri machine list — name, distro, state, IP
  • kiri usb list — device, id, tty, name
  • kiri registry insecure list / mirror list
$ kiri domains --json
{"http":{"port":80,"running":true,"serving":true},"https":{"port":443,"running":true,"serving":false}}

Why it is worth it

The window already asks the daemon for JSON (/kiri/domains, /kiri/k8s, …); every script that wants the same information today either scrapes columns or speaks the Docker API directly. CI and setup scripts (and kiri doctor above) would use the same output.

Shape

  • One flag, --json, on each of these; one line of compact JSON, exit code unchanged.
  • The daemon's own report shape is the natural body: domains::report(), machine::list(), usb::list() already return it.

Not implemented here — filing it as a proposal first.

Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
15h 49m
Merged PRs (30d)
241

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.