Skip to content

Conversation

@fxstein
Copy link
Owner

@fxstein fxstein commented Jul 6, 2025

This PR implements a comprehensive enhanced default behavior system for GoProX, along with a robust git hook system to prevent branch divergence issues. The work significantly improves the user experience by providing intelligent media management and preventing common git workflow problems.

fxstein added 30 commits July 1, 2025 22:53
…#73)

- Add mandatory logging requirements section to AI_INSTRUCTIONS.md
- Document requirement to use structured logger instead of echo statements
- Fix debug output in decision-matrix.zsh to use log_debug instead of echo
- Ensure all debug output follows project logging standards
- Add --enhanced flag for intelligent media management assistant
- Add --dry-run flag for safe testing without file modifications
- Create smart detection module for GoPro SD card analysis
- Create decision matrix for workflow planning and optimization
- Create enhanced default behavior coordinator
- Add comprehensive test suite for new functionality
- Fix permission errors and validation issues
- Update help text and CLI options
- Export dry_run flag to subscripts for simulation mode

The enhanced default behavior transforms GoProX from command-driven to
intelligent assistant that automatically detects cards, analyzes states,
and recommends optimal workflows with user confirmation.
…texts, fixes expected name preview and dry-run logic
… all contexts, fixes expected name preview and dry-run logic"

This reverts commit 2f84d0f.
…texts, fixes expected name preview and dry-run logic (refs #73)
…refs #73)

- Remove legacy install-commit-hooks.zsh script
- Consolidate all hooks to .githooks directory with core.hooksPath
- Add auto-configuration via post-checkout and post-merge hooks
- Create comprehensive test suite for hook consolidation
- Add quick verification script for ongoing testing
- Document test results showing 100% success rate
- Ensure zero manual setup required for new clones
- Follow Git/GitHub best practices for repository-tracked hooks
- Create HOOK_SYSTEM_GUIDE.md with complete testing and troubleshooting guide
- Add hook system references to README.md and CONTRIBUTING.md
- Document health check tools and verification scripts
- Include manual testing procedures and common issue solutions
- Add CI/CD integration examples and best practices
- Cover auto-configuration testing and troubleshooting steps
- Document 16 health checks with 100% pass rate verification
… (refs #73)

- Add file header validation for copyright notices, license headers, and usage patterns
- Add JSON linting support using jsonlint when available
- Update commit hooks analysis document with new requirements
- Enhance pre-commit hook with comprehensive file validation
- Check copyright notices in source files (zsh, md, yaml, json)
- Check license headers in appropriate files (zsh, md)
- Check usage patterns in documentation files
- Provide helpful installation instructions for jsonlint
- Maintain backward compatibility with optional tools
- Add check-hook-health.zsh with 16 comprehensive health checks
- Include configuration, file, functionality, and dependency validation
- Provide detailed health summary with pass/fail counts
- Support error, warning, and info severity levels
- Check Git version compatibility and tool availability
- Offer repair recommendations for failed checks
- Ensure non-destructive testing with config restoration
- Complete the hook system testing toolkit
… after restructuring (refs #66)""

This reverts commit b54772d.
- Restore firmware/official/ and firmware/labs/ directories
- Remove duplicate old firmware directories from root level
- Restore all firmware files, UPDATE.zip files, and download.url files
- Fix accidental deletion during testing that removed consolidated structure
…mware tree (refs #66)

- Adds scripts/maintenance/prevent-firmware-delete.sh
- Updates .git/hooks/pre-commit to call the protection script
- Blocks any commit that deletes files from firmware/ unless GOPROX_ALLOW_FIRMWARE_DELETE=1 is set
- Protects both official and labs firmware trees from accidental loss
…ion (refs #73)

- Fix GOPROX_HOME detection in main script to use correct path resolution
- Remove GOPROX_HOME override in firmware.zsh that was causing path issues
- Fix status string output in check_and_update_firmware to use stderr
- Update workflow to capture status strings correctly with tail -n1
- Ensure labs firmware is tried first, official firmware only as fallback
- Fix workflow logic to prevent installing both firmware types on same card
- Add comprehensive firmware-focused workflow with proper error handling
- Test and validate workflow with multiple GoPro camera models

The workflow now correctly:
- Detects and renames GoPro SD cards to standard format
- Checks for available firmware updates accurately
- Installs labs firmware (preferred) or official firmware (fallback)
- Reports accurate success/failure status messages
- Handles edge cases like card renaming during workflow execution

Resolves major bug where workflow reported 'firmware installation failed'
even when firmware was successfully installed.
- Add re-detection step after SD card renaming to get updated paths
- Ensure firmware operations use correct paths after card renaming
- Fix edge case where workflow would use old paths after renaming
- Maintain workflow integrity when cards are renamed during execution

The workflow now properly handles the scenario where:
1. Card is detected with non-standard name (e.g., 'Untitled')
2. Card is renamed to standard format (e.g., 'HERO13-8917')
3. Firmware operations use the updated path correctly
4. No need to run workflow twice after card renaming

This resolves the issue where firmware check/installation would fail
when using old volume paths after card renaming.
)

- Enhanced smart-detection.zsh to extract and log volume UUID using diskutil
- Updated format_card_display() to show UUID in output
- Modified main goprox script to display UUID for detected cards
- Updated rename-gopro-sd.zsh to include UUID in card information
- Fixed shell environment corruption in test-homebrew-integration.zsh
  by replacing PATH modification with function-based mocking
- All workflows now output and log SD card UUID alongside card name
- Ensures compliance with AI_INSTRUCTIONS.md regarding system command mocking
…ment (refs #73)

- Add 15 detailed use cases with requirements and validation criteria
- Document SD card tracking, camera settings, archive metadata
- Include multi-library support, deletion tracking, travel/office workflows
- Add external storage tracking, computer tracking, version tracking
- Include timestamp verification, geolocation tracking, cloud integration
- Document metadata sync and library migration requirements
- Provide validation checkboxes for implementation verification
- Serve as requirements specification and implementation guide
- Add Use Case 24: GoProX Version Tracking and Reprocessing
- Enhance media_files table with version tracking fields
- Add goprox_version to processing_history table
- Create goprox_version_features table for feature tracking
- Add comprehensive version tracking queries and examples
- Include implementation functions for version management
- Support selective reprocessing based on version criteria
- Enable tracking of feature availability and bug fixes by version
- Provide bulk reprocessing capabilities for version updates

This enables users to track which GoProX version processed each file
and selectively reprocess files when new features or bug fixes are
available in newer versions.
- Add Use Case 25: Comprehensive Logging and Traceability
- Implement unique identifier strategy for all entities
- Add structured JSON logging format with full context
- Create enhanced logger with traceability functions
- Add bidirectional traceability queries (logs ↔ metadata)
- Include log search and analysis functions
- Add logs table to database schema for traceability
- Implement log rotation and retention management
- Support multiple logging destinations (file, syslog, cloud)
- Enable complete audit trails and debugging capabilities

This provides complete traceability between logs and metadata,
enabling users to trace any media file back to its processing
history and find all operations for specific devices/cameras.
…ce (refs #73)

- Create docs/feature-planning/USE_CASES.md with all 25 use cases
- Organize use cases by category (Core Media Management, Environment/Workflow, Location/Cloud, Advanced Features, System/Maintenance)
- Add implementation priority guidance (Phase 1-3)
- Update Intelligent Media Management document to reference central use cases
- Remove duplicate use case definitions from individual feature document
- Add cross-references and maintenance guidelines

This centralizes use case definitions to avoid duplication and provides a single source of truth for all GoProX features to reference.
…#73)

- Add Use Case 26: GPS Track Import and Export
- Support importing GPX files from navigation software (e.g., Scenic Motorcycle Navigation)
- Enable combining multiple GPX files into single clean trip tracks
- Organize tracks by named trips with date ranges (e.g., 'CAMP 2025 Dolomites July 1-8')
- Associate GPS tracks with media files from same trip/time period
- Support both recorded tracks and planned routes
- Export tracks in standard formats (GPX, KML) for external use
- Handle track merging, cleaning, and optimization
- Store trip metadata and associate with tracks and media

This enables comprehensive trip organization by combining GPS navigation data with media files for complete travel documentation.
@fxstein fxstein force-pushed the feature/73-enhanced-default-behavior branch from 33c00ed to caa9a1b Compare July 7, 2025 05:14
fxstein added 29 commits July 7, 2025 07:27
…ode (refs #73)

- Move file path logging to after all media functions complete
- Log both variable values and resolved absolute paths for all directories
- Show Library, Archive, Imported, Processed, Deleted, Source, and Originals paths
- Enable debugging of CI issues by clearly showing all directory locations
- Fix syntax error with unmatched quotes in logging output
…#73)

- Add comprehensive listing of all original files and their sizes before any archive, import, or process tasks
- Add listing of all original files and their sizes after all test operations complete
- This will help identify exactly when and how files are being modified during test runs
- Provides better debugging information for CI failures where files are corrupted
- Add lfs: true to checkout actions in pr-tests.yml, integration-tests.yml, and release-tests.yml
- This ensures binary test files are properly fetched instead of LFS pointer files
- Fixes the file corruption issue in CI where binary files were being checked out as 132-byte pointers
- Addresses the root cause of test failures in GitHub Actions environment
- Add lfs: true to checkout actions in pr-tests.yml, integration-tests.yml, release-tests.yml, lint.yml, and release-automation.yml
- Ensures all LFS-tracked files are properly fetched in CI for all jobs
- Should resolve persistent test file corruption in GitHub Actions
- Add debug step to check git lfs version, environment, and tracked files
- Show file sizes of test media files to verify LFS fetch status
- Check git status to see if any files are modified
- This will help diagnose why LFS files are still pointer files in CI
…ed (refs #73)

- Add explicit 'git lfs pull' step after checkout in PR tests workflow
- This ensures all LFS-tracked files are properly downloaded, not just pointers
- Addresses issue where JPG files remain as 132-byte LFS pointers in CI
- Replace git lfs pull with git lfs fetch --all in PR tests workflow
- This fetches all LFS objects without checking them out
- May resolve issue where JPG files remain as LFS pointers in CI
- Replace git lfs fetch --all with git lfs checkout in PR tests workflow
- Based on research: this is the most reliable approach for the known LFS bug
- The actions/checkout LFS issue has been open for 4+ years and affects many users
- git lfs checkout specifically expands LFS pointers to actual files
…refs #73)

- Replace git lfs checkout with git lfs pull in PR tests workflow
- Based on research findings: some users reported git lfs pull was more reliable
- This addresses the known LFS inconsistent fetching bug in GitHub Actions
- Attempts to resolve issue where some LFS files remain as 132-byte pointers
- Add second checkout step after git lfs pull
- Based on research: some users reported multiple checkout steps resolved LFS issues
- This addresses the known inconsistent LFS fetching bug in GitHub Actions
- Attempts to resolve issue where JPG files remain as 132-byte pointers
- Add .lfsconfig file with explicit LFS configuration
- Configure fetchrecentrefsdays and fetchrecentremoterefs for better LFS fetching
- Set batchsize for improved performance
- Configure fetchinclude to ensure all LFS objects are downloaded
- Based on research findings for resolving LFS issues in GitHub Actions
- Remove unsafe LFS configuration keys that were causing warnings
- Keep only skipdownloaderrors, fetchinclude, and fetchexclude
- These are the supported options that should help with LFS fetching in CI
- Add _detect_insta360_x3() function to detect Insta360 X3 SD cards
- Extract serial number from .insp/.insv files using device identifier pattern
- Add API filter to map 'Insta360 X3' to '360X3' globally
- Modify auto-rename logic to handle Insta360 X3 naming: 360X3-[last4digits]
- Integrate Insta360 detection into _auto_rename_all_gopro_cards()
- Use find command instead of glob patterns to avoid shell expansion errors
- Maintain backward compatibility with existing GoPro functionality

Tested with dry-run mode - detects 360X3-BYMD card correctly
refs #73
)

- Add system readiness assessment function (_assess_system_readiness)
- Add content analysis function (_analyze_content_requirements)
- Add workflow selection function (_select_available_workflows)
- Integrate workflow analysis into main detection function
- Present available workflows based on system capabilities and content
- Set archive_clean as default workflow when available
- Add interactive user prompt for workflow selection
- Fix array indexing for zsh compatibility
- Add validation and error handling for user input

This implements the workflow analysis framework as designed in the documentation,
providing intelligent workflow selection based on system readiness and content state.
- Remove global output wrapper that was breaking interactive prompts
- Add _exiftool_wrapper function for centralized timestamping
- Update all exiftool calls to use the wrapper
- Preserve existing --time format and --test auto-timestamping
- Fix interactive prompt hanging issue
- Maintain backward compatibility

This change allows interactive prompts to work while preserving
timestamped output functionality for long-running exiftool operations.
)

- Add complete workflow presentation and execution system
- Implement system readiness assessment and content analysis
- Add workflow selection with user interaction
- Include safety checks for clean operations requiring archive/import markers
- Support Archive Only, Import Only, Archive+Clean, Import+Clean, and Archive+Import+Clean workflows
- Add volume processing functions with proper safety validation
- Tested and verified with real GoPro SD cards
- Fix logic error where workflow was archiving entire cards instead of just new media
- Ensure each volume is analyzed with its own specific archive history
- Properly calculate new media count per volume based on last archive time
- Prevent redundant archiving of already fully archived cards
- Update workflow presentation to show accurate new media counts
- Add force mode support to all workflow operations (archive, import, clean)
- Preserve force mode settings when calling individual volume functions
- Add force mode bypass for clean operation safety checks
- Display force mode warning in workflow presentation
- Maintain existing force mode protection and confirmation requirements
- Support --force --dry-run for safe testing of force operations
)

- Force mode now shows all GoPro cards regardless of archive status
- Displays total file counts instead of just new files in force mode
- Allows re-archiving of previously archived media by removing old markers
- Shows archive history in force mode display for clarity
- Remove verbose dry run messages with redundant icons
- Simplify archive output to show only essential information
- Clean up workflow execution messages
- Make dry run output more concise and readable
- Add prominent dry-run mode indicator at start of execution
- Enhance workflow options display to show dry-run status clearly
- When combined with force mode, explicitly indicate simulation only
- Ensure users are always aware when no changes will be made to media

This addresses the issue where dry-run mode was not clearly visible
when processing options were displayed, especially when combined
with the force option.
#73)

- Add _is_card_fully_archived() function to check both marker and archive file
- Add Clean Only workflow option (option 6) to workflow selection
- Show Clean option only for fully archived cards in normal mode
- Show Clean option for all cards in force mode with extra confirmation
- Add _execute_clean_only_workflow() with proper safety checks
- Require 'CLEAN_UNSAFE' confirmation for non-archived cards in force mode
- Update workflow numbering and validation to accommodate new option

The Clean option intelligently detects if cards are fully archived
(both marker file and matching archive file exist) and provides
appropriate safety measures based on archive status.
- Update messaging to distinguish between truly non-archived cards and cards without matching archives
- In force mode: 'Cards requiring extra confirmation (force mode)' instead of 'Non-archived cards'
- Clarify that cards have archive markers but may be missing matching archive files
- Update workflow option description to be more precise about archive matching
- Maintain proper safety warnings while being more accurate about card status

This addresses the confusion where cards with archive markers were being
called 'non-archived' when they were actually previously archived but
missing matching archive files in force mode.
- Remove unnecessary empty _warning line before confirmation prompt
- Clean up warning message formatting for better readability
- Maintain all safety warnings while improving visual presentation
- Update comment: 'cards without matching archives' instead of 'non-archived cards'
- Update error message: 'cards without matching archives' instead of 'non-archived cards'
- Update processing message: 'Processing card without matching archives' instead of 'Processing non-archived card'
- Ensure consistent terminology throughout the Clean workflow

This completes the messaging precision improvements to accurately reflect
that cards with archive markers but missing matching archive files are
not truly 'non-archived' but rather 'without matching archives'.
- Update clean operation message: 'missing matching archives - force mode' instead of 'not fully archived - force mode'
- Ensures complete consistency in terminology throughout the Clean workflow
- All messages now accurately reflect that cards have archive markers but may be missing matching archive files
…efs #73)

- Correctly distinguish fully archived, previously archived (missing marker), and missing archive cards
- Require confirmation for all clean operations in force mode, even for fully archived cards
- Improve workflow summary and warning messages for clarity and accuracy
- Refactor _is_card_fully_archived to match archive file, not just marker
- Ensure dry-run and force mode output is always precise and user-friendly

This addresses all messaging and logic issues for the Clean workflow and archive detection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants