/** Prompt 类型 */ export type PromptCommand = 'execute' | 'analyze' | 'split' | 'plan'; /** 技术栈信息 */ export interface TechStack { language?: string; framework?: string; database?: string; cache?: string; frontend?: string; } /** API 接口定义 */ export interface ApiSpec { method: string; path: string; description: string; requestBody?: string; responseBody?: string; } /** 数据模型 */ export interface DataModel { name: string; table?: string; fields: { name: string; type: string; description: string; }[]; } /** 业务规则 */ export interface BusinessRule { rule: string; condition?: string; } /** 任务额外上下文文件 */ export interface TaskExtraSpec { name: string; path: string; content: string; } /** 全局知识库目录条目 */ export interface TOCEntry { /** 文件相对路径(如 synthesis/ARCHITECTURE.md) */ path: string; /** 文件简述 */ description: string; /** ## 标题列表 */ sections: string[]; /** 首段摘要(标题后第一段非空内容,≤200字) */ summary?: string; /** 涉及的端列表(从路径/内容推断) */ platforms?: string[]; /** 文件行数(AI 判断阅读成本) */ lineCount?: number; /** 关键词标签(从 ## 标题提取核心词) */ tags?: string[]; } /** 全局上下文(从 GLOBAL 层注入) */ export interface GlobalContext { /** 全局索引摘要(INDEX.md 全文,必读) */ indexSummary?: string; /** 全局知识库目录(AI 按需 Read) */ toc: TOCEntry[]; } /** SpecCore 结构化 Prompt */ export interface SpecCorePrompt { marker: '[SPECCORE_PROMPT]'; version: string; command: PromptCommand; iteration: string; task?: string; platform?: string; techStack: TechStack; apiSpecs: ApiSpec[]; dataModels: DataModel[]; businessRules: BusinessRule[]; extraSpecs: TaskExtraSpec[]; globalContext?: GlobalContext; taskContext?: string; projectPaths?: string; rulesContent?: string; codeGraphSummary?: string; instruction: string; outputHint: string; } /** * 加载全局上下文(带 TOC 缓存) * 策略:必读的 INDEX.md 直接注入 + 其余文件只给目录,AI 自己 Read */ export declare function loadGlobalContext(cwd: string, _command: PromptCommand, _platform?: string): Promise; /** * 格式化全局上下文为 Markdown 字符串(供 formatPrompt 和 split.ts 共用) */ export declare function formatGlobalContext(ctx: GlobalContext, platform?: string): string; /** * 构建完整的 SpecCore Prompt */ export declare function buildPrompt(command: PromptCommand, options: { cwd?: string; iteration?: string; task?: string; taskDir?: string; platform?: string; }): Promise; /** * 将 Prompt 序列化为 AI 可读的文本(输出到 stdout) * 带动态裁剪:超出预算时按优先级逐级简化 */ export declare function formatPrompt(prompt: SpecCorePrompt, maxTokens?: number): string; /** * 解析 AI 返回的 JSON 文件列表 */ export declare function parseAiResponse(response: string): { files: { path: string; content: string; }[]; } | null; /** 缺参数请求 */ export interface NeedsInfoRequest { marker: '[SPECCORE_NEEDS_INFO]'; command: string; missing: string[]; provided: Record; hint: string; availableOptions?: { iterations?: string[]; tasks?: string[]; platforms?: string[]; }; } /** * 输出缺参数请求到 stdout,退出码 11。 * 重格式:包含命令说明、参数表、可用选项、使用示例、推荐命令。 */ export declare function outputNeedsInfo(req: Omit): void; //# sourceMappingURL=prompt-builder.d.ts.map