feat(openclaw): add docs download tools + fix cross-platform prepare script#854
feat(openclaw): add docs download tools + fix cross-platform prepare script#854MoonIRL wants to merge 3 commits intojackwener:mainfrom
Conversation
- replace shell-based prepare script with Node.js script - ensures build works on Linux, macOS, and Windows
- list: fetch documentation category list - read: download single doc page as markdown - all: batch download all docs - tool: language and URL utilities Note: downloaded markdown format may have some issues but is usable
|
opencli openclaw list openclaw/list
|
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for putting this together. The Windows prepare fix makes sense to me, but I got confused by the openclaw part of the PR and wanted to flag a couple things.
First, opencli openclaw all does not seem to download all docs right now. From the code, it looks like it only walks the top-level links returned by extractCategories(), so it fetches the section landing pages, not the full docs tree. That makes the command name and the PR description feel a bit stronger than the current behavior.
Second, I think the post-processing step may be missing the file it wants to edit. downloadArticle() writes the markdown file with the shared sanitizeFilename() helper, but this adapter builds the postProcessFile() path with a different safeTitle() helper. For titles with spaces or punctuation, those can produce different paths, so the cleanup step may quietly do nothing.
I also think this PR would be easier to review if the two changes were split:
- the cross-platform
preparefix - the new
openclawadapter
Those are both reasonable things to discuss, but they are separate enough that bundling them made the intent harder to follow.
I may be missing some context here, but my current read is:
- the
preparefix looks fine on its own - the
openclawadapter still needs some tightening, both in behavior and in how it is scoped/described

Description
This PR adds documentation download tools for OpenCLI and fixes the prepare script for cross-platform compatibility.
New Feature: OpenCLAW Documentation Downloader
Added
clis/openclaw/directory with four modules to download OpenCLI docs as Markdown:opencli openclaw list): Fetch documentation category list from docs.openclaw.aiopencli openclaw read --path /guide/intro): Download a single documentation page as markdownopencli openclaw all): Batch download all documentation pagesSupports multi-language: English, 简体中文
Bug Fix: Cross-platform Prepare Script
The original
preparescript used bash syntax which doesn't work on Windows cmd/PowerShell. Replaced withscripts/prepare.cjs- a pure Node.js implementation that works on Linux, macOS, and Windows.Type of Change
Testing
npm run prepareworks on Windows, Linux, and macOSopencli openclaw list --lang zh-CN