← Public packages
@kentcdodds/ship-pr
Progressive ship-pr loop for agents: PR status, Bugbot, review sort, 7-day decisions, merge, deploy, wrap-up.
src/decide-reply.ts
13 lines · 587 B · TypeScript/**
* Resolve `decide`'s `reply` input to the text to post on the thread.
*
* - `true` posts the decision `reason`.
* - A non-empty string posts that text.
* - `false`, missing, or a blank string posts nothing.
*/
export function resolveReplyText(value: unknown, reason: string, exportName: string): string | undefined {
if (value == null || value === false) return undefined
if (value === true) return reason
if (typeof value === 'string') return value.trim() || undefined
throw new Error(`${exportName}: reply must be true (post the reason) or a string (post that text).`)
}