@vfarcic/dot-ai 0.104.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 (56) hide show
  1. package/README.md +0 -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/platform-operations.d.ts +3 -3
  20. package/dist/core/platform-operations.d.ts.map +1 -1
  21. package/dist/core/platform-operations.js +6 -6
  22. package/dist/core/providers/anthropic-provider.d.ts +32 -0
  23. package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
  24. package/dist/core/providers/anthropic-provider.js +177 -0
  25. package/dist/core/providers/vercel-provider.d.ts +34 -0
  26. package/dist/core/providers/vercel-provider.d.ts.map +1 -0
  27. package/dist/core/providers/vercel-provider.js +202 -0
  28. package/dist/core/schema.d.ts +4 -7
  29. package/dist/core/schema.d.ts.map +1 -1
  30. package/dist/core/schema.js +13 -11
  31. package/dist/core/unified-creation-session.d.ts.map +1 -1
  32. package/dist/core/unified-creation-session.js +13 -14
  33. package/dist/interfaces/mcp.d.ts +1 -1
  34. package/dist/interfaces/mcp.js +1 -1
  35. package/dist/interfaces/rest-api.js +1 -1
  36. package/dist/mcp/server.d.ts +1 -1
  37. package/dist/mcp/server.js +2 -2
  38. package/dist/tools/answer-question.d.ts.map +1 -1
  39. package/dist/tools/answer-question.js +8 -10
  40. package/dist/tools/build-platform.js +3 -3
  41. package/dist/tools/generate-manifests.d.ts.map +1 -1
  42. package/dist/tools/generate-manifests.js +7 -8
  43. package/dist/tools/organizational-data.d.ts.map +1 -1
  44. package/dist/tools/organizational-data.js +3 -2
  45. package/dist/tools/recommend.d.ts.map +1 -1
  46. package/dist/tools/recommend.js +50 -30
  47. package/dist/tools/remediate.d.ts.map +1 -1
  48. package/dist/tools/remediate.js +23 -39
  49. package/dist/tools/version.d.ts +3 -2
  50. package/dist/tools/version.d.ts.map +1 -1
  51. package/dist/tools/version.js +35 -23
  52. package/package.json +5 -2
  53. package/prompts/question-generation.md +31 -3
  54. package/dist/core/claude.d.ts +0 -88
  55. package/dist/core/claude.d.ts.map +0 -1
  56. package/dist/core/claude.js +0 -414
@@ -42,7 +42,7 @@ exports.parseAIResponse = parseAIResponse;
42
42
  exports.handleRemediateTool = handleRemediateTool;
43
43
  const zod_1 = require("zod");
44
44
  const error_handling_1 = require("../core/error-handling");
45
- const claude_1 = require("../core/claude");
45
+ const ai_provider_factory_1 = require("../core/ai-provider-factory");
46
46
  const session_utils_1 = require("../core/session-utils");
47
47
  const kubernetes_utils_1 = require("../core/kubernetes-utils");
48
48
  const fs = __importStar(require("fs"));
@@ -116,7 +116,7 @@ function updateSessionFile(sessionDir, sessionId, updates) {
116
116
  /**
117
117
  * AI-driven investigation loop - iteratively gather data and analyze until complete
118
118
  */
119
- async function conductInvestigation(session, sessionDir, claudeIntegration, logger, requestId) {
119
+ async function conductInvestigation(session, sessionDir, aiProvider, logger, requestId) {
120
120
  const maxIterations = 20; // Allow more comprehensive investigations
121
121
  let currentIteration = session.iterations.length;
122
122
  logger.info('Starting AI investigation loop', {
@@ -128,7 +128,7 @@ async function conductInvestigation(session, sessionDir, claudeIntegration, logg
128
128
  logger.debug(`Starting investigation iteration ${currentIteration + 1}`, { requestId, sessionId: session.sessionId });
129
129
  try {
130
130
  // Get AI analysis with investigation prompts
131
- const aiAnalysis = await analyzeCurrentState(session, claudeIntegration, logger, requestId);
131
+ const aiAnalysis = await analyzeCurrentState(session, aiProvider, logger, requestId);
132
132
  // Parse AI response for data requests and completion status
133
133
  const { dataRequests, isComplete, needsMoreSpecificInfo, parsedResponse } = parseAIResponse(aiAnalysis);
134
134
  // Handle early termination when issue description is too vague
@@ -221,7 +221,7 @@ async function conductInvestigation(session, sessionDir, claudeIntegration, logg
221
221
  /**
222
222
  * Analyze current state using AI with investigation prompts
223
223
  */
224
- async function analyzeCurrentState(session, claudeIntegration, logger, requestId) {
224
+ async function analyzeCurrentState(session, aiProvider, logger, requestId) {
225
225
  logger.debug('Analyzing current state with AI', { requestId, sessionId: session.sessionId });
226
226
  try {
227
227
  // Load investigation prompt template
@@ -262,14 +262,14 @@ async function analyzeCurrentState(session, claudeIntegration, logger, requestId
262
262
  .replace('{maxIterations}', maxIterations.toString())
263
263
  .replace('{previousIterations}', previousIterationsJson)
264
264
  .replace('{clusterApiResources}', clusterApiResources);
265
- logger.debug('Sending investigation prompt to Claude', {
265
+ logger.debug('Sending investigation prompt to AI', {
266
266
  requestId,
267
267
  sessionId: session.sessionId,
268
268
  promptLength: investigationPrompt.length,
269
269
  iteration: currentIteration
270
270
  });
271
- // Send to Claude AI
272
- const aiResponse = await claudeIntegration.sendMessage(investigationPrompt);
271
+ // Send to AI provider
272
+ const aiResponse = await aiProvider.sendMessage(investigationPrompt);
273
273
  logger.debug('Received AI analysis response', {
274
274
  requestId,
275
275
  sessionId: session.sessionId,
@@ -285,9 +285,9 @@ async function analyzeCurrentState(session, claudeIntegration, logger, requestId
285
285
  requestId,
286
286
  sessionId: session.sessionId,
287
287
  suggestedActions: [
288
- 'Check ANTHROPIC_API_KEY is set correctly',
288
+ 'Check AI provider API key is set correctly',
289
289
  'Verify prompts/remediate-investigation.md exists',
290
- 'Check network connectivity to Anthropic API'
290
+ 'Check network connectivity to AI provider'
291
291
  ]
292
292
  });
293
293
  }
@@ -505,17 +505,8 @@ function generateErrorSuggestion(errorMessage) {
505
505
  async function generateFinalAnalysis(session, logger, requestId) {
506
506
  logger.debug('Generating final analysis with AI', { requestId, sessionId: session.sessionId });
507
507
  try {
508
- // Initialize Claude integration
509
- const claudeApiKey = process.env.ANTHROPIC_API_KEY;
510
- if (!claudeApiKey) {
511
- throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.CONFIGURATION, error_handling_1.ErrorSeverity.HIGH, 'ANTHROPIC_API_KEY environment variable not set for final analysis', {
512
- operation: 'generateFinalAnalysis',
513
- component: 'RemediateTool',
514
- requestId,
515
- sessionId: session.sessionId
516
- });
517
- }
518
- const claudeIntegration = new claude_1.ClaudeIntegration(claudeApiKey);
508
+ // Initialize AI provider (will validate API key automatically)
509
+ const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
519
510
  // Load final analysis prompt template
520
511
  const promptPath = path.join(__dirname, '..', '..', 'prompts', 'remediate-final-analysis.md');
521
512
  const promptTemplate = fs.readFileSync(promptPath, 'utf8');
@@ -541,13 +532,13 @@ async function generateFinalAnalysis(session, logger, requestId) {
541
532
  .replace('{iterations}', session.iterations.length.toString())
542
533
  .replace('{dataSources}', dataSources.join(', '))
543
534
  .replace('{completeInvestigationData}', JSON.stringify(completeInvestigationData, null, 2));
544
- logger.debug('Sending final analysis request to Claude AI', {
535
+ logger.debug('Sending final analysis request to AI provider', {
545
536
  requestId,
546
537
  sessionId: session.sessionId,
547
538
  promptLength: finalAnalysisPrompt.length
548
539
  });
549
- // Send to Claude AI
550
- const aiResponse = await claudeIntegration.sendMessage(finalAnalysisPrompt);
540
+ // Send to AI provider
541
+ const aiResponse = await aiProvider.sendMessage(finalAnalysisPrompt);
551
542
  logger.debug('Received AI final analysis response', {
552
543
  requestId,
553
544
  sessionId: session.sessionId,
@@ -650,9 +641,9 @@ async function generateFinalAnalysis(session, logger, requestId) {
650
641
  requestId,
651
642
  sessionId: session.sessionId,
652
643
  suggestedActions: [
653
- 'Check ANTHROPIC_API_KEY is set correctly',
644
+ 'Check AI provider API key is set correctly',
654
645
  'Verify prompts/remediate-final-analysis.md exists',
655
- 'Check network connectivity to Anthropic API',
646
+ 'Check network connectivity to AI provider',
656
647
  'Review AI response format for parsing issues'
657
648
  ]
658
649
  });
@@ -739,8 +730,10 @@ async function executeRemediationCommands(session, sessionDir, logger, requestId
739
730
  actionId,
740
731
  command: action.command
741
732
  });
742
- // Execute the command as-is using shell
743
- const fullCommand = action.command || '';
733
+ // Execute the command using shell
734
+ // Clean up escape sequences that some AI models incorrectly add to JSON parameters
735
+ let fullCommand = action.command || '';
736
+ fullCommand = fullCommand.replace(/\\"/g, '"');
744
737
  const { exec } = require('child_process');
745
738
  const { promisify } = require('util');
746
739
  const execAsync = promisify(exec);
@@ -970,19 +963,10 @@ async function handleRemediateTool(args) {
970
963
  // Write initial session file
971
964
  writeSessionFile(sessionDir, sessionId, session);
972
965
  logger.info('Investigation session created', { requestId, sessionId });
973
- // Initialize Claude integration
974
- const claudeApiKey = process.env.ANTHROPIC_API_KEY;
975
- if (!claudeApiKey) {
976
- throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.CONFIGURATION, error_handling_1.ErrorSeverity.HIGH, 'ANTHROPIC_API_KEY environment variable not set', {
977
- operation: 'claude_initialization',
978
- component: 'RemediateTool',
979
- requestId,
980
- suggestedActions: ['Set ANTHROPIC_API_KEY environment variable']
981
- });
982
- }
983
- const claudeIntegration = new claude_1.ClaudeIntegration(claudeApiKey);
966
+ // Initialize AI provider (will validate API key automatically)
967
+ const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
984
968
  // Conduct AI-driven investigation
985
- const finalAnalysis = await conductInvestigation(session, sessionDir, claudeIntegration, logger, requestId);
969
+ const finalAnalysis = await conductInvestigation(session, sessionDir, aiProvider, logger, requestId);
986
970
  logger.info('Remediation analysis completed', {
987
971
  requestId,
988
972
  sessionId,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { Logger } from '../core/error-handling';
8
8
  export declare const VERSION_TOOL_NAME = "version";
9
- export declare const VERSION_TOOL_DESCRIPTION = "Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, Anthropic API connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check";
9
+ export declare const VERSION_TOOL_DESCRIPTION = "Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, AI provider connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check";
10
10
  export declare const VERSION_TOOL_INPUT_SCHEMA: {};
11
11
  export interface VersionInfo {
12
12
  version: string;
@@ -45,9 +45,10 @@ export interface SystemStatus {
45
45
  dimensions?: number;
46
46
  reason?: string;
47
47
  };
48
- anthropic: {
48
+ aiProvider: {
49
49
  connected: boolean;
50
50
  keyConfigured: boolean;
51
+ providerType?: string;
51
52
  error?: string;
52
53
  };
53
54
  kubernetes: {
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,wBAAwB,+PAA+P,CAAC;AACrS,eAAO,MAAM,yBAAyB,IAAK,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,EAAE;YACX,QAAQ,EAAE;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,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,YAAY,EAAE;QACZ,WAAW,EAAE,OAAO,CAAC;QACrB,eAAe,EAAE,OAAO,CAAC;QACzB,oBAAoB,EAAE,OAAO,CAAC;QAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qBAAqB,EAAE,OAAO,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAgOD;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CA8HzE;AAsHD;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAqB5C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAqFd"}
@@ -51,7 +51,7 @@ const discovery_1 = require("../core/discovery");
51
51
  const kubernetes_utils_1 = require("../core/kubernetes-utils");
52
52
  const nushell_runtime_1 = require("../core/nushell-runtime");
53
53
  exports.VERSION_TOOL_NAME = 'version';
54
- exports.VERSION_TOOL_DESCRIPTION = 'Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, Anthropic API connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check';
54
+ exports.VERSION_TOOL_DESCRIPTION = 'Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, AI provider connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check';
55
55
  exports.VERSION_TOOL_INPUT_SCHEMA = {};
56
56
  /**
57
57
  * Test Vector DB connectivity and get status for all collections
@@ -421,32 +421,44 @@ async function getNushellStatus() {
421
421
  }
422
422
  }
423
423
  /**
424
- * Test Anthropic API connectivity
424
+ * Test AI provider connectivity
425
425
  */
426
- async function getAnthropicStatus() {
427
- const keyConfigured = !!process.env.ANTHROPIC_API_KEY;
428
- if (!keyConfigured) {
429
- return {
430
- connected: false,
431
- keyConfigured: false,
432
- error: 'ANTHROPIC_API_KEY environment variable not set'
433
- };
434
- }
426
+ async function getAIProviderStatus() {
435
427
  try {
436
- // Import Claude integration and test a simple connection
437
- const { ClaudeIntegration } = await Promise.resolve().then(() => __importStar(require('../core/claude')));
438
- const claude = new ClaudeIntegration(process.env.ANTHROPIC_API_KEY);
428
+ // Import AI provider factory and test connectivity
429
+ const { createAIProvider } = await Promise.resolve().then(() => __importStar(require('../core/ai-provider-factory')));
430
+ const aiProvider = createAIProvider();
431
+ if (!aiProvider.isInitialized()) {
432
+ return {
433
+ connected: false,
434
+ keyConfigured: false,
435
+ providerType: aiProvider.getProviderType(),
436
+ error: 'AI provider API key not configured'
437
+ };
438
+ }
439
439
  // Test with a minimal request to check connectivity
440
- await claude.sendMessage('test');
440
+ await aiProvider.sendMessage('test');
441
441
  return {
442
442
  connected: true,
443
- keyConfigured: true
443
+ keyConfigured: true,
444
+ providerType: aiProvider.getProviderType()
444
445
  };
445
446
  }
446
447
  catch (error) {
448
+ // Try to get provider type even on error
449
+ let providerType;
450
+ try {
451
+ const { createAIProvider } = await Promise.resolve().then(() => __importStar(require('../core/ai-provider-factory')));
452
+ const aiProvider = createAIProvider();
453
+ providerType = aiProvider.getProviderType();
454
+ }
455
+ catch {
456
+ providerType = undefined;
457
+ }
447
458
  return {
448
459
  connected: false,
449
- keyConfigured: true,
460
+ keyConfigured: false,
461
+ providerType,
450
462
  error: error instanceof Error ? error.message : String(error)
451
463
  };
452
464
  }
@@ -485,10 +497,10 @@ async function handleVersionTool(args, logger, requestId) {
485
497
  const version = getVersionInfo();
486
498
  // Run all diagnostics in parallel for better performance
487
499
  logger.info('Running system diagnostics...', { requestId });
488
- const [vectorDBStatus, embeddingStatus, anthropicStatus, kubernetesStatus, capabilityStatus, kyvernoStatus, nushellStatus] = await Promise.all([
500
+ const [vectorDBStatus, embeddingStatus, aiProviderStatus, kubernetesStatus, capabilityStatus, kyvernoStatus, nushellStatus] = await Promise.all([
489
501
  getVectorDBStatus(),
490
502
  getEmbeddingStatus(),
491
- getAnthropicStatus(),
503
+ getAIProviderStatus(),
492
504
  getKubernetesStatus(),
493
505
  getCapabilityStatus(),
494
506
  getKyvernoStatus(),
@@ -498,7 +510,7 @@ async function handleVersionTool(args, logger, requestId) {
498
510
  version,
499
511
  vectorDB: vectorDBStatus,
500
512
  embedding: embeddingStatus,
501
- anthropic: anthropicStatus,
513
+ aiProvider: aiProviderStatus,
502
514
  kubernetes: kubernetesStatus,
503
515
  capabilities: capabilityStatus,
504
516
  kyverno: kyvernoStatus,
@@ -510,7 +522,7 @@ async function handleVersionTool(args, logger, requestId) {
510
522
  version: version.version,
511
523
  vectorDBConnected: vectorDBStatus.connected,
512
524
  embeddingAvailable: embeddingStatus.available,
513
- anthropicConnected: anthropicStatus.connected,
525
+ aiProviderConnected: aiProviderStatus.connected,
514
526
  kubernetesConnected: kubernetesStatus.connected,
515
527
  capabilitySystemReady: capabilityStatus.systemReady,
516
528
  kyvernoReady: kyvernoStatus.policyGenerationReady,
@@ -523,7 +535,7 @@ async function handleVersionTool(args, logger, requestId) {
523
535
  status: 'success',
524
536
  system: systemStatus,
525
537
  summary: {
526
- overall: vectorDBStatus.connected && anthropicStatus.connected && kubernetesStatus.connected && capabilityStatus.systemReady ? 'healthy' : 'degraded',
538
+ overall: vectorDBStatus.connected && aiProviderStatus.connected && kubernetesStatus.connected && capabilityStatus.systemReady ? 'healthy' : 'degraded',
527
539
  patternSearch: embeddingStatus.available ? 'semantic+keyword' : 'keyword-only',
528
540
  capabilityScanning: capabilityStatus.systemReady && kubernetesStatus.connected ? 'ready' : 'not-ready',
529
541
  kubernetesAccess: kubernetesStatus.connected ? 'connected' : 'disconnected',
@@ -533,7 +545,7 @@ async function handleVersionTool(args, logger, requestId) {
533
545
  vectorDBStatus.connected && vectorDBStatus.collections.policies.exists ? 'policy-management' : null,
534
546
  capabilityStatus.systemReady && kubernetesStatus.connected ? 'capability-scanning' : null,
535
547
  embeddingStatus.available ? 'semantic-search' : null,
536
- anthropicStatus.connected ? 'ai-recommendations' : null,
548
+ aiProviderStatus.connected ? 'ai-recommendations' : null,
537
549
  kubernetesStatus.connected ? 'kubernetes-integration' : null,
538
550
  kyvernoStatus.policyGenerationReady ? 'policy-generation' : null,
539
551
  nushellStatus.ready ? 'platform-scripting' : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vfarcic/dot-ai",
3
- "version": "0.104.0",
3
+ "version": "0.105.0",
4
4
  "description": "AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance",
5
5
  "mcpName": "io.github.vfarcic/dot-ai",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,6 @@
14
14
  },
15
15
  "scripts": {
16
16
  "test": "npm run test:integration",
17
- "test:integration:setup": "./tests/integration/infrastructure/setup-cluster.sh",
18
17
  "test:integration:teardown": "./tests/integration/infrastructure/teardown-cluster.sh",
19
18
  "test:integration:server": "KUBECONFIG=./kubeconfig-test.yaml PORT=3456 DOT_AI_SESSION_DIR=./tmp/sessions TRANSPORT_TYPE=http QDRANT_URL=http://localhost:6335 QDRANT_CAPABILITIES_COLLECTION=capabilities-policies ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY OPENAI_API_KEY=$OPENAI_API_KEY node dist/mcp/server.js",
20
19
  "test:integration": "./tests/integration/infrastructure/run-integration-tests.sh",
@@ -82,10 +81,14 @@
82
81
  "vitest": "^3.2.4"
83
82
  },
84
83
  "dependencies": {
84
+ "@ai-sdk/anthropic": "^2.0.23",
85
+ "@ai-sdk/google": "^2.0.17",
86
+ "@ai-sdk/openai": "^2.0.42",
85
87
  "@anthropic-ai/sdk": "^0.65.0",
86
88
  "@kubernetes/client-node": "^1.3.0",
87
89
  "@modelcontextprotocol/sdk": "^1.13.2",
88
90
  "@qdrant/js-client-rest": "^1.15.0",
91
+ "ai": "^5.0.60",
89
92
  "glob": "^11.0.3",
90
93
  "openai": "^5.11.0",
91
94
  "yaml": "^2.8.0",
@@ -17,6 +17,10 @@
17
17
 
18
18
  ## Instructions
19
19
 
20
+ ## ⚠️ CRITICAL: MANDATORY "name" FIELD REQUIREMENT
21
+
22
+ **BEFORE GENERATING ANY QUESTIONS**: The REQUIRED section MUST include a question with `id: "name"`. This is non-negotiable and your response will be rejected if this field is missing or renamed to any variation like "cluster-name", "deployment-name", or "app-name".
23
+
20
24
  ## 🛡️ POLICY-AWARE QUESTION GENERATION (HIGHEST PRIORITY)
21
25
 
22
26
  **Policy Requirements Integration:**
@@ -52,9 +56,21 @@ Organize questions into three categories based on their importance and impact:
52
56
  ### REQUIRED Questions
53
57
  Essential information needed for basic functionality. These are mandatory fields or critical configuration that makes the difference between working and non-working deployments. Without answers to these questions, the manifests cannot be generated or will fail to deploy.
54
58
 
55
- **MANDATORY QUESTIONS**: You MUST always include these questions in the REQUIRED section:
56
- - `name`: Resource name (applies to metadata.name across all resources)
57
- - `namespace`: Target namespace (ONLY if any resource in the solution is namespace-scoped - check resource scope information)
59
+ **🚨 CRITICAL MANDATORY REQUIREMENTS - NON-NEGOTIABLE 🚨**
60
+
61
+ You MUST include these EXACT questions with these EXACT IDs in the REQUIRED section. DO NOT rename, replace, or substitute these with similar fields:
62
+
63
+ 1. **REQUIRED: `name` question (id: "name")**
64
+ - Question ID MUST be exactly: `"id": "name"`
65
+ - DO NOT use: "cluster-name", "deployment-name", "app-name", or any variation
66
+ - This is used for tracking and metadata - the manifest generator will apply it appropriately to resource-specific name fields
67
+ - Example: `{"id": "name", "question": "What is the name for this deployment?", "type": "text", ...}`
68
+
69
+ 2. **REQUIRED: `namespace` question (id: "namespace")**
70
+ - ONLY if any resource in the solution is namespace-scoped - check resource scope information
71
+ - Question ID MUST be exactly: `"id": "namespace"`
72
+
73
+ **VALIDATION**: Your response will fail if the REQUIRED section does not contain a question with `"id": "name"`
58
74
 
59
75
  ### BASIC Questions
60
76
  Common configuration options most users will want to set. These improve the deployment but aren't strictly required for basic functionality. They represent sensible customizations that enhance the deployment.
@@ -113,6 +129,17 @@ Return your response as JSON in this exact format:
113
129
  ```json
114
130
  {
115
131
  "required": [
132
+ {
133
+ "id": "name",
134
+ "question": "What is the name for this deployment?",
135
+ "type": "text",
136
+ "placeholder": "e.g., my-app",
137
+ "validation": {
138
+ "required": true,
139
+ "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
140
+ },
141
+ "suggestedAnswer": "example-app"
142
+ },
116
143
  {
117
144
  "id": "unique-kebab-case-id",
118
145
  "question": "User-friendly question text?",
@@ -143,6 +170,7 @@ Return your response as JSON in this exact format:
143
170
 
144
171
  ## Important Notes
145
172
 
173
+ - **CRITICAL VALIDATION REQUIREMENT**: The REQUIRED section MUST contain a question with `"id": "name"` - responses without this will be rejected
146
174
  - **CRITICAL**: Only ask questions about properties explicitly defined in the provided resource schemas
147
175
  - **REQUIRED**: Each question must include a `suggestedAnswer` field with a valid example value that passes the validation rules
148
176
  - **Generate comprehensive questions** covering all meaningful configuration options available in the resource schemas
@@ -1,88 +0,0 @@
1
- /**
2
- * Claude Integration Module
3
- *
4
- * Handles AI communication, YAML generation, and learning integration
5
- */
6
- export interface ClaudeResponse {
7
- content: string;
8
- usage: {
9
- input_tokens: number;
10
- output_tokens: number;
11
- };
12
- }
13
- export interface YAMLResponse {
14
- yaml: string;
15
- explanation: string;
16
- }
17
- export interface Interaction {
18
- input: string;
19
- output: string;
20
- success: boolean;
21
- timestamp?: Date;
22
- }
23
- export type ImpactLevel = 'HIGH' | 'MEDIUM' | 'LOW';
24
- export type ClarificationCategory = 'TECHNICAL_SPECIFICATIONS' | 'ARCHITECTURAL_CONTEXT' | 'OPERATIONAL_REQUIREMENTS' | 'SECURITY_COMPLIANCE' | 'ORGANIZATIONAL_ALIGNMENT';
25
- export interface ClarificationOpportunity {
26
- category: ClarificationCategory;
27
- missingContext: string;
28
- impactLevel: ImpactLevel;
29
- reasoning: string;
30
- suggestedQuestions?: string[];
31
- patternAlignment?: string;
32
- }
33
- export interface IntentAnalysisResult {
34
- clarificationOpportunities: ClarificationOpportunity[];
35
- overallAssessment: {
36
- enhancementPotential: ImpactLevel;
37
- primaryGaps: string[];
38
- recommendedFocus: string;
39
- };
40
- intentQuality: {
41
- currentSpecificity: string;
42
- strengthAreas: string[];
43
- improvementAreas: string[];
44
- };
45
- }
46
- export declare class ClaudeIntegration {
47
- private client;
48
- private apiKey;
49
- private conversationHistory;
50
- private interactions;
51
- private debugMode;
52
- constructor(apiKey: string);
53
- private validateApiKey;
54
- private shouldInitializeClient;
55
- private isTestKey;
56
- /**
57
- * Create debug directory if it doesn't exist
58
- */
59
- private ensureDebugDirectory;
60
- /**
61
- * Generate unique identifier for debug files with operation context
62
- */
63
- private generateDebugId;
64
- /**
65
- * Save AI interaction for debugging when DEBUG_DOT_AI=true
66
- */
67
- private debugLogInteraction;
68
- sendMessage(message: string, operation?: string): Promise<ClaudeResponse>;
69
- generateYAML(resourceType: string, config: any): Promise<YAMLResponse>;
70
- recordInteraction(interaction: Interaction): Promise<void>;
71
- getSuccessfulPatterns(): Promise<Interaction[]>;
72
- getConversationHistory(): any[];
73
- clearConversationHistory(): void;
74
- generateManifest(spec: any): Promise<string>;
75
- analyzeError(error: string, _context?: any): Promise<string>;
76
- suggestImprovements(_manifest: string): Promise<string[]>;
77
- processUserInput(input: string, context?: any): Promise<any>;
78
- /**
79
- * Analyze user intent for clarification opportunities
80
- *
81
- * @param intent User's deployment intent
82
- * @param organizationalPatterns Available organizational patterns context
83
- * @returns Analysis result with clarification opportunities
84
- */
85
- analyzeIntentForClarification(intent: string, organizationalPatterns?: string): Promise<IntentAnalysisResult>;
86
- isInitialized(): boolean;
87
- }
88
- //# sourceMappingURL=claude.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/core/claude.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,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;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