11<div align =" center " >
22
3- <img src = " ./public/og.svg " alt = " Coding CLI Guide " width = " 720 " />
3+ <br />
44
5- <br /><br />
5+ <img src =" ./public/favicon.svg " alt =" Coding CLI Guide " width =" 80 " />
6+
7+ <br />
68
79# Coding CLI Guide
810
9- ** AI Coding CLI 架构交互式学习指南** <br />
10- 深入拆解 Gemini CLI 内部实现,从启动链路到工具调度,从 Agent Loop 到安全沙箱
11+ ** Interactive Architecture Guide for AI Coding CLIs**
12+
13+ Deeply dissect the internals of Gemini CLI — from startup chain to tool scheduling, from Agent Loop to security sandbox.
1114
1215<br />
1316
14- [ ![ Live Demo] ( https://img.shields.io/badge/Live_Demo-→_在线体验-22d3ee ?style=for-the-badge&logo=github-pages&logoColor=white )] ( https://tt-a1i.github.io/coding-cli-guide/ )
17+ [ ![ Live Demo] ( https://img.shields.io/badge/Live_Demo-→_Try_it_now-2563eb ?style=for-the-badge&logo=github-pages&logoColor=white )] ( https://tt-a1i.github.io/coding-cli-guide/ )
1518
1619<br />
1720
18- <img src =" https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react&logoColor=black " alt =" React 19 " />
19- <img src =" https://img.shields.io/badge/TypeScript-5.9-3178C6?style=flat-square&logo=typescript&logoColor=white " alt =" TypeScript " />
20- <img src =" https://img.shields.io/badge/Vite-7-646CFF?style=flat-square&logo=vite&logoColor=white " alt =" Vite 7 " />
21- <img src =" https://img.shields.io/badge/Tailwind_CSS-4-06B6D4?style=flat-square&logo=tailwindcss&logoColor=white " alt =" Tailwind CSS 4 " />
22- <img src =" https://img.shields.io/badge/Pages-158+-22c55e?style=flat-square " alt =" 158+ pages " />
23- <img src =" https://img.shields.io/badge/Animations-120+-a855f7?style=flat-square " alt =" 120+ animations " />
21+ ![ React] ( https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react&logoColor=black )
22+ ![ TypeScript] ( https://img.shields.io/badge/TypeScript-5.9-3178C6?style=flat-square&logo=typescript&logoColor=white )
23+ ![ Vite] ( https://img.shields.io/badge/Vite-7-646CFF?style=flat-square&logo=vite&logoColor=white )
24+ ![ Tailwind CSS] ( https://img.shields.io/badge/Tailwind_CSS-4-06B6D4?style=flat-square&logo=tailwindcss&logoColor=white )
25+ ![ Mermaid] ( https://img.shields.io/badge/Mermaid-Diagrams-FF3670?style=flat-square&logo=mermaid&logoColor=white )
26+ ![ Prism.js] ( https://img.shields.io/badge/Prism.js-Syntax-1a1a2e?style=flat-square )
27+ ![ Pages] ( https://img.shields.io/badge/Pages-158+-22c55e?style=flat-square )
28+ ![ Animations] ( https://img.shields.io/badge/Animations-120+-a855f7?style=flat-square )
29+ ![ License] ( https://img.shields.io/badge/License-MIT-f59e0b?style=flat-square )
30+ ![ Deploy] ( https://img.shields.io/badge/Deploy-GitHub_Pages-222?style=flat-square&logo=github&logoColor=white )
2431
2532</div >
2633
3037
3138## Why
3239
33- AI Coding CLI(如 Gemini CLI、 Claude Code、 Qwen Code)的源码动辄数万行,直接阅读容易迷失。本项目将 ** Gemini CLI** 的核心架构提炼为 ** 158 个交互式页面 ** ,配合 ** Mermaid 流程图 ** 和 ** 120+ 步进动画 ** ,让你在浏览器中就能直观理解每一个内部机制。
40+ Source code of AI Coding CLIs ( Gemini CLI, Claude Code, Qwen Code, etc.) can be tens of thousands of lines. Reading them directly is overwhelming. This project distills the core architecture of ** Gemini CLI** into ** 158 interactive pages ** with ** Mermaid flowcharts ** and ** 120+ step-by-step animations ** , so you can visually understand every internal mechanism right in the browser.
3441
35- > 可分享 · 可检索 · 可深链 — 每个知识点都有独立 URL,方便团队内传阅与讨论。
42+ > Shareable · Searchable · Deep-linkable — every topic has its own URL for team sharing and discussion.
3643
3744---
3845
@@ -42,42 +49,42 @@ AI Coding CLI(如 Gemini CLI、Claude Code、Qwen Code)的源码动辄数万
4249<tr >
4350<td width =" 50% " >
4451
45- ### 📖 全景式架构拆解
46- 从 CLI 启动的第一行代码,到用户输入→模型调用→工具执行→响应渲染的完整请求生命周期,每一步都有对应的可视化页面。
52+ ### Panoramic Architecture Breakdown
53+ From the first line of CLI startup to the full request lifecycle: user input → model invocation → tool execution → response rendering. Every step has a corresponding visual page.
4754
4855</td >
4956<td width =" 50% " >
5057
51- ### 🎬 120+ 步进动画
52- 不是静态文档——关键流程( Agent Loop、工具调度、 MCP 握手、Token 计算等)都配有可交互的逐步动画演示。
58+ ### 120+ Step-by-step Animations
59+ Not static docs — key processes ( Agent Loop, tool scheduling, MCP handshake, token calculation, etc.) come with interactive step-through animation demos.
5360
5461</td >
5562</tr >
5663<tr >
5764<td >
5865
59- ### 🔧 深入工具系统
60- 工具注册、Schema 定义、并行调度、权限审批、结果缓存……完整覆盖从 ` ToolReference ` 到 ` ToolScheduler ` 的每个环节。
66+ ### Deep Dive into Tool System
67+ Tool registration, schema definitions, parallel scheduling, permission approval, result caching — complete coverage from ` ToolReference ` to ` ToolScheduler ` .
6168
6269</td >
6370<td >
6471
65- ### 🛡️ 安全机制全解
66- 审批模式、信任文件夹、沙箱隔离( Docker / Seatbelt)、 Git Checkpointing、循环检测、命令注入检测——安全边界一览无余。
72+ ### Security Mechanisms Explained
73+ Approval mode, trusted folders, sandbox isolation ( Docker / Seatbelt), Git checkpointing, loop detection, command injection detection — security boundaries at a glance.
6774
6875</td >
6976</tr >
7077<tr >
7178<td >
7279
73- ### 🔌 扩展与集成
74- Agent 框架、Subagent 系统、 MCP 协议集成、 IDE 扩展( VS Code / Cursor / Zed)、Prompt 注册表……了解 CLI 如何与外部世界交互。
80+ ### Extensions & Integrations
81+ Agent framework, subagent system, MCP protocol, IDE extensions ( VS Code / Cursor / Zed), prompt registry — how the CLI interacts with the outside world.
7582
7683</td >
7784<td >
7885
79- ### 🧭 多种学习路径
80- 提供「快速入门」「端到端走读」「学习路径指南」等入口,无论你是想快速了解还是深入研究,都能找到合适的阅读路线。
86+ ### Multiple Learning Paths
87+ Quick start, end-to-end walkthrough, learning path guides — whether you want a quick overview or deep research, there's a reading route for you.
8188
8289</td >
8390</tr >
@@ -88,72 +95,67 @@ Agent 框架、Subagent 系统、MCP 协议集成、IDE 扩展(VS Code / Curso
8895## Content Map
8996
9097```
91- 📂 快速入门 Start Here · 学习路径 · 架构概览 · 端到端走读 · 术语表
92- ⚙️ 核心机制 启动链路 · 请求生命周期 · 交互主循环 · Turn 状态机 · Token 体系
93- 会话持久化 · 服务层架构 · Prompt 构建 · 流式响应 · 多厂商兼容层
94- 🔧 工具系统 工具参考 · 开发指南 · 调度详解 · 文件发现 · 工具架构 · 执行流程
95- 💻 命令系统 斜杠命令 · 自定义命令 · @命令 · Shell 模式 · Prompt 处理器 · 记忆系统
96- 🔌 扩展集成 Agent 框架 · Agent Skills · Subagent · MCP 集成 · IDE 集成 · Zed ACP
97- 🎯 事件与策略 Hook 系统 · Policy 引擎 · 消息总线 · 模型路由 · 模型可用性
98- 🛡️ 安全可靠 审批模式 · 信任机制 · 检查点恢复 · 沙箱系统 · 循环检测 · 错误恢复
99- ▶️ 运行模式 非交互模式 · 聊天压缩 · 输出格式化 · 会话恢复 · 会话录制
100- 🎨 UI 与观测 渲染层 · 状态管理 · 组件库 · React Hooks · 键盘绑定 · 主题 · 遥测
101- 🎬 动画演示 50+ 核心流程动画 + 60+ 内部机制动画
102- 📚 附录 配置系统 · 认证流程 · 模型配置 · 设计权衡 · 并发模式 · 错误恢复模式
98+ Quick Start Start Here · Learning Paths · Architecture Overview · E2E Walkthrough · Glossary
99+ Core Mechanisms Startup Flow · Request Lifecycle · Interaction Loop · Turn State Machine · Token System
100+ Session Persistence · Service Layer · Prompt Building · Streaming · Multi-provider
101+ Tool System Tool Reference · Dev Guide · Scheduler · File Discovery · Architecture · Execution
102+ Command System Slash Commands · Custom Commands · @Commands · Shell Modes · Prompt Processor · Memory
103+ Extensions Agent Framework · Agent Skills · Subagent · MCP · IDE Integration · Zed ACP
104+ Events & Policy Hook System · Policy Engine · Message Bus · Model Router · Model Availability
105+ Security Approval Mode · Trust · Checkpointing · Sandbox · Loop Detection · Error Recovery
106+ Run Modes Non-interactive · Chat Compression · Output Format · Session Resume · Recording
107+ UI & Observability Render Layer · State Management · Components · React Hooks · Keybindings · Theme · Telemetry
108+ Animations 50+ Core Process Animations + 60+ Internal Mechanism Animations
109+ Appendix Config System · Auth Flow · Model Config · Design Tradeoffs · Concurrency · Error Patterns
103110```
104111
105112---
106113
107114## Quick Start
108115
109- ### 环境要求
116+ ### Prerequisites
110117
111118- ** Node.js** >= 18
112119- ** npm** >= 9
113120
114- ### 本地运行
121+ ### Run Locally
115122
116123``` bash
117- # 克隆
118124git clone https://github.com/tt-a1i/coding-cli-guide.git
119125cd coding-cli-guide
120-
121- # 安装依赖
122126npm install
123-
124- # 启动开发服务器
125127npm run dev
126128```
127129
128- 浏览器访问 ** http://localhost:5173 **
130+ Open ** http://localhost:5173 ** in your browser.
129131
130- ### 或者直接在线体验
132+ ### Or Try Online
131133
132- 👉 ** https://tt-a1i.github.io/coding-cli-guide/ **
134+ ** https://tt-a1i.github.io/coding-cli-guide/ **
133135
134136---
135137
136138## Tech Stack
137139
138- | 分类 | 技术 |
139- | ------| ------|
140- | ** 框架 ** | React 19 (Hooks) |
141- | ** 语言 ** | TypeScript 5.9 |
142- | ** 构建 ** | Vite 7 |
143- | ** 样式 ** | Tailwind CSS 4 |
144- | ** 流程图 ** | Mermaid |
145- | ** 代码高亮 ** | Prism.js |
146- | ** 部署 ** | GitHub Pages (GitHub Actions) |
140+ | Category | Technology |
141+ | ---------- | ----- ------|
142+ | ** Framework ** | React 19 (Hooks) |
143+ | ** Language ** | TypeScript 5.9 |
144+ | ** Build ** | Vite 7 |
145+ | ** Styling ** | Tailwind CSS 4 |
146+ | ** Diagrams ** | Mermaid |
147+ | ** Syntax Highlighting ** | Prism.js |
148+ | ** Deployment ** | GitHub Pages (GitHub Actions) |
147149
148150---
149151
150152## Development
151153
152154``` bash
153- npm run dev # 启动开发服务器
154- npm run build # 构建生产版本(含 TypeScript 类型检查)
155- npm run preview # 预览生产构建
156- npm run lint # 代码检查
155+ npm run dev # Start dev server
156+ npm run build # Production build (with TypeScript type check)
157+ npm run preview # Preview production build
158+ npm run lint # Lint check
157159```
158160
159161---
@@ -162,34 +164,34 @@ npm run lint # 代码检查
162164
163165```
164166src/
165- ├── pages/ # 158 个内容页面(含 120+ 动画页)
166- │ └── animations/ # 动画辅助组件
167- ├── components/ # 通用 UI 组件
168- │ ├── MermaidDiagram # Mermaid 流程图渲染
169- │ ├── CodeBlock # 代码块 + 语法高亮
170- │ ├── FlowDiagram # 流程图组件
171- │ ├── Tabs # 标签页切换
167+ ├── pages/ # 158 content pages (incl. 120+ animation pages)
168+ │ └── animations/ # Animation helper components
169+ ├── components/ # Shared UI components
170+ │ ├── MermaidDiagram # Mermaid diagram renderer
171+ │ ├── CodeBlock # Code block + syntax highlighting
172+ │ ├── FlowDiagram # Flow diagram component
173+ │ ├── Tabs # Tab switcher
172174│ └── ...
173175├── contexts/ # React Context
174- ├── nav.ts # 导航树定义( 13 个分组 · 160 个条目)
175- ├── types/ # TypeScript 类型
176- └── utils/ # 工具函数
176+ ├── nav.ts # Navigation tree ( 13 groups · 160 entries)
177+ ├── types/ # TypeScript types
178+ └── utils/ # Utilities
177179```
178180
179181---
180182
181183## Related Projects
182184
183- | 项目 | 说明 |
184- | ------| ------|
185- | [ Gemini CLI] ( https://github.com/google-gemini/gemini-cli ) | Google 官方 Gemini CLI — 本指南的分析对象 |
186- | [ Qwen Code] ( https://github.com/QwenLM/qwen-code ) | 基于 Gemini CLI 的衍生实现,可对照阅读 |
185+ | Project | Description |
186+ | --------- | ------- ------|
187+ | [ Gemini CLI] ( https://github.com/google-gemini/gemini-cli ) | Google's official Gemini CLI — the subject of this guide |
188+ | [ Qwen Code] ( https://github.com/QwenLM/qwen-code ) | A derivative based on Gemini CLI, useful for comparison |
187189
188190---
189191
190192## Contributing
191193
192- 欢迎提交 Issue 和 Pull Request!无论是纠正错误、补充内容,还是改进动画,都非常感谢。
194+ Issues and Pull Requests are welcome! Whether it's fixing errors, adding content, or improving animations — all contributions are appreciated.
193195
194196---
195197
@@ -199,5 +201,88 @@ src/
199201
200202<div align =" center " >
201203<br />
202- <sub >Built with React + TypeScript + Tailwind CSS + Mermaid</sub >
204+ <sub >Built with React · TypeScript · Tailwind CSS · Mermaid · Prism.js</sub >
205+ <br /><br />
206+ </div >
207+
208+ ---
209+
210+ <details >
211+ <summary ><strong >🇨🇳 中文版</strong ></summary >
212+
213+ <br />
214+
215+ <div align =" center " >
216+
217+ <img src =" ./public/favicon.svg " alt =" Coding CLI Guide " width =" 80 " />
218+
219+ <br />
220+
221+ # Coding CLI Guide
222+
223+ ** AI Coding CLI 架构交互式学习指南**
224+
225+ 深入拆解 Gemini CLI 内部实现,从启动链路到工具调度,从 Agent Loop 到安全沙箱
226+
227+ <br />
228+
229+ [ ![ 在线体验] ( https://img.shields.io/badge/在线体验-→_立即访问-2563eb?style=for-the-badge&logo=github-pages&logoColor=white )] ( https://tt-a1i.github.io/coding-cli-guide/ )
230+
203231</div >
232+
233+ <br />
234+
235+ ### 为什么做这个
236+
237+ AI Coding CLI(如 Gemini CLI、Claude Code、Qwen Code)的源码动辄数万行,直接阅读容易迷失。本项目将 ** Gemini CLI** 的核心架构提炼为 ** 158 个交互式页面** ,配合 ** Mermaid 流程图** 和 ** 120+ 步进动画** ,让你在浏览器中就能直观理解每一个内部机制。
238+
239+ > 可分享 · 可检索 · 可深链 — 每个知识点都有独立 URL,方便团队内传阅与讨论。
240+
241+ ### 特性
242+
243+ | | |
244+ | ---| ---|
245+ | ** 全景式架构拆解** — 从 CLI 启动的第一行代码,到完整请求生命周期的可视化 | ** 120+ 步进动画** — Agent Loop、工具调度、MCP 握手等关键流程的交互式演示 |
246+ | ** 深入工具系统** — 注册、Schema、并行调度、权限审批、结果缓存全覆盖 | ** 安全机制全解** — 审批模式、信任机制、沙箱隔离、循环检测一览无余 |
247+ | ** 扩展与集成** — Agent 框架、Subagent、MCP 协议、IDE 扩展 | ** 多种学习路径** — 快速入门、端到端走读、学习路径指南 |
248+
249+ ### 内容地图
250+
251+ ```
252+ 快速入门 Start Here · 学习路径 · 架构概览 · 端到端走读 · 术语表
253+ 核心机制 启动链路 · 请求生命周期 · 交互主循环 · Turn 状态机 · Token 体系
254+ 会话持久化 · 服务层架构 · Prompt 构建 · 流式响应 · 多厂商兼容层
255+ 工具系统 工具参考 · 开发指南 · 调度详解 · 文件发现 · 工具架构 · 执行流程
256+ 命令系统 斜杠命令 · 自定义命令 · @命令 · Shell 模式 · Prompt 处理器 · 记忆系统
257+ 扩展集成 Agent 框架 · Agent Skills · Subagent · MCP 集成 · IDE 集成 · Zed ACP
258+ 事件与策略 Hook 系统 · Policy 引擎 · 消息总线 · 模型路由 · 模型可用性
259+ 安全可靠 审批模式 · 信任机制 · 检查点恢复 · 沙箱系统 · 循环检测 · 错误恢复
260+ 运行模式 非交互模式 · 聊天压缩 · 输出格式化 · 会话恢复 · 会话录制
261+ UI 与观测 渲染层 · 状态管理 · 组件库 · React Hooks · 键盘绑定 · 主题 · 遥测
262+ 动画演示 50+ 核心流程动画 + 60+ 内部机制动画
263+ 附录 配置系统 · 认证流程 · 模型配置 · 设计权衡 · 并发模式 · 错误恢复模式
264+ ```
265+
266+ ### 本地运行
267+
268+ ``` bash
269+ git clone https://github.com/tt-a1i/coding-cli-guide.git
270+ cd coding-cli-guide
271+ npm install
272+ npm run dev
273+ ```
274+
275+ 浏览器访问 ** http://localhost:5173 **
276+
277+ ### 相关项目
278+
279+ | 项目 | 说明 |
280+ | ------| ------|
281+ | [ Gemini CLI] ( https://github.com/google-gemini/gemini-cli ) | Google 官方 Gemini CLI — 本指南的分析对象 |
282+ | [ Qwen Code] ( https://github.com/QwenLM/qwen-code ) | 基于 Gemini CLI 的衍生实现,可对照阅读 |
283+
284+ ### 许可证
285+
286+ [ MIT] ( ./LICENSE.md )
287+
288+ </details >
0 commit comments