flamecli 0.1.2__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.
- flamecli-0.1.2/LICENSE +22 -0
- flamecli-0.1.2/PKG-INFO +431 -0
- flamecli-0.1.2/README.md +411 -0
- flamecli-0.1.2/pyproject.toml +36 -0
- flamecli-0.1.2/setup.cfg +4 -0
- flamecli-0.1.2/src/cli/repl.py +324 -0
- flamecli-0.1.2/src/flame/__init__.py +1 -0
- flamecli-0.1.2/src/flame/api/__init__.py +2 -0
- flamecli-0.1.2/src/flame/api/async_client.py +43 -0
- flamecli-0.1.2/src/flame/api/client.py +156 -0
- flamecli-0.1.2/src/flame/cli/__init__.py +2 -0
- flamecli-0.1.2/src/flame/cli/executor.py +515 -0
- flamecli-0.1.2/src/flame/cli/repl.py +342 -0
- flamecli-0.1.2/src/flame/main.py +105 -0
- flamecli-0.1.2/src/flame/tools/__init__.py +0 -0
- flamecli-0.1.2/src/flame/tools/base.py +110 -0
- flamecli-0.1.2/src/flame/tools/fs.py +89 -0
- flamecli-0.1.2/src/flame/tools/registry.py +57 -0
- flamecli-0.1.2/src/flame/tools/system.py +13 -0
- flamecli-0.1.2/src/flame/utils/__init__.py +2 -0
- flamecli-0.1.2/src/flame/utils/context.py +168 -0
- flamecli-0.1.2/src/flame/utils/logger.py +11 -0
- flamecli-0.1.2/src/flame/utils/prompts.py +42 -0
- flamecli-0.1.2/src/flamecli.egg-info/PKG-INFO +431 -0
- flamecli-0.1.2/src/flamecli.egg-info/SOURCES.txt +29 -0
- flamecli-0.1.2/src/flamecli.egg-info/dependency_links.txt +1 -0
- flamecli-0.1.2/src/flamecli.egg-info/entry_points.txt +2 -0
- flamecli-0.1.2/src/flamecli.egg-info/requires.txt +4 -0
- flamecli-0.1.2/src/flamecli.egg-info/top_level.txt +2 -0
- flamecli-0.1.2/tests/test_basic.py +9 -0
- flamecli-0.1.2/tests/test_tools.py +36 -0
flamecli-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jameson Piscitello
|
|
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.
|
|
22
|
+
|
flamecli-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flamecli
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: AI-powered CLI coding assistant with API
|
|
5
|
+
Author-email: Jameson Piscitello <piscitello284@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jameson-pi/flame
|
|
8
|
+
Project-URL: Issues, https://github.com/jameson-pi/flame/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: openrouter>=0.1.0
|
|
16
|
+
Requires-Dist: rich>=13.0.0
|
|
17
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
18
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# 🔥 Flame - AI-Powered CLI Coding Assistant
|
|
22
|
+
|
|
23
|
+
An intelligent command-line interface (CLI) application that functions as an AI coding assistant directly in your terminal, powered by **API**.
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- **Interactive REPL**: Continuous chat loop with full conversation context
|
|
28
|
+
- **System Awareness**: Automatically gathers context about your environment (OS, project structure, git status)
|
|
29
|
+
- **Real-time Streaming**: Responses stream into the terminal as they're generated
|
|
30
|
+
- **Safe File Operations**: Create and edit files with intelligent diff preview and approval prompts
|
|
31
|
+
- **Command Execution**: Suggest and safely execute terminal commands with user approval
|
|
32
|
+
- **Dangerous Command Detection**: Blocks potentially harmful commands while allowing safe ones
|
|
33
|
+
- **Multi-turn Conversations**: Maintains full chat history across sessions
|
|
34
|
+
|
|
35
|
+
## 🚀 Quick Start
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
- Python 3.10+
|
|
40
|
+
- A API key
|
|
41
|
+
- pip or poetry for dependency management
|
|
42
|
+
|
|
43
|
+
### Installation
|
|
44
|
+
|
|
45
|
+
1. **Clone or navigate to the project**:
|
|
46
|
+
```bash
|
|
47
|
+
cd flame
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. **Create a virtual environment** (recommended):
|
|
51
|
+
```bash
|
|
52
|
+
python -m venv venv
|
|
53
|
+
# On Windows:
|
|
54
|
+
venv\Scripts\activate
|
|
55
|
+
# On macOS/Linux:
|
|
56
|
+
source venv/bin/activate
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Install dependencies**:
|
|
60
|
+
```bash
|
|
61
|
+
pip install -r requirements.txt
|
|
62
|
+
# OR if using pyproject.toml:
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
4. **Setup configuration**:
|
|
67
|
+
```bash
|
|
68
|
+
cp .env.example .env
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
5. **Add your API key to `.env`**:
|
|
72
|
+
```env
|
|
73
|
+
FLAME_API_KEY=your_actual_api_key_here
|
|
74
|
+
FLAME_API_BASE_URL=https://api.example.com/proxy/v1
|
|
75
|
+
FLAME_MODEL=qwen/qwen3-32b
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Test Connection
|
|
79
|
+
|
|
80
|
+
Before running the REPL, verify your setup:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python main.py --check
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Expected output:
|
|
87
|
+
```
|
|
88
|
+
🔍 Testing connection to API...
|
|
89
|
+
✅ Connection successful!
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Start the CLI
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
python main.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You'll see:
|
|
99
|
+
```
|
|
100
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
101
|
+
┃ 🔥 Flame - AI Coding Assistant ┃
|
|
102
|
+
┃ Powered by API ┃
|
|
103
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
104
|
+
|
|
105
|
+
Type 'help' for commands, 'exit' to quit
|
|
106
|
+
|
|
107
|
+
You: _
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 💬 Usage Examples
|
|
111
|
+
|
|
112
|
+
### Basic Chat
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
You: What does this code do?
|
|
116
|
+
[paste code]
|
|
117
|
+
|
|
118
|
+
🤖 Flame: This code does...
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Get Project Context
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
You: help
|
|
125
|
+
|
|
126
|
+
Available Commands:
|
|
127
|
+
|
|
128
|
+
help - Show this help message
|
|
129
|
+
context - Show current system context
|
|
130
|
+
clear - Clear conversation history
|
|
131
|
+
exit - Exit the program
|
|
132
|
+
/run <cmd> - Suggest running a command (AI-aware)
|
|
133
|
+
/edit <file> - Suggest editing a file
|
|
134
|
+
/create <file> - Suggest creating a file
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### View System Context
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
You: context
|
|
141
|
+
|
|
142
|
+
📍 System Context:
|
|
143
|
+
|
|
144
|
+
📍 Working Directory: /path/to/project
|
|
145
|
+
🖥️ System: Linux 6.1.0 | Python 3.11.0
|
|
146
|
+
🌿 Git Status: On branch main
|
|
147
|
+
📂 Project Structure:
|
|
148
|
+
project-name/
|
|
149
|
+
├── main.py
|
|
150
|
+
├── utils/
|
|
151
|
+
└── ...
|
|
152
|
+
📊 File Summary:
|
|
153
|
+
Total files: 24
|
|
154
|
+
.py: 12
|
|
155
|
+
.md: 3
|
|
156
|
+
...
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### AI-Suggested File Creation
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
You: Create a requirements.txt with common Python packages
|
|
163
|
+
|
|
164
|
+
🤖 Flame: I'll create a requirements.txt with popular packages...
|
|
165
|
+
|
|
166
|
+
📝 Create File: requirements.txt
|
|
167
|
+
Suggested by AI assistant
|
|
168
|
+
|
|
169
|
+
Preview:
|
|
170
|
+
requests>=2.28.0
|
|
171
|
+
python-dotenv>=0.20.0
|
|
172
|
+
rich>=13.0.0
|
|
173
|
+
...
|
|
174
|
+
|
|
175
|
+
✅ Create this file? [y/n]: y
|
|
176
|
+
✅ File created: requirements.txt
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### AI-Suggested Command Execution
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
You: How do I install the dependencies?
|
|
183
|
+
|
|
184
|
+
🤖 Flame: You can run pip install...
|
|
185
|
+
|
|
186
|
+
🔧 Run Command:
|
|
187
|
+
Suggested by AI assistant
|
|
188
|
+
|
|
189
|
+
Command:
|
|
190
|
+
pip install -r requirements.txt
|
|
191
|
+
|
|
192
|
+
✅ Execute this command? [y/n]: y
|
|
193
|
+
✅ Command executed successfully
|
|
194
|
+
|
|
195
|
+
Output:
|
|
196
|
+
Collecting requests...
|
|
197
|
+
...
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Clear History
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
You: clear
|
|
204
|
+
✅ Conversation history cleared
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## 🏗️ Architecture
|
|
208
|
+
|
|
209
|
+
### Directory Structure
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
flame/
|
|
213
|
+
├── api/
|
|
214
|
+
│ ├── __init__.py
|
|
215
|
+
│ └── client.py # API wrapper
|
|
216
|
+
├── cli/
|
|
217
|
+
│ ├── __init__.py
|
|
218
|
+
│ ├── repl.py # Interactive REPL loop
|
|
219
|
+
│ └── executor.py # File and command execution
|
|
220
|
+
├── utils/
|
|
221
|
+
│ ├── __init__.py
|
|
222
|
+
│ └── context.py # System context collector
|
|
223
|
+
├── main.py # Entry point
|
|
224
|
+
├── pyproject.toml # Project configuration
|
|
225
|
+
├── .env.example # Environment template
|
|
226
|
+
└── .env # Your configuration (gitignored)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Component Interaction
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
┌─────────────────────────────────────────┐
|
|
233
|
+
│ main.py (Entry Point) │
|
|
234
|
+
└──────────────────┬──────────────────────┘
|
|
235
|
+
│
|
|
236
|
+
▼
|
|
237
|
+
┌─────────────────────────────────────────┐
|
|
238
|
+
│ REPL (cli/repl.py) │
|
|
239
|
+
│ ├─ Interactive loop │
|
|
240
|
+
│ ├─ Message history │
|
|
241
|
+
│ └─ Command handling │
|
|
242
|
+
└──────────────┬──────────────────────────┘
|
|
243
|
+
│
|
|
244
|
+
┌──────┴──────┬────────────┐
|
|
245
|
+
▼ ▼ ▼
|
|
246
|
+
┌────────┐ ┌──────────┐ ┌─────────┐
|
|
247
|
+
│HackClubAI API │ │FileExecutor │ │CommandExecutor
|
|
248
|
+
│(api/client.py) │ │(executor.py)│ │(executor.py)
|
|
249
|
+
│ │ │ │ │
|
|
250
|
+
│• Streaming │ │• Safe file │ │• Command checks
|
|
251
|
+
│• Non-streaming │ │ ops │ │• Approval prompts
|
|
252
|
+
│• Error handling │ │• Diffs │ │• History
|
|
253
|
+
└────────┬────────┘ └──────────────┘ └─────────────┘
|
|
254
|
+
│
|
|
255
|
+
SystemContext
|
|
256
|
+
(utils/context.py)
|
|
257
|
+
├─ OS info
|
|
258
|
+
├─ Git status
|
|
259
|
+
├─ Project structure
|
|
260
|
+
└─ File summary
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🔒 Security Features
|
|
264
|
+
|
|
265
|
+
### File Operations Security
|
|
266
|
+
|
|
267
|
+
1. **Path Validation**: All file paths are validated to stay within the project directory
|
|
268
|
+
2. **Diff Preview**: Before writing, users see exactly what changes will be made
|
|
269
|
+
3. **User Approval**: Every file creation/edit requires explicit user confirmation
|
|
270
|
+
4. **Safe by Default**: Operations are blocked if path escapes project root
|
|
271
|
+
|
|
272
|
+
### Command Execution Security
|
|
273
|
+
|
|
274
|
+
1. **Dangerous Pattern Detection**: Blocks commands matching risky patterns:
|
|
275
|
+
- `rm -rf /` (recursive root deletion)
|
|
276
|
+
- `sudo` (privilege escalation)
|
|
277
|
+
- `dd` (disk operations)
|
|
278
|
+
- `mkfs` (filesystem formatting)
|
|
279
|
+
- Fork bombs
|
|
280
|
+
|
|
281
|
+
2. **User Approval**: Every command execution requires explicit confirmation
|
|
282
|
+
3. **Timeout Protection**: Commands are forcibly terminated after 30 seconds
|
|
283
|
+
4. **Error Reporting**: Command failures are clearly reported
|
|
284
|
+
|
|
285
|
+
### API Key Security
|
|
286
|
+
|
|
287
|
+
- Store in `.env` file (add to `.gitignore` automatically)
|
|
288
|
+
- Never commit `.env` to version control
|
|
289
|
+
- Use environment variables in production
|
|
290
|
+
- Supports `.env.example` for template sharing
|
|
291
|
+
|
|
292
|
+
## 📋 Configuration
|
|
293
|
+
|
|
294
|
+
### Environment Variables
|
|
295
|
+
|
|
296
|
+
Create a `.env` file from `.env.example`:
|
|
297
|
+
|
|
298
|
+
```env
|
|
299
|
+
# Required: Your API key
|
|
300
|
+
FLAME_API_KEY=hf_xxxxxxxxxxxxx
|
|
301
|
+
|
|
302
|
+
# Optional: API endpoint (usually pre-configured)
|
|
303
|
+
FLAME_API_BASE_URL=https://api.example.com/proxy/v1
|
|
304
|
+
|
|
305
|
+
# Optional: AI model to use
|
|
306
|
+
FLAME_MODEL=qwen/qwen3-32b
|
|
307
|
+
|
|
308
|
+
# Optional: CLI settings
|
|
309
|
+
CLI_THEME=dark
|
|
310
|
+
DEBUG=false
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## 🎮 CLI Options
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
python main.py --help
|
|
317
|
+
|
|
318
|
+
usage: main.py [-h] [--version] [--check] [--dir DIR] [--model MODEL] [--debug]
|
|
319
|
+
|
|
320
|
+
Flame - AI Coding Assistant powered by API
|
|
321
|
+
|
|
322
|
+
options:
|
|
323
|
+
-h, --help show this help message and exit
|
|
324
|
+
--version show program's version number and exit
|
|
325
|
+
--check Test connection to API
|
|
326
|
+
--dir DIR Working directory (defaults to current directory)
|
|
327
|
+
--model MODEL AI model to use (overrides FLAME_MODEL env var)
|
|
328
|
+
--debug Enable debug mode
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## 🐛 Troubleshooting
|
|
332
|
+
|
|
333
|
+
### Connection Failed
|
|
334
|
+
|
|
335
|
+
**Error**: `Connection failed. Check your API key and network.`
|
|
336
|
+
|
|
337
|
+
**Solutions**:
|
|
338
|
+
1. Verify API key is correct in `.env`
|
|
339
|
+
2. Check internet connection
|
|
340
|
+
3. Verify API base URL is correct
|
|
341
|
+
4. Test with: `python main.py --check --debug`
|
|
342
|
+
|
|
343
|
+
### Import Errors
|
|
344
|
+
|
|
345
|
+
**Error**: `ModuleNotFoundError: No module named 'api'`
|
|
346
|
+
|
|
347
|
+
**Solutions**:
|
|
348
|
+
1. Ensure you're in the project root directory
|
|
349
|
+
2. Virtual environment is activated
|
|
350
|
+
3. Dependencies are installed: `pip install -e .`
|
|
351
|
+
|
|
352
|
+
### Command Won't Execute
|
|
353
|
+
|
|
354
|
+
**Error**: `Dangerous Command Detected`
|
|
355
|
+
|
|
356
|
+
**Solutions**:
|
|
357
|
+
1. Command matches safety patterns (by design)
|
|
358
|
+
2. Use `--debug` to see pattern matching
|
|
359
|
+
3. Use safer alternative commands
|
|
360
|
+
4. File path must be within project directory
|
|
361
|
+
|
|
362
|
+
## 📚 Advanced Usage
|
|
363
|
+
|
|
364
|
+
### Using with Different Models
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
# Override model at runtime
|
|
368
|
+
python main.py --model llama2
|
|
369
|
+
|
|
370
|
+
# Or set in .env:
|
|
371
|
+
FLAME_MODEL=llama2
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Using Different Working Directory
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# Analyze a different project
|
|
378
|
+
python main.py --dir /path/to/other/project
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Debug Mode
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# See detailed error messages
|
|
385
|
+
python main.py --debug
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## 🔧 Development
|
|
389
|
+
|
|
390
|
+
### Running Tests
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
pytest tests/
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Code Style
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Format code
|
|
400
|
+
black api/ cli/ utils/ main.py
|
|
401
|
+
|
|
402
|
+
# Lint
|
|
403
|
+
flake8 api/ cli/ utils/ main.py
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## 📝 License
|
|
407
|
+
|
|
408
|
+
MIT License - feel free to use and modify!
|
|
409
|
+
|
|
410
|
+
## 🤝 Contributing
|
|
411
|
+
|
|
412
|
+
Contributions welcome! Please:
|
|
413
|
+
|
|
414
|
+
1. Fork the repository
|
|
415
|
+
2. Create a feature branch
|
|
416
|
+
3. Add tests for new functionality
|
|
417
|
+
4. Submit a pull request
|
|
418
|
+
|
|
419
|
+
## 🙋 Support
|
|
420
|
+
|
|
421
|
+
Need help? Try:
|
|
422
|
+
|
|
423
|
+
1. Check `.env` configuration
|
|
424
|
+
2. Run `python main.py --check` to verify setup
|
|
425
|
+
3. Use `--debug` flag for detailed error messages
|
|
426
|
+
4. Review this README for common issues
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
**Made with 🔥 by API Community**
|
|
431
|
+
|