diff --git a/.changeset/add-zai-glm-4-7-cerebras.md b/.changeset/add-zai-glm-4-7-cerebras.md new file mode 100644 index 00000000000..3c1724379ff --- /dev/null +++ b/.changeset/add-zai-glm-4-7-cerebras.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Add zai-glm-4.7 to Cerebras model list diff --git a/.changeset/chilly-corners-jam.md b/.changeset/chilly-corners-jam.md new file mode 100644 index 00000000000..8ebbc3c570b --- /dev/null +++ b/.changeset/chilly-corners-jam.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Adding support for responses api to OCA provider diff --git a/.changeset/huge-facts-happen.md b/.changeset/huge-facts-happen.md new file mode 100644 index 00000000000..e10949961c7 --- /dev/null +++ b/.changeset/huge-facts-happen.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +add bash command permission system to cline diff --git a/.changeset/revert-8341-diff-truncate.md b/.changeset/revert-8341-diff-truncate.md new file mode 100644 index 00000000000..a57cacf5cfb --- /dev/null +++ b/.changeset/revert-8341-diff-truncate.md @@ -0,0 +1,6 @@ +--- +"claude-dev": patch +--- + +Revert #8341 (0d04205dc) due to regressions in diff view/document truncation (see #8423, #8429). + diff --git a/.changeset/rich-readers-ring.md b/.changeset/rich-readers-ring.md new file mode 100644 index 00000000000..5047b9f44f8 --- /dev/null +++ b/.changeset/rich-readers-ring.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +feat(vercel-ai-gateway): add model refresh and improve reasoning support diff --git a/.changeset/soft-hounds-act.md b/.changeset/soft-hounds-act.md new file mode 100644 index 00000000000..de1052cfaf7 --- /dev/null +++ b/.changeset/soft-hounds-act.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +show cline command permission denials in the CLI diff --git a/.changeset/yellow-actors-promise.md b/.changeset/yellow-actors-promise.md deleted file mode 100644 index 6cd011a7ece..00000000000 --- a/.changeset/yellow-actors-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"claude-dev": patch ---- - -Interactive playwright script diff --git a/.changeset/yellow-bags-sin.md b/.changeset/yellow-bags-sin.md new file mode 100644 index 00000000000..4c8016338df --- /dev/null +++ b/.changeset/yellow-bags-sin.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Reduce the number of network requests for the users profile diff --git a/.changeset/yummy-goats-slide.md b/.changeset/yummy-goats-slide.md new file mode 100644 index 00000000000..37c5a4f95ff --- /dev/null +++ b/.changeset/yummy-goats-slide.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +fix: Verify selected index is not -1 when checking if an option is selectable in the context menu diff --git a/.claude/commands/hotfix-release.md b/.claude/commands/hotfix-release.md new file mode 120000 index 00000000000..354a69e143d --- /dev/null +++ b/.claude/commands/hotfix-release.md @@ -0,0 +1 @@ +../../.clinerules/workflows/hotfix-release.md \ No newline at end of file diff --git a/.claude/commands/release.md b/.claude/commands/release.md new file mode 120000 index 00000000000..98c6c3b9129 --- /dev/null +++ b/.claude/commands/release.md @@ -0,0 +1 @@ +../../.clinerules/workflows/release.md \ No newline at end of file diff --git a/.claude/hooks/claude-code-for-web-setup.sh b/.claude/hooks/claude-code-for-web-setup.sh new file mode 100755 index 00000000000..38cb4298e18 --- /dev/null +++ b/.claude/hooks/claude-code-for-web-setup.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -euo pipefail + +# Only run in Claude Code remote environments +if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then + exit 0 +fi + +cd "$CLAUDE_PROJECT_DIR" + +echo "=== Claude Code for Web Setup ===" +echo "" + +# Install latest gh CLI tool +echo "Installing GitHub CLI..." +GH_VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | grep '"tag_name"' | cut -d'"' -f4 | sed 's/^v//') +curl -sL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz" -o /tmp/gh.tar.gz +tar -xzf /tmp/gh.tar.gz -C /tmp +sudo mv "/tmp/gh_${GH_VERSION}_linux_amd64/bin/gh" /usr/local/bin/gh +rm -rf /tmp/gh.tar.gz /tmp/gh_${GH_VERSION}_linux_amd64 +echo "Installed gh version: $(gh --version | head -1)" +echo "" + +# Check if GITHUB_TOKEN is set and configure gh +if [ -n "${GITHUB_TOKEN:-}" ]; then + echo "GITHUB_TOKEN is configured - gh CLI is ready to use" + echo "" + echo "You can use gh commands directly, for example:" + echo " gh issue list --repo cline/cline --limit 5" + echo " gh pr list --repo cline/cline --state open" + echo " gh issue view 123 --repo cline/cline" + echo "" +else + echo "GITHUB_TOKEN is not set - gh CLI will have limited functionality" + echo "" + echo "To enable full GitHub API access:" + echo "1. Create a Fine-grained Personal Access Token at https://github.com/settings/tokens?type=beta" + echo "2. Add it as GITHUB_TOKEN in your Claude Code environment settings" + echo "" +fi + +# Install project dependencies +echo "Installing dependencies..." +npm run install:all + +# Generate gRPC/protobuf types (required for TypeScript) +echo "Generating proto types..." +npm run protos + +echo "" +echo "Session setup complete!" diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000000..2e612c9c62a --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,14 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/claude-code-for-web-setup.sh" + } + ] + } + ] + } +} diff --git a/.clinerules/hooks/PostToolUse.example b/.clinerules/hooks/PostToolUse.example new file mode 100755 index 00000000000..c77d73f05af --- /dev/null +++ b/.clinerules/hooks/PostToolUse.example @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +echo "PostToolUse running inside local cline/.clinerules/hooks/ directory" + +input=$(cat) +echo $input | jq . + +for i in {1..5}; do + sleep 1 + echo "$i" +done + +cat <> ~/.cline/hook-logs/tool-usage.jsonl + +# Allow execution +echo '{"cancel": false}' +``` + +## Global vs Workspace Hooks + +Cline supports two levels of hooks: + +### Global Hooks +- **Location**: `~/Documents/Cline/Hooks/` (macOS/Linux) +- **Scope**: Apply to ALL workspaces and projects +- **Use Case**: Organization-wide policies, personal preferences, universal validations +- **Priority**: Order not guaranteed when combined with workspace hooks + +### Workspace Hooks +- **Location**: `.clinerules/hooks/` in each workspace root +- **Scope**: Apply only to the specific workspace +- **Use Case**: Project-specific rules, team conventions, repository requirements +- **Priority**: Order not guaranteed when combined with global hooks + +### Hook Execution + +When multiple hooks exist (global and/or workspace): +- All hooks for a given step are executed **concurrently** using `Promise.all` +- **Execution order is not guaranteed** - hooks run in parallel +- If ALL hooks allow execution (`cancel: false`), the tool proceeds +- If ANY hook blocks (`cancel: true`), execution is blocked + +**Result Combination:** +- `cancel`: If ANY hook returns `true`, execution is blocked +- `contextModification`: All context strings are concatenated with double newlines (`\n\n`) +- `errorMessage`: All error messages are concatenated with single newlines (`\n`) + +### Setting Up Global Hooks + +1. The global hooks directory is automatically created at: + - macOS/Linux: `~/Documents/Cline/Hooks/` + +2. Add your hook script: + ```bash + # Unix/Linux/macOS + nano ~/Documents/Cline/Hooks/PreToolUse + chmod +x ~/Documents/Cline/Hooks/PreToolUse + ``` + +3. Enable hooks in Cline settings + +### Example: Global + Workspace Hooks + +**Global Hook** (applies to all projects): +```bash +#!/usr/bin/env bash +# ~/Documents/Cline/Hooks/PreToolUse +# Universal rule: Never delete package.json +input=$(cat) +tool_name=$(echo "$input" | jq -r '.preToolUse.toolName') +path=$(echo "$input" | jq -r '.preToolUse.parameters.path // ""') + +if [[ "$tool_name" == "write_to_file" && "$path" == *"package.json"* ]]; then + echo '{"cancel": true, "errorMessage": "Global policy: Cannot modify package.json"}' + exit 0 +fi + +echo '{"cancel": false}' +``` + +**Workspace Hook** (applies to specific project): +```bash +#!/usr/bin/env bash +# .clinerules/hooks/PreToolUse +# Project rule: Only TypeScript files +input=$(cat) +tool_name=$(echo "$input" | jq -r '.preToolUse.toolName') +path=$(echo "$input" | jq -r '.preToolUse.parameters.path // ""') + +if [[ "$tool_name" == "write_to_file" && "$path" == *.js ]]; then + echo '{"cancel": true, "errorMessage": "Project rule: Use .ts files only"}' + exit 0 +fi + +echo '{"cancel": false}' +``` + +**All hooks must allow execution for the tool to proceed.** Hooks may execute concurrently. + +## Multi-Root Workspaces + +If you have multiple workspace roots, you can place hooks in each root's `.clinerules/hooks/` directory. All hooks (global and workspace) may execute concurrently. Their results will be combined: + +- **cancel**: If ANY hook returns `true`, execution is blocked +- **contextModification**: All context modifications are concatenated +- **errorMessage**: All error messages are concatenated + +**Note:** No execution order is guaranteed between hooks from different directories. + +## Troubleshooting + +### Hook Not Running +- Ensure the "Enable Hooks" setting is checked +- Verify the hook file is executable (`chmod +x hookname`) +- Check the hook file has no syntax errors +- Look for errors in VSCode's Output panel (Cline channel) + +### Hook Timing Out +- Reduce complexity of the hook script +- Avoid expensive operations (network calls, heavy computations) +- Consider moving complex logic to a background process + +### Context Not Affecting Behavior +- Remember: context affects FUTURE decisions, not the current tool +- Ensure context modifications are clear and actionable +- Check that context isn't being truncated (50KB limit) + +## Security Considerations + +- Hooks run with the same permissions as VSCode +- Be cautious with hooks from untrusted sources +- Review hook scripts before enabling them +- Consider using `.gitignore` to avoid committing sensitive hook logic +- Hooks can access all workspace files and environment variables + +## Best Practices + +1. **Keep hooks fast** - Aim for <100ms execution time +2. **Make context actionable** - Be specific about what the AI should do +3. **Use structured prefixes** - Help the AI categorize context +4. **Handle errors gracefully** - Always return valid JSON +5. **Log for debugging** - Keep logs of hook executions for troubleshooting +6. **Test incrementally** - Start with simple hooks and add complexity +7. **Document your hooks** - Add comments explaining the purpose and logic diff --git a/.clinerules/hooks/TaskCancel.example b/.clinerules/hooks/TaskCancel.example new file mode 100755 index 00000000000..bc24a70da1e --- /dev/null +++ b/.clinerules/hooks/TaskCancel.example @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +echo "TaskCancel running inside local cline/.clinerules/hooks/ directory" + +input=$(cat) +echo $input | jq . + +for i in {1..5}; do + sleep 1 + echo "$i" +done + +cat < { + // This calls mockFetch + fetch('https://foo.example').then(...) + }) + // Original fetch is restored immediately when the call returns. +``` + +**Example (Promise):** + +``` +import { mockFetchForTesting } from "@/shared/net" + +... + let mockFetch = ... + await mockFetchForTesting(mockFetch, async () => { + await ... + // This calls mockFetch + await fetch('https://foo.example') + ... + }) + // Original fetch is restored when the Promise from the callback settles +``` + +## Verification + +If you are adding a new network call or integration: +1. Check `@/shared/net.ts` is imported. +2. Ensure `fetch` or `getAxiosSettings` is being used. +3. Verify that third-party clients are configured to use the custom fetch. diff --git a/.clinerules/workflows/address-pr-comments.md b/.clinerules/workflows/address-pr-comments.md new file mode 100644 index 00000000000..5d238cb7b42 --- /dev/null +++ b/.clinerules/workflows/address-pr-comments.md @@ -0,0 +1,29 @@ +# Address PR Comments + +Review and address all comments on the current branch's PR. + +## Steps + +1. Get the current branch name and find the associated PR: + ```bash + gh pr view --json number,title,body + ``` + +2. Understand the PR context: + - Get the full diff: `git diff origin/main...HEAD` + - Read the changed files to understand what the PR is doing + - Read related files if needed to understand the broader context + - Understand the intent and spirit of the changes, not just the code + +3. Fetch all PR comments: + - Inline comments: `gh api repos/{owner}/{repo}/pulls/{pr_number}/comments` + - General comments: `gh pr view {pr_number} --json comments,reviews` + +4. Present a summary of all comments with your recommendation for each (apply, skip, or respond). Ignore bot noise (changeset-bot, CI status, etc.). + +5. **Wait for my approval** before proceeding. + +6. After approval: + - Apply code changes and commit + - Reply to comments that were addressed or intentionally skipped + - Push commits diff --git a/.clinerules/workflows/extension-release.md b/.clinerules/workflows/extension-release.md index a9b03e71dcd..0a3d0421ef5 100644 --- a/.clinerules/workflows/extension-release.md +++ b/.clinerules/workflows/extension-release.md @@ -122,9 +122,9 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => { title="Previous Updates:" classNames={{ trigger: "bg-transparent border-0 pl-0 pb-0 w-fit", - title: "font-bold text-[var(--vscode-foreground)]", + title: "font-bold text-(--vscode-foreground)", indicator: - "text-[var(--vscode-foreground)] mb-0.5 -rotate-180 data-[open=true]:-rotate-90 rtl:rotate-0 rtl:data-[open=true]:-rotate-90", + "text-(--vscode-foreground) mb-0.5 -rotate-180 data-[open=true]:-rotate-90 rtl:rotate-0 rtl:data-[open=true]:-rotate-90", }}>