Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Commit 57bd81e

Browse files
committed
V1.3.5 Interactive mode feature upgrades
1 parent 3c9e044 commit 57bd81e

6 files changed

Lines changed: 874 additions & 3 deletions

File tree

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Designed for developers, researchers, and power users, DeepShell abstracts away
2323
* Set the conversation history limit (defaults to 25 turns).
2424
* Toggle response streaming for immediate (plain-text) or complete (Markdown-rendered) output. Streaming is disabled by default to preserve formatting.
2525
* Enable or disable Markdown rendering for each LLM service individually.
26+
* **Save responses to markdown files** directly from interactive mode using the `save` command.
2627
* **Unified & Interactive Configuration:**
2728
* A central, user-friendly settings menu (`-s`) guides you through all configuration tasks.
2829
* Manages LLM service details, including server addresses (Ollama) and API keys (Gemini).
@@ -226,6 +227,119 @@ Your settings will be saved to `~/.deepshell/deepshell.conf`.
226227
./deepshell -i (or --interactive)
227228
```
228229

230+
## 💬 Interactive Mode Commands
231+
232+
When using interactive mode (`-i`), you have access to special commands in addition to your regular queries:
233+
234+
### Available Commands
235+
236+
**Exit the interactive session:**
237+
```
238+
exit
239+
quit
240+
```
241+
242+
**Save the last response to a markdown file:**
243+
```
244+
save [filename]
245+
```
246+
247+
**Open a text file as input query:**
248+
```
249+
open [filepath]
250+
```
251+
252+
**Show help for all interactive commands:**
253+
```
254+
help
255+
```
256+
257+
### Save Command Examples
258+
259+
**Save with automatic filename prompt:**
260+
```
261+
> What are the benefits of using a CLI for LLM interaction?
262+
[LLM provides detailed response with markdown formatting]
263+
264+
> save
265+
Enter filename (.md extension will be added automatically): research-notes
266+
Save successful!
267+
File saved to: /home/user/Downloads/research-notes.md
268+
```
269+
270+
**Save with direct filename:**
271+
```
272+
> Explain the concept of machine learning
273+
[LLM provides detailed response]
274+
275+
> save ml-explanation
276+
Save successful!
277+
File saved to: /home/user/Downloads/ml-explanation.md
278+
```
279+
280+
**Save with existing .md extension:**
281+
```
282+
> How do neural networks work?
283+
[LLM provides detailed response]
284+
285+
> save neural-networks-guide.md
286+
Save successful!
287+
File saved to: /home/user/Downloads/neural-networks-guide.md
288+
```
289+
290+
### Save Command Features
291+
292+
- **Auto .md extension**: Automatically adds `.md` extension if not provided
293+
- **File validation**: Prevents invalid characters and empty filenames
294+
- **Overwrite protection**: Asks for confirmation before overwriting existing files
295+
- **Smart directory**: Saves to Downloads folder (falls back to home directory)
296+
- **Raw markdown**: Preserves exact formatting as received from the LLM
297+
- **Error handling**: Prevents conversion if no previous response exists
298+
299+
### Open Command Examples
300+
301+
**Open file with instructions:**
302+
```
303+
> open /home/user/data.txt
304+
Enter instructions for the LLM about this data: Please analyze this data and tell me if it's correct
305+
[LLM processes the file content with your instructions]
306+
```
307+
308+
**Open file with default analysis:**
309+
```
310+
> open ../documents/notes.md
311+
Enter instructions for the LLM about this data: [Press Enter for default]
312+
[LLM processes with "Please analyze this data"]
313+
```
314+
315+
### Open Command Features
316+
317+
- **File validation**: Checks if file exists, is readable, and is text-based
318+
- **Size limit**: Maximum 25MB file size to prevent memory issues
319+
- **Path support**: Both absolute and relative file paths
320+
- **User instructions**: Prompt for custom instructions on how to process the file
321+
- **Default instructions**: "Please analyze this data" if no instructions provided
322+
- **Binary detection**: Rejects non-text files (images, executables, etc.)
323+
- **Error handling**: Clear error messages for all failure cases
324+
325+
### Help Command Features
326+
327+
- **Comprehensive reference**: Complete list of all interactive mode commands
328+
- **Detailed descriptions**: Usage information and examples for each command
329+
- **Professional formatting**: Clean, easy-to-read help menu
330+
- **Usage tips**: Best practices and guidance for interactive mode
331+
332+
### Use Cases
333+
334+
- **Research documentation**: Save important findings and explanations
335+
- **Knowledge base building**: Create markdown files for future reference
336+
- **Content creation**: Export formatted responses for articles or documentation
337+
- **Learning materials**: Save educational content for later review
338+
- **File analysis**: Process documents, code, or data files with custom instructions
339+
- **Code review**: Analyze source code files for bugs, improvements, or explanations
340+
- **Document processing**: Extract insights from text files, logs, or reports
341+
- **Interactive help**: Get comprehensive command reference anytime during sessions
342+
229343
## ⚙️ Configuration File
230344

231345
DeepShell stores its configuration in a JSON file located at `~/.deepshell/deepshell.conf`. While you can view this file, it's recommended to manage settings through DeepShell's command-line options for safety and ease of use.

RELEASE_NOTES_1.3.5.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# DeepShell Release Notes - Version 1.3.5
2+
3+
**Release Date:** December 19, 2024
4+
**Version:** 1.3.5
5+
6+
---
7+
8+
## 🎉 Overview
9+
10+
DeepShell 1.3.5 introduces a comprehensive set of interactive mode enhancements that transform the user experience. This release focuses on productivity, usability, and workflow improvements, making DeepShell more powerful and user-friendly than ever before.
11+
12+
## ✨ New Features
13+
14+
### 💾 Interactive Mode Save Command
15+
16+
**Command:** `save [filename]`
17+
18+
Transform your interactive sessions with the ability to save LLM responses directly to markdown files.
19+
20+
**Usage Examples:**
21+
```bash
22+
# Save with automatic filename prompt
23+
> What are the benefits of using a CLI for LLM interaction?
24+
[LLM provides detailed response with markdown formatting]
25+
26+
> save
27+
Enter filename (.md extension will be added automatically): research-notes
28+
Save successful!
29+
File saved to: /home/user/Downloads/research-notes.md
30+
31+
# Save with direct filename
32+
> Explain the concept of machine learning
33+
[LLM provides detailed response]
34+
35+
> save ml-explanation
36+
Save successful!
37+
File saved to: /home/user/Downloads/ml-explanation.md
38+
39+
# Save with existing .md extension
40+
> How do neural networks work?
41+
[LLM provides detailed response]
42+
43+
> save neural-networks-guide.md
44+
Save successful!
45+
File saved to: /home/user/Downloads/neural-networks-guide.md
46+
```
47+
48+
**Key Features:**
49+
- **Auto .md extension**: Automatically adds `.md` extension if not provided
50+
- **File validation**: Prevents invalid characters and empty filenames
51+
- **Overwrite protection**: Asks for confirmation before overwriting existing files
52+
- **Smart directory**: Saves to Downloads folder (falls back to home directory)
53+
- **Raw markdown**: Preserves exact formatting as received from the LLM
54+
- **Error handling**: Prevents conversion if no previous response exists
55+
56+
### 📁 Interactive Mode Open Command
57+
58+
**Command:** `open [filepath]`
59+
60+
Process text files directly through the LLM with custom instructions, making file analysis seamless and powerful.
61+
62+
**Usage Examples:**
63+
```bash
64+
# Open file with custom instructions
65+
> open /home/user/data.txt
66+
Enter instructions for the LLM about this data: Please analyze this data and tell me if it's correct
67+
[LLM processes the file content with your instructions]
68+
69+
# Open file with default analysis
70+
> open ../documents/notes.md
71+
Enter instructions for the LLM about this data: [Press Enter for default]
72+
[LLM processes with "Please analyze this data"]
73+
```
74+
75+
**Key Features:**
76+
- **File validation**: Checks if file exists, is readable, and is text-based
77+
- **Size limit**: Maximum 25MB file size to prevent memory issues
78+
- **Path support**: Both absolute and relative file paths
79+
- **User instructions**: Prompt for custom instructions on how to process the file
80+
- **Default instructions**: "Please analyze this data" if no instructions provided
81+
- **Binary detection**: Rejects non-text files (images, executables, etc.)
82+
- **Error handling**: Clear error messages for all failure cases
83+
84+
### ❓ Interactive Mode Help Command
85+
86+
**Command:** `help`
87+
88+
Access comprehensive help documentation directly from interactive mode with a professionally formatted command reference.
89+
90+
**Features:**
91+
- **Comprehensive reference**: Complete list of all interactive mode commands
92+
- **Detailed descriptions**: Usage information and examples for each command
93+
- **Professional formatting**: Clean, easy-to-read help menu
94+
- **Usage tips**: Best practices and guidance for interactive mode
95+
96+
## 🔧 Technical Improvements
97+
98+
### Enhanced Interactive Mode Interface
99+
100+
- **Simplified welcome message**: Clean, focused interface with just essential information
101+
- **Streamlined command structure**: Intuitive command names and syntax
102+
- **Improved error handling**: Clear, actionable error messages for all scenarios
103+
- **Better user experience**: Reduced cognitive load with cleaner interface design
104+
105+
### Robust File Processing
106+
107+
- **Memory management**: Efficient handling of large files up to 25MB
108+
- **Binary file detection**: Smart detection of non-text files to prevent processing errors
109+
- **Path resolution**: Support for both absolute and relative file paths
110+
- **Error recovery**: Graceful handling of file access and permission issues
111+
112+
### Command History Management
113+
114+
- **Separate history entries**: User instructions and file content stored as separate history items
115+
- **Accurate help documentation**: Corrected information about conversation history persistence
116+
- **Memory efficiency**: Optimized storage and retrieval of conversation data
117+
118+
## 🐛 Bug Fixes
119+
120+
### Ollama Integration Fix
121+
122+
- **Fixed history bug**: Ollama responses now properly added to conversation history
123+
- **Consistent behavior**: All LLM services (Ollama, Gemini, OpenRouter) now work identically with save command
124+
- **Improved reliability**: Eliminated "No previous response found" errors for Ollama users
125+
126+
### Error Message Improvements
127+
128+
- **Accurate help text**: Fixed misleading information about conversation history persistence
129+
- **Clear error reporting**: Better error messages for file processing failures
130+
- **User guidance**: More helpful error messages that guide users to solutions
131+
132+
## 🚀 Getting Started with New Features
133+
134+
### Quick Start Guide
135+
136+
1. **Start interactive mode:**
137+
```bash
138+
./deepshell -i
139+
```
140+
141+
2. **Get help anytime:**
142+
```
143+
> help
144+
```
145+
146+
3. **Save important responses:**
147+
```
148+
> save my-notes
149+
```
150+
151+
4. **Process files with custom instructions:**
152+
```
153+
> open /path/to/file.txt
154+
Enter instructions for the LLM about this data: [your instructions]
155+
```
156+
157+
### Use Cases
158+
159+
- **Research documentation**: Save important findings and explanations
160+
- **Knowledge base building**: Create markdown files for future reference
161+
- **Content creation**: Export formatted responses for articles or documentation
162+
- **Learning materials**: Save educational content for later review
163+
- **File analysis**: Process documents, code, or data files with custom instructions
164+
- **Code review**: Analyze source code files for bugs, improvements, or explanations
165+
- **Document processing**: Extract insights from text files, logs, or reports
166+
- **Interactive help**: Get comprehensive command reference anytime during sessions
167+
168+
## 🔄 Migration Guide
169+
170+
### From Version 1.3.1 to 1.3.5
171+
172+
1. **No configuration changes required** - existing configurations work seamlessly
173+
2. **New interactive commands available** - use `help` to see all available commands
174+
3. **Enhanced workflow** - take advantage of save and open commands for better productivity
175+
4. **Improved reliability** - Ollama users will notice better consistency with other LLM services
176+
177+
### Command Changes
178+
179+
- **Convert → Save**: The `convert` command has been renamed to `save` for better clarity
180+
- **New commands**: `open` and `help` commands are now available in interactive mode
181+
- **Simplified interface**: Cleaner welcome message focuses on essential information
182+
183+
## 📋 Technical Details
184+
185+
### Files Modified
186+
187+
- **interactive.c**: Added save, open, and help command implementations
188+
- **utils.c**: Added file processing and help display functions
189+
- **deepshell.h**: Updated function declarations and version number
190+
- **README.md**: Comprehensive documentation updates
191+
192+
### New Functions
193+
194+
- `save_response_to_file()`: Saves LLM responses to markdown files
195+
- `read_file_content()`: Reads and validates text files
196+
- `is_text_file()`: Detects binary vs text files
197+
- `display_interactive_help()`: Shows comprehensive help menu
198+
- `is_valid_filename()`: Validates filenames for save command
199+
200+
### Dependencies
201+
202+
- No new dependencies required
203+
- All existing functionality preserved
204+
- Backward compatible with previous versions
205+
206+
## 🎯 Performance Improvements
207+
208+
- **Memory efficiency**: Optimized file processing and memory management
209+
- **Faster command processing**: Streamlined interactive mode command handling
210+
- **Reduced memory footprint**: Better memory allocation and cleanup
211+
- **Improved responsiveness**: Faster file validation and error checking
212+
213+
## 🔒 Security Considerations
214+
215+
- **File validation**: Strict validation of file types and sizes
216+
- **Path security**: Safe handling of file paths and permissions
217+
- **Memory protection**: Bounds checking and overflow protection
218+
- **Error isolation**: Graceful handling of file system errors
219+
220+
## 📚 Documentation Updates
221+
222+
- **README.md**: Updated with comprehensive interactive mode documentation
223+
- **Help system**: Built-in help command with detailed usage information
224+
- **Examples**: Extensive examples for all new features
225+
- **Use cases**: Practical applications and workflow guidance
226+
227+
## 🎉 What's Next
228+
229+
This release establishes a solid foundation for interactive mode productivity. Future releases will build upon these capabilities with additional features and enhancements.
230+
231+
## 🙏 Acknowledgments
232+
233+
Thank you to all users who provided feedback and suggestions that helped shape this release. Your input is invaluable in making DeepShell better for everyone.
234+
235+
---
236+
237+
**Happy Querying! 🤖✨**

deepshell.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <readline/history.h>
1717

1818
// Version
19-
#define DEEPSHELL_VERSION "1.3.1"
19+
#define DEEPSHELL_VERSION "1.3.5"
2020

2121
// Configuration constants
2222
#define CONFIG_DIR_NAME ".deepshell"
@@ -234,4 +234,15 @@ bool import_config_from_file(config_t *config, const char *filename, const char
234234
char* get_downloads_path(void);
235235
char* get_password_input(const char *prompt, bool confirm);
236236

237+
// Save functions
238+
bool save_response_to_file(const char *response_text, const char *filename);
239+
bool is_valid_filename(const char *filename);
240+
241+
// Open functions
242+
char* read_file_content(const char *filepath);
243+
bool is_text_file(const char *filepath);
244+
245+
// Help functions
246+
void display_interactive_help(void);
247+
237248
#endif // DEEPSHELL_H

images/deepshell-i.png

32.6 KB
Loading

0 commit comments

Comments
 (0)