cc-ding 1.0.2 → 1.0.3
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/README.md +2 -2
- package/dist/src/biz/cc-ding-cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#### 安装
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
|
|
34
|
+
npm i cc-ding -g
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
#### 初始化
|
|
@@ -208,7 +208,7 @@ Connect Claude Code to DingTalk for bidirectional communication. Supports multi-
|
|
|
208
208
|
#### Install
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
|
-
|
|
211
|
+
npm i cc-ding -g
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
#### Initialize
|
|
@@ -21,7 +21,7 @@ ${y}`;await this.sendDingMessage({conversationId:o,sessionWebhook:r,content:_,ms
|
|
|
21
21
|
`),msgType:"markdown"})}),(0,I.route)("/help",()=>(0,$.parseHelpCommand)(h),async()=>{await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:(0,$.formatHelpOverview)(J,this.isOwner(r)),msgType:"markdown"})}),(0,I.route)("/version",()=>(0,$.parseVersionCommand)(h),async()=>{let e="\u672A\u5B89\u88C5";try{const{stdout:t}=await new Promise((g,p)=>{(0,B.exec)("claude --version",{timeout:5e3},(u,m,T)=>{u?p(u):g({stdout:m})})});e=t.trim()||"\u672A\u77E5"}catch{}const a=["### \u{1F4E6} cc-ding \u7248\u672C\u4FE1\u606F","",`- **cc-ding:** ${J}`,`- **claude:** ${e}`,`- **os:** ${G.default.platform()} ${G.default.release()}`,`- **node:** ${process.version}`].join(`
|
|
22
22
|
`);await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:a,msgType:"markdown"})}),(0,I.route)("cmd-help",()=>(0,$.parseCommandHelp)(h),async e=>{const a=(0,$.getCommandByName)(e);a?await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:(0,$.formatCommandHelp)(a),msgType:"markdown"}):await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:`\u274C \u672A\u627E\u5230\u547D\u4EE4: **${e}**
|
|
23
23
|
|
|
24
|
-
\u{1F4A1} \u8F93\u5165 \`/help\` \u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4`,msgType:"markdown"})}),(0,I.route)("/reboot",()=>(0,$.parseRebootCommand)(h),async e=>{if(!await this.requireOwnerOrAdmin(s,n,r))return;if(e.tag&&!/^[\w.\-]+$/.test(e.tag)){await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u274C \u65E0\u6548\u7684 tag\uFF0C\u4EC5\u5141\u8BB8\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u70B9\u3001\u6A2A\u7EBF\u548C\u4E0B\u5212\u7EBF",msgType:"markdown"});return}const a=e.tag?`@${e.tag}`:"@latest",t=e.update?`
|
|
24
|
+
\u{1F4A1} \u8F93\u5165 \`/help\` \u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4`,msgType:"markdown"})}),(0,I.route)("/reboot",()=>(0,$.parseRebootCommand)(h),async e=>{if(!await this.requireOwnerOrAdmin(s,n,r))return;if(e.tag&&!/^[\w.\-]+$/.test(e.tag)){await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u274C \u65E0\u6548\u7684 tag\uFF0C\u4EC5\u5141\u8BB8\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u70B9\u3001\u6A2A\u7EBF\u548C\u4E0B\u5212\u7EBF",msgType:"markdown"});return}const a=e.tag?`@${e.tag}`:"@latest",t=e.update?`npm install -g cc-ding${a}`:null,g=`cc-ding-${this.clientId}`;await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:t?`\u2705 \u66F4\u65B0\u5E76\u91CD\u542F\uFF0C\u6B63\u5728\u6267\u884C ${t}...`:"\u2705 cc-ding \u6B63\u5728\u91CD\u542F\u4E2D...",msgType:"markdown"});const p=R.default.join(this.getClientDir(),".reboot_pending");C.default.writeFileSync(p,JSON.stringify({conversationId:s,senderStaffId:r,sessionWebhook:n,update:e.update}),"utf-8"),setTimeout(()=>{console.log(`[${(0,c.timestamp)()}] \u6267\u884C pm2 restart ${g}${t?" (\u542B\u66F4\u65B0)":""}`),(0,B.exec)(`${t?`${t} && `:""}pm2 restart "${g}"`,{timeout:6e4},u=>{u&&console.error(`[${(0,c.timestamp)()}] pm2 restart \u5931\u8D25:`,u)})},1e3)})];for(const e of F)if(await e.tryHandle())return;if(!y){console.log(`\u672A\u6CE8\u518C\u7684\u673A\u5668\u4EBA,\u7FA4:${l},${s}`),this.isOwner(r)?await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u26A0\uFE0F \u8BE5\u7FA4\u672A\u6CE8\u518C\uFF0C\u8BF7\u5148\u4F7F\u7528 `/cfg` \u547D\u4EE4\u6CE8\u518C",msgType:"markdown"}):await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:`\u62B1\u6B49,\u8BE5\u7FA4\u7684\u673A\u5668\u4EBA\u672A\u5728\u670D\u52A1\u7AEF\u6CE8\u518C,\u8BF7\u8054\u7CFB\u5E94\u7528\u673A\u5668\u4EBAowner\u6CE8\u518C(${s})...`});return}const Y=[(0,I.route)("/destroy",()=>(0,$.parseDestroyCommand)(h),async e=>{if(!await this.requireOwnerOrSingleChat(s,n,r,y))return;const a=e.conversationId||s;if(a!==s&&!this.isOwner(r)){await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u274C \u53EA\u6709 owner \u624D\u80FD\u64CD\u4F5C\u5176\u4ED6\u7FA4\u7684\u914D\u7F6E",msgType:"markdown"});return}const g=this.config.conversations.findIndex(A=>A.conversationId===a);if(g<0){await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u26A0\uFE0F \u8BE5\u7FA4\u672A\u5728\u914D\u7F6E\u4E2D\u6CE8\u518C\uFF0C\u65E0\u9700\u6CE8\u9500",msgType:"markdown"});return}const u=this.config.conversations[g].conversationTitle||a;this.config.conversations.splice(g,1);const m=this.getConversationDir(a);let T=!1;try{C.default.existsSync(m)&&(C.default.rmSync(m,{recursive:!0,force:!0}),T=!0)}catch(A){console.error(`[${(0,c.timestamp)()}] \u5220\u9664\u5DE5\u4F5C\u76EE\u5F55\u5931\u8D25:`,A)}const v=this.activeSessions.get(a);if(v?.currentProcess)try{v.currentProcess.kill("SIGTERM")}catch{}this.activeSessions.delete(a),this.recorderModeConversations.delete(a),(0,S.saveClientConfig)(this),console.log(`[${(0,c.timestamp)()}] \u5DF2\u6CE8\u9500\u7FA4: ${u}(${a})`);const w=["\u2705 \u7FA4\u673A\u5668\u4EBA\u5DF2\u6CE8\u9500",`- **\u7FA4\u540D\u79F0:** ${u}`,`- **\u7FA4ID:** ${a}`];T?w.push("- **\u5DE5\u4F5C\u76EE\u5F55:** \u5DF2\u5220\u9664"):w.push("- **\u5DE5\u4F5C\u76EE\u5F55:** (\u4E0D\u5B58\u5728\u6216\u65E0\u6CD5\u5220\u9664)"),v&&w.push("- **\u6D3B\u8DC3\u4F1A\u8BDD:** \u5DF2\u6E05\u9664"),w.push(`
|
|
25
25
|
\u26A0\uFE0F \u8BE5\u7FA4\u4E0B\u6B21\u53D1\u9001\u6D88\u606F\u65F6\u5C06\u6536\u5230"\u672A\u6CE8\u518C"\u63D0\u793A`),w.push("\u{1F4A1} \u5982\u9700\u91CD\u65B0\u6CE8\u518C\uFF0C\u8BF7\u4F7F\u7528 `/cfg` \u547D\u4EE4"),await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:w.join(`
|
|
26
26
|
`),msgType:"markdown"})}),(0,I.route)("/freedom",()=>(0,$.parseFreedomCommand)(h),async e=>{if(await this.requireOwnerOrSingleChat(s,n,r,y)){if(e.action==="enter"){if(y?.freedomMode){await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:"\u2139\uFE0F \u5F53\u524D\u5DF2\u5904\u4E8E\u81EA\u7531\u6A21\u5F0F",msgType:"markdown"});return}this.pendingFreedomConvs.set(s,Date.now()),await this.sendDingMessage({conversationId:s,sessionWebhook:n,content:`\u26A0\uFE0F \u5F00\u542F\u81EA\u7531\u6A21\u5F0F\u540E\uFF0C\u6240\u6709\u7FA4\u6210\u5458\u5747\u53EF\u4F7F\u7528\u673A\u5668\u4EBA\uFF08\u8DF3\u8FC7\u767D\u540D\u5355\u9650\u5236\uFF09
|
|
27
27
|
|