Files
Auto-Trader/wiki
Haozhe Wu a7f645f368 wiki: one header on every page, English by default, one switch for 中文
Each section carried its own copy of the header: Home's nav had no Home,
the docs' nav had no Docs, the research post had no star or theme button,
and the generated Alpha Library pages had no header at all. Only the docs
could switch language, and they guessed Chinese from the browser while
every other page stayed English.

- partials/ holds one head block, header and footer; sync_site_chrome.py
  writes them into every page between markers and, with --check in CI,
  also requires <body data-section> (the current section is highlighted by
  CSS), the language attributes and a single ?v= token site-wide. The
  Alpha Library generator inserts the same partials.
- site.js is the shared shell (theme, stars, language, footer traffic on
  home only). English is the HTML; Chinese comes from locales/zh.json via
  data-i18n hooks, and check_i18n.py fails on a key with no Chinese or a
  Chinese string nothing uses. A URL that names a language (/docs/zh/,
  the two articles) shows it and remembers it; everything else follows the
  stored choice, English by default. theme-init.js keeps a page hidden until
  its Chinese text is in, so it never flashes English.
- English tutorial and Chinese research post added. The Chinese tutorial
  gets the corrections its translation surfaced: 462 alphas in five zoos,
  AAPL.US, the mandate caps trades per day (it has no daily loss limit),
  Shadow Account extracts up to five rules, the web UI needs Docker or a
  checkout.
- Alpha Library: the zoo pages were never deployed — content/ is
  gitignored and nothing built it, so every zoo link served the root
  redirect. The deploy now exports the manifest and renders the pages (and
  redeploys when agent/src/factors changes); the fifth zoo, fundamental, is
  listed; generated pages allow same-origin scripts only.
- Phones keep the nav as a scrollable row instead of hiding it.
2026-09-29 17:53:13 +08:00
..
2026-05-14 19:31:31 +08:00
2026-05-14 19:31:31 +08:00

Vibe-Trading Wiki

Static source for https://vibetrading.wiki.

Local preview

cd wiki
python3 -m http.server 8088

Open http://localhost:8088/home/ for the landing page and these wiki sections:

  • http://localhost:8088/docs/
  • http://localhost:8088/tutorials/
  • http://localhost:8088/alpha-library/
  • http://localhost:8088/research-lab/

Direct docs URLs such as /docs/latest/getting-started/vibe-trading-overview or /docs/zh/… are handled by Cloudflare Pages via _redirects. The simple Python preview server does not apply those rewrite rules, so use /docs/ as the local entry point. Build the Alpha Library first (see below) or its zoo links fall through.

One header, two languages

Every page shares one head block, header and footer, kept in partials/ and copied between <!-- site-head|site-header|site-footer:start/end --> markers:

python3 wiki/scripts/sync_site_chrome.py          # after editing a partial
python3 wiki/scripts/sync_site_chrome.py --check  # CI

The check also requires <body data-section> (it highlights the current section in the header, CSS only), the language attributes below, and one cache-busting ?v= token everywhere — _headers lets browsers keep JS and CSS for an hour, so a module bumped alone can meet a cached copy of what it imports and leave the page blank. Bump the token with one replace across wiki/.

Language. English by default, never guessed from the browser; the header button switches the whole site and the choice is stored (vibetrading-lang). site.js does the switching:

  • A page whose URL names no language (<html data-lang-neutral>: home, tutorials and research-lab indexes, the Alpha Library and its generated pages, bare /docs/) is English HTML with data-i18n / data-i18n-html / data-i18n-attr / data-href-zh hooks; Chinese comes from locales/zh.json. theme-init.js hides such a page until the Chinese text is in, so it never flashes English.
  • An article exists once per language (<html data-page-lang="en|zh"> plus <link rel="alternate" hreflang> both ways): the tutorial (vibe-trading-beginner.html / -zh.html) and the research post. Opening one records its language; the button goes to the other file.
  • The docs are one shell: English at /docs/latest/<page> from docs/content.en.js, Chinese at /docs/zh/<page> from docs/content.zh.js.
node wiki/scripts/check_docs_parity.mjs   # docs: same pages and sections in both languages
python3 wiki/scripts/check_i18n.py        # every data-i18n key has Chinese, no orphans (needs jinja2)

Counts on the pages (data sources, engines, skills, presets, MCP tools, brokers, alphas) are measured from the code of the version in docs/content.js; re-measure them for a new release rather than editing one number.

Alpha Library

alpha-library/content/ and manifest.json are generated, not committed. The deploy workflow builds them before uploading, and also redeploys when agent/src/factors/ changes:

vibe-trading alpha export-manifest --out wiki/alpha-library/manifest.json --force
python wiki/scripts/build_alpha_library.py --clean

Cloudflare Pages

  • Project root: wiki
  • Build command: leave empty
  • Output directory: .
  • Custom domain: vibetrading.wiki

The pages are static and need no build step; the deploy workflow only generates the Alpha Library (above). The only dynamic piece is a small analytics layer in functions/ (Cloudflare Pages Functions): _middleware.js classifies each page request as AI-agent / bot / human by User-Agent and counts it into a D1 database (vibetrading-analytics, binding DB), and api/stats.js serves the footer's aggregate counts alongside public PyPI and GitHub numbers. The counter is anonymous and first-party — no cookies, no per-visitor identifier, no IP retention.