Skip to content

TeamCadenceAI/weather-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weather-cli

A Rust CLI that provides weather data from free APIs, with JSON and plain-text output optimized for scripting and AI agents. No API key required for basic use.

Features

  • Current conditions — temperature, humidity, wind, pressure, and more
  • Forecasts — hourly (up to 168h) and daily (up to 16 days)
  • Weather alerts — severe weather warnings via US National Weather Service
  • Historical data — hourly weather for any date back to 1940
  • Multiple location inputs — city name, coordinates, ZIP code, airport IATA code
  • Multiple providers — Open-Meteo (free, no key) with OpenWeatherMap fallback
  • Structured output — JSON (default) and TSV for easy parsing
  • Location caching — SQLite cache for resolved geocoding lookups

Building

Requires Rust (edition 2024).

cargo build --release

The binary is written to ./target/release/weather.

Installation

The install script builds the binary, copies it to ~/.local/bin, and automatically installs the skill to any detected AI agents (Claude Code, Codex):

./install.sh

Or manually:

# Build and install the binary
cargo build --release
mkdir -p ~/.local/bin
cp ./target/release/weather ~/.local/bin/weather

# Install the skill for Claude Code and/or Codex
mkdir -p ~/.claude/skills/weather
ln -sf "$(pwd)/SKILL.md" ~/.claude/skills/weather/SKILL.md

mkdir -p ~/.codex/skills/weather
ln -sf "$(pwd)/SKILL.md" ~/.codex/skills/weather/SKILL.md

Then initialize the config:

weather init

Usage

# Current weather
weather current "London"
weather current --lat 51.5 --lon -0.12
weather current --zip 10001
weather current --airport SFO

# Hourly forecast (next 24h by default)
weather forecast hourly "London"
weather forecast hourly "London" --hours 48

# Daily forecast (next 7 days by default)
weather forecast daily "London"
weather forecast daily "London" --days 14

# Weather alerts (US only)
weather alerts "New York"

# Historical weather
weather history "London" --date 2024-06-15
weather history "London" --from 2024-06-01 --to 2024-06-07

# Providers and cache
weather providers
weather cache stats
weather cache clear

Global flags

Flag Description
--json JSON output (default)
--plain TSV output
--units <metric|imperial|si> Unit system (default: metric)
--provider <openmeteo|openweathermap> Force a specific provider
-q, --quiet Suppress non-essential stderr messages

Location inputs

Method Example Supported commands
City name weather current "London" all
Coordinates weather current --lat 51.5 --lon -0.12 all
ZIP code weather current --zip 10001 --country US current only
Airport IATA weather current --airport SFO current only

Configuration

Config is created by weather init at:

  • macOS: ~/Library/Application Support/weather-cli/config.toml
  • Linux: ~/.config/weather-cli/config.toml

Override with the WEATHER_CLI_CONFIG_DIR environment variable.

[general]
default_units = "metric"
default_format = "json"

[providers]
primary = "openmeteo"
fallback = "openweathermap"

[providers.openweathermap]
api_key = ""

[cache]
location_ttl_days = 30

To use OpenWeatherMap as a provider, add your API key to the config file.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors