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

推荐订阅源

Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
罗磊的独立博客
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
J
Java Code Geeks
L
LangChain Blog
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers 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 channel docs examples · opencla...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

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

1+

import { spawnSync } from "node:child_process";

12

import fs from "node:fs";

23

import path from "node:path";

34

import JSON5 from "json5";

4-

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

5+

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

56

import { OpenClawSchema } from "../config/zod-schema.js";

6778

const CHANNEL_DOCS_DIR = path.join(process.cwd(), "docs", "channels");

@@ -10,13 +11,79 @@ function lineNumberAt(source: string, index: number): number {

1011

return source.slice(0, index).split("\n").length;

1112

}

121314+

function listChannelDocFiles(): string[] {

15+

const externalFiles = listExternalChannelDocFiles();

16+

if (externalFiles) {

17+

return externalFiles;

18+

}

19+

return fs

20+

.readdirSync(CHANNEL_DOCS_DIR)

21+

.filter((entry) => entry.endsWith(".md"))

22+

.map((fileName) => path.join(CHANNEL_DOCS_DIR, fileName))

23+

.toSorted();

24+

}

25+26+

function listExternalChannelDocFiles(): string[] | null {

27+

return listGitChannelDocFiles() ?? listFindChannelDocFiles();

28+

}

29+30+

function listGitChannelDocFiles(): string[] | null {

31+

const result = spawnSync("git", ["ls-files", "--", "docs/channels/*.md"], {

32+

cwd: process.cwd(),

33+

encoding: "utf8",

34+

maxBuffer: 1024 * 1024,

35+

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

36+

});

37+

if (result.status !== 0) {

38+

return null;

39+

}

40+

return result.stdout

41+

.split("\n")

42+

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

43+

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

44+

.map((filePath) => path.join(process.cwd(), filePath))

45+

.toSorted();

46+

}

47+48+

function listFindChannelDocFiles(): string[] | null {

49+

const result = spawnSync(

50+

"find",

51+

[CHANNEL_DOCS_DIR, "-maxdepth", "1", "-type", "f", "-name", "*.md"],

52+

{

53+

cwd: process.cwd(),

54+

encoding: "utf8",

55+

maxBuffer: 1024 * 1024,

56+

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

57+

},

58+

);

59+

if (result.status !== 0) {

60+

return null;

61+

}

62+

return result.stdout

63+

.split("\n")

64+

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

65+

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

66+

.toSorted();

67+

}

68+1369

describe("channel docs config examples", () => {

70+

it("lists channel docs without scanning the docs directory in-process", () => {

71+

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

72+

try {

73+

const files = listChannelDocFiles();

74+75+

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

76+

expect(files.every((filePath) => filePath.endsWith(".md"))).toBe(true);

77+

expect(readDir).not.toHaveBeenCalled();

78+

} finally {

79+

readDir.mockRestore();

80+

}

81+

});

82+1483

it("keeps channel docs JSON fences parseable", () => {

1584

const failures: string[] = [];

16-

for (const fileName of fs

17-

.readdirSync(CHANNEL_DOCS_DIR)

18-

.filter((entry) => entry.endsWith(".md"))) {

19-

const docPath = path.join(CHANNEL_DOCS_DIR, fileName);

85+

for (const docPath of listChannelDocFiles()) {

86+

const fileName = path.basename(docPath);

2087

const markdown = fs.readFileSync(docPath, "utf8");

2188

const blocks = markdown.matchAll(/```(?:json5|json)\n([\s\S]*?)```/g);

2289

for (const match of blocks) {

@@ -41,10 +108,8 @@ describe("channel docs config examples", () => {

4110842109

it("keeps OpenClaw channel config snippets parseable and schema-valid", () => {

43110

const failures: string[] = [];

44-

for (const fileName of fs

45-

.readdirSync(CHANNEL_DOCS_DIR)

46-

.filter((entry) => entry.endsWith(".md"))) {

47-

const docPath = path.join(CHANNEL_DOCS_DIR, fileName);

111+

for (const docPath of listChannelDocFiles()) {

112+

const fileName = path.basename(docPath);

48113

const markdown = fs.readFileSync(docPath, "utf8");

49114

const blocks = markdown.matchAll(/```(?:json5|json)\n([\s\S]*?)```/g);

50115

for (const match of blocks) {