Skip to main content

Lookup CLI commands easily

Project description

Ask 🔍

PyPI version License: MIT

Ask helps you remember (or discover) terminal commands using natural language.

Description

For Local Development

To install ask locally for development where you can make changes to the code:

Prerequisites

  • Python 3.10 or higher
  • Git

Installation Steps

  1. Clone the repository:
git clone https://github.com/dtnewman/ask.git
cd ask
  1. Install in editable mode:

macOS/Linux:

pip install -e .
# Or if you have multiple Python versions:
python3 -m pip install -e .

Windows:

pip install -e .
# Or if you have multiple Python versions:
python -m pip install -e .
  1. Verify installation:
ask --help

How Editable Installation Works

  • Creates a link to your local repository instead of copying files
  • Any changes you make to files in src/ask/ are immediately reflected when you run ask
  • No need to reinstall after making changes

Python Version Notes

  • macOS: If you get a "command not found" error, you may need Python 3.10+. Install via Homebrew: brew install python@3.11

  • Linux: Use your package manager to install Python 3.10+ (e.g., apt install python3.11 on Ubuntu)

  • Windows: Download Python 3.10+ from python.org

  • Note: This project runs on top of LLM APIs like OpenAI, Google's Gemini, or Ollama.

📦 Dependencies

For clipboard functionality (copying and pasting) to work properly, you may need to install:

  • On Linux: xclip or xsel (for X11) or wl-clipboard (for Wayland)
  • On macOS: No additional dependencies needed
  • On Windows: No additional dependencies needed

🎮 Usage

Option 1: Interactive Mode

ask

Option 2: Direct Query

ask '<what you want to do>'

📝 Examples

# Find running processes
ask 'show all running python processes'

# File operations
ask 'find all .py files modified in the last 24 hours'

# System information
ask 'show disk usage for current directory'

# Network commands
ask 'check if google.com is reachable'

# Git operations
ask 'show uncommitted changes in git'

🛡️ Safety Considerations

⚠️ Commands are generated by LLMs. While the tool attempts to flag dangerous commands, it may not always do so. Use caution.

Example of dangerous command warning

⚙️ Settings

Supported LLM Providers:

  • OpenAI
  • Google Gemini
  • Ollama
  • Azure OpenAI

You can update your API keys and provider settings by running:

ask --setup

OpenAI

To use OpenAI, you need an OpenAI account and a subscription. You can create an API key on this page.

Google Gemini (Free)

To use Google's Gemini models, you need a Google AI Studio account. You can create a Gemini API key in Google AI Studio.

🐪 Using with Ollama

You can use Ask with Ollama as an alternative to hosted providers, which lets you run all commands locally. To set this up:

  1. Install and start Ollama with a model of your choice

  2. Run ask --setup and put in the proper settings. For example:

? Pick your LLM provider: Ollama
? Enter the Ollama URL: http://localhost:11434/v1
? Enter the model to use (e.g. llama3.2): llama3.2

Azure OpenAI

To use Azure OpenAI, you’ll need access to an Azure OpenAI resource in your Azure subscription.

  1. Create a deployment of the model you want to use (e.g., gpt-4o, gpt-4o-mini etc.).

  2. Install required Azure depedencies with pip install ask[azure].

  3. Run ask --setup and put in the proper settings. For example:

    ? Pick your LLM provider: Azure OpenAI
    ? Azure OpenAI account name (e.g. my-openai-resource): my-openai-resource
    ? Azure OpenAI API key (leave blank to use Entra ID / keyless auth):
    ? Azure OpenAI deployment name (e.g. gpt-4, gpt-4o, etc): gpt-4o
    ? Azure OpenAI API version: 2025-03-01-preview
    

    Note: Model version must be 2024-08-06 or newer.
    API version must be 2024-08-01-preview or newer.

Note that to switch backends, you can re-run ask --setup again at any time.

🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

astexlabs_ask-0.1.1.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

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

astexlabs_ask-0.1.1-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file astexlabs_ask-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for astexlabs_ask-0.1.1.tar.gz
Algorithm Hash digest
SHA256 33d5be93501740338fd37b5c56fd5824890b71bcddbb0aad20c35595d09c0d38
MD5 0c9ab423af987d28ad4e23554f1ad512
BLAKE2b-256 e098713d8a18b93f6a116e29d92324b5e68ca6dddf7781c2809e604b6ec0e9b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for astexlabs_ask-0.1.1.tar.gz:

Publisher: publish.yml on Astexlabs/ask

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

File details

Details for the file astexlabs_ask-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for astexlabs_ask-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac3779abba900c394d80211d90350948c0f16b33ea1851993557b3720be67da8
MD5 57b3fe8d1de0621b099d52625f39381c
BLAKE2b-256 f4016a94c2790b204fe0e8b62bb060a49b556914fc41df290c45940eca6ee7f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for astexlabs_ask-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Astexlabs/ask

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