[PR #2517] feat(cli): introduce headless amnezia-cli for desktop automation #2835

Open
opened 2026-10-14 21:05:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2517
Author: @vitkuz573
Created: 4/23/2026
Status: 🔄 Open

Base: dev ← Head: feat/headless-cli


📝 Commits (1)

  • afc2be4 feat: add headless cli client

📊 Changes

12 files changed (+2392 additions, -14 deletions)

View changed files

📝 client/CMakeLists.txt (+2 -0)
➕ client/cli/CMakeLists.txt (+72 -0)
➕ client/cli/README.md (+58 -0)
➕ client/cli/cli_common.h (+50 -0)
➕ client/cli/cli_context.cpp (+1050 -0)
➕ client/cli/cli_context.h (+125 -0)
➕ client/cli/cli_ipc.cpp (+239 -0)
➕ client/cli/cli_ipc.h (+46 -0)
➕ client/cli/main.cpp (+696 -0)
📝 client/core/controllers/gatewayController.cpp (+24 -9)
📝 client/ui/controllers/api/apiConfigsController.cpp (+11 -3)
📝 client/ui/controllers/connectionController.cpp (+19 -2)

📄 Description

Why this PR exists

Amnezia had desktop flows and partial command handling, but not a true headless client suitable for terminal-first usage and automation.
This PR adds a dedicated CLI binary that works with the same core models/controllers as the app, so behavior stays consistent.

What this PR adds

  • A new executable: amnezia-cli (client/cli)
  • Full command surface for day-to-day operations:
    • VPN state and control: status, connect, disconnect
    • Daemon lifecycle: daemon start|stop|status
    • Server management: servers list|show|add|import|remove|set-default|scan
    • Country selection for API-backed configs: countries list|set
    • Container management: containers list|set-default|remove
    • Provisioning flows: install server, install container
    • Maintenance: logs cleanup
  • CLI documentation: client/cli/README.md

Implementation highlights

  • Added a separate CMake target for CLI (client/cli/CMakeLists.txt) and wired it into the client build graph.
  • Reworked several controller access paths to be safe in headless context:
    • network manager access no longer depends on UI-only app helpers
    • clipboard operations are guarded for GUI availability
  • Result: shared business logic can be used both by desktop UI and by CLI without duplicating behavior.

Verification

  • cmake --build build --target amnezia-cli -j4
  • ./build/client/cli/amnezia-cli --help
  • ./build/client/cli/amnezia-cli status --json
  • ./build/client/cli/amnezia-cli servers list --json
  • ./build/client/cli/amnezia-cli countries list --index 0 --json

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2517 **Author:** [@vitkuz573](https://github.com/vitkuz573) **Created:** 4/23/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feat/headless-cli` --- ### 📝 Commits (1) - [`afc2be4`](https://github.com/amnezia-vpn/amnezia-client/commit/afc2be414ce764fea684bce4e6fb9c010d597d37) feat: add headless cli client ### 📊 Changes **12 files changed** (+2392 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `client/CMakeLists.txt` (+2 -0) ➕ `client/cli/CMakeLists.txt` (+72 -0) ➕ `client/cli/README.md` (+58 -0) ➕ `client/cli/cli_common.h` (+50 -0) ➕ `client/cli/cli_context.cpp` (+1050 -0) ➕ `client/cli/cli_context.h` (+125 -0) ➕ `client/cli/cli_ipc.cpp` (+239 -0) ➕ `client/cli/cli_ipc.h` (+46 -0) ➕ `client/cli/main.cpp` (+696 -0) 📝 `client/core/controllers/gatewayController.cpp` (+24 -9) 📝 `client/ui/controllers/api/apiConfigsController.cpp` (+11 -3) 📝 `client/ui/controllers/connectionController.cpp` (+19 -2) </details> ### 📄 Description ## Why this PR exists Amnezia had desktop flows and partial command handling, but not a true headless client suitable for terminal-first usage and automation. This PR adds a dedicated CLI binary that works with the same core models/controllers as the app, so behavior stays consistent. ## What this PR adds - A new executable: `amnezia-cli` (`client/cli`) - Full command surface for day-to-day operations: - VPN state and control: `status`, `connect`, `disconnect` - Daemon lifecycle: `daemon start|stop|status` - Server management: `servers list|show|add|import|remove|set-default|scan` - Country selection for API-backed configs: `countries list|set` - Container management: `containers list|set-default|remove` - Provisioning flows: `install server`, `install container` - Maintenance: `logs cleanup` - CLI documentation: `client/cli/README.md` ## Implementation highlights - Added a separate CMake target for CLI (`client/cli/CMakeLists.txt`) and wired it into the client build graph. - Reworked several controller access paths to be safe in headless context: - network manager access no longer depends on UI-only app helpers - clipboard operations are guarded for GUI availability - Result: shared business logic can be used both by desktop UI and by CLI without duplicating behavior. ## Verification - `cmake --build build --target amnezia-cli -j4` - `./build/client/cli/amnezia-cli --help` - `./build/client/cli/amnezia-cli status --json` - `./build/client/cli/amnezia-cli servers list --json` - `./build/client/cli/amnezia-cli countries list --index 0 --json` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#2835
No description provided.