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

推荐订阅源

D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
L
LangChain Blog
B
Blog
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
U
Unit 42
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
小众软件
小众软件
I
InfoQ
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
C
Check Point 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
ci: align docs formatter with mintlify guard · openclaw/o...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -0,0 +1,100 @@

1+

#!/usr/bin/env node

2+3+

import { execFileSync, spawnSync } from "node:child_process";

4+

import fs from "node:fs";

5+

import os from "node:os";

6+

import path from "node:path";

7+

import { repairMintlifyAccordionIndentation } from "./lib/mintlify-accordion.mjs";

8+9+

const ROOT = path.resolve(import.meta.dirname, "..");

10+

const CHECK = process.argv.includes("--check");

11+

const OXFMT_BIN = path.join(ROOT, "node_modules", "oxfmt", "bin", "oxfmt");

12+

const OXFMT_CONFIG = path.join(ROOT, ".oxfmtrc.jsonc");

13+14+

function docsFiles() {

15+

const output = execFileSync("git", ["ls-files", "docs/**/*.md", "docs/**/*.mdx", "README.md"], {

16+

cwd: ROOT,

17+

encoding: "utf8",

18+

});

19+

return output.split("\n").filter(Boolean);

20+

}

21+22+

function runOxfmt(files) {

23+

const result = spawnSync(

24+

process.execPath,

25+

[OXFMT_BIN, "--write", "--threads=1", "--config", OXFMT_CONFIG, ...files],

26+

{

27+

cwd: ROOT,

28+

encoding: "utf8",

29+

maxBuffer: 1024 * 1024 * 16,

30+

},

31+

);

32+33+

if (result.status !== 0) {

34+

const stderr = result.stderr.trim();

35+

throw new Error(`oxfmt failed${stderr ? `:\n${stderr}` : ""}`);

36+

}

37+

}

38+39+

function repairFiles(root, files) {

40+

const changed = [];

41+

for (const relativePath of files) {

42+

const absolutePath = path.join(root, relativePath);

43+

const raw = fs.readFileSync(absolutePath, "utf8");

44+

const formatted = repairMintlifyAccordionIndentation(raw);

45+

if (formatted === raw) {

46+

continue;

47+

}

48+

fs.writeFileSync(absolutePath, formatted);

49+

changed.push(relativePath);

50+

}

51+

return changed;

52+

}

53+54+

function copyDocsToTemp(files) {

55+

const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-docs-format-"));

56+

for (const relativePath of files) {

57+

const source = path.join(ROOT, relativePath);

58+

const target = path.join(tempRoot, relativePath);

59+

fs.mkdirSync(path.dirname(target), { recursive: true });

60+

fs.copyFileSync(source, target);

61+

}

62+

return tempRoot;

63+

}

64+65+

const changed = [];

66+

const files = docsFiles();

67+68+

if (CHECK) {

69+

const tempRoot = copyDocsToTemp(files);

70+

try {

71+

runOxfmt(files.map((relativePath) => path.join(tempRoot, relativePath)));

72+

repairFiles(tempRoot, files);

73+

for (const relativePath of files) {

74+

const raw = fs.readFileSync(path.join(ROOT, relativePath), "utf8");

75+

const formatted = fs.readFileSync(path.join(tempRoot, relativePath), "utf8");

76+

if (formatted !== raw) {

77+

changed.push(relativePath);

78+

}

79+

}

80+

} finally {

81+

fs.rmSync(tempRoot, { recursive: true, force: true });

82+

}

83+

} else {

84+

runOxfmt(files);

85+

changed.push(...repairFiles(ROOT, files));

86+

}

87+88+

if (CHECK && changed.length > 0) {

89+

console.error(`Format issues found in ${changed.length} docs file(s):`);

90+

for (const relativePath of changed) {

91+

console.error(`- ${relativePath}`);

92+

}

93+

process.exit(1);

94+

}

95+96+

if (changed.length > 0) {

97+

console.log(`Formatted ${changed.length} docs file(s).`);

98+

} else {

99+

console.log(`Docs formatting clean (${files.length} files).`);

100+

}