kader 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli/README.md +169 -0
- cli/__init__.py +5 -0
- cli/__main__.py +6 -0
- cli/app.py +707 -0
- cli/app.tcss +664 -0
- cli/utils.py +68 -0
- cli/widgets/__init__.py +13 -0
- cli/widgets/confirmation.py +309 -0
- cli/widgets/conversation.py +55 -0
- cli/widgets/loading.py +59 -0
- kader/__init__.py +22 -0
- kader/agent/__init__.py +8 -0
- kader/agent/agents.py +126 -0
- kader/agent/base.py +927 -0
- kader/agent/logger.py +170 -0
- kader/config.py +139 -0
- kader/memory/__init__.py +66 -0
- kader/memory/conversation.py +409 -0
- kader/memory/session.py +385 -0
- kader/memory/state.py +211 -0
- kader/memory/types.py +116 -0
- kader/prompts/__init__.py +9 -0
- kader/prompts/agent_prompts.py +27 -0
- kader/prompts/base.py +81 -0
- kader/prompts/templates/planning_agent.j2 +26 -0
- kader/prompts/templates/react_agent.j2 +18 -0
- kader/providers/__init__.py +9 -0
- kader/providers/base.py +581 -0
- kader/providers/mock.py +96 -0
- kader/providers/ollama.py +447 -0
- kader/tools/README.md +483 -0
- kader/tools/__init__.py +130 -0
- kader/tools/base.py +955 -0
- kader/tools/exec_commands.py +249 -0
- kader/tools/filesys.py +650 -0
- kader/tools/filesystem.py +607 -0
- kader/tools/protocol.py +456 -0
- kader/tools/rag.py +555 -0
- kader/tools/todo.py +210 -0
- kader/tools/utils.py +456 -0
- kader/tools/web.py +246 -0
- kader-0.1.5.dist-info/METADATA +321 -0
- kader-0.1.5.dist-info/RECORD +45 -0
- kader-0.1.5.dist-info/WHEEL +4 -0
- kader-0.1.5.dist-info/entry_points.txt +2 -0
cli/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Kader CLI
|
|
2
|
+
|
|
3
|
+
A modern terminal-based AI coding assistant built with Python's [Textual](https://textual.textualize.io/) framework, powered by **ReActAgent** with tool execution capabilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🤖 **ReAct Agent** - Intelligent agent with reasoning and tool execution
|
|
8
|
+
- 🛠️ **Built-in Tools** - File system, command execution, web search
|
|
9
|
+
- 📁 **Directory Tree** - Auto-refreshing sidebar showing current working directory
|
|
10
|
+
- 💬 **Conversation View** - Markdown-rendered chat history
|
|
11
|
+
- 💾 **Session Persistence** - Save and load conversation sessions
|
|
12
|
+
- 🎨 **Color Themes** - 4 themes (dark, ocean, forest, sunset)
|
|
13
|
+
- 🔧 **Tool Confirmation** - Interactive approval for tool execution
|
|
14
|
+
- 🤖 **Model Selection** - Dynamic model switching interface
|
|
15
|
+
- 📝 **File Operations** - Integrated file system tools for coding tasks
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- [Ollama](https://ollama.ai/) running locally
|
|
20
|
+
- Model `gpt-oss:120b-cloud` (or update `DEFAULT_MODEL` in `utils.py`)
|
|
21
|
+
- Python 3.11 or higher
|
|
22
|
+
- [uv](https://docs.astral.sh/uv/) package manager (recommended) or [pip](https://pypi.org/project/pip/)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Using uv (recommended)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Clone the repository
|
|
30
|
+
git clone https://github.com/your-repo/kader.git
|
|
31
|
+
cd kader
|
|
32
|
+
|
|
33
|
+
# Install dependencies
|
|
34
|
+
uv sync
|
|
35
|
+
|
|
36
|
+
# Run the CLI
|
|
37
|
+
uv run python -m cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Using pip
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Clone the repository
|
|
44
|
+
git clone https://github.com/your-repo/kader.git
|
|
45
|
+
cd kader
|
|
46
|
+
|
|
47
|
+
# Install dependencies
|
|
48
|
+
pip install -e .
|
|
49
|
+
|
|
50
|
+
# Run the CLI
|
|
51
|
+
python -m cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
| Command | Description |
|
|
57
|
+
|---------|-------------|
|
|
58
|
+
| `/help` | Show command reference |
|
|
59
|
+
| `/models` | Show available Ollama models |
|
|
60
|
+
| `/theme` | Cycle color themes |
|
|
61
|
+
| `/clear` | Clear conversation |
|
|
62
|
+
| `/save` | Save current session |
|
|
63
|
+
| `/load <id>` | Load a saved session |
|
|
64
|
+
| `/sessions` | List saved sessions |
|
|
65
|
+
| `/refresh` | Refresh file tree |
|
|
66
|
+
| `/exit` | Exit the CLI |
|
|
67
|
+
|
|
68
|
+
## Keyboard Shortcuts
|
|
69
|
+
|
|
70
|
+
| Shortcut | Action |
|
|
71
|
+
|----------|--------|
|
|
72
|
+
| `Ctrl+Q` | Quit |
|
|
73
|
+
| `Ctrl+L` | Clear conversation |
|
|
74
|
+
| `Ctrl+T` | Cycle theme |
|
|
75
|
+
| `Ctrl+S` | Save session |
|
|
76
|
+
| `Ctrl+R` | Refresh file tree |
|
|
77
|
+
| `Tab` | Navigate panels |
|
|
78
|
+
|
|
79
|
+
## Input Editing
|
|
80
|
+
|
|
81
|
+
| Shortcut | Action |
|
|
82
|
+
|----------|--------|
|
|
83
|
+
| `Ctrl+C` | Copy selected text |
|
|
84
|
+
| `Ctrl+V` | Paste from clipboard |
|
|
85
|
+
| `Ctrl+A` | Select all text |
|
|
86
|
+
| Click+Drag | Select text |
|
|
87
|
+
|
|
88
|
+
## Session Management
|
|
89
|
+
|
|
90
|
+
Sessions are saved to `~/.kader/sessions/`. Use:
|
|
91
|
+
|
|
92
|
+
- `/save` to save current conversation
|
|
93
|
+
- `/sessions` to list all saved sessions
|
|
94
|
+
- `/load <session_id>` to restore a session
|
|
95
|
+
|
|
96
|
+
## Tool Confirmation System
|
|
97
|
+
|
|
98
|
+
Kader includes an interactive tool confirmation system that prompts for approval before executing tools. This provides:
|
|
99
|
+
|
|
100
|
+
- Safe execution of potentially destructive operations
|
|
101
|
+
- Interactive approval with arrow keys and Enter
|
|
102
|
+
- Quick confirmation with Y/N keys
|
|
103
|
+
- Visual feedback during tool execution
|
|
104
|
+
|
|
105
|
+
## Model Selection Interface
|
|
106
|
+
|
|
107
|
+
The model selection interface allows you to:
|
|
108
|
+
|
|
109
|
+
- Browse available Ollama models
|
|
110
|
+
- Switch models on the fly during conversation
|
|
111
|
+
- See which models are currently installed
|
|
112
|
+
- Cancel selection without changing the current model
|
|
113
|
+
|
|
114
|
+
## Project Structure
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
cli/
|
|
118
|
+
├── app.py # Main application (ReActAgent integration)
|
|
119
|
+
├── app.tcss # Styles (TCSS)
|
|
120
|
+
├── utils.py # Constants and helpers
|
|
121
|
+
├── __init__.py # Package exports
|
|
122
|
+
├── __main__.py # Entry point
|
|
123
|
+
└── widgets/ # Custom UI components
|
|
124
|
+
├── __init__.py
|
|
125
|
+
├── conversation.py # Chat display
|
|
126
|
+
├── loading.py # Spinner animation
|
|
127
|
+
└── confirmation.py # Tool and model selection widgets
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Changing the Model
|
|
131
|
+
|
|
132
|
+
Edit `DEFAULT_MODEL` in `utils.py`:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
DEFAULT_MODEL = "gpt-oss:120b-cloud"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
Run with live CSS reloading:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uv run textual run --dev cli.app:KaderApp
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Configuration
|
|
147
|
+
|
|
148
|
+
Kader automatically creates a `.kader` directory in your home directory on first run. This stores:
|
|
149
|
+
|
|
150
|
+
- Session data in `~/.kader/sessions/`
|
|
151
|
+
- Configuration files in `~/.kader/`
|
|
152
|
+
- Memory files in `~/.kader/memory/`
|
|
153
|
+
|
|
154
|
+
## Troubleshooting
|
|
155
|
+
|
|
156
|
+
### Common Issues
|
|
157
|
+
|
|
158
|
+
- **No models found**: Make sure Ollama is running and you have at least one model installed (e.g., `ollama pull gpt-oss:120b-cloud`)
|
|
159
|
+
- **Connection errors**: Verify that Ollama service is accessible at the configured endpoint
|
|
160
|
+
- **Theme not changing**: Some terminal emulators may not support all color themes
|
|
161
|
+
|
|
162
|
+
### Debugging
|
|
163
|
+
|
|
164
|
+
If you encounter issues:
|
|
165
|
+
|
|
166
|
+
1. Check that Ollama is running: `ollama serve`
|
|
167
|
+
2. Verify your model is pulled: `ollama list`
|
|
168
|
+
3. Ensure your terminal supports the required features
|
|
169
|
+
4. Check the logs for specific error messages
|
cli/__init__.py
ADDED