A CLI tool to manage Semaphore UI (ansible-semaphore) via HTTP REST API
Project description
semacli
A CLI tool to manage Semaphore UI (ansible-semaphore) via its HTTP REST API.
Designed for LLM/agent and automation use — deterministic commands, JSON output, exit codes.
Features
- List projects, templates, inventories, environments
- Launch and monitor tasks
- Read task output
- JSON output support
- Bearer-token authentication (User Settings → API Tokens)
Installation
# From PyPI
pip install semacli
# From source
pip install git+https://github.com/lduchosal/semacli.git
# Development
git clone https://github.com/lduchosal/semacli.git
cd semacli
pdm install
Quick Start
Configuration
Create semacli.ini in the current directory or ~/.semacli.ini:
[semaphore]
url = https://monitor.example.com/semaphore
project = 1
[auth]
method = bearer_token
bearer_token = your-api-token-here
[settings]
timeout = 30
verify_ssl = true
Get a bearer token from the Semaphore UI: User Settings → API Tokens → Create.
Basic Usage
# Ping the API
sem ping
# List projects
sem projects
# (more commands wired in as the CLI grows)
Output Options
# JSON output
sem projects --json
# Verbose debugging
sem projects -v
sem projects -vv
sem projects -vvv
Configuration Options
Authentication Methods
Bearer token (recommended)
[semaphore]
url = https://monitor.example.com/semaphore
[auth]
method = bearer_token
bearer_token = your-api-token
Bearer token from environment variable
[semaphore]
url = https://monitor.example.com/semaphore
[auth]
method = env_var
env_var = SEMAPHORE_TOKEN
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Authentication error |
| 4 | API error |
| 5 | Not found |
Development
# Clone and setup
git clone https://github.com/lduchosal/semacli.git
cd semacli
pdm install -G dev
# Run tests
pdm test
# Lint and format
pdm lint
pdm format
# Type check
pdm typecheck
# Build
pdm build
Architecture
semacli/
├── cli/ # Click CLI interface
│ ├── commands/ # Individual commands
│ ├── decorators.py # Common CLI options
│ └── handlers.py # Error handlers
├── core/ # Core business logic
│ ├── client.py # Semaphore HTTP client
│ ├── config.py # Configuration
│ ├── exceptions.py # Custom exceptions
│ └── models.py # Data models
└── services/ # Business services
See ARCHITECTURE.md for the wiki classification map used by ken wiki groom.
License
MIT License - see LICENSE for details.
Related Projects
- nagioscli - sibling CLI for Nagios Core (model project)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semacli-0.5.5.tar.gz.
File metadata
- Download URL: semacli-0.5.5.tar.gz
- Upload date:
- Size: 59.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.27.0 CPython/3.12.3 Darwin/25.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c9a0f922f759b4e08732a3a75653726288916a5e09daf3f9ebf7a021e993bec
|
|
| MD5 |
c9e24e6b06e8036b19fd2c083ddaeb4e
|
|
| BLAKE2b-256 |
87fcfe523590e4da4029e6677eb3107b60cef3cdc73a2ff2701b3cb0d050ad68
|
File details
Details for the file semacli-0.5.5-py3-none-any.whl.
File metadata
- Download URL: semacli-0.5.5-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.27.0 CPython/3.12.3 Darwin/25.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ba656c145224696cb4c47d765dab439d45ae7ef4971dc2f7ed141098917da06
|
|
| MD5 |
0b4c55dee9e0fac2358326127e303bf6
|
|
| BLAKE2b-256 |
1eef0ca75e96b9354287a6b535d520521516f9e1cfc010f4bbd2bfb4905e09af
|