Metadata-Version: 2.4
Name: cli-wizard
Version: 2.0.0
Summary: Generate modern CLIs from OpenAPI specifications
Author-email: Giacomo Marciani <giacomo.marciani@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/gmarciani/cli-wizard
Project-URL: Repository, https://github.com/gmarciani/cli-wizard
Project-URL: Issues, https://github.com/gmarciani/cli-wizard/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click~=8.3.1
Requires-Dist: Jinja2~=3.1.6
Requires-Dist: pydantic~=2.12.5
Requires-Dist: PyYAML~=6.0.3
Requires-Dist: requests~=2.32.5
Provides-Extra: dev
Requires-Dist: autoflake~=2.3; extra == "dev"
Requires-Dist: black~=26.1; extra == "dev"
Requires-Dist: build~=1.4; extra == "dev"
Requires-Dist: flake8~=7.3; extra == "dev"
Requires-Dist: mypy~=1.19; extra == "dev"
Requires-Dist: pre-commit~=4.5; extra == "dev"
Requires-Dist: pytest~=9.0; extra == "dev"
Requires-Dist: pytest-cov~=7.0; extra == "dev"
Requires-Dist: tox~=4.34; extra == "dev"
Requires-Dist: twine~=6.2; extra == "dev"
Requires-Dist: types-PyYAML~=6.0; extra == "dev"
Requires-Dist: types-requests~=2.32; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx~=9.1; extra == "docs"
Requires-Dist: sphinx-click~=6.2; extra == "docs"
Requires-Dist: sphinx-rtd-theme~=3.1; extra == "docs"
Requires-Dist: sphinx-new-tab-link~=0.8; extra == "docs"
Requires-Dist: autodoc_pydantic~=2.2; extra == "docs"
Dynamic: license-file

# CLI WIZARD

cli-wizard-banner

[![PyPI version](https://img.shields.io/pypi/v/cli-wizard.svg)](https://pypi.org/project/cli-wizard)
[![Python versions](https://img.shields.io/pypi/pyversions/cli-wizard.svg)](https://pypi.org/project/cli-wizard)
[![License](https://img.shields.io/github/license/gmarciani/cli-wizard.svg)](https://github.com/gmarciani/cli-wizard/blob/main/LICENSE)
[![Build status](https://img.shields.io/github/actions/workflow/status/gmarciani/cli-wizard/test.yaml?branch=main)](https://github.com/gmarciani/cli-wizard/actions)
[![Tests](https://img.shields.io/github/actions/workflow/status/gmarciani/cli-wizard/test.yaml?branch=main&label=tests)](https://github.com/gmarciani/cli-wizard/actions)
[![Coverage](https://img.shields.io/codecov/c/github/gmarciani/cli-wizard)](https://codecov.io/gh/gmarciani/cli-wizard)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://img.shields.io/pypi/dm/cli-wizard.svg)](https://pypi.org/project/cli-wizard)

Generate modern CLIs from OpenAPI specifications.

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Commands](#commands)
- [Issues](#issues)
- [License](#license)

## Features

### Code Generation
- Generate complete Python CLI projects from OpenAPI v3 specifications
- Automatic command grouping based on OpenAPI tags
- Automatic help generation for all commands
- Clean, colored terminal output
- `--debug` flag for verbose logging
- Built-in API client with configurable base URL and timeout
- SSL/TLS support with custom CA certificate bundles
- `--ca-file` option to specify custom CA certificates at runtime
- `--no-verify-ssl` flag to disable certificate verification

### Customization
- YAML-based configuration for full customization
- Configurable output directory and package name
- Tag inclusion/exclusion filters
- Custom command naming via `TagMapping` and `CommandMapping`
- Customizable splash screen with color support
- Configurable logging with colors, file output, and rotation

### Developer Experience
- Generated projects are pip-installable out of the box
- Auto-generated `pyproject.toml`, `README.md`, and `VERSION`
- Resources (CA certs, splash files) bundled in the package
- Profile management for storing credentials and settings

## Installation

```shell
pip install cli-wizard
```

## Usage

### Step 1: Prepare Your OpenAPI Specification

Ensure you have an OpenAPI v3 specification file (JSON or YAML format). For example, `openapi.yaml`:

```yaml
openapi: 3.0.0
info:
  title: My API
  version: 1.0.0
paths:
  /users:
    get:
      operationId: listUsers
      summary: List all users
      tags:
        - Users
      responses:
        '200':
          description: OK
```

### Step 2: Create a Configuration File

Create a `cli-wizard.yaml` file with your CLI settings. At minimum, you need `PackageName` and `DefaultBaseUrl`:

```yaml
# Required parameters
PackageName: "my-cli"
DefaultBaseUrl: "https://api.example.com"

# Optional: customize the splash screen
SplashFile: "splash.txt"
SplashColor: "#00FFFF"

# Optional: filter which tags to include
IncludeTags:
  - Users
  - Products
```

### Step 3: Generate the CLI

Run the `generate` command:

```shell
cli-wizard generate --openapi openapi.yaml --config cli-wizard.yaml --output my-cli
```

This creates a complete Python CLI project in the `my-cli` directory.

### Step 4: Install the Generated CLI

Navigate to the generated project and install it:

```shell
pip install -e my-cli
```

### Step 5: Use Your CLI

Your CLI is now ready to use:

```shell
my-cli --help
my-cli users list-users
```

## Configuration

See [configuration reference](https://gmarciani.github.io/cli-wizard/configuration.html) for full documentation.
See the [examples](examples/) directory for complete configuration examples.

## Commands

### cli-wizard generate

Generate a CLI from an OpenAPI specification and configuration file.

```shell
cli-wizard generate [OPTIONS]
```

Options:
- `--openapi, -o` - Path to OpenAPI spec file (default: `openapi.yaml`)
- `--config, -c` - Path to config YAML file (default: `cli-wizard.yaml`)
- `--output, -d` - Output directory for generated CLI (default: `cli`)
- `--working-dir, -w` - Working directory for resolving relative paths

## Issues

Please report any issues or feature requests on the [GitHub Issues](https://github.com/gmarciani/cli-wizard/issues) page.

## License

This project is licensed under the MIT License. See the [LICENSE](https://github.com/gmarciani/cli-wizard/blob/main/LICENSE) file for details.
