mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
The previous userInputCodeContext only skipped the context block when context was exactly '' or ' '. Anything else (e.g. a string of whitespace, null, undefined) would inject an empty or whitespace-only <context>…</context> tag into the system prompt. Trim the input and guard against null/undefined: - accept string | undefined | null - normalize via `(context ?? '').trim()` - skip the injection whenever the trimmed value is empty Also inline the INIT_MAIN_PROMPT IIFE into a normal function body and introduce a `content` local, removing a layer of nesting that obscured the prompt assembly. Behavior is unchanged.