mirror of
https://github.com/anthropics/claude-code.git
synced 2026-05-03 03:32:45 +00:00
Compare commits
8 Commits
ashwin/upd
...
boris/limc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a04589002 | ||
|
|
04cace9ec0 | ||
|
|
2dbf1e97a0 | ||
|
|
0662600e93 | ||
|
|
27d2c6fdcf | ||
|
|
dd53f86325 | ||
|
|
c40c658e1f | ||
|
|
e05411140d |
9
.github/workflows/lock-closed-issues.yml
vendored
9
.github/workflows/lock-closed-issues.yml
vendored
@@ -15,7 +15,6 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
lock-closed-issues:
|
lock-closed-issues:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
|
||||||
steps:
|
steps:
|
||||||
- name: Lock closed issues after 7 days of inactivity
|
- name: Lock closed issues after 7 days of inactivity
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
@@ -23,13 +22,13 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
const sevenDaysAgo = new Date();
|
const sevenDaysAgo = new Date();
|
||||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
|
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.`;
|
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 page = 1;
|
||||||
let hasMore = true;
|
let hasMore = true;
|
||||||
let totalLocked = 0;
|
let totalLocked = 0;
|
||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
// Get closed issues (pagination)
|
// Get closed issues (pagination)
|
||||||
const { data: issues } = await github.rest.issues.listForRepo({
|
const { data: issues } = await github.rest.issues.listForRepo({
|
||||||
@@ -89,5 +88,5 @@ jobs:
|
|||||||
|
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Total issues locked: ${totalLocked}`);
|
console.log(`Total issues locked: ${totalLocked}`);
|
||||||
|
|||||||
112
.github/workflows/log-issue-events.yml
vendored
112
.github/workflows/log-issue-events.yml
vendored
@@ -2,10 +2,11 @@ name: Log GitHub Issue Events
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened]
|
types: [opened, closed]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
log-issue-created:
|
log-issue-created:
|
||||||
|
if: github.event.action == 'opened'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
permissions:
|
permissions:
|
||||||
@@ -19,7 +20,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ISSUE_NUMBER=${{ github.event.issue.number }}
|
ISSUE_NUMBER=${{ github.event.issue.number }}
|
||||||
REPO=${{ github.repository }}
|
REPO=${{ github.repository }}
|
||||||
ISSUE_TITLE="${{ github.event.issue.title }}"
|
ISSUE_TITLE=$(echo '${{ github.event.issue.title }}' | sed "s/'/'\\\\''/g")
|
||||||
AUTHOR="${{ github.event.issue.user.login }}"
|
AUTHOR="${{ github.event.issue.user.login }}"
|
||||||
CREATED_AT="${{ github.event.issue.created_at }}"
|
CREATED_AT="${{ github.event.issue.created_at }}"
|
||||||
|
|
||||||
@@ -65,4 +66,111 @@ jobs:
|
|||||||
echo "Successfully logged issue creation for issue #${ISSUE_NUMBER}"
|
echo "Successfully logged issue creation for issue #${ISSUE_NUMBER}"
|
||||||
else
|
else
|
||||||
echo "Failed to log issue creation for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
|
echo "Failed to log issue creation for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log-issue-closed:
|
||||||
|
if: github.event.action == 'closed'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Log issue closure to Statsig
|
||||||
|
env:
|
||||||
|
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ISSUE_NUMBER=${{ github.event.issue.number }}
|
||||||
|
REPO=${{ github.repository }}
|
||||||
|
ISSUE_TITLE=$(echo '${{ github.event.issue.title }}' | sed "s/'/'\\\\''/g")
|
||||||
|
CLOSED_BY="${{ github.event.issue.closed_by.login }}"
|
||||||
|
CLOSED_AT="${{ github.event.issue.closed_at }}"
|
||||||
|
STATE_REASON="${{ github.event.issue.state_reason }}"
|
||||||
|
|
||||||
|
if [ -z "$STATSIG_API_KEY" ]; then
|
||||||
|
echo "STATSIG_API_KEY not found, skipping Statsig logging"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get additional issue data via GitHub API
|
||||||
|
echo "Fetching additional issue data for #${ISSUE_NUMBER}"
|
||||||
|
ISSUE_DATA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
"https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER}")
|
||||||
|
|
||||||
|
COMMENTS_COUNT=$(echo "$ISSUE_DATA" | jq -r '.comments')
|
||||||
|
|
||||||
|
# Get reactions data
|
||||||
|
REACTIONS_DATA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
"https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER}/reactions")
|
||||||
|
|
||||||
|
REACTIONS_COUNT=$(echo "$REACTIONS_DATA" | jq '. | length')
|
||||||
|
|
||||||
|
# Check if issue was closed automatically (by checking if closed_by is a bot)
|
||||||
|
CLOSED_AUTOMATICALLY="false"
|
||||||
|
if [[ "$CLOSED_BY" == *"[bot]"* ]]; then
|
||||||
|
CLOSED_AUTOMATICALLY="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if closed as duplicate by state_reason
|
||||||
|
CLOSED_AS_DUPLICATE="false"
|
||||||
|
if [ "$STATE_REASON" = "duplicate" ]; then
|
||||||
|
CLOSED_AS_DUPLICATE="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the event payload
|
||||||
|
EVENT_PAYLOAD=$(jq -n \
|
||||||
|
--arg issue_number "$ISSUE_NUMBER" \
|
||||||
|
--arg repo "$REPO" \
|
||||||
|
--arg title "$ISSUE_TITLE" \
|
||||||
|
--arg closed_by "$CLOSED_BY" \
|
||||||
|
--arg closed_at "$CLOSED_AT" \
|
||||||
|
--arg state_reason "$STATE_REASON" \
|
||||||
|
--arg comments_count "$COMMENTS_COUNT" \
|
||||||
|
--arg reactions_count "$REACTIONS_COUNT" \
|
||||||
|
--arg closed_automatically "$CLOSED_AUTOMATICALLY" \
|
||||||
|
--arg closed_as_duplicate "$CLOSED_AS_DUPLICATE" \
|
||||||
|
'{
|
||||||
|
events: [{
|
||||||
|
eventName: "github_issue_closed",
|
||||||
|
value: 1,
|
||||||
|
metadata: {
|
||||||
|
repository: $repo,
|
||||||
|
issue_number: ($issue_number | tonumber),
|
||||||
|
issue_title: $title,
|
||||||
|
closed_by: $closed_by,
|
||||||
|
closed_at: $closed_at,
|
||||||
|
state_reason: $state_reason,
|
||||||
|
comments_count: ($comments_count | tonumber),
|
||||||
|
reactions_count: ($reactions_count | tonumber),
|
||||||
|
closed_automatically: ($closed_automatically | test("true")),
|
||||||
|
closed_as_duplicate: ($closed_as_duplicate | test("true"))
|
||||||
|
},
|
||||||
|
time: (now | floor | tostring)
|
||||||
|
}]
|
||||||
|
}')
|
||||||
|
|
||||||
|
# Send to Statsig API
|
||||||
|
echo "Logging issue closure to Statsig for issue #${ISSUE_NUMBER}"
|
||||||
|
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST https://events.statsigapi.net/v1/log_event \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "STATSIG-API-KEY: ${STATSIG_API_KEY}" \
|
||||||
|
-d "$EVENT_PAYLOAD")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||||
|
BODY=$(echo "$RESPONSE" | head -n-1)
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 202 ]; then
|
||||||
|
echo "Successfully logged issue closure for issue #${ISSUE_NUMBER}"
|
||||||
|
echo "Closed by: $CLOSED_BY"
|
||||||
|
echo "Comments: $COMMENTS_COUNT"
|
||||||
|
echo "Reactions: $REACTIONS_COUNT"
|
||||||
|
echo "Closed automatically: $CLOSED_AUTOMATICALLY"
|
||||||
|
echo "Closed as duplicate: $CLOSED_AS_DUPLICATE"
|
||||||
|
else
|
||||||
|
echo "Failed to log issue closure for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
|
||||||
fi
|
fi
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.0.72
|
||||||
|
|
||||||
|
- Ask permissions: have Claude Code always ask for confirmation to use specific tools with /permissions
|
||||||
|
|
||||||
## 1.0.71
|
## 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.)
|
- Background commands: (Ctrl-b) to run any Bash command in the background so Claude can keep working (great for dev servers, tailing logs, etc.)
|
||||||
|
|||||||
@@ -51,41 +51,6 @@ function extractDuplicateIssueNumber(commentBody: string): number | null {
|
|||||||
return match ? parseInt(match[1], 10) : null;
|
return match ? parseInt(match[1], 10) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function logStatsigEvent(eventName: string, value: number, metadata: Record<string, any>): Promise<void> {
|
|
||||||
const statsigApiKey = process.env.STATSIG_API_KEY;
|
|
||||||
if (!statsigApiKey) {
|
|
||||||
console.log("[DEBUG] STATSIG_API_KEY not found, skipping Statsig logging");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const eventPayload = {
|
|
||||||
events: [{
|
|
||||||
eventName,
|
|
||||||
value,
|
|
||||||
metadata,
|
|
||||||
time: Math.floor(Date.now()).toString()
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('https://events.statsigapi.net/v1/log_event', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'STATSIG-API-KEY': statsigApiKey
|
|
||||||
},
|
|
||||||
body: JSON.stringify(eventPayload)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
console.log(`[DEBUG] Successfully logged Statsig event: ${eventName}`);
|
|
||||||
} else {
|
|
||||||
console.log(`[DEBUG] Failed to log Statsig event: ${response.status} ${response.statusText}`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(`[DEBUG] Error logging to Statsig: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function closeIssueAsDuplicate(
|
async function closeIssueAsDuplicate(
|
||||||
owner: string,
|
owner: string,
|
||||||
@@ -100,7 +65,8 @@ async function closeIssueAsDuplicate(
|
|||||||
'PATCH',
|
'PATCH',
|
||||||
{
|
{
|
||||||
state: 'closed',
|
state: 'closed',
|
||||||
state_reason: 'not_planned'
|
state_reason: 'duplicate',
|
||||||
|
labels: ['duplicate']
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -117,13 +83,6 @@ If this is incorrect, please re-open this issue or create a new one.
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Log to Statsig
|
|
||||||
await logStatsigEvent('github_issue_closed_as_duplicate', 1, {
|
|
||||||
repository: `${owner}/${repo}`,
|
|
||||||
issue_number: issueNumber,
|
|
||||||
duplicate_of_issue: duplicateOfNumber,
|
|
||||||
closed_by: 'auto-close-script'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function autoCloseDuplicates(): Promise<void> {
|
async function autoCloseDuplicates(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user