pitstop-cli 1.1.0__tar.gz → 1.2.0__tar.gz
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.
- pitstop_cli-1.2.0/.github/workflows/ci.yml +64 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/.github/workflows/release.yml +22 -7
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/.github/workflows/upstream-smoke.yml +5 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/CHANGELOG.md +43 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/PKG-INFO +30 -14
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/README.md +26 -10
- pitstop_cli-1.2.0/evals/agent/README.md +67 -0
- pitstop_cli-1.2.0/evals/agent/recipes.json +192 -0
- pitstop_cli-1.2.0/evals/agent/results/.gitkeep +0 -0
- pitstop_cli-1.2.0/evals/agent/tasks.json +230 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/pyproject.toml +3 -3
- pitstop_cli-1.2.0/scripts/run-agent-evals.sh +323 -0
- pitstop_cli-1.2.0/scripts/smoke-installed.py +63 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/skills/pitstop/SKILL.md +13 -2
- pitstop_cli-1.2.0/src/pitstop/cache.py +36 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/chargers.py +40 -8
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/cli.py +93 -39
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/core.py +64 -24
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/cpo_tariffs.py +2 -2
- pitstop_cli-1.2.0/src/pitstop/geocoding.py +254 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/mcp_server.py +66 -38
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/overpass.py +43 -17
- pitstop_cli-1.2.0/src/pitstop/results.py +22 -0
- pitstop_cli-1.2.0/src/pitstop/validation.py +52 -0
- pitstop_cli-1.2.0/src/pitstop/version.py +1 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/tests/test_chargers.py +79 -3
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/tests/test_core.py +25 -0
- pitstop_cli-1.2.0/tests/test_geocoding.py +79 -0
- pitstop_cli-1.2.0/tests/test_query_reuse.py +39 -0
- pitstop_cli-1.2.0/tests/test_validation.py +59 -0
- pitstop_cli-1.1.0/.github/workflows/ci.yml +0 -41
- pitstop_cli-1.1.0/src/pitstop/geocoding.py +0 -146
- pitstop_cli-1.1.0/src/pitstop/version.py +0 -1
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/.gitignore +0 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/LICENSE +0 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/__init__.py +0 -0
- {pitstop_cli-1.1.0 → pitstop_cli-1.2.0}/src/pitstop/__main__.py +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.10", "3.12"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python-version }}
|
|
19
|
+
- run: python -m pip install --upgrade pip
|
|
20
|
+
- run: pip install -e ".[dev]"
|
|
21
|
+
- run: pytest -q
|
|
22
|
+
|
|
23
|
+
mcp-protocol:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
strategy:
|
|
26
|
+
matrix:
|
|
27
|
+
mcp-requirement: ["mcp==1.12.0", "mcp<2"]
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
- run: pip install ".[mcp]" "$MCP_REQUIREMENT"
|
|
34
|
+
env:
|
|
35
|
+
MCP_REQUIREMENT: ${{ matrix.mcp-requirement }}
|
|
36
|
+
- run: python scripts/smoke-installed.py
|
|
37
|
+
|
|
38
|
+
build:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.12"
|
|
45
|
+
- run: pip install build
|
|
46
|
+
- run: python -m build
|
|
47
|
+
- run: pip install --no-deps dist/*.whl
|
|
48
|
+
- run: python scripts/smoke-installed.py
|
|
49
|
+
|
|
50
|
+
# Offline half of the eval suite: the eval files match the shipped parser, so a
|
|
51
|
+
# recipe or task can never name a command the CLI cannot run. The live half
|
|
52
|
+
# needs MIMIT and Overpass and runs in the weekly canary instead.
|
|
53
|
+
agent-evals:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- uses: actions/setup-python@v5
|
|
58
|
+
with:
|
|
59
|
+
python-version: "3.12"
|
|
60
|
+
- run: pip install -e .
|
|
61
|
+
- run: scripts/run-agent-evals.sh
|
|
62
|
+
env:
|
|
63
|
+
PITSTOP_EVAL_BIN: pitstop
|
|
64
|
+
PITSTOP_EVAL_OFFLINE: "1"
|
|
@@ -7,7 +7,7 @@ on:
|
|
|
7
7
|
workflow_dispatch:
|
|
8
8
|
inputs:
|
|
9
9
|
version:
|
|
10
|
-
description: Existing tag to release, for example v1.0
|
|
10
|
+
description: Existing tag to release, for example v1.2.0
|
|
11
11
|
required: true
|
|
12
12
|
type: string
|
|
13
13
|
|
|
@@ -15,6 +15,9 @@ permissions:
|
|
|
15
15
|
contents: write
|
|
16
16
|
id-token: write
|
|
17
17
|
|
|
18
|
+
env:
|
|
19
|
+
RELEASE_TAG: ${{ inputs.version || github.ref_name }}
|
|
20
|
+
|
|
18
21
|
jobs:
|
|
19
22
|
build:
|
|
20
23
|
name: Build distributions
|
|
@@ -22,18 +25,34 @@ jobs:
|
|
|
22
25
|
steps:
|
|
23
26
|
- uses: actions/checkout@v4
|
|
24
27
|
with:
|
|
25
|
-
ref: ${{ github.
|
|
28
|
+
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.version) || github.ref }}
|
|
26
29
|
|
|
27
30
|
- uses: actions/setup-python@v5
|
|
28
31
|
with:
|
|
29
32
|
python-version: "3.12"
|
|
30
33
|
|
|
34
|
+
- name: Check tag and package versions agree
|
|
35
|
+
run: |
|
|
36
|
+
python - <<'PY'
|
|
37
|
+
import os, runpy, tomllib
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
tag = os.environ["RELEASE_TAG"]
|
|
40
|
+
package = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
|
|
41
|
+
runtime = runpy.run_path("src/pitstop/version.py")["__version__"]
|
|
42
|
+
if tag != f"v{package}" or runtime != package:
|
|
43
|
+
raise SystemExit(f"Version mismatch: tag={tag}, package={package}, runtime={runtime}")
|
|
44
|
+
PY
|
|
45
|
+
|
|
31
46
|
- run: python -m pip install --upgrade build twine
|
|
32
47
|
|
|
33
48
|
- run: python -m build
|
|
34
49
|
|
|
35
50
|
- run: python -m twine check dist/*
|
|
36
51
|
|
|
52
|
+
- run: python -m pip install --no-deps dist/*.whl
|
|
53
|
+
|
|
54
|
+
- run: python scripts/smoke-installed.py
|
|
55
|
+
|
|
37
56
|
- uses: actions/upload-artifact@v4
|
|
38
57
|
with:
|
|
39
58
|
name: pitstop-cli-dist
|
|
@@ -51,11 +70,7 @@ jobs:
|
|
|
51
70
|
|
|
52
71
|
- name: Resolve release tag
|
|
53
72
|
run: |
|
|
54
|
-
|
|
55
|
-
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
|
|
56
|
-
else
|
|
57
|
-
echo "VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
|
|
58
|
-
fi
|
|
73
|
+
echo "VERSION=$RELEASE_TAG" >> "$GITHUB_ENV"
|
|
59
74
|
|
|
60
75
|
- name: Publish release
|
|
61
76
|
env:
|
|
@@ -4,6 +4,47 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project aims
|
|
5
5
|
to follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.2.0] - 2026-09-10
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Municipality discovery through `pitstop places` and the `find_places` MCP tool;
|
|
12
|
+
charger searches accept province and ISTAT ID and report the resolved location.
|
|
13
|
+
- Search coverage counts and cache timestamps in JSON and GeoJSON envelopes.
|
|
14
|
+
- Read-only MCP annotations and structured results; installed CLI/MCP checks
|
|
15
|
+
cover the minimum supported SDK (1.12) and the current 1.x SDK.
|
|
16
|
+
- Standard `--version` shortcut and charger download timeout/cache-age flags.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Replace Alperia and Neogy tariff links that returned HTTP 404 with their
|
|
21
|
+
current official charging-offer and direct-payment pages.
|
|
22
|
+
- CLI and MCP searches reject non-finite or out-of-range coordinates,
|
|
23
|
+
nonpositive radii, and negative limits before fetching data. Invalid CLI
|
|
24
|
+
searches return exit code 2 instead of empty results or invalid JSON.
|
|
25
|
+
- Freshness filters exclude prices with missing, unparseable, or future update
|
|
26
|
+
dates. Unfiltered queries still include those reported prices.
|
|
27
|
+
- Charger municipality centers come from OSM administrative relations keyed by
|
|
28
|
+
ISTAT ID, correcting the misplaced Bolzano reference. Duplicate town names
|
|
29
|
+
require disambiguation instead of silently selecting a different province.
|
|
30
|
+
- Fuel queries no longer mutate shared station/price objects. Parsed datasets
|
|
31
|
+
and statistics are reused between MCP calls and invalidated after a refresh.
|
|
32
|
+
- Cache writes use unique temporary files; malformed Overpass caches are retried
|
|
33
|
+
and valid empty caches retain their provenance during an upstream failure.
|
|
34
|
+
- Charger results exclude invalid coordinates and centers outside the radius.
|
|
35
|
+
- Release workflows check out the requested tag and verify that tag, package,
|
|
36
|
+
and runtime versions agree before publication.
|
|
37
|
+
|
|
38
|
+
## [1.1.1] - 2026-09-07
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- `--free` now returns only chargers with `fee=no`. Unknown fee (absent OSM
|
|
43
|
+
tag) used to pass the filter alongside true free stations, so most `--free`
|
|
44
|
+
hits near Bolzano were chargers that might bill. Refs #6.
|
|
45
|
+
- `--public` now requires an explicit `public` / `yes` / `permissive` access
|
|
46
|
+
tag; a missing access tag no longer counts as public.
|
|
47
|
+
|
|
7
48
|
## [1.1.0] - 2026-08-02
|
|
8
49
|
|
|
9
50
|
Correctness release: closes gaps between what `pitstop` claimed and what it
|
|
@@ -316,6 +357,8 @@ Initial release.
|
|
|
316
357
|
- `--fuel` is a substring match, so `Gasolio` also matches variants such as
|
|
317
358
|
`Gasolio Alpino`.
|
|
318
359
|
|
|
360
|
+
[1.1.1]: https://github.com/galjos/pitstop-cli/releases/tag/v1.1.1
|
|
361
|
+
[1.1.0]: https://github.com/galjos/pitstop-cli/releases/tag/v1.1.0
|
|
319
362
|
[1.0.2]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.2
|
|
320
363
|
[1.0.1]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.1
|
|
321
364
|
[1.0.0]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pitstop-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: JSON-first CLI + MCP server for Italian fuel-station prices and EV charging — MIMIT, OpenStreetMap, ISTAT.
|
|
5
5
|
Project-URL: Homepage, https://github.com/galjos/pitstop-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/galjos/pitstop-cli
|
|
@@ -44,10 +44,10 @@ Classifier: Topic :: Scientific/Engineering :: GIS
|
|
|
44
44
|
Classifier: Topic :: Utilities
|
|
45
45
|
Requires-Python: >=3.10
|
|
46
46
|
Provides-Extra: dev
|
|
47
|
-
Requires-Dist: mcp<2,>=1.
|
|
47
|
+
Requires-Dist: mcp<2,>=1.12; extra == 'dev'
|
|
48
48
|
Requires-Dist: pytest>=7; extra == 'dev'
|
|
49
49
|
Provides-Extra: mcp
|
|
50
|
-
Requires-Dist: mcp<2,>=1.
|
|
50
|
+
Requires-Dist: mcp<2,>=1.12; extra == 'mcp'
|
|
51
51
|
Description-Content-Type: text/markdown
|
|
52
52
|
|
|
53
53
|
# pitstop
|
|
@@ -58,11 +58,11 @@ Description-Content-Type: text/markdown
|
|
|
58
58
|
|
|
59
59
|
A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
|
|
60
60
|
|
|
61
|
-
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap
|
|
61
|
+
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data), and OpenStreetMap provides EV charger locations and capabilities. Raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating municipality names. `pitstop` handles those steps locally and returns JSON or a readable table.
|
|
62
62
|
|
|
63
63
|
Built for questions like:
|
|
64
64
|
- *"What's the cheapest diesel near Rome right now?"* → `pitstop stations --fuel Gasolio --near 41.9,12.5 --cheapest`
|
|
65
|
-
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --
|
|
65
|
+
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --near 46.498,11.354 --fast`
|
|
66
66
|
- *"Are these station prices statistically reliable?"* → every price says whether it was screened against its local market; screened ones carry a `regional_median`, a `deviation_pct`, and `outlier: true` when the price looks like a misreport.
|
|
67
67
|
|
|
68
68
|
International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
|
|
@@ -78,8 +78,9 @@ Unofficial community project. Not affiliated with or endorsed by MIMIT. Fuel dat
|
|
|
78
78
|
- **Coverage:** Italy only (by design, for now).
|
|
79
79
|
- **Known caveats:**
|
|
80
80
|
- Some operators report placeholder values (e.g. `1.000`); use `--min-price` (e.g. `1.2`) to drop them.
|
|
81
|
-
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field.
|
|
82
|
-
- Some stations are **mis-geocoded** in the registry.
|
|
81
|
+
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field. When enabled, the freshness filter also excludes missing, unparseable, and future update dates.
|
|
82
|
+
- Some stations are **mis-geocoded** in the registry. `pitstop` uses station clusters and a second coordinate reference from [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani) to flag discrepancies over 30 km as `coordinate_suspect` (`*` in the table). `--near` also excludes stations whose declared comune is geographically too far from the query point. Pass `--no-comune-validate` to disable the second reference.
|
|
83
|
+
- **Municipality reference coordinates can also be wrong.** Charger searches resolve a municipality's ISTAT ID to its mapped OpenStreetMap administrative center. JSON includes the selected `location`, its source link, cache age, and warnings when it differs from the reference coordinates. Ambiguous names require `--provincia` or `--comune-id`. If no mapped center is available, supply `--near lat,lon`.
|
|
83
84
|
|
|
84
85
|
## Install
|
|
85
86
|
|
|
@@ -119,10 +120,19 @@ pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
|
|
|
119
120
|
pitstop fuels
|
|
120
121
|
|
|
121
122
|
# Fast EV chargers (≥50 kW) within 5 km of Bolzano
|
|
122
|
-
pitstop chargers --
|
|
123
|
+
pitstop chargers --comune Bozen --radius 5 --fast --public --json
|
|
124
|
+
|
|
125
|
+
# Discover municipality IDs and disambiguate duplicate names
|
|
126
|
+
pitstop places Livo --json
|
|
127
|
+
pitstop chargers --comune Livo --provincia TN --json
|
|
128
|
+
pitstop chargers --comune-id 021008 --radius 5 --fast --json
|
|
123
129
|
```
|
|
124
130
|
|
|
125
|
-
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price
|
|
131
|
+
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price`, `--fresh-within-days`, `--max-deviation-pct`, `--no-comune-validate`, `--limit`, `--json`, `--geojson`. Choose one output format. `--limit 0` returns every match.
|
|
132
|
+
|
|
133
|
+
Distances and radii are straight-line measurements, not driving distances or travel times.
|
|
134
|
+
|
|
135
|
+
Loading flags (`--refresh`, `--max-age` in seconds, `--timeout` in seconds) apply to MIMIT commands and charger searches. The default caches last 24 hours for MIMIT, seven days for OSM, and 30 days for the municipality reference. `--refresh` also refreshes a charger's municipality lookup; `--max-age` controls its charger results. `--max-age 0` accepts cached files of any age. `places` supports `--refresh` and `--timeout`.
|
|
126
136
|
|
|
127
137
|
Every returned price carries a `median_basis`. A `screened` price also carries `regional_median` and `deviation_pct`, plus `outlier: true` when it is >15% below the local median **or** below the Tukey lower fence Q1−1.5·IQR (the Tukey rule catches misreports in tight markets that the percent rule alone misses). The `outlier` key is emitted **only when it is true**, so read it as optional. Pass `--drop-outliers` to remove flagged prices entirely.
|
|
128
138
|
|
|
@@ -130,7 +140,7 @@ A price is `unscreened` when its (fuel, provincia) bucket holds too few samples
|
|
|
130
140
|
|
|
131
141
|
## MCP server
|
|
132
142
|
|
|
133
|
-
For agents that speak MCP, the same data is exposed as tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `get_stats`) over the shared core
|
|
143
|
+
For agents that speak MCP, the same data is exposed as six tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `find_places`, `get_stats`) over the shared core. Tools advertise read-only behavior and return structured JSON alongside text. Repeated fuel searches reuse parsed files and provincial statistics until the cached files change.
|
|
134
144
|
|
|
135
145
|
```bash
|
|
136
146
|
pip install "pitstop-cli[mcp]" # or: uv tool install "pitstop-cli[mcp]"
|
|
@@ -143,24 +153,30 @@ Example client config entry:
|
|
|
143
153
|
{ "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
|
|
144
154
|
```
|
|
145
155
|
|
|
156
|
+
Machine-readable command recipes, with the caveats that belong with each answer, are in [evals/agent/recipes.json](evals/agent/recipes.json); the agent skill bundle is in [skills/pitstop/SKILL.md](skills/pitstop/SKILL.md). `scripts/run-agent-evals.sh` checks those recipes against the live CLI, and [evals/agent/README.md](evals/agent/README.md) explains how a scored round is recorded.
|
|
157
|
+
|
|
146
158
|
## Development
|
|
147
159
|
|
|
148
160
|
```bash
|
|
149
161
|
pip install -e ".[dev]"
|
|
150
162
|
pytest -q
|
|
163
|
+
python scripts/smoke-installed.py # installed entry points and stdio MCP, offline
|
|
151
164
|
```
|
|
152
165
|
|
|
153
166
|
## Automation contract
|
|
154
167
|
|
|
155
168
|
- `stdout` is command output; `stderr` is diagnostics.
|
|
156
|
-
-
|
|
169
|
+
- `stations --json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `quality`, `stations[]`, and `disclaimer`.
|
|
170
|
+
- Fuel and charger search envelopes include `coverage`: `fetched_count`, `matched_count` before the limit, `returned_count`, and `truncated`. These counts describe the downloaded data; OSM coverage is not an exhaustive charger inventory.
|
|
171
|
+
- `freshness` records local `fetched_at` and `age_seconds`: separately for the fuel registry and prices, or for the charger response. Charger `cache_status` is `hit`, `miss`, `stale_fallback`, `partial`, or `unavailable`. A partial/unavailable response has no successful fetch timestamp; an `error` explains degraded results. Fetch time does not establish current prices or charger availability.
|
|
172
|
+
- Charger municipality searches add `location` with the selected name, province, ISTAT ID, coordinates, provenance, and warnings. GeoJSON carries these envelope fields under `metadata`.
|
|
157
173
|
- Exit codes: `0` success, `1` runtime error, `2` usage error.
|
|
158
|
-
- Source files are cached
|
|
174
|
+
- Source files are cached under `$XDG_CACHE_HOME/pitstop` (or `~/.cache/pitstop`); use `--refresh` to bypass.
|
|
159
175
|
- Non-interactive; no hidden browser state or scraping.
|
|
160
176
|
|
|
161
177
|
## Status & roadmap
|
|
162
178
|
|
|
163
|
-
v1.
|
|
179
|
+
v1.2.0 adds municipality discovery, province and ISTAT-ID selection for chargers, search coverage and cache timestamps, and structured MCP results. Fuel prices, EV charger locations, statistics, navigation links, and GeoJSON remain available through the CLI and MCP server. See [CHANGELOG.md](CHANGELOG.md) for fixes and compatibility details.
|
|
164
180
|
|
|
165
181
|
Planned, roughly in order:
|
|
166
182
|
- per-station **EV tariff data** if a source `pitstop` can read starts publishing per-kWh prices (today it parses only OSM's `fee` yes/no flag, no price field);
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
|
|
8
8
|
|
|
9
|
-
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap
|
|
9
|
+
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data), and OpenStreetMap provides EV charger locations and capabilities. Raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating municipality names. `pitstop` handles those steps locally and returns JSON or a readable table.
|
|
10
10
|
|
|
11
11
|
Built for questions like:
|
|
12
12
|
- *"What's the cheapest diesel near Rome right now?"* → `pitstop stations --fuel Gasolio --near 41.9,12.5 --cheapest`
|
|
13
|
-
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --
|
|
13
|
+
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --near 46.498,11.354 --fast`
|
|
14
14
|
- *"Are these station prices statistically reliable?"* → every price says whether it was screened against its local market; screened ones carry a `regional_median`, a `deviation_pct`, and `outlier: true` when the price looks like a misreport.
|
|
15
15
|
|
|
16
16
|
International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
|
|
@@ -26,8 +26,9 @@ Unofficial community project. Not affiliated with or endorsed by MIMIT. Fuel dat
|
|
|
26
26
|
- **Coverage:** Italy only (by design, for now).
|
|
27
27
|
- **Known caveats:**
|
|
28
28
|
- Some operators report placeholder values (e.g. `1.000`); use `--min-price` (e.g. `1.2`) to drop them.
|
|
29
|
-
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field.
|
|
30
|
-
- Some stations are **mis-geocoded** in the registry.
|
|
29
|
+
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field. When enabled, the freshness filter also excludes missing, unparseable, and future update dates.
|
|
30
|
+
- Some stations are **mis-geocoded** in the registry. `pitstop` uses station clusters and a second coordinate reference from [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani) to flag discrepancies over 30 km as `coordinate_suspect` (`*` in the table). `--near` also excludes stations whose declared comune is geographically too far from the query point. Pass `--no-comune-validate` to disable the second reference.
|
|
31
|
+
- **Municipality reference coordinates can also be wrong.** Charger searches resolve a municipality's ISTAT ID to its mapped OpenStreetMap administrative center. JSON includes the selected `location`, its source link, cache age, and warnings when it differs from the reference coordinates. Ambiguous names require `--provincia` or `--comune-id`. If no mapped center is available, supply `--near lat,lon`.
|
|
31
32
|
|
|
32
33
|
## Install
|
|
33
34
|
|
|
@@ -67,10 +68,19 @@ pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
|
|
|
67
68
|
pitstop fuels
|
|
68
69
|
|
|
69
70
|
# Fast EV chargers (≥50 kW) within 5 km of Bolzano
|
|
70
|
-
pitstop chargers --
|
|
71
|
+
pitstop chargers --comune Bozen --radius 5 --fast --public --json
|
|
72
|
+
|
|
73
|
+
# Discover municipality IDs and disambiguate duplicate names
|
|
74
|
+
pitstop places Livo --json
|
|
75
|
+
pitstop chargers --comune Livo --provincia TN --json
|
|
76
|
+
pitstop chargers --comune-id 021008 --radius 5 --fast --json
|
|
71
77
|
```
|
|
72
78
|
|
|
73
|
-
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price
|
|
79
|
+
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price`, `--fresh-within-days`, `--max-deviation-pct`, `--no-comune-validate`, `--limit`, `--json`, `--geojson`. Choose one output format. `--limit 0` returns every match.
|
|
80
|
+
|
|
81
|
+
Distances and radii are straight-line measurements, not driving distances or travel times.
|
|
82
|
+
|
|
83
|
+
Loading flags (`--refresh`, `--max-age` in seconds, `--timeout` in seconds) apply to MIMIT commands and charger searches. The default caches last 24 hours for MIMIT, seven days for OSM, and 30 days for the municipality reference. `--refresh` also refreshes a charger's municipality lookup; `--max-age` controls its charger results. `--max-age 0` accepts cached files of any age. `places` supports `--refresh` and `--timeout`.
|
|
74
84
|
|
|
75
85
|
Every returned price carries a `median_basis`. A `screened` price also carries `regional_median` and `deviation_pct`, plus `outlier: true` when it is >15% below the local median **or** below the Tukey lower fence Q1−1.5·IQR (the Tukey rule catches misreports in tight markets that the percent rule alone misses). The `outlier` key is emitted **only when it is true**, so read it as optional. Pass `--drop-outliers` to remove flagged prices entirely.
|
|
76
86
|
|
|
@@ -78,7 +88,7 @@ A price is `unscreened` when its (fuel, provincia) bucket holds too few samples
|
|
|
78
88
|
|
|
79
89
|
## MCP server
|
|
80
90
|
|
|
81
|
-
For agents that speak MCP, the same data is exposed as tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `get_stats`) over the shared core
|
|
91
|
+
For agents that speak MCP, the same data is exposed as six tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `find_places`, `get_stats`) over the shared core. Tools advertise read-only behavior and return structured JSON alongside text. Repeated fuel searches reuse parsed files and provincial statistics until the cached files change.
|
|
82
92
|
|
|
83
93
|
```bash
|
|
84
94
|
pip install "pitstop-cli[mcp]" # or: uv tool install "pitstop-cli[mcp]"
|
|
@@ -91,24 +101,30 @@ Example client config entry:
|
|
|
91
101
|
{ "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
|
|
92
102
|
```
|
|
93
103
|
|
|
104
|
+
Machine-readable command recipes, with the caveats that belong with each answer, are in [evals/agent/recipes.json](evals/agent/recipes.json); the agent skill bundle is in [skills/pitstop/SKILL.md](skills/pitstop/SKILL.md). `scripts/run-agent-evals.sh` checks those recipes against the live CLI, and [evals/agent/README.md](evals/agent/README.md) explains how a scored round is recorded.
|
|
105
|
+
|
|
94
106
|
## Development
|
|
95
107
|
|
|
96
108
|
```bash
|
|
97
109
|
pip install -e ".[dev]"
|
|
98
110
|
pytest -q
|
|
111
|
+
python scripts/smoke-installed.py # installed entry points and stdio MCP, offline
|
|
99
112
|
```
|
|
100
113
|
|
|
101
114
|
## Automation contract
|
|
102
115
|
|
|
103
116
|
- `stdout` is command output; `stderr` is diagnostics.
|
|
104
|
-
-
|
|
117
|
+
- `stations --json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `quality`, `stations[]`, and `disclaimer`.
|
|
118
|
+
- Fuel and charger search envelopes include `coverage`: `fetched_count`, `matched_count` before the limit, `returned_count`, and `truncated`. These counts describe the downloaded data; OSM coverage is not an exhaustive charger inventory.
|
|
119
|
+
- `freshness` records local `fetched_at` and `age_seconds`: separately for the fuel registry and prices, or for the charger response. Charger `cache_status` is `hit`, `miss`, `stale_fallback`, `partial`, or `unavailable`. A partial/unavailable response has no successful fetch timestamp; an `error` explains degraded results. Fetch time does not establish current prices or charger availability.
|
|
120
|
+
- Charger municipality searches add `location` with the selected name, province, ISTAT ID, coordinates, provenance, and warnings. GeoJSON carries these envelope fields under `metadata`.
|
|
105
121
|
- Exit codes: `0` success, `1` runtime error, `2` usage error.
|
|
106
|
-
- Source files are cached
|
|
122
|
+
- Source files are cached under `$XDG_CACHE_HOME/pitstop` (or `~/.cache/pitstop`); use `--refresh` to bypass.
|
|
107
123
|
- Non-interactive; no hidden browser state or scraping.
|
|
108
124
|
|
|
109
125
|
## Status & roadmap
|
|
110
126
|
|
|
111
|
-
v1.
|
|
127
|
+
v1.2.0 adds municipality discovery, province and ISTAT-ID selection for chargers, search coverage and cache timestamps, and structured MCP results. Fuel prices, EV charger locations, statistics, navigation links, and GeoJSON remain available through the CLI and MCP server. See [CHANGELOG.md](CHANGELOG.md) for fixes and compatibility details.
|
|
112
128
|
|
|
113
129
|
Planned, roughly in order:
|
|
114
130
|
- per-station **EV tariff data** if a source `pitstop` can read starts publishing per-kWh prices (today it parses only OSM's `fee` yes/no flag, no price field);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Agent Evals
|
|
2
|
+
|
|
3
|
+
These evals test whether an agent can answer real fuel and EV-charging questions with `pitstop` without claiming more than the open data supports.
|
|
4
|
+
|
|
5
|
+
The goal is not to make `pitstop` answer broad natural-language questions itself. The goal is to verify that an agent can:
|
|
6
|
+
|
|
7
|
+
- pick the vocabulary the dataset uses instead of guessing it,
|
|
8
|
+
- choose stable CLI filters and parse the JSON envelope,
|
|
9
|
+
- read the per-price quality fields (`median_basis`, `regional_median`, `outlier`) before standing behind a number,
|
|
10
|
+
- treat an upstream failure as unknown rather than as an absence,
|
|
11
|
+
- state the source, the extraction date, and the Italy-only scope.
|
|
12
|
+
|
|
13
|
+
## Files
|
|
14
|
+
|
|
15
|
+
- `tasks.json` - real user-style prompts, expected command paths, scoring criteria, and common failure modes.
|
|
16
|
+
- `recipes.json` - machine-readable command recipes, parse targets, and caveats for common agent workflows.
|
|
17
|
+
- `results/` - dated reports from scored manual eval rounds.
|
|
18
|
+
- `../../scripts/run-agent-evals.sh` - live contract checks for the CLI surfaces the eval tasks use.
|
|
19
|
+
|
|
20
|
+
## Run The Smoke Evals
|
|
21
|
+
|
|
22
|
+
From the repository root:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
scripts/run-agent-evals.sh
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The runner calls the public MIMIT and Overpass endpoints. It requires `python3` and network access, and nothing else — the JSON work that the sibling `odh` runner gives to `jq` is done with the standard library, because pitstop's runtime has no third-party dependencies either.
|
|
29
|
+
|
|
30
|
+
To test an installed CLI instead of the source tree:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
PITSTOP_EVAL_BIN=pitstop scripts/run-agent-evals.sh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
MIMIT failures are hard failures. Overpass is a free community endpoint whose transient 5xx is normal operation, so it is retried and then downgraded to a warning — the same policy as `.github/workflows/upstream-smoke.yml`. pitstop's *handling* of that failure is asserted on every run either way.
|
|
37
|
+
|
|
38
|
+
## Manual Agent Eval Protocol
|
|
39
|
+
|
|
40
|
+
Use each `prompt` in `tasks.json` as a fresh agent task. The agent may use the `pitstop` CLI and, where a task calls for it, an operator's official page; it should not scrape unrelated websites by default.
|
|
41
|
+
|
|
42
|
+
Use `recipes.json` as a stable command-path library. Recipes are not final answers; they tell an agent which commands to run, which fields to parse, and which caveats must be reflected in the answer.
|
|
43
|
+
|
|
44
|
+
Score each task as:
|
|
45
|
+
|
|
46
|
+
- `pass` - uses the expected command path, handles the caveats, and gives a source-aware answer.
|
|
47
|
+
- `partial` - reaches useful data but misses a caveat, uses a less direct command, or overstates certainty.
|
|
48
|
+
- `fail` - guesses fuel names or prices, presents daily data as live, reads an upstream failure as an absence, or invents a number the data does not carry.
|
|
49
|
+
|
|
50
|
+
For every failure, decide whether the fix belongs in:
|
|
51
|
+
|
|
52
|
+
- documentation or skill guidance,
|
|
53
|
+
- an eval task clarification,
|
|
54
|
+
- a narrow CLI feature,
|
|
55
|
+
- or the agent's own reasoning layer.
|
|
56
|
+
|
|
57
|
+
Keep the CLI clean: add command surface only after repeated eval failures show the same missing mechanical data-access step.
|
|
58
|
+
|
|
59
|
+
## Recording A Round
|
|
60
|
+
|
|
61
|
+
Write `results/<YYYY-MM-DD>.md` with:
|
|
62
|
+
|
|
63
|
+
- **Setup** - CLI version and commit, how many agent attempts, what each agent was given (typically the installed CLI, `skills/pitstop/SKILL.md`, and `recipes.json`, with `tasks.json` and the repo source withheld), and the live upstream conditions during the round.
|
|
64
|
+
- **Scores** - one table row per task id with `pass` / `partial` / `fail`, then the totals.
|
|
65
|
+
- **Notes Per Task** - one line per task saying what the agent did and why it scored that way.
|
|
66
|
+
- **Failure Analysis And Fix Categories** - each observed issue with its fix category and whether it recurred.
|
|
67
|
+
- **Data Findings Worth Keeping** - upstream behaviour the round exposed that outlives it.
|