elliot-stack 1.0.13 → 1.0.15

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.
@@ -0,0 +1,173 @@
1
+ """
2
+ Pair filtered flights with the best shuttle option and output a ranked
3
+ markdown plans table.
4
+
5
+ Inputs:
6
+ --flights-json JSON list from filter_flights.py (file path or "-" for stdin)
7
+ --shuttles-json JSON dict with "shuttles" array (see references/shuttle_schedules.md)
8
+ --shuttle-costs Comma-separated AIRPORT:USD list (e.g. "ORD:60,IND:30"). Each
9
+ airport in your shuttle config must be listed here.
10
+ --tz-offsets Comma-separated AIRPORT:OFFSET_MIN list relative to home/origin
11
+ timezone (e.g. "ORD:-60,MDW:-60"). Airports omitted assume 0
12
+ (same timezone as the shuttle's `departs_local` zone).
13
+ --min-buffer-min Min minutes between shuttle arrival at airport and flight
14
+ departure. Default 90 (1.5h).
15
+ --max-wait-min Max acceptable wait at airport. Default 240 (4h).
16
+
17
+ Output: markdown table on stdout, one row per flight, sorted by viability
18
+ then total cost then departure time.
19
+
20
+ Timezones: shuttle entries record departure time in the home timezone
21
+ (`departs_local`) and arrival time in the airport's local timezone
22
+ (`arrives_local`). Pass --tz-offsets so this script can compare them on a
23
+ single timeline for buffer math.
24
+ """
25
+ import argparse
26
+ import json
27
+ import sys
28
+
29
+
30
+ def parse_kv_int(csv: str, value_label: str):
31
+ """Parse "KEY:VAL,KEY:VAL" into a dict[str,int]."""
32
+ out = {}
33
+ if not csv:
34
+ return out
35
+ for item in csv.split(","):
36
+ item = item.strip()
37
+ if not item:
38
+ continue
39
+ if ":" not in item:
40
+ print(f"ERROR: bad {value_label} entry {item!r} — expected KEY:VAL", file=sys.stderr)
41
+ sys.exit(2)
42
+ k, v = item.split(":", 1)
43
+ try:
44
+ out[k.strip()] = int(v.strip())
45
+ except ValueError:
46
+ print(f"ERROR: {value_label} {k!r} value {v!r} is not an int", file=sys.stderr)
47
+ sys.exit(2)
48
+ return out
49
+
50
+
51
+ def hm_to_min(hm: str) -> int:
52
+ h, m = hm.split(":")
53
+ return int(h) * 60 + int(m)
54
+
55
+
56
+ def viability(buffer_min: int, min_buffer: int, max_wait: int) -> str:
57
+ if buffer_min < min_buffer:
58
+ return "TOO_TIGHT"
59
+ if buffer_min > max_wait:
60
+ return "LONG_WAIT"
61
+ if buffer_min < min_buffer + 30:
62
+ return "TIGHT"
63
+ if buffer_min <= min_buffer + 90:
64
+ return "COMFORTABLE"
65
+ return "GENEROUS"
66
+
67
+
68
+ VIABILITY_RANK = {"COMFORTABLE": 0, "GENEROUS": 1, "TIGHT": 2, "LONG_WAIT": 3, "TOO_TIGHT": 4}
69
+ VIABILITY_NOTE = {
70
+ "COMFORTABLE": "Comfortable buffer",
71
+ "GENEROUS": "Comfortable, longer wait",
72
+ "TIGHT": "Tight - runs on shuttle being on time",
73
+ "LONG_WAIT": "Long airport wait",
74
+ "TOO_TIGHT": "Too tight - not viable",
75
+ }
76
+
77
+
78
+ def to_home_min(time_local: str, airport: str, tz_offsets: dict) -> int:
79
+ """Convert a local-airport HH:MM into home-timezone-equivalent minutes."""
80
+ return hm_to_min(time_local) - tz_offsets.get(airport, 0)
81
+
82
+
83
+ def best_shuttle_for_flight(flight, shuttles, min_buffer, max_wait, tz_offsets):
84
+ """Pick the shuttle with the best viability score for this flight."""
85
+ dep_airport = flight["from"]
86
+ flight_dep_min = to_home_min(flight["departs"], dep_airport, tz_offsets)
87
+ candidates = []
88
+ for s in shuttles:
89
+ if s.get("to") != dep_airport:
90
+ continue
91
+ arr = s.get("arrives_local", "")
92
+ if not arr:
93
+ continue
94
+ shuttle_arr_min = to_home_min(arr, dep_airport, tz_offsets)
95
+ buffer = flight_dep_min - shuttle_arr_min
96
+ if buffer < 0:
97
+ continue # shuttle arrives after flight leaves
98
+ v = viability(buffer, min_buffer, max_wait)
99
+ candidates.append((VIABILITY_RANK[v], buffer, v, s))
100
+ if not candidates:
101
+ return None, None, None
102
+ candidates.sort(key=lambda c: c[0])
103
+ _, buf, v, s = candidates[0]
104
+ return s, buf, v
105
+
106
+
107
+ def main() -> int:
108
+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
109
+ p.add_argument("--flights-json", required=True, help="Path to filter_flights.py output, or '-' for stdin")
110
+ p.add_argument("--shuttles-json", required=True)
111
+ p.add_argument("--shuttle-costs", default="",
112
+ help='Comma-separated "AIRPORT:USD" pairs (e.g. "ORD:60,IND:30")')
113
+ p.add_argument("--tz-offsets", default="",
114
+ help='Comma-separated "AIRPORT:OFFSET_MIN" pairs relative to home tz')
115
+ p.add_argument("--min-buffer-min", type=int, default=90)
116
+ p.add_argument("--max-wait-min", type=int, default=240)
117
+ args = p.parse_args()
118
+
119
+ shuttle_costs = parse_kv_int(args.shuttle_costs, "--shuttle-costs")
120
+ tz_offsets = parse_kv_int(args.tz_offsets, "--tz-offsets")
121
+
122
+ if args.flights_json == "-":
123
+ flights = json.load(sys.stdin)
124
+ else:
125
+ with open(args.flights_json, encoding="utf-8") as f:
126
+ flights = json.load(f)
127
+
128
+ with open(args.shuttles_json, encoding="utf-8") as f:
129
+ shuttles = json.load(f).get("shuttles", [])
130
+
131
+ rows = []
132
+ for fl in flights:
133
+ s, buf, v = best_shuttle_for_flight(
134
+ fl, shuttles, args.min_buffer_min, args.max_wait_min, tz_offsets,
135
+ )
136
+ if s is None:
137
+ continue
138
+ shuttle_cost = shuttle_costs.get(fl["from"], 0)
139
+ total = (fl["price"] or 0) + shuttle_cost
140
+ rows.append({
141
+ "flight": fl, "shuttle": s, "buffer_min": buf, "viability": v,
142
+ "shuttle_cost": shuttle_cost, "total": total,
143
+ })
144
+
145
+ # Sort: viability tier, then priority band, then total cost, then departure time
146
+ rows.sort(key=lambda r: (
147
+ VIABILITY_RANK[r["viability"]],
148
+ r.get("flight", {}).get("priority_band", 0),
149
+ r["total"],
150
+ r["flight"]["departs"],
151
+ ))
152
+
153
+ if not rows:
154
+ print("(no viable flight+shuttle pairings)")
155
+ return 0
156
+
157
+ print("| # | Date | Flight | From | To | Departs | Arrives | Shuttle | Shuttle Departs | Buffer | Flight $ | Shuttle $ | **Total** | Notes |")
158
+ print("|---|---|---|---|---|---|---|---|---|---|---|---|---|---|")
159
+ for i, r in enumerate(rows, 1):
160
+ f = r["flight"]; s = r["shuttle"]
161
+ depart_label = s.get("departs_local") or s.get("departs_et") or "?"
162
+ print(
163
+ f"| {i} | {f['date']} | {f['flight']} | {f['from']} | {f['to']} | "
164
+ f"{f['departs']} | {f['arrives']} | {s.get('company','?')} | "
165
+ f"{depart_label} | {r['buffer_min']} min | "
166
+ f"${f['price']} | ${r['shuttle_cost']} | **${r['total']}** | "
167
+ f"{VIABILITY_NOTE[r['viability']]} |"
168
+ )
169
+ return 0
170
+
171
+
172
+ if __name__ == "__main__":
173
+ sys.exit(main())
@@ -318,3 +318,55 @@ rm -rf "$TEMP_DIR"
318
318
  <context>
319
319
  $ARGUMENTS
320
320
  </context>
321
+
322
+ ---
323
+
324
+ ## Skill Feedback
325
+
326
+ If the user shares feedback about this skill — a bug, something confusing, a missing feature, or a suggestion — ask them to describe it in a bit more detail (what they expected, what happened, and any relevant context). Then build a pre-filled GitHub issue URL and share it so the user can click, review, and submit:
327
+
328
+ ```bash
329
+ python3 -c "
330
+ import urllib.parse
331
+ title = 'estack-github-issue-tracker: <concise summary>'
332
+ body = '<description from user feedback — expected vs. actual behavior and context>'
333
+ base = 'https://github.com/ElliotDrel/e-stack/issues/new'
334
+ print(base + '?title=' + urllib.parse.quote(title) + '&body=' + urllib.parse.quote(body))
335
+ "
336
+ ```
337
+
338
+ Share the printed URL with the user. They click it, review the pre-filled title and body, then click **Submit new issue**.
339
+
340
+ ---
341
+
342
+ ## Skill Feedback
343
+ ---
344
+
345
+ ## Skill Feedback
346
+
347
+ If the user shares feedback about this skill — a bug, something confusing, a missing feature, or a suggestion — ask them to describe it in a bit more detail (what they expected, what happened, and any relevant context). Then file the issue using whichever method is available:
348
+
349
+ **If `gh` is installed** (`gh --version` succeeds), create the issue directly:
350
+
351
+ ```bash
352
+ gh issue create \
353
+ --repo ElliotDrel/e-stack \
354
+ --title "estack-github-issue-tracker: <concise summary>" \
355
+ --body "<description from user feedback — expected vs. actual behavior and context>"
356
+ ```
357
+
358
+ **If `gh` is not installed**, build a pre-filled URL:
359
+
360
+ ```bash
361
+ python3 -c "
362
+ import urllib.parse
363
+ title = 'estack-github-issue-tracker: <concise summary>'
364
+ body = '<description from user feedback — expected vs. actual behavior and context>'
365
+ base = 'https://github.com/ElliotDrel/e-stack/issues/new'
366
+ print(base + '?title=' + urllib.parse.quote(title) + '&body=' + urllib.parse.quote(body))
367
+ "
368
+ ```
369
+
370
+ Share the printed URL with the user and offer to open it in their browser.
371
+
372
+ They can also click it directly, review the pre-filled title and body, and click **Submit new issue**.
@@ -61,3 +61,66 @@ git clone --depth 1 <repo-url> ~/repo-search-storage/<repo-name>
61
61
  To explore a repo, spawn one or more **Haiku** subagents using the Agent tool with `model: "haiku"` and `subagent_type: "Explore"`. In the prompt, always include the **full absolute path** to the cloned repo (e.g. `C:/Users/2supe/repo-search-storage/gstack`) and tell the subagent to search within that directory. Without this, the subagent won't know where to look.
62
62
 
63
63
  If the question spans multiple areas of the repo, spawn multiple subagents in parallel — each focused on a different aspect — to get answers faster.
64
+
65
+ ---
66
+
67
+ ## Skill Feedback
68
+
69
+ If the user shares feedback about this skill — a bug, something confusing, a missing feature, or a suggestion — ask them to describe it in a bit more detail (what they expected, what happened, and any relevant context). Then file the issue using whichever method is available:
70
+
71
+ **If `gh` is installed** (`gh --version` succeeds), create the issue directly:
72
+
73
+ ```bash
74
+ gh issue create \
75
+ --repo ElliotDrel/e-stack \
76
+ --title "estack-repo-search: <concise summary>" \
77
+ --body "<description from user feedback — expected vs. actual behavior and context>"
78
+ ```
79
+
80
+ **If `gh` is not installed**, build a pre-filled URL and share it so the user can click, review, and submit:
81
+
82
+ ```bash
83
+ python3 -c "
84
+ import urllib.parse
85
+ title = 'estack-repo-search: <concise summary>'
86
+ body = '<description from user feedback — expected vs. actual behavior and context>'
87
+ base = 'https://github.com/ElliotDrel/e-stack/issues/new'
88
+ print(base + '?title=' + urllib.parse.quote(title) + '&body=' + urllib.parse.quote(body))
89
+ "
90
+ ```
91
+
92
+ Share the printed URL with the user. They click it, review the pre-filled title and body, then click **Submit new issue**.
93
+
94
+ ---
95
+
96
+ ## Skill Feedback
97
+ ---
98
+
99
+ ## Skill Feedback
100
+
101
+ If the user shares feedback about this skill — a bug, something confusing, a missing feature, or a suggestion — ask them to describe it in a bit more detail (what they expected, what happened, and any relevant context). Then file the issue using whichever method is available:
102
+
103
+ **If `gh` is installed** (`gh --version` succeeds), create the issue directly:
104
+
105
+ ```bash
106
+ gh issue create \
107
+ --repo ElliotDrel/e-stack \
108
+ --title "estack-repo-search: <concise summary>" \
109
+ --body "<description from user feedback — expected vs. actual behavior and context>"
110
+ ```
111
+
112
+ **If `gh` is not installed**, build a pre-filled URL:
113
+
114
+ ```bash
115
+ python3 -c "
116
+ import urllib.parse
117
+ title = 'estack-repo-search: <concise summary>'
118
+ body = '<description from user feedback — expected vs. actual behavior and context>'
119
+ base = 'https://github.com/ElliotDrel/e-stack/issues/new'
120
+ print(base + '?title=' + urllib.parse.quote(title) + '&body=' + urllib.parse.quote(body))
121
+ "
122
+ ```
123
+
124
+ Share the printed URL with the user and offer to open it in their browser.
125
+
126
+ They can also click it directly, review the pre-filled title and body, and click **Submit new issue**.