@vfarcic/dot-ai 0.72.0 → 0.74.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 (74) hide show
  1. package/README.md +36 -1
  2. package/dist/core/capabilities.d.ts.map +1 -1
  3. package/dist/core/capabilities.js +6 -51
  4. package/dist/core/claude.d.ts +2 -0
  5. package/dist/core/claude.d.ts.map +1 -1
  6. package/dist/core/claude.js +24 -15
  7. package/dist/core/doc-testing-session.d.ts.map +1 -1
  8. package/dist/core/doc-testing-session.js +42 -60
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +4 -3
  12. package/dist/core/organizational-types.d.ts +43 -0
  13. package/dist/core/organizational-types.d.ts.map +1 -0
  14. package/dist/core/organizational-types.js +8 -0
  15. package/dist/core/pattern-types.d.ts +1 -10
  16. package/dist/core/pattern-types.d.ts.map +1 -1
  17. package/dist/core/policy-vector-service.d.ts +28 -0
  18. package/dist/core/policy-vector-service.d.ts.map +1 -0
  19. package/dist/core/policy-vector-service.js +64 -0
  20. package/dist/core/schema.d.ts +3 -5
  21. package/dist/core/schema.d.ts.map +1 -1
  22. package/dist/core/schema.js +85 -24
  23. package/dist/core/shared-prompt-loader.d.ts +13 -0
  24. package/dist/core/shared-prompt-loader.d.ts.map +1 -0
  25. package/dist/core/shared-prompt-loader.js +64 -0
  26. package/dist/core/unified-creation-session.d.ts +83 -0
  27. package/dist/core/unified-creation-session.d.ts.map +1 -0
  28. package/dist/core/unified-creation-session.js +943 -0
  29. package/dist/core/unified-creation-types.d.ts +58 -0
  30. package/dist/core/unified-creation-types.d.ts.map +1 -0
  31. package/dist/core/unified-creation-types.js +61 -0
  32. package/dist/core/vector-db-service.d.ts.map +1 -1
  33. package/dist/core/vector-db-service.js +10 -1
  34. package/dist/tools/answer-question.d.ts.map +1 -1
  35. package/dist/tools/answer-question.js +3 -4
  36. package/dist/tools/generate-manifests.d.ts.map +1 -1
  37. package/dist/tools/generate-manifests.js +25 -70
  38. package/dist/tools/organizational-data.d.ts +2 -2
  39. package/dist/tools/organizational-data.d.ts.map +1 -1
  40. package/dist/tools/organizational-data.js +650 -62
  41. package/dist/tools/version.d.ts +30 -3
  42. package/dist/tools/version.d.ts.map +1 -1
  43. package/dist/tools/version.js +200 -27
  44. package/package.json +3 -3
  45. package/prompts/infrastructure-trigger-expansion.md +26 -0
  46. package/prompts/infrastructure-triggers.md +11 -0
  47. package/prompts/kyverno-generation.md +317 -0
  48. package/prompts/pattern-complete-error.md +1 -0
  49. package/prompts/pattern-complete-success.md +8 -0
  50. package/prompts/pattern-created-by.md +1 -0
  51. package/prompts/pattern-description.md +7 -0
  52. package/prompts/pattern-rationale.md +1 -0
  53. package/prompts/pattern-resources.md +1 -0
  54. package/prompts/pattern-review.md +9 -0
  55. package/prompts/policy-complete-apply.md +12 -0
  56. package/prompts/policy-complete-discard.md +5 -0
  57. package/prompts/policy-complete-error.md +1 -0
  58. package/prompts/policy-complete-save.md +12 -0
  59. package/prompts/policy-complete-success.md +7 -0
  60. package/prompts/policy-created-by.md +1 -0
  61. package/prompts/policy-description.md +9 -0
  62. package/prompts/policy-namespace-scope.md +43 -0
  63. package/prompts/policy-rationale.md +1 -0
  64. package/prompts/question-generation.md +27 -0
  65. package/prompts/resource-selection.md +6 -2
  66. package/shared-prompts/manage-org-data.md +20 -9
  67. package/dist/core/pattern-creation-session.d.ts +0 -43
  68. package/dist/core/pattern-creation-session.d.ts.map +0 -1
  69. package/dist/core/pattern-creation-session.js +0 -312
  70. package/dist/core/pattern-creation-types.d.ts +0 -30
  71. package/dist/core/pattern-creation-types.d.ts.map +0 -1
  72. package/dist/core/pattern-creation-types.js +0 -8
  73. package/shared-prompts/context-load.md +0 -19
  74. package/shared-prompts/context-save.md +0 -24
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Unified Creation Workflow Types
3
+ *
4
+ * Generic workflow system that handles both patterns and policies
5
+ * with configurable steps and entity-specific behavior.
6
+ */
7
+ export type WorkflowStep = 'description' | 'triggers' | 'trigger-expansion' | 'resources' | 'rationale' | 'created-by' | 'namespace-scope' | 'kyverno-generation' | 'review' | 'apply-save-discard' | 'complete';
8
+ export type EntityType = 'pattern' | 'policy';
9
+ export interface WorkflowConfig {
10
+ entityType: EntityType;
11
+ steps: WorkflowStep[];
12
+ displayName: string;
13
+ }
14
+ export interface UnifiedCreationSession {
15
+ sessionId: string;
16
+ entityType: EntityType;
17
+ currentStep: WorkflowStep;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ data: {
21
+ description?: string;
22
+ initialTriggers?: string[];
23
+ expandedTriggers?: string[];
24
+ suggestedResources?: string[];
25
+ rationale?: string;
26
+ createdBy?: string;
27
+ source?: string;
28
+ policyId?: string;
29
+ generatedKyvernoPolicy?: string;
30
+ kyvernoGenerationError?: string;
31
+ kyvernoGenerationSkipped?: boolean;
32
+ kyvernoSkipReason?: string;
33
+ deploymentChoice?: string;
34
+ namespaceScope?: {
35
+ type: 'all' | 'include' | 'exclude';
36
+ namespaces?: string[];
37
+ };
38
+ };
39
+ }
40
+ export interface UnifiedWorkflowStepResponse {
41
+ sessionId: string;
42
+ entityType: EntityType;
43
+ prompt?: string;
44
+ instruction: string;
45
+ nextStep?: WorkflowStep;
46
+ data?: any;
47
+ }
48
+ export interface UnifiedWorkflowCompletionResponse {
49
+ sessionId: string;
50
+ entityType: EntityType;
51
+ instruction: string;
52
+ data?: any;
53
+ }
54
+ export declare const WORKFLOW_CONFIGS: Record<EntityType, WorkflowConfig>;
55
+ export declare function requiresResources(config: WorkflowConfig): boolean;
56
+ export declare function getNextStep(currentStep: WorkflowStep, config: WorkflowConfig): WorkflowStep | null;
57
+ export declare function getPreviousStep(currentStep: WorkflowStep, config: WorkflowConfig): WorkflowStep | null;
58
+ //# sourceMappingURL=unified-creation-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-creation-types.d.ts","sourceRoot":"","sources":["../../src/core/unified-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KACH,CAAC;CACH;AAED,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AA4BD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,cAAc,CAW/D,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEjE;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAIlG;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAGtG"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Unified Creation Workflow Types
4
+ *
5
+ * Generic workflow system that handles both patterns and policies
6
+ * with configurable steps and entity-specific behavior.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WORKFLOW_CONFIGS = void 0;
10
+ exports.requiresResources = requiresResources;
11
+ exports.getNextStep = getNextStep;
12
+ exports.getPreviousStep = getPreviousStep;
13
+ // Pattern workflow - unchanged, no Kyverno generation needed
14
+ const PATTERN_WORKFLOW = [
15
+ 'description',
16
+ 'triggers',
17
+ 'trigger-expansion',
18
+ 'resources',
19
+ 'rationale',
20
+ 'created-by',
21
+ 'review',
22
+ 'complete'
23
+ ];
24
+ // Policy workflow - includes Kyverno generation after data collection
25
+ const POLICY_WORKFLOW = [
26
+ 'description',
27
+ 'triggers',
28
+ 'trigger-expansion',
29
+ 'rationale',
30
+ 'created-by',
31
+ 'namespace-scope',
32
+ 'kyverno-generation',
33
+ 'review',
34
+ 'complete'
35
+ ];
36
+ // Predefined workflow configurations
37
+ exports.WORKFLOW_CONFIGS = {
38
+ pattern: {
39
+ entityType: 'pattern',
40
+ steps: PATTERN_WORKFLOW,
41
+ displayName: 'Pattern'
42
+ },
43
+ policy: {
44
+ entityType: 'policy',
45
+ steps: POLICY_WORKFLOW,
46
+ displayName: 'Policy Intent'
47
+ }
48
+ };
49
+ // Helper functions
50
+ function requiresResources(config) {
51
+ return config.steps.includes('resources');
52
+ }
53
+ function getNextStep(currentStep, config) {
54
+ const currentIndex = config.steps.indexOf(currentStep);
55
+ const nextIndex = currentIndex + 1;
56
+ return nextIndex < config.steps.length ? config.steps[nextIndex] : null;
57
+ }
58
+ function getPreviousStep(currentStep, config) {
59
+ const currentIndex = config.steps.indexOf(currentStep);
60
+ return currentIndex > 0 ? config.steps[currentIndex - 1] : null;
61
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"vector-db-service.d.ts","sourceRoot":"","sources":["../../src/core/vector-db-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,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,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,EAAE,CAAC;IA0C1B;;OAEG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA2B7D;;OAEG;IACG,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe/C;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BzC;;;OAGG;IACG,eAAe,CAAC,KAAK,GAAE,MAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IA+BvE;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC;IAYvC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAarC;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,SAAS,IAAI,cAAc;CAG5B"}
@@ -12,10 +12,13 @@ class VectorDBService {
12
12
  config;
13
13
  collectionName;
14
14
  constructor(config = {}) {
15
+ if (!config.collectionName) {
16
+ throw new Error('Collection name is required for Vector DB service');
17
+ }
15
18
  this.config = {
16
19
  url: config.url !== undefined ? config.url : (process.env.QDRANT_URL || 'http://localhost:6333'),
17
20
  apiKey: config.apiKey || process.env.QDRANT_API_KEY,
18
- collectionName: config.collectionName || 'patterns'
21
+ collectionName: config.collectionName
19
22
  };
20
23
  this.collectionName = this.config.collectionName;
21
24
  this.validateConfig();
@@ -270,6 +273,12 @@ class VectorDBService {
270
273
  throw new Error('Vector DB client not initialized');
271
274
  }
272
275
  try {
276
+ // Check if collection exists first
277
+ const collections = await this.client.getCollections();
278
+ const collectionExists = collections.collections.some(col => col.name === this.collectionName);
279
+ if (!collectionExists) {
280
+ throw new Error(`Collection '${this.collectionName}' does not exist. No data has been stored yet.`);
281
+ }
273
282
  const scrollResult = await this.client.scroll(this.collectionName, {
274
283
  limit,
275
284
  with_payload: true,
@@ -1 +1 @@
1
- {"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;AAkiBF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAC7G,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAqUxD"}
1
+ {"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAQhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;AAgiBF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAC7G,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAqUxD"}
@@ -43,6 +43,7 @@ const error_handling_1 = require("../core/error-handling");
43
43
  const claude_1 = require("../core/claude");
44
44
  const fs = __importStar(require("fs"));
45
45
  const path = __importStar(require("path"));
46
+ const shared_prompt_loader_1 = require("../core/shared-prompt-loader");
46
47
  const session_utils_1 = require("../core/session-utils");
47
48
  const solution_utils_1 = require("../core/solution-utils");
48
49
  // Tool metadata for direct MCP registration
@@ -354,8 +355,7 @@ function getStageGuidance(stage) {
354
355
  * Phase 1: Analyze what resources are needed for the user request
355
356
  */
356
357
  async function analyzeResourceNeeds(currentSolution, openResponse, context) {
357
- const promptPath = path.join(__dirname, '..', '..', 'prompts', 'resource-analysis.md');
358
- const template = fs.readFileSync(promptPath, 'utf8');
358
+ const template = (0, shared_prompt_loader_1.loadPrompt)('resource-analysis');
359
359
  // Get available resources from solution or use defaults
360
360
  const availableResources = currentSolution.availableResources || {
361
361
  resources: [],
@@ -428,8 +428,7 @@ async function applySolutionEnhancement(solution, openResponse, analysisResult,
428
428
  * Auto-populate existing questions based on user requirements
429
429
  */
430
430
  async function autoPopulateQuestions(solution, openResponse, analysisResult) {
431
- const promptPath = path.join(__dirname, '..', '..', 'prompts', 'solution-enhancement.md');
432
- const template = fs.readFileSync(promptPath, 'utf8');
431
+ const template = (0, shared_prompt_loader_1.loadPrompt)('solution-enhancement');
433
432
  const enhancementPrompt = template
434
433
  .replace('{current_solution}', JSON.stringify(solution, null, 2))
435
434
  .replace('{detailed_schemas}', JSON.stringify(solution.schemas || {}, null, 2))
@@ -1 +1 @@
1
- {"version":3,"file":"generate-manifests.d.ts","sourceRoot":"","sources":["../../src/tools/generate-manifests.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUhD,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,+IAA+I,CAAC;AAG/L,eAAO,MAAM,mCAAmC;;CAE/C,CAAC;AA2VF;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAC5B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAwMxD"}
1
+ {"version":3,"file":"generate-manifests.d.ts","sourceRoot":"","sources":["../../src/tools/generate-manifests.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAWhD,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,+IAA+I,CAAC;AAG/L,eAAO,MAAM,mCAAmC;;CAE/C,CAAC;AAgSF;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAC5B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAoMxD"}
@@ -42,10 +42,11 @@ const zod_1 = require("zod");
42
42
  const error_handling_1 = require("../core/error-handling");
43
43
  const claude_1 = require("../core/claude");
44
44
  const cluster_utils_1 = require("../core/cluster-utils");
45
+ const schema_1 = require("../core/schema");
45
46
  const fs = __importStar(require("fs"));
46
47
  const path = __importStar(require("path"));
48
+ const shared_prompt_loader_1 = require("../core/shared-prompt-loader");
47
49
  const yaml = __importStar(require("js-yaml"));
48
- const child_process_1 = require("child_process");
49
50
  const session_utils_1 = require("../core/session-utils");
50
51
  const solution_utils_1 = require("../core/solution-utils");
51
52
  // Tool metadata for direct MCP registration
@@ -149,45 +150,6 @@ function validateYamlSyntax(yamlContent) {
149
150
  };
150
151
  }
151
152
  }
152
- /**
153
- * Run kubectl dry-run validation
154
- */
155
- async function runKubectlDryRun(yamlPath) {
156
- return new Promise((resolve) => {
157
- const kubectl = (0, child_process_1.spawn)('kubectl', ['apply', '--dry-run=server', '-f', yamlPath], {
158
- stdio: ['ignore', 'pipe', 'pipe']
159
- });
160
- let stdout = '';
161
- let stderr = '';
162
- kubectl.stdout.on('data', (data) => {
163
- stdout += data.toString();
164
- });
165
- kubectl.stderr.on('data', (data) => {
166
- stderr += data.toString();
167
- });
168
- kubectl.on('close', (code) => {
169
- resolve({
170
- success: code === 0,
171
- yamlSyntaxValid: true, // If we get here, YAML was parseable
172
- kubectlOutput: stderr || stdout,
173
- exitCode: code || 0,
174
- stderr,
175
- stdout
176
- });
177
- });
178
- kubectl.on('error', (error) => {
179
- resolve({
180
- success: false,
181
- yamlSyntaxValid: true,
182
- error: `Failed to run kubectl: ${error.message}`,
183
- kubectlOutput: `kubectl command failed: ${error.message}`,
184
- exitCode: -1,
185
- stderr: error.message,
186
- stdout: ''
187
- });
188
- });
189
- });
190
- }
191
153
  /**
192
154
  * Validate manifests using multi-layer approach
193
155
  */
@@ -195,33 +157,32 @@ async function validateManifests(yamlPath) {
195
157
  // First check if file exists
196
158
  if (!fs.existsSync(yamlPath)) {
197
159
  return {
198
- success: false,
199
- yamlSyntaxValid: false,
200
- error: `Manifest file not found: ${yamlPath}`
160
+ valid: false,
161
+ errors: [`Manifest file not found: ${yamlPath}`],
162
+ warnings: []
201
163
  };
202
164
  }
203
- // Read YAML content
165
+ // Read YAML content for syntax validation
204
166
  const yamlContent = fs.readFileSync(yamlPath, 'utf8');
205
167
  // 1. YAML syntax validation
206
168
  const syntaxCheck = validateYamlSyntax(yamlContent);
207
169
  if (!syntaxCheck.valid) {
208
170
  return {
209
- success: false,
210
- yamlSyntaxValid: false,
211
- error: `YAML syntax error: ${syntaxCheck.error}`,
212
- kubectlOutput: `YAML parsing failed: ${syntaxCheck.error}`
171
+ valid: false,
172
+ errors: [`YAML syntax error: ${syntaxCheck.error}`],
173
+ warnings: []
213
174
  };
214
175
  }
215
- // 2. kubectl dry-run validation
216
- return await runKubectlDryRun(yamlPath);
176
+ // 2. kubectl dry-run validation using ManifestValidator
177
+ const validator = new schema_1.ManifestValidator();
178
+ return await validator.validateManifest(yamlPath, { dryRunMode: 'server' });
217
179
  }
218
180
  /**
219
181
  * Generate manifests using AI with Claude integration
220
182
  */
221
183
  async function generateManifestsWithAI(solution, dotAI, logger, errorContext, dotAiLabels) {
222
184
  // Load prompt template
223
- const promptPath = path.join(__dirname, '..', '..', 'prompts', 'manifest-generation.md');
224
- const template = fs.readFileSync(promptPath, 'utf8');
185
+ const template = (0, shared_prompt_loader_1.loadPrompt)('manifest-generation');
225
186
  // Retrieve schemas for solution resources
226
187
  const resourceSchemas = await retrieveResourceSchemas(solution, dotAI, logger);
227
188
  // Prepare template variables
@@ -234,10 +195,8 @@ ${errorContext.previousManifests}
234
195
  ` : 'None - this is the first attempt.';
235
196
  const errorDetails = errorContext ? `
236
197
  **Attempt**: ${errorContext.attempt}
237
- **YAML Syntax Valid**: ${errorContext.yamlSyntaxValid}
238
- **kubectl Output**: ${errorContext.kubectlOutput}
239
- **Exit Code**: ${errorContext.exitCode}
240
- **Error Details**: ${errorContext.stderr}
198
+ **Validation Errors**: ${errorContext.validationResult.errors.join(', ')}
199
+ **Validation Warnings**: ${errorContext.validationResult.warnings.join(', ')}
241
200
  ` : 'None - this is the first attempt.';
242
201
  // Replace template variables
243
202
  const schemasData = JSON.stringify(resourceSchemas, null, 2);
@@ -418,7 +377,7 @@ async function handleGenerateManifestsTool(args, dotAI, logger, requestId) {
418
377
  });
419
378
  // Validate manifests
420
379
  const validation = await validateManifests(yamlPath);
421
- if (validation.success) {
380
+ if (validation.valid) {
422
381
  logger.info('Manifest validation successful', {
423
382
  attempt,
424
383
  yamlPath,
@@ -445,17 +404,13 @@ async function handleGenerateManifestsTool(args, dotAI, logger, requestId) {
445
404
  lastError = {
446
405
  attempt,
447
406
  previousManifests: manifests,
448
- yamlSyntaxValid: validation.yamlSyntaxValid,
449
- kubectlOutput: validation.kubectlOutput,
450
- exitCode: validation.exitCode,
451
- stderr: validation.stderr,
452
- stdout: validation.stdout
407
+ validationResult: validation
453
408
  };
454
409
  logger.warn('Manifest validation failed', {
455
410
  attempt,
456
411
  maxAttempts,
457
- yamlSyntaxValid: validation.yamlSyntaxValid,
458
- kubectlOutput: validation.kubectlOutput,
412
+ validationErrors: validation.errors,
413
+ validationWarnings: validation.warnings,
459
414
  requestId
460
415
  });
461
416
  }
@@ -473,16 +428,16 @@ async function handleGenerateManifestsTool(args, dotAI, logger, requestId) {
473
428
  lastError = {
474
429
  attempt,
475
430
  previousManifests: lastError?.previousManifests || '',
476
- yamlSyntaxValid: false,
477
- kubectlOutput: errorMessage,
478
- exitCode: -1,
479
- stderr: errorMessage,
480
- stdout: ''
431
+ validationResult: {
432
+ valid: false,
433
+ errors: [errorMessage],
434
+ warnings: []
435
+ }
481
436
  };
482
437
  }
483
438
  }
484
439
  // If we reach here, all attempts failed
485
- throw new Error(`Failed to generate valid manifests after ${maxAttempts} attempts. Last error: ${lastError?.kubectlOutput}`);
440
+ throw new Error(`Failed to generate valid manifests after ${maxAttempts} attempts. Last errors: ${lastError?.validationResult.errors.join(', ')}`);
486
441
  }, {
487
442
  operation: 'generate_manifests',
488
443
  component: 'GenerateManifestsTool',
@@ -11,9 +11,9 @@ import { z } from 'zod';
11
11
  import { DotAI } from '../core/index';
12
12
  import { Logger } from '../core/error-handling';
13
13
  export declare const ORGANIZATIONAL_DATA_TOOL_NAME = "manageOrgData";
14
- export declare const ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = "Unified tool for managing cluster data: organizational patterns and resource capabilities. For patterns: supports step-by-step creation workflow. For capabilities: supports scan, list, get, delete, deleteAll, and progress operations for cluster resource capability discovery and management. Use dataType parameter to specify what to manage: \"pattern\" for organizational patterns, \"capabilities\" for resource capabilities.";
14
+ export declare const ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = "Unified tool for managing cluster data: organizational patterns, policy intents, and resource capabilities. For patterns and policies: supports create, list, get, delete, deleteAll, and search operations (patterns also support step-by-step creation workflow). For capabilities: supports scan, list, get, delete, deleteAll, and progress operations for cluster resource capability discovery and management. Use dataType parameter to specify what to manage: \"pattern\" for organizational patterns, \"policy\" for policy intents, \"capabilities\" for resource capabilities.";
15
15
  export declare const ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA: {
16
- dataType: z.ZodEnum<["pattern", "capabilities"]>;
16
+ dataType: z.ZodEnum<["pattern", "policy", "capabilities"]>;
17
17
  operation: z.ZodEnum<["create", "list", "get", "delete", "deleteAll", "scan", "analyze", "progress", "search"]>;
18
18
  sessionId: z.ZodOptional<z.ZodString>;
19
19
  step: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUhD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,8aAA0a,CAAC;AAG5d,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;CAwBjD,CAAC;AAg4EF;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAsHd"}
1
+ {"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAehD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,+jBAAyjB,CAAC;AAG3mB,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;CAwBjD,CAAC;AA6uFF;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CA0Hd"}