MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extractPrompt

Function extractPrompt

packages/opencode-atomic-hooks/src/handlers/chat.ts:243–250  ·  view source on GitHub ↗
(parts: MessagePart[])

Source from the content-addressed store, hash-verified

241 * @returns The combined prompt text, or `undefined` if empty
242 */
243export function extractPrompt(parts: MessagePart[]): string | undefined {
244 const texts = parts
245 .filter((p) => p.type === "text" && typeof p.text === "string")
246 .map((p) => p.text as string);
247
248 const combined = texts.join("\n").trim();
249 return combined.length > 0 ? combined : undefined;
250}

Callers 2

handlers.test.tsFile · 0.90
createChatHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected