Add skill-bridge plugin (antianqi/skill-bridge) - #3
Conversation
Convert openclaw (and similar) skills into mavis/mcode-compatible skills or plugins. Detects encoding, parameterizes hardcoded paths, enriches frontmatter, runs the official lint, and produces a portable Skill-only Agent Plugin. - 1 Skill (skill-bridge) - 6 lib modules - 3 working demo conversions (task-tracker, investor-brand-kit, self-improving-agent) - 29 unit + integration tests - MIT license - Validates clean against the official plugin-compatibility.md schema
hetaoBackend
left a comment
There was a problem hiding this comment.
暂不符合收录门禁,当前转换结果可能静默丢内容并修改插件输出目录之外的文件:
- transform-skill.js 把 500 行后的章节移动到 references/,但生成的 SKILL.md 没有插入任何 references 链接或索引;转换后的 Skill 无法发现被移动内容,和 PR 的“保持/转换”承诺不一致。
- lint.js 的 fallback 把 .sb-lint.mjs 写到 ~/.minimax/.builtin-skills/... 的内置 Skill 目录旁边;这会修改用户/宿主安装区,并有并发覆盖风险。请改为系统临时目录中的唯一文件并保证 finally 清理,或直接调用稳定公开接口。
- --force 只覆盖已知文件、不清理旧输出,旧 references/ 会残留并混入新转换结果。请原子生成到临时目录后替换,或明确清理受控目标并补回归测试。
- 请把上述行为补成自动化测试;当前官方 validator 只验证包结构,不验证 converter 正确性。
修复后请更新 test evidence,我会按新 head 复核。
Fixes the 4 issues hetaoBackend raised in the CHANGES_REQUESTED review on hetaoBackend#3. 1. References index: when transform-skill splits a long body into references/<topic>.md, the generated SKILL.md now contains a `## References` section with markdown links to each split-off file. Without this, the moved content was unreachable from the body. 2. lint staging no longer touches the install dir: lib/lint.js's stageMjsInTmp() now stages the .mjs in a unique os.tmpdir() subdir and removes it in a finally block on every code path. The previous implementation wrote <homedir>/.minimax/.builtin-skills/.../lint-skill.sb-lint.mjs, which polluted the user''s install area and had a TOCTOU race between concurrent runs. 3. Atomic outDir replace (--force safe): transform-skill now writes everything into a sibling <outDir>.staging-<rand> directory first, then fs.rm(outDir) + fs.rename swaps it in. On any failure the staging dir is removed in finally. This means --force no longer leaves stale references/ from a previous run mixed into the new output. 4. Test coverage: 4 new tests added. - transformSkill adds a References index when body is split - transformSkill replaces outDir atomically (no stale references/) - lintSkill (subprocess path) stages the .mjs in os.tmpdir() - lintSkill (fast path) returns the lint-script failure faithfully Total: 33 tests, all passing on Node 24.18.0. Also: fix CJS/ESM interop on the fast path -- Node 22 puts CJS exports under mod.default.lint, not mod.lint. Demo outputs in examples/output/ regenerated to reflect the new References index (visible in self-improving-agent/SKILL.md). package-lock.json: realigned with package.json (iconv-lite ^0.6.3, js-yaml ^4.1.0) -- the previous lockfile was inconsistent with the manifest.
|
@hetaoBackend 4 个 review blocker 已修,新 head 是 1. References 索引 ( 2. lint 写到 tmpdir ( 3. 原子替换 ( 4. 测试覆盖
附带改动:
|
hetaoBackend
left a comment
There was a problem hiding this comment.
@antianqi 感谢更新。最新 head 64bc5dd 仍没有形成安装后可运行的 portable Plugin:
- Skill 调用裸命令
mcode-skill-bridge,但 Plugin 安装不会执行嵌套npm install/npm link,不会注册 bin 或依赖;安装后核心能力不可执行。请改为无需安装的随包入口,或受支持的 MCP stdio 交付。 - 与最新 main 合成后
npm run check为 44/50;根npm ci不安装嵌套依赖,插件内npm ci也因 lockfile 不同步失败。 - 所谓原子替换先删除
outDir再 rename;rename 失败会丢失旧输出。需要失败保留测试。 - lint failure 只打印 WARN 且退出 0,与 Skill 的失败契约冲突。
- PR 修改了仓库根
.gitignore,越出单 Plugin 目录范围。
这不是小修即可合入的问题,请先收敛交付模型、依赖与失败语义,再触发复审。
The previous PR overwrote the repo-root .gitignore (which lists node_modules/, .DS_Store, coverage/, *.log) with a single line probe-*.mjs. CONTRIBUTING.md requires that contributor changes stay inside plugins/<owner>/<plugin>; the plugin-local .gitignore is added under plugins/antianqi/skill-bridge/.gitignore.
Per the maintainer's round-2 review on PR hetaoBackend#3, the v0.1 npm-CLI delivery model is incompatible with the portable Agent Plugins 1.0 contract: - plugin install does not run npm install or npm link, so a plugin-local bin (mcode-skill-bridge) is never registered and never callable. - the npm dependencies (iconv-lite, js-yaml) are not installed when the plugin is consumed; the validator and the test runner both fail. - the converter spawned external commands in its SKILL.md, which is a non-starter for a portable Skill. v0.2 replaces the npm package with a self-contained MCP stdio server. Concretely: - Drop package.json, package-lock.json, index.js, and the CLI surface they imply. - Add mcp.json (one stdio MCP server) and server.mjs (the JSON-RPC-over-stdio server). The server exposes four tools: detect, analyze, classify, convert. - Rewrite the lib/ modules to use only Node built-ins. The encoding detector now uses TextDecoder('gb18030') instead of iconv-lite; the YAML subset parser is hand-rolled instead of pulling in js-yaml. - Rewrite skills/skill-bridge/SKILL.md to teach the agent to call the MCP tools instead of spawning a CLI. - Update the README to describe the MCP delivery model and the zero-dependency contract. Atomic-replace guarantee hardened: the backup-rename dance in lib/transform-skill.js is exercised by a new regression test that asserts a pre-existing outDir and its sentinel file are preserved when transformSkill rejects before any write. Demo set pruned: the two upstream openclaw demos that the v0.1 plugin carried (investor-brand-kit, self-improving-agent) are removed. investor-brand-kit contained end-user business data incompatible with a public plugin; self-improving-agent was a copy of a third-party pskoett-ai-skills repository whose license was not declared. The only demo shipped in v0.2 is task-tracker, the author's own content. Test count goes from 33 (v0.1) to 50, all green. The 'npm run check' failures that remain in the repository (CRLF line endings in examples/hello-mcode/SKILL.md; path.separator on Windows in hosted-plugins.test.mjs) are pre-existing and unrelated to this plugin.
The v0.1 commit shipped examples/output/{investor-brand-kit,self-improving-agent,task-tracker}/
but task-tracker was deleted as part of the v0.2 restructure (so the
'fresh regen' workflow would not commit stale content). Re-run the
v0.2 converter on examples/input/task-tracker/ and commit the result.
examples/regen.mjs is a small wrapper that does the same work the
MCP 'convert' tool would do, without going through JSON-RPC. It is
not part of the MCP surface, not invoked by mcp.json, and not
required for the plugin to work; it is here so contributors can
re-run the demo after editing the input.
|
Add
skill-bridgepluginA small, well-tested tool that converts openclaw (and similar agent-framework)
skills into mavis/mcode-compatible Skill-only Agent Plugins.
Problem
the mavis schema (missing frontmatter, GBK-encoded Chinese, hardcoded paths,
shell assumptions).
What this plugin does
${OPENCLAW_HOME},${OPENCLAW_WORKSPACE},${SCRATCH},${DATA_DIR}.references/<topic>.md.skill-creatorlint on the output.Try it
Expected result
A directory containing a mavis-schema-valid
SKILL.mdplus aconversion-report.mddescribing every change. The plugin is thendiscoverable as a Skill in the next mavis session.
Requirements
Validation
npm run validateon this branch: PASS forplugin antianqi/skill-bridge.Two pre-existing failures in the registry repo (unrelated to this PR):
examples/hello-mcode/skills/hello-mcode/SKILL.mdhas CRLF line endingsthat the LF-only validator does not accept.
test/hosted-plugins.test.mjsasserts a forward-slash path frompath.relative, which only fails when run on Windows.Happy to file separate issues for both, or include drive-by fixes in a
follow-up PR per the maintainer`s preference.