sanguosha-agent-plugin 0.0.0 → 1.0.1
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/.claude-plugin/plugin.json +16 -0
- package/README.md +63 -0
- package/mcp/sanguosha-mcp.mjs +11158 -0
- package/package.json +12 -10
- package/skills/sanguosha-play/SKILL.md +148 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sanguosha-play",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI 驱动三国杀对局——接管座次、出牌决策、技能查询(含 sanguosha MCP server)",
|
|
5
|
+
"author": { "name": "wmzy", "url": "https://github.com/wmzy/sanguosha" },
|
|
6
|
+
"homepage": "https://github.com/wmzy/sanguosha",
|
|
7
|
+
"repository": "https://github.com/wmzy/sanguosha",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": ["sanguosha", "三国杀", "game", "mcp", "ai"],
|
|
10
|
+
"mcpServers": {
|
|
11
|
+
"sanguosha": {
|
|
12
|
+
"command": "node",
|
|
13
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/mcp/sanguosha-mcp.mjs"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# sanguosha-play plugin
|
|
2
|
+
|
|
3
|
+
AI 驱动三国杀对局的 Claude Code plugin。接管一个座次,自动开局、出牌决策、技能查询。
|
|
4
|
+
|
|
5
|
+
## 自包含——一个 npm 包全到位
|
|
6
|
+
|
|
7
|
+
本 plugin 发布为 npm 包 `sanguosha-agent-plugin`,**skill + MCP 构建产物都在包内**。`/plugin install` 一次,全部就位,无需额外 `npx` 拉取。
|
|
8
|
+
|
|
9
|
+
| 组件 | 说明 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| **sanguosha MCP server** | 暴露 `play`(驱动对局)和 `getSkillInfo`(查技能/卡牌描述)两个工具 |
|
|
12
|
+
| **sanguosha-play skill** | 教 AI 如何用上述工具跑完整局:开局 → 选将 → 出牌循环 → 结算 |
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/plugin marketplace add wmzy/sanguosha
|
|
18
|
+
/plugin install sanguosha-play@sanguosha
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 配置游戏服务器
|
|
22
|
+
|
|
23
|
+
MCP server 默认连 build 时注入的公共服务器(`SGS_PUBLIC_URL`)。
|
|
24
|
+
|
|
25
|
+
连自建服务器时,设置环境变量再启动 Claude Code:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export SGS_SERVER_URL=ws://your-server:3930/ws
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| 变量 | 默认 | 说明 |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `SGS_SERVER_URL` | build 时注入值 | 游戏服务器 WS 地址(注意 `/ws` 路径) |
|
|
34
|
+
| `SGS_ROOM_ID` | 自动建房 | 加入指定房间码 |
|
|
35
|
+
| `SGS_SEAT` | `0` | 座次下标 |
|
|
36
|
+
| `SGS_PLAYER_COUNT` | `2` | 建房人数 |
|
|
37
|
+
|
|
38
|
+
## 使用
|
|
39
|
+
|
|
40
|
+
直接对 Claude 说即可,skill 会引导流程:
|
|
41
|
+
|
|
42
|
+
- 「开一局三国杀」
|
|
43
|
+
- 「建房等 2 人加入」
|
|
44
|
+
- 「加入房间 ABC123」
|
|
45
|
+
|
|
46
|
+
## 开发者
|
|
47
|
+
|
|
48
|
+
仓库结构(git 仓库只放源文件,构建产物只进 npm tarball):
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
plugin/
|
|
52
|
+
├── .claude-plugin/plugin.json 源:manifest
|
|
53
|
+
├── package.json 源:npm 包元数据(version 由 semantic-release 管理)
|
|
54
|
+
├── skills/sanguosha-play/SKILL.md 源:玩家 skill
|
|
55
|
+
├── README.md 源:本文件
|
|
56
|
+
└── mcp/sanguosha-mcp.mjs 构建产物(.gitignore,只进 npm 包)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- 开发用 skill(`add-atom` / `add-skill`)不在本 plugin,见主仓库 `.claude/skills/`。
|
|
60
|
+
- MCP 源码:`src/ai-mcp/server.ts`。
|
|
61
|
+
- 本地构建验证:`SGS_PUBLIC_URL=wss://<服务器>/ws pnpm build:plugin && pnpm validate:plugin`。
|
|
62
|
+
- **发布全自动(OIDC trusted publishing)**:推 main 分支 → `release-agent-plugin.yml` 跑 build → semantic-release 分析 conventional commits → 自动发 npm 包 + GitHub Release。npm 认证走 OIDC(在 npmjs.com 配置 Trusted Publisher 指向本仓库 + workflow 文件 `release-agent-plugin.yml`),无需 NPM_TOKEN;provenance 自动生成。`plugin/package.json` 的 version 字段由 semantic-release 在 CI 临时更新(git 里保持占位值),版本真相由 git tag 追踪。
|
|
63
|
+
- 需配置的 GitHub Secrets:`SGS_PUBLIC_URL`(公共游戏服务器 WS 地址,可选)。npm 发布靠 OIDC,无需 NPM_TOKEN。
|