Skip to content

Conversation

@Sureshkumars
Copy link
Member

@Sureshkumars Sureshkumars commented Jan 7, 2026

Context

Adds a new Review capability and /review slash command to Kilo Code for performing local git-based code reviews. This enables users to get AI-powered code reviews of their uncommitted changes or feature branch diffs without any external integrations (no GitHub MCP required).

Implementation

Architecture

The implementation spans both the VSCode extension and CLI:

  1. ReviewService (src/services/review/ReviewService.ts) - Core service that:

    • Detects review scope (uncommitted changes vs branch diff)
    • Collects git diff using existing utilities from src/services/code-index/managed/git-utils.ts
    • Auto-detects base branch (main, master, develop, or remote default)
    • Truncates large diffs (>100KB) to prevent context overflow
  2. ReviewPrompt (src/services/review/ReviewPrompt.ts) - Builds the review prompt with:

    • Confidence levels (CRITICAL 95%+, WARNING 85%+, SUGGESTION 75%+)
    • Structured output format (Summary → Issues Table → Detailed Findings → Recommendation)
  3. Slash Command Handler (src/core/slash-commands/kilo.ts) - Processes /review in extension webview

  4. CLI Command (cli/src/commands/review.ts) - Separate command for CLI that sends /review to the extension

Key Design Decisions

  • No edit tools in Review mode - Keeps the mode advisory-only, humans make final decisions
  • Smart diff detection - Automatically chooses between uncommitted changes and branch diff
  • Fallback prompt - If git context collection fails, provides manual review instructions
  • Reuses existing git utilities - Leverages git-utils.ts functions like hasUncommittedChanges, getBaseBranch, isBaseBranch
before after
No review capability /review slash command and Review mode in mode selector

@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

⚠️ No Changeset found

Latest commit: 419eb29

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

⚠️ No Changeset found

Latest commit: cc1ca7b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 7, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR adds a new /review command for local git-based code reviews. The implementation is clean and well-structured:

  • ReviewService properly handles git repository detection, uncommitted changes, and branch diffs
  • ReviewPrompt builds a comprehensive prompt template with clear guidelines
  • CLI command follows existing patterns with appropriate aliases (r, cr)
  • Error handling is thorough with proper fallback messages
  • Diff size is appropriately limited to 100KB to prevent context overflow
Files Reviewed (7 files)
  • .kilocodemodes - Format conversion from JSON to YAML, removed test mode
  • cli/src/commands/review.ts - New CLI command implementation
  • cli/src/commands/index.ts - Command registration
  • src/services/review/ReviewService.ts - Git context collection service
  • src/services/review/ReviewPrompt.ts - Review prompt template builder
  • src/services/review/index.ts - Module exports
  • webview-ui/src/utils/slash-commands.ts - Slash command registration
Notes
  • The .kilocodemodes format change from JSON to YAML is a breaking change for any tooling that expects JSON, but this appears intentional
  • The "test" mode was removed from .kilocodemodes - verify this is intentional
  • Consider adding unit tests for the new ReviewService (not blocking)

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 7, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

This PR adds a /review command for local git-based code reviews. The implementation is clean and well-structured:

  • ReviewService properly handles git repository detection, uncommitted changes, and branch diffs
  • Error handling is comprehensive with try-catch blocks and meaningful error messages
  • Diff size is limited to 100KB to prevent memory issues
  • The CLI command and webview integration follow existing patterns
Files Reviewed (7 files)
  • .kilocodemodes - Format converted from JSON to YAML, test mode removed
  • cli/src/commands/index.ts - Added reviewCommand import and registration
  • cli/src/commands/review.ts - New CLI command handler
  • src/services/review/ReviewService.ts - Git diff collection service
  • src/services/review/ReviewPrompt.ts - Review prompt builder
  • src/services/review/index.ts - Module exports
  • webview-ui/src/utils/slash-commands.ts - Added /review to supported commands

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 7, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
N/A N/A Missing test coverage for new ReviewService and ReviewPrompt modules
Detailed Findings

[WARNING] Missing Test Coverage

Files: src/services/review/ReviewService.ts, src/services/review/ReviewPrompt.ts, cli/src/commands/review.ts
Confidence: 95%

Problem:
This PR introduces significant new functionality (ReviewService, ReviewPrompt, and CLI review command) but includes no test files. Per the project's AGENTS.md rules:

"Before attempting completion, always make sure that any code changes have test coverage"

The new code includes:

  • ReviewService class with multiple async methods for git operations
  • buildReviewPrompt function for generating review prompts
  • reviewCommand CLI command handler
  • reviewToolResponse fallback prompt function

Suggestion:
Add test files for the new modules:

  • src/services/review/__tests__/ReviewService.spec.ts
  • src/services/review/__tests__/ReviewPrompt.spec.ts
  • cli/src/commands/__tests__/review.test.ts (CLI uses .test.ts convention)
Other Observations (not in diff)

No additional issues found outside the diff.

Files Reviewed (11 files)
  • .kilocodemodes - Format conversion from JSON to YAML, removed test mode
  • cli/src/commands/index.ts - Added reviewCommand registration
  • cli/src/commands/review.ts - New CLI review command (no issues)
  • src/core/prompts/commands.ts - Added reviewToolResponse fallback
  • src/core/slash-commands/kilo.ts - Added /review command handling
  • src/core/task/Task.ts - Passed cwd to parseKiloSlashCommands
  • src/services/code-index/managed/git-utils.ts - Exported collectOutput, added trim parameter
  • src/services/review/ReviewPrompt.ts - New review prompt builder
  • src/services/review/ReviewService.ts - New review service for git operations
  • src/services/review/index.ts - Module exports
  • webview-ui/src/utils/slash-commands.ts - Added /review to supported commands

Fix these issues in Kilo Cloud

@kevinvandijk kevinvandijk self-requested a review January 8, 2026 14:39
</explicit_instructions>\n
`

export const reviewToolResponse = (userInput: string) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

It feels very much to me that this should not be a slash command but this is a mode that has certain tools available to it It seems to overlap a lot with the idea of modes and we even offer a code reviewer mode to be installed.

Image

We can add this as a standard available mode perhaps adn give this mode access to the ReviewService the way we give other modes access to certain tools?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants