Skip to content

Add CLI commands to start, stop and inspect the Kiri engine #983

Done

Description

@mona-chen

What you're trying to do

I'm trying to manage the Kiri engine lifecycle entirely from the CLI without having to open the GUI.

I ran into this limitation while debugging a networking conflict between Kiri and Cloudflare WARP on macOS.

When Kiri's engine is running, macOS's mDNSResponder binds UDP port 53 while the VM network (bridge100 / vmenet0) is active. This prevents WARP from connecting in its default DNS Proxy mode.

WARP reports the following error:

Ports potentially in conflict: [mDNSResponder -> 0.0.0.0:53]

UdpAddressNotAvailable {
  bound_processes: Some(["mDNSResponder"])
}

Turning off the engine through Settings → Resources → Turn off engine resolves the conflict immediately. The VM network interfaces disappear, port 53 becomes available, and WARP connects successfully.

However, there doesn't appear to be an equivalent CLI command.

  • kiri stop only stops containers.
  • Killing the daemon causes launchd to restart it due to its KeepAlive configuration.
  • Using launchctl bootout is not persistent, as launching the Kiri application re-registers the LaunchAgent.

The GUI already handles this correctly, stopping the VM while keeping the daemon alive and preserving the engine-off state until explicitly started again.

Beyond this particular networking conflict, being able to manage the engine from the CLI would be useful for automation, headless workflows and third-party integrations.

Environment: Kiri 0.2.2, macOS 26.4 (25E246), Apple silicon (arm64).

What you'd like Kiri to do

Expose the existing engine lifecycle controls through dedicated CLI commands, for example:

kiri engine start
kiri engine stop
kiri engine restart
kiri engine status

Alternatively, these could be exposed under kiri daemon, depending on the preferred CLI structure.

Ideally, these commands should:

  • Use the same underlying mechanism as the existing GUI engine controls.
  • Gracefully stop running containers and the VM without terminating the daemon.
  • Preserve the engine-off state until explicitly started again.
  • Keep the GUI and CLI engine states synchronised.
  • Return meaningful exit codes for scripting and automation.
  • Optionally support --json output for programmatic status checks.

Docker Desktop provides a similar interface through its docker desktop start, docker desktop stop, docker desktop restart and docker desktop status commands.

Since Kiri already supports engine lifecycle management through the GUI, exposing the same functionality through the CLI would be a welcome addition, particularly for users who prefer terminal-based workflows or want to integrate Kiri into other tools.

Would you like to build it?

Yes, once we've agreed on the approach

Activity

  1. added
    enhancement
    on Nov 26, 2026
  2. vorlaxen commented on Nov 26, 2026

    @vorlaxen
    Contributor

    I'm working on this and almost have a PR ready for kiri engine start|stop|restart|status (with --json output, scripting exit codes, and reusing the existing GUI engine lifecycle controls). Let me know if you'd prefer a different subcommand layout (e.g. under kiri daemon) or have any extra details you'd like included—I plan to open the PR within a few hours.

  3. libracoder commented on Nov 27, 2026

    @libracoder
    Owner

    Implemented in #996 (31cca962):

    Added kiri engine across macOS, Linux, and Windows (keeping kiri start as a compatible alias):

    • kiri engine start — starts Kiri's engine and wakes the VM + held restart-policy containers
    • kiri engine stop — gracefully stops running containers and powers off Kiri's engine/VM until kiri engine start (synchronizing the Kiri window, menu bar / system tray, and dedicated kiri WSL distro on Windows)
    • kiri engine restart — restarts Kiri's engine/VM cleanly (applying updated resource/network settings)
    • kiri engine status [--json] — inspects engine state (running, asleep, stopped, not_running) using background probes so a sleeping VM or stopped WSL distro is never woken; exits 0 when running or asleep and 1 when stopped or not_running

    This will ship in the upcoming 0.2.3 release.

  4. vorlaxen commented on Nov 27, 2026

    @vorlaxen
    Contributor

    I had already completed the implementation after leaving my comment above, so it's a bit disappointing to see it implemented separately without a heads-up, though glad the feature made it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions