dwarp 0.1.7__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.
- dwarp-0.1.7/PKG-INFO +133 -0
- dwarp-0.1.7/README.md +108 -0
- dwarp-0.1.7/dwarp.egg-info/PKG-INFO +133 -0
- dwarp-0.1.7/dwarp.egg-info/SOURCES.txt +30 -0
- dwarp-0.1.7/dwarp.egg-info/dependency_links.txt +1 -0
- dwarp-0.1.7/dwarp.egg-info/entry_points.txt +2 -0
- dwarp-0.1.7/dwarp.egg-info/not-zip-safe +1 -0
- dwarp-0.1.7/dwarp.egg-info/requires.txt +5 -0
- dwarp-0.1.7/dwarp.egg-info/top_level.txt +1 -0
- dwarp-0.1.7/pyproject.toml +49 -0
- dwarp-0.1.7/setup.cfg +4 -0
- dwarp-0.1.7/terminal/__init__.py +1 -0
- dwarp-0.1.7/terminal/agents/__init__.py +0 -0
- dwarp-0.1.7/terminal/agents/code_agent.py +83 -0
- dwarp-0.1.7/terminal/agents/general_agent.py +69 -0
- dwarp-0.1.7/terminal/agents/shell_agent.py +61 -0
- dwarp-0.1.7/terminal/api/__init__.py +3 -0
- dwarp-0.1.7/terminal/api/gemini.py +37 -0
- dwarp-0.1.7/terminal/cli.py +198 -0
- dwarp-0.1.7/terminal/commands/__init__.py +4 -0
- dwarp-0.1.7/terminal/commands/commands.py +146 -0
- dwarp-0.1.7/terminal/commands/os_info.py +162 -0
- dwarp-0.1.7/terminal/core/__init__.py +1 -0
- dwarp-0.1.7/terminal/core/agent.py +22 -0
- dwarp-0.1.7/terminal/core/executor.py +36 -0
- dwarp-0.1.7/terminal/core/router.py +59 -0
- dwarp-0.1.7/terminal/safety/__init__.py +3 -0
- dwarp-0.1.7/terminal/safety/safety.py +175 -0
- dwarp-0.1.7/terminal/utils/__init__.py +0 -0
- dwarp-0.1.7/terminal/utils/config.py +81 -0
- dwarp-0.1.7/terminal/utils/loading.py +87 -0
- dwarp-0.1.7/terminal/utils/parsers.py +64 -0
dwarp-0.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dwarp
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Terminal assistant built as an open source minimal alternative to Warp
|
|
5
|
+
Author-email: Abhinav <abhinavkumarsingh2023@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Abhinavexists/dwarp
|
|
8
|
+
Project-URL: Repository, https://github.com/Abhinavexists/dwarp.git
|
|
9
|
+
Project-URL: Issues, https://github.com/Abhinavexists/dwarp/issues
|
|
10
|
+
Keywords: terminal,ai,shell,assistant,cli,gemini
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: System :: Shells
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: prompt-toolkit==3.0.51
|
|
21
|
+
Requires-Dist: rich==14.1.0
|
|
22
|
+
Requires-Dist: pydantic==2.11.7
|
|
23
|
+
Requires-Dist: python-dotenv==1.1.1
|
|
24
|
+
Requires-Dist: google-genai==1.31.0
|
|
25
|
+
|
|
26
|
+
# Dwarp
|
|
27
|
+
|
|
28
|
+
[](https://opensource.org/licenses/MIT)
|
|
29
|
+
[](https://www.python.org/downloads/)
|
|
30
|
+
[](https://github.com/your-username/ai-enabled-terminal)
|
|
31
|
+
|
|
32
|
+
Terminal assistant built as an open source minimal alternative to Warp.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
- Python 3.12 or higher
|
|
39
|
+
- Linux operating system (Ubuntu, Arch, Fedora, CentOS, openSUSE, Debian supported) (Windows and MacOS will be supproted later on)
|
|
40
|
+
- Google Gemini API key ([Get one here](https://aistudio.google.com/app/apikey))
|
|
41
|
+
|
|
42
|
+
### Installation
|
|
43
|
+
|
|
44
|
+
#### Option 1: Binary Release (Recommended)
|
|
45
|
+
|
|
46
|
+
1. Download the latest release from [Releases](https://github.com/Abhinavexists/dwarp/releases)
|
|
47
|
+
2. Extract and install:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
tar -xzf dwarp-linux.tar.gz
|
|
51
|
+
cd dwarp-linux
|
|
52
|
+
sudo ./install.sh
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Launch the terminal:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
dwarp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
4. Enter your Gemini API key when prompted
|
|
62
|
+
|
|
63
|
+
#### Option 2: From Source
|
|
64
|
+
|
|
65
|
+
1. Clone the repository:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/Abhinavexists/dwarp.git
|
|
69
|
+
cd dwarp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Create and activate virtual environment:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m venv .venv
|
|
76
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Install dependencies:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install -r requirements.txt
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. Set up your API key:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
5. Run the application:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
python -m terminal.cli
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Usage Examples
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Natural language commands
|
|
101
|
+
> install docker
|
|
102
|
+
Command: sudo pacman -S docker
|
|
103
|
+
Explanation: Installs Docker using the system package manager
|
|
104
|
+
|
|
105
|
+
> find all python files in current directory
|
|
106
|
+
Command: find . -name "*.py" -type f
|
|
107
|
+
Explanation: Searches for all Python files in the current directory and subdirectories
|
|
108
|
+
|
|
109
|
+
> compress folder into zip
|
|
110
|
+
Command: zip -r archive.zip folder_name
|
|
111
|
+
Explanation: Creates a ZIP archive of the specified folder
|
|
112
|
+
|
|
113
|
+
> show disk usage sorted by size
|
|
114
|
+
Command: du -sh * | sort -hr
|
|
115
|
+
Explanation: Shows disk usage of all items in current directory, sorted by size
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Contributing
|
|
119
|
+
|
|
120
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
121
|
+
|
|
122
|
+
## Pending stuff
|
|
123
|
+
|
|
124
|
+
- [ ] Support for Windows and macOS
|
|
125
|
+
- [ ] Custom command templates and aliases
|
|
126
|
+
- [ ] Plugin system for extending functionality
|
|
127
|
+
- [ ] Command explanation and learning mode
|
|
128
|
+
- [ ] Integration with popular development tools
|
|
129
|
+
- [ ] Multi-language support
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
dwarp-0.1.7/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Dwarp
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/your-username/ai-enabled-terminal)
|
|
6
|
+
|
|
7
|
+
Terminal assistant built as an open source minimal alternative to Warp.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- Python 3.12 or higher
|
|
14
|
+
- Linux operating system (Ubuntu, Arch, Fedora, CentOS, openSUSE, Debian supported) (Windows and MacOS will be supproted later on)
|
|
15
|
+
- Google Gemini API key ([Get one here](https://aistudio.google.com/app/apikey))
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
#### Option 1: Binary Release (Recommended)
|
|
20
|
+
|
|
21
|
+
1. Download the latest release from [Releases](https://github.com/Abhinavexists/dwarp/releases)
|
|
22
|
+
2. Extract and install:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
tar -xzf dwarp-linux.tar.gz
|
|
26
|
+
cd dwarp-linux
|
|
27
|
+
sudo ./install.sh
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. Launch the terminal:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
dwarp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. Enter your Gemini API key when prompted
|
|
37
|
+
|
|
38
|
+
#### Option 2: From Source
|
|
39
|
+
|
|
40
|
+
1. Clone the repository:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/Abhinavexists/dwarp.git
|
|
44
|
+
cd dwarp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Create and activate virtual environment:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m venv .venv
|
|
51
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. Install dependencies:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install -r requirements.txt
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
4. Set up your API key:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. Run the application:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m terminal.cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage Examples
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Natural language commands
|
|
76
|
+
> install docker
|
|
77
|
+
Command: sudo pacman -S docker
|
|
78
|
+
Explanation: Installs Docker using the system package manager
|
|
79
|
+
|
|
80
|
+
> find all python files in current directory
|
|
81
|
+
Command: find . -name "*.py" -type f
|
|
82
|
+
Explanation: Searches for all Python files in the current directory and subdirectories
|
|
83
|
+
|
|
84
|
+
> compress folder into zip
|
|
85
|
+
Command: zip -r archive.zip folder_name
|
|
86
|
+
Explanation: Creates a ZIP archive of the specified folder
|
|
87
|
+
|
|
88
|
+
> show disk usage sorted by size
|
|
89
|
+
Command: du -sh * | sort -hr
|
|
90
|
+
Explanation: Shows disk usage of all items in current directory, sorted by size
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Contributing
|
|
94
|
+
|
|
95
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
96
|
+
|
|
97
|
+
## Pending stuff
|
|
98
|
+
|
|
99
|
+
- [ ] Support for Windows and macOS
|
|
100
|
+
- [ ] Custom command templates and aliases
|
|
101
|
+
- [ ] Plugin system for extending functionality
|
|
102
|
+
- [ ] Command explanation and learning mode
|
|
103
|
+
- [ ] Integration with popular development tools
|
|
104
|
+
- [ ] Multi-language support
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dwarp
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Terminal assistant built as an open source minimal alternative to Warp
|
|
5
|
+
Author-email: Abhinav <abhinavkumarsingh2023@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Abhinavexists/dwarp
|
|
8
|
+
Project-URL: Repository, https://github.com/Abhinavexists/dwarp.git
|
|
9
|
+
Project-URL: Issues, https://github.com/Abhinavexists/dwarp/issues
|
|
10
|
+
Keywords: terminal,ai,shell,assistant,cli,gemini
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: System :: Shells
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: prompt-toolkit==3.0.51
|
|
21
|
+
Requires-Dist: rich==14.1.0
|
|
22
|
+
Requires-Dist: pydantic==2.11.7
|
|
23
|
+
Requires-Dist: python-dotenv==1.1.1
|
|
24
|
+
Requires-Dist: google-genai==1.31.0
|
|
25
|
+
|
|
26
|
+
# Dwarp
|
|
27
|
+
|
|
28
|
+
[](https://opensource.org/licenses/MIT)
|
|
29
|
+
[](https://www.python.org/downloads/)
|
|
30
|
+
[](https://github.com/your-username/ai-enabled-terminal)
|
|
31
|
+
|
|
32
|
+
Terminal assistant built as an open source minimal alternative to Warp.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
- Python 3.12 or higher
|
|
39
|
+
- Linux operating system (Ubuntu, Arch, Fedora, CentOS, openSUSE, Debian supported) (Windows and MacOS will be supproted later on)
|
|
40
|
+
- Google Gemini API key ([Get one here](https://aistudio.google.com/app/apikey))
|
|
41
|
+
|
|
42
|
+
### Installation
|
|
43
|
+
|
|
44
|
+
#### Option 1: Binary Release (Recommended)
|
|
45
|
+
|
|
46
|
+
1. Download the latest release from [Releases](https://github.com/Abhinavexists/dwarp/releases)
|
|
47
|
+
2. Extract and install:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
tar -xzf dwarp-linux.tar.gz
|
|
51
|
+
cd dwarp-linux
|
|
52
|
+
sudo ./install.sh
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Launch the terminal:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
dwarp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
4. Enter your Gemini API key when prompted
|
|
62
|
+
|
|
63
|
+
#### Option 2: From Source
|
|
64
|
+
|
|
65
|
+
1. Clone the repository:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/Abhinavexists/dwarp.git
|
|
69
|
+
cd dwarp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Create and activate virtual environment:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m venv .venv
|
|
76
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Install dependencies:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install -r requirements.txt
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. Set up your API key:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
5. Run the application:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
python -m terminal.cli
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Usage Examples
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Natural language commands
|
|
101
|
+
> install docker
|
|
102
|
+
Command: sudo pacman -S docker
|
|
103
|
+
Explanation: Installs Docker using the system package manager
|
|
104
|
+
|
|
105
|
+
> find all python files in current directory
|
|
106
|
+
Command: find . -name "*.py" -type f
|
|
107
|
+
Explanation: Searches for all Python files in the current directory and subdirectories
|
|
108
|
+
|
|
109
|
+
> compress folder into zip
|
|
110
|
+
Command: zip -r archive.zip folder_name
|
|
111
|
+
Explanation: Creates a ZIP archive of the specified folder
|
|
112
|
+
|
|
113
|
+
> show disk usage sorted by size
|
|
114
|
+
Command: du -sh * | sort -hr
|
|
115
|
+
Explanation: Shows disk usage of all items in current directory, sorted by size
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Contributing
|
|
119
|
+
|
|
120
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
121
|
+
|
|
122
|
+
## Pending stuff
|
|
123
|
+
|
|
124
|
+
- [ ] Support for Windows and macOS
|
|
125
|
+
- [ ] Custom command templates and aliases
|
|
126
|
+
- [ ] Plugin system for extending functionality
|
|
127
|
+
- [ ] Command explanation and learning mode
|
|
128
|
+
- [ ] Integration with popular development tools
|
|
129
|
+
- [ ] Multi-language support
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
dwarp.egg-info/PKG-INFO
|
|
4
|
+
dwarp.egg-info/SOURCES.txt
|
|
5
|
+
dwarp.egg-info/dependency_links.txt
|
|
6
|
+
dwarp.egg-info/entry_points.txt
|
|
7
|
+
dwarp.egg-info/not-zip-safe
|
|
8
|
+
dwarp.egg-info/requires.txt
|
|
9
|
+
dwarp.egg-info/top_level.txt
|
|
10
|
+
terminal/__init__.py
|
|
11
|
+
terminal/cli.py
|
|
12
|
+
terminal/agents/__init__.py
|
|
13
|
+
terminal/agents/code_agent.py
|
|
14
|
+
terminal/agents/general_agent.py
|
|
15
|
+
terminal/agents/shell_agent.py
|
|
16
|
+
terminal/api/__init__.py
|
|
17
|
+
terminal/api/gemini.py
|
|
18
|
+
terminal/commands/__init__.py
|
|
19
|
+
terminal/commands/commands.py
|
|
20
|
+
terminal/commands/os_info.py
|
|
21
|
+
terminal/core/__init__.py
|
|
22
|
+
terminal/core/agent.py
|
|
23
|
+
terminal/core/executor.py
|
|
24
|
+
terminal/core/router.py
|
|
25
|
+
terminal/safety/__init__.py
|
|
26
|
+
terminal/safety/safety.py
|
|
27
|
+
terminal/utils/__init__.py
|
|
28
|
+
terminal/utils/config.py
|
|
29
|
+
terminal/utils/loading.py
|
|
30
|
+
terminal/utils/parsers.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
terminal
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dwarp"
|
|
7
|
+
version = "0.1.7"
|
|
8
|
+
description = "Terminal assistant built as an open source minimal alternative to Warp"
|
|
9
|
+
authors = [{name = "Abhinav", email = "abhinavkumarsingh2023@gmail.com"}]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Operating System :: POSIX :: Linux",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Topic :: System :: Shells",
|
|
20
|
+
"Topic :: Utilities",
|
|
21
|
+
]
|
|
22
|
+
keywords = ["terminal", "ai", "shell", "assistant", "cli", "gemini"]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"prompt-toolkit==3.0.51",
|
|
25
|
+
"rich==14.1.0",
|
|
26
|
+
"pydantic==2.11.7",
|
|
27
|
+
"python-dotenv==1.1.1",
|
|
28
|
+
"google-genai==1.31.0"
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
dwarp = "terminal.cli:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/Abhinavexists/dwarp"
|
|
36
|
+
Repository = "https://github.com/Abhinavexists/dwarp.git"
|
|
37
|
+
Issues = "https://github.com/Abhinavexists/dwarp/issues"
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["."]
|
|
41
|
+
include = ["terminal*"]
|
|
42
|
+
exclude = ["release*", "scripts*", "ai-terminal-linux*"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
terminal = ["*.py"]
|
|
46
|
+
|
|
47
|
+
[tool.setuptools]
|
|
48
|
+
zip-safe = false
|
|
49
|
+
|
dwarp-0.1.7/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.6"
|
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from terminal.api import client, generate_config
|
|
2
|
+
from terminal.core.executor import GeneralResponse, ResponseType
|
|
3
|
+
from terminal.utils.parsers import parse_json, parse_response_parts, handle_function_call
|
|
4
|
+
from terminal.utils.config import config
|
|
5
|
+
|
|
6
|
+
def prompt_code():
|
|
7
|
+
return """You are a specialized coding assistant. Your job is to help users with code generation, programming questions, and technical implementations.
|
|
8
|
+
|
|
9
|
+
IMPORTANT: Keep your response concise and within token limits. Focus on the most essential code and explanations.
|
|
10
|
+
|
|
11
|
+
Output a JSON object with the following structure:
|
|
12
|
+
|
|
13
|
+
{{
|
|
14
|
+
"content": "<your response with code examples and explanations>",
|
|
15
|
+
"response_type": "code_generation",
|
|
16
|
+
"action_required": false,
|
|
17
|
+
"suggested_command": null
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
Instructions:
|
|
21
|
+
- Provide clear, well-commented code examples
|
|
22
|
+
- Keep explanations brief but informative
|
|
23
|
+
- Include essential best practices only
|
|
24
|
+
- If the code can be executed as a script, set action_required to true and provide suggested_command
|
|
25
|
+
- Use appropriate programming languages based on the request
|
|
26
|
+
- Include basic error handling where relevant
|
|
27
|
+
- If the response is getting long, prioritize the core code over extensive explanations
|
|
28
|
+
|
|
29
|
+
CRITICAL: Your response must be ONLY the JSON object, with no extra text, markdown formatting, or code blocks outside the JSON."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def process_code_request(user_input: str, context: str = "") -> GeneralResponse:
|
|
33
|
+
prompt = prompt_code()
|
|
34
|
+
if context:
|
|
35
|
+
prompt += f"\n\nAdditional Context: {context}"
|
|
36
|
+
|
|
37
|
+
model_config = config.get_model_config()
|
|
38
|
+
response = client.models.generate_content(
|
|
39
|
+
contents=f"{prompt}\n\nUser request: {user_input}",
|
|
40
|
+
model=model_config["model"],
|
|
41
|
+
config=generate_config,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if response.candidates and hasattr(response.candidates[0], "content") and response.candidates[0].content and hasattr(response.candidates[0].content, "parts") and response.candidates[0].content.parts:
|
|
45
|
+
for part in response.candidates[0].content.parts:
|
|
46
|
+
func_response = handle_function_call(part, ResponseType.CODE_GENERATION)
|
|
47
|
+
if func_response:
|
|
48
|
+
return GeneralResponse(**func_response)
|
|
49
|
+
|
|
50
|
+
data = parse_response_parts(response.candidates[0].content.parts)
|
|
51
|
+
if data and "content" in data:
|
|
52
|
+
return GeneralResponse(**data)
|
|
53
|
+
|
|
54
|
+
for part in response.candidates[0].content.parts:
|
|
55
|
+
if hasattr(part, "text") and part.text:
|
|
56
|
+
data = parse_json(part.text)
|
|
57
|
+
if data and "content" in data:
|
|
58
|
+
return GeneralResponse(**data)
|
|
59
|
+
|
|
60
|
+
raw_text = part.text.strip()
|
|
61
|
+
if raw_text and len(raw_text) > 10:
|
|
62
|
+
cleaned_text = raw_text
|
|
63
|
+
if cleaned_text.startswith('```'):
|
|
64
|
+
lines = cleaned_text.split('\n')
|
|
65
|
+
if lines[0].startswith('```'):
|
|
66
|
+
lines = lines[1:]
|
|
67
|
+
if lines and lines[-1].strip() == '```':
|
|
68
|
+
lines = lines[:-1]
|
|
69
|
+
cleaned_text = '\n'.join(lines)
|
|
70
|
+
|
|
71
|
+
return GeneralResponse(
|
|
72
|
+
content=cleaned_text,
|
|
73
|
+
response_type=ResponseType.CODE_GENERATION,
|
|
74
|
+
action_required=False,
|
|
75
|
+
suggested_command=None
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return GeneralResponse(
|
|
79
|
+
content=f"I apologize, but I encountered an issue generating a proper response for your request: '{user_input}'. The response may have been truncated due to length limits. Please try rephrasing your request or breaking it into smaller parts.",
|
|
80
|
+
response_type=ResponseType.CODE_GENERATION,
|
|
81
|
+
action_required=False,
|
|
82
|
+
suggested_command=None
|
|
83
|
+
)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from terminal.api import client, generate_config
|
|
2
|
+
from terminal.core.executor import GeneralResponse
|
|
3
|
+
from terminal.utils.parsers import parse_json, parse_response_parts
|
|
4
|
+
from terminal.utils.config import config
|
|
5
|
+
|
|
6
|
+
def prompt_general():
|
|
7
|
+
return """You are a helpful AI assistant specializing in general knowledge, explanations, and informational responses.
|
|
8
|
+
|
|
9
|
+
IMPORTANT: Keep your response concise and within token limits. Focus on the most essential information.
|
|
10
|
+
|
|
11
|
+
Output a JSON object with the following structure:
|
|
12
|
+
|
|
13
|
+
{{
|
|
14
|
+
"content": "<your helpful response>",
|
|
15
|
+
"response_type": "general_query",
|
|
16
|
+
"action_required": false,
|
|
17
|
+
"suggested_command": null
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
Instructions:
|
|
21
|
+
- Provide clear, accurate, and concise information
|
|
22
|
+
- Use examples and analogies to make complex topics understandable
|
|
23
|
+
- If the user asks about something that could be done with a shell command, set action_required to true and provide suggested_command
|
|
24
|
+
- Be conversational but informative
|
|
25
|
+
- Keep responses focused and to the point
|
|
26
|
+
- If the response is getting long, prioritize the most important information
|
|
27
|
+
|
|
28
|
+
CRITICAL: Your response must be ONLY the JSON object, with no extra text, markdown formatting, or code blocks outside the JSON."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def process_general_request(user_input: str, context: str = "") -> GeneralResponse:
|
|
33
|
+
prompt = prompt_general()
|
|
34
|
+
if context:
|
|
35
|
+
prompt += f"\n\nAdditional Context: {context}"
|
|
36
|
+
|
|
37
|
+
model_config = config.get_model_config()
|
|
38
|
+
response = client.models.generate_content(
|
|
39
|
+
contents=f"{prompt}\n\nUser request: {user_input}",
|
|
40
|
+
model=model_config["model"],
|
|
41
|
+
config=generate_config,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if response.candidates and hasattr(response.candidates[0], "content") and response.candidates[0].content and hasattr(response.candidates[0].content, "parts") and response.candidates[0].content.parts:
|
|
45
|
+
data = parse_response_parts(response.candidates[0].content.parts)
|
|
46
|
+
if data and "content" in data:
|
|
47
|
+
return GeneralResponse(**data)
|
|
48
|
+
|
|
49
|
+
for part in response.candidates[0].content.parts:
|
|
50
|
+
if hasattr(part, "text") and part.text:
|
|
51
|
+
data = parse_json(part.text)
|
|
52
|
+
if data and "content" in data:
|
|
53
|
+
return GeneralResponse(**data)
|
|
54
|
+
|
|
55
|
+
raw_text = part.text.strip()
|
|
56
|
+
if raw_text and len(raw_text) > 10:
|
|
57
|
+
return GeneralResponse(
|
|
58
|
+
content=raw_text,
|
|
59
|
+
response_type="general_query",
|
|
60
|
+
action_required=False,
|
|
61
|
+
suggested_command=None
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return GeneralResponse(
|
|
65
|
+
content=f"I apologize, but I encountered an issue generating a proper response for your request: '{user_input}'. Please try rephrasing your question or breaking it into smaller parts.",
|
|
66
|
+
response_type="general_query",
|
|
67
|
+
action_required=False,
|
|
68
|
+
suggested_command=None
|
|
69
|
+
)
|