Context
bashdep::_is_orphan calls bashdep::_lock_get (which forks awk over the whole lockfile) for every file in a directory (bashdep:432), and _should_skip_download does the same per dep (bashdep:400). clean/doctor are therefore O(files) awk spawns.
Scope
- Load the lockfile’s recorded names once per
clean/doctor/install run and test membership in-shell (e.g. a newline-delimited string + case/grep -qxF), or do a single awk that joins the dir listing against the lockfile and emits orphans directly.
- Keep behavior identical (orphan = regular file, not the lockfile, not the bashdep script, no lock entry).
Acceptance criteria
Out of scope
Changing lockfile format; parallelism.
Constraints (apply to all bashdep work)
- Bash 3.2+ compatible — no
declare -A, ${var,,}/${var^^}, mapfile, negative array index, &>>.
- Zero runtime deps beyond
curl/wget/awk/mktemp/mkdir/rm/cp/mv/printf/cat/grep/sort/tr/dirname/basename + shell builtins.
- TDD: write the failing test first (
tests/unit/*_test.sh), then implement; keep make test green for the right reason. Mock curl/wget — no network in tests.
- Quality gate:
make test && make sa && make lint must all pass.
- Update
docs/api.md / docs/behavior.md when public API or semantics change; add a CHANGELOG.md ## [Unreleased] entry for any user-visible change.
- Conventional commits (
ref: for refactors); never mention AI/automation. One PR per issue, assigned to Chemaclass.
Context
bashdep::_is_orphancallsbashdep::_lock_get(which forksawkover the whole lockfile) for every file in a directory (bashdep:432), and_should_skip_downloaddoes the same per dep (bashdep:400).clean/doctorare therefore O(files)awkspawns.Scope
clean/doctor/installrun and test membership in-shell (e.g. a newline-delimited string +case/grep -qxF), or do a singleawkthat joins the dir listing against the lockfile and emits orphans directly.Acceptance criteria
cleananddoctorread each lockfile at most once, not once per fileawkcount before vs after for a dir with N filesOut of scope
Changing lockfile format; parallelism.
Constraints (apply to all bashdep work)
declare -A,${var,,}/${var^^},mapfile, negative array index,&>>.curl/wget/awk/mktemp/mkdir/rm/cp/mv/printf/cat/grep/sort/tr/dirname/basename+ shell builtins.tests/unit/*_test.sh), then implement; keepmake testgreen for the right reason. Mockcurl/wget— no network in tests.make test && make sa && make lintmust all pass.docs/api.md/docs/behavior.mdwhen public API or semantics change; add aCHANGELOG.md## [Unreleased]entry for any user-visible change.ref:for refactors); never mention AI/automation. One PR per issue, assigned to Chemaclass.