Skip to content

Add input chevron color patch#634

Open
VitalyOstanin wants to merge 3 commits intoPiebald-AI:mainfrom
VitalyOstanin:feature/input-chevron-color
Open

Add input chevron color patch#634
VitalyOstanin wants to merge 3 commits intoPiebald-AI:mainfrom
VitalyOstanin:feature/input-chevron-color

Conversation

@VitalyOstanin
Copy link
Copy Markdown

@VitalyOstanin VitalyOstanin commented Mar 26, 2026

Summary

New patch that changes the input chevron (❯) color based on loading state:

  • Idle (waiting for input): configurable theme color (e.g. "success" for green)
  • Generating: keeps the current theme color without dimming

Changes

  • src/patches/inputChevronColor.ts — new patch file
  • src/types.ts — add chevronIdleColor to InputBoxConfig
  • src/defaultSettings.ts — default null (disabled)
  • src/patches/index.ts — import, definition, implementation
  • src/ui/components/MiscView.tsx — type fix for InputBoxConfig initialization

Configuration

Set in config.json:

{
  "inputBox": {
    "chevronIdleColor": "success"
  }
}

The value is a theme color key (e.g. "success", "bashBorder", "planMode"). Set to null to disable.

Testing

  • Manual testing on Linux with Claude Code 2.1.84 (native binary)
  • Verified chevron turns green when idle, keeps theme color during generation
  • All existing tests pass

Related Issues

None

Summary by CodeRabbit

  • New Features

    • Added a configurable "idle chevron color" for the input box so users can set the chevron color when the input is not loading.
    • UI toggle now initializes input box settings with defaults so the chevron option is preserved when toggling.
  • Chores

    • Background logic now applies the configured chevron color when set.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b4434b7f-f82f-41c7-b129-519707e8755d

📥 Commits

Reviewing files that changed from the base of the PR and between 3fb4323 and 7236537.

📒 Files selected for processing (5)
  • src/defaultSettings.ts
  • src/patches/index.ts
  • src/patches/inputChevronColor.ts
  • src/types.ts
  • src/ui/components/MiscView.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/ui/components/MiscView.tsx
  • src/types.ts

📝 Walkthrough

Walkthrough

Adds a new inputBox.chevronIdleThemeColor setting (default 'success'), updates types and UI initialization to include it, registers a guarded input-chevron-color patch, and implements writeInputChevronColor which rewrites compiled code to apply loading vs idle chevron colors.

Changes

Cohort / File(s) Summary
Defaults
src/defaultSettings.ts
Add DEFAULT_SETTINGS.inputBox.chevronIdleThemeColor = 'success'.
Types
src/types.ts
Add `chevronIdleThemeColor: string
Patch Registration
src/patches/index.ts
Register input-chevron-color under PatchGroup.MISC_CONFIGURABLE; conditionally apply when config.settings.inputBox?.chevronIdleThemeColor is truthy; resolve theme color and call implementation.
Patch Implementation
src/patches/inputChevronColor.ts
New exported `writeInputChevronColor(file: string, resolvedColor: string): string
UI Initialization
src/ui/components/MiscView.tsx
Initialize missing settings.inputBox from DEFAULT_SETTINGS.inputBox so chevronIdleThemeColor is present rather than creating a minimal object.

Sequence Diagram(s)

sequenceDiagram
  participant UI as MiscView (UI)
  participant Config as Settings/Config
  participant Patcher as PatchManager
  participant Impl as writeInputChevronColor
  participant FS as Compiled File

  UI->>Config: ensure inputBox exists via DEFAULT_SETTINGS
  Config->>Patcher: provide config (includes inputBox.chevronIdleThemeColor)
  alt chevronIdleThemeColor is set
    Patcher->>Patcher: resolve theme color -> resolvedColor
    Patcher->>Impl: call writeInputChevronColor(fileContent, resolvedColor)
    Impl->>FS: read fileContent, regex-match chevron, replace color/dimColor
    Impl-->>Patcher: return modified file or null
    Patcher->>FS: write updated file if modified
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • bl-ue

Poem

🐇
I hop where chevrons softly gleam,
Idle green and loading beam,
I weave a regex, mend the line,
So quiet glow and busy shine,
A tiny tweak — a rabbit's gleam.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new patch that configures input chevron color based on loading state.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

@VitalyOstanin VitalyOstanin force-pushed the feature/input-chevron-color branch from 1827650 to eb5267e Compare March 26, 2026 21:58
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/patches/inputChevronColor.ts (2)

27-31: Use debug() for an unsupported-pattern miss.

Returning null already lets the patch framework record a failed patch. Writing to stderr here will make normal version drift look like a hard apply error.

Suggested change
+import { debug } from '../utils';
 import { showDiff } from './index';
@@
-    console.error(
-      'patch: inputChevronColor: failed to find chevron component pattern'
-    );
+    debug(
+      'patch: inputChevronColor: failed to find chevron component pattern'
+    );

As per coding guidelines, "Implement error handling with try-catch blocks, log errors with debug(), and return graceful fallbacks."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patches/inputChevronColor.ts` around lines 27 - 31, The patch function
inputChevronColor currently writes an error to stderr when the component pattern
isn't found (the branch checking if (!match || match.index === undefined));
change that to use debug() instead of console.error and keep returning null so
the patch framework records the miss; update the block that references match
(inside inputChevronColor) to call debug('patch: inputChevronColor: failed to
find chevron component pattern') rather than console.error, and ensure no other
console.error or throw is introduced for this unsupported-pattern path.

1-2: Please drop the new explanatory comments.

The symbol names and patch registration already make this file understandable, and the repo TS/JS guidelines ask us not to add comments unless they're explicitly requested. As per coding guidelines, "Do not add comments unless explicitly requested."

Also applies to: 5-15, 20-21

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patches/inputChevronColor.ts` around lines 1 - 2, Remove the newly added
explanatory comments from src/patches/inputChevronColor.ts (including the top
note and any other comments in the ranges referenced, e.g., lines 5–15 and
20–21), leaving only the actual code and patch registration symbols (e.g., the
patch export/registration identifiers such as the patch name or register
function) intact so the file contains no extra explanatory comments per the
TS/JS guidelines.
src/ui/components/MiscView.tsx (1)

168-172: Prefer the shared input-box defaults here.

This fallback already drifted once when chevronIdleColor was added. Spreading DEFAULT_SETTINGS.inputBox (or a small helper) will keep future InputBoxConfig additions from needing another manual sync.

Suggested refactor
+import { DEFAULT_SETTINGS } from '../../defaultSettings';
@@
             if (!settings.inputBox) {
-              settings.inputBox = {
-                removeBorder: false,
-                chevronIdleColor: null,
-              };
+              settings.inputBox = { ...DEFAULT_SETTINGS.inputBox };
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/ui/components/MiscView.tsx` around lines 168 - 172, The fallback for
settings.inputBox should use the shared defaults to avoid drift: replace the
manual literal object assigned to settings.inputBox with a spread of
DEFAULT_SETTINGS.inputBox (or a small helper that returns
DEFAULT_SETTINGS.inputBox) so new properties like chevronIdleColor are
automatically included; update the code that sets settings.inputBox (the block
checking if (!settings.inputBox)) to initialize from DEFAULT_SETTINGS.inputBox
and then override any per-instance values if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/patches/inputChevronColor.ts`:
- Around line 22-23: The current regex stored in the pattern constant is too
permissive and stops at the object "{color:...,dimColor:...}", which may match
an earlier memoized element instead of the chevron; update the regex in pattern
to extend it to include the chevron child tail (for example the unique minified
anchor containing pointer," ") so the match requires that exact sequence after
,{color:...,dimColor:...}; modify the /,\{isLoading:.../.../ regex to append the
chevron-specific fragment (the ...pointer," " tail) so it only matches the
minified chevron element and not other memoized elements.

---

Nitpick comments:
In `@src/patches/inputChevronColor.ts`:
- Around line 27-31: The patch function inputChevronColor currently writes an
error to stderr when the component pattern isn't found (the branch checking if
(!match || match.index === undefined)); change that to use debug() instead of
console.error and keep returning null so the patch framework records the miss;
update the block that references match (inside inputChevronColor) to call
debug('patch: inputChevronColor: failed to find chevron component pattern')
rather than console.error, and ensure no other console.error or throw is
introduced for this unsupported-pattern path.
- Around line 1-2: Remove the newly added explanatory comments from
src/patches/inputChevronColor.ts (including the top note and any other comments
in the ranges referenced, e.g., lines 5–15 and 20–21), leaving only the actual
code and patch registration symbols (e.g., the patch export/registration
identifiers such as the patch name or register function) intact so the file
contains no extra explanatory comments per the TS/JS guidelines.

In `@src/ui/components/MiscView.tsx`:
- Around line 168-172: The fallback for settings.inputBox should use the shared
defaults to avoid drift: replace the manual literal object assigned to
settings.inputBox with a spread of DEFAULT_SETTINGS.inputBox (or a small helper
that returns DEFAULT_SETTINGS.inputBox) so new properties like chevronIdleColor
are automatically included; update the code that sets settings.inputBox (the
block checking if (!settings.inputBox)) to initialize from
DEFAULT_SETTINGS.inputBox and then override any per-instance values if needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3741a2f-13f5-44ae-ae02-854f05f3933b

📥 Commits

Reviewing files that changed from the base of the PR and between 86ae3f3 and 1827650.

📒 Files selected for processing (5)
  • src/defaultSettings.ts
  • src/patches/index.ts
  • src/patches/inputChevronColor.ts
  • src/types.ts
  • src/ui/components/MiscView.tsx

Comment on lines +22 to +23
const pattern =
/,\{isLoading:([$\w]+),themeColor:([$\w]+)\}=[$\w]+,([$\w]+)=\2\?\?void 0,[$\w]+;if\([$\w]+\[0\]!==\3\|\|[$\w]+\[1\]!==\1\)[$\w]+=[$\w]+\.createElement\([$\w]+,\{color:\3,dimColor:\1\}/;
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Mar 26, 2026

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Tighten the regex to include the chevron child.

This match currently stops at {color:...,dimColor:...}, so the first memoized element with the same isLoading/themeColor shape could be rewritten instead of the chevron. In these minified Claude Code patches, the pattern should include one more unique anchor such as the ...pointer," " tail.

Suggested tightening
-  const pattern =
-    /,\{isLoading:([$\w]+),themeColor:([$\w]+)\}=[$\w]+,([$\w]+)=\2\?\?void 0,[$\w]+;if\([$\w]+\[0\]!==\3\|\|[$\w]+\[1\]!==\1\)[$\w]+=[$\w]+\.createElement\([$\w]+,\{color:\3,dimColor:\1\}/;
+  const pattern =
+    /,\{isLoading:([$\w]+),themeColor:([$\w]+)\}=[$\w]+,([$\w]+)=\2\?\?void 0,[$\w]+;if\([$\w]+\[0\]!==\3\|\|[$\w]+\[1\]!==\1\)[$\w]+=[$\w]+\.createElement\([$\w]+,\{color:\3,dimColor:\1\},[$\w]+\.pointer," "\)/;

Based on learnings, patch regexes under src/patches/ must be strict and match the minified format exactly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/patches/inputChevronColor.ts` around lines 22 - 23, The current regex
stored in the pattern constant is too permissive and stops at the object
"{color:...,dimColor:...}", which may match an earlier memoized element instead
of the chevron; update the regex in pattern to extend it to include the chevron
child tail (for example the unique minified anchor containing pointer," ") so
the match requires that exact sequence after ,{color:...,dimColor:...}; modify
the /,\{isLoading:.../.../ regex to append the chevron-specific fragment (the
...pointer," " tail) so it only matches the minified chevron element and not
other memoized elements.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@coderabbitai Investigated this in detail. The actual Claude Code binary uses \xA0 (non-breaking space U+00A0), not a regular space " ", in the chevron child tail. The suggested anchor pointer," " would never match the minified output.

This is documented in commit 44996da: "Skip regex tightening with pointer tail: binary uses "\xA0" (non-breaking space), not " ", so the suggested anchor would not match."

The current pattern is already unique enough — it matches the specific memoized element with {isLoading, themeColor} destructuring followed by the createElement({color, dimColor}) call, which only appears once in the chevron component.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@VitalyOstanin, thank you for the thorough investigation and the commit documenting the finding. You're correct — my suggestion was invalid. Since the minified Claude Code binary uses \xA0 (U+00A0 non-breaking space) rather than a regular space in the chevron child tail, the pointer," " anchor would never match, making the suggested tightening worse than doing nothing. The current pattern's uniqueness via the {isLoading, themeColor} destructuring + createElement({color, dimColor}) combination is a sound justification for leaving it as-is.

I'll record this for future reviews.


✏️ Learnings added
Learnt from: VitalyOstanin
Repo: Piebald-AI/tweakcc PR: 634
File: src/patches/inputChevronColor.ts:8-9
Timestamp: 2026-03-30T16:25:20.990Z
Learning: In src/patches/inputChevronColor.ts, the Claude Code minified binary uses `\xA0` (U+00A0 non-breaking space) rather than a regular ASCII space `" "` in the chevron component child tail (e.g., after `s6.pointer`). Any regex anchor using `," "` (regular space) to uniquely identify the chevron element will never match the minified output. The pattern ending at `{color:VAR,dimColor:VAR}` is already unique due to the `{isLoading, themeColor}` destructuring context.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: Piebald-AI/tweakcc PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-06T21:30:11.641Z
Learning: Applies to **/patches/**/*.{ts,tsx} : Use `,` `;` `}` `{` literal characters at regex start instead of `\\b` for performance in patch patterns

Learnt from: CR
Repo: Piebald-AI/tweakcc PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-06T21:30:11.641Z
Learning: Applies to **/patches/**/*.{ts,tsx} : Avoid `\\b` in regex patterns due to V8 performance issues; use literal character alternatives

Learnt from: bl-ue
Repo: Piebald-AI/tweakcc PR: 421
File: src/patches/thinkerSymbolSpeed.ts:46-58
Timestamp: 2026-01-27T21:16:01.318Z
Learning: In patches under src/patches/, assume code works with minified, original Claude Code installations. Patch regexes must be strict and match the minified format exactly (ignore formatting differences like whitespace/newlines). This guidance applies to all .ts files in src/patches and should be followed when adding or reviewing patches.

Learnt from: CR
Repo: Piebald-AI/tweakcc PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-06T21:30:11.641Z
Learning: Applies to **/patches/**/*.{ts,tsx} : Use `[\$\\w]+` instead of `\\w+` for identifier matching in regex patterns to include `$` for React refs

Learnt from: ljepson
Repo: Piebald-AI/tweakcc PR: 437
File: src/patches/toolsets.ts:811-833
Timestamp: 2026-01-29T21:19:04.770Z
Learning: In src/patches/toolsets.ts, when matching mode change patterns like `let X=Y(Z,{type:"setMode",mode:vv(TA),destination:"session"});`, the regex should capture the inner variable name (TA) not the entire expression (vv(TA)), because the variable holds the raw mode string value (e.g., "plan", "default", "acceptEdits") and is used in direct string comparisons like `if(${modeVar}==="plan")`. The wrapping function vv() is only for dispatch transformation.

Learnt from: bl-ue
Repo: Piebald-AI/tweakcc PR: 419
File: src/patches/thinkingVerbs.ts:35-35
Timestamp: 2026-01-27T18:56:52.902Z
Learning: In src/patches/thinkingVerbs.ts, the regex pattern for matching thinking verbs arrays uses `{50,}` quantifier to require at least 50 items, making it specific enough without needing test coverage since it only matches capitalized verb lists with that many entries.

Learnt from: mike1858
Repo: Piebald-AI/tweakcc PR: 616
File: data/prompts/prompts-2.1.79.json:882-882
Timestamp: 2026-03-19T21:08:36.258Z
Learning: In Piebald-AI/tweakcc (data/prompts/*), escape-only changes to JSON strings that do not alter the rendered prompt text are allowed and should not be flagged as prompt body modifications. The upstream parity rule concerns the user-visible content, not serialization details.

@VitalyOstanin
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@VitalyOstanin
Copy link
Copy Markdown
Author

@coderabbitai All nitpick comments from your review have been addressed in commits 44996da and 3fb4323:

  1. console.errordebug() — Fixed. Using debug() for pattern-miss logging now.
  2. Remove explanatory comments — Fixed. All non-requested comments removed per code style guidelines.
  3. Use { ...DEFAULT_SETTINGS.inputBox } instead of manual literal — Fixed. The fallback now spreads DEFAULT_SETTINGS.inputBox.
  4. Tighten regex with pointer," " tail — Declined (see inline reply). The binary uses \xA0 (NBSP), not " ", so the suggested anchor would not match.

Could you please re-review the latest changes?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

@VitalyOstanin Thanks for addressing those nitpicks and for the clear explanation on #4 — using \xA0 (NBSP) in the binary rather than a regular space is a perfectly valid reason to decline that regex anchor suggestion. I'll kick off a fresh review of the latest commits now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Allows changing the input chevron (❯) color based on loading state.
When idle: configurable theme color (e.g. "success" for green).
When generating: keeps the current theme color without dimming.

Configured via inputBox.chevronIdleColor in config.json.
- Rename chevronIdleColor to chevronIdleThemeColor for clarity
- Replace console.error with debug() for pattern miss
- Remove comments per project code style
- Use DEFAULT_SETTINGS.inputBox spread instead of manual literal
- Resolve theme color key to actual RGB value at patch time
- Skip regex tightening with pointer tail: binary uses "\xA0" (non-breaking
  space), not " ", so the suggested anchor would not match
@VitalyOstanin VitalyOstanin force-pushed the feature/input-chevron-color branch from 3fb4323 to 7236537 Compare April 2, 2026 13:06
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.

1 participant