@vfarcic/dot-ai 0.156.0 → 0.158.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.
- package/README.md +26 -25
- package/assets/images/logo-orig.jpeg +0 -0
- package/assets/images/logo.jpeg +0 -0
- package/dist/core/ai-provider.interface.d.ts +0 -35
- package/dist/core/ai-provider.interface.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/packaging.d.ts +50 -0
- package/dist/core/packaging.d.ts.map +1 -0
- package/dist/core/packaging.js +281 -0
- package/dist/core/schema.d.ts +6 -0
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +46 -5
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +233 -4
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +46 -95
- package/package.json +1 -1
- package/prompts/intent-refinement-guidance.md +53 -0
- package/prompts/packaging-generation.md +66 -0
- package/prompts/question-generation.md +2 -0
- package/shared-prompts/prd-done.md +5 -4
- package/assets/images/logo.png +0 -0
- package/prompts/intent-analysis.md +0 -106
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# DevOps AI Toolkit
|
|
2
2
|
|
|
3
|
+
<!-- docs-exclude-start -->
|
|
3
4
|
<div align="center">
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
<p align="center">
|
|
7
|
+
<img src="assets/images/logo.jpeg" alt="DevOps AI Toolkit Logo" width="400">
|
|
8
|
+
</p>
|
|
6
9
|
|
|
7
10
|
[](https://www.npmjs.com/package/@vfarcic/dot-ai)
|
|
8
11
|
[](https://www.npmjs.com/package/@vfarcic/dot-ai)
|
|
@@ -13,11 +16,13 @@
|
|
|
13
16
|
[](https://github.com/vfarcic/dot-ai)
|
|
14
17
|
|
|
15
18
|
</div>
|
|
19
|
+
<!-- docs-exclude-end -->
|
|
16
20
|
|
|
17
21
|
**AI-powered platform engineering and DevOps automation through intelligent Kubernetes operations and conversational workflows.**
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
<!-- docs-exclude-start -->
|
|
24
|
+
📚 [Quick Start](./docs/quick-start.md) | 🔧 [MCP Setup](./docs/setup/mcp-setup.md) | 🛠️ [Features & Tools](./docs/guides/mcp-tools-overview.md)
|
|
25
|
+
<!-- docs-exclude-end -->
|
|
21
26
|
---
|
|
22
27
|
|
|
23
28
|
## What is DevOps AI Toolkit?
|
|
@@ -58,36 +63,30 @@ DevOps AI Toolkit democratizes platform engineering and cloud native operations
|
|
|
58
63
|
|
|
59
64
|
### 🔍 Resource Provisioning Intelligence
|
|
60
65
|
Automatically discovers cluster resources using semantic capability management. AI understands what each resource actually does, providing intelligent recommendations for provisioning resources across clouds using Kubernetes as a control plane. When no matching capability exists, automatically discovers and installs third-party tools (Prometheus, Argo CD, Crossplane, etc.) via Helm charts from ArtifactHub.
|
|
61
|
-
📖 [Deployment Guide](./docs/mcp-recommendation-guide.md) | [Capability Management](./docs/mcp-capability-management-guide.md)
|
|
66
|
+
📖 [Deployment Guide](./docs/guides/mcp-recommendation-guide.md) | [Capability Management](./docs/guides/mcp-capability-management-guide.md)
|
|
62
67
|
|
|
63
68
|
### 🛠️ Issue Remediation
|
|
64
69
|
AI-powered root cause analysis with multi-step investigation, executable remediation commands, and safety mechanisms for manual or automatic execution.
|
|
65
|
-
📖 [Learn more →](./docs/mcp-remediate-guide.md)
|
|
70
|
+
📖 [Learn more →](./docs/guides/mcp-remediate-guide.md)
|
|
66
71
|
|
|
67
72
|
### 🏛️ Pattern & Policy Management
|
|
68
73
|
Capture organizational knowledge and governance policies that automatically enhance AI recommendations with best practices and compliance requirements. Uses vector search for intelligent semantic matching.
|
|
69
|
-
📖 [Pattern Management](./docs/pattern-management-guide.md) | [Policy Management](./docs/policy-management-guide.md)
|
|
74
|
+
📖 [Pattern Management](./docs/guides/pattern-management-guide.md) | [Policy Management](./docs/guides/policy-management-guide.md)
|
|
70
75
|
|
|
71
76
|
### 📦 Project Setup & Governance
|
|
72
77
|
Generate 25+ governance, legal, and automation files (LICENSE, CODE_OF_CONDUCT, CONTRIBUTING, SECURITY, GitHub workflows, Renovate, OpenSSF Scorecard) for repository standardization.
|
|
73
|
-
📖 [Learn more →](./docs/mcp-project-setup-guide.md)
|
|
78
|
+
📖 [Learn more →](./docs/guides/mcp-project-setup-guide.md)
|
|
74
79
|
|
|
75
80
|
### 💬 Shared Prompts Library
|
|
76
81
|
Access curated prompts as native slash commands (`/dot-ai:prompt-name`) in your coding agent for consistent workflows across projects:
|
|
77
82
|
- **PRD Management**: Create, track, and complete Product Requirements Documents (`prd-create`, `prd-next`, `prd-done`, etc.)
|
|
78
83
|
- **Dockerfile Generation**: Generate production-ready, secure multi-stage Dockerfiles for any project (`generate-dockerfile`)
|
|
79
84
|
|
|
80
|
-
📖 [Learn more →](./docs/mcp-prompts-guide.md)
|
|
85
|
+
📖 [Learn more →](./docs/guides/mcp-prompts-guide.md)
|
|
81
86
|
|
|
82
87
|
### ⚡ AI Integration
|
|
83
88
|
Works with Claude Code, Cursor, VS Code via Model Context Protocol. Supports multiple AI providers (Claude, GPT, Gemini) for flexibility and cost optimization.
|
|
84
|
-
📖 [AI Model Configuration](./docs/mcp-setup.md#ai-model-configuration)
|
|
85
|
-
|
|
86
|
-
## See It In Action
|
|
87
|
-
|
|
88
|
-
[](https://youtu.be/8Yzn-9qQpQI)
|
|
89
|
-
|
|
90
|
-
This video explains the platform engineering problem and demonstrates the Kubernetes deployment recommendation workflow from intent to running applications.
|
|
89
|
+
📖 [AI Model Configuration](./docs/setup/mcp-setup.md#ai-model-configuration)
|
|
91
90
|
|
|
92
91
|
## Quick Start
|
|
93
92
|
|
|
@@ -100,23 +99,24 @@ Get started in 3 steps:
|
|
|
100
99
|
|
|
101
100
|
### Getting Started
|
|
102
101
|
- **[Quick Start Guide](docs/quick-start.md)** - Get started in minutes
|
|
103
|
-
- **[MCP Setup Guide](docs/mcp-setup.md)** - Complete configuration instructions
|
|
104
|
-
- **[Tools Overview](docs/mcp-tools-overview.md)** - All available tools and features
|
|
102
|
+
- **[MCP Setup Guide](docs/setup/mcp-setup.md)** - Complete configuration instructions
|
|
103
|
+
- **[Tools Overview](docs/guides/mcp-tools-overview.md)** - All available tools and features
|
|
105
104
|
|
|
106
105
|
### Feature Guides
|
|
107
|
-
- **[Resource Provisioning](docs/mcp-recommendation-guide.md)** - AI-powered deployment recommendations
|
|
108
|
-
- **[Capability Management](docs/mcp-capability-management-guide.md)** - Semantic resource discovery
|
|
109
|
-
- **[Issue Remediation](docs/mcp-remediate-guide.md)** - AI-powered troubleshooting
|
|
110
|
-
- **[Pattern Management](docs/pattern-management-guide.md)** - Organizational deployment patterns
|
|
111
|
-
- **[Policy Management](docs/policy-management-guide.md)** - Governance and compliance
|
|
112
|
-
- **[Project Setup](docs/mcp-project-setup-guide.md)** - Repository governance automation
|
|
113
|
-
|
|
106
|
+
- **[Resource Provisioning](docs/guides/mcp-recommendation-guide.md)** - AI-powered deployment recommendations
|
|
107
|
+
- **[Capability Management](docs/guides/mcp-capability-management-guide.md)** - Semantic resource discovery
|
|
108
|
+
- **[Issue Remediation](docs/guides/mcp-remediate-guide.md)** - AI-powered troubleshooting
|
|
109
|
+
- **[Pattern Management](docs/guides/pattern-management-guide.md)** - Organizational deployment patterns
|
|
110
|
+
- **[Policy Management](docs/guides/policy-management-guide.md)** - Governance and compliance
|
|
111
|
+
- **[Project Setup](docs/guides/mcp-project-setup-guide.md)** - Repository governance automation
|
|
112
|
+
|
|
113
|
+
<!-- docs-exclude-start -->
|
|
114
114
|
## Support
|
|
115
115
|
|
|
116
116
|
- **[Support Guide](SUPPORT.md)** - How to get help and where to ask questions
|
|
117
117
|
- **GitHub Issues**: [Bug reports and feature requests](https://github.com/vfarcic/dot-ai/issues)
|
|
118
118
|
- **GitHub Discussions**: [Community Q&A and discussions](https://github.com/vfarcic/dot-ai/discussions)
|
|
119
|
-
- **Troubleshooting**: See [Troubleshooting Guide](./docs/mcp-setup.md#troubleshooting) for common problems
|
|
119
|
+
- **Troubleshooting**: See [Troubleshooting Guide](./docs/setup/mcp-setup.md#troubleshooting) for common problems
|
|
120
120
|
|
|
121
121
|
## Contributing & Governance
|
|
122
122
|
|
|
@@ -146,6 +146,7 @@ DevOps AI Toolkit is built on:
|
|
|
146
146
|
- [Vercel AI SDK](https://sdk.vercel.ai/) for unified AI provider interface
|
|
147
147
|
- [Kubernetes](https://kubernetes.io/) for the cloud native foundation
|
|
148
148
|
- [CNCF](https://www.cncf.io/) for the cloud native ecosystem
|
|
149
|
+
<!-- docs-exclude-end -->
|
|
149
150
|
|
|
150
151
|
---
|
|
151
152
|
|
|
Binary file
|
|
Binary file
|
|
@@ -22,41 +22,6 @@ export interface AIResponse {
|
|
|
22
22
|
cache_read_input_tokens?: number;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Impact level for clarification opportunities
|
|
27
|
-
*/
|
|
28
|
-
export type ImpactLevel = 'HIGH' | 'MEDIUM' | 'LOW';
|
|
29
|
-
/**
|
|
30
|
-
* Clarification category types
|
|
31
|
-
*/
|
|
32
|
-
export type ClarificationCategory = 'TECHNICAL_SPECIFICATIONS' | 'ARCHITECTURAL_CONTEXT' | 'OPERATIONAL_REQUIREMENTS' | 'SECURITY_COMPLIANCE' | 'ORGANIZATIONAL_ALIGNMENT';
|
|
33
|
-
/**
|
|
34
|
-
* Clarification opportunity structure
|
|
35
|
-
*/
|
|
36
|
-
export interface ClarificationOpportunity {
|
|
37
|
-
category: ClarificationCategory;
|
|
38
|
-
missingContext: string;
|
|
39
|
-
impactLevel: ImpactLevel;
|
|
40
|
-
reasoning: string;
|
|
41
|
-
suggestedQuestions?: string[];
|
|
42
|
-
patternAlignment?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Intent analysis result structure
|
|
46
|
-
*/
|
|
47
|
-
export interface IntentAnalysisResult {
|
|
48
|
-
clarificationOpportunities: ClarificationOpportunity[];
|
|
49
|
-
overallAssessment: {
|
|
50
|
-
enhancementPotential: ImpactLevel;
|
|
51
|
-
primaryGaps: string[];
|
|
52
|
-
recommendedFocus: string;
|
|
53
|
-
};
|
|
54
|
-
intentQuality: {
|
|
55
|
-
currentSpecificity: string;
|
|
56
|
-
strengthAreas: string[];
|
|
57
|
-
improvementAreas: string[];
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
25
|
/**
|
|
61
26
|
* AI Provider configuration
|
|
62
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-provider.interface.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"ai-provider.interface.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;I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AM,CAAC;IAEvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAE1D"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class DotAI {
|
|
|
40
40
|
export { KubernetesDiscovery } from './discovery';
|
|
41
41
|
export { MemorySystem } from './memory';
|
|
42
42
|
export { WorkflowEngine } from './workflow';
|
|
43
|
-
export { AIProvider, AIResponse,
|
|
43
|
+
export { AIProvider, AIResponse, AIProviderConfig } from './ai-provider.interface';
|
|
44
44
|
export { createAIProvider, AIProviderFactory } from './ai-provider-factory';
|
|
45
45
|
export { SchemaParser, ManifestValidator, ResourceRecommender } from './schema';
|
|
46
46
|
export { OrganizationalPattern, CreatePatternRequest } from './pattern-types';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAkB;IAErC,SAAgB,SAAS,EAAE,mBAAmB,CAAC;IAC/C,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,QAAQ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,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAGjI,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packaging Module - Convert raw Kubernetes manifests to Helm charts or Kustomize overlays
|
|
3
|
+
*
|
|
4
|
+
* Implements AI-driven packaging as specified in PRD #248.
|
|
5
|
+
* Raw manifests are always generated and validated first, then packaged based on outputFormat.
|
|
6
|
+
*/
|
|
7
|
+
import { Logger } from './error-handling';
|
|
8
|
+
import { DotAI } from './index';
|
|
9
|
+
/**
|
|
10
|
+
* Output format types supported by packaging
|
|
11
|
+
*/
|
|
12
|
+
export type OutputFormat = 'raw' | 'helm' | 'kustomize';
|
|
13
|
+
/**
|
|
14
|
+
* File entry in packaging response
|
|
15
|
+
*/
|
|
16
|
+
export interface PackageFile {
|
|
17
|
+
relativePath: string;
|
|
18
|
+
content: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of packaging operation
|
|
22
|
+
*/
|
|
23
|
+
export interface PackagingResult {
|
|
24
|
+
files: PackageFile[];
|
|
25
|
+
format: OutputFormat;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error context for packaging retries
|
|
29
|
+
*/
|
|
30
|
+
interface PackagingErrorContext {
|
|
31
|
+
attempt: number;
|
|
32
|
+
previousOutput: string;
|
|
33
|
+
validationError: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Package raw Kubernetes manifests into Helm chart or Kustomize overlay
|
|
37
|
+
*
|
|
38
|
+
* @param rawManifests - Validated raw Kubernetes YAML manifests
|
|
39
|
+
* @param solution - Solution data with intent, questions, answers
|
|
40
|
+
* @param outputFormat - Target format ('helm' or 'kustomize')
|
|
41
|
+
* @param outputPath - User-specified output path
|
|
42
|
+
* @param dotAI - DotAI instance for AI calls
|
|
43
|
+
* @param logger - Logger instance
|
|
44
|
+
* @param errorContext - Optional error context for retries
|
|
45
|
+
* @param interaction_id - Optional interaction ID for evaluation
|
|
46
|
+
* @returns PackagingResult with files array
|
|
47
|
+
*/
|
|
48
|
+
export declare function packageManifests(rawManifests: string, solution: any, outputFormat: OutputFormat, outputPath: string, dotAI: DotAI, logger: Logger, errorContext?: PackagingErrorContext, interaction_id?: string): Promise<PackagingResult>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=packaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packaging.d.ts","sourceRoot":"","sources":["../../src/core/packaging.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAgOD;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,GAAG,EACb,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,qBAAqB,EACpC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC,CA+D1B"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Packaging Module - Convert raw Kubernetes manifests to Helm charts or Kustomize overlays
|
|
4
|
+
*
|
|
5
|
+
* Implements AI-driven packaging as specified in PRD #248.
|
|
6
|
+
* Raw manifests are always generated and validated first, then packaged based on outputFormat.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.packageManifests = packageManifests;
|
|
10
|
+
const shared_prompt_loader_1 = require("./shared-prompt-loader");
|
|
11
|
+
/**
|
|
12
|
+
* Format-specific instructions for Helm chart generation
|
|
13
|
+
*/
|
|
14
|
+
const HELM_FORMAT_INSTRUCTIONS = `
|
|
15
|
+
### Helm Chart Structure
|
|
16
|
+
|
|
17
|
+
Generate the following files:
|
|
18
|
+
|
|
19
|
+
1. **Chart.yaml** - Chart metadata
|
|
20
|
+
- \`apiVersion: v2\`
|
|
21
|
+
- \`name\`: derived from application name
|
|
22
|
+
- \`description\`: based on user intent
|
|
23
|
+
- \`version: 0.1.0\`
|
|
24
|
+
- \`appVersion\`: from image tag if available, otherwise \`1.0.0\`
|
|
25
|
+
|
|
26
|
+
2. **values.yaml** - Default configuration values
|
|
27
|
+
- Include comments explaining each value
|
|
28
|
+
- Group related values logically (e.g., \`image.repository\`, \`image.tag\`)
|
|
29
|
+
- Use the actual values from user answers as defaults
|
|
30
|
+
|
|
31
|
+
3. **templates/*.yaml** - One file per Kubernetes resource type
|
|
32
|
+
- Use \`{{ .Release.Name }}\` for resource names
|
|
33
|
+
- Use \`{{ .Release.Namespace }}\` when namespace is referenced
|
|
34
|
+
- Use \`{{ .Values.xxx }}\` for externalized configuration
|
|
35
|
+
- Ensure label selectors match between related resources
|
|
36
|
+
- Quote string values that might be interpreted as numbers: \`{{ .Values.someValue | quote }}\`
|
|
37
|
+
`;
|
|
38
|
+
/**
|
|
39
|
+
* Format-specific example for Helm chart
|
|
40
|
+
*/
|
|
41
|
+
const HELM_FORMAT_EXAMPLE = `
|
|
42
|
+
### Example Helm Output
|
|
43
|
+
|
|
44
|
+
\`\`\`json
|
|
45
|
+
{
|
|
46
|
+
"files": [
|
|
47
|
+
{
|
|
48
|
+
"relativePath": "Chart.yaml",
|
|
49
|
+
"content": "apiVersion: v2\\nname: my-app\\ndescription: A Helm chart for my-app\\nversion: 0.1.0\\nappVersion: \\"1.0.0\\""
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"relativePath": "values.yaml",
|
|
53
|
+
"content": "# Number of replicas\\nreplicaCount: 3\\n\\n# Container image\\nimage:\\n repository: nginx\\n tag: \\"1.21\\"\\n pullPolicy: IfNotPresent"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"relativePath": "templates/deployment.yaml",
|
|
57
|
+
"content": "apiVersion: apps/v1\\nkind: Deployment\\nmetadata:\\n name: {{ .Release.Name }}\\n namespace: {{ .Release.Namespace }}\\nspec:\\n replicas: {{ .Values.replicaCount }}\\n ..."
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
\`\`\`
|
|
62
|
+
`;
|
|
63
|
+
/**
|
|
64
|
+
* Format-specific instructions for Kustomize generation
|
|
65
|
+
*/
|
|
66
|
+
const KUSTOMIZE_FORMAT_INSTRUCTIONS = `
|
|
67
|
+
### Kustomize Structure
|
|
68
|
+
|
|
69
|
+
Generate a production-ready Kustomize structure with base/ and overlays/ directories:
|
|
70
|
+
|
|
71
|
+
1. **base/kustomization.yaml** - Base kustomization file
|
|
72
|
+
- \`apiVersion: kustomize.config.k8s.io/v1beta1\`
|
|
73
|
+
- \`kind: Kustomization\`
|
|
74
|
+
- List all resource files in \`resources:\` section (e.g., \`- deployment.yaml\`)
|
|
75
|
+
- Do NOT include namespace, patches, or images here - base should be generic/reusable
|
|
76
|
+
|
|
77
|
+
2. **base/*.yaml** - Base Kubernetes manifests
|
|
78
|
+
- One file per Kubernetes resource (deployment.yaml, service.yaml, etc.)
|
|
79
|
+
- Include complete, valid manifests
|
|
80
|
+
- For container images: use ONLY the repository (e.g., \`image: nginx\` or \`image: ghcr.io/org/app\`) WITHOUT any tag - tags are set in overlays
|
|
81
|
+
- Resource names should be consistent across all files
|
|
82
|
+
|
|
83
|
+
3. **overlays/production/kustomization.yaml** - Production overlay (THE KEY FILE FOR CUSTOMIZATION)
|
|
84
|
+
- \`apiVersion: kustomize.config.k8s.io/v1beta1\`
|
|
85
|
+
- \`kind: Kustomization\`
|
|
86
|
+
- Reference base: \`resources: [../../base]\`
|
|
87
|
+
- Use \`namespace:\` field with the user-specified namespace
|
|
88
|
+
- **REQUIRED**: Use \`images:\` section to set image tags from user answers:
|
|
89
|
+
\`\`\`yaml
|
|
90
|
+
images:
|
|
91
|
+
- name: <repository-without-tag>
|
|
92
|
+
newTag: <tag-from-user-answer>
|
|
93
|
+
\`\`\`
|
|
94
|
+
- Use \`replicas:\` section if replicas were customized
|
|
95
|
+
- Use \`patches:\` for other customizations (resources, env vars, etc.)
|
|
96
|
+
|
|
97
|
+
4. **kustomization.yaml** (root) - Points to production overlay for easy deployment
|
|
98
|
+
- Simple file that references the production overlay: \`resources: [overlays/production]\`
|
|
99
|
+
|
|
100
|
+
**WHY THIS STRUCTURE**:
|
|
101
|
+
- \`base/\` contains generic, reusable manifests (like Helm templates)
|
|
102
|
+
- \`overlays/production/kustomization.yaml\` is like \`values.yaml\` - the single file users edit to customize
|
|
103
|
+
- Users can add \`overlays/staging/\`, \`overlays/dev/\` by copying the production overlay
|
|
104
|
+
- To upgrade: change \`newTag\` in the overlay, not the base manifests
|
|
105
|
+
`;
|
|
106
|
+
/**
|
|
107
|
+
* Format-specific example for Kustomize
|
|
108
|
+
*/
|
|
109
|
+
const KUSTOMIZE_FORMAT_EXAMPLE = `
|
|
110
|
+
### Example Kustomize Output
|
|
111
|
+
|
|
112
|
+
\`\`\`json
|
|
113
|
+
{
|
|
114
|
+
"files": [
|
|
115
|
+
{
|
|
116
|
+
"relativePath": "kustomization.yaml",
|
|
117
|
+
"content": "apiVersion: kustomize.config.k8s.io/v1beta1\\nkind: Kustomization\\nresources:\\n - overlays/production"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"relativePath": "overlays/production/kustomization.yaml",
|
|
121
|
+
"content": "apiVersion: kustomize.config.k8s.io/v1beta1\\nkind: Kustomization\\nnamespace: production\\nresources:\\n - ../../base\\nimages:\\n - name: nginx\\n newTag: \\"1.21\\"\\nreplicas:\\n - name: my-app\\n count: 3"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"relativePath": "base/kustomization.yaml",
|
|
125
|
+
"content": "apiVersion: kustomize.config.k8s.io/v1beta1\\nkind: Kustomization\\nresources:\\n - deployment.yaml\\n - service.yaml"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"relativePath": "base/deployment.yaml",
|
|
129
|
+
"content": "apiVersion: apps/v1\\nkind: Deployment\\nmetadata:\\n name: my-app\\nspec:\\n replicas: 1\\n selector:\\n matchLabels:\\n app: my-app\\n template:\\n metadata:\\n labels:\\n app: my-app\\n spec:\\n containers:\\n - name: my-app\\n image: nginx\\n ports:\\n - containerPort: 80"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"relativePath": "base/service.yaml",
|
|
133
|
+
"content": "apiVersion: v1\\nkind: Service\\nmetadata:\\n name: my-app\\nspec:\\n selector:\\n app: my-app\\n ports:\\n - port: 80\\n targetPort: 80"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
\`\`\`
|
|
138
|
+
`;
|
|
139
|
+
/**
|
|
140
|
+
* Get format-specific configuration for prompt template
|
|
141
|
+
*/
|
|
142
|
+
function getFormatConfig(format) {
|
|
143
|
+
switch (format) {
|
|
144
|
+
case 'helm':
|
|
145
|
+
return {
|
|
146
|
+
outputFormat: 'Helm Chart',
|
|
147
|
+
outputFormatDescription: 'a complete Helm chart structure',
|
|
148
|
+
formatSpecificInstructions: HELM_FORMAT_INSTRUCTIONS,
|
|
149
|
+
formatExample: HELM_FORMAT_EXAMPLE
|
|
150
|
+
};
|
|
151
|
+
case 'kustomize':
|
|
152
|
+
return {
|
|
153
|
+
outputFormat: 'Kustomize',
|
|
154
|
+
outputFormatDescription: 'a Kustomize overlay structure',
|
|
155
|
+
formatSpecificInstructions: KUSTOMIZE_FORMAT_INSTRUCTIONS,
|
|
156
|
+
formatExample: KUSTOMIZE_FORMAT_EXAMPLE
|
|
157
|
+
};
|
|
158
|
+
default:
|
|
159
|
+
throw new Error(`Unsupported format for packaging: ${format}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Format questions and answers for prompt
|
|
164
|
+
*/
|
|
165
|
+
function formatQuestionsAndAnswers(solution) {
|
|
166
|
+
const lines = [];
|
|
167
|
+
const questionCategories = ['required', 'basic', 'advanced'];
|
|
168
|
+
for (const category of questionCategories) {
|
|
169
|
+
const questions = solution.questions?.[category] || [];
|
|
170
|
+
for (const q of questions) {
|
|
171
|
+
if (q.answer !== undefined && q.answer !== null) {
|
|
172
|
+
lines.push(`- **${q.question}**: ${q.answer}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (solution.questions?.open?.answer) {
|
|
177
|
+
lines.push(`- **Open requirements**: ${solution.questions.open.answer}`);
|
|
178
|
+
}
|
|
179
|
+
return lines.length > 0 ? lines.join('\n') : 'No user answers provided.';
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Parse JSON response from AI, handling potential markdown code blocks
|
|
183
|
+
*/
|
|
184
|
+
function parsePackagingResponse(response) {
|
|
185
|
+
// Try to extract JSON from markdown code blocks if present
|
|
186
|
+
let jsonContent = response.trim();
|
|
187
|
+
// Remove markdown code blocks if present
|
|
188
|
+
// Use greedy match (*) not lazy (*?) to handle nested code blocks in content (e.g., README with ```bash examples)
|
|
189
|
+
// The $ anchor ensures we match the LAST closing ```
|
|
190
|
+
const jsonMatch = jsonContent.match(/```(?:json)?\s*([\s\S]*)```\s*$/);
|
|
191
|
+
if (jsonMatch) {
|
|
192
|
+
jsonContent = jsonMatch[1].trim();
|
|
193
|
+
}
|
|
194
|
+
// Parse JSON
|
|
195
|
+
let parsed;
|
|
196
|
+
try {
|
|
197
|
+
parsed = JSON.parse(jsonContent);
|
|
198
|
+
}
|
|
199
|
+
catch (parseError) {
|
|
200
|
+
const preview = jsonContent.slice(0, 200);
|
|
201
|
+
throw new Error(`Failed to parse packaging response as JSON: ${parseError instanceof Error ? parseError.message : String(parseError)}. Content preview: ${preview}...`);
|
|
202
|
+
}
|
|
203
|
+
if (!parsed.files || !Array.isArray(parsed.files)) {
|
|
204
|
+
throw new Error('Invalid packaging response: missing files array');
|
|
205
|
+
}
|
|
206
|
+
// Validate each file entry
|
|
207
|
+
for (const file of parsed.files) {
|
|
208
|
+
if (typeof file.relativePath !== 'string' || typeof file.content !== 'string') {
|
|
209
|
+
throw new Error('Invalid packaging response: each file must have relativePath and content strings');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return parsed.files;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Package raw Kubernetes manifests into Helm chart or Kustomize overlay
|
|
216
|
+
*
|
|
217
|
+
* @param rawManifests - Validated raw Kubernetes YAML manifests
|
|
218
|
+
* @param solution - Solution data with intent, questions, answers
|
|
219
|
+
* @param outputFormat - Target format ('helm' or 'kustomize')
|
|
220
|
+
* @param outputPath - User-specified output path
|
|
221
|
+
* @param dotAI - DotAI instance for AI calls
|
|
222
|
+
* @param logger - Logger instance
|
|
223
|
+
* @param errorContext - Optional error context for retries
|
|
224
|
+
* @param interaction_id - Optional interaction ID for evaluation
|
|
225
|
+
* @returns PackagingResult with files array
|
|
226
|
+
*/
|
|
227
|
+
async function packageManifests(rawManifests, solution, outputFormat, outputPath, dotAI, logger, errorContext, interaction_id) {
|
|
228
|
+
if (outputFormat === 'raw') {
|
|
229
|
+
// Raw format - no packaging needed
|
|
230
|
+
return {
|
|
231
|
+
files: [{ relativePath: 'manifests.yaml', content: rawManifests }],
|
|
232
|
+
format: 'raw'
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
logger.info('Packaging manifests', {
|
|
236
|
+
format: outputFormat,
|
|
237
|
+
outputPath,
|
|
238
|
+
isRetry: !!errorContext,
|
|
239
|
+
attempt: errorContext?.attempt
|
|
240
|
+
});
|
|
241
|
+
// Get format-specific configuration
|
|
242
|
+
const formatConfig = getFormatConfig(outputFormat);
|
|
243
|
+
// Prepare template variables
|
|
244
|
+
const previousAttempt = errorContext
|
|
245
|
+
? `Previous attempt output:\n\`\`\`json\n${errorContext.previousOutput}\n\`\`\``
|
|
246
|
+
: 'None - this is the first attempt.';
|
|
247
|
+
const errorDetails = errorContext
|
|
248
|
+
? `**Attempt**: ${errorContext.attempt}\n**Validation Error**: ${errorContext.validationError}`
|
|
249
|
+
: 'None - this is the first attempt.';
|
|
250
|
+
// Load and populate prompt template
|
|
251
|
+
const prompt = (0, shared_prompt_loader_1.loadPrompt)('packaging-generation', {
|
|
252
|
+
output_format: formatConfig.outputFormat,
|
|
253
|
+
output_format_description: formatConfig.outputFormatDescription,
|
|
254
|
+
intent: solution.intent || 'Kubernetes deployment',
|
|
255
|
+
solution_description: solution.description || solution.title || 'No description available',
|
|
256
|
+
raw_manifests: rawManifests,
|
|
257
|
+
questions_and_answers: formatQuestionsAndAnswers(solution),
|
|
258
|
+
output_path: outputPath,
|
|
259
|
+
format_specific_instructions: formatConfig.formatSpecificInstructions,
|
|
260
|
+
format_example: formatConfig.formatExample,
|
|
261
|
+
previous_attempt: previousAttempt,
|
|
262
|
+
error_details: errorDetails
|
|
263
|
+
});
|
|
264
|
+
// Call AI for packaging
|
|
265
|
+
const aiProvider = dotAI.ai;
|
|
266
|
+
const response = await aiProvider.sendMessage(prompt, `packaging-${outputFormat}`, {
|
|
267
|
+
user_intent: solution.intent || 'Package Kubernetes manifests',
|
|
268
|
+
interaction_id
|
|
269
|
+
});
|
|
270
|
+
// Parse response
|
|
271
|
+
const files = parsePackagingResponse(response.content);
|
|
272
|
+
logger.info('Packaging completed', {
|
|
273
|
+
format: outputFormat,
|
|
274
|
+
fileCount: files.length,
|
|
275
|
+
files: files.map(f => f.relativePath)
|
|
276
|
+
});
|
|
277
|
+
return {
|
|
278
|
+
files,
|
|
279
|
+
format: outputFormat
|
|
280
|
+
};
|
|
281
|
+
}
|
package/dist/core/schema.d.ts
CHANGED
|
@@ -82,6 +82,12 @@ export interface QuestionGroup {
|
|
|
82
82
|
};
|
|
83
83
|
relevantPolicies?: string[];
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Packaging questions for capability-based solutions (not Helm charts)
|
|
87
|
+
* These are injected programmatically after AI generates questions
|
|
88
|
+
*/
|
|
89
|
+
export declare const OUTPUT_FORMAT_QUESTION: Question;
|
|
90
|
+
export declare const OUTPUT_PATH_QUESTION: Question;
|
|
85
91
|
export interface ResourceSolution {
|
|
86
92
|
type: 'single' | 'combination';
|
|
87
93
|
resources: ResourceSchema[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM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