vouchington-tooling 0.59.0 → 0.60.0
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.
- package/README.md +59 -0
- package/dist/cli/commands/hook.d.mts +2 -0
- package/dist/cli/commands/hook.mjs +19 -0
- package/dist/cli/index.mjs +6 -0
- package/dist/cli/parse-forwarded-commands.d.mts +6 -0
- package/dist/cli/parse-forwarded-commands.mjs +4 -0
- package/dist/cli/parse.d.mts +6 -0
- package/dist/cli/usage-text.d.mts +1 -0
- package/dist/cli/usage-text.mjs +170 -0
- package/dist/cli/usage.d.mts +2 -1
- package/dist/cli/usage.mjs +2 -156
- package/dist/command-policy/engine.d.mts +7 -0
- package/dist/command-policy/engine.mjs +58 -0
- package/dist/command-policy/git-patterns.d.mts +20 -0
- package/dist/command-policy/git-patterns.mjs +82 -0
- package/dist/command-policy/git-process.d.mts +4 -0
- package/dist/command-policy/git-process.mjs +54 -0
- package/dist/command-policy/github-checkout-owners.d.mts +22 -0
- package/dist/command-policy/github-checkout-owners.mjs +122 -0
- package/dist/command-policy/github-command-context.d.mts +6 -0
- package/dist/command-policy/github-command-context.mjs +19 -0
- package/dist/command-policy/github-command-cwd.d.mts +8 -0
- package/dist/command-policy/github-command-cwd.mjs +130 -0
- package/dist/command-policy/github-command-position.d.mts +7 -0
- package/dist/command-policy/github-command-position.mjs +12 -0
- package/dist/command-policy/github-configured-base.d.mts +25 -0
- package/dist/command-policy/github-configured-base.mjs +59 -0
- package/dist/command-policy/github-invocation.d.mts +9 -0
- package/dist/command-policy/github-invocation.mjs +80 -0
- package/dist/command-policy/github-merge-authority.d.mts +21 -0
- package/dist/command-policy/github-merge-authority.mjs +86 -0
- package/dist/command-policy/github-option-flags.d.mts +3 -0
- package/dist/command-policy/github-option-flags.mjs +67 -0
- package/dist/command-policy/github-options.d.mts +12 -0
- package/dist/command-policy/github-options.mjs +73 -0
- package/dist/command-policy/github-stack-workflow.d.mts +9 -0
- package/dist/command-policy/github-stack-workflow.mjs +94 -0
- package/dist/command-policy/github-workflow.d.mts +7 -0
- package/dist/command-policy/github-workflow.mjs +50 -0
- package/dist/command-policy/hook/args.d.mts +11 -0
- package/dist/command-policy/hook/args.mjs +49 -0
- package/dist/command-policy/hook/harness.d.mts +26 -0
- package/dist/command-policy/hook/harness.mjs +119 -0
- package/dist/command-policy/hook/policy-module.d.mts +7 -0
- package/dist/command-policy/hook/policy-module.mjs +48 -0
- package/dist/command-policy/hook/post-tool-use.d.mts +9 -0
- package/dist/command-policy/hook/post-tool-use.mjs +51 -0
- package/dist/command-policy/hook/pre-tool-use.d.mts +21 -0
- package/dist/command-policy/hook/pre-tool-use.mjs +45 -0
- package/dist/command-policy/hook/run.d.mts +17 -0
- package/dist/command-policy/hook/run.mjs +69 -0
- package/dist/command-policy/hook/types.d.mts +33 -0
- package/dist/command-policy/hook/types.mjs +5 -0
- package/dist/command-policy/index.d.mts +29 -0
- package/dist/command-policy/index.mjs +23 -0
- package/dist/command-policy/path-references.d.mts +14 -0
- package/dist/command-policy/path-references.mjs +68 -0
- package/dist/command-policy/path-rules.d.mts +11 -0
- package/dist/command-policy/path-rules.mjs +37 -0
- package/dist/command-policy/payload.d.mts +8 -0
- package/dist/command-policy/payload.mjs +54 -0
- package/dist/command-policy/types.d.mts +77 -0
- package/dist/command-policy/types.mjs +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/tmux/cli-shared.d.mts +18 -0
- package/dist/tmux/cli-shared.mjs +8 -0
- package/dist/tmux/cli.d.mts +3 -0
- package/dist/tmux/cli.mjs +34 -0
- package/dist/tmux/config.d.mts +24 -0
- package/dist/tmux/config.mjs +91 -0
- package/dist/tmux/fake-tmux.test-helpers.d.mts +46 -0
- package/dist/tmux/fake-tmux.test-helpers.mjs +105 -0
- package/dist/tmux/hook-payload.d.mts +8 -0
- package/dist/tmux/hook-payload.mjs +39 -0
- package/dist/tmux/index.d.mts +9 -0
- package/dist/tmux/index.mjs +7 -0
- package/dist/tmux/launcher.d.mts +11 -0
- package/dist/tmux/launcher.mjs +127 -0
- package/dist/tmux/reminder-post-tool.d.mts +21 -0
- package/dist/tmux/reminder-post-tool.mjs +88 -0
- package/dist/tmux/runner.d.mts +11 -0
- package/dist/tmux/runner.mjs +26 -0
- package/dist/tmux/session-name.d.mts +5 -0
- package/dist/tmux/session-name.mjs +10 -0
- package/dist/tmux/shell-quote.d.mts +9 -0
- package/dist/tmux/shell-quote.mjs +16 -0
- package/dist/tmux/up.d.mts +2 -0
- package/dist/tmux/up.mjs +73 -0
- package/dist/tmux/windows.d.mts +18 -0
- package/dist/tmux/windows.mjs +50 -0
- package/package.json +11 -1
- package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
- package/scripts/tmux/tmux-agent-reminder.sh +68 -0
- package/scripts/tmux/tmux-name.sh +34 -0
- package/scripts/tmux/tmux-read-title.sh +13 -0
- package/scripts/tmux/tmux-target.sh +130 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Shared by the name helper and launchers. Sourcing this file never changes tmux.
|
|
3
|
+
|
|
4
|
+
tmux_target_error() {
|
|
5
|
+
printf 'tmux target: %s\nPass --socket PATH --pane %%ID --worktree PATH from the task worktree.\n' "$1" >&2
|
|
6
|
+
return 1
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
tmux_target_root() {
|
|
10
|
+
local directory git_root
|
|
11
|
+
directory=$(cd -- "$1" && pwd -P) || return 1
|
|
12
|
+
# Git's inherited repository selectors and runtime config can make -C
|
|
13
|
+
# report a different checkout. Keep normal global/system config (including
|
|
14
|
+
# safe.directory) while dropping exported Git overrides.
|
|
15
|
+
if command -v git >/dev/null 2>&1 && git_root=$(
|
|
16
|
+
env -i PATH="${PATH:-/usr/bin:/bin}" HOME="${HOME:-}" XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-}" \
|
|
17
|
+
git -C "$directory" rev-parse --show-toplevel 2>/dev/null
|
|
18
|
+
); then
|
|
19
|
+
(cd -- "$git_root" && pwd -P)
|
|
20
|
+
else
|
|
21
|
+
printf '%s\n' "$directory"
|
|
22
|
+
fi
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Return 3 only when there is no tmux context at all, preserving outside-tmux no-op.
|
|
26
|
+
# A partial or untrusted tmux context returns 1 and must never fall back to cwd.
|
|
27
|
+
tmux_target_resolve() {
|
|
28
|
+
local expected_root binding_root pane_path pane_root terminal panes candidate candidate_terminal matches socket_prefix
|
|
29
|
+
local tmux_command=${TMUX_TARGET_BIN:-tmux}
|
|
30
|
+
tmux_target_socket=$2
|
|
31
|
+
tmux_target_pane=$3
|
|
32
|
+
tmux_target_worktree=$4
|
|
33
|
+
expected_root=$(tmux_target_root "$1") || return 1
|
|
34
|
+
if [ -z "$tmux_target_socket$tmux_target_pane$tmux_target_worktree${TMUX:-}${TMUX_PANE:-}" ]; then return 3; fi
|
|
35
|
+
if ! command -v "$tmux_command" >/dev/null 2>&1; then
|
|
36
|
+
tmux_target_error 'tmux is missing; install with brew install tmux or apt-get install tmux'; return 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [ -n "$tmux_target_socket$tmux_target_pane$tmux_target_worktree" ]; then
|
|
40
|
+
if [ -z "$tmux_target_socket" ] || [ -z "$tmux_target_pane" ] || [ -z "$tmux_target_worktree" ]; then
|
|
41
|
+
tmux_target_error 'incomplete explicit binding'; return 1
|
|
42
|
+
fi
|
|
43
|
+
binding_root=$(tmux_target_root "$tmux_target_worktree") || return 1
|
|
44
|
+
if [ "$binding_root" != "$expected_root" ]; then
|
|
45
|
+
tmux_target_error 'binding belongs to a different worktree'; return 1
|
|
46
|
+
fi
|
|
47
|
+
else
|
|
48
|
+
if [ -z "${TMUX:-}${TMUX_PANE:-}" ]; then return 3; fi
|
|
49
|
+
# tty </dev/tty reports the alias /dev/tty on macOS. Query this shell's
|
|
50
|
+
# controlling terminal instead, including when an agent pipes its stdin.
|
|
51
|
+
terminal=$(ps -p "$$" -o tty= 2>/dev/null | tr -d '[:space:]')
|
|
52
|
+
case $terminal in
|
|
53
|
+
''|*'?'*|'-') tmux_target_error 'no verified controlling terminal or explicit binding'; return 1 ;;
|
|
54
|
+
/dev/*) ;;
|
|
55
|
+
*) terminal=/dev/$terminal ;;
|
|
56
|
+
esac
|
|
57
|
+
case ${TMUX:-} in
|
|
58
|
+
*,*,*) socket_prefix=${TMUX%,*}; tmux_target_socket=${socket_prefix%,*} ;;
|
|
59
|
+
*) tmux_target_error 'missing tmux socket identity'; return 1 ;;
|
|
60
|
+
esac
|
|
61
|
+
panes=$("$tmux_command" -S "$tmux_target_socket" list-panes -a -F $'#{pane_id}\t#{pane_tty}') || {
|
|
62
|
+
tmux_target_error 'unable to list panes on the specified socket'; return 1
|
|
63
|
+
}
|
|
64
|
+
matches=0
|
|
65
|
+
while IFS=$'\t' read -r candidate candidate_terminal; do
|
|
66
|
+
if [ "$candidate_terminal" = "$terminal" ]; then
|
|
67
|
+
tmux_target_pane=$candidate
|
|
68
|
+
matches=$((matches + 1))
|
|
69
|
+
fi
|
|
70
|
+
done <<EOF
|
|
71
|
+
$panes
|
|
72
|
+
EOF
|
|
73
|
+
if [ "$matches" -ne 1 ]; then
|
|
74
|
+
tmux_target_error 'controlling terminal does not identify exactly one pane'; return 1
|
|
75
|
+
fi
|
|
76
|
+
tmux_target_worktree=$expected_root
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
case $tmux_target_socket in
|
|
80
|
+
/*) ;;
|
|
81
|
+
*) tmux_target_error 'socket must be an absolute path'; return 1 ;;
|
|
82
|
+
esac
|
|
83
|
+
if ! [[ $tmux_target_pane =~ ^%[0-9]+$ ]]; then
|
|
84
|
+
tmux_target_error 'pane must be a literal %ID'; return 1
|
|
85
|
+
fi
|
|
86
|
+
pane_path=$("$tmux_command" -S "$tmux_target_socket" display-message -p -t "$tmux_target_pane" '#{pane_current_path}') || {
|
|
87
|
+
tmux_target_error 'pane is missing or unavailable on the specified socket'; return 1
|
|
88
|
+
}
|
|
89
|
+
if [ -z "$pane_path" ]; then tmux_target_error 'pane has no working directory'; return 1; fi
|
|
90
|
+
pane_root=$(tmux_target_root "$pane_path") || return 1
|
|
91
|
+
if [ "$pane_root" != "$expected_root" ]; then
|
|
92
|
+
tmux_target_error 'pane belongs to a different worktree'; return 1
|
|
93
|
+
fi
|
|
94
|
+
tmux_target_worktree=$expected_root
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# The resolved name is a public output consumed by callers sourcing this library.
|
|
98
|
+
# shellcheck disable=SC2034
|
|
99
|
+
tmux_target_parse() {
|
|
100
|
+
local expected=$1 socket='' pane='' worktree='' has_socket=false has_pane=false has_worktree=false has_name=false
|
|
101
|
+
shift
|
|
102
|
+
tmux_target_name=''
|
|
103
|
+
while [ "$#" -gt 0 ]; do
|
|
104
|
+
case $1 in
|
|
105
|
+
--socket|--pane|--worktree)
|
|
106
|
+
if [ "$#" -lt 2 ] || [ -z "$2" ]; then tmux_target_error "missing value for $1"; return 2; fi
|
|
107
|
+
case $1 in
|
|
108
|
+
--socket) if $has_socket; then tmux_target_error 'duplicate --socket'; return 2; fi; socket=$2; has_socket=true ;;
|
|
109
|
+
--pane) if $has_pane; then tmux_target_error 'duplicate --pane'; return 2; fi; pane=$2; has_pane=true ;;
|
|
110
|
+
--worktree) if $has_worktree; then tmux_target_error 'duplicate --worktree'; return 2; fi; worktree=$2; has_worktree=true ;;
|
|
111
|
+
esac
|
|
112
|
+
shift 2 ;;
|
|
113
|
+
--)
|
|
114
|
+
shift
|
|
115
|
+
if [ "$#" -ne 1 ] || $has_name; then tmux_target_error 'provide exactly one name'; return 2; fi
|
|
116
|
+
tmux_target_name=$1; has_name=true; shift ;;
|
|
117
|
+
-*) tmux_target_error "unknown option: $1"; return 2 ;;
|
|
118
|
+
*)
|
|
119
|
+
if $has_name; then tmux_target_error 'provide exactly one name'; return 2; fi
|
|
120
|
+
tmux_target_name=$1; has_name=true; shift ;;
|
|
121
|
+
esac
|
|
122
|
+
done
|
|
123
|
+
if ! $has_name; then tmux_target_error 'provide exactly one name'; return 2; fi
|
|
124
|
+
if $has_socket || $has_pane || $has_worktree; then
|
|
125
|
+
if ! $has_socket || ! $has_pane || ! $has_worktree; then tmux_target_error 'supply all three target options'; return 2; fi
|
|
126
|
+
else
|
|
127
|
+
socket=${AGENT_TMUX_SOCKET:-}; pane=${AGENT_TMUX_PANE:-}; worktree=${AGENT_TMUX_WORKTREE:-}
|
|
128
|
+
fi
|
|
129
|
+
tmux_target_resolve "$expected" "$socket" "$pane" "$worktree"
|
|
130
|
+
}
|