@vfarcic/dot-ai 0.151.0 → 0.153.0

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/core/artifacthub.d.ts +85 -0
  3. package/dist/core/artifacthub.d.ts.map +1 -0
  4. package/dist/core/artifacthub.js +106 -0
  5. package/dist/core/helm-types.d.ts +39 -0
  6. package/dist/core/helm-types.d.ts.map +1 -0
  7. package/dist/core/helm-types.js +5 -0
  8. package/dist/core/helm-utils.d.ts +66 -0
  9. package/dist/core/helm-utils.d.ts.map +1 -0
  10. package/dist/core/helm-utils.js +196 -0
  11. package/dist/core/index.d.ts +7 -1
  12. package/dist/core/index.d.ts.map +1 -1
  13. package/dist/core/index.js +12 -0
  14. package/dist/core/schema.d.ts +32 -4
  15. package/dist/core/schema.d.ts.map +1 -1
  16. package/dist/core/schema.js +200 -18
  17. package/dist/core/solution-cr.d.ts.map +1 -1
  18. package/dist/core/solution-cr.js +2 -3
  19. package/dist/tools/answer-question.d.ts.map +1 -1
  20. package/dist/tools/answer-question.js +85 -16
  21. package/dist/tools/choose-solution.d.ts.map +1 -1
  22. package/dist/tools/choose-solution.js +36 -24
  23. package/dist/tools/deploy-manifests.d.ts +2 -1
  24. package/dist/tools/deploy-manifests.d.ts.map +1 -1
  25. package/dist/tools/deploy-manifests.js +86 -2
  26. package/dist/tools/generate-manifests.d.ts +1 -0
  27. package/dist/tools/generate-manifests.d.ts.map +1 -1
  28. package/dist/tools/generate-manifests.js +204 -1
  29. package/dist/tools/recommend.d.ts +3 -2
  30. package/dist/tools/recommend.d.ts.map +1 -1
  31. package/dist/tools/recommend.js +116 -3
  32. package/package.json +1 -1
  33. package/prompts/helm-chart-selection.md +65 -0
  34. package/prompts/helm-generation.md +85 -0
  35. package/prompts/intent-analysis.md +17 -0
  36. package/prompts/question-generation.md +34 -24
  37. package/prompts/resource-selection.md +52 -8
  38. package/shared-prompts/prd-start.md +20 -10
  39. /package/prompts/{manifest-generation.md → capabilities-generation.md} +0 -0
@@ -0,0 +1,85 @@
1
+ # Helm Values Generation
2
+
3
+ ## Solution Configuration
4
+ {{solution}}
5
+
6
+ ## Chart Values Structure
7
+ The following is the chart's default values.yaml that defines available configuration options:
8
+ {{chart_values}}
9
+
10
+ ## Previous Attempt (if retry)
11
+ {{previous_attempt}}
12
+
13
+ ## Validation Error Details (if retry)
14
+ {{error_details}}
15
+
16
+ ## Instructions
17
+
18
+ Generate a values.yaml file for Helm chart installation based on the user's configuration answers. The solution contains the chart information, user intent, and all answered questions.
19
+
20
+ ### Core Strategy:
21
+
22
+ 1. **Identify CLI Arguments vs Values**:
23
+ - `name` answer → Helm release name (CLI argument, NOT a value)
24
+ - `namespace` answer → --namespace flag (CLI argument, NOT a value)
25
+ - All other answers → values.yaml content
26
+
27
+ 2. **Map Answers to Values Structure**:
28
+ - Use the chart's values.yaml structure above as your guide
29
+ - Match answer semantics to the appropriate value paths
30
+ - Common mappings:
31
+ * "replicas" → `replicaCount`
32
+ * "enable ingress" → `ingress.enabled`
33
+ * "ingress class" → `ingress.className` or `ingress.ingressClassName`
34
+ * "service type" → `service.type`
35
+ * "storage size" → `persistence.size`
36
+ - Use the actual field names from the chart's values.yaml, not generic assumptions
37
+
38
+ 3. **Handle Value Types Correctly**:
39
+ - Booleans: `true` or `false` (not strings "true"/"false")
40
+ - Numbers: numeric values without quotes
41
+ - Strings: use quotes only when necessary (values with special chars)
42
+ - Arrays/Lists: proper YAML list format
43
+ - Nested objects: proper YAML indentation
44
+
45
+ 4. **Include Only Values That Differ From Defaults**:
46
+ - Compare each user answer to the chart's default values above
47
+ - Only include values that DIFFER from the chart's defaults
48
+ - If user's answer matches the default value, do NOT include it in values.yaml
49
+ - Do NOT include `name` or `namespace` in the values (they're CLI args)
50
+ - This keeps the values file minimal and intentional - only showing what's changed
51
+
52
+ 5. **Process Open Requirements**:
53
+ - If the user provided open-ended requirements, translate them to appropriate values
54
+ - Reference the chart's values.yaml to find relevant configuration options
55
+
56
+ ### For Retry Attempts:
57
+ If this is a retry (previous attempt and error details provided above):
58
+ - Analyze the previous values.yaml to understand what was generated
59
+ - Study the Helm error to identify the specific problem
60
+ - Common issues:
61
+ * Invalid value type (string vs boolean vs number)
62
+ * Non-existent value path in the chart
63
+ * Invalid YAML syntax
64
+ * Template rendering errors from invalid combinations
65
+ - Make targeted corrections to fix the identified issues
66
+
67
+ ### Response Requirements:
68
+
69
+ 1. **Valid YAML**: Generate syntactically correct YAML
70
+ 2. **Correct Structure**: Match the chart's expected values.yaml structure exactly
71
+ 3. **Proper Types**: Use correct data types for each value
72
+ 4. **Exclude CLI Args**: Do NOT include `name` or `namespace` - they are handled separately
73
+
74
+ ## Response Format
75
+
76
+ **CRITICAL**: Return ONLY valid YAML content. NO explanations, NO markdown code blocks, NO additional text.
77
+
78
+ If no values need to be overridden (user accepted all defaults for non-CLI options), return:
79
+ ```
80
+ # Default values - no overrides needed
81
+ ```
82
+
83
+ Otherwise, return only the YAML values content.
84
+
85
+ **RETURN ONLY THE YAML VALUES**
@@ -8,6 +8,23 @@ You are an expert Kubernetes deployment consultant analyzing user intents to ide
8
8
  ## Organizational Patterns Context
9
9
  {{organizational_patterns}}
10
10
 
11
+ ## Third-Party Tool Installation Detection
12
+
13
+ **IMPORTANT**: First, determine if this intent is for installing a well-known third-party tool (Argo CD, Prometheus, Grafana, Crossplane, Cert-Manager, Jaeger, Vault, etc.).
14
+
15
+ **If YES (third-party tool installation)**:
16
+ - **Installation method is Helm** - DO NOT ask about Helm vs Kustomize vs manual
17
+ - **Detailed configuration will come later** - DO NOT ask about HA mode, authentication, storage, resource limits, monitoring integration, secrets management, backup strategies, etc. These questions will be asked in the Helm configuration phase
18
+ - **Keep clarification minimal** - only ask 1-3 questions that affect CHART SELECTION:
19
+ - "Do you want the full stack (e.g., kube-prometheus-stack) or just the base tool?"
20
+ - "Single cluster or multi-cluster setup?" (only if it affects which chart to use)
21
+ - Open-ended: "Any specific requirements that would affect the installation?"
22
+ - **Set enhancementPotential to LOW** for clear tool installation intents
23
+ - **Return minimal clarificationOpportunities** (1-3 max)
24
+
25
+ **If NO (custom application deployment)**:
26
+ - Proceed with comprehensive analysis below
27
+
11
28
  ## Analysis Framework
12
29
 
13
30
  Analyze the user's intent comprehensively to identify **every piece of missing context** that could improve the quality and relevance of deployment recommendations. Be thorough - explore all aspects that could influence the deployment, regardless of traditional categories.
@@ -1,4 +1,4 @@
1
- # Question Generation for Kubernetes Resource Configuration
1
+ # Question Generation for Kubernetes Configuration
2
2
 
3
3
  ## User Intent
4
4
  {{intent}}
@@ -6,10 +6,9 @@
6
6
  ## Recommended Solution
7
7
  {{solution_description}}
8
8
 
9
- ## Resources in Solution
10
- {{resource_details}}
9
+ {{{source_material}}}
11
10
 
12
- ## Available Cluster Options
11
+ ## Cluster Context
13
12
  {{cluster_options}}
14
13
 
15
14
  ## Organizational Policies
@@ -19,35 +18,35 @@
19
18
 
20
19
  ## ⚠️ CRITICAL: MANDATORY "name" FIELD REQUIREMENT
21
20
 
22
- **BEFORE GENERATING ANY QUESTIONS**: The REQUIRED section MUST include a question with `id: "name"`. This is non-negotiable and your response will be rejected if this field is missing or renamed to any variation like "cluster-name", "deployment-name", or "app-name".
21
+ **BEFORE GENERATING ANY QUESTIONS**: The REQUIRED section MUST include a question with `id: "name"`. This is non-negotiable and your response will be rejected if this field is missing or renamed to any variation like "cluster-name", "deployment-name", "app-name", or "release-name".
23
22
 
24
23
  ## 🛡️ POLICY-AWARE QUESTION GENERATION (HIGHEST PRIORITY)
25
24
 
26
25
  **Policy Requirements Integration:**
27
26
  - **Policy-driven questions** represent organizational governance requirements and must be enforced through configuration
28
- - **Conditional applicability** - Only apply policies when their rationale matches the selected resources
27
+ - **Conditional applicability** - Only apply policies when their rationale matches the solution
29
28
  - **REQUIRED question promotion** - Applicable policy requirements should become REQUIRED questions with helpful defaults
30
29
  - **Compliance indicators** - Mark policy-driven questions with "⚠️ required by [policy description]" in question text
31
30
  - **Policy rationale** - Include policy rationale as question hints to help users understand WHY they're required
32
31
 
33
32
  **POLICY APPLICATION APPROACH:**
34
33
 
35
- 1. **Analyze Resource Match**: Review each policy's rationale to determine if it applies to the selected resources
34
+ 1. **Analyze Match**: Review each policy's rationale to determine if it applies to the solution
36
35
  2. **Extract Requirements**: Identify what configuration properties the policy requires
37
36
  3. **Create REQUIRED Questions**: Convert applicable policy requirements into REQUIRED questions
38
37
  4. **Add Compliance Context**: Include policy context in question text and hints
39
38
  5. **Set Sensible Defaults**: Provide policy-compliant defaults when possible
40
39
 
41
40
  **CRITICAL: Policy Conditional Logic**
42
- - **Read each policy's "Rationale" field carefully** - it specifies WHEN and TO WHAT the policy applies
43
- - **Apply policies selectively** - only convert policy requirements to questions when the policy technically applies to the selected resource types
44
- - **Resource type matching** - If a policy rationale mentions specific resource types (e.g., "All Deployments must..."), only apply when Deployment resources are selected
45
- - **Field-specific requirements** - Match policy requirements to actual resource schema fields available in the "Resources in Solution" section
41
+ - **Read each policy's "Rationale" field carefully** - it specifies WHEN and TO WHAT the policy applies
42
+ - **Apply policies selectively** - only convert policy requirements to questions when the policy technically applies
43
+ - **Configuration matching** - If a policy rationale mentions specific configurations (e.g., "All Deployments must..."), only apply when relevant
44
+ - **Field-specific requirements** - Match policy requirements to configuration options available in the source material above
46
45
  - **Policy compliance increases user success** - policy-driven questions help users create compliant configurations from the start
47
46
 
48
- Based on the user's intent and the Kubernetes resources in this solution, generate appropriate questions to gather the information needed to create working manifests.
47
+ Based on the user's intent and the configuration options in the source material above, generate appropriate questions to gather the information needed.
49
48
 
50
- **IMPORTANT**: Only ask questions about properties that are explicitly listed in the "Resources in Solution" section below. Do not ask about common Kubernetes properties unless they appear in the actual resource schema.
49
+ **IMPORTANT**: Only ask questions about properties that are explicitly listed in the source material above. Do not ask about properties unless they appear in the provided configuration options.
51
50
 
52
51
  Use the provided cluster options to populate dynamic select questions with real values from the user's cluster.
53
52
 
@@ -69,6 +68,8 @@ You MUST include these EXACT questions with these EXACT IDs in the REQUIRED sect
69
68
  2. **REQUIRED: `namespace` question (id: "namespace")**
70
69
  - ONLY if any resource in the solution is namespace-scoped - check resource scope information
71
70
  - Question ID MUST be exactly: `"id": "namespace"`
71
+ - **For Helm chart installations**: Use `type: "text"` (NOT `select`) because users typically want to create NEW namespaces for third-party tools (e.g., "monitoring", "argocd", "cert-manager"). Mention existing namespaces in the placeholder as suggestions.
72
+ - **For capability-based solutions**: Use `type: "select"` with existing namespaces as options.
72
73
 
73
74
  **VALIDATION**: Your response will fail if the REQUIRED section does not contain a question with `"id": "name"`
74
75
 
@@ -80,18 +81,27 @@ Optional advanced configuration for power users. These are for optimization, sec
80
81
 
81
82
  ## Guidelines
82
83
 
83
- **CRITICAL CONSTRAINT**: Only ask questions about properties that actually exist in the provided resource schemas. Do not invent or assume properties that are not explicitly listed in the resource details.
84
+ **CRITICAL CONSTRAINT**: Only ask questions about properties that actually exist in the provided source material. Do not invent or assume properties that are not explicitly listed.
84
85
 
85
86
  For each question, consider:
86
- - **ONLY the resource schema properties and their actual constraints** - never ask about properties not in the schema
87
- - What information is truly needed to generate a working manifest from the actual schema fields
88
- - **Resource capabilities and configuration richness** - expose meaningful configuration options available in the schema
87
+ - **ONLY the properties and their actual constraints from the source material** - never ask about properties not provided
88
+ - What information is truly needed to generate a working configuration
89
+ - **Configuration richness** - expose meaningful configuration options available in the source material
89
90
  - User-friendly question wording (avoid Kubernetes jargon where possible)
90
91
  - Practical defaults that work in most environments
91
92
  - **Comprehensive coverage** - generate questions for all significant configurable properties, not just the minimum required
92
93
  - Use cluster-discovered options when available for select questions
93
94
 
94
- **VALIDATION RULE**: Before creating any question, verify that the property exists in the provided resource schema. If a property like "storageClass" is not listed in the schema, do not ask about it.
95
+ ### Determining Suggested Answers
96
+
97
+ Each question MUST include a `suggestedAnswer` field. Determine appropriate values by considering:
98
+
99
+ 1. **Organizational policies** - If a policy specifies required values or constraints, use compliant defaults
100
+ 2. **Source material defaults** - Use defaults defined in the chart values.yaml, CRD schema, or documentation
101
+ 3. **Cluster context** - For questions about cluster resources (ingress class, storage class, etc.), prefer options actually available in the cluster, especially those marked as default
102
+ 4. **Best practices** - Apply common Kubernetes conventions and production-ready defaults
103
+
104
+ **VALIDATION RULE**: Before creating any question, verify that the property exists in the provided source material. If a property like "storageClass" is not listed, do not ask about it.
95
105
 
96
106
  Question types available:
97
107
  - `text`: Free text input
@@ -178,13 +188,13 @@ Return your response as JSON in this exact format:
178
188
  ## Important Notes
179
189
 
180
190
  - **CRITICAL VALIDATION REQUIREMENT**: The REQUIRED section MUST contain a question with `"id": "name"` - responses without this will be rejected
181
- - **CRITICAL**: Only ask questions about properties explicitly defined in the provided resource schemas
182
- - **REQUIRED**: Each question must include a `suggestedAnswer` field with a valid example value that passes the validation rules
183
- - **Generate comprehensive questions** covering all meaningful configuration options available in the resource schemas
184
- - Focus on questions that actually affect the generated manifests based on the actual schema
191
+ - **CRITICAL**: Only ask questions about properties explicitly defined in the provided source material
192
+ - **REQUIRED**: Each question must include a `suggestedAnswer` field (see "Determining Suggested Answers" section for guidance)
193
+ - **Generate comprehensive questions** covering all meaningful configuration options available in the source material
194
+ - Focus on questions that actually affect the generated configuration
185
195
  - **Prefer explicit configuration over defaults** - give users control over important settings even if reasonable defaults exist
186
- - **DO NOT** ask about storage classes, node selectors, or other properties unless they appear in the resource schema
187
- - **DO NOT** make assumptions about what properties are configurable - stick strictly to the provided schema
196
+ - **DO NOT** ask about storage classes, node selectors, or other properties unless they appear in the source material
197
+ - **DO NOT** make assumptions about what properties are configurable - stick strictly to the provided source material
188
198
  - Use the provided cluster options to populate select questions with real values
189
199
  - Consider real-world usage patterns and common configurations
190
200
  - Ensure question IDs are unique and descriptive
@@ -54,11 +54,37 @@ Create multiple alternative solutions. Consider:
54
54
 
55
55
  **Generate 2-5 different solutions** that genuinely address the user intent. Prioritize relevance over quantity - it's better to provide 2-3 high-quality, relevant solutions than to include irrelevant alternatives just to reach a target number.
56
56
 
57
+ ## Helm Installation Fallback
58
+
59
+ **After analyzing available capabilities, determine if they can genuinely fulfill the user's intent.**
60
+
61
+ Ask yourself: "If the user applies these resources, will they get what they actually asked for?"
62
+
63
+ **Evaluation principles:**
64
+
65
+ 1. **Don't confuse "uses X" with "is X"**
66
+ - ServiceMonitor CRD *uses* Prometheus but doesn't *provide* Prometheus
67
+ - Certificate CRD *uses* cert-manager but doesn't *provide* cert-manager
68
+ - Prometheus CRD *provides* Prometheus instances (operator is installed)
69
+ - Cluster CRD from CNPG *provides* PostgreSQL instances (operator is installed)
70
+
71
+ 2. **Match the actual ask:**
72
+ - "Install Prometheus" + Prometheus CRD exists → Capability solution (can create Prometheus instance)
73
+ - "Install Prometheus" + Only ServiceMonitor exists → Helm fallback (cannot install Prometheus itself)
74
+ - "Deploy PostgreSQL" + CNPG Cluster CRD exists → Capability solution (can create database)
75
+ - "Deploy PostgreSQL" + No database operators → Helm fallback (need to install something first)
76
+
77
+ 3. **Decision:**
78
+ - If capabilities CAN fulfill the intent → Return `solutions` array with capability-based solutions
79
+ - If capabilities CANNOT fulfill the intent → Return `helmRecommendation` with empty `solutions` array
80
+
57
81
  ## Response Format
58
82
 
59
- Respond with ONLY a JSON object containing an array of complete solutions. Each solution should include resources, description, scoring, and pattern compliance:
83
+ Respond with ONLY a JSON object. The format depends on whether capabilities can fulfill the intent:
84
+
85
+ ### When capabilities CAN fulfill the intent:
60
86
 
61
- **CRITICAL**: For each resource in your solutions, you MUST include the `resourceName` field. This field contains the correct plural, lowercase resource name used for kubectl explain calls. Extract this from the Available Resources list - each resource shows its `resourceName` field that you should copy exactly.
87
+ Return solutions with resources. Include the `resourceName` field for each resource (extract from Available Resources list).
62
88
 
63
89
  ```json
64
90
  {
@@ -82,17 +108,35 @@ Respond with ONLY a JSON object containing an array of complete solutions. Each
82
108
  "score": 95,
83
109
  "description": "Complete web application deployment with networking",
84
110
  "reasons": ["High capability match for web applications", "Includes essential networking"],
85
- "appliedPatterns": ["High availability web application pattern", "Ingress with TLS termination"]
111
+ "appliedPatterns": ["High availability web application pattern"]
86
112
  }
87
113
  ]
88
114
  }
89
115
  ```
90
116
 
91
- **CRITICAL - Applied Patterns Field:**
92
- - Include `appliedPatterns` array with the **descriptions** of organizational patterns you applied to this solution
93
- - Use the pattern `description` field from the Organizational Patterns section provided above
94
- - Only include patterns that directly influenced this solution's resource selection or configuration
95
- - Use empty array `[]` if no organizational patterns were applied
117
+ **Applied Patterns:** Include pattern descriptions that influenced the solution. Use empty array `[]` if none applied.
118
+
119
+ ### When capabilities CANNOT fulfill the intent (Helm fallback):
120
+
121
+ Return empty solutions with Helm recommendation. Patterns do not apply to Helm installations.
122
+
123
+ ```json
124
+ {
125
+ "solutions": [],
126
+ "helmRecommendation": {
127
+ "reason": "No capabilities can install Prometheus. ServiceMonitor CRD configures monitoring targets but cannot install Prometheus itself.",
128
+ "suggestedTool": "Prometheus",
129
+ "searchQuery": "prometheus"
130
+ }
131
+ }
132
+ ```
133
+
134
+ **searchQuery construction rules:**
135
+ - Use the primary tool name only (e.g., "prometheus", "argo cd", "cert-manager")
136
+ - Do NOT include generic terms like "helm", "chart", "kubernetes", "install"
137
+ - Do NOT include compound queries - pick the main tool (e.g., "prometheus with alertmanager" → searchQuery: "prometheus")
138
+ - Keep it simple - ArtifactHub search works best with short, focused queries
139
+ - The full intent will be used later when selecting the best chart from search results
96
140
 
97
141
  IMPORTANT: Your response must be ONLY the JSON object, nothing else.
98
142
 
@@ -132,23 +132,33 @@ For documentation-first PRDs:
132
132
 
133
133
  ## Step 3: Implementation Context Setup
134
134
 
135
+ **⚠️ MANDATORY: Complete this step BEFORE proceeding to Step 4**
136
+
135
137
  ### Git Branch Management
136
- **If not already on a feature branch:**
137
- ```bash
138
- # Create feature branch for PRD implementation
139
- git checkout -b feature/prd-[issue-id]-[feature-name]
140
- git push -u origin feature/prd-[issue-id]-[feature-name]
141
- ```
138
+
139
+ 1. **Check current branch**: Run `git branch --show-current`
140
+ 2. **If on `main` or `master`**: Create and switch to feature branch:
141
+ ```bash
142
+ git checkout -b feature/prd-[issue-id]-[feature-name]
143
+ ```
144
+ 3. **If already on a feature branch**: Verify it's the correct branch for this PRD
142
145
 
143
146
  ### Development Environment Setup
144
147
  - **Dependencies**: Install any new dependencies required by the PRD
145
148
  - **Configuration**: Set up any configuration needed for development
146
149
  - **Test data**: Prepare test data or mock services
147
- - **Documentation tools**: Ensure documentation generation tools are available
148
150
 
149
- ### Implementation Tracking Setup
150
- - **Identify key milestones**: Review the PRD milestones for progress tracking
151
- - **Plan progress checkpoints**: Determine when to update progress during implementation
151
+ ### Step 3 Checkpoint (REQUIRED)
152
+
153
+ **You MUST display this confirmation before proceeding to Step 4:**
154
+
155
+ ```markdown
156
+ ## Environment Setup ✅
157
+ - **Branch**: `[current-branch-name]` ✅
158
+ - **Status**: [Created new branch / Already on correct branch / Staying on main (reason)]
159
+ ```
160
+
161
+ **DO NOT proceed to Step 4 until branch setup is confirmed.**
152
162
 
153
163
  ## Step 4: Identify Implementation Starting Point
154
164