gosh

module
v0.1.0-beta.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2025 License: MIT

README ΒΆ

🐚 GoSh - Cross-Platform Go Shell

Version: 0.1.0-beta.4 Status: Beta - Code Quality & API Refinement (breaking changes in this release) License: MIT

A modern, cross-platform shell written in Go with beautiful TUI and native script execution.

✨ Features

🎨 4 Beautiful UI Modes
  • Classic - Traditional bash-like interface
  • Warp - Modern, polished UI
  • Compact - Minimal, space-efficient
  • Chat - Telegram-like conversational interface
πŸ“œ Command History (v0.1.0-alpha.2)
  • 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
  • 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
  • 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
🎨 Syntax Highlighting
  • Inline ANSI syntax highlighting
  • Commands, options, and arguments color-coded
  • Real-time highlighting as you type
πŸ”§ Git Integration
  • Current branch displayed in prompt
  • Dirty status indicator
  • Works in any git repository
⌨️ Input & Navigation
  • Tab Completion: Basic command and file completion
  • Multi-line Input: Alt+Enter for multiline commands
  • Viewport Scrolling: PgUp/PgDn, Mouse Wheel support
  • Auto-scroll: Automatically scroll to bottom on new output
  • Visual Help Overlay: Press F1 or ? for keyboard shortcuts reference (since beta.3)
  • UI Mode Switching: Alt+1-4 hotkeys to switch modes on-the-fly (since beta.2)

πŸ“¦ Installation

Prerequisites
  • Go 1.25 or higher
  • Git (for installation from source)
Build from Source
git clone https://github.com/grpmsoft/gosh.git
cd gosh
go build -o gosh ./cmd/gosh

# On Windows:
go build -o gosh.exe ./cmd/gosh
Quick Start
# Run GoSh
./gosh

# Or on Windows:
gosh.exe

🎯 Usage

Basic Commands
# Execute any system command
ls -la
git status
npm install

# Run interactive programs
vim myfile.txt
ssh user@server
nano config.yml

# Execute shell scripts (native POSIX support!)
./my-script.sh
History Features
# Navigate history
# Use Up/Down arrow keys to browse previous commands

# History is automatically saved to ~/.gosh_history
# History loads automatically on shell startup
UI Modes & Keyboard Shortcuts
# Get help
F1 or ?          # Open visual help overlay (ESC to close)
help             # Show built-in commands

# Switch UI modes
Alt+1            # Classic mode (traditional bash-like)
Alt+2            # Warp mode (modern polished)
Alt+3            # Compact mode (minimal space)
Alt+4            # Chat mode (telegram-like)

# Or use :mode command
:mode            # Show current UI mode
:mode classic    # Switch to Classic
:mode warp       # Switch to Warp
:mode compact    # Switch to Compact
:mode chat       # Switch to Chat

βš™οΈ Configuration

History Configuration

History is stored in ~/.gosh_history and automatically managed.

Default Settings:

  • Max size: 10,000 commands
  • Auto-save: Enabled
  • Deduplication: Consecutive duplicates removed
.goshrc Configuration (v0.1.0-alpha.4)

GoSh supports .goshrc configuration file for customization:

  • Location: ~/.goshrc (home directory)
  • Aliases: Define custom command aliases
  • Environment: Set environment variables
  • Auto-load: Loaded automatically on shell startup

Example .goshrc:

# Aliases
alias ll='ls -la'
alias gs='git status'

# Environment variables
export EDITOR=vim
export GOPATH=$HOME/go

πŸ—οΈ Architecture

GoSh is built using modern software architecture patterns:

  • DDD (Domain-Driven Design): Rich domain models with business logic
  • Hexagonal Architecture: Clean separation of concerns
  • Bubbletea TUI Framework: Elm Architecture (Model-View-Update)
  • Native POSIX Shell: mvdan.cc/sh v3.12.0 for cross-platform script execution
Project Structure
gosh/
β”œβ”€β”€ cmd/gosh/                    # Entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ domain/                  # Domain models (Session, History, Process)
β”‚   β”‚   β”œβ”€β”€ history/            # History aggregate (30+ tests)
β”‚   β”‚   β”œβ”€β”€ session/            # Session aggregate
β”‚   β”‚   └── process/            # Process management
β”‚   β”œβ”€β”€ application/             # Use cases (10+ tests)
β”‚   β”‚   └── history/            # History use cases
β”‚   β”œβ”€β”€ infrastructure/          # External adapters (15+ tests)
β”‚   β”‚   β”œβ”€β”€ history/            # File persistence
β”‚   β”‚   └── executor/           # Command execution
β”‚   └── interfaces/              # UI layer
β”‚       └── repl/               # Bubbletea REPL
└── docs/                        # Documentation
    └── dev/                     # Development docs

πŸ§ͺ Testing

GoSh has comprehensive test coverage:

# Run all tests
go test ./...

# Run with coverage
go test -cover ./...

# Run specific package
go test ./internal/domain/history/...

Current Test Coverage:

  • Domain layer: 95%+
  • Application layer: 90%+
  • Infrastructure layer: 80%+
  • Total: 130+ tests passing across 21 packages

πŸ—ΊοΈ Roadmap

Current Version: v0.1.0-beta.4 βœ…

Status: In Development - Code Quality & API Refinement (breaking changes in this release)

What's New in beta.4:

  • Comprehensive linter cleanup (524β†’46 errors, 91% reduction)
  • Security fixes (gosec): file permissions, secure defaults
  • API improvements: renamed stuttering types for Go idioms
  • Code quality: removed dead code, fixed deprecations
  • Documentation: 385 comment improvements, architecture docs

Previously Implemented (alpha.1 β†’ beta.3):

  • History persistence and navigation (alpha.1-2)
  • Built-in commands: cd, pwd, export, unset, type, alias (alpha.3-4)
  • .goshrc configuration file (alpha.4)
  • Unix-style pipelines (|) (alpha.5)
  • File redirections (>, >>, <, 2>) (alpha.6)
  • Background jobs (&, jobs, fg, bg) (beta.1)
  • Glob patterns (*, ?, [], {}) (beta.2)
  • Visual help overlay (F1/?) (beta.3)
  • 4 UI modes: Classic, Warp, Compact, Chat
  • 130+ tests, CI/CD on 3 platforms
Next: v0.1.0-rc.1 (After beta.4)
  • Address community feedback from beta.4
  • Fix critical bugs reported by users
  • Performance optimizations if needed
  • Final polish before stable release
Future: v0.1.0 (Stable Release)
  • No critical bugs
  • Community-validated features
  • Complete documentation
  • Production-ready
Post-Release: v0.2.0

Based on community feedback:

  • Ctrl+R fuzzy search UI
  • Enhanced scripting support
  • Advanced configuration
  • Features requested by community

See RELEASE_ROADMAP.md for detailed roadmap.

πŸ“ Changelog

See CHANGELOG.md for detailed version history.

🀝 Contributing

Contributions are welcome! This project follows:

  • Semantic Versioning 2.0.0
  • Conventional Commits (feat:, fix:, docs:, etc.)
  • Test-Driven Development (TDD)
  • Domain-Driven Design principles
Development Workflow
# Clone repository
git clone https://github.com/grpmsoft/gosh.git
cd gosh

# Run tests
go test ./...

# Build
go build -o gosh ./cmd/gosh

# Run
./gosh

πŸ“„ License

MIT License - see LICENSE for details.

Third-party library licenses - see NOTICE for details.

πŸ™ Acknowledgments

Special Thanks

Professor Ancha Baranova - This project would not have been possible without her invaluable help and support. Her assistance was crucial in bringing GoSh to life.

Open Source Libraries
  • Bubbletea - Charm's excellent TUI framework
  • mvdan.cc/sh - Native POSIX shell interpreter
  • Lipgloss - Terminal styling library
  • Bubbles - TUI components

πŸ“ž Support


Built with ❀️ using Go and modern software architecture practices

GoSh aims to be the best cross-platform shell with native script execution and beautiful UI πŸš€

Directories ΒΆ

Path Synopsis
cmd
gosh command
Package main provides the entry point and dependency injection for the GoSh shell application.
Package main provides the entry point and dependency injection for the GoSh shell application.
internal
application/execute
Package execute provides use cases for command execution orchestration.
Package execute provides use cases for command execution orchestration.
application/history
Package history provides use cases for command history management.
Package history provides use cases for command history management.
application/ports
Package ports defines interfaces for adapters in hexagonal architecture.
Package ports defines interfaces for adapters in hexagonal architecture.
application/session
Package session provides use cases for shell session management.
Package session provides use cases for shell session management.
domain/builtins
Package builtins provides domain models for shell builtin commands.
Package builtins provides domain models for shell builtin commands.
domain/command
Package command provides domain models for shell commands and their execution semantics.
Package command provides domain models for shell commands and their execution semantics.
domain/config
Package config provides domain configuration models for shell behavior and UI modes.
Package config provides domain configuration models for shell behavior and UI modes.
domain/history
Package history provides domain models for command history management and navigation.
Package history provides domain models for command history management and navigation.
domain/job
Package job provides domain models for background job management.
Package job provides domain models for background job management.
domain/pipeline
Package pipeline provides domain models for command pipelines and their composition.
Package pipeline provides domain models for command pipelines and their composition.
domain/process
Package process provides domain models for OS process lifecycle management.
Package process provides domain models for OS process lifecycle management.
domain/session
Package session provides domain models for shell session state and environment.
Package session provides domain models for shell session state and environment.
domain/shared
Package shared provides common domain types and error definitions.
Package shared provides common domain types and error definitions.
infrastructure/builtin
Package builtin provides adapters for executing shell builtin commands.
Package builtin provides adapters for executing shell builtin commands.
infrastructure/config
Package config provides infrastructure for loading configuration from files.
Package config provides infrastructure for loading configuration from files.
infrastructure/executor
Package executor provides adapters for executing OS commands and pipelines.
Package executor provides adapters for executing OS commands and pipelines.
infrastructure/filesystem
Package filesystem provides adapters for filesystem operations.
Package filesystem provides adapters for filesystem operations.
infrastructure/history
Package history provides infrastructure for persisting command history to files.
Package history provides infrastructure for persisting command history to files.
interfaces/parser
Package parser provides lexical analysis and parsing for shell command syntax.
Package parser provides lexical analysis and parsing for shell command syntax.
interfaces/repl
Package repl provides the Read-Eval-Print-Loop interface using Bubbletea TUI framework.
Package repl provides the Read-Eval-Print-Loop interface using Bubbletea TUI framework.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL