Skip to content

Add property inspection, resource browsing, and style inspection devtools - #63

Merged
Chris Anderson (codemonkeychris) merged 2 commits into
mainfrom
andersonch/devtools-property-resource-style-tools
Apr 21, 2026
Merged

Chris Anderson (codemonkeychris) merged 2 commits into
mainfrom
andersonch/devtools-property-resource-style-tools

Conversation

@codemonkeychris

Copy link
Copy Markdown
Collaborator

Summary

Ports three key features from Raka into Reactor's devtools, exposed as both MCP tools (server-side) and CLI verbs (client-side).

New MCP Tools (6)

Tool Description
\properties\ Read DependencyProperty values on any element
\setProperty\ Write a DP value with smart type parsing
\
esources\ Browse ResourceDictionary entries at element/window/app scope
\setResource\ Modify resource values with shadow detection
\styles\ Inspect applied Style with BasedOn chain walking
\�ncestors\ Walk visual tree upward for scope analysis

New CLI Verbs (6)

\
mur devtools properties [--name PropName]
mur devtools set-property
mur devtools resources [--selector S] [--scope app|window|element]
mur devtools set-resource [--scope app]
mur devtools styles
mur devtools ancestors
\\

Value Parsing

Smart string→typed value conversion for \setProperty\ and \setResource:

  • Enum values (\Visible, \Collapsed, \Left, \Center, etc.)
  • Booleans, Thickness, CornerRadius
  • Hex color codes → SolidColorBrush (#RGB, #RRGGBB, #AARRGGBB)
  • Numeric types (double, int)

Test Coverage

46 unit tests covering all pure helpers (FormatValue, TryParseColor, TryParseThickness, TryParseCornerRadius, ParseValue, verb registration). All 294 devtools tests pass with no regressions.

Documentation

Updated \skills/devtools.md\ with:

  • 7 new verb catalog entries
  • 3 new workflow sections (property inspection, resource browsing, style debugging)
  • 3 new gotchas (Add MIT LICENSE file #10-12)
  • Source pointer for DevtoolsPropertyTools.cs

Files Changed

  • NEW \src/Reactor/Hosting/Devtools/DevtoolsPropertyTools.cs\ — 6 MCP tool registrations + helpers (~640 lines)
  • NEW \ ests/Reactor.Tests/Devtools/DevtoolsPropertyToolTests.cs\ — 46 unit tests
  • EDIT \src/Reactor/Hosting/Devtools/DevtoolsUiaTools.cs\ — wire registration
  • EDIT \src/Reactor.Cli/Devtools/DevtoolsVerbs.cs\ — 6 CLI verbs
  • EDIT \skills/devtools.md\ — documentation updates

…ools

Add 6 new MCP tools and 6 CLI verbs for property/resource/style inspection:

MCP tools:
- properties: Read DependencyProperty values on any element
- setProperty: Write a DP value with smart type parsing
- resources: Browse ResourceDictionary entries at element/window/app scope
- setResource: Modify resource values with shadow detection
- styles: Inspect applied Style with BasedOn chain walking
- ancestors: Walk visual tree upward for scope analysis

CLI verbs:
- mur devtools properties <selector> [--name PropName]
- mur devtools set-property <selector> <name> <value>
- mur devtools resources [--selector S] [--scope app|window|element]
- mur devtools set-resource <key> <value> [--scope app]
- mur devtools styles <selector>
- mur devtools ancestors <selector>

Includes 46 unit tests covering value parsing, color parsing,
thickness/corner-radius parsing, and verb registration.

Updated skills/devtools.md with verb catalog, workflows, and gotchas.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

Pull request overview

Ports property/resource/style inspection capabilities into Reactor Devtools, exposing them through new MCP tools and matching mur devtools CLI verbs to aid runtime UI debugging.

Changes:

  • Adds DevtoolsPropertyTools with MCP tools for dependency property inspection/mutation, resource browsing/mutation, style inspection, and ancestor walking.
  • Wires the new tool registrations into existing devtools tool registration (DevtoolsUiaTools).
  • Adds CLI verb support (+ unit tests + documentation) for the new devtools surface.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Reactor/Hosting/Devtools/DevtoolsPropertyTools.cs Implements and registers the 6 new MCP tools plus parsing/formatting helpers.
src/Reactor/Hosting/Devtools/DevtoolsUiaTools.cs Hooks DevtoolsPropertyTools.Register(...) into overall devtools registration.
src/Reactor.Cli/Devtools/DevtoolsVerbs.cs Adds 6 CLI verbs that call the new MCP tools.
tests/Reactor.Tests/Devtools/DevtoolsPropertyToolTests.cs Unit tests for helper parsing/formatting and verb registry presence.
skills/devtools.md Documents the new verbs and workflows/gotchas.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/devtools.md Resolved
…dation

- Add 3-digit hex color support (#RGB expands to #RRGGBB)
- Use CultureInfo.InvariantCulture in FormatValue for Thickness,
  CornerRadius, and all IFormattable values
- Throw McpToolException when ParseValue cannot parse a value for
  a specified targetType instead of falling through to string
- Validate scope parameter in resources tool (element|window|app)
  and require selector for element/window scopes
- Fix markdown heading spacing in devtools.md
- Add 3 new tests: #RGB parsing, type-mismatch throws, invariant formatting

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codemonkeychris
Chris Anderson (codemonkeychris) merged commit 9e4468d into main Apr 21, 2026
3 checks passed
@codemonkeychris
Chris Anderson (codemonkeychris) deleted the andersonch/devtools-property-resource-style-tools branch April 21, 2026 23:29
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jun 26, 2026
Reduces redundant WinRT/COM-RCW boundary crossings and per-element
allocations on the diff/reconcile/patch hot path (data-grid stress
workload, StocksGrid). Targets the dominant Reconcile gap.

Reconciler.cs / Update.cs / Mount.cs:
- #16 UnmountRecursive: read ReactorAttached.State once (was 5x GetValue).
- #17 UnmountAndCollect: read element tag once (was 5x GetElementTag).
- #14 Update: coalesce repeated `is FrameworkElement` RCW type-tests to one.
- #15 Cache the component rerender delegate on ComponentNode; recreate
  only when the requestRerender identity changes.
- #18 UpdateDefaultAutomationName: ref/ordinal short-circuit before the
  AutomationProperties.GetName COM read.
- #19 ApplyModifiers accepts null = clear-all (no fresh ElementModifiers).
- #20 PopulateDirtyAncestorPath iterates a tracked self-triggered set
  instead of the whole _componentNodes dict.
- #21 UnmountAndPool reuses a borrowed scratch list (reentrant calls fall
  back to a fresh list).
- #22 RefreshRealizedContainers reuses a cleared field list.
- #23 ApplyStyleToElement ref-equal + ActualTheme guard; ApplyThemeBindings
  gated on the ShallowEquals fast path.
- #24 BuildCacheKey: thread-static StringBuilder + pair buffer, single pass.
- #25 HasConsumedContextChanged compares via Context<T>/EqualityComparer<T>
  (no boxing of value-type context).
- #26 ApplyResourceOverrides: no ToHashSet/ToArray, ref-equal fast path.
- #27 WireReferenceListEdge: static loop, no per-edge List/closures.
- #28 ApplyStaggerDelays: hoisted static animation-key array.
- #29 PushContextDisposable: single-pair push overload, pooled PopOnDispose.

Reconciler.KeyedItemsBinding.cs:
- #39 ref-equality cache; only realloc + SetItemViewSource on change.

Reconciler.Mount.cs:
- #40 LayoutFootgunDetector gated by GridElement pre-filter.

AccessibilityScanner.cs (debug-only scan path):
- #62 compute GetChildren once in Walk, pass into Push.
- #63 cache sibling-text array in ScanContext, invalidate on Push.
- #64 BuildContext single-pass with pooled scratch (no LINQ chains).
- #65 IsLikelyEmoji explicit span loop (no LINQ).
- #66 CheckTabIndexGaps sorts a rented buffer (no OrderBy/ToList).

Behavior preserved exactly: coalesced COM reads observe the same values
at the same times; unmount/cleanup ordering unchanged; scanner emits
identical findings. AOT/trim clean (no new reflection).

Adds tests/Reactor.Tests/ReconcilerInteropPerfTests.cs (11 tests:
rerender-delegate caching, context-change compare, cache-key reuse,
single-pair context push, scanner output parity).

Closes #654

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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