(goal: string, repoContext: AgentRepoContext)
| 14521 | } |
| 14522 | |
| 14523 | function resolveGenericValidationCommands(goal: string, repoContext: AgentRepoContext): string[] { |
| 14524 | const commands: string[] = []; |
| 14525 | const addScript = (name: string) => { |
| 14526 | if (!repoContext.packageScripts.includes(name)) { |
| 14527 | return; |
| 14528 | } |
| 14529 | const command = formatRepoScriptCommand(repoContext.packageManager, name); |
| 14530 | if (!commands.includes(command)) { |
| 14531 | commands.push(command); |
| 14532 | } |
| 14533 | }; |
| 14534 | const normalizedGoal = goal.toLowerCase(); |
| 14535 | if (/test|测试/u.test(normalizedGoal)) { |
| 14536 | addScript('test'); |
| 14537 | } |
| 14538 | if (/typecheck|类型|ts|typescript/u.test(normalizedGoal)) { |
| 14539 | addScript('typecheck'); |
| 14540 | } |
| 14541 | if (/build|构建/u.test(normalizedGoal)) { |
| 14542 | addScript('build'); |
| 14543 | } |
| 14544 | for (const fallback of ['typecheck', 'test', 'build']) { |
| 14545 | addScript(fallback); |
| 14546 | } |
| 14547 | return commands.slice(0, 4); |
| 14548 | } |
| 14549 | |
| 14550 | function formatRepoScriptCommand( |
| 14551 | packageManager: AgentRepoContext['packageManager'], |
no test coverage detected