@spaceflow/core 0.16.0 → 0.18.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.
package/dist/index.js CHANGED
@@ -1046,7 +1046,17 @@ function parseDiffText(diffText) {
1046
1046
  return this.request("POST", `/repos/${owner}/${repo}/pulls/${index}/reviews`, options);
1047
1047
  }
1048
1048
  async listPullReviews(owner, repo, index) {
1049
- return this.request("GET", `/repos/${owner}/${repo}/pulls/${index}/reviews`);
1049
+ const allReviews = [];
1050
+ let page = 1;
1051
+ const limit = 50;
1052
+ while(true){
1053
+ const reviews = await this.request("GET", `/repos/${owner}/${repo}/pulls/${index}/reviews?page=${page}&limit=${limit}`);
1054
+ if (!reviews || reviews.length === 0) break;
1055
+ allReviews.push(...reviews);
1056
+ if (reviews.length < limit) break;
1057
+ page++;
1058
+ }
1059
+ return allReviews;
1050
1060
  }
1051
1061
  async updatePullReview(owner, repo, index, reviewId, body) {
1052
1062
  // Gitea 不支持更新 review,使用删除+创建的方式模拟
@@ -1065,8 +1075,30 @@ function parseDiffText(diffText) {
1065
1075
  async deletePullReviewComment(owner, repo, commentId) {
1066
1076
  await this.request("DELETE", `/repos/${owner}/${repo}/pulls/comments/${commentId}`);
1067
1077
  }
1068
- async listResolvedThreads() {
1069
- return [];
1078
+ async listResolvedThreads(owner, repo, index) {
1079
+ const result = [];
1080
+ try {
1081
+ const reviews = await this.listPullReviews(owner, repo, index);
1082
+ for (const review of reviews){
1083
+ if (!review.id) continue;
1084
+ const comments = await this.listPullReviewComments(owner, repo, index, review.id);
1085
+ for (const comment of comments){
1086
+ if (!comment.resolver) continue;
1087
+ result.push({
1088
+ path: comment.path,
1089
+ line: comment.position,
1090
+ resolvedBy: {
1091
+ id: comment.resolver.id,
1092
+ login: comment.resolver.login
1093
+ },
1094
+ body: comment.body
1095
+ });
1096
+ }
1097
+ }
1098
+ } catch {
1099
+ // 获取失败时返回空数组,不影响主流程
1100
+ }
1101
+ return result;
1070
1102
  }
1071
1103
  // ============ Reaction 操作 ============
1072
1104
  async getIssueCommentReactions(owner, repo, commentId) {
@@ -1654,13 +1686,15 @@ function parseDiffText(diffText) {
1654
1686
  const result = [];
1655
1687
  for (const thread of threads){
1656
1688
  if (!thread.isResolved) continue;
1689
+ const firstComment = thread.comments.nodes[0];
1657
1690
  result.push({
1658
1691
  path: thread.path ?? undefined,
1659
1692
  line: thread.line ?? undefined,
1660
1693
  resolvedBy: thread.resolvedBy ? {
1661
1694
  id: thread.resolvedBy.databaseId,
1662
1695
  login: thread.resolvedBy.login
1663
- } : null
1696
+ } : null,
1697
+ body: firstComment?.body
1664
1698
  });
1665
1699
  }
1666
1700
  return result;
@@ -1679,7 +1713,7 @@ function parseDiffText(diffText) {
1679
1713
  path
1680
1714
  line
1681
1715
  comments(first: 1) {
1682
- nodes { databaseId }
1716
+ nodes { databaseId body }
1683
1717
  }
1684
1718
  }
1685
1719
  }
@@ -11414,7 +11448,7 @@ async function exec(extensions = [], options = {}) {
11414
11448
  // 6. 创建 CLI 程序
11415
11449
  const program = new Command();
11416
11450
  const cliVersion = options.cliVersion || "0.0.0";
11417
- const coreVersion = true ? "0.16.0" : 0;
11451
+ const coreVersion = true ? "0.18.0" : 0;
11418
11452
  const versionOutput = `spaceflow/${cliVersion} core/${coreVersion}`;
11419
11453
  program.name("spaceflow").description("Spaceflow CLI").version(versionOutput, "-V, --version", "显示版本信息");
11420
11454
  // 定义全局 verbose 选项(支持计数:-v, -vv, -vvv)