Skip to content

OpenCode - Initial Implementation #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Apr 21, 2025
Merged

OpenCode - Initial Implementation #27

merged 41 commits into from
Apr 21, 2025

Conversation

kujtimiihoxha
Copy link
Collaborator

@kujtimiihoxha kujtimiihoxha commented Apr 12, 2025

OpenCode - A New Terminal AI Experience

Summary

This PR introduces OpenCode, a complete redesign of the terminal AI experience with significant improvements to the UI, performance, and functionality:

  • New Chat-Based UI: Completely redesigned TUI with a modern chat interface, improved message rendering, and better keyboard navigation
  • File History & Diff Support: Added file history tracking and diff/patch visualization capabilities
  • Enhanced LSP Integration: Improved LSP client with better error handling and file management
  • Memory Optimization: Fixed memory issues and improved caching mechanisms
  • New Dialog System: Implemented new modals for permissions, help, quit, and session management
  • Improved Tools: Enhanced bash, edit, grep and other tools with better error handling and diagnostics
  • File Management: Added comprehensive file tracking and history capabilities

Technical Changes

  • Completely refactored the TUI components and layout system
  • Added new diff/patch implementation for file comparison
  • Implemented file history tracking with SQLite
  • Enhanced LSP client with better diagnostics integration
  • Improved model providers (OpenAI, Anthropic, Gemini) with better error handling
  • Optimized memory usage and fixed memory leaks
  • Added new permission handling system
  • Improved markdown rendering and styling

Removed

  • Old UI components and layouts
  • Unused test files
  • Legacy REPL implementation
  • Outdated configuration tests

TODO:

  • Figure out memory issue?
  • Validate config file
  • Implement Init Screen
  • Potential LSP detection
  • Distribute the binary
  • Remove unused code
  • Cleanup components in the TUI to handle width and text width correctly.
  • License
  • Fix lsp, do not open all files.
  • Hide the logs view for now Updated to the new look
  • Handle errors correctly in the tools, errors that should not go to the LLM should be handled differently
  • Implement new permissions modal
  • Implement new quit
  • Implement new help modal/pane
  • Implement file history (use the service in the tools)
  • Remove old UI

Pushed After Release

  • Implement file rollbacks

@kujtimiihoxha kujtimiihoxha marked this pull request as ready for review April 21, 2025 12:00
@kujtimiihoxha kujtimiihoxha changed the title WIP - OpenCode OpenCode - Initial Implementation Apr 21, 2025
Copy link

@Copilot 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 implements OpenCode, a complete redesign of the terminal AI experience with significant improvements in UI, performance, and functionality. Key changes include a revamped chat-based TUI, enhanced diff/patch visualization, and improved LSP integration along with file history and memory optimizations.

Reviewed Changes

Copilot reviewed 110 out of 116 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/db/querier.go Added new querier methods for file, session, and message management.
internal/db/models.go Introduced a new File model and extended Message fields.
internal/db/messages.sql.go Updated SQL queries and Scan invocations to support additional fields.
internal/db/files.sql.go Generated SQL statements for file management.
internal/db/db.go Prepared and closed new SQL statements; updated error messages.
internal/db/connect.go Updated the DB connection logic and migrated from termai to opencode.
internal/app/* Removed legacy services and introduced new LSP and app implementations.
cmd/schema/* Added schema generation tool and updated related documentation.
cmd/root.go Updated command-line interface and subscriptions to support new features.
README.md & LICENSE Updated branding, configuration details, and licensing.
Files not reviewed (6)
  • .opencode.json: Language not supported
  • .termai.json: Language not supported
  • go.mod: Language not supported
  • internal/db/migrations/000001_initial.down.sql: Language not supported
  • internal/db/migrations/000001_initial.up.sql: Language not supported
  • internal/db/sql/files.sql: Language not supported
Comments suppressed due to low confidence (2)

internal/db/connect.go:34

  • [nitpick] Consider using an Info-level log for a successfully applied pragma rather than Warn, to better reflect that this is a normal operational message.
logging.Warn("Set pragma", "pragma", pragma)

cmd/root.go:183

  • [nitpick] For consistency with structured logging throughout the codebase, replace the format string with key-value pairs (e.g., logging.Info("subscription channel closed", "name", name)).
logging.Info("%s subscription channel closed", name)

@kujtimiihoxha
Copy link
Collaborator Author

Merging this so we have the info in the main branch.

@kujtimiihoxha kujtimiihoxha merged commit f33dff8 into main Apr 21, 2025
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