janito 0.11.0__tar.gz → 0.13.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.
- {janito-0.11.0 → janito-0.13.0}/.gitignore +4 -1
- janito-0.13.0/PKG-INFO +300 -0
- janito-0.13.0/README.md +280 -0
- janito-0.13.0/janito/__init__.py +5 -0
- janito-0.13.0/janito/__main__.py +7 -0
- janito-0.13.0/janito/callbacks.py +34 -0
- janito-0.13.0/janito/cli/__init__.py +6 -0
- janito-0.13.0/janito/cli/agent.py +400 -0
- janito-0.13.0/janito/cli/app.py +94 -0
- janito-0.13.0/janito/cli/commands.py +329 -0
- janito-0.13.0/janito/cli/output.py +29 -0
- janito-0.13.0/janito/cli/utils.py +22 -0
- janito-0.13.0/janito/config.py +358 -0
- janito-0.13.0/janito/data/instructions_template.txt +28 -0
- janito-0.13.0/janito/token_report.py +154 -0
- janito-0.13.0/janito/tools/__init__.py +38 -0
- janito-0.13.0/janito/tools/bash/bash.py +84 -0
- janito-0.13.0/janito/tools/bash/unix_persistent_bash.py +184 -0
- janito-0.13.0/janito/tools/bash/win_persistent_bash.py +308 -0
- {janito-0.11.0 → janito-0.13.0}/janito/tools/decorators.py +2 -13
- janito-0.13.0/janito/tools/delete_file.py +65 -0
- janito-0.13.0/janito/tools/fetch_webpage/__init__.py +34 -0
- janito-0.13.0/janito/tools/fetch_webpage/chunking.py +76 -0
- janito-0.13.0/janito/tools/fetch_webpage/core.py +155 -0
- janito-0.13.0/janito/tools/fetch_webpage/extractors.py +276 -0
- janito-0.13.0/janito/tools/fetch_webpage/news.py +137 -0
- janito-0.13.0/janito/tools/fetch_webpage/utils.py +108 -0
- janito-0.13.0/janito/tools/find_files.py +220 -0
- janito-0.13.0/janito/tools/move_file.py +72 -0
- janito-0.13.0/janito/tools/prompt_user.py +57 -0
- janito-0.13.0/janito/tools/replace_file.py +63 -0
- janito-0.13.0/janito/tools/rich_console.py +176 -0
- {janito-0.11.0 → janito-0.13.0}/janito/tools/search_text.py +35 -22
- {janito-0.11.0 → janito-0.13.0}/janito/tools/str_replace_editor/editor.py +7 -4
- janito-0.13.0/janito/tools/str_replace_editor/handlers/__init__.py +16 -0
- janito-0.13.0/janito/tools/str_replace_editor/handlers/create.py +60 -0
- janito-0.13.0/janito/tools/str_replace_editor/handlers/insert.py +100 -0
- janito-0.13.0/janito/tools/str_replace_editor/handlers/str_replace.py +94 -0
- janito-0.13.0/janito/tools/str_replace_editor/handlers/undo.py +64 -0
- janito-0.13.0/janito/tools/str_replace_editor/handlers/view.py +159 -0
- {janito-0.11.0 → janito-0.13.0}/janito/tools/str_replace_editor/utils.py +0 -1
- janito-0.13.0/janito/tools/usage_tracker.py +136 -0
- janito-0.13.0/pyproject.toml +89 -0
- janito-0.11.0/PKG-INFO +0 -86
- janito-0.11.0/README.md +0 -73
- janito-0.11.0/janito/__init__.py +0 -5
- janito-0.11.0/janito/__main__.py +0 -205
- janito-0.11.0/janito/callbacks.py +0 -132
- janito-0.11.0/janito/chat_history.py +0 -117
- janito-0.11.0/janito/config.py +0 -121
- janito-0.11.0/janito/data/instructions.txt +0 -4
- janito-0.11.0/janito/token_report.py +0 -145
- janito-0.11.0/janito/tools/__init__.py +0 -21
- janito-0.11.0/janito/tools/bash.py +0 -22
- janito-0.11.0/janito/tools/delete_file.py +0 -47
- janito-0.11.0/janito/tools/find_files.py +0 -158
- janito-0.11.0/janito/tools/prompt_user.py +0 -26
- janito-0.11.0/janito/tools/replace_file.py +0 -36
- janito-0.11.0/janito/tools/str_replace_editor/handlers.py +0 -335
- janito-0.11.0/pyproject.toml +0 -31
- {janito-0.11.0 → janito-0.13.0}/LICENSE +0 -0
- {janito-0.11.0 → janito-0.13.0}/janito/test_file.py +0 -0
- {janito-0.11.0 → janito-0.13.0}/janito/tools/str_replace_editor/__init__.py +0 -0
janito-0.13.0/PKG-INFO
ADDED
@@ -0,0 +1,300 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: janito
|
3
|
+
Version: 0.13.0
|
4
|
+
Summary: Janito CLI tool
|
5
|
+
Project-URL: Homepage, https://github.com/joaompinto/janito
|
6
|
+
Author-email: João Pinto <lamego.pinto@gmail.com>
|
7
|
+
License-File: LICENSE
|
8
|
+
Requires-Python: >=3.8
|
9
|
+
Requires-Dist: anthropic>=0.5.0
|
10
|
+
Requires-Dist: beautifulsoup4>=4.13.0
|
11
|
+
Requires-Dist: claudine>=0.1.0
|
12
|
+
Requires-Dist: jinja2>=3.0.0
|
13
|
+
Requires-Dist: lxml-html-clean>=0.4.1
|
14
|
+
Requires-Dist: newspaper3k>=0.2.8
|
15
|
+
Requires-Dist: requests>=2.32.0
|
16
|
+
Requires-Dist: rich>=13.0.0
|
17
|
+
Requires-Dist: trafilatura>=1.6.0
|
18
|
+
Requires-Dist: typer>=0.9.0
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
|
21
|
+
# 🤖 Janito
|
22
|
+
|
23
|
+
Janito is a powerful AI-assisted command-line interface (CLI) tool built with Python, leveraging Anthropic's Claude for intelligent code and file management.
|
24
|
+
|
25
|
+
[](https://github.com/joaompinto/janito)
|
26
|
+
|
27
|
+
## ✨ Features
|
28
|
+
|
29
|
+
- 🧠 Intelligent AI assistant powered by Claude
|
30
|
+
- 📁 File management capabilities with real-time output
|
31
|
+
- 🔍 Smart code search and editing
|
32
|
+
- 💻 Interactive terminal interface with rich formatting
|
33
|
+
- 📊 Detailed token usage tracking and cost reporting with cache savings analysis
|
34
|
+
- 🛑 Token and tool usage reporting even when interrupted with Ctrl+C
|
35
|
+
- 🌐 Web page fetching with content extraction capabilities
|
36
|
+
- 🔄 Parameter profiles for optimizing Claude's behavior for different tasks
|
37
|
+
- 📋 Line delta tracking to monitor net changes in files
|
38
|
+
- 💬 Conversation history with ability to resume previous conversations
|
39
|
+
- 🔇 Trust mode for concise output without tool details
|
40
|
+
|
41
|
+
## 🛠️ System Requirements
|
42
|
+
|
43
|
+
- **Python 3.8+** - Janito requires Python 3.8 or higher
|
44
|
+
- **Operating Systems**:
|
45
|
+
- Linux/macOS: Native support
|
46
|
+
- Windows: Requires Git Bash for proper operation of CLI tools
|
47
|
+
- **Anthropic API Key** - Required for Claude AI integration
|
48
|
+
|
49
|
+
## 🛠️ Installation
|
50
|
+
|
51
|
+
```bash
|
52
|
+
# Install directly from PyPI
|
53
|
+
pip install janito
|
54
|
+
```
|
55
|
+
|
56
|
+
### Setting up your API Key
|
57
|
+
|
58
|
+
Janito requires an Anthropic API key to function. You can:
|
59
|
+
1. Set the API key: `janito --set-api-key your_api_key`
|
60
|
+
|
61
|
+
For development or installation from source, please see [README_DEV.md](README_DEV.md).
|
62
|
+
|
63
|
+
## 🚀 Usage Tutorial
|
64
|
+
|
65
|
+
After installation, you can start using Janito right away. Let's walk through a simple tutorial:
|
66
|
+
|
67
|
+
### Getting Started
|
68
|
+
|
69
|
+
First, let's check that everything is working:
|
70
|
+
|
71
|
+
```bash
|
72
|
+
# Get help and see available commands
|
73
|
+
janito --help
|
74
|
+
```
|
75
|
+
|
76
|
+
### Tutorial: Creating a Simple Project
|
77
|
+
|
78
|
+
Let's create a simple HTML project with Janito's help:
|
79
|
+
|
80
|
+
After installing Janito, using your prefered editor and/or terminal, go to a new empty folder.
|
81
|
+
|
82
|
+
Use the janito command to create a new project.
|
83
|
+
|
84
|
+
```bash
|
85
|
+
# Step 1: Create a new project structure
|
86
|
+
janito "Create a simple HTML page with a calculator and 3 columns with text for the 3 main activities of the Kazakh culture"
|
87
|
+
```
|
88
|
+
Browse the resulting html page.
|
89
|
+
|
90
|
+
### Tutorial: Adding Features
|
91
|
+
|
92
|
+
Now, let's enhance our example
|
93
|
+
|
94
|
+
```bash
|
95
|
+
# Step 2: Add multiplication and division features
|
96
|
+
janito "Add some svg icons and remove the calculator"
|
97
|
+
|
98
|
+
```
|
99
|
+
|
100
|
+
Refresh the page
|
101
|
+
|
102
|
+
### Exploring More Features
|
103
|
+
|
104
|
+
Janito offers many more capabilities:
|
105
|
+
|
106
|
+
```bash
|
107
|
+
# Show detailed token usage and cost information
|
108
|
+
janito --show-tokens "Explain what is in the project"
|
109
|
+
|
110
|
+
# Use a specific parameter profile for creative tasks
|
111
|
+
janito --profile creative "Write a fun description for our project"
|
112
|
+
|
113
|
+
# Use trust mode for concise output without tool details
|
114
|
+
janito --trust "Optimize the HTML code"
|
115
|
+
# Or use the short alias
|
116
|
+
janito -t "Optimize the HTML code"
|
117
|
+
|
118
|
+
# Continue the most recent conversation
|
119
|
+
janito --continue "Please add one more line"
|
120
|
+
|
121
|
+
# Continue a specific conversation using its message ID
|
122
|
+
# (Janito displays the message ID after each conversation)
|
123
|
+
janito --continue abc123def "Let's refine that code"
|
124
|
+
|
125
|
+
# Show current configuration and available profiles
|
126
|
+
janito --show-config
|
127
|
+
|
128
|
+
# You can press Ctrl+C at any time to interrupt a query
|
129
|
+
# Janito will still display token and tool usage information
|
130
|
+
# Even interrupted conversations can be continued with --continue
|
131
|
+
```
|
132
|
+
|
133
|
+
## 🔧 Available Tools
|
134
|
+
|
135
|
+
Janito comes with several built-in tools:
|
136
|
+
- 📄 `str_replace_editor` - View, create, and edit files
|
137
|
+
- 🔎 `find_files` - Find files matching patterns
|
138
|
+
- 🗑️ `delete_file` - Delete files
|
139
|
+
- 🔍 `search_text` - Search for text patterns in files
|
140
|
+
- 🌐 `fetch_webpage` - Fetch and extract content from web pages
|
141
|
+
- 📋 `move_file` - Move files from one location to another
|
142
|
+
- 💻 `bash` - Execute bash commands with real-time output display
|
143
|
+
|
144
|
+
## 📊 Usage Tracking
|
145
|
+
|
146
|
+
Janito includes a comprehensive token usage tracking system that helps you monitor API costs:
|
147
|
+
|
148
|
+
- **Basic tracking**: By default, Janito displays a summary of token usage and cost after each query
|
149
|
+
- **Detailed reporting**: Use the `--show-tokens` flag to see detailed breakdowns including:
|
150
|
+
- Input and output token counts
|
151
|
+
- Per-tool token usage statistics
|
152
|
+
- Precise cost calculations
|
153
|
+
- Cache performance metrics with savings analysis
|
154
|
+
- Line delta tracking for file modifications
|
155
|
+
|
156
|
+
```bash
|
157
|
+
# Show detailed token usage and cost information
|
158
|
+
janito --show-tokens "Write a Python function to sort a list"
|
159
|
+
|
160
|
+
# Basic usage (shows simplified token usage summary)
|
161
|
+
janito "Explain Docker containers"
|
162
|
+
|
163
|
+
# Use trust mode for concise output without tool details
|
164
|
+
janito --trust "Create a simple Python script"
|
165
|
+
# Or use the short alias
|
166
|
+
janito -t "Create a simple Python script"
|
167
|
+
```
|
168
|
+
|
169
|
+
The usage tracker automatically calculates cache savings, showing you how much you're saving by reusing previous responses.
|
170
|
+
|
171
|
+
## 📋 Parameter Profiles
|
172
|
+
|
173
|
+
Janito offers predefined parameter profiles to optimize Claude's behavior for different tasks:
|
174
|
+
|
175
|
+
- **precise**: Factual answers, documentation, structured data (temperature: 0.2)
|
176
|
+
- **balanced**: Professional writing, summarization, everyday tasks (temperature: 0.5)
|
177
|
+
- **conversational**: Natural dialogue, educational content (temperature: 0.7)
|
178
|
+
- **creative**: Storytelling, brainstorming, marketing copy (temperature: 0.9)
|
179
|
+
- **technical**: Code generation, debugging, technical problem-solving (temperature: 0.3)
|
180
|
+
|
181
|
+
```bash
|
182
|
+
# Use a specific profile
|
183
|
+
janito --profile creative "Write a poem about coding"
|
184
|
+
|
185
|
+
# View available profiles
|
186
|
+
janito --show-config
|
187
|
+
```
|
188
|
+
|
189
|
+
## 🔇 Trust Mode
|
190
|
+
|
191
|
+
Janito offers a trust mode that suppresses tool outputs for a more concise execution experience:
|
192
|
+
|
193
|
+
### How It Works
|
194
|
+
|
195
|
+
- When enabled with `--trust` or `-t`, Janito suppresses informational and success messages from tools
|
196
|
+
- Only essential output and error messages are displayed
|
197
|
+
- The final result from Claude is still shown in full
|
198
|
+
- Trust mode is a per-session setting and not saved to your configuration
|
199
|
+
|
200
|
+
### Using Trust Mode
|
201
|
+
|
202
|
+
```bash
|
203
|
+
# Enable trust mode with the full flag
|
204
|
+
janito --trust "Create a Python script that reads a CSV file"
|
205
|
+
|
206
|
+
# Or use the short alias
|
207
|
+
janito -t "Create a Python script that reads a CSV file"
|
208
|
+
```
|
209
|
+
|
210
|
+
This feature is particularly useful for:
|
211
|
+
- Experienced users who don't need to see every step of the process
|
212
|
+
- Batch processing or scripting where concise output is preferred
|
213
|
+
- Focusing on results rather than the process
|
214
|
+
- Creating cleaner output for documentation or sharing
|
215
|
+
|
216
|
+
## 💬 Conversation History
|
217
|
+
|
218
|
+
Janito automatically saves your conversation history, allowing you to continue previous discussions:
|
219
|
+
|
220
|
+
### How It Works
|
221
|
+
|
222
|
+
- Each conversation is saved with a unique message ID in `.janito/last_messages/`
|
223
|
+
- The most recent conversation is also saved as `.janito/last_message.json` for backward compatibility
|
224
|
+
- After each conversation, Janito displays the command to continue that specific conversation
|
225
|
+
|
226
|
+
### Using the Continue Feature
|
227
|
+
|
228
|
+
```bash
|
229
|
+
# Continue the most recent conversation
|
230
|
+
janito --continue "Add more details to your previous response"
|
231
|
+
|
232
|
+
# Continue a specific conversation using its ID
|
233
|
+
janito --continue abc123def "Let's modify that code you suggested"
|
234
|
+
```
|
235
|
+
|
236
|
+
The `--continue` flag (or `-c` for short) allows you to:
|
237
|
+
- Resume the most recent conversation when used without an ID
|
238
|
+
- Resume a specific conversation when provided with a message ID
|
239
|
+
- Maintain context across multiple interactions for complex tasks
|
240
|
+
|
241
|
+
This feature is particularly useful for:
|
242
|
+
- Multi-step development tasks
|
243
|
+
- Iterative code improvements
|
244
|
+
- Continuing discussions after system interruptions
|
245
|
+
- Maintaining context when working on complex problems
|
246
|
+
|
247
|
+
## ⚙️ Dependencies
|
248
|
+
|
249
|
+
Janito automatically installs the following dependencies:
|
250
|
+
- typer (>=0.9.0) - For CLI interface
|
251
|
+
- rich (>=13.0.0) - For rich text formatting
|
252
|
+
- claudine - For Claude AI integration
|
253
|
+
- Additional packages for file handling and web content extraction
|
254
|
+
|
255
|
+
## 🛠️ Command-Line Options
|
256
|
+
|
257
|
+
Janito offers a variety of command-line options to customize its behavior:
|
258
|
+
|
259
|
+
```
|
260
|
+
--verbose, -v Enable verbose mode with detailed output
|
261
|
+
--show-tokens Show detailed token usage and pricing information
|
262
|
+
--workspace, -w TEXT Set the workspace directory
|
263
|
+
--set-config TEXT Configuration string in format 'key=value', e.g., 'temperature=0.7'
|
264
|
+
--show-config Show current configuration
|
265
|
+
--reset-config Reset configuration by removing the config file
|
266
|
+
--set-api-key TEXT Set the Anthropic API key globally in the user's home directory
|
267
|
+
--ask Enable ask mode which disables tools that perform changes
|
268
|
+
--trust, -t Enable trust mode which suppresses tool outputs for concise execution
|
269
|
+
--temperature FLOAT Set the temperature for model generation (0.0 to 1.0)
|
270
|
+
--profile TEXT Use a predefined parameter profile (precise, balanced, conversational, creative, technical)
|
271
|
+
--role TEXT Set the assistant's role (default: 'software engineer')
|
272
|
+
--version Show the version and exit
|
273
|
+
--continue, -c TEXT Continue a previous conversation, optionally with a specific message ID
|
274
|
+
--help Show the help message and exit
|
275
|
+
```
|
276
|
+
|
277
|
+
## 🔑 API Key Configuration
|
278
|
+
|
279
|
+
You can configure your Anthropic API key in several ways:
|
280
|
+
|
281
|
+
```bash
|
282
|
+
# Option 1: Set as environment variable
|
283
|
+
export ANTHROPIC_API_KEY=your_api_key
|
284
|
+
|
285
|
+
# Option 2: Configure globally within Janito
|
286
|
+
janito --set-api-key your_api_key
|
287
|
+
|
288
|
+
# Option 3: Let Janito prompt you on first use
|
289
|
+
janito "Hello, I'm new to Janito!"
|
290
|
+
```
|
291
|
+
|
292
|
+
Your API key is securely stored and used for all future sessions.
|
293
|
+
|
294
|
+
## 💻 Development
|
295
|
+
|
296
|
+
For development instructions, please refer to [README_DEV.md](README_DEV.md).
|
297
|
+
|
298
|
+
## 📜 License
|
299
|
+
|
300
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
janito-0.13.0/README.md
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
# 🤖 Janito
|
2
|
+
|
3
|
+
Janito is a powerful AI-assisted command-line interface (CLI) tool built with Python, leveraging Anthropic's Claude for intelligent code and file management.
|
4
|
+
|
5
|
+
[](https://github.com/joaompinto/janito)
|
6
|
+
|
7
|
+
## ✨ Features
|
8
|
+
|
9
|
+
- 🧠 Intelligent AI assistant powered by Claude
|
10
|
+
- 📁 File management capabilities with real-time output
|
11
|
+
- 🔍 Smart code search and editing
|
12
|
+
- 💻 Interactive terminal interface with rich formatting
|
13
|
+
- 📊 Detailed token usage tracking and cost reporting with cache savings analysis
|
14
|
+
- 🛑 Token and tool usage reporting even when interrupted with Ctrl+C
|
15
|
+
- 🌐 Web page fetching with content extraction capabilities
|
16
|
+
- 🔄 Parameter profiles for optimizing Claude's behavior for different tasks
|
17
|
+
- 📋 Line delta tracking to monitor net changes in files
|
18
|
+
- 💬 Conversation history with ability to resume previous conversations
|
19
|
+
- 🔇 Trust mode for concise output without tool details
|
20
|
+
|
21
|
+
## 🛠️ System Requirements
|
22
|
+
|
23
|
+
- **Python 3.8+** - Janito requires Python 3.8 or higher
|
24
|
+
- **Operating Systems**:
|
25
|
+
- Linux/macOS: Native support
|
26
|
+
- Windows: Requires Git Bash for proper operation of CLI tools
|
27
|
+
- **Anthropic API Key** - Required for Claude AI integration
|
28
|
+
|
29
|
+
## 🛠️ Installation
|
30
|
+
|
31
|
+
```bash
|
32
|
+
# Install directly from PyPI
|
33
|
+
pip install janito
|
34
|
+
```
|
35
|
+
|
36
|
+
### Setting up your API Key
|
37
|
+
|
38
|
+
Janito requires an Anthropic API key to function. You can:
|
39
|
+
1. Set the API key: `janito --set-api-key your_api_key`
|
40
|
+
|
41
|
+
For development or installation from source, please see [README_DEV.md](README_DEV.md).
|
42
|
+
|
43
|
+
## 🚀 Usage Tutorial
|
44
|
+
|
45
|
+
After installation, you can start using Janito right away. Let's walk through a simple tutorial:
|
46
|
+
|
47
|
+
### Getting Started
|
48
|
+
|
49
|
+
First, let's check that everything is working:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
# Get help and see available commands
|
53
|
+
janito --help
|
54
|
+
```
|
55
|
+
|
56
|
+
### Tutorial: Creating a Simple Project
|
57
|
+
|
58
|
+
Let's create a simple HTML project with Janito's help:
|
59
|
+
|
60
|
+
After installing Janito, using your prefered editor and/or terminal, go to a new empty folder.
|
61
|
+
|
62
|
+
Use the janito command to create a new project.
|
63
|
+
|
64
|
+
```bash
|
65
|
+
# Step 1: Create a new project structure
|
66
|
+
janito "Create a simple HTML page with a calculator and 3 columns with text for the 3 main activities of the Kazakh culture"
|
67
|
+
```
|
68
|
+
Browse the resulting html page.
|
69
|
+
|
70
|
+
### Tutorial: Adding Features
|
71
|
+
|
72
|
+
Now, let's enhance our example
|
73
|
+
|
74
|
+
```bash
|
75
|
+
# Step 2: Add multiplication and division features
|
76
|
+
janito "Add some svg icons and remove the calculator"
|
77
|
+
|
78
|
+
```
|
79
|
+
|
80
|
+
Refresh the page
|
81
|
+
|
82
|
+
### Exploring More Features
|
83
|
+
|
84
|
+
Janito offers many more capabilities:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
# Show detailed token usage and cost information
|
88
|
+
janito --show-tokens "Explain what is in the project"
|
89
|
+
|
90
|
+
# Use a specific parameter profile for creative tasks
|
91
|
+
janito --profile creative "Write a fun description for our project"
|
92
|
+
|
93
|
+
# Use trust mode for concise output without tool details
|
94
|
+
janito --trust "Optimize the HTML code"
|
95
|
+
# Or use the short alias
|
96
|
+
janito -t "Optimize the HTML code"
|
97
|
+
|
98
|
+
# Continue the most recent conversation
|
99
|
+
janito --continue "Please add one more line"
|
100
|
+
|
101
|
+
# Continue a specific conversation using its message ID
|
102
|
+
# (Janito displays the message ID after each conversation)
|
103
|
+
janito --continue abc123def "Let's refine that code"
|
104
|
+
|
105
|
+
# Show current configuration and available profiles
|
106
|
+
janito --show-config
|
107
|
+
|
108
|
+
# You can press Ctrl+C at any time to interrupt a query
|
109
|
+
# Janito will still display token and tool usage information
|
110
|
+
# Even interrupted conversations can be continued with --continue
|
111
|
+
```
|
112
|
+
|
113
|
+
## 🔧 Available Tools
|
114
|
+
|
115
|
+
Janito comes with several built-in tools:
|
116
|
+
- 📄 `str_replace_editor` - View, create, and edit files
|
117
|
+
- 🔎 `find_files` - Find files matching patterns
|
118
|
+
- 🗑️ `delete_file` - Delete files
|
119
|
+
- 🔍 `search_text` - Search for text patterns in files
|
120
|
+
- 🌐 `fetch_webpage` - Fetch and extract content from web pages
|
121
|
+
- 📋 `move_file` - Move files from one location to another
|
122
|
+
- 💻 `bash` - Execute bash commands with real-time output display
|
123
|
+
|
124
|
+
## 📊 Usage Tracking
|
125
|
+
|
126
|
+
Janito includes a comprehensive token usage tracking system that helps you monitor API costs:
|
127
|
+
|
128
|
+
- **Basic tracking**: By default, Janito displays a summary of token usage and cost after each query
|
129
|
+
- **Detailed reporting**: Use the `--show-tokens` flag to see detailed breakdowns including:
|
130
|
+
- Input and output token counts
|
131
|
+
- Per-tool token usage statistics
|
132
|
+
- Precise cost calculations
|
133
|
+
- Cache performance metrics with savings analysis
|
134
|
+
- Line delta tracking for file modifications
|
135
|
+
|
136
|
+
```bash
|
137
|
+
# Show detailed token usage and cost information
|
138
|
+
janito --show-tokens "Write a Python function to sort a list"
|
139
|
+
|
140
|
+
# Basic usage (shows simplified token usage summary)
|
141
|
+
janito "Explain Docker containers"
|
142
|
+
|
143
|
+
# Use trust mode for concise output without tool details
|
144
|
+
janito --trust "Create a simple Python script"
|
145
|
+
# Or use the short alias
|
146
|
+
janito -t "Create a simple Python script"
|
147
|
+
```
|
148
|
+
|
149
|
+
The usage tracker automatically calculates cache savings, showing you how much you're saving by reusing previous responses.
|
150
|
+
|
151
|
+
## 📋 Parameter Profiles
|
152
|
+
|
153
|
+
Janito offers predefined parameter profiles to optimize Claude's behavior for different tasks:
|
154
|
+
|
155
|
+
- **precise**: Factual answers, documentation, structured data (temperature: 0.2)
|
156
|
+
- **balanced**: Professional writing, summarization, everyday tasks (temperature: 0.5)
|
157
|
+
- **conversational**: Natural dialogue, educational content (temperature: 0.7)
|
158
|
+
- **creative**: Storytelling, brainstorming, marketing copy (temperature: 0.9)
|
159
|
+
- **technical**: Code generation, debugging, technical problem-solving (temperature: 0.3)
|
160
|
+
|
161
|
+
```bash
|
162
|
+
# Use a specific profile
|
163
|
+
janito --profile creative "Write a poem about coding"
|
164
|
+
|
165
|
+
# View available profiles
|
166
|
+
janito --show-config
|
167
|
+
```
|
168
|
+
|
169
|
+
## 🔇 Trust Mode
|
170
|
+
|
171
|
+
Janito offers a trust mode that suppresses tool outputs for a more concise execution experience:
|
172
|
+
|
173
|
+
### How It Works
|
174
|
+
|
175
|
+
- When enabled with `--trust` or `-t`, Janito suppresses informational and success messages from tools
|
176
|
+
- Only essential output and error messages are displayed
|
177
|
+
- The final result from Claude is still shown in full
|
178
|
+
- Trust mode is a per-session setting and not saved to your configuration
|
179
|
+
|
180
|
+
### Using Trust Mode
|
181
|
+
|
182
|
+
```bash
|
183
|
+
# Enable trust mode with the full flag
|
184
|
+
janito --trust "Create a Python script that reads a CSV file"
|
185
|
+
|
186
|
+
# Or use the short alias
|
187
|
+
janito -t "Create a Python script that reads a CSV file"
|
188
|
+
```
|
189
|
+
|
190
|
+
This feature is particularly useful for:
|
191
|
+
- Experienced users who don't need to see every step of the process
|
192
|
+
- Batch processing or scripting where concise output is preferred
|
193
|
+
- Focusing on results rather than the process
|
194
|
+
- Creating cleaner output for documentation or sharing
|
195
|
+
|
196
|
+
## 💬 Conversation History
|
197
|
+
|
198
|
+
Janito automatically saves your conversation history, allowing you to continue previous discussions:
|
199
|
+
|
200
|
+
### How It Works
|
201
|
+
|
202
|
+
- Each conversation is saved with a unique message ID in `.janito/last_messages/`
|
203
|
+
- The most recent conversation is also saved as `.janito/last_message.json` for backward compatibility
|
204
|
+
- After each conversation, Janito displays the command to continue that specific conversation
|
205
|
+
|
206
|
+
### Using the Continue Feature
|
207
|
+
|
208
|
+
```bash
|
209
|
+
# Continue the most recent conversation
|
210
|
+
janito --continue "Add more details to your previous response"
|
211
|
+
|
212
|
+
# Continue a specific conversation using its ID
|
213
|
+
janito --continue abc123def "Let's modify that code you suggested"
|
214
|
+
```
|
215
|
+
|
216
|
+
The `--continue` flag (or `-c` for short) allows you to:
|
217
|
+
- Resume the most recent conversation when used without an ID
|
218
|
+
- Resume a specific conversation when provided with a message ID
|
219
|
+
- Maintain context across multiple interactions for complex tasks
|
220
|
+
|
221
|
+
This feature is particularly useful for:
|
222
|
+
- Multi-step development tasks
|
223
|
+
- Iterative code improvements
|
224
|
+
- Continuing discussions after system interruptions
|
225
|
+
- Maintaining context when working on complex problems
|
226
|
+
|
227
|
+
## ⚙️ Dependencies
|
228
|
+
|
229
|
+
Janito automatically installs the following dependencies:
|
230
|
+
- typer (>=0.9.0) - For CLI interface
|
231
|
+
- rich (>=13.0.0) - For rich text formatting
|
232
|
+
- claudine - For Claude AI integration
|
233
|
+
- Additional packages for file handling and web content extraction
|
234
|
+
|
235
|
+
## 🛠️ Command-Line Options
|
236
|
+
|
237
|
+
Janito offers a variety of command-line options to customize its behavior:
|
238
|
+
|
239
|
+
```
|
240
|
+
--verbose, -v Enable verbose mode with detailed output
|
241
|
+
--show-tokens Show detailed token usage and pricing information
|
242
|
+
--workspace, -w TEXT Set the workspace directory
|
243
|
+
--set-config TEXT Configuration string in format 'key=value', e.g., 'temperature=0.7'
|
244
|
+
--show-config Show current configuration
|
245
|
+
--reset-config Reset configuration by removing the config file
|
246
|
+
--set-api-key TEXT Set the Anthropic API key globally in the user's home directory
|
247
|
+
--ask Enable ask mode which disables tools that perform changes
|
248
|
+
--trust, -t Enable trust mode which suppresses tool outputs for concise execution
|
249
|
+
--temperature FLOAT Set the temperature for model generation (0.0 to 1.0)
|
250
|
+
--profile TEXT Use a predefined parameter profile (precise, balanced, conversational, creative, technical)
|
251
|
+
--role TEXT Set the assistant's role (default: 'software engineer')
|
252
|
+
--version Show the version and exit
|
253
|
+
--continue, -c TEXT Continue a previous conversation, optionally with a specific message ID
|
254
|
+
--help Show the help message and exit
|
255
|
+
```
|
256
|
+
|
257
|
+
## 🔑 API Key Configuration
|
258
|
+
|
259
|
+
You can configure your Anthropic API key in several ways:
|
260
|
+
|
261
|
+
```bash
|
262
|
+
# Option 1: Set as environment variable
|
263
|
+
export ANTHROPIC_API_KEY=your_api_key
|
264
|
+
|
265
|
+
# Option 2: Configure globally within Janito
|
266
|
+
janito --set-api-key your_api_key
|
267
|
+
|
268
|
+
# Option 3: Let Janito prompt you on first use
|
269
|
+
janito "Hello, I'm new to Janito!"
|
270
|
+
```
|
271
|
+
|
272
|
+
Your API key is securely stored and used for all future sessions.
|
273
|
+
|
274
|
+
## 💻 Development
|
275
|
+
|
276
|
+
For development instructions, please refer to [README_DEV.md](README_DEV.md).
|
277
|
+
|
278
|
+
## 📜 License
|
279
|
+
|
280
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"""
|
2
|
+
Callback functions for tool execution in janito.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from rich.console import Console
|
6
|
+
from rich.markdown import Markdown
|
7
|
+
|
8
|
+
from janito.config import get_config
|
9
|
+
|
10
|
+
# Counter for pre-tool callbacks
|
11
|
+
pre_tool_callbacks = 0
|
12
|
+
|
13
|
+
def text_callback(text: str) -> None:
|
14
|
+
"""
|
15
|
+
Callback function that handles text output from the agent.
|
16
|
+
|
17
|
+
Args:
|
18
|
+
text: Text output from the agent
|
19
|
+
|
20
|
+
Returns:
|
21
|
+
None
|
22
|
+
"""
|
23
|
+
console = Console()
|
24
|
+
|
25
|
+
# Add debug counter only when debug mode is enabled
|
26
|
+
if get_config().debug_mode:
|
27
|
+
if not hasattr(text_callback, "counter"):
|
28
|
+
text_callback.counter = 1
|
29
|
+
console.print(f"[bold blue]DEBUG: Text callback #{text_callback.counter}[/bold blue]")
|
30
|
+
text_callback.counter += 1
|
31
|
+
|
32
|
+
# Print the text with markdown formatting
|
33
|
+
console.print(Markdown(text, code_theme="monokai"), end="")
|
34
|
+
|