Skip to content

Add color field to sidebar_state output - #1101

Merged
lawrencecchen merged 1 commit into
manaflow-ai:mainfrom
gonzaloserrano:gsr/sidebar-state-color
Mar 10, 2026
Merged

lawrencecchen merged 1 commit into
manaflow-ai:mainfrom
gonzaloserrano:gsr/sidebar-state-color

Conversation

@gonzaloserrano

@gonzaloserrano gonzaloserrano commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • What changed?

Expose workspace customColor in sidebar_state so external tools can read it without a new API endpoint.

  • Why?

I'm integrating cmux with Elgato Stream Deck https://github.com/gonzaloserrano/streamdeck-cmux and I'd like to reflect workspace colors in the deck button's background color.

Testing

  • How did you test this change?

I did not.

  • What did you verify manually?

Demo Video

For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).

  • Video URL or attachment:

Review Trigger (Copy/Paste as PR comment)

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes
  • I updated docs/changelog if needed
  • I requested bot reviews after my latest commit (copy/paste block above or equivalent)
  • All code review bot comments are resolved
  • All human review comments are resolved

Summary by cubic

Expose each tab’s workspace custom color in sidebar_state as color=<value> so external tools can read it without a new API. When unset, the value is none.

Written for commit 3a3a2da. Summary will update on new commits.

Expose workspace customColor in sidebar_state so external
tools can read it without a new API endpoint.
@vercel

vercel Bot commented Mar 9, 2026

Copy link
Copy Markdown

@gonzaloserrano is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The code modification adds a color attribute line to the tab output in TerminalController. When constructing tab information, it now appends the tab's custom color value or "none" if not set, providing additional semantic detail about tab state.

Changes

Cohort / File(s) Summary
Tab Color Output
Sources/TerminalController.swift
Added tab color attribute emission, appending color=\(tab.customColor ?? "none") to tab state output lines.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A color for each tab so fine,
Painted in output, line by line,
From customColor's gentle hue,
We'll show "none" when there's no view,
A splash of detail, small but true! 🎨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Description check ❓ Inconclusive The PR description is partially filled but lacks critical testing details and doesn't fully address the checklist requirements. Author should clarify testing approach, specify what manual verification was performed, and update the checklist items to reflect actual work completed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a color field to sidebar_state output, which matches the primary modification shown in the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@greptile-apps

greptile-apps Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR appends a color= field to the sidebarState command output, exposing the workspace's custom color so that external tools (e.g. a Stream Deck plugin) can read it without requiring a new API endpoint.

  • The value is always a validated, normalized color string or the literal none, enforced by upstream normalization logic whenever the color is set — so the new field cannot introduce malformed output.
  • The fallback to none when no color is assigned is consistent with how git_branch, pr, ports, and progress fields behave.
  • The PR author noted that no local testing was done. The change is a single-line addition with no branching logic, so the risk of regression is very low, but a test for the sidebarState output would be a valuable addition.

Confidence Score: 4/5

  • This PR is safe to merge; the one-line change is correct, well-bounded, and carries no risk of regressions.
  • The change is a single lines.append(...) call that reads a pre-validated, normalized string property. The value cannot be nil-unsafe (the nil-coalescing ?? "none" is correctly applied) and cannot contain characters that would break the output format. The only gap is the author's self-reported lack of local testing, which is why the score is 4 rather than 5.
  • No files require special attention.

Important Files Changed

Filename Overview
Sources/TerminalController.swift Adds a color field to the sidebarState output, exposing the workspace customColor property. The value is always a validated, normalized color string or the literal "none". The change is minimal and consistent with the existing output format.

Sequence Diagram

sequenceDiagram
    participant Tool as External Tool (e.g. Stream Deck)
    participant TC as TerminalController
    participant WS as Workspace (Tab)
    participant TM as WorkspaceTabColorSettings

    Tool->>TC: sidebar_state [tab-id]
    TC->>WS: resolveTabForReport(args)
    WS-->>TC: tab
    TC->>WS: tab.id (UUID)
    WS-->>TC: tab.id.uuidString
    TC->>WS: tab.customColor
    Note over WS,TM: customColor is stored as normalizedHex (#RRGGBB)<br/>set only via setCustomColor() → normalizedHex()
    WS-->>TC: "#C0392B" or nil
    TC->>TC: customColor ?? "none"
    TC-->>Tool: "tab=...\ncolor=#C0392B\ncwd=...\n..."
Loading

Last reviewed commit: 3a3a2da

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Sources/TerminalController.swift (1)

13629-13629: Add regression coverage for the new sidebar_state field.

Line 13629 changes a machine-consumed output contract. Please lock down both color=<value> and color=none in tests so external tooling doesn’t regress silently.

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

In `@Sources/TerminalController.swift` at line 13629, Update tests that parse the
machine-consumed output from TerminalController so they assert the new
sidebar_state field and explicitly lock down both color=none and color=<value>
cases produced by lines.append("color=\\(tab.customColor ?? \"none\")"); add at
least two assertions (one where tab.customColor is nil expecting "color=none"
and one where it is set expecting the exact "color=<value>") in the tests that
exercise the code path that builds `lines` (reference `lines`,
`tab.customColor`, and the `TerminalController` output generation) to prevent
silent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Sources/TerminalController.swift`:
- Line 13629: Update tests that parse the machine-consumed output from
TerminalController so they assert the new sidebar_state field and explicitly
lock down both color=none and color=<value> cases produced by
lines.append("color=\\(tab.customColor ?? \"none\")"); add at least two
assertions (one where tab.customColor is nil expecting "color=none" and one
where it is set expecting the exact "color=<value>") in the tests that exercise
the code path that builds `lines` (reference `lines`, `tab.customColor`, and the
`TerminalController` output generation) to prevent silent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00c4b1f8-2fb6-489a-a7c2-25cd18073cbd

📥 Commits

Reviewing files that changed from the base of the PR and between a636104 and 3a3a2da.

📒 Files selected for processing (1)
  • Sources/TerminalController.swift

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

@lawrencecchen
lawrencecchen merged commit 54c6a70 into manaflow-ai:main Mar 10, 2026
4 of 5 checks passed
@lawrencecchen

Copy link
Copy Markdown
Contributor

streamdeck-cmux is super cool!

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.

2 participants