Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(openclaw): strip dev dependencies from release artifacts (#4699)
Zayn Jarvis30c50926728e
diff --git a/.github/workflows/clawhub-dev-release.yml b/.github/workflows/clawhub-dev-release.ymlindex 19da99e70..c8807a4a5 100644--- a/.github/workflows/clawhub-dev-release.yml+++ b/.github/workflows/clawhub-dev-release.yml@@ -314,9 +314,13 @@ jobs:set -euo pipefailnpm version --no-git-tag-version --allow-same-version "$VERSION"npm ci+ npm run prepack+ # OpenClaw installs the extracted artifact as a project root. Even with+ # --omit=dev, npm resolves devDependencies and can hit Arborist peer bugs.+ npm pkg delete devDependenciespack_dir="$RUNNER_TEMP/openviking-pack"mkdir -p "$pack_dir"- npm pack --pack-destination "$pack_dir"+ npm pack --ignore-scripts --pack-destination "$pack_dir"tarball="$(find "$pack_dir" -maxdepth 1 -name '*.tgz' -print -quit)"if [ -z "$tarball" ]; thenecho "::error title=Pack failed::npm pack did not produce a tgz file."@@ -364,10 +368,13 @@ jobs:set -euo pipefailnpm version --no-git-tag-version --allow-same-version "$VERSION"npm ci+ npm run prepack+ # Keep the legacy ClawHub zip runtime-only for the same install path.+ npm pkg delete devDependenciespack_dir="$RUNNER_TEMP/openviking-clawhub-pack"package_dir="$RUNNER_TEMP/openviking-clawhub-package"mkdir -p "$pack_dir" "$package_dir"- npm pack --pack-destination "$pack_dir"+ npm pack --ignore-scripts --pack-destination "$pack_dir"tarball="$(find "$pack_dir" -maxdepth 1 -name '*.tgz' -print -quit)"if [ -z "$tarball" ]; thenecho "::error title=Pack failed::npm pack did not produce a tgz file for ClawHub."diff --git a/examples/openclaw-plugin/docs/openviking-install-package-contract.md b/examples/openclaw-plugin/docs/openviking-install-package-contract.mdindex 6a3515be3..0db69b54a 100644--- a/examples/openclaw-plugin/docs/openviking-install-package-contract.md+++ b/examples/openclaw-plugin/docs/openviking-install-package-contract.md@@ -38,7 +38,9 @@ The `setupEntry` must point at compiled JavaScript, not source TypeScript.## Runtime Dependencies-Runtime dependencies must include everything the compiled plugin imports at runtime. Development-only test/build packages belong in `devDependencies`.+Runtime dependencies must include everything the compiled plugin imports at runtime. Development-only test/build packages belong in `devDependencies` in the source manifest.++Published npm and ClawHub artifacts must remove the `devDependencies` field after `npm ci` and before `npm pack`. OpenClaw installs the extracted artifact as a project root, and `npm install --omit=dev` still resolves the root development dependency graph. Shipping that graph can therefore trigger npm Arborist peer-resolution failures even though none of those packages are needed at runtime.The package currently keeps an `axios` override to avoid installing vulnerable or incompatible transitive versions through OpenClaw packaging.@@ -78,7 +80,8 @@ The package contract test should verify:- `openclaw.extensions` and `openclaw.setupEntry` point to `dist/*.js`,- package `files` include runtime assets and docs,- install manifest required files exist,-- runtime dependencies and overrides are present.+- runtime dependencies and overrides are present,+- both release packaging paths strip `devDependencies` before `npm pack`.## Out Of Scopediff --git a/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts b/examples/openclaw-plugin/tests/ut/package-install-contract.test.tsindex 190768e45..abfad0c60 100644--- a/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts+++ b/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts@@ -87,6 +87,32 @@ describe("OpenClaw plugin package and install contract", () => {]));});+ it("strips dev dependencies before packing npm and ClawHub release artifacts", () => {+ const workflow = readFileSync(+ join(repoRoot, ".github/workflows/clawhub-dev-release.yml"),+ "utf8",+ );++ for (const stepName of [+ "Pack OpenViking plugin",+ "Prepare ClawHub legacy package folder",+ ]) {+ const stepStart = workflow.indexOf(` - name: ${stepName}`);+ expect(stepStart, `${stepName} should exist`).toBeGreaterThanOrEqual(0);+ const nextStep = workflow.indexOf("\n - name:", stepStart + 1);+ const step = workflow.slice(stepStart, nextStep < 0 ? undefined : nextStep);+ const buildIndex = step.indexOf("npm run prepack");+ const stripIndex = step.indexOf("npm pkg delete devDependencies");+ const packIndex = step.indexOf("npm pack --ignore-scripts --pack-destination");++ expect(buildIndex, `${stepName} should build before sanitizing`).toBeGreaterThanOrEqual(0);+ expect(stripIndex, `${stepName} should strip devDependencies`).toBeGreaterThan(buildIndex);+ expect(packIndex, `${stepName} should pack without rerunning scripts`).toBeGreaterThan(+ stripIndex,+ );+ }+ });+it("ships and registers the canonical Experience skill", () => {const pluginManifest = readJson("openclaw.plugin.json");const installManifest = readJson("install-manifest.json");