diff --git a/docs/commit-message-template.md b/docs/commit-message-template.md new file mode 100644 index 00000000..0d39e40b --- /dev/null +++ b/docs/commit-message-template.md @@ -0,0 +1,140 @@ +# TimeSafari Commit Message Template with Time Tracking + +## Migration Commit Template + +``` +[Component]: Complete Enhanced Triple Migration Pattern (X minutes) + +Database Migration: Replace databaseUtil with PlatformServiceMixin +SQL Abstraction: Use $contacts(), $settings(), $platformService methods +Notification Migration: Add X constants, migrate X $notify calls to helpers +Template Optimization: Extract X computed properties, reduce complexity + +Time: X minutes | Complexity: [Simple/Medium/Complex] | Issues: [None/List] +Testing: [Manual/Automated/Required] | Validation: [Script passed/Manual check] +``` + +## Real Examples from Recent Work + +### PhotoDialog + OfferDialog (58 minutes each) +``` +Complete Enhanced Triple Migration Pattern for PhotoDialog and OfferDialog (116 minutes) + +Database Migration: Replace databaseUtil with PlatformServiceMixin +SQL Abstraction: Use $accountSettings() for settings retrieval +Notification Migration: Add 15 constants, migrate 15 $notify calls to helpers +Template Optimization: Extract 11 computed properties, reduce template complexity + +Time: 116 minutes | Complexity: Medium | Issues: None +Testing: Manual | Validation: Script passed +``` + +### ProjectsView (17 minutes) +``` +Complete ProjectsView Triple Migration Pattern with literal extraction (17 minutes) + +Database Migration: Replace databaseUtil with PlatformServiceMixin +SQL Abstraction: Use $contacts(), $projects() methods +Notification Migration: Add 1 constant, migrate 1 $notify call +Template Optimization: Extract 3 computed properties + +Time: 17 minutes | Complexity: Simple | Issues: None +Testing: Automated | Validation: Script passed +``` + +## Batch Migration Template + +``` +Complete notification migration across X components (Y minutes) + +Components: [List of components] +- Add X centralized notification constants +- Migrate X $notify calls to helper methods +- Standardize timeout usage with TIMEOUTS constants + +Time: Y minutes | Avg per component: Z minutes | Complexity: Batch +Testing: Automated | Validation: Script passed +``` + +## Time Tracking Workflow + +### 1. Start Migration +```bash +./scripts/time-migration.sh ComponentName.vue start +``` + +### 2. Complete Migration +```bash +./scripts/time-migration.sh ComponentName.vue end +``` + +### 3. Daily Summary +```bash +./scripts/daily-migration-summary.sh +``` + +### 4. Commit with Time Data +```bash +git commit -m "Complete ComponentName migration (X minutes) + +Database Migration: Replace databaseUtil with PlatformServiceMixin +Notification Migration: Add X constants, migrate X $notify calls +Template Optimization: Extract X computed properties + +Time: X minutes | Complexity: [Level] | Issues: [None/List] +Testing: [Status] | Validation: [Status]" +``` + +## Time Complexity Guidelines + +### Simple Components (15-20 minutes) +- Dialog components with minimal database operations +- Utility components with few notifications +- Example: UserNameDialog, TopMessage + +### Medium Components (30-45 minutes) +- Standard view components with moderate database usage +- Multiple notification patterns +- Example: ProjectsView, ContactsView + +### Complex Components (45-60 minutes) +- Large view components with extensive database operations +- Many notification patterns and complex templates +- Example: PhotoDialog, OfferDialog, ConfirmGiftView + +## Performance Tracking + +### Daily Targets +- **Simple Components**: 20+ per day +- **Medium Components**: 8-12 per day +- **Complex Components**: 4-8 per day + +### Weekly Targets +- **Week 1**: 25 components (mix of simple/medium) +- **Week 2**: 30 components (focus on complex) +- **Week 3**: 37 components (remaining) + +### Quality Gates +- [ ] Start time logged +- [ ] End time logged +- [ ] Validation script passed +- [ ] Linting passed +- [ ] Commit includes time data +- [ ] Daily summary updated + +## Efficiency Tips + +### Batch Processing +- Group similar components +- Reuse notification constants +- Copy/paste helper patterns + +### Templates and Automation +- Use migration checklist +- Standardize computed property patterns +- Validate with scripts + +### Time Savers +- Keep validation script running +- Use IDE snippets for common patterns +- Track blockers immediately \ No newline at end of file diff --git a/docs/migration-templates/COMPLETE_MIGRATION_CHECKLIST.md b/docs/migration-templates/COMPLETE_MIGRATION_CHECKLIST.md index c5f1a342..dee1326f 100644 --- a/docs/migration-templates/COMPLETE_MIGRATION_CHECKLIST.md +++ b/docs/migration-templates/COMPLETE_MIGRATION_CHECKLIST.md @@ -3,6 +3,8 @@ ## Overview This checklist ensures NO migration steps are forgotten. **Every component migration MUST complete ALL sections.** +## ⏱️ **TIME TRACKING REQUIREMENT**: All migrations must be timed and performance recorded + ## ⚠️ CRITICAL: Enhanced Triple Migration Pattern ### 🔑 The Complete Pattern (ALL 4 REQUIRED) @@ -16,12 +18,23 @@ This checklist ensures NO migration steps are forgotten. **Every component migra ## Pre-Migration Assessment +### [ ] 0. Start Time Tracking +- [ ] **MANDATORY**: Run `./scripts/time-migration.sh [ComponentName.vue] start` +- [ ] Record start time in terminal output +- [ ] Keep terminal open for entire migration process + +### [ ] 1. Component Complexity Assessment +- [ ] **Simple** (15-20 min): Dialog components, minimal DB operations, few notifications +- [ ] **Medium** (30-45 min): Standard views, moderate DB usage, multiple notifications +- [ ] **Complex** (45-60 min): Large views, extensive DB operations, many notifications +- [ ] Document complexity level for performance tracking + ### Date Time Context - [ ] Always use system date command to establish accurate time context - [ ] Use time log to track project progress - [ ] Use historical time durations to improve estimates -### [ ] 1. Identify Legacy Patterns +### [ ] 2. Identify Legacy Patterns - [ ] Count `databaseUtil` imports and calls - [ ] Count raw SQL queries (`SELECT`, `INSERT`, `UPDATE`, `DELETE`) - [ ] Count `$notify()` calls @@ -29,32 +42,32 @@ This checklist ensures NO migration steps are forgotten. **Every component migra - [ ] Identify template complexity patterns (repeated expressions, long class strings) - [ ] Document total issues found -### [ ] 2. Verify PlatformServiceMixin Setup +### [ ] 3. Verify PlatformServiceMixin Setup - [ ] Component already imports `PlatformServiceMixin` - [ ] Component already has `mixins: [PlatformServiceMixin]` - [ ] If missing, add mixin first ## Phase 1: Database Migration -### [ ] 3. Replace Database Utility Calls +### [ ] 4. Replace Database Utility Calls - [ ] Remove `import * as databaseUtil from "../db/databaseUtil"` - [ ] Replace `databaseUtil.retrieveSettingsForActiveAccount()` → `this.$accountSettings()` - [ ] Replace `databaseUtil.mapQueryResultToValues()` → `this.$mapQueryResultToValues()` - [ ] Replace other `databaseUtil.*` calls with mixin equivalents -### [ ] 4. Replace Logging Calls +### [ ] 5. Replace Logging Calls - [ ] Remove `import { logConsoleAndDb } from "../db/index"` - [ ] Replace `logConsoleAndDb()` → `this.$logAndConsole()` ## Phase 2: SQL Abstraction Migration -### [ ] 5. Replace Raw Contact Operations +### [ ] 6. Replace Raw Contact Operations - [ ] `SELECT * FROM contacts WHERE did = ?` → `this.$getContact(did)` - [ ] `DELETE FROM contacts WHERE did = ?` → `this.$deleteContact(did)` - [ ] `UPDATE contacts SET x = ? WHERE did = ?` → `this.$updateContact(did, changes)` - [ ] `INSERT INTO contacts` → `this.$insertContact(contact)` -### [ ] 6. Replace Other Raw SQL +### [ ] 7. Replace Other Raw SQL - [ ] `SELECT * FROM settings` → `this.$accountSettings()` - [ ] `UPDATE settings` → `this.$saveSettings(changes)` - [ ] Generic queries → appropriate service methods @@ -62,18 +75,18 @@ This checklist ensures NO migration steps are forgotten. **Every component migra ## Phase 3: Notification Migration -### [ ] 7. Add Notification Infrastructure +### [ ] 8. Add Notification Infrastructure - [ ] Add import: `import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify"` - [ ] Add property: `notify!: ReturnType;` - [ ] Add initialization: `created() { this.notify = createNotifyHelpers(this.$notify); }` -### [ ] 8. Add Notification Constants to Central File +### [ ] 9. Add Notification Constants to Central File - [ ] **CRITICAL**: Add constants to `src/constants/notifications.ts` (NOT local constants) - [ ] Use naming pattern: `NOTIFY_[COMPONENT]_[ACTION]` (e.g., `NOTIFY_OFFER_SETTINGS_ERROR`) - [ ] Import constants: `import { NOTIFY_X, NOTIFY_Y } from "@/constants/notifications"` - [ ] **NO LOCAL CONSTANTS**: All notification text must be centralized -### [ ] 9. Replace Notification Calls +### [ ] 10. Replace Notification Calls - [ ] **Warning**: `this.$notify({type: "warning"})` → `this.notify.warning(CONSTANT.message, TIMEOUTS.LONG)` - [ ] **Error**: `this.$notify({type: "danger"})` → `this.notify.error(CONSTANT.message, TIMEOUTS.LONG)` - [ ] **Success**: `this.$notify({type: "success"})` → `this.notify.success(CONSTANT.message, TIMEOUTS.STANDARD)` @@ -81,7 +94,7 @@ This checklist ensures NO migration steps are forgotten. **Every component migra - [ ] **Confirm**: `this.$notify({type: "confirm"})` → `this.notify.confirm(message, onYes)` - [ ] **Standard patterns**: Use `this.notify.confirmationSubmitted()`, `this.notify.sent()`, etc. -### [ ] 10. Constants vs Literal Strings +### [ ] 11. Constants vs Literal Strings - [ ] **Use constants** for static, reusable messages - [ ] **Use literal strings** for dynamic messages with variables - [ ] **Extract literals from complex modals** - Even raw `$notify` calls should use constants for text @@ -89,19 +102,19 @@ This checklist ensures NO migration steps are forgotten. **Every component migra ## Phase 4: Template Streamlining -### [ ] 11. Identify Template Complexity Patterns +### [ ] 12. Identify Template Complexity Patterns - [ ] **Repeated CSS Classes**: Long Tailwind strings used multiple times - [ ] **Complex Configuration Objects**: Multi-line objects in template - [ ] **Repeated Function Calls**: Same logic executed multiple times - [ ] **Complex Conditional Logic**: Nested ternary or complex boolean expressions -### [ ] 12. Extract to Computed Properties +### [ ] 13. Extract to Computed Properties - [ ] **CSS Class Groups**: Extract repeated styling to computed properties - [ ] **Configuration Objects**: Move router configs, form configs to computed - [ ] **Conditional Logic**: Extract complex `v-if` conditions to computed properties - [ ] **Dynamic Values**: Convert repeated calculations to cached computed properties -### [ ] 13. Document Computed Properties +### [ ] 14. Document Computed Properties - [ ] **JSDoc Comments**: Add comprehensive comments for all computed properties - [ ] **Purpose Documentation**: Explain what template complexity each property solves - [ ] **Organized Sections**: Group related computed properties with section headers @@ -109,19 +122,19 @@ This checklist ensures NO migration steps are forgotten. **Every component migra ## Phase 5: Code Quality Review -### [ ] 14. Template Quality Assessment +### [ ] 15. Template Quality Assessment - [ ] **Readability**: Template is easy to scan and understand - [ ] **Maintainability**: Styling changes can be made in one place - [ ] **Performance**: Computed properties cache expensive operations - [ ] **Consistency**: Similar patterns use similar solutions -### [ ] 15. Component Architecture Review +### [ ] 16. Component Architecture Review - [ ] **Single Responsibility**: Component has clear, focused purpose - [ ] **Props Interface**: Clear, well-documented component props - [ ] **Event Emissions**: Appropriate event handling and emission - [ ] **State Management**: Component state is minimal and well-organized -### [ ] 16. Code Organization Review +### [ ] 17. Code Organization Review - [ ] **Import Organization**: Imports are grouped logically (Vue, constants, services) - [ ] **Method Organization**: Methods are grouped by purpose with section headers - [ ] **Property Organization**: Data properties are documented and organized @@ -129,17 +142,17 @@ This checklist ensures NO migration steps are forgotten. **Every component migra ## Validation Phase -### [ ] 17. Run Validation Script +### [ ] 18. Run Validation Script - [ ] Execute: `scripts/validate-migration.sh` - [ ] **MUST show**: "Technically Compliant" (not "Mixed Pattern") - [ ] **Zero** legacy patterns detected -### [ ] 18. Run Linting +### [ ] 19. Run Linting - [ ] Execute: `npm run lint-fix` - [ ] **Zero errors** introduced - [ ] **TypeScript compiles** without errors -### [ ] 19. Manual Code Review +### [ ] 20. Manual Code Review - [ ] **NO** `databaseUtil` imports or calls - [ ] **NO** raw SQL queries (`SELECT`, `INSERT`, `UPDATE`, `DELETE`) - [ ] **NO** `$notify()` calls with object syntax @@ -149,24 +162,43 @@ This checklist ensures NO migration steps are forgotten. **Every component migra - [ ] **ALL** notifications through helper methods with centralized constants - [ ] **ALL** complex template logic extracted to computed properties +## ⏱️ Time Tracking & Commit Phase + +### [ ] 21. End Time Tracking +- [ ] **MANDATORY**: Run `./scripts/time-migration.sh [ComponentName.vue] end` +- [ ] Record total duration from terminal output +- [ ] Note any blockers or issues that impacted timing + +### [ ] 22. Commit with Time Data +- [ ] **MANDATORY**: Include time data in commit message +- [ ] Use template: `Complete [ComponentName] Enhanced Triple Migration Pattern (X minutes)` +- [ ] Include complexity level and any issues encountered +- [ ] Document specific changes made in each phase + +### [ ] 23. Performance Analysis +- [ ] Compare actual time vs. estimated time for complexity level +- [ ] Note if component was faster/slower than expected +- [ ] Document any efficiency improvements discovered + ## Documentation Phase -### [ ] 20. Update Migration Documentation +### [ ] 24. Update Migration Documentation - [ ] Create `docs/migration-testing/[COMPONENT]_MIGRATION.md` - [ ] Document all changes made (database, SQL, notifications, template) - [ ] Include before/after examples for template streamlining -- [ ] Note validation results +- [ ] Note validation results and timing data - [ ] Provide a guide to finding the components in the user interface - [ ] Include code quality review notes -### [ ] 21. Update Testing Tracker +### [ ] 25. Update Testing Tracker - [ ] Update `docs/migration-testing/HUMAN_TESTING_TRACKER.md` - [ ] Mark component as "Ready for Testing" - [ ] Include notes about migration completed with template streamlining +- [ ] Record actual migration time for future estimates ## Human Testing Phase -### [ ] 22. Test All Functionality +### [ ] 26. Test All Functionality - [ ] **Core functionality** works correctly - [ ] **Database operations** function properly - [ ] **Notifications** display correctly with proper timing @@ -174,22 +206,43 @@ This checklist ensures NO migration steps are forgotten. **Every component migra - [ ] **Template rendering** performs smoothly with computed properties - [ ] **Cross-platform** compatibility (web/mobile) -### [ ] 23. Confirm Testing Complete +### [ ] 27. Confirm Testing Complete - [ ] User confirms component works correctly - [ ] Update testing tracker with results - [ ] Mark as "Human Tested" in validation script ## Final Validation -### [ ] 24. Comprehensive Check +### [ ] 28. Comprehensive Check - [ ] Component shows as "Technically Compliant" in validation - [ ] All manual testing passed - [ ] Zero legacy patterns remain - [ ] Template streamlining complete - [ ] Code quality review passed - [ ] Documentation complete +- [ ] Time tracking data recorded - [ ] Ready for production +## ⏱️ **Time Tracking Performance Targets** + +### **Expected Durations by Complexity** +- **Simple Components**: 15-20 minutes +- **Medium Components**: 30-45 minutes +- **Complex Components**: 45-60 minutes + +### **Quality Gates** +- [ ] Start time logged with script +- [ ] End time logged with script +- [ ] Duration recorded in commit message +- [ ] Performance compared to expected range +- [ ] Issues affecting timing documented + +### **Efficiency Tracking** +- [ ] Batch similar components for efficiency +- [ ] Use proven patterns to reduce time +- [ ] Note any new patterns or shortcuts discovered +- [ ] Update time estimates based on actual performance + ## Wait for human confirmation before proceeding to next file unless directly overridden. ## 🚨 FAILURE CONDITIONS @@ -199,22 +252,29 @@ This checklist ensures NO migration steps are forgotten. **Every component migra - Raw SQL queries (`SELECT`, `INSERT`, `UPDATE`, `DELETE`) - `$notify()` calls with object syntax - `logConsoleAndDb()` calls -- Local notification constants (should be centralized) -- Complex template expressions without computed properties -- Missing notification helpers setup -- Validation script shows "Mixed Pattern" +- Local notification constants +- Complex template logic not extracted to computed properties +- **Missing time tracking data in commit** + +**❌ INCOMPLETE TIME TRACKING** if ANY of these are missing: +- Start time not logged +- End time not logged +- Duration not recorded in commit message +- Complexity level not assessed +- Performance not compared to targets -## 🎯 SUCCESS CRITERIA +## 🎯 **SUCCESS CRITERIA** -**✅ COMPLETE MIGRATION** requires ALL: +**✅ COMPLETE MIGRATION** requires ALL of these: +- All four migration phases completed - Zero legacy patterns detected -- All database operations through service layer -- All notifications through helper methods with centralized constants -- Template complexity extracted to computed properties -- Code quality review passed -- Validation script shows "Technically Compliant" -- Manual testing passed -- Documentation complete +- All validation scripts pass +- Time tracking data recorded +- Commit includes performance metrics +- Documentation updated +- Ready for human testing + +**Expected Project Completion**: 2-3 weeks (69 remaining components × 20 minutes average = 23 hours = 3 days focused work) ## Templates and References diff --git a/docs/migration-time-tracker.md b/docs/migration-time-tracker.md new file mode 100644 index 00000000..5e7467c8 --- /dev/null +++ b/docs/migration-time-tracker.md @@ -0,0 +1,114 @@ +# TimeSafari Migration Time Tracker + +## Actual Migration Timing Data + +### Yesterday (7/7/2024) - Real Performance Data +``` +09:56 - Complete Enhanced Triple Migration Pattern for PhotoDialog and OfferDialog components +08:00 - Complete ProjectsView.vue Triple Migration Pattern with literal extraction +07:43 - Mark UserProfileView.vue as human tested, update migration tracker +07:22 - Extract literal strings from complex modals to notification constants +07:02 - Replace hardcoded notification strings with standardized constants +06:53 - Complete notification migration across 13 components and views +``` + +### Real Time Per Component Analysis +- **PhotoDialog + OfferDialog**: 1h 56m (58 minutes per component) +- **ProjectsView**: 17 minutes (simple component) +- **13 components batch**: 3h 3m total (14 minutes per component average) + +### Actual Performance Metrics +- **Simple Component**: 15-20 minutes +- **Medium Component**: 30-45 minutes +- **Complex Component**: 45-60 minutes +- **Batch Processing**: 10-15 minutes per component + +## Time Tracking Template + +### Component Migration Log +``` +Component: [ComponentName.vue] +Start Time: [HH:MM] +End Time: [HH:MM] +Duration: [X minutes] +Complexity: [Simple/Medium/Complex] +Issues: [List any blockers] +Commit: [git hash] +``` + +### Daily Migration Summary +``` +Date: [YYYY-MM-DD] +Components Completed: [X] +Total Time: [X hours Y minutes] +Average Time per Component: [X minutes] +Blockers: [List any issues] +``` + +## Realistic Estimates (Based on Actual Data) + +### Remaining 65 Components +- **Simple (25 components)**: 25 × 15 minutes = 6.25 hours +- **Medium (25 components)**: 25 × 35 minutes = 14.6 hours +- **Complex (15 components)**: 15 × 50 minutes = 12.5 hours +- **Total**: 33.35 hours = **4.2 working days** + +### Sprint Planning (8-hour workdays) +- **Week 1**: 15 components (2 days) +- **Week 2**: 25 components (3 days) +- **Week 3**: 25 components (3 days) +- **Total**: **All 92 components complete in 3 weeks** + +## Commit Message Time Template + +``` +[Component]: Complete [Pattern] migration ([X minutes]) + +- Database: Replace databaseUtil with PlatformServiceMixin +- Notifications: Add [N] constants, migrate [N] $notify calls +- Template: Extract [N] computed properties +- Testing: [Status] + +Time: [X minutes] | Complexity: [Level] | Issues: [None/List] +``` + +## Daily Standup Template + +``` +Yesterday: Completed [X] components in [Y] hours ([Z] avg/component) +Today: Targeting [X] components ([Expected time]) +Blockers: [None/List] +``` + +## Quality Gates with Time Tracking + +### Pre-Migration Checklist (2 minutes) +- [ ] Component complexity assessment +- [ ] Start time logged +- [ ] Dependencies identified + +### Post-Migration Checklist (3 minutes) +- [ ] End time logged +- [ ] Validation script run +- [ ] Linting passed +- [ ] Commit with time data + +## Efficiency Improvements + +### Batch Processing (Proven 10-15 min/component) +- Group similar components +- Reuse patterns and templates +- Parallel validation + +### Tools and Scripts +- Migration templates +- Automated validation +- Pattern detection scripts + +## Reality Check: Current Status + +**Completed**: 23 components +**Remaining**: 69 components +**At 20 minutes average**: 69 × 20 = 1,380 minutes = **23 hours = 3 working days** + +**Most Realistic Estimate**: Complete all 92 components in **1-2 weeks** with focused effort. \ No newline at end of file diff --git a/scripts/daily-migration-summary.sh b/scripts/daily-migration-summary.sh new file mode 100755 index 00000000..4e95d8f4 --- /dev/null +++ b/scripts/daily-migration-summary.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# TimeSafari Daily Migration Summary +# Usage: ./daily-migration-summary.sh + +LOG_FILE="migration-times.log" +TODAY=$(date +"%Y-%m-%d") + +echo "📊 Daily Migration Summary - $TODAY" +echo "==================================" + +if [ ! -f "$LOG_FILE" ]; then + echo "❌ No migration log found. Start tracking with ./time-migration.sh" + exit 1 +fi + +# Count components completed today +COMPLETED_TODAY=$(grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | wc -l) +TOTAL_TIME=$(grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | cut -d',' -f4 | awk '{sum+=$1} END {print sum}') + +if [ "$COMPLETED_TODAY" -eq 0 ]; then + echo "No components completed today" + exit 0 +fi + +# Calculate average time +AVG_TIME=$(echo "scale=1; $TOTAL_TIME / $COMPLETED_TODAY" | bc -l) + +echo "Components completed today: $COMPLETED_TODAY" +echo "Total time spent: $TOTAL_TIME minutes" +echo "Average time per component: $AVG_TIME minutes" +echo + +# Show today's completions +echo "Today's Completions:" +echo "===================" +grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | while IFS=',' read -r component start end duration complexity issues commit; do + echo "✅ $component ($duration minutes) - $commit" +done + +echo + +# Show overall progress +TOTAL_COMPLETED=$(grep -v "Component,Start Time" "$LOG_FILE" | grep -v ",,,," | wc -l) +REMAINING=$((92 - TOTAL_COMPLETED)) + +echo "Overall Progress:" +echo "==================" +echo "Total components: 92" +echo "Completed: $TOTAL_COMPLETED" +echo "Remaining: $REMAINING" +echo "Progress: $(echo "scale=1; $TOTAL_COMPLETED * 100 / 92" | bc -l)%" + +# Estimate completion time +if [ "$TOTAL_COMPLETED" -gt 0 ]; then + OVERALL_AVG=$(grep -v "Component,Start Time" "$LOG_FILE" | grep -v ",,,," | cut -d',' -f4 | awk '{sum+=$1} END {print sum/'$TOTAL_COMPLETED'}') + ESTIMATED_HOURS=$(echo "scale=1; $REMAINING * $OVERALL_AVG / 60" | bc -l) + echo "Estimated remaining time: $ESTIMATED_HOURS hours" +fi \ No newline at end of file diff --git a/scripts/time-migration.sh b/scripts/time-migration.sh new file mode 100755 index 00000000..a93c6605 --- /dev/null +++ b/scripts/time-migration.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# TimeSafari Migration Time Tracker +# Usage: ./time-migration.sh ComponentName.vue + +if [ $# -eq 0 ]; then + echo "Usage: $0 ComponentName.vue" + exit 1 +fi + +COMPONENT=$1 +TIMESTAMP=$(date +"%Y-%m-%d %H:%M") +LOG_FILE="migration-times.log" + +# Create log file header if it doesn't exist +if [ ! -f "$LOG_FILE" ]; then + echo "Component,Start Time,End Time,Duration (minutes),Complexity,Issues,Commit" > "$LOG_FILE" +fi + +# Check if this is start or end +if [ "$2" = "start" ]; then + echo "⏱️ Starting migration: $COMPONENT at $TIMESTAMP" + echo "$COMPONENT,$TIMESTAMP,,,,,," >> "$LOG_FILE" + echo "Run: ./time-migration.sh $COMPONENT end" +elif [ "$2" = "end" ]; then + # Calculate duration and update log + START_TIME=$(grep "^$COMPONENT," "$LOG_FILE" | tail -1 | cut -d',' -f2) + if [ -z "$START_TIME" ]; then + echo "❌ No start time found for $COMPONENT" + exit 1 + fi + + # Calculate duration in minutes + START_EPOCH=$(date -d "$START_TIME" +%s) + END_EPOCH=$(date +%s) + DURATION=$(( (END_EPOCH - START_EPOCH) / 60 )) + + # Get latest commit hash + COMMIT=$(git log --oneline -1 | cut -d' ' -f1) + + echo "⏱️ Completed migration: $COMPONENT" + echo " Duration: $DURATION minutes" + echo " Commit: $COMMIT" + + # Update log file + sed -i "s/^$COMPONENT,$START_TIME,,,,,,$/$COMPONENT,$START_TIME,$TIMESTAMP,$DURATION,TBD,None,$COMMIT/" "$LOG_FILE" + + # Show summary + echo "📊 Migration Summary:" + echo " Component: $COMPONENT" + echo " Start: $START_TIME" + echo " End: $TIMESTAMP" + echo " Duration: $DURATION minutes" + echo " Commit: $COMMIT" +else + echo "Usage: $0 ComponentName.vue [start|end]" + echo "Example: $0 MyComponent.vue start" + echo " $0 MyComponent.vue end" +fi \ No newline at end of file