refactor: decouple skills page from gateway marketplace (#1089)

This commit is contained in:
Felix
2026-06-02 16:15:57 +08:00
committed by GitHub
parent 83317210f6
commit d27faa5a00
32 changed files with 1875 additions and 1156 deletions

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
CDP_PORT="${CDP_PORT:-9222}"
OUT_DIR="${OUT_DIR:-playground/agent-browser}"
mkdir -p "$OUT_DIR"
agent-browser connect "$CDP_PORT"
agent-browser tab > "$OUT_DIR/00-tabs.txt"
agent-browser snapshot -i > "$OUT_DIR/01-initial.snapshot.txt"
agent-browser screenshot "$OUT_DIR/01-initial.png"
agent-browser find text "技能" click || agent-browser find text "Skills" click || true
agent-browser wait 1000
agent-browser snapshot -i > "$OUT_DIR/02-skills.snapshot.txt"
agent-browser screenshot "$OUT_DIR/02-skills.png"

View File

@@ -23,6 +23,7 @@ import { patchExtensionOpenClawSelfImports } from './openclaw-self-import-patch.
const ROOT = path.resolve(__dirname, '..');
const OUTPUT = path.join(ROOT, 'build', 'openclaw');
const NODE_MODULES = path.join(ROOT, 'node_modules');
const BUNDLED_OPENCLAW_SKILL_ALLOWLIST = new Set(['skill-creator']);
// On Windows, pnpm virtual store paths can exceed MAX_PATH (260 chars).
function normWin(p) {
@@ -57,6 +58,23 @@ function shouldCopyOpenClawPackageEntry(src) {
return true;
}
function trimBundledOpenClawSkills(skillsRoot) {
if (!fs.existsSync(skillsRoot)) return { removed: 0, kept: [...BUNDLED_OPENCLAW_SKILL_ALLOWLIST] };
let removed = 0;
for (const entry of fs.readdirSync(skillsRoot, { withFileTypes: true })) {
if (!entry.isDirectory()) continue;
if (BUNDLED_OPENCLAW_SKILL_ALLOWLIST.has(entry.name)) continue;
const skillDir = path.join(skillsRoot, entry.name);
if (!fs.existsSync(path.join(skillDir, 'SKILL.md'))) continue;
fs.rmSync(skillDir, { recursive: true, force: true });
removed += 1;
}
return { removed, kept: [...BUNDLED_OPENCLAW_SKILL_ALLOWLIST] };
}
function removeDirRobust(targetDir) {
if (!fs.existsSync(targetDir)) return;
@@ -97,6 +115,11 @@ fs.cpSync(openclawReal, OUTPUT, {
filter: shouldCopyOpenClawPackageEntry,
});
const bundledSkillsTrim = trimBundledOpenClawSkills(path.join(OUTPUT, 'skills'));
if (bundledSkillsTrim.removed > 0) {
echo` Trimmed bundled OpenClaw skills: removed ${bundledSkillsTrim.removed}, kept ${bundledSkillsTrim.kept.join(', ')}`;
}
// 4. Recursively collect ALL transitive dependencies via pnpm virtual store BFS
//
// pnpm structure example: