@spaceflow/review 0.29.3 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  import { z } from "@spaceflow/core";
2
+ import type { LLMMode, VerboseLevel } from "@spaceflow/core";
3
+ import type { ReportFormat } from "./review-report";
2
4
 
3
5
  /** LLM 模式 schema(与 core 中的 LLMMode 保持一致) */
4
6
  const llmModeSchema = z.enum(["claude-code", "openai", "gemini", "open-code"]);
@@ -12,6 +14,65 @@ const severitySchema = z.enum(["off", "warn", "error"]);
12
14
  /** 变更文件处理策略 schema */
13
15
  const invalidateChangedFilesSchema = z.enum(["invalidate", "keep", "off"]);
14
16
 
17
+ /**
18
+ * 删除代码分析模式
19
+ * - true: 始终启用
20
+ * - false: 始终禁用
21
+ * - 'ci': 仅在 CI 环境中启用
22
+ * - 'pr': 仅在 PR 环境中启用
23
+ * - 'terminal': 仅在终端环境中启用
24
+ */
25
+ export type AnalyzeDeletionsMode = z.infer<typeof analyzeDeletionsModeSchema>;
26
+
27
+ /** 审查规则严重级别 */
28
+ export type Severity = z.infer<typeof severitySchema>;
29
+
30
+ /**
31
+ * 变更文件处理策略
32
+ * - 'invalidate': 将变更文件的历史问题标记为无效(默认)
33
+ * - 'keep': 保留历史问题,不做处理
34
+ * - 'off': 关闭此功能
35
+ */
36
+ export type InvalidateChangedFilesMode = z.infer<typeof invalidateChangedFilesSchema>;
37
+
38
+ /**
39
+ * Review 命令选项
40
+ */
41
+ export interface ReviewOptions {
42
+ dryRun: boolean;
43
+ ci: boolean;
44
+ prNumber?: number;
45
+ base?: string;
46
+ head?: string;
47
+ references?: string[];
48
+ verbose?: VerboseLevel;
49
+ includes?: string[];
50
+ llmMode?: LLMMode;
51
+ files?: string[];
52
+ commits?: string[];
53
+ verifyFixes?: boolean;
54
+ verifyConcurrency?: number;
55
+ analyzeDeletions?: AnalyzeDeletionsMode;
56
+ /** 仅执行删除代码分析,跳过常规代码审查 */
57
+ deletionOnly?: boolean;
58
+ /** 删除代码分析模式:openai 使用标准模式,claude-agent 使用 Agent 模式 */
59
+ deletionAnalysisMode?: LLMMode;
60
+ /** 输出格式:markdown, terminal, json。不指定则智能选择 */
61
+ outputFormat?: ReportFormat;
62
+ /** 是否使用 AI 生成 PR 功能描述 */
63
+ generateDescription?: boolean;
64
+ /** 显示所有问题,不过滤非变更行的问题 */
65
+ showAll?: boolean;
66
+ /** 仅刷新状态(同步 reactions、resolved 等),不执行 LLM 审查 */
67
+ flush?: boolean;
68
+ /** PR 事件类型(opened, synchronize, closed 等) */
69
+ eventAction?: string;
70
+ concurrency?: number;
71
+ timeout?: number;
72
+ retries?: number;
73
+ retryDelay?: number;
74
+ }
75
+
15
76
  /** review 命令配置 schema(LLM 敏感配置由系统 llm.config.ts 管理) */
16
77
  export const reviewSchema = () =>
17
78
  z.object({
@@ -33,26 +94,5 @@ export const reviewSchema = () =>
33
94
  invalidateChangedFiles: invalidateChangedFilesSchema.default("invalidate").optional(),
34
95
  });
35
96
 
36
- /**
37
- * 变更文件处理策略
38
- * - 'invalidate': 将变更文件的历史问题标记为无效(默认)
39
- * - 'keep': 保留历史问题,不做处理
40
- * - 'off': 关闭此功能
41
- */
42
- export type InvalidateChangedFilesMode = z.infer<typeof invalidateChangedFilesSchema>;
43
-
44
97
  /** review 配置类型(从 schema 推导) */
45
98
  export type ReviewConfig = z.infer<ReturnType<typeof reviewSchema>>;
46
-
47
- /**
48
- * 删除代码分析模式
49
- * - true: 始终启用
50
- * - false: 始终禁用
51
- * - 'ci': 仅在 CI 环境中启用
52
- * - 'pr': 仅在 PR 环境中启用
53
- * - 'terminal': 仅在终端环境中启用
54
- */
55
- export type AnalyzeDeletionsMode = z.infer<typeof analyzeDeletionsModeSchema>;
56
-
57
- /** 审查规则严重级别 */
58
- export type Severity = z.infer<typeof severitySchema>;