/** * Prompt builders for project-level documentation generation. * Each builder produces a prompt for a specific doc type; the LLM output * is stored in the `project_docs` table and injected into card prompts. */ import type { BestPractices } from "../skills/types.js"; export type DocType = "readme" | "about" | "architecture" | "code_style" | "rules" | "styles" | "api_contracts" | "specialist" | "changelog" | "memory" | "pages" | "be_overview" | "business" | "product" | "cross_repo" | "discovery"; export declare const DOC_SYSTEM_PROMPT = "You are a senior software architect documenting a codebase for an AI coding assistant.\nWrite clear, concise markdown. Focus on what developers need to know to work confidently in this codebase.\nDo NOT fabricate details not visible in the provided source. If something is unclear, say so briefly.\nMaximum 600 words per document."; export interface BranchContext { branch: string; /** Semantic class of the branch */ branchClass: "base" | "environment" | "feature"; /** Target deployment environment — only set for environment branches */ targetEnvironment?: "demo" | "staging" | "production" | "release" | "other" | null; baseBranch: string; changedFiles: string[]; commitsAhead: number; /** Ticket IDs extracted from the branch name (e.g. ["ENG-756"]) */ ticketIds?: string[]; /** Optional ticket description injected via --ticket CLI flag */ ticketDescription?: string; /** * Cross-repo branch context: other repos in the workspace that are on the * same epic/feature branch. Populated by buildWorkspaceBranchSignal(). */ crossRepoBranches?: Array<{ repo: string; branch: string; changedFiles: string[]; recentCommits: string[]; }>; /** Repos that are still on their base branch and haven't picked up the epic */ behindRepos?: string[]; } /** * Builds a markdown block injected into prompts when indexing a non-base branch. * The framing is tailored to the branch class: * * environment (demo) → "DEMO ENVIRONMENT: WIP features for demo/orlando" * environment (staging) → "STAGING ENVIRONMENT: release candidate vs main" * environment (production) → "PRODUCTION ENVIRONMENT: stable deployed state" * feature → "FEATURE BRANCH: ticket-driven changes" */ export declare function buildBranchContextBlock(ctx: BranchContext): string; interface SourceFile { path: string; content: string; } export declare function buildReadmePrompt(repoName: string, files: SourceFile[], branchContext?: BranchContext): string; export declare function buildAboutPrompt(repoName: string, files: SourceFile[], branchContext?: BranchContext): string; export declare function buildArchitecturePrompt(repoName: string, files: SourceFile[], branchContext?: BranchContext): string; export declare function buildCodeStylePrompt(repoName: string, files: SourceFile[], frameworkBaseline?: string, branchContext?: BranchContext): string; export declare function buildRulesPrompt(repoName: string, files: SourceFile[], frameworkBaseline?: string, branchContext?: BranchContext): string; export declare function buildStylesPrompt(repoName: string, files: SourceFile[]): string; export declare function buildPagesPrompt(repoName: string, files: SourceFile[]): string; export declare function buildBeOverviewPrompt(repoName: string, files: SourceFile[], fePagesContext?: string, branchContext?: BranchContext): string; export declare function buildBusinessPrompt(repoName: string, files: SourceFile[], readmeSeed?: string): string; export declare function buildProductPrompt(repoName: string, files: SourceFile[], readmeSeed?: string, pagesDoc?: string): string; export declare function buildCrossRepoPrompt(workspaceName: string, fePagesDoc: string, feProductDoc: string, beApiContractsDoc: string): string; export declare function buildRefreshDocPrompt(docType: DocType, repoName: string, files: SourceFile[], frameworkBaseline?: string): string; export declare function buildSpecialistPrompt(repoName: string, stackLabel: string, aboutDoc: string, archDoc: string, rulesDoc: string, frameworkBestPractices?: string): string; export declare function buildApiContractsPrompt(repoName: string, files: SourceFile[]): string; export declare function buildChangelogPrompt(repoName: string, commitMessages: string[]): string; export interface MemoryInput { recentInsights: Array<{ title: string; flow: string; content: string; created_at: string; }>; topFlows: Array<{ flow: string; queryCount: number; }>; } export declare function buildMemoryDocPrompt(input: MemoryInput): string; /** @deprecated — use BestPractices from skills/types.ts directly. Kept for backward compat. */ export type { BestPractices as FrameworkBestPractices }; /** * Formats a skill's bestPractices into a compact markdown string suitable * for injection into code_style and rules doc prompts. * Multiple skills are merged and de-duplicated. Each section is capped at 8 * bullets to prevent bloat when 3+ framework stacks are combined. */ export declare function buildFrameworkBaseline(practicesList: BestPractices[], options?: { includeTesting?: boolean; includePerformance?: boolean; }): string; /** * Returns only the Architecture section of the framework baseline. * Designed for the specialist prompt where token budget is tighter * and architectural personality is more useful than style/security details. */ export declare function buildFrameworkArchitectureOnly(practicesList: BestPractices[]): string; export declare const DISCOVERY_SYSTEM_PROMPT = "You are a senior software architect performing codebase discovery.\nYour job is to identify the real business features of an application \u2014 not code clusters or file groups.\nReturn ONLY valid JSON. No markdown fences, no explanation, no preamble.\nBe specific. Name features as a product manager would name them."; /** * Call 1: Classify the directory structure and identify the repo type. * Input: full directory tree + all READMEs found. * Output: JSON with framework, repoType, primaryLanguage, and directory roles. */ export declare function buildDirectoryClassificationPrompt(repoName: string, tree: string, readme: string, repoTypeHint: { repoClass: string; likelyFramework: string; signals: string[]; }): string; /** * Call 2: Discover the real business features from the classified structure. * Input: dir classification JSON + file counts + README + raw tree + key files. * Output: JSON array of real business features with directory/file patterns. */ export declare function buildFeatureDiscoveryPrompt(repoName: string, dirClassificationJson: string, readme: string, fileCounts: Record, tree?: string, keyFiles?: string): string; /** * Workspace-level cross-repo topology prompt. * Sent once when multiple repos are indexed together. * Identifies: monolith vs API+FE vs microservices, and maps repo responsibilities. */ export declare function buildWorkspaceTopologyPrompt(repos: Array<{ name: string; repoClass: string; framework: string; dirSummary: string; }>): string; //# sourceMappingURL=doc-prompts.d.ts.map