CtrlK
BlogDocsLog inGet started
Tessl Logo

jbaruch/nanoclaw-travel

Travel assistant for NanoClaw: byAir flight notifications (delay, gate, connection risk, inbound aircraft delay, time-to-leave, arrival logistics), traffic-aware drive planning for in-person meetings (auto drive blocks + leave-by traffic rechecks), travel-booking gap checks, and nightly TripIt sync. Per-chat overlay plugin.

Quality

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

High

Do not use without reviewing

Overview
Quality
Evals
Security
Files

get-flight-state.pyskills/flight-assist/scripts/

#!/usr/bin/env python3
"""Read a per-flight state record and print it as JSON.

Used by SKILL.md Step 3 to enrich a wake-event notification with
the flight's last-known snapshot (gates, terminals, times, etc.)
without requiring the agent to embed a state-reader Python snippet
in its prompt.

Usage:
    get-flight-state.py <flight_id>

Output: single-line JSON on stdout with the full state record on
success, or `{"error": "..."}` on missing flight / invalid argument.
"""

from __future__ import annotations

import json
import sys
from pathlib import Path

_BUNDLE_DIR = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(_BUNDLE_DIR))

from state import read_flight_state  # noqa: E402


def main(argv: list[str]) -> int:
    if len(argv) != 2:
        print(
            json.dumps({"error": "usage: get-flight-state.py <flight_id>"}),
            file=sys.stderr,
        )
        return 2
    try:
        flight_id = int(argv[1])
    except ValueError:
        print(
            json.dumps({"error": f"flight_id must be int, got {argv[1]!r}"}),
            file=sys.stderr,
        )
        return 2
    state = read_flight_state(flight_id)
    if state is None:
        print(json.dumps({"error": f"flight_id {flight_id} has no state on disk"}))
        return 0
    print(json.dumps(state, separators=(",", ":")))
    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv))

README.md

tile.json