Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:3641397194 wq Gpt6 Astra build readme

From Leeroopedia
Knowledge Sources
Domains Documentation, Release_Management
Last Updated 2026-10-26 14:00 GMT

Overview

Concrete tool for rendering two GitHub-style preview HTML pages from README.md — a local preview and a published index — while validating download links against VERSION and package.json, provided by the ColdBrew Zero tools package.

Description

The build_readme script reads `README.md`, validates that its installer download links exactly match the release version in `VERSION` and the `artifactName` templates in `desktop/package.json` across all 7 platform/arch/ext installer combinations, then renders two HTML pages:

  • docs/readme-preview.html: local preview with `/docs/` path rebasing and a "打开软件交互预览" link.
  • docs/index.html: published version with in-page anchors and a "启动软件" link.

Both pages are styled with an embedded CSS that mimics GitHub's repository page layout (appbar, repo tabs, readme article, about sidebar). The README source file is never modified. The script supports a `--check` mode that validates freshness without writing, raising an error if the generated pages are stale.

Usage

  • Regenerate previews: run `python3 tools/build_readme.py` after editing README.md to refresh both HTML pages.
  • CI freshness check: run `python3 tools/build_readme.py --check` to fail if generated pages are out of sync with README.md or VERSION.
  • Fixture-based testing: pass `--root /path/to/fixture` to render from an isolated fixture directory.

Code Reference

Source Location

Signature

INSTALLERS: tuple[tuple[str, str, str], ...]  # 7 (platform, arch, ext) combos

class AnchorLinks(HTMLParser):
    hrefs: list[str]

def validate_downloads(root: Path, body: str) -> str   # returns version
def rebase_docs_paths(body: str, prefix: str) -> str
def render_page(body: str, version: str, local_preview: bool) -> str
def generate(root: Path, check: bool = False) -> None
def main() -> None

Import

# Standalone script — run directly:
#   python3 tools/build_readme.py [--root PATH] [--check]

I/O Contract

Inputs

Name Type Required Description
README.md File Yes Source README markdown (read-only, never modified)
VERSION File Yes Release version string (validated against semver pattern)
desktop/package.json File Yes Contains version and build.<platform>.artifactName templates
--root Path No Repository root (default: script parent's parent)
--check flag No Validate freshness without writing

Outputs

Name Type Description
docs/readme-preview.html File Local preview page (with /docs/ path rebasing)
docs/index.html File Published index page (with in-page anchors)
stdout string "README previews generated; README.md preserved" or "README previews verified"

Usage Examples

Generate Preview Pages

# From repository root:
python3 tools/build_readme.py
# Output: README previews generated; README.md preserved

CI Freshness Check

python3 tools/build_readme.py --check
# Exit 0 if pages are fresh; exit 1 with "Preview pages need regeneration: ..." if stale

Render from a Fixture

python3 tools/build_readme.py --root /tmp/test-fixture

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment