feat(claude-code): add yoloAlias option#19
Conversation
Add a boolean option that creates a 'yolo' shell alias mapping to 'claude --allow-dangerously-skip-permissions' in bash, zsh, and fish.
There was a problem hiding this comment.
Pull request overview
Adds an opt-in yoloAlias configuration to the claude-code devcontainer feature to create a yolo shortcut for running Claude with permissions skipped, plus a new test scenario to validate the setup.
Changes:
- Introduces
yoloAlias(defaultfalse) to theclaude-codefeature options. - Updates installation logic to configure
yolofor bash/zsh and a fish function file when enabled. - Adds a new scenario + test script to validate alias/function creation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/claude-code/scenarios.json | Adds a new claude_code_yolo_alias test scenario enabling yoloAlias. |
| test/claude-code/claude_code_yolo_alias.sh | New scenario test script for verifying alias/function presence. |
| src/claude-code/install.sh | Implements shell alias/function creation when YOLOALIAS=true. |
| src/claude-code/devcontainer-feature.json | Adds the new yoloAlias boolean option to the feature schema. |
| src/claude-code/NOTES.md | Documents the new YOLO alias behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Make alias appending idempotent with grep guard, add security warning to docs, and strengthen test assertions to verify full command string.
There was a problem hiding this comment.
Pull request overview
Adds an optional “YOLO” convenience command to the claude-code devcontainer feature, allowing users to opt-in to a yolo shortcut for running Claude Code with permissions checks skipped.
Changes:
- Adds a
yoloAliasboolean feature option (defaultfalse) and documents it. - Updates the feature installer to configure
yolofor bash/zsh and a fish function file. - Adds a new scenario + test script to validate the alias/function is created.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/claude-code/scenarios.json | Adds a new claude_code_yolo_alias test scenario enabling yoloAlias. |
| test/claude-code/claude_code_yolo_alias.sh | New scenario test that asserts the alias/function is present in bash/zsh/fish configs. |
| src/claude-code/install.sh | Implements yoloAlias behavior by appending aliases to rc files and creating a fish function. |
| src/claude-code/devcontainer-feature.json | Introduces the new yoloAlias option in the feature metadata. |
| src/claude-code/NOTES.md | Documents the yoloAlias option and its security implications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Skip writing yolo.fish if it already exists to match bash/zsh behavior. Chown only the specific file instead of the entire functions directory. Update docs to reflect the skip-if-exists behavior.
There was a problem hiding this comment.
Pull request overview
Adds an opt-in yoloAlias option to the claude-code devcontainer feature to install a yolo shortcut for running Claude Code with --allow-dangerously-skip-permissions, with shell-specific setup and new scenario coverage.
Changes:
- Introduces
yoloAlias(defaultfalse) to the feature options. - Updates the installer to add
yolofor bash/zsh and a fish function file when enabled. - Adds a new test scenario and scenario script to validate alias/function installation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/claude-code/scenarios.json | Adds a new claude_code_yolo_alias scenario enabling yoloAlias. |
| test/claude-code/claude_code_yolo_alias.sh | Adds checks for yolo being written to bash/zsh config and fish function. |
| src/claude-code/install.sh | Implements YOLOALIAS-gated alias/function creation and ownership adjustments. |
| src/claude-code/devcontainer-feature.json | Declares the new yoloAlias option. |
| src/claude-code/NOTES.md | Documents yoloAlias behavior and warns about safety implications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| add_shell_alias_if_missing() { | ||
| local rc_file="$1" | ||
| local alias_name="$2" | ||
| local alias_cmd="$3" | ||
|
|
||
| if [ -f "$rc_file" ] && grep -Eq "^[[:space:]]*alias[[:space:]]+${alias_name}=" "$rc_file"; then | ||
| echo "Skipping $rc_file: alias '$alias_name' already exists." | ||
| return 0 | ||
| fi | ||
|
|
||
| touch "$rc_file" | ||
| printf '%s\n' "$alias_cmd" >> "$rc_file" | ||
| } |
| "claude-code": { | ||
| "yoloAlias": true | ||
| } | ||
| } |
Update NOTES.md to accurately describe which existing definitions are detected. Add test scenario combining yoloAlias with remoteUser to verify file ownership for non-root users.
There was a problem hiding this comment.
Pull request overview
Adds an opt-in yoloAlias feature option for the claude-code devcontainer feature to create a yolo shortcut that runs Claude Code with --allow-dangerously-skip-permissions, and validates it via new feature scenario tests.
Changes:
- Introduces a
yoloAliasboolean option indevcontainer-feature.jsonand documents it (including safety warning) inNOTES.md. - Updates the installer to append a
yoloalias to.bashrc/.zshrcand create a fish function at~/.config/fish/functions/yolo.fishwhen enabled. - Adds new test scenarios and scripts to verify alias/function creation, including a non-root
remoteUserscenario.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/claude-code/scenarios.json | Adds new test scenarios for yoloAlias (default + custom user). |
| test/claude-code/claude_code_yolo_alias.sh | New scenario test validating alias/function presence. |
| test/claude-code/claude_code_yolo_alias_with_custom_user.sh | New scenario test validating alias/function presence and ownership under non-root user. |
| src/claude-code/install.sh | Implements alias/function creation logic when YOLOALIAS=true. |
| src/claude-code/devcontainer-feature.json | Adds the yoloAlias option definition. |
| src/claude-code/NOTES.md | Documents the option and its security implications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return 0 | ||
| fi | ||
|
|
||
| touch "$rc_file" |
| # Fix ownership if installing for non-root user | ||
| if [ -n "$_REMOTE_USER" ] && [ "$_REMOTE_USER" != "root" ]; then | ||
| chown "$_REMOTE_USER" "$TARGET_HOME/.bashrc" "$TARGET_HOME/.zshrc" | ||
| chown "$_REMOTE_USER" "$FISH_FUNC_FILE" |
| check "yolo alias in zshrc" bash -c "grep -Fq 'claude --allow-dangerously-skip-permissions' ~/.zshrc" | ||
| check "fish yolo function body" bash -c "test -f ~/.config/fish/functions/yolo.fish && grep -Fq 'claude --allow-dangerously-skip-permissions' ~/.config/fish/functions/yolo.fish" | ||
| check "bashrc owned by current user" bash -c "test \"$(stat -c '%U' ~/.bashrc)\" = \"$(whoami)\"" | ||
| check "zshrc owned by current user" bash -c "test \"$(stat -c '%U' ~/.zshrc)\" = \"$(whoami)\"" |
…wnership Ensure rc files end with a newline before appending alias to prevent concatenation onto the previous line. Chown fish config directories individually so non-root users can manage their fish config.
Summary
yoloAliasboolean option (default:false) to the claude-code featureyoloalias that expands toclaude --allow-dangerously-skip-permissions.bashrc), zsh (.zshrc), and fish (function file at~/.config/fish/functions/yolo.fish)Test plan
devcontainer features validate ./srcpassesclaude_code_yolo_aliasscenario tests pass