MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / resolveGenericValidationCommands

Function resolveGenericValidationCommands

src/core/bridge_coordinator.ts:14523–14548  ·  view source on GitHub ↗
(goal: string, repoContext: AgentRepoContext)

Source from the content-addressed store, hash-verified

14521}
14522
14523function 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
14550function formatRepoScriptCommand(
14551 packageManager: AgentRepoContext['packageManager'],

Calls 1

addScriptFunction · 0.85

Tested by

no test coverage detected