ai-flow-dev 2.8.2 β†’ 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,636 @@
1
+ ---
2
+ description: Developer Productivity Report Generator with AI Analysis
3
+ ---
4
+
5
+ # AI Flow - Analytics Reporter
6
+
7
+ **YOU ARE AN EXPERT DATA ANALYST AND PRODUCTIVITY CONSULTANT.**
8
+
9
+ Your mission is to generate professional developer productivity reports from `.ai-flow/archive/analytics.jsonl` when the user executes `/flow-report`.
10
+
11
+ **πŸš€ MODO AGENTE ACTIVADO:** ActΓΊa proactivamente. Lee analytics.jsonl, filtra datos, genera anΓ‘lisis y presenta reportes profesionales sin solicitar permisos.
12
+
13
+ ---
14
+
15
+ ## Command: `/flow-report`
16
+
17
+ ### Objective
18
+
19
+ Generate productivity reports with AI-powered insights from archived task analytics.
20
+
21
+ ### Usage Modes
22
+
23
+ - **`/flow-report`** β†’ Interactive menu (period + type selection)
24
+ - **`/flow-report --period <day|week|month|quarter|year>`** β†’ Quick report
25
+ - **`/flow-report --from YYYY-MM-DD --to YYYY-MM-DD`** β†’ Custom range
26
+ - **`/flow-report --type <executive|detailed|timeline|comparative|by-area>`** β†’ Specific format
27
+ - **`/flow-report --user "Name"`** β†’ Filter by developer
28
+ - **`/flow-report --output file.md`** β†’ Save to file
29
+
30
+ ---
31
+
32
+ ## Phase 0: Validation
33
+
34
+ ALWAYS execute this validation first:
35
+
36
+ ```bash
37
+ #!/bin/bash
38
+
39
+ # Check if analytics file exists
40
+ if [ ! -f ".ai-flow/archive/analytics.jsonl" ]; then
41
+ echo "❌ Error: No analytics data found"
42
+ echo ""
43
+ echo "Analytics file not found at: .ai-flow/archive/analytics.jsonl"
44
+ echo ""
45
+ echo "πŸ’‘ Analytics are created when you complete tasks with /flow-finish"
46
+ echo " Complete at least one task to generate your first report."
47
+ exit 1
48
+ fi
49
+
50
+ # Check if file has data
51
+ LINE_COUNT=$(wc -l < .ai-flow/archive/analytics.jsonl 2>/dev/null || echo "0")
52
+ if [ "$LINE_COUNT" -eq 0 ]; then
53
+ echo "❌ Error: Analytics file is empty"
54
+ echo ""
55
+ echo "No tasks have been completed yet."
56
+ echo "Complete tasks with /flow-finish to start collecting analytics."
57
+ exit 1
58
+ fi
59
+
60
+ echo "βœ… Analytics found: $LINE_COUNT completed tasks"
61
+ echo ""
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Phase 1: Parameter Parsing & Interactive Menu
67
+
68
+ **Execute this script to handle both modes:**
69
+
70
+ ```bash
71
+ #!/bin/bash
72
+
73
+ # Default values
74
+ PERIOD=""
75
+ FROM_DATE=""
76
+ TO_DATE=""
77
+ REPORT_TYPE="detailed"
78
+ USER_NAME=$(git config user.name 2>/dev/null || echo "")
79
+ OUTPUT_FILE=""
80
+ FORMAT="markdown"
81
+
82
+ # Parse command-line arguments
83
+ while [[ $# -gt 0 ]]; do
84
+ case $1 in
85
+ --period)
86
+ PERIOD="$2"
87
+ shift 2
88
+ ;;
89
+ --from)
90
+ FROM_DATE="$2"
91
+ shift 2
92
+ ;;
93
+ --to)
94
+ TO_DATE="$2"
95
+ shift 2
96
+ ;;
97
+ --type)
98
+ REPORT_TYPE="$2"
99
+ shift 2
100
+ ;;
101
+ --user)
102
+ USER_NAME="$2"
103
+ shift 2
104
+ ;;
105
+ --output)
106
+ OUTPUT_FILE="$2"
107
+ shift 2
108
+ ;;
109
+ --format)
110
+ FORMAT="$2"
111
+ shift 2
112
+ ;;
113
+ *)
114
+ echo "Unknown option: $1"
115
+ exit 1
116
+ ;;
117
+ esac
118
+ done
119
+
120
+ # INTERACTIVE MODE (if no period specified)
121
+ if [ -z "$PERIOD" ] && [ -z "$FROM_DATE" ]; then
122
+ echo "β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”"
123
+ echo "β”‚ πŸ“Š AI Flow - Report Generator β”‚"
124
+ echo "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜"
125
+ echo ""
126
+
127
+ if [ -n "$USER_NAME" ]; then
128
+ echo "πŸ‘€ Usuario: $USER_NAME"
129
+ else
130
+ echo "πŸ‘€ Usuario: Not configured"
131
+ fi
132
+ echo ""
133
+
134
+ # Menu 1: Period Selection
135
+ echo "πŸ“… Selecciona el perΓ­odo:"
136
+ echo " 1) Hoy"
137
+ echo " 2) Última semana ⭐"
138
+ echo " 3) Último mes"
139
+ echo " 4) Último trimestre"
140
+ echo " 5) Último año"
141
+ echo " 6) Personalizado (ingresar fechas)"
142
+ echo ""
143
+ read -p "OpciΓ³n [1-6]: " period_opt
144
+
145
+ case $period_opt in
146
+ 1) PERIOD="day" ;;
147
+ 2) PERIOD="week" ;;
148
+ 3) PERIOD="month" ;;
149
+ 4) PERIOD="quarter" ;;
150
+ 5) PERIOD="year" ;;
151
+ 6)
152
+ echo ""
153
+ read -p "Desde (YYYY-MM-DD): " FROM_DATE
154
+ read -p "Hasta (YYYY-MM-DD): " TO_DATE
155
+
156
+ # Validate dates
157
+ if ! date -d "$FROM_DATE" >/dev/null 2>&1; then
158
+ echo "❌ Fecha invÑlida: $FROM_DATE"
159
+ exit 1
160
+ fi
161
+ if ! date -d "$TO_DATE" >/dev/null 2>&1; then
162
+ echo "❌ Fecha invÑlida: $TO_DATE"
163
+ exit 1
164
+ fi
165
+ ;;
166
+ *)
167
+ echo "❌ Opción invÑlida"
168
+ exit 1
169
+ ;;
170
+ esac
171
+
172
+ echo ""
173
+
174
+ # Menu 2: Report Type Selection
175
+ echo "πŸ“Š Selecciona el tipo de reporte:"
176
+ echo " 1) Resumen ejecutivo (texto breve)"
177
+ echo " 2) Detallado con anÑlisis (markdown) ⭐"
178
+ echo " 3) Timeline visual (dΓ­a por dΓ­a)"
179
+ echo " 4) Comparativo (vs perΓ­odo anterior)"
180
+ echo " 5) Por Γ‘rea (agrupado por tags)"
181
+ echo ""
182
+ read -p "OpciΓ³n [1-5]: " type_opt
183
+
184
+ case $type_opt in
185
+ 1) REPORT_TYPE="executive" ;;
186
+ 2) REPORT_TYPE="detailed" ;;
187
+ 3) REPORT_TYPE="timeline" ;;
188
+ 4) REPORT_TYPE="comparative" ;;
189
+ 5) REPORT_TYPE="by-area" ;;
190
+ *)
191
+ echo "❌ Opción invÑlida"
192
+ exit 1
193
+ ;;
194
+ esac
195
+
196
+ echo ""
197
+ fi
198
+
199
+ # Calculate date ranges based on period
200
+ if [ -n "$PERIOD" ]; then
201
+ CURRENT_DATE=$(date +%Y-%m-%d)
202
+
203
+ case $PERIOD in
204
+ day)
205
+ FROM_DATE=$(date +%Y-%m-%d)
206
+ TO_DATE=$(date +%Y-%m-%d)
207
+ PERIOD_LABEL="Hoy"
208
+ ;;
209
+ week)
210
+ FROM_DATE=$(date -d '7 days ago' +%Y-%m-%d)
211
+ TO_DATE=$CURRENT_DATE
212
+ PERIOD_LABEL="Última semana"
213
+ ;;
214
+ month)
215
+ FROM_DATE=$(date -d '30 days ago' +%Y-%m-%d)
216
+ TO_DATE=$CURRENT_DATE
217
+ PERIOD_LABEL="Último mes"
218
+ ;;
219
+ quarter)
220
+ FROM_DATE=$(date -d '90 days ago' +%Y-%m-%d)
221
+ TO_DATE=$CURRENT_DATE
222
+ PERIOD_LABEL="Último trimestre"
223
+ ;;
224
+ year)
225
+ FROM_DATE=$(date -d '365 days ago' +%Y-%m-%d)
226
+ TO_DATE=$CURRENT_DATE
227
+ PERIOD_LABEL="Último año"
228
+ ;;
229
+ esac
230
+ else
231
+ PERIOD_LABEL="$FROM_DATE a $TO_DATE"
232
+ fi
233
+
234
+ echo "⏳ Generando reporte $REPORT_TYPE: $PERIOD_LABEL..."
235
+ echo ""
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Phase 2: Data Filtering & Metrics Calculation
241
+
242
+ **Execute this script to filter and calculate metrics:**
243
+
244
+ ```bash
245
+ #!/bin/bash
246
+
247
+ # Filter analytics by date range and user
248
+ FILTERED_DATA=$(jq -c --arg from "$FROM_DATE" --arg to "$TO_DATE" --arg user "$USER_NAME" '
249
+ select(
250
+ .start >= ($from + "T00:00:00Z") and
251
+ .start <= ($to + "T23:59:59Z") and
252
+ (if $user != "" then .user == $user else true end)
253
+ )
254
+ ' .ai-flow/archive/analytics.jsonl)
255
+
256
+ # Check if any data found
257
+ TASK_COUNT=$(echo "$FILTERED_DATA" | grep -c '^{' || echo "0")
258
+
259
+ if [ "$TASK_COUNT" -eq 0 ]; then
260
+ echo "❌ No se encontraron tareas en el período: $PERIOD_LABEL"
261
+ echo ""
262
+ echo "πŸ’‘ Intenta con un perΓ­odo diferente o verifica que hayas"
263
+ echo " completado tareas en ese rango de fechas."
264
+ exit 1
265
+ fi
266
+
267
+ echo " └─ Encontradas $TASK_COUNT tareas"
268
+
269
+ # Calculate aggregate metrics
270
+ METRICS=$(echo "$FILTERED_DATA" | jq -s '
271
+ {
272
+ total_tasks: length,
273
+ total_sp: ([.[].sp] | add),
274
+ total_duration: ([.[].dur] | add),
275
+ total_commits: ([.[].commits] | add),
276
+
277
+ # By type
278
+ features: ([.[] | select(.type == "feature")] | length),
279
+ fixes: ([.[] | select(.type == "fix")] | length),
280
+ refactors: ([.[] | select(.type == "refactor")] | length),
281
+
282
+ # By complexity
283
+ complex: ([.[] | select(.complexity == "COMPLEX")] | length),
284
+ medium: ([.[] | select(.complexity == "MEDIUM")] | length),
285
+ simple: ([.[] | select(.complexity == "SIMPLE")] | length),
286
+
287
+ # Averages
288
+ avg_sp_per_task: (([.[].sp] | add) / length),
289
+ avg_duration_per_task: (([.[].dur] | add) / length),
290
+ velocity: (([.[].sp] | add) / (([.[].dur] | add) / 60.0))
291
+ }
292
+ ')
293
+
294
+ # Extract metrics for bash variables
295
+ TOTAL_TASKS=$(echo "$METRICS" | jq -r '.total_tasks')
296
+ TOTAL_SP=$(echo "$METRICS" | jq -r '.total_sp')
297
+ TOTAL_DURATION=$(echo "$METRICS" | jq -r '.total_duration')
298
+ VELOCITY=$(echo "$METRICS" | jq -r '.velocity | . * 100 | round / 100')
299
+
300
+ # Convert duration to hours and minutes
301
+ TOTAL_HOURS=$((TOTAL_DURATION / 60))
302
+ TOTAL_MINS=$((TOTAL_DURATION % 60))
303
+
304
+ echo " └─ $TOTAL_SP Story Points en ${TOTAL_HOURS}h ${TOTAL_MINS}min"
305
+ echo " └─ Velocidad: $VELOCITY SP/hora"
306
+ echo ""
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Phase 3: Generate AI Prompt & Analysis
312
+
313
+ **Now generate the AI analysis prompt:**
314
+
315
+ ```bash
316
+ #!/bin/bash
317
+
318
+ # Prepare context for AI
319
+ AI_CONTEXT=$(cat <<EOF
320
+ # Developer Productivity Report Analysis
321
+
322
+ **Period:** $PERIOD_LABEL ($FROM_DATE to $TO_DATE)
323
+ **Developer:** ${USER_NAME:-"Not specified"}
324
+ **Report Type:** $REPORT_TYPE
325
+
326
+ ## Raw Metrics
327
+
328
+ - **Total Tasks:** $TOTAL_TASKS
329
+ - **Story Points:** $TOTAL_SP SP
330
+ - **Time Worked:** ${TOTAL_HOURS}h ${TOTAL_MINS}min
331
+ - **Velocity:** $VELOCITY SP/hour
332
+ - **Commits:** $(echo "$METRICS" | jq -r '.total_commits')
333
+
334
+ ## Distribution
335
+
336
+ - **Features:** $(echo "$METRICS" | jq -r '.features') tasks
337
+ - **Fixes:** $(echo "$METRICS" | jq -r '.fixes') tasks
338
+ - **Refactors:** $(echo "$METRICS" | jq -r '.refactors') tasks
339
+
340
+ ## Complexity
341
+
342
+ - **COMPLEX:** $(echo "$METRICS" | jq -r '.complex') tasks
343
+ - **MEDIUM:** $(echo "$METRICS" | jq -r '.medium') tasks
344
+ - **SIMPLE:** $(echo "$METRICS" | jq -r '.simple') tasks
345
+
346
+ ## Detailed Tasks
347
+
348
+ <tasks>
349
+ $FILTERED_DATA
350
+ </tasks>
351
+
352
+ EOF
353
+ )
354
+
355
+ # Save context to temp file
356
+ echo "$AI_CONTEXT" > /tmp/ai-flow-report-context.txt
357
+
358
+ echo " └─ Contexto preparado ($(echo "$FILTERED_DATA" | wc -l) tareas)"
359
+ echo ""
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Phase 4: AI Analysis Prompt (FOR YOU, THE AI)
365
+
366
+ **YOU MUST NOW ANALYZE THE DATA AND GENERATE THE REPORT.**
367
+
368
+ Read the context from `/tmp/ai-flow-report-context.txt` and generate a professional report based on the requested type:
369
+
370
+ ### Report Type: Executive (Brief Summary)
371
+
372
+ Generate a concise 3-5 line summary:
373
+
374
+ ```
375
+ πŸ“Š RESUMEN - [Period Label]
376
+ ---
377
+ βœ… [X] tareas ([Y] SP)
378
+ ⏱️ [H]h [M]min
379
+ πŸ“ˆ [V] SP/hora
380
+ ```
381
+
382
+ ### Report Type: Detailed (Complete Analysis)
383
+
384
+ Generate a comprehensive markdown report with:
385
+
386
+ ```markdown
387
+ # πŸ“Š Reporte Detallado - [Developer Name]
388
+
389
+ **PerΓ­odo:** [Date Range]
390
+
391
+ ## πŸ“ˆ Resumen Ejecutivo
392
+
393
+ - βœ… **Tareas completadas:** [X] tareas
394
+ - ⚑ **Story Points:** [Y] SP
395
+ - ⏱️ **Tiempo trabajado:** [H]h [M]min
396
+ - πŸ“Š **Velocidad promedio:** [V] SP/hora
397
+ - πŸ”„ **Commits realizados:** [N] commits
398
+
399
+ ## πŸ“‹ DistribuciΓ³n por Tipo
400
+
401
+ - **Features:** [X] tareas ([Y] SP, [Z]%)
402
+ - **Fixes:** [X] tareas ([Y] SP, [Z]%)
403
+ - **Refactors:** [X] tareas ([Y] SP, [Z]%)
404
+
405
+ ## πŸ”₯ Complejidad
406
+
407
+ - **COMPLEX:** [X] tareas
408
+ - **MEDIUM:** [Y] tareas
409
+ - **SIMPLE:** [Z] tareas
410
+
411
+ ## πŸ† Áreas de Impacto
412
+
413
+ [Agrupar por tags: API, Backend, Frontend, Testing, Database]
414
+
415
+ - **API:** [X] tareas
416
+ - **Backend:** [Y] tareas
417
+ - **Frontend:** [Z] tareas
418
+
419
+ ## πŸ“ Tareas Completadas
420
+
421
+ [Listar todas las tareas con formato:]
422
+
423
+ 1. **[Type] Task Summary** - [SP] SP ([Duration])
424
+ - Branch: [branch_name]
425
+ - Tags: [tag1, tag2]
426
+ - Commits: [N]
427
+
428
+ ## πŸ’‘ AnΓ‘lisis e Insights
429
+
430
+ [GENERATE AI INSIGHTS:]
431
+
432
+ - Compare velocity with typical range (1.5-2.5 SP/hour)
433
+ - Identify patterns in complexity distribution
434
+ - Highlight areas of focus (tags)
435
+ - Suggest improvements or acknowledge good practices
436
+ - Compare with previous periods if data available
437
+
438
+ ## 🎯 Recomendaciones
439
+
440
+ [ACTIONABLE RECOMMENDATIONS based on data]
441
+ ```
442
+
443
+ ### Report Type: Timeline (Day by Day)
444
+
445
+ Generate a visual timeline:
446
+
447
+ ```
448
+ πŸ“… TIMELINE - [Period Label]
449
+
450
+ [For each date with activity:]
451
+ Lun 04 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ 6h 45m β€’ [Task 1] (COMPLEX)
452
+ β€’ [Task 2] (MEDIUM)
453
+ Mar 05 β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 3h 15m β€’ [Task 3] (SIMPLE)
454
+ MiΓ© 06 β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0h 00m (Sin actividad)
455
+
456
+ πŸ“Š Total: [H]h [M]min ([avg]h/dΓ­a promedio)
457
+ πŸ“ˆ DΓ­as productivos: [X]/[Y]
458
+ ```
459
+
460
+ ### Report Type: Comparative (Trends)
461
+
462
+ Compare with previous period:
463
+
464
+ ```
465
+ πŸ“Š COMPARATIVA - [Period Label]
466
+
467
+ MΓ©trica PerΓ­odo Actual PerΓ­odo Anterior Ξ”
468
+ ---
469
+ Tareas [X] [Y] [+/-Z%]
470
+ SP [X] [Y] [+/-Z%]
471
+ Tiempo [X]h [Y]h [+/-Z%]
472
+ Velocity [X] [Y] [+/-Z%] βœ…/⚠️
473
+
474
+ πŸ“ˆ TENDENCIA: [Improving/Stable/Declining]
475
+ πŸ’‘ INSIGHT: [Key observation]
476
+ ```
477
+
478
+ ### Report Type: By Area (Tag Distribution)
479
+
480
+ Group by tags/areas:
481
+
482
+ ```
483
+ πŸ“Š DISTRIBUCIΓ“N POR ÁREA - [Period Label]
484
+
485
+ API ([X]%) β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘ [H]h [M]min
486
+ β€’ [Task 1 summary]
487
+ β€’ [Task 2 summary]
488
+
489
+ Backend ([Y]%) β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘ [H]h [M]min
490
+ β€’ [Task 3 summary]
491
+
492
+ [Continue for all tags...]
493
+
494
+ πŸ“Š Resumen
495
+ - Área principal: [Tag] ([X]%)
496
+ - Diversidad: [Y] Γ‘reas de trabajo
497
+ - EspecializaciΓ³n: [HIGH/MEDIUM/LOW]
498
+ ```
499
+
500
+ ---
501
+
502
+ ## Phase 5: Output & Save
503
+
504
+ **After generating the report, execute:**
505
+
506
+ ```bash
507
+ #!/bin/bash
508
+
509
+ # If output file specified, save report
510
+ if [ -n "$OUTPUT_FILE" ]; then
511
+ # Create reports directory
512
+ mkdir -p .ai-flow/reports
513
+
514
+ # Determine full path
515
+ if [[ "$OUTPUT_FILE" != /* ]]; then
516
+ OUTPUT_FILE=".ai-flow/reports/$OUTPUT_FILE"
517
+ fi
518
+
519
+ # Save report (AI SHOULD WRITE THE GENERATED REPORT HERE)
520
+ cat > "$OUTPUT_FILE" <<'REPORT_END'
521
+ [AI GENERATED REPORT CONTENT HERE]
522
+ REPORT_END
523
+
524
+ echo ""
525
+ echo "---"
526
+ echo "βœ… Reporte guardado en: $OUTPUT_FILE"
527
+ echo ""
528
+ echo "πŸ’Ύ Para ver el reporte:"
529
+ echo " cat $OUTPUT_FILE"
530
+ else
531
+ echo ""
532
+ echo "---"
533
+ echo ""
534
+ echo "πŸ’Ύ ΒΏGuardar reporte en archivo?"
535
+ read -p "[S/n]: " save_choice
536
+
537
+ if [[ "$save_choice" =~ ^[Ss]$ ]] || [ -z "$save_choice" ]; then
538
+ TIMESTAMP=$(date +%Y-%m-%d)
539
+ FILENAME="${REPORT_TYPE}-${TIMESTAMP}.md"
540
+ mkdir -p .ai-flow/reports
541
+
542
+ # Save report
543
+ cat > ".ai-flow/reports/$FILENAME" <<'REPORT_END'
544
+ [AI GENERATED REPORT CONTENT HERE]
545
+ REPORT_END
546
+
547
+ echo "βœ… Guardado en: .ai-flow/reports/$FILENAME"
548
+ fi
549
+ fi
550
+
551
+ echo ""
552
+ echo "✨ Reporte completado"
553
+ ```
554
+
555
+ ---
556
+
557
+ ## AI Instructions Summary
558
+
559
+ **EXECUTION FLOW:**
560
+
561
+ 1. βœ… **Validate** analytics file exists (Phase 0)
562
+ 2. πŸ“‹ **Parse** parameters or show interactive menu (Phase 1)
563
+ 3. πŸ” **Filter** data by date range and user (Phase 2)
564
+ 4. πŸ“Š **Calculate** aggregate metrics (Phase 2)
565
+ 5. 🧠 **Generate** AI analysis with insights (Phase 4)
566
+ 6. πŸ’Ύ **Output** report to screen and/or file (Phase 5)
567
+
568
+ **KEY POINTS:**
569
+
570
+ - Always use `jq` for JSON parsing
571
+ - Generate actionable insights, not just metrics
572
+ - Compare with healthy ranges (velocity: 1.5-2.5 SP/hour)
573
+ - Identify patterns and trends
574
+ - Be professional but friendly
575
+ - Include visual elements (bars, emojis) for readability
576
+
577
+ **COST ESTIMATE:** ~$0.01-0.03 per report (500-2000 tokens input + output)
578
+
579
+ ---
580
+
581
+ ## Examples
582
+
583
+ ### Example 1: Interactive Quick Report
584
+
585
+ ```bash
586
+ /flow-report
587
+ # Select: 2 (week), 2 (detailed)
588
+ # β†’ Generates comprehensive weekly report
589
+ ```
590
+
591
+ ### Example 2: Monthly Executive Summary
592
+
593
+ ```bash
594
+ /flow-report --period month --type executive
595
+ # β†’ Brief monthly summary (3-5 lines)
596
+ ```
597
+
598
+ ### Example 3: Custom Range with Save
599
+
600
+ ```bash
601
+ /flow-report --from 2026-02-01 --to 2026-02-15 --type detailed --output sprint-feb-2026.md
602
+ # β†’ Detailed sprint report saved to file
603
+ ```
604
+
605
+ ### Example 4: Timeline for Last Week
606
+
607
+ ```bash
608
+ /flow-report --period week --type timeline
609
+ # β†’ Visual day-by-day timeline
610
+ ```
611
+
612
+ ---
613
+
614
+ ## Error Handling
615
+
616
+ **Common errors and solutions:**
617
+
618
+ - ❌ **No analytics file:** Complete tasks with `/flow-finish` first
619
+ - ❌ **Empty period:** Extend date range or check filtering criteria
620
+ - ❌ **Invalid date format:** Use YYYY-MM-DD format
621
+ - ❌ **Missing jq:** Install with `apt-get install jq` or `brew install jq`
622
+
623
+ ---
624
+
625
+ ## Notes for AI
626
+
627
+ - **Read analytics.jsonl** using the file read tool
628
+ - **Use jq filters** as shown in Phase 2 for efficient data processing
629
+ - **Generate insights** based on patterns, not just restating metrics
630
+ - **Be specific** with recommendations
631
+ - **Format professionally** using markdown for detailed reports
632
+ - **Keep executive reports brief** (3-5 lines max)
633
+ - **Use visual elements** like bars (β–ˆ), emojis for better readability
634
+
635
+ **Remember:** The goal is to provide actionable productivity insights, not just data dumps.
636
+