Compare commits

...

75 Commits

Author SHA1 Message Date
inigo
d81efef324 cleanup
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 10:39:06 -07:00
GitHub Actions
c3a32e4ccf chore: Update CHANGELOG.md 2025-09-08 23:38:38 +00:00
GitHub Actions
2511feadf3 chore: Update CHANGELOG.md 2025-09-08 23:38:22 +00:00
bogini
bdba4a874d Merge pull request #7224 from anthropics/inigo/fix-repository-dispatch
Update workflow
2025-09-05 15:27:14 -07:00
inigo
cd043128fe Update workflow 2025-09-05 15:26:12 -07:00
inigo
8fba17cb99 Fix cross-repo workflow trigger mechanism 2025-09-05 15:15:25 -07:00
bogini
2b3a504f85 Merge pull request #7211 from anthropics/inigo/make-workflow-name-configurable
Add workflow configuration
2025-09-05 10:27:45 -07:00
inigo
1bcc5cf5bd msg 2025-09-05 09:21:33 -07:00
inigo
3e00a44590 Add workflow variable 2025-09-05 09:18:42 -07:00
bogini
702c601369 Merge pull request #7198 from anthropics/inigo/use-workflow-dispatch-for-issue-detective
Update workflow configuration
2025-09-05 00:17:13 -07:00
inigo
542b57b9a4 Update workflow trigger method 2025-09-05 00:16:39 -07:00
bogini
5c2a1e1d2e Merge pull request #7192 from anthropics/inigo/update-issue-notify-repository-dispatch
feat: update issue-notify to use repository_dispatch
2025-09-04 22:30:49 -07:00
inigo
156d9e9e3f feat: update issue-notify to use repository_dispatch
Switch from workflow_dispatch to repository_dispatch for cross-repo
triggering of issue-detective workflow in claude-cli-internal.

Changes:
- Use gh api with repository_dispatch endpoint
- Send issue_url in client_payload
- Support ISSUE_NOTIFY_TOKEN secret for better permissions
- Remove dependency on ISSUE_NOTIFY_WORKFLOW_NAME secret

This enables automatic issue detective analysis when issues are
opened in claude-code repository.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 22:24:51 -07:00
bogini
3404b075ec Merge pull request #7180 from anthropics/inigo/issue-templates
Update issue templates
2025-09-04 21:46:57 -07:00
GitHub Actions
72042e95fb chore: Update CHANGELOG.md 2025-09-05 00:56:17 +00:00
inigo
1feaffa747 Update issue templates
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 17:00:14 -07:00
bogini
7127181c79 Merge pull request #7170 from anthropics/inigo/update-issue-notification-workflow
Update issue notification workflow
2025-09-04 14:31:58 -07:00
inigo
e66b150c0e Update issue notification workflow
- Simplify workflow to use built-in GitHub token
- Remove external dependencies
- Improve error handling and logging
2025-09-04 14:28:04 -07:00
Dalton Flanagan
dbff8bea24 Merge pull request #7101 from anthropics/dalton/readme-update-data-usage
Update README.md data usage section
2025-09-03 19:33:09 -07:00
Dalton Flanagan
5a2442227a Update README.md data usage section
Link to the official page for the most up-to-date, accurate information
2025-09-03 19:04:05 -07:00
bogini
f5dd15ac7e Merge pull request #7092 from anthropics/workflow-update-2024
Update workflow configuration
2025-09-03 16:28:04 -07:00
Iñigo Beitia Arévalo
c0a28eede9 Add workflow configuration 2025-09-03 23:25:19 +00:00
GitHub Actions
81f65bea8a chore: Update CHANGELOG.md 2025-08-29 21:24:20 +00:00
Boris Cherny
dc8f77c7ef Merge pull request #5881 from anthropics/boris/iuni
feat: update dedupe backfill script to filter by issue number
2025-08-28 16:26:35 -07:00
Boris Cherny
786259a00c Merge pull request #6387 from anthropics/boris/oauy
Add issue close event trigger to log-issue-events workflow
2025-08-28 16:24:42 -07:00
GitHub Actions
8e679e75f7 chore: Update CHANGELOG.md 2025-08-27 21:53:37 +00:00
ant-kurt
87560460bc Merge pull request #6684 from anthropics/feat/devcontainer-claude-extension-and-vscode-urls
feat(devcontainer): add Claude Code extension and VS Code marketplace URLs
2025-08-27 14:30:12 -07:00
Kurt Carpenter
07e13937b2 feat(devcontainer): add Claude Code extension and VS Code marketplace URLs
- Add anthropic.claude-code extension to default extensions list
- Allow VS Code marketplace URLs in firewall configuration:
  - marketplace.visualstudio.com (marketplace API)
  - vscode.blob.core.windows.net (extension downloads)
  - update.code.visualstudio.com (VS Code updates/metadata)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 14:18:30 -07:00
ant-kurt
55988caadf Merge pull request #5842 from suwakei/fix/ps1
Improving the robustness of prerequisite checks
2025-08-26 17:58:52 -07:00
ant-kurt
8beb9b0c76 Merge pull request #6182 from nozokare/fix-devcontainer-firewall-reset
fix: ensure firewall rules are re-applied on every DevContainer start
2025-08-26 17:28:18 -07:00
ant-kurt
4607d83fa8 Merge pull request #6218 from rquintino/feat(devcontainer)use-firewall-reject-rule-for-immediate-feedback-instead-of-+2min-timeouts
feat(devcontainer): Use firewall reject rule for immediate feedback instead of +2min timeouts
2025-08-26 17:18:05 -07:00
ant-kurt
70d5361861 Merge pull request #6509 from arsenx/deprication-docker-env
chore: Update Dockerfile deprecated ENV usage
2025-08-26 17:04:09 -07:00
GitHub Actions
c792b7d4c7 chore: Update CHANGELOG.md 2025-08-26 22:53:44 +00:00
Arsen Hovhanissian
5f52517c0b chore: Update Dockerfile to standardize environment variable assignments for editor 2025-08-25 12:23:29 +03:00
GitHub Actions
cc09d58e8e chore: Update CHANGELOG.md 2025-08-25 01:58:04 +00:00
Boris Cherny
d820a4dbd7 Add issue close event trigger to log-issue-events workflow
Updates the GitHub workflow to also trigger when issues are closed,
expanding event tracking beyond just issue creation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 18:30:52 -07:00
GitHub Actions
eb0e43457b chore: Update CHANGELOG.md 2025-08-22 01:21:59 +00:00
GitHub Actions
b417bfc532 chore: Update CHANGELOG.md 2025-08-22 00:59:57 +00:00
Rui Quintino
2b46e47360 update to icmp-admin-prohibited
makes more sense for the intended usage
2025-08-20 23:41:38 +01:00
Rui Quintino
c58a7da257 add Explicit REJECT
Allows for immediate (~20ms) for any blocked call instead of long timeout
2025-08-20 23:17:44 +01:00
Dickson Tsai
239aeb55ee Merge pull request #6202 from anthropics/dickson/discord
Add Discord to README.md
2025-08-20 11:09:29 -07:00
Dickson Tsai
f4e707fdcc Add Discord to README.md 2025-08-20 11:07:32 -07:00
nozokare
6d79459b16 fix: ensure firewall rules are re-applied on every DevContainer start 2025-08-20 18:37:24 +09:00
GitHub Actions
d2f88820c9 chore: Update CHANGELOG.md 2025-08-19 23:59:26 +00:00
ant-kurt
a3620cdd0b Merge pull request #5872 from backpaper0/remove-cname-on-domain-ip-resolution
fix: improve DNS resolution in firewall script to filter CNAME records
2025-08-19 11:23:35 -07:00
GitHub Actions
da6d2f715e chore: Update CHANGELOG.md 2025-08-18 23:43:38 +00:00
GitHub Actions
f200ab3c5c chore: Update CHANGELOG.md 2025-08-18 23:19:02 +00:00
Boris Cherny
fa29b8f9c0 Merge pull request #6047 from anthropics/boris/adbf
Re-add log-issue-events workflow with security fix
2025-08-18 13:27:03 -07:00
GitHub Actions
2558619a83 chore: Update CHANGELOG.md 2025-08-18 20:06:51 +00:00
Boris Cherny
80ceacaa78 Re-add log-issue-events workflow with security fix
Re-implements the workflow removed in #5919, but with proper security:
- All GitHub event data is now passed via environment variables
- No direct templating of values into shell commands
- Prevents remote code execution through malicious issue titles
- Still escapes quotes in JSON payload for proper formatting

This fixes the security vulnerability while maintaining the functionality
of logging issue creation events to Statsig.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 09:56:56 -07:00
Boris Cherny
20ba9a34a5 feat: update dedupe backfill script to filter by issue number
Replace date-based filtering with issue number filtering to only process issues older than #4050. This provides more precise control over which issues are processed for duplicate detection backfill.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 09:54:40 -07:00
Chris Lloyd
4e63568abd Merge pull request #5919 from anthropics/chrislloyd/8a49b1
Remove log-issue-events workflow
2025-08-16 07:32:25 -07:00
Chris Lloyd
5d0b81ae41 Remove log-issue-events workflow 2025-08-16 07:26:53 -07:00
GitHub Actions
b1751f2e86 chore: Update CHANGELOG.md 2025-08-16 00:11:04 +00:00
Uragami Taichi
eb48d5e4a8 fix: improve DNS resolution in firewall script to filter CNAME records 2025-08-16 06:38:34 +09:00
Boris Cherny
fc8c10995f Merge pull request #5858 from anthropics/boris/vreg
fix: update auto-close-duplicates workflow permissions to write
2025-08-15 10:57:02 -07:00
Boris Cherny
01fb7af5b3 fix: update auto-close-duplicates workflow permissions to write
Change issues permission from read to write to fix 403 Forbidden
errors when attempting to close duplicate issues.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 10:55:50 -07:00
keitosuwahara
10a1f7dab9 Improving the robustness of prerequisite checks 2025-08-15 23:38:40 +09:00
Boris Cherny
afb0fc9156 Merge pull request #5802 from anthropics/boris/jymy
fix: improve duplicate issue number extraction in auto-close script
2025-08-14 16:38:49 -07:00
Boris Cherny
370a97d939 fix: improve duplicate issue number extraction in auto-close script
The extractDuplicateIssueNumber function now handles both #123 format
and full GitHub issue URLs like https://github.com/owner/repo/issues/123.
This fixes the "could not extract duplicate issue number from comment"
errors that were occurring when the script encountered URL-formatted
issue references in duplicate detection comments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 16:37:46 -07:00
GitHub Actions
f54569efd2 chore: Update CHANGELOG.md 2025-08-14 20:13:16 +00:00
GitHub Actions
d8cf5a874c chore: Update CHANGELOG.md 2025-08-14 16:59:55 +00:00
GitHub Actions
e499db6e9e chore: Update CHANGELOG.md 2025-08-11 23:43:35 +00:00
Boris Cherny
5300e12135 Merge pull request #5569 from anthropics/boris/limc
Consolidate GitHub issue closure events
2025-08-11 16:07:18 -07:00
Boris Cherny
4a04589002 Use proper 'duplicate' state_reason for issue closures
- Update auto-close script to use state_reason: 'duplicate' instead of 'not_planned'
- Simplify workflow detection logic to only check for duplicate state_reason
- Remove fallback logic for backward compatibility - use modern GitHub API

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 15:44:08 -07:00
Boris Cherny
04cace9ec0 Consolidate GitHub issue closure events to prevent duplicates
- Remove duplicate Statsig logging from auto-close-duplicates.ts
- GitHub workflow now handles all issue closures uniformly
- Add 'duplicate' label to ensure proper detection by workflow
- Prevents double-logging when script closes issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 15:33:31 -07:00
Boris Cherny
2dbf1e97a0 Merge pull request #5564 from anthropics/boris/lptz
Fix GitHub Actions workflow to properly escape issue titles
2025-08-11 13:49:50 -07:00
Boris Cherny
0662600e93 Fix GitHub Actions workflow to properly escape issue titles
Prevents shell execution of backticks in issue titles by using single quotes and sed escaping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 13:38:40 -07:00
Boris Cherny
27d2c6fdcf Merge pull request #5562 from anthropics/boris/zivm
Add GitHub workflow logging for issue closure events
2025-08-11 13:17:26 -07:00
GitHub Actions
dd53f86325 chore: Update CHANGELOG.md 2025-08-11 20:15:53 +00:00
Boris Cherny
c40c658e1f Add GitHub workflow logging for issue closure events
Extends the existing log-issue-events workflow to capture detailed metrics when issues are closed, including:
- Who closed the issue
- Whether it was closed automatically (by a bot)
- Whether it was closed as a duplicate
- Number of comments and reactions at closing time
- Issue state reason and timestamp

This provides comprehensive analytics for issue lifecycle tracking alongside the existing issue creation logging.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 13:13:52 -07:00
Ashwin Bhat
e05411140d Remove timeout-minutes from lock-closed-issues workflow (#5455)
The 10-minute timeout is unnecessary for this workflow as it typically
completes quickly. Removing it allows the workflow to use the default
GitHub Actions timeout (6 hours for public repos, 72 hours for private),
providing more flexibility if the workflow needs to process a large
number of issues.

Also fixed trailing whitespace inconsistencies in the script.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-09 10:58:52 -07:00
Boris Cherny
ce5b9164fa Merge pull request #5429 from anthropics/boris/bzxy
Add Statsig event logging to GitHub issue workflows
2025-08-08 18:46:52 -07:00
Boris Cherny
5af0b38a92 Add Statsig event logging to GitHub issue workflows
- Log events when issues are closed as duplicates in auto-close script
- Log events when duplicate comments are added via dedupe workflow
- Log events when new issues are created
- Follow existing pattern from code review reactions workflow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 18:26:48 -07:00
Boris Cherny
22946869b2 Merge pull request #5423 from anthropics/boris/uqbo
Rename auto-close duplicate issues workflow to remove "dry run"
2025-08-08 17:28:36 -07:00
20 changed files with 863 additions and 617 deletions

View File

@@ -65,8 +65,8 @@ ENV PATH=$PATH:/usr/local/share/npm-global/bin
ENV SHELL=/bin/zsh
# Set the default editor and visual
ENV EDITOR nano
ENV VISUAL nano
ENV EDITOR=nano
ENV VISUAL=nano
# Default powerline10k theme
ARG ZSH_IN_DOCKER_VERSION=1.2.0

View File

@@ -16,6 +16,7 @@
"customizations": {
"vscode": {
"extensions": [
"anthropic.claude-code",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"eamodio.gitlens"
@@ -51,5 +52,6 @@
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/workspace",
"postCreateCommand": "sudo /usr/local/bin/init-firewall.sh"
"postStartCommand": "sudo /usr/local/bin/init-firewall.sh",
"waitFor": "postStartCommand"
}

View File

@@ -69,9 +69,12 @@ for domain in \
"api.anthropic.com" \
"sentry.io" \
"statsig.anthropic.com" \
"statsig.com"; do
"statsig.com" \
"marketplace.visualstudio.com" \
"vscode.blob.core.windows.net" \
"update.code.visualstudio.com"; do
echo "Resolving $domain..."
ips=$(dig +short A "$domain")
ips=$(dig +noall +answer A "$domain" | awk '$4 == "A" {print $5}')
if [ -z "$ips" ]; then
echo "ERROR: Failed to resolve $domain"
exit 1
@@ -113,6 +116,9 @@ iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Then allow only specific outbound traffic to allowed domains
iptables -A OUTPUT -m set --match-set allowed-domains dst -j ACCEPT
# Explicitly REJECT all other outbound traffic for immediate feedback
iptables -A OUTPUT -j REJECT --reject-with icmp-admin-prohibited
echo "Firewall configuration complete"
echo "Verifying firewall rules..."
if curl --connect-timeout 5 https://example.com >/dev/null 2>&1; then

View File

@@ -1,34 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---
## Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: <!-- output of `claude --version` -->
- Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
- Terminal: <!-- e.g. iTerm2, Terminal App -->
## Bug Description
<!-- A clear and concise description of the bug -->
## Steps to Reproduce
1. <!-- First step -->
2. <!-- Second step -->
3. <!-- And so on... -->
## Expected Behavior
<!-- What you expected to happen -->
## Actual Behavior
<!-- What actually happened -->
## Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

188
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,188 @@
name: 🐛 Bug Report
description: Report a bug or unexpected behavior in Claude Code
title: "[BUG] "
labels:
- bug
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report this bug! Please fill out the sections below to help us understand and fix the issue.
Before submitting, please check:
- You're using the [latest version](https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=versions) of Claude Code (`claude --version`)
- This issue hasn't already been reported by searching [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug).
- This is a bug, not a feature request or support question
- type: checkboxes
id: preflight
attributes:
label: Preflight Checklist
description: Please confirm before submitting
options:
- label: I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
required: true
- label: This is a single bug report (please file separate reports for different bugs)
required: true
- label: I am using the latest version of Claude Code
required: true
- type: textarea
id: actual
attributes:
label: What's Wrong?
description: Describe what's happening that shouldn't be
placeholder: |
When I try to create a Python file, Claude shows an error "EACCES: permission denied" and the file isn't created.
The command fails immediately after accepting the file write permission...
validations:
required: true
- type: textarea
id: expected
attributes:
label: What Should Happen?
description: Describe the expected behavior
placeholder: Claude should create a Python script file successfully without errors
validations:
required: true
- type: textarea
id: error_output
attributes:
label: Error Messages/Logs
description: If you see any error messages, paste them here
placeholder: |
Paste any error output, stack traces, or relevant logs here.
This will be automatically formatted as code.
render: shell
validations:
required: false
- type: textarea
id: reproduction
attributes:
label: Steps to Reproduce
description: |
Please provide clear, numbered steps that anyone can follow to reproduce the issue.
**Important**: Include any necessary code, file contents, or context needed to reproduce the bug.
If the issue involves specific files or code, please create a minimal example.
placeholder: |
1. Create a file `test.py` with this content:
```python
def hello():
print("test")
```
2. Run `claude "add type hints to test.py"`
3. When prompted for file access, accept
4. Error appears: "Unable to parse..."
Note: The bug only happens with Python files containing...
validations:
required: true
- type: dropdown
id: model
attributes:
label: Claude Model
description: Which model were you using? (Run `/model` to check)
options:
- Sonnet (default)
- Opus
- Not sure / Multiple models
- Other
validations:
required: false
- type: dropdown
id: regression
attributes:
label: Is this a regression?
description: Did this work in a previous version?
options:
- "Yes, this worked in a previous version"
- "No, this never worked"
- "I don't know"
validations:
required: true
- type: input
id: working_version
attributes:
label: Last Working Version
description: If this is a regression, which version last worked? This helps expedite a fix.
placeholder: "e.g., 1.0.100"
validations:
required: false
- type: input
id: version
attributes:
label: Claude Code Version
description: Run `claude --version` and paste the output
placeholder: "e.g., 1.0.123 (Claude Code)"
validations:
required: true
- type: dropdown
id: platform
attributes:
label: Platform
description: Which API platform are you using?
options:
- Anthropic API
- AWS Bedrock
- Google Vertex AI
- Other
validations:
required: true
- type: dropdown
id: os
attributes:
label: Operating System
options:
- macOS
- Windows
- Ubuntu/Debian Linux
- Other Linux
- Other
validations:
required: true
- type: dropdown
id: terminal
attributes:
label: Terminal/Shell
description: Which terminal are you using?
options:
- Terminal.app (macOS)
- Warp
- Cursor
- iTerm2
- IntelliJ IDEA terminal
- VS Code integrated terminal
- PyCharm terminal
- Windows Terminal
- PowerShell
- WSL (Windows Subsystem for Linux)
- Xterm
- Non-interactive/CI environment
- Other
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional Information
description: |
Anything else that might help us understand the issue?
- Screenshots (drag and drop images here)
- Configuration files
- Related files or code
- Links to repositories demonstrating the issue
placeholder: Any additional context, screenshots, or information...
validations:
required: false

17
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
blank_issues_enabled: false
contact_links:
- name: 💬 Discord Community
url: https://anthropic.com/discord
about: Get help, ask questions, and chat with other Claude Code users
- name: 📖 Documentation
url: https://docs.anthropic.com/en/docs/claude-code
about: Read the official documentation and guides
- name: 🎓 Getting Started Guide
url: https://docs.anthropic.com/en/docs/claude-code/getting-started
about: New to Claude Code? Start here
- name: 🔧 Troubleshooting Guide
url: https://docs.anthropic.com/en/docs/claude-code/troubleshooting
about: Common issues and how to fix them
- name: 💡 Discussions
url: https://github.com/anthropics/claude-code/discussions
about: Share ideas, tips, and chat with maintainers

117
.github/ISSUE_TEMPLATE/documentation.yml vendored Normal file
View File

@@ -0,0 +1,117 @@
name: 📚 Documentation Issue
description: Report missing, unclear, or incorrect documentation
title: "[DOCS] "
labels:
- documentation
body:
- type: markdown
attributes:
value: |
## Help us improve our documentation!
Good documentation is crucial for a great developer experience. Please let us know what's missing or confusing.
- type: dropdown
id: doc_type
attributes:
label: Documentation Type
description: What kind of documentation issue is this?
options:
- Missing documentation (feature not documented)
- Unclear/confusing documentation
- Incorrect/outdated documentation
- Typo or formatting issue
- Missing code examples
- Broken links
- Other
validations:
required: true
- type: input
id: location
attributes:
label: Documentation Location
description: Where did you encounter this issue? Provide a URL if possible
placeholder: "e.g., https://docs.anthropic.com/en/docs/claude-code/getting-started"
validations:
required: false
- type: input
id: section
attributes:
label: Section/Topic
description: Which specific section or topic needs improvement?
placeholder: "e.g., MCP Server Configuration section"
validations:
required: true
- type: textarea
id: current
attributes:
label: Current Documentation
description: |
What does the documentation currently say?
Quote the specific text if applicable.
placeholder: |
The docs currently say:
"To configure MCP servers, add them to your configuration..."
But it doesn't explain...
validations:
required: false
- type: textarea
id: issue
attributes:
label: What's Wrong or Missing?
description: Explain what's incorrect, unclear, or missing
placeholder: |
The documentation doesn't explain how to:
- Configure multiple MCP servers
- Handle authentication
- Debug connection issues
The example code doesn't work because...
validations:
required: true
- type: textarea
id: suggested
attributes:
label: Suggested Improvement
description: How should the documentation be improved? Provide suggested text if possible
placeholder: |
The documentation should include:
1. A complete example showing...
2. Explanation of common errors like...
3. Step-by-step guide for...
Suggested text:
"To configure multiple MCP servers, create an array in your settings..."
validations:
required: true
- type: dropdown
id: impact
attributes:
label: Impact
description: How much does this documentation issue affect users?
options:
- High - Prevents users from using a feature
- Medium - Makes feature difficult to understand
- Low - Minor confusion or inconvenience
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional Context
description: |
- Screenshots showing the issue
- Links to related documentation
- Examples from other projects that do this well
placeholder: Any additional information that would help...
validations:
required: false

View File

@@ -0,0 +1,132 @@
name: ✨ Feature Request
description: Suggest a new feature or enhancement for Claude Code
title: "[FEATURE] "
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
## Thanks for suggesting a feature!
We love hearing ideas from our community. Please help us understand your use case by filling out the sections below.
Before submitting, please check if this feature has already been requested.
- type: checkboxes
id: preflight
attributes:
label: Preflight Checklist
options:
- label: I have searched [existing requests](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20label%3Aenhancement) and this feature hasn't been requested yet
required: true
- label: This is a single feature request (not multiple features)
required: true
- type: textarea
id: problem
attributes:
label: Problem Statement
description: |
What problem are you trying to solve? Why do you need this feature?
Focus on the problem, not the solution. Help us understand your workflow.
placeholder: |
I often need to work with multiple projects simultaneously, but Claude Code doesn't support...
When I'm debugging code, I find it difficult to...
The current workflow requires me to manually...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: |
How would you like this to work? Describe the ideal user experience.
Be specific about how you'd interact with this feature.
placeholder: |
I'd like to be able to run `claude --workspace project1,project2` to...
There should be a command or setting that allows...
The interface should show...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternative Solutions
description: |
What alternatives have you considered or tried?
Are there workarounds you're currently using?
placeholder: |
I've tried using multiple terminal windows but...
Currently I work around this by...
Other tools solve this by...
validations:
required: false
- type: dropdown
id: priority
attributes:
label: Priority
description: How important is this feature to your workflow?
options:
- Critical - Blocking my work
- High - Significant impact on productivity
- Medium - Would be very helpful
- Low - Nice to have
validations:
required: true
- type: dropdown
id: category
attributes:
label: Feature Category
description: What area does this feature relate to?
options:
- CLI commands and flags
- Interactive mode (TUI)
- File operations
- API and model interactions
- MCP server integration
- Performance and speed
- Configuration and settings
- Developer tools/SDK
- Documentation
- Other
validations:
required: true
- type: textarea
id: use_case
attributes:
label: Use Case Example
description: |
Provide a concrete, real-world example of when you'd use this feature.
Walk us through a scenario step-by-step.
placeholder: |
Example scenario:
1. I'm working on a React app with a Node.js backend
2. I need to make changes to both frontend and backend
3. With this feature, I could...
4. This would save me time because...
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional Context
description: |
- Screenshots or mockups of the proposed feature
- Links to similar features in other tools
- Technical considerations or constraints
- Any other relevant information
placeholder: Add any other context, mockups, or examples here...
validations:
required: false

View File

@@ -0,0 +1,220 @@
name: 🤖 Model Behavior Issue
description: Report unexpected Claude model behavior, incorrect actions, or permission violations
title: "[MODEL] "
labels:
- model
body:
- type: markdown
attributes:
value: |
## Report Unexpected Model Behavior
Use this template when Claude does something unexpected, makes unwanted changes, or behaves inconsistently with your instructions.
**This is for:** Unexpected actions, file modifications outside scope, ignoring instructions, making assumptions
**NOT for:** Crashes, API errors, or installation issues (use Bug Report instead)
- type: checkboxes
id: preflight
attributes:
label: Preflight Checklist
description: Please confirm before submitting
options:
- label: I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Amodel) for similar behavior reports
required: true
- label: This report does NOT contain sensitive information (API keys, passwords, etc.)
required: true
- type: dropdown
id: behavior_type
attributes:
label: Type of Behavior Issue
description: What category best describes the unexpected behavior?
options:
- Claude modified files I didn't ask it to modify
- Claude accessed files outside the working directory
- Claude ignored my instructions or configuration
- Claude reverted/undid previous changes without asking
- Claude made incorrect assumptions about my project
- Claude refused a reasonable request
- Claude's behavior changed between sessions
- Subagent behaved unexpectedly
- Other unexpected behavior
validations:
required: true
- type: textarea
id: what_you_asked
attributes:
label: What You Asked Claude to Do
description: Provide the exact prompt or command you gave
placeholder: |
I asked: "Update the README.md file to add installation instructions"
Or I ran: `claude "fix the bug in auth.js"`
validations:
required: true
- type: textarea
id: what_claude_did
attributes:
label: What Claude Actually Did
description: Describe step-by-step what Claude did instead
placeholder: |
1. Claude read README.md
2. Instead of updating it, Claude deleted the entire file
3. Created a new README from scratch with different content
4. Also modified package.json without being asked
5. Changed .gitignore file
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: Expected Behavior
description: What should Claude have done?
placeholder: |
Claude should have:
1. Read the existing README.md
2. Added an "Installation" section
3. Only modified that single file
4. Not touched any other files
validations:
required: true
- type: textarea
id: files_affected
attributes:
label: Files Affected
description: |
List all files that were accessed or modified (even if you didn't expect them to be)
placeholder: |
Modified:
- README.md (deleted and recreated)
- package.json (version bumped - not requested)
- .gitignore (added entries - not requested)
Read (unexpectedly):
- /Users/me/.ssh/config
- ../../../parent-directory/secrets.env
render: shell
validations:
required: false
- type: dropdown
id: permission_mode
attributes:
label: Permission Mode
description: What permission settings were active?
options:
- Accept Edits was ON (auto-accepting changes)
- Accept Edits was OFF (manual approval required)
- I don't know / Not sure
validations:
required: true
- type: dropdown
id: reproducible
attributes:
label: Can You Reproduce This?
description: Does this happen consistently?
options:
- Yes, every time with the same prompt
- Sometimes (intermittent)
- No, only happened once
- Haven't tried to reproduce
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: Steps to Reproduce
description: If reproducible, provide minimal steps
placeholder: |
1. Create a new directory with a simple README.md
2. Ask Claude Code to "improve the README"
3. Claude will delete and recreate the file instead of editing
validations:
required: false
- type: dropdown
id: model
attributes:
label: Claude Model
description: Which model were you using? (Run `/model` to check)
options:
- Sonnet
- Opus
- Haiku
- Not sure
- Other
validations:
required: true
- type: textarea
id: conversation_log
attributes:
label: Relevant Conversation
description: |
Include relevant parts of Claude's responses, especially where it explains what it's doing
placeholder: |
Claude said: "I'll help you update the README. Let me first delete the old one and create a fresh version..."
[Then proceeded to delete without asking for confirmation]
render: markdown
validations:
required: false
- type: dropdown
id: impact
attributes:
label: Impact
description: How severe was the impact of this behavior?
options:
- Critical - Data loss or corrupted project
- High - Significant unwanted changes
- Medium - Extra work to undo changes
- Low - Minor inconvenience
validations:
required: true
- type: input
id: version
attributes:
label: Claude Code Version
description: Run `claude --version` and paste the output
placeholder: "e.g., 1.0.123 (Claude Code)"
validations:
required: true
- type: dropdown
id: platform
attributes:
label: Platform
description: Which API platform are you using?
options:
- Anthropic API
- AWS Bedrock
- Google Vertex AI
- Other
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional Context
description: |
- Any patterns you've noticed
- Similar behavior in other sessions
- Specific file types or project structures that trigger this
- Screenshots if relevant
placeholder: |
This seems to happen more often with:
- Python projects
- When there are multiple similar files
- After long conversations
validations:
required: false

View File

@@ -1,30 +0,0 @@
name: Auto-close duplicate issues
description: Auto-closes issues that are duplicates of existing issues
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
auto-close-duplicates:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Auto-close duplicate issues
run: bun run scripts/auto-close-duplicates.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}

View File

@@ -1,44 +0,0 @@
name: Backfill Duplicate Comments
description: Triggers duplicate detection for old issues that don't have duplicate comments
on:
workflow_dispatch:
inputs:
days_back:
description: 'How many days back to look for old issues'
required: false
default: '90'
type: string
dry_run:
description: 'Dry run mode (true to only log what would be done)'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
jobs:
backfill-duplicate-comments:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
issues: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Backfill duplicate comments
run: bun run scripts/backfill-duplicate-comments.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DAYS_BACK: ${{ inputs.days_back }}
DRY_RUN: ${{ inputs.dry_run }}

View File

@@ -1,31 +0,0 @@
name: Claude Issue Dedupe
description: Automatically dedupe GitHub issues using Claude Code
on:
issues:
types: [opened]
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number to process for duplicate detection'
required: true
type: string
jobs:
claude-dedupe-issues:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Claude Code slash command
uses: anthropics/claude-code-base-action@beta
with:
prompt: "/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_env: |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,28 @@
name: Issue Opened Dispatch
on:
issues:
types: [opened]
permissions:
issues: read
actions: write
jobs:
notify:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Process new issue
env:
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
TARGET_REPO: ${{ secrets.ISSUE_OPENED_DISPATCH_TARGET_REPO }}
GH_TOKEN: ${{ secrets.ISSUE_OPENED_DISPATCH_TOKEN }}
run: |
gh api repos/${TARGET_REPO}/dispatches \
-f event_type=issue_opened \
-f client_payload[issue_url]="${ISSUE_URL}" || {
exit 0
}

View File

@@ -15,7 +15,6 @@ concurrency:
jobs:
lock-closed-issues:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Lock closed issues after 7 days of inactivity
uses: actions/github-script@v7
@@ -23,13 +22,13 @@ jobs:
script: |
const sevenDaysAgo = new Date();
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
const lockComment = `This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.`;
let page = 1;
let hasMore = true;
let totalLocked = 0;
while (hasMore) {
// Get closed issues (pagination)
const { data: issues } = await github.rest.issues.listForRepo({
@@ -89,5 +88,5 @@ jobs:
page++;
}
console.log(`Total issues locked: ${totalLocked}`);

40
.github/workflows/log-issue-events.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Log Issue Events to Statsig
on:
issues:
types: [opened, closed]
jobs:
log-to-statsig:
runs-on: ubuntu-latest
permissions:
issues: read
steps:
- name: Log issue creation to Statsig
env:
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
ISSUE_TITLE: ${{ github.event.issue.title }}
AUTHOR: ${{ github.event.issue.user.login }}
CREATED_AT: ${{ github.event.issue.created_at }}
run: |
# All values are now safely passed via environment variables
# No direct templating in the shell script to prevent injection attacks
curl -X POST "https://events.statsigapi.net/v1/log_event" \
-H "Content-Type: application/json" \
-H "statsig-api-key: $STATSIG_API_KEY" \
-d '{
"events": [{
"eventName": "github_issue_created",
"metadata": {
"issue_number": "'"$ISSUE_NUMBER"'",
"repository": "'"$REPO"'",
"title": "'"$(echo "$ISSUE_TITLE" | sed "s/\"/\\\\\"/g")"'",
"author": "'"$AUTHOR"'",
"created_at": "'"$CREATED_AT"'"
},
"time": '"$(date +%s)000"'
}]
}'

View File

@@ -1,5 +1,96 @@
# Changelog
## 1.0.106
- Windows: Fixed path permission matching to consistently use POSIX format (e.g., `Read(//c/Users/...)`)
## 1.0.97
- Settings: /doctor now validates permission rule syntax and suggests corrections
## 1.0.94
- Vertex: add support for global endpoints for supported models
- /memory command now allows direct editing of all imported memory files
- SDK: Add custom tools as callbacks
- Added /todos command to list current todo items
## 1.0.93
- Windows: Add alt + v shortcut for pasting images from clipboard
- Support NO_PROXY environment variable to bypass proxy for specified hostnames and IPs
## 1.0.90
- Settings file changes take effect immediately - no restart required
## 1.0.88
- Fixed issue causing "OAuth authentication is currently not supported"
- Status line input now includes `exceeds_200k_tokens`
- Fixed incorrect usage tracking in /cost.
- Introduced `ANTHROPIC_DEFAULT_SONNET_MODEL` and `ANTHROPIC_DEFAULT_OPUS_MODEL` for controlling model aliases opusplan, opus, and sonnet.
- Bedrock: Updated default Sonnet model to Sonnet 4
## 1.0.86
- Added /context to help users self-serve debug context issues
- SDK: Added UUID support for all SDK messages
- SDK: Added `--replay-user-messages` to replay user messages back to stdout
## 1.0.85
- Status line input now includes session cost info
- Hooks: Introduced SessionEnd hook
## 1.0.84
- Fix tool_use/tool_result id mismatch error when network is unstable
- Fix Claude sometimes ignoring real-time steering when wrapping up a task
- @-mention: Add ~/.claude/\* files to suggestions for easier agent, output style, and slash command editing
- Use built-in ripgrep by default; to opt out of this behavior, set USE_BUILTIN_RIPGREP=0
## 1.0.83
- @-mention: Support files with spaces in path
- New shimmering spinner
## 1.0.82
- SDK: Add request cancellation support
- SDK: New additionalDirectories option to search custom paths, improved slash command processing
- Settings: Validation prevents invalid fields in .claude/settings.json files
- MCP: Improve tool name consistency
- Bash: Fix crash when Claude tries to automatically read large files
## 1.0.81
- Released output styles, including new built-in educational output styles "Explanatory" and "Learning". Docs: https://docs.anthropic.com/en/docs/claude-code/output-styles
- Agents: Fix custom agent loading when agent files are unparsable
## 1.0.80
- UI improvements: Fix text contrast for custom subagent colors and spinner rendering issues
## 1.0.77
- Bash tool: Fix heredoc and multiline string escaping, improve stderr redirection handling
- SDK: Add session support and permission denial tracking
- Fix token limit errors in conversation summarization
- Opus Plan Mode: New setting in `/model` to run Opus only in plan mode, Sonnet otherwise
## 1.0.73
- MCP: Support multiple config files with `--mcp-config file1.json file2.json`
- MCP: Press Esc to cancel OAuth authentication flows
- Bash: Improved command validation and reduced false security warnings
- UI: Enhanced spinner animations and status line visual hierarchy
- Linux: Added support for Alpine and musl-based distributions (requires separate ripgrep installation)
## 1.0.72
- Ask permissions: have Claude Code always ask for confirmation to use specific tools with /permissions
## 1.0.71
- Background commands: (Ctrl-b) to run any Bash command in the background so Claude can keep working (great for dev servers, tailing logs, etc.)

View File

@@ -24,15 +24,17 @@ npm install -g @anthropic-ai/claude-code
We welcome your feedback. Use the `/bug` command to report issues directly within Claude Code, or file a [GitHub issue](https://github.com/anthropics/claude-code/issues).
## Connect on Discord
Join the [Claude Developers Discord](https://anthropic.com/discord) to connect with other developers using Claude Code. Get help, share feedback, and discuss your projects with the community.
## Data collection, usage, and retention
When you use Claude Code, we collect feedback, which includes usage data (such as code acceptance or rejections), associated conversation data, and user feedback submitted via the `/bug` command.
### How we use your data
We may use feedback to improve our products and services, but we will not train generative models using your feedback from Claude Code. Given their potentially sensitive nature, we store user feedback transcripts for only 30 days.
If you choose to send us feedback about Claude Code, such as transcripts of your usage, Anthropic may use that feedback to debug related issues and improve Claude Code's functionality (e.g., to reduce the risk of similar bugs occurring in the future).
See our [data usage policies](https://docs.anthropic.com/en/docs/claude-code/data-usage).
### Privacy safeguards

View File

@@ -40,14 +40,18 @@ Write-Host "Using backend: $($Backend)"
# --- Prerequisite Check ---
Write-Host "Checking for required commands..."
try {
Get-Command $Backend -ErrorAction Stop | Out-Null
if (-not (Get-Command $Backend -ErrorAction SilentlyContinue)) {
throw "Required command '$($Backend)' not found."
}
Write-Host "- $($Backend) command found."
Get-Command devcontainer -ErrorAction Stop | Out-Null
if (-not (Get-Command devcontainer -ErrorAction SilentlyContinue)) {
throw "Required command 'devcontainer' not found."
}
Write-Host "- devcontainer command found."
}
catch {
Write-Error "A required command is not installed or not in your PATH."
Write-Error "Please ensure '$($_.Exception.Message.Split(':')[0])' and 'devcontainer' are installed and accessible."
Write-Error "A required command is not installed or not in your PATH. $($_.Exception.Message)"
Write-Error "Please ensure both '$Backend' and 'devcontainer' are installed and accessible in your system's PATH."
exit 1
}

View File

@@ -1,263 +0,0 @@
#!/usr/bin/env bun
declare global {
var process: {
env: Record<string, string | undefined>;
};
}
interface GitHubIssue {
number: number;
title: string;
user: { id: number };
created_at: string;
}
interface GitHubComment {
id: number;
body: string;
created_at: string;
user: { type: string; id: number };
}
interface GitHubReaction {
user: { id: number };
content: string;
}
async function githubRequest<T>(endpoint: string, token: string, method: string = 'GET', body?: any): Promise<T> {
const response = await fetch(`https://api.github.com${endpoint}`, {
method,
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github.v3+json",
"User-Agent": "auto-close-duplicates-script",
...(body && { "Content-Type": "application/json" }),
},
...(body && { body: JSON.stringify(body) }),
});
if (!response.ok) {
throw new Error(
`GitHub API request failed: ${response.status} ${response.statusText}`
);
}
return response.json();
}
function extractDuplicateIssueNumber(commentBody: string): number | null {
const match = commentBody.match(/#(\d+)/);
return match ? parseInt(match[1], 10) : null;
}
async function closeIssueAsDuplicate(
owner: string,
repo: string,
issueNumber: number,
duplicateOfNumber: number,
token: string
): Promise<void> {
await githubRequest(
`/repos/${owner}/${repo}/issues/${issueNumber}`,
token,
'PATCH',
{
state: 'closed',
state_reason: 'not_planned'
}
);
await githubRequest(
`/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
token,
'POST',
{
body: `This issue has been automatically closed as a duplicate of #${duplicateOfNumber}.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with [Claude Code](https://claude.ai/code)`
}
);
}
async function autoCloseDuplicates(): Promise<void> {
console.log("[DEBUG] Starting auto-close duplicates script");
const token = process.env.GITHUB_TOKEN;
if (!token) {
throw new Error("GITHUB_TOKEN environment variable is required");
}
console.log("[DEBUG] GitHub token found");
const owner = process.env.GITHUB_REPOSITORY_OWNER || "anthropics";
const repo = process.env.GITHUB_REPOSITORY_NAME || "claude-code";
console.log(`[DEBUG] Repository: ${owner}/${repo}`);
const threeDaysAgo = new Date();
threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);
console.log(
`[DEBUG] Checking for duplicate comments older than: ${threeDaysAgo.toISOString()}`
);
console.log("[DEBUG] Fetching open issues created more than 3 days ago...");
const allIssues: GitHubIssue[] = [];
let page = 1;
const perPage = 100;
while (true) {
const pageIssues: GitHubIssue[] = await githubRequest(
`/repos/${owner}/${repo}/issues?state=open&per_page=${perPage}&page=${page}`,
token
);
if (pageIssues.length === 0) break;
// Filter for issues created more than 3 days ago
const oldEnoughIssues = pageIssues.filter(issue =>
new Date(issue.created_at) <= threeDaysAgo
);
allIssues.push(...oldEnoughIssues);
page++;
// Safety limit to avoid infinite loops
if (page > 20) break;
}
const issues = allIssues;
console.log(`[DEBUG] Found ${issues.length} open issues`);
let processedCount = 0;
let candidateCount = 0;
for (const issue of issues) {
processedCount++;
console.log(
`[DEBUG] Processing issue #${issue.number} (${processedCount}/${issues.length}): ${issue.title}`
);
console.log(`[DEBUG] Fetching comments for issue #${issue.number}...`);
const comments: GitHubComment[] = await githubRequest(
`/repos/${owner}/${repo}/issues/${issue.number}/comments`,
token
);
console.log(
`[DEBUG] Issue #${issue.number} has ${comments.length} comments`
);
const dupeComments = comments.filter(
(comment) =>
comment.body.includes("Found") &&
comment.body.includes("possible duplicate") &&
comment.user.type === "Bot"
);
console.log(
`[DEBUG] Issue #${issue.number} has ${dupeComments.length} duplicate detection comments`
);
if (dupeComments.length === 0) {
console.log(
`[DEBUG] Issue #${issue.number} - no duplicate comments found, skipping`
);
continue;
}
const lastDupeComment = dupeComments[dupeComments.length - 1];
const dupeCommentDate = new Date(lastDupeComment.created_at);
console.log(
`[DEBUG] Issue #${
issue.number
} - most recent duplicate comment from: ${dupeCommentDate.toISOString()}`
);
if (dupeCommentDate > threeDaysAgo) {
console.log(
`[DEBUG] Issue #${issue.number} - duplicate comment is too recent, skipping`
);
continue;
}
console.log(
`[DEBUG] Issue #${
issue.number
} - duplicate comment is old enough (${Math.floor(
(Date.now() - dupeCommentDate.getTime()) / (1000 * 60 * 60 * 24)
)} days)`
);
const commentsAfterDupe = comments.filter(
(comment) => new Date(comment.created_at) > dupeCommentDate
);
console.log(
`[DEBUG] Issue #${issue.number} - ${commentsAfterDupe.length} comments after duplicate detection`
);
if (commentsAfterDupe.length > 0) {
console.log(
`[DEBUG] Issue #${issue.number} - has activity after duplicate comment, skipping`
);
continue;
}
console.log(
`[DEBUG] Issue #${issue.number} - checking reactions on duplicate comment...`
);
const reactions: GitHubReaction[] = await githubRequest(
`/repos/${owner}/${repo}/issues/comments/${lastDupeComment.id}/reactions`,
token
);
console.log(
`[DEBUG] Issue #${issue.number} - duplicate comment has ${reactions.length} reactions`
);
const authorThumbsDown = reactions.some(
(reaction) =>
reaction.user.id === issue.user.id && reaction.content === "-1"
);
console.log(
`[DEBUG] Issue #${issue.number} - author thumbs down reaction: ${authorThumbsDown}`
);
if (authorThumbsDown) {
console.log(
`[DEBUG] Issue #${issue.number} - author disagreed with duplicate detection, skipping`
);
continue;
}
const duplicateIssueNumber = extractDuplicateIssueNumber(lastDupeComment.body);
if (!duplicateIssueNumber) {
console.log(
`[DEBUG] Issue #${issue.number} - could not extract duplicate issue number from comment, skipping`
);
continue;
}
candidateCount++;
const issueUrl = `https://github.com/${owner}/${repo}/issues/${issue.number}`;
try {
console.log(
`[INFO] Auto-closing issue #${issue.number} as duplicate of #${duplicateIssueNumber}: ${issueUrl}`
);
await closeIssueAsDuplicate(owner, repo, issue.number, duplicateIssueNumber, token);
console.log(
`[SUCCESS] Successfully closed issue #${issue.number} as duplicate of #${duplicateIssueNumber}`
);
} catch (error) {
console.error(
`[ERROR] Failed to close issue #${issue.number} as duplicate: ${error}`
);
}
}
console.log(
`[DEBUG] Script completed. Processed ${processedCount} issues, found ${candidateCount} candidates for auto-close`
);
}
autoCloseDuplicates().catch(console.error);
// Make it a module
export {};

View File

@@ -1,198 +0,0 @@
#!/usr/bin/env bun
declare global {
var process: {
env: Record<string, string | undefined>;
};
}
interface GitHubIssue {
number: number;
title: string;
state: string;
state_reason?: string;
user: { id: number };
created_at: string;
closed_at?: string;
}
interface GitHubComment {
id: number;
body: string;
created_at: string;
user: { type: string; id: number };
}
async function githubRequest<T>(endpoint: string, token: string, method: string = 'GET', body?: any): Promise<T> {
const response = await fetch(`https://api.github.com${endpoint}`, {
method,
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github.v3+json",
"User-Agent": "backfill-duplicate-comments-script",
...(body && { "Content-Type": "application/json" }),
},
...(body && { body: JSON.stringify(body) }),
});
if (!response.ok) {
throw new Error(
`GitHub API request failed: ${response.status} ${response.statusText}`
);
}
return response.json();
}
async function triggerDedupeWorkflow(
owner: string,
repo: string,
issueNumber: number,
token: string,
dryRun: boolean = true
): Promise<void> {
if (dryRun) {
console.log(`[DRY RUN] Would trigger dedupe workflow for issue #${issueNumber}`);
return;
}
await githubRequest(
`/repos/${owner}/${repo}/actions/workflows/claude-dedupe-issues.yml/dispatches`,
token,
'POST',
{
ref: 'main',
inputs: {
issue_number: issueNumber.toString()
}
}
);
}
async function backfillDuplicateComments(): Promise<void> {
console.log("[DEBUG] Starting backfill duplicate comments script");
const token = process.env.GITHUB_TOKEN;
if (!token) {
throw new Error(`GITHUB_TOKEN environment variable is required
Usage:
GITHUB_TOKEN=your_token bun run scripts/backfill-duplicate-comments.ts
Environment Variables:
GITHUB_TOKEN - GitHub personal access token with repo and actions permissions (required)
DRY_RUN - Set to "false" to actually trigger workflows (default: true for safety)
DAYS_BACK - How many days back to look for old issues (default: 90)`);
}
console.log("[DEBUG] GitHub token found");
const owner = "anthropics";
const repo = "claude-code";
const dryRun = process.env.DRY_RUN !== "false";
const daysBack = parseInt(process.env.DAYS_BACK || "90", 10);
console.log(`[DEBUG] Repository: ${owner}/${repo}`);
console.log(`[DEBUG] Dry run mode: ${dryRun}`);
console.log(`[DEBUG] Looking back ${daysBack} days`);
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - daysBack);
console.log(`[DEBUG] Fetching issues created since ${cutoffDate.toISOString()}...`);
const allIssues: GitHubIssue[] = [];
let page = 1;
const perPage = 100;
while (true) {
const pageIssues: GitHubIssue[] = await githubRequest(
`/repos/${owner}/${repo}/issues?state=all&per_page=${perPage}&page=${page}&since=${cutoffDate.toISOString()}`,
token
);
if (pageIssues.length === 0) break;
allIssues.push(...pageIssues);
page++;
// Safety limit to avoid infinite loops
if (page > 100) {
console.log("[DEBUG] Reached page limit, stopping pagination");
break;
}
}
console.log(`[DEBUG] Found ${allIssues.length} issues from the last ${daysBack} days`);
let processedCount = 0;
let candidateCount = 0;
let triggeredCount = 0;
for (const issue of allIssues) {
processedCount++;
console.log(
`[DEBUG] Processing issue #${issue.number} (${processedCount}/${allIssues.length}): ${issue.title}`
);
console.log(`[DEBUG] Fetching comments for issue #${issue.number}...`);
const comments: GitHubComment[] = await githubRequest(
`/repos/${owner}/${repo}/issues/${issue.number}/comments`,
token
);
console.log(
`[DEBUG] Issue #${issue.number} has ${comments.length} comments`
);
// Look for existing duplicate detection comments (from the dedupe bot)
const dupeDetectionComments = comments.filter(
(comment) =>
comment.body.includes("Found") &&
comment.body.includes("possible duplicate") &&
comment.user.type === "Bot"
);
console.log(
`[DEBUG] Issue #${issue.number} has ${dupeDetectionComments.length} duplicate detection comments`
);
// Skip if there's already a duplicate detection comment
if (dupeDetectionComments.length > 0) {
console.log(
`[DEBUG] Issue #${issue.number} already has duplicate detection comment, skipping`
);
continue;
}
candidateCount++;
const issueUrl = `https://github.com/${owner}/${repo}/issues/${issue.number}`;
try {
console.log(
`[INFO] ${dryRun ? '[DRY RUN] ' : ''}Triggering dedupe workflow for issue #${issue.number}: ${issueUrl}`
);
await triggerDedupeWorkflow(owner, repo, issue.number, token, dryRun);
if (!dryRun) {
console.log(
`[SUCCESS] Successfully triggered dedupe workflow for issue #${issue.number}`
);
}
triggeredCount++;
} catch (error) {
console.error(
`[ERROR] Failed to trigger workflow for issue #${issue.number}: ${error}`
);
}
// Add a delay between workflow triggers to avoid overwhelming the system
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log(
`[DEBUG] Script completed. Processed ${processedCount} issues, found ${candidateCount} candidates without duplicate comments, ${dryRun ? 'would trigger' : 'triggered'} ${triggeredCount} workflows`
);
}
backfillDuplicateComments().catch(console.error);
// Make it a module
export {};