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