gitarsenal-cli 1.9.106 โ 1.9.108
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/.venv_status.json +1 -1
- package/README-TYPING.md +91 -0
- package/START-HERE.md +230 -0
- package/bin/gitarsenal-tui.js +147 -0
- package/bin/gitarsenal.js +58 -15
- package/launch-tui.sh +18 -0
- package/package.json +9 -3
- package/scripts/ensure-dependencies.sh +46 -0
- package/scripts/postinstall.js +22 -7
- package/tui/App.jsx +326 -0
- package/tui/index.js +37 -0
- package/tui/simple-test.js +41 -0
- package/tui-app/bun.lock +200 -0
- package/tui-app/index-manual.js.bak +609 -0
- package/tui-app/index.jsx +848 -0
- package/tui-app/package-lock.json +1720 -0
- package/tui-app/package.json +16 -0
package/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-
|
|
1
|
+
{"created":"2025-10-15T13:20:17.803Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/README-TYPING.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# โ
Typing Now Works!
|
|
2
|
+
|
|
3
|
+
## What Was Fixed
|
|
4
|
+
|
|
5
|
+
**Problem:** Couldn't type when entering repository URL
|
|
6
|
+
**Solution:** Added proper text input mode with character handling
|
|
7
|
+
|
|
8
|
+
## ๐ฎ How to Use
|
|
9
|
+
|
|
10
|
+
### 1. Launch TUI
|
|
11
|
+
```bash
|
|
12
|
+
./launch-tui.sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Navigate Menu
|
|
16
|
+
- Use **โโ** to select "๐ Create New Sandbox"
|
|
17
|
+
- Press **Enter**
|
|
18
|
+
|
|
19
|
+
### 3. Type Repository URL
|
|
20
|
+
You can now **type freely**:
|
|
21
|
+
- Type any character (a-z, 0-9, symbols)
|
|
22
|
+
- **Backspace** to delete
|
|
23
|
+
- **Enter** to submit
|
|
24
|
+
- **Esc** to go back to menu
|
|
25
|
+
|
|
26
|
+
### 4. See Your Input
|
|
27
|
+
Your text appears with a cursor: `https://github.com/pytorch/examplesโ`
|
|
28
|
+
|
|
29
|
+
## โ
What Works Now
|
|
30
|
+
|
|
31
|
+
- โ
Menu navigation (โโ)
|
|
32
|
+
- โ
Enter to select
|
|
33
|
+
- โ
**Type repository URLs** โญ NEW!
|
|
34
|
+
- โ
Backspace to delete
|
|
35
|
+
- โ
Enter to submit
|
|
36
|
+
- โ
Esc to go back
|
|
37
|
+
- โ
Visual cursor
|
|
38
|
+
- โ
Screen transitions
|
|
39
|
+
|
|
40
|
+
## ๐ฏ Full Workflow
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Main Menu
|
|
44
|
+
โ (select "Create New Sandbox")
|
|
45
|
+
Repository Input Screen โ YOU CAN TYPE HERE!
|
|
46
|
+
โ (type URL and press Enter)
|
|
47
|
+
Success Screen
|
|
48
|
+
โ (press any key)
|
|
49
|
+
Back to Menu
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## ๐ Example Session
|
|
53
|
+
|
|
54
|
+
1. **Launch:** `./launch-tui.sh`
|
|
55
|
+
2. **Select:** Arrow down to "๐ Create New Sandbox"
|
|
56
|
+
3. **Enter:** Press Enter
|
|
57
|
+
4. **Type:** `https://github.com/pytorch/examples`
|
|
58
|
+
5. **Submit:** Press Enter
|
|
59
|
+
6. **See result:** Shows what you entered
|
|
60
|
+
7. **Return:** Press any key to go back
|
|
61
|
+
|
|
62
|
+
## ๐ง Technical Details
|
|
63
|
+
|
|
64
|
+
**What Changed:**
|
|
65
|
+
- Added `currentScreen` state management
|
|
66
|
+
- Added `inputText` variable to store input
|
|
67
|
+
- Added character-by-character input handling
|
|
68
|
+
- Added backspace support
|
|
69
|
+
- Added visual cursor (inverted space)
|
|
70
|
+
- Added screen transitions
|
|
71
|
+
|
|
72
|
+
**Input Handling:**
|
|
73
|
+
```javascript
|
|
74
|
+
if (key.charCodeAt(0) >= 32 && key.charCodeAt(0) <= 126) {
|
|
75
|
+
inputText += key; // Add character
|
|
76
|
+
renderRepoInput(); // Re-render with new text
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## โ
Try It Now!
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
./launch-tui.sh
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Navigate to "Create New Sandbox" and start typing! ๐
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
**You can now type in the TUI!** ๐จโจ๏ธ
|
|
91
|
+
|
package/START-HERE.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# ๐จ GitArsenal OpenTUI - Start Here
|
|
2
|
+
|
|
3
|
+
## โ
Everything is Fixed and Ready!
|
|
4
|
+
|
|
5
|
+
### ๐ Launch the TUI Right Now
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd /Users/rohansharma/RepoStarter/gitarsenal-cli
|
|
9
|
+
./launch-tui.sh
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
That's it! The beautiful OpenTUI interface will start.
|
|
13
|
+
|
|
14
|
+
## ๐ฎ What You Can Do
|
|
15
|
+
|
|
16
|
+
1. **Navigate** - Use โโ arrow keys
|
|
17
|
+
2. **Select** - Press Enter
|
|
18
|
+
3. **Go Back** - Press Esc
|
|
19
|
+
4. **Exit** - Press Ctrl+C
|
|
20
|
+
|
|
21
|
+
## ๐ Current Features
|
|
22
|
+
|
|
23
|
+
โ
Main menu with 6 options
|
|
24
|
+
โ
Repository input screen
|
|
25
|
+
โ
Beautiful terminal styling
|
|
26
|
+
โ
Keyboard navigation
|
|
27
|
+
โ
React-based components
|
|
28
|
+
|
|
29
|
+
## ๐ The Issue That Was Fixed
|
|
30
|
+
|
|
31
|
+
**Problem:** `SyntaxError: Unexpected token '<'`
|
|
32
|
+
|
|
33
|
+
**Root Cause:** Node.js doesn't understand JSX by default
|
|
34
|
+
|
|
35
|
+
**Solution:**
|
|
36
|
+
1. Installed `tsx` - transpiles JSX on-the-fly
|
|
37
|
+
2. Renamed `index.js` โ `index.jsx`
|
|
38
|
+
3. Updated launcher to use `tsx` instead of `node`
|
|
39
|
+
|
|
40
|
+
## ๐ Project Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
gitarsenal-cli/
|
|
44
|
+
โโโ ๐ tui-app/ # OpenTUI Application
|
|
45
|
+
โ โโโ index.jsx # โ
Main TUI file (JSX)
|
|
46
|
+
โ โโโ package.json # Dependencies
|
|
47
|
+
โ โโโ node_modules/ # tsx, OpenTUI, React 19
|
|
48
|
+
โ
|
|
49
|
+
โโโ ๐ launch-tui.sh # Easy launcher
|
|
50
|
+
โโโ ๐ TUI-FIXED.md # Technical details
|
|
51
|
+
โโโ ๐ START-HERE.md # This file
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## ๐ง How It Works
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
./launch-tui.sh
|
|
58
|
+
โ
|
|
59
|
+
cd tui-app
|
|
60
|
+
โ
|
|
61
|
+
npx tsx index.jsx
|
|
62
|
+
โ
|
|
63
|
+
tsx transpiles JSX โ JavaScript
|
|
64
|
+
โ
|
|
65
|
+
OpenTUI renders beautiful TUI
|
|
66
|
+
โ
|
|
67
|
+
You see the interface! ๐
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## ๐จ What It Looks Like
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
74
|
+
โ ๐จ GitArsenal TUI - Powered by OpenTUI โ
|
|
75
|
+
โ Beautiful Terminal Interface for GPU-Accelerated Sandboxes โ
|
|
76
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
77
|
+
|
|
78
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
79
|
+
โ ๐ฏ GitArsenal - GPU-Accelerated Repository Sandbox โ
|
|
80
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
81
|
+
|
|
82
|
+
Secure, cloud-based development environments with GPU acceleration
|
|
83
|
+
|
|
84
|
+
โฏ ๐ Create New Sandbox
|
|
85
|
+
๐ Browse Repositories
|
|
86
|
+
๐ API Keys Management
|
|
87
|
+
โ๏ธ Settings
|
|
88
|
+
โ Help & Examples
|
|
89
|
+
๐ช Exit
|
|
90
|
+
|
|
91
|
+
Use โโ arrows to navigate, Enter to select, Ctrl+C to exit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## ๐งช Try It Now
|
|
95
|
+
|
|
96
|
+
### 1. Launch
|
|
97
|
+
```bash
|
|
98
|
+
./launch-tui.sh
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2. Navigate
|
|
102
|
+
Use arrow keys to move through the menu
|
|
103
|
+
|
|
104
|
+
### 3. Select "Create New Sandbox"
|
|
105
|
+
Press Enter
|
|
106
|
+
|
|
107
|
+
### 4. Enter a Repository
|
|
108
|
+
Type: `https://github.com/pytorch/examples`
|
|
109
|
+
|
|
110
|
+
### 5. See It Work!
|
|
111
|
+
The TUI will show your input
|
|
112
|
+
|
|
113
|
+
## ๐ Two Interfaces Available
|
|
114
|
+
|
|
115
|
+
### Option 1: OpenTUI (NEW! โจ)
|
|
116
|
+
```bash
|
|
117
|
+
./launch-tui.sh
|
|
118
|
+
```
|
|
119
|
+
- Beautiful visual interface
|
|
120
|
+
- Arrow key navigation
|
|
121
|
+
- Modern React-based UI
|
|
122
|
+
|
|
123
|
+
### Option 2: Classic CLI
|
|
124
|
+
```bash
|
|
125
|
+
node bin/gitarsenal.js
|
|
126
|
+
```
|
|
127
|
+
- Traditional command-line
|
|
128
|
+
- Text-based prompts
|
|
129
|
+
- Fully functional
|
|
130
|
+
|
|
131
|
+
**Both use the same backend!**
|
|
132
|
+
|
|
133
|
+
## ๐ฆ What's Installed
|
|
134
|
+
|
|
135
|
+
In `tui-app/node_modules/`:
|
|
136
|
+
- **@opentui/core** - TUI framework
|
|
137
|
+
- **@opentui/react** - React reconciler
|
|
138
|
+
- **react** 19.0.0 - Required by OpenTUI
|
|
139
|
+
- **tsx** - JSX/TypeScript transpiler
|
|
140
|
+
- **esbuild** - Fast bundler (used by tsx)
|
|
141
|
+
|
|
142
|
+
## ๐ง What's Next
|
|
143
|
+
|
|
144
|
+
The foundation is complete! To finish the full workflow:
|
|
145
|
+
|
|
146
|
+
1. **GPU Selection Screen** - Choose GPU type
|
|
147
|
+
2. **Provider Selection** - Modal vs E2B
|
|
148
|
+
3. **Configuration Summary** - Review before creating
|
|
149
|
+
4. **Integration** - Connect to sandbox creation
|
|
150
|
+
5. **Progress Indicators** - Show creation progress
|
|
151
|
+
|
|
152
|
+
## ๐ก Key Files
|
|
153
|
+
|
|
154
|
+
| File | Purpose |
|
|
155
|
+
|------|---------|
|
|
156
|
+
| `tui-app/index.jsx` | Main TUI application |
|
|
157
|
+
| `launch-tui.sh` | Launcher script |
|
|
158
|
+
| `tui-app/package.json` | Dependencies |
|
|
159
|
+
| `START-HERE.md` | This guide |
|
|
160
|
+
| `TUI-FIXED.md` | Technical details |
|
|
161
|
+
|
|
162
|
+
## ๐ Troubleshooting
|
|
163
|
+
|
|
164
|
+
### TUI won't start
|
|
165
|
+
```bash
|
|
166
|
+
cd tui-app
|
|
167
|
+
npm install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Old error still showing
|
|
171
|
+
```bash
|
|
172
|
+
cd tui-app
|
|
173
|
+
rm -rf node_modules
|
|
174
|
+
npm install
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Check if tsx works
|
|
178
|
+
```bash
|
|
179
|
+
cd tui-app
|
|
180
|
+
npx tsx --version
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Should show: `tsx v4.x.x`
|
|
184
|
+
|
|
185
|
+
## โ
Verification Checklist
|
|
186
|
+
|
|
187
|
+
- [x] tsx installed
|
|
188
|
+
- [x] File renamed to .jsx
|
|
189
|
+
- [x] Scripts updated
|
|
190
|
+
- [x] Launcher updated
|
|
191
|
+
- [x] Dependencies installed
|
|
192
|
+
- [x] Ready to run!
|
|
193
|
+
|
|
194
|
+
## ๐ Success!
|
|
195
|
+
|
|
196
|
+
You now have:
|
|
197
|
+
- โ
Working OpenTUI interface
|
|
198
|
+
- โ
Beautiful terminal UI
|
|
199
|
+
- โ
JSX support via tsx
|
|
200
|
+
- โ
React 19 components
|
|
201
|
+
- โ
Easy launcher script
|
|
202
|
+
- โ
Both CLI and TUI options
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## ๐ Quick Commands
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Launch TUI
|
|
210
|
+
./launch-tui.sh
|
|
211
|
+
|
|
212
|
+
# Launch Classic CLI
|
|
213
|
+
node bin/gitarsenal.js
|
|
214
|
+
|
|
215
|
+
# Go to TUI directory
|
|
216
|
+
cd tui-app
|
|
217
|
+
|
|
218
|
+
# Run directly
|
|
219
|
+
npx tsx index.jsx
|
|
220
|
+
|
|
221
|
+
# Install deps
|
|
222
|
+
npm install
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
**๐จ Enjoy your beautiful new TUI!**
|
|
228
|
+
|
|
229
|
+
Try it now: `./launch-tui.sh`
|
|
230
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const { launchTUI } = require('../tui/index');
|
|
7
|
+
const { runContainer } = require('../lib/sandbox');
|
|
8
|
+
const { checkDependencies, checkDependenciesExceptE2B } = require('../lib/dependencies');
|
|
9
|
+
const boxen = require('boxen');
|
|
10
|
+
|
|
11
|
+
// Function to activate virtual environment (same as main CLI)
|
|
12
|
+
function activateVirtualEnvironment() {
|
|
13
|
+
const isWindows = process.platform === 'win32';
|
|
14
|
+
const venvPath = path.join(__dirname, '..', '.venv');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(venvPath)) {
|
|
17
|
+
console.log(chalk.red('โ Virtual environment not found. Please reinstall the package.'));
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const uvPythonPath = path.join(venvPath, 'bin', 'python');
|
|
22
|
+
const traditionalPythonPath = isWindows ?
|
|
23
|
+
path.join(venvPath, 'Scripts', 'python.exe') :
|
|
24
|
+
path.join(venvPath, 'bin', 'python');
|
|
25
|
+
|
|
26
|
+
let pythonPath;
|
|
27
|
+
if (fs.existsSync(uvPythonPath)) {
|
|
28
|
+
pythonPath = uvPythonPath;
|
|
29
|
+
} else if (fs.existsSync(traditionalPythonPath)) {
|
|
30
|
+
pythonPath = traditionalPythonPath;
|
|
31
|
+
} else {
|
|
32
|
+
console.log(chalk.red('โ Virtual environment structure not recognized'));
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const pathSeparator = isWindows ? ';' : ':';
|
|
37
|
+
const venvBinPath = path.dirname(pythonPath);
|
|
38
|
+
|
|
39
|
+
process.env.PATH = `${venvBinPath}${pathSeparator}${process.env.PATH}`;
|
|
40
|
+
process.env.VIRTUAL_ENV = venvPath;
|
|
41
|
+
process.env.PYTHONPATH = venvPath;
|
|
42
|
+
process.env.PYTHON_EXECUTABLE = pythonPath;
|
|
43
|
+
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Function to collect user credentials (simplified for TUI)
|
|
48
|
+
async function getUserCredentials() {
|
|
49
|
+
const os = require('os');
|
|
50
|
+
const userConfigDir = path.join(os.homedir(), '.gitarsenal');
|
|
51
|
+
const userConfigPath = path.join(userConfigDir, 'user-config.json');
|
|
52
|
+
|
|
53
|
+
if (fs.existsSync(userConfigPath)) {
|
|
54
|
+
try {
|
|
55
|
+
const config = JSON.parse(fs.readFileSync(userConfigPath, 'utf8'));
|
|
56
|
+
if (config.userId && config.userName && config.userEmail) {
|
|
57
|
+
return {
|
|
58
|
+
userId: config.userId,
|
|
59
|
+
userName: config.userName,
|
|
60
|
+
userEmail: config.userEmail
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// Ignore errors, fall through to default
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Return default credentials if not configured
|
|
69
|
+
return {
|
|
70
|
+
userId: 'tui-user',
|
|
71
|
+
userName: 'TUI User',
|
|
72
|
+
userEmail: 'user@example.com'
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function main() {
|
|
77
|
+
try {
|
|
78
|
+
// Activate virtual environment
|
|
79
|
+
activateVirtualEnvironment();
|
|
80
|
+
|
|
81
|
+
// Display banner
|
|
82
|
+
console.clear();
|
|
83
|
+
console.log(boxen(
|
|
84
|
+
chalk.bold.cyan('๐จ GitArsenal TUI') + '\n\n' +
|
|
85
|
+
chalk.white('Beautiful Terminal Interface for GPU-Accelerated Sandboxes') + '\n\n' +
|
|
86
|
+
chalk.green('โ
Powered by OpenTUI') + '\n' +
|
|
87
|
+
chalk.green('โ
Modern, Interactive Design') + '\n' +
|
|
88
|
+
chalk.green('โ
All the power of GitArsenal CLI'),
|
|
89
|
+
{
|
|
90
|
+
padding: 1,
|
|
91
|
+
margin: 1,
|
|
92
|
+
borderStyle: 'round',
|
|
93
|
+
borderColor: 'cyan'
|
|
94
|
+
}
|
|
95
|
+
));
|
|
96
|
+
|
|
97
|
+
console.log(chalk.gray('Loading TUI interface...\n'));
|
|
98
|
+
|
|
99
|
+
// Launch the TUI
|
|
100
|
+
const config = await launchTUI();
|
|
101
|
+
|
|
102
|
+
if (!config) {
|
|
103
|
+
console.log(chalk.yellow('Exited without creating sandbox.'));
|
|
104
|
+
process.exit(0);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Get user credentials
|
|
108
|
+
const { userId, userName, userEmail } = await getUserCredentials();
|
|
109
|
+
|
|
110
|
+
// Check dependencies
|
|
111
|
+
console.log(chalk.blue('โ Checking dependencies...'));
|
|
112
|
+
const dependenciesMet = config.sandboxProvider === 'e2b'
|
|
113
|
+
? await checkDependenciesExceptE2B()
|
|
114
|
+
: await checkDependencies();
|
|
115
|
+
|
|
116
|
+
if (!dependenciesMet) {
|
|
117
|
+
console.log(chalk.red('โ Missing dependencies. Please install them and try again.'));
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
console.log(chalk.green('โ Dependencies checked'));
|
|
121
|
+
|
|
122
|
+
// Run the container with the config from TUI
|
|
123
|
+
console.log(chalk.cyan('\n๐ Creating sandbox...'));
|
|
124
|
+
await runContainer({
|
|
125
|
+
repoUrl: config.repoUrl,
|
|
126
|
+
gpuType: config.gpuType || 'A10G',
|
|
127
|
+
gpuCount: config.gpuCount || 1,
|
|
128
|
+
volumeName: config.volumeName || '',
|
|
129
|
+
setupCommands: config.setupCommands || [],
|
|
130
|
+
yes: true, // Skip additional confirmations
|
|
131
|
+
userId,
|
|
132
|
+
userName,
|
|
133
|
+
userEmail,
|
|
134
|
+
apiKeys: config.apiKeys || {},
|
|
135
|
+
analysisData: config.analysisData || null,
|
|
136
|
+
sandboxProvider: config.sandboxProvider || 'modal'
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
console.log(chalk.green('\nโ
Sandbox created successfully!'));
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error(chalk.red(`\nโ Error: ${error.message}`));
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
main();
|
|
147
|
+
|
package/bin/gitarsenal.js
CHANGED
|
@@ -1118,8 +1118,22 @@ program
|
|
|
1118
1118
|
.option('--user-id <id>', 'User ID for tracking')
|
|
1119
1119
|
.option('--user-name <name>', 'User name for tracking')
|
|
1120
1120
|
.option('--sandbox-provider <provider>', 'Sandbox provider (modal or e2b)', 'modal')
|
|
1121
|
+
.option('--tui', 'Launch the interactive TUI interface')
|
|
1122
|
+
.option('--cli', 'Force CLI mode (skip TUI)')
|
|
1121
1123
|
.action(async (options) => {
|
|
1122
|
-
// If
|
|
1124
|
+
// If --tui flag is set, launch TUI
|
|
1125
|
+
if (options.tui) {
|
|
1126
|
+
launchTUI();
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
// If no arguments provided and stdin is a TTY (interactive), launch TUI
|
|
1131
|
+
if (process.argv.length <= 2 && process.stdin.isTTY && !options.cli) {
|
|
1132
|
+
launchTUI();
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// Otherwise, run the container command
|
|
1123
1137
|
if (options.repo || options.showExamples || process.argv.length <= 3) {
|
|
1124
1138
|
await runContainerCommand(options);
|
|
1125
1139
|
}
|
|
@@ -1127,6 +1141,33 @@ program
|
|
|
1127
1141
|
|
|
1128
1142
|
program.parse(process.argv);
|
|
1129
1143
|
|
|
1144
|
+
function launchTUI() {
|
|
1145
|
+
const tuiPath = path.join(__dirname, '..', 'tui-app', 'index.jsx');
|
|
1146
|
+
|
|
1147
|
+
// Check if TUI exists
|
|
1148
|
+
if (!fs.existsSync(tuiPath)) {
|
|
1149
|
+
console.log(chalk.red('โ TUI interface not found.'));
|
|
1150
|
+
console.log(chalk.yellow('Please ensure tui-app/index.jsx exists.'));
|
|
1151
|
+
process.exit(1);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// Launch the TUI with bun
|
|
1155
|
+
const child = spawn('bun', ['run', tuiPath], {
|
|
1156
|
+
stdio: 'inherit',
|
|
1157
|
+
cwd: path.join(__dirname, '..', 'tui-app')
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
child.on('close', (code) => {
|
|
1161
|
+
process.exit(code || 0);
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
child.on('error', (err) => {
|
|
1165
|
+
console.log(chalk.red('โ Failed to launch TUI:'), err.message);
|
|
1166
|
+
console.log(chalk.yellow('Make sure Bun is installed: curl -fsSL https://bun.sh/install | bash'));
|
|
1167
|
+
process.exit(1);
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1130
1171
|
async function runContainerCommand(options) {
|
|
1131
1172
|
try {
|
|
1132
1173
|
// console.log(chalk.blue('๐ DEBUG: runContainerCommand called with options:'), options);
|
|
@@ -1207,20 +1248,22 @@ async function runContainerCommand(options) {
|
|
|
1207
1248
|
repoUrl = answers.repoUrl;
|
|
1208
1249
|
}
|
|
1209
1250
|
|
|
1210
|
-
//
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1251
|
+
// Only prompt for sandbox provider if not already specified
|
|
1252
|
+
if (!options.sandboxProvider && !options.yes) {
|
|
1253
|
+
const providerAnswers = await inquirer.prompt([
|
|
1254
|
+
{
|
|
1255
|
+
type: 'list',
|
|
1256
|
+
name: 'sandboxProvider',
|
|
1257
|
+
message: 'Select sandbox provider:',
|
|
1258
|
+
choices: [
|
|
1259
|
+
{ name: 'Modal (GPU support, persistent volumes)', value: 'modal' },
|
|
1260
|
+
{ name: 'E2B (Faster startup, no GPU)', value: 'e2b' }
|
|
1261
|
+
],
|
|
1262
|
+
default: sandboxProvider
|
|
1263
|
+
}
|
|
1264
|
+
]);
|
|
1265
|
+
sandboxProvider = providerAnswers.sandboxProvider;
|
|
1266
|
+
}
|
|
1224
1267
|
|
|
1225
1268
|
// Load stored API keys for both providers
|
|
1226
1269
|
console.log(chalk.blue('๐ Loading stored API keys...'));
|
package/launch-tui.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# GitArsenal TUI Launcher
|
|
4
|
+
# This script launches the OpenTUI interface for GitArsenal
|
|
5
|
+
|
|
6
|
+
cd "$(dirname "$0")/tui-app"
|
|
7
|
+
|
|
8
|
+
# Check if node_modules exists
|
|
9
|
+
if [ ! -d "node_modules" ]; then
|
|
10
|
+
echo "๐ฆ Installing OpenTUI dependencies with Bun..."
|
|
11
|
+
bun install
|
|
12
|
+
echo ""
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# Clear screen and launch TUI
|
|
16
|
+
clear
|
|
17
|
+
bun run index.jsx "$@"
|
|
18
|
+
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitarsenal-cli",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.108",
|
|
4
4
|
"description": "CLI tool for creating Modal sandboxes with GitHub repositories",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"gitarsenal": "./bin/gitarsenal.js"
|
|
7
|
+
"gitarsenal": "./bin/gitarsenal.js",
|
|
8
|
+
"gitarsenal-tui": "./bin/gitarsenal-tui.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
|
-
"postinstall": "node scripts/postinstall.js"
|
|
11
|
+
"postinstall": "node scripts/postinstall.js",
|
|
12
|
+
"ensure-deps": "bash scripts/ensure-dependencies.sh"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [
|
|
13
15
|
"modal",
|
|
@@ -22,6 +24,8 @@
|
|
|
22
24
|
"license": "MIT",
|
|
23
25
|
"dependencies": {
|
|
24
26
|
"@e2b/code-interpreter": "^2.0.0",
|
|
27
|
+
"@opentui/core": "^0.1.27",
|
|
28
|
+
"@opentui/react": "^0.1.27",
|
|
25
29
|
"@supabase/supabase-js": "^2.53.0",
|
|
26
30
|
"boxen": "^5.1.2",
|
|
27
31
|
"chalk": "^4.1.2",
|
|
@@ -31,6 +35,8 @@
|
|
|
31
35
|
"g": "^2.0.1",
|
|
32
36
|
"inquirer": "^8.2.4",
|
|
33
37
|
"ora": "^5.4.1",
|
|
38
|
+
"react": "^19.2.0",
|
|
39
|
+
"react-dom": "^19.2.0",
|
|
34
40
|
"update-notifier": "^5.1.0",
|
|
35
41
|
"which": "^3.0.0"
|
|
36
42
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Ensure all Python dependencies are installed in the virtual environment
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
PACKAGE_DIR="$(dirname "$SCRIPT_DIR")"
|
|
8
|
+
|
|
9
|
+
echo "๐ฆ Ensuring Python dependencies are installed..."
|
|
10
|
+
echo "๐ Package directory: $PACKAGE_DIR"
|
|
11
|
+
|
|
12
|
+
# Check if virtual environment exists
|
|
13
|
+
if [ ! -d "$PACKAGE_DIR/.venv" ]; then
|
|
14
|
+
echo "โ Virtual environment not found. Please run: npm install"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Activate virtual environment
|
|
19
|
+
source "$PACKAGE_DIR/.venv/bin/activate"
|
|
20
|
+
|
|
21
|
+
# Check if uv is available
|
|
22
|
+
if ! command -v uv &> /dev/null; then
|
|
23
|
+
echo "โ uv is not installed. Please install it first."
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Install from requirements.txt
|
|
28
|
+
if [ -f "$PACKAGE_DIR/python/requirements.txt" ]; then
|
|
29
|
+
echo "๐ฆ Installing packages from requirements.txt..."
|
|
30
|
+
uv pip install -r "$PACKAGE_DIR/python/requirements.txt"
|
|
31
|
+
else
|
|
32
|
+
echo "๐ฆ Installing core packages..."
|
|
33
|
+
uv pip install modal requests pathlib python-dotenv flask flask-cors pexpect anthropic gitingest exa-py e2b-code-interpreter
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Verify critical packages
|
|
37
|
+
echo ""
|
|
38
|
+
echo "๐ Verifying installations..."
|
|
39
|
+
python -c "import modal; print('โ
Modal installed')"
|
|
40
|
+
python -c "import e2b_code_interpreter; print('โ
E2B Code Interpreter installed')"
|
|
41
|
+
python -c "import gitingest; print('โ
Gitingest installed')"
|
|
42
|
+
python -c "import anthropic; print('โ
Anthropic installed')"
|
|
43
|
+
|
|
44
|
+
echo ""
|
|
45
|
+
echo "โ
All dependencies installed successfully!"
|
|
46
|
+
|