Skip to content

improvment(cli): add UI feedback during sync#73

Merged
Myastr0 merged 3 commits intomasterfrom
improvment/add-ui-feedback-during-sync
Dec 19, 2025
Merged

improvment(cli): add UI feedback during sync#73
Myastr0 merged 3 commits intomasterfrom
improvment/add-ui-feedback-during-sync

Conversation

@Myastr0
Copy link
Owner

@Myastr0 Myastr0 commented Dec 19, 2025

Add Terminal UI Event Logging and Progress Tracking

Summary

This PR introduces a comprehensive event logging system with terminal UI feedback to provide users with real-time visibility into the synchronization process. The implementation includes progress tracking, spinner indicators, and clear status messages for key operations.

Changes to Core Features

What This PR Does

  1. Event Logging Infrastructure

    • Introduces a new EventLoggerRepository interface for abstracting event logging
    • Implements TerminalUiEventLoggerRepository using the ora library for terminal spinners
    • Provides a FakeEventLoggerRepository for testing purposes
  2. Synchronization Events

    • Adds event types for tracking synchronization operations:
      • check-source-is-accessible: Validates source accessibility
      • check-destination-is-accessible: Validates destination accessibility
      • synchronization-process: Tracks overall synchronization progress
  3. Progress Tracking

    • Implements progress tracking for the synchronization process using site map size
    • Displays real-time progress (e.g., "Starting synchronization process 5/20")
    • Updates progress as each page is synchronized
  4. User Experience Improvements

    • Provides visual feedback during long-running operations
    • Shows clear success/failure messages for accessibility checks
    • Improves console output formatting (added newline in completion message)

Why These Changes

  • Better User Experience: Users can now see what's happening during synchronization instead of waiting with no feedback
  • Debugging: Clear status messages help identify where issues occur during synchronization
  • Progress Visibility: Progress tracking helps users understand how long operations will take
  • Professional Polish: Terminal UI feedback makes the CLI feel more responsive and modern

Technical Details

New Dependencies

  • ora@9.0.0: Terminal spinner library for visual feedback
  • cli-progress@3.12.0: Progress bar library (added but not yet used in this PR)
  • @types/cli-progress@3.11.6: TypeScript types for cli-progress

Architecture Changes

  • Added EventLoggerRepository to the dependency injection system
  • Integrated event logging into SynchronizeMarkdownToNotion and PreviewSynchronization features
  • Added size property to SiteMap class for progress calculation
  • Updated infrastructure instances to include event logger

Files Changed

  • New Files:

    • src/domains/event-logs/: Event log types and repository interface
    • src/domains/synchronization/events/: Synchronization-specific event definitions
    • src/infrastructure/tui/terminal-ui-event-logger.repository.ts: Terminal UI implementation
    • __tests__/__fakes__/event-logs/fake-event-logger.repository.ts: Test fake implementation
  • Modified Files:

    • src/domains/synchronization/features/synchronize-markdown-to-notion.feature.ts: Added event logging calls
    • src/domains/synchronization/features/preview-synchronization.feature.ts: Added event logger dependency
    • src/MkNotes.ts: Integrated event logger into feature initialization
    • src/infrastructure/index.ts: Added event logger to infrastructure instances
    • src/domains/sitemap/entities/SiteMap.ts: Added size property for progress tracking

Testing

  • All existing tests pass with the new event logger integration
  • Fake event logger implementation allows testing without terminal UI dependencies
  • Tests updated to include FakeEventLoggerRepository in feature constructors

Checklist

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Example Output

Before this PR, users would see minimal output during synchronization. Now they'll see:

✓ Checking if the destination is accessible
✓ Checking if the source is accessible
⠋ Starting synchronization process 0/20
⠋ Starting synchronization process 5/20
⠋ Starting synchronization process 10/20
...
✓ Starting synchronization process 20/20
Synchronization done.
View the result at https://notion.so/...

Future Enhancements

  • Use cli-progress for more detailed progress bars
  • Add more granular progress tracking (e.g., per-file parsing progress)
  • Add event logging to other long-running operations
  • Support for different output formats (JSON, quiet mode, etc.)

@Myastr0
Copy link
Owner Author

Myastr0 commented Dec 19, 2025

👋 Hi, Myastr0! Thanks for opening a PR. We will review it soon.
If you have any questions, feel free to join the #need-help channel on the Discord server

@Myastr0 Myastr0 force-pushed the improvment/add-ui-feedback-during-sync branch from c37f46a to cfe089b Compare December 19, 2025 15:26
@Myastr0 Myastr0 merged commit c0589c3 into master Dec 19, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant