MCPcopy Create free account
hub / github.com/microsoft/Webwright / primaryCommand

Function primaryCommand

assets/compare_trajectory/app.js:76–91  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

74}
75
76function primaryCommand(raw) {
77 const input = String(raw || '').trim();
78 if (!input) {
79 return 'none';
80 }
81 const pieces = input.split(/&&|\|\|/).map((piece) => piece.trim()).filter(Boolean);
82 const target = pieces.find((piece) => !/^cd\s+/.test(piece)) || pieces[0] || input;
83 if (target.startsWith('python - <<')) {
84 return 'python-heredoc';
85 }
86 if (target.startsWith('printf ')) {
87 return 'printf';
88 }
89 const match = target.match(/^([A-Za-z0-9._/-]+)/);
90 return match ? match[1] : shortText(target, 40);
91}
92
93function parseExitCode(text) {
94 const match = String(text || '').match(/(?:Return code:|Process exited with code|<exited with exit code)\s*(-?\d+)/i);

Callers 4

parseSessionToolSectionFunction · 0.85
normalizeCodexFunction · 0.85
normalizeRawResponsesFunction · 0.85
normalizeTrajectoryFunction · 0.85

Calls 1

shortTextFunction · 0.85

Tested by

no test coverage detected