Skip to content

Expose stdlib loaded guard for companion libraries #50

@codeforester

Description

@codeforester

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or product improvement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions