kon-coding-agent 0.1.0__tar.gz
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.
- kon_coding_agent-0.1.0/.gitignore +19 -0
- kon_coding_agent-0.1.0/.kon/skills/kon-tmux-test/SKILL.md +208 -0
- kon_coding_agent-0.1.0/.kon/skills/kon-tmux-test/run-e2e-tests.sh +222 -0
- kon_coding_agent-0.1.0/.kon/skills/kon-tmux-test/setup-test-project.sh +27 -0
- kon_coding_agent-0.1.0/.python-version +1 -0
- kon_coding_agent-0.1.0/AGENTS.md +20 -0
- kon_coding_agent-0.1.0/LICENSE +21 -0
- kon_coding_agent-0.1.0/PKG-INFO +295 -0
- kon_coding_agent-0.1.0/README.md +279 -0
- kon_coding_agent-0.1.0/TODO.md +6 -0
- kon_coding_agent-0.1.0/pyproject.toml +72 -0
- kon_coding_agent-0.1.0/scripts/test_models.py +332 -0
- kon_coding_agent-0.1.0/scripts/test_thinking_blocks.py +195 -0
- kon_coding_agent-0.1.0/src/kon/__init__.py +36 -0
- kon_coding_agent-0.1.0/src/kon/config.py +229 -0
- kon_coding_agent-0.1.0/src/kon/context/__init__.py +13 -0
- kon_coding_agent-0.1.0/src/kon/context/agents.py +129 -0
- kon_coding_agent-0.1.0/src/kon/context/loader.py +41 -0
- kon_coding_agent-0.1.0/src/kon/context/shared.py +8 -0
- kon_coding_agent-0.1.0/src/kon/context/skills.py +217 -0
- kon_coding_agent-0.1.0/src/kon/core/__init__.py +41 -0
- kon_coding_agent-0.1.0/src/kon/core/compaction.py +89 -0
- kon_coding_agent-0.1.0/src/kon/core/types.py +152 -0
- kon_coding_agent-0.1.0/src/kon/defaults/__init__.py +0 -0
- kon_coding_agent-0.1.0/src/kon/defaults/config.toml +45 -0
- kon_coding_agent-0.1.0/src/kon/events.py +200 -0
- kon_coding_agent-0.1.0/src/kon/llm/__init__.py +64 -0
- kon_coding_agent-0.1.0/src/kon/llm/base.py +132 -0
- kon_coding_agent-0.1.0/src/kon/llm/models.py +147 -0
- kon_coding_agent-0.1.0/src/kon/llm/oauth/__init__.py +37 -0
- kon_coding_agent-0.1.0/src/kon/llm/oauth/copilot.py +352 -0
- kon_coding_agent-0.1.0/src/kon/llm/oauth/openai.py +390 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/__init__.py +53 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/anthropic.py +338 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/copilot.py +148 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/copilot_anthropic.py +126 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/github_copilot_headers.py +42 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/mock.py +157 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/openai_codex_responses.py +292 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/openai_completions.py +378 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/openai_responses.py +421 -0
- kon_coding_agent-0.1.0/src/kon/llm/providers/sanitize.py +14 -0
- kon_coding_agent-0.1.0/src/kon/loop.py +269 -0
- kon_coding_agent-0.1.0/src/kon/py.typed +0 -0
- kon_coding_agent-0.1.0/src/kon/session.py +577 -0
- kon_coding_agent-0.1.0/src/kon/shared.py +8 -0
- kon_coding_agent-0.1.0/src/kon/tools/__init__.py +49 -0
- kon_coding_agent-0.1.0/src/kon/tools/_read_image.py +106 -0
- kon_coding_agent-0.1.0/src/kon/tools/base.py +24 -0
- kon_coding_agent-0.1.0/src/kon/tools/bash.py +289 -0
- kon_coding_agent-0.1.0/src/kon/tools/edit.py +199 -0
- kon_coding_agent-0.1.0/src/kon/tools/find.py +137 -0
- kon_coding_agent-0.1.0/src/kon/tools/grep.py +171 -0
- kon_coding_agent-0.1.0/src/kon/tools/read.py +132 -0
- kon_coding_agent-0.1.0/src/kon/tools/write.py +54 -0
- kon_coding_agent-0.1.0/src/kon/tools_manager.py +222 -0
- kon_coding_agent-0.1.0/src/kon/turn.py +458 -0
- kon_coding_agent-0.1.0/src/kon/ui/__init__.py +0 -0
- kon_coding_agent-0.1.0/src/kon/ui/app.py +733 -0
- kon_coding_agent-0.1.0/src/kon/ui/app_protocol.py +35 -0
- kon_coding_agent-0.1.0/src/kon/ui/autocomplete.py +348 -0
- kon_coding_agent-0.1.0/src/kon/ui/blocks.py +207 -0
- kon_coding_agent-0.1.0/src/kon/ui/chat.py +241 -0
- kon_coding_agent-0.1.0/src/kon/ui/clipboard.py +59 -0
- kon_coding_agent-0.1.0/src/kon/ui/commands.py +615 -0
- kon_coding_agent-0.1.0/src/kon/ui/export.py +323 -0
- kon_coding_agent-0.1.0/src/kon/ui/floating_list.py +224 -0
- kon_coding_agent-0.1.0/src/kon/ui/formatting.py +116 -0
- kon_coding_agent-0.1.0/src/kon/ui/input.py +515 -0
- kon_coding_agent-0.1.0/src/kon/ui/path_complete.py +228 -0
- kon_coding_agent-0.1.0/src/kon/ui/selection_mode.py +8 -0
- kon_coding_agent-0.1.0/src/kon/ui/session_ui.py +226 -0
- kon_coding_agent-0.1.0/src/kon/ui/styles.py +191 -0
- kon_coding_agent-0.1.0/src/kon/ui/widgets.py +281 -0
- kon_coding_agent-0.1.0/tests/conftest.py +5 -0
- kon_coding_agent-0.1.0/tests/context/test_agents.py +289 -0
- kon_coding_agent-0.1.0/tests/context/test_skills.py +385 -0
- kon_coding_agent-0.1.0/tests/llm/__init__.py +0 -0
- kon_coding_agent-0.1.0/tests/llm/test_mock_provider.py +142 -0
- kon_coding_agent-0.1.0/tests/test_agentic_loop.py +516 -0
- kon_coding_agent-0.1.0/tests/test_cli_provider_resolution.py +27 -0
- kon_coding_agent-0.1.0/tests/test_compaction.py +332 -0
- kon_coding_agent-0.1.0/tests/test_config_binaries.py +34 -0
- kon_coding_agent-0.1.0/tests/test_config_error_fallback.py +28 -0
- kon_coding_agent-0.1.0/tests/test_config_injection.py +92 -0
- kon_coding_agent-0.1.0/tests/test_model_provider_resolution.py +19 -0
- kon_coding_agent-0.1.0/tests/test_session_persistence.py +521 -0
- kon_coding_agent-0.1.0/tests/test_system_prompt.py +18 -0
- kon_coding_agent-0.1.0/tests/tools/test_diff.py +132 -0
- kon_coding_agent-0.1.0/tests/tools/test_edit.py +74 -0
- kon_coding_agent-0.1.0/tests/tools/test_read.py +56 -0
- kon_coding_agent-0.1.0/tests/tools/test_read_image.py +46 -0
- kon_coding_agent-0.1.0/tests/tools/test_read_image_integration.py +43 -0
- kon_coding_agent-0.1.0/tests/tools/test_write.py +31 -0
- kon_coding_agent-0.1.0/tests/ui/test_autocomplete.py +281 -0
- kon_coding_agent-0.1.0/tests/ui/test_floating_list.py +35 -0
- kon_coding_agent-0.1.0/tests/ui/test_input_paste.py +73 -0
- kon_coding_agent-0.1.0/uv.lock +1500 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kon-tmux-test
|
|
3
|
+
description: E2E testing of kon using tmux sessions; IMPORTANT: only trigger this skill when user asks for e2e testing of kon
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kon Tmux E2E Testing
|
|
7
|
+
|
|
8
|
+
End-to-end testing of kon using tmux sessions to programmatically control the TUI application.
|
|
9
|
+
|
|
10
|
+
## Why Tmux?
|
|
11
|
+
|
|
12
|
+
Kon is a TUI (Textual-based) app. Running tests programmatically is hard. Tmux provides:
|
|
13
|
+
- `tmux new-session` - isolate test environment
|
|
14
|
+
- `tmux send-keys` - send keyboard input
|
|
15
|
+
- `tmux capture-pane` - capture output
|
|
16
|
+
- `tmux has-session` - check if kon is running
|
|
17
|
+
|
|
18
|
+
## Test Design Philosophy
|
|
19
|
+
|
|
20
|
+
- **Deterministic**: Shell scripts create reproducible test environments
|
|
21
|
+
- **Separation of concerns**: Shell script runs steps and captures output; kon (AI) evaluates results
|
|
22
|
+
- **Output-based evaluation**: Test success/failure determined by AI reading output files, not shell script heuristics
|
|
23
|
+
- **UI-focused**: Test triggers (@, / commands) by checking UI elements appear
|
|
24
|
+
- **Single conversation**: Encourage all tool calls in one query
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Run all e2e tests
|
|
30
|
+
bash ~/.kon/skills/kon-tmux-test/run-e2e-tests.sh
|
|
31
|
+
|
|
32
|
+
# After running, kon (the AI) reads the output files and evaluates results
|
|
33
|
+
# Output files: /tmp/kon-test-*.txt
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Test Scripts
|
|
37
|
+
|
|
38
|
+
### Setup Script: `setup-test-project.sh`
|
|
39
|
+
|
|
40
|
+
Creates the same deterministic test project structure each time at `/tmp/kon-test-project/`:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bash ~/.kon/skills/kon-tmux-test/setup-test-project.sh
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Test project structure:
|
|
47
|
+
```
|
|
48
|
+
/tmp/kon-test-project/
|
|
49
|
+
├── README.md # Project documentation
|
|
50
|
+
├── config.json # Config file with basic data
|
|
51
|
+
├── notes.txt # Simple text notes
|
|
52
|
+
├── utils.py # Python utility file
|
|
53
|
+
└── data.py # Python data file
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Main Test Script: `run-e2e-tests.sh`
|
|
57
|
+
|
|
58
|
+
Runs comprehensive e2e tests including UI triggers and tool execution:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bash ~/.kon/skills/kon-tmux-test/run-e2e-tests.sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Test Categories
|
|
65
|
+
|
|
66
|
+
### UI Trigger Tests (LLM-independent)
|
|
67
|
+
- **/ commands**: Type `/`, verify slash command list appears with all commands
|
|
68
|
+
- **@ file search**: Type `@pyproject`, verify file picker appears with pyproject.toml
|
|
69
|
+
- **/model command**: Type `/model`, verify model selector appears, then dismiss
|
|
70
|
+
- **/new command**: Type `/new`, verify new conversation is started
|
|
71
|
+
- **/resume command**: Type `/resume`, verify session list appears, then dismiss
|
|
72
|
+
- **/session command**: Type `/session`, verify session info/statistics displayed
|
|
73
|
+
|
|
74
|
+
### Tab Path Completion Tests (LLM-independent)
|
|
75
|
+
- **Unique match**: Type `sr` + Tab, verify completes to `src/` directly
|
|
76
|
+
- **Multiple alternatives**: Type `s` + Tab, verify floating list shows `scripts/`, `src/`
|
|
77
|
+
- **Home directory**: Type `~/De` + Tab, verify floating list shows `Desktop/`, `Developer/`, etc.
|
|
78
|
+
- **Select from list**: Type `s` + Tab + Enter, verify `scripts/` is applied to input
|
|
79
|
+
|
|
80
|
+
### Tool Execution Tests (File system verification)
|
|
81
|
+
- **Write tool**: Creates files, verified by file existence
|
|
82
|
+
- **Edit tool**: Modifies files, verified by file content
|
|
83
|
+
- **List files**: Shows directory contents, verified by output
|
|
84
|
+
- **Calculation**: Computes results, verified by LLM output (acceptable for non-tool operations)
|
|
85
|
+
|
|
86
|
+
## Running Tests
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run all tests - script executes steps and captures output
|
|
90
|
+
bash ~/.kon/skills/kon-tmux-test/run-e2e-tests.sh
|
|
91
|
+
|
|
92
|
+
# After running, the AI (kon) reads output files and provides evaluation:
|
|
93
|
+
# - /tmp/kon-test-1-commands.txt (/ slash commands list)
|
|
94
|
+
# - /tmp/kon-test-2-at-trigger.txt (@ file picker test)
|
|
95
|
+
# - /tmp/kon-test-3-model.txt (/model selector test)
|
|
96
|
+
# - /tmp/kon-test-4-new.txt (/new conversation test)
|
|
97
|
+
# - /tmp/kon-test-5-tab-unique.txt (Tab completion unique match)
|
|
98
|
+
# - /tmp/kon-test-6-tab-multiple.txt (Tab completion floating list)
|
|
99
|
+
# - /tmp/kon-test-7-tab-home.txt (Tab completion home directory)
|
|
100
|
+
# - /tmp/kon-test-8-tab-select.txt (Tab completion select from list)
|
|
101
|
+
# - /tmp/kon-test-9-tools.txt (tool execution test)
|
|
102
|
+
# - /tmp/kon-test-10-session.txt (/session stats test)
|
|
103
|
+
# - /tmp/kon-test-11-resume.txt (/resume session list test)
|
|
104
|
+
# - /tmp/kon-test-files.txt (file system state)
|
|
105
|
+
# - /tmp/kon-test-test1-content.txt (test1.txt content)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
Edit `run-e2e-tests.sh` to adjust:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
WAIT_TIME=30 # Time for LLM to complete all tasks (adjust based on model speed)
|
|
114
|
+
COMMAND_WAIT_TIME=3 # Time for UI commands to settle
|
|
115
|
+
SESSION_NAME="kon-test" # Tmux session name
|
|
116
|
+
TEST_DIR="/tmp/kon-test-project" # Test project directory for tool execution
|
|
117
|
+
KON_DIR="$HOME/Developer/personal/kon" # Kon repo directory (for tab completion tests)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Key Tmux Gotchas
|
|
121
|
+
|
|
122
|
+
- **Use `Escape` not `Esc`**: tmux recognizes `Escape` as the escape key. `Esc` is NOT a valid key name and sends literal characters 'E', 's', 'c' as text.
|
|
123
|
+
- **Always clear input between tests**: Use `Escape` to dismiss completions, then `C-u` to clear text. Without this, text from one test bleeds into the next.
|
|
124
|
+
- **Completion selectors block input**: The model selector and session list intercept Enter/Escape. Always dismiss them with `Escape` before the next test.
|
|
125
|
+
|
|
126
|
+
## Test Evaluation (by Kon)
|
|
127
|
+
|
|
128
|
+
After running the test script, kon evaluates the results by reading the output files:
|
|
129
|
+
|
|
130
|
+
### What to Check
|
|
131
|
+
|
|
132
|
+
**UI Trigger Tests (by reading output files):**
|
|
133
|
+
- `/` test: Slash command list appears showing commands (help, model, new, etc.)
|
|
134
|
+
- `@` test: File picker appears and shows files (pyproject.toml)
|
|
135
|
+
- `/model` test: Model selector appears with model list
|
|
136
|
+
- `/new` test: "Started new conversation" message appears
|
|
137
|
+
- `/resume` test: Session list appears with prior sessions
|
|
138
|
+
- `/session` test: Session info/statistics displayed (messages, tokens)
|
|
139
|
+
|
|
140
|
+
**Tab Path Completion Tests (by reading output files):**
|
|
141
|
+
- `sr` + Tab test: Input shows `src/` (unique completion applied)
|
|
142
|
+
- `s` + Tab test: Floating list visible with `scripts/` and `src/` options
|
|
143
|
+
- `~/De` + Tab test: Floating list visible with `Desktop/`, `Developer/`, `Documents/`, `Downloads/`
|
|
144
|
+
- `s` + Tab + Enter test: Input shows `scripts/` (selection applied)
|
|
145
|
+
|
|
146
|
+
**Tool Execution Tests (by reading output files + file system):**
|
|
147
|
+
- `test1.txt` created in /tmp/kon-test-project/
|
|
148
|
+
- `test1.txt` contains "world" (not "hello")
|
|
149
|
+
- Directory listing shows files
|
|
150
|
+
|
|
151
|
+
### Tabular Report
|
|
152
|
+
|
|
153
|
+
Kon provides a tabular summary after reading all output files, showing:
|
|
154
|
+
- Test name
|
|
155
|
+
- Status (PASS/FAIL)
|
|
156
|
+
- Description
|
|
157
|
+
- Overall success rate
|
|
158
|
+
|
|
159
|
+
### IMPORTANT: Always offer the view command
|
|
160
|
+
|
|
161
|
+
After presenting the tabular report, ALWAYS give the user this shell command so they can inspect the raw captured outputs in their terminal:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
for f in /tmp/kon-test-*.txt; do printf "\n\033[1;36m▶▶▶ %s\033[0m\n" "$f"; awk 'NF{found=1} found{lines[++n]=$0} END{while(n>0 && lines[n]=="") n--; for(i=1;i<=n;i++) print lines[i]}' "$f"; done
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Cleanup
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Test script auto-cleans tmux session on exit via trap
|
|
171
|
+
# Output files remain for kon to evaluate (/tmp/kon-test-*.txt)
|
|
172
|
+
# Manual cleanup if needed:
|
|
173
|
+
tmux kill-session -t kon-test 2>/dev/null
|
|
174
|
+
rm -rf /tmp/kon-test-project
|
|
175
|
+
rm -f /tmp/kon-test-*.txt
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Tmux Commands Reference
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Session management
|
|
182
|
+
tmux new-session -d -s <name> -c <dir> '<command>' # Create detached session
|
|
183
|
+
tmux kill-session -t <name> # Kill session
|
|
184
|
+
tmux has-session -t <name> # Check if session exists
|
|
185
|
+
|
|
186
|
+
# Input — IMPORTANT: use full key names (Escape, Enter, not Esc)
|
|
187
|
+
tmux send-keys -t <name> "text" # Send text
|
|
188
|
+
tmux send-keys -t <name> Enter # Send Enter key
|
|
189
|
+
tmux send-keys -t <name> Escape # Send Escape key (NOT "Esc"!)
|
|
190
|
+
tmux send-keys -t <name> Tab # Send Tab key
|
|
191
|
+
tmux send-keys -t <name> C-c # Send Ctrl+C
|
|
192
|
+
tmux send-keys -t <name> C-u # Send Ctrl+U (clear line)
|
|
193
|
+
|
|
194
|
+
# Output
|
|
195
|
+
tmux capture-pane -t <name> -p # Capture pane to stdout
|
|
196
|
+
tmux capture-pane -t <name> -p > file.txt # Save to file
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Tips
|
|
200
|
+
|
|
201
|
+
- Tests are deterministic: same project structure recreated each run
|
|
202
|
+
- UI tests don't depend on LLM: verify TUI elements appear
|
|
203
|
+
- Tab completion tests run from kon repo to test on known directory structure
|
|
204
|
+
- Tool tests verify file system: check actual files, not LLM output
|
|
205
|
+
- Use `trap cleanup EXIT` to ensure tmux session is always cleaned up
|
|
206
|
+
- Adjust `WAIT_TIME` based on model speed for tool execution tests
|
|
207
|
+
- Output files saved to `/tmp/kon-test-*.txt` for debugging
|
|
208
|
+
- Run tool execution before /resume so there's a session with messages in the list
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Comprehensive e2e test script for kon
|
|
4
|
+
# Tests UI triggers (@, / commands, Tab completion) and tool execution
|
|
5
|
+
# This script runs steps and captures output — evaluation is done by kon reading the output files
|
|
6
|
+
|
|
7
|
+
# Configuration
|
|
8
|
+
WAIT_TIME=30 # Time for LLM to complete tool tasks
|
|
9
|
+
COMMAND_WAIT_TIME=3 # Time for UI commands to settle
|
|
10
|
+
SESSION_NAME="kon-test"
|
|
11
|
+
TEST_DIR="/tmp/kon-test-project"
|
|
12
|
+
KON_DIR="$PWD" # use caller's current working directory for tab completion tests
|
|
13
|
+
|
|
14
|
+
# Helper functions
|
|
15
|
+
cleanup() {
|
|
16
|
+
tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
capture() {
|
|
20
|
+
tmux capture-pane -t "$SESSION_NAME" -p > "$1"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Dismiss any open completion/selector and clear the input line.
|
|
24
|
+
# Uses Escape (NOT "Esc" which tmux would send as literal text).
|
|
25
|
+
clear_input() {
|
|
26
|
+
tmux send-keys -t "$SESSION_NAME" Escape
|
|
27
|
+
sleep 0.5
|
|
28
|
+
tmux send-keys -t "$SESSION_NAME" Escape
|
|
29
|
+
sleep 0.5
|
|
30
|
+
tmux send-keys -t "$SESSION_NAME" C-u
|
|
31
|
+
sleep 0.5
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Cleanup on exit
|
|
35
|
+
trap cleanup EXIT
|
|
36
|
+
|
|
37
|
+
# === Setup ===
|
|
38
|
+
echo "Setting up test project..."
|
|
39
|
+
rm -rf "$TEST_DIR"
|
|
40
|
+
mkdir -p "$TEST_DIR"
|
|
41
|
+
cd "$TEST_DIR" || exit 1
|
|
42
|
+
echo "# Test Project" > README.md
|
|
43
|
+
echo '{"name": "test"}' > config.json
|
|
44
|
+
|
|
45
|
+
# Clean up old test output files
|
|
46
|
+
rm -f /tmp/kon-test-*.txt
|
|
47
|
+
|
|
48
|
+
# Clean up old sessions from previous runs, keep only the last 5
|
|
49
|
+
SESSION_DIR="$HOME/.kon/sessions/private-tmp-kon-test-project"
|
|
50
|
+
if [ -d "$SESSION_DIR" ]; then
|
|
51
|
+
ls -t "$SESSION_DIR"/*.jsonl 2>/dev/null | tail -n +6 | xargs rm -f 2>/dev/null
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# === Start kon (from kon repo for tab completion tests) ===
|
|
55
|
+
echo "Starting kon in tmux from kon repo..."
|
|
56
|
+
cleanup
|
|
57
|
+
tmux new-session -d -s "$SESSION_NAME" -c "$KON_DIR" 'uv run kon'
|
|
58
|
+
sleep 5 # Give kon time to start and render UI
|
|
59
|
+
|
|
60
|
+
# =============================================================================
|
|
61
|
+
# Test 1: / slash commands trigger
|
|
62
|
+
# Verify: typing / shows the slash command list
|
|
63
|
+
# =============================================================================
|
|
64
|
+
echo "Test 1: / slash commands trigger..."
|
|
65
|
+
tmux send-keys -t "$SESSION_NAME" '/'
|
|
66
|
+
sleep 2
|
|
67
|
+
capture /tmp/kon-test-1-commands.txt
|
|
68
|
+
clear_input
|
|
69
|
+
|
|
70
|
+
# =============================================================================
|
|
71
|
+
# Test 2: @ file search trigger
|
|
72
|
+
# Verify: typing @config shows file picker with config.json (from kon repo)
|
|
73
|
+
# =============================================================================
|
|
74
|
+
echo "Test 2: @ file search trigger..."
|
|
75
|
+
tmux send-keys -t "$SESSION_NAME" '@pyproject'
|
|
76
|
+
sleep 2
|
|
77
|
+
capture /tmp/kon-test-2-at-trigger.txt
|
|
78
|
+
clear_input
|
|
79
|
+
|
|
80
|
+
# =============================================================================
|
|
81
|
+
# Test 3: /model command
|
|
82
|
+
# Verify: /model shows model selector list, then dismiss without selecting
|
|
83
|
+
# =============================================================================
|
|
84
|
+
echo "Test 3: /model command..."
|
|
85
|
+
tmux send-keys -t "$SESSION_NAME" '/model'
|
|
86
|
+
sleep 2
|
|
87
|
+
# Enter applies the slash command autocomplete -> opens model selector
|
|
88
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
89
|
+
sleep "$COMMAND_WAIT_TIME"
|
|
90
|
+
capture /tmp/kon-test-3-model.txt
|
|
91
|
+
# Dismiss model selector without selecting (Escape hides the completion list)
|
|
92
|
+
clear_input
|
|
93
|
+
|
|
94
|
+
# =============================================================================
|
|
95
|
+
# Test 4: /new command
|
|
96
|
+
# Verify: /new starts a new conversation ("Started new conversation" message)
|
|
97
|
+
# =============================================================================
|
|
98
|
+
echo "Test 4: /new command..."
|
|
99
|
+
tmux send-keys -t "$SESSION_NAME" '/new'
|
|
100
|
+
sleep 2
|
|
101
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
102
|
+
sleep "$COMMAND_WAIT_TIME"
|
|
103
|
+
capture /tmp/kon-test-4-new.txt
|
|
104
|
+
|
|
105
|
+
# =============================================================================
|
|
106
|
+
# Test 5: Tab completion - unique match
|
|
107
|
+
# Verify: typing "sr" then Tab completes to "src/"
|
|
108
|
+
# =============================================================================
|
|
109
|
+
echo "Test 5: Tab completion - unique match..."
|
|
110
|
+
tmux send-keys -t "$SESSION_NAME" 'sr'
|
|
111
|
+
sleep 1
|
|
112
|
+
tmux send-keys -t "$SESSION_NAME" Tab
|
|
113
|
+
sleep 2
|
|
114
|
+
capture /tmp/kon-test-5-tab-unique.txt
|
|
115
|
+
clear_input
|
|
116
|
+
|
|
117
|
+
# =============================================================================
|
|
118
|
+
# Test 6: Tab completion - multiple alternatives (floating list)
|
|
119
|
+
# Verify: typing "s" then Tab shows floating list with scripts/, src/
|
|
120
|
+
# =============================================================================
|
|
121
|
+
echo "Test 6: Tab completion - multiple alternatives..."
|
|
122
|
+
tmux send-keys -t "$SESSION_NAME" 's'
|
|
123
|
+
sleep 1
|
|
124
|
+
tmux send-keys -t "$SESSION_NAME" Tab
|
|
125
|
+
sleep 2
|
|
126
|
+
capture /tmp/kon-test-6-tab-multiple.txt
|
|
127
|
+
clear_input
|
|
128
|
+
|
|
129
|
+
# =============================================================================
|
|
130
|
+
# Test 7: Tab completion - home directory
|
|
131
|
+
# Verify: typing "~/De" then Tab shows floating list with Desktop/, Developer/, etc.
|
|
132
|
+
# =============================================================================
|
|
133
|
+
echo "Test 7: Tab completion - home directory..."
|
|
134
|
+
tmux send-keys -t "$SESSION_NAME" '~/De'
|
|
135
|
+
sleep 1
|
|
136
|
+
tmux send-keys -t "$SESSION_NAME" Tab
|
|
137
|
+
sleep 2
|
|
138
|
+
capture /tmp/kon-test-7-tab-home.txt
|
|
139
|
+
clear_input
|
|
140
|
+
|
|
141
|
+
# =============================================================================
|
|
142
|
+
# Test 8: Tab completion - select from list
|
|
143
|
+
# Verify: typing "s" Tab shows list, then select with Enter applies completion
|
|
144
|
+
# =============================================================================
|
|
145
|
+
echo "Test 8: Tab completion - select from list..."
|
|
146
|
+
tmux send-keys -t "$SESSION_NAME" 's'
|
|
147
|
+
sleep 1
|
|
148
|
+
tmux send-keys -t "$SESSION_NAME" Tab
|
|
149
|
+
sleep 2
|
|
150
|
+
# Select first item (scripts/) with Enter
|
|
151
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
152
|
+
sleep 1
|
|
153
|
+
capture /tmp/kon-test-8-tab-select.txt
|
|
154
|
+
clear_input
|
|
155
|
+
|
|
156
|
+
# =============================================================================
|
|
157
|
+
# Test 9: Tool execution (multiple tool calls)
|
|
158
|
+
# Verify: creates test1.txt, edits it, lists files, calculates 3+3
|
|
159
|
+
# Running this BEFORE /resume so there's a session with messages to resume
|
|
160
|
+
# Switch to test project dir first
|
|
161
|
+
# =============================================================================
|
|
162
|
+
echo "Test 9: Tool execution..."
|
|
163
|
+
# Change to test directory for tool execution
|
|
164
|
+
tmux send-keys -t "$SESSION_NAME" "/new"
|
|
165
|
+
sleep 1
|
|
166
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
167
|
+
sleep 2
|
|
168
|
+
tmux send-keys -t "$SESSION_NAME" "Create $TEST_DIR/test1.txt containing \"hello\", then edit $TEST_DIR/test1.txt to change \"hello\" to \"world\", list files in $TEST_DIR, and calculate 3+3. Use parallel tool calls, be quick."
|
|
169
|
+
sleep 1
|
|
170
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
171
|
+
sleep "$WAIT_TIME"
|
|
172
|
+
capture /tmp/kon-test-9-tools.txt
|
|
173
|
+
|
|
174
|
+
# =============================================================================
|
|
175
|
+
# Test 10: /session command
|
|
176
|
+
# Verify: shows session info (messages, tokens, file path)
|
|
177
|
+
# =============================================================================
|
|
178
|
+
echo "Test 10: /session command..."
|
|
179
|
+
tmux send-keys -t "$SESSION_NAME" '/session'
|
|
180
|
+
sleep 2
|
|
181
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
182
|
+
sleep "$COMMAND_WAIT_TIME"
|
|
183
|
+
capture /tmp/kon-test-10-session.txt
|
|
184
|
+
|
|
185
|
+
# =============================================================================
|
|
186
|
+
# Test 11: /resume command
|
|
187
|
+
# Verify: shows list of sessions (at least one from tool execution above)
|
|
188
|
+
# =============================================================================
|
|
189
|
+
echo "Test 11: /resume command..."
|
|
190
|
+
tmux send-keys -t "$SESSION_NAME" '/resume'
|
|
191
|
+
sleep 2
|
|
192
|
+
tmux send-keys -t "$SESSION_NAME" Enter
|
|
193
|
+
sleep "$COMMAND_WAIT_TIME"
|
|
194
|
+
capture /tmp/kon-test-11-resume.txt
|
|
195
|
+
# Dismiss session list without selecting
|
|
196
|
+
clear_input
|
|
197
|
+
|
|
198
|
+
# =============================================================================
|
|
199
|
+
# Capture file system state for tool execution verification
|
|
200
|
+
# =============================================================================
|
|
201
|
+
echo "Capturing file system state..."
|
|
202
|
+
ls -la "$TEST_DIR" > /tmp/kon-test-files.txt 2>/dev/null
|
|
203
|
+
|
|
204
|
+
# Retry a few times in case the LLM is still finishing file writes
|
|
205
|
+
for i in 1 2 3; do
|
|
206
|
+
if [ -f "$TEST_DIR/test1.txt" ]; then
|
|
207
|
+
cat "$TEST_DIR/test1.txt" > /tmp/kon-test-test1-content.txt
|
|
208
|
+
break
|
|
209
|
+
fi
|
|
210
|
+
sleep 3
|
|
211
|
+
done
|
|
212
|
+
# Final check
|
|
213
|
+
if [ ! -f "$TEST_DIR/test1.txt" ]; then
|
|
214
|
+
echo "FILE_NOT_FOUND" > /tmp/kon-test-test1-content.txt
|
|
215
|
+
ls -la "$TEST_DIR" > /tmp/kon-test-files.txt 2>/dev/null
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
echo ""
|
|
219
|
+
echo "$SEP"
|
|
220
|
+
echo "All tests complete"
|
|
221
|
+
echo "Output files saved to /tmp/kon-test-*.txt"
|
|
222
|
+
echo "$SEP"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Setup script for kon e2e testing
|
|
4
|
+
# Creates a deterministic test project structure at /tmp/kon-test-project
|
|
5
|
+
|
|
6
|
+
TEST_DIR="/tmp/kon-test-project"
|
|
7
|
+
|
|
8
|
+
# Cleanup and recreate test project
|
|
9
|
+
rm -rf $TEST_DIR
|
|
10
|
+
mkdir -p $TEST_DIR
|
|
11
|
+
cd $TEST_DIR
|
|
12
|
+
|
|
13
|
+
# Create deterministic test files
|
|
14
|
+
echo "# Test Project" > README.md
|
|
15
|
+
echo '{"name": "test", "version": "1.0.0"}' > config.json
|
|
16
|
+
echo "Todo:
|
|
17
|
+
- Read config.json
|
|
18
|
+
- Calculate sum" > notes.txt
|
|
19
|
+
echo 'def add(a, b): return a + b
|
|
20
|
+
def multiply(a, b): return a * b
|
|
21
|
+
result = multiply(5, 3)
|
|
22
|
+
print(f"5 * 3 = {result}")' > utils.py
|
|
23
|
+
echo 'DATA = ["item1", "item2", "item3"]
|
|
24
|
+
for item in DATA:
|
|
25
|
+
print(item)' > data.py
|
|
26
|
+
|
|
27
|
+
echo "✓ Test project created at $TEST_DIR"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Agent Guidelines
|
|
2
|
+
|
|
3
|
+
## Code Style
|
|
4
|
+
|
|
5
|
+
- Don't add trivial docstrings. Only add docstrings when explaining complex functionality.
|
|
6
|
+
- This project uses `uv`. Run `uv run ruff format .` after editing or creating any files.
|
|
7
|
+
|
|
8
|
+
## Testing
|
|
9
|
+
|
|
10
|
+
- Use `uv run pytest` for testing in general; after edits/writes
|
|
11
|
+
- If the user asks for e2e tests then run the kon-tmux e2e test if available
|
|
12
|
+
|
|
13
|
+
## Committing code
|
|
14
|
+
|
|
15
|
+
- If the user tells you to commit code, look at all the changes and create multile commits if needed bsaed on logical groupings
|
|
16
|
+
|
|
17
|
+
## Pushing
|
|
18
|
+
|
|
19
|
+
- If the user asks you to push code, run these first before doing so: `uv run ruff format .`, `uv run ruff check .`, `uv run pyright .` and `uv run pytest` in parallel (same tool call)
|
|
20
|
+
- Only if these all pass without issues should you push otherwise report the warnings/errors back to user and ask for next steps
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kuutsav
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|