diff --git a/scripts/source/files/generate_function_manifest.sh b/scripts/source/files/generate_function_manifest.sh index 3c1eb44..8ec7fec 100644 --- a/scripts/source/files/generate_function_manifest.sh +++ b/scripts/source/files/generate_function_manifest.sh @@ -305,6 +305,27 @@ isSuccessful "Wrote $(realpath --relative-to="$SCRIPTS_DIR" "$OUTPUT")" isNotice "Scanned $total_files files, indexed $total_fns function definitions" isNotice "${#eager_files[@]} files flagged eager (will always source)" +# Untracked sources: warn before the manifest goes anywhere. +# +# The scan indexes what is on disk, which is correct. The hazard is committing +# the result: an entry for a file git does not have installs a stub on every +# other clone, and the first call to it unsets the stub, fails to source a file +# that is not there, and dies with "command not found". Easy to cause without +# noticing — several people working in one tree means someone else's in-progress +# file is sitting in scripts/ whenever you happen to regenerate. +# +# Just a warning: the scan is right to index them, and mid-work is a perfectly +# normal state for the tree to be in. What is not fine is committing it. +if command -v git >/dev/null 2>&1 && git -C "$SCRIPTS_DIR" rev-parse --git-dir >/dev/null 2>&1; then + _untracked=$(git -C "$SCRIPTS_DIR" ls-files --others --exclude-standard -- '*.sh' 2>/dev/null) + if [[ -n "$_untracked" ]]; then + isNotice "Indexed files git does not track yet:" + printf ' %s\n' $_untracked + isNotice " Commit them with this manifest, or drop their entries before committing —" + isNotice " an entry for a file others do not have breaks on first call." + fi +fi + # Collisions: report so they can be audited. The manifest reflects last-write- # wins, which matches the existing eager-load semantics, so behaviour is # identical — the warnings are about *avoidable* fragility, not bugs.