codegpt-ai 2.10.0 → 2.12.0
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 +122 -125
- package/chat.py +65 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,169 +6,168 @@
|
|
|
6
6
|
npm i -g codegpt-ai
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Then type `
|
|
9
|
+
Then type `code`.
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
╔══════════════════════════════════════════════════╗
|
|
13
|
+
║ ║
|
|
14
|
+
║ C o d e G P T v2.0 ║
|
|
15
|
+
║ local ai · powered by ollama ║
|
|
16
|
+
║ ║
|
|
17
|
+
╚══════════════════════════════════════════════════╝
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## What is it?
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
CodeGPT is a full-featured AI CLI that runs entirely on your machine using [Ollama](https://ollama.com). 123 commands, 8 AI agents, 26 tools, no cloud needed.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
- **8 AI agents** — coder, debugger, reviewer, architect, pentester, explainer, optimizer, researcher
|
|
26
|
-
- **29 AI tool integrations** — Claude, Codex, Gemini, Copilot, Cline, and more
|
|
27
|
-
- **Multi-AI system** — swarm, vote, race, team chat with multiple AIs
|
|
28
|
-
- **AI training** — train your own custom Ollama models from conversations
|
|
29
|
-
- **Security** — PIN lock, audit log, sandboxed tools, shell blocklist
|
|
30
|
-
- **Works anywhere** — Windows, macOS, Linux, Termux (Android)
|
|
24
|
+
**Works on Windows, macOS, Linux, and Termux (Android).**
|
|
31
25
|
|
|
32
26
|
## Install
|
|
33
27
|
|
|
34
|
-
### npm (recommended)
|
|
35
28
|
```bash
|
|
36
29
|
npm i -g codegpt-ai
|
|
37
|
-
|
|
30
|
+
code
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
No Python? No problem — a built-in Node.js chat client runs automatically. With Python installed, you get the full 123-command experience.
|
|
34
|
+
|
|
35
|
+
### Other install methods
|
|
41
36
|
|
|
42
|
-
### pip
|
|
43
37
|
```bash
|
|
44
|
-
pip
|
|
38
|
+
# pip
|
|
39
|
+
pip install git+https://github.com/CCguvycu/codegpt.git
|
|
45
40
|
ai
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### PowerShell (Windows)
|
|
49
|
-
```powershell
|
|
50
|
-
irm https://raw.githubusercontent.com/CCguvycu/codegpt/main/install.ps1 | iex
|
|
51
|
-
```
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
```bash
|
|
42
|
+
# Termux (Android)
|
|
55
43
|
curl -sL https://raw.githubusercontent.com/CCguvycu/codegpt/main/install-termux.sh | bash
|
|
44
|
+
code
|
|
45
|
+
|
|
46
|
+
# Windows (PowerShell)
|
|
47
|
+
irm https://raw.githubusercontent.com/CCguvycu/codegpt/main/install.ps1 | iex
|
|
56
48
|
```
|
|
57
49
|
|
|
58
50
|
## Requirements
|
|
59
51
|
|
|
60
|
-
- **Node.js 16+**
|
|
61
|
-
- **Ollama** —
|
|
62
|
-
- Or connect to a remote Ollama
|
|
63
|
-
|
|
64
|
-
## Quick Start
|
|
52
|
+
- **Node.js 16+** or **Python 3.10+**
|
|
53
|
+
- **Ollama** — [ollama.com](https://ollama.com) then `ollama pull llama3.2`
|
|
54
|
+
- Or connect to a remote Ollama with `/connect IP`
|
|
65
55
|
|
|
66
|
-
|
|
67
|
-
# Install
|
|
68
|
-
npm i -g codegpt-ai
|
|
56
|
+
## Features
|
|
69
57
|
|
|
70
|
-
|
|
71
|
-
ollama pull llama3.2
|
|
58
|
+
### 123 Commands
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
| Category | Commands |
|
|
61
|
+
|----------|----------|
|
|
62
|
+
| **Chat** | `/new` `/save` `/load` `/copy` `/regen` `/edit` `/history` `/export` |
|
|
63
|
+
| **Model** | `/model` `/temp` `/think` `/tokens` `/params` `/compact` |
|
|
64
|
+
| **AI Agents** | `/agent` `/all` `/vote` `/swarm` `/team` `/room` `/spectate` |
|
|
65
|
+
| **AI Lab** | `/lab bench` `/lab chain` `/lab prompt` `/race` `/compare` |
|
|
66
|
+
| **Tools** | `/tools` `/bg` `/split` `/grid` 26 AI CLI integrations |
|
|
67
|
+
| **Connect** | `/connect` `/server` `/qr` `/scan` `/disconnect` |
|
|
68
|
+
| **Files** | `/file` `/run` `/code` `/shell` `/browse` `/open` |
|
|
69
|
+
| **Memory** | `/mem` `/train` `/pin` `/search` `/fork` `/rate` |
|
|
70
|
+
| **Skills** | `/skill` `/skills` `/auto` `/cron` |
|
|
71
|
+
| **Comms** | `/broadcast` `/inbox` `/dm` `/monitor` `/hub` |
|
|
72
|
+
| **System** | `/github` `/weather` `/spotify` `/volume` `/sysinfo` |
|
|
73
|
+
| **Security** | `/pin-set` `/lock` `/audit` `/security` `/permissions` |
|
|
74
|
+
| **Profile** | `/profile` `/persona` `/usage` `/setname` `/setbio` |
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
### 8 AI Agents
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
Specialized agents with custom system prompts:
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|---------|-------------|
|
|
84
|
-
| `/new` | New conversation |
|
|
85
|
-
| `/save` | Save conversation |
|
|
86
|
-
| `/load` | Load saved conversation |
|
|
87
|
-
| `/model` | Switch model |
|
|
88
|
-
| `/persona` | Switch personality (hacker, teacher, roast, architect, minimal) |
|
|
89
|
-
| `/think` | Toggle deep reasoning mode |
|
|
90
|
-
| `/file path` | Read a file into context |
|
|
91
|
-
| `/run` | Execute last code block |
|
|
92
|
-
| `/compact` | Summarize conversation to save context |
|
|
93
|
-
|
|
94
|
-
### AI Agents
|
|
95
|
-
```
|
|
96
|
-
/agent coder build a REST API
|
|
80
|
+
```
|
|
81
|
+
/agent coder build a REST API with auth
|
|
97
82
|
/agent debugger why does this crash
|
|
98
|
-
/agent reviewer check this code
|
|
83
|
+
/agent reviewer check this code for bugs
|
|
99
84
|
/agent architect design a microservices system
|
|
85
|
+
/agent pentester find security vulnerabilities
|
|
86
|
+
/agent optimizer make this code faster
|
|
87
|
+
/agent explainer explain kubernetes simply
|
|
88
|
+
/agent researcher deep-dive into WebSockets
|
|
100
89
|
```
|
|
101
90
|
|
|
102
|
-
|
|
91
|
+
### Multi-AI System
|
|
103
92
|
|
|
104
|
-
### Multi-AI
|
|
105
93
|
```
|
|
106
94
|
/all what's the best database? # All 8 agents answer in parallel
|
|
107
95
|
/vote Flask or FastAPI? # Agents vote with consensus
|
|
108
|
-
/swarm build a CLI password manager # 6-agent pipeline
|
|
109
|
-
/team claude codex # Group chat
|
|
110
|
-
/
|
|
96
|
+
/swarm build a CLI password manager # 6-agent collaborative pipeline
|
|
97
|
+
/team claude codex # Group chat: you + 2 AIs
|
|
98
|
+
/room coder reviewer architect # Chat room with 3+ AIs
|
|
99
|
+
/spectate claude gemini debate AI # Watch AIs debate without you
|
|
111
100
|
```
|
|
112
101
|
|
|
113
|
-
### AI
|
|
102
|
+
### 26 AI Tool Integrations
|
|
103
|
+
|
|
104
|
+
Launch any AI CLI from CodeGPT. Auto-installs on first use. All sandboxed.
|
|
105
|
+
|
|
114
106
|
```
|
|
115
|
-
/
|
|
116
|
-
/
|
|
117
|
-
/
|
|
118
|
-
/
|
|
119
|
-
/split claude codex # Side-by-side split screen
|
|
120
|
-
/grid claude codex gemini cline # 2x2 grid
|
|
107
|
+
/claude /codex /gemini /copilot /cline
|
|
108
|
+
/aider /shellgpt /llm /litellm /opencommit
|
|
109
|
+
/gorilla /chatgpt /cursor /ollama /jq
|
|
110
|
+
/vercel /netlify /supabase /railway /wrangler
|
|
121
111
|
```
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
Split screen multiple tools:
|
|
124
114
|
|
|
125
|
-
### AI Training
|
|
126
115
|
```
|
|
127
|
-
/
|
|
128
|
-
/
|
|
129
|
-
/train build mymodel # Create custom Ollama model
|
|
130
|
-
/model mymodel # Use your trained model
|
|
116
|
+
/split claude codex # Side by side
|
|
117
|
+
/grid claude codex gemini cline # 2x2 grid
|
|
131
118
|
```
|
|
132
119
|
|
|
133
|
-
###
|
|
120
|
+
### Custom Skills
|
|
121
|
+
|
|
122
|
+
Create your own commands — like OpenClaw's self-extending skills:
|
|
123
|
+
|
|
134
124
|
```
|
|
135
|
-
/
|
|
136
|
-
/
|
|
137
|
-
/
|
|
125
|
+
/skill poet Write all responses as poetry
|
|
126
|
+
/auto a brutal code reviewer that finds every bug
|
|
127
|
+
/cron 5m /weather # Scheduled tasks
|
|
138
128
|
```
|
|
139
129
|
|
|
140
130
|
### Security
|
|
141
|
-
```
|
|
142
|
-
/pin-set # Set login PIN
|
|
143
|
-
/audit # View security log
|
|
144
|
-
/security # Security dashboard
|
|
145
|
-
```
|
|
146
131
|
|
|
147
|
-
|
|
132
|
+
- **Permission system** — asks before every action with risk level (CRITICAL/HIGH/MEDIUM/LOW)
|
|
133
|
+
- **PIN lock** — SHA-256 hashed, auto-locks after 10min idle
|
|
134
|
+
- **Sandbox** — non-coding tools run in isolated directories, API keys stripped
|
|
135
|
+
- **Rate limiting** — blocks rapid-fire command spam
|
|
136
|
+
- **Input sanitization** — strips null bytes and control characters
|
|
137
|
+
- **Shell blocklist** — blocks dangerous commands + injection patterns
|
|
138
|
+
- **Audit log** — every action logged
|
|
139
|
+
- **Pre-commit hook** — blocks secrets from being committed
|
|
140
|
+
|
|
141
|
+
### Remote Connect
|
|
142
|
+
|
|
148
143
|
```
|
|
149
|
-
/
|
|
150
|
-
/
|
|
151
|
-
/
|
|
152
|
-
/sysinfo # System info
|
|
144
|
+
/connect 192.168.1.100 # Connect to PC's Ollama from phone
|
|
145
|
+
/qr # Show QR code to scan
|
|
146
|
+
/server # Check connection status
|
|
153
147
|
```
|
|
154
148
|
|
|
155
|
-
|
|
149
|
+
### Token Counter
|
|
150
|
+
|
|
151
|
+
Tracks lifetime tokens and messages across all sessions. Visible on startup.
|
|
152
|
+
|
|
153
|
+
## CLI Args
|
|
156
154
|
|
|
157
155
|
```bash
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
156
|
+
code # Interactive chat
|
|
157
|
+
code --ask "explain recursion" # One-shot question
|
|
158
|
+
code --agent coder "flask app" # Run an agent
|
|
159
|
+
code --team claude codex "auth"# Two AIs respond
|
|
160
|
+
code --tools # List tools
|
|
161
|
+
code --models # List Ollama models
|
|
162
|
+
code --status # Show status
|
|
163
|
+
code doctor # System diagnostics
|
|
164
|
+
code update # Self-update
|
|
165
|
+
echo "question" | code # Pipe input
|
|
167
166
|
```
|
|
168
167
|
|
|
169
168
|
## Aliases
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
30+ shortcuts for fast typing:
|
|
172
171
|
|
|
173
172
|
| Short | Full | Short | Full |
|
|
174
173
|
|-------|------|-------|------|
|
|
@@ -178,33 +177,31 @@ Type faster with 30+ shortcuts:
|
|
|
178
177
|
| `/m` | `/model` | `/h` | `/help` |
|
|
179
178
|
| `/f` | `/file` | `/con` | `/connect` |
|
|
180
179
|
|
|
181
|
-
##
|
|
180
|
+
## Personas
|
|
181
|
+
|
|
182
|
+
6 built-in AI personalities:
|
|
182
183
|
|
|
183
184
|
```
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
bot.py Telegram bot
|
|
191
|
-
web.py Web app (Flask PWA)
|
|
192
|
-
server.py Backend API
|
|
185
|
+
/persona hacker # Cybersecurity expert, dark humor
|
|
186
|
+
/persona teacher # Patient, step-by-step explanations
|
|
187
|
+
/persona roast # Brutal code reviewer
|
|
188
|
+
/persona architect # System design, ASCII diagrams
|
|
189
|
+
/persona minimal # One-line answers, code only
|
|
190
|
+
/persona default # Standard helpful assistant
|
|
193
191
|
```
|
|
194
192
|
|
|
195
|
-
##
|
|
193
|
+
## Architecture
|
|
196
194
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
```
|
|
196
|
+
codegpt/
|
|
197
|
+
chat.py 6,500+ lines Main CLI (Python)
|
|
198
|
+
bin/chat.js 300 lines Node.js fallback
|
|
199
|
+
ai_cli/ Package (updater, doctor)
|
|
200
|
+
app.py TUI app (Textual)
|
|
201
|
+
bot.py Telegram bot
|
|
202
|
+
web.py Web app (Flask PWA)
|
|
203
|
+
```
|
|
203
204
|
|
|
204
205
|
## License
|
|
205
206
|
|
|
206
|
-
MIT
|
|
207
|
-
|
|
208
|
-
## Author
|
|
209
|
-
|
|
210
|
-
Built by [ArukuX](https://github.com/CCguvycu)
|
|
207
|
+
MIT — Built by [ArukuX](https://github.com/CCguvycu)
|
package/chat.py
CHANGED
|
@@ -660,40 +660,91 @@ def ask_permission(action, detail=""):
|
|
|
660
660
|
risk_color = RISK_COLORS.get(risk, "yellow")
|
|
661
661
|
risk_icon = RISK_ICONS.get(risk, "?")
|
|
662
662
|
|
|
663
|
-
#
|
|
664
|
-
|
|
665
|
-
"CRITICAL":
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
663
|
+
# Detailed risk info per level
|
|
664
|
+
risk_info = {
|
|
665
|
+
"CRITICAL": {
|
|
666
|
+
"warning": "Can execute code, modify files, or expose data.",
|
|
667
|
+
"examples": "shell commands, code execution, installing software",
|
|
668
|
+
"tip": "Only allow if you trust the command.",
|
|
669
|
+
},
|
|
670
|
+
"HIGH": {
|
|
671
|
+
"warning": "Accesses external services or modifies data.",
|
|
672
|
+
"examples": "opening URLs, GitHub access, deleting data",
|
|
673
|
+
"tip": "Check what it's doing before allowing.",
|
|
674
|
+
},
|
|
675
|
+
"MEDIUM": {
|
|
676
|
+
"warning": "Uses resources or changes settings.",
|
|
677
|
+
"examples": "running agents, saving files, training models",
|
|
678
|
+
"tip": "Generally safe for normal use.",
|
|
679
|
+
},
|
|
680
|
+
"LOW": {
|
|
681
|
+
"warning": "Safe operation with minimal impact.",
|
|
682
|
+
"examples": "switching model, changing persona, forking chat",
|
|
683
|
+
"tip": "Low risk — consider always-allowing.",
|
|
684
|
+
},
|
|
669
685
|
}
|
|
670
|
-
|
|
686
|
+
info = risk_info.get(risk, risk_info["MEDIUM"])
|
|
687
|
+
compact = is_compact()
|
|
671
688
|
|
|
672
|
-
#
|
|
689
|
+
# Permission prompt with full context
|
|
690
|
+
console.print()
|
|
691
|
+
console.print(Rule(style=risk_color.replace("bold ", ""), characters="─"))
|
|
692
|
+
console.print()
|
|
693
|
+
console.print(Text.from_markup(f" [{risk_color}]{risk_icon} {risk}[/] [{risk_color}]{action_desc}[/]"))
|
|
673
694
|
console.print()
|
|
674
|
-
console.print(Text.from_markup(f" [{risk_color}]{risk_icon} {action_desc}[/]"))
|
|
675
695
|
if detail:
|
|
676
|
-
console.print(Text(f" {detail[:70]}"
|
|
677
|
-
|
|
696
|
+
console.print(Text.from_markup(f" [bright_cyan]what:[/] {detail[:70]}"))
|
|
697
|
+
if not compact:
|
|
698
|
+
console.print(Text.from_markup(f" [dim]risk:[/] {info['warning']}"))
|
|
699
|
+
console.print(Text.from_markup(f" [dim]e.g.:[/] {info['examples']}"))
|
|
700
|
+
console.print(Text.from_markup(f" [dim]tip:[/] {info['tip']}"))
|
|
701
|
+
else:
|
|
702
|
+
console.print(Text.from_markup(f" [{risk_color}]{info['warning']}[/]"))
|
|
678
703
|
console.print()
|
|
679
704
|
|
|
680
705
|
try:
|
|
681
706
|
answer = prompt(
|
|
682
|
-
[("class:prompt", "
|
|
707
|
+
[("class:prompt", " (y)es (n)o (a)lways (?) info > ")],
|
|
683
708
|
style=input_style,
|
|
684
709
|
).strip().lower()
|
|
685
710
|
except (KeyboardInterrupt, EOFError):
|
|
711
|
+
audit_log("PERMISSION_DENIED", f"{action}: interrupted")
|
|
686
712
|
return False
|
|
687
713
|
|
|
714
|
+
if answer in ("?", "info", "help"):
|
|
715
|
+
# Show detailed info then re-ask
|
|
716
|
+
console.print()
|
|
717
|
+
console.print(Text.from_markup(
|
|
718
|
+
f" [bold]Action:[/] {action_desc}\n"
|
|
719
|
+
f" [bold]Risk:[/] [{risk_color}]{risk}[/]\n"
|
|
720
|
+
f" [bold]Warning:[/] {info['warning']}\n"
|
|
721
|
+
f" [bold]Examples:[/] {info['examples']}\n"
|
|
722
|
+
f" [bold]Tip:[/] {info['tip']}\n\n"
|
|
723
|
+
f" [dim]What each option does:[/]\n"
|
|
724
|
+
f" [bright_cyan]y[/] Allow this one time\n"
|
|
725
|
+
f" [bright_cyan]n[/] Block this action\n"
|
|
726
|
+
f" [bright_cyan]a[/] Always allow (saved, never asked again)\n"
|
|
727
|
+
))
|
|
728
|
+
try:
|
|
729
|
+
answer = prompt(
|
|
730
|
+
[("class:prompt", " Allow? (y/n/a) > ")],
|
|
731
|
+
style=input_style,
|
|
732
|
+
).strip().lower()
|
|
733
|
+
except (KeyboardInterrupt, EOFError):
|
|
734
|
+
return False
|
|
735
|
+
|
|
688
736
|
if answer in ("a", "always"):
|
|
689
737
|
PERMISSION_ALWAYS_ALLOW.add(action)
|
|
690
738
|
save_permissions()
|
|
691
|
-
console.print(Text(f" ✓ Always allowed", style="green"))
|
|
739
|
+
console.print(Text(f" ✓ Always allowed — {action_desc}", style="green"))
|
|
740
|
+
audit_log("PERMISSION_ALWAYS", action)
|
|
692
741
|
return True
|
|
693
742
|
elif answer in ("y", "yes", ""):
|
|
743
|
+
audit_log("PERMISSION_GRANTED", action)
|
|
694
744
|
return True
|
|
695
745
|
else:
|
|
696
|
-
|
|
746
|
+
console.print(Text(f" ✗ Blocked — {action_desc}", style="red"))
|
|
747
|
+
audit_log("PERMISSION_DENIED", action)
|
|
697
748
|
return False
|
|
698
749
|
|
|
699
750
|
|