38 lines
1.3 KiB
Bash
Executable File
38 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# ==============================================================================
|
|
# PARA TARGET CONTROLS
|
|
# Comment out (#) any directory to completely deactivate it from the sweep.
|
|
# ==============================================================================
|
|
TARGETS=(
|
|
"$HOME/ExoKortex/1-Projects"
|
|
"$HOME/ExoKortex/2-Areas"
|
|
# "$HOME/ExoKortex/3-Resources"
|
|
# "$HOME/ExoKortex/4-Archives/"
|
|
)
|
|
|
|
# Protect against empty arrays if all targets get disabled
|
|
if [ ${#TARGETS[@]} -eq 0 ]; then
|
|
echo "Drop execution: No active PARA targets configured."
|
|
exit 0
|
|
fi
|
|
|
|
# Root ExoKortex repo (root-level org files only; see ~/ExoKortex/.gitignore)
|
|
if git -C "$HOME/ExoKortex" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
if [ -n "$(git -C "$HOME/ExoKortex" status --porcelain)" ]; then
|
|
git -C "$HOME/ExoKortex" add -A
|
|
git -C "$HOME/ExoKortex" commit -m "System: Automated background sweep $(date +'%Y-%m-%d %H:%M')"
|
|
fi
|
|
fi
|
|
|
|
# Execute strict structural scanning on active paths only
|
|
find "${TARGETS[@]}" -mindepth 2 -maxdepth 2 -type d -name ".git" | while read -r gitdir; do
|
|
repo_dir=$(dirname "$gitdir")
|
|
cd "$repo_dir"
|
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
git add .
|
|
git commit -m "System: Automated background sweep $(date +'%Y-%m-%d %H:%M')"
|
|
fi
|
|
done
|