/** * change-detection — 变更感知模块(v6.69.0+) * * 通过 Git diff 识别变更范围,将变更文件映射到受影响的端, * 支持 Pipeline 的增量分析(仅分析受影响端)。 * * v6.69.1 修复: * - 对比基准从 HEAD 改为 CONSTITUTION.md 配置的默认分支 * - 新增分析快照持久化,支持基于上次分析点的增量 diff */ export interface PlatformChangeInfo { platform: string; changedFiles: string[]; changeCount: number; } /** * 获取 CONSTITUTION.md 配置的默认分支(带缓存) * 优先级:CONSTITUTION.md > 硬编码 'main' */ export declare function getDefaultBaseRef(): string; /** * 获取 Git 工作区的变更文件列表 * @param baseRef 对比的基准 ref(默认使用 CONSTITUTION.md 配置的默认分支) * @returns 相对路径列表 */ export declare function getChangedFiles(baseRef?: string): string[]; /** * 获取两个 commit/ref 之间的变更文件列表 * @param fromRef 起始 ref(如上次分析的 commit) * @param toRef 结束 ref(默认 HEAD) */ export declare function getChangedFilesBetween(fromRef: string, toRef?: string): string[]; /** * 获取工作区中未跟踪的新文件 */ export declare function getUntrackedFiles(): string[]; /** * 读取 CONSTITUTION.md 中的源码路径 → 端映射 * @returns Map<源码路径, 端名> */ export declare function loadSourcePathMap(cwd: string): Promise>; /** * 检测变更影响的端 * * 策略: * 1. 需求/规格文件变更(010-requirements/、020-specs/)→ 影响所有端 * 2. 源码文件变更 → 根据 CONSTITUTION.md 的源码路径映射到对应端 * 3. 全局配置变更(.speccore/)→ 影响所有端 * 4. 其他文件变更(CI、文档等)→ 不影响分析 * * v6.69.1: 支持基于分析快照的增量检测 * * @param cwd 工作目录 * @param changedFiles 可选:预计算的变更文件列表(不传则自动检测) * @param options 可选配置 * @returns 受影响的端名列表(空数组表示无变更或无法检测) */ export declare function detectAffectedPlatforms(cwd: string, changedFiles?: string[], options?: { /** 分析范围标识,用于读取快照(如 'global', 'Iteration-Q2', 'Task-001') */ scope?: string; /** 是否使用增量模式(基于上次分析的 commit 做 diff) */ incremental?: boolean; }): Promise; /** * 获取详细的变更信息(按端分组) */ export declare function getPlatformChangeDetails(cwd: string, changedFiles?: string[]): Promise; /** * 检测各端的优先级顺序(关键路径优先排序) * * 策略: * 1. 读取迭代中所有子任务的 TaskState * 2. 按 platform 分组,统计各端 high/medium/low 优先级任务数量 * 3. 按「high 数量降序 → medium 数量降序 → low 数量降序」排序端 * 4. 如果某端没有任务,赋予最低优先级 * * @param iteration 迭代名 * @returns 按优先级排序的端名列表(靠前的优先分析) */ export declare function detectPlatformPriorityOrder(iteration: string): Promise; export interface AnalysisSnapshot { lastCommit: string; analyzedAt: string; branch: string; } export interface AnalysisSnapshots { [scope: string]: AnalysisSnapshot; } /** * 读取分析快照文件 */ export declare function readAnalysisSnapshots(): Promise; /** * 写入分析快照文件 */ export declare function writeAnalysisSnapshots(snapshots: AnalysisSnapshots): Promise; /** * 获取当前 HEAD 的 commit hash */ export declare function getCurrentCommitHash(): string | null; /** * 获取当前分支名 */ export declare function getCurrentBranch(): string | null; /** * 基于上次分析的快照获取增量变更文件 * @param scope 分析范围标识(如 'global', 'Iteration-Q2', 'Task-001') * @returns 自上次分析以来的变更文件列表(无快照则 fallback 到默认分支对比) */ export declare function getIncrementalChangedFiles(scope: string): Promise; /** * 记录分析快照(分析完成后调用) * @param scope 分析范围标识(如 'global', 'Iteration-Q2', 'Task-001') */ export declare function recordAnalysisSnapshot(scope: string): Promise; /** * 清除指定范围的分析快照 * @param scope 分析范围标识,不传则清除全部 */ export declare function clearAnalysisSnapshot(scope?: string): Promise; //# sourceMappingURL=change-detection.d.ts.map