Skip to content

Commit f17debf

Browse files
davila7claude
andcommitted
Add interactive prompt input for E2B sandbox when --prompt not provided
Features: ✅ Interactive Project Requirements Editor: - Opens when --prompt parameter is not provided in sandbox mode - Uses inquirer editor type for multi-line text input - Comprehensive default template with structured guidance - Input validation (minimum 10 characters) ✅ Enhanced User Experience: - Clear instructions on how to provide detailed requirements - Pre-filled template with examples and categories: * Feature descriptions * Technical requirements (tech stack, styling) * Design requirements (colors, layout, UI style) - Real example at the bottom for reference ✅ Smart Flow: - Only triggers when prompt is missing in sandbox mode - Captures user input and continues with normal sandbox execution - Maintains all existing functionality when --prompt is provided This allows users to run sandbox mode without specifying --prompt and get a guided experience to describe their project requirements. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4951387 commit f17debf

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

cli-tool/src/index.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,11 +2096,30 @@ async function executeSandbox(options, targetDir) {
20962096
return;
20972097
}
20982098

2099-
// Validate prompt is provided
2099+
// Get prompt from user if not provided
21002100
if (!prompt) {
2101-
console.log(chalk.red('❌ Error: --prompt is required when using --sandbox'));
2102-
console.log(chalk.yellow('💡 Example: --sandbox e2b --prompt "Create a React todo app"'));
2103-
return;
2101+
console.log(chalk.blue('\n📝 Project Requirements'));
2102+
console.log(chalk.cyan('═══════════════════════════════════════'));
2103+
console.log(chalk.gray('Describe what you want to create in detail. The more specific you are,'));
2104+
console.log(chalk.gray('the better Claude Code will understand your requirements.\n'));
2105+
2106+
const inquirer = require('inquirer');
2107+
2108+
const { userPrompt } = await inquirer.prompt([{
2109+
type: 'editor',
2110+
name: 'userPrompt',
2111+
message: 'What would you like to create?',
2112+
default: 'Create a web application with:\n- Feature 1 (describe what it should do)\n- Feature 2 (describe what it should do)\n- Feature 3 (describe what it should do)\n\nTechnical Requirements:\n- Technology stack (React, Vue, vanilla JS, etc.)\n- Styling approach (CSS, Tailwind, styled-components)\n- Additional features (authentication, database, API integration)\n\nDesign Requirements:\n- Color scheme and theme\n- Layout structure\n- User interface style\n\nExample: Create a modern todo application with drag-and-drop functionality, dark/light mode toggle, priority levels, and local storage persistence.',
2113+
validate: (input) => {
2114+
if (!input || input.trim().length < 10) {
2115+
return 'Please provide a more detailed description (at least 10 characters)';
2116+
}
2117+
return true;
2118+
}
2119+
}]);
2120+
2121+
prompt = userPrompt.trim();
2122+
console.log(chalk.green('✅ Project requirements captured!'));
21042123
}
21052124

21062125
// Load .env file if it exists (for API keys)

0 commit comments

Comments
 (0)