templates/zshrc-formats.sh
# ============ TS-03 output formats + iPhone report link ============
# Append AFTER zshrc-tracker.sh: cat templates/zshrc-formats.sh >> ~/.zshrc
# Requires: scripts/ts03-render copied to ~/.local/bin/ts03-render
# ts03 [--table|--text|--json|--yaml|--html] <question> (flag also works at the end)
ts03() {
local fmt="${TS03_FORMAT:-}"
case "$1" in --table|--text|--json|--yaml|--html) fmt="${1#--}"; shift ;; esac
case "${@[-1]}" in --table|--text|--json|--yaml|--html) fmt="${@[-1]#--}"; set -- "${@[1,-2]}" ;; esac
if [[ -z "$fmt" ]]; then
claude -p --model sonnet "TS-03 tracker: $*"
return
fi
local schema='Reply with ONLY one JSON object, no prose, no code fences:
{"title": short heading, "generated_on": "YYYY-MM-DD", "answer": one or two plain sentences or "",
"items": [{"subject": "", "type": "", "title": "", "due_date": "YYYY-MM-DD", "time": "",
"status": "", "days_left": integer or null, "points": "", "notes": ""}],
"notes": [short strings]}
Include every relevant row as an item; use [] if none.'
claude -p --model sonnet "TS-03 tracker: $*
$schema" | ts03-render --format "$fmt"
}
# Address the iPhone uses to open reports (set by you: Mac .local name or LAN IP)
export TS03_HOST="Your-MacBook.local"
alias ts03-link='echo "http://$TS03_HOST:8765/latest.html"'
alias ts03-server='launchctl list | grep ts03; lsof -nP -iTCP:8765 -sTCP:LISTEN'
# ===================================================================
Questions or corrections: [email protected]