Envark includes a powerful AI assistant that provides intelligent analysis, security recommendations, and environment configuration generation. The AI can use OpenAI, Anthropic Claude, Google Gemini, or local Ollama models.
AI commands are only available in interactive TUI mode (envark -i).
Alternatively, set environment variables instead of using /config:
.env
# OpenAI (highest priority)OPENAI_API_KEY=sk-proj-...# Anthropic Claude (if OpenAI not set)ANTHROPIC_API_KEY=sk-ant-...# Google Gemini (if OpenAI/Anthropic not set)GEMINI_API_KEY=AIza...# orGOOGLE_API_KEY=AIza...# Ollama model (fallback if no API keys set)OLLAMA_MODEL=llama3.2
❯ /ask What are best practices for storing database URLs?❯ /ask How should I handle API keys in production?❯ /ask What's the difference between .env and .env.local?❯ /ask Should I commit .env.example to git?
Response format:
Markdown-formatted answer with:
Explanations
Code examples
Security recommendations
Best practices
Example response:
**Best Practices for Database URLs:**1. **Never commit database credentials** - Add `.env` to `.gitignore` - Use `.env.example` with placeholder values2. **Use connection pooling** ```typescript const pool = new Pool({ connectionString: process.env.DATABASE_URL, max: 20 })
Production considerations
Use SSL/TLS: ?sslmode=require
Set connection timeouts
Enable connection pooling
…
---### /analyzeRun AI-powered security analysis on your project.```bash/analyze
Aliases:anAnalysis includes:
Security vulnerability assessment
Missing critical variables
Hardcoded secrets detection
Configuration improvement suggestions
Environment-specific recommendations
Example:
❯ /analyze# or❯ an
Output:
## Security Analysis### Critical Issues (2)1. **JWT_SECRET missing** - Used in: src/auth/jwt.ts, src/middleware/auth.ts - Risk: Authentication will fail in production - Recommendation: Generate strong secret with `openssl rand -base64 32`2. **DATABASE_URL has no fallback** - Used in: src/db/client.ts - Risk: Application will crash if not set - Recommendation: Add validation at startup### Recommendations- Move API keys from .env to secure vault (AWS Secrets Manager, etc.)- Add .env.example for documentation- Implement environment validation at startup- Use different secrets per environment
Execution time: 5-15 seconds depending on project size and model.
❯ /suggest API_KEY❯ /suggest DB_URL❯ /suggest PORT
Example output:
## Suggestions for API_KEY### Naming- Consider more specific name: `STRIPE_API_KEY` or `OPENAI_API_KEY`- Use consistent prefix for related keys: `STRIPE_SECRET_KEY`, `STRIPE_PUBLIC_KEY`### Security- Ensure this is in `.gitignore`- Rotate keys regularly (every 90 days)- Use different keys per environment- Consider key management service (AWS KMS, HashiCorp Vault)### Related Variables- `API_BASE_URL` - Base URL for API- `API_TIMEOUT` - Request timeout in ms- `API_RETRY_ATTEMPTS` - Number of retries
## NODE_ENV### PurposeControls the application's runtime environment and enables/disables certain features.### Common Values- `development` - Local development with hot reload, verbose logging- `production` - Production deployment with optimizations- `test` - Running test suites- `staging` - Pre-production testing environment### Security Classification**Not sensitive** - Safe to commit in documentation### Usage Patterns**Express.js:**```javascriptif (process.env.NODE_ENV === 'production') { app.use(compression())}
Vite:
if (import.meta.env.MODE === 'production') { // Production-only code}
❯ /ask How do environment variables work in Docker?[AI response appears word-by-word in real-time]Environment variables in Docker can be set in multiple ways:1. **Dockerfile ENV instruction** ```dockerfile ENV NODE_ENV=production
…
**Benefits:**- See response as it's generated- Lower perceived latency- Can interrupt long responses---### Context AwarenessThe AI has context about your project:```bash❯ scan# AI sees that you have 24 env vars, 3 missing❯ /ask What should I fix first?# AI response considers your specific project stateBased on your scan results, you should prioritize:1. **Define the 3 missing variables** (will cause crashes) - JWT_SECRET - DATABASE_URL - REDIS_URL...
❯ /suggest API_KEY# AI analyzes variable name and usage patterns# Returns risk assessment with explanationRisk Level: HIGHExplanation:- Generic name "API_KEY" could refer to any API- Used in 5 different files- No indication of environment-specific valuesRecommendations:- Use specific names: STRIPE_API_KEY, OPENAI_API_KEY- Implement key rotation- Add validation at application startup