/** * Init Engine — 移植自 OpenSpec init.ts (52KB) * * 项目脚手架生成引擎: * - AI 工具检测(自动发现已安装的 AI 工具) * - 目录结构创建 * - 技能和命令生成 * - 配置文件初始化 * * **I/O 策略**: 当前全部使用 fs *Sync 变体(CLI 单用户场景可接受)。 * 迁移为 API/Server 时需将 createDirectoryStructure(), generateSampleSkills() * 等方法改为 async + fs.promises。 */ export interface InitOptions { /** 目标工具 */ tools?: string; /** 强制覆盖 */ force?: boolean; /** 交互式 */ interactive?: boolean; /** Profile */ profile?: 'core' | 'custom'; /** 安静模式 */ quiet?: boolean; } export interface DetectedTool { name: string; toolId: string; skillsDir: string; available: boolean; configured: boolean; } export interface InitResult { success: boolean; toolsDetected: DetectedTool[]; dirsCreated: string[]; skillsGenerated: number; warnings: string[]; } export declare const SUPPORTED_TOOLS: Array<{ name: string; toolId: string; skillsDir: string; detectionPaths: string[]; }>; export declare class InitEngine { private projectRoot; private warnings; constructor(projectRoot: string); /** * 执行初始化 * Phase 7 为 CodeGraph 集成(异步),其余为同步操作 */ initialize(options?: InitOptions): Promise; /** * 检测项目中的 AI 工具 */ detectTools(): DetectedTool[]; /** * 获取项目已激活的工具 */ getActiveTools(): DetectedTool[]; /** * 检测 Memory 数据源(Claude Code、CodeBuddy) */ private detectMemorySources; /** * 为指定工具生成命令 */ generateForTool(toolId: string): { path: string; content: string; }[]; private validateProject; private createDirectoryStructure; private createOpenSpecStructure; private generateSampleSkills; /** * 刷新 CLI 模式工件(schemas + skills + commands + hooks) * * 用于 `specpow update` 命令在非 plugin.json 项目(CLI 模式)中 * 重新同步包内置的 schemas、skills、CLI 命令和 hooks。 * 跳过未变化的文件(基于内容比较),保护用户已修改的文件。 */ refreshCliArtifacts(): { schemasCopied: number; skillsCopied: number; commandsCopied: number; hooksRegistered: boolean; }; /** * 同步目录(跳过内容未变的文件) */ private syncDirRecursive; /** * 幂等注册 hooks 到所有已检测到的 AI 工具 settings.json * 当前支持:.claude/settings.json, .codebuddy/settings.json */ private registerHooksIdempotent; } //# sourceMappingURL=engine.d.ts.map