vouchington-tooling 0.59.0 → 0.61.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.
Files changed (141) hide show
  1. package/README.md +108 -0
  2. package/dist/cli/commands/hook.d.mts +2 -0
  3. package/dist/cli/commands/hook.mjs +19 -0
  4. package/dist/cli/commands/sandbox-command-audit.d.mts +7 -0
  5. package/dist/cli/commands/sandbox-command-audit.mjs +27 -0
  6. package/dist/cli/index.mjs +8 -0
  7. package/dist/cli/parse-forwarded-commands.d.mts +9 -0
  8. package/dist/cli/parse-forwarded-commands.mjs +6 -0
  9. package/dist/cli/parse.d.mts +9 -0
  10. package/dist/cli/usage-text.d.mts +1 -0
  11. package/dist/cli/usage-text.mjs +179 -0
  12. package/dist/cli/usage.d.mts +2 -1
  13. package/dist/cli/usage.mjs +2 -156
  14. package/dist/command-policy/engine.d.mts +7 -0
  15. package/dist/command-policy/engine.mjs +58 -0
  16. package/dist/command-policy/git-patterns.d.mts +20 -0
  17. package/dist/command-policy/git-patterns.mjs +82 -0
  18. package/dist/command-policy/git-process.d.mts +4 -0
  19. package/dist/command-policy/git-process.mjs +54 -0
  20. package/dist/command-policy/github-checkout-owners.d.mts +22 -0
  21. package/dist/command-policy/github-checkout-owners.mjs +122 -0
  22. package/dist/command-policy/github-command-context.d.mts +6 -0
  23. package/dist/command-policy/github-command-context.mjs +19 -0
  24. package/dist/command-policy/github-command-cwd.d.mts +8 -0
  25. package/dist/command-policy/github-command-cwd.mjs +130 -0
  26. package/dist/command-policy/github-command-position.d.mts +7 -0
  27. package/dist/command-policy/github-command-position.mjs +12 -0
  28. package/dist/command-policy/github-configured-base.d.mts +25 -0
  29. package/dist/command-policy/github-configured-base.mjs +59 -0
  30. package/dist/command-policy/github-invocation.d.mts +9 -0
  31. package/dist/command-policy/github-invocation.mjs +80 -0
  32. package/dist/command-policy/github-merge-authority.d.mts +21 -0
  33. package/dist/command-policy/github-merge-authority.mjs +86 -0
  34. package/dist/command-policy/github-option-flags.d.mts +3 -0
  35. package/dist/command-policy/github-option-flags.mjs +67 -0
  36. package/dist/command-policy/github-options.d.mts +12 -0
  37. package/dist/command-policy/github-options.mjs +73 -0
  38. package/dist/command-policy/github-stack-workflow.d.mts +9 -0
  39. package/dist/command-policy/github-stack-workflow.mjs +94 -0
  40. package/dist/command-policy/github-workflow.d.mts +7 -0
  41. package/dist/command-policy/github-workflow.mjs +50 -0
  42. package/dist/command-policy/hook/args.d.mts +11 -0
  43. package/dist/command-policy/hook/args.mjs +49 -0
  44. package/dist/command-policy/hook/harness.d.mts +26 -0
  45. package/dist/command-policy/hook/harness.mjs +119 -0
  46. package/dist/command-policy/hook/policy-module.d.mts +7 -0
  47. package/dist/command-policy/hook/policy-module.mjs +48 -0
  48. package/dist/command-policy/hook/post-tool-use.d.mts +9 -0
  49. package/dist/command-policy/hook/post-tool-use.mjs +51 -0
  50. package/dist/command-policy/hook/pre-tool-use.d.mts +21 -0
  51. package/dist/command-policy/hook/pre-tool-use.mjs +45 -0
  52. package/dist/command-policy/hook/run.d.mts +17 -0
  53. package/dist/command-policy/hook/run.mjs +69 -0
  54. package/dist/command-policy/hook/types.d.mts +33 -0
  55. package/dist/command-policy/hook/types.mjs +5 -0
  56. package/dist/command-policy/index.d.mts +29 -0
  57. package/dist/command-policy/index.mjs +23 -0
  58. package/dist/command-policy/path-references.d.mts +14 -0
  59. package/dist/command-policy/path-references.mjs +68 -0
  60. package/dist/command-policy/path-rules.d.mts +11 -0
  61. package/dist/command-policy/path-rules.mjs +37 -0
  62. package/dist/command-policy/payload.d.mts +8 -0
  63. package/dist/command-policy/payload.mjs +54 -0
  64. package/dist/command-policy/types.d.mts +77 -0
  65. package/dist/command-policy/types.mjs +1 -0
  66. package/dist/index.d.mts +2 -0
  67. package/dist/index.mjs +1 -0
  68. package/dist/sandbox-command-audit/args.d.mts +20 -0
  69. package/dist/sandbox-command-audit/args.mjs +64 -0
  70. package/dist/sandbox-command-audit/classify-prefixes.d.mts +23 -0
  71. package/dist/sandbox-command-audit/classify-prefixes.mjs +50 -0
  72. package/dist/sandbox-command-audit/classify.d.mts +46 -0
  73. package/dist/sandbox-command-audit/classify.mjs +74 -0
  74. package/dist/sandbox-command-audit/claude-extract.d.mts +23 -0
  75. package/dist/sandbox-command-audit/claude-extract.mjs +76 -0
  76. package/dist/sandbox-command-audit/claude-tool-uses.d.mts +15 -0
  77. package/dist/sandbox-command-audit/claude-tool-uses.mjs +53 -0
  78. package/dist/sandbox-command-audit/codex-extract.d.mts +21 -0
  79. package/dist/sandbox-command-audit/codex-extract.mjs +77 -0
  80. package/dist/sandbox-command-audit/codex-scan.d.mts +11 -0
  81. package/dist/sandbox-command-audit/codex-scan.mjs +98 -0
  82. package/dist/sandbox-command-audit/codex-spool.d.mts +14 -0
  83. package/dist/sandbox-command-audit/codex-spool.mjs +46 -0
  84. package/dist/sandbox-command-audit/discover-files.d.mts +44 -0
  85. package/dist/sandbox-command-audit/discover-files.mjs +85 -0
  86. package/dist/sandbox-command-audit/failure-text.d.mts +7 -0
  87. package/dist/sandbox-command-audit/failure-text.mjs +34 -0
  88. package/dist/sandbox-command-audit/fixtures.test-helpers.d.mts +34 -0
  89. package/dist/sandbox-command-audit/fixtures.test-helpers.mjs +41 -0
  90. package/dist/sandbox-command-audit/index.d.mts +26 -0
  91. package/dist/sandbox-command-audit/index.mjs +15 -0
  92. package/dist/sandbox-command-audit/json-record.d.mts +6 -0
  93. package/dist/sandbox-command-audit/json-record.mjs +16 -0
  94. package/dist/sandbox-command-audit/limits.d.mts +30 -0
  95. package/dist/sandbox-command-audit/limits.mjs +66 -0
  96. package/dist/sandbox-command-audit/repo-scope.d.mts +25 -0
  97. package/dist/sandbox-command-audit/repo-scope.mjs +79 -0
  98. package/dist/sandbox-command-audit/report-raw.d.mts +16 -0
  99. package/dist/sandbox-command-audit/report-raw.mjs +55 -0
  100. package/dist/sandbox-command-audit/report.d.mts +10 -0
  101. package/dist/sandbox-command-audit/report.mjs +61 -0
  102. package/dist/sandbox-command-audit/run.d.mts +36 -0
  103. package/dist/sandbox-command-audit/run.mjs +70 -0
  104. package/dist/sandbox-command-audit/scan.d.mts +10 -0
  105. package/dist/sandbox-command-audit/scan.mjs +79 -0
  106. package/dist/sandbox-command-audit/transcript-cwd.d.mts +14 -0
  107. package/dist/sandbox-command-audit/transcript-cwd.mjs +153 -0
  108. package/dist/sandbox-command-audit/types.d.mts +59 -0
  109. package/dist/sandbox-command-audit/types.mjs +23 -0
  110. package/dist/tmux/cli-shared.d.mts +18 -0
  111. package/dist/tmux/cli-shared.mjs +8 -0
  112. package/dist/tmux/cli.d.mts +3 -0
  113. package/dist/tmux/cli.mjs +34 -0
  114. package/dist/tmux/config.d.mts +24 -0
  115. package/dist/tmux/config.mjs +91 -0
  116. package/dist/tmux/fake-tmux.test-helpers.d.mts +46 -0
  117. package/dist/tmux/fake-tmux.test-helpers.mjs +105 -0
  118. package/dist/tmux/hook-payload.d.mts +8 -0
  119. package/dist/tmux/hook-payload.mjs +39 -0
  120. package/dist/tmux/index.d.mts +9 -0
  121. package/dist/tmux/index.mjs +7 -0
  122. package/dist/tmux/launcher.d.mts +11 -0
  123. package/dist/tmux/launcher.mjs +127 -0
  124. package/dist/tmux/reminder-post-tool.d.mts +21 -0
  125. package/dist/tmux/reminder-post-tool.mjs +88 -0
  126. package/dist/tmux/runner.d.mts +11 -0
  127. package/dist/tmux/runner.mjs +26 -0
  128. package/dist/tmux/session-name.d.mts +5 -0
  129. package/dist/tmux/session-name.mjs +10 -0
  130. package/dist/tmux/shell-quote.d.mts +9 -0
  131. package/dist/tmux/shell-quote.mjs +16 -0
  132. package/dist/tmux/up.d.mts +2 -0
  133. package/dist/tmux/up.mjs +73 -0
  134. package/dist/tmux/windows.d.mts +18 -0
  135. package/dist/tmux/windows.mjs +50 -0
  136. package/package.json +16 -1
  137. package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
  138. package/scripts/tmux/tmux-agent-reminder.sh +68 -0
  139. package/scripts/tmux/tmux-name.sh +34 -0
  140. package/scripts/tmux/tmux-read-title.sh +13 -0
  141. package/scripts/tmux/tmux-target.sh +130 -0
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Remind the agent to rename the tmux window at workflow checkpoints.
5
+ # Called by agent hooks; stdout is injected as context.
6
+ #
7
+ # Usage: vouchington tmux agent-reminder <event>
8
+ # event: session-start | user-prompt
9
+ # TMUX_TARGET_BIN: optional tmux binary (default: tmux on PATH).
10
+ # TMUX_TARGET_ROOT: worktree the pane must belong to (default: $PWD).
11
+ # TMUX_NAME_COMMAND: command the reminder tells the agent to run
12
+ # (default: vouchington tmux name).
13
+ #
14
+ # Silently exits 0 when no tmux context is available.
15
+
16
+ EVENT="${1:-}"
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
18
+ # shellcheck source=tmux-target.sh
19
+ source "$SCRIPT_DIR/tmux-target.sh"
20
+ tmux_target_socket=''
21
+ tmux_target_pane=''
22
+ TMUX_TARGET_BIN="${TMUX_TARGET_BIN:-tmux}"
23
+ NAME_COMMAND="${TMUX_NAME_COMMAND:-vouchington tmux name}"
24
+
25
+ if tmux_target_resolve "${TMUX_TARGET_ROOT:-$PWD}" "${AGENT_TMUX_SOCKET:-}" "${AGENT_TMUX_PANE:-}" "${AGENT_TMUX_WORKTREE:-}"; then
26
+ :
27
+ else
28
+ # Hook reminders are advisory. The resolver diagnoses invalid bindings and
29
+ # the hook leaves the agent's work alone.
30
+ exit 0
31
+ fi
32
+
33
+ # Drain the hook payload so the caller never blocks on an unread pipe.
34
+ cat >/dev/null
35
+
36
+ pane_title() {
37
+ "$TMUX_TARGET_BIN" -S "$tmux_target_socket" display-message -p -t "$tmux_target_pane" '#{pane_title}' 2>/dev/null || true
38
+ }
39
+
40
+ POLICY="Run: $NAME_COMMAND <name> (must run unsandboxed: Claude/Codex dangerouslyDisableSandbox; Cursor disable sandbox)
41
+ Checkpoints: (1) topic clear → short-hyphenated-name; (2) plan accepted → refine if scope shifted; (3) PR created → append -pr<N> suffix; (4) git push on PR branch → confirm -pr<N> still set; (5) after compaction → verify name still matches topic; (6) reset-worktree → confirm pane title is empty."
42
+
43
+ json_escape() {
44
+ local value=$1
45
+ value=${value//\\/\\\\}
46
+ value=${value//\"/\\\"}
47
+ value=${value//$'\n'/\\n}
48
+ value=${value//$'\t'/\\t}
49
+ printf '%s' "$value"
50
+ }
51
+
52
+ # Emit structured hook context for events that require JSON stdout.
53
+ emit_json() {
54
+ printf '{"hookSpecificOutput":{"hookEventName":"%s","additionalContext":"%s"}}\n' \
55
+ "$(json_escape "$1")" "$(json_escape "$2")"
56
+ }
57
+
58
+ case "$EVENT" in
59
+ session-start)
60
+ emit_json "SessionStart" "[tmux-window-name] $POLICY"
61
+ ;;
62
+ user-prompt)
63
+ TITLE="$(pane_title)"
64
+ if [ -z "$TITLE" ] || printf '%s' "$TITLE" | grep -qE '^(claude|codex|grok|cursor|agent|zsh|bash|fish|reset|sh)$'; then
65
+ printf '[tmux-window-name] Topic is clear — set the window name now. %s\n' "$POLICY"
66
+ fi
67
+ ;;
68
+ esac
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Name the tmux window and pane that belong to the caller's worktree.
5
+ # The worktree defaults to the git root of $PWD; override with TMUX_TARGET_ROOT.
6
+ # The tmux binary defaults to `tmux`; override with TMUX_TARGET_BIN.
7
+
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
9
+ if [ "$#" -eq 1 ] && { [ "$1" = "-h" ] || [ "$1" = "--help" ]; }; then
10
+ echo 'Usage: vouchington tmux name [--socket PATH --pane %ID --worktree PATH] NAME'
11
+ exit 0
12
+ fi
13
+ # shellcheck source=tmux-target.sh
14
+ source "$SCRIPT_DIR/tmux-target.sh"
15
+ tmux_target_socket=''
16
+ tmux_target_pane=''
17
+ TMUX_TARGET_BIN="${TMUX_TARGET_BIN:-tmux}"
18
+
19
+ if tmux_target_parse "${TMUX_TARGET_ROOT:-$PWD}" "$@"; then
20
+ :
21
+ else
22
+ resolve_status=$?
23
+ # An interactive command outside tmux has no target. Invalid, partial, stale,
24
+ # and mismatched bindings retain the resolver's diagnostic.
25
+ if [ "$resolve_status" -eq 3 ]; then exit 0; fi
26
+ exit "$resolve_status"
27
+ fi
28
+
29
+ if [ -z "$tmux_target_name" ]; then
30
+ "$TMUX_TARGET_BIN" -S "$tmux_target_socket" set-window-option -t "$tmux_target_pane" automatic-rename on
31
+ else
32
+ "$TMUX_TARGET_BIN" -S "$tmux_target_socket" rename-window -t "$tmux_target_pane" -- "$tmux_target_name"
33
+ fi
34
+ "$TMUX_TARGET_BIN" -S "$tmux_target_socket" select-pane -t "$tmux_target_pane" -T "$tmux_target_name"
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5
+ # shellcheck source=tmux-target.sh
6
+ source "$SCRIPT_DIR/tmux-target.sh"
7
+ tmux_target_socket=''
8
+ tmux_target_pane=''
9
+ TMUX_TARGET_BIN="${TMUX_TARGET_BIN:-tmux}"
10
+
11
+ # A title read uses the same pane/worktree check as tmux-name.
12
+ tmux_target_resolve "${TMUX_TARGET_ROOT:-$PWD}" "${AGENT_TMUX_SOCKET:-}" "${AGENT_TMUX_PANE:-}" "${AGENT_TMUX_WORKTREE:-}"
13
+ "$TMUX_TARGET_BIN" -S "$tmux_target_socket" display-message -p -t "$tmux_target_pane" '#{pane_title}'
@@ -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
+ }