Skip to content

Commit b0be1f1

Browse files
Sehoon/oncall filter (google-gemini#18105)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 85dd6ef commit b0be1f1

3 files changed

Lines changed: 727 additions & 2 deletions

File tree

packages/cli/src/ui/commands/oncallCommand.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
type OpenCustomDialogActionReturn,
1111
} from './types.js';
1212
import { TriageDuplicates } from '../components/triage/TriageDuplicates.js';
13+
import { TriageIssues } from '../components/triage/TriageIssues.js';
1314

1415
export const oncallCommand: SlashCommand = {
1516
name: 'oncall',
@@ -49,5 +50,63 @@ export const oncallCommand: SlashCommand = {
4950
};
5051
},
5152
},
53+
{
54+
name: 'audit',
55+
description: 'Triage issues labeled as status/need-triage',
56+
kind: CommandKind.BUILT_IN,
57+
autoExecute: true,
58+
action: async (context, args): Promise<OpenCustomDialogActionReturn> => {
59+
const { config } = context.services;
60+
if (!config) {
61+
throw new Error('Config not available');
62+
}
63+
64+
let limit = 100;
65+
let until: string | undefined;
66+
67+
if (args && args.trim().length > 0) {
68+
const argArray = args.trim().split(/\s+/);
69+
for (let i = 0; i < argArray.length; i++) {
70+
const arg = argArray[i];
71+
if (arg === '--until') {
72+
if (i + 1 >= argArray.length) {
73+
throw new Error('Flag --until requires a value (YYYY-MM-DD).');
74+
}
75+
const val = argArray[i + 1];
76+
if (!/^\d{4}-\d{2}-\d{2}$/.test(val)) {
77+
throw new Error(
78+
`Invalid date format for --until: "${val}". Expected YYYY-MM-DD.`,
79+
);
80+
}
81+
until = val;
82+
i++;
83+
} else if (arg.startsWith('--')) {
84+
throw new Error(`Unknown flag: ${arg}`);
85+
} else {
86+
const parsedLimit = parseInt(arg, 10);
87+
if (!isNaN(parsedLimit) && parsedLimit > 0) {
88+
limit = parsedLimit;
89+
} else {
90+
throw new Error(
91+
`Invalid argument: "${arg}". Expected a positive number or --until flag.`,
92+
);
93+
}
94+
}
95+
}
96+
}
97+
98+
return {
99+
type: 'custom_dialog',
100+
component: (
101+
<TriageIssues
102+
config={config}
103+
initialLimit={limit}
104+
until={until}
105+
onExit={() => context.ui.removeComponent()}
106+
/>
107+
),
108+
};
109+
},
110+
},
52111
],
53112
};

packages/cli/src/ui/components/triage/TriageDuplicates.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const VISIBLE_LINES_COLLAPSED = 6;
8080
const VISIBLE_LINES_EXPANDED = 20;
8181
const VISIBLE_LINES_DETAIL = 25;
8282
const VISIBLE_CANDIDATES = 5;
83-
const MAX_CONCURRENT_ANALYSIS = 3;
83+
const MAX_CONCURRENT_ANALYSIS = 10;
8484

8585
const getReactionCount = (issue: Issue | Candidate | undefined) => {
8686
if (!issue || !issue.reactionGroups) return 0;
@@ -336,7 +336,7 @@ Return a JSON object with:
336336
const issuesToAnalyze = state.issues
337337
.slice(
338338
state.currentIndex,
339-
state.currentIndex + MAX_CONCURRENT_ANALYSIS + 2,
339+
state.currentIndex + MAX_CONCURRENT_ANALYSIS + 20,
340340
) // Look ahead a bit
341341
.filter(
342342
(issue) =>

0 commit comments

Comments
 (0)