MCPcopy Create free account
hub / github.com/github/gh-aw / formatCodexBashCall

Function formatCodexBashCall

actions/setup/js/parse_codex_log.cjs:924–958  ·  view source on GitHub ↗

* Format a Codex bash call with HTML details * Uses the shared formatToolCallAsDetails helper for consistent rendering across all engines. * @param {string} command - The bash command * @param {string} response - The response as plain text * @param {string} statusIcon - The status icon (✅, ❌, or

(command, response, statusIcon)

Source from the content-addressed store, hash-verified

922 * @returns {string} Formatted HTML details string
923 */
924function formatCodexBashCall(command, response, statusIcon) {
925 // Calculate token estimate from command + response
926 const totalTokens = estimateTokens(command) + estimateTokens(response);
927
928 // Format metadata
929 let metadata = "";
930 if (totalTokens > 0) {
931 metadata = `<code>~${totalTokens}t</code>`;
932 }
933
934 const summary = `<code>bash: ${truncateString(command, 60)}</code>`;
935
936 // Build sections array
937 const sections = [];
938
939 sections.push({
940 label: "Command",
941 content: command,
942 language: "bash",
943 });
944
945 if (response && response.trim()) {
946 sections.push({
947 label: "Output",
948 content: response,
949 });
950 }
951
952 return formatToolCallAsDetails({
953 summary,
954 statusIcon,
955 metadata,
956 sections,
957 });
958}
959
960// Export for testing
961if (typeof module !== "undefined" && module.exports) {

Callers 3

parseCodexJsonlFunction · 0.85
parseCodexLogFunction · 0.85

Calls 3

truncateStringFunction · 0.85
formatToolCallAsDetailsFunction · 0.85
estimateTokensFunction · 0.70

Tested by

no test coverage detected