FABRIC/scripts/br-ready-wrapper.sh
jeda 57e8193f7b feat(bd-2kf): Add comprehensive test coverage for parser and store
- Add 36 parser tests covering:
  - parseLogLine with valid/invalid inputs
  - parseLogLines for multi-line parsing
  - formatEvent with all options
  - Edge cases: malformed JSON, missing fields, colorization

- Add 35 store tests covering:
  - InMemoryEventStore add/query operations
  - Worker status tracking (active/idle/error)
  - Event filtering by worker, level, bead, timestamp
  - maxEvents limit and LRU trimming
  - getStore/resetStore singleton management

- Close phase beads (bd-2pa, bd-n8l, bd-2nu) as infrastructure complete
- Close test beads (bd-5eh, bd-2en) with comprehensive coverage
- Total: 91 tests passing across parser, store, and tailer

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 10:43:24 +00:00

66 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
# br-ready-wrapper.sh
# Drop-in replacement for "br ready" that works around the schema bug.
#
# This script outputs the same format as "br ready" so it can be used as a
# direct replacement in worker scripts.
#
# Usage:
# ./scripts/br-ready-wrapper.sh # Equivalent to "br ready"
# ./scripts/br-ready-wrapper.sh --json # JSON output format
#
# To use as a permanent replacement:
# alias br-ready='./scripts/br-ready-wrapper.sh'
# # Or add to ~/.bashrc:
# export PATH="$HOME/FABRIC/scripts:$PATH"
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
JSON_OUTPUT=false
while [[ $# -gt 0 ]]; do
case $1 in
--json|-j)
JSON_OUTPUT=true
shift
;;
--help|-h)
echo "Usage: $0 [--json]"
echo "Drop-in replacement for 'br ready' command"
exit 0
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
cd "$PROJECT_ROOT"
if $JSON_OUTPUT; then
# Output as JSON array (same format as br ready --json)
br list --all --format json 2>/dev/null | jq -c '
[.[]
| select(.status == "open")
| select(.issue_type != "human" and .issue_type != "phase" and .issue_type != "epic")
| {id, title, priority, issue_type, labels, dependencies}]
'
else
# Output in tabular format (similar to br ready)
echo "ID PRI TYPE TITLE"
echo "------ --- ------ --------------------------------------------------"
br list --all --format json 2>/dev/null | jq -r '
.[]
| select(.status == "open")
| select(.issue_type != "human" and .issue_type != "phase" and .issue_type != "epic")
| "\(.id)\t\(.priority)\t\(.issue_type)\t\(.title)"
' | sort -t$'\t' -k2,2n -k1,1 | head -20 | while IFS=$'\t' read -r id pri type title; do
printf "%-7s P%-3d %-7s %s\n" "$id" "$pri" "$type" "$title"
done
echo ""
echo "To claim: br update <bead-id> --status in_progress"
fi