Skip to content

feat(weather): add weather search adapter#240

Closed
vkop007 wants to merge 1 commit intojackwener:mainfrom
vkop007:feat/weather-adapter
Closed

feat(weather): add weather search adapter#240
vkop007 wants to merge 1 commit intojackwener:mainfrom
vkop007:feat/weather-adapter

Conversation

@vkop007
Copy link
Contributor

@vkop007 vkop007 commented Mar 22, 2026

Description

This PR introduces the new Weather adapter to OpenCLI. It leverages the completely free, lightning-fast wttr.in JSON API to stream real-time global weather telemetry directly into the terminal without requiring browser sessions or API keys.

Commands Added (opencli weather):

  • search - Instantly fetch live environmental conditions for any city or location (e.g., opencli weather search --location "San Francisco").

Note: Fully documented and structurally integrated into the VitePress website and project READMEs.

Related issue: N/A

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR (opencli validate)
  • I updated tests or docs if needed (README.md and VitePress configs)
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (docs/adapters/browser/weather.md)
  • Updated docs/adapters/index.md table
  • Updated sidebar in docs/.vitepress/config.mts

Screenshots / Output

$ opencli weather search --location "San Francisco"

  weather/search
┌───────────┬──────┬───────┬──────────┬────────┐
│ Condition │ Temp │ Feels │ Humidity │ Wind   │
├───────────┼──────┼───────┼──────────┼────────┤
│ Clear     │ 13°C │ 13°C  │ 80%      │ 5 km/h │
└───────────┴──────┴───────┴──────────┴────────┘
1 items · 1.9s · weather/search

Copy link
Contributor

@Astro-Han Astro-Han left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One major concern before the code-level issues:

Conflicts with PR #214

PR #214 (by 0xsline) already includes a full weather adapter with 11 commands (current, forecast, hourly, search, air, sunrise, etc.) using Open Meteo API — including the same file paths (src/clis/weather/search.yaml, docs/adapters/browser/weather.md). These two PRs can't both merge. Worth checking with the maintainer which direction to go.

URL encoding missing

${{ args.location }} is interpolated directly into the URL. Locations with spaces (e.g. "San Francisco") need encoding. Use ${{ args.location | urlencode }}.

location should be positional

Same issue as #241opencli weather search London is more natural than --location London.

config.mts not updated

PR checklist says sidebar was updated, but the diff doesn't include docs/.vitepress/config.mts.

@vkop007 vkop007 closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants