Gemini CLI
Traduzione: Copia tutti i comandi
Traduzione: Generare PDF
< >
Gemini CLI è l'agente AI open source di Google che fornisce l'accesso ai modelli Gemini direttamente nel terminale per la codifica, la creazione di contenuti, la risoluzione dei problemi e l'automazione del flusso di lavoro.
## Installazione e configurazione
| | Command | Description | |
| --- | --- |
| | `npm install -g @google/gemini-cli` | Install Gemini CLI globally | |
| | `gemini auth login` | Authenticate with Google account | |
| | `gemini auth status` | Check authentication status | |
| | `gemini config set model gemini-1.5-pro` | Set default model | |
| | `gemini config list` | Show current configuration | |
| | `gemini --version` | Display version information | |
| | `gemini --help` | Show help and available commands | |
## Uso di base
| | Command | Description | |
| --- | --- |
| | `gemini "Hello, world!"` | Simple text generation | |
| | `gemini chat` | Start interactive chat session | |
| | `gemini -f input.txt` | Process file input | |
| | `gemini -o output.txt "Generate code"` | Save output to file | |
| | `gemini --model gemini-1.5-flash "Quick task"` | Use specific model | |
| | `gemini --stream "Long response"` | Enable streaming output | |
## Operazioni di file
| | Command | Description | |
| --- | --- |
| | `gemini read file.txt` | Read and analyze file content | |
| | `gemini write file.txt "Content to write"` | Write content to file | |
| | `gemini edit file.txt "Make these changes"` | Edit existing file | |
| | `gemini analyze *.py` | Analyze multiple files | |
| | `gemini diff file1.txt file2.txt` | Compare two files | |
| | `gemini summarize document.pdf` | Summarize document content | |
## Codice di sviluppo
| | Command | Description | |
| --- | --- |
| | `gemini code "Create a Python function"` | Generate code | |
| | `gemini debug script.py` | Debug code issues | |
| | `gemini test app.js` | Generate test cases | |
| | `gemini refactor old_code.py` | Refactor existing code | |
| | `gemini explain complex_function.py` | Explain code functionality | |
| | `gemini optimize slow_script.py` | Optimize code performance | |
## Gestione dei progetti
| | Command | Description | |
| --- | --- |
| | `gemini init` | Initialize project with Gemini | |
| | `gemini project analyze` | Analyze entire project | |
| | `gemini project docs` | Generate project documentation | |
| | `gemini project structure` | Analyze project structure | |
| | `gemini project dependencies` | Analyze dependencies | |
| | `gemini project security` | Security analysis | |
## Integrazione Git
| | Command | Description | |
| --- | --- |
| | `gemini git commit` | Generate commit messages | |
| | `gemini git review` | Review code changes | |
| | `gemini git branch "feature description"` | Suggest branch names | |
| | `gemini git merge-conflicts` | Help resolve merge conflicts | |
| | `gemini git changelog` | Generate changelog | |
| | `gemini git pr-description` | Generate PR descriptions | |
## Strumenti integrati
### Strumenti di sistema di file
| | Command | Description | |
| --- | --- |
| | `gemini ls` | List directory contents with AI insights | |
| | `gemini find "search criteria"` | Intelligent file search | |
| | `gemini tree` | Display directory tree with analysis | |
| | `gemini size` | Analyze disk usage | |
| | `gemini clean` | Suggest cleanup actions | |
### Strumenti di sistema
| | Command | Description | |
| --- | --- |
| | `gemini ps` | Analyze running processes | |
| | `gemini top` | Monitor system resources | |
| | `gemini logs` | Analyze system logs | |
| | `gemini network` | Network diagnostics | |
| | `gemini disk` | Disk usage analysis | |
## Creazione di contenuti
| | Command | Description | |
| --- | --- |
| | `gemini blog "topic"` | Generate blog post | |
| | `gemini email "context"` | Draft email content | |
| | `gemini presentation "topic"` | Create presentation outline | |
| | `gemini report "data"` | Generate report | |
| | `gemini documentation "code"` | Create documentation | |
| | `gemini readme` | Generate README file | |
## Analisi dei dati
| | Command | Description | |
| --- | --- |
| | `gemini csv analyze data.csv` | Analyze CSV data | |
| | `gemini json parse data.json` | Parse and analyze JSON | |
| | `gemini logs analyze access.log` | Analyze log files | |
| | `gemini sql "database query"` | Generate SQL queries | |
| | `gemini chart data.csv` | Suggest data visualizations | |
## Configurazione
| | Command | Description | |
| --- | --- |
| | `gemini config set temperature 0.7` | Set model temperature | |
| | `gemini config set max-tokens 2048` | Set maximum tokens | |
| | `gemini config set model gemini-1.5-pro` | Set default model | |
| | `gemini config set output-format json` | Set output format | |
| | `gemini config reset` | Reset to default settings | |
| | `gemini config export config.json` | Export configuration | |
## Caratteristiche avanzate
### Ingresso multimodale
| | Command | Description | |
| --- | --- |
| | `gemini image analyze photo.jpg` | Analyze image content | |
| | `gemini image describe screenshot.png` | Describe image | |
| | `gemini video analyze video.mp4` | Analyze video content | |
| | `gemini audio transcribe audio.wav` | Transcribe audio | |
### Elaborazione batch
| | Command | Description | |
| --- | --- |
| | `gemini batch -f tasks.txt` | Process multiple tasks | |
| | `gemini parallel "task1" "task2" "task3"` | Run tasks in parallel | |
| | `gemini queue add "task"` | Add task to queue | |
| | `gemini queue process` | Process queued tasks | |
### Strumenti personalizzati
| | Command | Description | |
| --- | --- |
| | `gemini tools list` | List available tools | |
| | `gemini tools install tool-name` | Install custom tool | |
| | `gemini tools create my-tool` | Create custom tool | |
| | `gemini tools config tool-name` | Configure tool | |
## Automazione del flusso di lavoro
| | Command | Description | |
| --- | --- |
| | `gemini workflow create "name"` | Create new workflow | |
| | `gemini workflow run "name"` | Execute workflow | |
| | `gemini workflow list` | List available workflows | |
| | `gemini workflow edit "name"` | Edit workflow | |
| | `gemini schedule "0 9 * * *" "daily task"` | Schedule recurring task | |
## Esempi di integrazione
### Flusso di lavoro
| | Command | Description | |
| --- | --- |
| | `gemini dev setup` | Setup development environment | |
| | `gemini dev build` | Build project with AI assistance | |
| | `gemini dev deploy` | Deploy with AI guidance | |
| | `gemini dev monitor` | Monitor application | |
### Compiti DevOps
| | Command | Description | |
| --- | --- |
| | `gemini docker optimize Dockerfile` | Optimize Docker configuration | |
| | `gemini k8s analyze deployment.yaml` | Analyze Kubernetes configs | |
| | `gemini terraform plan` | Review Terraform plans | |
| | `gemini ci-cd optimize .github/workflows/` | Optimize CI/CD pipelines | |
## Selezione del modello
| | Command | Description | |
| --- | --- |
| | `gemini models list` | List available models | |
| | `gemini models info gemini-1.5-pro` | Get model information | |
| | `gemini --model gemini-1.5-flash "fast task"` | Use Flash model for speed | |
| | `gemini --model gemini-1.5-pro "complex task"` | Use Pro model for complexity | |
## Formati di uscita
| | Command | Description | |
| --- | --- |
| | `gemini --format json "data request"` | JSON output | |
| | `gemini --format markdown "documentation"` | Markdown output | |
| | `gemini --format code "programming task"` | Code-only output | |
| | `gemini --format table "structured data"` | Table format | |
## Gestione del contesto
| | Command | Description | |
| --- | --- |
| | `gemini context add file.txt` | Add file to context | |
| | `gemini context list` | Show current context | |
| | `gemini context clear` | Clear context | |
| | `gemini context save session.json` | Save context session | |
| | `gemini context load session.json` | Load context session | |
## Debug e Risoluzione dei problemi
| | Command | Description | |
| --- | --- |
| | `gemini --debug "command"` | Enable debug mode | |
| | `gemini --verbose "command"` | Verbose output | |
| | `gemini doctor` | Diagnose installation issues | |
| | `gemini logs show` | Show application logs | |
| | `gemini test connection` | Test API connectivity | |
## Variabili dell'ambiente
| | Variable | Description | |
| --- | --- |
| | `GEMINI_API_KEY` | Set API key | |
| | `GEMINI_MODEL` | Default model | |
| | `GEMINI_TEMPERATURE` | Default temperature | |
| | `GEMINI_MAX_TOKENS` | Default max tokens | |
| | `GEMINI_CONFIG_PATH` | Custom config path | |
## Migliori Pratiche
- Utilizzare richieste specifiche e chiare per ottenere risultati migliori
- Levare il contesto di 1 milione di token per grandi codebases
- Combinare più strumenti per flussi di lavoro complessi
- Salvare i comandi usati frequentemente come alias
- Utilizzare lo streaming per le attività di lungo periodo
- Aggiornamento regolare per ottenere le ultime funzionalità
- Configurare un modello appropriato basato sulla complessità delle attività
- Utilizzare la gestione del contesto per le attività multi-step
- Attuazione corretta gestione degli errori nei flussi di lavoro
- Monitorare l'utilizzo e i costi API
## Casi di uso comune
### Codice recensione
Traduzione:
### Generazione di documenti
Traduzione:
### Indagine su bug
Traduzione:
### Configurazione del progetto
Traduzione: