Skip to content

feat(site): LLM-readable single-file bundle of the seven chapters#16

Merged
PanQiWei merged 1 commit into
PanQiWei:mainfrom
pandazki:feat/llm-mental-models-bundle
Apr 30, 2026
Merged

feat(site): LLM-readable single-file bundle of the seven chapters#16
PanQiWei merged 1 commit into
PanQiWei:mainfrom
pandazki:feat/llm-mental-models-bundle

Conversation

@pandazki
Copy link
Copy Markdown
Contributor

Summary

  • Build-time script bundles every mental-model chapter into one .txt file per language (/llms-mental-models-{en,zh}.txt) — meant to be pasted into an LLM chat or fed to an agent in one shot.
  • Inline copy button sits next to the "For Non-Human Readers" / "致非人类读者" h2 on the homepage. Click → clipboard receives the bundle URL on the current origin; button flips to a vermilion "Copied" state for 1.6s.
  • Chapter URLs in the bundle are path-only with the site base prefix (no host), so the file is portable across forks. The preamble explains how an LLM should reconstruct the host from where it fetched the bundle.
  • UTF-8 BOM is prepended to each bundle so browsers render the file correctly even though GitHub Pages serves .txt without a charset= response header.
  • Drive-by fix: site/astro.config.mjs site: was still pointing at a fork's host (nanxingw.github.io). Updated to panqiwei.github.io.

Test plan

  • npm run build regenerates both bundles (prebuild hook → build:llm-bundle)
  • npm run dev regenerates bundles (predev hook)
  • npm run test:sync still passes (8/8)
  • Bundles open as proper UTF-8 in the browser (BOM)
  • Copy button writes the right URL to clipboard on both /zh/ and /en/
  • Button label flips to "已复制" / "Copied" and back after 1.6s
  • No baked-in host: grep -E '\.github\.io' site/public/llms-mental-models-*.txt returns nothing
  • No UI changes outside the homepage (mm hub untouched)

🤖 Generated with Claude Code

Adds a build-time script that bundles every mental-model chapter into one
text file per language for one-shot ingestion by an LLM, and an inline copy
button next to the "For Non-Human Readers" heading on the homepage.

Chapter URLs in the bundle are path-only with the site base prefix so the
file is portable across forks; readers reconstruct the host from where
they fetched the bundle (explained in a Resolving URLs note in the
preamble). UTF-8 BOM is prepended so browsers render the file correctly
without a charset response header.

Also fixes the long-stale `site` field in astro.config.mjs that pointed
at a fork's URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PanQiWei PanQiWei merged commit d5b243e into PanQiWei:main Apr 30, 2026
5 checks passed
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