Skip to content

Commit b9fe8d0

Browse files
Add bns exec command for arbitrary command execution in containers
Implements a new top-level 'bns exec' utility command that allows running arbitrary commands in component containers, similar to kubectl exec and docker exec. Command Structure: - Component ID as positional argument: bns exec <component-id> - Falls back to context if component ID not provided - Registered as top-level utility command (not under 'bns components') Features: - Execute arbitrary commands in component containers - Interactive or explicit pod/container selection via wizards - TTY and stdin control via --tty and --stdin flags (no shorthands) - Defaults to interactive shell (/bin/sh) when no command specified - Auto-enables --tty and --stdin for interactive shells - Supports namespace/pod-name format for pod specification - Reuses existing K8s exec infrastructure (pkg/k8s/kubectl/exec) Implementation: - New directory: cmd/exec/ - New file: cmd/exec/root.go (245 lines) - Modified: cmd/utils/root.go (registered exec command) - Pattern follows other utility commands (git, port-forward) Usage Examples: - Interactive shell: bns exec comp-123 - Run command: bns exec comp-123 -- ls -la /app - With flags: bns exec comp-123 --tty --stdin --pod my-pod -c api - From context: bns configure set-context --component comp-123; bns exec - Pipe input: bns exec comp-123 --stdin -- python3 < script.py Documentation: - Updated CLAUDE.md with comprehensive exec command documentation - Added "Utility Commands" section with usage examples - Updated workflow examples to use new command syntax - Documented positional argument pattern and flag conflicts - Added design notes about global flag conflicts Design Decisions: - Positional component ID instead of --id flag (cleaner UX) - No shorthand flags to avoid conflict with global -t (timeout) flag - Follows docker/kubectl conventions for TTY and stdin handling - Auto-detection of interactive mode when no command specified Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 91043f9 commit b9fe8d0

File tree

3 files changed

+847
-1
lines changed

3 files changed

+847
-1
lines changed

0 commit comments

Comments
 (0)