Skip to main content

CLI utility for SD README Documentation Generator

Project description

SmoothDev CLI

AI-powered development assistance for commit messages, pull requests, and release notes.

Python 3.12+ PyPI License

Overview

The SmoothDev CLI (smooth) provides AI-powered assistance for common development workflows:

  • Commit Messages: Generate conventional commit messages from staged changes
  • Pull Requests: Create professional PR titles and summaries with GitHub integration
  • Release Notes: Automatically generate release notes from git history

Installation

From PyPI (Recommended):

pip install smooth-cli

Features

๐Ÿ“ Commit Message Generation

Generate conventional commit messages from your staged changes.

Command:

# Stage your changes
git add .

# Generate commit message
smooth commit generate

# Generate and commit
smooth commit generate --commit

Example Output:

feat: add user authentication with Auth0

- Implement Auth0 device flow authentication
- Add token storage and refresh logic
- Create auth command group with login/logout
- Add secure token file permissions (0600)

Features:

  • Analyzes git diff automatically
  • Generates conventional commit format (feat, fix, docs, etc.)
  • Handles large diffs intelligently
  • Provides detailed commit body with bullet points

๐Ÿ”€ Pull Request Generation

Generate professional PR titles and comprehensive summaries from GitHub PR data.

Command:

# Auto-detects owner/repo from git remote
smooth pr generate --pr-number 42

# On branch "pr-42" - auto-detects everything!
smooth pr generate

# Push directly to GitHub
smooth pr generate --pr-number 42 --push

Example Output:

feat: implement smart defaults and configuration system

# PR Summary

Generated by: *Smoothdev.io*

## Overview

This PR introduces a four-tier configuration precedence system that enables smart defaults
and auto-detection of repository context, significantly reducing the need for repetitive
CLI flags.

## Changes

### Added
- Four-tier configuration precedence (CLI flags โ†’ Git context โ†’ Repo config โ†’ User config)
- Auto-detection of owner/repo from git remotes
- PR number detection from branch names
- Smart tag detection for release notes
- Configuration management commands (`smooth config`)

### Modified
- Updated all commands to support smart defaults
- Enhanced error messages with context information

## Testing

- Added 53 new tests covering auto-detection scenarios
- All existing tests passing
- Coverage maintained at 85%+

## Documentation

- Updated README with smart defaults examples
- Added ADR for configuration system design
- Created user guide for configuration management

Features:

  • Fetches PR data directly from GitHub API
  • Generates concise titles (max 250 characters)
  • Creates structured summaries with multiple sections
  • Clean, markdown-formatted output
  • Optional push to GitHub
  • Smart defaults reduce required flags

๐Ÿš€ Release Notes Generation

Generate comprehensive release notes from git history.

Command:

# Auto-detects latest two tags
smooth release generate

# Specify tags explicitly
smooth release generate --from-tag v1.0.0 --to-tag v1.1.0

# Push to GitHub Releases
smooth release generate --from-tag v1.0.0 --to-tag v1.1.0 --push

Example Output:

# Release v1.1.0

## ๐ŸŽ‰ New Features

- **Smart Defaults**: Four-tier configuration precedence system
- **Auto-Detection**: Automatic owner/repo detection from git remotes
- **PR Number Detection**: Extract PR numbers from branch names
- **Config Management**: New `smooth config` command group

## ๐Ÿ› Bug Fixes

- Fixed issue with large diff handling in commit generation
- Resolved GitHub API rate limiting edge cases

## ๐Ÿ“š Documentation

- Added comprehensive configuration guide
- Updated README with smart defaults examples
- Created ADR for configuration system

## ๐Ÿ”ง Improvements

- Reduced required CLI flags by 80%
- Enhanced error messages with context
- Improved verbose mode output

## ๐Ÿ“Š Statistics

- **Commits**: 47
- **Contributors**: 3
- **Files Changed**: 28

**Features:**

- Automatic tag detection (latest and previous)
- Semantic versioning support
- Categorized changelog (features, fixes, docs, etc.)
- Breaking change detection
- Contributor statistics
- Optional GitHub Releases integration

โšก Smart Defaults

The CLI automatically detects context from your git repository, eliminating repetitive flags.

Four-Tier Precedence:

  1. CLI Flags - Explicit overrides (highest priority)
  2. Git Context - Auto-detected from repository
  3. Repository Config - Team settings (.smoothdev.json)
  4. User Config - Personal defaults (~/.smoothdevio/config.json)

Auto-Detection Features:

  • Owner and repo from git remote URLs
  • PR number from branch names (pr-123, 123-feature)
  • Latest and previous tags for release notes
  • Current branch from git HEAD

Example:

# Before: Required flags every time
smooth pr generate --owner smoothdev-io --repo my-repo --pr-number 42

# After: Auto-detected from git!
smooth pr generate  # On branch "pr-42" in a git repo with remote

Authentication

The CLI uses Auth0 device flow for secure authentication.

Login

smooth auth login

This will:

  1. Display a device code and URL
  2. Open your browser to authenticate
  3. Store your token securely at ~/.smoothdevio/token.json (with 0600 permissions)
  4. Auto-refresh the token when needed

Logout

smooth auth logout

GitHub Token

For commands that push to GitHub (e.g., --push flag), set your GitHub token:

export GITHUB_TOKEN=ghp_your_token_here

Or add it to your user config (see Configuration section below).

Configuration

The CLI uses a four-tier configuration system that automatically resolves settings in this order:

Configuration Precedence

  1. CLI Flags (highest priority) - Explicit command-line arguments
  2. Git Context - Auto-detected from your repository
  3. Repository Config - Team settings in .smoothdev.json
  4. User Config - Personal defaults in ~/.smoothdevio/config.json

User Config

Store personal defaults at ~/.smoothdevio/config.json:

{
  "github_token": "ghp_your_token_here",
  "defaults": {
    "owner": "your-org",
    "output": "text",
    "verbose": false
  }
}

Initialize user config:

smooth config init --owner your-org --output text

Repository Config

Store team settings in .smoothdev.json (committed to repo):

{
  "owner": "your-org",
  "repo": "your-repo",
  "defaults": {
    "output": "text",
    "verbose": false
  }
}

Initialize repository config:

smooth config init --scope repo --owner your-org --repo your-repo

Security Note: Repository config cannot contain credentials (github_token) to prevent accidental commits.

Configuration Commands

# View all configurations
smooth config show

# View specific scope
smooth config show --scope user
smooth config show --scope repo

# Get specific value
smooth config get defaults.owner
smooth config get defaults.owner --scope repo

# Set value
smooth config set defaults.verbose true
smooth config set defaults.output json --scope repo

# Show config file path
smooth config path
smooth config path --scope repo

Environment Variables

  • GITHUB_TOKEN - GitHub authentication token
  • GH_TOKEN - Alternative GitHub token variable

Command Reference

PR Commands

# Generate PR title and summary (auto-detects owner/repo from git)
smooth pr generate --pr-number <number>

# On branch "pr-123" - auto-detects everything!
smooth pr generate

# Generate only title
smooth pr generate --pr-number <number> --title

# Generate only summary
smooth pr generate --pr-number <number> --summary

# Push to GitHub
smooth pr generate --pr-number <number> --push

# JSON output
smooth pr generate --pr-number <number> --output json

# Verbose mode (shows where values come from)
smooth pr generate --pr-number <number> --verbose

# Explicit flags still work
smooth pr generate --owner <owner> --repo <repo> --pr-number <number>

Commit Commands

# Generate commit message from staged changes
smooth commit generate

# Specify custom template
smooth commit generate --template <path>

Release Commands

# Generate release notes (auto-detects latest two tags)
smooth release generate

# Specify tags explicitly
smooth release generate --from-tag <tag> --to-tag <tag>

# JSON output
smooth release generate --output json

# Verbose mode
smooth release generate --verbose

Config Commands

# Show all configurations
smooth config show

# Show specific scope
smooth config show --scope user
smooth config show --scope repo

# Get value
smooth config get <key>
smooth config get <key> --scope repo

# Set value
smooth config set <key> <value>
smooth config set <key> <value> --scope repo

# Initialize config
smooth config init --owner <org> --output json
smooth config init --scope repo --owner <org> --repo <repo>

# Show config path
smooth config path
smooth config path --scope repo

Auth Commands

# Login with Auth0
smooth auth login

# Logout
smooth auth logout

Coming Soon

We're actively developing additional features:

  • API Key Authentication: Non-interactive authentication for CI/CD pipelines
  • Repository Documentation Generation: AI-powered README and documentation generation

Stay tuned for updates!

Development

Prerequisites

  • Python 3.12+
  • Poetry 1.7+
  • Git
  • GitHub CLI (optional, for auth)

Setup

# Clone repository
git clone https://github.com/smoothdev-io/sd-smooth-cli.git
cd sd-smooth-cli/src/cli

# Install dependencies
poetry install

# Run tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=smooth --cov-report=html

# Linting
poetry run ruff check .
poetry run ruff format .

# Type checking
poetry run mypy .

Project Structure

sd-smooth-cli/
โ”œโ”€โ”€ src/cli/              # CLI source code
โ”‚   โ”œโ”€โ”€ cli/              # Core CLI framework
โ”‚   โ”‚   โ”œโ”€โ”€ git_context.py       # Git detection & parsing
โ”‚   โ”‚   โ”œโ”€โ”€ config_manager.py    # Configuration management
โ”‚   โ”‚   โ””โ”€โ”€ context_resolver.py  # Four-tier precedence
โ”‚   โ”œโ”€โ”€ smooth/           # Command implementations
โ”‚   โ”‚   โ”œโ”€โ”€ commands/     # Command modules
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ pr.py            # PR generation
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ release.py       # Release notes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config.py        # Config management
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ auth/         # Authentication
โ”‚   โ”‚   โ””โ”€โ”€ utils/        # Utilities
โ”‚   โ””โ”€โ”€ tests/            # Test suite (161 tests)
โ”‚       โ”œโ”€โ”€ test_git_context.py
โ”‚       โ”œโ”€โ”€ test_config_manager.py
โ”‚       โ”œโ”€โ”€ test_context_resolver.py
โ”‚       โ”œโ”€โ”€ test_pr_auto_detection.py
โ”‚       โ””โ”€โ”€ test_smart_tag_detection.py
โ”œโ”€โ”€ docs/                 # Documentation
โ”‚   โ”œโ”€โ”€ system/           # Feature documentation
โ”‚   โ”œโ”€โ”€ architecture/     # Architecture docs
โ”‚   โ”œโ”€โ”€ decisions/        # ADRs
โ”‚   โ”œโ”€โ”€ api-changes/      # API change log
โ”‚   โ”œโ”€โ”€ development/      # Development notes
โ”‚   โ””โ”€โ”€ guides/           # User guides
โ”œโ”€โ”€ service.json          # Repository metadata
โ””โ”€โ”€ README.md             # This file

Testing

# Run all tests
poetry run pytest

# Run specific test file
poetry run pytest tests/test_pr_generate_output.py

# Run with verbose output
poetry run pytest -v

# Run with coverage
poetry run pytest --cov=smooth --cov-report=html
open htmlcov/index.html

Code Quality

# Linting
poetry run ruff check .

# Auto-fix
poetry run ruff check . --fix

# Formatting
poetry run ruff format .

# Type checking
poetry run mypy .

# Security scanning
poetry run bandit -r smooth/

License

Proprietary - ยฉ 2025 SmoothDev

Acknowledgments

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

smooth_cli-0.3.4.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

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

smooth_cli-0.3.4-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

Details for the file smooth_cli-0.3.4.tar.gz.

File metadata

  • Download URL: smooth_cli-0.3.4.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smooth_cli-0.3.4.tar.gz
Algorithm Hash digest
SHA256 760cb0bbf9cb29775b4e97e68452f5d105ed60ccf74afab998568d4a3b659a13
MD5 2adcd833cb161875c3044f802d2de577
BLAKE2b-256 a9749b83d5e50025fee41d34bf8c39d889dd3219c1f096b6d83af4b718a78f28

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth_cli-0.3.4.tar.gz:

Publisher: pypi-publish.yml on smoothdev-io/sd-smooth-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth_cli-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: smooth_cli-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 56.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smooth_cli-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5aa41faaf7045b12a7ce5190a227c65ecf256d433129892d79860c0160baea2c
MD5 c58207307bdaa2e092c6fc66a5a1e961
BLAKE2b-256 26f0822e3d510d3bde22bc7449a7665a52f91375099af477ff20fc2125fb22b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth_cli-0.3.4-py3-none-any.whl:

Publisher: pypi-publish.yml on smoothdev-io/sd-smooth-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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