---
id: T-480
name: "macOS compat: replace grep -oP and ${var,,} with portable alternatives"
description: >
  macOS BSD grep lacks -P (Perl regex) and bash ${var,,} is not POSIX. 6 grep -oP
  in install.sh, bin/fw, bin/watchtower.sh, action.yml. 1 ${var,,} in lib/upstream.sh.
  From OneDev issues #2 and #3.

status: work-completed
workflow_type: build
owner: agent
horizon:
tags: [portability, bugfix]
components: []
related_tasks: []
created: 2026-03-14T13:05:22Z
last_update: '2026-06-11T22:24:22Z'
date_finished: 2026-03-14T13:07:31Z
bvp_scores_proposed:
  - ts: '2026-06-11T22:24:22Z'
    estimator: bvp-estimator-v1-heuristic
    scores:
      D1: 0
      D2: 0
      D3: 0
      D4: 0
      F-RECALL: 0
      F-ORCH: 0
      F3: 0
      F1: 0
      F2: 0
    rationale: D1=0 (no-signal); D2=0 (no-signal); D3=0 (no-signal); D4=0 
      (no-signal); F-RECALL=0 (no-signal); F-ORCH=0 (no-signal); F3=0 
      (no-signal); F1=0 (no-signal); F2=0 (no-signal)
    rubric_sha: e4a00f38e801
---

# T-480: macOS compat: replace grep -oP and ${var,,} with portable alternatives

## Context

macOS field report (OneDev issues #2, #3). BSD grep lacks `-P` (Perl regex) and `${var,,}` is bash 4+ only. Directive D4 (portability).

## Acceptance Criteria

### Agent
- [x] No `grep -oP` in any shell script or action.yml
- [x] No `${var,,}` in any shell script
- [x] All replaced patterns produce identical output
- [x] All modified files pass syntax check

## Verification

# No grep -oP remaining
test "$(grep -rn 'grep -oP' install.sh bin/fw action.yml bin/watchtower.sh 2>/dev/null | wc -l)" = "0"
# No ${var,,} remaining
test "$(grep -rn '\${.*,,}' lib/upstream.sh 2>/dev/null | wc -l)" = "0"
# Smoke tests
bash -c 'echo "git version 2.53.1" | grep -oE "[0-9]+\.[0-9]+" | head -1' | grep -q '2.53'
bash -c 'echo "Python 3.9.6" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"' | grep -q '3.9.6'
bash -n install.sh
bash -n bin/watchtower.sh
bash -n lib/upstream.sh

## Decisions

<!-- Record decisions ONLY when choosing between alternatives.
     Skip for tasks with no meaningful choices.
     Format:
     ### [date] — [topic]
     - **Chose:** [what was decided]
     - **Why:** [rationale]
     - **Rejected:** [alternatives and why not]
-->

## Updates

### 2026-03-14T13:05:22Z — task-created [task-create-agent]
- **Action:** Created task via task-create agent
- **Output:** /opt/999-Agentic-Engineering-Framework/.tasks/active/T-480-macos-compat-replace-grep--op-and-var-wi.md
- **Context:** Initial task creation

### 2026-03-14T13:07:31Z — status-update [task-update-agent]
- **Change:** status: started-work → work-completed

## Reviewer Verdict (v1.5)

- **Scan ID:** R-078ef0d5
- **Timestamp:** 2026-06-02T15:03:05Z
- **Catalogue:** v1.3-seed
- **Overall:** CONCERN
- **Needs Human:** no
- **Findings:** 2

**Verification-level findings:**

  1. **l387-sigpipe-risk** (partial, heuristic) @ Verification:line 6
     - evidence: `bash -c 'echo "git version 2.53.1" | grep -oE "[0-9]+\.[0-9]+" | head -1' | grep -q '2.53'`
  2. **l387-sigpipe-risk** (partial, heuristic) @ Verification:line 7
     - evidence: `bash -c 'echo "Python 3.9.6" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"' | grep -q '3.9.6'`
