Skip to content

feat(phase6-7-8): AI explain, cache, expanded coverage, server/mcp mode#129

Merged
utkarsh232005 merged 9 commits into
KDM-cli:mainfrom
utkarsh232005:phase6-7-8
Jun 7, 2026
Merged

feat(phase6-7-8): AI explain, cache, expanded coverage, server/mcp mode#129
utkarsh232005 merged 9 commits into
KDM-cli:mainfrom
utkarsh232005:phase6-7-8

Conversation

@utkarsh232005
Copy link
Copy Markdown
Member

This PR contains implementation for Phase 6, 7, and 8 including AI explain mode, cache system, 17 new analyzers, server mode, MCP server, and integrations.

…server & MCP

Phase 6 - AI Explain Mode:
- Add prompt template system (src/ai/prompts.ts) with language selection
- Add text anonymization utilities (src/utils/text.ts) for K8s name masking
- Extend AnalysisOptions with explain, backend, language, anonymize flags
- Integrate explain flow into analysis engine with cache-check pipeline
- Add --explain, --backend, --language, --anonymize, --no-cache CLI flags
- Add 9 new AI providers: Azure OpenAI, Cohere, Google Gemini, Vertex AI,
  Amazon Bedrock, Hugging Face, Groq, IBM watsonx, OCI GenAI

Phase 7 - Cache System:
- Add CacheProvider interface and FileCacheProvider implementation
- Add cache factory with config-driven provider selection
- Add cache CLI commands: list, get, remove, purge
- Integrate cache into AI explain pipeline with SHA-256 keying

Phase 8 - Expanded Coverage:
- Add 17 new analyzers: ReplicaSet, StatefulSet, DaemonSet, Job, CronJob,
  Ingress, ConfigMap, HPA, PDB, NetworkPolicy, Events, Logs, Security,
  Storage, GatewayClass, Gateway, HTTPRoute
- Extend K8s client with Batch, Networking, Autoscaling, Policy, Storage,
  CustomObjects API accessors
- Add HTTP server mode with /health, /analyze, /filters, /config endpoints
- Add MCP server with stdio JSON-RPC protocol and 4 analysis tools
- Add integration registry with KEDA, Kyverno, Prometheus analyzers
- Add custom analyzer framework (command/HTTP execution modes)
- Add serve and custom-analyzer CLI commands

Tests: 191 passing across 20 test files (58 new tests added)
Test improvements:
- Complete rewrite of phase8-analyzers.test.ts (26 → 76 tests)
- Add missing SecurityAnalyzer and LogAnalyzer test coverage
- Add healthy-resource green-path tests for every analyzer
- Add API failure propagation tests via parameterized it.each
- Add result metadata assertions (kind, name, namespace)
- Add edge case tests: conditions with messages, singular/plural,
  multi-rule scenarios, pod-level vs container-level security
- Follow coding_style.md: it.each for structural deduplication, JSDoc

Cleanup:
- Remove tracked .DS_Store from git
- Add .DS_Store to .gitignore
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 7, 2026

Review Change Stack

Warning

Review limit reached

@utkarsh232005, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a3ffe6bc-2fc5-4fa0-839c-94eab36897d3

📥 Commits

Reviewing files that changed from the base of the PR and between 81697e8 and 0dee8f3.

⛔ Files ignored due to path filters (3)
  • .DS_Store is excluded by !**/.DS_Store and included by none
  • .gitignore is excluded by none and included by none
  • tsconfig.json is excluded by none and included by none
📒 Files selected for processing (64)
  • src/__tests__/auth.test.ts
  • src/__tests__/cache.test.ts
  • src/__tests__/config.test.ts
  • src/__tests__/explain.test.ts
  • src/__tests__/filters.test.ts
  • src/__tests__/integrations.test.ts
  • src/__tests__/kubernetes-resources.test.ts
  • src/__tests__/mcp.test.ts
  • src/__tests__/phase8-analyzers.test.ts
  • src/__tests__/server.test.ts
  • src/ai/amazon-bedrock.ts
  • src/ai/azure-openai.ts
  • src/ai/cohere.ts
  • src/ai/factory.ts
  • src/ai/google-gemini.ts
  • src/ai/google-vertex.ts
  • src/ai/groq.ts
  • src/ai/huggingface.ts
  • src/ai/ibm-watsonx.ts
  • src/ai/oci-genai.ts
  • src/ai/prompts.ts
  • src/analysis/analysis.ts
  • src/analysis/types.ts
  • src/analyzers/configmap.ts
  • src/analyzers/cronjob.ts
  • src/analyzers/custom.ts
  • src/analyzers/daemonset.ts
  • src/analyzers/events.ts
  • src/analyzers/gateway.ts
  • src/analyzers/gatewayclass.ts
  • src/analyzers/hpa.ts
  • src/analyzers/httproute.ts
  • src/analyzers/index.ts
  • src/analyzers/ingress.ts
  • src/analyzers/job.ts
  • src/analyzers/log-analyzer.ts
  • src/analyzers/networkpolicy.ts
  • src/analyzers/pdb.ts
  • src/analyzers/replicaset.ts
  • src/analyzers/security.ts
  • src/analyzers/service.ts
  • src/analyzers/statefulset.ts
  • src/analyzers/storage.ts
  • src/cache/file-cache.ts
  • src/cache/index.ts
  • src/cache/types.ts
  • src/commands/analyze.ts
  • src/commands/auth.ts
  • src/commands/cache.ts
  • src/commands/config.ts
  • src/commands/custom-analyzer.ts
  • src/commands/logs.ts
  • src/commands/root.ts
  • src/commands/serve.ts
  • src/config/schema.ts
  • src/integrations/integrations.ts
  • src/kubernetes/client.ts
  • src/kubernetes/pods.ts
  • src/kubernetes/resources.ts
  • src/server/mcp.ts
  • src/server/server.ts
  • src/ui/WatchDashboard.tsx
  • src/utils/config.ts
  • src/utils/text.ts

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "pre_merge_checks"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@utkarsh232005 utkarsh232005 added this to the v2.0.0 milestone Jun 7, 2026
…ov patch coverage

- Extracted helper functions in log-analyzer.ts and server.ts to reduce nesting depth/complexity.
- Deduplicated custom resource integrations in integrations.ts using analyzeCustomObjects helper.
- Added JSDocs to networkpolicy.ts.
- Consolidated phase8 healthy green path test cases in phase8-analyzers.test.ts into a parameterized block to avoid duplicate test assertions and reduce file size.
- Wrote full unit/integration test coverage for kubernetes-resources.test.ts, server.test.ts, mcp.test.ts, and explain.test.ts cache/anonymize paths.
- Global statement coverage is now 90.08%, and all 298 tests pass.
codescene-delta-analysis[bot]

This comment was marked as outdated.

… for CodeScene

- Extracted routing check in server.ts to routeRequest to reduce createServer complexity.
- Extracted unhealthy check in log-analyzer.ts to reduce analyze complexity.
- Refactored custom objects integrations in integrations.ts to use map/fetch helpers and a factory.
- Extracted verifyAnalyzerFailure assertion helper in phase8-analyzers.test.ts to remove test duplication.
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@utkarsh232005 utkarsh232005 merged commit 0c8749f into KDM-cli:main Jun 7, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant