@vfarcic/dot-ai 0.103.0 → 0.105.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 (96) hide show
  1. package/README.md +14 -1
  2. package/dist/core/ai-provider-factory.d.ts +90 -0
  3. package/dist/core/ai-provider-factory.d.ts.map +1 -0
  4. package/dist/core/ai-provider-factory.js +187 -0
  5. package/dist/core/ai-provider.interface.d.ts +116 -0
  6. package/dist/core/ai-provider.interface.d.ts.map +1 -0
  7. package/dist/core/ai-provider.interface.js +14 -0
  8. package/dist/core/capabilities.d.ts +3 -3
  9. package/dist/core/capabilities.d.ts.map +1 -1
  10. package/dist/core/capabilities.js +4 -4
  11. package/dist/core/capability-scan-workflow.d.ts.map +1 -1
  12. package/dist/core/capability-scan-workflow.js +29 -14
  13. package/dist/core/doc-testing-session.d.ts +1 -1
  14. package/dist/core/doc-testing-session.js +1 -1
  15. package/dist/core/error-handling.js +2 -2
  16. package/dist/core/index.d.ts +4 -6
  17. package/dist/core/index.d.ts.map +1 -1
  18. package/dist/core/index.js +11 -22
  19. package/dist/core/nushell-runtime.d.ts +39 -0
  20. package/dist/core/nushell-runtime.d.ts.map +1 -0
  21. package/dist/core/nushell-runtime.js +103 -0
  22. package/dist/core/platform-operations.d.ts +76 -0
  23. package/dist/core/platform-operations.d.ts.map +1 -0
  24. package/dist/core/platform-operations.js +317 -0
  25. package/dist/core/providers/anthropic-provider.d.ts +32 -0
  26. package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
  27. package/dist/core/providers/anthropic-provider.js +177 -0
  28. package/dist/core/providers/vercel-provider.d.ts +34 -0
  29. package/dist/core/providers/vercel-provider.d.ts.map +1 -0
  30. package/dist/core/providers/vercel-provider.js +202 -0
  31. package/dist/core/schema.d.ts +4 -7
  32. package/dist/core/schema.d.ts.map +1 -1
  33. package/dist/core/schema.js +13 -11
  34. package/dist/core/unified-creation-session.d.ts.map +1 -1
  35. package/dist/core/unified-creation-session.js +13 -14
  36. package/dist/interfaces/mcp.d.ts +1 -1
  37. package/dist/interfaces/mcp.d.ts.map +1 -1
  38. package/dist/interfaces/mcp.js +10 -2
  39. package/dist/interfaces/rest-api.js +1 -1
  40. package/dist/mcp/server.d.ts +1 -1
  41. package/dist/mcp/server.js +2 -2
  42. package/dist/tools/answer-question.d.ts.map +1 -1
  43. package/dist/tools/answer-question.js +8 -10
  44. package/dist/tools/build-platform.d.ts +25 -0
  45. package/dist/tools/build-platform.d.ts.map +1 -0
  46. package/dist/tools/build-platform.js +277 -0
  47. package/dist/tools/generate-manifests.d.ts.map +1 -1
  48. package/dist/tools/generate-manifests.js +7 -8
  49. package/dist/tools/index.d.ts +1 -0
  50. package/dist/tools/index.d.ts.map +1 -1
  51. package/dist/tools/index.js +6 -1
  52. package/dist/tools/organizational-data.d.ts.map +1 -1
  53. package/dist/tools/organizational-data.js +3 -2
  54. package/dist/tools/recommend.d.ts.map +1 -1
  55. package/dist/tools/recommend.js +50 -30
  56. package/dist/tools/remediate.d.ts.map +1 -1
  57. package/dist/tools/remediate.js +23 -39
  58. package/dist/tools/version.d.ts +10 -2
  59. package/dist/tools/version.d.ts.map +1 -1
  60. package/dist/tools/version.js +65 -24
  61. package/package.json +7 -3
  62. package/prompts/map-intent-to-operation.md +104 -0
  63. package/prompts/parse-script-operations.md +72 -0
  64. package/prompts/question-generation.md +31 -3
  65. package/scripts/ack.nu +195 -0
  66. package/scripts/anthropic.nu +24 -0
  67. package/scripts/argo-workflows.nu +47 -0
  68. package/scripts/argocd.nu +85 -0
  69. package/scripts/aso.nu +74 -0
  70. package/scripts/atlas.nu +15 -0
  71. package/scripts/backstage.nu +349 -0
  72. package/scripts/cert-manager.nu +13 -0
  73. package/scripts/cnpg.nu +14 -0
  74. package/scripts/common.nu +116 -0
  75. package/scripts/crossplane.nu +718 -0
  76. package/scripts/dot.nu +32 -0
  77. package/scripts/external-secrets.nu +110 -0
  78. package/scripts/gatekeeper.nu +19 -0
  79. package/scripts/github.nu +42 -0
  80. package/scripts/image.nu +67 -0
  81. package/scripts/ingress.nu +149 -0
  82. package/scripts/kro.nu +11 -0
  83. package/scripts/kubernetes.nu +609 -0
  84. package/scripts/kubevela.nu +22 -0
  85. package/scripts/kyverno.nu +16 -0
  86. package/scripts/mcp.nu +139 -0
  87. package/scripts/port.nu +71 -0
  88. package/scripts/prometheus.nu +21 -0
  89. package/scripts/registry.nu +55 -0
  90. package/scripts/storage.nu +210 -0
  91. package/scripts/tests.nu +12 -0
  92. package/scripts/toolhive.nu +21 -0
  93. package/scripts/velero.nu +45 -0
  94. package/dist/core/claude.d.ts +0 -88
  95. package/dist/core/claude.d.ts.map +0 -1
  96. package/dist/core/claude.js +0 -414
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/anthropic-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,iBAAkB,YAAW,UAAU;IAClD,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAU;gBAEf,MAAM,EAAE,gBAAgB;IAWpC,OAAO,CAAC,cAAc;IAStB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA+BrB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;CAkDvF"}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ /**
3
+ * Anthropic AI Provider Implementation
4
+ *
5
+ * Implements AIProvider interface using Anthropic SDK directly.
6
+ * Supports streaming for long operations and debug logging.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.AnthropicProvider = void 0;
46
+ const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
47
+ const fs = __importStar(require("fs"));
48
+ const path = __importStar(require("path"));
49
+ const crypto = __importStar(require("crypto"));
50
+ class AnthropicProvider {
51
+ client;
52
+ apiKey;
53
+ model;
54
+ debugMode;
55
+ constructor(config) {
56
+ this.apiKey = config.apiKey;
57
+ this.model = config.model || this.getDefaultModel();
58
+ this.debugMode = config.debugMode ?? (process.env.DEBUG_DOT_AI === 'true');
59
+ this.validateApiKey();
60
+ this.client = new sdk_1.default({
61
+ apiKey: this.apiKey,
62
+ });
63
+ }
64
+ validateApiKey() {
65
+ if (!this.apiKey) {
66
+ throw new Error('API key is required for Anthropic provider');
67
+ }
68
+ if (this.apiKey.length === 0) {
69
+ throw new Error('Invalid API key: API key cannot be empty');
70
+ }
71
+ }
72
+ getProviderType() {
73
+ return 'anthropic';
74
+ }
75
+ getDefaultModel() {
76
+ return 'claude-sonnet-4-5-20250929';
77
+ }
78
+ isInitialized() {
79
+ return this.client !== undefined;
80
+ }
81
+ /**
82
+ * Create debug directory if it doesn't exist
83
+ */
84
+ ensureDebugDirectory() {
85
+ const debugDir = path.join(process.cwd(), 'tmp', 'debug-ai');
86
+ if (!fs.existsSync(debugDir)) {
87
+ fs.mkdirSync(debugDir, { recursive: true });
88
+ }
89
+ return debugDir;
90
+ }
91
+ /**
92
+ * Generate unique identifier for debug files with operation context
93
+ */
94
+ generateDebugId(operation) {
95
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '').split('T');
96
+ const dateTime = timestamp[0] + 'T' + timestamp[1].substring(0, 6);
97
+ const randomHex = crypto.randomBytes(4).toString('hex');
98
+ return `${dateTime}_${randomHex}_${operation}`;
99
+ }
100
+ /**
101
+ * Save AI interaction for debugging when DEBUG_DOT_AI=true
102
+ */
103
+ debugLogInteraction(debugId, prompt, response, operation = 'ai_call') {
104
+ if (!this.debugMode)
105
+ return;
106
+ try {
107
+ const debugDir = this.ensureDebugDirectory();
108
+ // Save prompt with descriptive naming
109
+ const promptFile = path.join(debugDir, `${debugId}_prompt.md`);
110
+ fs.writeFileSync(promptFile, `# AI Prompt - ${operation}\n\nTimestamp: ${new Date().toISOString()}\nOperation: ${operation}\n\n---\n\n${prompt}`);
111
+ // Save response with matching naming
112
+ const responseFile = path.join(debugDir, `${debugId}_response.md`);
113
+ const responseContent = `# AI Response - ${operation}
114
+
115
+ Timestamp: ${new Date().toISOString()}
116
+ Operation: ${operation}
117
+ Input Tokens: ${response.usage.input_tokens}
118
+ Output Tokens: ${response.usage.output_tokens}
119
+
120
+ ---
121
+
122
+ ${response.content}`;
123
+ fs.writeFileSync(responseFile, responseContent);
124
+ console.log(`🐛 DEBUG: AI interaction logged to tmp/debug-ai/${debugId}_*.md`);
125
+ }
126
+ catch (error) {
127
+ console.warn('Failed to log AI debug interaction:', error);
128
+ }
129
+ }
130
+ async sendMessage(message, operation = 'generic') {
131
+ if (!this.client) {
132
+ throw new Error('Anthropic client not initialized');
133
+ }
134
+ try {
135
+ // Make real API call to Anthropic with streaming
136
+ const stream = await this.client.messages.create({
137
+ model: this.model,
138
+ max_tokens: 64000,
139
+ messages: [{ role: 'user', content: message }],
140
+ stream: true // Enable streaming by default to support long operations (>10 minutes)
141
+ });
142
+ let content = '';
143
+ let input_tokens = 0;
144
+ let output_tokens = 0;
145
+ for await (const chunk of stream) {
146
+ if (chunk.type === 'message_start') {
147
+ input_tokens = chunk.message.usage.input_tokens;
148
+ }
149
+ else if (chunk.type === 'content_block_delta') {
150
+ if (chunk.delta.type === 'text_delta') {
151
+ content += chunk.delta.text;
152
+ }
153
+ }
154
+ else if (chunk.type === 'message_delta') {
155
+ output_tokens = chunk.usage.output_tokens;
156
+ }
157
+ }
158
+ const response = {
159
+ content,
160
+ usage: {
161
+ input_tokens,
162
+ output_tokens
163
+ }
164
+ };
165
+ // Debug log the interaction if enabled
166
+ if (this.debugMode) {
167
+ const debugId = this.generateDebugId(operation);
168
+ this.debugLogInteraction(debugId, message, response, operation);
169
+ }
170
+ return response;
171
+ }
172
+ catch (error) {
173
+ throw new Error(`Anthropic API error: ${error}`);
174
+ }
175
+ }
176
+ }
177
+ exports.AnthropicProvider = AnthropicProvider;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Vercel AI Provider Implementation
3
+ *
4
+ * Implements AIProvider interface using Vercel AI SDK.
5
+ * Supports OpenAI and Google Gemini providers through unified interface.
6
+ */
7
+ import { AIProvider, AIResponse, AIProviderConfig } from '../ai-provider.interface';
8
+ export declare class VercelProvider implements AIProvider {
9
+ private providerType;
10
+ private model;
11
+ private apiKey;
12
+ private debugMode;
13
+ private modelInstance;
14
+ constructor(config: AIProviderConfig);
15
+ private validateConfiguration;
16
+ private initializeModel;
17
+ getProviderType(): string;
18
+ getDefaultModel(): string;
19
+ isInitialized(): boolean;
20
+ /**
21
+ * Create debug directory if it doesn't exist
22
+ */
23
+ private ensureDebugDirectory;
24
+ /**
25
+ * Generate unique identifier for debug files with operation context
26
+ */
27
+ private generateDebugId;
28
+ /**
29
+ * Save AI interaction for debugging when DEBUG_DOT_AI=true
30
+ */
31
+ private debugLogInteraction;
32
+ sendMessage(message: string, operation?: string): Promise<AIResponse>;
33
+ }
34
+ //# sourceMappingURL=vercel-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/vercel-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAalC,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAM;gBAEf,MAAM,EAAE,gBAAgB;IAUpC,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,eAAe;IAgCvB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiCrB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;CAiCvF"}
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ /**
3
+ * Vercel AI Provider Implementation
4
+ *
5
+ * Implements AIProvider interface using Vercel AI SDK.
6
+ * Supports OpenAI and Google Gemini providers through unified interface.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.VercelProvider = void 0;
43
+ const ai_1 = require("ai");
44
+ const openai_1 = require("@ai-sdk/openai");
45
+ const google_1 = require("@ai-sdk/google");
46
+ const anthropic_1 = require("@ai-sdk/anthropic");
47
+ const fs = __importStar(require("fs"));
48
+ const path = __importStar(require("path"));
49
+ const crypto = __importStar(require("crypto"));
50
+ /**
51
+ * Provider-specific default models
52
+ */
53
+ const PROVIDER_MODELS = {
54
+ openai: 'gpt-5',
55
+ google: 'gemini-2.5-pro',
56
+ anthropic: 'claude-sonnet-4-5-20250929'
57
+ };
58
+ class VercelProvider {
59
+ providerType;
60
+ model;
61
+ apiKey;
62
+ debugMode;
63
+ modelInstance; // Vercel AI SDK model instance
64
+ constructor(config) {
65
+ this.apiKey = config.apiKey;
66
+ this.providerType = config.provider;
67
+ this.model = config.model || this.getDefaultModel();
68
+ this.debugMode = config.debugMode ?? (process.env.DEBUG_DOT_AI === 'true');
69
+ this.validateConfiguration();
70
+ this.initializeModel();
71
+ }
72
+ validateConfiguration() {
73
+ if (!this.apiKey) {
74
+ throw new Error(`API key is required for ${this.providerType} provider`);
75
+ }
76
+ if (!['openai', 'google', 'anthropic'].includes(this.providerType)) {
77
+ throw new Error(`Unsupported provider: ${this.providerType}. Must be 'openai', 'google', or 'anthropic'`);
78
+ }
79
+ }
80
+ initializeModel() {
81
+ try {
82
+ switch (this.providerType) {
83
+ case 'openai': {
84
+ const provider = (0, openai_1.createOpenAI)({
85
+ apiKey: this.apiKey
86
+ });
87
+ this.modelInstance = provider(this.model);
88
+ break;
89
+ }
90
+ case 'google': {
91
+ const provider = (0, google_1.createGoogleGenerativeAI)({
92
+ apiKey: this.apiKey
93
+ });
94
+ this.modelInstance = provider(this.model);
95
+ break;
96
+ }
97
+ case 'anthropic': {
98
+ const provider = (0, anthropic_1.createAnthropic)({
99
+ apiKey: this.apiKey
100
+ });
101
+ this.modelInstance = provider(this.model);
102
+ break;
103
+ }
104
+ default:
105
+ throw new Error(`Cannot initialize model for provider: ${this.providerType}`);
106
+ }
107
+ }
108
+ catch (error) {
109
+ throw new Error(`Failed to initialize ${this.providerType} model: ${error}`);
110
+ }
111
+ }
112
+ getProviderType() {
113
+ return this.providerType;
114
+ }
115
+ getDefaultModel() {
116
+ return PROVIDER_MODELS[this.providerType];
117
+ }
118
+ isInitialized() {
119
+ return this.modelInstance !== undefined;
120
+ }
121
+ /**
122
+ * Create debug directory if it doesn't exist
123
+ */
124
+ ensureDebugDirectory() {
125
+ const debugDir = path.join(process.cwd(), 'tmp', 'debug-ai');
126
+ if (!fs.existsSync(debugDir)) {
127
+ fs.mkdirSync(debugDir, { recursive: true });
128
+ }
129
+ return debugDir;
130
+ }
131
+ /**
132
+ * Generate unique identifier for debug files with operation context
133
+ */
134
+ generateDebugId(operation) {
135
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '').split('T');
136
+ const dateTime = timestamp[0] + 'T' + timestamp[1].substring(0, 6);
137
+ const randomHex = crypto.randomBytes(4).toString('hex');
138
+ return `${dateTime}_${randomHex}_${operation}`;
139
+ }
140
+ /**
141
+ * Save AI interaction for debugging when DEBUG_DOT_AI=true
142
+ */
143
+ debugLogInteraction(debugId, prompt, response, operation = 'ai_call') {
144
+ if (!this.debugMode)
145
+ return;
146
+ try {
147
+ const debugDir = this.ensureDebugDirectory();
148
+ // Save prompt with descriptive naming
149
+ const promptFile = path.join(debugDir, `${debugId}_prompt.md`);
150
+ fs.writeFileSync(promptFile, `# AI Prompt - ${operation}\n\nTimestamp: ${new Date().toISOString()}\nProvider: ${this.providerType}\nModel: ${this.model}\nOperation: ${operation}\n\n---\n\n${prompt}`);
151
+ // Save response with matching naming
152
+ const responseFile = path.join(debugDir, `${debugId}_response.md`);
153
+ const responseContent = `# AI Response - ${operation}
154
+
155
+ Timestamp: ${new Date().toISOString()}
156
+ Provider: ${this.providerType}
157
+ Model: ${this.model}
158
+ Operation: ${operation}
159
+ Input Tokens: ${response.usage.input_tokens}
160
+ Output Tokens: ${response.usage.output_tokens}
161
+
162
+ ---
163
+
164
+ ${response.content}`;
165
+ fs.writeFileSync(responseFile, responseContent);
166
+ console.log(`🐛 DEBUG: AI interaction logged to tmp/debug-ai/${debugId}_*.md`);
167
+ }
168
+ catch (error) {
169
+ console.warn('Failed to log AI debug interaction:', error);
170
+ }
171
+ }
172
+ async sendMessage(message, operation = 'generic') {
173
+ if (!this.isInitialized()) {
174
+ throw new Error(`${this.providerType} provider not initialized`);
175
+ }
176
+ try {
177
+ // Use Vercel AI SDK generateText
178
+ // Note: maxTokens omitted - let SDK/provider use model-specific optimal defaults
179
+ const result = await (0, ai_1.generateText)({
180
+ model: this.modelInstance,
181
+ prompt: message,
182
+ });
183
+ const response = {
184
+ content: result.text,
185
+ usage: {
186
+ input_tokens: result.usage.inputTokens || 0,
187
+ output_tokens: result.usage.outputTokens || 0
188
+ }
189
+ };
190
+ // Debug log the interaction if enabled
191
+ if (this.debugMode) {
192
+ const debugId = this.generateDebugId(operation);
193
+ this.debugLogInteraction(debugId, message, response, operation);
194
+ }
195
+ return response;
196
+ }
197
+ catch (error) {
198
+ throw new Error(`${this.providerType} API error: ${error}`);
199
+ }
200
+ }
201
+ }
202
+ exports.VercelProvider = VercelProvider;
@@ -5,6 +5,7 @@
5
5
  * Fetches structured OpenAPI schemas from Kubernetes API server and validates manifests
6
6
  */
7
7
  import { ResourceExplanation } from './discovery';
8
+ import { AIProvider } from './ai-provider.interface';
8
9
  export interface FieldConstraints {
9
10
  minimum?: number;
10
11
  maximum?: number;
@@ -97,9 +98,6 @@ export interface ResourceSolution {
97
98
  patternInfluences?: PatternInfluence[];
98
99
  usedPatterns?: boolean;
99
100
  }
100
- export interface AIRankingConfig {
101
- claudeApiKey: string;
102
- }
103
101
  export interface ClusterOptions {
104
102
  namespaces: string[];
105
103
  storageClasses: string[];
@@ -151,12 +149,11 @@ export declare class ManifestValidator {
151
149
  * ResourceRecommender determines which resources best meet user needs using AI
152
150
  */
153
151
  export declare class ResourceRecommender {
154
- private claudeIntegration;
155
- private config;
152
+ private aiProvider;
156
153
  private patternService?;
157
154
  private capabilityService?;
158
155
  private policyService?;
159
- constructor(config: AIRankingConfig);
156
+ constructor(aiProvider?: AIProvider);
160
157
  /**
161
158
  * Find the best resource solution(s) for user intent using two-phase analysis
162
159
  */
@@ -239,7 +236,7 @@ export declare class ResourceRecommender {
239
236
  .replace('{patterns}', patternsContext);
240
237
 
241
238
 
242
- const response = await this.claudeIntegration.sendMessage(selectionPrompt, 'resource-selection');
239
+ const response = await this.aiProvider.sendMessage(selectionPrompt, 'resource-selection');
243
240
 
244
241
  try {
245
242
  // Extract JSON from response with robust parsing
@@ -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;AAclD,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,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;I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 @@ var __importStar = (this && this.__importStar) || (function () {
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.ResourceRecommender = exports.ManifestValidator = exports.SchemaParser = void 0;
43
43
  const kubernetes_utils_1 = require("./kubernetes-utils");
44
- const claude_1 = require("./claude");
45
44
  const pattern_vector_service_1 = require("./pattern-vector-service");
46
45
  const vector_db_service_1 = require("./vector-db-service");
47
46
  const capability_vector_service_1 = require("./capability-vector-service");
@@ -266,14 +265,17 @@ exports.ManifestValidator = ManifestValidator;
266
265
  * ResourceRecommender determines which resources best meet user needs using AI
267
266
  */
268
267
  class ResourceRecommender {
269
- claudeIntegration;
270
- config;
268
+ aiProvider;
271
269
  patternService;
272
270
  capabilityService;
273
271
  policyService;
274
- constructor(config) {
275
- this.config = config;
276
- this.claudeIntegration = new claude_1.ClaudeIntegration(config.claudeApiKey);
272
+ constructor(aiProvider) {
273
+ // Use provided AI provider or create from environment
274
+ this.aiProvider = aiProvider || (() => {
275
+ // Lazy import to avoid circular dependencies
276
+ const { createAIProvider } = require('./ai-provider-factory');
277
+ return createAIProvider();
278
+ })();
277
279
  // Initialize capability service - fail gracefully if Vector DB unavailable
278
280
  try {
279
281
  // Use environment variable for collection name (allows using test data collection)
@@ -311,8 +313,8 @@ class ResourceRecommender {
311
313
  * Find the best resource solution(s) for user intent using two-phase analysis
312
314
  */
313
315
  async findBestSolutions(intent, _explainResource) {
314
- if (!this.claudeIntegration.isInitialized()) {
315
- throw new Error('Claude integration not initialized. API key required for AI-powered resource ranking.');
316
+ if (!this.aiProvider.isInitialized()) {
317
+ throw new Error('AI provider not initialized. API key required for AI-powered resource ranking.');
316
318
  }
317
319
  try {
318
320
  // Phase 0: Search for relevant organizational patterns
@@ -373,7 +375,7 @@ class ResourceRecommender {
373
375
  */
374
376
  async assembleAndRankSolutions(intent, availableResources, patterns) {
375
377
  const prompt = await this.loadSolutionAssemblyPrompt(intent, availableResources, patterns);
376
- const response = await this.claudeIntegration.sendMessage(prompt, 'solution-assembly');
378
+ const response = await this.aiProvider.sendMessage(prompt, 'solution-assembly');
377
379
  return this.parseSimpleSolutionResponse(response.content);
378
380
  }
379
381
  /**
@@ -620,7 +622,7 @@ class ResourceRecommender {
620
622
  .replace('{patterns}', patternsContext);
621
623
 
622
624
 
623
- const response = await this.claudeIntegration.sendMessage(selectionPrompt, 'resource-selection');
625
+ const response = await this.aiProvider.sendMessage(selectionPrompt, 'resource-selection');
624
626
 
625
627
  try {
626
628
  // Extract JSON from response with robust parsing
@@ -901,7 +903,7 @@ Available Node Labels: ${clusterOptions.nodeLabels.length > 0 ? clusterOptions.n
901
903
  .replace('{resource_details}', resourceDetails)
902
904
  .replace('{cluster_options}', clusterOptionsText)
903
905
  .replace('{policy_context}', policyContextText);
904
- const response = await this.claudeIntegration.sendMessage(questionPrompt, 'question-generation');
906
+ const response = await this.aiProvider.sendMessage(questionPrompt, 'question-generation');
905
907
  // Use robust JSON extraction
906
908
  const questions = this.extractJsonFromAIResponse(response.content);
907
909
  // Validate the response structure
@@ -1 +1 @@
1
- {"version":3,"file":"unified-creation-session.d.ts","sourceRoot":"","sources":["../../src/core/unified-creation-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,iCAAiC,EACjC,UAAU,EAIX,MAAM,0BAA0B,CAAC;AAKlC,qBAAa,6BAA6B;IACxC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAsB;gBAE3B,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,mBAAmB;IAKnE;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,sBAAsB;IAqBhD;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,sBAAsB,GAAG,IAAI;IAiBxE;;OAEG;IACH,eAAe,CAAC,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;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,sBAAsB;IA2GvF;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,2BAA2B,GAAG,iCAAiC,CAAC;IAoGhJ;;OAEG;YACW,4BAA4B;IA4C1C;;OAEG;YACW,gCAAgC;IAsC9C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6E1B;;OAEG;YACW,gBAAgB;IAsF9B;;OAEG;YACW,4BAA4B;IAoH1C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;YACW,qBAAqB;IAqCnC;;OAEG;YACW,mBAAmB;IAqLjC;;OAEG;YACW,uBAAuB;IAmFrC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAG1B"}
@@ -48,7 +48,6 @@ const session_utils_1 = require("./session-utils");
48
48
  const shared_prompt_loader_1 = require("./shared-prompt-loader");
49
49
  const capability_vector_service_1 = require("./capability-vector-service");
50
50
  const discovery_1 = require("./discovery");
51
- const claude_1 = require("./claude");
52
51
  const schema_1 = require("./schema");
53
52
  const version_1 = require("../tools/version");
54
53
  const yaml = __importStar(require("js-yaml"));
@@ -335,18 +334,18 @@ class UnifiedCreationSessionManager {
335
334
  * Generate trigger expansion using internal AI
336
335
  */
337
336
  async generateInternalTriggerExpansion(initialTriggers, description) {
338
- const apiKey = process.env.ANTHROPIC_API_KEY;
339
- if (!apiKey || apiKey === 'test-key') {
340
- console.warn('ANTHROPIC_API_KEY not available for trigger expansion');
337
+ const { createAIProvider } = require('./ai-provider-factory');
338
+ const aiProvider = createAIProvider();
339
+ if (!aiProvider.isInitialized()) {
340
+ console.warn('AI provider not available for trigger expansion');
341
341
  return [];
342
342
  }
343
- const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
344
343
  const prompt = (0, shared_prompt_loader_1.loadPrompt)('infrastructure-trigger-expansion', {
345
344
  initialTriggers: initialTriggers.join(', '),
346
345
  description
347
346
  });
348
347
  try {
349
- const response = await claudeIntegration.sendMessage(prompt, 'trigger-expansion');
348
+ const response = await aiProvider.sendMessage(prompt, 'trigger-expansion');
350
349
  const expandedText = response.content.trim();
351
350
  if (!expandedText || expandedText.toLowerCase().includes('no relevant') || expandedText.toLowerCase().includes('no additional')) {
352
351
  return [];
@@ -354,9 +353,9 @@ class UnifiedCreationSessionManager {
354
353
  // Parse comma-separated response and clean up
355
354
  const expanded = expandedText
356
355
  .split(',')
357
- .map(trigger => trigger.trim())
358
- .filter(trigger => trigger.length > 0)
359
- .filter(trigger => !initialTriggers.some(initial => initial.toLowerCase() === trigger.toLowerCase()));
356
+ .map((trigger) => trigger.trim())
357
+ .filter((trigger) => trigger.length > 0)
358
+ .filter((trigger) => !initialTriggers.some((initial) => initial.toLowerCase() === trigger.toLowerCase()));
360
359
  return expanded;
361
360
  }
362
361
  catch (error) {
@@ -485,7 +484,7 @@ The pattern is now ready to enhance AI recommendations. When users ask for deplo
485
484
  // Create policy intent using the consistent ID generated during kyverno-generation step
486
485
  if (!session.data.policyId) {
487
486
  // In test environment, generate ID if missing (for mocked workflows)
488
- const isTestEnv = process.env.NODE_ENV === 'test' || process.env.ANTHROPIC_API_KEY === 'test-key';
487
+ const isTestEnv = process.env.NODE_ENV === 'test';
489
488
  if (isTestEnv) {
490
489
  session.data.policyId = (0, crypto_1.randomUUID)();
491
490
  }
@@ -733,10 +732,10 @@ The policy intent has been stored in the database. The Kyverno policy was not ap
733
732
  error_details: lastError ? `\n**Attempt**: ${lastError.attempt}\n**Validation Errors**: ${lastError.validationResult.errors.join(', ')}\n**Validation Warnings**: ${lastError.validationResult.warnings.join(', ')}` : 'None - this is the first attempt.'
734
733
  };
735
734
  const prompt = (0, shared_prompt_loader_1.loadPrompt)('kyverno-generation', templateData);
736
- // Call Claude AI internally to generate Kyverno policy
737
- const apiKey = process.env.ANTHROPIC_API_KEY || 'test-key';
738
- const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
739
- const response = await claudeIntegration.sendMessage(prompt, 'kyverno-generation');
735
+ // Call AI provider internally to generate Kyverno policy
736
+ const { createAIProvider } = require('./ai-provider-factory');
737
+ const aiProvider = createAIProvider();
738
+ const response = await aiProvider.sendMessage(prompt, 'kyverno-generation');
740
739
  // Response should be clean YAML with analysis comments
741
740
  const kyvernoPolicy = response.content.trim();
742
741
  // Save policy to file immediately after generation
@@ -2,7 +2,7 @@
2
2
  * Model Context Protocol (MCP) Interface for DevOps AI Toolkit
3
3
  *
4
4
  * Provides MCP server capabilities that expose DevOps AI Toolkit functionality
5
- * to AI assistants like Claude through standardized protocol
5
+ * to AI assistants through standardized protocol
6
6
  */
7
7
  import { DotAI } from '../core/index';
8
8
  export interface MCPServerConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAwCtC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACxC;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAkB;IACrC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