diff --git a/.claude/rules/architecture-map.md b/.claude/rules/architecture-map.md index e252ef26..2c2677a7 100644 --- a/.claude/rules/architecture-map.md +++ b/.claude/rules/architecture-map.md @@ -101,7 +101,9 @@ shell (or, in parallel, in per-test `.result` files aggregated at the end). | `coverage/html_index.sh` / `html_file.sh` | HTML page emitters; the only two files exempt from `max_line_length` | | `rerun.sh` | `.bashunit/last-failed` cache for `--rerun-failed` | | `reports.sh` | JUnit/HTML/TAP/JSON writers | -| `check_os.sh` / `dependencies.sh` | one-fork OS detect; `command -v` probes (builtins, not forks) | +| `system/index.sh` | aggregator only — sources the `src/system/` module below | +| `system/check_os.sh` / `system/dependencies.sh` | one-fork OS detect; `command -v` probes (builtins, not forks) | +| `system/io.sh` | small I/O helpers | | `cli/index.sh` | aggregator only — sources the `src/cli/` module below | | `cli/{upgrade,watch,doc,init}.sh` | the non-`test` subcommand implementations; `main.sh` is their only caller | | `learn/index.sh` `benchmark.sh` | the remaining non-`test` subcommands; benchmark is shared with `runner/bench.sh` | diff --git a/bashunit b/bashunit index 029f1934..55e269fa 100755 --- a/bashunit +++ b/bashunit @@ -65,11 +65,9 @@ for arg in "$@"; do done source "$BASHUNIT_ROOT_DIR/src/dev/debug.sh" -source "$BASHUNIT_ROOT_DIR/src/check_os.sh" +source "$BASHUNIT_ROOT_DIR/src/system/index.sh" source "$BASHUNIT_ROOT_DIR/src/str.sh" source "$BASHUNIT_ROOT_DIR/src/globals.sh" -source "$BASHUNIT_ROOT_DIR/src/dependencies.sh" -source "$BASHUNIT_ROOT_DIR/src/io.sh" source "$BASHUNIT_ROOT_DIR/src/math.sh" source "$BASHUNIT_ROOT_DIR/src/parallel.sh" source "$BASHUNIT_ROOT_DIR/src/env.sh" diff --git a/build.sh b/build.sh index 185f1a9e..aaa56792 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -source src/check_os.sh +source src/system/check_os.sh bashunit::check_os::init BASHUNIT_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/src/check_os.sh b/src/system/check_os.sh similarity index 100% rename from src/check_os.sh rename to src/system/check_os.sh diff --git a/src/dependencies.sh b/src/system/dependencies.sh similarity index 100% rename from src/dependencies.sh rename to src/system/dependencies.sh diff --git a/src/system/index.sh b/src/system/index.sh new file mode 100644 index 00000000..a1c78417 --- /dev/null +++ b/src/system/index.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Entry point for the src/system/ module: only `source` lines and comments belong +# here. build.sh emits a file's body before recursing into its `source` lines, so +# any statement here would run before its dependencies in the built binary +# (adrs/adr-010-src-module-directories.md). +# +# Capability probing: what this machine is and what it has. The bottom layer -- +# nothing here touches config, test state, console or the runner. +source "$BASHUNIT_ROOT_DIR/src/system/check_os.sh" +source "$BASHUNIT_ROOT_DIR/src/system/dependencies.sh" +source "$BASHUNIT_ROOT_DIR/src/system/io.sh" diff --git a/src/io.sh b/src/system/io.sh similarity index 100% rename from src/io.sh rename to src/system/io.sh diff --git a/tests/unit/check_os_test.sh b/tests/unit/check_os_test.sh index 8cd9c5c3..84ea08f4 100644 --- a/tests/unit/check_os_test.sh +++ b/tests/unit/check_os_test.sh @@ -85,7 +85,7 @@ function test_module_load_detects_os_with_a_single_uname_call() { # under `build.sh --verify` the built bashunit lives in a folder # without src/, and sourcing through $BASHUNIT_ROOT_DIR crashed # the whole verification run (silently, until #834 gated it). - source "$(dirname "${BASH_SOURCE[0]}")/../../src/check_os.sh" + source "$(dirname "${BASH_SOURCE[0]}")/../../src/system/check_os.sh" assert_have_been_called_times 1 uname }