chatccc 0.2.109 → 0.2.111
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 +94 -1
- package/package.json +1 -1
- package/src/orchestrator.ts +6 -0
package/README.md
CHANGED
|
@@ -44,7 +44,100 @@ ChatCCC 把本地 AI 编程工具接入即时通讯软件。你可以在手机
|
|
|
44
44
|
|
|
45
45
|
### 1. 安装
|
|
46
46
|
|
|
47
|
-
####
|
|
47
|
+
#### Windows 一键安装(零依赖起步)
|
|
48
|
+
|
|
49
|
+
如果你的电脑没有装任何东西,**复制下面全部内容,打开 PowerShell 粘贴,回车**。脚本会自动检测并安装所有缺失的依赖,最后启动 ChatCCC。全程只需确认一次 UAC 弹窗。
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
# ============================================================
|
|
53
|
+
# ChatCCC Windows 一键安装脚本
|
|
54
|
+
# 用法: 复制全部内容 → 打开 PowerShell → 粘贴 → 回车
|
|
55
|
+
# 优先用 winget(快),没有则直接下载安装包(零依赖)
|
|
56
|
+
# ============================================================
|
|
57
|
+
|
|
58
|
+
# --- 辅助函数:安装完程序后刷新 PATH,让当前窗口立即可用 ---
|
|
59
|
+
function Refresh-Path {
|
|
60
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# --- 辅助函数:判断一个命令是否已安装 ---
|
|
64
|
+
function Test-Cmd($name) { return [bool](Get-Command $name -ErrorAction SilentlyContinue) }
|
|
65
|
+
|
|
66
|
+
# --- 判断 winget 是否可用 ---
|
|
67
|
+
$useWinget = Test-Cmd winget
|
|
68
|
+
|
|
69
|
+
Write-Host ''
|
|
70
|
+
Write-Host '============================================================' -ForegroundColor Cyan
|
|
71
|
+
Write-Host ' ChatCCC 环境检测与一键安装' -ForegroundColor Cyan
|
|
72
|
+
if ($useWinget) {
|
|
73
|
+
Write-Host ' 安装方式: winget(Windows 包管理器)' -ForegroundColor DarkGray
|
|
74
|
+
} else {
|
|
75
|
+
Write-Host ' 安装方式: 直接下载(无需 winget)' -ForegroundColor DarkGray
|
|
76
|
+
}
|
|
77
|
+
Write-Host '============================================================' -ForegroundColor Cyan
|
|
78
|
+
Write-Host ''
|
|
79
|
+
|
|
80
|
+
# ============================================================
|
|
81
|
+
# [1/2] 安装 Node.js(ChatCCC 运行环境,要求 >= 20)
|
|
82
|
+
# ============================================================
|
|
83
|
+
if (Test-Cmd node) {
|
|
84
|
+
Write-Host "[1/2] Node.js 已安装: $(node --version 2>$null)" -ForegroundColor Green
|
|
85
|
+
} else {
|
|
86
|
+
Write-Host '[1/2] Node.js 未安装,正在安装...' -ForegroundColor Yellow
|
|
87
|
+
|
|
88
|
+
if ($useWinget) {
|
|
89
|
+
# 方式 A:winget 安装(推荐,速度快)
|
|
90
|
+
Write-Host ' (如弹出 UAC 窗口请点击"是")' -ForegroundColor DarkGray
|
|
91
|
+
winget install OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements
|
|
92
|
+
} else {
|
|
93
|
+
# 方式 B:直接请求 Node.js 官网目录页,从页面中提取最新 LTS 安装包链接
|
|
94
|
+
Write-Host ' 正在获取最新 LTS 版本...' -ForegroundColor DarkGray
|
|
95
|
+
# 请求 latest-v22.x 目录页(返回该大版本下最新的小版本列表)
|
|
96
|
+
$dirHtml = (Invoke-WebRequest 'https://nodejs.org/dist/latest-v22.x/' -UseBasicParsing).Content
|
|
97
|
+
# 从 HTML 中匹配 MSI 文件名,如 node-v22.15.0-x64.msi
|
|
98
|
+
$msiFile = [regex]::Match($dirHtml, 'node-v\d+\.\d+\.\d+-x64\.msi').Value
|
|
99
|
+
if (-not $msiFile) {
|
|
100
|
+
Write-Host ' 错误: 未能从页面中提取 MSI 下载链接' -ForegroundColor Red
|
|
101
|
+
exit 1
|
|
102
|
+
}
|
|
103
|
+
Write-Host " 正在下载 $msiFile ..." -ForegroundColor DarkGray
|
|
104
|
+
# 用提取到的文件名拼出完整下载链接
|
|
105
|
+
$nodeMsi = "$env:TEMP\$msiFile"
|
|
106
|
+
Invoke-WebRequest "https://nodejs.org/dist/latest-v22.x/$msiFile" -OutFile $nodeMsi
|
|
107
|
+
Write-Host ' 正在静默安装(请稍候)...' -ForegroundColor DarkGray
|
|
108
|
+
# /quiet 静默安装,/norestart 不自动重启
|
|
109
|
+
Start-Process msiexec.exe -ArgumentList "/i `"$nodeMsi`" /quiet /norestart" -Wait
|
|
110
|
+
Remove-Item $nodeMsi -Force
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Refresh-Path
|
|
114
|
+
Write-Host "[1/2] Node.js 安装完成: $(node --version 2>$null)" -ForegroundColor Green
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# ============================================================
|
|
118
|
+
# [2/2] 安装 ChatCCC 本体(npm 全局安装)
|
|
119
|
+
# ============================================================
|
|
120
|
+
Write-Host '[2/2] 正在从 npm 安装 ChatCCC...' -ForegroundColor Yellow
|
|
121
|
+
npm install -g chatccc
|
|
122
|
+
Write-Host '[2/2] ChatCCC 安装完成!' -ForegroundColor Green
|
|
123
|
+
|
|
124
|
+
# ============================================================
|
|
125
|
+
# 启动 ChatCCC(首次启动自动打开浏览器进入配置向导)
|
|
126
|
+
# ============================================================
|
|
127
|
+
Write-Host ''
|
|
128
|
+
Write-Host '============================================================' -ForegroundColor Cyan
|
|
129
|
+
Write-Host ' 环境就绪,正在启动 ChatCCC ...' -ForegroundColor Cyan
|
|
130
|
+
Write-Host ' 浏览器将自动打开 Web 配置页面' -ForegroundColor Cyan
|
|
131
|
+
Write-Host '============================================================' -ForegroundColor Cyan
|
|
132
|
+
Write-Host ''
|
|
133
|
+
chatccc
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
如果一切顺利,浏览器会自动打开 `http://127.0.0.1:18080` 的 Web 配置页面。按页面提示填入飞书 App ID / App Secret,点击"保存并启动"即可。
|
|
137
|
+
|
|
138
|
+
> **只想装 ChatCCC 本体?** 如果你已经有 Node.js,直接 `npm install -g chatccc && chatccc` 即可,不需要跑上面的完整脚本。
|
|
139
|
+
|
|
140
|
+
#### 其他安装方式
|
|
48
141
|
|
|
49
142
|
```bash
|
|
50
143
|
npm install -g chatccc
|
package/package.json
CHANGED
package/src/orchestrator.ts
CHANGED
|
@@ -286,6 +286,12 @@ export async function handleCommand(
|
|
|
286
286
|
const content = buildCdContent(targetDir, withStats, isUpdate, sessionCwd);
|
|
287
287
|
await platform.sendCard(chatId, "新会话工作路径", content, "blue");
|
|
288
288
|
logTrace(tid, "DONE", { outcome: "cd_path", targetDir, isUpdate });
|
|
289
|
+
|
|
290
|
+
// 微信模式下,若用户没有活跃会话,自动创建新会话
|
|
291
|
+
if (platform.kind === "wechat" && !sessionInfoMap.has(chatId)) {
|
|
292
|
+
logTrace(tid, "BRANCH", { cmd: "/new", trigger: "auto_after_cd" });
|
|
293
|
+
await handleCommand(platform, "/new", chatId, openId, msgTimestamp, chatType, traceId);
|
|
294
|
+
}
|
|
289
295
|
}
|
|
290
296
|
return;
|
|
291
297
|
}
|