oprun-skills 0.0.0-stage → 1.4.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/INSTALL.md +81 -0
- package/README.md +76 -2
- package/bundle.json +25 -0
- package/cli/core.mjs +178 -0
- package/cli/main.mjs +49 -0
- package/package.json +37 -4
- package/release.json +9 -0
- package/skills/oprun-project-planning/SKILL.md +182 -0
- package/skills/oprun-project-planning/assets/external-plan.example.json +80 -0
- package/skills/oprun-project-planning/assets/qveris-mcp.json +11 -0
- package/skills/oprun-project-planning/assets/qveris-readonly-mcp.json +11 -0
- package/skills/oprun-project-planning/assets/workbuddy-mcp.json +8 -0
- package/skills/oprun-project-planning/references/delivery.md +47 -0
- package/skills/oprun-project-planning/references/external-planning.md +124 -0
- package/skills/oprun-project-planning/references/hosts.md +107 -0
- package/skills/oprun-project-planning/references/matching.md +70 -0
- package/skills/oprun-project-planning/references/qveris.md +61 -0
- package/skills/oprun-project-planning/references/updates.md +20 -0
- package/skills/oprun-project-planning/references/workbuddy.md +39 -0
- package/skills/oprun-project-planning/references/workflow.md +42 -0
package/INSTALL.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# 安装或更新 OpRun
|
|
2
|
+
|
|
3
|
+
用户说“安装 OpRun”或“更新 OpRun”时,先按当前客户端能力选择方式,保留已有配置,再检查连接。说明入口是 https://github.com/TeamSillyBees/oprun-skills/blob/main/INSTALL.md;说明可随 main 更新,实际安装必须固定到正式版本。
|
|
4
|
+
|
|
5
|
+
## 先选择安装方式
|
|
6
|
+
|
|
7
|
+
先查看当前会话已有的工具、宿主和 OpRun 连接,不让用户选择 npm 或 ZIP 等技术方案,不根据客户端名称猜测执行能力。
|
|
8
|
+
|
|
9
|
+
| 当前能力 | 直接采用的方式 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| 能执行命令、写入获准 Skill 目录,且已有 Node.js 22+ | npm/npx 安装或更新 |
|
|
12
|
+
| 没有命令工具、没有文件写入能力、Node.js 不可用,或命令被宿主限制 | 原生 ZIP 导入,不要求用户安装 Node.js、Python 或打开终端 |
|
|
13
|
+
| 能运行命令,但桌面宿主未公开 Skill 安装目录 | 原生 ZIP 导入,不修改应用私有目录或数据库 |
|
|
14
|
+
| 客户端不支持 Skill 导入 | 明确说明不能安装 Skill;若支持 MCP,可继续复用或配置连接,不能称为 Skill 已安装 |
|
|
15
|
+
|
|
16
|
+
工具列表已能确定能力时不做无效尝试。命令安装因能力不足失败一次后转 ZIP,不反复尝试命令,也不用联网搜索工具代替文件写入。网络故障或文件校验失败需如实说明,不能通过改用 ZIP 绕过校验。
|
|
17
|
+
|
|
18
|
+
## ZIP 安装与更新
|
|
19
|
+
|
|
20
|
+
1. 读取[最新正式发布](https://github.com/TeamSillyBees/oprun-skills/releases/latest),确定具体版本,提供该版本的 `oprun-project-planning.zip` 下载链接。不要提供仓库的 Source code ZIP,也不要把二进制 ZIP 交给正文读取工具。如果无法解析版本,提供[官方 ZIP 下载入口](https://github.com/TeamSillyBees/oprun-skills/releases/latest/download/oprun-project-planning.zip),标明“版本待核实”,不编造版本号。
|
|
21
|
+
2. 根据已知客户端,只给一条具体导入路径。Qveris 已核验路径为“添加技能 → 上传 ZIP”,选择文件后“导入技能”,再在对话中选择 `oprun-project-planning`;已有 oprun 连接需在“本对话已启用”中启用。WorkBuddy 使用其当前页面的 Skill 安装/导入入口;若无法看到该入口或没有可靠文档,只询问入口位置,不编造按钮名称。能安全下载到获准目录时可代为下载;不能下载时让用户点击链接。不擅自打开或操作用户窗口。
|
|
22
|
+
3. 更新使用客户端的原生更新或替换方式。保留既有 MCP 连接、配置、授权、会话及用户自定义内容,不先卸载旧 Skill,不反复导入同名副本。若客户端只能重复新增,先说明这一限制;有本地改动时先导出或备份并核对,不能直接覆盖。可靠核对到 Skill 文件完全一致时,无需重复导入。
|
|
23
|
+
4. 宿主不能自动导入时,简短提示“请下载并导入 ZIP,完成后告知结果”,状态为“等待导入确认”。客户端显示导入成功或用户确认后,再检查 Skill 是否在当前会话启用;仅下载完成不能报告已安装。不能读取已安装版本时明确“已导入,版本待客户端核实”。
|
|
24
|
+
|
|
25
|
+
对无命令能力的客户端,首次引导只需要:下载链接、当前宿主的导入步骤,以及“已有连接会保留”。不要再展示 npm 命令、要求用户配置开发环境或索取凭据。能够读取二进制文件的工具应按同版本 `manifest.json` 和 `SHA256SUMS` 核对 ZIP;做不到时使用官方链接并标明“文件摘要未核验”,不声称已校验。
|
|
26
|
+
|
|
27
|
+
## 命令安装与更新
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npx oprun-skills@latest install --host <宿主>
|
|
31
|
+
npx oprun-skills@latest update --host <宿主>
|
|
32
|
+
npx oprun-skills@latest doctor --host <宿主>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
支持 codex、claude、qveris、workbuddy、generic。只有项目标记唯一时可省略 `--host` 自动识别;多个标记不猜测。默认项目范围:Codex 为 `.agents/skills/oprun-project-planning`,Claude Code 为 `.claude/skills/oprun-project-planning`。全局安装仅在用户要求时使用已公开的目录。
|
|
36
|
+
|
|
37
|
+
工具输出 `awaiting_host_import` 表示还没有完成安装,转入上面的 ZIP 流程。桌面宿主只在已公开支持目录时使用 `--target <完整Skill目录>`,目录名须为 `oprun-project-planning`。`npx` 首次可能要求确认下载包,遵循宿主提示。
|
|
38
|
+
|
|
39
|
+
更新使用当前正式版;一旦解析出版本,本次安装、更新、检查和下载均使用同一版本(例如 `oprun-skills@<版本>`),不混用变动的 latest。npm 和 GitHub 发布不同步时,分别说明可用版本,不把旧包称为新版。
|
|
40
|
+
|
|
41
|
+
npm 注册表不可用时,可使用同版本 GitHub 包:`npx https://github.com/TeamSillyBees/oprun-skills/releases/download/v<版本>/oprun-skills.tgz install --host <宿主>`;更新改用 `update`。没有命令能力时不展示这个备用命令,直接走 ZIP。
|
|
42
|
+
|
|
43
|
+
已有 Python 安装方式继续保留:从同一固定 Release 下载并校验 `install.py`、`manifest.json`、`SHA256SUMS`,用 Python 3.9+ 执行 `python3 install.py install|update|check`。不要使用 curl 管道直接运行下载脚本。
|
|
44
|
+
|
|
45
|
+
## 复用连接,再检查
|
|
46
|
+
|
|
47
|
+
Skill 安装与 MCP 连接分开判断。同站点连接已经可用时直接复用,不因更新 Skill 删除、重建连接或要求重新授权。Qveris 中“已保存”不等于当前会话已启用;只检查一次是否启用并刷新,不反复用全局研究工具搜索。界面显示“任务工具离线”不能单独证明 OpRun MCP 不可用。
|
|
48
|
+
|
|
49
|
+
没有连接时,使用宿主原生方式导入对应配置;仅查看时使用只读配置。需要增加权限时再由用户重新授权,不悄悄扩大已有授权。用户本人完成首次 OAuth;密码、Cookie、Token、授权回调参数都不应索取、导出或保存到日志。
|
|
50
|
+
|
|
51
|
+
| 客户端 | 新建连接时使用 |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| Codex / Claude Code | 宿主支持的 MCP OAuth 方式,命令以本机帮助为准 |
|
|
54
|
+
| Qveris | [统一配置](skills/oprun-project-planning/assets/qveris-mcp.json)或[只读配置](skills/oprun-project-planning/assets/qveris-readonly-mcp.json),点击“保存并授权” |
|
|
55
|
+
| WorkBuddy | [专用配置](skills/oprun-project-planning/assets/workbuddy-mcp.json),点击“连接” |
|
|
56
|
+
| 其他 | 核实支持 Streamable HTTP 和 OAuth S256 PKCE,使用原生连接入口 |
|
|
57
|
+
|
|
58
|
+
服务地址和 OAuth issuer 均为 `https://www.agi.yifx.vip/mcp`。Qveris 显式使用 `authMode: oauth`、该 issuer 及配置中的 Scope,不填写 `openid offline_access`。详细差异按需阅读 [Qveris 指引](skills/oprun-project-planning/references/qveris.md)、[WorkBuddy 指引](skills/oprun-project-planning/references/workbuddy.md)及[多宿主指引](skills/oprun-project-planning/references/hosts.md)。一个连接覆盖当前身份获准的方案、发单、接单、交付等能力,无需分别配置。
|
|
59
|
+
|
|
60
|
+
有命令工具时可运行 `doctor` 检查本地记录和公开 OAuth 发现;`--offline` 只核对文件。没有命令工具时跳过 doctor,直接用当前宿主检查连接和工具加载,再调用 `oprun_account_context`;支持直接 `tools/list` 时一并检查。不得为了验证安装而读取项目、生成方案或执行业务操作。
|
|
61
|
+
|
|
62
|
+
公开发现通过不等于 OAuth 成功。无法调用 MCP 时报告“连接待验证”,不因导入 Skill 或用户已登录就宣称工具可用。`update_available` 只表示本地版本早于 CLI 所携版本;`host_managed` 只表示安装由客户端管理,不是已安装证明。
|
|
63
|
+
|
|
64
|
+
## 完成状态与恢复
|
|
65
|
+
|
|
66
|
+
分别报告 Skill 和连接状态,保持简短:例如“Skill 已导入;连接已验证”,或“等待 ZIP 导入;已有连接保留”。只有客户端证据或用户确认支持时才报告已导入,只有实际工具调用成功时才报告连接已验证;版本、摘要未核实的部分单独说明。
|
|
67
|
+
|
|
68
|
+
| 情况 | 下一步 |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| Skill 已导入,当前会话未启用 | 选择 Skill,或按宿主要求重新加载会话 |
|
|
71
|
+
| 401 / 授权已失效 | 使用现有连接的登录授权入口 |
|
|
72
|
+
| 工具未加载 | 检查连接启用状态并刷新一次 |
|
|
73
|
+
| 权限不足 | 根据 account_context 的 required_scopes,在使用该功能时重新授权 |
|
|
74
|
+
| 本地内容有改动 | 保留并核对差异,不强制覆盖 |
|
|
75
|
+
| 无法核实版本或调用工具 | 如实标为待核实,不重复安装来代替验证 |
|
|
76
|
+
|
|
77
|
+
npm 更新输出 backup 路径,备份位于 Skill 扫描目录外的 `oprun-skill-backups`。恢复前核对两边安装记录和摘要,先保存当前内容,再将 backup 中完整 Skill 目录放回原 target,不能覆盖后续本地修改。ZIP 导入前保存的原包和自定义内容也应保留。撤销授权使用[授权管理](https://www.agi.yifx.vip/mcp/manage),安装更新不会自动撤销。
|
|
78
|
+
|
|
79
|
+
说明页面读取失败时改用 GitHub Contents API 的 INSTALL.md(content 为 Base64);不要重复读取被当作 `application/octet-stream` 的 Release 说明附件。只提供官方链接时如实标记未读取版本。
|
|
80
|
+
|
|
81
|
+
Skill 正文唯一来源仍是 oprun-mcp 的固定提交。安装指引更新不改变服务端能力,不代替客户端真实验收。
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpRun Skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
安装或更新,把这句话发给你的 Agent:
|
|
4
|
+
|
|
5
|
+
> 请按 https://github.com/TeamSillyBees/oprun-skills/blob/main/INSTALL.md 安装或更新 OpRun,根据当前客户端能力选择命令安装或 ZIP 导入,保留已有配置,并检查连接。
|
|
6
|
+
|
|
7
|
+
Agent 会先检查当前会话能力:能执行命令且已有 Node.js 22+ 时使用 npm/npx;否则直接给出 ZIP 下载链接和客户端导入步骤,不要求安装开发环境。更新复用已有 MCP 连接;需要手动导入时明确提示“等待导入确认”。
|
|
8
|
+
|
|
9
|
+
有 Node.js 22+ 的命令行客户端可直接运行:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx oprun-skills@latest install --host codex
|
|
13
|
+
npx oprun-skills@latest update --host codex
|
|
14
|
+
npx oprun-skills@latest doctor --host codex
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
也可执行 `npm install -g oprun-skills`,再用 `oprun-skills install|update|doctor`;使用全局安装时,先用 `npm install -g oprun-skills@latest` 更新工具本身。
|
|
18
|
+
|
|
19
|
+
Claude Code 使用 `--host claude`;已能确定当前项目标记时可省略 `--host`。Qveris、WorkBuddy 保留原生 ZIP 导入,`--host qveris` 或 `--host workbuddy` 返回同版本下载地址及配置。npm 工具无需 Python,不启动本地 MCP 服务,不改写已有连接或登录信息。
|
|
20
|
+
|
|
21
|
+
[下载安装包](https://github.com/TeamSillyBees/oprun-skills/releases/latest/download/oprun-project-planning.zip) · [安装与排错](INSTALL.md)
|
|
22
|
+
|
|
23
|
+
支持 Skill 和 MCP OAuth 的客户端可按指引完成安装及连接检查,首次登录授权由你完成。Qveris 1.0.22 的当前研究会话可读取指引和检查连接,但不能执行安装程序;实际安装及更新使用“添加技能 → 上传 ZIP”,随后在对话中选择 Skill 并启用 oprun。Qveris、WorkBuddy 若不能自动添加连接,导入对应配置后点击授权即可。一个连接支持方案、发单、接单和交付,能力随当前身份及授权确定。
|
|
24
|
+
|
|
25
|
+
安装工具只处理 Skill 和公开配置,不保存密码或 Token,不自动扩大已有授权。更新校验正式版本、保留恢复目录,遇到本地修改停止覆盖。
|
|
26
|
+
|
|
27
|
+
## 连接后能做什么
|
|
28
|
+
|
|
29
|
+
登录并验证连接后,Agent 会在回复末尾按你的实际权限给出操作引导。选择后再执行,例如:
|
|
30
|
+
|
|
31
|
+
- “列出我的项目,再读取库存项目的当前版本和工序。”
|
|
32
|
+
- “为研发工序补充库存查询网页的交付物和验收条件,先给我确认。”
|
|
33
|
+
- “根据这些需求生成项目方案、工时和报价。”
|
|
34
|
+
|
|
35
|
+
连接覆盖个人和企业身份当前已有的项目权限。修改已有工序需要你在 OpRun 确认;生成和补充方案使用所选身份的模型额度。旧的单项目连接需重新授权才能使用账号级能力。
|
|
36
|
+
|
|
37
|
+
[连接配置](https://www.agi.yifx.vip/mcp/setup) · [授权管理与撤销](https://www.agi.yifx.vip/mcp/manage) · [问题反馈](https://github.com/TeamSillyBees/oprun-skills/issues)
|
|
38
|
+
|
|
39
|
+
## 维护发布
|
|
40
|
+
|
|
41
|
+
Skill 内容的唯一来源是 oprun-mcp 仓库的 `skills/oprun-project-planning`,与服务端协议同仓维护,并由 OpRun MCP 以资源形式提供。**不要直接修改本仓库的 `skills/`**;修改先合入 oprun-mcp `main`,再同步到这里。本仓库只维护安装说明、通用连接示例、安装器、同步和打包工具。
|
|
42
|
+
|
|
43
|
+
1. 在 oprun-mcp 本地克隆中拉取最新 `main`,然后在本仓库运行(默认 `origin/main`,拒绝未合入 main 的提交):
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
python3 tools/sync.py --oprun-mcp ../oprun-mcp
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
脚本按来源提交完整替换 `skills/oprun-project-planning/`,删除上游已移除的文件,并把来源提交写入 `release.json` 的 `mcp_revision`。核对差异后更新 `version`。
|
|
50
|
+
|
|
51
|
+
2. 运行 `python3 -m unittest discover -s tests` 和 `python3 tools/sync.py --oprun-mcp ../oprun-mcp --check`,确认 `skills/` 与记录的来源提交完全一致。
|
|
52
|
+
|
|
53
|
+
3. 提交并推送后打包。独立 INSTALL.md 链接到该提交,未推送时脚本拒绝打包;仅本地试打包可加 `--allow-unpushed`:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
python3 tools/package.py --output-dir dist/v<版本>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
发布资产时先创建绑定完整提交的空草稿,再运行 `python3 tools/upload_assets.py --directory dist/v<版本> --tag v<版本>`;核对下载后再正式发布。安装说明以 `text/plain` 上传,但 GitHub 下载层仍可能返回二进制类型;一句话接入使用仓库网页说明,下载入口仅供包管理工具使用。不覆盖既有正式资产。
|
|
60
|
+
|
|
61
|
+
输出可复现的 ZIP、安装指南、安装工具 `install.py`、通用及各宿主 MCP 配置(Skill 中的 `assets/*-mcp.json`)、`manifest.json` 与 `SHA256SUMS`。ZIP 即同步来的完整 Skill 目录;清单的 `skill_files` 列出每个成员的校验值,`mcp_revision` 是 Skill 来源提交,不代表线上当前版本。为新版本使用新的输出目录和版本标签;源码更新与 Release 发布分开执行,不覆盖旧资产。
|
|
62
|
+
|
|
63
|
+
Skill 的唯一维护源迁到 [oprun-mcp](https://github.com/TeamSillyBees/oprun-mcp)。此仓库只分发固定提交;原 PR #17 的工序与文件说明由本次同步一并纳入,不需要分别建立发单和接单连接。
|
|
64
|
+
|
|
65
|
+
## npm 发布
|
|
66
|
+
|
|
67
|
+
npm 与 ZIP 使用相同的 `release.json` 版本、固定来源和逐文件摘要。先运行 `node --test tests/*.test.mjs`,再提交推送。构建器拒绝未提交内容、版本错配、覆盖旧制品和安装时自动执行的脚本。
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
node tools/package-npm.mjs --output-dir dist/npm-v<版本>
|
|
71
|
+
cd dist/npm-v<版本>
|
|
72
|
+
npm pack --ignore-scripts
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
发布前核对 npm 包名的所有权、包内文件清单,以及 `bundle.json` 和 ZIP `manifest.json` 中的 `skill_files`、`revision` 完全一致。使用已审核的 `.tgz` 执行 `npm publish <包文件> --access public --ignore-scripts`;首次发布和 npm 的双重验证由维护者完成,不记录凭据。正式 ZIP 和 npm 必须来自同一提交。用 `python3 tools/package.py --output-dir dist/v<版本> --npm-tarball dist/npm-v<版本>/oprun-skills-<版本>.tgz` 生成联合 Release,逐文件验证后把 npm 包作为 `oprun-skills.tgz` 纳入清单。分别下载验证后才报告发布完成。npm 发布失败时不要宣称 npm 注册表已可用,原 ZIP 安装保持可用;也可通过 `npx https://github.com/TeamSillyBees/oprun-skills/releases/latest/download/oprun-skills.tgz install` 安装同版本包。
|
|
76
|
+
|
|
77
|
+
CLI 没有运行时依赖及安装钩子;`install` / `update` 仅在显式调用时写 Skill 目录。`doctor` 不读取 OAuth 凭据,不查询业务项目。npm 包不会在后台拉取新内容:更新使用 `npx oprun-skills@latest update`,需要固定版本时用 `@<版本>`。原 Python 安装器继续提供;两者兼容同一安装记录。
|
package/bundle.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4.1",
|
|
3
|
+
"repository": "TeamSillyBees/oprun-skills",
|
|
4
|
+
"skill": "oprun-project-planning",
|
|
5
|
+
"grant_version": 2,
|
|
6
|
+
"mcp_revision": "7a2f5da2b1f96e18e224fa428873a0407dc2589b",
|
|
7
|
+
"source_repository": "TeamSillyBees/oprun-mcp",
|
|
8
|
+
"source_merge_status": "merged",
|
|
9
|
+
"revision": "76baadfd72ee254713bab68b27d6af678661d3d3",
|
|
10
|
+
"skill_files": {
|
|
11
|
+
"SKILL.md": "4ebf243ef59a5407506e470f87cbb23e115b18b8a62262d13508af4896608f99",
|
|
12
|
+
"assets/external-plan.example.json": "02b2b875d6f7220a30406ac4e8ad896787fed03e0ab751bd3b69383e210079b2",
|
|
13
|
+
"assets/qveris-mcp.json": "8827eaf60dd7ee3e7f5e54995f0af538909a2f10a2989cd43293b8092f24db2c",
|
|
14
|
+
"assets/qveris-readonly-mcp.json": "87f151d6a729c8eb615ef8abfb51b1ea068ba0eb439db2c5af9f13f158e23007",
|
|
15
|
+
"assets/workbuddy-mcp.json": "6530f66756cd50cdf1b7c1adc45978e77b9012f5d77cdc779239341257e25b85",
|
|
16
|
+
"references/delivery.md": "a97d45f43be16cce27b2c03aedf065ba31c3aa1886616ee1d4a469baf64670d5",
|
|
17
|
+
"references/external-planning.md": "4d7c467bed8941be5fc86d6ec17bdb5a9e06c1f11dbd0abb9dc6e7c02e0c3402",
|
|
18
|
+
"references/hosts.md": "b61f7a9e870b2934258880f23dc8bd9ad2ed5c1915572d63a6c3713e48c3078c",
|
|
19
|
+
"references/matching.md": "d93e086408698904f9d23b09b773db753f1388df85498e01446ef044d99b38c8",
|
|
20
|
+
"references/qveris.md": "6f7a12a0a47d786c9d3e4d0c9185117a03f3fa14892478973b46ffd149c078ff",
|
|
21
|
+
"references/updates.md": "d1a47df2ce5662c18279dab681f53017d41dcc33f8d2c045eeab2ac224ec689b",
|
|
22
|
+
"references/workbuddy.md": "d2a1f0d2c7d5a57bce03e5c8e3bed81f2f51d6a820e23afdf345360724b52505",
|
|
23
|
+
"references/workflow.md": "b16be84f08eae8c4fa18cd10b6b31a4b65813d2f5b9dc0f4dd2c7059c028129a"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/cli/core.mjs
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {createHash, randomUUID} from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
export const SKILL = 'oprun-project-planning';
|
|
6
|
+
export const STATE = '.oprun-install.json';
|
|
7
|
+
export const SITE = 'https://www.agi.yifx.vip';
|
|
8
|
+
const REPO = 'TeamSillyBees/oprun-skills';
|
|
9
|
+
export const digest = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
10
|
+
const fail = message => { throw new Error(message); };
|
|
11
|
+
const json = file => JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
12
|
+
const equal = (a, b) => JSON.stringify(Object.entries(a).sort()) === JSON.stringify(Object.entries(b).sort());
|
|
13
|
+
export function safeName(name) {
|
|
14
|
+
const parts = name.split('/');
|
|
15
|
+
if (!name || name.includes('\\') || parts.some(p => !p || p === '.' || p === '..' || /[<>:"|?*\x00-\x1f]/.test(p) || /[. ]$/.test(p) || /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$)/i.test(p)) || name.toLowerCase() === STATE.toLowerCase()) fail('Unsafe Skill file name');
|
|
16
|
+
}
|
|
17
|
+
export function treeHashes(root, ignoreReceipt = true) {
|
|
18
|
+
const entries = [];
|
|
19
|
+
const seen = new Set();
|
|
20
|
+
let size = 0;
|
|
21
|
+
function walk(dir, prefix = '') {
|
|
22
|
+
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
|
|
23
|
+
const name = prefix + entry.name;
|
|
24
|
+
const full = path.join(dir, entry.name);
|
|
25
|
+
const stat = fs.lstatSync(full);
|
|
26
|
+
if (stat.isSymbolicLink()) fail('Symbolic links are not supported inside a Skill');
|
|
27
|
+
if (ignoreReceipt && name === STATE) {
|
|
28
|
+
if (!stat.isFile()) fail('Invalid installation receipt');
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
safeName(name);
|
|
32
|
+
if (seen.has(name.toLowerCase())) fail('Case-conflicting Skill paths');
|
|
33
|
+
seen.add(name.toLowerCase());
|
|
34
|
+
if (stat.isDirectory()) walk(full, name + '/');
|
|
35
|
+
else if (stat.isFile()) {
|
|
36
|
+
size += stat.size;
|
|
37
|
+
if (size > 16 * 1024 * 1024) fail('Skill exceeds size limit');
|
|
38
|
+
entries.push([name, digest(fs.readFileSync(full))]);
|
|
39
|
+
} else fail('Unsupported Skill entry');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (fs.lstatSync(root).isSymbolicLink()) fail('Symbolic link Skill directory');
|
|
43
|
+
walk(root);
|
|
44
|
+
return Object.fromEntries(entries);
|
|
45
|
+
}
|
|
46
|
+
function version(value) {
|
|
47
|
+
if (!/^\d+\.\d+\.\d+$/.test(value)) fail('Invalid stable version');
|
|
48
|
+
return value.split('.').map(Number);
|
|
49
|
+
}
|
|
50
|
+
function compare(a, b) {
|
|
51
|
+
const av = version(a), bv = version(b);
|
|
52
|
+
for (let i = 0; i < 3; i++) if (av[i] !== bv[i]) return Math.sign(av[i] - bv[i]);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
export function loadBundle(root) {
|
|
56
|
+
const manifest = json(path.join(root, 'bundle.json'));
|
|
57
|
+
const release = json(path.join(root, 'release.json'));
|
|
58
|
+
const pkg = json(path.join(root, 'package.json'));
|
|
59
|
+
if (manifest.repository !== REPO || manifest.skill !== SKILL || manifest.version !== release.version || manifest.version !== pkg.version || manifest.mcp_revision !== release.mcp_revision || !/^[a-f0-9]{40}$/.test(manifest.revision) || !/^[a-f0-9]{40}$/.test(manifest.mcp_revision)) fail('Package identity mismatch');
|
|
60
|
+
version(manifest.version);
|
|
61
|
+
const skillRoot = path.join(root, 'skills', SKILL);
|
|
62
|
+
const hashes = treeHashes(skillRoot, false);
|
|
63
|
+
if (!hashes['SKILL.md'] || !equal(hashes, manifest.skill_files)) fail('Skill content checksum mismatch');
|
|
64
|
+
return {manifest, skillRoot};
|
|
65
|
+
}
|
|
66
|
+
function writeReceipt(dir, manifest) {
|
|
67
|
+
const temporary = path.join(dir, `.oprun-receipt-${randomUUID()}`);
|
|
68
|
+
try {
|
|
69
|
+
fs.writeFileSync(temporary, JSON.stringify({version: manifest.version, revision: manifest.revision, skill_files: manifest.skill_files}, null, 2) + '\n', {flag: 'wx', mode: 0o600});
|
|
70
|
+
fs.renameSync(temporary, path.join(dir, STATE));
|
|
71
|
+
} finally { fs.rmSync(temporary, {force: true}); }
|
|
72
|
+
}
|
|
73
|
+
function targetPath(target) {
|
|
74
|
+
const absolute = path.resolve(target);
|
|
75
|
+
// Resolve existing ancestors (e.g. macOS /tmp) without accepting a symlink target.
|
|
76
|
+
try {
|
|
77
|
+
if (fs.lstatSync(absolute).isSymbolicLink()) fail('Symbolic link installation target');
|
|
78
|
+
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
79
|
+
if (path.basename(absolute) !== SKILL) fail(`Target must end in ${SKILL}`);
|
|
80
|
+
fs.mkdirSync(path.dirname(absolute), {recursive: true});
|
|
81
|
+
return path.join(fs.realpathSync(path.dirname(absolute)), path.basename(absolute));
|
|
82
|
+
}
|
|
83
|
+
export function install(bundle, target, update = false, operations = fs) {
|
|
84
|
+
target = targetPath(target);
|
|
85
|
+
const {manifest, skillRoot} = bundle;
|
|
86
|
+
// Revalidate immediately before use; never rely on a stale download/receipt.
|
|
87
|
+
if (!equal(treeHashes(skillRoot, false), manifest.skill_files)) fail('Skill content checksum mismatch');
|
|
88
|
+
const parent = path.dirname(target);
|
|
89
|
+
const lock = path.join(parent, `.${SKILL}.lock`);
|
|
90
|
+
try { fs.mkdirSync(lock); } catch { fail('Another installation is active; inspect the lock before retrying'); }
|
|
91
|
+
let stage;
|
|
92
|
+
let backup;
|
|
93
|
+
try {
|
|
94
|
+
if (fs.existsSync(target)) {
|
|
95
|
+
const actual = treeHashes(target);
|
|
96
|
+
const receiptPath = path.join(target, STATE);
|
|
97
|
+
const receipt = fs.existsSync(receiptPath) ? json(receiptPath) : null;
|
|
98
|
+
if (receipt && compare(manifest.version, receipt.version) < 0) fail('Downgrade refused');
|
|
99
|
+
if (equal(actual, manifest.skill_files)) {
|
|
100
|
+
writeReceipt(target, manifest);
|
|
101
|
+
return {status: 'current', target, version: manifest.version};
|
|
102
|
+
}
|
|
103
|
+
if (!update || !receipt) fail('Existing Skill differs; preserve and review it before updating');
|
|
104
|
+
if (!equal(actual, receipt.skill_files)) fail('Local Skill changes detected; nothing overwritten');
|
|
105
|
+
if (compare(manifest.version, receipt.version) <= 0) fail('Same version has different contents; update refused');
|
|
106
|
+
} else if (update) fail('Skill is not installed; run install first');
|
|
107
|
+
stage = fs.mkdtempSync(path.join(parent, '.oprun-stage-'));
|
|
108
|
+
for (const name of Object.keys(manifest.skill_files)) {
|
|
109
|
+
safeName(name);
|
|
110
|
+
const output = path.join(stage, name);
|
|
111
|
+
fs.mkdirSync(path.dirname(output), {recursive: true});
|
|
112
|
+
fs.copyFileSync(path.join(skillRoot, name), output, fs.constants.COPYFILE_EXCL);
|
|
113
|
+
}
|
|
114
|
+
if (!equal(treeHashes(stage), manifest.skill_files)) fail('Staged Skill verification failed');
|
|
115
|
+
writeReceipt(stage, manifest);
|
|
116
|
+
if (fs.existsSync(target)) {
|
|
117
|
+
// Store backups outside the active Skill discovery directory.
|
|
118
|
+
const backupRoot = path.join(parent, '..', 'oprun-skill-backups');
|
|
119
|
+
fs.mkdirSync(backupRoot, {recursive: true});
|
|
120
|
+
backup = path.join(fs.mkdtempSync(path.join(backupRoot, 'backup-')), SKILL);
|
|
121
|
+
operations.renameSync(target, backup);
|
|
122
|
+
}
|
|
123
|
+
try { operations.renameSync(stage, target); stage = undefined; }
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (backup) operations.renameSync(backup, target);
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
return {status: update ? 'updated' : 'installed', target, version: manifest.version, ...(backup ? {backup} : {})};
|
|
129
|
+
} finally {
|
|
130
|
+
if (stage) fs.rmSync(stage, {recursive: true, force: true});
|
|
131
|
+
fs.rmdirSync(lock);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export function inspect(bundle, target) {
|
|
135
|
+
if (!fs.existsSync(target)) return {status: 'not_installed'};
|
|
136
|
+
const actual = treeHashes(target);
|
|
137
|
+
const receiptPath = path.join(target, STATE);
|
|
138
|
+
if (!fs.existsSync(receiptPath)) return {status: equal(actual, bundle.manifest.skill_files) ? 'unmanaged_matching' : 'unmanaged'};
|
|
139
|
+
const receipt = json(receiptPath);
|
|
140
|
+
const matches = equal(actual, receipt.skill_files);
|
|
141
|
+
const comparison = compare(receipt.version, bundle.manifest.version);
|
|
142
|
+
return {status: !matches ? 'modified' : comparison < 0 ? 'update_available' : comparison > 0 ? 'newer_than_cli' : equal(actual, bundle.manifest.skill_files) ? 'current' : 'content_mismatch', installed_version: receipt.version, package_version: bundle.manifest.version};
|
|
143
|
+
}
|
|
144
|
+
export function chooseHost(host, project) {
|
|
145
|
+
if (host !== 'auto') return host;
|
|
146
|
+
const found = [['codex', '.agents'], ['claude', '.claude']].filter(([, marker]) => fs.existsSync(path.join(project, marker)));
|
|
147
|
+
return found.length === 1 ? found[0][0] : 'generic';
|
|
148
|
+
}
|
|
149
|
+
export function profile(bundle, host, readonly) {
|
|
150
|
+
const config = json(path.join(bundle.skillRoot, 'assets', readonly ? 'qveris-readonly-mcp.json' : 'qveris-mcp.json'));
|
|
151
|
+
const server = config.mcpServers.oprun;
|
|
152
|
+
const requested_scopes = server.scope.split(' ');
|
|
153
|
+
if (host !== 'qveris') {
|
|
154
|
+
delete server.authMode; delete server.issuer; delete server.scope;
|
|
155
|
+
if (host === 'workbuddy') server.type = 'streamableHttp';
|
|
156
|
+
}
|
|
157
|
+
return {config, requested_scopes, config_written: false, oauth: 'not_checked', tools: 'not_checked'};
|
|
158
|
+
}
|
|
159
|
+
export async function checkConnection(fetcher = fetch) {
|
|
160
|
+
async function get(url) {
|
|
161
|
+
const response = await fetcher(url, {signal: AbortSignal.timeout(15000), redirect: 'error', headers: {'accept': 'application/json'}});
|
|
162
|
+
if (!response.ok) fail('Public OAuth discovery request failed');
|
|
163
|
+
const reader = response.body.getReader();
|
|
164
|
+
const chunks = []; let size = 0;
|
|
165
|
+
try {
|
|
166
|
+
for (;;) {
|
|
167
|
+
const {done, value} = await reader.read(); if (done) break;
|
|
168
|
+
size += value.length; if (size > 256 * 1024) fail('Discovery document exceeds size limit');
|
|
169
|
+
chunks.push(Buffer.from(value));
|
|
170
|
+
}
|
|
171
|
+
} finally { await reader.cancel(); }
|
|
172
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
173
|
+
}
|
|
174
|
+
const resource = await get(`${SITE}/.well-known/oauth-protected-resource/mcp`);
|
|
175
|
+
const auth = await get(`${SITE}/.well-known/oauth-authorization-server/mcp`);
|
|
176
|
+
if (resource.resource !== `${SITE}/mcp` || !resource.authorization_servers?.includes(`${SITE}/mcp`) || auth.issuer !== `${SITE}/mcp` || !auth.code_challenge_methods_supported?.includes('S256')) fail('Unexpected OAuth discovery metadata');
|
|
177
|
+
return {discovery: 'passed', oauth: 'not_checked', tools: 'not_checked', next: '在客户端完成 OAuth,再调用 tools/list 和 oprun_account_context;检查不读取项目。'};
|
|
178
|
+
}
|
package/cli/main.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
4
|
+
import {parseArgs} from 'node:util';
|
|
5
|
+
import {SKILL, loadBundle, chooseHost, profile, install, inspect, checkConnection} from './core.mjs';
|
|
6
|
+
|
|
7
|
+
const HELP = `OpRun Skill 安装工具(Node.js 22+)
|
|
8
|
+
oprun-skills install [--host codex|claude|qveris|workbuddy|generic] [--project 路径]
|
|
9
|
+
oprun-skills update [--host ...] [--target 完整Skill目录]
|
|
10
|
+
oprun-skills doctor [--host ...] [--target 完整Skill目录] [--offline]
|
|
11
|
+
--readonly 仅输出只读权限配置,不修改现有授权
|
|
12
|
+
使用 npx oprun-skills@latest 获取最新版;本工具不会后台自动更新。
|
|
13
|
+
桌面宿主无公开安装目录时返回同版本 ZIP 和配置;首次 OAuth 由用户完成。`;
|
|
14
|
+
try {
|
|
15
|
+
const {values, positionals} = parseArgs({allowPositionals: true, options: {
|
|
16
|
+
host: {type: 'string', default: 'auto'}, project: {type: 'string', default: process.cwd()},
|
|
17
|
+
target: {type: 'string'}, readonly: {type: 'boolean', default: false},
|
|
18
|
+
offline: {type: 'boolean', default: false}, help: {type: 'boolean', short: 'h'}, version: {type: 'boolean'}
|
|
19
|
+
}});
|
|
20
|
+
if (values.help || (!positionals.length && !values.version)) { console.log(HELP); }
|
|
21
|
+
else {
|
|
22
|
+
const root = fileURLToPath(new URL('../', import.meta.url));
|
|
23
|
+
const bundle = loadBundle(root);
|
|
24
|
+
if (values.version) console.log(bundle.manifest.version);
|
|
25
|
+
else {
|
|
26
|
+
const command = positionals[0];
|
|
27
|
+
if (positionals.length !== 1 || !['install', 'update', 'doctor', 'check'].includes(command)) throw new Error('Use install, update or doctor');
|
|
28
|
+
if (!['auto', 'codex', 'claude', 'qveris', 'workbuddy', 'generic'].includes(values.host)) throw new Error('Unsupported host');
|
|
29
|
+
if (values.offline && !['doctor', 'check'].includes(command)) throw new Error('--offline applies only to doctor');
|
|
30
|
+
const host = chooseHost(values.host, values.project);
|
|
31
|
+
const target = values.target || (['codex', 'claude'].includes(host) ? path.resolve(values.project, host === 'codex' ? '.agents' : '.claude', 'skills', SKILL) : null);
|
|
32
|
+
const result = {package_version: bundle.manifest.version, source_revision: bundle.manifest.mcp_revision, host};
|
|
33
|
+
if (['doctor', 'check'].includes(command)) {
|
|
34
|
+
result.installation = target ? inspect(bundle, target) : {status: 'host_managed'};
|
|
35
|
+
try { result.connection = values.offline ? {discovery: 'not_checked', oauth: 'not_checked', tools: 'not_checked'} : await checkConnection(); }
|
|
36
|
+
catch { result.connection = {discovery: 'failed', oauth: 'not_checked', tools: 'not_checked', next: '检查网络及公开 OAuth 发现地址;未读取登录信息。'}; process.exitCode = 1; }
|
|
37
|
+
if (['modified', 'content_mismatch', 'not_installed', 'unmanaged'].includes(result.installation.status)) process.exitCode = 1;
|
|
38
|
+
} else {
|
|
39
|
+
result.installation = target ? install(bundle, target, command === 'update') : {status: 'awaiting_host_import', zip: `https://github.com/TeamSillyBees/oprun-skills/releases/download/v${bundle.manifest.version}/${SKILL}.zip`, next: '使用客户端原生 ZIP 导入,或提供其公开支持的 --target 目录。'};
|
|
40
|
+
result.connection = profile(bundle, host, values.readonly);
|
|
41
|
+
}
|
|
42
|
+
console.log(JSON.stringify(result, null, 2));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Do not emit environment values, HTTP bodies, credentials or stack traces.
|
|
47
|
+
console.error(JSON.stringify({error: error.code ? `本地文件操作失败(${error.code}),请检查目标目录。` : error instanceof SyntaxError ? '配置或清单不是有效 JSON。' : error.message}));
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oprun-skills",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Install, update and check the official OpRun Skill and remote MCP connection guidance",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"oprun-skills": "cli/main.mjs"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"cli/",
|
|
14
|
+
"skills/",
|
|
15
|
+
"bundle.json",
|
|
16
|
+
"release.json",
|
|
17
|
+
"INSTALL.md"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/TeamSillyBees/oprun-skills.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/TeamSillyBees/oprun-skills#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/TeamSillyBees/oprun-skills/issues"
|
|
26
|
+
},
|
|
27
|
+
"license": "UNLICENSED",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"registry": "https://registry.npmjs.org/"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "node --test tests/*.test.mjs"
|
|
34
|
+
},
|
|
35
|
+
"oprun": {
|
|
36
|
+
"source_revision": "76baadfd72ee254713bab68b27d6af678661d3d3",
|
|
37
|
+
"mcp_revision": "7a2f5da2b1f96e18e224fa428873a0407dc2589b"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/release.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4.1",
|
|
3
|
+
"repository": "TeamSillyBees/oprun-skills",
|
|
4
|
+
"skill": "oprun-project-planning",
|
|
5
|
+
"grant_version": 2,
|
|
6
|
+
"mcp_revision": "7a2f5da2b1f96e18e224fa428873a0407dc2589b",
|
|
7
|
+
"source_repository": "TeamSillyBees/oprun-mcp",
|
|
8
|
+
"source_merge_status": "merged"
|
|
9
|
+
}
|