genbox 1.0.121 → 1.0.122

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.
@@ -97,7 +97,7 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
97
97
  .option('--model <model>', 'Model to use (sonnet, opus, haiku)', 'sonnet')
98
98
  .option('-v, --verbose', 'Show verbose output including tool results')
99
99
  .option('--no-stream', 'Wait for completion instead of streaming')
100
- .option('--cwd <path>', 'Working directory on the genbox', '~/workspace')
100
+ .option('--cwd <path>', 'Working directory on the genbox (default: auto-detect from genbox)')
101
101
  .action(async (name, prompt, options) => {
102
102
  try {
103
103
  // Get genbox info
@@ -131,8 +131,28 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
131
131
  return;
132
132
  }
133
133
  spinner.succeed(chalk_1.default.green(`Connected to genbox '${name}'`));
134
+ // Determine working directory
135
+ let workingDir = options.cwd;
136
+ if (!workingDir) {
137
+ // Auto-detect from genbox configuration
138
+ // Priority: first repo path > first app path > /home/dev
139
+ if (genbox.repos && Object.keys(genbox.repos).length > 0) {
140
+ const firstRepo = Object.values(genbox.repos)[0];
141
+ workingDir = firstRepo.path || `/home/dev/${genbox.workspace}`;
142
+ }
143
+ else if (genbox.appConfigs && genbox.appConfigs.length > 0) {
144
+ // Use parent directory of first app
145
+ const appPath = genbox.appConfigs[0].path;
146
+ workingDir = appPath.includes('/') ? appPath.split('/').slice(0, -1).join('/') : '/home/dev';
147
+ }
148
+ else {
149
+ // Fallback to workspace directory
150
+ workingDir = `/home/dev/${genbox.workspace || 'project'}`;
151
+ }
152
+ }
134
153
  // Display info
135
154
  console.log(chalk_1.default.dim(` IP: ${genbox.ipAddress}`));
155
+ console.log(chalk_1.default.dim(` Working dir: ${workingDir}`));
136
156
  console.log(chalk_1.default.dim(` Tools: ${options.tools}`));
137
157
  console.log(chalk_1.default.dim(` Max turns: ${options.maxTurns}`));
138
158
  console.log('');
@@ -149,6 +169,7 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
149
169
  '--print',
150
170
  `"${escapedPrompt}"`,
151
171
  '--output-format', 'stream-json',
172
+ '--verbose', // Required when using --print with stream-json
152
173
  '--allowedTools', `"${options.tools}"`,
153
174
  '--max-turns', options.maxTurns,
154
175
  ];
@@ -156,7 +177,10 @@ exports.runPromptCommand = new commander_1.Command('run-prompt')
156
177
  claudeCommand.push('--model', options.model);
157
178
  }
158
179
  // Build the full SSH command
159
- const sshCommand = `cd ${options.cwd} && ${claudeCommand.join(' ')}`;
180
+ // 1. Source NVM (required for non-interactive SSH to find claude)
181
+ // 2. Change to working directory (with fallback)
182
+ // 3. Run claude command
183
+ const sshCommand = `source ~/.nvm/nvm.sh 2>/dev/null; cd "${workingDir}" 2>/dev/null || cd /home/dev; ${claudeCommand.join(' ')}`;
160
184
  // Execute via SSH
161
185
  const sshAlias = (0, ssh_config_1.getSshAlias)(name);
162
186
  const ssh = (0, child_process_1.spawn)('ssh', [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.121",
3
+ "version": "1.0.122",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {