diff --git a/packages/core/src/annotations.ts b/packages/core/src/annotations.ts index 16dc7152f3..303e8ddee6 100644 --- a/packages/core/src/annotations.ts +++ b/packages/core/src/annotations.ts @@ -4,6 +4,8 @@ * of annotations into different formats for integration with CI/CD tools. */ +import { EMOJI_SUCCESS, EMOJI_WARNING } from "./constants" + // Regular expression for matching GitHub Actions annotations. // Example: ::error file=foo.js,line=10,endLine=11::Something went wrong. const GITHUB_ANNOTATIONS_RX = @@ -18,6 +20,7 @@ const AZURE_DEVOPS_ANNOTATIONS_RX = // Example: foo.ts:10:error TS1005: ';' expected. const TYPESCRIPT_ANNOTATIONS_RX = /^(?[^:\s].*?):(?\d+)(?::(?\d+))?(?::\d+)?\s+-\s+(?error|warning)\s+(?[^:]+)\s*:\s*(?.*)$/gim + // Maps severity strings to `DiagnosticSeverity`. const SEV_MAP: Record = Object.freeze({ ["info"]: "info", @@ -25,6 +28,12 @@ const SEV_MAP: Record = Object.freeze({ ["warning"]: "warning", ["error"]: "error", }) +const SEV_EMOJI_MAP: Record = Object.freeze({ + ["info"]: "ℹ️", + ["notice"]: "ℹ️", // Maps 'notice' to 'info' severity + ["warning"]: EMOJI_WARNING, + ["error"]: EMOJI_SUCCESS, +}) /** * Parses annotations from TypeScript, GitHub Actions, and Azure DevOps. @@ -82,7 +91,7 @@ export function convertAnnotationsToItems(text: string) { const m = rx.exec(s) if (!m) return s const { file, line, severity, code, message } = m.groups - return `- ${SEV_MAP[severity?.toLowerCase()] ?? "info"}: ${message} (${file}#L${line} ${code || ""})` + return `- ${SEV_EMOJI_MAP[severity?.toLowerCase()] ?? "info"}: ${message} ([${file}#L${line}](${file}) ${code || ""})\n` }), text ) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 7180b8ec77..9fc59d3ffb 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -159,6 +159,7 @@ export const STATS_DIR_NAME = "stats" export const EMOJI_SUCCESS = "✅" export const EMOJI_FAIL = "❌" +export const EMOJI_WARNING = "⚠️" export const EMOJI_UNDEFINED = "?" export const MODEL_PROVIDER_OPENAI = "openai"