xonecas.io
62159
Sy

symb / commit 4ac8f62

chore: screenshot and code org

xonecas2026-02-11 4ac8f62427883cacc06de4f2d38e20bc49f4c869 parent 5dee4c8

6 files changed

README.md+6−0
@@ -10,6 +10,12 @@ A symbiotic code/pair programming TUI for developers who use agents in their mai
1010
1111 Symb pairs you with an LLM, providing an agentic UI with tools the LLM can use to cooperate in coding and development.
1212
13+# Preview
14+
15+<p align="center">
16+ <img src="assets/Screenshot_20260211_224648.png" alt="Symb Screenshot"/>
17+</p>
18+
1319 ## Features
1420
1521 - **Dual-pane TUI**: Code editor on one side, agent conversation on the other
assets/Screenshot_20260211_224648.png+0−0
Binary file, not shown.
cmd/symb/main.go+5−4
@@ -11,6 +11,7 @@ import (
1111 "github.com/rs/zerolog/log"
1212 "github.com/xonecas/symb/internal/config"
1313 "github.com/xonecas/symb/internal/mcp"
14+ "github.com/xonecas/symb/internal/mcp_tools"
1415 "github.com/xonecas/symb/internal/provider"
1516 "github.com/xonecas/symb/internal/tui"
1617 )
@@ -93,13 +94,13 @@ func main() {
9394 var p *tea.Program
9495
9596 // Register local tools that need program reference (before listing tools)
96- openForUserTool := mcp.NewOpenForUserTool()
97- openForUserHandler := mcp.MakeOpenForUserHandler(&p)
97+ openForUserTool := mcp_tools.NewOpenForUserTool()
98+ openForUserHandler := mcp_tools.MakeOpenForUserHandler(&p)
9899 proxy.RegisterTool(openForUserTool, openForUserHandler)
99100
100101 // Register grep tool
101- grepTool := mcp.NewGrepTool()
102- grepHandler := mcp.MakeGrepHandler()
102+ grepTool := mcp_tools.NewGrepTool()
103+ grepHandler := mcp_tools.MakeGrepHandler()
103104 proxy.RegisterTool(grepTool, grepHandler)
104105
105106 // List all tools (local + upstream)
internal/mcp_tools/grep.go+19−18
@@ -1,4 +1,4 @@
1-package mcp
1+package mcp_tools
22
33 import (
44 "context"
@@ -8,6 +8,7 @@ import (
88 "strings"
99
1010 "github.com/xonecas/symb/internal/filesearch"
11+ "github.com/xonecas/symb/internal/mcp"
1112 )
1213
1314 // GrepArgs represents arguments for the grep tool.
@@ -19,7 +20,7 @@ type GrepArgs struct {
1920 }
2021
2122 // NewGrepTool creates the grep tool definition.
22-func NewGrepTool() Tool {
23+func NewGrepTool() mcp.Tool {
2324 schema := map[string]interface{}{
2425 "type": "object",
2526 "properties": map[string]interface{}{
@@ -45,27 +46,27 @@ func NewGrepTool() Tool {
4546
4647 schemaJSON, _ := json.Marshal(schema)
4748
48- return Tool{
49- Name: "grep",
49+ return mcp.Tool{
50+ Name: "Grep",
5051 Description: "Search for files by name (fuzzy) or search file contents (grep). Respects .gitignore. Use content_search=false for finding files, content_search=true for searching content.",
5152 InputSchema: schemaJSON,
5253 }
5354 }
5455
5556 // MakeGrepHandler creates a handler for the grep tool.
56-func MakeGrepHandler() ToolHandler {
57- return func(ctx context.Context, arguments json.RawMessage) (*ToolResult, error) {
57+func MakeGrepHandler() mcp.ToolHandler {
58+ return func(ctx context.Context, arguments json.RawMessage) (*mcp.ToolResult, error) {
5859 var args GrepArgs
5960 if err := json.Unmarshal(arguments, &args); err != nil {
60- return &ToolResult{
61- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid arguments: %v", err)}},
61+ return &mcp.ToolResult{
62+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid arguments: %v", err)}},
6263 IsError: true,
6364 }, nil
6465 }
6566
6667 if args.Pattern == "" {
67- return &ToolResult{
68- Content: []ContentBlock{{Type: "text", Text: "Pattern cannot be empty"}},
68+ return &mcp.ToolResult{
69+ Content: []mcp.ContentBlock{{Type: "text", Text: "Pattern cannot be empty"}},
6970 IsError: true,
7071 }, nil
7172 }
@@ -78,8 +79,8 @@ func MakeGrepHandler() ToolHandler {
7879 // Get current working directory
7980 cwd, err := os.Getwd()
8081 if err != nil {
81- return &ToolResult{
82- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to get working directory: %v", err)}},
82+ return &mcp.ToolResult{
83+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to get working directory: %v", err)}},
8384 IsError: true,
8485 }, nil
8586 }
@@ -87,8 +88,8 @@ func MakeGrepHandler() ToolHandler {
8788 // Create searcher
8889 searcher, err := filesearch.NewSearcher(cwd)
8990 if err != nil {
90- return &ToolResult{
91- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to create searcher: %v", err)}},
91+ return &mcp.ToolResult{
92+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to create searcher: %v", err)}},
9293 IsError: true,
9394 }, nil
9495 }
@@ -103,8 +104,8 @@ func MakeGrepHandler() ToolHandler {
103104 })
104105
105106 if err != nil {
106- return &ToolResult{
107- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Search failed: %v", err)}},
107+ return &mcp.ToolResult{
108+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Search failed: %v", err)}},
108109 IsError: true,
109110 }, nil
110111 }
@@ -131,8 +132,8 @@ func MakeGrepHandler() ToolHandler {
131132 }
132133 }
133134
134- return &ToolResult{
135- Content: []ContentBlock{{Type: "text", Text: output.String()}},
135+ return &mcp.ToolResult{
136+ Content: []mcp.ContentBlock{{Type: "text", Text: output.String()}},
136137 IsError: false,
137138 }, nil
138139 }
internal/mcp_tools/open.go+24−23
@@ -1,4 +1,4 @@
1-package mcp
1+package mcp_tools
22
33 import (
44 "context"
@@ -9,6 +9,7 @@ import (
99 "strings"
1010
1111 tea "github.com/charmbracelet/bubbletea"
12+ "github.com/xonecas/symb/internal/mcp"
1213 )
1314
1415 // OpenForUserArgs represents arguments for Open tool.
@@ -26,7 +27,7 @@ type OpenForUserMsg struct {
2627 }
2728
2829 // NewOpenForUserTool creates the Open tool definition.
29-func NewOpenForUserTool() Tool {
30+func NewOpenForUserTool() mcp.Tool {
3031 schema := map[string]interface{}{
3132 "type": "object",
3233 "properties": map[string]interface{}{
@@ -48,7 +49,7 @@ func NewOpenForUserTool() Tool {
4849
4950 schemaJSON, _ := json.Marshal(schema)
5051
51- return Tool{
52+ return mcp.Tool{
5253 Name: "Open",
5354 Description: "Opens a file (or file range) in the user's editor with correct syntax highlighting. If start/end are provided, only that line range is shown.",
5455 InputSchema: schemaJSON,
@@ -57,19 +58,19 @@ func NewOpenForUserTool() Tool {
5758
5859 // MakeOpenForUserHandler creates a handler for Open tool.
5960 // programPtr should point to the tea.Program instance (can be set after creation).
60-func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
61- return func(ctx context.Context, arguments json.RawMessage) (*ToolResult, error) {
61+func MakeOpenForUserHandler(programPtr **tea.Program) mcp.ToolHandler {
62+ return func(ctx context.Context, arguments json.RawMessage) (*mcp.ToolResult, error) {
6263 var args OpenForUserArgs
6364 if err := json.Unmarshal(arguments, &args); err != nil {
64- return &ToolResult{
65- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid arguments: %v", err)}},
65+ return &mcp.ToolResult{
66+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid arguments: %v", err)}},
6667 IsError: true,
6768 }, nil
6869 }
6970
7071 if args.File == "" {
71- return &ToolResult{
72- Content: []ContentBlock{{Type: "text", Text: "File path cannot be empty"}},
72+ return &mcp.ToolResult{
73+ Content: []mcp.ContentBlock{{Type: "text", Text: "File path cannot be empty"}},
7374 IsError: true,
7475 }, nil
7576 }
@@ -77,8 +78,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
7778 // Security: Convert to absolute path and validate
7879 absPath, err := filepath.Abs(args.File)
7980 if err != nil {
80- return &ToolResult{
81- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid file path: %v", err)}},
81+ return &mcp.ToolResult{
82+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid file path: %v", err)}},
8283 IsError: true,
8384 }, nil
8485 }
@@ -86,8 +87,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
8687 // Get current working directory for validation
8788 workingDir, err := os.Getwd()
8889 if err != nil {
89- return &ToolResult{
90- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to get working directory: %v", err)}},
90+ return &mcp.ToolResult{
91+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to get working directory: %v", err)}},
9192 IsError: true,
9293 }, nil
9394 }
@@ -95,8 +96,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
9596 // Security: Prevent path traversal - only allow files within or below working directory
9697 relPath, err := filepath.Rel(workingDir, absPath)
9798 if err != nil || strings.HasPrefix(relPath, "..") || filepath.IsAbs(relPath) {
98- return &ToolResult{
99- Content: []ContentBlock{{Type: "text", Text: "Access denied: path outside working directory"}},
99+ return &mcp.ToolResult{
100+ Content: []mcp.ContentBlock{{Type: "text", Text: "Access denied: path outside working directory"}},
100101 IsError: true,
101102 }, nil
102103 }
@@ -104,8 +105,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
104105 // Read file content
105106 content, err := os.ReadFile(absPath)
106107 if err != nil {
107- return &ToolResult{
108- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to read file: %v", err)}},
108+ return &mcp.ToolResult{
109+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Failed to read file: %v", err)}},
109110 IsError: true,
110111 }, nil
111112 }
@@ -125,8 +126,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
125126
126127 // Validate start is in range
127128 if start < 1 || start > len(lines) {
128- return &ToolResult{
129- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Start line %d out of range (file has %d lines)", start, len(lines))}},
129+ return &mcp.ToolResult{
130+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Start line %d out of range (file has %d lines)", start, len(lines))}},
130131 IsError: true,
131132 }, nil
132133 }
@@ -138,8 +139,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
138139
139140 // Validate range
140141 if start > end {
141- return &ToolResult{
142- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid range: start (%d) > end (%d)", start, end)}},
142+ return &mcp.ToolResult{
143+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Invalid range: start (%d) > end (%d)", start, end)}},
143144 IsError: true,
144145 }, nil
145146 }
@@ -162,8 +163,8 @@ func MakeOpenForUserHandler(programPtr **tea.Program) ToolHandler {
162163 })
163164 }
164165
165- return &ToolResult{
166- Content: []ContentBlock{{Type: "text", Text: fmt.Sprintf("Opened %s in editor", args.File)}},
166+ return &mcp.ToolResult{
167+ Content: []mcp.ContentBlock{{Type: "text", Text: fmt.Sprintf("Opened %s in editor", args.File)}},
167168 IsError: false,
168169 }, nil
169170 }
internal/tui/tui.go+2−1
@@ -13,6 +13,7 @@ import (
1313 "github.com/charmbracelet/x/ansi"
1414 "github.com/xonecas/symb/internal/llm"
1515 "github.com/xonecas/symb/internal/mcp"
16+ "github.com/xonecas/symb/internal/mcp_tools"
1617 "github.com/xonecas/symb/internal/provider"
1718 editorarea "github.com/xonecas/symb/internal/tui/textarea"
1819 )
@@ -492,7 +493,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
492493 m.conversation = append(m.conversation, separator)
493494 return m, nil // Done listening
494495
495- case mcp.OpenForUserMsg:
496+ case mcp_tools.OpenForUserMsg:
496497 // Update editor with file content
497498 m.editor.SetValue(msg.Content)
498499 m.editor.Language = msg.Language