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

set-home-base.pyskills/flight-assist/scripts/

#!/usr/bin/env python3
"""Persist the user's home address to the flight-assist plugin config.

Read by the precheck script for `time_to_leave` Distance Matrix
queries (the leave-by deadline is computed against current traffic
between this address and the departure airport).

Usage:
    set-home-base.py "1 Infinite Loop, Cupertino, CA 95014"

Idempotent — overwrites any prior `home_address` value. Preserves
other config keys.

Output: single-line JSON on stdout with `{"home_address": "..."}`
on success, or `{"error": "..."}` on validation failure.
"""

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_config, write_config  # noqa: E402


def main(argv: list[str]) -> int:
    if len(argv) != 2:
        print(
            json.dumps({"error": "usage: set-home-base.py <home_address>"}),
            file=sys.stderr,
        )
        return 2
    home_address = argv[1].strip()
    if not home_address:
        print(json.dumps({"error": "home_address must not be empty"}), file=sys.stderr)
        return 2
    existing = read_config() or {}
    existing["home_address"] = home_address
    write_config(existing)
    print(json.dumps({"home_address": home_address}, separators=(",", ":")))
    return 0


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

README.md

tile.json