diff --git a/.agents/scripts/101domains-helper.sh b/.agents/scripts/101domains-helper.sh index dbd0eed9..1f473bc8 100755 --- a/.agents/scripts/101domains-helper.sh +++ b/.agents/scripts/101domains-helper.sh @@ -4,46 +4,17 @@ # 101domains Registrar Helper Script # Comprehensive domain and DNS management for AI assistants -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_DOMAIN_NAME_REQUIRED="Domain name is required" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" # Common constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} CONFIG_FILE="../configs/101domains-config.json" API_BASE_URL="https://api.101domain.com/v4" diff --git a/.agents/scripts/_archive/add-missing-returns.sh b/.agents/scripts/_archive/add-missing-returns.sh index 77be221c..c72f8083 100755 --- a/.agents/scripts/_archive/add-missing-returns.sh +++ b/.agents/scripts/_archive/add-missing-returns.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Add return statements to functions missing them add_returns_to_file() { diff --git a/.agents/scripts/_archive/fix-auth-headers.sh b/.agents/scripts/_archive/fix-auth-headers.sh index 89eeb43e..6f38abc2 100755 --- a/.agents/scripts/_archive/fix-auth-headers.sh +++ b/.agents/scripts/_archive/fix-auth-headers.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix Authorization header in a file fix_auth_header_in_file() { diff --git a/.agents/scripts/_archive/fix-common-strings.sh b/.agents/scripts/_archive/fix-common-strings.sh index 8fb6b165..4d4c6083 100755 --- a/.agents/scripts/_archive/fix-common-strings.sh +++ b/.agents/scripts/_archive/fix-common-strings.sh @@ -10,39 +10,10 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔧 $message${NC}" diff --git a/.agents/scripts/_archive/fix-content-type.sh b/.agents/scripts/_archive/fix-content-type.sh index a852bdeb..fc55f5a3 100755 --- a/.agents/scripts/_archive/fix-content-type.sh +++ b/.agents/scripts/_archive/fix-content-type.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix Content-Type in a file fix_content_type_in_file() { @@ -41,13 +27,11 @@ fix_content_type_in_file() { sed -i '' '/NC=.*No Color/a\ \ # Common constants\ -readonly CONTENT_TYPE_JSON="Content-Type: application/json" ' "$file" elif grep -q "readonly.*NC=" "$file"; then sed -i '' '/readonly.*NC=/a\ \ # Common constants\ -readonly CONTENT_TYPE_JSON="Content-Type: application/json" ' "$file" fi fi diff --git a/.agents/scripts/_archive/fix-error-messages.sh b/.agents/scripts/_archive/fix-error-messages.sh index d6622503..11880dca 100755 --- a/.agents/scripts/_archive/fix-error-messages.sh +++ b/.agents/scripts/_archive/fix-error-messages.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix error messages in a file fix_error_messages_in_file() { @@ -62,7 +48,6 @@ fix_error_messages_in_file() { if [[ $unknown_cmd_count -ge 1 ]]; then if ! grep -q "ERROR_UNKNOWN_COMMAND" "$file"; then sed -i '' '/# Error message constants/a\ -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" ' "$file" changes_made=1 fi diff --git a/.agents/scripts/_archive/fix-misplaced-returns.sh b/.agents/scripts/_archive/fix-misplaced-returns.sh index f2cb3b87..edf2c7ff 100755 --- a/.agents/scripts/_archive/fix-misplaced-returns.sh +++ b/.agents/scripts/_archive/fix-misplaced-returns.sh @@ -4,6 +4,9 @@ # Script to fix misplaced return statements in mainwp-helper.sh # These were introduced by the earlier mass fix script +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + cd providers || exit echo "🔧 Fixing misplaced return statements in mainwp-helper.sh..." diff --git a/.agents/scripts/_archive/fix-remaining-literals.sh b/.agents/scripts/_archive/fix-remaining-literals.sh index 855f2d0f..93190a1d 100755 --- a/.agents/scripts/_archive/fix-remaining-literals.sh +++ b/.agents/scripts/_archive/fix-remaining-literals.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix remaining string literals in a file fix_remaining_literals_in_file() { @@ -103,7 +89,6 @@ readonly HELP_SHOW_MESSAGE="Show this help" fi sed -i '' '/# Common.*constants/a\ -readonly CONTENT_TYPE_JSON="Content-Type: application/json" ' "$file" sed -i '' 's|"Content-Type: application/json"|"$CONTENT_TYPE_JSON"|g' "$file" changes_made=1 diff --git a/.agents/scripts/_archive/fix-s131-default-cases.sh b/.agents/scripts/_archive/fix-s131-default-cases.sh index 72bc5820..c5a116b3 100755 --- a/.agents/scripts/_archive/fix-s131-default-cases.sh +++ b/.agents/scripts/_archive/fix-s131-default-cases.sh @@ -6,19 +6,10 @@ # # This script finds case statements missing a default (*) case and adds one. -set -euo pipefail - -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -print_info() { echo -e "${BLUE}[INFO]${NC} $1"; return 0; } -print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; return 0; } -print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; return 0; } -print_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; return 0; } +set -euo pipefail DRY_RUN=false TARGET_FILE="" diff --git a/.agents/scripts/_archive/fix-sc2155-simple.sh b/.agents/scripts/_archive/fix-sc2155-simple.sh index 2cd37173..9e651d6b 100755 --- a/.agents/scripts/_archive/fix-sc2155-simple.sh +++ b/.agents/scripts/_archive/fix-sc2155-simple.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix SC2155 in a file using simple patterns fix_sc2155_simple() { diff --git a/.agents/scripts/_archive/fix-shellcheck-critical.sh b/.agents/scripts/_archive/fix-shellcheck-critical.sh index feaea290..e0f1b444 100755 --- a/.agents/scripts/_archive/fix-shellcheck-critical.sh +++ b/.agents/scripts/_archive/fix-shellcheck-critical.sh @@ -7,29 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly NC='\033[0m' - -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} - -print_warning() { - local _arg1="$1" - echo -e "${YELLOW}⚠️ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Fix SC2155 issues in a file fix_sc2155_in_file() { diff --git a/.agents/scripts/_archive/fix-string-literals.sh b/.agents/scripts/_archive/fix-string-literals.sh index 7c8b35f4..2e488c30 100755 --- a/.agents/scripts/_archive/fix-string-literals.sh +++ b/.agents/scripts/_archive/fix-string-literals.sh @@ -10,39 +10,10 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔧 $message${NC}" diff --git a/.agents/scripts/add-skill-helper.sh b/.agents/scripts/add-skill-helper.sh index 9a2645b2..517d834b 100755 --- a/.agents/scripts/add-skill-helper.sh +++ b/.agents/scripts/add-skill-helper.sh @@ -21,6 +21,9 @@ # add-skill-helper.sh check-updates # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -29,13 +32,6 @@ SKILL_SOURCES="${AGENTS_DIR}/configs/skill-sources.json" TEMP_DIR="${TMPDIR:-/tmp}/aidevops-skill-import" SCAN_RESULTS_FILE=".agents/SKILL-SCAN-RESULTS.md" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - # ============================================================================= # Helper Functions # ============================================================================= diff --git a/.agents/scripts/agent-browser-helper.sh b/.agents/scripts/agent-browser-helper.sh index 7320bb5f..e6dbdcf0 100755 --- a/.agents/scripts/agent-browser-helper.sh +++ b/.agents/scripts/agent-browser-helper.sh @@ -9,38 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Check if agent-browser is installed check_installed() { if command -v agent-browser &> /dev/null; then diff --git a/.agents/scripts/agent-test-helper.sh b/.agents/scripts/agent-test-helper.sh index a75a349a..542c00a8 100755 --- a/.agents/scripts/agent-test-helper.sh +++ b/.agents/scripts/agent-test-helper.sh @@ -48,6 +48,8 @@ set -euo pipefail # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # shellcheck disable=SC2034 readonly SCRIPT_DIR source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true @@ -76,22 +78,14 @@ detect_cli() { AI_CLI="$(detect_cli)" readonly AI_CLI -readonly DEFAULT_TIMEOUT="${AGENT_TEST_TIMEOUT:-120}" # OpenCode server defaults (localhost-only, HTTP is intentional for local dev server) readonly OPENCODE_HOST="${OPENCODE_HOST:-localhost}" readonly OPENCODE_PORT="${OPENCODE_PORT:-4096}" readonly OPENCODE_URL="http://${OPENCODE_HOST}:${OPENCODE_PORT}" # NOSONAR - localhost dev server, no TLS needed -# Colors -readonly GREEN='\033[0;32m' -readonly RED='\033[0;31m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly PURPLE='\033[0;35m' readonly BOLD='\033[1m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Logging log_info() { echo -e "${BLUE}[TEST]${NC} $*"; } diff --git a/.agents/scripts/agno-setup.sh b/.agents/scripts/agno-setup.sh index d9c7494c..aa20ab2a 100755 --- a/.agents/scripts/agno-setup.sh +++ b/.agents/scripts/agno-setup.sh @@ -7,17 +7,8 @@ # Author: AI DevOps Framework # Version: 1.2.0 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Configuration AGNO_DIR="$HOME/.aidevops/agno" diff --git a/.agents/scripts/ampcode-cli.sh b/.agents/scripts/ampcode-cli.sh index 2339ddcc..377d7c57 100755 --- a/.agents/scripts/ampcode-cli.sh +++ b/.agents/scripts/ampcode-cli.sh @@ -17,46 +17,16 @@ # Version: 1.0.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Configuration readonly AMPCODE_API_CONFIG="configs/ampcode-config.json" readonly AMPCODE_RESULTS_DIR=".agents/tmp/ampcode" readonly ALLOWED_OUTPUT_FORMATS="json text csv html md" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🤖 $message${NC}" diff --git a/.agents/scripts/anti-detect-helper.sh b/.agents/scripts/anti-detect-helper.sh index a70e18cd..3ce9cfd6 100755 --- a/.agents/scripts/anti-detect-helper.sh +++ b/.agents/scripts/anti-detect-helper.sh @@ -12,12 +12,7 @@ VENV_DIR="$HOME/.aidevops/anti-detect-venv" # shellcheck disable=SC2034 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +source "${SCRIPT_DIR}/shared-constants.sh" show_help() { cat <<'EOF' diff --git a/.agents/scripts/auto-version-bump.sh b/.agents/scripts/auto-version-bump.sh index a7a1c986..4a3ab048 100755 --- a/.agents/scripts/auto-version-bump.sh +++ b/.agents/scripts/auto-version-bump.sh @@ -7,17 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Source shared constants (provides sed_inplace and other utilities) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit diff --git a/.agents/scripts/autogen-helper.sh b/.agents/scripts/autogen-helper.sh index ba10c8ef..0c2ee901 100755 --- a/.agents/scripts/autogen-helper.sh +++ b/.agents/scripts/autogen-helper.sh @@ -16,14 +16,10 @@ # help Show this help message # ============================================================================= -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Configuration AUTOGEN_DIR="$HOME/.aidevops/autogen" @@ -32,22 +28,6 @@ SCRIPTS_DIR="$HOME/.aidevops/scripts" LOCALHOST_HELPER="$SCRIPTS_DIR/localhost-helper.sh" # Helper functions -print_info() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - # Port management integration with localhost-helper.sh # Returns available port (original if free, or next available) get_available_port() { diff --git a/.agents/scripts/beads-sync-helper.sh b/.agents/scripts/beads-sync-helper.sh index 3d5e4756..27689f67 100755 --- a/.agents/scripts/beads-sync-helper.sh +++ b/.agents/scripts/beads-sync-helper.sh @@ -24,19 +24,15 @@ # - Conflict detection with manual resolution # - Audit log of all sync operations +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration LOCK_FILE="/tmp/beads-sync.lock" LOCK_TIMEOUT=60 -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - # Logging log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[OK]${NC} $*"; } diff --git a/.agents/scripts/clawdhub-helper.sh b/.agents/scripts/clawdhub-helper.sh index 4da71bf6..c8e46372 100755 --- a/.agents/scripts/clawdhub-helper.sh +++ b/.agents/scripts/clawdhub-helper.sh @@ -18,6 +18,9 @@ # clawdhub-helper.sh info caldav-calendar # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -25,13 +28,6 @@ CLAWDHUB_BASE_URL="https://clawdhub.com" CLAWDHUB_API="${CLAWDHUB_BASE_URL}/api/v1" TEMP_DIR="${TMPDIR:-/tmp}/clawdhub-fetch" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - log_info() { echo -e "${BLUE}[clawdhub]${NC} $1" return 0 diff --git a/.agents/scripts/cloudron-helper.sh b/.agents/scripts/cloudron-helper.sh index 8aa9af79..7efbd3ab 100755 --- a/.agents/scripts/cloudron-helper.sh +++ b/.agents/scripts/cloudron-helper.sh @@ -4,42 +4,16 @@ # Cloudron Helper Script # Manages Cloudron servers and applications -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_SERVER_NAME_REQUIRED="Server name is required" readonly ERROR_SERVER_NOT_FOUND="Server not found in configuration" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Error message constants # readonly USAGE_PREFIX="Usage:" # Currently unused -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" - -print_info() { - local message="$1" - echo -e "${BLUE}[INFO]${NC} $message" - return 0 -} -print_success() { - local message="$1" - echo -e "${GREEN}[SUCCESS]${NC} $message" - return 0 -} -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARNING]${NC} $message" - return 0 -} -print_error() { - local message="$1" - echo -e "${RED}[ERROR]${NC} $message" >&2 - return 0 -} # Configuration file CONFIG_FILE="../configs/cloudron-config.json" diff --git a/.agents/scripts/cloudron-package-helper.sh b/.agents/scripts/cloudron-package-helper.sh index a5287c8f..05649eec 100755 --- a/.agents/scripts/cloudron-package-helper.sh +++ b/.agents/scripts/cloudron-package-helper.sh @@ -16,14 +16,10 @@ # scaffold [type] Generate boilerplate (php|node|python|go|static) # status Show current package status -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color +set -euo pipefail # Logging functions log_info() { echo -e "${BLUE}[INFO]${NC} $*"; return 0; } diff --git a/.agents/scripts/codacy-cli-chunked.sh b/.agents/scripts/codacy-cli-chunked.sh index 4b1a03a9..6b98c872 100755 --- a/.agents/scripts/codacy-cli-chunked.sh +++ b/.agents/scripts/codacy-cli-chunked.sh @@ -16,17 +16,10 @@ # Version: 1.0.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Configuration readonly CODACY_CONFIG_DIR=".codacy" readonly CODACY_CONFIG_FILE="$CODACY_CONFIG_DIR/codacy.yaml" @@ -42,30 +35,6 @@ PROGRESS_FILE=".agents/tmp/codacy-progress.log" TIMESTAMP_FILE=".agents/tmp/codacy-timestamp.log" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔍 $message${NC}" diff --git a/.agents/scripts/codacy-cli.sh b/.agents/scripts/codacy-cli.sh index 0893140c..fc6f8e11 100755 --- a/.agents/scripts/codacy-cli.sh +++ b/.agents/scripts/codacy-cli.sh @@ -17,16 +17,10 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Configuration readonly CODACY_CLI_VERSION="1.0.0-main.361.sha.f961a76" readonly CODACY_CONFIG_DIR=".codacy" @@ -35,24 +29,6 @@ readonly CODACY_API_CONFIG="configs/codacy-config.json" # API token loaded from environment variable CODACY_API_TOKEN # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - # Load API configuration load_api_config() { # Check environment variable first (set via credentials.sh, sourced by .zshrc) @@ -99,12 +75,6 @@ load_api_config() { return 0 } -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔍 $message${NC}" diff --git a/.agents/scripts/coderabbit-pro-analysis.sh b/.agents/scripts/coderabbit-pro-analysis.sh index 781fc781..16bbfa39 100755 --- a/.agents/scripts/coderabbit-pro-analysis.sh +++ b/.agents/scripts/coderabbit-pro-analysis.sh @@ -16,16 +16,10 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Framework constants (verified November 2024) # These metrics are validated against live quality platforms readonly FRAMEWORK_NAME="AI DevOps Framework" @@ -34,30 +28,6 @@ readonly TOTAL_LINES="18000+" readonly PROVIDERS_COUNT="25+" # Print functions with idiomatic return patterns -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🤖 $message${NC}" diff --git a/.agents/scripts/context-builder-helper.sh b/.agents/scripts/context-builder-helper.sh index b239ced6..e240ad87 100755 --- a/.agents/scripts/context-builder-helper.sh +++ b/.agents/scripts/context-builder-helper.sh @@ -22,6 +22,8 @@ set -euo pipefail # Configuration declare SCRIPT_DIR SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR export SCRIPT_DIR # Available for sourced scripts declare SCRIPT_NAME @@ -32,42 +34,10 @@ readonly VERSION="1.0.0" # Default output directory readonly DEFAULT_OUTPUT_DIR="$HOME/.aidevops/.agent-workspace/work/context" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - # ============================================================================= # Helper Functions # ============================================================================= -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - print_header() { echo -e "${CYAN}========================================${NC}" echo -e "${CYAN} Context Builder - Token-Efficient AI Context${NC}" diff --git a/.agents/scripts/coolify-cli-helper.sh b/.agents/scripts/coolify-cli-helper.sh index 6d287ac3..1ded3a6b 100755 --- a/.agents/scripts/coolify-cli-helper.sh +++ b/.agents/scripts/coolify-cli-helper.sh @@ -13,21 +13,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/coolify-cli-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" readonly ERROR_COOLIFY_NOT_INSTALLED="Coolify CLI is required but not installed" @@ -46,30 +40,6 @@ readonly SUCCESS_CONTEXT_ADDED="Context added successfully" # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - # ------------------------------------------------------------------------------ # DEPENDENCY CHECKS # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/coolify-helper.sh b/.agents/scripts/coolify-helper.sh index fa06a489..15eb4d07 100755 --- a/.agents/scripts/coolify-helper.sh +++ b/.agents/scripts/coolify-helper.sh @@ -4,46 +4,17 @@ # Coolify Helper Script # This script provides easy access to Coolify-hosted applications and services -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Error message constants # readonly USAGE_PREFIX="Usage:" # Currently unused -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Configuration file CONFIG_FILE="../configs/coolify-config.json" # Function to print colored output -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Check if config file exists check_config() { if [[ ! -f "$CONFIG_FILE" ]]; then diff --git a/.agents/scripts/coordinator-helper.sh b/.agents/scripts/coordinator-helper.sh index 102cf869..e5bfad18 100755 --- a/.agents/scripts/coordinator-helper.sh +++ b/.agents/scripts/coordinator-helper.sh @@ -23,6 +23,8 @@ set -euo pipefail # Configuration - resolve relative to this script's location SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly MAIL_HELPER="${SCRIPT_DIR}/mail-helper.sh" readonly MEMORY_HELPER="${SCRIPT_DIR}/memory-helper.sh" @@ -30,14 +32,6 @@ readonly MAIL_DIR="${AIDEVOPS_MAIL_DIR:-$HOME/.aidevops/.agent-workspace/mail}" readonly MAIL_DB="$MAIL_DIR/mailbox.db" readonly COORDINATOR_ID="coordinator" -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[0;33m' -readonly RED='\033[0;31m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - log_info() { echo -e "${BLUE}[COORD]${NC} $*"; } log_success() { echo -e "${GREEN}[COORD]${NC} $*"; } log_warn() { echo -e "${YELLOW}[COORD]${NC} $*"; } diff --git a/.agents/scripts/crawl4ai-examples.sh b/.agents/scripts/crawl4ai-examples.sh index abd158e9..4ec83235 100755 --- a/.agents/scripts/crawl4ai-examples.sh +++ b/.agents/scripts/crawl4ai-examples.sh @@ -23,46 +23,16 @@ # Version: 1.0.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color - # Constants readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly FRAMEWORK_ROOT="$SCRIPT_DIR/../.." readonly CRAWL4AI_HELPER="$FRAMEWORK_ROOT/.agents/scripts/crawl4ai-helper.sh" readonly OUTPUT_DIR="$HOME/.agents/tmp/crawl4ai-examples" readonly TEST_URL_HTML="https://httpbin.org/html" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🚀 $message${NC}" diff --git a/.agents/scripts/crawl4ai-helper.sh b/.agents/scripts/crawl4ai-helper.sh index 5be72931..f04b3072 100755 --- a/.agents/scripts/crawl4ai-helper.sh +++ b/.agents/scripts/crawl4ai-helper.sh @@ -29,21 +29,13 @@ # Version: 1.0.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Common constants -readonly CONTENT_TYPE_JSON=$CONTENT_TYPE_JSON # Constants SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly CONFIG_DIR="$SCRIPT_DIR/../configs" readonly DOCKER_IMAGE="unclecode/crawl4ai:latest" @@ -53,30 +45,6 @@ readonly MCP_PORT="3009" readonly HELP_SHOW_MESSAGE="Show this help message" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🚀 $message${NC}" diff --git a/.agents/scripts/credential-helper.sh b/.agents/scripts/credential-helper.sh index 71938344..8e2d383f 100755 --- a/.agents/scripts/credential-helper.sh +++ b/.agents/scripts/credential-helper.sh @@ -13,15 +13,12 @@ # Author: AI DevOps Framework # Version: 1.1.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Paths readonly CONFIG_DIR="$HOME/.config/aidevops" @@ -32,31 +29,6 @@ readonly LEGACY_MCP_ENV_FILE="$CONFIG_DIR/mcp-env.sh" readonly PROJECT_TENANT_FILE=".aidevops-tenant" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" - -print_success() { - local msg="$1" - echo -e "${GREEN}[OK] $msg${NC}" - return 0 -} - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO] $msg${NC}" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN] $msg${NC}" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR] $msg${NC}" >&2 - return 0 -} # Validate tenant name (alphanumeric, hyphens, underscores) validate_tenant_name() { diff --git a/.agents/scripts/crewai-helper.sh b/.agents/scripts/crewai-helper.sh index 62918796..2ee91363 100755 --- a/.agents/scripts/crewai-helper.sh +++ b/.agents/scripts/crewai-helper.sh @@ -18,14 +18,10 @@ # help Show this help message # ============================================================================= -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Configuration CREWAI_DIR="$HOME/.aidevops/crewai" @@ -34,22 +30,6 @@ SCRIPTS_DIR="$HOME/.aidevops/scripts" LOCALHOST_HELPER="$SCRIPTS_DIR/localhost-helper.sh" # Helper functions -print_info() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - # Port management integration with localhost-helper.sh # Returns available port (original if free, or next available) get_available_port() { diff --git a/.agents/scripts/cron-helper.sh b/.agents/scripts/cron-helper.sh index 41605f67..d45b5ed5 100755 --- a/.agents/scripts/cron-helper.sh +++ b/.agents/scripts/cron-helper.sh @@ -20,6 +20,9 @@ # - Supports basic auth via OPENCODE_SERVER_PASSWORD # - SSL verification enabled by default (disable with OPENCODE_INSECURE=1) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -31,18 +34,10 @@ readonly SCRIPTS_DIR="$HOME/.aidevops/agents/scripts" readonly OPENCODE_PORT="${OPENCODE_PORT:-4096}" readonly OPENCODE_HOST="${OPENCODE_HOST:-127.0.0.1}" readonly OPENCODE_INSECURE="${OPENCODE_INSECURE:-}" -readonly DEFAULT_TIMEOUT=600 readonly DEFAULT_MODEL="anthropic/claude-sonnet-4-20250514" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' # shellcheck disable=SC2034 # CYAN reserved for future use -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' ####################################### # Logging diff --git a/.agents/scripts/dev-browser-helper.sh b/.agents/scripts/dev-browser-helper.sh index 02a91b73..427e5a2b 100755 --- a/.agents/scripts/dev-browser-helper.sh +++ b/.agents/scripts/dev-browser-helper.sh @@ -13,38 +13,7 @@ if [[ -f "${SCRIPT_DIR}/shared-constants.sh" ]]; then source "${SCRIPT_DIR}/shared-constants.sh" fi -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Dev-browser specific constants readonly DEV_BROWSER_DIR="${HOME}/.aidevops/dev-browser" readonly DEV_BROWSER_SKILL_DIR="${DEV_BROWSER_DIR}/skills/dev-browser" diff --git a/.agents/scripts/dns-helper.sh b/.agents/scripts/dns-helper.sh index d92a3dab..e057c99b 100755 --- a/.agents/scripts/dns-helper.sh +++ b/.agents/scripts/dns-helper.sh @@ -8,13 +8,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [command] [options]" @@ -23,30 +16,6 @@ readonly HELP_USAGE_INFO="Use '$0 help' for usage information" # Common constants readonly AUTH_BEARER_PREFIX="Authorization: Bearer" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Configuration directory CONFIG_DIR="../configs" diff --git a/.agents/scripts/domain-research-helper.sh b/.agents/scripts/domain-research-helper.sh index c07175c6..efc787d2 100755 --- a/.agents/scripts/domain-research-helper.sh +++ b/.agents/scripts/domain-research-helper.sh @@ -9,14 +9,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - # THC API Configuration readonly THC_API_BASE="https://ip.thc.org" readonly THC_API_V1="${THC_API_BASE}/api/v1" @@ -59,30 +51,6 @@ readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [command] [options]" readonly HELP_USAGE_INFO="Use '$0 help' for usage information" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - print_header() { local msg="$1" echo -e "${CYAN}=== $msg ===${NC}" diff --git a/.agents/scripts/dspy-helper.sh b/.agents/scripts/dspy-helper.sh index 1b4e011e..f13433fe 100755 --- a/.agents/scripts/dspy-helper.sh +++ b/.agents/scripts/dspy-helper.sh @@ -13,11 +13,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/shared-constants.sh" # Use shared print functions with fallback for compatibility -print_info() { print_shared_info "$command"; return 0; } -print_success() { print_shared_success "$command"; return 0; } -print_warning() { print_shared_warning "$command"; return 0; } -print_error() { print_shared_error "$command"; return 0; } - # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" diff --git a/.agents/scripts/dspyground-helper.sh b/.agents/scripts/dspyground-helper.sh index 7296f1d0..1b8f0071 100755 --- a/.agents/scripts/dspyground-helper.sh +++ b/.agents/scripts/dspyground-helper.sh @@ -13,11 +13,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/shared-constants.sh" # Use shared print functions with fallback for compatibility -print_info() { local msg="$1"; print_shared_info "$msg"; return 0; } -print_success() { local msg="$1"; print_shared_success "$msg"; return 0; } -print_warning() { local msg="$1"; print_shared_warning "$msg"; return 0; } -print_error() { local msg="$1"; print_shared_error "$msg"; return 0; } - # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" diff --git a/.agents/scripts/eeat-score-helper.sh b/.agents/scripts/eeat-score-helper.sh index e8766dcf..9b3caa4f 100755 --- a/.agents/scripts/eeat-score-helper.sh +++ b/.agents/scripts/eeat-score-helper.sh @@ -19,16 +19,10 @@ set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' - # Constants SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly CONFIG_DIR="${HOME}/.config/aidevops" readonly CONFIG_FILE="${CONFIG_DIR}/eeat-score.json" @@ -53,30 +47,6 @@ WEIGHT_SUBJECTIVE=0.15 WEIGHT_WRITING=0.10 # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}[OK] $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}[INFO] $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARN] $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}[ERROR] $message${NC}" - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}=== $message ===${NC}" diff --git a/.agents/scripts/email-health-check-helper.sh b/.agents/scripts/email-health-check-helper.sh index ffc28bd3..0349cbc6 100755 --- a/.agents/scripts/email-health-check-helper.sh +++ b/.agents/scripts/email-health-check-helper.sh @@ -12,13 +12,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit # shellcheck source=/dev/null source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [command] [domain] [options]" @@ -27,30 +20,6 @@ readonly HELP_USAGE_INFO="Use '$0 help' for usage information" # Common DKIM selectors by provider readonly DKIM_SELECTORS="google google1 google2 selector1 selector2 k1 k2 s1 s2 pm smtp zoho default dkim" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[OK]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[FAIL]${NC} $msg" >&2 - return 0 -} - print_header() { local msg="$1" echo "" diff --git a/.agents/scripts/extract-opencode-prompts.sh b/.agents/scripts/extract-opencode-prompts.sh index c1ed064c..e98b3a62 100755 --- a/.agents/scripts/extract-opencode-prompts.sh +++ b/.agents/scripts/extract-opencode-prompts.sh @@ -9,15 +9,12 @@ # Output: ~/.aidevops/cache/opencode-prompts/ # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' # shellcheck disable=SC2034 # RED reserved for future error messages -RED='\033[0;31m' -NC='\033[0m' CACHE_DIR="$HOME/.aidevops/cache/opencode-prompts" OPENCODE_BIN="" diff --git a/.agents/scripts/find-missing-returns.sh b/.agents/scripts/find-missing-returns.sh index 8445c910..7033ade1 100755 --- a/.agents/scripts/find-missing-returns.sh +++ b/.agents/scripts/find-missing-returns.sh @@ -7,22 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly BLUE='\033[0;34m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} - -print_error() { - local _arg1="$1" - echo -e "${RED}❌ $_arg1${NC}" - return 0 -} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Find functions missing return statements in a file find_missing_returns_in_file() { diff --git a/.agents/scripts/full-loop-helper.sh b/.agents/scripts/full-loop-helper.sh index e6218e5c..e254e4c5 100755 --- a/.agents/scripts/full-loop-helper.sh +++ b/.agents/scripts/full-loop-helper.sh @@ -39,6 +39,8 @@ set -euo pipefail # ============================================================================= SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly STATE_DIR=".agents/loop-state" readonly STATE_FILE="${STATE_DIR}/full-loop.local.state" @@ -63,43 +65,12 @@ readonly PHASE_POSTFLIGHT="postflight" readonly PHASE_DEPLOY="deploy" readonly PHASE_COMPLETE="complete" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # ============================================================================= # Helper Functions # ============================================================================= -print_error() { - local message="$1" - echo -e "${RED}[full-loop] Error:${NC} ${message}" >&2 - return 0 -} - -print_success() { - local message="$1" - echo -e "${GREEN}[full-loop]${NC} ${message}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[full-loop]${NC} ${message}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}[full-loop]${NC} ${message}" - return 0 -} - print_phase() { local phase="$1" local description="$2" diff --git a/.agents/scripts/generate-opencode-agents.sh b/.agents/scripts/generate-opencode-agents.sh index 2f8d91fb..0c8fb59c 100755 --- a/.agents/scripts/generate-opencode-agents.sh +++ b/.agents/scripts/generate-opencode-agents.sh @@ -17,6 +17,9 @@ # - Default: full build permissions with common context tools # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail AGENTS_DIR="$HOME/.aidevops/agents" @@ -24,12 +27,6 @@ OPENCODE_CONFIG_DIR="$HOME/.config/opencode" OPENCODE_AGENT_DIR="$OPENCODE_CONFIG_DIR/agent" OPENCODE_CONFIG="$OPENCODE_CONFIG_DIR/opencode.json" -# Colors -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -NC='\033[0m' - echo -e "${BLUE}Generating OpenCode agent configuration...${NC}" # Ensure directories exist diff --git a/.agents/scripts/generate-opencode-commands.sh b/.agents/scripts/generate-opencode-commands.sh index cd1580c9..284cb410 100755 --- a/.agents/scripts/generate-opencode-commands.sh +++ b/.agents/scripts/generate-opencode-commands.sh @@ -13,15 +13,13 @@ # - Other agents as needed # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail OPENCODE_COMMAND_DIR="$HOME/.config/opencode/command" -# Colors -GREEN='\033[0;32m' -BLUE='\033[0;34m' -NC='\033[0m' - echo -e "${BLUE}Generating OpenCode commands...${NC}" # Ensure command directory exists diff --git a/.agents/scripts/generate-skills.sh b/.agents/scripts/generate-skills.sh index d8cfb0af..1ba4b0c4 100755 --- a/.agents/scripts/generate-skills.sh +++ b/.agents/scripts/generate-skills.sh @@ -22,6 +22,9 @@ # --clean Remove all generated SKILL.md files # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -29,13 +32,6 @@ AGENTS_DIR="${AIDEVOPS_AGENTS_DIR:-$HOME/.aidevops/agents}" DRY_RUN=false CLEAN=false -# Colors -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' - # Parse arguments while [[ $# -gt 0 ]]; do case $1 in diff --git a/.agents/scripts/git-platforms-helper.sh b/.agents/scripts/git-platforms-helper.sh index 22cfa78c..e0071f19 100755 --- a/.agents/scripts/git-platforms-helper.sh +++ b/.agents/scripts/git-platforms-helper.sh @@ -4,75 +4,24 @@ # Git Platforms Helper Script # Enhanced Git platform management with AI assistants (GitHub, GitLab, Gitea, Local Git) -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # HTTP Constants -readonly AUTH_HEADER_PREFIX="Authorization: Bearer" # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" # Common constants -readonly CONTENT_TYPE_JSON=$CONTENT_TYPE_JSON -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -# Colors for output - -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # HTTP Constants -readonly AUTH_HEADER_PREFIX="Authorization: Bearer" # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" # Common constants -readonly CONTENT_TYPE_JSON=$CONTENT_TYPE_JSON - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} CONFIG_FILE="../configs/git-platforms-config.json" diff --git a/.agents/scripts/gitea-cli-helper.sh b/.agents/scripts/gitea-cli-helper.sh index b6f00942..78a1ee39 100755 --- a/.agents/scripts/gitea-cli-helper.sh +++ b/.agents/scripts/gitea-cli-helper.sh @@ -13,21 +13,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/gitea-cli-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" readonly ERROR_TEA_NOT_INSTALLED="Gitea CLI (tea) is required but not installed" @@ -35,7 +29,6 @@ readonly ERROR_NOT_LOGGED_IN="Gitea CLI is not authenticated. Run 'tea login'" readonly ERROR_ACCOUNT_MISSING="Account configuration not found" readonly ERROR_ARGS_MISSING="Missing required arguments" readonly ERROR_API_FAILED="Gitea API request failed" -readonly ERROR_REPO_NAME_REQUIRED="Repository name is required" readonly ERROR_ISSUE_TITLE_REQUIRED="Issue title is required" readonly ERROR_ISSUE_NUMBER_REQUIRED="Issue number is required" readonly ERROR_PR_NUMBER_REQUIRED="Pull request number is required" @@ -45,7 +38,6 @@ readonly ERROR_OWNER_NOT_CONFIGURED="Owner not configured for account" readonly ERROR_FAILED_TO_READ_CONFIG="Failed to read configuration" # Success Messages -readonly SUCCESS_REPO_CREATED="Repository created successfully" readonly SUCCESS_ISSUE_CREATED="Issue created successfully" readonly SUCCESS_PR_CREATED="Pull request created successfully" readonly SUCCESS_BRANCH_CREATED="Branch created successfully" @@ -53,37 +45,12 @@ readonly SUCCESS_ISSUE_CLOSED="Issue closed successfully" readonly SUCCESS_PR_MERGED="Pull request merged successfully" # Common constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" readonly AUTH_HEADER_TOKEN="Authorization: token" # ------------------------------------------------------------------------------ # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # ------------------------------------------------------------------------------ # DEPENDENCY CHECKING # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/github-cli-helper.sh b/.agents/scripts/github-cli-helper.sh index ac4c58bf..71e1f3fc 100755 --- a/.agents/scripts/github-cli-helper.sh +++ b/.agents/scripts/github-cli-helper.sh @@ -13,21 +13,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/github-cli-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" readonly ERROR_GH_NOT_INSTALLED="GitHub CLI (gh) is required but not installed" @@ -36,7 +30,6 @@ readonly ERROR_ACCOUNT_MISSING="Account configuration not found" readonly ERROR_ARGS_MISSING="Missing required arguments" readonly ERROR_API_FAILED="GitHub API request failed" -readonly ERROR_REPO_NAME_REQUIRED="Repository name is required" readonly ERROR_ISSUE_TITLE_REQUIRED="Issue title is required" readonly ERROR_ISSUE_NUMBER_REQUIRED="Issue number is required" readonly ERROR_PR_TITLE_REQUIRED="Pull request title is required" @@ -46,7 +39,6 @@ readonly ERROR_OWNER_NOT_CONFIGURED="Owner not configured for account" readonly ERROR_FAILED_TO_READ_CONFIG="Failed to read configuration" # Success Messages -readonly SUCCESS_REPO_CREATED="Repository created successfully" readonly SUCCESS_ISSUE_CREATED="Issue created successfully" readonly SUCCESS_PR_CREATED="Pull request created successfully" readonly SUCCESS_BRANCH_CREATED="Branch created successfully" @@ -54,37 +46,12 @@ readonly SUCCESS_ISSUE_CLOSED="Issue closed successfully" readonly SUCCESS_PR_MERGED="Pull request merged successfully" # Common constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" readonly AUTH_HEADER_TOKEN="Authorization: token" # ------------------------------------------------------------------------------ # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # ------------------------------------------------------------------------------ # DEPENDENCY CHECKING # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/gitlab-cli-helper.sh b/.agents/scripts/gitlab-cli-helper.sh index b2fef740..47b496e0 100755 --- a/.agents/scripts/gitlab-cli-helper.sh +++ b/.agents/scripts/gitlab-cli-helper.sh @@ -13,21 +13,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/gitlab-cli-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" readonly ERROR_GLAB_NOT_INSTALLED="GitLab CLI (glab) is required but not installed" @@ -36,7 +30,6 @@ readonly ERROR_ACCOUNT_MISSING="Account configuration not found" readonly ERROR_ARGS_MISSING="Missing required arguments" readonly ERROR_API_FAILED="GitLab API request failed" -readonly ERROR_PROJECT_NOT_FOUND="Project not found" readonly ERROR_INSTANCE_URL_NOT_CONFIGURED="Instance URL not configured for account" readonly ERROR_FAILED_TO_READ_CONFIG="Failed to read configuration" readonly ERROR_PROJECT_NAME_REQUIRED="Project name is required" @@ -55,37 +48,12 @@ readonly SUCCESS_ISSUE_CLOSED="Issue closed successfully" readonly SUCCESS_MR_MERGED="Merge request merged successfully" # Common constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" readonly AUTH_HEADER_TOKEN="Authorization: token" # ------------------------------------------------------------------------------ # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # ------------------------------------------------------------------------------ # DEPENDENCY CHECKING # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/gsc-add-user-helper.sh b/.agents/scripts/gsc-add-user-helper.sh index 79aa67b7..23168649 100755 --- a/.agents/scripts/gsc-add-user-helper.sh +++ b/.agents/scripts/gsc-add-user-helper.sh @@ -3,18 +3,14 @@ # Google Search Console - Add Service Account to All Properties # Uses Playwright to automate adding a service account to all GSC properties +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail WORK_DIR="${HOME}/.aidevops/.agent-workspace/tmp" GSC_SCRIPT="${WORK_DIR}/gsc-add-user.js" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - log_info() { echo -e "${BLUE}[INFO]${NC} $1"; return 0; } log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; return 0; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; return 0; } diff --git a/.agents/scripts/hetzner-helper.sh b/.agents/scripts/hetzner-helper.sh index f23e93e7..47425aba 100755 --- a/.agents/scripts/hetzner-helper.sh +++ b/.agents/scripts/hetzner-helper.sh @@ -4,18 +4,13 @@ # Hetzner Helper Script # Manages Hetzner Cloud VPS servers across multiple projects -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_SERVER_NAME_REQUIRED="Server name is required" readonly ERROR_INVALID_JSON="Invalid JSON in configuration file" -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" @@ -24,33 +19,8 @@ readonly HELP_USAGE_INFO="Use '$0 help' for usage information" # Common constants readonly AUTH_BEARER_PREFIX="Authorization: Bearer" -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" readonly HETZNER_API_SERVERS="https://api.hetzner.cloud/v1/servers" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Configuration file CONFIG_FILE="../configs/hetzner-config.json" diff --git a/.agents/scripts/hostinger-helper.sh b/.agents/scripts/hostinger-helper.sh index 8ca235dd..26dfcb25 100755 --- a/.agents/scripts/hostinger-helper.sh +++ b/.agents/scripts/hostinger-helper.sh @@ -8,44 +8,11 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - # HTTP Constants -readonly AUTH_HEADER_PREFIX="Authorization: Bearer" # Error message constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" readonly HELP_SHOW_MESSAGE="Show this help" readonly HELP_USAGE_INFO="Use '$0 help' for usage information" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Configuration file CONFIG_FILE="../configs/hostinger-config.json" diff --git a/.agents/scripts/humanise-update-helper.sh b/.agents/scripts/humanise-update-helper.sh index b726fc9f..5990abc2 100755 --- a/.agents/scripts/humanise-update-helper.sh +++ b/.agents/scripts/humanise-update-helper.sh @@ -17,6 +17,8 @@ readonly UPSTREAM_REPO="blader/humanizer" readonly UPSTREAM_RAW="https://raw.githubusercontent.com/${UPSTREAM_REPO}/main/SKILL.md" readonly LOCAL_SUBAGENT="${HOME}/.aidevops/agents/content/humanise.md" SCRIPT_DIR="$(dirname "$0")" +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly SOURCE_SUBAGENT="${SCRIPT_DIR}/../content/humanise.md" readonly CACHE_DIR="${HOME}/.aidevops/.agent-workspace/cache" @@ -24,14 +26,7 @@ readonly CACHE_FILE="${CACHE_DIR}/humanizer-upstream.md" readonly CACHE_VERSION_FILE="${CACHE_DIR}/humanizer-version.txt" readonly CACHE_TTL=86400 # 24 hours in seconds -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # Get local version from subagent frontmatter get_local_version() { diff --git a/.agents/scripts/keyword-research-helper.sh b/.agents/scripts/keyword-research-helper.sh index 32084a22..850cc710 100755 --- a/.agents/scripts/keyword-research-helper.sh +++ b/.agents/scripts/keyword-research-helper.sh @@ -67,25 +67,11 @@ readonly THRESHOLD_HIGH_SPAM=50 readonly THRESHOLD_OLD_CONTENT_YEARS=2 readonly THRESHOLD_UGC_HEAVY=3 -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly PURPLE='\033[0;35m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - # ============================================================================= # Utility Functions # ============================================================================= print_header() { local msg="$1"; echo -e "${PURPLE}═══ $msg ═══${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # Ensure directories exist ensure_directories() { mkdir -p "$CONFIG_DIR" diff --git a/.agents/scripts/langflow-helper.sh b/.agents/scripts/langflow-helper.sh index d58cb0fa..b509ca58 100755 --- a/.agents/scripts/langflow-helper.sh +++ b/.agents/scripts/langflow-helper.sh @@ -18,14 +18,10 @@ # help Show this help message # ============================================================================= -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Configuration LANGFLOW_DIR="$HOME/.aidevops/langflow" @@ -35,22 +31,6 @@ FLOWS_DIR="$LANGFLOW_DIR/flows" LOCALHOST_HELPER="$SCRIPTS_DIR/localhost-helper.sh" # Helper functions -print_info() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - # Port management integration with localhost-helper.sh # Returns available port (original if free, or next available) get_available_port() { diff --git a/.agents/scripts/linter-manager.sh b/.agents/scripts/linter-manager.sh index 1395056a..4b63840c 100755 --- a/.agents/scripts/linter-manager.sh +++ b/.agents/scripts/linter-manager.sh @@ -8,40 +8,10 @@ # Version: 1.1.1 # Reference: https://docs.codefactor.io/bootcamp/analysis-tools/ -# Colors for output -readonly GREEN='\033[0;32m' -readonly RED='\033[0;31m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔧 $message${NC}" diff --git a/.agents/scripts/linters-local.sh b/.agents/scripts/linters-local.sh index d7252a9b..bf962c70 100755 --- a/.agents/scripts/linters-local.sh +++ b/.agents/scripts/linters-local.sh @@ -16,14 +16,12 @@ # /code-audit-remote or code-audit-helper.sh # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Color codes for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' # No Color # Quality thresholds # Note: These thresholds are set to allow existing code patterns while catching regressions @@ -43,30 +41,6 @@ print_header() { return 0 } -print_success() { - local message="$1" - echo -e "${GREEN}[PASS] $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARN] $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}[FAIL] $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}[INFO] $message${NC}" - return 0 -} - check_sonarcloud_status() { echo -e "${BLUE}Checking SonarCloud Status (remote API)...${NC}" diff --git a/.agents/scripts/list-keys-helper.sh b/.agents/scripts/list-keys-helper.sh index e04d1438..b2437329 100755 --- a/.agents/scripts/list-keys-helper.sh +++ b/.agents/scripts/list-keys-helper.sh @@ -7,15 +7,12 @@ # Author: AI DevOps Framework # Version: 1.0.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Key storage locations readonly CREDENTIALS_FILE="$HOME/.config/aidevops/credentials.sh" diff --git a/.agents/scripts/list-todo-helper.sh b/.agents/scripts/list-todo-helper.sh index 58ccdb74..471c800b 100755 --- a/.agents/scripts/list-todo-helper.sh +++ b/.agents/scripts/list-todo-helper.sh @@ -29,13 +29,14 @@ # --json Output as JSON # --no-color Disable colors +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Colors (reserved for future terminal output enhancement) # shellcheck disable=SC2034 -RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' # shellcheck disable=SC2034 -BLUE='\033[0;34m' CYAN='\033[0;36m' BOLD='\033[1m' DIM='\033[2m' NC='\033[0m' # Defaults SORT_BY="status" diff --git a/.agents/scripts/localhost-helper.sh b/.agents/scripts/localhost-helper.sh index ddad2465..516f2617 100755 --- a/.agents/scripts/localhost-helper.sh +++ b/.agents/scripts/localhost-helper.sh @@ -8,13 +8,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - # Error message constants (use shared-constants.sh if available, otherwise define locally) if [[ -z "${ERROR_UNKNOWN_COMMAND:-}" ]]; then readonly ERROR_UNKNOWN_COMMAND="Unknown command:" @@ -23,30 +16,6 @@ if [[ -z "${HELP_USAGE_INFO:-}" ]]; then readonly HELP_USAGE_INFO="Use '$0 help' for usage information" fi -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Configuration file CONFIG_FILE="../configs/localhost-config.json" diff --git a/.agents/scripts/mail-helper.sh b/.agents/scripts/mail-helper.sh index 91befd4e..4be51779 100755 --- a/.agents/scripts/mail-helper.sh +++ b/.agents/scripts/mail-helper.sh @@ -27,6 +27,9 @@ # Previous TOON file-based system: ~25ms per message (2.5s for 100 messages). # SQLite: <1ms per query regardless of message count. +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -35,14 +38,6 @@ readonly MAIL_DB="$MAIL_DIR/mailbox.db" readonly DEFAULT_PRUNE_DAYS=7 readonly MEMORY_HELPER="$HOME/.aidevops/agents/scripts/memory-helper.sh" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - ####################################### # Logging ####################################### diff --git a/.agents/scripts/mainwp-helper.sh b/.agents/scripts/mainwp-helper.sh index 22b714a8..f0378670 100755 --- a/.agents/scripts/mainwp-helper.sh +++ b/.agents/scripts/mainwp-helper.sh @@ -5,17 +5,12 @@ # Comprehensive WordPress site management for AI assistants # Uses MainWP REST API v1 with query parameter authentication -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color +set -euo pipefail # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_JQ_REQUIRED="jq is required but not installed" readonly INFO_JQ_INSTALL_MACOS="Install with: brew install jq" readonly INFO_JQ_INSTALL_UBUNTU="Install with: apt-get install jq" @@ -28,30 +23,6 @@ readonly HELP_SHOW_MESSAGE="Show this help" CONFIG_FILE="${HOME}/.config/aidevops/mainwp-config.json" TEMPLATE_FILE="${HOME}/.aidevops/agents/configs/mainwp-config.json.txt" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Check dependencies check_dependencies() { if ! command -v curl &> /dev/null; then diff --git a/.agents/scripts/markdown-formatter.sh b/.agents/scripts/markdown-formatter.sh index c0eeeaaf..01f4c8d4 100755 --- a/.agents/scripts/markdown-formatter.sh +++ b/.agents/scripts/markdown-formatter.sh @@ -20,41 +20,11 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}📝 $message${NC}" diff --git a/.agents/scripts/markdown-lint-fix.sh b/.agents/scripts/markdown-lint-fix.sh index a8a2dc14..8b1f51ab 100755 --- a/.agents/scripts/markdown-lint-fix.sh +++ b/.agents/scripts/markdown-lint-fix.sh @@ -10,41 +10,11 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}📝 $message${NC}" diff --git a/.agents/scripts/matrix-dispatch-helper.sh b/.agents/scripts/matrix-dispatch-helper.sh index 8fd1c4a5..70a2a74d 100755 --- a/.agents/scripts/matrix-dispatch-helper.sh +++ b/.agents/scripts/matrix-dispatch-helper.sh @@ -32,6 +32,9 @@ # - Room-to-runner mapping prevents unauthorized dispatch # - Only responds to messages from allowed users (configurable) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -45,13 +48,7 @@ readonly RUNNER_HELPER="$HOME/.aidevops/agents/scripts/runner-helper.sh" readonly OPENCODE_PORT="${OPENCODE_PORT:-4096}" readonly OPENCODE_HOST="${OPENCODE_HOST:-127.0.0.1}" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' readonly BOLD='\033[1m' -readonly NC='\033[0m' ####################################### # Logging diff --git a/.agents/scripts/mcp-diagnose.sh b/.agents/scripts/mcp-diagnose.sh index f28eff32..15ba7d01 100755 --- a/.agents/scripts/mcp-diagnose.sh +++ b/.agents/scripts/mcp-diagnose.sh @@ -8,14 +8,10 @@ # - Configuration errors # - Known breaking changes -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' +set -euo pipefail MCP_NAME="${1:-}" diff --git a/.agents/scripts/mcp-index-helper.sh b/.agents/scripts/mcp-index-helper.sh index 9f601024..042439b1 100755 --- a/.agents/scripts/mcp-index-helper.sh +++ b/.agents/scripts/mcp-index-helper.sh @@ -19,6 +19,9 @@ # - Supports lazy-loading pattern: search → find MCP → enable MCP → use tool # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -28,14 +31,6 @@ readonly OPENCODE_CONFIG="$HOME/.config/opencode/opencode.json" # shellcheck disable=SC2034 # Used for future cache invalidation readonly CACHE_TTL_HOURS=24 -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[OK]${NC} $*"; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } diff --git a/.agents/scripts/mcp-inspector-helper.sh b/.agents/scripts/mcp-inspector-helper.sh index b29929ce..ce686c36 100755 --- a/.agents/scripts/mcp-inspector-helper.sh +++ b/.agents/scripts/mcp-inspector-helper.sh @@ -16,43 +16,13 @@ set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - # Script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly CONFIG_FILE="${SCRIPT_DIR}/../../.opencode/server/mcp-test-config.json" -print_info() { - local msg="$1" - echo -e "${BLUE}ℹ️ ${msg}${NC}" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}✅ ${msg}${NC}" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}⚠️ ${msg}${NC}" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}❌ ${msg}${NC}" - return 0 -} - print_header() { echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" return 0 diff --git a/.agents/scripts/memory-embeddings-helper.sh b/.agents/scripts/memory-embeddings-helper.sh index 34d5b934..f9a048c0 100755 --- a/.agents/scripts/memory-embeddings-helper.sh +++ b/.agents/scripts/memory-embeddings-helper.sh @@ -15,6 +15,9 @@ # memory-embeddings-helper.sh rebuild # Rebuild entire index # memory-embeddings-helper.sh help # Show this help +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -29,13 +32,6 @@ MEMORY_DB="$MEMORY_DIR/memory.db" EMBEDDINGS_DB="$MEMORY_DIR/embeddings.db" PYTHON_SCRIPT="$MEMORY_DIR/.embeddings-engine.py" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[OK]${NC} $*"; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } diff --git a/.agents/scripts/memory-helper.sh b/.agents/scripts/memory-helper.sh index 08e345af..aa598c99 100755 --- a/.agents/scripts/memory-helper.sh +++ b/.agents/scripts/memory-helper.sh @@ -38,6 +38,9 @@ # - Prune removes entries older than threshold AND never accessed # - Validate warns about potentially stale entries +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -60,13 +63,6 @@ readonly VALID_TYPES="WORKING_SOLUTION FAILED_APPROACH CODEBASE_PATTERN USER_PRE # - derives: Second-order inference from combining memories readonly VALID_RELATIONS="updates extends derives" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' # No Color - ####################################### # Print colored message ####################################### diff --git a/.agents/scripts/monitor-code-review.sh b/.agents/scripts/monitor-code-review.sh index 7d5a2a42..b67759f9 100755 --- a/.agents/scripts/monitor-code-review.sh +++ b/.agents/scripts/monitor-code-review.sh @@ -7,18 +7,9 @@ # Author: AI DevOps Framework # Version: 1.1.0 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + print_header() { local msg="$1"; echo -e "${PURPLE}[MONITOR]${NC} $msg"; return 0; } # Configuration diff --git a/.agents/scripts/onboarding-helper.sh b/.agents/scripts/onboarding-helper.sh index c67fd2a6..0cdaae25 100755 --- a/.agents/scripts/onboarding-helper.sh +++ b/.agents/scripts/onboarding-helper.sh @@ -19,16 +19,12 @@ # Author: AI DevOps Framework # Version: 1.0.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Credential file locations readonly CREDENTIALS_FILE="$HOME/.config/aidevops/credentials.sh" diff --git a/.agents/scripts/opencode-github-setup-helper.sh b/.agents/scripts/opencode-github-setup-helper.sh index a3859dbb..8a293ebe 100755 --- a/.agents/scripts/opencode-github-setup-helper.sh +++ b/.agents/scripts/opencode-github-setup-helper.sh @@ -34,17 +34,15 @@ # VERSION: 1.0.0 # LICENSE: MIT +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # ------------------------------------------------------------------------------ # CONFIGURATION & CONSTANTS # ------------------------------------------------------------------------------ -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' readonly GITHUB_APP_URL="https://github.com/apps/opencode-agent" readonly OPENCODE_GITHUB_DOCS="https://opencode.ai/docs/github/" @@ -58,42 +56,18 @@ readonly OPENCODE_GITLAB_DOCS="https://opencode.ai/docs/gitlab/" # Arguments: # $1 - Message to print # Returns: 0 -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - # Print a success message in green # Arguments: # $1 - Message to print # Returns: 0 -print_success() { - local msg="$1" - echo -e "${GREEN}[OK]${NC} $msg" - return 0 -} - # Print a warning message in yellow # Arguments: # $1 - Message to print # Returns: 0 -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN]${NC} $msg" - return 0 -} - # Print an error/missing message in red # Arguments: # $1 - Message to print # Returns: 0 -print_error() { - local msg="$1" - echo -e "${RED}[MISSING]${NC} $msg" - return 0 -} - # ------------------------------------------------------------------------------ # DETECTION FUNCTIONS # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/opencode-test-helper.sh b/.agents/scripts/opencode-test-helper.sh index eee1e6ec..225d5b71 100755 --- a/.agents/scripts/opencode-test-helper.sh +++ b/.agents/scripts/opencode-test-helper.sh @@ -15,19 +15,10 @@ # opencode-test-helper.sh run [--agent ] # ============================================================================= -set -euo pipefail - -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -print_info() { echo -e "${BLUE}[INFO]${NC} $1"; return 0; } -print_success() { echo -e "${GREEN}[OK]${NC} $1"; return 0; } -print_warning() { echo -e "${YELLOW}[WARN]${NC} $1"; return 0; } -print_error() { echo -e "${RED}[ERROR]${NC} $1"; return 0; } +set -euo pipefail show_help() { cat << 'EOF' diff --git a/.agents/scripts/pagespeed-helper.sh b/.agents/scripts/pagespeed-helper.sh index 5bb997b9..433e5613 100755 --- a/.agents/scripts/pagespeed-helper.sh +++ b/.agents/scripts/pagespeed-helper.sh @@ -4,22 +4,12 @@ # 🚀 PageSpeed Insights & Lighthouse Helper Script # Comprehensive website performance auditing and optimization guidance -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly PURPLE='\033[0;35m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' +set -euo pipefail print_header() { local msg="$1"; echo -e "${PURPLE}$msg${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}$msg${NC}"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}$msg${NC}"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}$msg${NC}"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}$msg${NC}"; return 0; } print_metric() { local msg="$1"; echo -e "${CYAN}$msg${NC}"; return 0; } # Configuration diff --git a/.agents/scripts/pandoc-helper.sh b/.agents/scripts/pandoc-helper.sh index 06cf654e..08705c93 100755 --- a/.agents/scripts/pandoc-helper.sh +++ b/.agents/scripts/pandoc-helper.sh @@ -7,17 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.2 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Check if pandoc is installed check_pandoc() { diff --git a/.agents/scripts/pattern-tracker-helper.sh b/.agents/scripts/pattern-tracker-helper.sh index 5fccae55..d5c44105 100755 --- a/.agents/scripts/pattern-tracker-helper.sh +++ b/.agents/scripts/pattern-tracker-helper.sh @@ -16,17 +16,11 @@ set -euo pipefail # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly MEMORY_HELPER="$SCRIPT_DIR/memory-helper.sh" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[OK]${NC} $*"; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } diff --git a/.agents/scripts/pdf-helper.sh b/.agents/scripts/pdf-helper.sh index 60230081..4cff32c7 100755 --- a/.agents/scripts/pdf-helper.sh +++ b/.agents/scripts/pdf-helper.sh @@ -11,14 +11,10 @@ # install - Install @libpdf/core # help - Show this help -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Check if bun or node is available get_runtime() { diff --git a/.agents/scripts/peekaboo-helper.sh b/.agents/scripts/peekaboo-helper.sh index 9ba99b45..885ecd1b 100755 --- a/.agents/scripts/peekaboo-helper.sh +++ b/.agents/scripts/peekaboo-helper.sh @@ -11,38 +11,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Peekaboo-specific constants readonly PEEKABOO_CONFIG_DIR="${HOME}/.peekaboo" readonly PEEKABOO_SNAPSHOTS_DIR="${PEEKABOO_CONFIG_DIR}/snapshots" diff --git a/.agents/scripts/planning-commit-helper.sh b/.agents/scripts/planning-commit-helper.sh index e645d634..01830340 100755 --- a/.agents/scripts/planning-commit-helper.sh +++ b/.agents/scripts/planning-commit-helper.sh @@ -16,14 +16,10 @@ # 1 - Error (not in git repo, etc.) # ============================================================================= -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' +set -euo pipefail # Planning file patterns readonly PLANNING_PATTERNS="^TODO\.md$|^todo/" diff --git a/.agents/scripts/postflight-check.sh b/.agents/scripts/postflight-check.sh index 1ad2a17d..9971ead1 100755 --- a/.agents/scripts/postflight-check.sh +++ b/.agents/scripts/postflight-check.sh @@ -8,6 +8,9 @@ # Author: AI DevOps Framework # Version: 1.0.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -16,13 +19,6 @@ readonly TIMEOUT_TOOLS=300 # 5 minutes for code review tools readonly POLL_INTERVAL=30 # Check every 30 seconds readonly MAX_ATTEMPTS=20 # Maximum polling attempts -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - # Repository info readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" || exit readonly SONAR_PROJECT_KEY="marcusquinn_aidevops" @@ -44,27 +40,6 @@ print_header() { return 0 } -print_success() { - local message="$1" - echo -e "${GREEN}PASSED${NC} $message" - ((PASSED++)) - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}WARNING${NC} $message" - ((WARNINGS++)) - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}FAILED${NC} $message" - ((FAILED++)) - return 0 -} - print_skip() { local message="$1" echo -e "${BLUE}SKIPPED${NC} $message" @@ -72,12 +47,6 @@ print_skip() { return 0 } -print_info() { - local message="$1" - echo -e "${BLUE}INFO${NC} $message" - return 0 -} - print_section() { local title="$1" echo "" diff --git a/.agents/scripts/pre-commit-hook.sh b/.agents/scripts/pre-commit-hook.sh index 4811268e..dffbc847 100755 --- a/.agents/scripts/pre-commit-hook.sh +++ b/.agents/scripts/pre-commit-hook.sh @@ -3,38 +3,12 @@ # Pre-commit hook for multi-platform quality validation # Install with: cp .agents/scripts/pre-commit-hook.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Color codes for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' # No Color - -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} # Get list of modified shell files get_modified_shell_files() { diff --git a/.agents/scripts/pre-edit-check.sh b/.agents/scripts/pre-edit-check.sh index 6eeb1297..c9116cd4 100755 --- a/.agents/scripts/pre-edit-check.sh +++ b/.agents/scripts/pre-edit-check.sh @@ -78,12 +78,7 @@ is_docs_only() { return 1 } -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' BOLD='\033[1m' -NC='\033[0m' # Check if we're in a git repository if ! git rev-parse --is-inside-work-tree &>/dev/null; then @@ -164,6 +159,8 @@ else # Sync terminal tab title with repo/branch (silent, non-blocking) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + if [[ -x "$SCRIPT_DIR/terminal-title-helper.sh" ]]; then "$SCRIPT_DIR/terminal-title-helper.sh" sync 2>/dev/null || true fi diff --git a/.agents/scripts/qlty-cli.sh b/.agents/scripts/qlty-cli.sh index 7ac612d4..090dfda7 100755 --- a/.agents/scripts/qlty-cli.sh +++ b/.agents/scripts/qlty-cli.sh @@ -7,39 +7,10 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly RED='\033[0;31m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_error() { - local _arg1="$1" - echo -e "${RED}❌ $_arg1${NC}" >&2 - return 0 -} - -print_warning() { - local _arg1="$1" - echo -e "${YELLOW}⚠️ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} - print_header() { local _arg1="$1" echo -e "${BLUE}🚀 $_arg1${NC}" diff --git a/.agents/scripts/quality-cli-manager.sh b/.agents/scripts/quality-cli-manager.sh index 77d932c2..b9f146f3 100755 --- a/.agents/scripts/quality-cli-manager.sh +++ b/.agents/scripts/quality-cli-manager.sh @@ -23,16 +23,10 @@ # Version: 1.2.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # CLI Scripts readonly CODERABBIT_SCRIPT=".agents/scripts/coderabbit-cli.sh" readonly CODACY_SCRIPT=".agents/scripts/codacy-cli.sh" @@ -44,30 +38,6 @@ readonly CLI_CODERABBIT="coderabbit" readonly CLI_SNYK="snyk" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔧 $message${NC}" diff --git a/.agents/scripts/quality-feedback-helper.sh b/.agents/scripts/quality-feedback-helper.sh index c26fb8e9..0b3d5b13 100755 --- a/.agents/scripts/quality-feedback-helper.sh +++ b/.agents/scripts/quality-feedback-helper.sh @@ -21,17 +21,12 @@ # quality-feedback-helper.sh annotations --commit abc123 # quality-feedback-helper.sh watch --pr 4 -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' # No Color +set -euo pipefail # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Get repository info get_repo() { local repo diff --git a/.agents/scripts/quality-loop-helper.sh b/.agents/scripts/quality-loop-helper.sh index d0586605..6eb29090 100755 --- a/.agents/scripts/quality-loop-helper.sh +++ b/.agents/scripts/quality-loop-helper.sh @@ -30,6 +30,8 @@ set -euo pipefail # ============================================================================= SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly STATE_DIR=".agents/loop-state" readonly STATE_FILE="${STATE_DIR}/quality-loop.local.state" @@ -73,14 +75,6 @@ readonly BACKOFF_BASE=15 readonly BACKOFF_MAX=120 readonly BACKOFF_MULTIPLIER=2 -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - # ============================================================================= # Helper Functions # ============================================================================= @@ -88,39 +82,15 @@ readonly NC='\033[0m' # Print error message to stderr with prefix # Arguments: $1 - Error message # Returns: 0 -print_error() { - local message="$1" - echo -e "${RED}[quality-loop] Error:${NC} ${message}" >&2 - return 0 -} - # Print success message in green with prefix # Arguments: $1 - Success message # Returns: 0 -print_success() { - local message="$1" - echo -e "${GREEN}[quality-loop]${NC} ${message}" - return 0 -} - # Print warning message in yellow with prefix # Arguments: $1 - Warning message # Returns: 0 -print_warning() { - local message="$1" - echo -e "${YELLOW}[quality-loop]${NC} ${message}" - return 0 -} - # Print info message in blue with prefix # Arguments: $1 - Info message # Returns: 0 -print_info() { - local message="$1" - echo -e "${BLUE}[quality-loop]${NC} ${message}" - return 0 -} - # Print step message in cyan with prefix # Arguments: $1 - Step message # Returns: 0 @@ -431,7 +401,6 @@ run_preflight_checks() { fi - # Check 2: Secretlint (skip if not installed) print_info " Checking secrets..." if command -v secretlint &>/dev/null; then diff --git a/.agents/scripts/ralph-loop-helper.sh b/.agents/scripts/ralph-loop-helper.sh index 99a4923c..cf9b5e14 100755 --- a/.agents/scripts/ralph-loop-helper.sh +++ b/.agents/scripts/ralph-loop-helper.sh @@ -33,6 +33,8 @@ set -euo pipefail # ============================================================================= SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly SCRIPT_NAME="ralph-loop-helper.sh" @@ -61,13 +63,7 @@ readonly DEFAULT_MAX_ITERATIONS=50 readonly DEFAULT_MAX_ATTEMPTS=5 # Colors (fallback if loop-common.sh not loaded) -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # Output file for tool capture (shared with EXIT trap) output_file="" @@ -76,30 +72,6 @@ output_file="" # Helper Functions # ============================================================================= -print_error() { - local message="$1" - echo -e "${RED}[ralph] Error:${NC} ${message}" >&2 - return 0 -} - -print_success() { - local message="$1" - echo -e "${GREEN}[ralph]${NC} ${message}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[ralph]${NC} ${message}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}[ralph]${NC} ${message}" - return 0 -} - print_step() { local message="$1" echo -e "${CYAN}[ralph]${NC} ${message}" diff --git a/.agents/scripts/ralph-upstream-check.sh b/.agents/scripts/ralph-upstream-check.sh index eafbd40e..9b285b98 100755 --- a/.agents/scripts/ralph-upstream-check.sh +++ b/.agents/scripts/ralph-upstream-check.sh @@ -15,6 +15,9 @@ # Author: AI DevOps Framework # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # ============================================================================= @@ -28,12 +31,6 @@ readonly CACHE_DIR="$HOME/.cache/aidevops" readonly CACHE_FILE="${CACHE_DIR}/ralph-upstream-check.json" readonly CACHE_TTL=86400 # 24 hours in seconds -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' - # ============================================================================= # Helper Functions # ============================================================================= diff --git a/.agents/scripts/runner-helper.sh b/.agents/scripts/runner-helper.sh index fcaf552d..aad1f493 100755 --- a/.agents/scripts/runner-helper.sh +++ b/.agents/scripts/runner-helper.sh @@ -32,6 +32,9 @@ # - Supports basic auth via OPENCODE_SERVER_PASSWORD # - Runner AGENTS.md files are local-only (not committed to repos) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -41,15 +44,8 @@ readonly MAIL_HELPER="$HOME/.aidevops/agents/scripts/mail-helper.sh" readonly OPENCODE_PORT="${OPENCODE_PORT:-4096}" readonly OPENCODE_HOST="${OPENCODE_HOST:-127.0.0.1}" readonly DEFAULT_MODEL="anthropic/claude-sonnet-4-20250514" -readonly DEFAULT_TIMEOUT=600 -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' readonly BOLD='\033[1m' -readonly NC='\033[0m' ####################################### # Logging diff --git a/.agents/scripts/schema-validator-helper.sh b/.agents/scripts/schema-validator-helper.sh index 6386f796..08fea2dc 100755 --- a/.agents/scripts/schema-validator-helper.sh +++ b/.agents/scripts/schema-validator-helper.sh @@ -25,13 +25,6 @@ readonly SCRIPT_DIR # shellcheck source=/dev/null source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Constants readonly TOOL_DIR="$HOME/.aidevops/tools/schema-validator" readonly JS_SCRIPT="$TOOL_DIR/validate.mjs" @@ -40,30 +33,6 @@ readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [command] [target]" readonly HELP_USAGE_INFO="Use '$0 help' for usage information" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[OK]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[FAIL]${NC} $msg" >&2 - return 0 -} - # Check if a command exists command_exists() { local cmd="$1" diff --git a/.agents/scripts/secret-helper.sh b/.agents/scripts/secret-helper.sh index 99c07f42..f871bfa5 100755 --- a/.agents/scripts/secret-helper.sh +++ b/.agents/scripts/secret-helper.sh @@ -18,45 +18,18 @@ # Author: AI DevOps Framework # Version: 1.0.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Paths readonly CONFIG_DIR="$HOME/.config/aidevops" readonly CREDENTIALS_FILE="$CONFIG_DIR/credentials.sh" readonly GOPASS_PREFIX="aidevops" -print_success() { - local msg="$1" - echo -e "${GREEN}[OK] $msg${NC}" - return 0 -} - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO] $msg${NC}" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN] $msg${NC}" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR] $msg${NC}" >&2 - return 0 -} - # Check if gopass is available and initialized has_gopass() { if ! command -v gopass &>/dev/null; then diff --git a/.agents/scripts/secretlint-helper.sh b/.agents/scripts/secretlint-helper.sh index be917470..1e36f70a 100755 --- a/.agents/scripts/secretlint-helper.sh +++ b/.agents/scripts/secretlint-helper.sh @@ -22,46 +22,15 @@ # License: MIT # Reference: https://github.com/secretlint/secretlint -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" readonly SECRETLINT_CONFIG_FILE=".secretlintrc.json" readonly SECRETLINT_IGNORE_FILE=".secretlintignore" readonly DEFAULT_GLOB_PATTERN="**/*" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔐 $message${NC}" diff --git a/.agents/scripts/self-improve-helper.sh b/.agents/scripts/self-improve-helper.sh index dc2e6e1c..4e7ce1a1 100755 --- a/.agents/scripts/self-improve-helper.sh +++ b/.agents/scripts/self-improve-helper.sh @@ -24,6 +24,8 @@ set -euo pipefail # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly AIDEVOPS_DIR="${HOME}/.aidevops" readonly WORKSPACE_DIR="${AIDEVOPS_DIR}/.agent-workspace" @@ -37,14 +39,6 @@ readonly OPENCODE_HOST="${OPENCODE_HOST:-localhost}" readonly OPENCODE_PORT="${OPENCODE_PORT:-4096}" readonly OPENCODE_URL="http://${OPENCODE_HOST}:${OPENCODE_PORT}" -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color - # Print functions log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[PASS]${NC} $*"; } diff --git a/.agents/scripts/seo-analysis-helper.sh b/.agents/scripts/seo-analysis-helper.sh index 782fa1a5..3045f07e 100755 --- a/.agents/scripts/seo-analysis-helper.sh +++ b/.agents/scripts/seo-analysis-helper.sh @@ -43,24 +43,11 @@ readonly SCORE_STRIKING_OFFSET=31 # Offset for striking distance scori readonly VOLUME_ESTIMATION_DIVISOR=10 # Estimate volume from impressions when unavailable readonly TARGET_CTR_IMPROVEMENT=0.05 # Target CTR (5%) for potential clicks calculation -# Colors -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly PURPLE="${COLOR_PURPLE:-\033[0;35m}" -readonly NC="${COLOR_RESET:-\033[0m}" - # ============================================================================= # Utility Functions # ============================================================================= print_header() { local msg="$1"; echo -e "${PURPLE}=== $msg ===${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # ============================================================================= # TOON Parsing Functions # ============================================================================= diff --git a/.agents/scripts/seo-export-ahrefs.sh b/.agents/scripts/seo-export-ahrefs.sh index 75851644..6b2f0c5c 100755 --- a/.agents/scripts/seo-export-ahrefs.sh +++ b/.agents/scripts/seo-export-ahrefs.sh @@ -31,22 +31,10 @@ readonly AHREFS_API_BASE="https://api.ahrefs.com/v3" # Ahrefs provides search volume but not impressions; estimate impressions as volume * multiplier readonly IMPRESSION_VOLUME_MULTIPLIER=10 -# Colors -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly NC="${COLOR_RESET:-\033[0m}" - # ============================================================================= # Utility Functions # ============================================================================= -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # ============================================================================= # Ahrefs API Functions # ============================================================================= diff --git a/.agents/scripts/seo-export-bing.sh b/.agents/scripts/seo-export-bing.sh index 1b328401..0eda5536 100755 --- a/.agents/scripts/seo-export-bing.sh +++ b/.agents/scripts/seo-export-bing.sh @@ -25,22 +25,10 @@ readonly SEO_DATA_DIR="$HOME/.aidevops/.agent-workspace/work/seo-data" readonly CONFIG_DIR="$HOME/.config/aidevops" readonly DEFAULT_DAYS=90 -# Colors -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly NC="${COLOR_RESET:-\033[0m}" - # ============================================================================= # Utility Functions # ============================================================================= -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # ============================================================================= # Bing API Functions # ============================================================================= diff --git a/.agents/scripts/seo-export-dataforseo.sh b/.agents/scripts/seo-export-dataforseo.sh index bcecba7c..1736a175 100755 --- a/.agents/scripts/seo-export-dataforseo.sh +++ b/.agents/scripts/seo-export-dataforseo.sh @@ -31,22 +31,10 @@ readonly DFS_API_BASE="https://api.dataforseo.com/v3" # DataForSEO provides search volume but not impressions; estimate impressions as volume * multiplier readonly IMPRESSION_VOLUME_MULTIPLIER=10 -# Colors -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly NC="${COLOR_RESET:-\033[0m}" - # ============================================================================= # Utility Functions # ============================================================================= -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # ============================================================================= # DataForSEO API Functions # ============================================================================= diff --git a/.agents/scripts/seo-export-gsc.sh b/.agents/scripts/seo-export-gsc.sh index ee803908..9676af2a 100755 --- a/.agents/scripts/seo-export-gsc.sh +++ b/.agents/scripts/seo-export-gsc.sh @@ -26,22 +26,10 @@ readonly CONFIG_DIR="$HOME/.config/aidevops" readonly DEFAULT_DAYS=90 readonly ROW_LIMIT=25000 -# Colors -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly NC="${COLOR_RESET:-\033[0m}" - # ============================================================================= # Utility Functions # ============================================================================= -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # ============================================================================= # GSC API Functions # ============================================================================= diff --git a/.agents/scripts/seo-export-helper.sh b/.agents/scripts/seo-export-helper.sh index 2a8cfcd9..5282b776 100755 --- a/.agents/scripts/seo-export-helper.sh +++ b/.agents/scripts/seo-export-helper.sh @@ -27,23 +27,12 @@ readonly CONFIG_DIR="$HOME/.config/aidevops" readonly DEFAULT_DAYS=90 # Colors (fallback if shared-constants not loaded) -readonly RED="${COLOR_RED:-\033[0;31m}" -readonly GREEN="${COLOR_GREEN:-\033[0;32m}" -readonly BLUE="${COLOR_BLUE:-\033[0;34m}" -readonly YELLOW="${COLOR_YELLOW:-\033[1;33m}" -readonly PURPLE="${COLOR_PURPLE:-\033[0;35m}" -readonly NC="${COLOR_RESET:-\033[0m}" # ============================================================================= # Utility Functions # ============================================================================= print_header() { local msg="$1"; echo -e "${PURPLE}=== $msg ===${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } - # Ensure data directory exists ensure_directories() { local domain="$1" diff --git a/.agents/scripts/servers-helper.sh b/.agents/scripts/servers-helper.sh index 385705d4..6dc13c52 100755 --- a/.agents/scripts/servers-helper.sh +++ b/.agents/scripts/servers-helper.sh @@ -5,17 +5,8 @@ # Unified access to all servers across all providers # For detailed provider-specific operations, use individual helper scripts -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Get server configuration (hostname, port, auth method) get_server_config() { diff --git a/.agents/scripts/ses-helper.sh b/.agents/scripts/ses-helper.sh index 4658db75..b1cef85a 100755 --- a/.agents/scripts/ses-helper.sh +++ b/.agents/scripts/ses-helper.sh @@ -4,42 +4,14 @@ # Amazon SES Helper Script # Comprehensive SES management for AI assistants -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - CONFIG_FILE="../configs/ses-config.json" # Constants for repeated strings diff --git a/.agents/scripts/session-checkpoint-helper.sh b/.agents/scripts/session-checkpoint-helper.sh index 7b96f51a..16ec04f7 100755 --- a/.agents/scripts/session-checkpoint-helper.sh +++ b/.agents/scripts/session-checkpoint-helper.sh @@ -31,20 +31,14 @@ set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly CHECKPOINT_DIR="${HOME}/.aidevops/.agent-workspace/tmp" readonly CHECKPOINT_FILE="${CHECKPOINT_DIR}/session-checkpoint.md" -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' readonly BOLD='\033[1m' readonly DIM='\033[2m' -readonly NC='\033[0m' - -print_success() { printf "${GREEN}%s${NC}\n" "$1"; } -print_warning() { printf "${YELLOW}%s${NC}\n" "$1"; } -print_error() { printf "${RED}%s${NC}\n" "$1" >&2; } -print_info() { printf "${DIM}%s${NC}\n" "$1"; } ensure_dir() { if [[ ! -d "$CHECKPOINT_DIR" ]]; then diff --git a/.agents/scripts/session-distill-helper.sh b/.agents/scripts/session-distill-helper.sh index 495b6135..3bb7c589 100755 --- a/.agents/scripts/session-distill-helper.sh +++ b/.agents/scripts/session-distill-helper.sh @@ -21,6 +21,8 @@ set -euo pipefail # Configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly MEMORY_HELPER="$SCRIPT_DIR/memory-helper.sh" readonly WORKSPACE_DIR="${AIDEVOPS_WORKSPACE:-$HOME/.aidevops/.agent-workspace}" @@ -28,14 +30,7 @@ readonly SESSION_DIR="$WORKSPACE_DIR/sessions" # shellcheck disable=SC2034 # Reserved for future use readonly DISTILL_OUTPUT="$SESSION_DIR/distill-output.json" -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[0;33m' -readonly BLUE='\033[0;34m' # shellcheck disable=SC2034 # Available for future use -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } log_success() { echo -e "${GREEN}[OK]${NC} $*"; } diff --git a/.agents/scripts/session-review-helper.sh b/.agents/scripts/session-review-helper.sh index b275ccd7..42242c03 100755 --- a/.agents/scripts/session-review-helper.sh +++ b/.agents/scripts/session-review-helper.sh @@ -13,16 +13,12 @@ # Options: # --focus Focus on: objectives, workflow, knowledge, all (default: all) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # Find project root (look for .git or TODO.md) find_project_root() { diff --git a/.agents/scripts/session-time-helper.sh b/.agents/scripts/session-time-helper.sh index cd8378ca..f68da1aa 100755 --- a/.agents/scripts/session-time-helper.sh +++ b/.agents/scripts/session-time-helper.sh @@ -17,17 +17,13 @@ # --limit Number of sessions to show (default: 10) # --json Output as JSON +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' readonly DIM='\033[2m' -readonly NC='\033[0m' # Defaults CLAUDE_DIR="${HOME}/.claude" diff --git a/.agents/scripts/setup-linters-wizard.sh b/.agents/scripts/setup-linters-wizard.sh index 842f0953..782c19d6 100755 --- a/.agents/scripts/setup-linters-wizard.sh +++ b/.agents/scripts/setup-linters-wizard.sh @@ -8,41 +8,10 @@ # Author: AI DevOps Framework # Version: 1.1.1 -# Colors for output -readonly GREEN='\033[0;32m' -readonly RED='\033[0;31m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly PURPLE='\033[0;35m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" -print_success() { - local _arg1="$1" - echo -e "${GREEN}✅ $_arg1${NC}" - return 0 -} - -print_error() { - local _arg1="$1" - echo -e "${RED}❌ $_arg1${NC}" >&2 - return 0 -} - -print_warning() { - local _arg1="$1" - echo -e "${YELLOW}⚠️ $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}ℹ️ $_arg1${NC}" - return 0 -} - print_question() { local _arg1="$1" echo -e "${CYAN}❓ $_arg1${NC}" diff --git a/.agents/scripts/setup-local-api-keys.sh b/.agents/scripts/setup-local-api-keys.sh index d688a087..44149654 100755 --- a/.agents/scripts/setup-local-api-keys.sh +++ b/.agents/scripts/setup-local-api-keys.sh @@ -7,39 +7,7 @@ # Author: AI DevOps Framework # Version: 2.1.0 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" -print_success() { - local _arg1="$1" - echo -e "${GREEN}[OK] $_arg1${NC}" - return 0 -} - -print_info() { - local _arg1="$1" - echo -e "${BLUE}[INFO] $_arg1${NC}" - return 0 -} - -print_warning() { - local _arg1="$1" - echo -e "${YELLOW}[WARN] $_arg1${NC}" - return 0 -} - -print_error() { - local _arg1="$1" - echo -e "${RED}[ERROR] $_arg1${NC}" >&2 - return 0 -} - # Secure API key directory and file readonly API_KEY_DIR="$HOME/.config/aidevops" readonly CREDENTIALS_FILE="$API_KEY_DIR/credentials.sh" @@ -318,6 +286,8 @@ main() { # Delegate to multi-tenant credential helper local script_dir script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + bash "$script_dir/credential-helper.sh" "$@" ;; "help"|"--help"|"-h"|"") diff --git a/.agents/scripts/setup-mcp-integrations.sh b/.agents/scripts/setup-mcp-integrations.sh index 92e536b6..f70712d1 100755 --- a/.agents/scripts/setup-mcp-integrations.sh +++ b/.agents/scripts/setup-mcp-integrations.sh @@ -9,20 +9,9 @@ set -euo pipefail # Script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' +source "${SCRIPT_DIR}/shared-constants.sh" print_header() { local msg="$1"; echo -e "${PURPLE}$msg${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}$msg${NC}"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}✅ $msg${NC}"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}⚠️ $msg${NC}"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}❌ $msg${NC}"; return 0; } - # Available MCP integrations get_mcp_command() { local integration="$1" diff --git a/.agents/scripts/shared-constants.sh b/.agents/scripts/shared-constants.sh index 0d6875db..f7a448f0 100755 --- a/.agents/scripts/shared-constants.sh +++ b/.agents/scripts/shared-constants.sh @@ -155,6 +155,19 @@ readonly COLOR_CYAN='\033[0;36m' readonly COLOR_WHITE='\033[1;37m' readonly COLOR_RESET='\033[0m' +# ============================================================================= +# Color Aliases (short names used by most scripts) +# ============================================================================= + +readonly RED="$COLOR_RED" +readonly GREEN="$COLOR_GREEN" +readonly YELLOW="$COLOR_YELLOW" +readonly BLUE="$COLOR_BLUE" +readonly PURPLE="$COLOR_PURPLE" +readonly CYAN="$COLOR_CYAN" +readonly WHITE="$COLOR_WHITE" +readonly NC="$COLOR_RESET" + # ============================================================================= # Common Functions for Error Handling # ============================================================================= @@ -187,6 +200,12 @@ print_shared_info() { return 0 } +# Short aliases (used by most scripts - avoids needing inline redefinitions) +print_error() { print_shared_error "$1"; return $?; } +print_success() { print_shared_success "$1"; return $?; } +print_warning() { print_shared_warning "$1"; return $?; } +print_info() { print_shared_info "$1"; return $?; } + # Validate required parameter validate_required_param() { local param_name="$1" @@ -330,3 +349,4 @@ export CI_WAIT_FAST CI_POLL_FAST CI_WAIT_MEDIUM CI_POLL_MEDIUM CI_WAIT_SLOW CI_P export CI_BACKOFF_BASE CI_BACKOFF_MAX CI_BACKOFF_MULTIPLIER export CI_TIMEOUT_FAST CI_TIMEOUT_MEDIUM CI_TIMEOUT_SLOW export COLOR_RED COLOR_GREEN COLOR_YELLOW COLOR_BLUE COLOR_PURPLE COLOR_CYAN COLOR_WHITE COLOR_RESET +export RED GREEN YELLOW BLUE PURPLE CYAN WHITE NC diff --git a/.agents/scripts/show-plan-helper.sh b/.agents/scripts/show-plan-helper.sh index 2f85b99f..5026d976 100755 --- a/.agents/scripts/show-plan-helper.sh +++ b/.agents/scripts/show-plan-helper.sh @@ -11,13 +11,14 @@ # --json Output as JSON # --no-color Disable colors +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Colors (reserved for future terminal output enhancement) # shellcheck disable=SC2034 -RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' # shellcheck disable=SC2034 -BLUE='\033[0;34m' CYAN='\033[0;36m' BOLD='\033[1m' DIM='\033[2m' NC='\033[0m' # Options OUTPUT_JSON=false diff --git a/.agents/scripts/site-crawler-helper.sh b/.agents/scripts/site-crawler-helper.sh index b011d21b..1432cce8 100755 --- a/.agents/scripts/site-crawler-helper.sh +++ b/.agents/scripts/site-crawler-helper.sh @@ -22,16 +22,10 @@ set -euo pipefail -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' - # Constants SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR readonly CONFIG_DIR="${HOME}/.config/aidevops" readonly CONFIG_FILE="${CONFIG_DIR}/site-crawler.json" @@ -51,26 +45,6 @@ USE_CRAWL4AI=false PYTHON_CMD="" # Print functions -print_success() { - echo -e "${GREEN}[OK] $1${NC}" - return 0 -} - -print_info() { - echo -e "${BLUE}[INFO] $1${NC}" - return 0 -} - -print_warning() { - echo -e "${YELLOW}[WARN] $1${NC}" - return 0 -} - -print_error() { - echo -e "${RED}[ERROR] $1${NC}" - return 0 -} - print_header() { echo -e "${PURPLE}=== $1 ===${NC}" return 0 diff --git a/.agents/scripts/skill-update-helper.sh b/.agents/scripts/skill-update-helper.sh index daa4c93b..e9aa65c4 100755 --- a/.agents/scripts/skill-update-helper.sh +++ b/.agents/scripts/skill-update-helper.sh @@ -16,6 +16,9 @@ # --json Output in JSON format # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -23,13 +26,6 @@ AGENTS_DIR="${AIDEVOPS_AGENTS_DIR:-$HOME/.aidevops/agents}" SKILL_SOURCES="${AGENTS_DIR}/configs/skill-sources.json" ADD_SKILL_HELPER="${AGENTS_DIR}/scripts/add-skill-helper.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - # Options AUTO_UPDATE=false QUIET=false diff --git a/.agents/scripts/snyk-helper.sh b/.agents/scripts/snyk-helper.sh index 9e64a476..e5d6a0f5 100755 --- a/.agents/scripts/snyk-helper.sh +++ b/.agents/scripts/snyk-helper.sh @@ -31,22 +31,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/snyk-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_SNYK_NOT_INSTALLED="Snyk CLI is required but not installed" readonly ERROR_NOT_AUTHENTICATED="Snyk CLI is not authenticated. Run 'snyk auth' or set SNYK_TOKEN" @@ -70,30 +63,6 @@ export SNYK_API_BASE="https://api.snyk.io" # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - print_header() { local msg="$1" echo -e "${PURPLE}🔒 $msg${NC}" diff --git a/.agents/scripts/sonarcloud-cli.sh b/.agents/scripts/sonarcloud-cli.sh index dbe34e42..7e5c3bcd 100755 --- a/.agents/scripts/sonarcloud-cli.sh +++ b/.agents/scripts/sonarcloud-cli.sh @@ -4,22 +4,12 @@ # 🔍 SonarCloud Analysis CLI Script # Provides local SonarCloud analysis and issue reporting -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' +set -euo pipefail print_header() { local msg="$1"; echo -e "${PURPLE}$msg${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}$msg${NC}"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}✅ $msg${NC}"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}⚠️ $msg${NC}"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}❌ $msg${NC}"; return 0; } - # SonarCloud project configuration readonly SONAR_PROJECT_KEY="marcusquinn_aidevops" readonly SONAR_ORGANIZATION="marcusquinn" diff --git a/.agents/scripts/sonarscanner-cli.sh b/.agents/scripts/sonarscanner-cli.sh index 0f946585..f5520b74 100755 --- a/.agents/scripts/sonarscanner-cli.sh +++ b/.agents/scripts/sonarscanner-cli.sh @@ -16,46 +16,16 @@ # Version: 1.1.1 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' # No Color +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Configuration readonly SONAR_SCANNER_VERSION="7.3" readonly SONAR_CONFIG_FILE="sonar-project.properties" readonly SONAR_HOST_URL="https://sonarcloud.io" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}✅ $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}ℹ️ $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}⚠️ $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}❌ $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}🔍 $message${NC}" diff --git a/.agents/scripts/spaceship-helper.sh b/.agents/scripts/spaceship-helper.sh index 673135a9..ed1e2ec5 100755 --- a/.agents/scripts/spaceship-helper.sh +++ b/.agents/scripts/spaceship-helper.sh @@ -4,49 +4,19 @@ # Spaceship Domain Registrar Helper Script # Comprehensive domain and DNS management for AI assistants -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_DOMAIN_NAME_REQUIRED="Domain name is required" readonly DOMAINS_ENDPOINT="domains" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # HTTP Constants -readonly AUTH_HEADER_PREFIX="Authorization: Bearer" # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" # Common constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} CONFIG_FILE="../configs/spaceship-config.json" API_BASE_URL="https://api.spaceship.com/v1" diff --git a/.agents/scripts/speech-to-speech-helper.sh b/.agents/scripts/speech-to-speech-helper.sh index 068985c6..b7e0dab9 100755 --- a/.agents/scripts/speech-to-speech-helper.sh +++ b/.agents/scripts/speech-to-speech-helper.sh @@ -5,14 +5,10 @@ # Manages HuggingFace speech-to-speech pipeline # Supports local GPU (CUDA/MPS), Docker, and remote server deployment -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' +set -euo pipefail # Defaults readonly S2S_REPO="https://github.com/huggingface/speech-to-speech.git" @@ -22,30 +18,6 @@ readonly S2S_LOG_FILE="${S2S_DIR}/.s2s.log" readonly DEFAULT_RECV_PORT=12345 readonly DEFAULT_SEND_PORT=12346 -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[OK]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # ─── Dependency checks ─────────────────────────────────────────────── check_python() { diff --git a/.agents/scripts/stagehand-helper.sh b/.agents/scripts/stagehand-helper.sh index b6cf8ae3..f685ab09 100755 --- a/.agents/scripts/stagehand-helper.sh +++ b/.agents/scripts/stagehand-helper.sh @@ -9,38 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Stagehand-specific constants readonly STAGEHAND_CONFIG_DIR="${HOME}/.aidevops/stagehand" readonly STAGEHAND_EXAMPLES_DIR="${STAGEHAND_CONFIG_DIR}/examples" diff --git a/.agents/scripts/stagehand-python-helper.sh b/.agents/scripts/stagehand-python-helper.sh index d8eacccb..a6ad4ca8 100755 --- a/.agents/scripts/stagehand-python-helper.sh +++ b/.agents/scripts/stagehand-python-helper.sh @@ -9,38 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Stagehand Python-specific constants readonly STAGEHAND_PYTHON_CONFIG_DIR="${HOME}/.aidevops/stagehand-python" readonly STAGEHAND_PYTHON_EXAMPLES_DIR="${STAGEHAND_PYTHON_CONFIG_DIR}/examples" diff --git a/.agents/scripts/stagehand-python-setup.sh b/.agents/scripts/stagehand-python-setup.sh index 06972813..029a0cd0 100755 --- a/.agents/scripts/stagehand-python-setup.sh +++ b/.agents/scripts/stagehand-python-setup.sh @@ -8,38 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/../../.agents/scripts/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Stagehand Python configuration readonly STAGEHAND_PYTHON_CONFIG_DIR="${HOME}/.aidevops/stagehand-python" readonly STAGEHAND_PYTHON_EXAMPLES_DIR="${STAGEHAND_PYTHON_CONFIG_DIR}/examples" diff --git a/.agents/scripts/stagehand-setup.sh b/.agents/scripts/stagehand-setup.sh index e9c7196a..fe5f69e6 100755 --- a/.agents/scripts/stagehand-setup.sh +++ b/.agents/scripts/stagehand-setup.sh @@ -8,38 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/../../.agents/scripts/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Stagehand configuration readonly STAGEHAND_CONFIG_DIR="${HOME}/.aidevops/stagehand" readonly STAGEHAND_EXAMPLES_DIR="${STAGEHAND_CONFIG_DIR}/examples" diff --git a/.agents/scripts/supervisor-helper.sh b/.agents/scripts/supervisor-helper.sh index 9542525e..8a6e1a47 100755 --- a/.agents/scripts/supervisor-helper.sh +++ b/.agents/scripts/supervisor-helper.sh @@ -77,6 +77,8 @@ unset _p # Configuration - resolve relative to this script's location SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true readonly SUPERVISOR_DIR="${AIDEVOPS_SUPERVISOR_DIR:-$HOME/.aidevops/.agent-workspace/supervisor}" @@ -125,14 +127,7 @@ readonly -a VALID_TRANSITIONS=( "deployed:cancelled" ) -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[0;33m' -readonly RED='\033[0;31m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*"; } log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*"; } diff --git a/.agents/scripts/system-cleanup.sh b/.agents/scripts/system-cleanup.sh index f74368f4..b598e466 100755 --- a/.agents/scripts/system-cleanup.sh +++ b/.agents/scripts/system-cleanup.sh @@ -11,6 +11,9 @@ # Author: AI DevOps Framework # Version: 1.0.0 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # Strict mode set -euo pipefail @@ -27,13 +30,6 @@ readonly PROJECT_DIR="$HOME/git/aidevops" readonly RETENTION_DAYS_LOGS=90 readonly RETENTION_DAYS_TMP=7 -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly NC='\033[0m' # No Color - # Global state DRY_RUN=true diff --git a/.agents/scripts/terminal-title-helper.sh b/.agents/scripts/terminal-title-helper.sh index a64aa5ab..2ed181f3 100755 --- a/.agents/scripts/terminal-title-helper.sh +++ b/.agents/scripts/terminal-title-helper.sh @@ -23,14 +23,10 @@ # TERMINAL_TITLE_FORMAT Format string: "repo/branch" (default), "branch", "repo" # TERMINAL_TITLE_ENABLED Set to "false" to disable terminal title integration -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Logging log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } diff --git a/.agents/scripts/terminal-title-setup.sh b/.agents/scripts/terminal-title-setup.sh index cbb27228..8fc4b20f 100755 --- a/.agents/scripts/terminal-title-setup.sh +++ b/.agents/scripts/terminal-title-setup.sh @@ -15,14 +15,10 @@ # status Check current installation status # help Show this help message -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Logging log_info() { echo -e "${BLUE}[INFO]${NC} $*"; return 0; } diff --git a/.agents/scripts/test-stagehand-both-integration.sh b/.agents/scripts/test-stagehand-both-integration.sh index 424ea21f..b137a884 100755 --- a/.agents/scripts/test-stagehand-both-integration.sh +++ b/.agents/scripts/test-stagehand-both-integration.sh @@ -8,38 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/../../.agents/scripts/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Test configuration readonly TEST_RESULTS_DIR="${HOME}/.agents/tmp/stagehand-both-tests" readonly TEST_LOG="${TEST_RESULTS_DIR}/test-results.log" diff --git a/.agents/scripts/test-stagehand-integration.sh b/.agents/scripts/test-stagehand-integration.sh index 3a9ed665..eebcb0f7 100755 --- a/.agents/scripts/test-stagehand-integration.sh +++ b/.agents/scripts/test-stagehand-integration.sh @@ -8,38 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/../../.agents/scripts/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Test configuration readonly TEST_RESULTS_DIR="${HOME}/.agents/tmp/stagehand-tests" readonly TEST_LOG="${TEST_RESULTS_DIR}/test-results.log" diff --git a/.agents/scripts/test-stagehand-python-integration.sh b/.agents/scripts/test-stagehand-python-integration.sh index 8591c97a..ba2617a9 100755 --- a/.agents/scripts/test-stagehand-python-integration.sh +++ b/.agents/scripts/test-stagehand-python-integration.sh @@ -8,38 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "${SCRIPT_DIR}/../../.agents/scripts/shared-constants.sh" -# Colors for output -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Print functions -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Test configuration readonly TEST_RESULTS_DIR="${HOME}/.agents/tmp/stagehand-python-tests" readonly TEST_LOG="${TEST_RESULTS_DIR}/test-results.log" diff --git a/.agents/scripts/todo-ready.sh b/.agents/scripts/todo-ready.sh index f098e93b..a39a6d04 100755 --- a/.agents/scripts/todo-ready.sh +++ b/.agents/scripts/todo-ready.sh @@ -10,13 +10,10 @@ # --count Only show count of ready tasks # --verbose Show all task details -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' +set -euo pipefail # Find project root find_project_root() { diff --git a/.agents/scripts/tool-version-check.sh b/.agents/scripts/tool-version-check.sh index c7ba9f26..72c0fb15 100755 --- a/.agents/scripts/tool-version-check.sh +++ b/.agents/scripts/tool-version-check.sh @@ -10,16 +10,12 @@ # # Categories: npm, brew, pip, all (default) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # Parse arguments AUTO_UPDATE=false diff --git a/.agents/scripts/toon-helper.sh b/.agents/scripts/toon-helper.sh index 0358d144..8144f906 100755 --- a/.agents/scripts/toon-helper.sh +++ b/.agents/scripts/toon-helper.sh @@ -7,17 +7,8 @@ # Author: AI DevOps Framework # Version: 1.0.0 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Determine package runner (bun x or npx) get_pkg_runner() { diff --git a/.agents/scripts/twilio-helper.sh b/.agents/scripts/twilio-helper.sh index 4ec40544..b0c9ac01 100755 --- a/.agents/scripts/twilio-helper.sh +++ b/.agents/scripts/twilio-helper.sh @@ -5,43 +5,14 @@ # Comprehensive Twilio management for AI assistants # Supports SMS, Voice, WhatsApp, Verify, Lookup, Recordings, Transcriptions -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [account] [options]" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Script directory for relative paths SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # Config can be in repo configs/ or ~/.aidevops/configs/ if [[ -f "${SCRIPT_DIR}/../../configs/twilio-config.json" ]]; then CONFIG_FILE="${SCRIPT_DIR}/../../configs/twilio-config.json" diff --git a/.agents/scripts/unstract-helper.sh b/.agents/scripts/unstract-helper.sh index e609920c..079d6b15 100755 --- a/.agents/scripts/unstract-helper.sh +++ b/.agents/scripts/unstract-helper.sh @@ -6,6 +6,9 @@ # # Usage: unstract-helper.sh [install|start|stop|status|logs|uninstall|configure-llm] +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Source shared constants (provides sed_inplace and other utilities) @@ -19,18 +22,6 @@ readonly CREDENTIALS_FILE="${HOME}/.config/aidevops/credentials.sh" readonly FRONTEND_URL="http://frontend.unstract.localhost" readonly BACKEND_URL="http://backend.unstract.localhost" -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - -print_success() { local msg="$1"; echo -e "${GREEN}[OK] ${msg}${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}[INFO] ${msg}${NC}"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARN] ${msg}${NC}"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR] ${msg}${NC}" >&2; return 0; } - # Check prerequisites check_prerequisites() { local missing=0 diff --git a/.agents/scripts/updown-helper.sh b/.agents/scripts/updown-helper.sh index 93857689..727e2727 100755 --- a/.agents/scripts/updown-helper.sh +++ b/.agents/scripts/updown-helper.sh @@ -14,22 +14,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly REPO_ROOT="$(dirname "$SCRIPT_DIR")" readonly CONFIG_FILE="$REPO_ROOT/configs/updown-config.json" readonly API_BASE_URL="https://updown.io/api" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # HTTP Constants -readonly CONTENT_TYPE_JSON="$CONTENT_TYPE_JSON" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" -readonly ERROR_API_KEY_MISSING="API key not found in configuration" readonly ERROR_CURL_FAILED="Failed to execute API request" readonly ERROR_JQ_MISSING="jq is required but not installed" @@ -37,30 +30,6 @@ readonly ERROR_JQ_MISSING="jq is required but not installed" # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - check_dependencies() { if ! command -v jq >/dev/null 2>&1; then print_error "$ERROR_JQ_MISSING" diff --git a/.agents/scripts/validate-mcp-integrations.sh b/.agents/scripts/validate-mcp-integrations.sh index 89497c65..7a5c1bbc 100755 --- a/.agents/scripts/validate-mcp-integrations.sh +++ b/.agents/scripts/validate-mcp-integrations.sh @@ -4,22 +4,12 @@ # 🔍 MCP Integrations Validation Script # Validates and tests all MCP integrations for proper functionality -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' +set -euo pipefail print_header() { local msg="$1"; echo -e "${PURPLE}$msg${NC}"; return 0; } -print_info() { local msg="$1"; echo -e "${BLUE}$msg${NC}"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}✅ $msg${NC}"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}⚠️ $msg${NC}"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}❌ $msg${NC}"; return 0; } - # Test results tracking declare -i total_tests=0 declare -i passed_tests=0 diff --git a/.agents/scripts/validate-version-consistency.sh b/.agents/scripts/validate-version-consistency.sh index bfc95a3e..00667ae7 100755 --- a/.agents/scripts/validate-version-consistency.sh +++ b/.agents/scripts/validate-version-consistency.sh @@ -4,6 +4,9 @@ # AI DevOps Framework - Version Consistency Validator # Validates that all version references are synchronized across the framework +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail # Configuration @@ -11,11 +14,6 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" || exit VERSION_FILE="$REPO_ROOT/VERSION" # Color output functions -print_success() { local msg="$1"; echo -e "\033[32m✅ $msg\033[0m"; return 0; } -print_error() { local msg="$1"; echo -e "\033[31m❌ $msg\033[0m"; return 0; } -print_warning() { local msg="$1"; echo -e "\033[33m⚠️ $msg\033[0m"; return 0; } -print_info() { local msg="$1"; echo -e "\033[34mℹ️ $msg\033[0m"; return 0; } - # Function to get current version get_current_version() { if [[ -f "$VERSION_FILE" ]]; then diff --git a/.agents/scripts/vaultwarden-helper.sh b/.agents/scripts/vaultwarden-helper.sh index e3f78890..7ebf597c 100755 --- a/.agents/scripts/vaultwarden-helper.sh +++ b/.agents/scripts/vaultwarden-helper.sh @@ -4,48 +4,20 @@ # Vaultwarden (Self-hosted Bitwarden) Helper Script # Secure password and secrets management for AI assistants -# Colors for output +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_JQ_REQUIRED="jq is required but not installed" readonly INFO_JQ_INSTALL_MACOS="Install with: brew install jq" readonly INFO_JQ_INSTALL_UBUNTU="Install with: apt-get install jq" readonly ERROR_CURL_REQUIRED="curl is required but not installed" -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color # Common message constants readonly HELP_SHOW_MESSAGE="Show this help" readonly USAGE_COMMAND_OPTIONS="Usage: $0 [options]" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - CONFIG_FILE="../configs/vaultwarden-config.json" # Check dependencies diff --git a/.agents/scripts/vercel-cli-helper.sh b/.agents/scripts/vercel-cli-helper.sh index 566d7c23..60825e73 100755 --- a/.agents/scripts/vercel-cli-helper.sh +++ b/.agents/scripts/vercel-cli-helper.sh @@ -13,21 +13,15 @@ set -euo pipefail # ------------------------------------------------------------------------------ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared-constants.sh" + readonly SCRIPT_DIR="$script_dir" repo_root="$(dirname "$SCRIPT_DIR")" readonly REPO_ROOT="$repo_root" readonly CONFIG_FILE="$REPO_ROOT/configs/vercel-cli-config.json" -# Colors -readonly BLUE='\033[0;34m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Common constants -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" # Error Messages readonly ERROR_CONFIG_MISSING="Configuration file not found at $CONFIG_FILE" readonly ERROR_VERCEL_NOT_INSTALLED="Vercel CLI is required but not installed" @@ -38,7 +32,6 @@ readonly ERROR_DEPLOYMENT_FAILED="Deployment failed" # Success Messages # Removed unused success constant to fix ShellCheck SC2034 warning -readonly SUCCESS_DEPLOYMENT_COMPLETE="Deployment completed successfully" readonly SUCCESS_ENV_UPDATED="Environment variables updated successfully" readonly SUCCESS_DOMAIN_ADDED="Domain added successfully" # Removed unused success constant to fix ShellCheck SC2034 warning @@ -50,30 +43,6 @@ readonly JQ_TEAM_ID_EXPR='.team_id // empty' # UTILITY FUNCTIONS # ------------------------------------------------------------------------------ -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - # ------------------------------------------------------------------------------ # DEPENDENCY CHECKS # ------------------------------------------------------------------------------ diff --git a/.agents/scripts/verify-mirrors.sh b/.agents/scripts/verify-mirrors.sh index e502c075..88795eda 100755 --- a/.agents/scripts/verify-mirrors.sh +++ b/.agents/scripts/verify-mirrors.sh @@ -13,20 +13,10 @@ set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[OK]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARN]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg"; return 0; } - # Get repo root SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" # Expected symlinks (target:link_path relative to repo root) diff --git a/.agents/scripts/version-manager.sh b/.agents/scripts/version-manager.sh index bb84261d..7124795d 100755 --- a/.agents/scripts/version-manager.sh +++ b/.agents/scripts/version-manager.sh @@ -7,17 +7,8 @@ # Author: AI DevOps Framework # Version: 1.1.0 -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color - -print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; } -print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; } -print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; } -print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; } +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Source shared constants (provides sed_inplace and other utilities) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit diff --git a/.agents/scripts/virustotal-helper.sh b/.agents/scripts/virustotal-helper.sh index 9508e230..ed6589c2 100755 --- a/.agents/scripts/virustotal-helper.sh +++ b/.agents/scripts/virustotal-helper.sh @@ -24,14 +24,6 @@ readonly VT_API_BASE="https://www.virustotal.com/api/v3" readonly VERSION="1.0.0" readonly RATE_LIMIT_DELAY=16 # 4 req/min = 1 every 15s, add 1s buffer -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' -readonly NC='\033[0m' - # ============================================================================= # Helper Functions # ============================================================================= @@ -120,6 +112,8 @@ resolve_api_key() { # Try aidevops secret helper local script_dir="" script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || return 1 +source "${SCRIPT_DIR}/shared-constants.sh" + if [[ -x "${script_dir}/secret-helper.sh" ]]; then local key="" key=$("${script_dir}/secret-helper.sh" get VIRUSTOTAL_MARCUSQUINN 2>/dev/null || true) diff --git a/.agents/scripts/voice-helper.sh b/.agents/scripts/voice-helper.sh index 53972656..60a174ea 100755 --- a/.agents/scripts/voice-helper.sh +++ b/.agents/scripts/voice-helper.sh @@ -7,44 +7,15 @@ set -euo pipefail -# Colors -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' - # Paths readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + readonly BRIDGE_SCRIPT="${SCRIPT_DIR}/voice-bridge.py" readonly S2S_DIR="${HOME}/.aidevops/.agent-workspace/work/speech-to-speech" readonly VENV_DIR="${S2S_DIR}/.venv" readonly VOICE_PID_FILE="${HOME}/.aidevops/.agent-workspace/tmp/.voice-bridge.pid" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} ${msg}" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[OK]${NC} ${msg}" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARN]${NC} ${msg}" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} ${msg}" >&2 - return 0 -} - # ─── Dependency checks ─────────────────────────────────────────────── check_venv() { diff --git a/.agents/scripts/webhosting-helper.sh b/.agents/scripts/webhosting-helper.sh index 76fdfa0a..b93a158f 100755 --- a/.agents/scripts/webhosting-helper.sh +++ b/.agents/scripts/webhosting-helper.sh @@ -9,14 +9,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -PURPLE='\033[0;35m' -NC='\033[0m' # No Color - # Configuration CERT_DIR="$HOME/.localhost-setup/certs" NGINX_CONF_DIR="/Users/$(whoami)/Library/Application Support/Local/run/router/nginx/conf" @@ -31,30 +23,6 @@ print_header() { return 0 } -print_info() { - local message="$1" - echo -e "${BLUE}[INFO]${NC} $message" - return 0 -} - -print_success() { - local message="$1" - echo -e "${GREEN}[SUCCESS]${NC} $message" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARNING]${NC} $message" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}[ERROR]${NC} $message" >&2 - return 0 -} - # Check if LocalWP is available check_localwp() { if [[ -d "/Applications/Local.app" ]] || [[ -d "$HOME/Applications/Local.app" ]]; then diff --git a/.agents/scripts/webhosting-verify.sh b/.agents/scripts/webhosting-verify.sh index 32cd3ce2..ffec0d23 100755 --- a/.agents/scripts/webhosting-verify.sh +++ b/.agents/scripts/webhosting-verify.sh @@ -8,14 +8,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -PURPLE='\033[0;35m' -NC='\033[0m' # No Color - # Configuration CERT_DIR="$HOME/.localhost-setup/certs" NGINX_CONF_DIR="/Users/$(whoami)/Library/Application Support/Local/run/router/nginx/conf" @@ -29,30 +21,6 @@ print_header() { return 0 } -print_info() { - local message="$1" - echo -e "${BLUE}[INFO]${NC} $message" - return 0 -} - -print_success() { - local message="$1" - echo -e "${GREEN}[SUCCESS]${NC} $message" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARNING]${NC} $message" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}[ERROR]${NC} $message" >&2 - return 0 -} - # Verify domain setup verify_domain() { local project_name="$1" diff --git a/.agents/scripts/wordpress-mcp-helper.sh b/.agents/scripts/wordpress-mcp-helper.sh index f413adfc..dad6b464 100755 --- a/.agents/scripts/wordpress-mcp-helper.sh +++ b/.agents/scripts/wordpress-mcp-helper.sh @@ -5,8 +5,10 @@ # Manages WordPress MCP connections for AI assistants # Supports both STDIO (local/SSH) and HTTP transports +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_JQ_REQUIRED="jq is required but not installed" readonly INFO_JQ_INSTALL_MACOS="Install with: brew install jq" readonly INFO_JQ_INSTALL_UBUNTU="Install with: apt-get install jq" @@ -14,38 +16,6 @@ readonly ERROR_CURL_REQUIRED="curl is required but not installed" readonly ERROR_SITE_REQUIRED="Site name is required" readonly ERROR_SITE_NOT_FOUND="Site not found in configuration" -# Colors for output -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Configuration paths (XDG-compliant user config) CONFIG_FILE="${HOME}/.config/aidevops/wordpress-sites-config.json" TEMPLATE_FILE="${HOME}/.aidevops/agents/configs/wordpress-sites-config.json.txt" diff --git a/.agents/scripts/worktree-helper.sh b/.agents/scripts/worktree-helper.sh index ee884a89..c67be4a7 100755 --- a/.agents/scripts/worktree-helper.sh +++ b/.agents/scripts/worktree-helper.sh @@ -28,15 +28,12 @@ # worktree-helper.sh clean # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' readonly BOLD='\033[1m' -readonly NC='\033[0m' # Get repo info get_repo_root() { diff --git a/.agents/scripts/worktree-sessions.sh b/.agents/scripts/worktree-sessions.sh index dfdc65dd..626ac67c 100755 --- a/.agents/scripts/worktree-sessions.sh +++ b/.agents/scripts/worktree-sessions.sh @@ -18,17 +18,13 @@ # help Show this help # ============================================================================= +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" + set -euo pipefail -# Colors -readonly RED='\033[0;31m' -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly BLUE='\033[0;34m' -readonly CYAN='\033[0;36m' readonly BOLD='\033[1m' readonly DIM='\033[2m' -readonly NC='\033[0m' # OpenCode session storage readonly SESSION_BASE="$HOME/.local/share/opencode/storage/session" diff --git a/.agents/scripts/wp-helper.sh b/.agents/scripts/wp-helper.sh index 4e386ed3..eaddb6ac 100755 --- a/.agents/scripts/wp-helper.sh +++ b/.agents/scripts/wp-helper.sh @@ -5,17 +5,12 @@ # Runs WP-CLI commands on sites configured in wordpress-sites.json # Supports multiple hosting types: LocalWP, Hostinger, Hetzner, Cloudways, Closte -set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' # No Color +set -euo pipefail # String literal constants -readonly ERROR_CONFIG_NOT_FOUND="Configuration file not found" readonly ERROR_JQ_REQUIRED="jq is required but not installed" readonly INFO_JQ_INSTALL_MACOS="Install with: brew install jq" readonly INFO_JQ_INSTALL_UBUNTU="Install with: apt-get install jq" @@ -27,30 +22,6 @@ readonly ERROR_COMMAND_REQUIRED="WP-CLI command is required" CONFIG_FILE="${HOME}/.config/aidevops/wordpress-sites.json" TEMPLATE_FILE="${HOME}/.aidevops/agents/configs/wordpress-sites.json.txt" -print_info() { - local msg="$1" - echo -e "${BLUE}[INFO]${NC} $msg" - return 0 -} - -print_success() { - local msg="$1" - echo -e "${GREEN}[SUCCESS]${NC} $msg" - return 0 -} - -print_warning() { - local msg="$1" - echo -e "${YELLOW}[WARNING]${NC} $msg" - return 0 -} - -print_error() { - local msg="$1" - echo -e "${RED}[ERROR]${NC} $msg" >&2 - return 0 -} - # Check dependencies check_dependencies() { if ! command -v jq &> /dev/null; then diff --git a/.agents/scripts/x-helper.sh b/.agents/scripts/x-helper.sh index 16476f16..711af170 100755 --- a/.agents/scripts/x-helper.sh +++ b/.agents/scripts/x-helper.sh @@ -21,12 +21,10 @@ set -euo pipefail -readonly FXTWITTER_API="https://api.fxtwitter.com" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" -readonly GREEN='\033[0;32m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly NC='\033[0m' +readonly FXTWITTER_API="https://api.fxtwitter.com" print_success() { printf "${GREEN}%s${NC}\n" "$1"; } print_warning() { printf "${YELLOW}%s${NC}\n" "$1"; } diff --git a/.agents/scripts/yt-dlp-helper.sh b/.agents/scripts/yt-dlp-helper.sh index 0c4ef5bd..e232e538 100755 --- a/.agents/scripts/yt-dlp-helper.sh +++ b/.agents/scripts/yt-dlp-helper.sh @@ -26,47 +26,17 @@ # Version: 1.0.0 # License: MIT -# Colors for output -readonly GREEN='\033[0;32m' -readonly BLUE='\033[0;34m' -readonly YELLOW='\033[1;33m' -readonly RED='\033[0;31m' -readonly PURPLE='\033[0;35m' -readonly NC='\033[0m' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +source "${SCRIPT_DIR}/shared-constants.sh" # Constants readonly DEFAULT_DOWNLOAD_DIR="$HOME/Downloads" readonly CONFIG_DIR="$HOME/.config/yt-dlp" readonly CONFIG_FILE="$CONFIG_DIR/config" readonly ARCHIVE_FILE="$CONFIG_DIR/archive.txt" -readonly ERROR_UNKNOWN_COMMAND="Unknown command:" readonly HELP_SHOW_MESSAGE="Show this help message" # Print functions -print_success() { - local message="$1" - echo -e "${GREEN}[OK] $message${NC}" - return 0 -} - -print_info() { - local message="$1" - echo -e "${BLUE}[INFO] $message${NC}" - return 0 -} - -print_warning() { - local message="$1" - echo -e "${YELLOW}[WARN] $message${NC}" - return 0 -} - -print_error() { - local message="$1" - echo -e "${RED}[ERROR] $message${NC}" >&2 - return 0 -} - print_header() { local message="$1" echo -e "${PURPLE}=== $message ===${NC}"