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

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Forbes - Security
Forbes - Security
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
W
WeLiveSecurity
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News and Events Feed by Topic
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
PCI Perspectives
PCI Perspectives
Martin Fowler
Martin Fowler
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
WordPress大学
WordPress大学
S
Security Affairs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
P
Privacy International News Feed
IT之家
IT之家
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY
Hacker News: Ask HN
Hacker News: Ask HN
D
DataBreaches.Net
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Check Point Blog
美团技术团队
Security Latest
Security Latest
Cyberwarzone
Cyberwarzone
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
H
Help Net Security
宝玉的分享
宝玉的分享
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
The Cloudflare Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
爱范儿
爱范儿
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AI
AI
I
InfoQ
N
News | PayPal Newsroom
TaoSecurity Blog
TaoSecurity 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 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
fix(test): avoid walking plugin sdk package guardrails · openclaw/openclaw@f1c8570
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -1,7 +1,8 @@

1-

import { existsSync, readdirSync, readFileSync } from "node:fs";

1+

import { spawnSync } from "node:child_process";

2+

import fs from "node:fs";

23

import { dirname, join, relative, resolve } from "node:path";

34

import { fileURLToPath } from "node:url";

4-

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

5+

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

56

import {

67

deprecatedBarrelPluginSdkEntrypoints,

78

deprecatedPublicPluginSdkEntrypoints,

@@ -55,9 +56,57 @@ const MATRIX_RUNTIME_DEPS = [

5556

"matrix-js-sdk",

5657

"music-metadata",

5758

] as const;

59+

const trackedFilesByRoot = new Map<string, readonly string[] | null>();

60+61+

function toRepoRelativePath(filePath: string): string {

62+

return relative(REPO_ROOT, filePath).replaceAll("\\", "/");

63+

}

64+65+

function isSkippedTrackedPath(repoRelativePath: string): boolean {

66+

return repoRelativePath

67+

.split("/")

68+

.some((part) => part === "dist" || part === "node_modules" || part === ".git");

69+

}

70+71+

function isCodeFile(filePath: string): boolean {

72+

return /\.(?:[cm]?ts|tsx|mts|cts)$/.test(filePath);

73+

}

74+75+

function listTrackedFiles(root: string): string[] | null {

76+

const relativeRoot = toRepoRelativePath(root);

77+

if (!relativeRoot || relativeRoot.startsWith("..")) {

78+

return null;

79+

}

80+

if (trackedFilesByRoot.has(relativeRoot)) {

81+

const files = trackedFilesByRoot.get(relativeRoot);

82+

return files ? [...files] : null;

83+

}

84+

const result = spawnSync("git", ["ls-files", "--", relativeRoot], {

85+

cwd: REPO_ROOT,

86+

encoding: "utf8",

87+

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

88+

});

89+

if (result.status !== 0) {

90+

trackedFilesByRoot.set(relativeRoot, null);

91+

return null;

92+

}

93+

const files = result.stdout

94+

.split("\n")

95+

.map((line) => line.trim().replaceAll("\\", "/"))

96+

.filter((line) => line.length > 0 && !isSkippedTrackedPath(line))

97+

.map((line) => resolve(REPO_ROOT, line))

98+

.toSorted();

99+

trackedFilesByRoot.set(relativeRoot, files);

100+

return [...files];

101+

}

102+103+

function listTrackedCodeFiles(root: string): string[] | null {

104+

const files = listTrackedFiles(root);

105+

return files?.filter(isCodeFile) ?? null;

106+

}

5810759108

function collectPluginSdkPackageExports(): string[] {

60-

const packageJson = JSON.parse(readFileSync(resolve(REPO_ROOT, "package.json"), "utf8")) as {

109+

const packageJson = JSON.parse(fs.readFileSync(resolve(REPO_ROOT, "package.json"), "utf8")) as {

61110

exports?: Record<string, unknown>;

62111

};

63112

const exports = packageJson.exports ?? {};

@@ -78,7 +127,7 @@ function collectPluginSdkPackageExports(): string[] {

78127

function collectPluginSdkSubpathReferences() {

79128

const references: Array<{ file: string; subpath: string }> = [];

80129

for (const file of PUBLIC_CONTRACT_REFERENCE_FILES) {

81-

const source = readFileSync(resolve(REPO_ROOT, file), "utf8");

130+

const source = fs.readFileSync(resolve(REPO_ROOT, file), "utf8");

82131

for (const match of source.matchAll(PLUGIN_SDK_SUBPATH_PATTERN)) {

83132

const subpath = match[1];

84133

if (!subpath) {

@@ -91,7 +140,7 @@ function collectPluginSdkSubpathReferences() {

91140

}

9214193142

function collectDocumentedSdkSubpaths(): Set<string> {

94-

const source = readFileSync(resolve(REPO_ROOT, SDK_SUBPATH_DOC_FILE), "utf8");

143+

const source = fs.readFileSync(resolve(REPO_ROOT, SDK_SUBPATH_DOC_FILE), "utf8");

95144

return new Set(

96145

[...source.matchAll(/`plugin-sdk\/([a-z0-9][a-z0-9-]*)`/g)]

97146

.map((match) => match[1])

@@ -100,7 +149,20 @@ function collectDocumentedSdkSubpaths(): Set<string> {

100149

}

101150102151

function collectBundledPluginIds(): string[] {

103-

return readdirSync(resolve(REPO_ROOT, "extensions"), { withFileTypes: true })

152+

const trackedFiles = listTrackedFiles(resolve(REPO_ROOT, "extensions"));

153+

if (trackedFiles) {

154+

return [

155+

...new Set(

156+

trackedFiles

157+

.map((file) => toRepoRelativePath(file).split("/"))

158+

.filter((parts) => parts.length > 2)

159+

.map((parts) => parts[1])

160+

.filter((pluginId): pluginId is string => Boolean(pluginId)),

161+

),

162+

].toSorted((a, b) => b.length - a.length || a.localeCompare(b));

163+

}

164+

return fs

165+

.readdirSync(resolve(REPO_ROOT, "extensions"), { withFileTypes: true })

104166

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

105167

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

106168

.toSorted((a, b) => b.length - a.length || a.localeCompare(b));

@@ -142,7 +204,7 @@ function collectBundledFacadeSdkEntrypoints(): string[] {

142204

const entrypoints: string[] = [];

143205

for (const entrypoint of pluginSdkEntrypoints) {

144206

const filePath = resolve(REPO_ROOT, "src/plugin-sdk", `${entrypoint}.ts`);

145-

const source = readFileSync(filePath, "utf8");

207+

const source = fs.readFileSync(filePath, "utf8");

146208

if (BUNDLED_PLUGIN_FACADE_LOADER_PATTERN.test(source)) {

147209

entrypoints.push(entrypoint);

148210

}

@@ -154,7 +216,7 @@ function collectPrivateBundledSdkSurfaceEntrypoints(): string[] {

154216

const entrypoints: string[] = [];

155217

for (const entrypoint of pluginSdkEntrypoints) {

156218

const filePath = resolve(REPO_ROOT, "src/plugin-sdk", `${entrypoint}.ts`);

157-

const source = readFileSync(filePath, "utf8");

219+

const source = fs.readFileSync(filePath, "utf8");

158220

if (PRIVATE_BUNDLED_SDK_SURFACE_PATTERN.test(source)) {

159221

entrypoints.push(entrypoint);

160222

}

@@ -165,7 +227,7 @@ function collectPrivateBundledSdkSurfaceEntrypoints(): string[] {

165227

function collectGenericCoreOwnerNameLeaks(): Array<{ file: string; match: string }> {

166228

const leaks: Array<{ file: string; match: string }> = [];

167229

for (const file of GENERIC_CORE_HELPER_FILES) {

168-

const source = readFileSync(resolve(REPO_ROOT, file), "utf8");

230+

const source = fs.readFileSync(resolve(REPO_ROOT, file), "utf8");

169231

for (const match of source.matchAll(GENERIC_CORE_PLUGIN_OWNER_NAME_PATTERN)) {

170232

const ownerName = match[0];

171233

if (!ownerName) {

@@ -182,7 +244,7 @@ function readRootPackageJson(): {

182244

optionalDependencies?: Record<string, string>;

183245

files?: string[];

184246

} {

185-

return JSON.parse(readFileSync(resolve(REPO_ROOT, "package.json"), "utf8")) as {

247+

return JSON.parse(fs.readFileSync(resolve(REPO_ROOT, "package.json"), "utf8")) as {

186248

dependencies?: Record<string, string>;

187249

optionalDependencies?: Record<string, string>;

188250

files?: string[];

@@ -193,7 +255,9 @@ function readMatrixPackageJson(): {

193255

dependencies?: Record<string, string>;

194256

optionalDependencies?: Record<string, string>;

195257

} {

196-

return JSON.parse(readFileSync(resolve(REPO_ROOT, "extensions/matrix/package.json"), "utf8")) as {

258+

return JSON.parse(

259+

fs.readFileSync(resolve(REPO_ROOT, "extensions/matrix/package.json"), "utf8"),

260+

) as {

197261

dependencies?: Record<string, string>;

198262

optionalDependencies?: Record<string, string>;

199263

};

@@ -210,7 +274,12 @@ function collectRuntimeDependencySpecs(packageJson: {

210274

}

211275212276

function collectExtensionFiles(dir: string): string[] {

213-

const entries = readdirSync(dir, { withFileTypes: true });

277+

const trackedFiles = listTrackedCodeFiles(dir);

278+

if (trackedFiles) {

279+

return trackedFiles;

280+

}

281+282+

const entries = fs.readdirSync(dir, { withFileTypes: true });

214283

const files: string[] = [];

215284

for (const entry of entries) {

216285

if (entry.name === "dist" || entry.name === "node_modules") {

@@ -252,7 +321,7 @@ function collectExtensionCoreImportLeaks(): Array<{ file: string; specifier: str

252321

}

253322

const extensionRootMatch = /^(.*?\/extensions\/[^/]+)/.exec(file.replaceAll("\\", "/"));

254323

const extensionRoot = extensionRootMatch?.[1];

255-

const source = readFileSync(file, "utf8");

324+

const source = fs.readFileSync(file, "utf8");

256325

for (const match of source.matchAll(importPattern)) {

257326

const specifier = match[1];

258327

if (!specifier) {

@@ -283,7 +352,7 @@ function collectExtensionTestHelperImportLeaks(): Array<{ file: string; specifie

283352

if (isExtensionTestOrSupportPath(repoRelativePath)) {

284353

continue;

285354

}

286-

const source = readFileSync(file, "utf8");

355+

const source = fs.readFileSync(file, "utf8");

287356

for (const importPattern of importPatterns) {

288357

for (const match of source.matchAll(importPattern)) {

289358

const specifier = match[1];

@@ -309,7 +378,7 @@ function collectDeprecatedExtensionSdkImports(): Array<{ file: string; specifier

309378

];

310379

for (const file of collectExtensionFiles(resolve(REPO_ROOT, "extensions"))) {

311380

const repoRelativePath = relative(REPO_ROOT, file).replaceAll("\\", "/");

312-

const source = readFileSync(file, "utf8");

381+

const source = fs.readFileSync(file, "utf8");

313382

for (const importPattern of importPatterns) {

314383

for (const match of source.matchAll(importPattern)) {

315384

const specifier = match[1];

@@ -327,8 +396,13 @@ function collectDeprecatedExtensionSdkImports(): Array<{ file: string; specifier

327396

}

328397329398

function collectCodeFiles(dir: string): string[] {

399+

const trackedFiles = listTrackedCodeFiles(dir);

400+

if (trackedFiles) {

401+

return trackedFiles;

402+

}

403+330404

const files: string[] = [];

331-

for (const entry of readdirSync(dir, { withFileTypes: true })) {

405+

for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {

332406

if (entry.name === "dist" || entry.name === "node_modules" || entry.name === ".git") {

333407

continue;

334408

}

@@ -358,7 +432,7 @@ function collectDeprecatedTestBarrelImports(): Array<{ file: string; specifier:

358432

if (DEPRECATED_TEST_BARREL_ALLOWED_REFERENCE_FILES.has(repoRelativePath)) {

359433

continue;

360434

}

361-

const source = readFileSync(file, "utf8");

435+

const source = fs.readFileSync(file, "utf8");

362436

for (const importPattern of importPatterns) {

363437

for (const match of source.matchAll(importPattern)) {

364438

const specifier = match[1];

@@ -377,7 +451,7 @@ function collectDeprecatedTestBarrelImports(): Array<{ file: string; specifier:

377451

}

378452379453

function collectDeprecatedPackageTestingBridgeDrift(): string[] {

380-

const source = readFileSync(

454+

const source = fs.readFileSync(

381455

resolve(REPO_ROOT, "packages/plugin-sdk/src/testing.ts"),

382456

"utf8",

383457

).trim();

@@ -422,7 +496,7 @@ function collectWorkspaceCodeFiles(): string[] {

422496

const files: string[] = [];

423497

for (const root of ["src", "test", "extensions", "packages", "scripts"]) {

424498

const dir = resolve(REPO_ROOT, root);

425-

if (existsSync(dir)) {

499+

if (fs.existsSync(dir)) {

426500

files.push(...collectCodeFiles(dir));

427501

}

428502

}

@@ -443,7 +517,7 @@ function collectUnusedExtensionTestApiExports(): Array<{ file: string; exportNam

443517

const exportNames = new Set<string>();

444518445519

for (const file of testApiFiles) {

446-

const source = readFileSync(file, "utf8");

520+

const source = fs.readFileSync(file, "utf8");

447521

const namedExports = parseTestApiNamedExports(source);

448522

testApiExports.set(file, namedExports);

449523

for (const exportName of namedExports) {

@@ -463,7 +537,7 @@ function collectUnusedExtensionTestApiExports(): Array<{ file: string; exportNam

463537

const selfReferenceCounts = new Map<string, Map<string, number>>();

464538465539

for (const file of workspaceCodeFiles) {

466-

const source = readFileSync(file, "utf8");

540+

const source = fs.readFileSync(file, "utf8");

467541

const selfCounts = testApiExports.has(file) ? new Map<string, number>() : undefined;

468542

for (const match of source.matchAll(identifierPattern)) {

469543

const exportName = match[1];

@@ -510,7 +584,7 @@ function collectCrossOwnerReservedSdkImports(): Array<{

510584

for (const file of collectExtensionFiles(resolve(REPO_ROOT, "extensions"))) {

511585

const repoRelativePath = relative(REPO_ROOT, file).replaceAll("\\", "/");

512586

const pluginId = repoRelativePath.split("/")[1];

513-

const source = readFileSync(file, "utf8");

587+

const source = fs.readFileSync(file, "utf8");

514588

for (const match of source.matchAll(importPattern)) {

515589

const subpath = match[1];

516590

if (!subpath || !reserved.has(subpath)) {

@@ -541,7 +615,7 @@ function collectReservedSdkSubpathImports(): string[] {

541615542616

for (const root of ["src", "test", "extensions", "packages", "scripts"]) {

543617

for (const file of collectCodeFiles(resolve(REPO_ROOT, root))) {

544-

const source = readFileSync(file, "utf8");

618+

const source = fs.readFileSync(file, "utf8");

545619

for (const importPattern of importPatterns) {

546620

for (const match of source.matchAll(importPattern)) {

547621

const subpath = match[1];

@@ -557,7 +631,7 @@ function collectReservedSdkSubpathImports(): string[] {

557631

}

558632559633

function hasWildcardReexport(entrypoint: string): boolean {

560-

const source = readFileSync(resolve(REPO_ROOT, "src/plugin-sdk", `${entrypoint}.ts`), "utf8");

634+

const source = fs.readFileSync(resolve(REPO_ROOT, "src/plugin-sdk", `${entrypoint}.ts`), "utf8");

561635

return /^\s*export\s+(?:type\s+)?\*\s+from\s+["'][^"']+["']/mu.test(source);

562636

}

563637

@@ -574,7 +648,7 @@ function collectExtensionProductionSdkSubpathImports(subpaths: ReadonlySet<strin

574648

if (isExtensionTestOrSupportPath(repoRelativePath)) {

575649

continue;

576650

}

577-

const source = readFileSync(file, "utf8");

651+

const source = fs.readFileSync(file, "utf8");

578652

for (const importPattern of importPatterns) {

579653

for (const match of source.matchAll(importPattern)) {

580654

const subpath = match[1];

@@ -589,6 +663,22 @@ function collectExtensionProductionSdkSubpathImports(subpaths: ReadonlySet<strin

589663

}

590664591665

describe("plugin-sdk package contract guardrails", () => {

666+

it("lists package guardrail scan inputs from git without walking roots", () => {

667+

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

668+

try {

669+

const pluginIds = collectBundledPluginIds();

670+

const extensionFiles = collectExtensionFiles(resolve(REPO_ROOT, "extensions"));

671+

const workspaceFiles = collectWorkspaceCodeFiles();

672+673+

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

674+

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

675+

expect(workspaceFiles.length).toBeGreaterThan(extensionFiles.length);

676+

expect(readDir).not.toHaveBeenCalled();

677+

} finally {

678+

readDir.mockRestore();

679+

}

680+

});

681+592682

it("keeps plugin-sdk entrypoint metadata unique", () => {

593683

const counts = new Map<string, number>();

594684

for (const entrypoint of pluginSdkEntrypoints) {