Skip to content

CXEPI/cxp-lifecycle-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CX Lifecycle CLI

A command-line interface tool for managing lifecycle operations, built for modern Python development.

🚀 Quick Start

Install with uvx (Recommended)

The fastest way to get started is with uvx - no need to manage Python environments:

# Install and run directly from GitHub
uvx --from git+https://github.com/CXEPI/cxp-lifecycle-cli cx-cli --help

# Or install permanently 
uv tool install git+https://github.com/CXEPI/cxp-lifecycle-cli
cx-cli --help

Alternative: Install with pip

pip install git+https://github.com/CXEPI/cxp-lifecycle-cli

📖 Usage

Once installed, you can access the CLI:

cx-cli --help          # Show all available commands
cx-cli version         # Show version information
cx-cli init            # Initialize a new project

🔄 Version Management & Updates

The CLI automatically checks for new versions on startup and notifies you when updates are available.

Upgrading to the Latest Version

To upgrade to the latest version, simply run:

cx-cli upgrade

This will automatically detect your installation method (uv or pip) and upgrade accordingly. You can also specify the method:

cx-cli upgrade --method uv    # Force upgrade using uv
cx-cli upgrade --method pip   # Force upgrade using pip
cx-cli upgrade -y             # Skip confirmation prompt

Manual Upgrade

If you prefer to upgrade manually:

# Using uv (recommended)
uv tool install --force --no-cache git+https://github.com/CXEPI/cxp-lifecycle-cli

# Using pip
pip install --upgrade git+https://github.com/CXEPI/cxp-lifecycle-cli

🪟 Windows Support

The CLI now fully supports Windows! All features work cross-platform including file operations, path handling, and cloud deployments.

Upgrading from Previous Versions (Windows Users)

If you installed the CLI before Windows support was added, you'll need to perform a clean reinstall to get the fixes:

# 1. Uninstall the old version
uv tool uninstall lifecycle-cli

# 2. Clear the UV cache
uv cache clean

# 3. Reinstall with no cache
uv tool install --force --no-cache git+https://github.com/CXEPI/cxp-lifecycle-cli

After reinstalling, verify the installation:

cx-cli --help
cx-cli version

⚙️ Configuration

The CLI can be configured using a configuration file located at ~/.cx-cli/config.json.

Managing Configuration

# List all configuration settings
cx-cli config list

# Get a specific configuration value
cx-cli config get version-check-enabled

# Set a configuration value
cx-cli config set version-check-enabled false

Available Configuration Options

version-check-enabled

Controls whether the CLI checks for updates on startup.

  • Type: boolean (true/false)
  • Default: true
  • Usage:
    # Disable version checking
    cx-cli config set version-check-enabled false
    
    # Enable version checking
    cx-cli config set version-check-enabled true

When disabled, the CLI will not check for updates or block execution when a new version is available. This is useful for CI/CD environments or if you prefer to manage updates manually.

Configuration File Location

Configuration is stored in ~/.cx-cli/config.json. You can also edit this file directly:

{
  "version-check-enabled": false
}

Commands

General Commands

  • Get help on CLI commands
    cx-cli --help
    Displays help information for all available commands.

  • Get help on a specific command

  • cx-cli <command> --help
    Displays help information for the specified command.

  • Create metadata

  • cx-cli init
    Creates metadata for the application.

  • validate metadata

  • cx-cli validate-app
    Validates the metadata of the application.

datafabric Management

  • Deploy a connector
    cx-cli datafabric add-connector
    Deploys the specified connector.

  • Destroy a connector
    cx-cli datafabric destroy-connector <connector-name>
    Removes the specified connector.

  • List all connectors
    cx-cli datafabric list-connectors
    Lists all available connectors.

API Function Management

  • Get help on API commands
    cx-cli api --help
    Displays help information for API-related commands.

  • Create a new function
    cx-cli api add-function
    Creates a new API function.

  • Destroy a function
    cx-cli api destroy-function <function-name>
    Removes the specified API function.

  • List all functions
    cx-cli api list-functions
    Lists all available API functions.

IAM Management

  • Get help on IAM commands
    cx-cli iam --help
    Displays help information for IAM-related commands.

  • Create Permission

  • cx-cli iam create_permission
    Creates a new permission in the IAM system.

  • Create Tenant

    • cx-cli iam create_tenant
      Creates a new tenant in the IAM system.

This version is for end-users who want to install and run the CLI from GitHub.

Lifecycle CLI

Command-line interface tool for managing lifecycle operations.

🧩 Installation (via GitHub)

You can install the CLI directly from the GitHub repo:

bash

pip install git+https://github.com//.git#subdirectory=cli Make sure you have Python ≥ 3.9 and pip installed.

🚀 Usage

Once installed, you can access the CLI using:

cx-cli --help Example:

cx-cli init cx-cli datafabric add-connector 🔄 Enable Autocomplete (Optional but Recommended)

Typer provides autocomplete for bash, zsh, and fish.

Enable it by running:

cx-cli --install-completion


🛠️ 2. README for Developers (Contributors)

This version is for internal developers who are working on the CLI source code.

Lifecycle CLI - Developer Guide

🧪 Local Setup

Clone the repository and set up Poetry (if you haven’t already):

  1. git clone https://github.com/CXEPI/cxp-lifecycle.git
  2. cd cxp-lifecycle/cli
  3. poetry install
  4. copy .env.example to .env and fill in the required environment variables

To run the CLI locally:

  1. poetry run cx-cli --help

or globally by:

  1. cd cxp-lifecycle/cli

  2. pip install -e .

and then just use: cx-cli (it will also automatically reflects changes you make in the lifecycle code)

To test a command:

poetry run cx-cli hello --name Dev 🧹 Lint and Format

Run formatting and lint checks:

poetry run black src 🧪 Tests

poetry run pytest 🔄 Releasing a New Version

Bump version in pyproject.toml under [tool.poetry]: version = "0.2.0" Commit and push the changes: git add pyproject.toml git commit -m "chore: bump CLI version to 0.2.0" git push Create a GitHub Release (optional): Go to GitHub > Releases > Draft a new release Tag: v0.2.0 Title: v0.2.0 Description: Add change notes Notify users to update: pip install --upgrade git+https://github.com//.git#subdirectory=cli 🧠 Autocomplete (for dev testing)

Run once to install CLI autocomplete:

poetry run cx-cli --install-completion Then restart your shell or source ~/.bashrc.

🛠️ Creating a Standalone Executable (.exe) with PyInstaller

You can package the CLI into a single .exe for users who don't have Python installed.

1. Install PyInstaller

pip install pyinstaller
2. Add a launcher script
Create src/cli/main.py:

from cli.commands import app

if __name__ == "__main__":
    app()
3. Build the binary
From the cli/ folder:

pyinstaller --onefile src/cli/main.py --name cx-cli --paths src
Output:

dist/cx-cli.exe       # Windows
dist/cx-cli           # Linux/macOS
4. Run the binary
./dist/cx-cli --help
5. Clean up (optional)
Add to .gitignore:

# PyInstaller
build/
dist/
*.spec


## 🔄 Version Management

This CLI uses Git tags for version management. To release a new version:

1. Update the version in `pyproject.toml`
2. Create a Git tag: `git tag v0.1.39`
3. Push the tag: `git push origin v0.1.39`
4. Users can install the latest version with uvx/uv

### Automatic Updates

When using uvx, you can always run the latest version:
```bash
uvx --from git+https://github.com/CXEPI/cxp-lifecycle-cli cx-cli --help

For permanent installations, update with:

uv tool upgrade lifecycle-cli
# or
pip install --upgrade git+https://github.com/CXEPI/cxp-lifecycle-cli

🛠️ Development

For Contributors

Clone and set up for development:

git clone https://github.com/CXEPI/cxp-lifecycle-cli
cd cxp-lifecycle-cli
uv sync --dev
uv run cx-cli --help

Or with Poetry (legacy):

poetry install
poetry run cx-cli --help

Testing Changes

# Test your changes locally
uvx --from . cx-cli --help

# Run tests
uv run pytest

# Format code
uv run black src

About

cli public repo for new releases

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 10