genbox 1.0.148 → 1.0.149
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/dist/commands/attach.js +25 -17
- package/package.json +1 -1
package/dist/commands/attach.js
CHANGED
|
@@ -45,7 +45,8 @@ const child_process_1 = require("child_process");
|
|
|
45
45
|
const os = __importStar(require("os"));
|
|
46
46
|
const path = __importStar(require("path"));
|
|
47
47
|
const fs = __importStar(require("fs"));
|
|
48
|
-
const
|
|
48
|
+
const select_1 = __importDefault(require("@inquirer/select"));
|
|
49
|
+
const confirm_1 = __importDefault(require("@inquirer/confirm"));
|
|
49
50
|
function getPrivateSshKey() {
|
|
50
51
|
const home = os.homedir();
|
|
51
52
|
const potentialKeys = [
|
|
@@ -119,17 +120,20 @@ async function selectSession(sessions, allowNew = true) {
|
|
|
119
120
|
name: chalk_1.default.dim('Cancel'),
|
|
120
121
|
value: '__cancel__',
|
|
121
122
|
});
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
type: 'list',
|
|
125
|
-
name: 'session',
|
|
123
|
+
try {
|
|
124
|
+
const session = await (0, select_1.default)({
|
|
126
125
|
message: allowNew ? 'Select a session or create new:' : 'Select a session to attach:',
|
|
127
126
|
choices,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
});
|
|
128
|
+
return session === '__cancel__' ? null : session;
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
// Handle Ctrl+C
|
|
132
|
+
if (error.name === 'ExitPromptError' || error.message?.includes('force closed')) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
133
137
|
}
|
|
134
138
|
function generateSessionName() {
|
|
135
139
|
const adjectives = ['swift', 'bright', 'calm', 'bold', 'keen', 'warm', 'cool', 'quick'];
|
|
@@ -166,15 +170,19 @@ async function createClaudeSession(ipAddress, keyPath, sessionName) {
|
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
async function promptCreateSession() {
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
type: 'confirm',
|
|
172
|
-
name: 'create',
|
|
173
|
+
try {
|
|
174
|
+
return await (0, confirm_1.default)({
|
|
173
175
|
message: 'No active sessions found. Create a new Claude session?',
|
|
174
176
|
default: true,
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
// Handle Ctrl+C
|
|
181
|
+
if (error.name === 'ExitPromptError' || error.message?.includes('force closed')) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
178
186
|
}
|
|
179
187
|
async function ensureTmuxConfig(ipAddress, keyPath) {
|
|
180
188
|
const configPath = '/home/dev/.tmux.conf';
|