Skip to content

Commit 525523b

Browse files
committed
Update docs for latest gemini-cli changes
1 parent 12b6f47 commit 525523b

21 files changed

Lines changed: 629 additions & 558 deletions

src/pages/AgentFramework.tsx

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function QuickSummary({ isExpanded, onToggle }: { isExpanded: boolean; onToggle:
3434
<div className="bg-[var(--bg-terminal)]/50 rounded-lg p-4 border-l-4 border-[var(--cyber-blue)]">
3535
<p className="text-[var(--text-primary)] font-medium">
3636
<span className="text-[var(--cyber-blue)] font-bold">一句话:</span>
37-
可配置的子代理执行框架,通过 TOML 定义 Agent,支持本地执行和远程 A2A 调用
37+
可配置的子代理执行框架,通过 Markdown + YAML frontmatter 定义 Agent,支持本地执行和远程 A2A 调用
3838
</p>
3939
</div>
4040

@@ -53,7 +53,7 @@ function QuickSummary({ isExpanded, onToggle }: { isExpanded: boolean; onToggle:
5353
<div className="text-xs text-[var(--text-muted)]">配置层级</div>
5454
</div>
5555
<div className="bg-[var(--bg-card)] rounded-lg p-3 text-center border border-[var(--border-subtle)]">
56-
<div className="text-2xl font-bold text-[var(--purple)]">2</div>
56+
<div className="text-2xl font-bold text-[var(--purple)]">3</div>
5757
<div className="text-xs text-[var(--text-muted)]">内置 Agent</div>
5858
</div>
5959
</div>
@@ -63,7 +63,7 @@ function QuickSummary({ isExpanded, onToggle }: { isExpanded: boolean; onToggle:
6363
<h4 className="text-sm font-semibold text-[var(--text-muted)] mb-2">Agent 执行流程</h4>
6464
<div className="flex items-center gap-2 flex-wrap text-sm">
6565
<span className="px-3 py-1.5 bg-[var(--cyber-blue)]/20 text-[var(--cyber-blue)] rounded-lg border border-[var(--cyber-blue)]/30">
66-
TOML 加载
66+
Markdown frontmatter 加载
6767
</span>
6868
<span className="text-[var(--text-muted)]"></span>
6969
<span className="px-3 py-1.5 bg-[var(--purple)]/20 text-[var(--purple)] rounded-lg border border-[var(--purple)]/30">
@@ -98,15 +98,15 @@ export function AgentFramework() {
9898

9999
const architectureChart = `flowchart TD
100100
subgraph Config["📁 配置层"]
101-
TOML[TOML 配置文件]
101+
TOML[Markdown 配置文件]
102102
BUILTIN[内置 Agent]
103103
end
104104
105105
subgraph Registry["📋 AgentRegistry"]
106106
REG[注册与管理]
107107
REG --> |用户级| USER["~/.gemini/agents/"]
108108
REG --> |项目级| PROJ[".gemini/agents/"]
109-
REG --> |内置| BUILT[CodebaseInvestigator\nIntrospectionAgent]
109+
REG --> |内置| BUILT[codebase_investigator\ncli_help\ngeneralist]
110110
end
111111
112112
subgraph Execution["⚡ 执行层"]
@@ -252,15 +252,28 @@ export class AgentRegistry {
252252
}
253253
254254
private loadBuiltInAgents(): void {
255+
const investigatorSettings = this.config.getCodebaseInvestigatorSettings();
256+
const cliHelpSettings = this.config.getCliHelpAgentSettings();
257+
const agentsOverrides = this.config.getAgentsSettings().overrides ?? {};
258+
255259
// CodebaseInvestigator - 代码库探索
256-
if (this.config.getCodebaseInvestigatorSettings()?.enabled) {
260+
if (
261+
investigatorSettings?.enabled &&
262+
agentsOverrides[CodebaseInvestigatorAgent.name]?.enabled !== false
263+
) {
257264
this.registerLocalAgent(CodebaseInvestigatorAgent);
258265
}
259266
260-
// IntrospectionAgent - 自省分析
261-
if (this.config.getIntrospectionAgentSettings().enabled) {
262-
this.registerLocalAgent(IntrospectionAgent);
267+
// CLI Help - 文档问答
268+
if (
269+
cliHelpSettings.enabled &&
270+
agentsOverrides[CliHelpAgent.name]?.enabled !== false
271+
) {
272+
this.registerLocalAgent(CliHelpAgent(this.config));
263273
}
274+
275+
// Generalist - 通用代理(实验特性)
276+
this.registerLocalAgent(GeneralistAgent(this.config));
264277
}
265278
266279
// 获取 Agent 目录上下文(注入到系统提示词)
@@ -274,14 +287,22 @@ export class AgentRegistry {
274287
}
275288
}`;
276289

277-
const tomlConfigCode = `# ~/.gemini/agents/code-reviewer.toml
278-
name = "code-reviewer"
279-
description = "专业代码审查,检查最佳实践和潜在问题"
280-
tools = ["read_file", "search_file_content", "glob", "list_directory"]
290+
const markdownConfigCode = `---
291+
kind: local
292+
name: code-reviewer
293+
description: 专业代码审查,检查最佳实践和潜在问题
294+
display_name: Code Reviewer
295+
tools:
296+
- read_file
297+
- search_file_content
298+
- glob
299+
- list_directory
281300
# 说明:内置工具使用 tool name(如 read_file);MCP 工具用 server__tool 格式
282-
283-
[prompts]
284-
system_prompt = """
301+
model: gemini-2.5-flash
302+
temperature: 0.3
303+
max_turns: 10
304+
timeout_mins: 5
305+
---
285306
You are a senior code reviewer. Analyze the code for:
286307
- Best practices and patterns
287308
- Potential bugs and issues
@@ -291,16 +312,7 @@ You are a senior code reviewer. Analyze the code for:
291312
Current model: \${activeModel}
292313
Today: \${today}
293314
294-
When asked to review code, focus on actionable feedback.
295-
"""
296-
297-
[model]
298-
model = "gemini-2.0-flash"
299-
temperature = 0.3
300-
301-
[run]
302-
max_turns = 10
303-
timeout_mins = 5`;
315+
When asked to review code, focus on actionable feedback.`;
304316

305317
const remoteAgentNote = `注意:远程 Agent 通过 A2A (Agent-to-Agent) 协议调用,
306318
配置需要提供 agent_card_url 指向远程 Agent 的描述文件。
@@ -559,7 +571,7 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
559571
Agent Framework 代理框架
560572
</h1>
561573
<p className="text-xl text-[var(--text-muted)]">
562-
可配置的子代理执行框架 - TOML 驱动的 Agent 定义与执行
574+
可配置的子代理执行框架 - Markdown frontmatter 驱动的 Agent 定义与执行
563575
</p>
564576
</div>
565577

@@ -571,7 +583,7 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
571583
{/* 核心架构 */}
572584
<Layer title="核心架构">
573585
<p className="text-[var(--text-secondary)] mb-6">
574-
Agent Framework 提供了一套完整的子代理系统,支持通过 TOML 配置文件定义 Agent,
586+
Agent Framework 提供了一套完整的子代理系统,支持通过 Markdown + YAML frontmatter 定义 Agent,
575587
并在隔离的执行环境中运行。支持本地执行和远程 A2A (Agent-to-Agent) 调用。
576588
</p>
577589
<MermaidDiagram chart={architectureChart} />
@@ -652,14 +664,14 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
652664
</div>
653665
</Layer>
654666

655-
{/* TOML 配置示例 */}
656-
<Layer title="TOML 配置示例">
667+
{/* Markdown 配置示例 */}
668+
<Layer title="Markdown 配置示例">
657669
<p className="text-[var(--text-secondary)] mb-4">
658-
Agent 通过 TOML 文件定义,放置在 <code>~/.gemini/agents/</code> (用户级) 或
659-
<code>.gemini/agents/</code> (项目级) 目录下。
670+
Agent 通过 Markdown 文件 + YAML frontmatter 定义(文件必须以 <code>---</code> 开头),放置在
671+
<code>~/.gemini/agents/</code> (用户级) 或 <code>.gemini/agents/</code> (项目级) 目录下(仅加载 <code>.md</code>
660672
</p>
661673

662-
<CodeBlock code={tomlConfigCode} language="toml" title="本地 Agent 配置示例" />
674+
<CodeBlock code={markdownConfigCode} language="markdown" title="本地 Agent 配置示例" />
663675

664676
<div className="mt-6 bg-[var(--amber)]/10 rounded-lg p-4 border border-[var(--amber)]/30">
665677
<h4 className="text-[var(--amber)] font-bold mb-2">关于远程 Agent</h4>
@@ -688,11 +700,11 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
688700
<CodeBlock code={registryCode} language="typescript" title="registry.ts" />
689701

690702
<div className="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
691-
<HighlightBox title="内置 Agent (2个)" variant="blue">
703+
<HighlightBox title="内置 Agent (3个)" variant="blue">
692704
<ul className="text-sm space-y-1">
693-
<li><strong>CodebaseInvestigator</strong> - 代码库探索</li>
694-
<li><strong>IntrospectionAgent</strong> - 自省分析</li>
695-
<li>通过设置启用/禁用</li>
705+
<li><strong>codebase_investigator</strong> - 代码库探索</li>
706+
<li><strong>cli_help</strong> - CLI 文档问答</li>
707+
<li><strong>generalist</strong> - 通用代理(实验)</li>
696708
</ul>
697709
</HighlightBox>
698710

@@ -934,8 +946,8 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
934946
<td className="py-2 px-3 text-[var(--text-secondary)]">LocalAgentExecutor - 本地 Agent 执行循环</td>
935947
</tr>
936948
<tr className="border-b border-[var(--border-subtle)]/50">
937-
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/toml-loader.ts</td>
938-
<td className="py-2 px-3 text-[var(--text-secondary)]">TOML 配置解析与验证</td>
949+
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/agentLoader.ts</td>
950+
<td className="py-2 px-3 text-[var(--text-secondary)]">Markdown frontmatter 解析与验证</td>
939951
</tr>
940952
<tr className="border-b border-[var(--border-subtle)]/50">
941953
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/delegate-to-agent-tool.ts</td>
@@ -949,6 +961,14 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
949961
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/codebase-investigator.ts</td>
950962
<td className="py-2 px-3 text-[var(--text-secondary)]">CodebaseInvestigatorAgent 内置定义</td>
951963
</tr>
964+
<tr className="border-b border-[var(--border-subtle)]/50">
965+
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/cli-help-agent.ts</td>
966+
<td className="py-2 px-3 text-[var(--text-secondary)]">CliHelpAgent 内置定义</td>
967+
</tr>
968+
<tr className="border-b border-[var(--border-subtle)]/50">
969+
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/generalist-agent.ts</td>
970+
<td className="py-2 px-3 text-[var(--text-secondary)]">GeneralistAgent 内置定义(experimental)</td>
971+
</tr>
952972
<tr className="border-b border-[var(--border-subtle)]/50">
953973
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)] text-xs">agents/a2a-client-manager.ts</td>
954974
<td className="py-2 px-3 text-[var(--text-secondary)]">A2AClientManager - 远程 Agent 通信</td>
@@ -971,7 +991,7 @@ this.emitActivity('ERROR', { error: errorMessage, context: 'tool_call' });`;
971991

972992
<HighlightBox title="为什么 Agent 不能调用 delegate_to_agent?" variant="purple">
973993
<p className="text-sm">
974-
<strong>防止递归和复杂性</strong>toml-loader 会验证 tools 配置,
994+
<strong>防止递归和复杂性</strong>agentLoader 会验证 tools 配置,
975995
拒绝包含 delegate_to_agent 的 Agent 定义。这防止了 Agent 之间的递归调用,
976996
简化了执行模型和调试。
977997
</p>

src/pages/AgentSkills.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function AgentSkills() {
4444
<Layer title="技能发现(Discovery)" icon="🗂️">
4545
<p className="text-gray-300 mb-4">
4646
skills 启用后,<code>SkillManager</code> 会扫描 <code>*/SKILL.md</code> 并汇总为“可用技能清单”。
47-
覆盖优先级为:<strong>Extension(最低) → User → Project(最高)</strong>(同名以 YAML frontmatter 的 <code>name</code> 为准)。
47+
覆盖优先级为:<strong>Built-in(最低) → Extension → User → Workspace(最高)</strong>(同名以 YAML frontmatter 的 <code>name</code> 为准)。
4848
</p>
4949

5050
<CodeBlock
@@ -62,22 +62,25 @@ getProjectSkillsDir(): string {
6262
<CodeBlock
6363
title="发现顺序与覆盖(skillManager.ts)"
6464
code={`// packages/core/src/skills/skillManager.ts
65-
// Precedence: Extensions (lowest) -> User -> Project (highest).
65+
// Precedence: Built-in (lowest) -> Extensions -> User -> Workspace (highest).
6666
async discoverSkills(storage: Storage, extensions: GeminiCLIExtension[] = []) {
6767
this.clearSkills();
6868
69-
// 1) Extension skills (lowest)
69+
// 1) Built-in skills (lowest)
70+
await this.discoverBuiltinSkills();
71+
72+
// 2) Extension skills
7073
for (const extension of extensions) {
7174
if (extension.isActive && extension.skills) {
7275
this.addSkillsWithPrecedence(extension.skills);
7376
}
7477
}
7578
76-
// 2) User skills
79+
// 3) User skills
7780
const userSkills = await loadSkillsFromDir(Storage.getUserSkillsDir());
7881
this.addSkillsWithPrecedence(userSkills);
7982
80-
// 3) Project skills (highest, overrides)
83+
// 4) Workspace skills (highest, overrides)
8184
const projectSkills = await loadSkillsFromDir(storage.getProjectSkillsDir());
8285
this.addSkillsWithPrecedence(projectSkills);
8386
}`}
@@ -168,18 +171,43 @@ You have access to the following specialized skills...
168171
<Layer title="用户侧管理(/skills + settings)" icon="🧰">
169172
<p className="text-gray-300 mb-4">
170173
Skills 目前属于实验特性:通过 <code>experimental.skills</code> 开启;通过 <code>skills.disabled</code> 禁用特定技能。
171-
CLI 也提供 <code>/skills</code> 命令用于列出与启用/禁用(修改配置后需要重启生效)。
174+
CLI 也提供 <code>/skills</code> 命令用于列出与启用/禁用/刷新(禁用/启用后建议 <code>/skills reload</code> 让本会话生效)。
172175
</p>
173176
<CodeBlock
174-
title="配置项(docs/get-started/configuration.md)"
177+
title="配置项(docs/cli/settings.md)"
175178
code={`experimental.skills: boolean # Enable Agent Skills (experimental)
176179
skills.disabled: string[] # List of disabled skills (restart required)`}
177180
/>
178181
<CodeBlock
179182
title="/skills 命令(skillsCommand.ts)"
180183
code={`/skills list [nodesc]
184+
/skills list [nodesc] [all]
181185
/skills disable <name>
182-
/skills enable <name>`}
186+
/skills enable <name>
187+
/skills reload`}
188+
/>
189+
<p className="text-xs text-gray-400 mt-2">
190+
说明:<code>/skills list --all</code> 会展示内建 skills(例如 <code>skill-creator</code>),否则默认隐藏。
191+
</p>
192+
</Layer>
193+
194+
<Layer title="终端命令(gemini skills)" icon="🧪">
195+
<p className="text-gray-300 mb-4">
196+
除了 Slash Commands,CLI 还提供 <code>gemini skills</code> 子命令用于安装/卸载技能包(默认 user scope)。
197+
</p>
198+
<CodeBlock
199+
title="gemini skills 管理"
200+
code={`# 列出所有技能
201+
gemini skills list
202+
203+
# 安装(Git / 本地 / .skill)
204+
gemini skills install https://github.com/my-org/my-skills.git
205+
gemini skills install /path/to/skill --scope workspace
206+
207+
# 卸载/启用/禁用
208+
gemini skills uninstall my-skill
209+
gemini skills enable my-skill
210+
gemini skills disable my-skill --scope workspace`}
183211
/>
184212
</Layer>
185213

src/pages/ErrorHandling.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ function attemptJSONFix(
11191119
<code className="text-green-400">AI 自动处理</code>
11201120
重新读取文件后重试
11211121
</td>
1122-
<td className="py-3 px-2 text-xs font-mono text-cyan-400">packages/core/src/tools/smart-edit.ts</td>
1122+
<td className="py-3 px-2 text-xs font-mono text-cyan-400">packages/core/src/tools/edit.ts</td>
11231123
</tr>
11241124

11251125
{/* 配置错误 */}

src/pages/Glossary.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const glossaryTerms: Term[] = [
126126
{
127127
term: 'Skill',
128128
definition:
129-
'Agent Skills(技能系统):启用 experimental.skills 后,CLI 会从 ~/.gemini/skills 与 .gemini/skills 扫描 */SKILL.md;模型可通过 activate_skill 激活技能并获得 <ACTIVATED_SKILL> 指令注入;用户可用 /skills 列表/启用/禁用。',
129+
'Agent Skills(技能系统):启用 experimental.skills 后,CLI 会从 Built-in/Extension/用户/工作区的 skills 目录扫描 */SKILL.md;模型可通过 activate_skill 激活技能并获得 <ACTIVATED_SKILL> 指令注入;用户可用 /skills list/enable/disable/reload 管理。',
130130
category: 'extension',
131131
relatedPage: 'agent-skills',
132132
},
@@ -423,14 +423,14 @@ const glossaryTerms: Term[] = [
423423

424424
// Editing
425425
{
426-
term: 'SmartEdit',
427-
definition: '智能编辑引擎,支持模糊匹配和自动修复。当 old_string 不完全匹配时尝试智能定位。',
426+
term: 'Edit Tool (replace)',
427+
definition: '编辑/替换引擎,支持精确、灵活空白、正则和 LLM 修复多策略匹配。',
428428
category: 'tool',
429429
relatedPage: 'smart-edit-anim',
430430
},
431431
{
432-
term: 'LLMEditFixer',
433-
definition: 'AI 辅助的编辑修复器,当 Edit 工具失败时调用 AI 分析并修复匹配问题。',
432+
term: 'FixLLMEditWithInstruction',
433+
definition: 'LLM 辅助的编辑修复器,当 replace 工具失败时生成新的 search/replace 以修复匹配问题。',
434434
category: 'tool',
435435
relatedPage: 'smart-edit-anim',
436436
example: '处理缩进差异、空白字符不匹配等常见问题',

src/pages/ModelAvailability.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ export function classifyFailureKind(error: unknown): FailureKind {
243243

244244
const policyChainCode = `// packages/core/src/availability/policyCatalog.ts
245245
246+
import {
247+
DEFAULT_GEMINI_MODEL,
248+
DEFAULT_GEMINI_FLASH_MODEL,
249+
PREVIEW_GEMINI_MODEL,
250+
PREVIEW_GEMINI_FLASH_MODEL,
251+
} from '../config/models.js';
252+
246253
// 降级动作
247254
export type FallbackAction = 'silent' | 'prompt';
248255
@@ -256,14 +263,14 @@ export interface ModelPolicy {
256263
257264
// 默认策略链: Pro → Flash
258265
const DEFAULT_CHAIN: ModelPolicyChain = [
259-
definePolicy({ model: 'gemini-2.5-pro' }),
260-
definePolicy({ model: 'gemini-2.0-flash', isLastResort: true }),
266+
definePolicy({ model: DEFAULT_GEMINI_MODEL }),
267+
definePolicy({ model: DEFAULT_GEMINI_FLASH_MODEL, isLastResort: true }),
261268
];
262269
263270
// Preview 策略链
264271
const PREVIEW_CHAIN: ModelPolicyChain = [
265-
definePolicy({ model: 'gemini-2.5-pro-preview' }),
266-
definePolicy({ model: 'gemini-2.0-flash-preview', isLastResort: true }),
272+
definePolicy({ model: PREVIEW_GEMINI_MODEL }),
273+
definePolicy({ model: PREVIEW_GEMINI_FLASH_MODEL, isLastResort: true }),
267274
];
268275
269276
// 验证策略链
@@ -486,6 +493,9 @@ export function validateModelPolicyChain(chain: ModelPolicyChain): void {
486493
策略链定义了模型的优先级和故障转移规则。默认链:Pro → Flash,确保至少有一个 lastResort 模型。
487494
</p>
488495
<CodeBlock code={policyChainCode} language="typescript" title="policyCatalog.ts" />
496+
<p className="text-[var(--text-muted)] text-sm mt-3">
497+
Preview 模式启用时,策略链会切换到 Gemini 3 的 preview 模型(Pro/Flash)。
498+
</p>
489499

490500
<HighlightBox title="策略链验证规则" variant="blue" className="mt-4">
491501
<ul className="text-sm space-y-1">

0 commit comments

Comments
 (0)