客户资料
订单
项目
投诉
项目列表
# CGAI 中控 → WorkBuddy 一键接入(用你自己的账号,密码内置)
$u = Read-Host "你的澄光平台用户名"
$tok = (Invoke-RestMethod -Uri "https://api.chengguang.work/api/auth/login" -Method Post -ContentType "application/json" -Body (@{username=$u;password="shanhebeiren666"}|ConvertTo-Json) -Headers @{"User-Agent"="Mozilla/5.0"}).data.token
if (-not $tok) { Write-Host "登录失败:用户名不存在或账号被禁用"; exit }
$cfg = "$env:USERPROFILE\.workbuddy\mcp.json"
$root = [ordered]@{ mcpServers = [ordered]@{} }
if (Test-Path $cfg) { $raw = Get-Content $cfg -Raw; if ($raw -and $raw.Trim()) { $root = $raw | ConvertFrom-Json -AsHashtable } }
if (-not $root["mcpServers"]) { $root["mcpServers"] = [ordered]@{} }
$root["mcpServers"]["cgai"] = @{ type="http"; url="https://api.chengguang.work/api/customer/mcp"; headers=@{ Authorization="Bearer $tok" }; description="CGAI 澄光中控平台(客户/订单/项目/工单管理)"; disabled=$false }
$dir = Split-Path $cfg; if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Force $dir | Out-Null }
$root | ConvertTo-Json -Depth 10 | Set-Content $cfg -Encoding UTF8
Write-Host "完成!完全退出重开 WorkBuddy,连接器管理里对 cgai 点「信任」即可。"
# CGAI 中控 → Codex 一键接入(用你自己的账号,密码内置)
if (-not (Get-Command codex -ErrorAction SilentlyContinue)) { Write-Host "先装 Codex App:https://openai.com/codex"; exit }
$u = Read-Host "你的澄光平台用户名"
$tok = (Invoke-RestMethod -Uri "https://api.chengguang.work/api/auth/login" -Method Post -ContentType "application/json" -Body (@{username=$u;password="shanhebeiren666"}|ConvertTo-Json) -Headers @{"User-Agent"="Mozilla/5.0"}).data.token
if (-not $tok) { Write-Host "登录失败:用户名不存在或账号被禁用"; exit }
$cfg = "$env:USERPROFILE\.codex\config.toml"
if (-not (Test-Path $cfg)) { New-Item -ItemType File -Force $cfg | Out-Null }
$b = "[mcp_servers.cgai]`nurl = `"https://api.chengguang.work/api/customer/mcp`"`nhttp_headers = { Authorization = `"Bearer $tok`" }`n"
$c = Get-Content $cfg -Raw; if (-not $c) { $c = "" }
if ($c -match "\[mcp_servers\.cgai\]") { $c = $c -replace '(?m)\[mcp_servers\.cgai\][^\[]*', $b } else { $c = $c.TrimEnd() + "`n`n" + $b }
Set-Content $cfg $c -Encoding UTF8
Write-Host "完成!完全退出并重开 Codex App,即可用你的账号操作中控平台。"
# CGAI MCP 技能指南 → 一键安装到本机(WorkBuddy 用,版本以 R2 中心仓库为准)
$ErrorActionPreference = "Stop"
$url = "https://api.chengguang.work/api/customer/skill-guide"
$dest = "$env:USERPROFILE\.workbuddy\skills\cgai-mcp-guide"
$tmp = Join-Path $env:TEMP "cgai-mcp-guide.tar.gz"
$tar = Join-Path $env:SystemRoot "System32\tar.exe"
Write-Host "下载最新技能指南 ..."
Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing
New-Item -ItemType Directory -Force $dest | Out-Null
Get-ChildItem $dest -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force
& $tar -xf $tmp -C $dest
Remove-Item $tmp -Force
$v = Get-Content (Join-Path $dest "VERSION") -ErrorAction SilentlyContinue
if ($v) { Write-Host "已安装技能版 $v" } else { Write-Host "警告:包内无 VERSION(发布过期?)" -ForegroundColor Yellow }
Write-Host "完成 → $dest ;重开 WorkBuddy 生效。"