mirror of
https://github.com/anthropics/claude-code.git
synced 2026-04-26 15:03:17 +00:00
Compare commits
3 Commits
github-api
...
ashwin/cha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0006ad1a2 | ||
|
|
5eb232b866 | ||
|
|
ccfdadbd44 |
@@ -69,10 +69,10 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
|
|||||||
# Install Claude
|
# Install Claude
|
||||||
RUN npm install -g @anthropic-ai/claude-code
|
RUN npm install -g @anthropic-ai/claude-code
|
||||||
|
|
||||||
# Copy and set up scripts
|
# Copy and set up firewall script
|
||||||
COPY init-firewall.sh cache-github-api.sh /usr/local/bin/
|
COPY init-firewall.sh /usr/local/bin/
|
||||||
USER root
|
USER root
|
||||||
RUN chmod +x /usr/local/bin/init-firewall.sh /usr/local/bin/cache-github-api.sh && \
|
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
||||||
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
||||||
chmod 0440 /etc/sudoers.d/node-firewall
|
chmod 0440 /etc/sudoers.d/node-firewall
|
||||||
USER node
|
USER node
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Script to cache GitHub API data
|
|
||||||
# Used to prevent rate limiting during container builds
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
# Store cache in the home directory
|
|
||||||
CACHE_DIR="${HOME}/.github-meta-cache"
|
|
||||||
CACHE_FILE="${CACHE_DIR}/meta.json"
|
|
||||||
TIMESTAMP_FILE="${CACHE_DIR}/meta-timestamp.txt"
|
|
||||||
MAX_AGE_SECONDS=3600 # Cache expires after 1 hour
|
|
||||||
|
|
||||||
# Create cache directory if it doesn't exist
|
|
||||||
mkdir -p "${CACHE_DIR}"
|
|
||||||
|
|
||||||
# Function to get current timestamp
|
|
||||||
get_timestamp() {
|
|
||||||
date +%s
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to check if cache is valid
|
|
||||||
is_cache_valid() {
|
|
||||||
if [[ ! -f "${CACHE_FILE}" || ! -f "${TIMESTAMP_FILE}" ]]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local cache_time=$(cat "${TIMESTAMP_FILE}")
|
|
||||||
local current_time=$(get_timestamp)
|
|
||||||
local age=$((current_time - cache_time))
|
|
||||||
|
|
||||||
if [[ ${age} -gt ${MAX_AGE_SECONDS} ]]; then
|
|
||||||
echo "Cache is expired (${age} seconds old)"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using cached GitHub API data (${age} seconds old)"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to fetch data using authenticated gh cli
|
|
||||||
fetch_with_gh() {
|
|
||||||
echo "Attempting to fetch GitHub API data using authenticated gh CLI..."
|
|
||||||
if gh auth status &>/dev/null; then
|
|
||||||
gh api meta > "${CACHE_FILE}" &&
|
|
||||||
get_timestamp > "${TIMESTAMP_FILE}" &&
|
|
||||||
echo "Successfully fetched and cached GitHub API data using gh CLI"
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
echo "gh CLI not authenticated"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to fetch data using curl
|
|
||||||
fetch_with_curl() {
|
|
||||||
echo "Attempting to fetch GitHub API data using curl..."
|
|
||||||
# First try with GITHUB_TOKEN if available
|
|
||||||
if [[ -n "${GITHUB_TOKEN}" ]]; then
|
|
||||||
echo "Using GITHUB_TOKEN for authentication"
|
|
||||||
curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/meta > "${CACHE_FILE}" &&
|
|
||||||
get_timestamp > "${TIMESTAMP_FILE}" &&
|
|
||||||
echo "Successfully fetched and cached GitHub API data using curl with token"
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
# Fall back to unauthenticated request
|
|
||||||
echo "No GITHUB_TOKEN found, making unauthenticated request (may be rate limited)"
|
|
||||||
curl -s https://api.github.com/meta > "${CACHE_FILE}"
|
|
||||||
|
|
||||||
# Check if the response indicates rate limiting
|
|
||||||
if grep -q "API rate limit exceeded" "${CACHE_FILE}"; then
|
|
||||||
echo "Rate limit exceeded for unauthenticated request"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
get_timestamp > "${TIMESTAMP_FILE}"
|
|
||||||
echo "Successfully fetched and cached GitHub API data using curl without auth"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main logic
|
|
||||||
if is_cache_valid; then
|
|
||||||
echo "Using existing cache from $(cat ${TIMESTAMP_FILE})"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try with gh CLI first
|
|
||||||
if ! fetch_with_gh; then
|
|
||||||
# Fall back to curl
|
|
||||||
if ! fetch_with_curl; then
|
|
||||||
# Both methods failed, check if we have an existing cache file
|
|
||||||
if [[ -f "${CACHE_FILE}" ]]; then
|
|
||||||
echo "Warning: Failed to update cache, using existing cached data (which may be expired)"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "Error: Failed to fetch GitHub API data and no cache exists"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Display a summary of the cached data
|
|
||||||
echo "GitHub API meta data cached successfully. Summary:"
|
|
||||||
jq -r '.domains.actions | length' "${CACHE_FILE}" > /dev/null 2>&1 &&
|
|
||||||
echo "- Actions domains: $(jq -r '.domains.actions | length' "${CACHE_FILE}")" ||
|
|
||||||
echo "- Could not parse actions domains from cache file"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -4,9 +4,6 @@
|
|||||||
"dockerfile": "Dockerfile",
|
"dockerfile": "Dockerfile",
|
||||||
"args": {
|
"args": {
|
||||||
"TZ": "${localEnv:TZ:America/Los_Angeles}"
|
"TZ": "${localEnv:TZ:America/Los_Angeles}"
|
||||||
},
|
|
||||||
"prebuild": {
|
|
||||||
"command": "bash -c '${localWorkspaceFolder}/.devcontainer/cache-github-api.sh || echo \"Warning: Failed to cache GitHub API data\"'"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runArgs": [
|
"runArgs": [
|
||||||
@@ -42,8 +39,7 @@
|
|||||||
"remoteUser": "node",
|
"remoteUser": "node",
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=claude-code-bashhistory,target=/commandhistory,type=volume",
|
"source=claude-code-bashhistory,target=/commandhistory,type=volume",
|
||||||
"source=claude-code-config,target=/home/node/.claude,type=volume",
|
"source=claude-code-config,target=/home/node/.claude,type=volume"
|
||||||
"type=bind,source=${localEnv:HOME}/.github-meta-cache,target=/github-meta-cache,consistency=cached"
|
|
||||||
],
|
],
|
||||||
"remoteEnv": {
|
"remoteEnv": {
|
||||||
"NODE_OPTIONS": "--max-old-space-size=4096",
|
"NODE_OPTIONS": "--max-old-space-size=4096",
|
||||||
|
|||||||
@@ -27,20 +27,16 @@ iptables -A OUTPUT -o lo -j ACCEPT
|
|||||||
# Create ipset with CIDR support
|
# Create ipset with CIDR support
|
||||||
ipset create allowed-domains hash:net
|
ipset create allowed-domains hash:net
|
||||||
|
|
||||||
# Use cached GitHub meta information from mounted volume
|
# Fetch GitHub meta information and aggregate + add their IP ranges
|
||||||
CACHE_FILE="/github-meta-cache/meta.json"
|
echo "Fetching GitHub IP ranges..."
|
||||||
|
gh_ranges=$(curl -s https://api.github.com/meta)
|
||||||
|
if [ -z "$gh_ranges" ]; then
|
||||||
|
echo "ERROR: Failed to fetch GitHub IP ranges"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Using cached GitHub IP ranges..."
|
if ! echo "$gh_ranges" | jq -e '.web and .api and .git' >/dev/null; then
|
||||||
if [ -f "${CACHE_FILE}" ]; then
|
echo "ERROR: GitHub API response missing required fields"
|
||||||
gh_ranges=$(cat "${CACHE_FILE}")
|
|
||||||
|
|
||||||
# Verify the cached data is valid
|
|
||||||
if ! echo "$gh_ranges" | jq -e '.web and .api and .git' >/dev/null; then
|
|
||||||
echo "ERROR: Cached GitHub API data is invalid"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "ERROR: No cached GitHub IP ranges found"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
105
CHANGELOG.md
Normal file
105
CHANGELOG.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.69
|
||||||
|
|
||||||
|
- Fixed UI glitches with improved Select component behavior
|
||||||
|
- Enhanced terminal output display with better text truncation logic
|
||||||
|
|
||||||
|
## 0.2.67
|
||||||
|
|
||||||
|
- Shared project permission rules can be saved in .claude/settings.json
|
||||||
|
|
||||||
|
## 0.2.66
|
||||||
|
|
||||||
|
- Print mode (-p) now supports streaming output via --output-format --stream-json
|
||||||
|
- Fixed issue where pasting could trigger memory or bash mode unexpectedly
|
||||||
|
|
||||||
|
## 0.2.63
|
||||||
|
|
||||||
|
- Fixed an issue where MCP tools were loaded twice, which caused tool call errors
|
||||||
|
|
||||||
|
## 0.2.61
|
||||||
|
|
||||||
|
- Navigate menus with vim-style keys (j/k) or bash/emacs shortcuts (Ctrl+n/p) for faster interaction
|
||||||
|
- Enhanced image detection for more reliable clipboard paste functionality
|
||||||
|
- Fixed an issue where ESC key could crash the conversation history selector
|
||||||
|
|
||||||
|
## 0.2.59
|
||||||
|
|
||||||
|
- Copy+paste images directly into your prompt
|
||||||
|
- Improved progress indicators for bash and fetch tools
|
||||||
|
- Bugfixes for non-interactive mode (-p)
|
||||||
|
|
||||||
|
## 0.2.54
|
||||||
|
|
||||||
|
- Quickly add to Memory by starting your message with '#'
|
||||||
|
- Press ctrl+r to see full output for long tool results
|
||||||
|
- Added support for MCP SSE transport
|
||||||
|
|
||||||
|
## 0.2.53
|
||||||
|
|
||||||
|
- New web fetch tool lets Claude view URLs that you paste in
|
||||||
|
- Fixed a bug with JPEG detection
|
||||||
|
|
||||||
|
## 0.2.50
|
||||||
|
|
||||||
|
- New MCP "project" scope now allows you to add MCP servers to .mcp.json files and commit them to your repository
|
||||||
|
|
||||||
|
## 0.2.49
|
||||||
|
|
||||||
|
- Previous MCP server scopes have been renamed: previous "project" scope is now "local" and "global" scope is now "user"
|
||||||
|
|
||||||
|
## 0.2.47
|
||||||
|
|
||||||
|
- Press Tab to auto-complete file and folder names
|
||||||
|
- Press Shift + Tab to toggle auto-accept for file edits
|
||||||
|
- Automatic conversation compaction for infinite conversation length (toggle with /config)
|
||||||
|
|
||||||
|
## 0.2.44
|
||||||
|
|
||||||
|
- Ask Claude to make a plan with thinking mode: just say 'think' or 'think harder' or even 'ultrathink'
|
||||||
|
|
||||||
|
## 0.2.41
|
||||||
|
|
||||||
|
- MCP server startup timeout can now be configured via MCP_TIMEOUT environment variable
|
||||||
|
- MCP server startup no longer blocks the app from starting up
|
||||||
|
|
||||||
|
## 0.2.37
|
||||||
|
|
||||||
|
- New /release-notes command lets you view release notes at any time
|
||||||
|
- `claude config add/remove` commands now accept multiple values separated by commas or spaces
|
||||||
|
|
||||||
|
## 0.2.36
|
||||||
|
|
||||||
|
- Import MCP servers from Claude Desktop with `claude mcp add-from-claude-desktop`
|
||||||
|
- Add MCP servers as JSON strings with `claude mcp add-json <n> <json>`
|
||||||
|
|
||||||
|
## 0.2.34
|
||||||
|
|
||||||
|
- Vim bindings for text input - enable with /vim or /config
|
||||||
|
|
||||||
|
## 0.2.32
|
||||||
|
|
||||||
|
- Interactive MCP setup wizard: Run "claude mcp add" to add MCP servers with a step-by-step interface
|
||||||
|
- Fix for some PersistentShell issues
|
||||||
|
|
||||||
|
## 0.2.31
|
||||||
|
|
||||||
|
- Custom slash commands: Markdown files in .claude/commands/ directories now appear as custom slash commands to insert prompts into your conversation
|
||||||
|
- MCP debug mode: Run with --mcp-debug flag to get more information about MCP server errors
|
||||||
|
|
||||||
|
## 0.2.30
|
||||||
|
|
||||||
|
- Added ANSI color theme for better terminal compatibility
|
||||||
|
- Fixed issue where slash command arguments weren't being sent properly
|
||||||
|
- (Mac-only) API keys are now stored in macOS Keychain
|
||||||
|
|
||||||
|
## 0.2.26
|
||||||
|
|
||||||
|
- New /approved-tools command for managing tool permissions
|
||||||
|
- Word-level diff display for improved code readability
|
||||||
|
- Fuzzy matching for slash commands
|
||||||
|
|
||||||
|
## 0.2.21
|
||||||
|
|
||||||
|
- Fuzzy matching for /commands
|
||||||
Reference in New Issue
Block a user