fix: sync packaged plugin manifest#30
Conversation
📝 WalkthroughWalkthroughA build script now generates a distribution plugin manifest from the source manifest with the ChangesPlugin Manifest Parity Verification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
scripts/sync-dist-manifest.mjs (1)
5-8: ⚡ Quick winEnsure
dist/exists before writing the generated manifest.Line 6 assumes the directory already exists; creating it here makes this script independently reliable.
Suggested change
-import { readFileSync, writeFileSync } from "node:fs"; +import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; @@ const manifest = JSON.parse(readFileSync("openclaw.plugin.json", "utf8")); +mkdirSync("dist", { recursive: true }); + writeFileSync( "dist/openclaw.plugin.json", `${JSON.stringify({ ...manifest, main: "index.js" }, null, 2)}\n`, );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/sync-dist-manifest.mjs` around lines 5 - 8, The script calls writeFileSync to write "dist/openclaw.plugin.json" but doesn't ensure the dist directory exists; before the writeFileSync call (in scripts/sync-dist-manifest.mjs, near the writeFileSync line that uses manifest and main:"index.js"), create the dist directory (e.g., use fs.mkdirSync or fs.promises.mkdir with { recursive: true }) so the write won't fail when dist is missing; perform the mkdir step immediately before writing the file.src/__tests__/plugin-manifest-parity.test.ts (1)
19-22: ⚡ Quick winAdd explicit guards for
configSchema.propertiesbefore per-key checks.Line 20 can throw a TypeError if shape regresses; a dedicated assertion gives clearer failure output.
Suggested change
assert.deepEqual(distManifest.tools, rootManifest.tools); assert.deepEqual(distManifest.configSchema, rootManifest.configSchema); assert.equal(distManifest.main, "index.js"); +assert.ok(distManifest.configSchema, "dist manifest is missing configSchema"); +assert.ok( + distManifest.configSchema.properties, + "dist manifest is missing configSchema.properties", +); for (const property of [ @@ ]) { assert.ok( distManifest.configSchema.properties[property], `dist manifest is missing ${property}`, ); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/__tests__/plugin-manifest-parity.test.ts` around lines 19 - 22, Add an explicit guard assertion before the per-key check to avoid a TypeError if shape regresses: assert that distManifest.configSchema exists and that distManifest.configSchema.properties is defined (e.g. using assert.ok or assert.strictEqual) with a clear failure message, then proceed to the existing per-key assertion that references distManifest.configSchema.properties[property]; reference the symbols distManifest, configSchema, properties and the per-key check to locate where to insert the guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/sync-dist-manifest.mjs`:
- Around line 5-8: The script calls writeFileSync to write
"dist/openclaw.plugin.json" but doesn't ensure the dist directory exists; before
the writeFileSync call (in scripts/sync-dist-manifest.mjs, near the
writeFileSync line that uses manifest and main:"index.js"), create the dist
directory (e.g., use fs.mkdirSync or fs.promises.mkdir with { recursive: true })
so the write won't fail when dist is missing; perform the mkdir step immediately
before writing the file.
In `@src/__tests__/plugin-manifest-parity.test.ts`:
- Around line 19-22: Add an explicit guard assertion before the per-key check to
avoid a TypeError if shape regresses: assert that distManifest.configSchema
exists and that distManifest.configSchema.properties is defined (e.g. using
assert.ok or assert.strictEqual) with a clear failure message, then proceed to
the existing per-key assertion that references
distManifest.configSchema.properties[property]; reference the symbols
distManifest, configSchema, properties and the per-key check to locate where to
insert the guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d0ef545-2738-4f70-a896-175654cfaf90
⛔ Files ignored due to path filters (5)
dist/__tests__/plugin-manifest-parity.test.d.tsis excluded by!**/dist/**dist/__tests__/plugin-manifest-parity.test.d.ts.mapis excluded by!**/dist/**,!**/*.mapdist/__tests__/plugin-manifest-parity.test.jsis excluded by!**/dist/**dist/__tests__/plugin-manifest-parity.test.js.mapis excluded by!**/dist/**,!**/*.mapdist/openclaw.plugin.jsonis excluded by!**/dist/**
📒 Files selected for processing (3)
package.jsonscripts/sync-dist-manifest.mjssrc/__tests__/plugin-manifest-parity.test.ts
Summary
dist/openclaw.plugin.jsonfrom the root plugin manifest during build while preservingmain: index.jsfor the packaged artifactcortex_insightstool cannot disappear fromdist/againVerification
npm testgit diff --checkNotes
npm run company-brain:canarystill requires a live Cortex endpoint and returnedfetch failedlocally with the defaulthttp://localhost:8000; the repo-level unit/build coverage and the Electric Sheep staged smoke are the useful local checks for this packaging fix.Targets plugin #24 and #25.
Summary by CodeRabbit
Chores
Tests