[codex] harden clawhub plugin publishing and install#56870
Conversation
Greptile SummaryThis PR hardens ClawHub plugin publishing and install by fixing scoped package name handling in archive downloads, consolidating temp-file cleanup behind a
Confidence Score: 5/5Safe to merge — all changes are well-scoped refactors with matching test coverage and no regressions in the changed paths. No P0 or P1 issues found. The scoped-package filename fix is correct (path.basename strips the scope, unique mkdtemp dir prevents collisions). Cleanup delegation is semantically equivalent to the previous two-step rm. The contract package logic is null-safe and fully tested. Docs regression tests anchor the snippets to the validator. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/infra/temp-download.ts | New temp-download abstraction wrapping mkdtemp-based isolation with sanitized filenames and attached cleanup(). Moved from plugin-sdk/temp-path.ts with no logic changes. |
| src/infra/clawhub.ts | Downloads now use createTempDownloadTarget; path.basename inside sanitizeTempFileName strips scopes safely. ClawHubPackageCompatibility aliased to ExternalPluginCompatibility (additive: gains optional pluginSdkVersion). |
| src/plugins/clawhub.ts | Cleanup replaced from two ad-hoc fs.rm calls to a single archive.cleanup() delegation; semantically equivalent but cleaner. |
| src/agents/skills-clawhub.ts | Same cleanup consolidation as plugins/clawhub.ts; correctly delegates to archive.cleanup() in the finally block. |
| packages/plugin-package-contract/src/index.ts | Clean canonical validation helpers for external code plugins with correct null-safe field traversal and proper fallback logic. |
| src/docs/clawhub-plugin-docs.test.ts | Regression tests verify canonical snippet files pass contract validation and labelled JSON blocks in docs match the snippets. |
| src/plugin-sdk/temp-path.ts | Reduced to a pure re-export barrel of temp-download.ts; removes ~80 lines of duplicated code. |
Reviews (1): Last reviewed commit: "fix: harden clawhub plugin publishing an..." | Re-trigger Greptile
0bd38c3 to
b028549
Compare
|
🤖 We're reviewing this PR with Aisle We're running a security check on the changes in this PR now. This usually takes a few minutes. ⌛ Progress:
Latest run failed. Keeping previous successful results. Trace ID: Last updated on: 2026-03-30T09:47:26Z |
* fix: harden clawhub plugin publishing and install * fix(process): preserve windows shim exit success
* fix: harden clawhub plugin publishing and install * fix(process): preserve windows shim exit success
* fix: harden clawhub plugin publishing and install * fix(process): preserve windows shim exit success
* fix: harden clawhub plugin publishing and install * fix(process): preserve windows shim exit success
Summary
@openclaw/plugin-package-contractworkspace package for external ClawHub-published pluginsRoot cause
The OpenClaw side of the plugin publish flow had two structural problems: archive downloads treated package names as filesystem-safe paths, which breaks for scoped packages, and the published plugin contract was not owned or tested as a single source of truth for docs and validation.
What changed
src/infra/temp-download.tsand re-export fromsrc/plugin-sdk/temp-path.tspackages/plugin-package-contractwith canonical compatibility-field validation helpers for externally published code pluginsdocs/snippets/plugin-publish/clawhub package publishand include requiredopenclaw.compat/openclaw.buildmetadataclawhub publishin plugin docsFollow-up
The final cross-repo de-duplication step is intentionally deferred until the corresponding publishable package releases exist. For now this PR makes the contract explicit and tested without depending on npm publish rights.
Validation
pnpm exec vitest run packages/plugin-package-contract/src/index.test.ts src/infra/clawhub.test.ts src/plugins/clawhub.test.ts src/agents/skills-clawhub.test.ts src/docs/clawhub-plugin-docs.test.tsnode --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.json --noEmit