在 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 的真正价值在于它能适应开发具体场景,无论是优化一行命令,还是构建一个完整的功能模块。

感兴趣可以升级体验。

相关推荐
孟健3 小时前
用OpenClaw给12个AI下属定KPI,它们自己复盘、迭代、进化
ai编程
IT_陈寒3 小时前
React状态管理终极对决:Redux vs Context API谁更胜一筹?
前端·人工智能·后端
蝎子莱莱爱打怪4 小时前
OpenClaw 从零配置指南:接入飞书 + 常用命令 + 原理图解
java·后端·ai编程
MaXiaoTiao11054 小时前
OpenCode配置详细教程(Windows版)
ai编程
Kagol4 小时前
TinyVue 支持 Skills 啦!现在你可以让 AI 使用 TinyVue 组件搭建项目
前端·agent·ai编程
舒一笑5 小时前
如何获取最新的技术趋势和热门技术
人工智能·程序员
聚客AI5 小时前
🎉OpenClaw深度解析:多智能体协同的三种模式、四大必装技能与自动化运维秘籍
人工智能·开源·agent
黄粱梦醒5 小时前
大模型企业级部署方案-vllm
人工智能·llm
李广坤5 小时前
使用 Skills 的技巧与规范
ai编程
IT_陈寒5 小时前
JavaScript代码效率提升50%?这5个优化技巧你必须知道!
前端·人工智能·后端