pitstop-cli 1.0.2__tar.gz → 1.1.1__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.
Files changed (29) hide show
  1. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/.github/workflows/ci.yml +16 -0
  2. pitstop_cli-1.1.1/.github/workflows/release.yml +93 -0
  3. pitstop_cli-1.1.1/.github/workflows/upstream-smoke.yml +285 -0
  4. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/.gitignore +2 -0
  5. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/CHANGELOG.md +54 -0
  6. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/PKG-INFO +19 -10
  7. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/README.md +15 -7
  8. pitstop_cli-1.1.1/evals/agent/README.md +67 -0
  9. pitstop_cli-1.1.1/evals/agent/recipes.json +164 -0
  10. pitstop_cli-1.1.1/evals/agent/results/.gitkeep +0 -0
  11. pitstop_cli-1.1.1/evals/agent/tasks.json +212 -0
  12. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/pyproject.toml +5 -3
  13. pitstop_cli-1.1.1/scripts/run-agent-evals.sh +323 -0
  14. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/skills/pitstop/SKILL.md +8 -5
  15. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/chargers.py +14 -16
  16. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/cli.py +49 -9
  17. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/core.py +61 -10
  18. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/cpo_tariffs.py +2 -11
  19. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/mcp_server.py +14 -9
  20. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/overpass.py +46 -0
  21. pitstop_cli-1.1.1/src/pitstop/version.py +1 -0
  22. pitstop_cli-1.1.1/tests/test_chargers.py +343 -0
  23. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/tests/test_core.py +171 -0
  24. pitstop_cli-1.0.2/src/pitstop/version.py +0 -1
  25. pitstop_cli-1.0.2/tests/test_chargers.py +0 -173
  26. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/LICENSE +0 -0
  27. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/__init__.py +0 -0
  28. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/__main__.py +0 -0
  29. {pitstop_cli-1.0.2 → pitstop_cli-1.1.1}/src/pitstop/geocoding.py +0 -0
@@ -39,3 +39,19 @@ jobs:
39
39
  python-version: "3.12"
40
40
  - run: pip install build
41
41
  - run: python -m build
42
+
43
+ # Offline half of the eval suite: the eval files match the shipped parser, so a
44
+ # recipe or task can never name a command the CLI cannot run. The live half
45
+ # needs MIMIT and Overpass and runs in the weekly canary instead.
46
+ agent-evals:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+ - uses: actions/setup-python@v5
51
+ with:
52
+ python-version: "3.12"
53
+ - run: pip install -e .
54
+ - run: scripts/run-agent-evals.sh
55
+ env:
56
+ PITSTOP_EVAL_BIN: pitstop
57
+ PITSTOP_EVAL_OFFLINE: "1"
@@ -0,0 +1,93 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: Existing tag to release, for example v1.0.2
11
+ required: true
12
+ type: string
13
+
14
+ permissions:
15
+ contents: write
16
+ id-token: write
17
+
18
+ jobs:
19
+ build:
20
+ name: Build distributions
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ ref: ${{ github.event.inputs.version || github.ref_name }}
26
+
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: "3.12"
30
+
31
+ - run: python -m pip install --upgrade build twine
32
+
33
+ - run: python -m build
34
+
35
+ - run: python -m twine check dist/*
36
+
37
+ - uses: actions/upload-artifact@v4
38
+ with:
39
+ name: pitstop-cli-dist
40
+ path: dist/*
41
+
42
+ publish-github:
43
+ name: Publish GitHub release
44
+ runs-on: ubuntu-latest
45
+ needs: build
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ name: pitstop-cli-dist
50
+ path: dist
51
+
52
+ - name: Resolve release tag
53
+ run: |
54
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
55
+ echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
56
+ else
57
+ echo "VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
58
+ fi
59
+
60
+ - name: Publish release
61
+ env:
62
+ GH_TOKEN: ${{ github.token }}
63
+ run: |
64
+ if gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
65
+ gh release edit "$VERSION" \
66
+ --repo "$GITHUB_REPOSITORY" \
67
+ --title "$VERSION" \
68
+ --notes "Automated pitstop-cli release for $VERSION."
69
+ gh release upload "$VERSION" dist/* \
70
+ --repo "$GITHUB_REPOSITORY" \
71
+ --clobber
72
+ else
73
+ gh release create "$VERSION" dist/* \
74
+ --repo "$GITHUB_REPOSITORY" \
75
+ --title "$VERSION" \
76
+ --notes "Automated pitstop-cli release for $VERSION." \
77
+ --verify-tag
78
+ fi
79
+
80
+ publish-pypi:
81
+ name: Publish PyPI package
82
+ runs-on: ubuntu-latest
83
+ needs: build
84
+ environment: pypi
85
+ steps:
86
+ - uses: actions/download-artifact@v4
87
+ with:
88
+ name: pitstop-cli-dist
89
+ path: dist
90
+
91
+ - uses: pypa/gh-action-pypi-publish@release/v1
92
+ with:
93
+ skip-existing: true
@@ -0,0 +1,285 @@
1
+ name: Upstream smoke
2
+
3
+ # Weekly canary over the live upstreams. A red run must mean "pitstop is broken",
4
+ # so nothing the maintainer cannot act on may turn it red. MIMIT failures are
5
+ # therefore hard failures; Overpass is a free community endpoint where transient
6
+ # 5xx is normal operation, so it is retried and then downgraded to a warning —
7
+ # but pitstop's *handling* of that failure is still asserted on every run.
8
+
9
+ on:
10
+ schedule:
11
+ - cron: "17 5 * * 1"
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ live-data:
19
+ name: Live data smoke
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 15
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - run: python -m pip install --upgrade pip
30
+
31
+ - run: pip install -e ".[mcp]"
32
+
33
+ - name: Check fuel prices
34
+ run: |
35
+ pitstop stations --comune ROMA --fuel Gasolio --cheapest --min-price 1.2 --fresh-within-days 120 --drop-outliers --limit 3 --json > fuel.json
36
+ python - <<'PY'
37
+ import json
38
+
39
+ with open("fuel.json", encoding="utf-8") as fh:
40
+ payload = json.load(fh)
41
+
42
+ assert payload["count"] > 0, payload
43
+ assert payload["source"].startswith("MIMIT"), payload["source"]
44
+ for station in payload["stations"]:
45
+ assert station["prices"], station
46
+ assert station["prices"][0]["price"] >= 1.2, station
47
+ PY
48
+
49
+ - name: Check MIMIT feed freshness
50
+ run: |
51
+ pitstop stations --comune ROMA --fuel Gasolio --limit 1 --json > freshness.json
52
+ python - <<'PY'
53
+ import json
54
+ import re
55
+ from datetime import date, datetime, timezone
56
+
57
+ # MIMIT publishes daily at ~06:45 UTC; at this job's pre-dawn hour the
58
+ # extraction date always lags exactly 2 days, weekends and holidays
59
+ # included (measured over nine archived samples, Dec 2025 - Jul 2026).
60
+ # 7 lets a stalled publish or two stay green while a frozen feed still
61
+ # goes red within one weekly run.
62
+ MAX_PRICE_AGE_DAYS = 7
63
+
64
+ with open("freshness.json", encoding="utf-8") as fh:
65
+ payload = json.load(fh)
66
+
67
+ price_date = payload["price_extraction_date"]
68
+ registry_date = payload["registry_extraction_date"]
69
+
70
+ # Both dates come straight off line 0 of the CSV, so a well-formed date
71
+ # here is also the cheapest proof we got the file and not MIMIT's
72
+ # maintenance page (whose line 0 is "<!DOCTYPE html>").
73
+ iso_date = re.compile(r"^\d{4}-\d{2}-\d{2}$")
74
+ for label, value in (("price", price_date), ("registry", registry_date)):
75
+ assert iso_date.match(str(value)), \
76
+ f"{label}_extraction_date is not a date: {value!r} -- MIMIT served something that is not the CSV"
77
+
78
+ today = datetime.now(timezone.utc).date()
79
+ age_days = (today - date.fromisoformat(price_date)).days
80
+ assert age_days <= MAX_PRICE_AGE_DAYS, (
81
+ f"MIMIT price feed looks frozen: price_extraction_date={price_date} "
82
+ f"is {age_days} days old (limit {MAX_PRICE_AGE_DAYS}); the feed normally "
83
+ f"lags 2 days at this hour"
84
+ )
85
+ # A future date means the line was misparsed, not that the feed is fresh;
86
+ # one day of slack absorbs the UTC/CET boundary.
87
+ assert age_days >= -1, f"price_extraction_date={price_date} is in the future (today={today})"
88
+
89
+ print(f"price_extraction_date={price_date} ({age_days}d old), "
90
+ f"registry_extraction_date={registry_date}, today={today}")
91
+ PY
92
+
93
+ - name: Check MIMIT dataset schema
94
+ run: |
95
+ pitstop stations --limit 0 --json > all.json
96
+ python - <<'PY'
97
+ import collections
98
+ import json
99
+ import statistics
100
+
101
+ # Every threshold sits an order of magnitude clear of what the live feed
102
+ # carried on 2026-08-01 (in brackets), so only a layout change that guts
103
+ # the parse can turn this red — not ordinary churn.
104
+ MIN_STATIONS = 10_000 # [23_917]
105
+ MAX_STATIONS = 200_000 # [23_917] -- catches a duplicated/garbage parse
106
+ MIN_PRICED_STATIONS = 5_000 # [21_697]
107
+ MIN_PRICE_ROWS = 20_000 # [93_007]
108
+ MIN_PROVINCE_CODES = 80 # [107 of Italy's 107]
109
+ MIN_IN_BBOX_SHARE = 0.90 # [0.9954]
110
+ MIN_ROWS_PER_MAIN_FUEL = 1_000 # [Benzina 34_267, Gasolio 34_146]
111
+ # Deliberately wide: catches a column shift or a lost decimal, not the
112
+ # market. [Benzina 1.999, Gasolio 2.099, GPL 0.739, Metano 1.599]
113
+ PRICE_BAND = (0.3, 6.0)
114
+
115
+ # The four structural MIMIT categories. The other ~55 values are brand
116
+ # names (Blue Diesel, HVOlution, ...) that come and go, so they are
117
+ # counted but not required.
118
+ CORE_FUELS = ("Benzina", "Gasolio", "GPL", "Metano")
119
+
120
+ STATION_FIELDS = ("id", "operator", "brand", "type", "name", "address",
121
+ "comune", "provincia", "lat", "lon", "prices")
122
+ PRICE_FIELDS = ("fuel", "price", "self_service", "updated", "median_basis")
123
+
124
+ ITALY_BBOX = (35.0, 47.6, 6.0, 19.0) # min_lat, max_lat, min_lon, max_lon
125
+
126
+ with open("all.json", encoding="utf-8") as fh:
127
+ payload = json.load(fh)
128
+
129
+ stations = payload["stations"]
130
+ assert payload["count"] == len(stations), (payload["count"], len(stations))
131
+ assert MIN_STATIONS <= len(stations) <= MAX_STATIONS, (
132
+ f"registry parsed to {len(stations)} stations, outside the plausible "
133
+ f"{MIN_STATIONS}..{MAX_STATIONS} band -- suspect an anagrafica layout change"
134
+ )
135
+
136
+ price_rows = 0
137
+ priced_stations = 0
138
+ province_codes = set()
139
+ in_bbox = 0
140
+ by_fuel = collections.defaultdict(list)
141
+
142
+ for st in stations:
143
+ missing = [f for f in STATION_FIELDS if f not in st]
144
+ assert not missing, f"station is missing {missing}: {st}"
145
+ prov = str(st["provincia"]).strip()
146
+ # The registry carries some dirty provincia values (full comune names
147
+ # instead of the 2-letter code), so count the well-formed ones rather
148
+ # than requiring every row to be clean.
149
+ if len(prov) == 2 and prov.isalpha():
150
+ province_codes.add(prov.upper())
151
+ lat, lon = st["lat"], st["lon"]
152
+ if ITALY_BBOX[0] <= lat <= ITALY_BBOX[1] and ITALY_BBOX[2] <= lon <= ITALY_BBOX[3]:
153
+ in_bbox += 1
154
+ if st["prices"]:
155
+ priced_stations += 1
156
+ for p in st["prices"]:
157
+ missing = [f for f in PRICE_FIELDS if f not in p]
158
+ assert not missing, f"price row is missing {missing}: {p}"
159
+ assert isinstance(p["price"], (int, float)) and not isinstance(p["price"], bool), p
160
+ assert isinstance(p["self_service"], bool), p
161
+ by_fuel[str(p["fuel"]).strip()].append(float(p["price"]))
162
+ price_rows += 1
163
+
164
+ assert priced_stations >= MIN_PRICED_STATIONS, priced_stations
165
+ assert price_rows >= MIN_PRICE_ROWS, price_rows
166
+ assert len(province_codes) >= MIN_PROVINCE_CODES, sorted(province_codes)
167
+ bbox_share = in_bbox / len(stations)
168
+ assert bbox_share >= MIN_IN_BBOX_SHARE, (
169
+ f"only {bbox_share:.2%} of stations sit inside the Italy bbox -- "
170
+ f"suspect the lat/lon columns moved"
171
+ )
172
+
173
+ for fuel in CORE_FUELS:
174
+ prices = by_fuel.get(fuel, [])
175
+ assert prices, f"core fuel {fuel!r} vanished from the price feed"
176
+ median = statistics.median(prices)
177
+ assert PRICE_BAND[0] <= median <= PRICE_BAND[1], (
178
+ f"{fuel} median {median} is outside {PRICE_BAND} -- suspect a "
179
+ f"column shift or a lost decimal"
180
+ )
181
+
182
+ for fuel in ("Benzina", "Gasolio"):
183
+ assert len(by_fuel[fuel]) >= MIN_ROWS_PER_MAIN_FUEL, (fuel, len(by_fuel[fuel]))
184
+
185
+ print(f"stations={len(stations)} priced={priced_stations} price_rows={price_rows} "
186
+ f"province_codes={len(province_codes)} in_bbox={bbox_share:.2%} "
187
+ f"distinct_fuels={len(by_fuel)}")
188
+ for fuel in CORE_FUELS:
189
+ print(f" {fuel}: rows={len(by_fuel[fuel])} median={statistics.median(by_fuel[fuel]):.3f}")
190
+ PY
191
+
192
+ - name: Check price statistics
193
+ run: |
194
+ pitstop stats --fuel Gasolio --json > stats.json
195
+ python - <<'PY'
196
+ import json
197
+
198
+ with open("stats.json", encoding="utf-8") as fh:
199
+ payload = json.load(fh)
200
+
201
+ gasolio = payload["stats"]["Gasolio"]
202
+ assert gasolio["national"]["count"] > 1000, gasolio["national"]
203
+ assert gasolio["national"]["median"] > 1.0, gasolio["national"]
204
+ PY
205
+
206
+ - name: Check EV charger discovery
207
+ run: |
208
+ set -uo pipefail
209
+
210
+ # Exit 0 -> Overpass answered and the data assertions passed.
211
+ # Exit 75 -> Overpass is degraded but pitstop reported it correctly; retryable.
212
+ # Exit 1 -> pitstop itself is wrong. Never retried, never downgraded.
213
+ cat > check_chargers.py <<'PY'
214
+ import json
215
+ import re
216
+ import sys
217
+
218
+ with open("chargers.json", encoding="utf-8") as fh:
219
+ payload = json.load(fh)
220
+
221
+ # Holds whether or not Overpass answered.
222
+ assert payload["source"].startswith("OpenStreetMap"), payload["source"]
223
+ assert payload["count"] == len(payload["stations"]), payload
224
+
225
+ error = payload.get("error")
226
+ if error:
227
+ # Degraded upstream, but pitstop must still fail honestly: a populated
228
+ # error and no invented data. Hard failure even on a day Overpass is down.
229
+ assert isinstance(error, str) and error.strip(), repr(error)
230
+ # 429 is exempt: rate-limiting is Overpass shedding load, not a bad request.
231
+ assert not re.search(r"HTTP Error 4(?!29)\d\d", error), (
232
+ f"Overpass rejected the request: {error} -- a 4xx is pitstop asking the "
233
+ f"wrong question (query syntax, endpoint URL, user agent), not an "
234
+ f"upstream outage; see src/pitstop/overpass.py"
235
+ )
236
+ if payload["count"] == 0:
237
+ assert payload["stations"] == [], payload
238
+ with open("overpass_error.txt", "w", encoding="utf-8") as fh:
239
+ fh.write(error.strip())
240
+ print(f"Overpass degraded, no data returned: {error}")
241
+ sys.exit(75)
242
+ # A timed-out query can still hand back a partial element set; those
243
+ # rows are held to the same assertions as a clean run.
244
+ print(f"Overpass degraded but returned {payload['count']} station(s): {error}")
245
+ else:
246
+ # No error means pitstop is vouching for the result, so hold it to that.
247
+ assert payload["count"] > 0, payload
248
+
249
+ for station in payload["stations"]:
250
+ assert station.get("max_power_kw", 0) >= 50, station
251
+
252
+ print(f"ok: {payload['count']} fast charger(s)")
253
+ PY
254
+
255
+ rc=99
256
+ attempt=0
257
+ # Overpass sheds load with a 504 that clears in under a minute. 0+45+120s
258
+ # of backoff plus three 60s fetch timeouts fits the 15-minute job budget.
259
+ for delay in 0 45 120; do
260
+ attempt=$((attempt + 1))
261
+ if [ "$delay" -gt 0 ]; then
262
+ echo "Retrying in ${delay}s (attempt ${attempt}/3)..."
263
+ sleep "$delay"
264
+ fi
265
+ if ! pitstop chargers --near 46.498,11.354 --radius 8 --fast --limit 5 --json > chargers.json; then
266
+ echo "pitstop chargers exited non-zero -- that is a pitstop failure, not an upstream one"
267
+ exit 1
268
+ fi
269
+ rc=0
270
+ python check_chargers.py || rc=$?
271
+ [ "$rc" -eq 75 ] || break
272
+ done
273
+
274
+ if [ "$rc" -eq 75 ]; then
275
+ reason="$(cat overpass_error.txt 2>/dev/null || echo 'unknown')"
276
+ echo "::warning title=Overpass unavailable, EV charger data assertions skipped::Overpass failed ${attempt} attempts (${reason}) — transient 5xx from a free community endpoint, not a pitstop defect. pitstop's failure envelope was verified well-formed (populated error, count 0, no stations); only the charger data assertions were skipped. The MIMIT fuel-price, freshness and schema assertions all ran."
277
+ exit 0
278
+ fi
279
+
280
+ exit "$rc"
281
+
282
+ - name: Run live agent smoke evals
283
+ run: scripts/run-agent-evals.sh
284
+ env:
285
+ PITSTOP_EVAL_BIN: pitstop
@@ -9,4 +9,6 @@ venv/
9
9
  .pytest_cache/
10
10
  .ruff_cache/
11
11
  .mypy_cache/
12
+ .coverage
12
13
  .DS_Store
14
+ uv.lock
@@ -4,6 +4,58 @@ 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.1.1] - 2026-09-07
8
+
9
+ ### Fixed
10
+
11
+ - `--free` now returns only chargers with `fee=no`. Unknown fee (absent OSM
12
+ tag) used to pass the filter alongside true free stations, so most `--free`
13
+ hits near Bolzano were chargers that might bill. Refs #6.
14
+ - `--public` now requires an explicit `public` / `yes` / `permissive` access
15
+ tag; a missing access tag no longer counts as public.
16
+
17
+ ## [1.1.0] - 2026-08-02
18
+
19
+ Correctness release: closes gaps between what `pitstop` claimed and what it
20
+ returned.
21
+
22
+ ### Fixed
23
+
24
+ - `pitstop-mcp` was dead on a fresh install — `mcp` 2.0.0 removed
25
+ `mcp.server.fastmcp`. The `mcp` extra is now pinned `mcp>=1.0,<2`; lift the
26
+ bound only together with a 2.x migration.
27
+ - A failed Overpass response could poison the charger cache for 7 days (its
28
+ failures arrive as HTTP 200 plus a `remark` and were cached unvalidated),
29
+ after which every call returned `count: 0` and no error. Such bodies are now
30
+ never cached, a stale cache wins over them, and partial results come back
31
+ alongside the error.
32
+ - A MIMIT maintenance page (also HTTP 200) could poison the fuel cache for 24
33
+ hours. A download must now carry the `Estrazione del ...` header to be cached.
34
+ - The charger table dropped the Overpass error the JSON path reported, so a
35
+ degraded answer looked complete.
36
+
37
+ ### Changed
38
+
39
+ - The CLI legend, agent skill and MCP tool description documented only the
40
+ percentage half of the outlier rule; all now state the Tukey lower fence too,
41
+ and that `outlier` is present only when true.
42
+ - The stations table marks unscreened prices `~` and prints its source and
43
+ extraction dates.
44
+ - EV tariff wording now describes what `pitstop` parses (OSM's `fee` yes/no
45
+ flag, no price field) rather than asserting what OpenStreetMap contains.
46
+ - Withdrawn: the agent skill claimed unscreened prices were "a small minority,
47
+ concentrated in methane, HVO, GPL". That was measured from a single snapshot
48
+ and shipped as standing fact. Read the `quality` block instead — it reports
49
+ the real figure for the answer you got.
50
+
51
+ ### Added
52
+
53
+ - `quality` block in the JSON envelope plus a per-price `median_basis`: a price
54
+ in a thin (fuel, provincia) bucket gets no outlier verdict and now says so,
55
+ instead of serializing like a screened-and-clean price. Purely additive.
56
+ - The weekly upstream canary asserts MIMIT freshness and schema shape, and
57
+ tolerates transient Overpass 5xx (a 4xx still fails).
58
+
7
59
  ## [1.0.2] - 2026-06-26
8
60
 
9
61
  Documentation/package-description patch. The README status section still
@@ -274,6 +326,8 @@ Initial release.
274
326
  - `--fuel` is a substring match, so `Gasolio` also matches variants such as
275
327
  `Gasolio Alpino`.
276
328
 
329
+ [1.1.1]: https://github.com/galjos/pitstop-cli/releases/tag/v1.1.1
330
+ [1.1.0]: https://github.com/galjos/pitstop-cli/releases/tag/v1.1.0
277
331
  [1.0.2]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.2
278
332
  [1.0.1]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.1
279
333
  [1.0.0]: https://github.com/galjos/pitstop-cli/releases/tag/v1.0.0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: pitstop-cli
3
- Version: 1.0.2
3
+ Version: 1.1.1
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,13 +44,18 @@ 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.0; extra == 'dev'
47
48
  Requires-Dist: pytest>=7; extra == 'dev'
48
49
  Provides-Extra: mcp
49
- Requires-Dist: mcp>=1.0; extra == 'mcp'
50
+ Requires-Dist: mcp<2,>=1.0; extra == 'mcp'
50
51
  Description-Content-Type: text/markdown
51
52
 
52
53
  # pitstop
53
54
 
55
+ [![CI](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml)
56
+ [![Release](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml)
57
+ [![Upstream smoke](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml)
58
+
54
59
  A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
55
60
 
56
61
  Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap maps every EV charger in the country, but raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating between Italian comune names and the ones a user actually types. `pitstop` does all of that locally and returns a small, well-formed JSON envelope.
@@ -58,7 +63,7 @@ Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti*
58
63
  Built for questions like:
59
64
  - *"What's the cheapest diesel near Rome right now?"* → `pitstop stations --fuel Gasolio --near 41.9,12.5 --cheapest`
60
65
  - *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --comune Bozen --fast`
61
- - *"Are these station prices statistically reliable?"* → every price carries a `regional_median`, `deviation_pct`, and `outlier` flag.
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.
62
67
 
63
68
  International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
64
69
 
@@ -117,9 +122,11 @@ pitstop fuels
117
122
  pitstop chargers --near 46.498,11.354 --radius 5 --fast --json
118
123
  ```
119
124
 
120
- `stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to any data command.
125
+ `stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to the MIMIT data commands (`stations`, `fuels`, `stats`); `chargers` uses its own OSM cache and takes only `--refresh`.
126
+
127
+ 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.
121
128
 
122
- Every returned price carries `regional_median`, `deviation_pct`, and an `outlier` flag (true when >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). Pass `--drop-outliers` to remove flagged prices entirely.
129
+ A price is `unscreened` when its (fuel, provincia) bucket holds too few samples for a median, so **no outlier check ran on it** and it is returned as reported (the table marks these `~`). The `--json` envelope's `quality` block counts screened vs unscreened prices for the answer you got.
123
130
 
124
131
  ## MCP server
125
132
 
@@ -136,6 +143,8 @@ Example client config entry:
136
143
  { "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
137
144
  ```
138
145
 
146
+ 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.
147
+
139
148
  ## Development
140
149
 
141
150
  ```bash
@@ -146,18 +155,18 @@ pytest -q
146
155
  ## Automation contract
147
156
 
148
157
  - `stdout` is command output; `stderr` is diagnostics.
149
- - `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `stations[]`, and `disclaimer`.
158
+ - `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `quality`, `stations[]`, and `disclaimer`.
150
159
  - Exit codes: `0` success, `1` runtime error, `2` usage error.
151
160
  - Source files are cached (default 24h) under `$XDG_CACHE_HOME/pitstop`; use `--refresh` to bypass.
152
161
  - Non-interactive; no hidden browser state or scraping.
153
162
 
154
163
  ## Status & roadmap
155
164
 
156
- v1.0.2 — stable public release: fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, agent skill, tests, CI.
165
+ v1.1.1 — stable public release: fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, agent skill, tests, CI.
157
166
 
158
167
  Planned, roughly in order:
159
- - per-station **EV tariff data** once Italy exposes a documented public API for PUN / AFIR data;
160
- - additional countries behind a per-country source adapter (e.g. Germany Tankerkönig, France/Spain official feeds).
168
+ - 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);
169
+ - additional countries behind a per-country source adapter, only where the source's own terms permit the bulk download and locally derived ranking `pitstop` does.
161
170
 
162
171
  ## Data sources & attributions
163
172
 
@@ -1,5 +1,9 @@
1
1
  # pitstop
2
2
 
3
+ [![CI](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml)
4
+ [![Release](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml)
5
+ [![Upstream smoke](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml)
6
+
3
7
  A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
4
8
 
5
9
  Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap maps every EV charger in the country, but raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating between Italian comune names and the ones a user actually types. `pitstop` does all of that locally and returns a small, well-formed JSON envelope.
@@ -7,7 +11,7 @@ Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti*
7
11
  Built for questions like:
8
12
  - *"What's the cheapest diesel near Rome right now?"* → `pitstop stations --fuel Gasolio --near 41.9,12.5 --cheapest`
9
13
  - *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --comune Bozen --fast`
10
- - *"Are these station prices statistically reliable?"* → every price carries a `regional_median`, `deviation_pct`, and `outlier` flag.
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.
11
15
 
12
16
  International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
13
17
 
@@ -66,9 +70,11 @@ pitstop fuels
66
70
  pitstop chargers --near 46.498,11.354 --radius 5 --fast --json
67
71
  ```
68
72
 
69
- `stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to any data command.
73
+ `stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to the MIMIT data commands (`stations`, `fuels`, `stats`); `chargers` uses its own OSM cache and takes only `--refresh`.
74
+
75
+ 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.
70
76
 
71
- Every returned price carries `regional_median`, `deviation_pct`, and an `outlier` flag (true when >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). Pass `--drop-outliers` to remove flagged prices entirely.
77
+ A price is `unscreened` when its (fuel, provincia) bucket holds too few samples for a median, so **no outlier check ran on it** and it is returned as reported (the table marks these `~`). The `--json` envelope's `quality` block counts screened vs unscreened prices for the answer you got.
72
78
 
73
79
  ## MCP server
74
80
 
@@ -85,6 +91,8 @@ Example client config entry:
85
91
  { "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
86
92
  ```
87
93
 
94
+ 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.
95
+
88
96
  ## Development
89
97
 
90
98
  ```bash
@@ -95,18 +103,18 @@ pytest -q
95
103
  ## Automation contract
96
104
 
97
105
  - `stdout` is command output; `stderr` is diagnostics.
98
- - `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `stations[]`, and `disclaimer`.
106
+ - `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `quality`, `stations[]`, and `disclaimer`.
99
107
  - Exit codes: `0` success, `1` runtime error, `2` usage error.
100
108
  - Source files are cached (default 24h) under `$XDG_CACHE_HOME/pitstop`; use `--refresh` to bypass.
101
109
  - Non-interactive; no hidden browser state or scraping.
102
110
 
103
111
  ## Status & roadmap
104
112
 
105
- v1.0.2 — stable public release: fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, agent skill, tests, CI.
113
+ v1.1.1 — stable public release: fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, agent skill, tests, CI.
106
114
 
107
115
  Planned, roughly in order:
108
- - per-station **EV tariff data** once Italy exposes a documented public API for PUN / AFIR data;
109
- - additional countries behind a per-country source adapter (e.g. Germany Tankerkönig, France/Spain official feeds).
116
+ - 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);
117
+ - additional countries behind a per-country source adapter, only where the source's own terms permit the bulk download and locally derived ranking `pitstop` does.
110
118
 
111
119
  ## Data sources & attributions
112
120