Skip to content

fix(skills): detect built-in skills from all npm install layouts#11

Merged
taoyizhi68 merged 1 commit into
mainfrom
fix/builtin-skills-path
May 19, 2026
Merged

fix(skills): detect built-in skills from all npm install layouts#11
taoyizhi68 merged 1 commit into
mainfrom
fix/builtin-skills-path

Conversation

@taoyizhi68
Copy link
Copy Markdown
Contributor

Problem

Settings → Skill Management showed Built-in Skills (0) — "No built-in skills detected" even though the gateway was happily loading all 52 skills and chats worked fine.

Root cause: the skills:list IPC handler in desktop/src/main.ts and getSkillSourceDirs() in desktop/src/skill-integrity.ts hard-coded the built-in skills directory to only two paths — the legacy deployer layout under ~/.openclaw-node/:

~/.openclaw-node/node_modules/openclaw/skills
~/.openclaw-node/lib/node_modules/openclaw/skills

Per the updated install flow described in CLAUDE.md, the deployer now installs Node.js via the official MSI to %ProgramFiles%\nodejs\ (or reuses a system Node ≥22.16), and openclaw is installed via npm i -g, which lands the package in:

  • %AppData%\npm\node_modules\openclaw\skills (per-user npm prefix — default on Windows)
  • %ProgramFiles%\nodejs\node_modules\openclaw\skills (per-machine)
  • %LocalAppData%\Programs\nodejs\node_modules\openclaw\skills (per-user Node)

None of these were probed by the UI's skill-listing code, so the panel rendered empty.

Notably resolveOpenClawEntry() in path-resolver.ts already handled the %AppData%\npm layout — which is why the gateway found openclaw.mjs and ran normally; only the UI list was blind.

Fix

Add a shared resolveBuiltinSkillsDir() helper in desktop/src/path-resolver.ts that mirrors the candidate list used by resolveOpenClawEntry():

  1. Packaged app resources (process.resourcesPath/openclaw/skills)
  2. ~/.openclaw-node/node_modules/openclaw/skills (classic deployer)
  3. ~/.openclaw-node/lib/node_modules/openclaw/skills (lib deployer)
  4. %AppData%/npm/node_modules/openclaw/skills (per-user npm global)
  5. %ProgramFiles%/nodejs/node_modules/openclaw/skills (per-machine Node)
  6. %LocalAppData%/Programs/nodejs/node_modules/openclaw/skills (per-user Node)

Returns the first existing path, falling back to candidate #2 (legacy layout) so log messages stay informative when nothing is installed yet.

Both call sites — skills:list in main.ts and getSkillSourceDirs() in skill-integrity.ts — now route through this helper.

Verification

  • All 32 tests in path-resolver.test.ts + skill-integrity.test.ts pass.
  • Updated skill-integrity.test.ts to also mock resolveBuiltinSkillsDir.
  • Local run with npm run dev confirms the file-watcher picks up the right directory:
    Watching skill directory: C:\Users\<user>\AppData\Roaming\npm\node_modules\openclaw\skills
    
  • Settings → Skill Management now lists all 52 built-in skills instead of "No built-in skills detected".

Files changed

  • desktop/src/path-resolver.ts — new resolveBuiltinSkillsDir()
  • desktop/src/main.tsskills:list uses the helper
  • desktop/src/skill-integrity.tsgetSkillSourceDirs() uses the helper
  • desktop/src/skill-integrity.test.ts — mock updated

The skills:list IPC handler and skill-integrity.getSkillSourceDirs() only probed ~/.openclaw-node/{,lib/}node_modules/openclaw/skills, the legacy deployer layout. When the installer reuses a system Node.js and runs
pm i -g openclaw, the package lands under %AppData%/npm/node_modules/openclaw (or %ProgramFiles%/nodejs/... for per-machine installs), so the Settings -> Skill Management panel showed Built-in Skills (0) even though resolveOpenClawEntry() found the package and the gateway loaded all 52 skills correctly.

Add resolveBuiltinSkillsDir() in path-resolver.ts that mirrors the candidate list used by resolveOpenClawEntry() (packaged resources, ~/.openclaw-node classic+lib, %AppData%/npm, %ProgramFiles%/nodejs, %LocalAppData%/Programs/nodejs) and route both call sites through it. Tests updated to mock the new helper.
@taoyizhi68 taoyizhi68 merged commit b9024a0 into main May 19, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant