/** * Shared Types — 真实运行时共享的项目配置、系统类型和脚手架类型。 * * 职责边界: * - 负责:跨模型共享的基础枚举类型 * - 不负责:业务模型专属类型(各模型自己的 types.ts) * * 被谁调用:4 个模型 + types/index.ts barrel * 调用谁:无依赖 * * 数据流:类型定义 → 供其他模块引用 * 持久化:无持久化(纯计算/内存态) */ /** 系统类型:新系统(绿场)/ 老系统(增量改造),决定走哪条管线 */ export type SystemType = "新系统" | "老系统"; export interface CustomScaffoldContract { /** 必需的模板变量名,缺失则阻断渲染 */ required_template_vars?: string[]; /** 允许的技术栈关键词(匹配 tech_stack.backend.framework 或 frontend.framework),为空则不限 */ tech_stack?: string[]; /** 输出边界约束 */ output_boundary?: { /** 禁止出现的正则模式(如 ["System\\.exit", "Runtime\\.exec"]) */ forbidden_patterns?: string[]; /** 单文件最大字节数 */ max_file_size?: number; }; } /** 构建命令配置 */ interface BuildCommands { /** 构建命令 */ build: string; /** 测试命令 */ test: string; /** 全量构建(含测试)命令 */ full: string; } /** 仓库配置 */ interface RepoConfig { /** 仓库名称 */ name: string; /** 仓库路径 */ path: string; /** 编程语言 */ lang: string; /** 框架 */ framework: string; /** 作用域路径列表 */ scope: string[]; } /** 多工程项目类型 */ type ProjectKind = "frontend-end" | "backend" | "shared"; /** 多工程项目声明 */ interface ProjectEntry { /** 工程 ID(如 FE-admin-01 / backend / shared) */ id: string; /** 工程目录(项目根相对路径) */ dir: string; /** 工程类型;缺失时由使用方按 id/dir/tech_stack 保守推断 */ kind?: ProjectKind; /** 是否独立部署;缺失时默认 kind !== shared */ deployable?: boolean; /** 是否独立发版(独立推镜像仓库);缺失时默认 = deployable */ release_unit?: boolean; /** 技术栈 */ tech_stack?: { lang: string; framework: string; }; } /** 项目配置 */ export interface ProjectConfig { /** 配置 schema 版本 */ schema_version?: number; /** 项目名称 */ name: string; /** 技术栈 */ tech_stack: { backend: { lang: string; framework: string; version: string; }; frontend: { lang: string; framework: string; version: string; }; }; /** 产品画像 */ product_profile: string; /** 仓库配置列表 */ repos: RepoConfig[]; /** 多工程项目目录声明 */ projects?: ProjectEntry[]; /** 构建命令 */ build_commands: { backend: BuildCommands; frontend: BuildCommands; }; /** 作用域范围 */ scope: { backend: string[]; frontend: string[]; }; /** 约定文件路径 */ conventions_file?: string; /** 验证超时设置 */ verify_timeout?: { /** 构建超时(秒) */ build: number; /** 测试超时(秒) */ test: number; }; /** 产品映射(功能点到模块的映射) */ product_mapping?: Record; /** 脚手架配置 */ scaffold?: { /** 基础包名 */ base_package?: string; /** 模板名称 */ templates?: string; /** 自定义模板目录 */ custom_templates_dir?: string; /** 自定义脚手架项目级合同(按模板集名称索引) */ contracts?: Record; }; /** @internal resolved at runtime, not from config file */ _projectPath?: string; /** @internal 知识索引降级标记 — 索引构建失败时设为 true */ _knowledgeDegraded?: boolean; } /** 解析后的项目配置(含来源信息) */ export interface ResolvedConfig { config: ProjectConfig; source: "config_file" | "inferred"; } /** 脚手架文件 */ export interface ScaffoldFile { /** 文件路径 */ path: string; /** 文件内容 */ content: string; /** 文件描述 */ description: string; /** 是否为模板文件 */ is_template: boolean; /** 模板变量 */ template_vars?: Record; } /** 脚手架生成结果 */ export interface ScaffoldResult { /** 任务 ID */ task_id: string; /** 模块名称 */ module_name: string; /** 生成的文件列表 */ files: ScaffoldFile[]; /** 生成摘要 */ summary: string; /** 生成文件总数 */ total_files: number; /** 警告信息列表 */ warnings: string[]; /** 已存在、不可直接覆盖的候选路径 */ conflicting_paths: string[]; } export {};