mcp-souschef 3.0.0__tar.gz → 3.2.0__tar.gz
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.
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/PKG-INFO +83 -380
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/README.md +82 -378
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/pyproject.toml +3 -2
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/__init__.py +2 -10
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/assessment.py +336 -181
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ci/common.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/cli.py +37 -13
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/playbook.py +119 -48
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/__init__.py +6 -1
- mcp_souschef-3.2.0/souschef/core/path_utils.py +275 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/deployment.py +10 -3
- mcp_souschef-3.2.0/souschef/generators/__init__.py +13 -0
- mcp_souschef-3.2.0/souschef/generators/repo.py +695 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/attributes.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/habitat.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/inspec.py +25 -2
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/metadata.py +5 -3
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/recipe.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/resource.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/template.py +1 -1
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/server.py +426 -188
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/app.py +24 -30
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/pages/cookbook_analysis.py +837 -163
- mcp_souschef-3.0.0/souschef/converters/cookbook_specific.py.backup +0 -109
- mcp_souschef-3.0.0/souschef/core/path_utils.py +0 -61
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/LICENSE +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ci/__init__.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ci/github_actions.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ci/gitlab_ci.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ci/jenkins_pipeline.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/__init__.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/cookbook_specific.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/habitat.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/resource.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/converters/template.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/constants.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/errors.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/metrics.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/ruby_utils.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/core/validation.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/filesystem/__init__.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/filesystem/operations.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/parsers/__init__.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/profiling.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/__init__.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/health_check.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/pages/ai_settings.py +0 -0
- {mcp_souschef-3.0.0 → mcp_souschef-3.2.0}/souschef/ui/pages/validation_reports.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp-souschef
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: AI-powered MCP server for Chef to Ansible conversion
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -28,7 +28,6 @@ Requires-Dist: plotly (>=5.0.0)
|
|
|
28
28
|
Requires-Dist: python-dotenv (>=1.2.1)
|
|
29
29
|
Requires-Dist: pyyaml (>=6.0.0)
|
|
30
30
|
Requires-Dist: streamlit (>=1.28.0)
|
|
31
|
-
Requires-Dist: zod (>=0.8.0)
|
|
32
31
|
Project-URL: Documentation, https://kpeacocke.github.io/souschef/
|
|
33
32
|
Project-URL: Homepage, https://github.com/kpeacocke/souschef
|
|
34
33
|
Project-URL: Repository, https://github.com/kpeacocke/souschef
|
|
@@ -101,6 +100,7 @@ poetry install
|
|
|
101
100
|
## Core Capabilities
|
|
102
101
|
|
|
103
102
|
### 1. Chef Cookbook Analysis & Parsing
|
|
103
|
+
|
|
104
104
|
Complete cookbook introspection and analysis tools:
|
|
105
105
|
|
|
106
106
|
- **parse_template** - Parse ERB templates with Jinja2 conversion and variable extraction
|
|
@@ -113,6 +113,7 @@ Complete cookbook introspection and analysis tools:
|
|
|
113
113
|
- **list_cookbook_structure** - Display complete cookbook directory hierarchy
|
|
114
114
|
|
|
115
115
|
### 2. Chef-to-Ansible Conversion Engine
|
|
116
|
+
|
|
116
117
|
Advanced resource-to-task conversion with intelligent module selection:
|
|
117
118
|
|
|
118
119
|
- **convert_resource_to_task** - Transform individual Chef resources to Ansible tasks
|
|
@@ -125,6 +126,7 @@ Advanced resource-to-task conversion with intelligent module selection:
|
|
|
125
126
|
- Platform checks, node attributes, file/directory existence, and command execution
|
|
126
127
|
|
|
127
128
|
### 3. Chef Search & Inventory Integration
|
|
129
|
+
|
|
128
130
|
Convert Chef search patterns to dynamic Ansible inventory:
|
|
129
131
|
|
|
130
132
|
- **convert_chef_search_to_inventory** - Transform Chef search queries to Ansible inventory groups
|
|
@@ -132,6 +134,7 @@ Convert Chef search patterns to dynamic Ansible inventory:
|
|
|
132
134
|
- **analyse_chef_search_patterns** - Discover and analyse search usage in cookbooks
|
|
133
135
|
|
|
134
136
|
### 4. InSpec Integration & Validation
|
|
137
|
+
|
|
135
138
|
Complete InSpec-to-Ansible testing pipeline:
|
|
136
139
|
|
|
137
140
|
- **parse_inspec_profile** - Parse InSpec profiles and extract controls
|
|
@@ -139,6 +142,7 @@ Complete InSpec-to-Ansible testing pipeline:
|
|
|
139
142
|
- **generate_inspec_from_recipe** - Auto-generate InSpec validation from Chef recipes
|
|
140
143
|
|
|
141
144
|
### 5. Data Bags & Secrets Management
|
|
145
|
+
|
|
142
146
|
Chef data bags to Ansible vars/vault conversion:
|
|
143
147
|
|
|
144
148
|
- **convert_chef_databag_to_vars** - Transform data bags to Ansible variable files
|
|
@@ -146,6 +150,7 @@ Chef data bags to Ansible vars/vault conversion:
|
|
|
146
150
|
- **analyse_chef_databag_usage** - Analyse data bag usage patterns in cookbooks
|
|
147
151
|
|
|
148
152
|
### 6. Environment & Configuration Management
|
|
153
|
+
|
|
149
154
|
Chef environments to Ansible inventory groups:
|
|
150
155
|
|
|
151
156
|
- **convert_chef_environment_to_inventory_group** - Transform Chef environments to inventory
|
|
@@ -153,6 +158,7 @@ Chef environments to Ansible inventory groups:
|
|
|
153
158
|
- **analyse_chef_environment_usage** - Analyse environment usage in cookbooks
|
|
154
159
|
|
|
155
160
|
### 7. AWX/Ansible Automation Platform Integration
|
|
161
|
+
|
|
156
162
|
Enterprise AWX/AAP configuration generation:
|
|
157
163
|
|
|
158
164
|
- **generate_awx_job_template_from_cookbook** - Create AWX job templates from cookbooks
|
|
@@ -161,6 +167,7 @@ Enterprise AWX/AAP configuration generation:
|
|
|
161
167
|
- **generate_awx_inventory_source_from_chef** - Create dynamic inventory sources from Chef server
|
|
162
168
|
|
|
163
169
|
### 8. Chef Habitat to Container Conversion
|
|
170
|
+
|
|
164
171
|
Modernize Habitat applications to containerized deployments:
|
|
165
172
|
|
|
166
173
|
- **parse_habitat_plan** - Parse Chef Habitat plan files (plan.sh) and extract package metadata, dependencies, build/install hooks, and service configuration
|
|
@@ -168,6 +175,7 @@ Modernize Habitat applications to containerized deployments:
|
|
|
168
175
|
- **generate_compose_from_habitat** - Generate docker-compose.yml from multiple Habitat plans for multi-service deployments
|
|
169
176
|
|
|
170
177
|
### 9. Advanced Deployment Patterns & Migration Assessment
|
|
178
|
+
|
|
171
179
|
Modern deployment strategies and migration planning:
|
|
172
180
|
|
|
173
181
|
- **convert_chef_deployment_to_ansible_strategy** - Convert deployment recipes to Ansible strategies
|
|
@@ -175,6 +183,7 @@ Modern deployment strategies and migration planning:
|
|
|
175
183
|
- **generate_canary_deployment_strategy** - Generate canary deployment configurations
|
|
176
184
|
|
|
177
185
|
### 10. CI/CD Pipeline Generation
|
|
186
|
+
|
|
178
187
|
Generate Jenkins, GitLab CI, and GitHub Actions workflows from Chef cookbook CI patterns:
|
|
179
188
|
|
|
180
189
|
- **generate_jenkinsfile_from_chef** - Generate Jenkinsfile (Declarative or Scripted) from Chef cookbook CI/CD patterns
|
|
@@ -182,6 +191,7 @@ Generate Jenkins, GitLab CI, and GitHub Actions workflows from Chef cookbook CI
|
|
|
182
191
|
- **generate_github_workflow_from_chef** - Generate GitHub Actions workflow from Chef cookbook CI/CD patterns
|
|
183
192
|
|
|
184
193
|
Automatically detects and converts:
|
|
194
|
+
|
|
185
195
|
- **Test Kitchen** configurations (.kitchen.yml) → Integration test stages
|
|
186
196
|
- **ChefSpec** tests (spec/) → Unit test stages
|
|
187
197
|
- **Cookstyle/Foodcritic** → Lint stages
|
|
@@ -207,7 +217,10 @@ souschef generate-gitlab-ci ./mycookbook --no-cache --no-artifacts
|
|
|
207
217
|
souschef generate-github-workflow ./mycookbook --workflow-name "My CI" --no-cache
|
|
208
218
|
```
|
|
209
219
|
|
|
220
|
+
#### Command Line Usage
|
|
221
|
+
|
|
210
222
|
**MCP Tool Usage:**
|
|
223
|
+
|
|
211
224
|
```python
|
|
212
225
|
# From an AI assistant with SousChef MCP
|
|
213
226
|
|
|
@@ -235,6 +248,7 @@ generate_github_workflow_from_chef(
|
|
|
235
248
|
```
|
|
236
249
|
|
|
237
250
|
### 11. Conversion Validation Framework
|
|
251
|
+
|
|
238
252
|
Comprehensive validation of Chef-to-Ansible conversions:
|
|
239
253
|
|
|
240
254
|
- **validate_conversion** - Validate conversions across multiple dimensions
|
|
@@ -245,18 +259,20 @@ Comprehensive validation of Chef-to-Ansible conversions:
|
|
|
245
259
|
- **Performance Recommendations**: Efficiency suggestions and optimizations
|
|
246
260
|
|
|
247
261
|
#### Validation Levels
|
|
262
|
+
|
|
248
263
|
- **ERROR**: Critical issues that will prevent execution
|
|
249
264
|
- **WARNING**: Potential problems or anti-patterns that may cause issues
|
|
250
265
|
- **INFO**: Suggestions for improvements and best practices
|
|
251
266
|
|
|
252
267
|
#### Validation Categories
|
|
268
|
+
|
|
253
269
|
- **Syntax**: Code structure and syntax correctness
|
|
254
270
|
- **Semantic**: Logical equivalence and meaning preservation
|
|
255
271
|
- **Best Practice**: Ansible community standards and patterns
|
|
256
272
|
- **Security**: Security considerations and recommendations
|
|
257
273
|
- **Performance**: Efficiency and optimization suggestions
|
|
258
274
|
|
|
259
|
-
####
|
|
275
|
+
#### Validation Examples
|
|
260
276
|
|
|
261
277
|
```python
|
|
262
278
|
# Validate a resource conversion
|
|
@@ -272,6 +288,7 @@ validate_conversion(
|
|
|
272
288
|
```
|
|
273
289
|
|
|
274
290
|
Output formats:
|
|
291
|
+
|
|
275
292
|
- **text**: Detailed report with all findings grouped by severity
|
|
276
293
|
- **json**: Structured JSON for programmatic processing
|
|
277
294
|
- **summary**: Quick overview with counts only
|
|
@@ -285,6 +302,7 @@ Output formats:
|
|
|
285
302
|
## Migration Workflow
|
|
286
303
|
|
|
287
304
|
### Phase 1: Discovery & Assessment
|
|
305
|
+
|
|
288
306
|
```bash
|
|
289
307
|
# Assess migration complexity
|
|
290
308
|
assess_chef_migration_complexity /path/to/cookbooks
|
|
@@ -297,6 +315,7 @@ generate_migration_plan '{\"cookbooks\": [\"/path/to/cookbook1\", \"/path/to/coo
|
|
|
297
315
|
```
|
|
298
316
|
|
|
299
317
|
### Phase 2: Content Conversion
|
|
318
|
+
|
|
300
319
|
```bash
|
|
301
320
|
# Convert recipes to playbooks
|
|
302
321
|
generate_playbook_from_recipe /path/to/recipe.rb
|
|
@@ -309,6 +328,7 @@ generate_inventory_from_chef_environments /path/to/environments
|
|
|
309
328
|
```
|
|
310
329
|
|
|
311
330
|
### Phase 3: AWX/AAP Integration
|
|
331
|
+
|
|
312
332
|
```bash
|
|
313
333
|
# Generate AWX job templates
|
|
314
334
|
generate_awx_job_template_from_cookbook /path/to/cookbook cookbook_name
|
|
@@ -321,6 +341,7 @@ generate_awx_inventory_source_from_chef https://chef.example.com production web_
|
|
|
321
341
|
```
|
|
322
342
|
|
|
323
343
|
### Phase 4: Habitat to Container Migration
|
|
344
|
+
|
|
324
345
|
```bash
|
|
325
346
|
# Parse Habitat plan
|
|
326
347
|
parse_habitat_plan /path/to/plan.sh
|
|
@@ -333,6 +354,7 @@ generate_compose_from_habitat "/path/to/plan1.sh,/path/to/plan2.sh" my_network
|
|
|
333
354
|
```
|
|
334
355
|
|
|
335
356
|
### Phase 5: Validation & Testing
|
|
357
|
+
|
|
336
358
|
```bash
|
|
337
359
|
# Generate InSpec validation
|
|
338
360
|
generate_inspec_from_recipe /path/to/recipe.rb
|
|
@@ -342,6 +364,7 @@ convert_inspec_to_test /path/to/inspec_profile testinfra
|
|
|
342
364
|
```
|
|
343
365
|
|
|
344
366
|
### Performance Profiling & Optimization
|
|
367
|
+
|
|
345
368
|
Profile cookbook parsing performance to identify bottlenecks and optimize large-scale migrations:
|
|
346
369
|
|
|
347
370
|
```bash
|
|
@@ -362,6 +385,7 @@ profile_parsing_operation recipe /path/to/recipe.rb --detailed
|
|
|
362
385
|
```
|
|
363
386
|
|
|
364
387
|
### 10. Visual Migration Planning Interface
|
|
388
|
+
|
|
365
389
|
Interactive web-based interface for Chef-to-Ansible migration planning and visualization:
|
|
366
390
|
|
|
367
391
|
- **Cookbook Analysis Dashboard**: Interactive directory scanning with metadata parsing and complexity assessment
|
|
@@ -371,6 +395,7 @@ Interactive web-based interface for Chef-to-Ansible migration planning and visua
|
|
|
371
395
|
- **Progress Tracking**: Real-time migration progress with completion metrics and bottleneck identification
|
|
372
396
|
|
|
373
397
|
**Launch the UI:**
|
|
398
|
+
|
|
374
399
|
```bash
|
|
375
400
|
# Using Poetry (development)
|
|
376
401
|
poetry run souschef ui
|
|
@@ -383,6 +408,7 @@ souschef ui --port 8080
|
|
|
383
408
|
```
|
|
384
409
|
|
|
385
410
|
**Run in Docker:**
|
|
411
|
+
|
|
386
412
|
```bash
|
|
387
413
|
# Build the image
|
|
388
414
|
docker build -t souschef-ui .
|
|
@@ -407,6 +433,7 @@ nano .env
|
|
|
407
433
|
```
|
|
408
434
|
|
|
409
435
|
**Example .env file:**
|
|
436
|
+
|
|
410
437
|
```dotenv
|
|
411
438
|
# AI Configuration
|
|
412
439
|
SOUSCHEF_AI_PROVIDER=Anthropic (Claude)
|
|
@@ -423,12 +450,14 @@ STREAMLIT_SERVER_HEADLESS=true
|
|
|
423
450
|
```
|
|
424
451
|
|
|
425
452
|
**Supported AI Providers:**
|
|
453
|
+
|
|
426
454
|
- `Anthropic (Claude)` - Anthropic Claude models
|
|
427
455
|
- `OpenAI (GPT)` - OpenAI GPT models
|
|
428
456
|
- `IBM Watsonx` - IBM Watsonx AI models
|
|
429
457
|
- `Red Hat Lightspeed` - Red Hat Lightspeed models
|
|
430
458
|
|
|
431
459
|
**Environment Variables:**
|
|
460
|
+
|
|
432
461
|
- `SOUSCHEF_AI_PROVIDER` - AI provider name (required)
|
|
433
462
|
- `SOUSCHEF_AI_MODEL` - Model name (required)
|
|
434
463
|
- `SOUSCHEF_AI_API_KEY` - API key for authentication (required)
|
|
@@ -438,6 +467,7 @@ STREAMLIT_SERVER_HEADLESS=true
|
|
|
438
467
|
- `SOUSCHEF_AI_MAX_TOKENS` - Maximum tokens to generate (optional, default: 4000)
|
|
439
468
|
|
|
440
469
|
**Docker Compose (recommended for development):**
|
|
470
|
+
|
|
441
471
|
```yaml
|
|
442
472
|
version: '3.8'
|
|
443
473
|
services:
|
|
@@ -456,6 +486,7 @@ services:
|
|
|
456
486
|
```
|
|
457
487
|
|
|
458
488
|
**Features:**
|
|
489
|
+
|
|
459
490
|
- Clean, professional design matching documentation standards
|
|
460
491
|
- Real-time cookbook analysis with progress indicators
|
|
461
492
|
- **Interactive dependency visualization** with Plotly graphs and NetworkX analysis
|
|
@@ -468,6 +499,7 @@ services:
|
|
|
468
499
|
### Advanced UI Features
|
|
469
500
|
|
|
470
501
|
#### Interactive Dependency Visualization
|
|
502
|
+
|
|
471
503
|
The UI includes sophisticated dependency graph visualization powered by NetworkX and Plotly:
|
|
472
504
|
|
|
473
505
|
- **Graph Analysis**: Automatic detection of cookbook dependencies, circular references, and migration ordering
|
|
@@ -477,6 +509,7 @@ The UI includes sophisticated dependency graph visualization powered by NetworkX
|
|
|
477
509
|
- **Large Graph Support**: Optimized layouts for complex cookbook ecosystems
|
|
478
510
|
|
|
479
511
|
#### Real-Time Progress Tracking
|
|
512
|
+
|
|
480
513
|
All analysis operations include comprehensive progress feedback:
|
|
481
514
|
|
|
482
515
|
- **Progress Bars**: Visual progress indicators for long-running operations
|
|
@@ -485,18 +518,21 @@ All analysis operations include comprehensive progress feedback:
|
|
|
485
518
|
- **Error Handling**: Graceful error display with recovery suggestions
|
|
486
519
|
|
|
487
520
|
#### Enhanced User Experience
|
|
521
|
+
|
|
488
522
|
- **Responsive Design**: Clean, professional interface that works across different screen sizes
|
|
489
523
|
- **Export Options**: Download analysis results, graphs, and migration plans
|
|
490
524
|
- **Session Persistence**: Maintain analysis state across page refreshes
|
|
491
525
|
- **Quick Actions**: One-click access to common migration tasks
|
|
492
526
|
|
|
493
527
|
### Migration Assessment & Reporting
|
|
528
|
+
|
|
494
529
|
- **Complexity Analysis**: Automated assessment of migration effort and risk factors
|
|
495
530
|
- **Dependency Mapping**: Complete cookbook dependency analysis with migration ordering
|
|
496
531
|
- **Impact Analysis**: Resource usage patterns and conversion recommendations
|
|
497
532
|
- **Executive Reports**: Stakeholder-ready migration reports with timelines and costs
|
|
498
533
|
|
|
499
534
|
### Modern Deployment Patterns
|
|
535
|
+
|
|
500
536
|
- **Blue/Green Deployments**: Zero-downtime deployment strategies
|
|
501
537
|
- **Canary Releases**: Gradual rollout configurations
|
|
502
538
|
- **Application Patterns**: Modern containerized and cloud-native deployment patterns
|
|
@@ -504,6 +540,7 @@ All analysis operations include comprehensive progress feedback:
|
|
|
504
540
|
- **Habitat to Container**: Convert Chef Habitat plans to Docker and Docker Compose configurations
|
|
505
541
|
|
|
506
542
|
### Enterprise Integration
|
|
543
|
+
|
|
507
544
|
- **AWX/AAP Ready**: Native Ansible Automation Platform integration
|
|
508
545
|
- **Dynamic Inventory**: Chef server integration for hybrid environments
|
|
509
546
|
- **Secrets Management**: Secure data bag to Vault conversion
|
|
@@ -512,6 +549,7 @@ All analysis operations include comprehensive progress feedback:
|
|
|
512
549
|
## Installation & Setup
|
|
513
550
|
|
|
514
551
|
### Prerequisites
|
|
552
|
+
|
|
515
553
|
- Python 3.14+
|
|
516
554
|
- [Poetry](https://python-poetry.org/) for dependency management
|
|
517
555
|
- MCP-compatible client (Claude Desktop, VS Code 1.102+ with GitHub Copilot, etc.)
|
|
@@ -519,6 +557,7 @@ All analysis operations include comprehensive progress feedback:
|
|
|
519
557
|
### Quick Start
|
|
520
558
|
|
|
521
559
|
1. **Install SousChef**:
|
|
560
|
+
|
|
522
561
|
```bash
|
|
523
562
|
pip install mcp-souschef
|
|
524
563
|
```
|
|
@@ -528,12 +567,14 @@ All analysis operations include comprehensive progress feedback:
|
|
|
528
567
|
Use the pre-configured files in the `config/` directory for quick setup with Claude Desktop, VS Code Copilot, or other MCP clients.
|
|
529
568
|
|
|
530
569
|
**Claude Desktop** (macOS):
|
|
570
|
+
|
|
531
571
|
```bash
|
|
532
572
|
cp config/claude-desktop.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
533
573
|
# Restart Claude Desktop
|
|
534
574
|
```
|
|
535
575
|
|
|
536
576
|
**VS Code + GitHub Copilot** (requires VS Code 1.102+):
|
|
577
|
+
|
|
537
578
|
```bash
|
|
538
579
|
# macOS/Linux
|
|
539
580
|
cp config/vscode-copilot.json ~/.config/Code/User/mcp.json
|
|
@@ -544,7 +585,7 @@ All analysis operations include comprehensive progress feedback:
|
|
|
544
585
|
# Reload VS Code window, then trust the server when prompted
|
|
545
586
|
```
|
|
546
587
|
|
|
547
|
-
**
|
|
588
|
+
**See [config/CONFIGURATION.md](config/CONFIGURATION.md) for:**
|
|
548
589
|
- Platform-specific setup (macOS/Linux/Windows)
|
|
549
590
|
- Model provider configurations (Red Hat AI, OpenAI, local models)
|
|
550
591
|
- Development setup
|
|
@@ -574,6 +615,7 @@ souschef-cli inspec-convert controls.rb --format testinfra
|
|
|
574
615
|
```
|
|
575
616
|
|
|
576
617
|
**Available Commands:**
|
|
618
|
+
|
|
577
619
|
- `recipe` - Parse Chef recipe files and extract resources
|
|
578
620
|
- `template` - Convert ERB templates to Jinja2 with variable extraction
|
|
579
621
|
- `resource` - Parse custom resources and LWRPs
|
|
@@ -629,15 +671,17 @@ poetry update # All packages
|
|
|
629
671
|
```
|
|
630
672
|
|
|
631
673
|
**Automated Systems:**
|
|
632
|
-
|
|
633
|
-
-
|
|
634
|
-
-
|
|
674
|
+
|
|
675
|
+
- Pre-commit hooks auto-update `poetry.lock` when `pyproject.toml` changes
|
|
676
|
+
- CI validates lock file on every PR
|
|
677
|
+
- Dependabot sends weekly dependency updates
|
|
635
678
|
|
|
636
679
|
See [CONTRIBUTING.md](CONTRIBUTING.md#-managing-dependencies) for detailed dependency management guide.
|
|
637
680
|
|
|
638
681
|
## Architecture & Design
|
|
639
682
|
|
|
640
683
|
### MCP Protocol Integration
|
|
684
|
+
|
|
641
685
|
SousChef leverages the Model Context Protocol (MCP) to provide seamless integration with AI assistants and development environments:
|
|
642
686
|
|
|
643
687
|
- **38 Specialized Tools**: Each migration capability exposed as dedicated MCP tool
|
|
@@ -646,6 +690,7 @@ SousChef leverages the Model Context Protocol (MCP) to provide seamless integrat
|
|
|
646
690
|
- **Streaming Support**: Efficient handling of large cookbook conversions
|
|
647
691
|
|
|
648
692
|
### Testing Strategy
|
|
693
|
+
|
|
649
694
|
Following enterprise-grade testing standards with comprehensive test coverage:
|
|
650
695
|
|
|
651
696
|
- **Unit Tests**: Mock-based testing for individual functions (test_server.py, test_cli.py, test_mcp.py)
|
|
@@ -657,6 +702,7 @@ Following enterprise-grade testing standards with comprehensive test coverage:
|
|
|
657
702
|
- **92% Coverage**: Comprehensive test coverage exceeding the 90% target for production readiness
|
|
658
703
|
|
|
659
704
|
### Quality Assurance
|
|
705
|
+
|
|
660
706
|
- **Zero Warnings Policy**: All code passes linting without disabling checks
|
|
661
707
|
- **Type Safety**: Complete type annotations throughout the codebase
|
|
662
708
|
- **Automated Testing**: CI/CD pipeline with comprehensive test suites
|
|
@@ -665,7 +711,9 @@ Following enterprise-grade testing standards with comprehensive test coverage:
|
|
|
665
711
|
## Documentation
|
|
666
712
|
|
|
667
713
|
### Tool Reference
|
|
714
|
+
|
|
668
715
|
Each MCP tool includes comprehensive documentation:
|
|
716
|
+
|
|
669
717
|
- Purpose and use cases
|
|
670
718
|
- Parameter descriptions and types
|
|
671
719
|
- Return value specifications
|
|
@@ -673,73 +721,12 @@ Each MCP tool includes comprehensive documentation:
|
|
|
673
721
|
- Error handling behaviors
|
|
674
722
|
|
|
675
723
|
### Migration Guides
|
|
724
|
+
|
|
676
725
|
- **[Enterprise Migration Guide](docs/enterprise-migration.md)** - Complete methodology for large-scale migrations
|
|
677
726
|
- **[AWX Integration Guide](docs/awx-integration.md)** - Step-by-step AWX/AAP setup and configuration
|
|
678
727
|
- **[Testing Strategy Guide](docs/testing-strategy.md)** - Validation and testing approaches
|
|
679
728
|
- **[Best Practices](docs/best-practices.md)** - Recommended patterns and approaches
|
|
680
729
|
|
|
681
|
-
## Contributing
|
|
682
|
-
|
|
683
|
-
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
|
684
|
-
- Development setup and workflow
|
|
685
|
-
- Code style and testing requirements
|
|
686
|
-
- Pull request process
|
|
687
|
-
- Issue reporting guidelines
|
|
688
|
-
|
|
689
|
-
## License
|
|
690
|
-
|
|
691
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
692
|
-
|
|
693
|
-
## Roadmap
|
|
694
|
-
|
|
695
|
-
### Completed
|
|
696
|
-
- Complete Chef cookbook parsing (recipes, attributes, metadata, templates)
|
|
697
|
-
- InSpec profile parsing and conversion to Testinfra/Ansible tests
|
|
698
|
-
- Chef resource to Ansible task conversion with module mapping
|
|
699
|
-
- Data bags to Ansible Vault conversion
|
|
700
|
-
- Chef environments to Ansible inventory conversion
|
|
701
|
-
- Chef search patterns to dynamic inventory conversion
|
|
702
|
-
- AWX/AAP job templates, workflows, and project generation
|
|
703
|
-
- Blue/green and canary deployment pattern generation
|
|
704
|
-
- Migration complexity assessment and planning tools
|
|
705
|
-
- Comprehensive testing suite (unit, integration, property-based)
|
|
706
|
-
- Command-line interface (CLI) for standalone usage
|
|
707
|
-
- Enhanced Chef guard handling (arrays, lambda syntax, complex nested conditions)
|
|
708
|
-
- Advanced attribute precedence resolution (6 levels with conflict detection)
|
|
709
|
-
- Automated release management with Release Please
|
|
710
|
-
- Automated branch cleanup for release PRs
|
|
711
|
-
- Automated conversion validation and testing framework
|
|
712
|
-
- Chef Habitat to containerized deployment conversion (parse_habitat_plan, convert_habitat_to_dockerfile, generate_compose_from_habitat)
|
|
713
|
-
- Enhanced error handling with custom exceptions and actionable recovery suggestions
|
|
714
|
-
- Technical debt reduction - ALL PHASES COMPLETE: 16 functions refactored (15 C-grade eliminated, 70+ helpers extracted, average 77% complexity reduction, zero C-grade functions remaining)
|
|
715
|
-
- Performance profiling and optimization for large cookbooks (profiling module, CLI commands, MCP tools)
|
|
716
|
-
- Code duplication elimination (InSpec functions refactored: 55 duplicate lines removed, improved architecture)
|
|
717
|
-
- Documentation website with MkDocs + Material theme (charcoal + teal colour scheme, 16 pages)
|
|
718
|
-
- Comprehensive documentation content (Getting Started, Tool Reference, Migration Guide, API docs, Examples)
|
|
719
|
-
- Integration with additional test frameworks (ServerSpec, Goss) - InSpec conversion now supports 4 output formats
|
|
720
|
-
- Jenkins/GitLab CI pipeline generation from Chef cookbook CI patterns (Test Kitchen, ChefSpec, Cookstyle)
|
|
721
|
-
- Visual migration planning interface with Streamlit-based web UI for interactive cookbook analysis and migration planning
|
|
722
|
-
- **Interactive dependency mapping and visualization** with Plotly graphs and NetworkX analysis
|
|
723
|
-
- **Real-time progress tracking** for all analysis operations with Streamlit progress bars
|
|
724
|
-
- **Static graph visualization** with matplotlib for reports and documentation
|
|
725
|
-
- **Automated ERB to Jinja2 template conversion** - Converts Chef ERB templates to Ansible Jinja2 templates during cookbook conversion
|
|
726
|
-
- Converts ERB syntax to Jinja2: `<%= var %>` → `{{ var }}`, `<% if %>` → `{% if %}`
|
|
727
|
-
- Extracts template variables for validation and documentation
|
|
728
|
-
- Includes converted templates in downloadable playbook archives
|
|
729
|
-
- UI displays converted templates with variable lists and preview
|
|
730
|
-
|
|
731
|
-
### Planned
|
|
732
|
-
- 📅 Enhanced graph layout algorithms for large dependency networks (force-directed, hierarchical)
|
|
733
|
-
- 📅 Export functionality for graphs (PNG, SVG, PDF formats)
|
|
734
|
-
- 📅 UI configuration options and themes
|
|
735
|
-
- 📅 Performance caching for expensive analysis operations
|
|
736
|
-
- 📅 Mobile-responsive design improvements
|
|
737
|
-
- 📅 Accessibility enhancements (ARIA labels, keyboard navigation)
|
|
738
|
-
- 📅 Integration testing for UI components
|
|
739
|
-
- 📅 Advanced filtering and search in dependency graphs
|
|
740
|
-
- 📅 Migration templates and presets
|
|
741
|
-
- 📅 Terraform provider for infrastructure state management
|
|
742
|
-
|
|
743
730
|
## Support & Community
|
|
744
731
|
|
|
745
732
|
- **Issues**: [GitHub Issues](https://github.com/kpeacocke/souschef/issues)
|
|
@@ -748,326 +735,23 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
748
735
|
|
|
749
736
|
---
|
|
750
737
|
|
|
751
|
-
|
|
752
|
-
desc 'Ensure package nginx is properly configured'
|
|
753
|
-
impact 1.0
|
|
754
|
-
|
|
755
|
-
describe package('nginx') do
|
|
756
|
-
it { should be_installed }
|
|
757
|
-
end
|
|
758
|
-
end
|
|
759
|
-
|
|
760
|
-
control 'service-nginx' do
|
|
761
|
-
title 'Verify service nginx'
|
|
762
|
-
desc 'Ensure service nginx is properly configured'
|
|
763
|
-
impact 1.0
|
|
764
|
-
|
|
765
|
-
describe service('nginx') do
|
|
766
|
-
it { should be_running }
|
|
767
|
-
it { should be_enabled }
|
|
768
|
-
end
|
|
769
|
-
end
|
|
770
|
-
|
|
771
|
-
control 'template--etc-nginx-nginx.conf' do
|
|
772
|
-
title 'Verify template /etc/nginx/nginx.conf'
|
|
773
|
-
desc 'Ensure template /etc/nginx/nginx.conf is properly configured'
|
|
774
|
-
impact 1.0
|
|
775
|
-
|
|
776
|
-
describe file('/etc/nginx/nginx.conf') do
|
|
777
|
-
it { should exist }
|
|
778
|
-
its('mode') { should cmp '0644' }
|
|
779
|
-
its('owner') { should eq 'root' }
|
|
780
|
-
its('group') { should eq 'root' }
|
|
781
|
-
end
|
|
782
|
-
end
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
#### Testinfra Integration
|
|
786
|
-
|
|
787
|
-
Convert to Python tests for CI/CD pipelines:
|
|
788
|
-
|
|
789
|
-
```bash
|
|
790
|
-
souschef-cli inspec-convert validation-controls.rb --format testinfra
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
```python
|
|
794
|
-
import pytest
|
|
795
|
-
|
|
796
|
-
def test_package_nginx(host):
|
|
797
|
-
"""Ensure package nginx is properly configured"""
|
|
798
|
-
pkg = host.package("nginx")
|
|
799
|
-
assert pkg.is_installed
|
|
800
|
-
|
|
801
|
-
def test_service_nginx(host):
|
|
802
|
-
"""Ensure service nginx is properly configured"""
|
|
803
|
-
svc = host.service("nginx")
|
|
804
|
-
assert svc.is_running
|
|
805
|
-
assert svc.is_enabled
|
|
806
|
-
|
|
807
|
-
def test_template_etc_nginx_nginx_conf(host):
|
|
808
|
-
"""Ensure template /etc/nginx/nginx.conf is properly configured"""
|
|
809
|
-
f = host.file("/etc/nginx/nginx.conf")
|
|
810
|
-
assert f.exists
|
|
811
|
-
assert oct(f.mode) == "0644"
|
|
812
|
-
assert f.user == "root"
|
|
813
|
-
assert f.group == "root"
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
#### Ansible Assert Integration
|
|
817
|
-
|
|
818
|
-
For Ansible playbook validation:
|
|
819
|
-
|
|
820
|
-
```bash
|
|
821
|
-
souschef-cli inspec-convert validation-controls.rb --format ansible_assert
|
|
822
|
-
```
|
|
823
|
-
|
|
824
|
-
```yaml
|
|
825
|
-
---
|
|
826
|
-
# Validation tasks converted from InSpec
|
|
827
|
-
|
|
828
|
-
- name: Verify package nginx
|
|
829
|
-
ansible.builtin.assert:
|
|
830
|
-
that:
|
|
831
|
-
- ansible_facts.packages['nginx'] is defined
|
|
832
|
-
fail_msg: "Ensure package nginx is properly configured validation failed"
|
|
833
|
-
|
|
834
|
-
- name: Verify service nginx
|
|
835
|
-
ansible.builtin.assert:
|
|
836
|
-
that:
|
|
837
|
-
- services['nginx'].state == 'running'
|
|
838
|
-
- services['nginx'].status == 'enabled'
|
|
839
|
-
fail_msg: "Ensure service nginx is properly configured validation failed"
|
|
840
|
-
```
|
|
841
|
-
|
|
842
|
-
#### Benefits
|
|
843
|
-
|
|
844
|
-
- **Consistency Validation** - Ensure Chef and Ansible produce identical infrastructure state
|
|
845
|
-
- **AI Context Enhancement** - InSpec profiles help AI understand infrastructure intent
|
|
846
|
-
- **Automated Testing** - Generate tests automatically from Chef recipes
|
|
847
|
-
- **Multiple Test Formats** - Support for InSpec, Testinfra, and Ansible assert
|
|
848
|
-
- **CI/CD Integration** - Easy integration with existing test pipelines
|
|
849
|
-
|
|
850
|
-
### As an MCP Server
|
|
851
|
-
|
|
852
|
-
SousChef is designed to be used as an MCP server with AI assistants that support the Model Context Protocol.
|
|
853
|
-
|
|
854
|
-
#### Configure with Claude Desktop
|
|
855
|
-
|
|
856
|
-
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
857
|
-
|
|
858
|
-
```json
|
|
859
|
-
{
|
|
860
|
-
"mcpServers": {
|
|
861
|
-
"souschef": {
|
|
862
|
-
"command": "poetry",
|
|
863
|
-
"args": [
|
|
864
|
-
"-C",
|
|
865
|
-
"/path/to/souschef",
|
|
866
|
-
"run",
|
|
867
|
-
"souschef"
|
|
868
|
-
]
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
### Available Tools
|
|
875
|
-
|
|
876
|
-
#### `list_directory(path: str)`
|
|
877
|
-
List the contents of a directory.
|
|
878
|
-
|
|
879
|
-
**Example:**
|
|
880
|
-
```python
|
|
881
|
-
list_directory("/path/to/cookbooks")
|
|
882
|
-
# Returns: ['nginx', 'apache2', 'mysql']
|
|
883
|
-
```
|
|
884
|
-
|
|
885
|
-
#### `read_file(path: str)`
|
|
886
|
-
Read the contents of a file.
|
|
887
|
-
|
|
888
|
-
**Example:**
|
|
889
|
-
```python
|
|
890
|
-
read_file("/path/to/cookbook/recipes/default.rb")
|
|
891
|
-
# Returns: file contents as string
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
#### `read_cookbook_metadata(path: str)`
|
|
895
|
-
Parse Chef cookbook metadata.rb file.
|
|
896
|
-
|
|
897
|
-
**Example:**
|
|
898
|
-
```python
|
|
899
|
-
read_cookbook_metadata("/path/to/cookbook/metadata.rb")
|
|
900
|
-
# Returns:
|
|
901
|
-
# name: nginx
|
|
902
|
-
# maintainer: Chef Software, Inc.
|
|
903
|
-
# version: 8.0.0
|
|
904
|
-
# depends: logrotate, iptables
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
#### `parse_recipe(path: str)`
|
|
908
|
-
Parse a Chef recipe file and extract resources.
|
|
909
|
-
|
|
910
|
-
**Example:**
|
|
911
|
-
```python
|
|
912
|
-
parse_recipe("/path/to/cookbook/recipes/default.rb")
|
|
913
|
-
# Returns:
|
|
914
|
-
# Resource 1:
|
|
915
|
-
# Type: package
|
|
916
|
-
# Name: nginx
|
|
917
|
-
# Action: install
|
|
918
|
-
```
|
|
919
|
-
|
|
920
|
-
#### `parse_attributes(path: str, resolve_precedence: bool = True)`
|
|
921
|
-
Parse a Chef attributes file and extract attribute definitions with precedence analysis.
|
|
922
|
-
|
|
923
|
-
**Chef Attribute Precedence** (lowest to highest):
|
|
924
|
-
1. `default` - Normal default value
|
|
925
|
-
2. `force_default` - Forced default, higher than regular default
|
|
926
|
-
3. `normal` - Normal attribute set by cookbook
|
|
927
|
-
4. `override` - Override values
|
|
928
|
-
5. `force_override` - Forced override, cannot be overridden
|
|
929
|
-
6. `automatic` - Automatically detected by Ohai (highest precedence)
|
|
930
|
-
|
|
931
|
-
When multiple attributes with the same path exist at different precedence levels, the highest precedence wins. The tool automatically resolves conflicts and reports which values were overridden.
|
|
932
|
-
|
|
933
|
-
**Parameters:**
|
|
934
|
-
- `path`: Path to the attributes (.rb) file
|
|
935
|
-
- `resolve_precedence`: If True (default), resolves conflicts and shows only winning values. If False, shows all attributes.
|
|
936
|
-
|
|
937
|
-
**Example:**
|
|
938
|
-
```python
|
|
939
|
-
# With precedence resolution (default)
|
|
940
|
-
parse_attributes("/path/to/cookbook/attributes/default.rb")
|
|
941
|
-
# Returns:
|
|
942
|
-
# Resolved Attributes (with precedence):
|
|
943
|
-
# ==================================================
|
|
944
|
-
#
|
|
945
|
-
# Attribute: nginx.port
|
|
946
|
-
# Value: 443
|
|
947
|
-
# Precedence: force_override (level 5)
|
|
948
|
-
# Overridden values: default=80, normal=8080
|
|
949
|
-
#
|
|
950
|
-
# Attribute: nginx.ssl_port
|
|
951
|
-
# Value: 443
|
|
952
|
-
# Precedence: default (level 1)
|
|
953
|
-
#
|
|
954
|
-
# ==================================================
|
|
955
|
-
# Total attributes: 2
|
|
956
|
-
# Attributes with precedence conflicts: 1
|
|
957
|
-
|
|
958
|
-
# Without precedence resolution (show all)
|
|
959
|
-
parse_attributes("/path/to/cookbook/attributes/default.rb", resolve_precedence=False)
|
|
960
|
-
# Returns:
|
|
961
|
-
# default[nginx.port] = 80
|
|
962
|
-
# normal[nginx.port] = 8080
|
|
963
|
-
# force_override[nginx.port] = 443
|
|
964
|
-
# default[nginx.ssl_port] = 443
|
|
965
|
-
```
|
|
966
|
-
|
|
967
|
-
**Use Cases:**
|
|
968
|
-
- Understanding attribute conflicts in complex cookbooks
|
|
969
|
-
- Debugging which attributes will actually be applied
|
|
970
|
-
- Planning attribute migrations to Ansible variables
|
|
971
|
-
- Identifying force_override attributes that need special handling
|
|
972
|
-
|
|
973
|
-
#### `list_cookbook_structure(path: str)`
|
|
974
|
-
List the structure of a Chef cookbook directory.
|
|
975
|
-
|
|
976
|
-
**Example:**
|
|
977
|
-
```python
|
|
978
|
-
list_cookbook_structure("/path/to/cookbook")
|
|
979
|
-
# Returns:
|
|
980
|
-
# recipes/
|
|
981
|
-
# default.rb
|
|
982
|
-
# install.rb
|
|
983
|
-
# attributes/
|
|
984
|
-
# default.rb
|
|
985
|
-
# metadata/
|
|
986
|
-
# metadata.rb
|
|
987
|
-
```
|
|
988
|
-
|
|
989
|
-
#### `parse_template(path: str)`
|
|
990
|
-
Parse a Chef ERB template file and convert it to Jinja2 format.
|
|
991
|
-
|
|
992
|
-
**Example:**
|
|
993
|
-
```python
|
|
994
|
-
parse_template("/path/to/cookbook/templates/default/nginx.conf.erb")
|
|
995
|
-
# Returns JSON with:
|
|
996
|
-
# {
|
|
997
|
-
# "original_file": "/path/to/cookbook/templates/default/nginx.conf.erb",
|
|
998
|
-
# "variables": [
|
|
999
|
-
# "nginx']['port",
|
|
1000
|
-
# "nginx']['server_name",
|
|
1001
|
-
# "nginx']['ssl_enabled"
|
|
1002
|
-
# ],
|
|
1003
|
-
# "jinja2_template": "server {\n listen {{ nginx']['port }};\n {% if nginx']['ssl_enabled %}\n ssl on;\n {% endif %}\n}"
|
|
1004
|
-
# }
|
|
1005
|
-
```
|
|
1006
|
-
|
|
1007
|
-
**ERB to Jinja2 Conversion:**
|
|
1008
|
-
- Variable output: `<%= var %>` → `{{ var }}`
|
|
1009
|
-
- Instance variables: `<%= @var %>` → `{{ var }}`
|
|
1010
|
-
- Node attributes: `<%= node['attr'] %>` → `{{ attr }}`
|
|
1011
|
-
- Conditionals: `<% if cond %>` → `{% if cond %}`
|
|
1012
|
-
- Unless: `<% unless cond %>` → `{% if not cond %}`
|
|
1013
|
-
- Elsif: `<% elsif cond %>` → `{% elif cond %}`
|
|
1014
|
-
- Else: `<% else %>` → `{% else %}`
|
|
1015
|
-
- Loops: `<% arr.each do |item| %>` → `{% for item in arr %}`
|
|
1016
|
-
- End blocks: `<% end %>` → `{% endif %}` or `{% endfor %}`
|
|
1017
|
-
|
|
1018
|
-
#### `parse_custom_resource(path: str)`
|
|
1019
|
-
Parse a Chef custom resource or LWRP file and extract properties, attributes, and actions.
|
|
1020
|
-
|
|
1021
|
-
**Example:**
|
|
1022
|
-
```python
|
|
1023
|
-
parse_custom_resource("/path/to/cookbook/resources/app_config.rb")
|
|
1024
|
-
# Returns JSON with:
|
|
1025
|
-
# {
|
|
1026
|
-
# "resource_file": "/path/to/cookbook/resources/app_config.rb",
|
|
1027
|
-
# "resource_name": "app_config",
|
|
1028
|
-
# "resource_type": "custom_resource", # or "lwrp"
|
|
1029
|
-
# "properties": [
|
|
1030
|
-
# {
|
|
1031
|
-
# "name": "config_name",
|
|
1032
|
-
# "type": "String",
|
|
1033
|
-
# "name_property": true
|
|
1034
|
-
# },
|
|
1035
|
-
# {
|
|
1036
|
-
# "name": "port",
|
|
1037
|
-
# "type": "Integer",
|
|
1038
|
-
# "default": "8080"
|
|
1039
|
-
# },
|
|
1040
|
-
# {
|
|
1041
|
-
# "name": "ssl_enabled",
|
|
1042
|
-
# "type": "[true, false]",
|
|
1043
|
-
# "default": "false"
|
|
1044
|
-
# }
|
|
1045
|
-
# ],
|
|
1046
|
-
# "actions": ["create", "delete"],
|
|
1047
|
-
# "default_action": "create"
|
|
1048
|
-
# }
|
|
1049
|
-
```
|
|
738
|
+
## SousChef
|
|
1050
739
|
|
|
1051
|
-
**Detected Resource Types:**
|
|
1052
|
-
- **Custom Resource** (modern) - Uses `property` keyword
|
|
1053
|
-
- **LWRP** (legacy) - Uses `attribute` keyword with `kind_of:`
|
|
1054
|
-
|
|
1055
|
-
**Property/Attribute Fields:**
|
|
1056
|
-
- `name` - Property/attribute name
|
|
1057
|
-
- `type` - Type constraint (String, Integer, Boolean, Array, Hash, etc.)
|
|
1058
|
-
- `name_property` - Whether this is the resource's name property (true/false)
|
|
1059
740
|
- `default` - Default value if specified
|
|
1060
741
|
- `required` - Whether the property is required (true/false)
|
|
1061
742
|
|
|
1062
743
|
**Action Extraction:**
|
|
744
|
+
|
|
1063
745
|
- Modern format: `action :name do ... end`
|
|
1064
746
|
- LWRP format: `actions :create, :delete, :update`
|
|
1065
747
|
- Supports both formats and mixed declarations
|
|
1066
748
|
|
|
1067
|
-
|
|
749
|
+
### `convert_resource_to_task(resource_type: str, resource_name: str, action: str = "create", properties: str = "")`
|
|
750
|
+
|
|
1068
751
|
Convert a Chef resource to an Ansible task.
|
|
1069
752
|
|
|
1070
753
|
**Example:**
|
|
754
|
+
|
|
1071
755
|
```python
|
|
1072
756
|
convert_resource_to_task("package", "nginx", "install")
|
|
1073
757
|
# Returns:
|
|
@@ -1094,6 +778,7 @@ convert_resource_to_task("template", "/etc/nginx/nginx.conf.erb", "create")
|
|
|
1094
778
|
```
|
|
1095
779
|
|
|
1096
780
|
**Supported Resource Types:**
|
|
781
|
+
|
|
1097
782
|
- `package` → `ansible.builtin.package`
|
|
1098
783
|
- `service` → `ansible.builtin.service`
|
|
1099
784
|
- `template` → `ansible.builtin.template`
|
|
@@ -1106,9 +791,11 @@ convert_resource_to_task("template", "/etc/nginx/nginx.conf.erb", "create")
|
|
|
1106
791
|
- And more...
|
|
1107
792
|
|
|
1108
793
|
#### `parse_habitat_plan(plan_path: str)`
|
|
794
|
+
|
|
1109
795
|
Parse a Chef Habitat plan file (plan.sh) and extract package metadata, dependencies, build/install hooks, and service configuration.
|
|
1110
796
|
|
|
1111
797
|
**Example:**
|
|
798
|
+
|
|
1112
799
|
```python
|
|
1113
800
|
parse_habitat_plan("/path/to/habitat/plan.sh")
|
|
1114
801
|
# Returns JSON with:
|
|
@@ -1144,6 +831,7 @@ parse_habitat_plan("/path/to/habitat/plan.sh")
|
|
|
1144
831
|
```
|
|
1145
832
|
|
|
1146
833
|
**Extracted Information:**
|
|
834
|
+
|
|
1147
835
|
- **Package metadata**: name, origin, version, maintainer, description
|
|
1148
836
|
- **Dependencies**: Build-time and runtime package dependencies
|
|
1149
837
|
- **Ports**: Exported port configurations for service discovery
|
|
@@ -1152,15 +840,18 @@ parse_habitat_plan("/path/to/habitat/plan.sh")
|
|
|
1152
840
|
- **Build callbacks**: do_build, do_install, do_init, and other lifecycle hooks
|
|
1153
841
|
|
|
1154
842
|
**Use Cases:**
|
|
843
|
+
|
|
1155
844
|
- Understanding Habitat application structure before containerization
|
|
1156
845
|
- Extracting dependencies for Docker base image selection
|
|
1157
846
|
- Planning port mappings for docker-compose configurations
|
|
1158
847
|
- Analyzing service dependencies and orchestration needs
|
|
1159
848
|
|
|
1160
849
|
#### `convert_habitat_to_dockerfile(plan_path: str, base_image: str = "ubuntu:22.04")`
|
|
850
|
+
|
|
1161
851
|
Convert a Chef Habitat plan to a production-ready Dockerfile with security validation.
|
|
1162
852
|
|
|
1163
853
|
**Example:**
|
|
854
|
+
|
|
1164
855
|
```python
|
|
1165
856
|
convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
|
|
1166
857
|
# Returns:
|
|
@@ -1202,10 +893,12 @@ convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
|
|
|
1202
893
|
```
|
|
1203
894
|
|
|
1204
895
|
**Parameters:**
|
|
896
|
+
|
|
1205
897
|
- `plan_path`: Path to the Habitat plan.sh file
|
|
1206
898
|
- `base_image`: Docker base image (default: ubuntu:22.04). Validated for security
|
|
1207
899
|
|
|
1208
900
|
**Features:**
|
|
901
|
+
|
|
1209
902
|
- **Dependency mapping**: Converts Habitat dependencies to apt packages
|
|
1210
903
|
- **Build optimization**: Multi-stage builds when applicable
|
|
1211
904
|
- **Security scanning**: Detects dangerous patterns (curl|sh, eval, etc.)
|
|
@@ -1217,9 +910,11 @@ convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
|
|
|
1217
910
|
The tool processes shell commands from Habitat plans and includes them in the Dockerfile. Only use with trusted Habitat plans from known sources. Review generated Dockerfiles before building images.
|
|
1218
911
|
|
|
1219
912
|
#### `generate_compose_from_habitat(plan_paths: str, network_name: str = "habitat_net")`
|
|
913
|
+
|
|
1220
914
|
Generate docker-compose.yml from multiple Habitat plans for multi-service deployments.
|
|
1221
915
|
|
|
1222
916
|
**Example:**
|
|
917
|
+
|
|
1223
918
|
```python
|
|
1224
919
|
# Single service
|
|
1225
920
|
generate_compose_from_habitat("/path/to/nginx/plan.sh", "myapp_network")
|
|
@@ -1289,10 +984,12 @@ generate_compose_from_habitat(
|
|
|
1289
984
|
```
|
|
1290
985
|
|
|
1291
986
|
**Parameters:**
|
|
987
|
+
|
|
1292
988
|
- `plan_paths`: Comma-separated paths to plan.sh files for multiple services
|
|
1293
989
|
- `network_name`: Docker network name for service communication (default: habitat_net)
|
|
1294
990
|
|
|
1295
991
|
**Features:**
|
|
992
|
+
|
|
1296
993
|
- **Multi-service orchestration**: Combines multiple Habitat plans into one compose file
|
|
1297
994
|
- **Automatic dependencies**: Creates depends_on from Habitat service binds
|
|
1298
995
|
- **Volume detection**: Identifies services needing persistent storage from do_init callbacks
|
|
@@ -1301,6 +998,7 @@ generate_compose_from_habitat(
|
|
|
1301
998
|
- **Environment variables**: Generates environment configuration from port definitions
|
|
1302
999
|
|
|
1303
1000
|
**Use Cases:**
|
|
1001
|
+
|
|
1304
1002
|
- Converting multi-service Habitat applications to Docker Compose
|
|
1305
1003
|
- Creating development environments from production Habitat plans
|
|
1306
1004
|
- Simplifying container orchestration for local testing
|
|
@@ -1310,7 +1008,7 @@ generate_compose_from_habitat(
|
|
|
1310
1008
|
|
|
1311
1009
|
### Project Structure
|
|
1312
1010
|
|
|
1313
|
-
```
|
|
1011
|
+
```text
|
|
1314
1012
|
souschef/
|
|
1315
1013
|
├── souschef/
|
|
1316
1014
|
│ ├── __init__.py
|
|
@@ -1330,12 +1028,14 @@ souschef/
|
|
|
1330
1028
|
SousChef uses a modern Python toolchain for code quality:
|
|
1331
1029
|
|
|
1332
1030
|
- **Ruff**: Primary linter and formatter (replaces Black, isort, flake8)
|
|
1031
|
+
|
|
1333
1032
|
```bash
|
|
1334
1033
|
poetry run ruff check . # Lint code
|
|
1335
1034
|
poetry run ruff format . # Format code
|
|
1336
1035
|
```
|
|
1337
1036
|
|
|
1338
1037
|
- **mypy**: Static type checking for CI/CD
|
|
1038
|
+
|
|
1339
1039
|
```bash
|
|
1340
1040
|
poetry run mypy souschef # Type check source code
|
|
1341
1041
|
```
|
|
@@ -1345,11 +1045,13 @@ SousChef uses a modern Python toolchain for code quality:
|
|
|
1345
1045
|
- Provides immediate feedback during development
|
|
1346
1046
|
|
|
1347
1047
|
- **pytest**: Testing framework with coverage reporting
|
|
1048
|
+
|
|
1348
1049
|
```bash
|
|
1349
1050
|
poetry run pytest --cov=souschef --cov-report=term-missing
|
|
1350
1051
|
```
|
|
1351
1052
|
|
|
1352
1053
|
**Quality Requirements:**
|
|
1054
|
+
|
|
1353
1055
|
- Zero warnings from all tools (Ruff, mypy, Pylance)
|
|
1354
1056
|
- Type hints required for all functions
|
|
1355
1057
|
- Google-style docstrings
|
|
@@ -1444,6 +1146,7 @@ poetry run mutmut results
|
|
|
1444
1146
|
### VS Code Tasks
|
|
1445
1147
|
|
|
1446
1148
|
The project includes several VS Code tasks:
|
|
1149
|
+
|
|
1447
1150
|
- **Run Tests** - Execute test suite
|
|
1448
1151
|
- **Run Tests with Coverage** - Generate coverage reports
|
|
1449
1152
|
- **Lint (Ruff)** - Check code quality
|
|
@@ -1457,6 +1160,7 @@ Thank you for your interest in contributing to SousChef!
|
|
|
1457
1160
|
**Before you start**, please read the [**Architecture Guide**](docs/ARCHITECTURE.md) to understand where different code belongs and why. This is essential for understanding how to structure your contributions.
|
|
1458
1161
|
|
|
1459
1162
|
For complete contributing guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md), which includes:
|
|
1163
|
+
|
|
1460
1164
|
- Development setup instructions
|
|
1461
1165
|
- Code standards and quality tools
|
|
1462
1166
|
- Testing requirements and patterns
|
|
@@ -1464,6 +1168,7 @@ For complete contributing guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md), wh
|
|
|
1464
1168
|
- Release procedures
|
|
1465
1169
|
|
|
1466
1170
|
**Quick Checklist for Contributions:**
|
|
1171
|
+
|
|
1467
1172
|
1. Read [**docs/ARCHITECTURE.md**](docs/ARCHITECTURE.md) to understand module structure
|
|
1468
1173
|
2. Ensure all tests pass: `poetry run pytest`
|
|
1469
1174
|
3. Code passes linting: `poetry run ruff check .`
|
|
@@ -1481,5 +1186,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
1481
1186
|
|
|
1482
1187
|
---
|
|
1483
1188
|
|
|
1484
|
-
**SousChef** - *Ansible automation, one recipe at a time.*
|
|
1485
|
-
|