Skip to content

arandito/coto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coto

License Version CI

A CLI tool to generate AWS boto3 code snippets using the OpenAI API and written in Rust.

Status: This is version 0.1.0—still in development. Major (1.x) releases are forthcoming.

Table of Contents

Features

  • Generate Python boto3 scripts for AWS operations from natural language prompts.
  • Configure default OpenAI model, AWS region, and AWS profile.
  • Interactive and manual configuration methods.
  • Flexible output: print to stdout or write to files.

Prerequisites

  • A Unix-like shell (Linux, macOS) or PowerShell (Windows)
  • A valid OpenAI API key
  • AWS credentials configured

Installation

Install coto with our standalone installers:

# On macOS and Linux.
curl -LsSf https://aranda.xyz/coto/install.sh | sh

Windows standalone installer will be added in a future version. You can access our Windows binaries here.

Configuration

Interactive Setup

Run the setup command to initialize your configuration file at $XDG_CONFIG_HOME/coto/config.toml (e.g., ~/.config/coto/config.toml):

coto setup

You will be prompted to enter:

  • OpenAI API key
  • Default OpenAI model (e.g., gpt-4o-mini)
  • AWS region (e.g., us-west-2)
  • AWS CLI profile (e.g., default)

Manual Configuration

Create or edit the config file directly:

# ~/.config/coto/config.toml

api_key = "your-openai-api-key"
model   = "gpt-4o-mini"
region  = "us-west-2"
profile = "default"

coto config

Manage individual settings in your config file without opening it manually. You can:

# Show current configuration
coto config show

# Set a value
coto config set model gpt-4

# Unset a value
coto config unset profile

Commands

coto setup

Interactively configure your OpenAI key, default model, AWS region, and profile.

coto setup

coto config

Manage individual settings in your config file (alias for config commands shown above).

# Show settings
coto config show

# Set or unset values
coto config set <key> <value>

coto gen

Generate a boto3 code snippet from a natural language prompt.

coto gen [OPTIONS]

Options:

  • -p, --prompt <PROMPT> Natural language description of desired AWS operation. (required)
  • -r, --region <REGION> AWS region to use (overrides config).
  • -P, --profile <PROFILE> AWS CLI profile to use (overrides config).
  • -m, --model <MODEL> OpenAI model to use (overrides config).
  • -o, --output <FILE> Write code snippet to file instead of printing.
  • -d, --dry-run Show request details without calling the API.

Examples

# Print a snippet to stdout
coto gen -p "list all S3 buckets in us-west-2"

# Write snippet to a file
coto gen -p "upload the file ~/profile.png to the coto-test S3 bucket" -o upload.py

# Override defaults
coto gen -p "delete the EC2 instance named coto-vm" --region us-east-1 --profile myprofile

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues or submit a pull request.

License

This project is licensed under the Apache License 2.0. See LICENSE for details.

About

A CLI tool to generate boto3 code using natural language prompts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published