feat(openclaw): configure node for full access and install essential production tools
- Enabled native execution and nativeSkills in OpenClaw config - Installed and linked core CLI dependencies (things3-cli, grizzly, remindctl, op, etc.) - Deployed macOS-specific skills (Notes, Reminders, Things, TTS, Mission Control) - Hardened node startup script with optimized PATH and daemon configuration - Finalized environment for secure autonomous operation
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from weather_cli.cli import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
import click
|
||||
import asyncio
|
||||
from weather_cli.service import WeatherService
|
||||
|
||||
@click.command()
|
||||
@click.option("--city", required=True, help="City name to fetch weather for.")
|
||||
@click.option("--units", default="metric", type=click.Choice(["metric", "imperial"]), help="Units of measurement.")
|
||||
def main(city: str, units: str):
|
||||
"""Weather Fetcher CLI - Get current weather for a city."""
|
||||
try:
|
||||
service = WeatherService()
|
||||
weather = asyncio.run(service.get_weather(city, units))
|
||||
|
||||
unit_sym = "°C" if units == "metric" else "°F"
|
||||
click.echo(f"Weather for {weather.city}:")
|
||||
click.echo(f"Temperature: {weather.temperature}{unit_sym}")
|
||||
click.echo(f"Condition: {weather.condition.capitalize()}")
|
||||
except ValueError as e:
|
||||
click.echo(f"Error: {e}", err=True)
|
||||
except Exception as e:
|
||||
click.echo(f"Unexpected error: {e}", err=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,8 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class CityWeather:
|
||||
city: str
|
||||
temperature: float
|
||||
condition: str
|
||||
units: str
|
||||
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
import httpx
|
||||
from .models import CityWeather
|
||||
|
||||
class WeatherService:
|
||||
BASE_URL = "https://api.openweathermap.org/data/2.5/weather"
|
||||
|
||||
def __init__(self, api_key: str | None = None):
|
||||
self.api_key = api_key or os.getenv("WEATHER_API_KEY")
|
||||
if not self.api_key:
|
||||
raise ValueError("WEATHER_API_KEY environment variable is missing")
|
||||
|
||||
async def get_weather(self, city: str, units: str = "metric") -> CityWeather:
|
||||
params = {
|
||||
"q": city,
|
||||
"appid": self.api_key,
|
||||
"units": units
|
||||
}
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(self.BASE_URL, params=params)
|
||||
|
||||
if response.status_code == 404:
|
||||
raise ValueError(f"City '{city}' not found")
|
||||
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
return CityWeather(
|
||||
city=data["name"],
|
||||
temperature=data["main"]["temp"],
|
||||
condition=data["weather"][0]["description"],
|
||||
units=units
|
||||
)
|
||||
Reference in New Issue
Block a user