惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
IT之家
IT之家
Y
Y Combinator Blog
T
Tailwind CSS Blog
B
Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
InfoQ
J
Java Code Geeks
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Hackread – Cybersecurity News, Data Breaches, AI and More
人人都是产品经理
人人都是产品经理
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(test): avoid scanning bundled plugin metadata · openc...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -1,6 +1,7 @@

1+

import { spawnSync } from "node:child_process";

12

import fs from "node:fs";

23

import path from "node:path";

3-

import { describe, expect, it } from "vitest";

4+

import { describe, expect, it, vi } from "vitest";

45

import { collectBundledChannelConfigs } from "./bundled-channel-config-metadata.js";

56

import {

67

type BundledPluginMetadata,

@@ -130,14 +131,86 @@ function listRepoBundledPluginMetadata(): readonly BundledPluginMetadata[] {

130131

}

131132132133

function listRepoBundledPluginManifestsUncached() {

134+

const bundledPluginsDir = path.join(repoRoot, "extensions");

135+

return listRepoBundledPluginManifestDirs()

136+

.flatMap((dirName) => {

137+

const result = loadPluginManifest(path.join(bundledPluginsDir, dirName), false);

138+

return result.ok ? [{ dirName, manifest: result.manifest }] : [];

139+

});

140+

}

141+142+

function listRepoBundledPluginManifestDirs(): string[] {

143+

const externalDirs = listExternalRepoBundledPluginManifestDirs();

144+

if (externalDirs) {

145+

return externalDirs;

146+

}

133147

const bundledPluginsDir = path.join(repoRoot, "extensions");

134148

return fs

135149

.readdirSync(bundledPluginsDir, { withFileTypes: true })

136150

.filter((entry) => entry.isDirectory())

137-

.flatMap((entry) => {

138-

const result = loadPluginManifest(path.join(bundledPluginsDir, entry.name), false);

139-

return result.ok ? [{ dirName: entry.name, manifest: result.manifest }] : [];

140-

});

151+

.map((entry) => entry.name)

152+

.toSorted();

153+

}

154+155+

function listExternalRepoBundledPluginManifestDirs(): string[] | null {

156+

const manifestFiles =

157+

listGitRepoBundledPluginManifestFiles() ?? listFindRepoBundledPluginManifestFiles();

158+

if (!manifestFiles) {

159+

return null;

160+

}

161+

return manifestFiles

162+

.flatMap((file) => {

163+

const match = /^extensions\/([^/]+)\/openclaw\.plugin\.json$/u.exec(file);

164+

return match?.[1] ? [match[1]] : [];

165+

})

166+

.toSorted();

167+

}

168+169+

function listGitRepoBundledPluginManifestFiles(): string[] | null {

170+

const result = spawnSync("git", ["ls-files", "--", "extensions/*/openclaw.plugin.json"], {

171+

cwd: repoRoot,

172+

encoding: "utf8",

173+

maxBuffer: 1024 * 1024,

174+

stdio: ["ignore", "pipe", "ignore"],

175+

});

176+

if (result.status !== 0) {

177+

return null;

178+

}

179+

return result.stdout

180+

.split("\n")

181+

.map((line) => line.trim())

182+

.filter((line) => line.length > 0)

183+

.toSorted();

184+

}

185+186+

function listFindRepoBundledPluginManifestFiles(): string[] | null {

187+

const result = spawnSync(

188+

"find",

189+

[

190+

path.join(repoRoot, "extensions"),

191+

"-maxdepth",

192+

"2",

193+

"-type",

194+

"f",

195+

"-name",

196+

"openclaw.plugin.json",

197+

],

198+

{

199+

cwd: repoRoot,

200+

encoding: "utf8",

201+

maxBuffer: 1024 * 1024,

202+

stdio: ["ignore", "pipe", "ignore"],

203+

},

204+

);

205+

if (result.status !== 0) {

206+

return null;

207+

}

208+

return result.stdout

209+

.split("\n")

210+

.map((line) => line.trim())

211+

.filter((line) => line.length > 0)

212+

.map((file) => path.relative(repoRoot, file).split(path.sep).join("/"))

213+

.toSorted();

141214

}

142215143216

function listRepoBundledPluginManifests() {

@@ -261,6 +334,19 @@ function createInstalledPluginIndexForManifests(

261334

}

262335263336

describe("bundled plugin metadata", () => {

337+

it("lists bundled plugin manifests without scanning extension directories in-process", () => {

338+

const readDir = vi.spyOn(fs, "readdirSync");

339+

try {

340+

const manifests = listRepoBundledPluginManifestsUncached();

341+342+

expect(manifests.length).toBeGreaterThan(0);

343+

expect(manifests.every((entry) => entry.dirName.length > 0)).toBe(true);

344+

expect(readDir).not.toHaveBeenCalled();

345+

} finally {

346+

readDir.mockRestore();

347+

}

348+

});

349+264350

it(

265351

"matches the runtime metadata snapshot",

266352

{ timeout: BUNDLED_PLUGIN_METADATA_TEST_TIMEOUT_MS },