@vfarcic/dot-ai 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/context-load.md +11 -0
- package/.claude/commands/context-save.md +16 -0
- package/.claude/commands/prd-done.md +115 -0
- package/.claude/commands/prd-get.md +25 -0
- package/.claude/commands/prd-start.md +87 -0
- package/.claude/commands/task-done.md +77 -0
- package/.claude/commands/tests-reminder.md +32 -0
- package/.claude/settings.local.json +20 -0
- package/.eslintrc.json +25 -0
- package/.github/workflows/ci.yml +170 -0
- package/.prettierrc.json +10 -0
- package/.teller.yml +8 -0
- package/CLAUDE.md +162 -0
- package/assets/images/logo.png +0 -0
- package/bin/dot-ai.ts +47 -0
- package/destroy.sh +45 -0
- package/devbox.json +13 -0
- package/devbox.lock +225 -0
- package/docs/API.md +449 -0
- package/docs/CONTEXT.md +49 -0
- package/docs/DEVELOPMENT.md +203 -0
- package/docs/NEXT_STEPS.md +97 -0
- package/docs/STAGE_BASED_API.md +97 -0
- package/docs/cli-guide.md +798 -0
- package/docs/design.md +750 -0
- package/docs/discovery-engine.md +515 -0
- package/docs/error-handling.md +429 -0
- package/docs/function-registration.md +157 -0
- package/docs/mcp-guide.md +416 -0
- package/package.json +2 -121
- package/renovate.json +51 -0
- package/setup.sh +111 -0
- package/{dist/cli.js → src/cli.ts} +26 -19
- package/src/core/claude.ts +280 -0
- package/src/core/deploy-operation.ts +127 -0
- package/src/core/discovery.ts +900 -0
- package/src/core/error-handling.ts +562 -0
- package/src/core/index.ts +143 -0
- package/src/core/kubernetes-utils.ts +218 -0
- package/src/core/memory.ts +148 -0
- package/src/core/schema.ts +830 -0
- package/src/core/session-utils.ts +97 -0
- package/src/core/workflow.ts +234 -0
- package/src/index.ts +18 -0
- package/src/interfaces/cli.ts +872 -0
- package/src/interfaces/mcp.ts +183 -0
- package/src/mcp/server.ts +131 -0
- package/src/tools/answer-question.ts +807 -0
- package/src/tools/choose-solution.ts +169 -0
- package/src/tools/deploy-manifests.ts +94 -0
- package/src/tools/generate-manifests.ts +502 -0
- package/src/tools/index.ts +41 -0
- package/src/tools/recommend.ts +370 -0
- package/tests/__mocks__/@kubernetes/client-node.ts +106 -0
- package/tests/build-system.test.ts +345 -0
- package/tests/configuration.test.ts +226 -0
- package/tests/core/deploy-operation.test.ts +38 -0
- package/tests/core/discovery.test.ts +1648 -0
- package/tests/core/error-handling.test.ts +632 -0
- package/tests/core/schema.test.ts +1658 -0
- package/tests/core/session-utils.test.ts +245 -0
- package/tests/core.test.ts +439 -0
- package/tests/fixtures/configmap-no-labels.yaml +8 -0
- package/tests/fixtures/crossplane-app-configuration.yaml +6 -0
- package/tests/fixtures/crossplane-providers.yaml +45 -0
- package/tests/fixtures/crossplane-rbac.yaml +48 -0
- package/tests/fixtures/invalid-configmap.yaml +8 -0
- package/tests/fixtures/invalid-deployment.yaml +17 -0
- package/tests/fixtures/test-deployment.yaml +28 -0
- package/tests/fixtures/valid-configmap.yaml +15 -0
- package/tests/infrastructure.test.ts +426 -0
- package/tests/interfaces/cli.test.ts +1036 -0
- package/tests/interfaces/mcp.test.ts +139 -0
- package/tests/kubernetes-utils.test.ts +200 -0
- package/tests/mcp/server.test.ts +126 -0
- package/tests/setup.ts +31 -0
- package/tests/tools/answer-question.test.ts +367 -0
- package/tests/tools/choose-solution.test.ts +481 -0
- package/tests/tools/deploy-manifests.test.ts +185 -0
- package/tests/tools/generate-manifests.test.ts +441 -0
- package/tests/tools/index.test.ts +111 -0
- package/tests/tools/recommend.test.ts +180 -0
- package/tsconfig.json +34 -0
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/core/claude.d.ts +0 -42
- package/dist/core/claude.d.ts.map +0 -1
- package/dist/core/claude.js +0 -229
- package/dist/core/deploy-operation.d.ts +0 -38
- package/dist/core/deploy-operation.d.ts.map +0 -1
- package/dist/core/deploy-operation.js +0 -101
- package/dist/core/discovery.d.ts +0 -162
- package/dist/core/discovery.d.ts.map +0 -1
- package/dist/core/discovery.js +0 -758
- package/dist/core/error-handling.d.ts +0 -167
- package/dist/core/error-handling.d.ts.map +0 -1
- package/dist/core/error-handling.js +0 -399
- package/dist/core/index.d.ts +0 -42
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -123
- package/dist/core/kubernetes-utils.d.ts +0 -38
- package/dist/core/kubernetes-utils.d.ts.map +0 -1
- package/dist/core/kubernetes-utils.js +0 -177
- package/dist/core/memory.d.ts +0 -45
- package/dist/core/memory.d.ts.map +0 -1
- package/dist/core/memory.js +0 -113
- package/dist/core/schema.d.ts +0 -187
- package/dist/core/schema.d.ts.map +0 -1
- package/dist/core/schema.js +0 -655
- package/dist/core/session-utils.d.ts +0 -29
- package/dist/core/session-utils.d.ts.map +0 -1
- package/dist/core/session-utils.js +0 -121
- package/dist/core/workflow.d.ts +0 -70
- package/dist/core/workflow.d.ts.map +0 -1
- package/dist/core/workflow.js +0 -161
- package/dist/index.d.ts +0 -15
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -32
- package/dist/interfaces/cli.d.ts +0 -74
- package/dist/interfaces/cli.d.ts.map +0 -1
- package/dist/interfaces/cli.js +0 -769
- package/dist/interfaces/mcp.d.ts +0 -30
- package/dist/interfaces/mcp.d.ts.map +0 -1
- package/dist/interfaces/mcp.js +0 -105
- package/dist/mcp/server.d.ts +0 -9
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -151
- package/dist/tools/answer-question.d.ts +0 -27
- package/dist/tools/answer-question.d.ts.map +0 -1
- package/dist/tools/answer-question.js +0 -696
- package/dist/tools/choose-solution.d.ts +0 -23
- package/dist/tools/choose-solution.d.ts.map +0 -1
- package/dist/tools/choose-solution.js +0 -171
- package/dist/tools/deploy-manifests.d.ts +0 -25
- package/dist/tools/deploy-manifests.d.ts.map +0 -1
- package/dist/tools/deploy-manifests.js +0 -74
- package/dist/tools/generate-manifests.d.ts +0 -23
- package/dist/tools/generate-manifests.d.ts.map +0 -1
- package/dist/tools/generate-manifests.js +0 -424
- package/dist/tools/index.d.ts +0 -11
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -34
- package/dist/tools/recommend.d.ts +0 -23
- package/dist/tools/recommend.d.ts.map +0 -1
- package/dist/tools/recommend.js +0 -332
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
# DevOps AI Toolkit CLI Guide
|
|
2
|
+
|
|
3
|
+
**Complete command-line interface guide for DevOps AI Toolkit - AI-powered Kubernetes deployment recommendations.**
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Core Workflow](#core-workflow)
|
|
10
|
+
- [Command Reference](#command-reference)
|
|
11
|
+
- [Workflow Examples](#workflow-examples)
|
|
12
|
+
- [Configuration](#configuration)
|
|
13
|
+
- [Troubleshooting](#troubleshooting)
|
|
14
|
+
- [Advanced Usage](#advanced-usage)
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
19
|
+
- **Node.js 18+** and **kubectl** configured with cluster access
|
|
20
|
+
- **Claude API key** (required for AI recommendations)
|
|
21
|
+
|
|
22
|
+
### Installation
|
|
23
|
+
|
|
24
|
+
**Recommended Method: Global Install**
|
|
25
|
+
```bash
|
|
26
|
+
# Install globally from npm
|
|
27
|
+
npm install -g @vfarcic/dot-ai
|
|
28
|
+
|
|
29
|
+
# Required: Set up Claude API key
|
|
30
|
+
export ANTHROPIC_API_KEY=your_api_key_here
|
|
31
|
+
|
|
32
|
+
# Verify installation
|
|
33
|
+
dot-ai --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Basic Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 1. Get AI recommendations for your deployment
|
|
40
|
+
dot-ai recommend --intent "deploy a web application" --session-dir ./tmp
|
|
41
|
+
|
|
42
|
+
# 2. Choose a solution from the recommendations
|
|
43
|
+
dot-ai choose-solution --solution-id sol_xxx --session-dir ./tmp
|
|
44
|
+
|
|
45
|
+
# 3. Configure step-by-step with guided questions
|
|
46
|
+
dot-ai answer-question --solution-id sol_xxx --stage required --answers '{"name":"myapp"}' --session-dir ./tmp
|
|
47
|
+
|
|
48
|
+
# 4. Generate and deploy manifests
|
|
49
|
+
dot-ai generate-manifests --solution-id sol_xxx --session-dir ./tmp
|
|
50
|
+
dot-ai deploy-manifests --solution-id sol_xxx --session-dir ./tmp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### From Source (Current)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Clone the repository
|
|
59
|
+
git clone https://github.com/vfarcic/dot-ai.git
|
|
60
|
+
cd dot-ai
|
|
61
|
+
|
|
62
|
+
# Install dependencies and build
|
|
63
|
+
npm install
|
|
64
|
+
npm run build
|
|
65
|
+
|
|
66
|
+
# Verify installation
|
|
67
|
+
dot-ai --help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Environment Setup
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Required: Claude API key for AI recommendations
|
|
74
|
+
export ANTHROPIC_API_KEY=your_api_key_here
|
|
75
|
+
|
|
76
|
+
# Optional: Custom kubeconfig location
|
|
77
|
+
export KUBECONFIG=/path/to/your/kubeconfig.yaml
|
|
78
|
+
|
|
79
|
+
# Verify cluster access
|
|
80
|
+
kubectl cluster-info
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Shell Integration (Optional)
|
|
84
|
+
|
|
85
|
+
Add to your `.bashrc` or `.zshrc` for convenience:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Create alias for easier usage
|
|
89
|
+
alias dot-ai='node /path/to/dot-ai/dist/cli.js'
|
|
90
|
+
|
|
91
|
+
# Add to PATH (after npm global install becomes available)
|
|
92
|
+
export PATH="$PATH:/path/to/dot-ai/dist"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Core Workflow
|
|
96
|
+
|
|
97
|
+
DevOps AI Toolkit uses a **stage-based workflow** that guides you through deployment configuration:
|
|
98
|
+
|
|
99
|
+
### 1. Intent → Recommendations
|
|
100
|
+
Describe what you want to deploy and get AI-powered recommendations based on your cluster capabilities.
|
|
101
|
+
|
|
102
|
+
### 2. Solution Selection
|
|
103
|
+
Choose the best solution from ranked recommendations with detailed explanations.
|
|
104
|
+
|
|
105
|
+
### 3. Step-by-Step Configuration
|
|
106
|
+
Answer configuration questions through multiple stages:
|
|
107
|
+
- **Required**: Essential settings (app name, image, etc.)
|
|
108
|
+
- **Basic**: Common options (namespace, replicas, etc.)
|
|
109
|
+
- **Advanced**: Fine-tuning (resource limits, security contexts, etc.)
|
|
110
|
+
- **Open**: Free-form requirements and customizations
|
|
111
|
+
|
|
112
|
+
### 4. Manifest Generation
|
|
113
|
+
AI generates optimized Kubernetes manifests based on your configuration.
|
|
114
|
+
|
|
115
|
+
### 5. Deployment
|
|
116
|
+
Deploy manifests to your cluster with readiness verification.
|
|
117
|
+
|
|
118
|
+
## Command Reference
|
|
119
|
+
|
|
120
|
+
### AI-Powered Workflow Commands
|
|
121
|
+
|
|
122
|
+
#### `recommend`
|
|
123
|
+
Get AI-powered deployment recommendations based on your cluster capabilities.
|
|
124
|
+
|
|
125
|
+
**Usage:**
|
|
126
|
+
```bash
|
|
127
|
+
dot-ai recommend --intent "DESCRIPTION" --session-dir ./tmp [OPTIONS]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Required Arguments:**
|
|
131
|
+
- `--intent "DESCRIPTION"`: Describe what you want to deploy
|
|
132
|
+
|
|
133
|
+
**Required Options:**
|
|
134
|
+
- `--session-dir PATH`: Directory to store solution files
|
|
135
|
+
|
|
136
|
+
**Optional:**
|
|
137
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
138
|
+
- `--verbose`: Enable verbose output
|
|
139
|
+
- `--output-file PATH`: Write output to file
|
|
140
|
+
|
|
141
|
+
**Examples:**
|
|
142
|
+
```bash
|
|
143
|
+
# Simple web application
|
|
144
|
+
dot-ai recommend --intent "deploy a web application" --session-dir ./tmp
|
|
145
|
+
|
|
146
|
+
# Application with specific requirements
|
|
147
|
+
dot-ai recommend --intent "deploy a Node.js API with PostgreSQL database" --session-dir ./tmp
|
|
148
|
+
|
|
149
|
+
# Microservice with scaling requirements
|
|
150
|
+
dot-ai recommend --intent "deploy a microservice that can auto-scale" --session-dir ./tmp
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### `choose-solution`
|
|
154
|
+
Select a specific solution and get its configuration questions.
|
|
155
|
+
|
|
156
|
+
**Usage:**
|
|
157
|
+
```bash
|
|
158
|
+
dot-ai choose-solution --solution-id ID --session-dir PATH [OPTIONS]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Required Arguments:**
|
|
162
|
+
- `--solution-id ID`: Solution ID from recommend command (e.g., sol_2025-01-01T123456_abcdef)
|
|
163
|
+
- `--session-dir PATH`: Session directory containing solution files
|
|
164
|
+
|
|
165
|
+
**Optional:**
|
|
166
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
167
|
+
|
|
168
|
+
**Example:**
|
|
169
|
+
```bash
|
|
170
|
+
dot-ai choose-solution --solution-id sol_2025-01-01T123456_abcdef --session-dir ./tmp
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### `answer-question`
|
|
174
|
+
Provide answers to configuration questions for your chosen solution.
|
|
175
|
+
|
|
176
|
+
**Usage:**
|
|
177
|
+
```bash
|
|
178
|
+
dot-ai answer-question --solution-id ID --session-dir PATH --stage STAGE --answers JSON [OPTIONS]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Required Arguments:**
|
|
182
|
+
- `--solution-id ID`: Solution ID
|
|
183
|
+
- `--session-dir PATH`: Session directory path
|
|
184
|
+
- `--stage STAGE`: Question stage (required|basic|advanced|open)
|
|
185
|
+
- `--answers JSON`: Configuration answers as JSON object
|
|
186
|
+
|
|
187
|
+
**Optional:**
|
|
188
|
+
- `--done`: Mark as final answer for open stage
|
|
189
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
190
|
+
|
|
191
|
+
**Examples:**
|
|
192
|
+
```bash
|
|
193
|
+
# Required stage
|
|
194
|
+
dot-ai answer-question \
|
|
195
|
+
--solution-id sol_xxx \
|
|
196
|
+
--session-dir ./tmp \
|
|
197
|
+
--stage required \
|
|
198
|
+
--answers '{"name":"myapp","image":"nginx:latest","port":80}'
|
|
199
|
+
|
|
200
|
+
# Basic stage
|
|
201
|
+
dot-ai answer-question \
|
|
202
|
+
--solution-id sol_xxx \
|
|
203
|
+
--session-dir ./tmp \
|
|
204
|
+
--stage basic \
|
|
205
|
+
--answers '{"namespace":"production","replicas":3}'
|
|
206
|
+
|
|
207
|
+
# Advanced stage
|
|
208
|
+
dot-ai answer-question \
|
|
209
|
+
--solution-id sol_xxx \
|
|
210
|
+
--session-dir ./tmp \
|
|
211
|
+
--stage advanced \
|
|
212
|
+
--answers '{"resourceLimits":true,"securityContext":true}'
|
|
213
|
+
|
|
214
|
+
# Open stage (final step)
|
|
215
|
+
dot-ai answer-question \
|
|
216
|
+
--solution-id sol_xxx \
|
|
217
|
+
--session-dir ./tmp \
|
|
218
|
+
--stage open \
|
|
219
|
+
--answers '{"open":"Need high availability and monitoring"}' \
|
|
220
|
+
--done
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### `generate-manifests`
|
|
224
|
+
Generate final Kubernetes manifests from your configured solution.
|
|
225
|
+
|
|
226
|
+
**Usage:**
|
|
227
|
+
```bash
|
|
228
|
+
dot-ai generate-manifests --solution-id ID --session-dir PATH [OPTIONS]
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Required Arguments:**
|
|
232
|
+
- `--solution-id ID`: Fully configured solution ID
|
|
233
|
+
- `--session-dir PATH`: Session directory containing solution files
|
|
234
|
+
|
|
235
|
+
**Example:**
|
|
236
|
+
```bash
|
|
237
|
+
dot-ai generate-manifests --solution-id sol_xxx --session-dir ./tmp
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### `deploy-manifests`
|
|
241
|
+
Deploy the generated manifests to your Kubernetes cluster.
|
|
242
|
+
|
|
243
|
+
**Usage:**
|
|
244
|
+
```bash
|
|
245
|
+
dot-ai deploy-manifests --solution-id ID --session-dir PATH [OPTIONS]
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Required Arguments:**
|
|
249
|
+
- `--solution-id ID`: Solution ID with generated manifests
|
|
250
|
+
- `--session-dir PATH`: Session directory path
|
|
251
|
+
|
|
252
|
+
**Optional:**
|
|
253
|
+
- `--timeout SECONDS`: Deployment timeout in seconds (default: 30)
|
|
254
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
255
|
+
|
|
256
|
+
**Examples:**
|
|
257
|
+
```bash
|
|
258
|
+
# Deploy with default timeout
|
|
259
|
+
dot-ai deploy-manifests --solution-id sol_xxx --session-dir ./tmp
|
|
260
|
+
|
|
261
|
+
# Deploy with custom timeout
|
|
262
|
+
dot-ai deploy-manifests --solution-id sol_xxx --session-dir ./tmp --timeout 60
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Utility Commands
|
|
266
|
+
|
|
267
|
+
#### `status`
|
|
268
|
+
Check deployment status and workflow information.
|
|
269
|
+
|
|
270
|
+
**Usage:**
|
|
271
|
+
```bash
|
|
272
|
+
dot-ai status [OPTIONS]
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Optional:**
|
|
276
|
+
- `--deployment ID`: Specific deployment/workflow ID to check
|
|
277
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
278
|
+
|
|
279
|
+
**Example:**
|
|
280
|
+
```bash
|
|
281
|
+
dot-ai status --deployment workflow-123
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### `learn`
|
|
285
|
+
Show learned deployment patterns and recommendations from previous deployments.
|
|
286
|
+
|
|
287
|
+
**Usage:**
|
|
288
|
+
```bash
|
|
289
|
+
dot-ai learn [OPTIONS]
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Optional:**
|
|
293
|
+
- `--pattern TYPE`: Filter by pattern type
|
|
294
|
+
- `--output FORMAT`: Output format (json|yaml|table, default: json)
|
|
295
|
+
|
|
296
|
+
**Examples:**
|
|
297
|
+
```bash
|
|
298
|
+
# Show all learned patterns
|
|
299
|
+
dot-ai learn
|
|
300
|
+
|
|
301
|
+
# Show specific pattern type
|
|
302
|
+
dot-ai learn --pattern deployment
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Global Options
|
|
306
|
+
|
|
307
|
+
These options work with all commands:
|
|
308
|
+
|
|
309
|
+
- `--kubeconfig PATH`: Path to kubeconfig file (overrides KUBECONFIG env var)
|
|
310
|
+
- `--verbose`: Enable verbose output globally
|
|
311
|
+
- `--output-file PATH`: Write clean formatted output to file
|
|
312
|
+
- `--quiet`: Suppress tool registration and info logs
|
|
313
|
+
|
|
314
|
+
## Workflow Examples
|
|
315
|
+
|
|
316
|
+
### Example 1: Simple Web Application
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# 1. Get recommendations
|
|
320
|
+
dot-ai recommend \
|
|
321
|
+
--intent "deploy an nginx web server" \
|
|
322
|
+
--session-dir ./sessions
|
|
323
|
+
|
|
324
|
+
# Output shows available solutions with scores:
|
|
325
|
+
# Solution 1: Kubernetes Deployment + Service (Score: 95)
|
|
326
|
+
# Solution 2: Pod + Service (Score: 80)
|
|
327
|
+
# etc.
|
|
328
|
+
|
|
329
|
+
# 2. Choose the best solution
|
|
330
|
+
dot-ai choose-solution \
|
|
331
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
332
|
+
--session-dir ./sessions
|
|
333
|
+
|
|
334
|
+
# Output shows configuration questions grouped by stage
|
|
335
|
+
|
|
336
|
+
# 3. Answer required questions
|
|
337
|
+
dot-ai answer-question \
|
|
338
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
339
|
+
--session-dir ./sessions \
|
|
340
|
+
--stage required \
|
|
341
|
+
--answers '{"name":"my-nginx","image":"nginx:latest","port":80}'
|
|
342
|
+
|
|
343
|
+
# 4. Answer basic questions
|
|
344
|
+
dot-ai answer-question \
|
|
345
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
346
|
+
--session-dir ./sessions \
|
|
347
|
+
--stage basic \
|
|
348
|
+
--answers '{"namespace":"default","replicas":2}'
|
|
349
|
+
|
|
350
|
+
# 5. Skip advanced questions (or answer them)
|
|
351
|
+
dot-ai answer-question \
|
|
352
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
353
|
+
--session-dir ./sessions \
|
|
354
|
+
--stage advanced \
|
|
355
|
+
--answers '{}'
|
|
356
|
+
|
|
357
|
+
# 6. Final open question
|
|
358
|
+
dot-ai answer-question \
|
|
359
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
360
|
+
--session-dir ./sessions \
|
|
361
|
+
--stage open \
|
|
362
|
+
--answers '{"open":"Standard configuration is fine"}' \
|
|
363
|
+
--done
|
|
364
|
+
|
|
365
|
+
# 7. Generate manifests
|
|
366
|
+
dot-ai generate-manifests \
|
|
367
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
368
|
+
--session-dir ./sessions
|
|
369
|
+
|
|
370
|
+
# 8. Deploy to cluster
|
|
371
|
+
dot-ai deploy-manifests \
|
|
372
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
373
|
+
--session-dir ./sessions
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Example 2: Full-Stack Application
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# 1. Get recommendations for complex application
|
|
380
|
+
dot-ai recommend \
|
|
381
|
+
--intent "deploy a React frontend with Node.js API and PostgreSQL database" \
|
|
382
|
+
--session-dir ./fullstack
|
|
383
|
+
|
|
384
|
+
# 2. Choose solution (likely multiple resources)
|
|
385
|
+
dot-ai choose-solution \
|
|
386
|
+
--solution-id sol_xxx \
|
|
387
|
+
--session-dir ./fullstack
|
|
388
|
+
|
|
389
|
+
# 3. Configure each component
|
|
390
|
+
# Frontend configuration
|
|
391
|
+
dot-ai answer-question \
|
|
392
|
+
--solution-id sol_xxx \
|
|
393
|
+
--session-dir ./fullstack \
|
|
394
|
+
--stage required \
|
|
395
|
+
--answers '{
|
|
396
|
+
"frontend_name": "my-react-app",
|
|
397
|
+
"frontend_image": "my-app:frontend-v1.0",
|
|
398
|
+
"frontend_port": 3000,
|
|
399
|
+
"api_name": "my-api",
|
|
400
|
+
"api_image": "my-app:api-v1.0",
|
|
401
|
+
"api_port": 4000,
|
|
402
|
+
"database_name": "my-postgres"
|
|
403
|
+
}'
|
|
404
|
+
|
|
405
|
+
# Database configuration
|
|
406
|
+
dot-ai answer-question \
|
|
407
|
+
--solution-id sol_xxx \
|
|
408
|
+
--session-dir ./fullstack \
|
|
409
|
+
--stage basic \
|
|
410
|
+
--answers '{
|
|
411
|
+
"namespace": "production",
|
|
412
|
+
"frontend_replicas": 3,
|
|
413
|
+
"api_replicas": 2,
|
|
414
|
+
"database_storage": "20Gi"
|
|
415
|
+
}'
|
|
416
|
+
|
|
417
|
+
# Advanced settings
|
|
418
|
+
dot-ai answer-question \
|
|
419
|
+
--solution-id sol_xxx \
|
|
420
|
+
--session-dir ./fullstack \
|
|
421
|
+
--stage advanced \
|
|
422
|
+
--answers '{
|
|
423
|
+
"enable_ingress": true,
|
|
424
|
+
"enable_tls": true,
|
|
425
|
+
"resource_limits": true,
|
|
426
|
+
"horizontal_scaling": true
|
|
427
|
+
}'
|
|
428
|
+
|
|
429
|
+
# Final requirements
|
|
430
|
+
dot-ai answer-question \
|
|
431
|
+
--solution-id sol_xxx \
|
|
432
|
+
--session-dir ./fullstack \
|
|
433
|
+
--stage open \
|
|
434
|
+
--answers '{"open": "Need monitoring and backup for database"}' \
|
|
435
|
+
--done
|
|
436
|
+
|
|
437
|
+
# Generate and deploy
|
|
438
|
+
dot-ai generate-manifests --solution-id sol_xxx --session-dir ./fullstack
|
|
439
|
+
dot-ai deploy-manifests --solution-id sol_xxx --session-dir ./fullstack
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Example 3: Using Output Formats
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Get recommendations in table format
|
|
446
|
+
dot-ai recommend \
|
|
447
|
+
--intent "deploy Redis cache" \
|
|
448
|
+
--session-dir ./redis \
|
|
449
|
+
--output table
|
|
450
|
+
|
|
451
|
+
# Save results to file
|
|
452
|
+
dot-ai recommend \
|
|
453
|
+
--intent "deploy Redis cache" \
|
|
454
|
+
--session-dir ./redis \
|
|
455
|
+
--output yaml \
|
|
456
|
+
--output-file ./redis-recommendations.yaml
|
|
457
|
+
|
|
458
|
+
# Check status with verbose output
|
|
459
|
+
dot-ai status --verbose --output table
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## Configuration
|
|
463
|
+
|
|
464
|
+
### Kubeconfig Management
|
|
465
|
+
|
|
466
|
+
DevOps AI Toolkit automatically finds your kubeconfig file in this order:
|
|
467
|
+
|
|
468
|
+
1. **Command line flag**: `--kubeconfig /path/to/config`
|
|
469
|
+
2. **Environment variable**: `KUBECONFIG=/path/to/config`
|
|
470
|
+
3. **Default location**: `~/.kube/config`
|
|
471
|
+
|
|
472
|
+
**Examples:**
|
|
473
|
+
```bash
|
|
474
|
+
# Use specific kubeconfig
|
|
475
|
+
dot-ai recommend \
|
|
476
|
+
--intent "deploy app" \
|
|
477
|
+
--session-dir ./tmp \
|
|
478
|
+
--kubeconfig ./clusters/production.yaml
|
|
479
|
+
|
|
480
|
+
# Set environment variable
|
|
481
|
+
export KUBECONFIG=./clusters/staging.yaml
|
|
482
|
+
dot-ai recommend --intent "deploy app" --session-dir ./tmp
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Session Directory Management
|
|
486
|
+
|
|
487
|
+
**Project-specific sessions:**
|
|
488
|
+
```bash
|
|
489
|
+
mkdir -p ./deployments/sessions
|
|
490
|
+
dot-ai recommend \
|
|
491
|
+
--intent "deploy app" \
|
|
492
|
+
--session-dir ./deployments/sessions
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Shared sessions:**
|
|
496
|
+
```bash
|
|
497
|
+
mkdir -p ~/.dot-ai/sessions
|
|
498
|
+
dot-ai recommend \
|
|
499
|
+
--intent "deploy app" \
|
|
500
|
+
--session-dir ~/.dot-ai/sessions
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Session directory structure:**
|
|
504
|
+
```
|
|
505
|
+
sessions/
|
|
506
|
+
├── sol_2025-01-01T123456_abcdef/
|
|
507
|
+
│ ├── solution.json # Solution configuration
|
|
508
|
+
│ ├── questions.json # Question responses
|
|
509
|
+
│ ├── manifest.yaml # Generated manifests
|
|
510
|
+
│ └── metadata.json # Deployment metadata
|
|
511
|
+
└── sol_2025-01-01T789012_fedcba/
|
|
512
|
+
└── ...
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### API Keys
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
# Required for AI recommendations
|
|
519
|
+
export ANTHROPIC_API_KEY=your_api_key_here
|
|
520
|
+
|
|
521
|
+
# Verify API key is accessible
|
|
522
|
+
echo $ANTHROPIC_API_KEY
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
## Troubleshooting
|
|
526
|
+
|
|
527
|
+
### Common Issues
|
|
528
|
+
|
|
529
|
+
#### Command Not Found
|
|
530
|
+
|
|
531
|
+
**Symptoms:**
|
|
532
|
+
- `dot-ai: command not found`
|
|
533
|
+
- `node: No such file or directory`
|
|
534
|
+
|
|
535
|
+
**Solutions:**
|
|
536
|
+
```bash
|
|
537
|
+
# Verify Node.js installation
|
|
538
|
+
node --version
|
|
539
|
+
npm --version
|
|
540
|
+
|
|
541
|
+
# Use full path if needed
|
|
542
|
+
/path/to/dot-ai/dist/cli.js --help
|
|
543
|
+
|
|
544
|
+
# Build if not already built
|
|
545
|
+
cd /path/to/dot-ai
|
|
546
|
+
npm run build
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### API Key Issues
|
|
550
|
+
|
|
551
|
+
**Symptoms:**
|
|
552
|
+
- "ANTHROPIC_API_KEY environment variable must be set"
|
|
553
|
+
- AI recommendation failures
|
|
554
|
+
|
|
555
|
+
**Solutions:**
|
|
556
|
+
```bash
|
|
557
|
+
# Check if API key is set
|
|
558
|
+
echo $ANTHROPIC_API_KEY
|
|
559
|
+
|
|
560
|
+
# Set API key
|
|
561
|
+
export ANTHROPIC_API_KEY=your_actual_key_here
|
|
562
|
+
|
|
563
|
+
# Verify key format
|
|
564
|
+
# Should start with 'sk-ant-api03-' for Claude API keys
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
#### Kubeconfig Issues
|
|
568
|
+
|
|
569
|
+
**Symptoms:**
|
|
570
|
+
- "Cannot connect to Kubernetes cluster"
|
|
571
|
+
- "Kubeconfig file not found"
|
|
572
|
+
- "connection refused"
|
|
573
|
+
|
|
574
|
+
**Solutions:**
|
|
575
|
+
```bash
|
|
576
|
+
# Test cluster connectivity
|
|
577
|
+
kubectl cluster-info
|
|
578
|
+
kubectl get nodes
|
|
579
|
+
|
|
580
|
+
# Check kubeconfig location
|
|
581
|
+
echo $KUBECONFIG
|
|
582
|
+
ls -la ~/.kube/config
|
|
583
|
+
|
|
584
|
+
# Use specific kubeconfig
|
|
585
|
+
dot-ai recommend \
|
|
586
|
+
--intent "test" \
|
|
587
|
+
--session-dir ./tmp \
|
|
588
|
+
--kubeconfig ./path/to/working/config.yaml
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
#### Session Directory Issues
|
|
592
|
+
|
|
593
|
+
**Symptoms:**
|
|
594
|
+
- "Session directory does not exist"
|
|
595
|
+
- "Permission denied"
|
|
596
|
+
- "Session directory is not writable"
|
|
597
|
+
|
|
598
|
+
**Solutions:**
|
|
599
|
+
```bash
|
|
600
|
+
# Create session directory
|
|
601
|
+
mkdir -p ./tmp/sessions
|
|
602
|
+
chmod 755 ./tmp/sessions
|
|
603
|
+
|
|
604
|
+
# Check permissions
|
|
605
|
+
ls -la ./tmp/
|
|
606
|
+
touch ./tmp/sessions/test-write && rm ./tmp/sessions/test-write
|
|
607
|
+
|
|
608
|
+
# Use absolute path
|
|
609
|
+
dot-ai recommend \
|
|
610
|
+
--intent "test" \
|
|
611
|
+
--session-dir "$(pwd)/sessions"
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
#### Solution ID Issues
|
|
615
|
+
|
|
616
|
+
**Symptoms:**
|
|
617
|
+
- "Solution not found"
|
|
618
|
+
- "Invalid solution ID format"
|
|
619
|
+
|
|
620
|
+
**Solutions:**
|
|
621
|
+
```bash
|
|
622
|
+
# List available solutions
|
|
623
|
+
ls -la ./sessions/
|
|
624
|
+
|
|
625
|
+
# Use exact solution ID from recommend output
|
|
626
|
+
# Format: sol_YYYY-MM-DDTHHMISS_randomhash
|
|
627
|
+
dot-ai choose-solution \
|
|
628
|
+
--solution-id sol_2025-01-01T123456_abcdef \
|
|
629
|
+
--session-dir ./sessions
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### Debug Mode
|
|
633
|
+
|
|
634
|
+
```bash
|
|
635
|
+
# Enable verbose output for detailed logging
|
|
636
|
+
dot-ai recommend \
|
|
637
|
+
--intent "debug test" \
|
|
638
|
+
--session-dir ./tmp \
|
|
639
|
+
--verbose
|
|
640
|
+
|
|
641
|
+
# Check what's in session directory
|
|
642
|
+
ls -la ./tmp/sol_*/
|
|
643
|
+
cat ./tmp/sol_*/solution.json
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### Performance Issues
|
|
647
|
+
|
|
648
|
+
**Large clusters:**
|
|
649
|
+
- Discovery may take longer with many CRDs
|
|
650
|
+
- Use `--verbose` to monitor progress
|
|
651
|
+
- Consider filtering intent to be more specific
|
|
652
|
+
|
|
653
|
+
**Network timeouts:**
|
|
654
|
+
```bash
|
|
655
|
+
# Increase timeout for deployment
|
|
656
|
+
dot-ai deploy-manifests \
|
|
657
|
+
--solution-id sol_xxx \
|
|
658
|
+
--session-dir ./tmp \
|
|
659
|
+
--timeout 120
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
## Advanced Usage
|
|
663
|
+
|
|
664
|
+
### Scripting and Automation
|
|
665
|
+
|
|
666
|
+
**Bash script example:**
|
|
667
|
+
```bash
|
|
668
|
+
#!/bin/bash
|
|
669
|
+
set -e
|
|
670
|
+
|
|
671
|
+
SESSION_DIR="./automated-deployment"
|
|
672
|
+
INTENT="deploy nginx web server"
|
|
673
|
+
|
|
674
|
+
echo "Starting automated deployment..."
|
|
675
|
+
|
|
676
|
+
# Get recommendations
|
|
677
|
+
RESULT=$(dot-ai recommend \
|
|
678
|
+
--intent "$INTENT" \
|
|
679
|
+
--session-dir "$SESSION_DIR" \
|
|
680
|
+
--output json)
|
|
681
|
+
|
|
682
|
+
# Extract best solution ID
|
|
683
|
+
SOLUTION_ID=$(echo "$RESULT" | jq -r '.data.solutions[0].id')
|
|
684
|
+
echo "Using solution: $SOLUTION_ID"
|
|
685
|
+
|
|
686
|
+
# Choose solution
|
|
687
|
+
dot-ai choose-solution \
|
|
688
|
+
--solution-id "$SOLUTION_ID" \
|
|
689
|
+
--session-dir "$SESSION_DIR" \
|
|
690
|
+
--output json
|
|
691
|
+
|
|
692
|
+
# Answer all questions with defaults/preset values
|
|
693
|
+
dot-ai answer-question \
|
|
694
|
+
--solution-id "$SOLUTION_ID" \
|
|
695
|
+
--session-dir "$SESSION_DIR" \
|
|
696
|
+
--stage required \
|
|
697
|
+
--answers '{"name":"auto-nginx","image":"nginx:latest","port":80}'
|
|
698
|
+
|
|
699
|
+
dot-ai answer-question \
|
|
700
|
+
--solution-id "$SOLUTION_ID" \
|
|
701
|
+
--session-dir "$SESSION_DIR" \
|
|
702
|
+
--stage basic \
|
|
703
|
+
--answers '{}'
|
|
704
|
+
|
|
705
|
+
dot-ai answer-question \
|
|
706
|
+
--solution-id "$SOLUTION_ID" \
|
|
707
|
+
--session-dir "$SESSION_DIR" \
|
|
708
|
+
--stage advanced \
|
|
709
|
+
--answers '{}'
|
|
710
|
+
|
|
711
|
+
dot-ai answer-question \
|
|
712
|
+
--solution-id "$SOLUTION_ID" \
|
|
713
|
+
--session-dir "$SESSION_DIR" \
|
|
714
|
+
--stage open \
|
|
715
|
+
--answers '{"open":"Automated deployment"}' \
|
|
716
|
+
--done
|
|
717
|
+
|
|
718
|
+
# Generate and deploy
|
|
719
|
+
dot-ai generate-manifests \
|
|
720
|
+
--solution-id "$SOLUTION_ID" \
|
|
721
|
+
--session-dir "$SESSION_DIR"
|
|
722
|
+
|
|
723
|
+
dot-ai deploy-manifests \
|
|
724
|
+
--solution-id "$SOLUTION_ID" \
|
|
725
|
+
--session-dir "$SESSION_DIR"
|
|
726
|
+
|
|
727
|
+
echo "Deployment completed successfully!"
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### CI/CD Integration
|
|
731
|
+
|
|
732
|
+
**GitHub Actions example:**
|
|
733
|
+
```yaml
|
|
734
|
+
name: Deploy with DevOps AI Toolkit
|
|
735
|
+
|
|
736
|
+
on:
|
|
737
|
+
push:
|
|
738
|
+
branches: [main]
|
|
739
|
+
|
|
740
|
+
jobs:
|
|
741
|
+
deploy:
|
|
742
|
+
runs-on: ubuntu-latest
|
|
743
|
+
steps:
|
|
744
|
+
- uses: actions/checkout@v3
|
|
745
|
+
|
|
746
|
+
- name: Setup Node.js
|
|
747
|
+
uses: actions/setup-node@v3
|
|
748
|
+
with:
|
|
749
|
+
node-version: '18'
|
|
750
|
+
|
|
751
|
+
- name: Setup kubectl
|
|
752
|
+
uses: azure/setup-kubectl@v3
|
|
753
|
+
|
|
754
|
+
- name: Deploy with DevOps AI Toolkit
|
|
755
|
+
env:
|
|
756
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
757
|
+
KUBECONFIG: ${{ github.workspace }}/kubeconfig
|
|
758
|
+
run: |
|
|
759
|
+
# Your deployment script here
|
|
760
|
+
./scripts/automated-deployment.sh
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
### Multiple Clusters
|
|
764
|
+
|
|
765
|
+
```bash
|
|
766
|
+
# Production cluster
|
|
767
|
+
export KUBECONFIG=./clusters/production.yaml
|
|
768
|
+
dot-ai recommend \
|
|
769
|
+
--intent "deploy production app" \
|
|
770
|
+
--session-dir ./sessions/prod
|
|
771
|
+
|
|
772
|
+
# Staging cluster
|
|
773
|
+
export KUBECONFIG=./clusters/staging.yaml
|
|
774
|
+
dot-ai recommend \
|
|
775
|
+
--intent "deploy staging app" \
|
|
776
|
+
--session-dir ./sessions/staging
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Custom Output Processing
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
# Extract specific information with jq
|
|
783
|
+
dot-ai recommend \
|
|
784
|
+
--intent "deploy app" \
|
|
785
|
+
--session-dir ./tmp \
|
|
786
|
+
--output json | jq '.data.solutions[0].score'
|
|
787
|
+
|
|
788
|
+
# Convert to different formats
|
|
789
|
+
dot-ai status --output yaml > status.yaml
|
|
790
|
+
dot-ai learn --output table | grep -i deployment
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
## See Also
|
|
794
|
+
|
|
795
|
+
- [MCP Integration Guide](mcp-guide.md) - Use DevOps AI Toolkit with AI development tools
|
|
796
|
+
- [API Reference](API.md) - Programmatic usage and TypeScript interfaces
|
|
797
|
+
- [Development Guide](DEVELOPMENT.md) - Contributing and architecture
|
|
798
|
+
- [Manual Testing](manual-testing.md) - Testing procedures and examples
|