@x-otto/plugin-weather 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/otto-plugin.json +17 -0
- package/package.json +27 -0
- package/plugin-dist/meta.json +1 -0
- package/plugin-dist/plugin.cjs +52383 -0
- package/plugin-dist/plugin.js +13935 -0
- package/plugin.ts +52 -0
- package/src/open-meteo-client.ts +108 -0
- package/src/schema.ts +17 -0
- package/src/types.ts +27 -0
- package/src/weather-codes.ts +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @x-otto/plugin-weather
|
|
2
|
+
|
|
3
|
+
> Weather forecast plugin for otto.
|
|
4
|
+
|
|
5
|
+
Provides a single `get_weather` tool that fetches current weather and a 3-day forecast for any city. Uses the free Open-Meteo API (no API key required). Results are rendered as a terminal card by the bundled `renderers-dist/weather.js` renderer.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
This plugin contributes two things:
|
|
10
|
+
|
|
11
|
+
1. **Tool** (`get_weather`) — Geocodes a city name, fetches the 7-day forecast from Open-Meteo, and returns structured data with current conditions + 3-day summary.
|
|
12
|
+
2. **Renderer** — A terminal card renderer (`matcher.toolName: "get_weather"`) that formats the tool result as a pretty TUI card with temperature, description, and forecast details.
|
|
13
|
+
|
|
14
|
+
The tool returns both a plain-text summary (for the conversation stream) and structured `details` (for the renderer to consume without string parsing).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
otto extension install plugin-weather
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Ask otto about the weather
|
|
26
|
+
"what's the weather in Tokyo?"
|
|
27
|
+
"get weather for London"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Dependencies
|
|
31
|
+
|
|
32
|
+
- `@x-otto/interchange` (workspace)
|
|
33
|
+
- `@x-otto/plugin` (dev, build-time only)
|
|
34
|
+
- Open-Meteo API (free, no key)
|
package/otto-plugin.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "plugin-weather",
|
|
3
|
+
"name": "Weather Forecast",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Get current weather + 3-day forecast via Open-Meteo (free, no API key required), rendered as a terminal card.",
|
|
6
|
+
"capabilities": ["tools", "tui.renderer"],
|
|
7
|
+
"contributes": {
|
|
8
|
+
"renderers": [
|
|
9
|
+
{
|
|
10
|
+
"id": "weather-card",
|
|
11
|
+
"matcher": { "toolName": "get_weather" },
|
|
12
|
+
"entry": "renderers-dist/weather.js"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"scripts": { "postinstall": "otto extension build" }
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-otto/plugin-weather",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Weather forecast plugin — get_weather tool (Open-Meteo, no API key) + terminal card renderer",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@x-otto/interchange": "0.1.0-alpha.1",
|
|
8
|
+
"@x-otto/plugin": "0.1.0-alpha.1"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"otto-plugin.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"plugin.ts",
|
|
15
|
+
"src",
|
|
16
|
+
"plugin-dist"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org",
|
|
21
|
+
"tag": "alpha"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"test": "vitest run"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apiVersion":1,"compilerVersion":"0.1.0-alpha.1","sourceHash":"9e8bd4430b48b0319a2b7d5ae2439dc182c9db159fb3431fa2612c49e4095606"}
|