@votadev/tooncode 2.2.1
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.
- package/README.md +243 -0
- package/__main__.py +2 -0
- package/bin/postinstall.js +81 -0
- package/bin/tooncode.js +104 -0
- package/package.json +42 -0
- package/requirements.txt +4 -0
- package/setup.py +22 -0
- package/skills/api/endpoint.md +16 -0
- package/skills/api/mock.md +15 -0
- package/skills/arch/diagram.md +14 -0
- package/skills/arch/pattern.md +15 -0
- package/skills/arch/split.md +16 -0
- package/skills/code/convert.md +15 -0
- package/skills/code/deps.md +15 -0
- package/skills/code/explain.md +13 -0
- package/skills/code/lint.md +23 -0
- package/skills/code/optimize.md +11 -0
- package/skills/code/refactor.md +26 -0
- package/skills/code/review.md +24 -0
- package/skills/code/scaffold.md +13 -0
- package/skills/code/test.md +26 -0
- package/skills/code/types.md +12 -0
- package/skills/data/migrate.md +14 -0
- package/skills/data/seed.md +13 -0
- package/skills/data/sql.md +14 -0
- package/skills/debug/error.md +27 -0
- package/skills/debug/fix.md +23 -0
- package/skills/debug/perf.md +16 -0
- package/skills/debug/trace.md +12 -0
- package/skills/devops/ci.md +16 -0
- package/skills/devops/docker.md +15 -0
- package/skills/doc/api.md +15 -0
- package/skills/doc/readme.md +29 -0
- package/skills/git/changelog.md +16 -0
- package/skills/git/commit.md +12 -0
- package/skills/git/pr.md +17 -0
- package/skills/security/audit.md +24 -0
- package/skills/security/secrets.md +13 -0
- package/tooncode.cmd +2 -0
- package/tooncode.py +5493 -0
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# ToonCode — Free AI Coding Agent CLI
|
|
2
|
+
|
|
3
|
+
> **by VotaLab** | v2.0.0 | Claude Code alternative powered by free AI models
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
████████╗ ██████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
|
|
7
|
+
██║ ██║ ██║██║ ██║██╔██╗ ██║██║ ██║ ██║██║ ██║█████╗
|
|
8
|
+
╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
ToonCode is a **free, open-source** AI coding agent that runs in your terminal. It uses free AI models (no API key needed) and provides a Claude Code-like experience with 20+ tools, multi-agent teams, browser automation, and more.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- **Python 3.10+**
|
|
18
|
+
- **Git**
|
|
19
|
+
- **Node.js 16+** (optional, for npm install method)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Method 1: One-line install (recommended)
|
|
26
|
+
|
|
27
|
+
**Mac / Linux:**
|
|
28
|
+
```bash
|
|
29
|
+
curl -fsSL https://raw.githubusercontent.com/votalab/tooncode/main/install.sh | bash
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Windows (PowerShell):**
|
|
33
|
+
```powershell
|
|
34
|
+
irm https://raw.githubusercontent.com/votalab/tooncode/main/install.bat -OutFile install.bat; .\install.bat
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Method 2: Git clone (manual)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Clone
|
|
41
|
+
git clone https://github.com/votalab/tooncode.git ~/.tooncode
|
|
42
|
+
|
|
43
|
+
# Install dependencies
|
|
44
|
+
pip install -r ~/.tooncode/requirements.txt
|
|
45
|
+
|
|
46
|
+
# Optional: Playwright for browser tool
|
|
47
|
+
pip install playwright && playwright install chromium
|
|
48
|
+
|
|
49
|
+
# Run
|
|
50
|
+
python ~/.tooncode/tooncode.py
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Add to PATH (run from anywhere):**
|
|
54
|
+
|
|
55
|
+
Mac/Linux — add to `~/.bashrc` or `~/.zshrc`:
|
|
56
|
+
```bash
|
|
57
|
+
alias tooncode="python ~/.tooncode/tooncode.py"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Windows — create `tooncode.cmd` in a PATH directory:
|
|
61
|
+
```cmd
|
|
62
|
+
@echo off
|
|
63
|
+
python %USERPROFILE%\.tooncode\tooncode.py %*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Method 3: npm
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install -g tooncode
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Method 4: Copy the folder
|
|
73
|
+
|
|
74
|
+
Just copy the entire `tooncode` folder anywhere and run:
|
|
75
|
+
```bash
|
|
76
|
+
cd /path/to/tooncode
|
|
77
|
+
pip install -r requirements.txt
|
|
78
|
+
python tooncode.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick Start
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
tooncode # Start in current directory
|
|
87
|
+
tooncode big-pickle # Start with specific model
|
|
88
|
+
tooncode minimax-m2.5-free ~/my-project # Model + directory
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Features
|
|
94
|
+
|
|
95
|
+
### 20 Tools
|
|
96
|
+
|
|
97
|
+
| Tool | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `bash` | Run shell commands (auto-detects PowerShell/bash) |
|
|
100
|
+
| `read` | Read files with line numbers |
|
|
101
|
+
| `write` | Create/overwrite files (shows diff) |
|
|
102
|
+
| `edit` | String replacement in files (shows diff) |
|
|
103
|
+
| `multi_edit` | Batch edits in one call |
|
|
104
|
+
| `glob` | Find files by pattern |
|
|
105
|
+
| `grep` | Search file contents with regex |
|
|
106
|
+
| `list_dir` | Browse directory structure |
|
|
107
|
+
| `web_search` | Search the web (DuckDuckGo) |
|
|
108
|
+
| `web_fetch` | Fetch web page content |
|
|
109
|
+
| `http` | Full HTTP client (GET/POST/PUT/DELETE + auth) |
|
|
110
|
+
| `browser` | Playwright browser: open, click, fill, screenshot, console, network |
|
|
111
|
+
| `screenshot` | Capture desktop/window screenshot |
|
|
112
|
+
| `spawn_agent` | Spawn sub-agent (coder/reviewer/tester/researcher) |
|
|
113
|
+
| `memory_save` | Save notes for future sessions |
|
|
114
|
+
| `memory_search` | Search past memories |
|
|
115
|
+
| `task_create/update/list` | Task management |
|
|
116
|
+
| `bosshelp` | Escalate to Claude Code or fallback model |
|
|
117
|
+
|
|
118
|
+
### Slash Commands
|
|
119
|
+
|
|
120
|
+
| Command | Description |
|
|
121
|
+
|---------|-------------|
|
|
122
|
+
| `/help` | Show all commands |
|
|
123
|
+
| `/model [name]` | Switch AI model |
|
|
124
|
+
| `/boss <task>` | Create task plan (uses Claude Code or own model) |
|
|
125
|
+
| `/team <task>` | Multi-agent team: planner + frontend + backend + reviewer + tester |
|
|
126
|
+
| `/plan` | Toggle Plan Mode (read-only) |
|
|
127
|
+
| `/do` | Execute pending tasks |
|
|
128
|
+
| `/tasks` | Show task progress |
|
|
129
|
+
| `/continue`, `/c` | Continue where AI left off |
|
|
130
|
+
| `/save`, `/s` | Save session |
|
|
131
|
+
| `/resume`, `/r` | Load saved session |
|
|
132
|
+
| `/compact` | Compress context |
|
|
133
|
+
| `/memory` | Browse saved memories |
|
|
134
|
+
| `/paste`, `/v` | Send clipboard content |
|
|
135
|
+
| `/send <msg>` | Chat between ToonCode windows |
|
|
136
|
+
| `/bg`, `/ps` | Manage background processes |
|
|
137
|
+
| `/commit` | Git add & commit |
|
|
138
|
+
| `/diff` | Git diff |
|
|
139
|
+
| `/status` | Git status |
|
|
140
|
+
| `/undo` | Undo last file edit |
|
|
141
|
+
| `/init` | Create TOONCODE.md (auto-imports CLAUDE.md etc.) |
|
|
142
|
+
| `/config` | Show/edit config |
|
|
143
|
+
| `/skills` | List 32 built-in skills |
|
|
144
|
+
| `/cost` | Token usage stats |
|
|
145
|
+
|
|
146
|
+
### Multi-Agent Team
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
/team สร้างเว็บ portfolio # Default: planner + frontend + backend
|
|
150
|
+
/team สร้าง API --roles planner,backend,tester # Custom roles
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Agents coordinate automatically via shared channel:
|
|
154
|
+
- 📋 **planner** — Creates plan, assigns work
|
|
155
|
+
- 🎨 **frontend** — Builds UI (HTML/CSS/JS)
|
|
156
|
+
- ⚙️ **backend** — Builds API/server logic
|
|
157
|
+
- 🔍 **reviewer** — Reviews code, fixes bugs
|
|
158
|
+
- 🧪 **tester** — Writes & runs tests
|
|
159
|
+
|
|
160
|
+
### 32 Built-in Skills
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
/refactor src/utils.py # Refactor code
|
|
164
|
+
/review # Code review
|
|
165
|
+
/test api/users.js # Generate tests
|
|
166
|
+
/fix # Fix bugs
|
|
167
|
+
/explain server.py # Explain code
|
|
168
|
+
/optimize # Performance optimization
|
|
169
|
+
/docker # Create Dockerfile
|
|
170
|
+
/commit # Smart git commit
|
|
171
|
+
/audit # Security audit
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Available Models
|
|
175
|
+
|
|
176
|
+
| Model | Context | Notes |
|
|
177
|
+
|-------|---------|-------|
|
|
178
|
+
| `minimax-m2.5-free` | 200K | Default, good all-round |
|
|
179
|
+
| `big-pickle` | 200K | Strong coding |
|
|
180
|
+
| `nemotron-3-super-free` | 131K | Fast |
|
|
181
|
+
| `gpt-5-nano` | 1M | Largest context |
|
|
182
|
+
|
|
183
|
+
Auto-fallback: if a model fails, ToonCode automatically tries the next one.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Project Context
|
|
188
|
+
|
|
189
|
+
ToonCode auto-reads these files from your project:
|
|
190
|
+
- `TOONCODE.md` — ToonCode project context
|
|
191
|
+
- `CLAUDE.md` — Claude Code context (auto-imported)
|
|
192
|
+
- `GEMINI.md` — Gemini context
|
|
193
|
+
- `.cursorrules` — Cursor rules
|
|
194
|
+
- `COPILOT.md` — Copilot instructions
|
|
195
|
+
|
|
196
|
+
Run `/init` to auto-create `TOONCODE.md` with imported content.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Browser Tool
|
|
201
|
+
|
|
202
|
+
Requires Playwright:
|
|
203
|
+
```bash
|
|
204
|
+
pip install playwright && playwright install chromium
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
AI can control a real browser:
|
|
208
|
+
```
|
|
209
|
+
❯ เปิด google ค้นหา "ToonCode" แล้วสรุปผลลัพธ์
|
|
210
|
+
|
|
211
|
+
AI → browser open https://google.com/search?q=ToonCode
|
|
212
|
+
AI → browser text (reads search results)
|
|
213
|
+
AI → browser console (checks JS errors)
|
|
214
|
+
AI → browser screenshot (captures page)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Update
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
cd ~/.tooncode && git pull
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Cross-Platform
|
|
228
|
+
|
|
229
|
+
| Feature | Windows | Mac | Linux |
|
|
230
|
+
|---------|:-------:|:---:|:-----:|
|
|
231
|
+
| All tools | ✅ | ✅ | ✅ |
|
|
232
|
+
| Shell | PowerShell | bash | bash |
|
|
233
|
+
| Screenshot | ImageGrab | screencapture | scrot |
|
|
234
|
+
| Clipboard | Get-Clipboard | pbpaste | xclip |
|
|
235
|
+
| Browser | ✅ | ✅ | ✅ |
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
MIT — Free to use, modify, and distribute.
|
|
242
|
+
|
|
243
|
+
**Made with ❤️ by VotaLab**
|
package/__main__.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
const C = "\x1b[36m", G = "\x1b[32m", Y = "\x1b[33m", D = "\x1b[2m", X = "\x1b[0m";
|
|
7
|
+
console.log(`\n${C}ToonCode${X} — Installing...\n`);
|
|
8
|
+
|
|
9
|
+
function findPython() {
|
|
10
|
+
const cmds = process.platform === "win32" ? ["python", "python3", "py"] : ["python3", "python"];
|
|
11
|
+
for (const cmd of cmds) {
|
|
12
|
+
try {
|
|
13
|
+
const r = execSync(`${cmd} --version 2>&1`, { encoding: "utf-8" });
|
|
14
|
+
if (r.includes("Python 3")) return cmd;
|
|
15
|
+
} catch {}
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getVenvDir() {
|
|
21
|
+
return path.join(__dirname, "..", ".venv");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getVenvPython() {
|
|
25
|
+
const venvDir = getVenvDir();
|
|
26
|
+
return process.platform === "win32"
|
|
27
|
+
? path.join(venvDir, "Scripts", "python.exe")
|
|
28
|
+
: path.join(venvDir, "bin", "python");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ensureVenv(python) {
|
|
32
|
+
const venvDir = getVenvDir();
|
|
33
|
+
const venvPy = getVenvPython();
|
|
34
|
+
if (!fs.existsSync(venvPy)) {
|
|
35
|
+
console.log(`${D}Creating virtual environment...${X}`);
|
|
36
|
+
execSync(`${python} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 60000 });
|
|
37
|
+
}
|
|
38
|
+
return venvPy;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const python = findPython();
|
|
42
|
+
if (!python) {
|
|
43
|
+
console.log(`${Y}Python 3.10+ not found. Install: https://python.org${X}\n`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
console.log(`${D}Python: ${python}${X}`);
|
|
47
|
+
|
|
48
|
+
const req = path.join(__dirname, "..", "requirements.txt");
|
|
49
|
+
if (!fs.existsSync(req)) { process.exit(0); }
|
|
50
|
+
|
|
51
|
+
// Strategy 1: venv inside package (works on all OS)
|
|
52
|
+
try {
|
|
53
|
+
const venvPy = ensureVenv(python);
|
|
54
|
+
console.log(`${D}Installing into venv...${X}`);
|
|
55
|
+
execSync(`"${venvPy}" -m pip install --quiet -r "${req}"`, {
|
|
56
|
+
stdio: ["ignore", "pipe", "pipe"], timeout: 120000
|
|
57
|
+
});
|
|
58
|
+
console.log(`${G}Dependencies installed (venv).${X}`);
|
|
59
|
+
console.log(`\n${G}ToonCode ready!${X} Run: ${C}tooncode${X}\n`);
|
|
60
|
+
process.exit(0);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.log(`${D}venv failed, trying system pip...${X}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Strategy 2: system pip fallbacks
|
|
66
|
+
const pipCmds = [
|
|
67
|
+
`${python} -m pip install --user --quiet --break-system-packages -r "${req}"`,
|
|
68
|
+
`${python} -m pip install --user --quiet -r "${req}"`,
|
|
69
|
+
`${python} -m pip install --quiet -r "${req}"`,
|
|
70
|
+
];
|
|
71
|
+
for (const cmd of pipCmds) {
|
|
72
|
+
try {
|
|
73
|
+
execSync(cmd, { stdio: ["ignore", "pipe", "pipe"], timeout: 120000 });
|
|
74
|
+
console.log(`${G}Dependencies installed (system).${X}`);
|
|
75
|
+
console.log(`\n${G}ToonCode ready!${X} Run: ${C}tooncode${X}\n`);
|
|
76
|
+
process.exit(0);
|
|
77
|
+
} catch {}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log(`${Y}Auto-install failed. Run manually:${X}`);
|
|
81
|
+
console.log(`${C} pip install --user httpx rich prompt_toolkit${X}\n`);
|
package/bin/tooncode.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn, execSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
const R = "\x1b[31m", G = "\x1b[32m", C = "\x1b[36m", D = "\x1b[2m", X = "\x1b[0m";
|
|
7
|
+
|
|
8
|
+
function findPython() {
|
|
9
|
+
const cmds = process.platform === "win32" ? ["python", "python3", "py"] : ["python3", "python"];
|
|
10
|
+
for (const cmd of cmds) {
|
|
11
|
+
try {
|
|
12
|
+
const r = execSync(`${cmd} --version 2>&1`, { encoding: "utf-8" });
|
|
13
|
+
if (r.includes("Python 3")) return cmd;
|
|
14
|
+
} catch {}
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getVenvPython() {
|
|
20
|
+
const venvDir = path.join(__dirname, "..", ".venv");
|
|
21
|
+
return process.platform === "win32"
|
|
22
|
+
? path.join(venvDir, "Scripts", "python.exe")
|
|
23
|
+
: path.join(venvDir, "bin", "python");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function checkDeps(py) {
|
|
27
|
+
try {
|
|
28
|
+
execSync(`"${py}" -c "import httpx, rich, prompt_toolkit" 2>&1`, { encoding: "utf-8" });
|
|
29
|
+
return true;
|
|
30
|
+
} catch { return false; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ensureVenv(sysPython) {
|
|
34
|
+
const venvDir = path.join(__dirname, "..", ".venv");
|
|
35
|
+
const venvPy = getVenvPython();
|
|
36
|
+
if (!fs.existsSync(venvPy)) {
|
|
37
|
+
console.log(`${C}Creating virtual environment...${X}`);
|
|
38
|
+
execSync(`${sysPython} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 60000 });
|
|
39
|
+
}
|
|
40
|
+
return venvPy;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function installDeps(py) {
|
|
44
|
+
const req = path.join(__dirname, "..", "requirements.txt");
|
|
45
|
+
console.log(`${D}Installing dependencies...${X}`);
|
|
46
|
+
execSync(`"${py}" -m pip install --quiet -r "${req}"`, {
|
|
47
|
+
stdio: ["ignore", "pipe", "pipe"], timeout: 120000
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Find system Python
|
|
52
|
+
const sysPython = findPython();
|
|
53
|
+
if (!sysPython) {
|
|
54
|
+
console.error(`${R}Python 3.10+ required. Install: https://python.org${X}`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Determine which Python to use (prefer venv)
|
|
59
|
+
let usePython;
|
|
60
|
+
const venvPy = getVenvPython();
|
|
61
|
+
|
|
62
|
+
if (fs.existsSync(venvPy) && checkDeps(venvPy)) {
|
|
63
|
+
// venv exists and has deps
|
|
64
|
+
usePython = venvPy;
|
|
65
|
+
} else if (checkDeps(sysPython)) {
|
|
66
|
+
// system Python has deps
|
|
67
|
+
usePython = sysPython;
|
|
68
|
+
} else {
|
|
69
|
+
// Need to install — try venv first
|
|
70
|
+
console.log(`${C}First run — setting up...${X}`);
|
|
71
|
+
try {
|
|
72
|
+
const vp = ensureVenv(sysPython);
|
|
73
|
+
installDeps(vp);
|
|
74
|
+
usePython = vp;
|
|
75
|
+
console.log(`${G}Ready.${X}\n`);
|
|
76
|
+
} catch {
|
|
77
|
+
// venv failed, try system pip
|
|
78
|
+
const fallbacks = [
|
|
79
|
+
`${sysPython} -m pip install --user --quiet --break-system-packages -r "${path.join(__dirname, "..", "requirements.txt")}"`,
|
|
80
|
+
`${sysPython} -m pip install --user --quiet -r "${path.join(__dirname, "..", "requirements.txt")}"`,
|
|
81
|
+
];
|
|
82
|
+
let ok = false;
|
|
83
|
+
for (const cmd of fallbacks) {
|
|
84
|
+
try { execSync(cmd, { stdio: ["ignore", "pipe", "pipe"], timeout: 120000 }); ok = true; break; } catch {}
|
|
85
|
+
}
|
|
86
|
+
if (ok) {
|
|
87
|
+
usePython = sysPython;
|
|
88
|
+
} else {
|
|
89
|
+
console.error(`${R}Could not install dependencies.${X}`);
|
|
90
|
+
console.error(`${C} ${sysPython} -m pip install httpx rich prompt_toolkit${X}`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Run tooncode
|
|
97
|
+
const mainPy = path.join(__dirname, "..", "tooncode.py");
|
|
98
|
+
const child = spawn(usePython, [mainPy, ...process.argv.slice(2)], {
|
|
99
|
+
stdio: "inherit",
|
|
100
|
+
cwd: process.cwd(),
|
|
101
|
+
env: { ...process.env, PYTHONIOENCODING: "utf-8" },
|
|
102
|
+
});
|
|
103
|
+
child.on("exit", (code) => process.exit(code || 0));
|
|
104
|
+
child.on("error", (err) => { console.error(err.message); process.exit(1); });
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@votadev/tooncode",
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "Free AI Coding Agent CLI — Claude Code alternative powered by free models. 20 tools, multi-agent team, browser automation, MCP servers.",
|
|
5
|
+
"author": "VotaLab",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"ai",
|
|
9
|
+
"coding",
|
|
10
|
+
"agent",
|
|
11
|
+
"cli",
|
|
12
|
+
"claude",
|
|
13
|
+
"free",
|
|
14
|
+
"tooncode",
|
|
15
|
+
"copilot",
|
|
16
|
+
"cursor"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/votalab/tooncode.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/votalab/tooncode#readme",
|
|
23
|
+
"bin": {
|
|
24
|
+
"tooncode": "bin/tooncode.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/",
|
|
28
|
+
"tooncode.py",
|
|
29
|
+
"__main__.py",
|
|
30
|
+
"skills/",
|
|
31
|
+
"requirements.txt",
|
|
32
|
+
"setup.py",
|
|
33
|
+
"tooncode.cmd",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"postinstall": "node bin/postinstall.js"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=16"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/requirements.txt
ADDED
package/setup.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="tooncode",
|
|
5
|
+
version="2.0.0",
|
|
6
|
+
description="AI Coding Agent CLI - Free, single-file, Claude Code alternative",
|
|
7
|
+
author="VotaLab",
|
|
8
|
+
py_modules=["tooncode", "tui"],
|
|
9
|
+
python_requires=">=3.10",
|
|
10
|
+
install_requires=[
|
|
11
|
+
"httpx>=0.27.0",
|
|
12
|
+
"rich>=13.0.0",
|
|
13
|
+
"prompt_toolkit>=3.0.0",
|
|
14
|
+
"textual>=1.0.0",
|
|
15
|
+
],
|
|
16
|
+
entry_points={
|
|
17
|
+
"console_scripts": [
|
|
18
|
+
"tooncode=tooncode:main",
|
|
19
|
+
"tooncode-tui=tui:ToonCodeApp.run",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: endpoint
|
|
3
|
+
description: Create a new API endpoint
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Create API endpoint: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Detect framework (FastAPI, Express, Gin, etc.)
|
|
9
|
+
2. Create the endpoint with:
|
|
10
|
+
- Route handler with proper HTTP method
|
|
11
|
+
- Input validation (Pydantic, Zod, etc.)
|
|
12
|
+
- Error handling with proper status codes
|
|
13
|
+
- Response serialization
|
|
14
|
+
3. Add to router/app
|
|
15
|
+
4. Write tests for the endpoint
|
|
16
|
+
5. Update API docs if applicable
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mock
|
|
3
|
+
description: Generate mock API server or test doubles
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Create mocks for: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Read the API/interface definitions
|
|
9
|
+
2. Generate:
|
|
10
|
+
- Mock server (for frontend dev)
|
|
11
|
+
- Test doubles (for unit tests)
|
|
12
|
+
- Fixture data (realistic responses)
|
|
13
|
+
3. Match the real API contract exactly
|
|
14
|
+
4. Include: success responses, error responses, edge cases
|
|
15
|
+
5. Make configurable (delay, error rate, custom responses)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagram
|
|
3
|
+
description: Generate architecture diagram (Mermaid)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze the project and generate architecture diagrams in Mermaid format:
|
|
7
|
+
|
|
8
|
+
1. Read project structure and imports
|
|
9
|
+
2. Generate diagrams:
|
|
10
|
+
- **System overview** - components and their connections
|
|
11
|
+
- **Data flow** - how data moves through the system
|
|
12
|
+
- **Class/module diagram** - key classes and relationships
|
|
13
|
+
3. Output as Mermaid code blocks (renders in GitHub/VS Code)
|
|
14
|
+
4. Keep it high-level and readable
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pattern
|
|
3
|
+
description: Apply a design pattern to code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Apply design pattern: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Analyze current code structure
|
|
9
|
+
2. Identify which pattern fits (or use the one specified):
|
|
10
|
+
- Creational: Factory, Builder, Singleton
|
|
11
|
+
- Structural: Adapter, Decorator, Facade
|
|
12
|
+
- Behavioral: Observer, Strategy, Command
|
|
13
|
+
3. Refactor to apply the pattern
|
|
14
|
+
4. Explain: why this pattern, what problem it solves
|
|
15
|
+
5. Show before/after comparison
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: split
|
|
3
|
+
description: Split large file into modules
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Split {{input}} into smaller modules:
|
|
7
|
+
|
|
8
|
+
1. Analyze the file - identify logical groups of functions/classes
|
|
9
|
+
2. Plan the split:
|
|
10
|
+
- Group by responsibility (single responsibility principle)
|
|
11
|
+
- Identify shared utilities
|
|
12
|
+
- Map dependencies between groups
|
|
13
|
+
3. Create new files with proper names
|
|
14
|
+
4. Move code, update all imports
|
|
15
|
+
5. Verify nothing is broken (run tests or import check)
|
|
16
|
+
6. Show the new structure
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: convert
|
|
3
|
+
description: Convert code between languages
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Convert: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Read the source code
|
|
9
|
+
2. Convert to the target language preserving:
|
|
10
|
+
- Logic and algorithm
|
|
11
|
+
- Error handling patterns
|
|
12
|
+
- Naming conventions (adapt to target language style)
|
|
13
|
+
- Comments explaining non-obvious parts
|
|
14
|
+
3. Use idiomatic patterns of the target language
|
|
15
|
+
4. Write the converted file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deps
|
|
3
|
+
description: Analyze and manage dependencies
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze dependencies in this project:
|
|
7
|
+
|
|
8
|
+
1. List all dependencies and their versions
|
|
9
|
+
2. Check for:
|
|
10
|
+
- Outdated packages (major/minor/patch)
|
|
11
|
+
- Known vulnerabilities (npm audit / pip-audit / cargo audit)
|
|
12
|
+
- Unused dependencies
|
|
13
|
+
- Missing dependencies
|
|
14
|
+
3. Suggest updates with risk assessment
|
|
15
|
+
4. If {{input}} = "update": apply safe updates (patch/minor only)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explain
|
|
3
|
+
description: Explain code in detail
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read {{input}} and explain:
|
|
7
|
+
- What it does (high level overview)
|
|
8
|
+
- How it works (step by step walkthrough)
|
|
9
|
+
- Key design decisions and patterns used
|
|
10
|
+
- Dependencies and integrations
|
|
11
|
+
- Potential gotchas or known limitations
|
|
12
|
+
|
|
13
|
+
Keep it clear for someone new to the codebase.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint
|
|
3
|
+
description: Lint and auto-fix code (auto-detect or specify)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Lint target: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a file was specified:
|
|
9
|
+
Lint that specific file.
|
|
10
|
+
|
|
11
|
+
## If nothing specified (auto-detect):
|
|
12
|
+
1. Detect project language from files present
|
|
13
|
+
2. Find the linter config or use defaults
|
|
14
|
+
3. Lint entire project
|
|
15
|
+
|
|
16
|
+
## Actions:
|
|
17
|
+
- Python: run `ruff check --fix .` then `ruff format .` (or black/isort)
|
|
18
|
+
- JS/TS: run `eslint --fix .` then `prettier --write .`
|
|
19
|
+
- Go: run `gofmt -w .` then `go vet ./...`
|
|
20
|
+
- Rust: run `cargo clippy --fix`
|
|
21
|
+
|
|
22
|
+
If linter not installed, fix issues manually by reading files and applying style fixes.
|
|
23
|
+
Report: fixed count, remaining issues that need manual fix.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: optimize
|
|
3
|
+
description: Optimize code for performance
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze {{input}} for performance:
|
|
7
|
+
1. Profile / identify bottlenecks
|
|
8
|
+
2. Check: unnecessary loops, N+1 queries, memory leaks, blocking calls
|
|
9
|
+
3. Suggest optimizations with expected impact
|
|
10
|
+
4. Implement the changes
|
|
11
|
+
5. Benchmark before/after if possible
|