Sehoon/oncall filter (#18105)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Sehoon Shon
2026-02-02 13:10:28 -05:00
committed by GitHub
parent 85dd6ef773
commit b0be1f1689
3 changed files with 727 additions and 2 deletions
@@ -10,6 +10,7 @@ import {
type OpenCustomDialogActionReturn,
} from './types.js';
import { TriageDuplicates } from '../components/triage/TriageDuplicates.js';
import { TriageIssues } from '../components/triage/TriageIssues.js';
export const oncallCommand: SlashCommand = {
name: 'oncall',
@@ -49,5 +50,63 @@ export const oncallCommand: SlashCommand = {
};
},
},
{
name: 'audit',
description: 'Triage issues labeled as status/need-triage',
kind: CommandKind.BUILT_IN,
autoExecute: true,
action: async (context, args): Promise<OpenCustomDialogActionReturn> => {
const { config } = context.services;
if (!config) {
throw new Error('Config not available');
}
let limit = 100;
let until: string | undefined;
if (args && args.trim().length > 0) {
const argArray = args.trim().split(/\s+/);
for (let i = 0; i < argArray.length; i++) {
const arg = argArray[i];
if (arg === '--until') {
if (i + 1 >= argArray.length) {
throw new Error('Flag --until requires a value (YYYY-MM-DD).');
}
const val = argArray[i + 1];
if (!/^\d{4}-\d{2}-\d{2}$/.test(val)) {
throw new Error(
`Invalid date format for --until: "${val}". Expected YYYY-MM-DD.`,
);
}
until = val;
i++;
} else if (arg.startsWith('--')) {
throw new Error(`Unknown flag: ${arg}`);
} else {
const parsedLimit = parseInt(arg, 10);
if (!isNaN(parsedLimit) && parsedLimit > 0) {
limit = parsedLimit;
} else {
throw new Error(
`Invalid argument: "${arg}". Expected a positive number or --until flag.`,
);
}
}
}
}
return {
type: 'custom_dialog',
component: (
<TriageIssues
config={config}
initialLimit={limit}
until={until}
onExit={() => context.ui.removeComponent()}
/>
),
};
},
},
],
};