@spaceflow/core 0.19.0 → 0.20.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
@@ -1026,7 +1026,34 @@ function parseDiffText(diffText) {
1026
1026
  }
1027
1027
  // ============ Issue 操作 ============
1028
1028
  async createIssue(owner, repo, options) {
1029
- return this.request("POST", `/repos/${owner}/${repo}/issues`, options);
1029
+ const body = {
1030
+ title: options.title,
1031
+ body: options.body,
1032
+ assignees: options.assignees,
1033
+ milestone: options.milestone,
1034
+ due_date: options.due_date
1035
+ };
1036
+ if (options.labels?.length) {
1037
+ body.labels = await this.resolveLabelIds(owner, repo, options.labels);
1038
+ }
1039
+ return this.request("POST", `/repos/${owner}/${repo}/issues`, body);
1040
+ }
1041
+ /**
1042
+ * 将标签名称列表转换为 Gitea label ID 列表
1043
+ */ async resolveLabelIds(owner, repo, names) {
1044
+ const allLabels = await this.request("GET", `/repos/${owner}/${repo}/labels`);
1045
+ const nameToId = new Map(allLabels.map((l)=>[
1046
+ l.name.toLowerCase(),
1047
+ l.id
1048
+ ]));
1049
+ const ids = [];
1050
+ for (const name of names){
1051
+ const id = nameToId.get(name.toLowerCase());
1052
+ if (id !== undefined) {
1053
+ ids.push(id);
1054
+ }
1055
+ }
1056
+ return ids;
1030
1057
  }
1031
1058
  async listIssueComments(owner, repo, index) {
1032
1059
  return this.request("GET", `/repos/${owner}/${repo}/issues/${index}/comments`);
@@ -11434,7 +11461,7 @@ async function exec(extensions = [], options = {}) {
11434
11461
  // 6. 创建 CLI 程序
11435
11462
  const program = new Command();
11436
11463
  const cliVersion = options.cliVersion || "0.0.0";
11437
- const coreVersion = true ? "0.19.0" : 0;
11464
+ const coreVersion = true ? "0.20.0" : 0;
11438
11465
  const versionOutput = `spaceflow/${cliVersion} core/${coreVersion}`;
11439
11466
  program.name("spaceflow").description("Spaceflow CLI").version(versionOutput, "-V, --version", "显示版本信息");
11440
11467
  // 定义全局 verbose 选项(支持计数:-v, -vv, -vvv)