Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 23, 2025

Summary

This PR attempts to address Issue #8238 by adding visual scope indicators to help users distinguish between global and project-level custom modes.

Changes

  • ✨ Add scope badges ("Global" or "Project") to custom modes in the mode selector dropdown
  • ✨ Add scope badge to the currently selected mode button
  • ✨ Add scope badge to mode names in the modes editor view
  • 🌐 Use existing translations from common:customModes.scope for localization support

Visual Changes

The implementation adds small, unobtrusive badges next to custom mode names showing:

  • "project" for project-level modes (stored in .roomodes)
  • "global" for global modes (stored in user settings)

These indicators appear in:

  1. The mode selection dropdown list
  2. The currently selected mode display
  3. The mode editor header when editing custom modes

Testing

  • ✅ All existing tests pass
  • ✅ Linting and type checking pass
  • ✅ Manual testing with both global and project custom modes

Notes

  • Built-in modes (architect, code, ask, etc.) do not show scope indicators as they are not custom modes
  • The badges use existing VSCode theme variables for consistent styling
  • Translations are already available in all supported languages

Fixes #8238

Feedback and guidance are welcome!


Important

Add scope indicators to custom modes in ModeSelector.tsx and ModesView.tsx, distinguishing between global and project-level modes.

  • Behavior:
    • Add scope badges ("Global" or "Project") to custom modes in ModeSelector.tsx and ModesView.tsx.
    • Use existing translations from common:customModes.scope for localization.
  • Visual Changes:
    • Badges indicate "project" for modes in .roomodes and "global" for modes in user settings.
    • Indicators appear in mode selection dropdown, selected mode display, and mode editor header.
  • Testing:
    • All existing tests pass.
    • Linting and type checking pass.
    • Manual testing with global and project custom modes.

This description was created by Ellipsis for 2e10c13. You can customize this summary. It will automatically update as commits are pushed.

- Add visual badges showing 'Global' or 'Project' scope for custom modes
- Display scope in mode selector dropdown items
- Display scope in currently selected mode button
- Display scope in modes editor view
- Use existing translations from common.json

Fixes #8238
- Update translation references from common:scope to common:customModes.scope
- Ensures proper localization of Global/Project labels
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 23, 2025 00:10
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. UI/UX UI/UX related or focused labels Sep 23, 2025
{selectedMode?.source && (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
{selectedMode.source === "project"
? t("common:customModes.scope.project")
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistent translation keys: the selected mode display uses t('common:customModes.scope.project/global') while the dropdown item uses t('common:scope.project/global'). Please unify these so the same key set is used throughout.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

{getCurrentMode()?.source && (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
{getCurrentMode()?.source === "project"
? t("common:scope.project")
Copy link
Contributor

Choose a reason for hiding this comment

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

In ModesView the scope badge translation keys are inconsistent. For example, the current mode badge uses t('common:scope.project/global') (line 626) while later the custom mode header uses t('common:customModes.scope.project/global'). Consider using a single pair of keys for consistency.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 23, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like proofreading my own emails - I always find the typos after hitting send.

{isCustomMode && (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
{mode.source === "project"
? t("common:scope.project")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Critical Issue: These translation keys common:scope.project and common:scope.global don't exist in the translation files. The PR description mentions using common:customModes.scope but these are different keys. This will cause missing translation errors.

Suggested fix:

{mode.source === "project"
  ? t("common:customModes.scope.project")
  : t("common:customModes.scope.global")}

)}>
<span className="truncate">{selectedMode?.name || ""}</span>
{selectedMode?.source && (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestion: Consider extracting this repeated badge markup into a reusable component to reduce duplication across the 6 instances in this PR:

const ScopeBadge = ({ source }: { source?: string }) => {
  if (!source) return null;
  return (
    <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
      {source === "project"
        ? t("common:customModes.scope.project")
        : t("common:customModes.scope.global")}
    </span>
  );
};

)}>
<span className="truncate">{selectedMode?.name || ""}</span>
{selectedMode?.source && (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accessibility: Consider adding an aria-label or title attribute to help screen reader users understand what these scope indicators mean:

<span 
  className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"
  aria-label={`Scope: ${selectedMode.source === "project" ? "Project-level mode" : "Global mode"}`}
>

<span className="truncate">
{getCurrentMode()?.name || t("prompts:modes.selectMode")}
</span>
{getCurrentMode()?.source && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Type Safety: The optional chaining here is good, but consider being more explicit about when the badge should show. Built-in modes don't have a source property, so this correctly hides the badge for them. However, a comment explaining this intentional behavior would help future maintainers.

@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Show scope indicator (Global/Project) in mode editor and selector

3 participants