Skip to content

feat(openclaw): add docs download tools + fix cross-platform prepare script#854

Open
MoonIRL wants to merge 3 commits intojackwener:mainfrom
MoonIRL:main
Open

feat(openclaw): add docs download tools + fix cross-platform prepare script#854
MoonIRL wants to merge 3 commits intojackwener:mainfrom
MoonIRL:main

Conversation

@MoonIRL
Copy link
Copy Markdown

@MoonIRL MoonIRL commented Apr 7, 2026

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:

  • list (opencli openclaw list): Fetch documentation category list from docs.openclaw.ai
  • read (opencli openclaw read --path /guide/intro): Download a single documentation page as markdown
  • all (opencli openclaw all): Batch download all documentation pages
  • tool: Shared utilities for language detection and URL building

Supports multi-language: English, 简体中文

Bug Fix: Cross-platform Prepare Script

The original prepare script used bash syntax which doesn't work on Windows cmd/PowerShell. Replaced with scripts/prepare.cjs - a pure Node.js implementation that works on Linux, macOS, and Windows.

Type of Change

  • ✨ New feature
  • 🔧 CI / build / tooling

Testing

  • npm run prepare works on Windows, Linux, and macOS
  • OpenCLAW downloader tested with opencli openclaw list --lang zh-CN

MoonIRL added 2 commits April 7, 2026 15:08
- 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
@MoonIRL
Copy link
Copy Markdown
Author

MoonIRL commented Apr 7, 2026

opencli openclaw list

openclaw/list
┌─────────────────┬────────────────────────┐
│ Title │ Path │
├─────────────────┼────────────────────────┤
│ Get started │ / │
├─────────────────┼────────────────────────┤
│ Install │ /install │
├─────────────────┼────────────────────────┤
│ Channels │ /channels │
├─────────────────┼────────────────────────┤
│ Agents │ /concepts/architecture │
├─────────────────┼────────────────────────┤
│ Tools & Plugins │ /tools │
├─────────────────┼────────────────────────┤
│ Models │ /providers │
├─────────────────┼────────────────────────┤
│ Platforms │ /platforms │
├─────────────────┼────────────────────────┤
│ Gateway & Ops │ /gateway │
├─────────────────┼────────────────────────┤
│ Reference │ /cli │
├─────────────────┼────────────────────────┤
│ Help │ /help │
└─────────────────┴────────────────────────┘
10 items · 13.4s · openclaw/list

opencli openclaw read --path "/"

openclaw/read
┌─────────────────────┬───────────────────────────┬───────┐
│ Title │ Url │ Size │
├─────────────────────┼───────────────────────────┼───────┤
│ OpenClaw - OpenClaw │ https://docs.openclaw.ai/ │ 60047 │
└─────────────────────┴───────────────────────────┴───────┘
1 items · 2.2s · openclaw/read

Install

## Recommended: installer script

The fastest way to install. It detects your OS, installs Node if needed, installs OpenClaw, and launches onboarding.

-   macOS / Linux / WSL2

-   Windows (PowerShell)

curl -fsSL https://openclaw.ai/install.sh | bash


iwr -useb https://openclaw.ai/install.ps1 | iex


To install without running onboarding:

-   macOS / Linux / WSL2

-   Windows (PowerShell)


curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard


& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard


For all flags and CI/automation options, see [Installer internals](/install/installer).

## System requirements

-   **Node 24** (recommended) or Node 22.14+ — the installer script handles this automatically
-   **macOS, Linux, or Windows** — both native Windows and WSL2 are supported; WSL2 is more stable. See [Windows](/platforms/windows).
-   `pnpm` is only needed if you build from source

## Alternative install methods

###


Local prefix installer (`install-cli.sh`)

Use this when you want OpenClaw and Node kept under a local prefix such as `~/.openclaw`, without depending on a system-wide Node install:

curl -fsSL https://openclaw.ai/install-cli.sh | bash


It supports npm installs by default, plus git-checkout installs under the same prefix flow. Full reference: [Installer internals](/install/installer#install-clish).

###


npm, pnpm, or bun

If you already manage Node yourself:

-   npm

-   pnpm

-   bun


npm install -g openclaw@latest
openclaw onboard --install-daemon


pnpm add -g openclaw@latest
pnpm approve-builds -g
openclaw onboard --install-daemon


pnpm requires explicit approval for packages with build scripts. Run `pnpm approve-builds -g` after the first install.

bun add -g openclaw@latest
openclaw onboard --install-daemon


Bun is supported for the global CLI install path. For the Gateway runtime, Node remains the recommended daemon runtime.

Troubleshooting: sharp build errors (npm)

If `sharp` fails due to a globally installed libvips:

SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest


###


From source

For contributors or anyone who wants to run from a local checkout:

git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install && pnpm ui:build && pnpm build
pnpm link --global
openclaw onboard --install-daemon


Or skip the link and use `pnpm openclaw ...` from inside the repo. See [Setup](/start/setup) for full development workflows.

###


Install from GitHub main

npm install -g github:openclaw/openclaw#main


###


Containers and package managers

## Verify the install

openclaw --version # confirm the CLI is available
openclaw doctor # check for config issues
openclaw gateway status # verify the Gateway is running


If you want managed startup after install:

-   macOS: LaunchAgent via `openclaw onboard --install-daemon` or `openclaw gateway install`
-   Linux/WSL2: systemd user service via the same commands
-   Native Windows: Scheduled Task first, with a per-user Startup-folder login item fallback if task creation is denied

## Hosting and deployment

Deploy OpenClaw on a cloud server or VPS:

## Update, migrate, or uninstall

## Troubleshooting: `openclaw` not found

If the install succeeded but `openclaw` is not found in your terminal:

node -v # Node installed?
npm prefix -g # Where are global packages?
echo "$PATH" # Is the global bin dir in PATH?


If `$(npm prefix -g)/bin` is not in your `$PATH`, add it to your shell startup file (`~/.zshrc` or `~/.bashrc`):

export PATH="$(npm prefix -g)/bin:$PATH"


Then open a new terminal. See [Node setup](/install/node) for more details.

> 原文链接: https://docs.openclaw.ai/install

Copy link
Copy Markdown
Contributor

@Astro-Han Astro-Han left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 prepare fix
  • the new openclaw adapter

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 prepare fix looks fine on its own
  • the openclaw adapter still needs some tightening, both in behavior and in how it is scoped/described

@MoonIRL MoonIRL marked this pull request as draft April 7, 2026 08:45
@MoonIRL
Copy link
Copy Markdown
Author

MoonIRL commented Apr 7, 2026

opencli openclaw all --output ./test-openclaw

openclaw/all
┌─────────────────┬────────────────────────┬─────────┐
│ Title │ Path │ Status │
├─────────────────┼────────────────────────┼─────────┤
│ Get started │ / │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Install │ /install │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Channels │ /channels │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Agents │ /concepts/architecture │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Tools & Plugins │ /tools │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Models │ /providers │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Platforms │ /platforms │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Gateway & Ops │ /gateway │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Reference │ /cli │ success │
├─────────────────┼────────────────────────┼─────────┤
│ Help │ /help │ success │
└─────────────────┴────────────────────────┴─────────┘
10 items · 100.8s · openclaw/all

image

@MoonIRL MoonIRL marked this pull request as ready for review April 7, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants