Skip to content

feat(sync): selective project export with TUI checkboxes and --projects flag#98

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

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

Conversation

@alvarorestrepo
Copy link

Summary

Adds the ability to choose which projects to export during engram sync, instead of always exporting all or just the CWD project.

What changed

  • --projects=a,b flag — non-interactive multi-project export for scripts/CI
  • Interactive TUI selector — on TTY, engram sync prompts "Show projects pending sync? [y/n]" and launches a checkbox screen to pick projects
  • TUI keyboard bindingsj/k navigate, space toggles, enter confirms, q/esc cancels
  • Per-project export loop — each selected project creates its own chunk; results are accumulated and printed as a summary
  • --all warning — prints to stderr when --all overrides a --projects value
  • Full backward compatibility--all, --project (singular) and CWD default behave exactly as before; non-TTY environments skip the prompt entirely

Usage

# Interactive (TTY):
engram sync
# → "Show projects pending sync? [y/n]: y"
# → TUI with checkboxes: j/k move, space toggle, enter confirm

# Non-interactive (scripts/CI):
engram sync --projects=engram,gentleman-dots

# Existing flags unchanged:
engram sync --all
engram sync --project myproject

Tests

277 tests passing across all 8 packages. New tests added:

  • TestResolveProjects — 8 table-driven cases covering all precedence paths
  • TestHandleProjectSelectorKeys* — 7 unit tests for TUI state machine (cursor nav, toggle, enter/cancel, q/esc)

Files changed

File Change
cmd/engram/main.go --projects flag, resolveProjects() helper, TTY detection, export loop
internal/tui/model.go ScreenProjectSelector, 5 new fields, NewProjectSelector() constructor
internal/tui/update.go Screen router case, handleProjectSelectorKeys(), collectSelected()
internal/tui/view.go View router case, viewProjectSelector() renderer
cmd/engram/main_test.go TestResolveProjects table tests
internal/tui/update_test.go TUI state machine tests

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)
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