@@ -111,7 +111,7 @@ echo "=== Skill Monitor: Directory Checks ==="
111111
112112setup_test_env
113113output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
114- if [[ $rc -ne 0 ]] && echo " $output " | grep -q " directory not found" ; then
114+ if [[ $rc -ne 0 ]] && grep -q " directory not found" <<< " $output " ; then
115115 pass " Returns error when .humanize/skill does not exist"
116116else
117117 fail " Should error when skill dir missing" " got: $output "
@@ -126,7 +126,7 @@ echo "=== Skill Monitor: Empty Directory ==="
126126setup_test_env
127127mkdir -p .humanize/skill
128128output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
129- if [[ $rc -ne 0 ]] && echo " $output " | grep -q " No skill invocations found" ; then
129+ if [[ $rc -ne 0 ]] && grep -q " No skill invocations found" <<< " $output " ; then
130130 pass " Returns error when no invocations exist"
131131else
132132 fail " Should error when no invocations" " got: $output "
@@ -149,43 +149,43 @@ else
149149 fail " --once mode should succeed" " exit code: $rc "
150150fi
151151
152- if echo " $output " | grep -q " Total Invocations: 1" ; then
152+ if grep -q " Total Invocations: 1" <<< " $output " ; then
153153 pass " Shows total invocation count"
154154else
155155 fail " Should show total count" " got: $output "
156156fi
157157
158- if echo " $output " | grep -q " Success: 1" ; then
158+ if grep -q " Success: 1" <<< " $output " ; then
159159 pass " Shows success count"
160160else
161161 fail " Should show success count" " got: $output "
162162fi
163163
164- if echo " $output " | grep -q " success" ; then
164+ if grep -q " success" <<< " $output " ; then
165165 pass " Shows success status for focused invocation"
166166else
167167 fail " Should show success status" " got: $output "
168168fi
169169
170- if echo " $output " | grep -q " gpt-5.4" ; then
170+ if grep -q " gpt-5.4" <<< " $output " ; then
171171 pass " Shows model name"
172172else
173173 fail " Should show model" " got: $output "
174174fi
175175
176- if echo " $output " | grep -q " 15s" ; then
176+ if grep -q " 15s" <<< " $output " ; then
177177 pass " Shows duration"
178178else
179179 fail " Should show duration" " got: $output "
180180fi
181181
182- if echo " $output " | grep -q " How should I structure the auth module" ; then
182+ if grep -q " How should I structure the auth module" <<< " $output " ; then
183183 pass " Shows question text"
184184else
185185 fail " Should show question" " got: $output "
186186fi
187187
188- if echo " $output " | grep -q " This is the response" ; then
188+ if grep -q " This is the response" <<< " $output " ; then
189189 pass " Shows output content"
190190else
191191 fail " Should show output" " got: $output "
@@ -205,38 +205,38 @@ create_skill_invocation "2026-02-19_21-00-00-333-ccc" "timeout" "gpt-5.4" "high"
205205create_skill_invocation " 2026-02-19_21-30-00-444-ddd" " success" " gpt-5.4" " high" " 20s" " Latest question"
206206
207207output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
208- if echo " $output " | grep -q " Total Invocations: 4" ; then
208+ if grep -q " Total Invocations: 4" <<< " $output " ; then
209209 pass " Counts all invocations"
210210else
211211 fail " Should count all invocations" " got: $( echo " $output " | grep ' Total' ) "
212212fi
213213
214- if echo " $output " | grep -q " Success: 2" ; then
214+ if grep -q " Success: 2" <<< " $output " ; then
215215 pass " Counts success invocations"
216216else
217217 fail " Should count 2 successes" " got: $( echo " $output " | grep ' Success' ) "
218218fi
219219
220- if echo " $output " | grep -q " Error: 1" ; then
220+ if grep -q " Error: 1" <<< " $output " ; then
221221 pass " Counts error invocations"
222222else
223223 fail " Should count 1 error" " got: $( echo " $output " | grep ' Error' ) "
224224fi
225225
226- if echo " $output " | grep -q " Timeout: 1" ; then
226+ if grep -q " Timeout: 1" <<< " $output " ; then
227227 pass " Counts timeout invocations"
228228else
229229 fail " Should count 1 timeout" " got: $( echo " $output " | grep ' Timeout' ) "
230230fi
231231
232232# Latest should be the newest (2026-02-19_21-30-00)
233- if echo " $output " | grep " Focused: " | grep -q " 2026-02-19_21-30-00" ; then
233+ if grep " Focused: " <<< " $output " | grep -q " 2026-02-19_21-30-00" ; then
234234 pass " Shows the most recent invocation with content as focused"
235235else
236236 fail " Should show newest with content as focused" " got: $( echo " $output " | grep ' Focused:' ) "
237237fi
238238
239- if echo " $output " | grep -q " Latest question" ; then
239+ if grep -q " Latest question" <<< " $output " ; then
240240 pass " Shows question from latest invocation"
241241else
242242 fail " Should show latest question" " got: $output "
@@ -254,13 +254,13 @@ create_skill_invocation "2026-02-19_21-00-00-111-aaa" "success" "gpt-5.4" "high"
254254create_skill_invocation " 2026-02-19_21-30-00-222-bbb" " running" " gpt-5.4" " high" " " " Running question"
255255
256256output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
257- if echo " $output " | grep -q " Running: 1" ; then
257+ if grep -q " Running: 1" <<< " $output " ; then
258258 pass " Counts running invocations"
259259else
260260 fail " Should count 1 running" " got: $( echo " $output " | grep ' Running' ) "
261261fi
262262
263- if echo " $output " | grep -q " running" ; then
263+ if grep -q " running" <<< " $output " ; then
264264 pass " Shows running status for focused invocation"
265265else
266266 fail " Should show running status" " got: $output "
@@ -279,14 +279,14 @@ create_skill_invocation "2026-02-19_20-30-00-222-bbb" "error" "gpt-5.4" "high" "
279279create_skill_invocation " 2026-02-19_21-00-00-333-ccc" " success" " gpt-5.4" " high" " 20s" " Question three"
280280
281281output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
282- if echo " $output " | grep -q " Recent Invocations" ; then
282+ if grep -q " Recent Invocations" <<< " $output " ; then
283283 pass " Shows recent invocations section"
284284else
285285 fail " Should show recent section" " got: $output "
286286fi
287287
288288# Check that invocations appear in the output
289- if echo " $output " | grep -q " 2026-02-19_21-00-00-333-ccc" ; then
289+ if grep -q " 2026-02-19_21-00-00-333-ccc" <<< " $output " ; then
290290 pass " Lists invocations in recent section"
291291else
292292 fail " Should list invocations" " got: $( echo " $output " | grep ' 2026-02-19' ) "
@@ -332,14 +332,14 @@ EOF
332332echo " Performance analysis result" > " $local_dir /output.md"
333333
334334output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
335- if echo " $output " | grep -q " What are the performance bottlenecks" ; then
335+ if grep -q " What are the performance bottlenecks" <<< " $output " ; then
336336 pass " Extracts first line of question"
337337else
338338 fail " Should extract question first line" " got: $output "
339339fi
340340
341341# Should NOT contain the second line
342- if ! echo " $output " | grep -q " Additional context" ; then
342+ if ! grep -q " Additional context" <<< " $output " ; then
343343 pass " Does not include subsequent lines from question"
344344else
345345 fail " Should only show first line" " got: $output "
@@ -356,13 +356,13 @@ mkdir -p .humanize/skill
356356create_skill_invocation " 2026-02-19_21-00-00-111-aaa" " empty_response" " gpt-5.4" " high" " 30s" " Why is the sky blue?"
357357
358358output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
359- if echo " $output " | grep -q " Empty: 1" ; then
359+ if grep -q " Empty: 1" <<< " $output " ; then
360360 pass " Counts empty response invocations"
361361else
362362 fail " Should count 1 empty" " got: $( echo " $output " | grep ' Empty' ) "
363363fi
364364
365- if echo " $output " | grep -q " No output available" ; then
365+ if grep -q " No output available" <<< " $output " ; then
366366 pass " Shows no output message for empty response"
367367else
368368 fail " Should show no output message" " got: $output "
@@ -382,7 +382,7 @@ mkdir -p ".humanize/skill/not-a-skill-dir"
382382echo " junk" > " .humanize/skill/not-a-skill-dir/input.md"
383383
384384output=$( _humanize_monitor_skill --once 2>&1 ) && rc=0 || rc=$?
385- if echo " $output " | grep -q " Total Invocations: 1" ; then
385+ if grep -q " Total Invocations: 1" <<< " $output " ; then
386386 pass " Ignores non-timestamp directories"
387387else
388388 fail " Should only count valid skill dirs" " got: $( echo " $output " | grep ' Total' ) "
0 commit comments