/** * Fingerprint — 配置层模块。 * * 职责边界: * - 负责:DetectedFramework 等 配置层职责 * - 不负责:不属于本模块的职责由对应模块承担 * * 被谁调用:项目初始化、配置加载 * 调用谁:node:fs、node:path、yaml、logger、helpers、framework_map * * 数据流:输入 → DetectedFramework 处理 → 输出 * 持久化:读写本地文件(详见代码内路径) */ /** 检测到的框架信息 */ interface DetectedFramework { /** 编程语言 */ lang: string; /** 框架名称 */ framework: string; /** 框架版本 */ version: string; /** 检测来源文件 */ detected_from: string; } /** 项目指纹 */ export interface Fingerprint { /** 项目根路径 */ project_root: string; /** 后端框架检测结果 */ backend: DetectedFramework | null; /** 前端框架检测结果 */ frontend: DetectedFramework | null; /** 包管理器列表 */ package_managers: string[]; /** package.json scripts */ pkg_scripts: Record; /** workspace 信息(monorepo 检测) */ workspace: WorkspaceInfo | null; /** 项目目录列表 */ directories: string[]; /** 检测警告 */ warnings: string[]; /** 部署基础设施(docker-compose / Dockerfile / 本地 dev server) */ deployment?: DeploymentFingerprint; } /** 部署基础设施指纹 */ export interface DeploymentFingerprint { /** 部署方式 */ method: "docker_compose" | "dockerfile" | "local_dev_server" | "unknown"; /** 部署文件路径列表(相对于项目根) */ deploy_files: string[]; /** 从部署文件解析出的服务列表 */ services: DeploymentService[]; /** 用户声明的 HTTP 验收探针(intent.deployment.http_acceptance 透传;探测不产生,恒 undefined)。 * 配置驱动 local_http_acceptance:声明 path + 期望(状态码/响应体子串),治"启动≠逻辑通"。 * 无配置时 executor 回退自动探活(/health + 根路径)。 */ http_acceptance?: HttpAcceptanceProbe[]; } /** HTTP 验收探针 —— 用户在 intent.deployment.http_acceptance 声明,驱动 local_http_acceptance executor。 * 覆盖"状态码/关键字段/登录态"三个验收维度: * - 状态码:expected_status(默认 2xx/3xx;受保护端点可声明 401/403 证鉴权门存在——即"登录态"校验)。 * - 关键字段:expected_body_contains / expected_body_not_contains(响应体子串断言)。 * - 登录态:受保护端点 path + expected_status: 401(未授权被拒即鉴权生效;不做完整登录编排—— * 凭据不入 intent.yaml 的安全考虑 + 超出确定性探活定位)。 * method 固定 GET(探活场景足够;POST/headers/登录流程编排留 backlog)。 */ export interface HttpAcceptanceProbe { /** 探测路径(相对 host 根,如 /api/health、/api/users)。必填。 */ path: string; /** 指定走哪个 host 端口(多端口时;不填用 compose 首个 host 端口)。 */ port?: number; /** 期望 HTTP 状态码(不填默认 2xx/3xx)。受保护端点声明 401/403 证鉴权门。 */ expected_status?: number; /** 期望响应体包含的子串(关键字段断言)。 */ expected_body_contains?: string; /** 期望响应体不包含的子串(如 "error"/"exception")。 */ expected_body_not_contains?: string; } /** 从部署文件解析出的单个服务 */ interface DeploymentService { /** 服务名称(docker-compose 中的 service key) */ name: string; /** 服务类型 */ type: "frontend" | "backend_api" | "database" | "cache" | "object_storage" | "reverse_proxy" | "queue" | "other"; /** 端口映射列表 */ ports: Array<{ internal: number; external: number; }>; /** 启动命令(Dockerfile CMD 或 compose command) */ start_command?: string; } /** Workspace 信息 */ interface WorkspaceInfo { /** workspace 类型 */ type: "pnpm" | "nx" | "turbo" | "lerna" | "yarn" | "npm"; /** 子包列表 */ packages: WorkspacePackage[]; } /** Workspace 子包 */ interface WorkspacePackage { /** 子包名称 */ name: string; /** 相对路径 */ path: string; /** 分类 */ layer: "backend" | "frontend" | "shared"; } /** * 探测项目指纹 — 纯确定性,无 LLM 参与。 * * 执行顺序: * 1. 读取 package.json(缓存,避免重复读取) * 2. 后端探测(遍历 backend profiles) * 3. 记录后端已使用的标记文件 * 4. 前端探测(排除后端已使用的标记) * 5. 包管理器 / scripts / workspace 检测 */ export declare function detectFingerprint(projectRoot: string): Promise; export {};