Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/claude-code/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ By default, the `latest` release channel is installed. You can also specify:

The channel chosen at install time becomes the default for auto-updates.

## YOLO Alias

When `yoloAlias` is set to `true`, a `yolo` shell alias is created that expands to `claude --allow-dangerously-skip-permissions`. The alias is configured for bash, zsh, and fish.

Comment thread
tmaier marked this conversation as resolved.
## Auto-Updates

The native binary automatically updates in the background. Update checks are performed on startup and periodically while running. To disable auto-updates, set the `DISABLE_AUTOUPDATER=1` environment variable.
Expand Down
5 changes: 5 additions & 0 deletions src/claude-code/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"type": "string",
"default": "latest",
"description": "Version to install. Use 'latest', 'stable', or a specific semver (e.g. '1.0.58')."
},
"yoloAlias": {
"type": "boolean",
"default": false,
"description": "Create a 'yolo' shell alias for 'claude --allow-dangerously-skip-permissions' in bash, zsh, and fish."
}
},
"customizations": {
Expand Down
30 changes: 30 additions & 0 deletions src/claude-code/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,34 @@ if [ -f "$INSTALL_HOME/.local/bin/claude" ] && [ ! -f /usr/local/bin/claude ]; t
echo "Symlinked claude to /usr/local/bin/claude"
fi

# Set up yolo alias if requested
if [ "${YOLOALIAS:-false}" = "true" ]; then
echo "Setting up 'yolo' alias..."
ALIAS_CMD='alias yolo="claude --allow-dangerously-skip-permissions"'
TARGET_HOME="${INSTALL_HOME}"

# bash
echo "$ALIAS_CMD" >> "$TARGET_HOME/.bashrc"

# zsh
echo "$ALIAS_CMD" >> "$TARGET_HOME/.zshrc"
Comment thread
tmaier marked this conversation as resolved.
Outdated

# fish — create a function file (idiomatic for fish)
FISH_FUNC_DIR="$TARGET_HOME/.config/fish/functions"
mkdir -p "$FISH_FUNC_DIR"
cat > "$FISH_FUNC_DIR/yolo.fish" << 'FISHEOF'
function yolo --description "claude --allow-dangerously-skip-permissions"
claude --allow-dangerously-skip-permissions $argv
end
FISHEOF
Comment thread
tmaier marked this conversation as resolved.

# 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 -R "$_REMOTE_USER" "$FISH_FUNC_DIR"
fi
Comment thread
tmaier marked this conversation as resolved.

echo "yolo alias configured for bash, zsh, and fish."
fi

echo "Claude Code installed successfully!"
19 changes: 19 additions & 0 deletions test/claude-code/claude_code_yolo_alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# This test file will be executed against the 'claude_code_yolo_alias' scenario
# to verify that the yolo alias is properly configured.

set -e

# Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

# Feature-specific tests
check "claude command available" which claude
check "yolo alias in bashrc" bash -c "grep -q 'alias yolo=' ~/.bashrc"
check "yolo alias in zshrc" bash -c "grep -q 'alias yolo=' ~/.zshrc"
check "fish yolo function exists" bash -c "test -f ~/.config/fish/functions/yolo.fish"
check "yolo resolves in bash" bash -ic "type yolo"
Comment thread
tmaier marked this conversation as resolved.
Outdated

# Report results
reportResults
8 changes: 8 additions & 0 deletions test/claude-code/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,13 @@
"features": {
"claude-code": {}
}
},
"claude_code_yolo_alias": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"claude-code": {
"yoloAlias": true
}
}
}
}
Loading