Skip to main content

CLI tool for translating natural language to shell commands via cmd.xaw.me API

Project description

clixaw

A command-line interface tool that translates natural language queries into executable shell commands using the cmd.xaw.me API.

Installation

From PyPI (when published)

pip install clixaw

From source

git clone <repository-url>
cd clixawtest
pip install -e .

Development mode

pip install -e ".[dev]"

Usage

Basic Usage

Translate a natural language query to a shell command:

xaw show me big files
# Output: du -ah . | sort -rh | head -n 10

Quoted Queries

For multi-word queries with special characters, use quotes:

xaw "git push new branch"
# Output: git push -u origin $(git branch --show-current)

Execute Commands

Use the --execute or -e flag to execute the translated command:

xaw --execute list files in current directory
# Executes: ls -la

Configuration

Set a custom API URL using the XAW_API_URL environment variable:

export XAW_API_URL="http://localhost:8000"
xaw show files

Or use the --api-url flag:

xaw --api-url http://localhost:8000 show files

Safety Features

By default, clixaw only prints commands without executing them. When using --execute:

  • Dangerous commands (like rm -rf, format, etc.) require confirmation
  • Use --no-confirm to skip confirmation (use with caution)
xaw --execute remove all files
# Warning: This command may be dangerous!
# Command: rm -rf *
# Do you want to proceed? [y/N]:

Command-Line Options

Usage: xaw [OPTIONS] QUERY...

  Translate natural language queries to shell commands using cmd.xaw.me API.

Options:
  -e, --execute          Execute the translated command instead of just printing it
  --api-url TEXT         API URL (defaults to XAW_API_URL env var or https://cmd.xaw.me)
  --no-confirm           Skip confirmation for dangerous commands (use with caution)
  --version              Show the version and exit
  --help                 Show this message and exit

Examples

# Find large files
xaw show me big files

# Git operations
xaw "git push new branch"
xaw "create a new git branch"

# File operations
xaw list all python files
xaw find files modified today

# System information
xaw show disk usage
xaw check network connections

# Execute commands
xaw --execute show current directory
xaw -e "list files sorted by size"

API Details

  • Base URL: https://cmd.xaw.me (configurable)
  • Endpoints:
    • GET /?q={query} (query parameter style, preferred)
    • GET /{query} (path-based)
  • Response: Plain text shell command
  • Authentication: None required

Error Handling

The tool handles various error scenarios:

  • Network connection errors
  • API timeouts
  • HTTP errors from the API
  • Invalid or empty responses
  • Command execution errors

Development

Project Structure

clixaw/
├── clixaw/
│   ├── __init__.py
│   ├── cli.py          # Main CLI entry point
│   └── api.py          # API client module
├── pyproject.toml      # Package configuration
├── README.md
└── requirements.txt

Running Tests

pytest

Code Formatting

black clixaw/

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

clixaw-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

clixaw-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file clixaw-0.1.0.tar.gz.

File metadata

  • Download URL: clixaw-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for clixaw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4e611278a9971a3dfcd0c70198bdca17282569e856ed6c25080282f39982e32d
MD5 bcadca1f4ecdbc37a81d9d28104921c2
BLAKE2b-256 e2ff56c514117ee6282cd5e82b6d03967a3ad8ea924ad42fae3c90f8532d0790

See more details on using hashes here.

File details

Details for the file clixaw-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clixaw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for clixaw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76484c6c0228aa06e83642e85118360ef2a2043812d1bef6b5cb2f8800a3b735
MD5 1af0d9cf5040eb735a6b9c3d63210f9d
BLAKE2b-256 dd225738f9316f1309b35cbacc7a6ac5d607db5d6853a5584b1c13cd1e5e9afa

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