Terminal-based AI coding agent with interactive TUI for autonomous code generation.

Features:
  - Interactive TUI with React/Ink
  - Autonomous agent with tool calls (bash, read, write, edit, glob, grep)
  - Permission system with pattern-based rules
  - Session management with auto-compaction
  - Dual providers: GitHub Copilot and Ollama
  - MCP server integration
  - Todo panel and theme system
  - Streaming responses
  - GitHub-compatible project context
This commit is contained in:
2026-01-27 23:33:06 -05:00
commit 0062e5d9d9
521 changed files with 66418 additions and 0 deletions

132
docs/CHANGELOG.md Normal file
View File

@@ -0,0 +1,132 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- **Home Screen**: New welcome screen with centered gradient logo
- Displays version, provider, and model info
- Transitions to session view on first message
- Clean, centered layout
- **MCP Integration**: Model Context Protocol server support
- Connect to external MCP servers
- Use tools from connected servers
- `/mcp` command for server management
- Status display in UI
- **Reasoning System**: Advanced agent orchestration
- Memory selection for context optimization
- Quality evaluation of responses
- Termination detection for agent loops
- Context compression for long conversations
- Retry policies with exponential backoff
- **Todo Panel**: Task tracking during sessions
- Toggle visibility with `Ctrl+T`
- `todo-read` and `todo-write` tools
- Zustand-based state management
- **Theme System**: Customizable color themes
- `/theme` command to switch themes
- Dark, Light, Tokyo Night, Dracula themes
- Persistent theme preference
- **Agent Selection**: Switch between agent modes
- `/agent` command for selection
- Coder, Architect, Reviewer agents
- **Learning System**: Knowledge persistence
- Vector store for embeddings
- Semantic search capabilities
- Project learnings storage
- **Streaming Responses**: Real-time message display
- Faster feedback from LLM
- Progress indicators
- **Enhanced Navigation**:
- `PageUp/PageDown` for fast scrolling
- `Shift+Up/Down` for line-by-line scroll
- `Ctrl+Home/End` to jump to top/bottom
- **Optimized Permissions**: Performance improvements
- Pattern caching
- Indexed pattern matching
- Faster permission checks
- **Auto-Compaction**: Context management
- Automatic conversation compression
- Maintains context within limits
### Changed
- Improved session header with token count and context percentage
- Enhanced status bar with MCP connection info
- Better command menu with more commands
## [0.1.0] - 2025-01-16
### Added
- **Interactive TUI**: Full terminal UI using Ink (React for CLIs)
- Message-based input (Enter to send, Alt+Enter for newlines)
- Log panel showing conversation history
- Status bar with session info
- ASCII banner header
- **Permission System**: Granular control over tool execution
- Interactive permission modal with keyboard navigation
- Scoped permissions: once, session, project, global
- Pattern-based matching: `Bash(command:args)`, `Read(*)`, `Write(path)`, `Edit(*.ext)`
- Persistent storage in `~/.codetyper/settings.json` and `.codetyper/settings.json`
- **Agent System**: Autonomous task execution
- Multi-turn conversation with tool calls
- Automatic retry with exponential backoff for rate limits
- Configurable max iterations
- **Tools**:
- `bash` - Execute shell commands
- `read` - Read file contents
- `write` - Create or overwrite files
- `edit` - Find and replace in files
- **Provider Support**:
- GitHub Copilot (default) - OAuth device flow authentication, access to GPT-4o, GPT-5, Claude, Gemini via Copilot API
- Ollama - Local server (no auth), run any local model
- **Session Management**:
- Persistent session storage
- Continue previous sessions with `--continue`
- Resume specific sessions with `--resume <id>`
- **CLI Commands**:
- `codetyper` - Start interactive TUI
- `codetyper <prompt>` - Start with initial prompt
- `codetyper login <provider>` - Authenticate with provider
- `codetyper status` - Show provider status
- `codetyper config` - Manage configuration
### Changed
- Migrated from readline-based input to Ink TUI
- Removed classic mode in favor of TUI-only interface
- Tool output now captured and displayed in log panel (not streamed to stdout)
### Fixed
- Permission modal not showing in TUI mode
- Input area blocking during command execution
- Rate limit handling for Copilot provider (429 errors)
---
## Version History
- **0.1.0** - Initial release with TUI, agent system, and multi-provider support

202
docs/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,202 @@
# Contributing to CodeTyper CLI
Thank you for your interest in contributing to CodeTyper CLI! This document provides guidelines and instructions for contributing.
## Code of Conduct
Please be respectful and constructive in all interactions. We welcome contributors of all experience levels.
## Getting Started
### Prerequisites
- Node.js >= 18.0.0
- npm or yarn
- Git
### Setup
1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/codetyper-cli.git
cd codetyper-cli
```
3. Install dependencies:
```bash
npm install
```
4. Build the project:
```bash
npm run build
```
5. Link for local testing:
```bash
npm link
```
### Development Workflow
```bash
# Start TypeScript watch mode
npm run dev
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run format
```
## How to Contribute
### Reporting Bugs
1. Check existing issues to avoid duplicates
2. Create a new issue with:
- Clear, descriptive title
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Node version, provider)
- Relevant logs or screenshots
### Suggesting Features
1. Check existing issues for similar requests
2. Create a feature request with:
- Clear description of the feature
- Use cases and motivation
- Proposed implementation (optional)
### Submitting Pull Requests
1. Create a branch from `main`:
```bash
git checkout -b feature/your-feature-name
```
2. Make your changes following our coding standards
3. Write/update tests if applicable
4. Ensure all tests pass:
```bash
npm test
```
5. Commit with clear messages:
```bash
git commit -m "feat: add new feature description"
```
6. Push and create a Pull Request
### Commit Message Format
We follow [Conventional Commits](https://www.conventionalcommits.org/):
- `feat:` - New feature
- `fix:` - Bug fix
- `docs:` - Documentation changes
- `style:` - Code style changes (formatting, etc.)
- `refactor:` - Code refactoring
- `test:` - Adding or updating tests
- `chore:` - Maintenance tasks
Examples:
```
feat: add permission caching for faster lookups
fix: resolve race condition in agent loop
docs: update README with new CLI options
```
## Coding Standards
### TypeScript
- Use TypeScript strict mode
- Define explicit types (avoid `any` when possible)
- Use interfaces for object shapes
- Export types that are part of the public API
### Code Style
- Use 2 spaces for indentation
- Use single quotes for strings
- Add trailing commas in multi-line structures
- Keep lines under 100 characters when reasonable
### File Organization
```
src/
├── index.ts # Entry point only
├── commands/ # CLI command implementations
├── providers/ # LLM provider integrations
├── tools/ # Agent tools (bash, read, write, edit)
├── tui/ # Terminal UI components
│ └── components/ # Reusable UI components
└── types.ts # Shared type definitions
```
### Testing
- Write tests for non-UI logic
- Place tests in `tests/` directory
- Name test files `*.test.ts`
- Use descriptive test names
```typescript
describe('PermissionManager', () => {
it('should match wildcard patterns correctly', () => {
// ...
});
});
```
### Documentation
- Add JSDoc comments for public APIs
- Update README for user-facing changes
- Update CHANGELOG for notable changes
## Project Structure
### Key Files
| File | Purpose |
|------|---------|
| `src/index.ts` | CLI entry point, command registration |
| `src/agent.ts` | Agent loop, tool orchestration |
| `src/permissions.ts` | Permission system |
| `src/commands/chat-tui.tsx` | Main TUI command |
| `src/tui/App.tsx` | Root TUI component |
| `src/tui/store.ts` | Zustand state management |
### Adding a New Provider
1. Create `src/providers/yourprovider.ts`
2. Implement the `Provider` interface
3. Register in `src/providers/index.ts`
4. Add authentication in `src/commands/login.ts`
5. Update documentation
### Adding a New Tool
1. Create `src/tools/yourtool.ts`
2. Define parameters with Zod schema
3. Implement `execute` function
4. Register in `src/tools/index.ts`
5. Add permission handling if needed
## Questions?
- Open a GitHub issue for questions
- Tag with `question` label
## License
By contributing, you agree that your contributions will be licensed under the MIT License.