genbox 1.0.122 → 1.0.124
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/create.js +3 -1
- package/dist/commands/init.js +17 -1
- package/dist/commands/run-prompt.js +34 -36
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -792,7 +792,9 @@ exports.createCommand = new commander_1.Command('create')
|
|
|
792
792
|
payload.localSetupDuration = localSetupDuration;
|
|
793
793
|
}
|
|
794
794
|
// Handle Claude Code credential injection
|
|
795
|
-
|
|
795
|
+
// Check both CLI flag and genbox.yaml config
|
|
796
|
+
const shouldInjectClaudeAuth = options.injectClaudeAuth || config.defaults?.inject_claude_auth;
|
|
797
|
+
if (shouldInjectClaudeAuth) {
|
|
796
798
|
console.log('');
|
|
797
799
|
console.log(chalk_1.default.blue('=== Claude Code Authentication ==='));
|
|
798
800
|
const claudeCreds = (0, utils_1.getClaudeCredentials)();
|
package/dist/commands/init.js
CHANGED
|
@@ -800,7 +800,19 @@ async function getProjectSettings(detected, existingEnvValues) {
|
|
|
800
800
|
message: 'Install Claude Code CLI on genbox servers?',
|
|
801
801
|
default: true,
|
|
802
802
|
});
|
|
803
|
-
|
|
803
|
+
// Claude Code credential injection
|
|
804
|
+
let injectClaudeAuth = false;
|
|
805
|
+
if (installClaudeCode) {
|
|
806
|
+
injectClaudeAuth = await prompts.confirm({
|
|
807
|
+
message: 'Inject your Claude credentials into genboxes for remote execution?',
|
|
808
|
+
default: true,
|
|
809
|
+
});
|
|
810
|
+
if (injectClaudeAuth) {
|
|
811
|
+
console.log(chalk_1.default.dim(' Your local Claude credentials will be injected when creating genboxes.'));
|
|
812
|
+
console.log(chalk_1.default.dim(' This enables running Claude prompts remotely with your subscription.'));
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return { projectName, serverSize, baseBranch, installClaudeCode, injectClaudeAuth };
|
|
804
816
|
}
|
|
805
817
|
// =============================================================================
|
|
806
818
|
// Git Auth Setup
|
|
@@ -1453,6 +1465,9 @@ function generateConfig(detected, settings, repos, environments, profiles) {
|
|
|
1453
1465
|
if (settings.installClaudeCode) {
|
|
1454
1466
|
defaults.install_claude_code = true;
|
|
1455
1467
|
}
|
|
1468
|
+
if (settings.injectClaudeAuth) {
|
|
1469
|
+
defaults.inject_claude_auth = true;
|
|
1470
|
+
}
|
|
1456
1471
|
// Map structure type
|
|
1457
1472
|
const structureMap = {
|
|
1458
1473
|
'single-app': 'single-app',
|
|
@@ -2210,6 +2225,7 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
2210
2225
|
serverSize: 'medium',
|
|
2211
2226
|
baseBranch: detected.git?.branch || 'main',
|
|
2212
2227
|
installClaudeCode: true,
|
|
2228
|
+
injectClaudeAuth: true,
|
|
2213
2229
|
};
|
|
2214
2230
|
const { repos, envVars: gitEnvVars } = await setupGitAuth(detected, settings.projectName, existingEnvValues);
|
|
2215
2231
|
const environments = {};
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* Claude.ai subscription (via injected credentials).
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* gb run-prompt
|
|
10
|
-
* gb run-prompt
|
|
9
|
+
* gb run-prompt "Your prompt here" # Auto-selects genbox
|
|
10
|
+
* gb run-prompt "Your prompt here" my-genbox # Specific genbox
|
|
11
|
+
* gb run-prompt "Implement dark mode" --model opus # With options
|
|
11
12
|
*/
|
|
12
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -16,10 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
17
|
exports.runPromptCommand = void 0;
|
|
17
18
|
const commander_1 = require("commander");
|
|
18
19
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
-
const ora_1 = __importDefault(require("ora"));
|
|
20
20
|
const child_process_1 = require("child_process");
|
|
21
21
|
const api_1 = require("../api");
|
|
22
22
|
const ssh_config_1 = require("../ssh-config");
|
|
23
|
+
const genbox_selector_1 = require("../genbox-selector");
|
|
23
24
|
/**
|
|
24
25
|
* Format tool input for display
|
|
25
26
|
*/
|
|
@@ -90,64 +91,61 @@ function handleStreamMessage(msg, options) {
|
|
|
90
91
|
}
|
|
91
92
|
exports.runPromptCommand = new commander_1.Command('run-prompt')
|
|
92
93
|
.description('Run a Claude Code prompt on a remote genbox')
|
|
93
|
-
.argument('<name>', 'Name of the genbox')
|
|
94
94
|
.argument('<prompt>', 'The prompt to execute')
|
|
95
|
+
.argument('[name]', 'Name of the genbox (optional - will prompt if not provided)')
|
|
96
|
+
.option('-a, --all', 'Select from all genboxes (not just current project)')
|
|
95
97
|
.option('--tools <tools>', 'Comma-separated list of allowed tools', 'Read,Edit,Bash,Glob,Grep,Write')
|
|
96
98
|
.option('--max-turns <n>', 'Maximum number of turns', '50')
|
|
97
99
|
.option('--model <model>', 'Model to use (sonnet, opus, haiku)', 'sonnet')
|
|
98
100
|
.option('-v, --verbose', 'Show verbose output including tool results')
|
|
99
101
|
.option('--no-stream', 'Wait for completion instead of streaming')
|
|
100
102
|
.option('--cwd <path>', 'Working directory on the genbox (default: auto-detect from genbox)')
|
|
101
|
-
.action(async (
|
|
103
|
+
.action(async (prompt, name, options) => {
|
|
102
104
|
try {
|
|
103
|
-
//
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
105
|
+
// Select genbox (interactive if no name provided)
|
|
106
|
+
const { genbox, cancelled } = await (0, genbox_selector_1.selectGenbox)(name, {
|
|
107
|
+
all: options.all,
|
|
108
|
+
selectMessage: 'Select a genbox to run the prompt on:',
|
|
109
|
+
statusFilter: 'running', // Only show running genboxes
|
|
110
|
+
});
|
|
111
|
+
if (cancelled) {
|
|
112
|
+
console.log(chalk_1.default.dim('Cancelled.'));
|
|
113
|
+
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (error instanceof api_1.AuthenticationError) {
|
|
118
|
-
console.log(chalk_1.default.yellow(' Please authenticate first:'));
|
|
119
|
-
console.log(chalk_1.default.cyan(' $ genbox login'));
|
|
120
|
-
}
|
|
115
|
+
if (!genbox) {
|
|
116
|
+
console.log(chalk_1.default.red('No genbox selected'));
|
|
121
117
|
return;
|
|
122
118
|
}
|
|
123
119
|
// Check status
|
|
124
120
|
if (genbox.status !== 'running') {
|
|
125
|
-
|
|
126
|
-
console.log(chalk_1.default.dim(' Start the genbox first with: gb start ' + name));
|
|
121
|
+
console.log(chalk_1.default.red(`Genbox '${genbox.name}' is not running (status: ${genbox.status})`));
|
|
122
|
+
console.log(chalk_1.default.dim(' Start the genbox first with: gb start ' + genbox.name));
|
|
127
123
|
return;
|
|
128
124
|
}
|
|
129
125
|
if (!genbox.ipAddress) {
|
|
130
|
-
|
|
126
|
+
console.log(chalk_1.default.red(`Genbox '${genbox.name}' has no IP address`));
|
|
131
127
|
return;
|
|
132
128
|
}
|
|
133
|
-
|
|
129
|
+
console.log(chalk_1.default.green(`✓ Selected genbox '${genbox.name}'`));
|
|
130
|
+
// Cast to any for accessing dynamic API response properties
|
|
131
|
+
const g = genbox;
|
|
134
132
|
// Determine working directory
|
|
135
133
|
let workingDir = options.cwd;
|
|
136
134
|
if (!workingDir) {
|
|
137
135
|
// Auto-detect from genbox configuration
|
|
138
136
|
// Priority: first repo path > first app path > /home/dev
|
|
139
|
-
if (
|
|
140
|
-
const firstRepo = Object.values(
|
|
141
|
-
workingDir = firstRepo.path || `/home/dev/${
|
|
137
|
+
if (g.repos && Object.keys(g.repos).length > 0) {
|
|
138
|
+
const firstRepo = Object.values(g.repos)[0];
|
|
139
|
+
workingDir = firstRepo.path || `/home/dev/${g.workspace}`;
|
|
142
140
|
}
|
|
143
|
-
else if (
|
|
141
|
+
else if (g.appConfigs && g.appConfigs.length > 0) {
|
|
144
142
|
// Use parent directory of first app
|
|
145
|
-
const appPath =
|
|
143
|
+
const appPath = g.appConfigs[0].path;
|
|
146
144
|
workingDir = appPath.includes('/') ? appPath.split('/').slice(0, -1).join('/') : '/home/dev';
|
|
147
145
|
}
|
|
148
146
|
else {
|
|
149
147
|
// Fallback to workspace directory
|
|
150
|
-
workingDir = `/home/dev/${
|
|
148
|
+
workingDir = `/home/dev/${g.workspace || 'project'}`;
|
|
151
149
|
}
|
|
152
150
|
}
|
|
153
151
|
// Display info
|
|
@@ -182,7 +180,7 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
|
|
|
182
180
|
// 3. Run claude command
|
|
183
181
|
const sshCommand = `source ~/.nvm/nvm.sh 2>/dev/null; cd "${workingDir}" 2>/dev/null || cd /home/dev; ${claudeCommand.join(' ')}`;
|
|
184
182
|
// Execute via SSH
|
|
185
|
-
const sshAlias = (0, ssh_config_1.getSshAlias)(name);
|
|
183
|
+
const sshAlias = (0, ssh_config_1.getSshAlias)(genbox.name);
|
|
186
184
|
const ssh = (0, child_process_1.spawn)('ssh', [
|
|
187
185
|
'-o', 'StrictHostKeyChecking=no',
|
|
188
186
|
'-o', 'UserKnownHostsFile=/dev/null',
|
|
@@ -236,9 +234,9 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
|
|
|
236
234
|
if (code === 0) {
|
|
237
235
|
console.log('');
|
|
238
236
|
console.log(chalk_1.default.bold('Next steps:'));
|
|
239
|
-
console.log(` View changes: ${chalk_1.default.cyan(`gb connect ${name}`)} then ${chalk_1.default.cyan('git diff')}`);
|
|
240
|
-
console.log(` Push changes: ${chalk_1.default.cyan(`gb push ${name}`)}`);
|
|
241
|
-
console.log(` Run again: ${chalk_1.default.cyan(`gb run-prompt ${name}
|
|
237
|
+
console.log(` View changes: ${chalk_1.default.cyan(`gb connect ${genbox.name}`)} then ${chalk_1.default.cyan('git diff')}`);
|
|
238
|
+
console.log(` Push changes: ${chalk_1.default.cyan(`gb push ${genbox.name}`)}`);
|
|
239
|
+
console.log(` Run again: ${chalk_1.default.cyan(`gb run-prompt "..." ${genbox.name}`)} `);
|
|
242
240
|
}
|
|
243
241
|
else {
|
|
244
242
|
console.log(chalk_1.default.yellow(` SSH exited with code ${code}`));
|