@@ -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 ) {
@@ -829,6 +832,78 @@ exec claude --dangerously-skip-permissions' > /start-claude.sh && \\
829832 }
830833 }
831834
835+ private async _setupBypassPermissions (
836+ container : Docker . Container ,
837+ ) : Promise < void > {
838+ try {
839+ console . log ( chalk . blue ( "• Configuring bypass permissions mode..." ) ) ;
840+
841+ // Create or update settings.json to enable bypass permissions mode
842+ // This skips the "By proceeding, you accept all responsibility" confirmation prompt
843+ const settingsContent = JSON . stringify (
844+ {
845+ permissions : {
846+ defaultMode : "bypassPermissions" ,
847+ } ,
848+ } ,
849+ null ,
850+ 2 ,
851+ ) ;
852+
853+ const setupExec = await container . exec ( {
854+ Cmd : [
855+ "/bin/bash" ,
856+ "-c" ,
857+ `
858+ # Ensure .claude directory exists
859+ mkdir -p /home/claude/.claude &&
860+
861+ # Check if settings.json exists
862+ if [ -f /home/claude/.claude/settings.json ]; then
863+ # Merge with existing settings using jq if available, otherwise replace
864+ if command -v jq &> /dev/null; then
865+ # Use jq to merge settings, preserving existing values
866+ jq '.permissions.defaultMode = "bypassPermissions"' /home/claude/.claude/settings.json > /tmp/settings.json.tmp &&
867+ mv /tmp/settings.json.tmp /home/claude/.claude/settings.json
868+ else
869+ # No jq, just overwrite (existing settings will be lost)
870+ echo '${ settingsContent } ' > /home/claude/.claude/settings.json
871+ fi
872+ else
873+ # Create new settings file
874+ echo '${ settingsContent } ' > /home/claude/.claude/settings.json
875+ fi &&
876+
877+ # Fix permissions
878+ chown -R claude:claude /home/claude/.claude &&
879+ chmod 700 /home/claude/.claude &&
880+ chmod 600 /home/claude/.claude/settings.json
881+ ` ,
882+ ] ,
883+ AttachStdout : true ,
884+ AttachStderr : true ,
885+ } ) ;
886+
887+ const stream = await setupExec . start ( { } ) ;
888+
889+ // Wait for completion
890+ await new Promise < void > ( ( resolve , reject ) => {
891+ stream . on ( "end" , resolve ) ;
892+ stream . on ( "error" , reject ) ;
893+ } ) ;
894+
895+ console . log (
896+ chalk . green ( "✓ Bypass permissions mode configured (no confirmation prompt)" ) ,
897+ ) ;
898+ } catch ( error ) {
899+ console . error (
900+ chalk . yellow ( "⚠ Failed to configure bypass permissions:" ) ,
901+ error ,
902+ ) ;
903+ // Don't throw - Claude will still work, just with the confirmation prompt
904+ }
905+ }
906+
832907 private async _copyGitConfig ( container : Docker . Container ) : Promise < void > {
833908 const fs = require ( "fs" ) ;
834909 const os = require ( "os" ) ;
0 commit comments