Skip to content

Conversation

@kristopherjohnson
Copy link
Collaborator

@kristopherjohnson kristopherjohnson commented Aug 12, 2025

Go TUI Quickstart app

Based on original Claude translation of the rust-tui (#128), and updated with final Go SDK APIs and bug fixes.

Closes SDKS-1804

Note that there is no 4.x version of the Go SDK, so at this time it's not appropriate to add it to our auto-version-update scripts.

bigfish24 and others added 4 commits August 10, 2025 20:01
- Update go.mod to use local Go SDK development path
- Replace identity-based initialization with Config-based API
- Migrate from SetTransportConfig to UpdateTransportConfig pattern
- Add CODEOWNERS entry for go-tui directory maintenance

This migration prepares the go-tui application for Ditto v5 compatibility
while maintaining all existing functionality.
@kristopherjohnson kristopherjohnson requested a review from a team as a code owner August 12, 2025 17:15
@kristopherjohnson kristopherjohnson requested review from nickrobinson and removed request for a team August 12, 2025 17:15
@kristopherjohnson kristopherjohnson self-assigned this Aug 12, 2025
@kristopherjohnson kristopherjohnson marked this pull request as draft August 12, 2025 17:16
@kristopherjohnson kristopherjohnson changed the title feat: migrate go-tui to Ditto SDK v5 Config-based API go-tui: Update for v5 Go SDK API Aug 12, 2025
- Add context support for graceful cancellation
- Replace sleep hack with synchronous initial query
- Implement robust error handling with time.AfterFunc
- Simplify mutex patterns with proper RWMutex usage
- Add non-blocking channel operations with select/ctx.Done
- Document all improvements in GO_IMPROVEMENTS.md
- Enhance goroutine lifecycle management
- Update main.go to use DittoAuthenticator with token provider pattern
- Replace legacy manual authentication with AuthenticationProvider interface
- Add proper authentication status handling and token refresh logic
- Implement demo token provider for testing authentication workflow
- Update imports to use new authenticator types from Go SDK

This update aligns the TUI demo with the latest Go SDK authentication
patterns and provides a working example of the new auth system.
- Update imports to use single ditto package instead of nested packages
- Change from ditto/presence to ditto for PeerPresenceObserver
- Compatible with SDK refactoring that flattened package structure
- Updated config initialization to use DittoConfig type
- Aligns with recent SDK refactoring in go-sdk
…ndConnect

Updated main.go to use the new ServerConnect API instead of the deprecated
OnlinePlaygroundConnect type, following the Go SDK's removal of deprecated APIs.
- Replace deprecated OnlinePlaygroundConnect with ServerConnect
- Add platform-specific stderr redirection (Unix/Windows compatible)
- Switch from RUST_LOG environment variable to Ditto Logger API
- Redirect logs to temp file to prevent terminal UI interference
- Add go fmt formatting fixes
- Confirm observer callbacks functionality
- Add golang.org/x/sys and golang.org/x/term dependencies
- Fixed terminal initialization to properly show UI components
- Removed debug logging statements that cluttered output
- Cleaned up temporary test file handling
- Application now displays correctly in terminal
- Remove DisableSyncWithV3() call from main initialization
- Function has been removed from Go SDK
- No longer needed for v4+ SDK compatibility
@kristopherjohnson kristopherjohnson changed the title go-tui: Update for v5 Go SDK API go-tui: Go SDK Quickstart Aug 15, 2025
- Change Authenticator() to Auth() method calls
- Remove error assignment from SetExpirationHandler (now infallible)
- Changed ServerConnect type to DittoConfigConnectServer to match renamed type in Go SDK v5
- Maintains consistency with other DittoConfig connection types
Update StartSync() call to use d.Sync().Start() to match the refactored
Go SDK API where sync methods have been moved from Ditto to Sync type.
dsharp-pivotal and others added 9 commits August 26, 2025 14:54
- Clear the RowStyles map so the previous selection is removed.
- termui.Table.TextStyle is used as the default style for rows not in
  the RowStyles map.
The main task table was also making room for the input box when in
edit/create modes, but no room is needed since the input box is rendered
over the task table.
In edit mode, it was not possible to type the letter "q" because the
main event loop was swallowing the event. This event switch was
over-complicated anyway, and pushing all these cases down into
handleEvent/handle{Normal,Input}Mode lets them serve their purpose
better.
@kristopherjohnson kristopherjohnson changed the base branch from af/go-tui to main November 3, 2025 22:21
@kristopherjohnson kristopherjohnson marked this pull request as ready for review November 6, 2025 21:56
Copilot AI review requested due to automatic review settings November 6, 2025 21:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Go Terminal User Interface (TUI) application for managing tasks with Ditto's real-time sync capabilities. The application provides a terminal-based task manager with create, edit, delete, and completion toggle functionality, synchronized across multiple peers using the Ditto Go SDK.

Key changes:

  • Complete Go TUI application with task management features (CRUD operations, real-time sync)
  • Platform-specific stderr redirection to prevent TUI corruption (Unix and Windows implementations)
  • Build system with Makefile that handles Ditto SDK library downloads and platform-specific configuration

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go-tui/main.go Core application logic with event loop, UI rendering, and Ditto integration
go-tui/widgets.go Helper function for creating borderless paragraphs for small UI elements
go-tui/redirect_unix.go Unix-specific stderr redirection to /dev/null
go-tui/redirect_windows.go Windows-specific terminal detection (stderr redirection not yet implemented)
go-tui/go.mod Go module definition with dependencies
go-tui/go.sum Dependency checksums
go-tui/Makefile Build system for downloading SDK and building the application
go-tui/README.md Comprehensive documentation with setup instructions and troubleshooting
go-tui/.gitignore Git ignore rules for build artifacts and logs
go-tui/.editorconfig Editor configuration for Go files
.github/CODEOWNERS Code ownership assignments for the new go-tui directory
Comments suppressed due to low confidence (1)

go-tui/redirect_unix.go:29

  • File handle may be writable as a result of data flow from a call to OpenFile and closing it may result in data loss upon failure, which is not handled explicitly.
		defer devNull.Close()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@skylerjokiel skylerjokiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@kristopherjohnson kristopherjohnson enabled auto-merge (squash) November 18, 2025 17:41
@kristopherjohnson kristopherjohnson merged commit 72197ba into main Nov 18, 2025
8 checks passed
@kristopherjohnson kristopherjohnson deleted the kj/go-tui branch November 18, 2025 17:44
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.

7 participants