Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2026-01-18 - [Shell Builtins vs Caching]
**Learning:** Attempted to cache `command -v` results in a variable to avoid repeated checks. However, benchmarking revealed that `command -v` (a shell builtin) is extremely fast, and the overhead of checking a variable in shell script is comparable or even slower than the builtin itself. The optimization added complexity without performance gain.
**Action:** Do not cache shell builtins like `command -v` unless inside a very tight loop with significant other overheads. Focus on avoiding external process spawns (like `jq`, `chmod`, `grep`) instead.
## 2026-01-16 - [Shell Dependency Check Overhead]
**Learning:** `lib/core/common.sh` functions like `safe_json_get_key` re-check dependencies (`command -v jq`) on every invocation. In tight loops, this adds significant overhead (~13% in micro-benchmark).
**Action:** Cache dependency checks in global variables (e.g., `_JSON_PROCESSOR_CACHE`) when the script is sourced, rather than checking inside hot functions.
Expand Down
27 changes: 20 additions & 7 deletions bin/workflow-enforcer
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi

# Determine Project Root (where .adbs data is)
# Default to current directory or ADBS_PROJECT_ROOT if set
if [ -n "$ADBS_PROJECT_ROOT" ]; then
if [ -n "${ADBS_PROJECT_ROOT:-}" ]; then
PROJECT_ROOT="$ADBS_PROJECT_ROOT"
else
# Fallback: assume current directory is project root
Expand All @@ -44,12 +44,25 @@ DASHBOARD="$INSTALL_ROOT/lib/internal/dashboard.sh"
mkdir -p "$PROJECT_ROOT/lib/internal"

# Ensure scripts are executable
if ! chmod +x "$WORK_MANAGER" "$TASK_BACKEND" "$MIGRATOR" "$PLATFORM_DETECTOR" "$DASHBOARD" 2>/dev/null; then
# chmod failed - likely on Windows or permission issue
# Check if scripts are already executable or if we're on Windows
if [ ! -x "$WORK_MANAGER" ] && [ "$(uname -s)" != "MINGW"* ] && [ "$(uname -s)" != "MSYS"* ]; then
echo "Warning: Could not make scripts executable. You may need to run:"
echo " chmod +x lib/**/*.sh bin/*"
# Performance: Check first to avoid spawning chmod process on every run
_scripts_to_check=("$WORK_MANAGER" "$TASK_BACKEND" "$MIGRATOR" "$PLATFORM_DETECTOR" "$DASHBOARD")
_needs_chmod=false

for script in "${_scripts_to_check[@]}"; do
if [ ! -x "$script" ]; then
_needs_chmod=true
break
fi
done

if [ "$_needs_chmod" = true ]; then
if ! chmod +x "${_scripts_to_check[@]}" 2>/dev/null; then
# chmod failed - likely on Windows or permission issue
# Check if scripts are already executable or if we're on Windows
if [ ! -x "$WORK_MANAGER" ] && [ "$(uname -s)" != "MINGW"* ] && [ "$(uname -s)" != "MSYS"* ]; then
echo "Warning: Could not make scripts executable. You may need to run:"
echo " chmod +x lib/**/*.sh bin/*"
fi
fi
fi

Expand Down
Empty file modified lib/internal/dashboard.sh
100644 → 100755
Empty file.
Empty file modified lib/internal/migrator.sh
100644 → 100755
Empty file.
Empty file modified lib/internal/task_backend.sh
100644 → 100755
Empty file.
62 changes: 32 additions & 30 deletions lib/internal/work_manager.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -406,33 +406,35 @@ export_context() {
}

# Main command handler
case "${1:-}" in
create|new)
shift
create_work "$@"
;;
list)
shift
list_work "$@"
;;
show)
shift
show_work "$@"
;;
context)
shift
export_context "$@"
;;
complete|done)
shift
complete_work "$@"
;;
status)
show_status
;;
*)
echo "Unknown work command: ${1:-}"
echo "Usage: work_manager.sh {create|list|show|complete|status}"
exit 1
;;
esac
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
case "${1:-}" in
create|new)
shift
create_work "$@"
;;
list)
shift
list_work "$@"
;;
show)
shift
show_work "$@"
;;
context)
shift
export_context "$@"
;;
complete|done)
shift
complete_work "$@"
;;
status)
show_status
;;
*)
echo "Unknown work command: ${1:-}"
echo "Usage: work_manager.sh {create|list|show|complete|status}"
exit 1
;;
esac
fi
Loading