vouchington-tooling 0.0.4 → 0.0.6

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 (52) hide show
  1. package/README.md +10 -0
  2. package/dist/cli/commands/allocate-browser-safe-ports.slot-fixtures.test-helpers.d.mts +6 -0
  3. package/dist/cli/commands/allocate-browser-safe-ports.slot-fixtures.test-helpers.mjs +103 -0
  4. package/dist/cli/commands/github-output.test-helpers.d.mts +1 -0
  5. package/dist/cli/commands/github-output.test-helpers.mjs +32 -0
  6. package/dist/cli/commands/pnpm-install.d.mts +1 -0
  7. package/dist/cli/commands/pnpm-install.mjs +27 -0
  8. package/dist/cli/commands/spawn-script.d.mts +5 -0
  9. package/dist/cli/commands/spawn-script.mjs +7 -0
  10. package/dist/cli/commands/vitest-blob-manifest.d.mts +1 -0
  11. package/dist/cli/commands/vitest-blob-manifest.mjs +11 -0
  12. package/dist/cli/index.mjs +28 -0
  13. package/dist/cli/parse.d.mts +11 -0
  14. package/dist/cli/parse.mjs +14 -0
  15. package/dist/cli/script-path.d.mts +1 -0
  16. package/dist/cli/script-path.mjs +4 -0
  17. package/dist/cli/usage.d.mts +1 -1
  18. package/dist/cli/usage.mjs +16 -1
  19. package/dist/index.d.mts +6 -0
  20. package/dist/index.mjs +3 -0
  21. package/dist/pnpm-install/exec.d.mts +8 -0
  22. package/dist/pnpm-install/exec.mjs +88 -0
  23. package/dist/pnpm-install/index.d.mts +7 -0
  24. package/dist/pnpm-install/index.mjs +6 -0
  25. package/dist/pnpm-install/metadata.d.mts +5 -0
  26. package/dist/pnpm-install/metadata.mjs +91 -0
  27. package/dist/pnpm-install/pnpm-install-fixture.test-helpers.d.mts +22 -0
  28. package/dist/pnpm-install/pnpm-install-fixture.test-helpers.mjs +174 -0
  29. package/dist/pnpm-install/process.d.mts +11 -0
  30. package/dist/pnpm-install/process.mjs +81 -0
  31. package/dist/pnpm-install/release-age.d.mts +9 -0
  32. package/dist/pnpm-install/release-age.mjs +59 -0
  33. package/dist/pnpm-install/runner.d.mts +2 -0
  34. package/dist/pnpm-install/runner.mjs +106 -0
  35. package/dist/pnpm-install/support.d.mts +30 -0
  36. package/dist/pnpm-install/support.mjs +143 -0
  37. package/dist/shared-context/fake-git.test-helpers.d.mts +11 -0
  38. package/dist/shared-context/fake-git.test-helpers.mjs +59 -0
  39. package/dist/shared-context/index.d.mts +26 -0
  40. package/dist/shared-context/index.mjs +89 -0
  41. package/dist/vitest-blob-manifest/cli.d.mts +2 -0
  42. package/dist/vitest-blob-manifest/cli.mjs +33 -0
  43. package/dist/vitest-blob-manifest/index.d.mts +37 -0
  44. package/dist/vitest-blob-manifest/index.mjs +134 -0
  45. package/package.json +16 -1
  46. package/scripts/allocate-browser-safe-ports.py +661 -0
  47. package/scripts/fetch-forbidden-ports.json +7 -0
  48. package/scripts/gha/check-needs-results.sh +19 -0
  49. package/scripts/gha/download-with-diagnostics.sh +52 -0
  50. package/scripts/gha/host-pressure-diagnostics.sh +179 -0
  51. package/scripts/gha/write-github-multiline-output.sh +60 -0
  52. package/scripts/runner-port-policy.json +7 -0
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ci_download_failed() {
4
+ local url="$1"
5
+ local status="${2:-000}"
6
+ local message="DOWNLOAD FAILED: ${url} → HTTP ${status}"
7
+
8
+ echo "$message"
9
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
10
+ echo "$message" >> "$GITHUB_STEP_SUMMARY" || true
11
+ fi
12
+ }
13
+
14
+ ci_download_to() {
15
+ if [ "$#" -lt 2 ]; then
16
+ echo "Error: ci_download_to requires both url and destination arguments" >&2
17
+ return 1
18
+ fi
19
+ local url="$1"
20
+ local destination="$2"
21
+ shift 2
22
+
23
+ local http_status
24
+ local curl_status
25
+
26
+ if http_status=$(
27
+ curl \
28
+ --location \
29
+ --silent \
30
+ --show-error \
31
+ --output "$destination" \
32
+ --write-out '%{http_code}' \
33
+ --connect-timeout 30 \
34
+ --max-time 120 \
35
+ "$@" \
36
+ "$url"
37
+ ); then
38
+ curl_status=0
39
+ else
40
+ curl_status=$?
41
+ fi
42
+
43
+ if [ "$curl_status" -ne 0 ] || ! [[ "$http_status" =~ ^2[0-9][0-9]$ ]]; then
44
+ rm -f "$destination"
45
+ ci_download_failed "$url" "${http_status:-000}"
46
+ return 1
47
+ fi
48
+ }
49
+
50
+ if [ "${BASH_SOURCE[0]}" = "$0" ]; then
51
+ ci_download_to "$@"
52
+ fi
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -u
4
+
5
+ have() {
6
+ command -v "$1" >/dev/null 2>&1
7
+ }
8
+
9
+ section() {
10
+ printf '\n== %s ==\n' "$1"
11
+ }
12
+
13
+ show_meminfo_field() {
14
+ field=$1
15
+ if [ -r /proc/meminfo ]; then
16
+ awk -v name="$field" '$1 == name ":" { print }' /proc/meminfo 2>/dev/null || true
17
+ fi
18
+ }
19
+
20
+ show_oom_lines() {
21
+ lines=''
22
+ attempted=false
23
+
24
+ # Never retain a complete kernel log in memory. Each source gets two seconds,
25
+ # then the filtered result is capped at 50 lines of 1,000 characters.
26
+ if have timeout && have journalctl; then
27
+ attempted=true
28
+ lines=$(
29
+ timeout 2 journalctl -k --since '30 min ago' --no-pager 2>/dev/null |
30
+ grep -Ei 'oom|oom-kill|out of memory|killed process' |
31
+ cut -c 1-1000 |
32
+ tail -n 50 || true
33
+ )
34
+ fi
35
+
36
+ if [ -z "$lines" ] && have timeout && have dmesg; then
37
+ attempted=true
38
+ lines=$(
39
+ timeout 2 dmesg 2>/dev/null |
40
+ grep -Ei 'oom|oom-kill|out of memory|killed process' |
41
+ cut -c 1-1000 |
42
+ tail -n 50 || true
43
+ )
44
+ fi
45
+
46
+ if [ -n "$lines" ]; then
47
+ printf '%s\n' "$lines"
48
+ elif [ "$attempted" = false ]; then
49
+ printf 'unavailable: bounded kernel-log reader or source command missing\n'
50
+ else
51
+ printf 'no OOM-kill lines found within bounded reads\n'
52
+ fi
53
+ }
54
+
55
+ show_top_rss_processes() {
56
+ if have ps && have sort && have sed; then
57
+ ps ax -o pid= -o rss= -o comm= 2>/dev/null | sort -k2,2nr | sed -n '1,15p'
58
+ else
59
+ printf 'unavailable\n'
60
+ fi
61
+ }
62
+
63
+ show_runner_counts() {
64
+ ps ax -o comm= 2>/dev/null | awk '
65
+ {
66
+ command = $0
67
+ sub(/^[[:space:]]+/, "", command)
68
+ sub(/[[:space:]]+$/, "", command)
69
+ sub(/^.*\//, "", command)
70
+ if (command == "Runner.Worker") workers++
71
+ else if (command == "Runner.Listener") listeners++
72
+ }
73
+ END {
74
+ printf "Runner.Worker count: %d\n", workers + 0
75
+ printf "Runner.Listener count: %d\n", listeners + 0
76
+ }
77
+ '
78
+ }
79
+
80
+ show_cgroup_memory() {
81
+ found=false
82
+ relative_cgroup=$(awk -F: '$1 == "0" { print $3; exit }' /proc/self/cgroup 2>/dev/null || true)
83
+ case "$relative_cgroup" in
84
+ /*) current_cgroup_root=/sys/fs/cgroup$relative_cgroup ;;
85
+ *) current_cgroup_root=/sys/fs/cgroup ;;
86
+ esac
87
+
88
+ for cgroup_root in "$current_cgroup_root" /sys/fs/cgroup; do
89
+ for field in memory.current memory.max memory.events memory.events.local; do
90
+ path=$cgroup_root/$field
91
+ if [ -r "$path" ]; then
92
+ found=true
93
+ printf '%s:\n' "$path"
94
+ cat "$path" 2>/dev/null || printf 'unavailable\n'
95
+ fi
96
+ done
97
+ [ "$cgroup_root" = /sys/fs/cgroup ] && break
98
+ done
99
+ [ "$found" = true ] || printf 'unavailable\n'
100
+ }
101
+
102
+ platform=$(uname -s 2>/dev/null || printf 'unknown')
103
+
104
+ section 'host pressure diagnostics'
105
+ printf 'platform: %s\n' "$platform"
106
+
107
+ case "$platform" in
108
+ Linux)
109
+ section 'memory and swap basics'
110
+ if have free; then
111
+ free -h 2>/dev/null || printf 'free unavailable\n'
112
+ else
113
+ printf 'free unavailable\n'
114
+ fi
115
+
116
+ section '/proc/meminfo selected fields'
117
+ show_meminfo_field MemTotal
118
+ show_meminfo_field MemFree
119
+ show_meminfo_field MemAvailable
120
+ show_meminfo_field Buffers
121
+ show_meminfo_field Cached
122
+ show_meminfo_field SwapTotal
123
+ show_meminfo_field SwapFree
124
+ show_meminfo_field SwapCached
125
+
126
+ section 'cgroup memory'
127
+ show_cgroup_memory
128
+
129
+ section 'pressure stall information'
130
+ for path in /proc/pressure/memory /proc/pressure/cpu /proc/pressure/io; do
131
+ if [ -r "$path" ]; then
132
+ printf '%s:\n' "$path"
133
+ cat "$path" 2>/dev/null || printf 'unavailable\n'
134
+ else
135
+ printf '%s unavailable\n' "$path"
136
+ fi
137
+ done
138
+
139
+ section 'load and cpu'
140
+ if [ -r /proc/loadavg ]; then
141
+ printf 'load average: '
142
+ awk '{ print $1, $2, $3 }' /proc/loadavg 2>/dev/null || printf 'unavailable\n'
143
+ else
144
+ printf 'load average unavailable\n'
145
+ fi
146
+ printf 'nproc: '
147
+ if have nproc; then
148
+ nproc 2>/dev/null || printf 'unavailable\n'
149
+ else
150
+ getconf _NPROCESSORS_ONLN 2>/dev/null || printf 'unavailable\n'
151
+ fi
152
+
153
+ section 'kernel OOM evidence'
154
+ show_oom_lines
155
+ section 'top rss processes'
156
+ show_top_rss_processes
157
+ section 'runner worker/listener counts'
158
+ show_runner_counts
159
+ ;;
160
+ Darwin)
161
+ section 'system basics'
162
+ uptime 2>/dev/null || printf 'uptime unavailable\n'
163
+ printf 'hw.ncpu: '
164
+ sysctl -n hw.ncpu 2>/dev/null || printf 'unavailable\n'
165
+ printf 'hw.memsize: '
166
+ sysctl -n hw.memsize 2>/dev/null || printf 'unavailable\n'
167
+ section 'swap and vm'
168
+ vm_stat 2>/dev/null || printf 'vm_stat unavailable\n'
169
+ sysctl vm.swapusage 2>/dev/null || printf 'vm.swapusage unavailable\n'
170
+ section 'top rss processes'
171
+ show_top_rss_processes
172
+ section 'runner worker/listener counts'
173
+ show_runner_counts
174
+ ;;
175
+ *)
176
+ section 'system basics'
177
+ printf 'unsupported platform: %s\n' "$platform"
178
+ ;;
179
+ esac
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [[ $# -ne 1 ]]; then
5
+ echo "usage: $0 <output-name>" >&2
6
+ exit 2
7
+ fi
8
+
9
+ output_name=$1
10
+ if [[ ! "$output_name" =~ ^[A-Za-z_][A-Za-z0-9_-]*$ ]]; then
11
+ echo "invalid GitHub output name: $output_name" >&2
12
+ exit 2
13
+ fi
14
+
15
+ if [[ -z "${GITHUB_OUTPUT:-}" ]]; then
16
+ echo 'GITHUB_OUTPUT must be set' >&2
17
+ exit 2
18
+ fi
19
+
20
+ temporary_root=${RUNNER_TEMP:-${TMPDIR:-/tmp}}
21
+ payload_file=$(mktemp "$temporary_root/write-github-multiline-output.XXXXXX")
22
+ trap 'rm -f "$payload_file"' EXIT HUP INT TERM
23
+ cat >"$payload_file"
24
+
25
+ delimiter_prefix=$(printf '%s' "$output_name" | tr '[:lower:]-' '[:upper:]_')
26
+ delimiter=''
27
+ attempt=1
28
+ while [[ $attempt -le 10 ]]; do
29
+ if ! uuid=$(uuidgen); then
30
+ echo 'uuidgen failed while creating a GitHub output delimiter' >&2
31
+ exit 1
32
+ fi
33
+ if [[ -z "$uuid" ]]; then
34
+ echo 'uuidgen returned an empty GitHub output delimiter suffix' >&2
35
+ exit 1
36
+ fi
37
+
38
+ normalized_uuid=$(printf '%s' "$uuid" | tr '[:lower:]-' '[:upper:]_')
39
+ delimiter="${delimiter_prefix}_${normalized_uuid}"
40
+ if ! grep -Fq -- "$delimiter" "$payload_file"; then
41
+ break
42
+ fi
43
+
44
+ delimiter=''
45
+ attempt=$((attempt + 1))
46
+ done
47
+
48
+ if [[ -z "$delimiter" ]]; then
49
+ echo 'could not create a collision-free GitHub output delimiter after 10 attempts' >&2
50
+ exit 1
51
+ fi
52
+
53
+ {
54
+ printf '%s<<%s\n' "$output_name" "$delimiter"
55
+ cat "$payload_file"
56
+ if [[ -s "$payload_file" ]] && [[ $(tail -c 1 "$payload_file" | wc -l | tr -d ' ') -eq 0 ]]; then
57
+ printf '\n'
58
+ fi
59
+ printf '%s\n' "$delimiter"
60
+ } >>"$GITHUB_OUTPUT"
@@ -0,0 +1,7 @@
1
+ {
2
+ "reservedPortStart": 2200,
3
+ "reservedPortEnd": 2999,
4
+ "portsPerRunner": 16,
5
+ "minimumRunnerSlot": 1,
6
+ "maximumRunnerSlot": 50
7
+ }