mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 06:12:50 -07:00
## Metric Improvement: Accuracy of Open Issues and PR Counts
### What the change is This PR updates the `open_issues.ts` and `open_prs.ts` metric scripts to use the GitHub Search API for retrieving total counts, rather than listing items with a hardcoded limit of 1000. ### Why it is recommended The current implementation caps the number of open issues and PRs at 1000. Repository metrics currently show exactly 1000 open issues, indicating that the true scale of the backlog is being masked. Accurate data is essential for the "Brain" phase to formulate effective strategies for repository health. ### Which metric is expected to be improved `open_issues` and `open_prs`. ### By how much the metric is expected to improve This change improves the **accuracy** of these metrics from a capped value of 1000 to the true total count. Based on current trends, we expect the reported `open_issues` value to increase significantly, providing a more realistic baseline for future triage efforts.
This commit is contained in:
@@ -5,16 +5,27 @@
|
||||
*/
|
||||
|
||||
import { execSync } from 'node:child_process';
|
||||
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
|
||||
|
||||
try {
|
||||
const count = execSync(
|
||||
'gh issue list --state open --limit 1000 --json number --jq length',
|
||||
`gh api "search/issues?q=repo:${GITHUB_OWNER}/${GITHUB_REPO}+is:issue+is:open" --jq .total_count`,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
).trim();
|
||||
console.log(`open_issues,${count}`);
|
||||
} catch {
|
||||
// Fallback if gh fails or no issues found
|
||||
console.log('open_issues,0');
|
||||
// Fallback if search fails
|
||||
try {
|
||||
const count = execSync(
|
||||
`gh issue list -R ${GITHUB_OWNER}/${GITHUB_REPO} --state open --limit 5000 --json number --jq length`,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
).trim();
|
||||
console.log(`open_issues,${count}`);
|
||||
} catch {
|
||||
console.log('open_issues,0');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,27 @@
|
||||
*/
|
||||
|
||||
import { execSync } from 'node:child_process';
|
||||
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
|
||||
|
||||
try {
|
||||
const count = execSync(
|
||||
'gh pr list --state open --limit 1000 --json number --jq length',
|
||||
`gh api "search/issues?q=repo:${GITHUB_OWNER}/${GITHUB_REPO}+is:pr+is:open" --jq .total_count`,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
).trim();
|
||||
console.log(`open_prs,${count}`);
|
||||
} catch {
|
||||
// Fallback if gh fails or no PRs found
|
||||
console.log('open_prs,0');
|
||||
// Fallback if search fails
|
||||
try {
|
||||
const count = execSync(
|
||||
`gh pr list -R ${GITHUB_OWNER}/${GITHUB_REPO} --state open --limit 5000 --json number --jq length`,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
).trim();
|
||||
console.log(`open_prs,${count}`);
|
||||
} catch {
|
||||
console.log('open_prs,0');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user