@@ -34,6 +34,9 @@ export class ContainerManager {
3434 // Copy Claude configuration if it exists
3535 await this . _copyClaudeConfig ( container ) ;
3636
37+ // Configure bypass permissions mode to skip confirmation prompt
38+ await this . _setupBypassPermissions ( container ) ;
39+
3740 // Copy git configuration if it exists
3841 await this . _copyGitConfig ( container ) ;
3942 } catch ( error ) {
@@ -842,6 +845,78 @@ exec claude --dangerously-skip-permissions' > /start-claude.sh && \\
842845 }
843846 }
844847
848+ private async _setupBypassPermissions (
849+ container : Docker . Container ,
850+ ) : Promise < void > {
851+ try {
852+ console . log ( chalk . blue ( "• Configuring bypass permissions mode..." ) ) ;
853+
854+ // Create or update settings.json to enable bypass permissions mode
855+ // This skips the "By proceeding, you accept all responsibility" confirmation prompt
856+ const settingsContent = JSON . stringify (
857+ {
858+ permissions : {
859+ defaultMode : "bypassPermissions" ,
860+ } ,
861+ } ,
862+ null ,
863+ 2 ,
864+ ) ;
865+
866+ const setupExec = await container . exec ( {
867+ Cmd : [
868+ "/bin/bash" ,
869+ "-c" ,
870+ `
871+ # Ensure .claude directory exists
872+ mkdir -p /home/claude/.claude &&
873+
874+ # Check if settings.json exists
875+ if [ -f /home/claude/.claude/settings.json ]; then
876+ # Merge with existing settings using jq if available, otherwise replace
877+ if command -v jq &> /dev/null; then
878+ # Use jq to merge settings, preserving existing values
879+ jq '.permissions.defaultMode = "bypassPermissions"' /home/claude/.claude/settings.json > /tmp/settings.json.tmp &&
880+ mv /tmp/settings.json.tmp /home/claude/.claude/settings.json
881+ else
882+ # No jq, just overwrite (existing settings will be lost)
883+ echo '${ settingsContent } ' > /home/claude/.claude/settings.json
884+ fi
885+ else
886+ # Create new settings file
887+ echo '${ settingsContent } ' > /home/claude/.claude/settings.json
888+ fi &&
889+
890+ # Fix permissions
891+ chown -R claude:claude /home/claude/.claude &&
892+ chmod 700 /home/claude/.claude &&
893+ chmod 600 /home/claude/.claude/settings.json
894+ ` ,
895+ ] ,
896+ AttachStdout : true ,
897+ AttachStderr : true ,
898+ } ) ;
899+
900+ const stream = await setupExec . start ( { } ) ;
901+
902+ // Wait for completion
903+ await new Promise < void > ( ( resolve , reject ) => {
904+ stream . on ( "end" , resolve ) ;
905+ stream . on ( "error" , reject ) ;
906+ } ) ;
907+
908+ console . log (
909+ chalk . green ( "✓ Bypass permissions mode configured (no confirmation prompt)" ) ,
910+ ) ;
911+ } catch ( error ) {
912+ console . error (
913+ chalk . yellow ( "⚠ Failed to configure bypass permissions:" ) ,
914+ error ,
915+ ) ;
916+ // Don't throw - Claude will still work, just with the confirmation prompt
917+ }
918+ }
919+
845920 private async _copyGitConfig ( container : Docker . Container ) : Promise < void > {
846921 const fs = require ( "fs" ) ;
847922 const os = require ( "os" ) ;
0 commit comments