Context
Companion libraries currently detect lib_std.sh indirectly by checking for selected functions. That works, but it is an implicit contract. As more companion libraries are added, they should have a stable, documented stdlib-loaded marker to check before sourcing.
Scope
Add a Base-native loaded guard marker from lib_std.sh, then use it from companion libraries. Do not borrow code from external shell libraries.
Acceptance Criteria
lib_std.sh exposes a documented loaded marker after successful initialization.
lib_file.sh, lib_git.sh, and any current companion libraries check the stable marker before loading.
- Sourcing a companion library before
lib_std.sh fails clearly with the existing style of error message.
- Existing source-once behavior remains unchanged.
- README or library docs describe the source order/guard contract.
- BATS coverage verifies guarded and correctly-loaded paths.
Validation
- Focused BATS coverage for stdlib and companion-library guard behavior.
./tests/validate.sh
- `git diff --check
Context
Companion libraries currently detect
lib_std.shindirectly by checking for selected functions. That works, but it is an implicit contract. As more companion libraries are added, they should have a stable, documented stdlib-loaded marker to check before sourcing.Scope
Add a Base-native loaded guard marker from
lib_std.sh, then use it from companion libraries. Do not borrow code from external shell libraries.Acceptance Criteria
lib_std.shexposes a documented loaded marker after successful initialization.lib_file.sh,lib_git.sh, and any current companion libraries check the stable marker before loading.lib_std.shfails clearly with the existing style of error message.Validation
./tests/validate.sh