How qqzhangyanhua/learn-opencode-agent works
Purpose and Runtime
This is a Chinese AI-agent engineering learning site, not an agent runtime. It publishes structured tutorials, source-code analyses, runnable TypeScript exercises, decision guides, and interactive visualizations. It runs on Bun with VitePress/Vue; production serves the built static site through Caddy on port 3000. Key entry points: package.json, .vitepress/config.mts, Caddyfile.
Site Composition and Navigation
VitePress configuration defines routing, navigation, sidebars, search, and page metadata; the documentation tree supplies route-backed Markdown content. The homepage and major hubs direct learners into OpenCode analysis, practice, intermediate topics, selection guidance, animation lab, interviews, and enterprise-agent material. Paths: docs/index.md, docs/discover/index.md, docs/learning-paths/index.md.
Theme Application Layer
The custom Vue theme is the client-side presentation and interaction boundary. It registers globally usable educational components, provides layout behavior, and owns site-wide styling and legacy selection-route redirects. Markdown pages embed these components rather than owning application logic. Paths: .vitepress/theme/index.ts, .vitepress/theme/Layout.vue, .vitepress/theme/custom.css, .vitepress/theme/agent-selection-redirects.ts.
Structured Content Data
Theme data modules are the canonical structured inputs for content-driven experiences: discovery, learning paths, practice catalogs, and animation scenarios. UI hubs consume this data to render cards, routes, progress, and simulations; content additions often require synchronized Markdown, data, and navigation updates. Paths: .vitepress/theme/data/content-index.data.ts, .vitepress/theme/data/learning-paths.data.ts, .vitepress/theme/data/practice-projects.ts.
Interactive Simulation System
Interactive teaching demos model Agent workflows in Vue, with scenario/state logic separated from rendering in several features. The animation laboratory is explicitly data-driven: experiment definitions feed a shared canvas/player rather than independent navigation or bespoke pages. Some scenario modules have colocated unit tests, making state transitions a tested boundary. Paths: .vitepress/theme/components/animation-lab/FlowExperimentCanvas.vue, .vitepress/theme/data/animation-lab-experiments.ts, .vitepress/theme/components/flowScenario.ts.
Educational Content Domains
Markdown is organized as independently navigable curricula: core OpenCode material, source-analysis series for Claude Code and Hermes, enterprise-agent design, practices, intermediate topics, selection guides, and interview resources. The docs are static source content; references to external Agent systems are explanatory source snapshots, not bundled integrations. Paths: docs/02-agent-core/index.md, docs/new-claude/part-1-主业务流/04-query-主循环如何驱动整个系统.md, docs/enterprise-agent/index.md.
Runnable Practice Boundary
Practice scripts are standalone TypeScript learning artifacts paired one-to-one with practice documentation and catalog metadata. They demonstrate concepts such as tool use, RAG, planning, MCP, multi-agent coordination, and deployment, rather than acting as services used by the site. MCP is represented by a dedicated server example. Paths: practice/p01-minimal-agent.ts, practice/p14-mcp-server.ts, docs/practice/p14-mcp/index.md.
Quality and Delivery Pipeline
Node/Bun scripts enforce cross-boundary consistency: required content metadata, navigation and hub entry reachability, practice-to-doc mappings, learning data, and animation registrations. build:strict sequences these checks before the static build; TypeScript checking focuses on the VitePress theme. Output is .vitepress/dist/, then Caddy serves it. Paths: scripts/check.sh, scripts/check-practice-entries.mjs, scripts/check-animation-lab.mjs.
Main entry points: index.ts Custom Vue theme · index.md Homepage & learning hubs · check.sh Strict consistency checks · config.mts Site configuration
Components 26
Learning Content
Route-backed curricula and practice materials.
- Homepage & learning hubs · Directs learners into the major curricula and experiences.
docs/index.md - Discovery hub
docs/discover/index.md - Learning paths hub
docs/learning-paths/index.md - OpenCode curriculum
docs/02-agent-core/index.md - Source-analysis curriculum · Claude Code and Hermes implementation analyses.
docs/new-claude/part-1-主业务流/04-query-主循环如何驱动整个系统.md - Enterprise-agent curriculum
docs/enterprise-agent/index.md - MCP practice lesson · Paired documentation for the MCP server exercise.
docs/practice/p14-mcp/index.md - Runnable exercises · Standalone learning examples, including agent and MCP concepts.
practice/p01-minimal-agent.ts - MCP server example · Dedicated standalone MCP server learning artifact.
practice/p14-mcp-server.ts
Theme & Experiences
Vue presentation, structured data, and interactive lessons.
- Custom Vue theme · Registers educational components and the site presentation boundary.
.vitepress/theme/index.ts - Site layout · Provides global layout behavior.
.vitepress/theme/Layout.vue - Global styling
.vitepress/theme/custom.css - Selection redirects · Preserves legacy selection routes.
.vitepress/theme/agent-selection-redirects.ts - Content catalogs · Canonical discovery and practice catalog input.
.vitepress/theme/data/content-index.data.ts - Learning-path data · Defines learning-path progress and route content.
.vitepress/theme/data/learning-paths.data.ts - Practice catalog · Maps practice entries to their learning materials.
.vitepress/theme/data/practice-projects.ts - Animation experiments · Data-driven experiment definitions for the animation lab.
.vitepress/theme/data/animation-lab-experiments.ts - Flow experiment canvas · Shared renderer and player for animation experiments.
.vitepress/theme/components/animation-lab/FlowExperimentCanvas.vue - Flow scenario logic · Models interactive workflow state transitions.
.vitepress/theme/components/flowScenario.ts
Quality & Delivery
Validation, static build, and production serving.
- Bun / VitePress · Builds the static documentation site.
package.json - Site configuration · Defines navigation, sidebars, search, routes, and metadata.
.vitepress/config.mts - Strict consistency checks · Checks metadata, reachability, mappings, learning data, and animation registrations.
scripts/check.sh - Practice mapping check
scripts/check-practice-entries.mjs - Animation registration check
scripts/check-animation-lab.mjs - Static site output · Production-ready generated site files.
- Caddy · Serves the static site on port 3000.
Caddyfile
Connections 26
- Bun / VitePress → Site configuration: loads
- Site configuration → Homepage & learning hubs: routes
- Site configuration → OpenCode curriculum: navigates
- Homepage & learning hubs → Discovery hub: links to
- Homepage & learning hubs → Learning paths hub: links to
- Homepage & learning hubs → OpenCode curriculum: links to
- Homepage & learning hubs → Source-analysis curriculum: links to
- Homepage & learning hubs → Enterprise-agent curriculum: links to
- Learning paths hub → Learning-path data: uses
- Discovery hub → Content catalogs: uses
- MCP practice lesson → MCP server example: teaches
- Practice catalog → Runnable exercises: catalogs
- Practice catalog → MCP practice lesson: maps to
- Custom Vue theme → Site layout: provides
- Custom Vue theme → Global styling: applies
- Custom Vue theme → Selection redirects: owns
- Custom Vue theme → Content catalogs: consumes
- Custom Vue theme → Learning-path data: consumes
- Animation experiments → Flow experiment canvas: drives
- Flow scenario logic → Flow experiment canvas: supplies state
- Custom Vue theme → Flow experiment canvas: registers
- Strict consistency checks → Practice mapping check: runs
- Strict consistency checks → Animation registration check: runs
- Strict consistency checks → Static site output: gates build
- Bun / VitePress → Static site output: builds
- Static site output → Caddy: served by