@candriajs/karin-plugin-git 1.5.0 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,129 @@
1
1
  # 变更日志
2
2
 
3
+ ## [1.8.0](https://github.com/CandriaJS/karin-plugin-git/compare/core-v1.7.0...core-v1.8.0) (2026-05-06)
4
+
5
+
6
+ ### ✨ 新功能
7
+
8
+ * **core:** 新增 Release 订阅功能并重构仓库管理 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
9
+ * **core:** 添加仓库绑定功能并重构数据库结构 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
10
+ * **models:** 实现session和bind数据模型 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
11
+ * **web:** 添加平台推送仓库列表配置界面 ([c720bf1](https://github.com/CandriaJS/karin-plugin-git/commit/c720bf169ad727f39484e1e4e3b68c7500e2582e))
12
+
13
+
14
+ ### 🐛 错误修复
15
+
16
+ * **commit:** 优化提交信息查询逻辑 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
17
+ * 修复ci ([7aff0cf](https://github.com/CandriaJS/karin-plugin-git/commit/7aff0cf7420f5f2cf097e5a1b4370e397dd657ac))
18
+ * 修复ci发版 ([ef880b8](https://github.com/CandriaJS/karin-plugin-git/commit/ef880b88bdd5cba704adfdd3096a98e8b8c31e74))
19
+ * 修复图标路径 ([e12ef68](https://github.com/CandriaJS/karin-plugin-git/commit/e12ef68da2e8d2ecc9c0b3405d00675ad0565f7c))
20
+ * 修正ci ([b8f8dfe](https://github.com/CandriaJS/karin-plugin-git/commit/b8f8dfe6395f28052859bd9b5cdcbac0086eedf3))
21
+
22
+
23
+ ### 🎨 代码样式
24
+
25
+ * 优化模板 ([68b963c](https://github.com/CandriaJS/karin-plugin-git/commit/68b963c862c6c3402147be0b307089dfae0eed4a))
26
+
27
+
28
+ ### 🔧 其他更新
29
+
30
+ * **core:** 更新 nipaw 依赖版本 ([6575fc9](https://github.com/CandriaJS/karin-plugin-git/commit/6575fc9832f56419300be40c48f704159c2f293f))
31
+ * release main ([a1cd269](https://github.com/CandriaJS/karin-plugin-git/commit/a1cd269af7d9e61f1764385a2b2a5cf0ffd52987))
32
+ * release main ([6e97261](https://github.com/CandriaJS/karin-plugin-git/commit/6e9726148136390833dcd1309d807aad374aa5ad))
33
+ * release main ([aa229e2](https://github.com/CandriaJS/karin-plugin-git/commit/aa229e29ca9e58630ffaadf241031fd770e6b521))
34
+ * release main ([dace4f9](https://github.com/CandriaJS/karin-plugin-git/commit/dace4f92809005877ee404ce985ad0a7499b6cd8))
35
+ * 更新help组件 ([a8fa23a](https://github.com/CandriaJS/karin-plugin-git/commit/a8fa23ac44c1ac6293195999d3d4c80ba382c0d3))
36
+
37
+
38
+ ### ♻️ 代码重构
39
+
40
+ * **config:** 重构配置文件结构 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
41
+ * **core:** 重构核心实现 ([#14](https://github.com/CandriaJS/karin-plugin-git/issues/14)) ([fa15ee1](https://github.com/CandriaJS/karin-plugin-git/commit/fa15ee174127db957b7b18584daf6ac157cf370a))
42
+ * **template:** 重构模板结构并新增 Release 组件 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
43
+
44
+
45
+ ### Dependencies
46
+
47
+ * The following workspace dependencies were updated
48
+ * devDependencies
49
+ * @candriajs/template bumped to 1.8.0
50
+
51
+ ## [1.7.0](https://github.com/CandriaJS/karin-plugin-git/compare/core-v1.6.0...core-v1.7.0) (2026-05-06)
52
+
53
+
54
+ ### ✨ 新功能
55
+
56
+ * **core:** 新增 Release 订阅功能并重构仓库管理 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
57
+ * **core:** 添加仓库绑定功能并重构数据库结构 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
58
+ * **models:** 实现session和bind数据模型 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
59
+ * **web:** 添加平台推送仓库列表配置界面 ([c720bf1](https://github.com/CandriaJS/karin-plugin-git/commit/c720bf169ad727f39484e1e4e3b68c7500e2582e))
60
+
61
+
62
+ ### 🐛 错误修复
63
+
64
+ * **commit:** 优化提交信息查询逻辑 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
65
+ * 修复ci ([7aff0cf](https://github.com/CandriaJS/karin-plugin-git/commit/7aff0cf7420f5f2cf097e5a1b4370e397dd657ac))
66
+ * 修复ci发版 ([ef880b8](https://github.com/CandriaJS/karin-plugin-git/commit/ef880b88bdd5cba704adfdd3096a98e8b8c31e74))
67
+ * 修复图标路径 ([e12ef68](https://github.com/CandriaJS/karin-plugin-git/commit/e12ef68da2e8d2ecc9c0b3405d00675ad0565f7c))
68
+ * 修正ci ([b8f8dfe](https://github.com/CandriaJS/karin-plugin-git/commit/b8f8dfe6395f28052859bd9b5cdcbac0086eedf3))
69
+
70
+
71
+ ### 🎨 代码样式
72
+
73
+ * 优化模板 ([68b963c](https://github.com/CandriaJS/karin-plugin-git/commit/68b963c862c6c3402147be0b307089dfae0eed4a))
74
+
75
+
76
+ ### 🔧 其他更新
77
+
78
+ * **core:** 更新 nipaw 依赖版本 ([6575fc9](https://github.com/CandriaJS/karin-plugin-git/commit/6575fc9832f56419300be40c48f704159c2f293f))
79
+ * release main ([6e97261](https://github.com/CandriaJS/karin-plugin-git/commit/6e9726148136390833dcd1309d807aad374aa5ad))
80
+ * release main ([aa229e2](https://github.com/CandriaJS/karin-plugin-git/commit/aa229e29ca9e58630ffaadf241031fd770e6b521))
81
+ * release main ([dace4f9](https://github.com/CandriaJS/karin-plugin-git/commit/dace4f92809005877ee404ce985ad0a7499b6cd8))
82
+ * 更新help组件 ([a8fa23a](https://github.com/CandriaJS/karin-plugin-git/commit/a8fa23ac44c1ac6293195999d3d4c80ba382c0d3))
83
+
84
+
85
+ ### ♻️ 代码重构
86
+
87
+ * **config:** 重构配置文件结构 ([84cbfa9](https://github.com/CandriaJS/karin-plugin-git/commit/84cbfa9dcd7fdc6bc36371b2765fddd23e3ad367))
88
+ * **core:** 重构核心实现 ([#14](https://github.com/CandriaJS/karin-plugin-git/issues/14)) ([fa15ee1](https://github.com/CandriaJS/karin-plugin-git/commit/fa15ee174127db957b7b18584daf6ac157cf370a))
89
+ * **template:** 重构模板结构并新增 Release 组件 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
90
+
91
+
92
+ ### Dependencies
93
+
94
+ * The following workspace dependencies were updated
95
+ * devDependencies
96
+ * @candriajs/template bumped to 1.7.0
97
+
98
+ ## [1.6.0](https://github.com/CandriaJS/karin-plugin-git/compare/core-v1.5.0...core-v1.6.0) (2026-05-06)
99
+
100
+
101
+ ### ✨ 新功能
102
+
103
+ * **core:** 新增 Release 订阅功能并重构仓库管理 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
104
+
105
+
106
+ ### 🎨 代码样式
107
+
108
+ * 优化模板 ([68b963c](https://github.com/CandriaJS/karin-plugin-git/commit/68b963c862c6c3402147be0b307089dfae0eed4a))
109
+
110
+
111
+ ### 🔧 其他更新
112
+
113
+ * 更新help组件 ([a8fa23a](https://github.com/CandriaJS/karin-plugin-git/commit/a8fa23ac44c1ac6293195999d3d4c80ba382c0d3))
114
+
115
+
116
+ ### ♻️ 代码重构
117
+
118
+ * **template:** 重构模板结构并新增 Release 组件 ([7dc6d05](https://github.com/CandriaJS/karin-plugin-git/commit/7dc6d050cfaa794a31f3c706ae5c611486ea80b0))
119
+
120
+
121
+ ### Dependencies
122
+
123
+ * The following workspace dependencies were updated
124
+ * devDependencies
125
+ * @candriajs/template bumped to 1.6.0
126
+
3
127
  ## [1.5.0](https://github.com/CandriaJS/karin-plugin-git/compare/core-v1.4.0...core-v1.5.0) (2026-02-26)
4
128
 
5
129
 
package/lib/apps/admin.js CHANGED
@@ -1 +1 @@
1
- import"../root-q84D5Ojp.js";import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,s as c}from"../db-DhpZxiAN.js";import{i as l,n as u,r as d}from"../common-DZ40JEMm.js";import{d as f,f as p,l as m,u as h}from"../models-D_S-DAOz.js";import g from"node-karin";const _=g.command(/^#?git(?:添加|add)(?:订阅仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))(?:\s+([^/\s]+))?$/i,async e=>{let[,r,s,l,g]=e.msg.match(_.reg),v=g?g.toLocaleLowerCase().split(`,`).map(e=>e.trim()).filter(e=>e):[u.Push];v.length||v.push(u.Push);let y=e.selfId,b=e.groupId,x=d.GitHub,S=p();switch(r.toLowerCase()){case`github`:S=p(),x=d.GitHub;break;case`gitcode`:S=h(),x=d.GitCode;break;case`gitee`:S=f(),x=d.Gitee;break;case`cnb`:case`cnbcool`:S=m(),x=d.CnbCool;break;default:return await e.reply(`未找到该平台, 请重试`)}let[C,w]=await Promise.all([i(x,s,l),t(y,b)]);if(C||=(await o(x,s,l),await i(x,s,l)),w||=(await c(y,b),await t(y,b)),!C||!w)return await e.reply(`添加订阅仓库失败,请重试`);let T=`添加订阅仓库成功, 平台: ${x}, 仓库: ${s}/${l}, 订阅类型: ${v.join(`,`)}`;if(v.includes(u.Push)){let e=S.repo(),t;try{t=(await e.info({owner:s,repo:l})).defaultBranch}catch{t=`main`}await n(C.id,w.id,t)?T=`仓库 ${s}/${l} 的推送订阅已存在, 请勿重复订阅`:(await a(C.id,w.id,t),T+=`, 分支: ${t}`)}await e.reply(T)},{name:`admin:addRepo`,priority:500,event:`message.group`,permission:`master`}),v=g.command(/^#?git(?:绑定|bind)(?:仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))$/i,async t=>{let[,n,r,a]=t.msg.match(v.reg),c=d.GitHub;switch(n.toLowerCase()){case`github`:c=d.GitHub;break;case`gitcode`:c=d.GitCode;break;case`gitee`:c=d.Gitee;break;case`cnb`:case`cnbcool`:c=d.CnbCool;break;default:return await t.reply(`未找到该平台, 请重试`)}let l=await i(c,r,a);if(l||=(await o(c,r,a),await i(c,r,a)),!l)return await t.reply(`绑定仓库失败, 请重试`);if(await s(t.groupId))return await t.reply(`该群已绑定该仓库, 请勿重复绑定`);await e(t.groupId,l.id),await t.reply(`绑定仓库成功, 平台: ${c}, 仓库: ${r}/${a}`)},{name:`admin:bindRepo`,event:`message.group`}),y=g.command(/^#?git(?:移除|删除|remove)(?:订阅仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))$/i,async e=>{let[,n,a,o]=e.msg.match(y.reg),s=e.selfId,c=e.groupId,l=d.GitHub;switch(n.toLowerCase()){case`github`:l=d.GitHub;break;case`gitcode`:l=d.GitCode;break;case`gitee`:l=d.Gitee;break;case`cnb`:case`cnbcool`:l=d.CnbCool;break;default:return await e.reply(`未找到该平台, 请重试`)}let[u,f]=await Promise.all([i(l,a,o),t(s,c)]);if(!u||!f)return await e.reply(`未找到该订阅仓库, 删除失败,请重试`);await r(u.id,f.id),await e.reply(`删除订阅仓库成功`)},{name:`admin:removeRepo`,priority:500,event:`message.group`,permission:`master`}),b=g.command(/^#?git(?:设置|set)([^\s]+)?(?:token|访问令牌)([\s\S]+)$/i,async e=>{let[,t,n]=e.msg.match(b.reg),r;switch(t.toLowerCase()){case`github`:r=`github`;break;case`gitcode`:r=`gitcode`;break;case`gitee`:r=`gitee`;break;case`cnb`:case`cnbcool`:r=`cnbcool`;break;default:return await e.reply(`未找到该平台, 请重试`)}l.Modify(r,`token`,n),await e.reply(`设置${t.toLowerCase()}访问令牌成功`)},{name:`admin:SetToken`,priority:500,event:`message.friend`,permission:`master`});export{_ as AddRepo,v as BindRepo,y as RemoveRepo,b as SetToken};
1
+ import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,r as l,s as u,u as d}from"../db-DRx0_etZ.js";import{n as f}from"../common-DKsRuZTK.js";import{d as p,f as m,l as h,u as g}from"../models-ovIphdkj.js";import _ from"node-karin";const v=_.command(/^#?git(?:添加|add)(?:订阅仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))(?:\s+([^/\s]+))?$/i,async t=>{let[,i,a,o,f]=t.msg.match(v.reg),_=f?f.toLocaleLowerCase().split(`,`).map(e=>e.trim()).filter(e=>e):[`push`];_.length||_.push(`push`);let y=t.selfId,b=t.groupId,x=`GitHub`,S=m();switch(i.toLowerCase()){case`github`:S=m(),x=`GitHub`;break;case`gitcode`:S=g(),x=`GitCode`;break;case`gitee`:S=p(),x=`Gitee`;break;case`cnb`:case`cnbcool`:S=h(),x=`CnbCool`;break;default:return await t.reply(`未支持的平台,目前支持: github、gitee、gitcode、cnbcool`)}let[C,w]=await Promise.all([u(x,a,o),n(y,b)]);if(C||=(await e(x,a,o),await u(x,a,o)),w||=(await d(y,b),await n(y,b)),!C||!w)return await t.reply(`添加订阅仓库失败,请稍后重试`);let T=[],E=await s(C.id,w.id,`main`);if(_.includes(`push`))if(E)T.push(`推送订阅`);else{let e=S.repo(),t;try{t=(await e.info({owner:a,repo:o})).defaultBranch}catch{t=`main`}await r(C.id,w.id,t),T.push(`推送订阅 (分支: ${t})`)}let D=await l(C.id,w.id);if(_.includes(`release`)&&(D||await c(C.id,w.id,`latest`),T.push(`Release 订阅`)),T.length===0)return await t.reply(`未指定订阅类型,请指定 push 或 release`);await t.reply(`订阅成功!仓库: ${a}/${o},订阅类型: ${T.join(`、`)}`)},{name:`admin:addRepo`,priority:500,event:`message.group`,permission:`master`}),y=_.command(/^#?git(?:绑定|bind)(?:仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))$/i,async n=>{let[,r,i,a]=n.msg.match(y.reg),s=`GitHub`;switch(r.toLowerCase()){case`github`:s=`GitHub`;break;case`gitcode`:s=`GitCode`;break;case`gitee`:s=`Gitee`;break;case`cnb`:case`cnbcool`:s=`CnbCool`;break;default:return await n.reply(`未支持的平台,目前支持: github、gitee、gitcode、cnbcool`)}let c=await u(s,i,a);if(c||=(await e(s,i,a),await u(s,i,a)),!c)return await n.reply(`绑定仓库失败,请稍后重试`);if(await o(n.groupId))return await n.reply(`该群已绑定仓库,请勿重复绑定`);await t(n.groupId,c.id),await n.reply(`绑定仓库成功,仓库: ${i}/${a}`)},{name:`admin:bindRepo`,event:`message.group`}),b=_.command(/^#?git(?:移除|删除|remove)(?:订阅仓库|repo)(?:([a-zA-Z]+):([^/\s]+)\/([^:\s]+))(?:\s+([^/\s]+))?$/i,async e=>{let[,t,r,o,s]=e.msg.match(b.reg),c=e.selfId,l=e.groupId,d=`GitHub`;switch(t.toLowerCase()){case`github`:d=`GitHub`;break;case`gitcode`:d=`GitCode`;break;case`gitee`:d=`Gitee`;break;case`cnb`:case`cnbcool`:d=`CnbCool`;break;default:return await e.reply(`未支持的平台,目前支持: github、gitee、gitcode、cnbcool`)}let[f,p]=await Promise.all([u(d,r,o),n(c,l)]);if(!f||!p)return await e.reply(`未找到该订阅仓库,删除失败`);let m=[];if((!s||s.toLowerCase().includes(`push`))&&(await i(f.id,p.id),m.push(`推送订阅`)),(!s||s.toLowerCase().includes(`release`))&&(await a(f.id,p.id),m.push(`Release 订阅`)),m.length===0)return await e.reply(`未指定订阅类型,请指定 push 或 release`);await e.reply(`删除订阅成功,已取消: ${m.join(`、`)}`)},{name:`admin:removeRepo`,priority:500,event:`message.group`,permission:`master`}),x=_.command(/^#?git(?:设置|set)([^\s]+)?(?:token|访问令牌)([\s\S]+)$/i,async e=>{let[,t,n]=e.msg.match(x.reg),r;switch(t.toLowerCase()){case`github`:r=`github`;break;case`gitcode`:r=`gitcode`;break;case`gitee`:r=`gitee`;break;case`cnb`:case`cnbcool`:r=`cnbcool`;break;default:return await e.reply(`未支持的平台,目前支持: github、gitee、gitcode、cnbcool`)}f.Modify(r,`token`,n),await e.reply(`${t.toLowerCase()} 访问令牌设置成功`)},{name:`admin:SetToken`,priority:500,event:`message.friend`,permission:`master`});export{v as AddRepo,y as BindRepo,b as RemoveRepo,x as SetToken};
@@ -1,3 +1,3 @@
1
- import"../root-q84D5Ojp.js";import{i as e,o as t}from"../db-DhpZxiAN.js";import{i as n,r,t as i}from"../common-DZ40JEMm.js";import{d as a,f as o,l as s,u as c}from"../models-D_S-DAOz.js";import l,{logger as u}from"node-karin";import{isEmpty as d}from"es-toolkit/compat";const f=l.command(/^#?(?:git(?:commit|提交信息|提交记录))\s*(\w+)(?::(?:([^\/\s]+)\/([^:\s]+)))?(?::([^\/\s]+))?$/i,async l=>{let[,p,m,h,g]=l.msg.match(f.reg);if(!m||!h){let n=await t(l.groupId);if(!n)return await l.reply(`请先绑定仓库或指定仓库`);let r=await e(n.repoId);m=r.owner,h=r.repo}let _,v=n.token.github,y=r.GitHub;switch(p.toLowerCase()){case`github`:y=r.GitHub,_=o(),v=n.token.github;break;case`gitcode`:y=r.GitCode,_=c(),v=n.token.gitcode;break;case`gitee`:y=r.Gitee,_=a(),v=n.token.gitee;break;case`cnbcool`:y=r.CnbCool,_=s(),v=n.token.cnbcool;break;default:return await l.reply(`未找到该平台, 请重试`)}if(p.toLowerCase()!==`github`&&d(v))return await l.reply(`请先配置访问令牌`);let b=_.commit();try{let e=await b.info({owner:m,repo:h},g),t=e.commit.message.split(`
2
- `),n={owner:m,repo:h,sha:e.sha,title:t[0],content:t.slice(1).join(`
3
- `),stats:e.stats,files:e.files,author:e.commit.author,committer:e.commit.committer,branch:g},r=await i.commit(y,n);return await l.reply(r)}catch(e){return u.error(`获取${p.toLowerCase()}提交信息出错: ${m}/${h}:${g||``} - ${e.message}`),await l.reply(`获取提交信息失败, 请重试`)}},{name:`commit:info`,event:`message.group`});export{f as commit};
1
+ import{l as e,s as t}from"../db-DRx0_etZ.js";import{n,t as r}from"../common-DKsRuZTK.js";import{d as i,f as a,l as o,u as s}from"../models-ovIphdkj.js";import c,{logger as l}from"node-karin";import{isEmpty as u}from"es-toolkit/compat";const d=c.command(/^#?(?:git(?:commit|提交信息|提交记录))\s*(\w+)(?::(?:([^/\s]+)\/([^:\s]+)))?(?::([^/\s]+))?$/i,async c=>{let[,f,p,m,h]=c.msg.match(d.reg);if(c.isGroup&&(!p||!m)){let n=await e(c.groupId);if(!n)return await c.reply(`请先绑定仓库或指定仓库`);let r=await t(n.repoId);p=r.owner,m=r.repo}if(!p||!m)return await c.reply(`请指定仓库`);let g,_=n.token.github,v=`GitHub`;switch(f.toLowerCase()){case`github`:v=`GitHub`,g=a(),_=n.token.github;break;case`gitcode`:v=`GitCode`,g=s(),_=n.token.gitcode;break;case`gitee`:v=`Gitee`,g=i(),_=n.token.gitee;break;case`cnbcool`:v=`CnbCool`,g=o(),_=n.token.cnbcool;break;default:return await c.reply(`未找到该平台, 请重试`)}if(f.toLowerCase()!==`github`&&u(_))return await c.reply(`请先配置访问令牌`);let y=g.commit();try{let e=await y.info({owner:p,repo:m},h),t=e.commit.message.split(`
2
+ `),n={owner:p,repo:m,sha:e.sha,title:t[0],content:t.slice(1).join(`
3
+ `),stats:e.stats,files:e.files,author:e.commit.author,committer:e.commit.committer,branch:h},i=await r.commit(v,n);return await c.reply(i)}catch(e){return l.error(`获取${f.toLowerCase()}提交信息出错: ${p}/${m}:${h||``} - ${e.message}`),await c.reply(`获取提交信息失败, 请重试`)}},{name:`commit:info`,event:`message`});export{d as commit};
package/lib/apps/help.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"../root-q84D5Ojp.js";import{t}from"../common-DZ40JEMm.js";import n,{segment as r}from"node-karin";import i from"node:fs";const a=n.command(/^#?(?:(git))(?:命令|帮助|菜单|help|说明|功能|指令|使用说明)$/i,async n=>{let a=[{name:`常用操作`,list:[{name:`订阅git仓库`,desc:`订阅git仓库并推送, 支持github,gitee,gitcode,cnbcool`,icon:await i.promises.readFile(`${e.Plugin_Path}/resources/icons/repo.svg`)}]}];if(n.isMaster){let t=await i.promises.readFile(`${e.Plugin_Path}/resources/icons/subscription.svg`),n=await i.promises.readFile(`${e.Plugin_Path}/resources/icons/token.svg`);a.push({name:`管理命令`,list:[{name:`#git添加订阅仓库[platform:]owner/repo[:event]`,desc:`添加一个订阅仓库, event可选:push`,icon:t},{name:`#git删除订阅仓库[platform:]owner/repo`,desc:`删除一个订阅仓库`,icon:t},{name:`#git设置[platform]token + token`,desc:`设置一个平台的访问令牌`,icon:n}]})}let o=await i.promises.readFile(`${e.Plugin_Path}/resources/background.webp`),s=await t.help({title:`Git 帮助`,theme:{backgroundImage:o},list:a});return await n.reply(r.image(`base64://${s.toString(`base64`)}`)),!0},{name:`help`,priority:500,event:`message`,permission:`all`});export{a as help};
1
+ import{t as e}from"../root-q84D5Ojp.js";import{t}from"../common-DKsRuZTK.js";import n,{segment as r}from"node-karin";import i from"node:fs";const a=n.command(/^#?(?:(git))(?:命令|帮助|菜单|help|说明|功能|指令|使用说明)$/i,async n=>{let a=await i.promises.readFile(`${e.Plugin_Path}/resources/images/repo.svg`),o=[{name:`常用操作`,list:[{name:`订阅git仓库`,desc:`订阅git仓库并推送, 支持github,gitee,gitcode,cnbcool`,icon:a}]}];if(n.isMaster){let t=await i.promises.readFile(`${e.Plugin_Path}/resources/images/token.svg`);o.push({name:`管理命令`,list:[{name:`#git添加订阅仓库[platform:]owner/repo[:event]`,desc:`添加一个订阅仓库, event可选:push`,icon:a},{name:`#git删除订阅仓库[platform:]owner/repo`,desc:`删除一个订阅仓库`,icon:a},{name:`#git设置[platform]token + token`,desc:`设置一个平台的访问令牌`,icon:t}]})}let s=await i.promises.readFile(`${e.Plugin_Path}/resources/images/background.webp`),c=await t.help({title:`Git 帮助`,theme:{background:{type:`Image`,field0:s}},groups:o});return await n.reply(r.image(`base64://${c.toString(`base64`)}`)),!0},{name:`help`,priority:500,event:`message`,permission:`all`});export{a as help};
package/lib/apps/push.js CHANGED
@@ -1 +1 @@
1
- import"../root-q84D5Ojp.js";import"../db-DhpZxiAN.js";import{i as e}from"../common-DZ40JEMm.js";import{c as t,i as n,n as r,o as i}from"../models-D_S-DAOz.js";import a,{logger as o}from"node-karin";import{isEmpty as s}from"es-toolkit/compat";const c=a.task(`commit:push:github`,e.github.cron||`0 */5 * * * *`,async()=>{let n=e.token.github;if(s(n))return o.warn(`未配置GitHub Token, 跳过任务`);try{await new t().action()}catch(e){o.error(e)}}),l=a.task(`commit:push:gitee`,e.gitee.cron||`0 */5 * * * *`,async()=>{let t=e.token.gitee;if(s(t))return o.warn(`未配置 Gitee Token, 跳过任务`);try{await new i().action()}catch(e){o.error(e)}}),u=a.task(`commit:push:gitcode`,e.gitcode.cron||`0 */5 * * * *`,async()=>{let t=e.token.gitcode;if(s(t))return o.warn(`未配置 GitCode Token, 跳过任务`);try{await new n().action()}catch(e){o.error(e)}}),d=a.task(`commit:push:cnbcool`,e.cnbcool.cron||`0 */5 * * * *`,async()=>{let t=e.token.cnbcool;if(s(t))return o.warn(`未配置 CnbCol Token, 跳过任务`);try{await new r().action()}catch(e){o.error(`推送CnbCool仓库提交信息失败: ${e}`)}});export{d as cnbcool,u as gitcode,l as gitee,c as github};
1
+ import{n as e}from"../common-DKsRuZTK.js";import{c as t,i as n,n as r,o as i}from"../models-ovIphdkj.js";import a,{logger as o}from"node-karin";import{isEmpty as s}from"es-toolkit/compat";const c=a.task(`commit:push:github`,e.github.cron||`0 */5 * * * *`,async()=>{let n=e.token.github;if(s(n))return o.warn(`未配置GitHub Token, 跳过任务`);try{await new t().action()}catch(e){o.error(e)}}),l=a.task(`commit:push:gitee`,e.gitee.cron||`0 */5 * * * *`,async()=>{let t=e.token.gitee;if(s(t))return o.warn(`未配置 Gitee Token, 跳过任务`);try{await new i().action()}catch(e){o.error(e)}}),u=a.task(`commit:push:gitcode`,e.gitcode.cron||`0 */5 * * * *`,async()=>{let t=e.token.gitcode;if(s(t))return o.warn(`未配置 GitCode Token, 跳过任务`);try{await new n().action()}catch(e){o.error(e)}}),d=a.task(`commit:push:cnbcool`,e.cnbcool.cron||`0 */5 * * * *`,async()=>{let t=e.token.cnbcool;if(s(t))return o.warn(`未配置 CnbCol Token, 跳过任务`);try{await new r().action()}catch(e){o.error(`推送CnbCool仓库提交信息失败: ${e}`)}});export{d as cnbcool,u as gitcode,l as gitee,c as github};
@@ -0,0 +1 @@
1
+ import{l as e,s as t}from"../db-DRx0_etZ.js";import{n,t as r}from"../common-DKsRuZTK.js";import{d as i,f as a,l as o,u as s}from"../models-ovIphdkj.js";import c,{logger as l}from"node-karin";import{isEmpty as u}from"es-toolkit/compat";const d=c.command(/^#?(?:gitrelease|git\s*release|版本发布)\s*(\w+)(?::(?:([^/\s]+)\/([^\s:]+)))?(?::([^\s]+))?$/i,async c=>{let[,f,p,m,h]=c.msg.match(d.reg);if(c.isGroup&&(!p||!m)){let n=await e(c.groupId);if(!n)return await c.reply(`请先绑定仓库或指定仓库`);let r=await t(n.repoId);p=r.owner,m=r.repo}if(!p||!m)return await c.reply(`请指定仓库`);let g,_=n.token.github,v=`GitHub`;switch(f.toLowerCase()){case`github`:v=`GitHub`,g=a(),_=n.token.github;break;case`gitcode`:v=`GitCode`,g=s(),_=n.token.gitcode;break;case`gitee`:v=`Gitee`,g=i(),_=n.token.gitee;break;case`cnbcool`:v=`CnbCool`,g=o(),_=n.token.cnbcool;break;default:return await c.reply(`未找到该平台, 请重试`)}if(f.toLowerCase()!==`github`&&u(_))return await c.reply(`请先配置访问令牌`);let y=g.release();try{let e=await y.info({owner:p,repo:m},h||void 0),t={owner:p,repo:m,tagName:e.tagName,targetCommitish:e.targetCommitish,prerelease:e.prerelease,name:e.name,body:e.body,author:e.author,createdAt:e.createdAt,assets:e.assets},n=await r.release(v,t);return await c.reply(n)}catch(e){return l.error(`获取${f.toLowerCase()}版本发布信息出错: ${p}/${m}:${h||``} - ${e.message}`),await c.reply(`获取版本发布信息失败, 请重试`)}},{name:`release:info`,event:`message`});export{d as release};