trigger-tree 1.14.0__py3-none-any.whl

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,164 @@
1
+ #!/bin/bash
2
+ # Opens the trigger-tree live dashboard (tt-watch.py) in a new terminal pane/window.
3
+ # Usage: tt-open.sh [demo|replay] (empty = live tail of the real history)
4
+ # Tries, in order: tmux split, macOS Terminal (osascript), Windows Terminal/start
5
+ # (Git Bash), gnome-terminal, konsole, x-terminal-emulator, xterm.
6
+ set -euo pipefail
7
+
8
+ MODE="${1:-}"
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
11
+ PY="$(command -v python3 || command -v python || echo python3)"
12
+ PLATFORM="$(uname)"
13
+ # Claude may expose a native C:\... project path while the launcher runs in Git
14
+ # Bash. Convert it before quoting so `cd` and the child environment use one form.
15
+ case "$PLATFORM" in
16
+ MINGW*|MSYS*|CYGWIN*)
17
+ if command -v cygpath >/dev/null 2>&1; then
18
+ ROOT="$(cygpath -u "$ROOT")"
19
+ fi
20
+ ;;
21
+ esac
22
+ VERSION="$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' "$SCRIPT_DIR/../.claude-plugin/plugin.json" 2>/dev/null | head -1)"
23
+ V="v${VERSION:-?}"
24
+
25
+ FLAG=""
26
+ case "$MODE" in
27
+ demo|replay) FLAG="--$MODE" ;;
28
+ "") ;;
29
+ *) echo "usage: tt-open.sh [demo|replay]" >&2; exit 1 ;;
30
+ esac
31
+
32
+ CLIENT="${TT_CLIENT:-}"
33
+ if [ -z "$CLIENT" ]; then
34
+ if [ -n "${CODEX_HOME:-}" ] || [ -n "${PLUGIN_ROOT:-}" ]; then
35
+ CLIENT="codex"
36
+ elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
37
+ CLIENT="claude"
38
+ else
39
+ case "$SCRIPT_DIR" in
40
+ */.claude/plugins/*) CLIENT="claude" ;;
41
+ */.codex/plugins/*) CLIENT="codex" ;;
42
+ *) CLIENT="auto" ;;
43
+ esac
44
+ fi
45
+ fi
46
+
47
+ make_launcher() {
48
+ LAUNCH="$(mktemp "${TMPDIR:-/tmp}/tt-watch.XXXXXX")"
49
+ # shellcheck disable=SC2016 # $status/$0 must stay literal in the generated script
50
+ {
51
+ printf '#!/bin/bash\n%s\n' "$CMD"
52
+ printf 'status=$?\n'
53
+ printf 'if [ $status -eq 143 ] || [ $status -eq 130 ]; then\n'
54
+ printf ' echo; echo "tt-watch stopped: terminated from outside (signal $((status-128))) - not a crash. press Enter to close"\n'
55
+ printf ' read -r\n'
56
+ printf 'elif [ $status -ne 0 ]; then\n'
57
+ printf ' echo; echo "tt-watch crashed with status $status - press Enter to close"\n'
58
+ printf ' read -r\nfi\n'
59
+ printf 'rm -f "$0"\n'
60
+ } > "$LAUNCH"
61
+ chmod +x "$LAUNCH"
62
+ }
63
+
64
+ # Build a shell-safe command. Repository names can legally contain spaces,
65
+ # apostrophes and shell metacharacters; the split must still tail that exact repo.
66
+ printf -v Q_ROOT '%q' "$ROOT"
67
+ printf -v Q_PY '%q' "$PY"
68
+ printf -v Q_WATCH '%q' "$SCRIPT_DIR/tt-watch.py"
69
+ printf -v Q_CLIENT '%q' "$CLIENT"
70
+ CMD="cd $Q_ROOT && CLAUDE_PROJECT_DIR=$Q_ROOT $Q_PY $Q_WATCH $FLAG --client $Q_CLIENT"
71
+
72
+ # Testable without opening a window.
73
+ if [ "${TT_OPEN_DRYRUN:-}" = "1" ]; then
74
+ echo "$CMD"
75
+ exit 0
76
+ fi
77
+
78
+ if [ -n "${TMUX:-}" ]; then
79
+ tmux split-window -h "$CMD"
80
+ echo "trigger-tree $V watcher opened in a tmux split."
81
+ exit 0
82
+ fi
83
+
84
+ case "$PLATFORM" in
85
+ Darwin)
86
+ # Stay in the terminal you called it from: iTerm2 gets a split pane in the
87
+ # current window instead of a foreign Terminal.app window.
88
+ if [ "${TERM_PROGRAM:-}" = "iTerm.app" ]; then
89
+ # iTerm2's AppleScript `command` is exec-style (no shell), so a compound
90
+ # `cd ... && ...` dies instantly and the pane closes. Hand it a launcher
91
+ # script instead, which also keeps the pane open on failure.
92
+ make_launcher
93
+ # Target the exact session that invoked us (ITERM_SESSION_ID), so two Claude
94
+ # sessions in different projects each get their own split — never the
95
+ # frontmost window by accident.
96
+ SESSION_UUID="${ITERM_SESSION_ID#*:}"
97
+ if [ -n "${ITERM_SESSION_ID:-}" ] && osascript >/dev/null 2>&1 <<OSA
98
+ tell application "iTerm2"
99
+ set found to false
100
+ repeat with w in windows
101
+ repeat with t in tabs of w
102
+ repeat with s in sessions of t
103
+ if (id of s as text) is "$SESSION_UUID" then
104
+ tell s to split vertically with default profile command "$LAUNCH"
105
+ set found to true
106
+ end if
107
+ end repeat
108
+ end repeat
109
+ end repeat
110
+ if not found then error "no matching session"
111
+ end tell
112
+ OSA
113
+ then
114
+ echo "trigger-tree $V watcher opened in an iTerm2 split next to this session."
115
+ elif osascript \
116
+ -e 'tell application "iTerm2"' \
117
+ -e 'tell current session of current window' \
118
+ -e "split vertically with default profile command \"$LAUNCH\"" \
119
+ -e 'end tell' \
120
+ -e 'end tell' >/dev/null 2>&1; then
121
+ echo "trigger-tree $V watcher opened in an iTerm2 split (same window)."
122
+ else
123
+ osascript \
124
+ -e 'tell application "iTerm2"' \
125
+ -e "create window with default profile command \"$LAUNCH\"" \
126
+ -e 'end tell' >/dev/null
127
+ echo "trigger-tree $V watcher opened in a new iTerm2 window."
128
+ fi
129
+ exit 0
130
+ fi
131
+ make_launcher
132
+ osascript \
133
+ -e 'tell application "Terminal"' \
134
+ -e 'activate' \
135
+ -e "do script \"$LAUNCH\"" \
136
+ -e 'end tell' >/dev/null
137
+ echo "trigger-tree $V watcher opened in a new Terminal window."
138
+ exit 0
139
+ ;;
140
+ MINGW*|MSYS*|CYGWIN*) # Windows (Git Bash)
141
+ if command -v wt.exe >/dev/null 2>&1; then
142
+ wt.exe new-tab bash -lc "$CMD" &
143
+ else
144
+ cmd.exe /c start bash -lc "$CMD" &
145
+ fi
146
+ echo "trigger-tree $V watcher opened in a new window."
147
+ exit 0
148
+ ;;
149
+ esac
150
+
151
+ for TERM_CMD in gnome-terminal konsole x-terminal-emulator xterm; do
152
+ if command -v "$TERM_CMD" >/dev/null 2>&1; then
153
+ case "$TERM_CMD" in
154
+ gnome-terminal) "$TERM_CMD" -- bash -c "$CMD" & ;;
155
+ *) "$TERM_CMD" -e bash -c "$CMD" & ;;
156
+ esac
157
+ echo "trigger-tree $V watcher opened via $TERM_CMD."
158
+ exit 0
159
+ fi
160
+ done
161
+
162
+ echo "No supported terminal found — start manually in a second terminal:" >&2
163
+ echo "$CMD" >&2
164
+ exit 1
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT=$(git rev-parse --show-toplevel)
5
+ REMOTE=$(git -C "$ROOT" remote get-url origin)
6
+ BADGE_DIR=$(mktemp -d)
7
+ trap 'rm -rf "$BADGE_DIR"' EXIT
8
+
9
+ python3 "$ROOT/scripts/tt-stats.py" --badge >/dev/null
10
+
11
+ if ! git clone --quiet --single-branch --branch badges "$REMOTE" "$BADGE_DIR"; then
12
+ echo "badge-publish: create and push a badges branch first" >&2
13
+ exit 1
14
+ fi
15
+
16
+ cp "$ROOT/.trigger-tree/badge.json" "$BADGE_DIR/docs-health.json"
17
+ if [[ -z $(git -C "$BADGE_DIR" status --porcelain -- docs-health.json) ]]; then
18
+ echo "docs-health badge is already current"
19
+ exit 0
20
+ fi
21
+
22
+ git -C "$BADGE_DIR" add docs-health.json
23
+ git -C "$BADGE_DIR" -c user.name="trigger-tree" -c user.email="trigger-tree@users.noreply.github.com" \
24
+ commit -m "chore: publish local docs health"
25
+ git -C "$BADGE_DIR" push origin badges
26
+ echo "published locally measured docs health to the badges branch"