oprun-skills 0.0.0-stage → 1.4.0
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 +59 -0
- package/README.md +74 -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,59 @@
|
|
|
1
|
+
# 安装或更新 OpRun
|
|
2
|
+
|
|
3
|
+
用户说“安装 OpRun”或“更新 OpRun”时,执行以下简短流程。阅读入口为 https://github.com/TeamSillyBees/oprun-skills/blob/main/INSTALL.md,使用网页读取工具时不要访问 Release 附件下载地址,GitHub 可能将其强制作为二进制附件返回。默认使用最新正式 Release,不用移动的 main 作为安装版本。
|
|
4
|
+
|
|
5
|
+
1. 先核对当前会话工具、宿主和已有连接。Qveris 中已保存连接还需在“本对话已启用”中勾选 oprun;不要用反复搜索替代连接检查。没有命令执行或文件写入能力时,直接使用宿主原生 ZIP 导入。
|
|
6
|
+
2. 有 Node.js 22+ 时执行 `npx oprun-skills@latest install --host <宿主>`,更新使用 `update`,检查使用 `doctor`。支持 codex、claude、qveris、workbuddy、generic。工具携带固定版本的完整 Skill,校验每个文件;不依赖 Python,不启动本地业务服务。`npx` 首次可能要求确认下载官方 npm 包。
|
|
7
|
+
3. 默认只写当前项目。Codex 使用 `.agents/skills/oprun-project-planning`,Claude Code 使用 `.claude/skills/oprun-project-planning`。只有项目标记唯一时自动识别;不确定时输出原生导入说明。桌面宿主导入同版本 ZIP;仅当宿主公开支持目录时使用 `--target <完整Skill目录>`,目录名须为 `oprun-project-planning`。不猜测应用私有数据库位置。
|
|
8
|
+
4. 复用已有 MCP 连接。工具只输出公开配置,不改写宿主配置;需要时使用原生导入。只读用途加 `--readonly`,已有授权不自动扩大。用户本人完成首次 OAuth;再在客户端调用 `tools/list`、`oprun_account_context` 检查授权和工具。不得查询项目或执行业务操作来验证安装。
|
|
9
|
+
5. `doctor` 检查公开 OAuth 发现及本地安装记录,发现成功不代表登录或工具调用成功。`--offline` 仅核对文件;`update_available` 表示已安装版本早于当前 CLI 所携版本,不表示已完成更新。桌面宿主的导入状态需在其原生界面核对。
|
|
10
|
+
|
|
11
|
+
npm 注册表不可用时,可执行 `npx https://github.com/TeamSillyBees/oprun-skills/releases/latest/download/oprun-skills.tgz install --host <宿主>`,更新时将 `install` 换成 `update`。使用固定版本可把 URL 中的 `latest/download` 改成 `download/v<版本>`。
|
|
12
|
+
|
|
13
|
+
没有 Node.js 时仍可导入 ZIP。既有 Python 安装方式保留:从同一固定 Release 下载并校验 `install.py`、`manifest.json` 和 `SHA256SUMS`,用 Python 3.9+ 执行 `python3 install.py install|update|check`。不要使用 curl 管道直接运行下载脚本。
|
|
14
|
+
|
|
15
|
+
只有实际完成相应步骤才能报告“已安装/已更新、已连接”。等待用户登录或原生导入时说明具体一步;不把脚本测试当作客户端真实验收。
|
|
16
|
+
|
|
17
|
+
再次更新沿用同一流程,不重建连接、不删除用户配置。工具输出 backup 是恢复目录;npm 更新备份放在 Skill 扫描目录外的 `oprun-skill-backups`。需要恢复时先比较两边安装记录和文件摘要,备份当前目录,再将 backup 下的完整 Skill 目录放回原 target;不能覆盖新的本地修改。早期非托管安装只读比较;内容有差异时先保存、核对,不强行覆盖。
|
|
18
|
+
|
|
19
|
+
安装说明获取失败时:若网页读取工具拒绝 `application/octet-stream`,改读 https://github.com/TeamSillyBees/oprun-skills/blob/main/INSTALL.md;仍无法读取时使用 GitHub Contents API 的 INSTALL.md(content 为 Base64)。同一错误不重复请求。说明入口可跟随 main,实际安装包始终固定正式 Release 标签。
|
|
20
|
+
|
|
21
|
+
以下为宿主差异和排错参考,无需逐条展示给用户。
|
|
22
|
+
|
|
23
|
+
## 客户端适配
|
|
24
|
+
|
|
25
|
+
| 客户端 | 安装位置与连接方式 |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| Codex | 当前项目 `.agents/skills/oprun-project-planning`;连接采用本机 CLI 帮助所支持的 MCP OAuth 方式 |
|
|
28
|
+
| Claude Code | 当前项目 `.claude/skills/oprun-project-planning`;使用宿主 MCP OAuth 配置 |
|
|
29
|
+
| Qveris | 原生导入完整 ZIP;导入 [专用配置](skills/oprun-project-planning/assets/qveris-mcp.json),点击“保存并授权” |
|
|
30
|
+
| WorkBuddy | 原生安装完整 Skill;导入 [专用配置](skills/oprun-project-planning/assets/workbuddy-mcp.json),点击“连接” |
|
|
31
|
+
| 其他 | 先核实宿主支持 Skill、Streamable HTTP、OAuth S256 PKCE;用原生安装与连接方式 |
|
|
32
|
+
|
|
33
|
+
默认项目范围。全局安装只在用户明确要求时使用宿主文档中的目录。脚本不编辑宿主私有数据库、Token 存储或其他 MCP 配置。仅有 `.agents` 或 `.claude` 标记时可自动识别;桌面客户端及多个标记时由 Agent 根据当前宿主选 `--host`,无需让用户猜路径。
|
|
34
|
+
|
|
35
|
+
正式下载入口为 `https://github.com/TeamSillyBees/oprun-skills/releases/latest`。先解析实际标签,所有文件从同一标签下载。`install.py`、ZIP 必须分别通过该版本清单和 SHA256SUMS 校验;摘要证明完整性,可信来源仍是官方仓库 HTTPS。没有 Python 时使用 npm 工具或宿主原生 ZIP 安装;不要让用户安装开发环境才能连接。
|
|
36
|
+
|
|
37
|
+
## 登录和权限
|
|
38
|
+
|
|
39
|
+
地址和 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)。
|
|
40
|
+
|
|
41
|
+
用户明确要连接完整功能时采用统一配置;仅查看时采用只读配置。意图不明时在 OAuth 授权页由用户选择,不悄悄扩权。一次连接覆盖当前身份已有的方案、发单、接单及交付能力,无需分别配置。既有只读连接先复用,需要新权限时另行由用户重新授权。
|
|
42
|
+
|
|
43
|
+
登录及授权由用户本人完成,凭据交给宿主保存。不要索取密码、Cookie、Token,不读取其他浏览器登录态,不把授权链接、回调参数写入文件或日志。配置文件不含静态凭据。尚未登录时可完成安装与配置,报告“等待登录授权”。
|
|
44
|
+
|
|
45
|
+
## 检查和恢复
|
|
46
|
+
|
|
47
|
+
| 检查结果 | 下一步 |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| Skill 已安装,宿主未发现 | 按宿主要求重新加载会话 |
|
|
50
|
+
| 公开发现失败 | 检查网络和站点;不能报告已连接或已是最新 |
|
|
51
|
+
| 尚未授权、401 | 使用已有连接的登录授权入口 |
|
|
52
|
+
| 工具未加载 | 检查连接是否启用并刷新;不查询业务数据 |
|
|
53
|
+
| 权限不足 | 根据 account_context 的 required_scopes,在需要该功能时重新授权 |
|
|
54
|
+
| 本地 Skill 有改动 | 保留并核对差异,不使用强制覆盖 |
|
|
55
|
+
| 旧版非托管安装 | 内容与正式包一致时登记版本;不同则先备份、比较,由用户决定保留方式 |
|
|
56
|
+
|
|
57
|
+
安装与更新验证只需 `tools/list` 和 `oprun_account_context`。不自动列出项目、生成方案或执行业务操作。用户已有具体任务时,连接通过后再继续原任务。撤销入口:[授权管理](https://www.agi.yifx.vip/mcp/manage)。
|
|
58
|
+
|
|
59
|
+
Skill 正文仍由 oprun-mcp 固定来源同步。本次安装器更新不改变服务器能力,文件内容一致时版本登记可更新,无需反复重新登录。新权限和客户端真实展示验收分别确认,不把脚本校验当成真实客户端验收。
|
package/README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpRun Skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
安装或更新,把这句话发给你的 Agent:
|
|
4
|
+
|
|
5
|
+
> 请按 https://github.com/TeamSillyBees/oprun-skills/blob/main/INSTALL.md 安装或更新 OpRun,带我完成连接。
|
|
6
|
+
|
|
7
|
+
有 Node.js 22+ 的命令行客户端可直接运行:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx oprun-skills@latest install --host codex
|
|
11
|
+
npx oprun-skills@latest update --host codex
|
|
12
|
+
npx oprun-skills@latest doctor --host codex
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
也可执行 `npm install -g oprun-skills`,再用 `oprun-skills install|update|doctor`;使用全局安装时,先用 `npm install -g oprun-skills@latest` 更新工具本身。
|
|
16
|
+
|
|
17
|
+
Claude Code 使用 `--host claude`;已能确定当前项目标记时可省略 `--host`。Qveris、WorkBuddy 保留原生 ZIP 导入,`--host qveris` 或 `--host workbuddy` 返回同版本下载地址及配置。npm 工具无需 Python,不启动本地 MCP 服务,不改写已有连接或登录信息。
|
|
18
|
+
|
|
19
|
+
[下载安装包](https://github.com/TeamSillyBees/oprun-skills/releases/latest/download/oprun-project-planning.zip) · [安装与排错](INSTALL.md)
|
|
20
|
+
|
|
21
|
+
支持 Skill 和 MCP OAuth 的客户端可按指引完成安装及连接检查,首次登录授权由你完成。Qveris 1.0.22 的当前研究会话可读取指引和检查连接,但不能执行安装程序;实际安装及更新使用“添加技能 → 上传 ZIP”,随后在对话中选择 Skill 并启用 oprun。Qveris、WorkBuddy 若不能自动添加连接,导入对应配置后点击授权即可。一个连接支持方案、发单、接单和交付,能力随当前身份及授权确定。
|
|
22
|
+
|
|
23
|
+
安装工具只处理 Skill 和公开配置,不保存密码或 Token,不自动扩大已有授权。更新校验正式版本、保留恢复目录,遇到本地修改停止覆盖。
|
|
24
|
+
|
|
25
|
+
## 连接后能做什么
|
|
26
|
+
|
|
27
|
+
登录并验证连接后,Agent 会在回复末尾按你的实际权限给出操作引导。选择后再执行,例如:
|
|
28
|
+
|
|
29
|
+
- “列出我的项目,再读取库存项目的当前版本和工序。”
|
|
30
|
+
- “为研发工序补充库存查询网页的交付物和验收条件,先给我确认。”
|
|
31
|
+
- “根据这些需求生成项目方案、工时和报价。”
|
|
32
|
+
|
|
33
|
+
连接覆盖个人和企业身份当前已有的项目权限。修改已有工序需要你在 OpRun 确认;生成和补充方案使用所选身份的模型额度。旧的单项目连接需重新授权才能使用账号级能力。
|
|
34
|
+
|
|
35
|
+
[连接配置](https://www.agi.yifx.vip/mcp/setup) · [授权管理与撤销](https://www.agi.yifx.vip/mcp/manage) · [问题反馈](https://github.com/TeamSillyBees/oprun-skills/issues)
|
|
36
|
+
|
|
37
|
+
## 维护发布
|
|
38
|
+
|
|
39
|
+
Skill 内容的唯一来源是 oprun-mcp 仓库的 `skills/oprun-project-planning`,与服务端协议同仓维护,并由 OpRun MCP 以资源形式提供。**不要直接修改本仓库的 `skills/`**;修改先合入 oprun-mcp `main`,再同步到这里。本仓库只维护安装说明、通用连接示例、安装器、同步和打包工具。
|
|
40
|
+
|
|
41
|
+
1. 在 oprun-mcp 本地克隆中拉取最新 `main`,然后在本仓库运行(默认 `origin/main`,拒绝未合入 main 的提交):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
python3 tools/sync.py --oprun-mcp ../oprun-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
脚本按来源提交完整替换 `skills/oprun-project-planning/`,删除上游已移除的文件,并把来源提交写入 `release.json` 的 `mcp_revision`。核对差异后更新 `version`。
|
|
48
|
+
|
|
49
|
+
2. 运行 `python3 -m unittest discover -s tests` 和 `python3 tools/sync.py --oprun-mcp ../oprun-mcp --check`,确认 `skills/` 与记录的来源提交完全一致。
|
|
50
|
+
|
|
51
|
+
3. 提交并推送后打包。独立 INSTALL.md 链接到该提交,未推送时脚本拒绝打包;仅本地试打包可加 `--allow-unpushed`:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
python3 tools/package.py --output-dir dist/v<版本>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
发布资产时先创建绑定完整提交的空草稿,再运行 `python3 tools/upload_assets.py --directory dist/v<版本> --tag v<版本>`;核对下载后再正式发布。安装说明以 `text/plain` 上传,但 GitHub 下载层仍可能返回二进制类型;一句话接入使用仓库网页说明,下载入口仅供包管理工具使用。不覆盖既有正式资产。
|
|
58
|
+
|
|
59
|
+
输出可复现的 ZIP、安装指南、安装工具 `install.py`、通用及各宿主 MCP 配置(Skill 中的 `assets/*-mcp.json`)、`manifest.json` 与 `SHA256SUMS`。ZIP 即同步来的完整 Skill 目录;清单的 `skill_files` 列出每个成员的校验值,`mcp_revision` 是 Skill 来源提交,不代表线上当前版本。为新版本使用新的输出目录和版本标签;源码更新与 Release 发布分开执行,不覆盖旧资产。
|
|
60
|
+
|
|
61
|
+
Skill 的唯一维护源迁到 [oprun-mcp](https://github.com/TeamSillyBees/oprun-mcp)。此仓库只分发固定提交;原 PR #17 的工序与文件说明由本次同步一并纳入,不需要分别建立发单和接单连接。
|
|
62
|
+
|
|
63
|
+
## npm 发布
|
|
64
|
+
|
|
65
|
+
npm 与 ZIP 使用相同的 `release.json` 版本、固定来源和逐文件摘要。先运行 `node --test tests/*.test.mjs`,再提交推送。构建器拒绝未提交内容、版本错配、覆盖旧制品和安装时自动执行的脚本。
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
node tools/package-npm.mjs --output-dir dist/npm-v<版本>
|
|
69
|
+
cd dist/npm-v<版本>
|
|
70
|
+
npm pack --ignore-scripts
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
发布前核对 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` 安装同版本包。
|
|
74
|
+
|
|
75
|
+
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.0",
|
|
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": "82c868868f75f99c86b10b5164059de3002348bc",
|
|
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.0",
|
|
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": "82c868868f75f99c86b10b5164059de3002348bc",
|
|
37
|
+
"mcp_revision": "7a2f5da2b1f96e18e224fa428873a0407dc2589b"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/release.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4.0",
|
|
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
|
+
}
|