Skip to content

feat(sync): selective project export with TUI checkboxes#108

Open
alvarorestrepo wants to merge 1 commit intoGentleman-Programming:mainfrom
alvarorestrepo:feat/selective-project-sync
Open

feat(sync): selective project export with TUI checkboxes#108
alvarorestrepo wants to merge 1 commit intoGentleman-Programming:mainfrom
alvarorestrepo:feat/selective-project-sync

Conversation

@alvarorestrepo
Copy link

Summary

This PR implements Selective Project Sync, allowing users to choose which projects to export instead of relying solely on CWD auto-detection.

Changes

CLI (cmd/engram/main.go)

  • Add --projects=a,b flag for non-interactive multi-project export (comma-separated)
  • Add interactive y/n prompt on TTY: "Show projects pending sync? [y/n]"
  • Implement resolveProjects() helper with strict precedence: --all > --projects > --project > TUI > CWD default
  • Replace single syncExport() call with per-project export loop
  • Warn to stderr when --all overrides --projects
  • Preserve 100% backward compatibility with existing --project, --all, and CWD default behavior

TUI (internal/tui/)

  • model.go: Add ScreenProjectSelector, NewProjectSelector() constructor, 3 state fields (ProjectSelectorItems, ProjectSelectorChecked, ProjectSelectorCursor)
  • update.go: Add handleProjectSelectorKeys() with j/k navigation, space toggle, enter confirm, q/esc cancel. Uses buffered channel for result handoff.
  • view.go: Add viewProjectSelector() for checkbox list rendering

Testing

  • Add TestResolveProjects() – table-driven with 8 cases (flag parsing, precedence, TTY fallback, CWD default)
  • Add TestHandleProjectSelectorKeys*() – 7 test functions covering all navigation and toggle states
  • 277 tests passing, 0 regressions across all 8 packages

Usage Examples

# Interactive (TTY) – prompts for project selection
engram sync

# Non-interactive – specific projects
engram sync --projects=engram,dots,work

# Backward compatible – single project
engram sync --project=legacy

# All projects (no prompt)
engram sync --all

# Piped/CI – skips prompt, uses CWD default
engram sync | tee sync.log

Issue

Closes #107

Add --projects flag and interactive TUI selector for choosing which
projects to export during sync.

- Add --projects=a,b flag for non-interactive multi-project export
- Add interactive y/n prompt on TTY before launching project selector
- Add ScreenProjectSelector TUI screen with j/k navigation, space
  toggle, enter confirm and q/esc cancel (channel-based result handoff)
- Replace single syncExport call with per-project export loop that
  accumulates results and prints a summary
- Preserve full backward compatibility: --all, --project and CWD
  default behave exactly as before
- Warn to stderr when --all overrides --projects
- Add table-driven tests for resolveProjects() and unit tests for
  handleProjectSelectorKeys() state machine (277 tests passing)

Closes Gentleman-Programming#107
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.

Selective Project Sync – Interactive Multi-Project Export

1 participant