werkmeister-core 0.93.0 → 0.93.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # sandbox-core
2
2
 
3
+ ## 0.93.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cde5d85: SW-799: `with-temp-home` exports `TMPDIR` as its temp dir, so scratch a wrapped command makes in `os.tmpdir()` (the scripts tests' `mkdtemp` dirs) is removed on exit instead of piling up in the host's temp folder.
8
+
3
9
  ## 0.93.0
4
10
 
5
11
  ## 0.92.2
@@ -4,7 +4,7 @@
4
4
  * hand-roll `HOME=$(mktemp -d) …` and none can forget it.
5
5
  */
6
6
  /** Also run inline in a container by the pr gate (SW-329). */
7
- export declare const TEMP_HOME_SCRIPT = "#!/bin/sh\n# Generated by `werkmeister workspace init` (SW-124); rerun it to regenerate.\n# Runs <cmd...> with HOME set to a fresh temporary directory, removed on exit,\n# so no test or CLI exercise reads or writes the real ~/.werkmeister.\n# --no-wait first does what WERKMEISTER_NO_WAIT=1 does, without an env assignment (SW-367),\n# and exports it, so a with-temp-home nested under it skips its wait too (SW-425).\n[ \"${1:-}\" != --no-wait ] || { export WERKMEISTER_NO_WAIT=1; shift; }\nno_wait=${WERKMEISTER_NO_WAIT:-}\n[ \"$#\" -gt 0 ] || { echo \"usage: with-temp-home [--no-wait] <cmd> [args...]\" >&2; exit 2; }\n# Wait like the pr gate while host load is over budget.host_load (SW-224), before HOME\n# changes so the real config's budget applies; no werkmeister on PATH, no wait.\n# In the background with a trap, so killing the wrapper ends the wait too (SW-456).\n[ -n \"$no_wait\" ] || ! command -v werkmeister >/dev/null 2>&1 || {\n # Trap before the fork: $! is empty until the job exists, so no signal can land between them.\n trap 'kill $! 2>/dev/null; exit 130' HUP INT TERM\n werkmeister internal wait-load >&2 &\n wait $!\n# 75: the wait is spent and load is still over, so running would pile on (SW-540); any other failure runs.\n} || { s=$?; [ \"$s\" -ne 75 ] || exit 75; }\ntmp=$(mktemp -d) || exit 1\ntrap 'rm -rf \"$tmp\"' EXIT\ntrap 'exit 130' HUP INT TERM\n# Corepack keeps pnpm under HOME; without this a fresh HOME re-downloads it every run.\nexport COREPACK_HOME=\"${COREPACK_HOME:-$HOME/.cache/node/corepack}\"\n# OrbStack and Docker Desktop keep the compose plugin and context here (SW-285).\nexport DOCKER_CONFIG=\"${DOCKER_CONFIG:-$HOME/.docker}\"\n# A temp HOME isolates files, not the daemon: unreachable unless the caller sets it (SW-264).\nexport WERKMEISTER_HOST=\"${WERKMEISTER_HOST:-http://127.0.0.1:1}\"\n# An agent's shell inherits its Claude Code session's variables; CI has none (SW-332). CLAUDE_BIN stays.\nunset CLAUDECODE\nfor v in $(env | sed -n '/^CLAUDE_CODE_[A-Za-z0-9_]*=/s/=.*//p'); do unset \"$v\"; done\nHOME=$tmp \"$@\"\nstatus=$?\n# A failure under load reads as load (SW-209).\n[ \"$status\" -eq 0 ] || echo \"with-temp-home: exit $status; host load $(uptime | sed 's/.*load averages*: //; s/,//g') on $(getconf _NPROCESSORS_ONLN) cores\" >&2\nexit \"$status\"\n";
7
+ export declare const TEMP_HOME_SCRIPT = "#!/bin/sh\n# Generated by `werkmeister workspace init` (SW-124); rerun it to regenerate.\n# Runs <cmd...> with HOME set to a fresh temporary directory, removed on exit,\n# so no test or CLI exercise reads or writes the real ~/.werkmeister.\n# --no-wait first does what WERKMEISTER_NO_WAIT=1 does, without an env assignment (SW-367),\n# and exports it, so a with-temp-home nested under it skips its wait too (SW-425).\n[ \"${1:-}\" != --no-wait ] || { export WERKMEISTER_NO_WAIT=1; shift; }\nno_wait=${WERKMEISTER_NO_WAIT:-}\n[ \"$#\" -gt 0 ] || { echo \"usage: with-temp-home [--no-wait] <cmd> [args...]\" >&2; exit 2; }\n# Wait like the pr gate while host load is over budget.host_load (SW-224), before HOME\n# changes so the real config's budget applies; no werkmeister on PATH, no wait.\n# In the background with a trap, so killing the wrapper ends the wait too (SW-456).\n[ -n \"$no_wait\" ] || ! command -v werkmeister >/dev/null 2>&1 || {\n # Trap before the fork: $! is empty until the job exists, so no signal can land between them.\n trap 'kill $! 2>/dev/null; exit 130' HUP INT TERM\n werkmeister internal wait-load >&2 &\n wait $!\n# 75: the wait is spent and load is still over, so running would pile on (SW-540); any other failure runs.\n} || { s=$?; [ \"$s\" -ne 75 ] || exit 75; }\ntmp=$(mktemp -d) || exit 1\n# os.tmpdir() scratch from the wrapped command goes with the temp HOME (SW-799).\nexport TMPDIR=\"$tmp\"\ntrap 'rm -rf \"$tmp\"' EXIT\ntrap 'exit 130' HUP INT TERM\n# Corepack keeps pnpm under HOME; without this a fresh HOME re-downloads it every run.\nexport COREPACK_HOME=\"${COREPACK_HOME:-$HOME/.cache/node/corepack}\"\n# OrbStack and Docker Desktop keep the compose plugin and context here (SW-285).\nexport DOCKER_CONFIG=\"${DOCKER_CONFIG:-$HOME/.docker}\"\n# A temp HOME isolates files, not the daemon: unreachable unless the caller sets it (SW-264).\nexport WERKMEISTER_HOST=\"${WERKMEISTER_HOST:-http://127.0.0.1:1}\"\n# An agent's shell inherits its Claude Code session's variables; CI has none (SW-332). CLAUDE_BIN stays.\nunset CLAUDECODE\nfor v in $(env | sed -n '/^CLAUDE_CODE_[A-Za-z0-9_]*=/s/=.*//p'); do unset \"$v\"; done\nHOME=$tmp \"$@\"\nstatus=$?\n# A failure under load reads as load (SW-209).\n[ \"$status\" -eq 0 ] || echo \"with-temp-home: exit $status; host load $(uptime | sed 's/.*load averages*: //; s/,//g') on $(getconf _NPROCESSORS_ONLN) cores\" >&2\nexit \"$status\"\n";
8
8
  export declare function tempHomeWrapper(workspaceRoot: string): string;
9
9
  /** Write the wrapper, executable, over any earlier copy; returns its path. */
10
10
  export declare function writeTempHomeWrapper(workspaceRoot: string): string;
package/dist/temp_home.js CHANGED
@@ -27,6 +27,8 @@ no_wait=\${WERKMEISTER_NO_WAIT:-}
27
27
  # 75: the wait is spent and load is still over, so running would pile on (SW-540); any other failure runs.
28
28
  } || { s=$?; [ "$s" -ne 75 ] || exit 75; }
29
29
  tmp=$(mktemp -d) || exit 1
30
+ # os.tmpdir() scratch from the wrapped command goes with the temp HOME (SW-799).
31
+ export TMPDIR="$tmp"
30
32
  trap 'rm -rf "$tmp"' EXIT
31
33
  trap 'exit 130' HUP INT TERM
32
34
  # Corepack keeps pnpm under HOME; without this a fresh HOME re-downloads it every run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "werkmeister-core",
3
- "version": "0.93.0",
3
+ "version": "0.93.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "werkmeister's shared library. Its public API is werkmeister-core/sdk; every other entry point is internal.",