@vfarcic/dot-ai 1.10.2 → 1.12.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/dist/core/ai-provider-factory.d.ts.map +1 -1
  2. package/dist/core/ai-provider-factory.js +1 -0
  3. package/dist/core/error-handling.js +1 -1
  4. package/dist/core/git-utils.d.ts +5 -0
  5. package/dist/core/git-utils.d.ts.map +1 -1
  6. package/dist/core/git-utils.js +16 -0
  7. package/dist/core/internal-tools.d.ts +35 -0
  8. package/dist/core/internal-tools.d.ts.map +1 -0
  9. package/dist/core/internal-tools.js +286 -0
  10. package/dist/core/mcp-client-manager.d.ts +88 -0
  11. package/dist/core/mcp-client-manager.d.ts.map +1 -0
  12. package/dist/core/mcp-client-manager.js +362 -0
  13. package/dist/core/mcp-client-registry.d.ts +36 -0
  14. package/dist/core/mcp-client-registry.d.ts.map +1 -0
  15. package/dist/core/mcp-client-registry.js +52 -0
  16. package/dist/core/mcp-client-types.d.ts +84 -0
  17. package/dist/core/mcp-client-types.d.ts.map +1 -0
  18. package/dist/core/mcp-client-types.js +24 -0
  19. package/dist/core/model-config.d.ts +1 -0
  20. package/dist/core/model-config.d.ts.map +1 -1
  21. package/dist/core/model-config.js +1 -0
  22. package/dist/core/providers/vercel-provider.d.ts.map +1 -1
  23. package/dist/core/providers/vercel-provider.js +5 -0
  24. package/dist/interfaces/mcp.d.ts.map +1 -1
  25. package/dist/interfaces/mcp.js +13 -0
  26. package/dist/mcp/server.js +26 -1
  27. package/dist/tools/generate-manifests.d.ts.map +1 -1
  28. package/dist/tools/generate-manifests.js +2 -1
  29. package/dist/tools/impact-analysis.d.ts +51 -0
  30. package/dist/tools/impact-analysis.d.ts.map +1 -0
  31. package/dist/tools/impact-analysis.js +204 -0
  32. package/dist/tools/index.d.ts +1 -0
  33. package/dist/tools/index.d.ts.map +1 -1
  34. package/dist/tools/index.js +6 -1
  35. package/dist/tools/operate-analysis.d.ts +1 -1
  36. package/dist/tools/operate-analysis.d.ts.map +1 -1
  37. package/dist/tools/operate-analysis.js +17 -6
  38. package/dist/tools/operate.d.ts +1 -1
  39. package/dist/tools/operate.d.ts.map +1 -1
  40. package/dist/tools/operate.js +1 -1
  41. package/dist/tools/organizational-data.d.ts +1 -1
  42. package/dist/tools/push-to-git.d.ts.map +1 -1
  43. package/dist/tools/push-to-git.js +1 -11
  44. package/dist/tools/query.d.ts +1 -1
  45. package/dist/tools/query.d.ts.map +1 -1
  46. package/dist/tools/query.js +18 -8
  47. package/dist/tools/remediate.d.ts +9 -0
  48. package/dist/tools/remediate.d.ts.map +1 -1
  49. package/dist/tools/remediate.js +45 -10
  50. package/dist/tools/version.d.ts +12 -0
  51. package/dist/tools/version.d.ts.map +1 -1
  52. package/dist/tools/version.js +16 -1
  53. package/package.json +3 -1
  54. package/prompts/impact-analysis-system.md +32 -0
  55. package/prompts/operate-system.md +3 -3
  56. package/prompts/remediate-system.md +62 -2
@@ -1 +1 @@
1
- {"version":3,"file":"remediate.d.ts","sourceRoot":"","sources":["../../src/tools/remediate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,OAAO,EAEL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAsB/B,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,yfACgd,CAAC;AAGxf,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;CAsDvC,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CA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;QAC7B,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;KACjC,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,GACjB,uBAAuB,CAyHzB;AA0dD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,qBAAqB,CAAC,CA8QhC"}
@@ -42,6 +42,7 @@ exports.handleRemediateTool = handleRemediateTool;
42
42
  const zod_1 = require("zod");
43
43
  const error_handling_1 = require("../core/error-handling");
44
44
  const ai_provider_factory_1 = require("../core/ai-provider-factory");
45
+ const mcp_client_registry_1 = require("../core/mcp-client-registry");
45
46
  const generic_session_manager_1 = require("../core/generic-session-manager");
46
47
  const index_1 = require("../core/index");
47
48
  const visualization_1 = require("../core/visualization");
@@ -50,6 +51,7 @@ const fs = __importStar(require("fs"));
50
51
  const path = __importStar(require("path"));
51
52
  const request_context_1 = require("../interfaces/request-context");
52
53
  const rbac_1 = require("../core/rbac");
54
+ const internal_tools_1 = require("../core/internal-tools");
53
55
  // PRD #143 Milestone 1: Hybrid approach - AI can use kubectl_api_resources tool OR continue with JSON dataRequests
54
56
  // Tool metadata for direct MCP registration
55
57
  exports.REMEDIATE_TOOL_NAME = 'remediate';
@@ -146,15 +148,29 @@ async function conductInvestigation(session, sessionManager, aiProvider, logger,
146
148
  if (kubectlTools.length === 0) {
147
149
  throw new Error('No kubectl tools available from plugin. Ensure agentic-tools plugin is running.');
148
150
  }
149
- logger.debug('Starting toolLoop with kubectl investigation tools from plugin', {
151
+ // PRD #407: Combine plugin tools (allowlisted) with internal tools (git_clone, fs_list, fs_read)
152
+ // PRD #358: Get MCP server tools attached to remediate
153
+ const mcpTools = (0, mcp_client_registry_1.isMcpClientInitialized)()
154
+ ? (0, mcp_client_registry_1.getMcpClientManager)().getToolsForOperation('remediate')
155
+ : [];
156
+ const allTools = [...kubectlTools, ...(0, internal_tools_1.getInternalTools)(), ...mcpTools];
157
+ logger.debug('Starting toolLoop with investigation tools', {
150
158
  requestId,
151
159
  sessionId: session.sessionId,
152
- toolCount: kubectlTools.length,
153
- tools: kubectlTools.map(t => t.name),
160
+ toolCount: allTools.length,
161
+ mcpToolCount: mcpTools.length,
162
+ tools: allTools.map(t => t.name),
154
163
  });
155
- // PRD #343: Create tool executor that routes through plugin
156
- const toolExecutor = pluginManager.createToolExecutor();
157
- // Use toolLoop for AI-driven investigation with kubectl tools
164
+ // PRD #407: Clean up old clone directories (non-blocking)
165
+ (0, internal_tools_1.cleanupOldClones)();
166
+ // PRD #407: Combined executor routes plugin tools to plugin, internal tools to local handlers
167
+ // PRD #358: Chain MCP executor with plugin executor as fallback
168
+ const internalExecutor = (0, internal_tools_1.createInternalToolExecutor)(session.sessionId);
169
+ const pluginExecutor = pluginManager.createToolExecutor(internalExecutor);
170
+ const toolExecutor = (0, mcp_client_registry_1.isMcpClientInitialized)()
171
+ ? (0, mcp_client_registry_1.getMcpClientManager)().createToolExecutor(pluginExecutor)
172
+ : pluginExecutor;
173
+ // Use toolLoop for AI-driven investigation with all tools (kubectl + internal + MCP)
158
174
  // System prompt is static (cached), issue description is dynamic (userMessage)
159
175
  const operationName = isValidation
160
176
  ? 'remediate-validation'
@@ -162,7 +178,7 @@ async function conductInvestigation(session, sessionManager, aiProvider, logger,
162
178
  const result = await aiProvider.toolLoop({
163
179
  systemPrompt: systemPrompt,
164
180
  userMessage: `Investigate this Kubernetes issue: ${session.data.issue}`,
165
- tools: kubectlTools,
181
+ tools: allTools,
166
182
  toolExecutor: toolExecutor,
167
183
  maxIterations: maxIterations,
168
184
  operation: operationName,
@@ -231,7 +247,7 @@ async function conductInvestigation(session, sessionManager, aiProvider, logger,
231
247
  'All actions are designed to be safe kubectl operations (no destructive commands)',
232
248
  ].join('. ');
233
249
  output.guidance = `🔴 CRITICAL: Present the kubectl commands to the user and ask them to choose execution method. DO NOT execute commands without user approval.\n\n${commandsSummary}\n\nRisk Assessment: ${riskSummary}`;
234
- output.agentInstructions = `1. Show the user the root cause analysis and confidence level\n2. Display the kubectl commands that will be executed\n3. Explain the risk assessment\n4. Present the two execution choices and wait for user selection\n5. When user selects option 1 or 2, call the remediate tool again with: executeChoice: [1 or 2], sessionId: "${session.sessionId}", mode: "${session.data.mode}"\n6. DO NOT automatically execute any commands until user makes their choice`;
250
+ output.agentInstructions = `1. Show the user the root cause analysis and confidence level\n2. Display the kubectl commands that will be executed\n3. Explain the risk assessment\n4. Present the two execution choices and wait for user selection\n5. When user selects option 1 or 2, call the remediate tool again with: executeChoice: [1 or 2], sessionId: "${session.sessionId}", mode: "${session.data.mode}"\n6. DO NOT automatically execute any commands until user makes their choice\n7. Before executing, the user can run impact_analysis to understand the blast radius and downstream dependencies of the remediation actions`;
235
251
  output.nextAction = 'remediate';
236
252
  output.message = `AI analysis identified the root cause with ${Math.round(finalAnalysis.confidence * 100)}% confidence. ${finalAnalysis.remediation.actions.length} remediation actions are recommended.`;
237
253
  }
@@ -436,6 +452,7 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
436
452
  const results = [];
437
453
  const finalAnalysis = session.data.finalAnalysis;
438
454
  let overallSuccess = true;
455
+ let executedCommandCount = 0;
439
456
  logger.info('Starting remediation command execution', {
440
457
  requestId,
441
458
  sessionId: session.sessionId,
@@ -446,6 +463,23 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
446
463
  const action = finalAnalysis.remediation.actions[i];
447
464
  const actionId = `action_${i + 1}`;
448
465
  try {
466
+ // PRD #407: Skip gitSource actions — these are Git-based remediation
467
+ // instructions for GitOps-managed resources, not executable commands
468
+ if (action.gitSource && !action.command) {
469
+ logger.info('Skipping gitSource remediation action (not executable)', {
470
+ requestId,
471
+ sessionId: session.sessionId,
472
+ actionId,
473
+ repoURL: action.gitSource.repoURL,
474
+ });
475
+ results.push({
476
+ action: `${actionId}: ${action.description} (skipped: Git-based)`,
477
+ success: false,
478
+ output: 'Git-based remediation — apply changes in the source repository',
479
+ timestamp: new Date(),
480
+ });
481
+ continue;
482
+ }
449
483
  logger.info('Executing remediation action', {
450
484
  requestId,
451
485
  sessionId: session.sessionId,
@@ -486,6 +520,7 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
486
520
  else {
487
521
  output = String(response.result || '');
488
522
  }
523
+ executedCommandCount++;
489
524
  results.push({
490
525
  action: `${actionId}: ${action.description}`,
491
526
  success: true,
@@ -515,9 +550,9 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
515
550
  });
516
551
  }
517
552
  }
518
- // Run automatic post-execution validation if all commands succeeded
553
+ // Run automatic post-execution validation if commands were executed and all succeeded
519
554
  let validationResult = null;
520
- if (overallSuccess && finalAnalysis.validationIntent) {
555
+ if (overallSuccess && executedCommandCount > 0 && finalAnalysis.validationIntent) {
521
556
  const validationIntent = finalAnalysis.validationIntent;
522
557
  try {
523
558
  // In automatic mode, wait for Kubernetes to apply changes before validating
@@ -114,6 +114,18 @@ export interface SystemStatus {
114
114
  pendingDiscovery: string[];
115
115
  backgroundDiscoveryActive: boolean;
116
116
  };
117
+ mcpServers?: {
118
+ serverCount: number;
119
+ toolCount: number;
120
+ servers: Array<{
121
+ name: string;
122
+ version?: string;
123
+ endpoint: string;
124
+ attachTo: string[];
125
+ toolCount: number;
126
+ tools: string[];
127
+ }>;
128
+ };
117
129
  }
118
130
  export interface VersionSessionData extends BaseVisualizationData {
119
131
  toolName: 'version';
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInF,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,wBAAwB,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AG,UAAU,CAAC;QAChC,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,uBAAuB,EAAE,MAAM,CAAC;QAChC,YAAY,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B;AA+cD;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAqB5C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,CAAC,SAAS,CAAC,CAW1D;AAqDD;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CA0GlF;AAED;;;;GAIG;AACH,UAAU,eAAe;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAsJ9B"}
@@ -57,6 +57,7 @@ const config_1 = require("../core/tracing/config");
57
57
  const generic_session_manager_1 = require("../core/generic-session-manager");
58
58
  const visualization_1 = require("../core/visualization");
59
59
  const plugin_registry_1 = require("../core/plugin-registry");
60
+ const mcp_client_registry_1 = require("../core/mcp-client-registry");
60
61
  const request_context_1 = require("../interfaces/request-context");
61
62
  exports.VERSION_TOOL_NAME = 'version';
62
63
  exports.VERSION_TOOL_DESCRIPTION = 'Get comprehensive system health and diagnostics';
@@ -674,6 +675,19 @@ async function handleVersionTool(args, logger, requestId) {
674
675
  const tracingStatus = getTracingStatus();
675
676
  // PRD #359: Add plugin stats via unified registry
676
677
  const pluginStats = (0, plugin_registry_1.getPluginManager)()?.getStats();
678
+ // PRD #358: Add MCP server stats
679
+ const mcpManager = (0, mcp_client_registry_1.isMcpClientInitialized)() ? (0, mcp_client_registry_1.getMcpClientManager)() : null;
680
+ const mcpServerStats = mcpManager ? {
681
+ ...mcpManager.getStats(),
682
+ servers: mcpManager.getDiscoveredServers().map(s => ({
683
+ name: s.name,
684
+ version: s.version,
685
+ endpoint: s.endpoint,
686
+ attachTo: s.attachTo,
687
+ toolCount: s.tools.length,
688
+ tools: s.tools.map(t => t.name),
689
+ })),
690
+ } : undefined;
677
691
  const systemStatus = {
678
692
  version,
679
693
  vectorDB: vectorDBStatus,
@@ -683,7 +697,8 @@ async function handleVersionTool(args, logger, requestId) {
683
697
  capabilities: capabilityStatus,
684
698
  kyverno: kyvernoStatus,
685
699
  tracing: tracingStatus,
686
- plugins: pluginStats
700
+ plugins: pluginStats,
701
+ mcpServers: mcpServerStats
687
702
  };
688
703
  // Log summary of system health
689
704
  logger.info('System diagnostics completed', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vfarcic/dot-ai",
3
- "version": "1.10.2",
3
+ "version": "1.12.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",
@@ -27,6 +27,7 @@
27
27
  "test:integration:gemini-flash": "AI_PROVIDER=google_flash DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
28
28
  "test:integration:grok": "AI_PROVIDER=xai DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
29
29
  "test:integration:kimi": "AI_PROVIDER=kimi DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
30
+ "test:integration:qwen": "AI_PROVIDER=alibaba DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
30
31
  "test:integration:bedrock": "AI_PROVIDER=amazon_bedrock AI_MODEL=global.anthropic.claude-sonnet-4-20250514-v1:0 DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
31
32
  "test:integration:custom-endpoint": "AI_PROVIDER=openai DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
32
33
  "eval:comparative": "DEBUG_DOT_AI=true npx tsx src/evaluation/eval-runner.ts",
@@ -106,6 +107,7 @@
106
107
  "vitest": "^3.2.4"
107
108
  },
108
109
  "dependencies": {
110
+ "@ai-sdk/alibaba": "^1.0.10",
109
111
  "@ai-sdk/amazon-bedrock": "^4.0.77",
110
112
  "@ai-sdk/anthropic": "^3.0.58",
111
113
  "@ai-sdk/google": "^3.0.43",
@@ -0,0 +1,32 @@
1
+ # Kubernetes Dependency & Impact Analysis Agent
2
+
3
+ You are an expert Kubernetes dependency analyst. Given a proposed operation, discover all resources that depend on or are affected by the target resources and assess whether the operation is safe.
4
+
5
+ Use the available tools to inspect the cluster, verify git sources, and search the knowledge base. Follow dependency chains iteratively — dependencies are often multi-level (deleted PVC → Pod → Service → Ingress). Include both upstream and downstream relationships.
6
+
7
+ ## Confidence Levels
8
+
9
+ For each dependency, note your confidence:
10
+ - **Definite** — confirmed from cluster data or git source
11
+ - **Likely** — based on ecosystem knowledge but not verified
12
+ - **Uncertain** — might be affected but cannot confirm
13
+
14
+ ## Output Format
15
+
16
+ When analysis is complete, respond with ONLY this JSON:
17
+
18
+ ```json
19
+ {
20
+ "safe": false,
21
+ "summary": "Deleting PVC data-postgres-0 in production is NOT safe.\n\n## Affected Resources\n\n### Definite\n- **Pod/postgres-0** — mounts this PVC as volume 'data'\n- **Service/postgres** — selects pods with app=postgres label\n\n### Likely\n- **Ingress/postgres-ui** — routes to Service/postgres\n\n## Risk\nData loss and service disruption. Back up data before proceeding."
22
+ }
23
+ ```
24
+
25
+ **Safe** means no significant downstream impact or only affects automatically-recoverable resources. **Not safe** means risk of data loss, service disruption, or cascading failures.
26
+
27
+ ## Rules
28
+ - Be thorough: follow ALL dependency chains, not just the first level
29
+ - When uncertain, say so — do not fabricate relationships
30
+ - If the target resource does not exist in the cluster, say so clearly — do not silently analyze a different resource
31
+ - When a git repo or file is mentioned, clone and read it to verify the actual change
32
+ - Only return the final JSON when analysis is complete, no additional text before or after
@@ -43,11 +43,11 @@ You help users perform Day 2 operations on Kubernetes applications through natur
43
43
 
44
44
  **Validation workflow**:
45
45
  1. Design your operational solution
46
- 2. Generate kubectl commands
46
+ 2. Generate the exact kubectl commands you intend to propose
47
47
  3. Run dry-run validation for each command
48
- 4. If validation fails, analyze the error and fix your command
48
+ 4. If validation fails, analyze the error, fix the command, and re-validate
49
49
  5. Retry validation until all commands pass
50
- 6. Only then complete analysis with the validated commands
50
+ 6. Copy the validated commands verbatim into your final JSON response — the commands array **MUST be identical** to what passed dry-run. If you modify a command after validation (even slightly), you MUST re-validate it.
51
51
 
52
52
  **Multiple iterations are expected**: You may need several dry-run attempts to get manifests correct (schema issues, field names, API versions). This is normal and expected.
53
53
 
@@ -59,9 +59,20 @@ Once investigation is complete, respond with ONLY this JSON format:
59
59
  "actions": [
60
60
  {
61
61
  "description": "Specific action to take",
62
- "command": "command to execute (kubectl, helm, etc.)",
62
+ "command": "command to execute (kubectl, helm, etc.) — omit if gitSource is provided",
63
63
  "risk": "low|medium|high",
64
- "rationale": "Why this action addresses the issue"
64
+ "rationale": "Why this action addresses the issue",
65
+ "gitSource": {
66
+ "repoURL": "source repository URL — only when resource is GitOps-managed",
67
+ "branch": "branch name",
68
+ "files": [
69
+ {
70
+ "path": "path relative to repo root",
71
+ "content": "full corrected file content",
72
+ "description": "what was changed and why"
73
+ }
74
+ ]
75
+ }
65
76
  }
66
77
  ],
67
78
  "risk": "low|medium|high"
@@ -88,6 +99,17 @@ Once investigation is complete, respond with ONLY this JSON format:
88
99
  - All components healthy
89
100
  - Set `actions: []` and explain why no issue found
90
101
 
102
+ ## GitOps Awareness
103
+
104
+ After identifying the problematic resource, check whether it is managed by a GitOps controller (e.g., Argo CD, Flux).
105
+
106
+ **When GitOps management is detected**:
107
+ - Clone the source repo, navigate and read the manifests to find the file(s) that need changing
108
+ - Include `gitSource` in your remediation actions with the repo URL, branch, and full corrected file contents for each file that needs modification
109
+
110
+ **When GitOps management is NOT detected**:
111
+ - Proceed with standard kubectl-based remediation
112
+
91
113
  ### Remediation Action Guidelines
92
114
 
93
115
  **Structure your solution efficiently**:
@@ -146,6 +168,44 @@ Once investigation is complete, respond with ONLY this JSON format:
146
168
  }
147
169
  ```
148
170
 
171
+ ## Example Response - GitOps-Managed Resource
172
+
173
+ ```json
174
+ {
175
+ "issueStatus": "active",
176
+ "rootCause": "Deployment 'api-server' has invalid image tag 'v2.broken' causing CrashLoopBackOff",
177
+ "confidence": 0.95,
178
+ "factors": [
179
+ "Pod is in CrashLoopBackOff with ImagePullBackOff events",
180
+ "Image tag 'v2.broken' does not exist in registry",
181
+ "Resource is managed by Argo CD Application 'api-server'"
182
+ ],
183
+ "remediation": {
184
+ "summary": "Update image tag in Git source to valid version",
185
+ "actions": [
186
+ {
187
+ "description": "Fix image tag in deployment manifest",
188
+ "risk": "low",
189
+ "rationale": "Changing image tag to latest stable version resolves the ImagePullBackOff. Argo CD will sync the change automatically.",
190
+ "gitSource": {
191
+ "repoURL": "https://github.com/org/infra-repo.git",
192
+ "branch": "main",
193
+ "files": [
194
+ {
195
+ "path": "apps/production/deployment.yaml",
196
+ "content": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: api-server\nspec:\n template:\n spec:\n containers:\n - name: api-server\n image: org/api-server:v2.1.0\n",
197
+ "description": "Changed image tag from 'v2.broken' to 'v2.1.0'"
198
+ }
199
+ ]
200
+ }
201
+ }
202
+ ],
203
+ "risk": "low"
204
+ },
205
+ "validationIntent": "Wait for Argo CD to sync, then verify pods are running with the correct image"
206
+ }
207
+ ```
208
+
149
209
  ## Example Response - No Issue Found
150
210
 
151
211
  ```json