diff --git a/.agent/scripts/add-skill-helper.sh b/.agent/scripts/add-skill-helper.sh index 9427e6a0e..18028e5c3 100755 --- a/.agent/scripts/add-skill-helper.sh +++ b/.agent/scripts/add-skill-helper.sh @@ -259,7 +259,7 @@ to_kebab_case() { # Determine target path in .agent/ based on skill content determine_target_path() { local skill_name="$1" - local description="$2" + local _description="$2" # Reserved for future category detection local source_dir="$3" # Analyze content to determine category diff --git a/.agent/scripts/beads-sync-helper.sh b/.agent/scripts/beads-sync-helper.sh index 715b6726f..3d5e4756b 100755 --- a/.agent/scripts/beads-sync-helper.sh +++ b/.agent/scripts/beads-sync-helper.sh @@ -184,7 +184,7 @@ parse_todo_md() { # Push TODO.md to Beads cmd_push() { - local force="${1:-false}" + local _force="${1:-false}" # Reserved for future force-push support local dry_run="${2:-false}" local verbose="${3:-false}" diff --git a/.agent/scripts/cloudron-package-helper.sh b/.agent/scripts/cloudron-package-helper.sh index 1c194ad1f..f6f7694a7 100755 --- a/.agent/scripts/cloudron-package-helper.sh +++ b/.agent/scripts/cloudron-package-helper.sh @@ -348,7 +348,7 @@ cmd_debug_off() { # Run validation checklist cmd_test() { - local app="${1:-}" + # Note: app parameter reserved for future use (specific app testing) check_cloudron_cli || return 1 diff --git a/.agent/scripts/dspyground-helper.sh b/.agent/scripts/dspyground-helper.sh index f8cedef6f..b084567bd 100755 --- a/.agent/scripts/dspyground-helper.sh +++ b/.agent/scripts/dspyground-helper.sh @@ -240,22 +240,6 @@ show_help() { # Main command handler main() { - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables case "${1:-help}" in "install") install diff --git a/.agent/scripts/eeat-score-helper.sh b/.agent/scripts/eeat-score-helper.sh index de3113e51..c14c0f2cc 100755 --- a/.agent/scripts/eeat-score-helper.sh +++ b/.agent/scripts/eeat-score-helper.sh @@ -85,25 +85,23 @@ print_header() { # Load configuration load_config() { - if [[ -f "$CONFIG_FILE" ]]; then - if command -v jq &> /dev/null; then - LLM_PROVIDER=$(jq -r '.llm_provider // "openai"' "$CONFIG_FILE") - LLM_MODEL=$(jq -r '.llm_model // "gpt-4o"' "$CONFIG_FILE") - TEMPERATURE=$(jq -r '.temperature // 0.3' "$CONFIG_FILE") - MAX_TOKENS=$(jq -r '.max_tokens // 500' "$CONFIG_FILE") - CONCURRENT_REQUESTS=$(jq -r '.concurrent_requests // 3' "$CONFIG_FILE") - OUTPUT_FORMAT=$(jq -r '.output_format // "xlsx"' "$CONFIG_FILE") - INCLUDE_REASONING=$(jq -r '.include_reasoning // true' "$CONFIG_FILE") - - # Load weights - WEIGHT_AUTHORSHIP=$(jq -r '.weights.authorship // 0.15' "$CONFIG_FILE") - WEIGHT_CITATION=$(jq -r '.weights.citation // 0.15' "$CONFIG_FILE") - WEIGHT_EFFORT=$(jq -r '.weights.effort // 0.15' "$CONFIG_FILE") - WEIGHT_ORIGINALITY=$(jq -r '.weights.originality // 0.15' "$CONFIG_FILE") - WEIGHT_INTENT=$(jq -r '.weights.intent // 0.15' "$CONFIG_FILE") - WEIGHT_SUBJECTIVE=$(jq -r '.weights.subjective // 0.15' "$CONFIG_FILE") - WEIGHT_WRITING=$(jq -r '.weights.writing // 0.10' "$CONFIG_FILE") - fi + if [[ -f "$CONFIG_FILE" ]] && command -v jq &> /dev/null; then + LLM_PROVIDER=$(jq -r '.llm_provider // "openai"' "$CONFIG_FILE") + LLM_MODEL=$(jq -r '.llm_model // "gpt-4o"' "$CONFIG_FILE") + TEMPERATURE=$(jq -r '.temperature // 0.3' "$CONFIG_FILE") + MAX_TOKENS=$(jq -r '.max_tokens // 500' "$CONFIG_FILE") + CONCURRENT_REQUESTS=$(jq -r '.concurrent_requests // 3' "$CONFIG_FILE") + OUTPUT_FORMAT=$(jq -r '.output_format // "xlsx"' "$CONFIG_FILE") + INCLUDE_REASONING=$(jq -r '.include_reasoning // true' "$CONFIG_FILE") + + # Load weights + WEIGHT_AUTHORSHIP=$(jq -r '.weights.authorship // 0.15' "$CONFIG_FILE") + WEIGHT_CITATION=$(jq -r '.weights.citation // 0.15' "$CONFIG_FILE") + WEIGHT_EFFORT=$(jq -r '.weights.effort // 0.15' "$CONFIG_FILE") + WEIGHT_ORIGINALITY=$(jq -r '.weights.originality // 0.15' "$CONFIG_FILE") + WEIGHT_INTENT=$(jq -r '.weights.intent // 0.15' "$CONFIG_FILE") + WEIGHT_SUBJECTIVE=$(jq -r '.weights.subjective // 0.15' "$CONFIG_FILE") + WEIGHT_WRITING=$(jq -r '.weights.writing // 0.10' "$CONFIG_FILE") fi return 0 } diff --git a/.agent/scripts/fix-s131-default-cases.sh b/.agent/scripts/fix-s131-default-cases.sh index aa9dec911..0b1a89345 100755 --- a/.agent/scripts/fix-s131-default-cases.sh +++ b/.agent/scripts/fix-s131-default-cases.sh @@ -174,7 +174,6 @@ process_file() { local file="$1" local violations local count=0 - local offset=0 print_info "Processing: $file" @@ -204,7 +203,6 @@ process_file() { # Main execution main() { - local total_fixed=0 local files_processed=0 print_info "SonarCloud S131 Fixer - Add default case to case statements" diff --git a/.agent/scripts/keyword-research-helper.sh b/.agent/scripts/keyword-research-helper.sh index c39168616..2ea4a07d9 100755 --- a/.agent/scripts/keyword-research-helper.sh +++ b/.agent/scripts/keyword-research-helper.sh @@ -771,7 +771,6 @@ do_webmaster_research() { print_info "Period: Last $days days" print_info "Enrichment: $enrich" - local all_keywords=() local gsc_data="" local bing_data="" @@ -845,7 +844,6 @@ do_webmaster_research() { fi # Enrich with DataForSEO volume/difficulty data if requested - local enriched_data="[]" if [[ "$enrich" == "true" ]]; then print_info "Enriching with search volume and difficulty data..." diff --git a/.agent/scripts/linters-local.sh b/.agent/scripts/linters-local.sh index 21562cf00..e0493bf27 100755 --- a/.agent/scripts/linters-local.sh +++ b/.agent/scripts/linters-local.sh @@ -483,11 +483,9 @@ check_toon_syntax() { else # Fallback: basic structure validation (non-empty check) while IFS= read -r file; do - if [[ -f "$file" ]]; then - if [[ ! -s "$file" ]]; then - ((violations++)) - print_warning "TOON: Empty file $file" - fi + if [[ -f "$file" ]] && [[ ! -s "$file" ]]; then + ((violations++)) + print_warning "TOON: Empty file $file" fi done <<< "$toon_files" fi diff --git a/.agent/scripts/localhost-helper.sh b/.agent/scripts/localhost-helper.sh index 758d979d8..7f27d4292 100755 --- a/.agent/scripts/localhost-helper.sh +++ b/.agent/scripts/localhost-helper.sh @@ -78,10 +78,8 @@ is_port_free() { fi # Double-check with nc if available - if command -v nc >/dev/null 2>&1; then - if nc -z 127.0.0.1 "$port" 2>/dev/null; then - return 1 # Port is in use - fi + if command -v nc >/dev/null 2>&1 && nc -z 127.0.0.1 "$port" 2>/dev/null; then + return 1 # Port is in use fi return 0 # Port is free diff --git a/.agent/scripts/mail-helper.sh b/.agent/scripts/mail-helper.sh index 04a971825..0a6b40b80 100755 --- a/.agent/scripts/mail-helper.sh +++ b/.agent/scripts/mail-helper.sh @@ -398,13 +398,11 @@ cmd_prune() { payload=$(sed -n '/^-->$/,$ { /^-->$/d; p; }' "$msg_file" | sed '/^$/d') # Remember discoveries and important status reports - if [[ "$msg_type" == "discovery" || "$msg_type" == "status_report" ]]; then - if [[ -x "$MEMORY_HELPER" && -n "$payload" ]]; then - "$MEMORY_HELPER" store \ - --content "Mailbox ($msg_type): $payload" \ - --type CONTEXT \ - --tags "mailbox,${msg_type},archived" 2>/dev/null && remembered=$((remembered + 1)) - fi + if [[ ("$msg_type" == "discovery" || "$msg_type" == "status_report") && -x "$MEMORY_HELPER" && -n "$payload" ]]; then + "$MEMORY_HELPER" store \ + --content "Mailbox ($msg_type): $payload" \ + --type CONTEXT \ + --tags "mailbox,${msg_type},archived" 2>/dev/null && remembered=$((remembered + 1)) fi rm -f "$msg_file" diff --git a/.agent/scripts/opencode-github-setup-helper.sh b/.agent/scripts/opencode-github-setup-helper.sh index d27056b54..bbd2a14e3 100755 --- a/.agent/scripts/opencode-github-setup-helper.sh +++ b/.agent/scripts/opencode-github-setup-helper.sh @@ -203,10 +203,10 @@ check_github_workflow() { # Check if AI provider API key is configured in repository secrets # Looks for ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY # Arguments: -# $1 - Repository path in "owner/repo" format +# $1 - Repository path in "owner/repo" format (reserved for future multi-repo support) # Returns: 0 if at least one AI key is configured, 1 otherwise check_github_secrets() { - local repo_path="$1" + local _repo_path="$1" # Reserved for future multi-repo support if ! command -v gh &> /dev/null; then return 1 @@ -231,11 +231,9 @@ check_github_secrets() { # Arguments: None # Returns: 0 if OpenCode is configured in GitLab CI, 1 otherwise check_gitlab_ci() { - if [[ -f ".gitlab-ci.yml" ]]; then - # Check if it contains opencode configuration - if grep -q "opencode" ".gitlab-ci.yml" 2>/dev/null; then - return 0 - fi + # Check if gitlab-ci.yml exists and contains opencode configuration + if [[ -f ".gitlab-ci.yml" ]] && grep -q "opencode" ".gitlab-ci.yml" 2>/dev/null; then + return 0 fi return 1 } @@ -502,7 +500,6 @@ cmd_create_secure_workflow() { fi # Check if aidevops has the template - local template_path="$HOME/.aidevops/agents/scripts/../../../.github/workflows/opencode-agent.yml" local aidevops_template="$HOME/Git/aidevops/.github/workflows/opencode-agent.yml" mkdir -p .github/workflows diff --git a/.agent/scripts/pagespeed-helper.sh b/.agent/scripts/pagespeed-helper.sh index 8b6880a6f..cd19bf230 100755 --- a/.agent/scripts/pagespeed-helper.sh +++ b/.agent/scripts/pagespeed-helper.sh @@ -364,22 +364,6 @@ generate_actionable_report() { # Main function main() { - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables - local command="${1:-help}" - local account_name="$account_name" - local target="$target" - local options="$options" - # Assign positional parameters to local variables case "${1:-help}" in "check"|"audit") if [[ -z "${2:-}" ]]; then diff --git a/.agent/scripts/quality-loop-helper.sh b/.agent/scripts/quality-loop-helper.sh index d7994f3ae..348978d61 100755 --- a/.agent/scripts/quality-loop-helper.sh +++ b/.agent/scripts/quality-loop-helper.sh @@ -835,10 +835,8 @@ pr_review_loop() { WAITING) print_info "Waiting for review..." # Check if review is stale and trigger re-review if enabled - if [[ "$auto_trigger_review" == "true" ]]; then - if check_and_trigger_review "$pr_number"; then - print_info "Re-review triggered, waiting for response..." - fi + if [[ "$auto_trigger_review" == "true" ]] && check_and_trigger_review "$pr_number"; then + print_info "Re-review triggered, waiting for response..." fi ;; *) diff --git a/.agent/scripts/secretlint-helper.sh b/.agent/scripts/secretlint-helper.sh index 8a79abd63..a3039ad97 100755 --- a/.agent/scripts/secretlint-helper.sh +++ b/.agent/scripts/secretlint-helper.sh @@ -105,21 +105,17 @@ check_rules_installed() { local missing_rules=() # Check for preset-recommend (most common) - if grep -q "secretlint-rule-preset-recommend" "$config_file"; then - if ! npm list @secretlint/secretlint-rule-preset-recommend &>/dev/null; then - if ! npm list -g @secretlint/secretlint-rule-preset-recommend &>/dev/null; then - missing_rules+=("@secretlint/secretlint-rule-preset-recommend") - fi - fi + if grep -q "secretlint-rule-preset-recommend" "$config_file" \ + && ! npm list @secretlint/secretlint-rule-preset-recommend &>/dev/null \ + && ! npm list -g @secretlint/secretlint-rule-preset-recommend &>/dev/null; then + missing_rules+=("@secretlint/secretlint-rule-preset-recommend") fi # Check for pattern rule - if grep -q "secretlint-rule-pattern" "$config_file"; then - if ! npm list @secretlint/secretlint-rule-pattern &>/dev/null; then - if ! npm list -g @secretlint/secretlint-rule-pattern &>/dev/null; then - missing_rules+=("@secretlint/secretlint-rule-pattern") - fi - fi + if grep -q "secretlint-rule-pattern" "$config_file" \ + && ! npm list @secretlint/secretlint-rule-pattern &>/dev/null \ + && ! npm list -g @secretlint/secretlint-rule-pattern &>/dev/null; then + missing_rules+=("@secretlint/secretlint-rule-pattern") fi if [[ ${#missing_rules[@]} -gt 0 ]]; then diff --git a/.agent/scripts/session-time-helper.sh b/.agent/scripts/session-time-helper.sh index 6ddb1441c..cd8378ca0 100755 --- a/.agent/scripts/session-time-helper.sh +++ b/.agent/scripts/session-time-helper.sh @@ -246,8 +246,8 @@ cmd_list() { local result result=$(calculate_active_time "$session_file") - local active wall msgs afk first_ts last_ts - IFS='|' read -r active wall msgs afk first_ts last_ts <<< "$result" + local active wall msgs afk first_ts _last_ts + IFS='|' read -r active wall msgs afk first_ts _last_ts <<< "$result" # Skip empty/trivial sessions [[ $msgs -lt 3 ]] && continue @@ -384,8 +384,8 @@ cmd_summary() { local result result=$(calculate_active_time "$session_file") - local active wall msgs afk first_ts last_ts - IFS='|' read -r active wall msgs afk first_ts last_ts <<< "$result" + local active wall msgs _afk _first_ts _last_ts + IFS='|' read -r active wall msgs _afk _first_ts _last_ts <<< "$result" [[ $msgs -lt 3 ]] && continue diff --git a/.agent/scripts/site-crawler-helper.sh b/.agent/scripts/site-crawler-helper.sh index d3b9430a1..2df386c93 100755 --- a/.agent/scripts/site-crawler-helper.sh +++ b/.agent/scripts/site-crawler-helper.sh @@ -91,13 +91,12 @@ find_python() { local user_site="${HOME}/Library/Python/3.11/lib/python/site-packages" for py in "${pythons[@]}"; do - if command -v "$py" &> /dev/null; then - # Test if it has the required modules - if PYTHONPATH="${user_site}:${PYTHONPATH:-}" "$py" -c "import aiohttp, bs4" 2>/dev/null; then - PYTHON_CMD="$py" - export PYTHONPATH="${user_site}:${PYTHONPATH:-}" - return 0 - fi + # Check if python exists and has the required modules + if command -v "$py" &> /dev/null \ + && PYTHONPATH="${user_site}:${PYTHONPATH:-}" "$py" -c "import aiohttp, bs4" 2>/dev/null; then + PYTHON_CMD="$py" + export PYTHONPATH="${user_site}:${PYTHONPATH:-}" + return 0 fi done return 1 @@ -151,7 +150,7 @@ save_markdown_with_metadata() { local full_page_dir="$2" local body_only_dir="$3" local images_dir="$4" - local base_domain="$5" + local _base_domain="$5" # Reserved for future domain-relative path generation # Extract basic info local page_url status_code redirected_url success @@ -637,7 +636,7 @@ crawl4ai_generate_reports() { echo "url,status_code,status,title,title_length,meta_description,description_length,h1,h1_count,canonical,meta_robots,word_count,response_time_ms,crawl_depth,internal_links,external_links,images,images_missing_alt" > "$csv_file" local broken_links=() - local redirects=() + local _redirects=() # Reserved for future redirect chain analysis local meta_issues=() local status_codes=() diff --git a/.agent/scripts/worktree-sessions.sh b/.agent/scripts/worktree-sessions.sh index 3b38c83fd..77aa8494c 100755 --- a/.agent/scripts/worktree-sessions.sh +++ b/.agent/scripts/worktree-sessions.sh @@ -183,7 +183,7 @@ find_matching_sessions() { local branch="$1" local project_id="$2" local branch_start_epoch="$3" - local worktree_path="$4" + local _worktree_path="$4" # Reserved for future path-based filtering local session_dir="$SESSION_BASE/$project_id" @@ -431,11 +431,10 @@ cmd_open() { elif [[ "$line" =~ ^branch\ refs/heads/(.+)$ ]]; then worktree_branch="${BASH_REMATCH[1]}" elif [[ -z "$line" ]]; then - if [[ -n "$worktree_path" ]] && [[ -n "$worktree_branch" ]]; then - if [[ "$worktree_branch" != "main" ]] && [[ "$worktree_branch" != "master" ]]; then - worktrees+=("$worktree_path") - branches+=("$worktree_branch") - fi + if [[ -n "$worktree_path" ]] && [[ -n "$worktree_branch" ]] \ + && [[ "$worktree_branch" != "main" ]] && [[ "$worktree_branch" != "master" ]]; then + worktrees+=("$worktree_path") + branches+=("$worktree_branch") fi worktree_path="" worktree_branch=""