Context
Portable mktemp usage is easy to get wrong across macOS and Linux, especially around mktemp -t. lib_std.sh should provide simple temp file and directory helpers that follow Base conventions and integrate with cleanup registration.
Scope
Add Base-native temp helpers to lib_std.sh, built on the cleanup/trap registration API. Do not copy external implementations.
Acceptance Criteria
- Public helpers create a temp file and a temp directory using caller-provided result variables.
- Helpers avoid platform-specific
mktemp -t assumptions and work with ${TMPDIR:-/tmp}.
- Temp paths are registered for cleanup by default.
- A clear opt-out exists for callers that intentionally need to keep the temp path.
- Invalid result variable names fail clearly.
- Public API and behavior are documented in
lib/bash/std/README.md.
- BATS coverage verifies file creation, directory creation, prefixes, cleanup registration, opt-out behavior, and invalid arguments.
Validation
- Focused stdlib BATS coverage.
./tests/validate.sh
- `git diff --check
Context
Portable
mktempusage is easy to get wrong across macOS and Linux, especially aroundmktemp -t.lib_std.shshould provide simple temp file and directory helpers that follow Base conventions and integrate with cleanup registration.Scope
Add Base-native temp helpers to
lib_std.sh, built on the cleanup/trap registration API. Do not copy external implementations.Acceptance Criteria
mktemp -tassumptions and work with${TMPDIR:-/tmp}.lib/bash/std/README.md.Validation
./tests/validate.sh