Skip to content

Conversation

@benzntech
Copy link
Contributor

This PR resolves #3304 by adding support for custom modes and refactoring the implementation based on code review feedback. It also includes fixes for several TypeScript type errors that arose during development.

Your Name and others added 2 commits October 26, 2025 11:09
Adds ability for CLI to load and use custom modes from:
- Global: custom_modes.yaml in VS Code global storage
- Project: .kilocodemodes in workspace root

Changes:
- Created customModes loader with platform-aware path resolution
- Updated CLI entry point to load and validate custom modes
- Extended ExtensionHost to accept and use custom modes
- Modified /mode command to display and switch to custom modes
- Added customModes to CommandContext for all commands

Resolves Kilo-Org#3304

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

🦋 Changeset detected

Latest commit: df83fc7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Minor

Not sure what this means? Click here to learn what changesets are.

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

Resolved conflicts in:
- cli/src/cli.ts: Added both customModes and parallel mode options
- cli/src/index.ts: Merged custom modes loading with parallel mode support
- cli/src/state/hooks/useCommandContext.ts: Added both customModes and isParallelMode to context

Also added changeset for this PR.
@chrarnoldus chrarnoldus added the CLI Kilo Code CLI label Nov 1, 2025
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@catrielmuller catrielmuller self-requested a review November 5, 2025 13:53
@catrielmuller
Copy link
Contributor

Hi @benzntech , Thanks for the PR, looks good.
Please remove the all added ";" at the end of the lines because there are like 250 lines changed that should not.
After that i will test it and it's good to go.

Copy link
Contributor

@catrielmuller catrielmuller left a comment

Choose a reason for hiding this comment

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

Hi @benzntech , Thanks for the PR, looks good.
Please remove the all added ";" at the end of the lines because there are like 250 lines changed that should not.
After that i will test it and it's good to go.

Benson K B and others added 6 commits November 7, 2025 18:58
- Add roleDefinition, whenToUse, customInstructions, groups, and iconName properties to ModeConfig
- Add organization source type to ModeConfig
- Update DEFAULT_MODES with comprehensive mode definitions including:
  - Detailed role definitions for each mode (architect, code, ask, debug, orchestrator)
  - Icon names for UI integration
  - Permission groups for feature access control
  - Custom instructions for specialized mode behavior
  - When to use guidance for users

This enables richer mode configuration and better user guidance on mode selection.
- Change customModes in ExtensionState from any[] to ModeConfig[]
- Change customModesAtom from any[] to ModeConfig[]
- Import ModeConfig in extension.ts atoms file

This ensures proper type checking throughout the custom modes system.
- Add mode.test.ts with 332 lines of comprehensive test coverage
- Test command metadata (name, aliases, description, usage, examples)
- Test handler behavior with no arguments (list available modes)
- Test handler behavior with valid and invalid mode slugs
- Test case-insensitive mode switching
- Test source label display (global, project, organization)
- Test custom modes integration
- Test message structure and timestamps
- Coverage includes default modes and custom modes scenarios
- Includes tests for error handling and user feedback
},
setCommittingParallelMode: (isCommitting: boolean) => {
setCommittingParallelMode(isCommitting)
setCommittingParallelMode(isCommitting);
Copy link
Contributor

Choose a reason for hiding this comment

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

I still see a bunch of these, can you maybe clean up the PR so that we can review the actual changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Benson K B and others added 6 commits November 16, 2025 16:10
Clean up formatting to match project's no-semicolon style while
maintaining the custom modes feature changes.
Merge latest main branch changes while maintaining custom modes feature:
- Use ModeConfig from @roo-code/types instead of local definition
- Update parseCustomModes to return proper ModeConfig structure
- Add customModes to mockContext for tests
- Keep all main branch improvements (typed options, selectProvider, etc.)
- Remove unused imports from mode.ts (ArgumentValue, DEFAULT_MODES)
- Replace any types with unknown and proper casting in customModes.ts
- Rename unused error variables to _error
- Add missing properties to mode.test.ts mock context
- Treat undefined source as "global" for built-in modes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI Kilo Code CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add custom modes support to CLI

4 participants