Repository navigation
feat: add Uno Linter spec and uno-lint prototype - #163
Conversation
Adds specs/001-uno-linter, a feature specification for a deterministic XAML and C# linter that verifies what an agent wrote, complementing the skills that tell it what to write. Includes the spec, a brief, and the requirements checklist in the same format as the other Studio repos. Adds tools/uno-lint, the C# prototype: a netstandard2.0 rule library (XDocument for XAML, Roslyn for C#) with nine rules in recommended and strict profiles, .editorconfig severities, Toolkit gating, suppression comments, a CLI with path, JSON and Claude Code hook modes, 32 xunit tests, and FINDINGS.md with the first corpus run. Co-Authored-By: Claude Fable 5.1 <[email protected]>
- Hook: take added lines from tool_response.structuredPatch (Write create = every line). Fallback diffs old_string/new_string and stays silent when new_string is missing or ambiguous, instead of blaming the first match. - Dev-path skip matches whole folder names (Tests/, MyApp.Tests/), not "Probe"/"Harness" anywhere; the old test passed only via the file name. - BUILTIN matches control names as PascalCase words (no more OperatingHoursView -> RatingControl, DiscardBanner -> Card). - Palette/icon file exemptions match whole words of the file name, so ColorPickerPage, AuthTokenPage and LexiconPage are linted. - HEX fires only on color properties, Setter and keyframe values targeting one, and color elements; Text="#404" is text. 46 new tests (78 total). Toolkit samples re-run: one new HEX hit, from a page the old palette-name match had hidden. Co-Authored-By: Claude Opus 5.5 <[email protected]>
noknowscode
left a comment
There was a problem hiding this comment.
Really solid prototype. I cloned the branch: clean Release build, 78/78 tests pass. The one-core-many-surfaces shape, .editorconfig severities, Toolkit gating, and the hook reporting only added lines (via structuredPatch) are all the right calls, and the port fixes real false positives from my PowerShell version.
Inline comments below. The bugs marked confirmed reproduce with a small probe project (Toolkit enabled, strict profile). Strategic points first:
- Analyzer reuse is overstated (FR-022). Roslyn analyzers can't do file IO (RS1035) and receive syntax trees plus
AnalyzerConfigOptionsfrom the compiler.Linter,EditorConfigandProjectContextread the disk, andCSharpAnalyzerparses its own trees. The rule functions can be shared; each surface needs a host layer. Worth rewording before the three-surface plan gets sign-off. - Suppressions need to be a metric. In my own hook transcripts the agent answered 15 of 32 hits with an
allowcomment and fixed only 8. SC-005 ("HEX drops to zero within one turn") is satisfiable by suppressing everything. Suggest counting suppressions per rule in the report and JSON. - Pull one correctness rule into phase 1. Design Decision 5 already argues that bug rules earn trust. Launching an official Uno Platform linter with only style rules invites pushback;
{Binding State.Value}orx:Bindagainst an MVUX model would carry it. - HEX fix text assumes Uno.Themes (Assumption 3). In a Fluent-only app
PrimaryBrush/SurfaceBrushdon't exist, and HEX is inrecommended. Needs a theme gate like the Toolkit one.
Housekeeping: the PR body says 32 tests (it's 78), the conventional-commits check is failing, and there's no CI job building or testing tools/uno-lint. I'd consider landing the spec here and moving the prototype to its own repo or adding a build/test job.
Open questions from my side: CARD stays strict until the chip/avatar/zero-radius cases are fixed; hook first, gated on measured dnx cold start; skill owners own the fix text (UX-004); TOKENTHEME at suggestion.
Confirmed bugs from the PR review, each with a regression test:
- .editorconfig section globs are honored per file (EditorConfig
semantics), so CLI and a future analyzer read the same file alike
- suppression comments above a multi-line element reach attribute hits
- CornerRadius="0", circles, pills and chips are no longer cards
- StaticResource/ThemeResource aliases are not TOKENTHEME hits
Review requests:
- HEX covers named colors in XAML and Colors.X / Color.FromArgb in C#
- suppressions are counted per rule (Supp column, JSON suppressed)
- hook leads with the fix and no longer offers the allow comment
- JSON carries the fix text; fix text adapts to Uno.Themes / Toolkit
- first correctness rule: BINDVALUE (UNOL201) for {Binding State.Value}
in MVUX projects, recommended profile
- TOKENTHEME ships at suggestion severity
- handler detection matches FR-008 (object + *Args, two parameters)
- hook-mode project context cached; bin/obj never walked
- Roslyn pinned to 4.8.0; CSharpFile accepts a compiler SyntaxTree
- CI job builds, tests and packs tools/uno-lint on Ubuntu and Windows
Spec, README and FINDINGS updated with the dnx measurement (400-570 ms
vs 100 ms installed), the host-layer wording for FR-022, a suppression
budget in SC-005, and the review's answers to the open questions.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Thanks for the review, Matthew. Everything marked confirmed is fixed in b4ef3db with a regression test each, and the strategic points are addressed as follows:
Also: named colors and Still open from your list: the ShadowContainer exemption, and whether the prototype stays in |
kazo0
left a comment
There was a problem hiding this comment.
Reviewed at b4ef3db. Built Release locally and ran the tests (110/110 pass). Every bug in the inline comments was reproduced against the built CLI with a small fixture project. The design is right and the previous round was addressed carefully, but two of the "fixed in b4ef3db" claims hold only in single-file mode, and there is a design question worth settling before the XAML-side fixes.
Design question: reuse Uno.XamlParser for the XAML side?
Uno.XamlParser (NuGet Uno.XamlParser, net9.0) is already the XAML pipeline in Uno.AI generation and in Studio Live, where spec 041 (studio.live#1118, studio.live#1362) runs it after every agent XAML write and feeds the diagnostics back to the agent. That is this PR's hook surface, already in production.
Rule-level overlap: none. Its codes (XML0001 to SEM3301) are correctness and normalization: does it parse, is #abc canonical, is the enum value valid. The ten rules here are style and architecture and are new either way.
Host-level overlap: most of XamlAnalyzer's plumbing.
- Stage 0/1 element model:
ParentIndex,XamlPropertyKind(attribute / attached / property element), line+column, namespace scope, comments as text tokens. Replaces theXDocumentancestry, key and attached-property helpers. IXamlSemanticVisitoris an observe-only extension point;XamlDiagnosticis the finding shape.- Stage 0 repairs the unbalanced tags agents write and reports XML1006, where
XDocument.Parsethrows today and the file is silently skipped. - The same visitor assembly registers into Studio Live / Uno.AI with one DI line. There, Stage 2 type resolution makes BUILTIN, CARD and OVERLAY type-exact instead of name-regex.
What it does not give, so the host layer here stays as is: .editorconfig per-code severity (its policy model gates fixes per stage, not diagnostics per code), suppression comments, project context, exit codes, hook attribution, and all C# rules. XamlMarkupExpression is raw text plus IsBindingLike, so BINDVALUE keeps its regex. Stage 2 needs a type resolver, which a CLI/hook does not have; the parser's own xamlparser CLI is a PackAsTool net10.0 tool that runs Stage 0+1 only, and that is exactly the shape uno-lint would keep. Nothing in the linted app needs wiring.
The constraint: FR-022 pins the rule library to netstandard2.0 so a phase 3 Roslyn analyzer can load it, and Uno.XamlParser is net9.0 only. The C# rules are unaffected. Since the Uno XAML generator already surfaces UXAML diagnostics into build and IDE, I'd drop the XAML rules from the analyzer goal and rewrite XamlAnalyzer as IXamlSemanticVisitor implementations in a small package that references Uno.XamlParser. Caveats: it is prerelease (0.10.0-dev.74), and the pipeline is not thread-safe (Studio Live serializes it with a semaphore), so directory mode needs one pipeline per worker.
This changes the fix order: the .editorconfig and Directory.Build.props bugs are host-layer and survive either path. The HEX/TOKENTHEME merge and the ThemeDictionaries exemption live in XamlAnalyzer and get rewritten if the parser changes, so I'd settle this before fixing those.
Confirmed bugs (details inline)
- Nested
.editorconfigignored in directory mode, honored in hook mode: CLI and hook disagree on the same file (SC-006). Directory.Build.propsabove the csproj never read: Toolkit/MVUX/Themes gates close depending on which folder is linted.- HEX merged into TOKENTHEME keyed by line number: gating depends on formatting,
allow hexdropped. - Unkeyed children inside
ThemeDictionariesflagged as HEX. App.xaml.cslifecycle handlers reported as CODEBEHIND.
Lower severity (inline where there is a line)
- Preamble
dotnet_diagnostic.*.severityis honored; a Roslyn analyzer would not read it there. - Suppression lookbehind crosses element boundaries.
- Dev-path skip only applies in directory mode, so the hook lints
Tests/files the CLI skips. - OVERLAY
panelsuffix catchesRootPanel/ContentPanel. - C# HEX has no palette-file exemption, unlike XAML.
- Path mode accepts any file;
uno-lint notes.txtparses as C# and reports clean. - Directory mode reads every XAML twice when the project files leave a flag unset. Fine at 175 files, worth a note for larger solutions.
CI
- Conventional-commits fails only on 8929aa9: scope
uno-lintis hyphenated and commitsar rejects that in this repo. Reword, or rely on squash-merge. - The validate-plugin failure (
skills/uno-testing/SKILL.mdmirror drift) is already onmain; this branch's mirror is in sync. Not this PR's to fix.
Docs and nits
- "nine rules" in User Story 2 scenario 3, FR-012 and FINDINGS.md; there are 10. FR-012's recommended list omits BINDVALUE while FR-023 includes it. The PR body also lists nine. Key Entities "Project context" omits MVUX and Themes.
allow allis accepted by the suppression regex but documented nowhere.Polyfills.csis dead: nothing insrcusesinitorrecord.- 41 xUnit analyzer warnings (xUnit2029, xUnit2031) in the test project.
What holds up well: exact attribution from structuredPatch, the netstandard2.0 core with the compiler-supplied SyntaxTree constructor, suppression counted as a metric instead of offered as an exit, a regression test for every bug from the previous round, the CI job, and the measured dnx numbers that settled the distribution question.
Blocking: - nested .editorconfig files below the lint root are loaded in directory mode, and a single file resolves its chain from the project root, so the CLI and the hook agree on every file - Directory.Build.props / Directory.Packages.props above the project root feed the Toolkit, MVUX and Themes gates in every mode Bugs: - the HEX/TOKENTHEME fold is keyed on the element and keeps the gating HEX finding with a single-theme note; allow hex suppresses it - anything nested under a keyed resource inside ThemeDictionaries is exempt from HEX - App.xaml.cs and Application subclasses are exempt from CODEBEHIND Minor: - preamble severity keys are ignored and reported - suppression look-behind stops at the first non-comment line - "panel" dropped from the OVERLAY suffix set - C# color literals get the palette-file exemption - non-source files are rejected with exit 2; dev-path skip applies to single files - XAML is read once in directory mode Nits: ten rules everywhere, BINDVALUE in FR-012, Key Entities list MVUX and Themes, allow all documented, Polyfills.cs removed, xUnit analyzer warnings fixed. 127 tests. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Thanks Steve. Round 2 is in ef43333; every item from your review has a regression test in Blocking, both host-layer, both survive a parser swap:
Bugs: the HEX/TOKENTHEME fold is keyed on the element and now keeps the gating HEX warning with a single-theme note (GridWatch: 18 suggestions back to 18 warnings); anything nested under a keyed resource inside Minor: preamble severities ignored and reported; the suppression look-behind stops at the first non-comment line; Nits: ten rules everywhere (spec, README, FINDINGS, PR body), BINDVALUE in FR-012, Key Entities list MVUX and Themes, On Uno.XamlParser: I agree with the split you describe (XamlParser hosts the XAML rules, Roslyn the C# rules, The conventional-commits failure is still only |
Adds an experimental XAML host on Uno.XamlParser 0.10.0-dev.74 behind --xaml-engine xamlparser, owning HEX and CARD: - IXamlEngine in the netstandard2.0 core: an engine owns some rules, the built-in XDocument path runs the rest, no core dependency on the net9.0 parser - RuleLogic: color, key and geometry predicates shared by both hosts - Uno.Lint.Xaml: Stage 0 repairs on, Stage 1 fixers off, rules over the Stage-1 node model; partial reads are linted up to the stop - repaired, partial and line-shifted counts in text and JSON output Measured: identical findings on the five-app corpus (489/489), 7 of 7 broken-markup fixtures linted where the built-in host skips them, hook 273 ms with JIT and 194 ms with ReadyToRun. Write-up and upstream API findings in tools/uno-lint/XAMLPARSER-SPIKE.md. 141 tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The six XAML rules (HEX, TOKENTHEME, ICON, CARD, BACKBAR, BINDVALUE) are now Uno.XamlParser Stage-1 fixers that only report, registered through SemanticFixerTypes, plus one stream visitor for element text. UnoLintXamlRules.AddTo(options) adds them to any XamlParser pipeline, so Studio Live and Uno.AI can enable them with one call. The XDocument reader (XamlAnalyzer) is removed. uno-lint keeps what XamlParser does not do: the C# rules on Roslyn, .editorconfig severities, profiles, project gates, suppressions, the hook and output. The CLI registers XamlParserEngine as the XAML host; --xaml-engine is gone. Measured against the XDocument reader on the five-app corpus: identical findings and info counters, except six false positives removed (<SolidColorBrush x:Key="Red"> flagged on its key). Malformed agent markup is linted (8 of 8 fixtures). Hook 227 ms JIT, 185 ms ReadyToRun. Works around a parser bug: the quote-repair sanitizer corrupts valid XAML whose element text contains ":/" (ms-appx:///, http://), so sanitizers run only on files that are not well-formed. This and nine other parser issues are listed in tools/uno-lint/XAMLPARSER.md. 140 tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Following the review and the 2026-10-14 call with Carl: the XAML side now runs on Uno.XamlParser. Two commits added, f867e67 (spike) and 8ebfd7f. What changed
Measured against the old reader
For @carldebilly: The spec's architecture section and FR-022 are updated: the XAML rules leave the netstandard2.0 analyzer goal (the XAML generator's |
8ebfd7f to
60f0efd
Compare
|
Tracked in unoplatform/private#1210 (Uno Team Backlog, studio/agentic). Supersedes unoplatform/studio.live#3833, which is closed: the linter ships through the plugin hooks and CLI, not inside studio.live. |
carldebilly
left a comment
There was a problem hiding this comment.
Thanks for the XamlParser move: running the XAML rules inside the pipeline Studio already uses is the right call, and the Claude Code hook attribution holds up. I fed real-shaped Edit, MultiEdit and Write payloads (with and without structuredPatch, plus the old/new fallback) and every hit landed on the exact added line. Garbage, empty or mistyped stdin exits 0 silently. Release build is clean and 140/140 tests pass.
This round looked at three questions besides the code itself: the command surface, whether --hook works in agent harnesses other than Claude Code, and how the Uno.XamlParser host behaves outside the happy path.
1. Command surface: reuse a command framework instead of hand-rolling it
Program.cs re-implements argument parsing and validation (45-72), the usage/help text (10-31, also copied by hand into the README and FR-017), the exit-code contract (384-389), --list-rules (74-82) and the --json writer (263-332), and none of it is tested. Repl Toolkit (MIT, net10.0 like this CLI) gives all of that from one command graph: typed option binding with typo suggestions, generated help (--help --json|xml|yaml, per-command help, doc export), the same 0/1/2 exit-code defaults, structured output from a typed result, shell completion, an in-memory test harness, and UseMcpServer() for the MCP surface the spec plans next. Nothing has shipped yet, so switching now is free; once the plugin wires uno-lint --hook, the command line becomes a contract.
The hook fits too: as a hook route marked AsProtocolPassthrough(), the handler receives an IReplIoContext (input/output writers) instead of touching Console directly, framework diagnostics are kept off the protocol stream, and the same handler runs in-memory under the test harness, which closes the hook test gap noted inline. Conditions worth checking first: start from CoreReplApp (no runtime dependencies) and measure startup against the hook budget, and turn the banner off. Even if the MCP tool ends up hosted on uno.devserver, the main gain is the same: one immutable, typed LintReport rendered by text, JSON and MCP, which is what SC-006 needs.
2. Hook portability across harnesses
- Claude Code: works, with gaps noted inline. The most serious one: on Windows, stdin is decoded with the console code page, so any non-ASCII path or text (an accented user folder, for instance) makes the hook go silent.
- Codex CLI: the hook fires but is a silent no-op. Per the Codex hooks docs,
Edit|Writematchers aliasapply_patch, whose payload carries the patch intool_input.commandwith nofile_path. A payload built from the docs exits 0 with empty output. The output shape (hookSpecificOutput.additionalContext,systemMessage) would be accepted.spec.md:270currently claims the hook ships the linter to Codex. - Copilot CLI / Gemini CLI (docs only, not run): the snippet does not carry over as-is (tool names
edit/create, top-leveladditionalContext; Gemini readstimeoutin milliseconds). dnxvariant: unsafe as written (see inline), andUno.Lint.Toolis not on nuget.org, so both documented install paths fail today.
3. Uno.XamlParser host
The well-formed path and Stage-0 repair work, but UnoLintXamlRules.AddTo(options) is not the drop-in the docs describe: the HEX/TOKENTHEME dedupe, suppressions and the :/ sanitizer gate live only in XamlParserEngine, and ElementTextCapture is registered as a singleton with mutable per-stream state, so hosts must serialize calls. Line-shift detection depends on reflection over an internal property and is only ever tested in the not-shifted case. A duplicate attribute or an undeclared prefix (utu:) stops the reader and silently drops every later finding. On my machine a XAML hit took 333-433 ms (JIT), above the documented 227 ms.
Before merge (public repo)
XAMLPARSER.mdlinks to and describes the internals of a repository that is not public (its build failure, internal types, its agent instructions). Please keep only package-observable behaviour and file the parser issues upstream.- Commit
b23b88ecarries aClaude-Session:URL, and the PR body's closing link points to a non-public tracker. Please strip both from the squash message.
Also worth a look (lower confidence)
FileKindswalks into symlinks/junctions; two self-links make the walk explode.RegexOptions.Compiledeverywhere, including one regex per.editorconfigsection per run, costs startup inside the hook budget.Uno.Lint.Xamltargets net10.0 while the parser is net9.0; a net9.0 host could not reference it.- No end-to-end hook step in CI, no macOS runner.
- The context cache lives in the shared temp folder (
/tmpon Linux), undocumented, with no bypass. - The hook filters by line even on files whose repair shifted lines, and lists findings out of line order.
x:Name/x:Keyvalues are echoed verbatim into the agent's context; restrict to identifier-shaped values, especially for the MCP surface.- The hook's lead sentence frames BINDVALUE (a real bug) as a style pattern.
--list-rules:Recommendedvs--profile recommended, no MVUX gate or severity column, ignores--json.- DOCTYPE handling is unverified: a fixture with an internal and a
SYSTEMentity in a card Border'sx:Namewould settle it.
Summary
1 blocker, 5 high, 21 medium, 5 low (plus style nits folded into the low comments). Suggested order, so one more round should be enough: (1) structure: rules-only netstandard2.0 core, a net10 host with an immutable LintReport and per-harness hook adapters, the CLI on a command framework, async engine, reusable XAML post-processing; (2) hook: UTF-8 stdin, a Codex apply_patch adapter or a Claude-Code-only scope, a stderr line in the catch-all, exit 0 always in hook mode, a PATH guard, drop or pin dnx; (3) robustness: lone CR, no-project fallback, reparse points; (4) tests for the hook envelope, JSON shape and exit codes; (5) docs: private content, session-log material, a single latency figure, stale counts.
Structure - Uno.Lint.Core is rules only (netstandard2.0): C# rules, catalog, RuleLogic, suppression, immutable Finding/ProjectContext. The folder walk, .editorconfig, context cache, report and hook adapters move to a net10.0 Uno.Lint.Host. IXamlEngine and the static XamlEngines registry are gone; the host references the XAML project directly. - Uno.Lint.Xaml targets net9.0 like the parser. XamlLintEngine is async, serialized with a SemaphoreSlim and cancellable. UnoLintXaml exposes the three steps another XamlParser host needs: AddTo, IsWellFormed and Collect (gating, HEX/TOKENTHEME hand-off without a private code, suppression, line order, info counters). - The CLI is a command graph on Repl Toolkit: lint, rules, hook. Help, binding, structured output and 0/1/2 exit codes come from one definition; handlers return one immutable LintReport. Hook - Payload read as raw UTF-8 whatever the console code page. - One adapter per harness: Claude Code (Edit, MultiEdit, Write) and Codex (apply_patch, several files, paths relative to cwd). - Always exits 0: unknown options are ignored with a stderr note, any failure is one stderr line. Bugs are listed before patterns. Files whose XAML repair shifted lines are named instead of misattributed. - A file outside any project is linted with an empty context and only its ancestors' .editorconfig, without walking its folder. - The dnx variant is dropped; a sh shim with a PATH guard and a UNO_LINT_CLI override replaces it, matching MultiEdit too. Robustness - Lone CR and mixed line endings split like XmlReader and Roslyn; the suppression look-behind is clamped. - The folder walk skips symlinks and junctions. - `default` is accepted as a severity. - Messages never echo an x:Name or x:Key that is not identifier-shaped; DOCTYPE files are not read and entities never expanded. - Interpreted or source-generated regexes instead of compiled ones; one suppression regex per rule; the context cache moves to the user's local application data with --no-cache and UNO_LINT_NO_CACHE. Tests and docs - Tests regrouped by subject (202): hook envelope, Codex payloads, raw UTF-8 through the built tool, JSON shape pinned through Repl's test harness, CR-only files, line shifts, symlink loops, cache entries. - CI adds macOS and an end-to-end hook step through the packed tool. - XAMLPARSER.md keeps only package-observable behaviour; FINDINGS.md keeps corpus results and verdicts; one latency measurement with its machine and method, referenced everywhere else. Corpus findings are identical to the previous build on all five apps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
60f0efd to
8d5b881
Compare
|
@carldebilly thanks for the thorough round. Everything is in 8d5b881; each inline comment has its own reply. In your suggested order:
From the summary list:
Before merge:
Corpus findings are identical to the previous build on all five apps (757 findings, same rule, file, line and message). |
- HEX treated any property of a color-named control as a color slot, so
<ColorPicker Header="Red"/> was reported. A color slot is now a
color-named property, or the To/From/By/Value of a color animation or
keyframe (RuleLogic.IsColorProperty).
- TOKENTHEME only looked for a {ThemeResource} on Color, so
<AcrylicBrush TintColor="{ThemeResource ...}"/> was reported. Any
attribute now counts.
Same changes as the Uno.XamlParser.BestPractices rules, so the two
implementations agree. Corpus counts unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0.10.0-dev.80 carries the fix for the sanitizer that rewrote valid markup with ":/" in element text. uno-lint keeps running the sanitizers only on malformed text, so a valid file is never rewritten; the docs now describe that as a choice rather than a workaround. Corpus findings are identical to the dev.74 build on all five apps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A folder run now gives each file the project, dev-path skip and .editorconfig chain a run on that file gives it, so the CLI and the hook agree: a subfolder run finds the project above it, a nested root = true stops the chain, and a nested uno_lint.profile applies below it only. - Dev-path folders are counted from the solution or repository root, so a MyApp.Tests project folder is skipped from any start. - Generated files are skipped in single-file runs too. - Cloud-placeholder folders (OneDrive) are walked; only links are skipped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- HEX reports a literal written as a color property element (<SolidColorBrush.Color>, a <Color> inside one, a keyframe Value under a color target) once, with the TOKENTHEME hand-off, and skips label property elements such as <ColorPicker.Header>. - The single-theme note only appears when TOKENTHEME would report. - CARD reads Background, CornerRadius, Width and Height from property elements, counts Border.Child as content, ignores attached property elements, and leaves image clips (an ImageBrush background) alone. - BACKBAR is decided per root element. - BINDVALUE skips bindings with ElementName, RelativeSource or Source. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The look-behind now tracks comments across lines: an allow comment after an element covers that line only, and an allow line inside a multi-line comment counts. - C# files take their lines from Roslyn, which also ends a line at NEL, LS and PS, so findings and allow comments agree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The hook notes allow comments an edit added even when that is all it added, names files that share a name by their path, and lints a file a patch names twice once. - C# lines from the payload are mapped to Roslyn's when a file has NEL, LS or PS characters. - A raw-string tool_input (freeform apply_patch) or a payload of another shape no longer throws. - --profile=x, --profile:x and Repl's own options are not called unknown. - --markdown prints the whole text report; the last format flag decides the output, as Repl does; lint --help names the path argument. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- FR-014/016/017/018 and the README describe per-file project and .editorconfig resolution, the comment scan and the hook notes. - The performance table holds today's measurements; SC-001 is not met. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Another review pass on the CLI and hook found the bugs below; all are fixed with a test each (239 tests, 0 warnings). Uno.XamlParser is now 0.10.0-dev.80 (7a2f25e). Folder and file runs now agree (ba0226a). Every file gets its own project root, dev-path skip and
XAML rules (21d0b2e):
Allow comments (0d75626):
Hook and CLI (d67dd34):
CI (d3c4512) installs the exact package version the run packed. Corpus: every finding on the five corpus apps is identical to the previous build, so FINDINGS.md stands. Latency correction: the spec's 158 ms hook figure did not reproduce. Re-measured, the hook takes 381 ms, and 206 ms of that is process start with an empty payload. The Performance section now has these numbers and says SC-001 is not met; getting under 250 ms needs ReadyToRun per platform or a resident process, which is a decision for a follow-up. 🤖 Generated with Claude Code |
There was a problem hiding this comment.
Reviewed 4b2743d, with the question "is this ready to land once unoplatform/uno.xamlparser#39 publishes". Release build is clean, 239/239 tests pass, the branch merges cleanly with main, and the seven review threads that are still current all have their fixes in the code (the suppression test was renamed in the regroup). The three previous rounds covered the XAML rules and the hook envelope well, so this pass went after the parts they did not probe: the suppression scanner's string handling, the project-locator boundary, .editorconfig glob parsing and the hook's option path. Each item below was reproduced against the built CLI from this branch unless it says otherwise.
Three I would fix before merge, even with the tool unwired and unpublished. Each either contradicts a claim in the description or produces a silent green run:
Suppression.cs: a/*or<!--inside a string literal ("image/*","**/*.cs") opens a comment that never closes, so one allow comment suppresses every later hit in the file. This also skews the suppression metric SC-005 relies on.HookRunner.cs: an edit that only adds an allow comment is still silent. The description says d67dd34 fixed this; both tests include the hit's line in the patch, which is why they pass.ProjectLocator.cs: a.gitancestor counts as the solution root, so a project with no.slnunderDev/,Tests/or similar is skipped entirely: 0 files, exit 0, no warning, in folder and hook mode alike.
Before the hook ships through the plugin (inline): a bad --profile value disables the hook silently with an unprefixed stderr line; a malformed glob in any .editorconfig aborts the run where Roslyn would ignore the section; dev-path skipping differs between folder and single-file mode when no project exists above the file; <UnoFeatures Condition=...> is not read and commented-out package references count as live; --no-cache <file> swallows the path.
Nits (inline): the context cache key ignores XAML xmlns changes, so a page that starts using the Toolkit keeps Toolkit rules off until a project file changes; blank lines do not count toward the three-line look-behind; UNO_LINT_NO_CACHE is case-sensitive; FINDINGS.md and the spec disagree on the false-positive list (five vs six).
After #39 publishes: bump the pin, drop the four workarounds (I verified the swap: −91/+9 lines, 238/238 tests pass) and update XAMLPARSER.md lines 16/23/62–65 and spec.md line 301. The three items above fit in that same commit. With that round done, I would be comfortable landing this as the staged spec-plus-tool the description scopes it to, with the pre-ship list tracked.
- The comment scanner knows each language: C# string, verbatim, raw and character literals and XAML CDATA are code, so "image/*" or Text="/*" no longer opens a comment that hides every later hit. // and /* mean nothing in XAML. - Blank lines count toward the three-line look-behind. - A suppressed finding carries the line of its allow comment, and the hook notes an edit that adds only that comment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Only a solution makes the folders above a project count toward the dev-path skip, and the climb stops at the repository root, so a solution-less app under Dev/ in a repository is linted. - A file outside any project is counted from its own folder in folder and single-file runs alike. - An .editorconfig section header that is not a valid glob matches nothing instead of failing the run. - UnoFeatures is read with attributes (Condition); commented-out references and features are ignored. - A single-file run adds the linted page's own namespaces to the cached context; UNO_LINT_NO_CACHE accepts 1, true, yes or on in any case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- In hook mode an unknown or missing --profile value is dropped with one uno-lint: line on stderr and the hook runs with its defaults, instead of Repl rejecting the command and leaving every edit unlinted. - Repl reads the token after a bool flag as its value, so 'lint --no-cache <file>' failed; a flag not followed by true or false now gets an explicit value. A test keeps the flag list in step with the lint command's bool options. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- FR-015 to FR-018 and new edge cases for this round's fixes. - The spec's false-positive table lists the same five prototype differences as FINDINGS.md; both note the key-named HEX hit the move to Uno.XamlParser removed, measured against the earlier reader. - README: hook option handling and the cache variable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
uno-lint is expected to move into the Uno Studio CLI, which brings its own command handling, so the command line no longer depends on a preview of Repl.Core. - UnoLintCli replaces UnoLintCommands and CommandLine: one option table per command drives both parsing and the generated help. Flags take no value, so a path after a flag is always the path, without rewriting the arguments first. - Errors are one uno-lint: line on stderr with exit code 2. The hook still exits 0 and notes unknown options and --profile values. - Output is the text report, --json or --markdown; the last one wins. --output:FORMAT, --human, --yaml and --xml are gone. - CliTests run the same entry point as Main in memory, and check that help and the README list every option. The JSON, text and Markdown reports and the exit codes are byte-identical to the Repl build on the five corpus apps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-context workarounds uno.xamlparser#39 gives fixers the element's index, its text at the end tag and whether the call is a re-run on a parent, and exposes the sanitized text on the read result. The text-capturing visitor, the seen-positions set and the reflection read of the repaired text go; XamlRules reads the context instead. XAMLPARSER.md lists what dev.87 fixed and keeps the two behaviors still worked around. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01PZQ75idMW4YnrJut3PKrok
|
Pushed 15968f0 onto this branch now that unoplatform/uno.xamlparser#39 is merged and
Verified against the published package: clean restore from nuget.org, 286/286 tests pass, and @vatsashah45 feel free to squash or reword as you like. |
PR Type
What is the current behavior?
The
uno-platform-studioplugin ships skills that tell an agent how to use MVUX, navigation, the Toolkit and theming, but nothing verifies what the agent actually wrote. Agents drift back to hard-coded colors, cards drawn as rounded Borders, hand-drawn icons and UI logic in code-behind. An agent-built sample with SimpleTheme, Toolkit and MVUX enabled still hard-coded its whole palette on every page.What is the new behavior?
Adds
specs/001-uno-linter: a feature specification for a deterministic XAML and C# linter that checks agent-written code after each edit and names the platform control or resource to use instead. Same spec format as the other Studio repos (prioritized user stories, FR/SC numbering, brief and checklist). Ships through three surfaces: a plugin hook and CLI now, an MCP tool onuno.devservernext, a Roslyn analyzer for the C# rules later.Adds
tools/uno-lint, in four projects:Uno.Lint.CoreUno.Lint.XamlUnoLintXaml(AddTo,IsWellFormed,Collect), the steps any XamlParser host such as Studio Live or Uno.AI callsUno.Lint.Host.editorconfigwith Roslyn semantics), the immutableLintReport, and the hook adapters for Claude Code and CodexUno.Lint.Cliuno-lint lint,rulesandhook, with no command-line frameworkrecommended: HEX, TOKENTHEME, ICON, BUILTIN, RESPONSIVE, BINDVALUE;strictadds CARD, BACKBAR, CODEBEHIND, OVERLAY), gated on Toolkit, MVUX and Uno.Themes references, severities per rule and per path from.editorconfig, reasoned suppression comments counted per rule.FINDINGS.mdhas the corpus results and per-rule verdicts;XAMLPARSER.mddescribes how the rules use the parser package.Nothing is wired into the plugin yet, and
Uno.Lint.Toolis not published; this PR is the spec plus the tool for review. Open questions are listed at the end of the spec.PR Checklist
Additional Information
The repo's
validate-pluginworkflow runsclaude plugin validate .at the root;tools/andspecs/contain no plugin manifests so it is unaffected..github/workflows/uno-lint.ymlbuilds, tests, packs and installs the tool, then runs the hook end to end through the shim, on Ubuntu, Windows and macOS whentools/uno-lintchanges. The.gitignorealready excludesbin/andobj/.🤖 Generated with Claude Code