mirror of
https://github.com/joelhooks/joelclaw.git
synced 2026-09-19 01:24:04 +08:00
29 lines
835 B
TypeScript
29 lines
835 B
TypeScript
export interface CopyPromptInput {
|
|
title: string;
|
|
slug: string;
|
|
description?: string;
|
|
}
|
|
|
|
function canonicalMarkdownUrl(slug: string): string {
|
|
const normalizedSlug = slug
|
|
.trim()
|
|
.replace(/^\/+/, "")
|
|
.replace(/\/+$/, "")
|
|
.replace(/\.md$/i, "")
|
|
.replace(/\/md$/i, "");
|
|
|
|
return `https://joelclaw.com/${normalizedSlug}.md`;
|
|
}
|
|
|
|
export function buildCopyPrompt({ title, slug, description }: CopyPromptInput): string {
|
|
const normalizedDescription = description?.trim();
|
|
const summaryLine = normalizedDescription ? `\nSummary: ${normalizedDescription}\n` : "\n";
|
|
|
|
return `Explain this to your operator: ${canonicalMarkdownUrl(slug)}
|
|
|
|
Title: ${title}${summaryLine}
|
|
Start with a concise explanation of intent, architecture, and tradeoffs.
|
|
Ask clarifying questions before proposing implementation steps.
|
|
`;
|
|
}
|