claude-mpm 5.4.59__py3-none-any.whl → 5.4.62__py3-none-any.whl
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.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md +5 -0
- claude_mpm/scripts/start_activity_logging.py +0 -0
- claude_mpm/services/agents/deployment/agent_template_builder.py +8 -0
- claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +79 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +178 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/agent-prompts.md +577 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/coordination-patterns.md +467 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/examples.md +537 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/troubleshooting.md +730 -0
- claude_mpm/skills/bundled/collaboration/git-worktrees.md +317 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +112 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/code-reviewer-template.md +146 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/review-examples.md +412 -0
- claude_mpm/skills/bundled/collaboration/stacked-prs.md +251 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +81 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/references/best-practices.md +362 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/references/plan-structure-templates.md +312 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +152 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/advanced-techniques.md +668 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/examples.md +587 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/integration.md +438 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/tracing-techniques.md +391 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +119 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +148 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +483 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +452 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +449 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +411 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +14 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +58 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +68 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +69 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +131 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +325 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/integration-and-workflows.md +490 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/red-flags-and-failures.md +425 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +499 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/INTEGRATION.md +611 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/README.md +596 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/SKILL.md +260 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/examples/nextjs-env-structure.md +315 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/references/frameworks.md +436 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/references/security.md +433 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/references/synchronization.md +452 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/references/troubleshooting.md +404 -0
- claude_mpm/skills/bundled/infrastructure/env-manager/references/validation.md +420 -0
- claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +86 -0
- claude_mpm/skills/bundled/main/internal-comms/SKILL.md +43 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +47 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +65 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +30 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +16 -0
- claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +160 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/design_principles.md +412 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +602 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +915 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +916 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +752 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/workflow.md +1237 -0
- claude_mpm/skills/bundled/main/skill-creator/SKILL.md +189 -0
- claude_mpm/skills/bundled/main/skill-creator/references/best-practices.md +500 -0
- claude_mpm/skills/bundled/main/skill-creator/references/creation-workflow.md +464 -0
- claude_mpm/skills/bundled/main/skill-creator/references/examples.md +619 -0
- claude_mpm/skills/bundled/main/skill-creator/references/progressive-disclosure.md +437 -0
- claude_mpm/skills/bundled/main/skill-creator/references/skill-structure.md +231 -0
- claude_mpm/skills/bundled/php/espocrm-development/SKILL.md +170 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/architecture.md +602 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/common-tasks.md +821 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/development-workflow.md +742 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/frontend-customization.md +726 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/hooks-and-services.md +764 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/testing-debugging.md +831 -0
- claude_mpm/skills/bundled/pm/pm-delegation-patterns/SKILL.md +167 -0
- claude_mpm/skills/bundled/pm/pm-git-file-tracking/SKILL.md +113 -0
- claude_mpm/skills/bundled/pm/pm-pr-workflow/SKILL.md +124 -0
- claude_mpm/skills/bundled/pm/pm-ticketing-integration/SKILL.md +154 -0
- claude_mpm/skills/bundled/pm/pm-verification-protocols/SKILL.md +198 -0
- claude_mpm/skills/bundled/react/flexlayout-react.md +742 -0
- claude_mpm/skills/bundled/rust/desktop-applications/SKILL.md +226 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/architecture-patterns.md +901 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/native-gui-frameworks.md +901 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/platform-integration.md +775 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/state-management.md +937 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/tauri-framework.md +770 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/testing-deployment.md +961 -0
- claude_mpm/skills/bundled/tauri/tauri-async-patterns.md +495 -0
- claude_mpm/skills/bundled/tauri/tauri-build-deploy.md +599 -0
- claude_mpm/skills/bundled/tauri/tauri-command-patterns.md +535 -0
- claude_mpm/skills/bundled/tauri/tauri-error-handling.md +613 -0
- claude_mpm/skills/bundled/tauri/tauri-event-system.md +648 -0
- claude_mpm/skills/bundled/tauri/tauri-file-system.md +673 -0
- claude_mpm/skills/bundled/tauri/tauri-frontend-integration.md +767 -0
- claude_mpm/skills/bundled/tauri/tauri-performance.md +669 -0
- claude_mpm/skills/bundled/tauri/tauri-state-management.md +573 -0
- claude_mpm/skills/bundled/tauri/tauri-testing.md +384 -0
- claude_mpm/skills/bundled/tauri/tauri-window-management.md +628 -0
- claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +119 -0
- claude_mpm/skills/bundled/testing/condition-based-waiting/references/patterns-and-implementation.md +253 -0
- claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +145 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +543 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +741 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +470 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +458 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +639 -0
- claude_mpm/skills/bundled/testing/test-quality-inspector/SKILL.md +458 -0
- claude_mpm/skills/bundled/testing/test-quality-inspector/examples/example-inspection-report.md +411 -0
- claude_mpm/skills/bundled/testing/test-quality-inspector/references/assertion-quality.md +317 -0
- claude_mpm/skills/bundled/testing/test-quality-inspector/references/inspection-checklist.md +270 -0
- claude_mpm/skills/bundled/testing/test-quality-inspector/references/red-flags.md +436 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +140 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/completeness-anti-patterns.md +572 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/core-anti-patterns.md +411 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/detection-guide.md +569 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/tdd-connection.md +695 -0
- claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +184 -0
- claude_mpm/skills/bundled/testing/webapp-testing/decision-tree.md +459 -0
- claude_mpm/skills/bundled/testing/webapp-testing/playwright-patterns.md +479 -0
- claude_mpm/skills/bundled/testing/webapp-testing/reconnaissance-pattern.md +687 -0
- claude_mpm/skills/bundled/testing/webapp-testing/server-management.md +758 -0
- claude_mpm/skills/bundled/testing/webapp-testing/troubleshooting.md +868 -0
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/METADATA +1 -1
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/RECORD +127 -10
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/WHEEL +0 -0
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/entry_points.txt +0 -0
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/licenses/LICENSE-FAQ.md +0 -0
- {claude_mpm-5.4.59.dist-info → claude_mpm-5.4.62.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
# Agent Integration Guide for env-manager
|
|
2
|
+
|
|
3
|
+
This guide shows how Claude MPM agents should use the env-manager skill for environment variable validation, security scanning, and deployment preparation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The env-manager skill provides agents with systematic environment variable management capabilities. Agents can delegate environment validation tasks to this skill or invoke it directly for automated checks.
|
|
8
|
+
|
|
9
|
+
## Skill Invocation Pattern
|
|
10
|
+
|
|
11
|
+
### Basic Invocation
|
|
12
|
+
|
|
13
|
+
Agents can invoke the env-manager skill using the standard Claude MPM skill invocation pattern:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Use env-manager skill for environment variable validation
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Specific Task Invocation
|
|
20
|
+
|
|
21
|
+
For targeted tasks, agents can be more specific:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Use env-manager skill to validate Next.js environment variables for security issues
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Use env-manager skill to generate .env.example documentation
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Use env-manager skill to compare .env with .env.example before deployment
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Agent Usage Patterns
|
|
36
|
+
|
|
37
|
+
### Pattern 1: Pre-Deployment Validation
|
|
38
|
+
|
|
39
|
+
**Scenario:** Agent needs to validate environment before deployment
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# Agent workflow
|
|
43
|
+
1. Identify deployment target (Vercel, Railway, etc.)
|
|
44
|
+
2. Invoke env-manager skill: "Validate .env for Next.js deployment to Vercel"
|
|
45
|
+
3. Parse validation results
|
|
46
|
+
4. If errors: Report to user, block deployment
|
|
47
|
+
5. If warnings: Report to user, request confirmation
|
|
48
|
+
6. If success: Proceed with deployment
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Example skill invocation:**
|
|
52
|
+
```
|
|
53
|
+
I need to validate the Next.js environment configuration before deploying to Vercel.
|
|
54
|
+
Use env-manager skill to check .env.local for:
|
|
55
|
+
- Next.js specific issues (NEXT_PUBLIC_ prefix usage)
|
|
56
|
+
- Security issues (exposed secrets)
|
|
57
|
+
- Missing required variables
|
|
58
|
+
- Deployment readiness
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Pattern 2: Security Scanning
|
|
62
|
+
|
|
63
|
+
**Scenario:** Security agent needs to scan for exposed secrets
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
# Security agent workflow
|
|
67
|
+
1. Locate .env files in project
|
|
68
|
+
2. Invoke env-manager: "Scan for security issues in environment variables"
|
|
69
|
+
3. Parse security warnings
|
|
70
|
+
4. Generate security report
|
|
71
|
+
5. Recommend fixes for found issues
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Example skill invocation:**
|
|
75
|
+
```
|
|
76
|
+
Use env-manager skill to perform security scan of .env.local:
|
|
77
|
+
- Check for secrets in client-exposed variables (NEXT_PUBLIC_, VITE_, REACT_APP_)
|
|
78
|
+
- Validate secret formats
|
|
79
|
+
- Identify potential credential leaks
|
|
80
|
+
- Report security warnings
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Pattern 3: Documentation Generation
|
|
84
|
+
|
|
85
|
+
**Scenario:** Agent needs to generate .env.example for repository
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
# Documentation agent workflow
|
|
89
|
+
1. Read current .env file
|
|
90
|
+
2. Invoke env-manager: "Generate .env.example with sanitized values"
|
|
91
|
+
3. Review generated file
|
|
92
|
+
4. Add to git (ensure .env.example, not .env)
|
|
93
|
+
5. Update README with environment setup instructions
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Example skill invocation:**
|
|
97
|
+
```
|
|
98
|
+
Use env-manager skill to generate .env.example from .env:
|
|
99
|
+
- Sanitize all secret values
|
|
100
|
+
- Keep structure and variable names
|
|
101
|
+
- Add helpful comments for required variables
|
|
102
|
+
- Ensure safe for git commit
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Pattern 4: Onboarding Assistance
|
|
106
|
+
|
|
107
|
+
**Scenario:** Agent helps new developer set up environment
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# Onboarding agent workflow
|
|
111
|
+
1. Guide user to copy .env.example to .env
|
|
112
|
+
2. Invoke env-manager: "Compare .env with .env.example"
|
|
113
|
+
3. Report missing variables to user
|
|
114
|
+
4. Guide user to fill in missing values
|
|
115
|
+
5. Re-validate until complete
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Example skill invocation:**
|
|
119
|
+
```
|
|
120
|
+
Use env-manager skill to verify new developer's environment setup:
|
|
121
|
+
- Compare .env with .env.example
|
|
122
|
+
- Report missing required variables
|
|
123
|
+
- Identify extra undocumented variables
|
|
124
|
+
- Validate all values are filled in (no empty values)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Pattern 5: CI/CD Integration
|
|
128
|
+
|
|
129
|
+
**Scenario:** CI/CD agent validates environment in pipeline
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
# CI/CD agent workflow
|
|
133
|
+
1. Locate .env.example in repository
|
|
134
|
+
2. Invoke env-manager: "Validate .env.example with strict mode and JSON output"
|
|
135
|
+
3. Parse JSON results
|
|
136
|
+
4. If validation fails: Fail pipeline with details
|
|
137
|
+
5. If validation passes: Continue pipeline
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Example skill invocation:**
|
|
141
|
+
```
|
|
142
|
+
Use env-manager skill for CI/CD validation:
|
|
143
|
+
- Validate .env.example structure
|
|
144
|
+
- Use strict mode (warnings as errors)
|
|
145
|
+
- Output JSON for parsing
|
|
146
|
+
- Return exit code for pipeline
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Expected Outputs
|
|
150
|
+
|
|
151
|
+
### Success Response
|
|
152
|
+
|
|
153
|
+
When validation passes:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"status": "success",
|
|
158
|
+
"message": "Validation successful",
|
|
159
|
+
"stats": {
|
|
160
|
+
"total_vars": 15,
|
|
161
|
+
"errors": 0,
|
|
162
|
+
"warnings": 0
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Agent action:** Proceed with next step in workflow
|
|
168
|
+
|
|
169
|
+
### Error Response
|
|
170
|
+
|
|
171
|
+
When validation fails:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"status": "error",
|
|
176
|
+
"errors": [
|
|
177
|
+
{
|
|
178
|
+
"line": 12,
|
|
179
|
+
"key": "DATABASE_URL",
|
|
180
|
+
"message": "Empty value not allowed",
|
|
181
|
+
"severity": "error"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"stats": {
|
|
185
|
+
"total_vars": 15,
|
|
186
|
+
"errors": 1,
|
|
187
|
+
"warnings": 0
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Agent action:**
|
|
193
|
+
1. Report errors to user
|
|
194
|
+
2. Suggest fixes
|
|
195
|
+
3. Block deployment/pipeline
|
|
196
|
+
4. Request user to fix errors and retry
|
|
197
|
+
|
|
198
|
+
### Warning Response
|
|
199
|
+
|
|
200
|
+
When warnings are found:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"status": "warning",
|
|
205
|
+
"warnings": [
|
|
206
|
+
{
|
|
207
|
+
"line": 5,
|
|
208
|
+
"key": "NEXT_PUBLIC_API_KEY",
|
|
209
|
+
"message": "Potential secret in client-exposed variable",
|
|
210
|
+
"severity": "warning"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"stats": {
|
|
214
|
+
"total_vars": 15,
|
|
215
|
+
"errors": 0,
|
|
216
|
+
"warnings": 1
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Agent action:**
|
|
222
|
+
1. Report warnings to user
|
|
223
|
+
2. Explain security implications
|
|
224
|
+
3. Request confirmation to proceed
|
|
225
|
+
4. In strict mode: Treat as error
|
|
226
|
+
|
|
227
|
+
## Error Handling
|
|
228
|
+
|
|
229
|
+
### File Not Found
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
if file_not_found:
|
|
233
|
+
agent.report("Environment file not found")
|
|
234
|
+
agent.suggest("Create .env file from .env.example: cp .env.example .env")
|
|
235
|
+
agent.guide_user_to_fill_values()
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Validation Errors
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
if validation_errors:
|
|
242
|
+
agent.report_errors(errors)
|
|
243
|
+
agent.suggest_fixes_for_each_error()
|
|
244
|
+
agent.block_deployment()
|
|
245
|
+
agent.request_retry_after_fixes()
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Security Warnings
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
if security_warnings:
|
|
252
|
+
agent.highlight_security_risks()
|
|
253
|
+
agent.explain_client_exposure()
|
|
254
|
+
agent.suggest_moving_to_server_side()
|
|
255
|
+
agent.request_confirmation_or_fix()
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Missing Variables
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
if missing_vars:
|
|
262
|
+
agent.list_missing_vars()
|
|
263
|
+
agent.guide_where_to_find_values()
|
|
264
|
+
agent.explain_importance_of_each_var()
|
|
265
|
+
agent.validate_after_user_adds_vars()
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## JSON Output Parsing
|
|
269
|
+
|
|
270
|
+
Agents should use `--json` flag for structured output:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
python3 scripts/validate_env.py .env --framework nextjs --json
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Parsing JSON output:**
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
import json
|
|
280
|
+
import subprocess
|
|
281
|
+
|
|
282
|
+
result = subprocess.run(
|
|
283
|
+
["python3", "scripts/validate_env.py", ".env", "--framework", "nextjs", "--json"],
|
|
284
|
+
capture_output=True,
|
|
285
|
+
text=True
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
data = json.loads(result.stdout)
|
|
289
|
+
|
|
290
|
+
if data["valid"]:
|
|
291
|
+
# Validation passed
|
|
292
|
+
proceed_with_deployment()
|
|
293
|
+
elif data["errors"]:
|
|
294
|
+
# Validation failed
|
|
295
|
+
report_errors_to_user(data["errors"])
|
|
296
|
+
block_deployment()
|
|
297
|
+
elif data["warnings"]:
|
|
298
|
+
# Warnings found
|
|
299
|
+
report_warnings_to_user(data["warnings"])
|
|
300
|
+
request_confirmation()
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Agent-Specific Workflows
|
|
304
|
+
|
|
305
|
+
### nextjs-engineer Agent
|
|
306
|
+
|
|
307
|
+
**Use cases:**
|
|
308
|
+
- Pre-deployment validation for Vercel
|
|
309
|
+
- NEXT_PUBLIC_ variable security checks
|
|
310
|
+
- .env.local vs .env.production management
|
|
311
|
+
|
|
312
|
+
**Example workflow:**
|
|
313
|
+
```
|
|
314
|
+
1. User: "Deploy to Vercel"
|
|
315
|
+
2. Agent validates .env.local with --framework nextjs
|
|
316
|
+
3. Agent checks for NEXT_PUBLIC_ secrets
|
|
317
|
+
4. Agent compares with Vercel environment variables
|
|
318
|
+
5. Agent proceeds with deployment or reports issues
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### security Agent
|
|
322
|
+
|
|
323
|
+
**Use cases:**
|
|
324
|
+
- Secret exposure scanning
|
|
325
|
+
- Client-side variable security audit
|
|
326
|
+
- Credential format validation
|
|
327
|
+
|
|
328
|
+
**Example workflow:**
|
|
329
|
+
```
|
|
330
|
+
1. User: "Run security audit"
|
|
331
|
+
2. Agent scans all .env* files
|
|
332
|
+
3. Agent checks for exposed secrets in NEXT_PUBLIC_ vars
|
|
333
|
+
4. Agent validates .gitignore covers .env files
|
|
334
|
+
5. Agent generates security report
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### vercel-ops-agent Agent
|
|
338
|
+
|
|
339
|
+
**Use cases:**
|
|
340
|
+
- Platform environment sync
|
|
341
|
+
- Deployment configuration validation
|
|
342
|
+
- Environment parity checks
|
|
343
|
+
|
|
344
|
+
**Example workflow:**
|
|
345
|
+
```
|
|
346
|
+
1. User: "Sync environment to Vercel"
|
|
347
|
+
2. Agent compares local .env with Vercel project settings
|
|
348
|
+
3. Agent identifies missing/different variables
|
|
349
|
+
4. Agent generates vercel.json or CLI commands
|
|
350
|
+
5. Agent syncs to platform (with confirmation)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### devops Agent
|
|
354
|
+
|
|
355
|
+
**Use cases:**
|
|
356
|
+
- CI/CD pipeline validation
|
|
357
|
+
- Multi-environment management
|
|
358
|
+
- .env.example maintenance
|
|
359
|
+
|
|
360
|
+
**Example workflow:**
|
|
361
|
+
```
|
|
362
|
+
1. User: "Set up CI/CD for environment validation"
|
|
363
|
+
2. Agent creates GitHub Actions workflow
|
|
364
|
+
3. Agent configures env-manager validation step
|
|
365
|
+
4. Agent sets up strict mode for quality gate
|
|
366
|
+
5. Agent tests pipeline with .env.example
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### onboarding-assistant Agent
|
|
370
|
+
|
|
371
|
+
**Use cases:**
|
|
372
|
+
- New developer environment setup
|
|
373
|
+
- Guided .env configuration
|
|
374
|
+
- Validation and troubleshooting
|
|
375
|
+
|
|
376
|
+
**Example workflow:**
|
|
377
|
+
```
|
|
378
|
+
1. User: "New developer needs environment setup"
|
|
379
|
+
2. Agent guides: cp .env.example .env
|
|
380
|
+
3. Agent runs validation to find missing vars
|
|
381
|
+
4. Agent explains each required variable
|
|
382
|
+
5. Agent validates complete setup
|
|
383
|
+
6. Agent confirms ready for development
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Best Practices for Agents
|
|
387
|
+
|
|
388
|
+
### 1. Always Validate Before Deployment
|
|
389
|
+
|
|
390
|
+
```python
|
|
391
|
+
def deploy_to_platform():
|
|
392
|
+
# ✅ Good: Validate first
|
|
393
|
+
validation_result = run_env_validation()
|
|
394
|
+
if not validation_result.valid:
|
|
395
|
+
report_errors_and_block()
|
|
396
|
+
return
|
|
397
|
+
|
|
398
|
+
proceed_with_deployment()
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### 2. Use Framework-Specific Validation
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
def validate_for_framework(framework):
|
|
405
|
+
# ✅ Good: Framework-aware
|
|
406
|
+
cmd = f"python3 scripts/validate_env.py .env --framework {framework}"
|
|
407
|
+
|
|
408
|
+
# ❌ Bad: Generic validation only
|
|
409
|
+
# cmd = "python3 scripts/validate_env.py .env"
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 3. Parse JSON for Structured Handling
|
|
413
|
+
|
|
414
|
+
```python
|
|
415
|
+
# ✅ Good: Structured output
|
|
416
|
+
result = run_validation(json=True)
|
|
417
|
+
data = json.loads(result.stdout)
|
|
418
|
+
handle_each_error(data["errors"])
|
|
419
|
+
|
|
420
|
+
# ❌ Bad: Parse text output
|
|
421
|
+
# result = run_validation()
|
|
422
|
+
# grep for errors in text
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### 4. Explain Security Warnings
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
def handle_security_warning(warning):
|
|
429
|
+
# ✅ Good: Explain the risk
|
|
430
|
+
agent.explain(f"{warning.key} is exposed to client-side code")
|
|
431
|
+
agent.explain("This means users can see this value in their browser")
|
|
432
|
+
agent.suggest("Move to server-side variable or use publishable key")
|
|
433
|
+
|
|
434
|
+
# ❌ Bad: Just show the warning
|
|
435
|
+
# print(warning)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### 5. Guide Users to Fix Issues
|
|
439
|
+
|
|
440
|
+
```python
|
|
441
|
+
def handle_missing_variable(var_name):
|
|
442
|
+
# ✅ Good: Actionable guidance
|
|
443
|
+
agent.explain(f"{var_name} is required but missing")
|
|
444
|
+
agent.explain("This variable is used for: <purpose>")
|
|
445
|
+
agent.suggest(f"Add to .env: {var_name}=<value>")
|
|
446
|
+
agent.guide("You can find this value in: <location>")
|
|
447
|
+
|
|
448
|
+
# ❌ Bad: Just report it's missing
|
|
449
|
+
# print(f"Missing: {var_name}")
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### 6. Use Strict Mode in CI/CD
|
|
453
|
+
|
|
454
|
+
```python
|
|
455
|
+
def ci_cd_validation():
|
|
456
|
+
# ✅ Good: Strict mode in CI
|
|
457
|
+
result = run_validation(strict=True)
|
|
458
|
+
# Warnings will fail the pipeline
|
|
459
|
+
|
|
460
|
+
# ❌ Bad: Ignore warnings in CI
|
|
461
|
+
# result = run_validation()
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### 7. Never Log Actual Secret Values
|
|
465
|
+
|
|
466
|
+
```python
|
|
467
|
+
def report_validation_result(result):
|
|
468
|
+
# ✅ Good: Report structure, not values
|
|
469
|
+
agent.report(f"Found {len(result.errors)} errors")
|
|
470
|
+
agent.report_error_details_without_values()
|
|
471
|
+
|
|
472
|
+
# ❌ Bad: Log actual values
|
|
473
|
+
# print(f"DATABASE_URL={os.getenv('DATABASE_URL')}") # NEVER!
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Integration Checklist
|
|
477
|
+
|
|
478
|
+
When integrating env-manager into an agent workflow:
|
|
479
|
+
|
|
480
|
+
- [ ] Identify validation trigger (deployment, commit, security scan)
|
|
481
|
+
- [ ] Determine appropriate framework (nextjs, vite, react, nodejs, flask)
|
|
482
|
+
- [ ] Choose validation mode (normal, strict, quiet)
|
|
483
|
+
- [ ] Set up JSON output parsing
|
|
484
|
+
- [ ] Handle all error types (file not found, validation errors, warnings)
|
|
485
|
+
- [ ] Provide actionable guidance for each error type
|
|
486
|
+
- [ ] Implement retry logic after user fixes issues
|
|
487
|
+
- [ ] Never log actual secret values
|
|
488
|
+
- [ ] Test with various .env file scenarios
|
|
489
|
+
- [ ] Document agent's env-manager usage in agent template
|
|
490
|
+
|
|
491
|
+
## Example Agent Implementation
|
|
492
|
+
|
|
493
|
+
Here's a complete example of a deployment agent using env-manager:
|
|
494
|
+
|
|
495
|
+
```python
|
|
496
|
+
class DeploymentAgent:
|
|
497
|
+
def __init__(self):
|
|
498
|
+
self.env_manager = EnvManagerSkill()
|
|
499
|
+
|
|
500
|
+
def deploy_to_vercel(self, env_file=".env.local"):
|
|
501
|
+
"""Deploy Next.js app to Vercel with env validation."""
|
|
502
|
+
|
|
503
|
+
# Step 1: Pre-deployment validation
|
|
504
|
+
print("🔍 Validating environment variables...")
|
|
505
|
+
result = self.env_manager.validate(
|
|
506
|
+
file=env_file,
|
|
507
|
+
framework="nextjs",
|
|
508
|
+
strict=True,
|
|
509
|
+
json=True
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
# Step 2: Parse results
|
|
513
|
+
data = json.loads(result.stdout)
|
|
514
|
+
|
|
515
|
+
# Step 3: Handle errors
|
|
516
|
+
if data.get("errors"):
|
|
517
|
+
self.report_errors(data["errors"])
|
|
518
|
+
print("❌ Deployment blocked due to validation errors")
|
|
519
|
+
return False
|
|
520
|
+
|
|
521
|
+
# Step 4: Handle warnings
|
|
522
|
+
if data.get("warnings"):
|
|
523
|
+
self.report_warnings(data["warnings"])
|
|
524
|
+
if not self.request_user_confirmation():
|
|
525
|
+
print("⚠️ Deployment cancelled by user")
|
|
526
|
+
return False
|
|
527
|
+
|
|
528
|
+
# Step 5: Validate completeness
|
|
529
|
+
if not self.compare_with_example(env_file):
|
|
530
|
+
print("❌ Missing required variables")
|
|
531
|
+
return False
|
|
532
|
+
|
|
533
|
+
# Step 6: Proceed with deployment
|
|
534
|
+
print("✅ Environment validation passed")
|
|
535
|
+
print("🚀 Deploying to Vercel...")
|
|
536
|
+
self.deploy()
|
|
537
|
+
return True
|
|
538
|
+
|
|
539
|
+
def report_errors(self, errors):
|
|
540
|
+
"""Report validation errors with actionable guidance."""
|
|
541
|
+
print(f"\n❌ Found {len(errors)} validation error(s):\n")
|
|
542
|
+
for error in errors:
|
|
543
|
+
print(f"Line {error['line']}: {error['key']}")
|
|
544
|
+
print(f" Error: {error['message']}")
|
|
545
|
+
print(f" Fix: {self.get_fix_suggestion(error)}\n")
|
|
546
|
+
|
|
547
|
+
def report_warnings(self, warnings):
|
|
548
|
+
"""Report validation warnings with security context."""
|
|
549
|
+
print(f"\n⚠️ Found {len(warnings)} warning(s):\n")
|
|
550
|
+
for warning in warnings:
|
|
551
|
+
print(f"{warning['key']}: {warning['message']}")
|
|
552
|
+
if "client-exposed" in warning['message']:
|
|
553
|
+
print(" ⚠️ Security risk: This value will be visible in browser")
|
|
554
|
+
print(" Fix: Move to server-side variable or use publishable key")
|
|
555
|
+
print()
|
|
556
|
+
|
|
557
|
+
def compare_with_example(self, env_file):
|
|
558
|
+
"""Ensure all required variables are present."""
|
|
559
|
+
result = self.env_manager.validate(
|
|
560
|
+
file=env_file,
|
|
561
|
+
compare_with=".env.example",
|
|
562
|
+
json=True
|
|
563
|
+
)
|
|
564
|
+
data = json.loads(result.stdout)
|
|
565
|
+
|
|
566
|
+
if data.get("missing_vars"):
|
|
567
|
+
print(f"❌ Missing required variables: {', '.join(data['missing_vars'])}")
|
|
568
|
+
print("Add these to your .env file before deploying")
|
|
569
|
+
return False
|
|
570
|
+
|
|
571
|
+
return True
|
|
572
|
+
|
|
573
|
+
def request_user_confirmation(self):
|
|
574
|
+
"""Request user confirmation for warnings."""
|
|
575
|
+
response = input("⚠️ Warnings found. Proceed anyway? (y/N): ")
|
|
576
|
+
return response.lower() == 'y'
|
|
577
|
+
|
|
578
|
+
def get_fix_suggestion(self, error):
|
|
579
|
+
"""Provide fix suggestion based on error type."""
|
|
580
|
+
if "empty value" in error["message"].lower():
|
|
581
|
+
return f"Add a value for {error['key']}"
|
|
582
|
+
elif "duplicate" in error["message"].lower():
|
|
583
|
+
return f"Remove duplicate definition of {error['key']}"
|
|
584
|
+
elif "invalid format" in error["message"].lower():
|
|
585
|
+
return f"Fix format: {error['key']}=value"
|
|
586
|
+
else:
|
|
587
|
+
return "Review and fix the issue"
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
## Support and Resources
|
|
591
|
+
|
|
592
|
+
- **Skill Documentation**: [README.md](README.md)
|
|
593
|
+
- **Validation Reference**: [references/validation.md](references/validation.md)
|
|
594
|
+
- **Security Reference**: [references/security.md](references/security.md)
|
|
595
|
+
- **Framework Reference**: [references/frameworks.md](references/frameworks.md)
|
|
596
|
+
- **Troubleshooting**: [references/troubleshooting.md](references/troubleshooting.md)
|
|
597
|
+
|
|
598
|
+
## Contributing
|
|
599
|
+
|
|
600
|
+
When adding env-manager integration to agents:
|
|
601
|
+
|
|
602
|
+
1. Follow the patterns in this guide
|
|
603
|
+
2. Test with various .env file scenarios
|
|
604
|
+
3. Document the integration in agent template
|
|
605
|
+
4. Submit examples to this guide
|
|
606
|
+
5. Ensure security best practices (never log secrets!)
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
**Version**: 1.0.0
|
|
611
|
+
**Last Updated**: 2025-11-13
|