Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ca42699
feat: help system overhaul for v0.1.0-beta.3
kolkov Oct 12, 2025
bab7b7d
fix: critical keyboard input bug - 'b' and 'f' keys not working (v0.1…
kolkov Oct 12, 2025
ba2d9ef
feat: non-interactive mode (-c flag) and critical cd bug fix (v0.1.0-…
kolkov Oct 12, 2025
1494eee
chore: update .gitignore for Linux binaries and test scripts
kolkov Oct 12, 2025
b9cf343
style: replace if-else with switch for FD handling (linter fix)
kolkov Oct 12, 2025
c39847d
fix: export display bug in interactive mode
kolkov Oct 12, 2025
9a4b601
docs: update CHANGELOG with export fix details
kolkov Oct 12, 2025
ad239b6
style: fix gofmt formatting + update .gitignore
kolkov Oct 12, 2025
a88f531
fix: Classic mode viewport rendering issue
kolkov Oct 12, 2025
0183f81
feat: REPL refactoring + UI modes + code quality improvements (v0.1.0…
kolkov Oct 13, 2025
46652fc
Merge feature: REPL refactoring + UI modes for v0.1.0-beta.4
kolkov Oct 13, 2025
c4e8c07
Release v0.1.0-beta.4: REPL refactoring + Windows stability fixes
kolkov Oct 13, 2025
44c1d80
fix: CI failures - format files and fix pwd test on macOS
kolkov Oct 13, 2025
7c0ee48
fix: return errors instead of silently swallowing them in config loader
kolkov Oct 13, 2025
2f49f6b
refactor: comprehensive linter cleanup and API improvements (v0.1.0-b…
kolkov Oct 14, 2025
a0fbcfe
style: fix gofmt formatting for repl files
kolkov Oct 14, 2025
bb3ea4f
docs: restructure documentation following 2025 best practices
kolkov Oct 14, 2025
eecd0ac
fix: Classic mode rendering and spinner issues
kolkov Oct 14, 2025
4a9b1dd
docs: update documentation for v0.1.0-beta.5
kolkov Oct 14, 2025
ce5a346
fix: update golangci-lint exclusions for refactored REPL modules
kolkov Oct 14, 2025
a8f6301
docs: update documentation for v0.1.0-beta.6
kolkov Oct 14, 2025
53007c8
feat: implement git-flow with release branches for safer releases
kolkov Oct 14, 2025
9a50a33
fix: normalize paths in pwd test for cross-platform compatibility
kolkov Oct 14, 2025
045a062
docs: prepare v0.1.0-beta.7 release
kolkov Oct 14, 2025
7d793a1
Merge release/v0.1.0-beta.7 into main
kolkov Oct 14, 2025
dc0f19e
docs: add badges and improve release workflow
kolkov Oct 14, 2025
cb3007e
docs: document cursor visibility workaround and ShellUI migration plan
kolkov Oct 14, 2025
0ded665
docs: update TODOs to reference Phoenix TUI framework
kolkov Oct 14, 2025
3091b2e
feat: Phase 1 - Migrate event loop from Bubbletea to Phoenix tea/api
kolkov Oct 17, 2025
8a37443
feat: Phase 2 - Replace TextArea with Phoenix ShellInput wrapper
kolkov Oct 17, 2025
3efde80
feat(repl): complete Phoenix Viewport migration (Phase 3)
kolkov Oct 17, 2025
85990d0
feat(repl): complete Phoenix TUI migration (Phases 1-8)
kolkov Oct 17, 2025
c7128ad
fix(repl): fix Classic mode prompt visibility and rendering
kolkov Oct 17, 2025
350e1fe
feat(repl): implement PowerShell-style system cursor with full-text s…
kolkov Oct 17, 2025
1ddced4
fix(repl): align syntax highlighting colors during typing with post-e…
kolkov Oct 17, 2025
8e6e3a5
feat(config): add configurable cursor style (DECSCUSR)
kolkov Oct 18, 2025
48fff2e
fix(syntax): replace complex highlighting with simple word-based appr…
kolkov Oct 18, 2025
14ce6e6
feat(readline): add PowerShell-style coordinate transformation package
kolkov Oct 18, 2025
6709c8e
refactor(repl): replace lipgloss with Phoenix style library
kolkov Oct 18, 2025
a6f6c6a
chore: cleanup dependencies after Phoenix migration
kolkov Oct 18, 2025
9745e91
docs: clarify cursor blinking responsibility in ShellInput
kolkov Oct 18, 2025
b6f15be
fix(config): change default cursor style to blinking block
kolkov Oct 18, 2025
d7ac615
feat(repl): add native terminal cursor with blinking support
kolkov Oct 18, 2025
8ee2146
fix(repl): remove syntax highlighting to fix input lag and space key
kolkov Oct 18, 2025
f2b6e76
fix(repl): implement smart caching and PSReadLine-style cursor positi…
kolkov Oct 18, 2025
798737d
fix(repl): remove cursor hide/show from View to prevent flickering
kolkov Oct 18, 2025
1474098
fix(repl): fix space key - preserve whitespace in syntax highlighting
kolkov Oct 18, 2025
1af8413
feat(config): add cursor style and blinking configuration support
kolkov Oct 18, 2025
8deaf7d
fix(repl): clear input after command execution
kolkov Oct 18, 2025
c95e3f1
fix(multiline): add syntax highlighting and fix rendering artifacts
kolkov Oct 18, 2025
4bcf629
feat(repl): integrate Phoenix Terminal API for 10x performance
kolkov Oct 18, 2025
7ef4004
docs: document Phoenix Terminal integration
kolkov Oct 18, 2025
f0ef2ce
merge: integrate Phoenix Terminal migration into develop
kolkov Oct 18, 2025
bd21662
feat(repl): integrate Phoenix ExecProcess API for interactive commands
kolkov Oct 21, 2025
52b4897
docs(changelog): document Phoenix ExecProcess integration
kolkov Oct 21, 2025
74c5ca7
fix(repl): fix program reference injection for MVU pattern
kolkov Oct 21, 2025
49b1ba5
fix(main): fix program reference injection timing with Start/Send pat…
kolkov Oct 21, 2025
00e8363
feat(repl): enable interactive commands with Phoenix ExecProcess
kolkov Feb 6, 2026
3f18b0d
feat(repl): migrate to Phoenix TUI v0.1.0-beta.3 + universal ExecProcess
kolkov Feb 6, 2026
91aaf7c
chore: update Phoenix TUI to v0.2.2, cleanup docs and dependencies
kolkov Feb 6, 2026
b1c9123
fix(repl): fix ExecProcess issues, arrow keys, highlighting + update …
kolkov Feb 6, 2026
acaaf28
feat(repl): add PSReadLine-style predictive IntelliSense from history
kolkov Feb 6, 2026
1a3d893
feat(repl): implement runtime UI mode switching with manual alt scree…
kolkov Feb 7, 2026
9934c94
fix(repl): fix cursor positioning and stale content in chat/compact m…
kolkov Feb 7, 2026
b24aa69
merge: resolve conflicts with main (take feature branch Phoenix TUI c…
kolkov Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ docs/dev
# Temporary test files
tmp/
export_output.txt
test_cursor.go
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added - Phoenix TUI Integration
- **Phoenix TUI Framework**: Migrated from Charm Bubbletea/Lipgloss to Phoenix TUI v0.2.3
- `phoenix/tea` v0.2.3 - Elm Architecture MVU event loop
- `phoenix/terminal` v0.2.3 - Terminal operations with Unicode support
- `phoenix/style` v0.2.3 - CSS-like styling system
- `phoenix/components` v0.2.3 - Rich UI components (ShellInput, Viewport, Spinner)
- `phoenix/clipboard` v0.2.3 - Cross-platform clipboard support
- **10x Performance**: Differential rendering engine, 29,000 FPS capability
- Before: ~450ms rendering lag with 1000+ history lines
- After: ~20-40ms rendering, sub-frame response times
- Perfect Unicode support (no more emoji/CJK width bugs)
- **Predictive IntelliSense**: PSReadLine-style ghost text suggestions from history
- Type a prefix → dim gray ghost text shows matching command from history
- Press Right arrow → accept suggestion (replaces input with full command)
- Case-insensitive prefix search, newest match first
- Clears on Enter, Tab, Up/Down navigation
- **Interactive Command Support**: Full TTY control for vim, ssh, claude, python REPL, etc.
- Universal ExecProcessWithTTY - all external commands run with proper TTY control
- Level 2 TTY: TransferForeground + CreateProcessGroup for interactive programs
- Pipe-based CancelableReader for reliable stdin handoff (MSYS/mintty compatible)
- Automatic TUI state management (alt screen enter/exit, cursor show/hide)
- Classic mode: no alt screen (bash-like), Warp/Compact/Chat: alt screen + mouse
- **Critical Fixes**:
- Fixed prompt jumping issue (ESC[2K ClearLine integration)
- Fixed cursor blinking interference with output
- Fixed ExecProcess stdin race condition on MSYS/mintty (pipe-based CancelableReader)
- Fixed arrow key matching for Phoenix Unicode key strings (↑/↓/→/← vs up/down/right/left)
- Fixed syntax highlighting loss after history navigation (RefreshHighlight after SetValue)

### Changed - Terminal Backend
- **Removed Charm dependencies**:
- `github.com/charmbracelet/bubbletea` - replaced by `phoenix/tea`
- `github.com/charmbracelet/lipgloss` - replaced by `phoenix/style`
- `github.com/charmbracelet/bubbles` - replaced by `phoenix/components`
- **Added Phoenix dependencies** (all at v0.2.3):
- `github.com/phoenix-tui/phoenix/tea`
- `github.com/phoenix-tui/phoenix/terminal`
- `github.com/phoenix-tui/phoenix/style`
- `github.com/phoenix-tui/phoenix/components`
- `github.com/phoenix-tui/phoenix/clipboard`
- **Dependency cleanup**: Removed `replace` directives from go.mod (go.work handles local development)
- **Updated transitive deps**: `golang.org/x/term` v0.39.0, `golang.org/x/sys` v0.40.0, `uniwidth` v0.2.0

### Planned
- Ctrl+R fuzzy search UI
- Command sequences with && and || operators
- Gather community feedback on beta.7
- v0.1.0-rc.1 (after feedback collection)
- v0.1.0 stable release

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,4 +543,4 @@ By contributing, you agree that your contributions will be licensed under the MI

**Thank you for contributing to GoSh!** 🚀

*Last updated: 2025-10-14*
*Last updated: 2026-02-06*
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-blue)](https://github.com/grpmsoft/gosh)

**Version**: 0.1.0-beta.7
**Status**: Beta - Git-Flow + Cross-Platform Testing
**Version**: 0.1.0-beta.8-dev
**Status**: Beta - Phoenix TUI Integration
**License**: MIT

A modern, cross-platform shell written in Go with beautiful TUI and native script execution.
Expand All @@ -25,12 +25,13 @@ A modern, cross-platform shell written in Go with beautiful TUI and native scrip
- **Persistent History**: Commands automatically save to `~/.gosh_history`
- **Auto-Load**: History loads on shell startup
- **Up/Down Navigation**: Navigate through command history with arrow keys
- **Predictive IntelliSense**: PSReadLine-style ghost text suggestions from history — type `cd` and see gray suggestion `cd /projects/...`, press Right arrow to accept
- **Smart Deduplication**: Consecutive identical commands are automatically deduplicated
- **Configurable Limit**: History respects 10,000 command limit (configurable)

### 🚀 **Command Execution**
- **External Commands**: Execute any system command via os/exec
- **Interactive Mode**: Full TTY support for programs like vim, ssh, nano
- **Interactive Mode**: Full TTY support for programs like vim, ssh, nano, claude, python
- **Native Shell Scripts**: Execute .sh/.bash scripts natively using mvdan.cc/sh (no bash.exe dependency on Windows!)
- **Script Detection**: Automatically detects .sh, .bash, .bat, .cmd, .ps1 scripts

Expand Down Expand Up @@ -100,6 +101,11 @@ nano config.yml
# Navigate history
# Use Up/Down arrow keys to browse previous commands

# Predictive IntelliSense (PSReadLine-style)
# Start typing → gray ghost text appears from history
# Press Right arrow → accept suggestion
# Example: type "cd" → see "cd /projects/grpmsoft/gosh" in gray → press → to accept

# History is automatically saved to ~/.gosh_history
# History loads automatically on shell startup
```
Expand Down Expand Up @@ -154,9 +160,9 @@ export GOPATH=$HOME/go

## 🗺️ Project Status

**Current**: v0.1.0-beta.7 (Git-Flow + Cross-Platform Testing)
**Current**: v0.1.0-beta.8-dev (Phoenix TUI Integration)
**Next**: v0.1.0-rc.1 (Community Feedback)
**Target**: v0.1.0 Stable (Q2 2025)
**Target**: v0.1.0 Stable

See [ROADMAP.md](ROADMAP.md) for detailed development plan.

Expand Down Expand Up @@ -196,10 +202,13 @@ Third-party library licenses - see [NOTICE](NOTICE) for details.

### Open Source Libraries

- **Bubbletea** - Charm's excellent TUI framework
- **mvdan.cc/sh** - Native POSIX shell interpreter
- **Lipgloss** - Terminal styling library
- **Bubbles** - TUI components
- **[Phoenix TUI](https://github.com/phoenix-tui/phoenix)** v0.2.3 - Next-generation TUI framework with 10x performance
- `phoenix/tea` - Elm Architecture event loop with TTY control
- `phoenix/terminal` - Cross-platform terminal operations
- `phoenix/style` - CSS-like styling system
- `phoenix/components` - Rich UI components (ShellInput, Viewport)
- **[mvdan.cc/sh](https://pkg.go.dev/mvdan.cc/sh/v3)** v3.12.0 - Native POSIX shell interpreter
- **[uniwidth](https://github.com/unilibs/uniwidth)** v0.2.0 - Unicode width calculation library

## 📞 Support

Expand Down
31 changes: 25 additions & 6 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,32 @@ This document outlines the planned development roadmap for GoSh, organized by re

---

## 🎯 Next: v0.1.0-rc.1 (Q1 2025)
## 🔄 In Progress: v0.1.0-beta.8 (Phoenix TUI Integration)

**Status**: Active Development
**Focus**: Phoenix TUI v0.2.1 Migration + Interactive Commands

### What's New
- ✅ **Phoenix TUI v0.2.2**: Complete migration from Charm Bubbletea/Lipgloss
- 10x performance (differential rendering, 29,000 FPS)
- Perfect Unicode support (emoji, CJK width)
- TTY Control System for interactive commands
- ✅ **Interactive Commands**: Universal ExecProcessWithTTY
- All external commands run with proper TTY control (like bash)
- vim, ssh, claude, python REPL — all work natively
- Pipe-based CancelableReader (MSYS/mintty compatible)
- ✅ **Classic Mode**: No alt screen (true bash-like behavior)
- ✅ **Dependency cleanup**: Removed go.mod replace directives

---

## 🎯 Next: v0.1.0-rc.1

**Status**: Planning
**Focus**: Community Feedback & Bug Fixes

### Goals
- [ ] Gather and address community feedback from beta.4
- [ ] Gather and address community feedback
- [ ] Fix critical bugs reported by users
- [ ] Performance optimizations based on real-world usage
- [ ] Final polish before stable release
Expand All @@ -64,7 +83,7 @@ This document outlines the planned development roadmap for GoSh, organized by re

---

## 🚀 Target: v0.1.0 Stable (Q2 2025)
## 🚀 Target: v0.1.0 Stable

**Status**: Future
**Focus**: Production-Ready Stable Release
Expand All @@ -84,7 +103,7 @@ This document outlines the planned development roadmap for GoSh, organized by re

---

## 🌟 Future: v0.2.0 (Q3 2025)
## 🌟 Future: v0.2.0

**Status**: Planned
**Focus**: Enhanced User Experience
Expand All @@ -103,7 +122,7 @@ This document outlines the planned development roadmap for GoSh, organized by re

---

## 🔮 Long-Term Vision (2026+)
## 🔮 Long-Term Vision

### Potential Features (Under Research)

Expand Down Expand Up @@ -180,7 +199,7 @@ This roadmap is a living document and will be updated based on:
- Resource availability and priorities
- Real-world usage patterns

**Last Updated**: 2025-10-14
**Last Updated**: 2026-02-06
**Next Review**: After v0.1.0-rc.1 release

---
Expand Down
18 changes: 17 additions & 1 deletion cmd/gosh/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/grpmsoft/gosh/internal/application/execute"
appsession "github.com/grpmsoft/gosh/internal/application/session"
"github.com/grpmsoft/gosh/internal/domain/config"
"github.com/grpmsoft/gosh/internal/infrastructure/builtin"
configLoader "github.com/grpmsoft/gosh/internal/infrastructure/config"
"github.com/grpmsoft/gosh/internal/infrastructure/executor"
Expand All @@ -28,14 +29,29 @@ func setupLogger() *slog.Logger {
}

// bootstrapREPL creates and configures REPL with dependencies.
func bootstrapREPL(logger *slog.Logger, ctx context.Context) (*repl.Model, error) {
// modeOverride overrides UI mode from --mode CLI flag (empty = use config default).
func bootstrapREPL(logger *slog.Logger, ctx context.Context, modeOverride string) (*repl.Model, error) {
// Load configuration
loader := configLoader.NewLoader()
cfg, err := loader.Load()
if err != nil {
logger.Warn("Failed to load config, using defaults", "error", err)
}

// Override UI mode from CLI flag (before creating model — affects welcome messages)
if modeOverride != "" {
switch modeOverride {
case "classic":
cfg.UI.Mode = config.UIModeClassic
case "warp":
cfg.UI.Mode = config.UIModeWarp
case "compact":
cfg.UI.Mode = config.UIModeCompact
case "chat":
cfg.UI.Mode = config.UIModeChat
}
}

// Create dependencies (Dependency Injection)
fs := filesystem.NewOSFileSystem()
builtinExec := builtin.NewExecutor(fs, logger)
Expand Down
63 changes: 57 additions & 6 deletions cmd/gosh/main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
package main

import (
"bufio"
"context"
"flag"
"fmt"
"io"
"log/slog"
"os"
"strings"

tea "github.com/charmbracelet/bubbletea"
"github.com/grpmsoft/gosh/internal/application/execute"
"github.com/grpmsoft/gosh/internal/interfaces/repl"
"github.com/phoenix-tui/phoenix/tea"
)

// autoFlushWriter wraps an io.Writer and flushes after each Write.
// Needed for raw mode where stdout is buffered.
type autoFlushWriter struct {
w *bufio.Writer
}

func newAutoFlushWriter(w io.Writer) *autoFlushWriter {
return &autoFlushWriter{w: bufio.NewWriter(w)}
}

func (a *autoFlushWriter) Write(p []byte) (n int, err error) {
n, err = a.w.Write(p)
if err != nil {
return n, err
}
// Always flush after write in raw mode
return n, a.w.Flush()
}

func main() {
// Parse command line flags
commandFlag := flag.String("c", "", "Execute command and exit (non-interactive mode)")
modeFlag := flag.String("mode", "", "UI mode: classic, warp, compact, chat")
flag.Parse()

// Setup
Expand All @@ -27,17 +50,45 @@ func main() {
os.Exit(exitCode)
}

// Interactive mode: Bootstrap REPL
model, err := bootstrapREPL(logger, ctx)
// Validate --mode flag
modeOverride := strings.ToLower(strings.TrimSpace(*modeFlag))
if modeOverride != "" {
switch modeOverride {
case "classic", "warp", "compact", "chat":
// valid
default:
fmt.Fprintf(os.Stderr, "Unknown mode: %s (available: classic, warp, compact, chat)\n", *modeFlag)
os.Exit(1)
}
}

// Auto-flush stdout after each write.
// In raw mode stdout is buffered and Phoenix doesn't flush.
stdout := newAutoFlushWriter(os.Stdout)

// Bootstrap REPL
model, err := bootstrapREPL(logger, ctx, modeOverride)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create REPL: %v\n", err)
os.Exit(1)
}

// Run (without AltScreen - using native terminal scrolling)
p := tea.NewProgram(model)
// Phoenix TUI options — NEVER use WithAltScreen.
// Alt screen is managed manually by the Model (enter/exit via ANSI sequences).
// This allows runtime mode switching without restarting the Program.
var opts []tea.Option[repl.Model]
opts = append(opts,
tea.WithInput[repl.Model](os.Stdin),
tea.WithOutput[repl.Model](stdout),
)

p := tea.New(*model, opts...)

// Set global program reference for ExecProcess compatibility
repl.SetGlobalProgram(p)

if _, err := p.Run(); err != nil {
// Run BLOCKS main thread (single program, no restart loop)
if err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "Error running program: %v\n", err)
os.Exit(1)
}
Expand Down
Loading
Loading