@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
package/README.md CHANGED
@@ -14,6 +14,7 @@ DevOps AI Toolkit is an AI-powered development productivity platform that enhanc
14
14
  ### Kubernetes Deployment
15
15
  - **Developers**: Deploy applications without needing deep Kubernetes expertise
16
16
  - **Platform Engineers**: Create organizational deployment patterns that enhance AI recommendations with institutional knowledge and best practices, and scan cluster resources to enable semantic matching for dramatically improved recommendation accuracy
17
+ - **Security Engineers**: Define governance policies that integrate into deployment workflows with optional Kyverno enforcement
17
18
 
18
19
  ### Documentation Testing
19
20
  - **Documentation Maintainers**: Automatically validate documentation accuracy and catch outdated content
@@ -72,6 +73,12 @@ Result: Finds sqls.devopstoolkit.live as perfect match ✨
72
73
  🔍 **Semantic Search**: Uses Vector DB technology for intelligent pattern matching based on user intent
73
74
  📋 **Best Practices**: Share deployment standards across teams through reusable patterns
74
75
 
76
+ ### Policy Management & Governance
77
+ 🛡️ **Policy Creation**: Define governance policies that guide users toward compliant configurations
78
+ ⚠️ **Compliance Integration**: Policies create required questions with compliance indicators during deployment
79
+ 🤖 **Kyverno Generation**: Automatically generates Kyverno ClusterPolicies for active enforcement
80
+ 🎯 **Proactive Governance**: Prevents configuration drift by embedding compliance into the recommendation workflow
81
+
75
82
  ### Shared Prompts Library
76
83
  🎯 **Native Slash Commands**: Prompts appear as `/dot-ai:prompt-name` in your coding agent
77
84
  📚 **Curated Library**: Access proven prompts for code review, documentation, architecture, and project management
@@ -118,6 +125,12 @@ This video explains the platform engineering problem and demonstrates the Kubern
118
125
  - **OpenAI API key** (required) for semantic pattern matching and vector operations
119
126
  - See the [Pattern Management Guide](./docs/pattern-management-guide.md) for complete setup
120
127
 
128
+ **For policy management and governance:**
129
+ - **Vector DB service** (Qdrant) for policy storage and semantic search
130
+ - **OpenAI API key** (required) for semantic policy matching and vector operations
131
+ - **Optional**: Kyverno installed in cluster for active policy enforcement
132
+ - See the [Policy Management Guide](./docs/policy-management-guide.md) for complete setup
133
+
121
134
  ### Installation
122
135
 
123
136
  DevOps AI Toolkit is designed to be used through AI development tools via MCP (Model Context Protocol). No direct installation needed - simply configure your AI tool to connect to the MCP server.
@@ -163,7 +176,7 @@ EOF
163
176
 
164
177
  **What you get:**
165
178
  - ✅ **Complete Stack**: MCP server + Qdrant vector database included
166
- - ✅ **All Features Working**: Capability management, pattern storage, semantic search
179
+ - ✅ **All Features Working**: Capability management, pattern storage, policy governance, semantic search
167
180
  - ✅ **No External Dependencies**: Everything runs in containers
168
181
  - ✅ **Kubernetes Integration**: Direct kubectl access to your clusters
169
182
 
@@ -220,6 +233,28 @@ Agent: Let me get enhanced recommendations using your capability data.
220
233
  Agent: Perfect! I found sqls.devopstoolkit.live as the top match - it's a managed database solution supporting PostgreSQL with multi-cloud capabilities and low complexity. Much better than the generic StatefulSet approach I would have suggested before!
221
234
  ```
222
235
 
236
+ **Example: Policy Management**
237
+ ```
238
+ User: I want to create a policy requiring resource limits on all deployments
239
+
240
+ Agent: I'll help you create a governance policy for resource limits. Let me start the creation workflow.
241
+ [Uses manageOrgData with policy creation]
242
+
243
+ Agent: Please describe your resource limits policy intent:
244
+
245
+ User: All container deployments must have CPU and memory limits to prevent resource exhaustion. CPU limits should be between 100m-2000m, memory between 128Mi-4Gi.
246
+
247
+ Agent: Excellent! I've created your Resource Limits Policy and generated a Kyverno ClusterPolicy for enforcement.
248
+
249
+ Would you like to:
250
+ 1. Store policy intent only (for AI guidance)
251
+ 2. Apply Kyverno policy to cluster (active enforcement)
252
+
253
+ User: Apply the Kyverno policy for active enforcement
254
+
255
+ Agent: ✅ Policy deployed! Now when users deploy applications, they'll get required questions for CPU/memory limits with your specified ranges, and any non-compliant deployments will be blocked by Kyverno.
256
+ ```
257
+
223
258
  **Example: Documentation Testing**
224
259
  ```
225
260
  User: I want to test my README.md file to make sure all the examples work
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/core/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C;;GAEG;AACH,MAAM,WAAW,kBAAkB;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EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAGtC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAGrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,iBAAiB,CAAoB;gBAEjC,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;IAKhE;;;;;OAKG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IA2B9B;;;;OAIG;YACW,WAAW;IA0BzB;;;;OAIG;YACW,oBAAoB;IAalC;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAwD/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAQ1D"}
@@ -7,43 +7,9 @@
7
7
  * This module provides capability inference for Kubernetes resources through
8
8
  * AI-powered analysis of schemas and metadata.
9
9
  */
10
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __importStar = (this && this.__importStar) || (function () {
27
- var ownKeys = function(o) {
28
- ownKeys = Object.getOwnPropertyNames || function (o) {
29
- var ar = [];
30
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
- return ar;
32
- };
33
- return ownKeys(o);
34
- };
35
- return function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- })();
43
10
  Object.defineProperty(exports, "__esModule", { value: true });
44
11
  exports.CapabilityInferenceEngine = void 0;
45
- const fs = __importStar(require("fs"));
46
- const path = __importStar(require("path"));
12
+ const shared_prompt_loader_1 = require("./shared-prompt-loader");
47
13
  /**
48
14
  * Generic Capability Inference Engine
49
15
  *
@@ -109,22 +75,11 @@ class CapabilityInferenceEngine {
109
75
  * @throws Error if prompt template cannot be loaded
110
76
  */
111
77
  async buildInferencePrompt(resourceName, resourceDefinition) {
112
- // Load prompt template using standard pattern from existing codebase
113
- const promptPath = path.join(__dirname, '..', '..', 'prompts', 'capability-inference.md');
114
- if (!fs.existsSync(promptPath)) {
115
- throw new Error(`Capability inference prompt template not found: ${promptPath}`);
116
- }
117
- let template;
118
- try {
119
- template = fs.readFileSync(promptPath, 'utf8');
120
- }
121
- catch (error) {
122
- throw new Error(`Failed to read capability inference prompt: ${error instanceof Error ? error.message : String(error)}`);
123
- }
124
- // Replace template variables using standard pattern
125
- const finalPrompt = template
126
- .replace(/\{resourceName\}/g, resourceName)
127
- .replace(/\{resourceDefinition\}/g, resourceDefinition || 'No resource definition provided');
78
+ // Load prompt template using shared prompt loader
79
+ const finalPrompt = (0, shared_prompt_loader_1.loadPrompt)('capability-inference', {
80
+ resourceName,
81
+ resourceDefinition: resourceDefinition || 'No resource definition provided'
82
+ });
128
83
  return finalPrompt;
129
84
  }
130
85
  /**
@@ -51,6 +51,8 @@ export declare class ClaudeIntegration {
51
51
  private debugMode;
52
52
  constructor(apiKey: string);
53
53
  private validateApiKey;
54
+ private shouldInitializeClient;
55
+ private isTestKey;
54
56
  /**
55
57
  * Create debug directory if it doesn't exist
56
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/core/claude.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AACpD,MAAM,MAAM,qBAAqB,GAC7B,0BAA0B,GAC1B,uBAAuB,GACvB,0BAA0B,GAC1B,qBAAqB,GACrB,0BAA0B,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,0BAA0B,EAAE,wBAAwB,EAAE,CAAC;IACvD,iBAAiB,EAAE;QACjB,oBAAoB,EAAE,WAAW,CAAC;QAClC,WAAW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AAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IA2BlE;;;;;;OAMG;IACG,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAE,MAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA+DvH,aAAa,IAAI,OAAO;CAGzB"}
@@ -45,6 +45,7 @@ exports.ClaudeIntegration = void 0;
45
45
  const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
46
46
  const fs = __importStar(require("fs"));
47
47
  const path = __importStar(require("path"));
48
+ const shared_prompt_loader_1 = require("./shared-prompt-loader");
48
49
  const crypto = __importStar(require("crypto"));
49
50
  class ClaudeIntegration {
50
51
  client = null;
@@ -56,7 +57,7 @@ class ClaudeIntegration {
56
57
  this.apiKey = apiKey;
57
58
  this.debugMode = process.env.DEBUG_DOT_AI === 'true';
58
59
  this.validateApiKey();
59
- if (this.apiKey) {
60
+ if (this.apiKey && this.shouldInitializeClient()) {
60
61
  this.client = new sdk_1.default({
61
62
  apiKey: this.apiKey,
62
63
  });
@@ -74,6 +75,15 @@ class ClaudeIntegration {
74
75
  throw new Error('Invalid API key: API key cannot be empty');
75
76
  }
76
77
  }
78
+ shouldInitializeClient() {
79
+ // Don't initialize for test configurations
80
+ const testKeys = ['test-key', 'mock-key', 'invalid-key'];
81
+ return !testKeys.includes(this.apiKey);
82
+ }
83
+ isTestKey() {
84
+ const testKeys = ['test-key', 'mock-key', 'invalid-key'];
85
+ return testKeys.includes(this.apiKey);
86
+ }
77
87
  /**
78
88
  * Create debug directory if it doesn't exist
79
89
  */
@@ -124,7 +134,8 @@ ${response.content}`;
124
134
  }
125
135
  }
126
136
  async sendMessage(message, operation = 'generic') {
127
- if (!this.client) {
137
+ // For test keys, skip client initialization check and continue to mock responses
138
+ if (!this.client && !this.isTestKey()) {
128
139
  throw new Error('Claude client not initialized due to missing API key');
129
140
  }
130
141
  if (this.apiKey === 'invalid-key') {
@@ -138,7 +149,7 @@ ${response.content}`;
138
149
  // Make real API call to Claude
139
150
  const completion = await this.client.messages.create({
140
151
  model: 'claude-sonnet-4-20250514', // Latest Claude Sonnet 4 - check for newer versions periodically
141
- max_tokens: 4000,
152
+ max_tokens: 64000,
142
153
  messages: [{ role: 'user', content: message }]
143
154
  });
144
155
  const content = completion.content[0].type === 'text' ? completion.content[0].text : '';
@@ -192,7 +203,7 @@ ${response.content}`;
192
203
  }
193
204
  }
194
205
  async generateYAML(resourceType, config) {
195
- if (!this.client) {
206
+ if (!this.client && !this.isTestKey()) {
196
207
  throw new Error('Claude client not initialized');
197
208
  }
198
209
  // Mock YAML generation for testing
@@ -250,7 +261,7 @@ spec:
250
261
  this.conversationHistory = [];
251
262
  }
252
263
  async generateManifest(spec) {
253
- if (!this.client) {
264
+ if (!this.client && !this.isTestKey()) {
254
265
  throw new Error('Claude client not initialized');
255
266
  }
256
267
  // Simulate manifest generation
@@ -278,14 +289,14 @@ spec:
278
289
  return yamlContent.trim();
279
290
  }
280
291
  async analyzeError(error, _context) {
281
- if (!this.client) {
292
+ if (!this.client && !this.isTestKey()) {
282
293
  throw new Error('Claude client not initialized');
283
294
  }
284
295
  // Simulate error analysis
285
296
  return `Error analysis: ${error}. Suggested fix: Check the configuration and try again.`;
286
297
  }
287
298
  async suggestImprovements(_manifest) {
288
- if (!this.client) {
299
+ if (!this.client && !this.isTestKey()) {
289
300
  throw new Error('Claude client not initialized');
290
301
  }
291
302
  // Simulate improvement suggestions
@@ -296,7 +307,7 @@ spec:
296
307
  ];
297
308
  }
298
309
  async processUserInput(input, context) {
299
- if (!this.client) {
310
+ if (!this.client && !this.isTestKey()) {
300
311
  throw new Error('Claude client not initialized');
301
312
  }
302
313
  // Simulate interactive workflow processing
@@ -326,17 +337,15 @@ spec:
326
337
  * @returns Analysis result with clarification opportunities
327
338
  */
328
339
  async analyzeIntentForClarification(intent, organizationalPatterns = '') {
329
- if (!this.client) {
340
+ if (!this.client && !this.isTestKey()) {
330
341
  throw new Error('Claude client not initialized');
331
342
  }
332
343
  try {
333
344
  // Load intent analysis prompt template
334
- const promptPath = path.join(__dirname, '..', '..', 'prompts', 'intent-analysis.md');
335
- const template = fs.readFileSync(promptPath, 'utf8');
336
- // Replace template variables
337
- const analysisPrompt = template
338
- .replaceAll('{intent}', intent)
339
- .replaceAll('{organizational_patterns}', organizationalPatterns || 'No specific organizational patterns available');
345
+ const analysisPrompt = (0, shared_prompt_loader_1.loadPrompt)('intent-analysis', {
346
+ intent,
347
+ organizational_patterns: organizationalPatterns || 'No specific organizational patterns available'
348
+ });
340
349
  // Send to Claude for analysis
341
350
  const response = await this.sendMessage(analysisPrompt, 'intent-analysis');
342
351
  // Parse JSON response with robust error handling
@@ -1 +1 @@
1
- {"version":3,"file":"doc-testing-session.d.ts","sourceRoot":"","sources":["../../src/core/doc-testing-session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EACL,iBAAiB,EACjB,eAAe,EAEf,YAAY,EACZ,eAAe,EACf,aAAa,EAEb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,wBAAwB;IAEnC;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,iBAAiB;IAyB7D;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,iBAAiB,GAAG,IAAI;IAiBnE;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IASxD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA0B5B;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI;IAyC/F;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkCxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqD5B;;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T,IAAI;IAmCP;;OAEG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,WAAW,EAAE;CAmBrE"}
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.DocTestingSessionManager = void 0;
43
43
  const fs = __importStar(require("fs"));
44
44
  const path = __importStar(require("path"));
45
+ const shared_prompt_loader_1 = require("./shared-prompt-loader");
45
46
  const session_utils_1 = require("./session-utils");
46
47
  const doc_testing_types_1 = require("./doc-testing-types");
47
48
  class DocTestingSessionManager {
@@ -273,47 +274,35 @@ The system manages session state and workflow progression automatically.`;
273
274
  * Load phase prompt from file (following CLAUDE.md pattern)
274
275
  */
275
276
  loadPhasePrompt(phase, session) {
276
- const promptPath = path.join(process.cwd(), 'prompts', `doc-testing-${phase}.md`);
277
- if (!fs.existsSync(promptPath)) {
278
- // Fallback to basic prompt if file doesn't exist
277
+ // Prepare template variables for all phases
278
+ const templateVariables = {
279
+ filePath: session.filePath,
280
+ sessionId: session.sessionId,
281
+ phase: phase,
282
+ totalSections: session.metadata.totalSections.toString(),
283
+ completedSections: session.metadata.completedSections.toString()
284
+ };
285
+ // Handle phase-specific template variables
286
+ if (phase === doc_testing_types_1.ValidationPhase.FIX) {
287
+ templateVariables.statusSummary = this.generateStatusSummary(session);
288
+ templateVariables.pendingItems = this.generatePendingItemsList(session);
289
+ }
290
+ if (phase === doc_testing_types_1.ValidationPhase.DONE) {
291
+ templateVariables.finalSummary = this.generateFinalSummary(session);
292
+ templateVariables.completionTime = session.metadata.lastUpdated;
293
+ templateVariables.sessionDir = session.metadata.sessionDir;
294
+ }
295
+ const result = (0, shared_prompt_loader_1.loadPrompt)(`doc-testing-${phase}`, templateVariables);
296
+ // Check if prompt loading failed and return fallback
297
+ if (result.startsWith('Error loading prompt:')) {
279
298
  return `Read the file at "${session.filePath}" and process it for phase ${phase}.`;
280
299
  }
281
- try {
282
- const template = fs.readFileSync(promptPath, 'utf8');
283
- // Replace all template variables with actual values
284
- let processedPrompt = template
285
- .replace(/\{filePath\}/g, session.filePath)
286
- .replace(/\{sessionId\}/g, session.sessionId)
287
- .replace(/\{phase\}/g, phase)
288
- .replace(/\{totalSections\}/g, session.metadata.totalSections.toString())
289
- .replace(/\{completedSections\}/g, session.metadata.completedSections.toString());
290
- // Handle fix phase specific template variables
291
- if (phase === doc_testing_types_1.ValidationPhase.FIX) {
292
- const statusSummary = this.generateStatusSummary(session);
293
- const pendingItems = this.generatePendingItemsList(session);
294
- processedPrompt = processedPrompt
295
- .replace(/\{statusSummary\}/g, statusSummary)
296
- .replace(/\{pendingItems\}/g, pendingItems);
297
- }
298
- // Handle done phase specific template variables
299
- if (phase === doc_testing_types_1.ValidationPhase.DONE) {
300
- const finalSummary = this.generateFinalSummary(session);
301
- processedPrompt = processedPrompt
302
- .replace(/\{completionTime\}/g, session.metadata.lastUpdated)
303
- .replace(/\{finalSummary\}/g, finalSummary)
304
- .replace(/\{sessionDir\}/g, session.metadata.sessionDir);
305
- }
306
- // Check for unreplaced template variables
307
- const unreplacedVars = processedPrompt.match(/\{[^}]+\}/g);
308
- if (unreplacedVars) {
309
- console.error(`Warning: Unreplaced template variables in ${phase} prompt:`, unreplacedVars);
310
- }
311
- return processedPrompt;
312
- }
313
- catch (error) {
314
- console.error(`Failed to load prompt for phase ${phase}:`, error);
315
- return `Read the file at "${session.filePath}" and process it for phase ${phase}.`;
300
+ // Check for unreplaced template variables and warn
301
+ const unreplacedVars = result.match(/\{[^}]+\}/g);
302
+ if (unreplacedVars) {
303
+ console.error(`Warning: Unreplaced template variables in ${phase} prompt:`, unreplacedVars);
316
304
  }
305
+ return result;
317
306
  }
318
307
  getNextPhase(currentPhase) {
319
308
  const phases = [doc_testing_types_1.ValidationPhase.SCAN, doc_testing_types_1.ValidationPhase.TEST, doc_testing_types_1.ValidationPhase.ANALYZE, doc_testing_types_1.ValidationPhase.FIX];
@@ -456,31 +445,24 @@ The system manages session state and workflow progression automatically.`;
456
445
  * Load section-specific test prompt
457
446
  */
458
447
  loadSectionTestPrompt(section, session) {
459
- const promptPath = path.join(process.cwd(), 'prompts', 'doc-testing-test-section.md');
460
- if (!fs.existsSync(promptPath)) {
461
- // Fallback prompt
448
+ const result = (0, shared_prompt_loader_1.loadPrompt)('doc-testing-test-section', {
449
+ filePath: session.filePath,
450
+ sessionId: session.sessionId,
451
+ sectionId: section.id,
452
+ sectionTitle: section.title,
453
+ totalSections: session.sections?.length.toString() || '0',
454
+ sectionsRemaining: this.getRemainingTestSections(session).length.toString()
455
+ });
456
+ // Check if prompt loading failed and return fallback
457
+ if (result.startsWith('Error loading prompt:')) {
462
458
  return `Test the "${section.title}" section of ${session.filePath}.\n\nAnalyze this section and test everything you determine is testable within it.`;
463
459
  }
464
- try {
465
- const template = fs.readFileSync(promptPath, 'utf8');
466
- const processedPrompt = template
467
- .replace(/\{filePath\}/g, session.filePath)
468
- .replace(/\{sessionId\}/g, session.sessionId)
469
- .replace(/\{sectionId\}/g, section.id)
470
- .replace(/\{sectionTitle\}/g, section.title)
471
- .replace(/\{totalSections\}/g, session.sections?.length.toString() || '0')
472
- .replace(/\{sectionsRemaining\}/g, this.getRemainingTestSections(session).length.toString());
473
- // Check for unreplaced template variables
474
- const unreplacedVars = processedPrompt.match(/\{[^}]+\}/g);
475
- if (unreplacedVars) {
476
- console.error(`Warning: Unreplaced template variables in section test prompt:`, unreplacedVars);
477
- }
478
- return processedPrompt;
479
- }
480
- catch (error) {
481
- console.error(`Failed to load section test prompt:`, error);
482
- return `Test the "${section.title}" section of ${session.filePath}.`;
460
+ // Check for unreplaced template variables and warn
461
+ const unreplacedVars = result.match(/\{[^}]+\}/g);
462
+ if (unreplacedVars) {
463
+ console.error(`Warning: Unreplaced template variables in section test prompt:`, unreplacedVars);
483
464
  }
465
+ return result;
484
466
  }
485
467
  /**
486
468
  * Convert string arrays to FixableItem arrays with generated IDs
@@ -40,12 +40,12 @@ export { WorkflowEngine } from './workflow';
40
40
  export { ClaudeIntegration } from './claude';
41
41
  export { SchemaParser, ManifestValidator, ResourceRecommender } from './schema';
42
42
  export { OrganizationalPattern, CreatePatternRequest } from './pattern-types';
43
+ export { BaseOrganizationalEntity, PolicyIntent, CreatePolicyIntentRequest, DeployedPolicyReference } from './organizational-types';
43
44
  export { validatePattern, createPattern, serializePattern, deserializePattern } from './pattern-operations';
44
- export { PatternCreationStep, PatternCreationSession, PatternWorkflowStep } from './pattern-creation-types';
45
- export { PatternCreationSessionManager } from './pattern-creation-session';
46
45
  export { VectorDBService, VectorDBConfig, VectorDocument, SearchResult } from './vector-db-service';
47
46
  export { BaseVectorService, BaseSearchOptions, BaseSearchResult } from './base-vector-service';
48
47
  export { PatternVectorService, PatternSearchOptions, PatternSearchResult } from './pattern-vector-service';
48
+ export { PolicyVectorService, PolicySearchOptions, PolicySearchResult } from './policy-vector-service';
49
49
  export { CapabilityVectorService, ResourceCapability, CapabilitySearchOptions } from './capability-vector-service';
50
50
  export { EmbeddingService, EmbeddingConfig, EmbeddingProvider, OpenAIEmbeddingProvider } from './embedding-service';
51
51
  export default DotAI;
@@ -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,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEhF,MAAM,WAAW,UAAU;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,C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AC/F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGpH,eAAe,KAAK,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * Shared intelligence for both CLI and MCP interfaces
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.OpenAIEmbeddingProvider = exports.EmbeddingService = exports.CapabilityVectorService = exports.PatternVectorService = exports.BaseVectorService = exports.VectorDBService = exports.PatternCreationSessionManager = exports.deserializePattern = exports.serializePattern = exports.createPattern = exports.validatePattern = exports.ResourceRecommender = exports.ManifestValidator = exports.SchemaParser = exports.ClaudeIntegration = exports.WorkflowEngine = exports.MemorySystem = exports.KubernetesDiscovery = exports.DotAI = void 0;
8
+ exports.OpenAIEmbeddingProvider = exports.EmbeddingService = exports.CapabilityVectorService = exports.PolicyVectorService = exports.PatternVectorService = exports.BaseVectorService = exports.VectorDBService = exports.deserializePattern = exports.serializePattern = exports.createPattern = exports.validatePattern = exports.ResourceRecommender = exports.ManifestValidator = exports.SchemaParser = exports.ClaudeIntegration = exports.WorkflowEngine = exports.MemorySystem = exports.KubernetesDiscovery = exports.DotAI = void 0;
9
9
  const discovery_1 = require("./discovery");
10
10
  const memory_1 = require("./memory");
11
11
  const workflow_1 = require("./workflow");
@@ -135,14 +135,15 @@ Object.defineProperty(exports, "validatePattern", { enumerable: true, get: funct
135
135
  Object.defineProperty(exports, "createPattern", { enumerable: true, get: function () { return pattern_operations_1.createPattern; } });
136
136
  Object.defineProperty(exports, "serializePattern", { enumerable: true, get: function () { return pattern_operations_1.serializePattern; } });
137
137
  Object.defineProperty(exports, "deserializePattern", { enumerable: true, get: function () { return pattern_operations_1.deserializePattern; } });
138
- var pattern_creation_session_1 = require("./pattern-creation-session");
139
- Object.defineProperty(exports, "PatternCreationSessionManager", { enumerable: true, get: function () { return pattern_creation_session_1.PatternCreationSessionManager; } });
138
+ // Removed obsolete pattern creation types - now using unified creation system
140
139
  var vector_db_service_1 = require("./vector-db-service");
141
140
  Object.defineProperty(exports, "VectorDBService", { enumerable: true, get: function () { return vector_db_service_1.VectorDBService; } });
142
141
  var base_vector_service_1 = require("./base-vector-service");
143
142
  Object.defineProperty(exports, "BaseVectorService", { enumerable: true, get: function () { return base_vector_service_1.BaseVectorService; } });
144
143
  var pattern_vector_service_1 = require("./pattern-vector-service");
145
144
  Object.defineProperty(exports, "PatternVectorService", { enumerable: true, get: function () { return pattern_vector_service_1.PatternVectorService; } });
145
+ var policy_vector_service_1 = require("./policy-vector-service");
146
+ Object.defineProperty(exports, "PolicyVectorService", { enumerable: true, get: function () { return policy_vector_service_1.PolicyVectorService; } });
146
147
  var capability_vector_service_1 = require("./capability-vector-service");
147
148
  Object.defineProperty(exports, "CapabilityVectorService", { enumerable: true, get: function () { return capability_vector_service_1.CapabilityVectorService; } });
148
149
  var embedding_service_1 = require("./embedding-service");
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Shared Organizational Entity Types
3
+ *
4
+ * Base interfaces and types for organizational entities (patterns and policies)
5
+ * that enhance AI recommendations with institutional knowledge via RAG.
6
+ */
7
+ /**
8
+ * Base interface for all organizational entities stored in Vector DB
9
+ * Contains shared fields used by both patterns and policies
10
+ */
11
+ export interface BaseOrganizationalEntity {
12
+ id: string;
13
+ description: string;
14
+ triggers: string[];
15
+ rationale: string;
16
+ createdAt: string;
17
+ createdBy: string;
18
+ }
19
+ /**
20
+ * Organizational Pattern - guides resource selection
21
+ * Extends base entity with pattern-specific fields
22
+ */
23
+ export interface OrganizationalPattern extends BaseOrganizationalEntity {
24
+ suggestedResources: string[];
25
+ }
26
+ /**
27
+ * Policy Intent - guides resource configuration
28
+ * Extends base entity with policy-specific fields
29
+ */
30
+ export interface PolicyIntent extends BaseOrganizationalEntity {
31
+ deployedPolicies?: DeployedPolicyReference[];
32
+ }
33
+ /**
34
+ * Reference to a deployed Kyverno policy
35
+ * Stored in PolicyIntent to track lifecycle without duplicating YAML
36
+ */
37
+ export interface DeployedPolicyReference {
38
+ name: string;
39
+ appliedAt: string;
40
+ }
41
+ export type CreatePatternRequest = Omit<OrganizationalPattern, 'id' | 'createdAt'>;
42
+ export type CreatePolicyIntentRequest = Omit<PolicyIntent, 'id' | 'createdAt' | 'deployedPolicies'>;
43
+ //# sourceMappingURL=organizational-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizational-types.d.ts","sourceRoot":"","sources":["../../src/core/organizational-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACrE,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,wBAAwB;IAC5D,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC;AAGnF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Shared Organizational Entity Types
4
+ *
5
+ * Base interfaces and types for organizational entities (patterns and policies)
6
+ * that enhance AI recommendations with institutional knowledge via RAG.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,14 +4,5 @@
4
4
  * Simple TypeScript interfaces for organizational deployment patterns
5
5
  * that enhance AI recommendations with institutional knowledge via RAG.
6
6
  */
7
- export interface OrganizationalPattern {
8
- id: string;
9
- description: string;
10
- triggers: string[];
11
- suggestedResources: string[];
12
- rationale: string;
13
- createdAt: string;
14
- createdBy: string;
15
- }
16
- export type CreatePatternRequest = Omit<OrganizationalPattern, 'id' | 'createdAt'>;
7
+ export { OrganizationalPattern, CreatePatternRequest } from './organizational-types.js';
17
8
  //# sourceMappingURL=pattern-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern-types.d.ts","sourceRoot":"","sources":["../../src/core/pattern-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"pattern-types.d.ts","sourceRoot":"","sources":["../../src/core/pattern-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Policy Vector Service
3
+ *
4
+ * Handles policy intent-specific Vector DB operations
5
+ * Extends BaseVectorService for policy intents
6
+ */
7
+ import { VectorDBService } from './vector-db-service';
8
+ import { PolicyIntent } from './organizational-types';
9
+ import { EmbeddingService } from './embedding-service';
10
+ import { BaseVectorService, BaseSearchOptions, BaseSearchResult } from './base-vector-service';
11
+ export interface PolicySearchOptions extends BaseSearchOptions {
12
+ }
13
+ export interface PolicySearchResult extends BaseSearchResult<PolicyIntent> {
14
+ }
15
+ export declare class PolicyVectorService extends BaseVectorService<PolicyIntent> {
16
+ constructor(vectorDB?: VectorDBService, embeddingService?: EmbeddingService);
17
+ protected createSearchText(policyIntent: PolicyIntent): string;
18
+ protected extractId(policyIntent: PolicyIntent): string;
19
+ protected createPayload(policyIntent: PolicyIntent): Record<string, any>;
20
+ protected payloadToData(payload: Record<string, any>): PolicyIntent;
21
+ storePolicyIntent(policyIntent: PolicyIntent): Promise<void>;
22
+ searchPolicyIntents(query: string, options?: PolicySearchOptions): Promise<PolicySearchResult[]>;
23
+ getPolicyIntent(id: string): Promise<PolicyIntent | null>;
24
+ getAllPolicyIntents(): Promise<PolicyIntent[]>;
25
+ deletePolicyIntent(id: string): Promise<void>;
26
+ getPolicyIntentsCount(): Promise<number>;
27
+ }
28
+ //# sourceMappingURL=policy-vector-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-vector-service.d.ts","sourceRoot":"","sources":["../../src/core/policy-vector-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,MAAM,WAAW,mBAAoB,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