/** * Git 工具函数 — 提供 git hash 读取等基础操作。 * * 职责边界: * - 负责:获取文件/HEAD 的 git hash、检查文件是否有未提交变更 * - 不负责:git commit/push/pull 等写操作、merge 冲突处理 * * 被谁调用:验证摘要、新鲜度判定和项目路径解析 * 调用谁:git CLI(通过 child_process) * * 数据流:文件系统 → git CLI → hash 字符串 * 持久化:无(纯读取) */ import type { ProjectMapOverrideValue } from "../domain/project_map.js"; /** * 获取指定文件的 git hash(blob hash)。 * git 不可用(未装 / cwd 无效)时降级为内容 sha256(前缀 `c:`);文件不存在返回空字符串。 */ export declare function getFileGitHash(filePath: string, cwd?: string): Promise; /** * 主产物 bundle hash:主路径 + references + companion_files 共同决定 verified 是否仍有效。 * 无附件/引用时保持 getGlobArtifactHash 的旧格式,避免普通产物无意义全量 stale。 */ export declare function getArtifactBundleHash(projectRoot: string, artifact: { kind?: string; path_pattern: string; references?: string[]; companion_files?: string[]; }, overrides?: Record): Promise; /** * 获取 HEAD 的 commit hash(短格式)。 * 如果不在 git 仓库中,返回空字符串。 */ export declare function getHeadHash(cwd?: string): Promise; /** * 获取指定文件在 HEAD 中的 hash(即 git 跟踪的版本)。 * 文件未跟踪或已删除返回空字符串。 */ export declare function getTrackedFileHash(filePath: string, cwd?: string): Promise; /** * 检查文件是否有未提交的变更(工作区 vs HEAD)。 */ export declare function hasUncommittedChanges(filePath: string, cwd?: string): Promise;