diff --git a/internal/app/lsp.go b/internal/app/lsp.go index 872532fd80aa6d99adc0e34ee1ecf25de34df253..c04cc42398423d88e9277ce57cddc54ebcc8a66a 100644 --- a/internal/app/lsp.go +++ b/internal/app/lsp.go @@ -25,7 +25,7 @@ func (app *App) initLSPClients(ctx context.Context) { func (app *App) createAndStartLSPClient(ctx context.Context, name string, command string, args ...string) { // Create a specific context for initialization with a timeout logging.Info("Creating LSP client", "name", name, "command", command, "args", args) - + // Create the LSP client lspClient, err := lsp.NewClient(ctx, command, args...) if err != nil { @@ -36,7 +36,7 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman // Create a longer timeout for initialization (some servers take time to start) initCtx, cancel := context.WithTimeout(ctx, 30*time.Second) defer cancel() - + // Initialize with the initialization context _, err = lspClient.InitializeLSPClient(initCtx, config.WorkingDirectory()) if err != nil { @@ -57,13 +57,13 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman } logging.Info("LSP client initialized", "name", name) - + // Create a child context that can be canceled when the app is shutting down watchCtx, cancelFunc := context.WithCancel(ctx) - + // Create a context with the server name for better identification watchCtx = context.WithValue(watchCtx, "serverName", name) - + // Create the workspace watcher workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient) diff --git a/internal/config/init.go b/internal/config/init.go index e0a1c6da7372fb3c66656d18bdf565357b6b1b07..5f8860f5264aaf0002ad782595f505c0e881b049 100644 --- a/internal/config/init.go +++ b/internal/config/init.go @@ -58,4 +58,3 @@ func MarkProjectInitialized() error { return nil } - diff --git a/internal/llm/prompt/prompt_test.go b/internal/llm/prompt/prompt_test.go index 405ad5194b85c208c52749cecc5ca9f84b05c614..bcd9e20993a4e0b4555d9dc82e46330938223b72 100644 --- a/internal/llm/prompt/prompt_test.go +++ b/internal/llm/prompt/prompt_test.go @@ -44,13 +44,13 @@ func createTestFiles(t *testing.T, tmpDir string, testFiles []string) { for _, path := range testFiles { fullPath := filepath.Join(tmpDir, path) if path[len(path)-1] == '/' { - err := os.MkdirAll(fullPath, 0755) + err := os.MkdirAll(fullPath, 0o755) require.NoError(t, err) } else { dir := filepath.Dir(fullPath) - err := os.MkdirAll(dir, 0755) + err := os.MkdirAll(dir, 0o755) require.NoError(t, err) - err = os.WriteFile(fullPath, []byte(path+": test content"), 0644) + err = os.WriteFile(fullPath, []byte(path+": test content"), 0o644) require.NoError(t, err) } } diff --git a/internal/llm/provider/azure.go b/internal/llm/provider/azure.go index 6368a181c8188c8e2bf2096df1e58f3f978a5130..33a04cb3a79be4d9cf2845031f07f3ebaf473e8c 100644 --- a/internal/llm/provider/azure.go +++ b/internal/llm/provider/azure.go @@ -16,7 +16,6 @@ type azureClient struct { type AzureClient ProviderClient func newAzureClient(opts providerClientOptions) AzureClient { - endpoint := os.Getenv("AZURE_OPENAI_ENDPOINT") // ex: https://foo.openai.azure.com apiVersion := os.Getenv("AZURE_OPENAI_API_VERSION") // ex: 2025-04-01-preview diff --git a/internal/llm/provider/bedrock.go b/internal/llm/provider/bedrock.go index 9f42e5b18e291474cc86dfe1aedbaba8b7d36c00..9fa3ca87f984147a3137fa013484b453d37d9687 100644 --- a/internal/llm/provider/bedrock.go +++ b/internal/llm/provider/bedrock.go @@ -98,4 +98,3 @@ func (b *bedrockClient) stream(ctx context.Context, messages []message.Message, return b.childProvider.stream(ctx, messages, tools) } - diff --git a/internal/llm/tools/ls_test.go b/internal/llm/tools/ls_test.go index 508cb98d36aee05ed3ea2417ed10ee364298ba27..98c97ed95b5db4bbb0ee5f21ba5ee646a43de889 100644 --- a/internal/llm/tools/ls_test.go +++ b/internal/llm/tools/ls_test.go @@ -56,14 +56,14 @@ func TestLsTool_Run(t *testing.T) { // Create directories for _, dir := range testDirs { dirPath := filepath.Join(tempDir, dir) - err := os.MkdirAll(dirPath, 0755) + err := os.MkdirAll(dirPath, 0o755) require.NoError(t, err) } // Create files for _, file := range testFiles { filePath := filepath.Join(tempDir, file) - err := os.WriteFile(filePath, []byte("test content"), 0644) + err := os.WriteFile(filePath, []byte("test content"), 0o644) require.NoError(t, err) } @@ -83,19 +83,19 @@ func TestLsTool_Run(t *testing.T) { response, err := tool.Run(context.Background(), call) require.NoError(t, err) - + // Check that visible directories and files are included assert.Contains(t, response.Content, "dir1") assert.Contains(t, response.Content, "dir2") assert.Contains(t, response.Content, "dir3") assert.Contains(t, response.Content, "file1.txt") assert.Contains(t, response.Content, "file2.txt") - + // Check that hidden files and directories are not included assert.NotContains(t, response.Content, ".hidden_dir") assert.NotContains(t, response.Content, ".hidden_file.txt") assert.NotContains(t, response.Content, ".hidden_root_file.txt") - + // Check that __pycache__ is not included assert.NotContains(t, response.Content, "__pycache__") }) @@ -122,7 +122,7 @@ func TestLsTool_Run(t *testing.T) { t.Run("handles empty path parameter", func(t *testing.T) { // For this test, we need to mock the config.WorkingDirectory function // Since we can't easily do that, we'll just check that the response doesn't contain an error message - + tool := NewLsTool() params := LSParams{ Path: "", @@ -138,7 +138,7 @@ func TestLsTool_Run(t *testing.T) { response, err := tool.Run(context.Background(), call) require.NoError(t, err) - + // The response should either contain a valid directory listing or an error // We'll just check that it's not empty assert.NotEmpty(t, response.Content) @@ -173,11 +173,11 @@ func TestLsTool_Run(t *testing.T) { response, err := tool.Run(context.Background(), call) require.NoError(t, err) - + // The output format is a tree, so we need to check for specific patterns // Check that file1.txt is not directly mentioned assert.NotContains(t, response.Content, "- file1.txt") - + // Check that dir1/ is not directly mentioned assert.NotContains(t, response.Content, "- dir1/") }) @@ -189,12 +189,12 @@ func TestLsTool_Run(t *testing.T) { defer func() { os.Chdir(origWd) }() - + // Change to a directory above the temp directory parentDir := filepath.Dir(tempDir) err = os.Chdir(parentDir) require.NoError(t, err) - + tool := NewLsTool() params := LSParams{ Path: filepath.Base(tempDir), @@ -210,7 +210,7 @@ func TestLsTool_Run(t *testing.T) { response, err := tool.Run(context.Background(), call) require.NoError(t, err) - + // Should list the temp directory contents assert.Contains(t, response.Content, "dir1") assert.Contains(t, response.Content, "file1.txt") @@ -291,22 +291,22 @@ func TestCreateFileTree(t *testing.T) { } tree := createFileTree(paths) - + // Check the structure of the tree assert.Len(t, tree, 1) // Should have one root node - + // Check the root node rootNode := tree[0] assert.Equal(t, "path", rootNode.Name) assert.Equal(t, "directory", rootNode.Type) assert.Len(t, rootNode.Children, 1) - + // Check the "to" node toNode := rootNode.Children[0] assert.Equal(t, "to", toNode.Name) assert.Equal(t, "directory", toNode.Type) assert.Len(t, toNode.Children, 3) // file1.txt, dir1, dir2 - + // Find the dir1 node var dir1Node *TreeNode for _, child := range toNode.Children { @@ -315,7 +315,7 @@ func TestCreateFileTree(t *testing.T) { break } } - + require.NotNil(t, dir1Node) assert.Equal(t, "directory", dir1Node.Type) assert.Len(t, dir1Node.Children, 2) // file2.txt and subdir @@ -354,9 +354,9 @@ func TestPrintTree(t *testing.T) { Type: "file", }, } - + result := printTree(tree, "/root") - + // Check the output format assert.Contains(t, result, "- /root/") assert.Contains(t, result, " - dir1/") @@ -390,14 +390,14 @@ func TestListDirectory(t *testing.T) { // Create directories for _, dir := range testDirs { dirPath := filepath.Join(tempDir, dir) - err := os.MkdirAll(dirPath, 0755) + err := os.MkdirAll(dirPath, 0o755) require.NoError(t, err) } // Create files for _, file := range testFiles { filePath := filepath.Join(tempDir, file) - err := os.WriteFile(filePath, []byte("test content"), 0644) + err := os.WriteFile(filePath, []byte("test content"), 0o644) require.NoError(t, err) } @@ -405,7 +405,7 @@ func TestListDirectory(t *testing.T) { files, truncated, err := listDirectory(tempDir, []string{}, 1000) require.NoError(t, err) assert.False(t, truncated) - + // Check that visible files and directories are included containsPath := func(paths []string, target string) bool { targetPath := filepath.Join(tempDir, target) @@ -416,12 +416,12 @@ func TestListDirectory(t *testing.T) { } return false } - + assert.True(t, containsPath(files, "dir1")) assert.True(t, containsPath(files, "file1.txt")) assert.True(t, containsPath(files, "file2.txt")) assert.True(t, containsPath(files, "dir1/file3.txt")) - + // Check that hidden files and directories are not included assert.False(t, containsPath(files, ".hidden_dir")) assert.False(t, containsPath(files, ".hidden_file.txt")) @@ -438,12 +438,12 @@ func TestListDirectory(t *testing.T) { files, truncated, err := listDirectory(tempDir, []string{"*.txt"}, 1000) require.NoError(t, err) assert.False(t, truncated) - + // Check that no .txt files are included for _, file := range files { assert.False(t, strings.HasSuffix(file, ".txt"), "Found .txt file: %s", file) } - + // But directories should still be included containsDir := false for _, file := range files { @@ -454,4 +454,4 @@ func TestListDirectory(t *testing.T) { } assert.True(t, containsDir) }) -} \ No newline at end of file +} diff --git a/internal/llm/tools/shell/shell.go b/internal/llm/tools/shell/shell.go index 7d3b87e4b2f3145a7e7a157a0c31e83232048ccd..cc127cd0cab5cde909e8c1fe9760c4bbefd57f8f 100644 --- a/internal/llm/tools/shell/shell.go +++ b/internal/llm/tools/shell/shell.go @@ -61,23 +61,23 @@ func GetPersistentShell(workingDir string) *PersistentShell { func newPersistentShell(cwd string) *PersistentShell { // Get shell configuration from config cfg := config.Get() - + // Default to environment variable if config is not set or nil var shellPath string var shellArgs []string - + if cfg != nil { shellPath = cfg.Shell.Path shellArgs = cfg.Shell.Args } - + if shellPath == "" { shellPath = os.Getenv("SHELL") if shellPath == "" { shellPath = "/bin/bash" } } - + // Default shell args if len(shellArgs) == 0 { shellArgs = []string{"-l"} diff --git a/internal/tui/components/dialog/custom_commands.go b/internal/tui/components/dialog/custom_commands.go index cd1ed3988ea10ff35400f90e427b9b054e6348cd..dd2ae57148ee07ef1a88087d93525a4f439bdc54 100644 --- a/internal/tui/components/dialog/custom_commands.go +++ b/internal/tui/components/dialog/custom_commands.go @@ -82,7 +82,7 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) { // Check if the commands directory exists if _, err := os.Stat(commandsDir); os.IsNotExist(err) { // Create the commands directory if it doesn't exist - if err := os.MkdirAll(commandsDir, 0755); err != nil { + if err := os.MkdirAll(commandsDir, 0o755); err != nil { return nil, fmt.Errorf("failed to create commands directory %s: %w", commandsDir, err) } // Return empty list since we just created the directory @@ -171,7 +171,6 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) { commands = append(commands, command) return nil }) - if err != nil { return nil, fmt.Errorf("failed to load custom commands from %s: %w", commandsDir, err) } diff --git a/internal/tui/components/dialog/custom_commands_test.go b/internal/tui/components/dialog/custom_commands_test.go index 3468ac3b0b2c5acc8999fcf3b444411e7f07ca5c..c21eaaa548adc563b6dc4c75125c588c9782b061 100644 --- a/internal/tui/components/dialog/custom_commands_test.go +++ b/internal/tui/components/dialog/custom_commands_test.go @@ -1,8 +1,8 @@ package dialog import ( - "testing" "regexp" + "testing" ) func TestNamedArgPattern(t *testing.T) { @@ -38,11 +38,11 @@ func TestNamedArgPattern(t *testing.T) { for _, tc := range testCases { matches := namedArgPattern.FindAllStringSubmatch(tc.input, -1) - + // Extract unique argument names argNames := make([]string, 0) argMap := make(map[string]bool) - + for _, match := range matches { argName := match[1] // Group 1 is the name without $ if !argMap[argName] { @@ -50,13 +50,13 @@ func TestNamedArgPattern(t *testing.T) { argNames = append(argNames, argName) } } - + // Check if we got the expected number of arguments if len(argNames) != len(tc.expected) { t.Errorf("Expected %d arguments, got %d for input: %s", len(tc.expected), len(argNames), tc.input) continue } - + // Check if we got the expected argument names for _, expectedArg := range tc.expected { found := false @@ -75,7 +75,7 @@ func TestNamedArgPattern(t *testing.T) { func TestRegexPattern(t *testing.T) { pattern := regexp.MustCompile(`\$([A-Z][A-Z0-9_]*)`) - + validMatches := []string{ "$FOO", "$BAR", @@ -83,7 +83,7 @@ func TestRegexPattern(t *testing.T) { "$BAZ123", "$ARGUMENTS", } - + invalidMatches := []string{ "$foo", "$1BAR", @@ -91,16 +91,16 @@ func TestRegexPattern(t *testing.T) { "FOO", "$", } - + for _, valid := range validMatches { if !pattern.MatchString(valid) { t.Errorf("Expected %s to match, but it didn't", valid) } } - + for _, invalid := range invalidMatches { if pattern.MatchString(invalid) { t.Errorf("Expected %s not to match, but it did", invalid) } } -} \ No newline at end of file +} diff --git a/internal/tui/theme/dracula.go b/internal/tui/theme/dracula.go index eaf981c786e20f605bdeb7ac90c1e3f955421f59..10a1a7216107bff40415e3f56b66f49d6840035f 100644 --- a/internal/tui/theme/dracula.go +++ b/internal/tui/theme/dracula.go @@ -103,4 +103,4 @@ func NewDraculaTheme() *DraculaTheme { func init() { // Register the Dracula theme with the theme manager RegisterTheme("dracula", NewDraculaTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/flexoki.go b/internal/tui/theme/flexoki.go index fc7f59b81ee056ef0ef771b2132f181388036a4a..183cd65d0de26e7a511dde5f18a98caf523a0941 100644 --- a/internal/tui/theme/flexoki.go +++ b/internal/tui/theme/flexoki.go @@ -7,20 +7,20 @@ import ( // Flexoki color palette constants const ( // Base colors - flexokiPaper = "#FFFCF0" // Paper (lightest) - flexokiBase50 = "#F2F0E5" // bg-2 (light) - flexokiBase100 = "#E6E4D9" // ui (light) - flexokiBase150 = "#DAD8CE" // ui-2 (light) - flexokiBase200 = "#CECDC3" // ui-3 (light) - flexokiBase300 = "#B7B5AC" // tx-3 (light) - flexokiBase500 = "#878580" // tx-2 (light) - flexokiBase600 = "#6F6E69" // tx (light) - flexokiBase700 = "#575653" // tx-3 (dark) - flexokiBase800 = "#403E3C" // ui-3 (dark) - flexokiBase850 = "#343331" // ui-2 (dark) - flexokiBase900 = "#282726" // ui (dark) - flexokiBase950 = "#1C1B1A" // bg-2 (dark) - flexokiBlack = "#100F0F" // bg (darkest) + flexokiPaper = "#FFFCF0" // Paper (lightest) + flexokiBase50 = "#F2F0E5" // bg-2 (light) + flexokiBase100 = "#E6E4D9" // ui (light) + flexokiBase150 = "#DAD8CE" // ui-2 (light) + flexokiBase200 = "#CECDC3" // ui-3 (light) + flexokiBase300 = "#B7B5AC" // tx-3 (light) + flexokiBase500 = "#878580" // tx-2 (light) + flexokiBase600 = "#6F6E69" // tx (light) + flexokiBase700 = "#575653" // tx-3 (dark) + flexokiBase800 = "#403E3C" // ui-3 (dark) + flexokiBase850 = "#343331" // ui-2 (dark) + flexokiBase900 = "#282726" // ui (dark) + flexokiBase950 = "#1C1B1A" // bg-2 (dark) + flexokiBlack = "#100F0F" // bg (darkest) // Accent colors - Light theme (600) flexokiRed600 = "#AF3029" @@ -86,11 +86,11 @@ func NewFlexokiDarkTheme() *FlexokiTheme { theme.DiffHunkHeaderColor = lipgloss.Color(flexokiBase700) theme.DiffHighlightAddedColor = lipgloss.Color(flexokiGreen400) theme.DiffHighlightRemovedColor = lipgloss.Color(flexokiRed400) - theme.DiffAddedBgColor = lipgloss.Color("#1D2419") // Darker green background + theme.DiffAddedBgColor = lipgloss.Color("#1D2419") // Darker green background theme.DiffRemovedBgColor = lipgloss.Color("#241919") // Darker red background theme.DiffContextBgColor = lipgloss.Color(flexokiBlack) theme.DiffLineNumberColor = lipgloss.Color(flexokiBase700) - theme.DiffAddedLineNumberBgColor = lipgloss.Color("#1A2017") // Slightly darker green + theme.DiffAddedLineNumberBgColor = lipgloss.Color("#1A2017") // Slightly darker green theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#201717") // Slightly darker red // Markdown colors @@ -110,14 +110,14 @@ func NewFlexokiDarkTheme() *FlexokiTheme { theme.MarkdownCodeBlockColor = lipgloss.Color(flexokiBase300) // Syntax highlighting colors (based on Flexoki's mappings) - theme.SyntaxCommentColor = lipgloss.Color(flexokiBase700) // tx-3 - theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen400) // gr - theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange400) // or - theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue400) // bl - theme.SyntaxStringColor = lipgloss.Color(flexokiCyan400) // cy - theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple400) // pu - theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow400) // ye - theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2 + theme.SyntaxCommentColor = lipgloss.Color(flexokiBase700) // tx-3 + theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen400) // gr + theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange400) // or + theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue400) // bl + theme.SyntaxStringColor = lipgloss.Color(flexokiCyan400) // cy + theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple400) // pu + theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow400) // ye + theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2 theme.SyntaxPunctuationColor = lipgloss.Color(flexokiBase500) // tx-2 return theme @@ -160,11 +160,11 @@ func NewFlexokiLightTheme() *FlexokiTheme { theme.DiffHunkHeaderColor = lipgloss.Color(flexokiBase500) theme.DiffHighlightAddedColor = lipgloss.Color(flexokiGreen600) theme.DiffHighlightRemovedColor = lipgloss.Color(flexokiRed600) - theme.DiffAddedBgColor = lipgloss.Color("#EFF2E2") // Light green background + theme.DiffAddedBgColor = lipgloss.Color("#EFF2E2") // Light green background theme.DiffRemovedBgColor = lipgloss.Color("#F2E2E2") // Light red background theme.DiffContextBgColor = lipgloss.Color(flexokiPaper) theme.DiffLineNumberColor = lipgloss.Color(flexokiBase500) - theme.DiffAddedLineNumberBgColor = lipgloss.Color("#E5EBD9") // Light green + theme.DiffAddedLineNumberBgColor = lipgloss.Color("#E5EBD9") // Light green theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#EBD9D9") // Light red // Markdown colors @@ -184,14 +184,14 @@ func NewFlexokiLightTheme() *FlexokiTheme { theme.MarkdownCodeBlockColor = lipgloss.Color(flexokiBase600) // Syntax highlighting colors (based on Flexoki's mappings) - theme.SyntaxCommentColor = lipgloss.Color(flexokiBase300) // tx-3 - theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen600) // gr - theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange600) // or - theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue600) // bl - theme.SyntaxStringColor = lipgloss.Color(flexokiCyan600) // cy - theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple600) // pu - theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow600) // ye - theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2 + theme.SyntaxCommentColor = lipgloss.Color(flexokiBase300) // tx-3 + theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen600) // gr + theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange600) // or + theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue600) // bl + theme.SyntaxStringColor = lipgloss.Color(flexokiCyan600) // cy + theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple600) // pu + theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow600) // ye + theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2 theme.SyntaxPunctuationColor = lipgloss.Color(flexokiBase500) // tx-2 return theme @@ -201,4 +201,4 @@ func init() { // Register the Flexoki themes with the theme manager RegisterTheme("flexoki-dark", NewFlexokiDarkTheme()) RegisterTheme("flexoki-light", NewFlexokiLightTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/gruvbox.go b/internal/tui/theme/gruvbox.go index 6df6ebb4d5723052d419476f5c9b9397e1bafb3d..0eb79b44da2d8c4d039e0073a2e755a6372f03fa 100644 --- a/internal/tui/theme/gruvbox.go +++ b/internal/tui/theme/gruvbox.go @@ -106,12 +106,12 @@ func NewGruvboxTheme() *GruvboxTheme { theme.DiffHunkHeaderColor = lipgloss.Color(gruvboxDarkFg3) theme.DiffHighlightAddedColor = lipgloss.Color(gruvboxDarkGreenBright) theme.DiffHighlightRemovedColor = lipgloss.Color(gruvboxDarkRedBright) - theme.DiffAddedBgColor = lipgloss.Color("#3C4C3C") // Darker green background - theme.DiffRemovedBgColor = lipgloss.Color("#4C3C3C") // Darker red background + theme.DiffAddedBgColor = lipgloss.Color("#3C4C3C") // Darker green background + theme.DiffRemovedBgColor = lipgloss.Color("#4C3C3C") // Darker red background theme.DiffContextBgColor = lipgloss.Color(gruvboxDarkBg0) theme.DiffLineNumberColor = lipgloss.Color(gruvboxDarkFg4) theme.DiffAddedLineNumberBgColor = lipgloss.Color("#32432F") // Slightly darker green - theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#43322F") // Slightly darker red + theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#43322F") // Slightly darker red // Markdown colors theme.MarkdownTextColor = lipgloss.Color(gruvboxDarkFg1) @@ -180,11 +180,11 @@ func NewGruvboxLightTheme() *GruvboxTheme { theme.DiffHunkHeaderColor = lipgloss.Color(gruvboxLightFg3) theme.DiffHighlightAddedColor = lipgloss.Color(gruvboxLightGreenBright) theme.DiffHighlightRemovedColor = lipgloss.Color(gruvboxLightRedBright) - theme.DiffAddedBgColor = lipgloss.Color("#E8F5E9") // Light green background + theme.DiffAddedBgColor = lipgloss.Color("#E8F5E9") // Light green background theme.DiffRemovedBgColor = lipgloss.Color("#FFEBEE") // Light red background theme.DiffContextBgColor = lipgloss.Color(gruvboxLightBg0) theme.DiffLineNumberColor = lipgloss.Color(gruvboxLightFg4) - theme.DiffAddedLineNumberBgColor = lipgloss.Color("#C8E6C9") // Light green + theme.DiffAddedLineNumberBgColor = lipgloss.Color("#C8E6C9") // Light green theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#FFCDD2") // Light red // Markdown colors @@ -221,4 +221,4 @@ func init() { // Register the Gruvbox themes with the theme manager RegisterTheme("gruvbox", NewGruvboxTheme()) RegisterTheme("gruvbox-light", NewGruvboxLightTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/monokai.go b/internal/tui/theme/monokai.go index 8b860316dc649310f6b976369c16ded9a932f3d9..abe342906d156da8128df30599a0056b525e05e2 100644 --- a/internal/tui/theme/monokai.go +++ b/internal/tui/theme/monokai.go @@ -192,4 +192,4 @@ func init() { // Register the Monokai Pro themes with the theme manager RegisterTheme("monokai", NewMonokaiProTheme()) RegisterTheme("monokai-light", NewMonokaiProLightTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/onedark.go b/internal/tui/theme/onedark.go index 936998d98142e73de4396e3ccbf320061fc2289e..5c694b2837f0c4a86ab4d5b85705847c739c1f4d 100644 --- a/internal/tui/theme/onedark.go +++ b/internal/tui/theme/onedark.go @@ -193,4 +193,4 @@ func init() { // Register the One Dark and One Light themes with the theme manager RegisterTheme("onedark", NewOneDarkTheme()) RegisterTheme("onelight", NewOneLightTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/theme_test.go b/internal/tui/theme/theme_test.go index 5ec810e3377ebfeb1a1ef6d0b399e6baefd0e403..790ee3aa8a37a3561da92ab56431f12646d050ec 100644 --- a/internal/tui/theme/theme_test.go +++ b/internal/tui/theme/theme_test.go @@ -7,7 +7,7 @@ import ( func TestThemeRegistration(t *testing.T) { // Get list of available themes availableThemes := AvailableThemes() - + // Check if "catppuccin" theme is registered catppuccinFound := false for _, themeName := range availableThemes { @@ -16,11 +16,11 @@ func TestThemeRegistration(t *testing.T) { break } } - + if !catppuccinFound { t.Errorf("Catppuccin theme is not registered") } - + // Check if "gruvbox" theme is registered gruvboxFound := false for _, themeName := range availableThemes { @@ -29,11 +29,11 @@ func TestThemeRegistration(t *testing.T) { break } } - + if !gruvboxFound { t.Errorf("Gruvbox theme is not registered") } - + // Check if "monokai" theme is registered monokaiFound := false for _, themeName := range availableThemes { @@ -42,48 +42,48 @@ func TestThemeRegistration(t *testing.T) { break } } - + if !monokaiFound { t.Errorf("Monokai theme is not registered") } - + // Try to get the themes and make sure they're not nil catppuccin := GetTheme("catppuccin") if catppuccin == nil { t.Errorf("Catppuccin theme is nil") } - + gruvbox := GetTheme("gruvbox") if gruvbox == nil { t.Errorf("Gruvbox theme is nil") } - + monokai := GetTheme("monokai") if monokai == nil { t.Errorf("Monokai theme is nil") } - + // Test switching theme originalTheme := CurrentThemeName() - + err := SetTheme("gruvbox") if err != nil { t.Errorf("Failed to set theme to gruvbox: %v", err) } - + if CurrentThemeName() != "gruvbox" { t.Errorf("Theme not properly switched to gruvbox") } - + err = SetTheme("monokai") if err != nil { t.Errorf("Failed to set theme to monokai: %v", err) } - + if CurrentThemeName() != "monokai" { t.Errorf("Theme not properly switched to monokai") } - + // Switch back to original theme _ = SetTheme(originalTheme) -} \ No newline at end of file +} diff --git a/internal/tui/theme/tokyonight.go b/internal/tui/theme/tokyonight.go index 61d82140cda3e3cc9d09f4b6d05b8459dca2cbc5..36fd976c3d9e69ffaa7d5b5203e7f7ad4d8a15dc 100644 --- a/internal/tui/theme/tokyonight.go +++ b/internal/tui/theme/tokyonight.go @@ -57,11 +57,11 @@ func NewTokyoNightTheme() *TokyoNightTheme { theme.BorderDimColor = lipgloss.Color(darkSelection) // Diff view colors - theme.DiffAddedColor = lipgloss.Color("#4fd6be") // teal from palette - theme.DiffRemovedColor = lipgloss.Color("#c53b53") // red1 from palette - theme.DiffContextColor = lipgloss.Color("#828bb8") // fg_dark from palette - theme.DiffHunkHeaderColor = lipgloss.Color("#828bb8") // fg_dark from palette - theme.DiffHighlightAddedColor = lipgloss.Color("#b8db87") // git.add from palette + theme.DiffAddedColor = lipgloss.Color("#4fd6be") // teal from palette + theme.DiffRemovedColor = lipgloss.Color("#c53b53") // red1 from palette + theme.DiffContextColor = lipgloss.Color("#828bb8") // fg_dark from palette + theme.DiffHunkHeaderColor = lipgloss.Color("#828bb8") // fg_dark from palette + theme.DiffHighlightAddedColor = lipgloss.Color("#b8db87") // git.add from palette theme.DiffHighlightRemovedColor = lipgloss.Color("#e26a75") // git.delete from palette theme.DiffAddedBgColor = lipgloss.Color("#20303b") theme.DiffRemovedBgColor = lipgloss.Color("#37222c") @@ -193,4 +193,4 @@ func init() { // Register the Tokyo Night themes with the theme manager RegisterTheme("tokyonight", NewTokyoNightTheme()) RegisterTheme("tokyonight-day", NewTokyoNightDayTheme()) -} \ No newline at end of file +} diff --git a/internal/tui/theme/tron.go b/internal/tui/theme/tron.go index 9b55dd1e2cf46404dcacd0e7e84f4d0e78dd16ce..9e08f88c9a04e7e617f12434d8a233e2791a4b1e 100644 --- a/internal/tui/theme/tron.go +++ b/internal/tui/theme/tron.go @@ -195,4 +195,4 @@ func init() { // Register the Tron themes with the theme manager RegisterTheme("tron", NewTronTheme()) RegisterTheme("tron-light", NewTronLightTheme()) -} \ No newline at end of file +}