Debian Codegraph @

.claude/todo/track-progress.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Progress tracking script for ExaBGP testing implementation
3 # Usage: ./track-progress.sh [command]
4
5 set -e
6
7 PROGRESS_FILE=".claude/todo/PROGRESS.md"
8 TODO_DIR=".claude/todo"
9
10 # Colors for output
11 GREEN='\033[0;32m'
12 YELLOW='\033[1;33m'
13 RED='\033[0;31m'
14 BLUE='\033[0;34m'
15 NC='\033[0m' # No Color
16
17 # Function to count completed tasks in a file
18 count_completed_tasksscip-shell shell exabgp 5.0.8-1 count_completed_tasks().() {
19 local file=$1
20 if [scip-shell system . . `[`. ! -f "$file" ]; then
21 echoscip-shell system . . echo. "0/0"
22 return
23 fi
24
25 local total=$(grepscip-shell system . . grep. -c "^- \[ \]" "$file" 2>/dev/nullscip-shell filesystem . . `/dev/null`. || echoscip-shell system . . echo. "0")
26 local completed=$(grepscip-shell system . . grep. -c "^- \[x\]" "$file" 2>/dev/nullscip-shell filesystem . . `/dev/null`. || echoscip-shell system . . echo. "0")
27 echoscip-shell system . . echo. "$completed/$total"
28 }
29
30 # Function to show overall progress
31 show_progressscip-shell shell exabgp 5.0.8-1 show_progress().() {
32 echoscip-shell system . . echo. -e "${BLUE}=== ExaBGP Testing Implementation Progress ===${NC}\n"
33
34 # Phase 0
35 local p0=$(count_completed_tasksscip-shell shell exabgp 5.0.8-1 count_completed_tasks(). "$TODO_DIR/00-SETUP-FOUNDATION.md")
36 echoscip-shell system . . echo. -e "${YELLOW}Phase 0: Foundation Setup${NC}"
37 echoscip-shell system . . echo. -e " File: 00-SETUP-FOUNDATION.md"
38 echoscip-shell system . . echo. -e " Progress: $p0"
39 echoscip-shell system . . echo. ""
40
41 # Phase 1.1
42 local p1_1=$(count_completed_tasksscip-shell shell exabgp 5.0.8-1 count_completed_tasks(). "$TODO_DIR/01-FUZZ-MESSAGE-HEADER.md")
43 echoscip-shell system . . echo. -e "${YELLOW}Phase 1.1: Message Header Fuzzing${NC}"
44 echoscip-shell system . . echo. -e " File: 01-FUZZ-MESSAGE-HEADER.md"
45 echoscip-shell system . . echo. -e " Progress: $p1_1"
46 echoscip-shell system . . echo. ""
47
48 # Phase 1.2
49 local p1_2=$(count_completed_tasksscip-shell shell exabgp 5.0.8-1 count_completed_tasks(). "$TODO_DIR/02-FUZZ-UPDATE-MESSAGE.md")
50 echoscip-shell system . . echo. -e "${YELLOW}Phase 1.2: UPDATE Message Fuzzing${NC}"
51 echoscip-shell system . . echo. -e " File: 02-FUZZ-UPDATE-MESSAGE.md"
52 echoscip-shell system . . echo. -e " Progress: $p1_2"
53 echoscip-shell system . . echo. ""
54
55 # Phase 1.3
56 local p1_3=$(count_completed_tasksscip-shell shell exabgp 5.0.8-1 count_completed_tasks(). "$TODO_DIR/03-FUZZ-ATTRIBUTES.md")
57 echoscip-shell system . . echo. -e "${YELLOW}Phase 1.3: Attributes Fuzzing${NC}"
58 echoscip-shell system . . echo. -e " File: 03-FUZZ-ATTRIBUTES.md"
59 echoscip-shell system . . echo. -e " Progress: $p1_3"
60 echoscip-shell system . . echo. ""
61
62 # Test statistics
63 echoscip-shell system . . echo. -e "${BLUE}=== Test Statistics ===${NC}\n"
64
65 if [scip-shell system . . `[`. -d "tests" ]; then
66 local test_files=$(findscip-shell system . . find. tests -name "*_test.py" -o -name "fuzz_*.py" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)
67 echoscip-shell system . . echo. -e "Test files: ${GREEN}$test_files${NC}"
68
69 local fuzz_files=$(findscip-shell system . . find. tests/fuzz -name "*.py" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)
70 echoscip-shell system . . echo. -e "Fuzzing test files: ${GREEN}$fuzz_files${NC}"
71
72 local test_lines=$(findscip-shell system . . find. tests -name "*.py" -exec wc -l {} + 2>/dev/nullscip-shell filesystem . . `/dev/null`. | tailscip-shell system . . tail. -1 | awkscip-shell system . . awk. '{print $1}')
73 echoscip-shell system . . echo. -e "Test code lines: ${GREEN}$test_lines${NC}"
74 else
75 echoscip-shell system . . echo. -e "${YELLOW}Tests directory not found${NC}"
76 fi
77 echoscip-shell system . . echo. ""
78 }
79
80 # Function to show current coverage
81 show_coveragescip-shell shell exabgp 5.0.8-1 show_coverage().() {
82 echoscip-shell system . . echo. -e "${BLUE}=== Current Test Coverage ===${NC}\n"
83
84 if [scip-shell system . . `[`. ! -d "src" ]; then
85 echoscip-shell system . . echo. -e "${RED}Source directory not found${NC}"
86 return
87 fi
88
89 if ! command -v pytest &> /dev/nullscip-shell filesystem . . `/dev/null`.; then
90 echoscip-shell system . . echo. -e "${YELLOW}pytest not installed${NC}"
91 return
92 fi
93
94 echoscip-shell system . . echo. "Running coverage analysis..."
95 envscip-shell system . . env. PYTHONPATH=src pytest --cov=exabgp --cov-report=term-missing --quiet 2>/dev/nullscip-shell filesystem . . `/dev/null`. || {
96 echoscip-shell system . . echo. -e "${YELLOW}Coverage analysis failed (tests may not be set up yet)${NC}"
97 }
98 }
99
100 # Function to mark a task as complete
101 mark_completescip-shell shell exabgp 5.0.8-1 mark_complete().() {
102 local phase=$1
103 local task=$2
104
105 if [scip-shell system . . `[`. -z "$phase" ] || [scip-shell system . . `[`. -z "$task" ]; then
106 echoscip-shell system . . echo. -e "${RED}Usage: $0 complete <phase-file> <task-number>${NC}"
107 echoscip-shell system . . echo. "Example: $0 complete 00-SETUP-FOUNDATION.md 0.1"
108 return 1
109 fi
110
111 local file="$TODO_DIR/$phase"
112 if [scip-shell system . . `[`. ! -f "$file" ]; then
113 echoscip-shell system . . echo. -e "${RED}File not found: $file${NC}"
114 return 1
115 fi
116
117 # Use sed to replace [ ] with [x] for specific task
118 # This is a simple implementation - may need refinement
119 echoscip-shell system . . echo. -e "${YELLOW}Marking task $task as complete in $phase${NC}"
120 echoscip-shell system . . echo. -e "${YELLOW}Please manually edit the file to mark tasks complete${NC}"
121 }
122
123 # Function to show next steps
124 show_nextscip-shell shell exabgp 5.0.8-1 show_next().() {
125 echoscip-shell system . . echo. -e "${BLUE}=== Next Steps ===${NC}\n"
126
127 # Find first uncompleted task in each phase
128 for file in "$TODO_DIR"/*.md; do
129 if [[ "$file" == *"README.md" ]] || [[ "$file" == *"PROGRESS.md" ]]; then
130 continue
131 fi
132
133 local first_incomplete=$(grepscip-shell system . . grep. -n "^- \[ \]" "$file" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | headscip-shell system . . head. -1)
134 if [scip-shell system . . `[`. -n "$first_incomplete" ]; then
135 local line_num=$(echoscip-shell system . . echo. "$first_incomplete" | cutscip-shell system . . cut. -d: -f1)
136 local task=$(echoscip-shell system . . echo. "$first_incomplete" | cutscip-shell system . . cut. -d: -f2-)
137 local filename=$(basenamescip-shell system . . basename. "$file")
138 echoscip-shell system . . echo. -e "${YELLOW}$filename${NC}"
139 echoscip-shell system . . echo. -e " Next: $task"
140 echoscip-shell system . . echo. ""
141 fi
142 done
143 }
144
145 # Function to generate progress report
146 generate_reportscip-shell shell exabgp 5.0.8-1 generate_report().() {
147 echoscip-shell system . . echo. -e "${BLUE}=== Progress Report ===${NC}\n"
148 echoscip-shell system . . echo. "Generated: $(datescip-shell system . . date.)"
149 echoscip-shell system . . echo. ""
150
151 show_progressscip-shell shell exabgp 5.0.8-1 show_progress().
152 echoscip-shell system . . echo. ""
153 show_nextscip-shell shell exabgp 5.0.8-1 show_next().
154 }
155
156 # Function to update PROGRESS.md with current stats
157 update_progress_filescip-shell shell exabgp 5.0.8-1 update_progress_file().() {
158 echoscip-shell system . . echo. -e "${BLUE}Updating PROGRESS.md...${NC}"
159
160 # Update last updated date
161 sedscip-shell system . . sed. -i "s/\*\*Last Updated\*\*:.*/\*\*Last Updated\*\*: $(datescip-shell system . . date. '+%Y-%m-%d %H:%M')/" "$PROGRESS_FILE"
162
163 echoscip-shell system . . echo. -e "${GREEN}PROGRESS.md updated. Please manually update task completions.${NC}"
164 }
165
166 # Main command dispatcher
167 case "${1:-}" in
168 "show"|"")
169 show_progressscip-shell shell exabgp 5.0.8-1 show_progress().
170 ;;
171 "coverage")
172 show_coveragescip-shell shell exabgp 5.0.8-1 show_coverage().
173 ;;
174 "next")
175 show_nextscip-shell shell exabgp 5.0.8-1 show_next().
176 ;;
177 "report")
178 generate_reportscip-shell shell exabgp 5.0.8-1 generate_report().
179 ;;
180 "update")
181 update_progress_filescip-shell shell exabgp 5.0.8-1 update_progress_file().
182 ;;
183 "complete")
184 mark_completescip-shell shell exabgp 5.0.8-1 mark_complete(). "$2" "$3"
185 ;;
186 "help")
187 echoscip-shell system . . echo. "ExaBGP Testing Progress Tracker"
188 echoscip-shell system . . echo. ""
189 echoscip-shell system . . echo. "Usage: $0 [command]"
190 echoscip-shell system . . echo. ""
191 echoscip-shell system . . echo. "Commands:"
192 echoscip-shell system . . echo. " show - Show current progress (default)"
193 echoscip-shell system . . echo. " coverage - Run and display test coverage"
194 echoscip-shell system . . echo. " next - Show next tasks to work on"
195 echoscip-shell system . . echo. " report - Generate full progress report"
196 echoscip-shell system . . echo. " update - Update PROGRESS.md timestamp"
197 echoscip-shell system . . echo. " help - Show this help message"
198 echoscip-shell system . . echo. ""
199 echoscip-shell system . . echo. "Examples:"
200 echoscip-shell system . . echo. " $0 # Show progress"
201 echoscip-shell system . . echo. " $0 coverage # Show coverage"
202 echoscip-shell system . . echo. " $0 next # Show next tasks"
203 ;;
204 *)
205 echoscip-shell system . . echo. -e "${RED}Unknown command: $1${NC}"
206 echoscip-shell system . . echo. "Use '$0 help' for usage information"
207 exit 1
208 ;;
209 esac