在 Gemini CLI 中使用 Gemini 3 Pro 实操指南

现在可以在 Gemini CLI 中用 Gemini 3 Pro 啦。

这下子终端不仅仅是一个输入指令的窗口,而是变成了一个具备执行力的开发环境,并且还能通过 Agentic Coding(代理编码)处理复杂的工程任务,并通过调用外部工具优化工作流。

目前 Google AI Ultra 订阅用户或持有付费 Gemini API Key 的用户可以使用,而其他用户可以加入加入候补名单,等官方开放权限。

如何在 Gemini CLI 使用 Gemini 3 Pro

首先要部署好Node.js 20或以上的环境,如果不知道怎么安装。可以使用ServBay,一键安装。

ServBay能够支持不同Node.js版本同时运行,并且能一键切换它们。只需要安装好ServBay后,在左边菜单的「软件包」中找到Node.js,点击安装即可。

然后输入命令安装好Gemini。

bash 复制代码
npm install -g @google/gemini-cli

升级 CLI 版本

  1. 所有这些工作准备好之后,输入下面的命令升级。
css 复制代码
npm install -g @google/gemini-cli@latest
  1. 开启预览功能

安装完成后,在终端运行 /settings,将 Preview features 设置为 true。此时,Gemini CLI 将默认使用 Gemini 3 Pro 模型。

以下是 4个具体场景,展示如何利用 Gemini 3 Pro 加速开发。


利用 Agentic Coding 在终端直接构建应用

Gemini 3 Pro 擅长整合文本、代码和视觉信息,并能遵循极其复杂的指令,一句话就能直接从生成一个可运行的项目骨架。

实操案例:构建 高保真 3D 仿真场景

传统的 3D 开发需要配置图形库、本地服务器和大量样板代码。现在,可以将创意简报和技术规格合并为一个 Prompt,让 CLI 直接生成结果。

比如输入以下指令,要求它生成一个金门大桥的 3D 模拟:

vbnet 复制代码
Objective: Build a visually stunning, photorealistic 3D Voxel simulation of the Golden Gate Bridge using Three.js, prioritizing quality and complex visuals (no simple blocks), atmospheric depth and 60FPS performance.

Visuals  &  Atmosphere:
Lighting: Slider (0-24h) controlling sun position, light intensity, sky color, and fog color.
Fog: Volumetric-style fog using sprite particles that drift and bob. Slider 0-100. 0 = True Zero (Crystal Clear). 100 = Dense but realistic (not whiteout).
Water: Custom GLSL shader with waves, specular reflections, and manual distance-based fog blending (exp2) for seamless horizon integration.
Post-Processing: ACESFilmic Tone Mapping and UnrealBloom (optimized for glowing lights at night).

Scene Details:
Bridge: Art Deco towers with concrete piers (anchored to seabed), main span catenary cables, and suspenders.
Terrain: Low-poly Marin Headlands and SF Peninsula.
Skyline: Procedural city blocks on the SF side.
Traffic: Up to 400 cars using InstancedMesh, positioned accurately on top of the deck (ensure vertical alignment prevents clipping into the concrete). Each car features emissive headlights (white) and taillights (red).
Ships: Procedural cargo ships with hull, containers, and functional navigation lights (Port/Starboard/Mast/Cabin) moving along the water.
Nature: Animated flocking birds.
Night Mode: At night, activate city lights, car headlights, ship navigation lights, tower beacons, street lights.

Tech  &  Controls:
Core: Must output only single HTML file golden_gate_bridge.html to be run in a blank Chrome tab. Import Three.js/Addons via CDN map.
Libs: three (Core library) via CDN (ES Modules); three/examples/jsm/... modules via Import Map.
Build: No build step (Vite/Webpack). Pure HTML/JS.
UI: Visually appealing sliders for Time (0-24h), Fog Density (0-100%), Traffic Density (0-100%), and Camera Zoom.
Optimization: InstancedMesh for all repetitive elements (cars, lights, birds).

Gemini 3 Pro 会理解对光照、GLSL 着色器和性能优化的具体要求,直接生成一个独立的 HTML 文件。

多模态开发:从草图到代码

如果想做一个视觉创意,Gemini 3 Pro 的多模态能力可以快速实现 UI 原型。只需将草图拖入终端,配合文字描述,它就能识别布局并生成代码。

实操案例:还原 赛博朋克 风格 UI

假设正在设计一个网络安全监控工具,需要独特的视觉风格。将线框图(@wireframe.png)拖入终端,并输入以下指令:

less 复制代码
Build a UI prototype for "CyberSentinel," a real-time network security monitor. The visual style should be gritty Cyberpunk: neon green and hot pink grid lines against a deep void background. Instead of typical charts, visualize data streams as cascading "digital rain" or glitch-art pillars. When hovering over a data node, a holographic, semi-transparent info card should pop up with glitch effects, styled using Tailwind CSS. I have a rough wireframe here to guide the layout: @wireframe.png.

模型不仅会还原线框图的结构,还会根据开发者对 "Cyberpunk"、"Digital Rain" 和 "Glitch effects" 的描述,编写对应的 CSS 动画和布局逻辑。

逆向工程:自动生成项目文档

Gemini 3 Pro 能够深入理解代码逻辑,而不仅仅是语法。这使得它非常适合为老旧项目或复杂的开源代码库补充文档。

实操案例:为无文档代码生成说明书

如果接手一个没有文档的项目时,可以让 Gemini 分析代码并生成结构化文档:

vbnet 复制代码
This is an undocumented application. Please read through the entire codebase to understand the logic first, then generate user documentation for me. The documentation should include: user interactions (command-line options, authentication, etc.), explanations of core concepts (such as MCP), an architectural overview, and how to contribute to the open-source project. Please ensure the format is clear and easy to read; do not just provide a simple HTML page.

跨服务联动:排查云端故障

Gemini 3 Pro 支持工具调用(Tool Use),可以根据你的指令制定多步骤计划,联动日志监控、安全扫描和代码库来解决复杂问题。

实操案例:排查 Cloud Run 服务延迟

当遇到线上性能问题时,它能化身为一个 SRE 助手:

csharp 复制代码
Users are reporting that the 'Save Changes' button is slow to respond. Please investigate the status of the 'tech-stack' service.

它会自动连接 Cloud Run 查看指标,调用 Snyk 等工具扫描潜在问题,并结合代码变更记录,最终给出根因分析甚至修复补丁。

总结

这些案例只是冰山一角。Gemini 3 Pro 的真正价值在于它能适应开发具体场景,无论是优化一行命令,还是构建一个完整的功能模块。

感兴趣可以升级体验。

相关推荐
YuMiao4 分钟前
WSL2 (Manjaro) 环境下 Google Antigravity AI服务网络连接与环境配置问题
ai编程
WLJT1231231238 分钟前
AI懂你,家更暖:重塑生活温度的智能家电新范式
人工智能·生活
roman_日积跬步-终至千里25 分钟前
【计算机视觉(16)】语义理解-训练神经网络1_激活_预处理_初始化_BN
人工智能·神经网络·计算机视觉
AI营销实验室26 分钟前
原圈科技AI CRM系统引领2025文旅行业智能升级新趋势
人工智能·科技
AI营销前沿28 分钟前
私域AI首倡者韩剑,原圈科技领航AI营销
大数据·人工智能
咚咚王者28 分钟前
人工智能之数学基础 概率论与统计:第一章 基础概念
人工智能·概率论
_Li.29 分钟前
机器学习-集成学习
人工智能·机器学习·集成学习
Percent_bigdata36 分钟前
数据治理平台选型解析:AI大模型与智能体如何重塑企业数字基座
大数据·人工智能
牛客企业服务37 分钟前
AI面试监考:破解在线面试作弊难题
人工智能·面试·职场和发展
yuhaiqun198940 分钟前
Typora 技能进阶:从会写 Markdown 到玩转配置 + 插件高效学习笔记
经验分享·笔记·python·学习·学习方法·ai编程·markdown