| "use strict"; |
| |
| |
| |
| |
| |
| |
| Object.defineProperty(exports, "__esModule", { value: true }); |
| exports.isBotComment = exports.parsePrixCommand = void 0; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| const parsePrixCommand = (commentBody) => { |
| const trimmed = commentBody.trim(); |
| |
| const prixCommandRegex = /^[/!]?prix\s+(\w+)(.*)$/i; |
| const match = trimmed.match(prixCommandRegex); |
| if (!match) { |
| return { |
| isPrixCommand: false, |
| command: null, |
| args: [], |
| rawCommand: '' |
| }; |
| } |
| const commandStr = match[1].toLowerCase(); |
| const argsStr = match[2].trim(); |
| const args = argsStr ? argsStr.split(/\s+/).filter(Boolean) : []; |
| |
| const commandMap = { |
| plan: 'plan', |
| fix: 'fix', |
| review: 'review', |
| help: 'help' |
| }; |
| const command = commandMap[commandStr] || null; |
| return { |
| isPrixCommand: true, |
| command, |
| args, |
| rawCommand: match[0] |
| }; |
| }; |
| exports.parsePrixCommand = parsePrixCommand; |
| |
| |
| |
| |
| |
| |
| |
| const isBotComment = (username, botUsername = 'prix-ai[bot]') => { |
| if (!username) |
| return false; |
| const normalizedUsername = username.toLowerCase(); |
| const normalizedBot = botUsername.toLowerCase(); |
| return (normalizedUsername === normalizedBot || normalizedUsername.endsWith('[bot]')); |
| }; |
| exports.isBotComment = isBotComment; |
| |