Skip to main content

A CLI tool to manage Semaphore UI (ansible-semaphore) via HTTP REST API

Project description

semacli

PyPI version Python versions License: MIT Build Publish codecov Docstring coverage Quality Gate Status Maintainability Rating Reliability Rating Security Rating Bugs Vulnerabilities Code Smells Technical Debt

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
semacli ping

# List projects
semacli projects

# (more commands wired in as the CLI grows)

Output Options

# JSON output
semacli projects --json

# Verbose debugging
semacli projects -v
semacli projects -vv
semacli 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semacli-0.1.4.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semacli-0.1.4-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file semacli-0.1.4.tar.gz.

File metadata

  • Download URL: semacli-0.1.4.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.27.0 CPython/3.12.3 Darwin/25.5.0

File hashes

Hashes for semacli-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7050dbfb7d89ee7a3bb8565271e8419d71563afcb36304219e71e5c297fc24a9
MD5 a9404a6e1e234f759724ed3a6ff888a7
BLAKE2b-256 6ab9f59ecb5ae5b921a095b5a5e79781348747f84025fe96ceab0db8e8ce8ff4

See more details on using hashes here.

File details

Details for the file semacli-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: semacli-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.8 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

Hashes for semacli-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 59a17b409c97af624a99f8320d8bfa09fa89c936884bf9e86728fd2909028b3e
MD5 35d580e2d1ec8935e4cfab37d1d513d6
BLAKE2b-256 fef45097d5d36ca51e7a1bc9c9730ef8ee48e0328e6872e879bccfe75b0101d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page