@spaceflow/review 0.75.0 → 0.77.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.
@@ -0,0 +1,19 @@
1
+ import type { VerboseLevel } from "@spaceflow/core";
2
+
3
+ export interface FileReviewPrompt {
4
+ filename: string;
5
+ systemPrompt: string;
6
+ userPrompt: string;
7
+ }
8
+
9
+ export interface ReviewPrompt {
10
+ filePrompts: FileReviewPrompt[];
11
+ }
12
+
13
+ export interface LLMReviewOptions {
14
+ verbose?: VerboseLevel;
15
+ concurrency?: number;
16
+ timeout?: number;
17
+ retries?: number;
18
+ retryDelay?: number;
19
+ }
@@ -0,0 +1,32 @@
1
+ import type { PullRequestCommit } from "@spaceflow/core";
2
+
3
+ export function buildLinesWithNumbers(contentLines: [string, string][]): string {
4
+ const padWidth = String(contentLines.length).length;
5
+ return contentLines
6
+ .map(([hash, line], index) => {
7
+ const lineNum = index + 1;
8
+ return `${hash} ${String(lineNum).padStart(padWidth)}| ${line}`;
9
+ })
10
+ .join("\n");
11
+ }
12
+
13
+ export function buildCommitsSection(
14
+ contentLines: [string, string][],
15
+ commits: PullRequestCommit[],
16
+ ): string {
17
+ const fileCommitHashes = new Set<string>();
18
+ for (const [hash] of contentLines) {
19
+ if (hash !== "-------") {
20
+ fileCommitHashes.add(hash);
21
+ }
22
+ }
23
+ const relatedCommits = commits.filter((c) => {
24
+ const shortHash = c.sha?.slice(0, 7) || "";
25
+ return fileCommitHashes.has(shortHash);
26
+ });
27
+ return relatedCommits.length > 0
28
+ ? relatedCommits
29
+ .map((c) => `- \`${c.sha?.slice(0, 7)}\` ${c.commit?.message?.split("\n")[0]}`)
30
+ .join("\n")
31
+ : "- 无相关 commits";
32
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../packages/core/tsconfig.skill.json",
2
+ "extends": "../../packages/core/tsconfig.extension.json",
3
3
  "compilerOptions": {
4
4
  "types": ["vitest/globals"]
5
5
  },