You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "::error::ReSharper code cleanup found style drift. Run 'dotnet jb cleanupcode Terminal.Gui.Editor.slnx --profile=\"TG.Editor Full Cleanup\" --no-build --exclude=\"third_party/**/*;src/Terminal.Gui.Editor/Document/**/*;src/Terminal.Gui.Editor/Utils/**/*;src/Terminal.Gui.Editor/Search/**/*\"' locally and commit the result."
77
+
echo "::error::ReSharper code cleanup found style drift outside lifted AvaloniaEdit code. Run '.claude/hooks/cleanup-cs.ps1' locally and commit the result."
66
78
exit 1
67
79
fi
68
80
@@ -81,4 +93,3 @@ jobs:
81
93
# NOTE: Performance smoke tests and the BenchmarkDotNet baseline compare live in a
82
94
# dedicated workflow: .github/workflows/perf.yml (ubuntu-latest only). They were split
83
95
# out so this CI workflow stays purely correctness-focused and fast across all three OSes.
Copy file name to clipboardExpand all lines: CLAUDE.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Run a single test by passing xUnit.v3 filter args after `--`:
51
51
dotnet run --project tests/Terminal.Gui.Editor.Tests -- -method "*MyTestName*"
52
52
```
53
53
54
-
CI verifies formatting with `dotnet format Terminal.Gui.Editor.slnx --verify-no-changes --exclude third_party/`. Run the same locally before pushing if you've touched C# files outside `third_party/`.
54
+
CI verifies formatting with `dotnet format Terminal.Gui.Editor.slnx --verify-no-changes` while excluding `third_party/` and AvaloniaEdit-lifted folders. Run `.claude/hooks/cleanup-cs.ps1`locally before pushing if you've touched C# files outside lifted code.
55
55
56
56
### Verifying the *look* (ANSI snapshots) — MANDATORY for render changes
57
57
@@ -84,15 +84,22 @@ The boundary matters: anything that takes a dependency on `Terminal.Gui` types b
84
84
85
85
See `specs/00-plan.md` §6 for the planned pipeline and full `Editor` public API sketch.
86
86
87
-
## AvaloniaEdit fork policy
87
+
## AvaloniaEdit fork policy — do not format lifted code
88
88
89
-
Code is lifted from AvaloniaEdit into the relevant `src/Terminal.Gui.Editor/` subfolders (`Document/`, `Utils/` so far; `Folding/`, `Search/`, `Indentation/`, `Highlighting/` to follow). The pinned upstream commit and per-file modification log live in `third_party/AvaloniaEdit/UPSTREAM.md` (with the upstream MIT `LICENSE` alongside).
89
+
Code is lifted from AvaloniaEdit into the relevant `src/Terminal.Gui.Editor/` subfolders (`Document/`, `Utils/`, `Folding/`, `Search/`, `Indentation/`, `Highlighting/`, and supporting lifted helpers). The pinned upstream commit and per-file modification log live in `third_party/AvaloniaEdit/UPSTREAM.md` (with the upstream MIT `LICENSE` alongside).
90
+
91
+
**Do not run broad formatting or cleanup over lifted files.** Treat any file containing
92
+
`// Adapted for Terminal.Gui from AvaloniaEdit ...` as upstream-owned formatting, even when it
93
+
lives outside `third_party/`. `dotnet format`, ReSharper cleanup, Rider "cleanup on save", and
94
+
"format document" can create huge no-op diffs in these files; those diffs make future upstream
95
+
re-syncs painful and must be reverted before finishing work.
90
96
91
97
For lifted files:
92
98
93
99
-**Preserve original formatting and copyright headers.** House-style reformatting defeats the merge story.
94
100
- Add the line `// Adapted for Terminal.Gui from AvaloniaEdit <commit-sha>` under the original header.
95
101
- Targeted edits only: strip `using Avalonia.*`, remove `Dispatcher.UIThread.VerifyAccess ()` calls, replace `IBrush`/`Avalonia.Media.Color` with `Terminal.Gui.Color`, drop typeface/font-size from `HighlightingColor`.
102
+
- If a formatter or cleanup tool touches lifted files as a side effect, immediately revert those unrelated formatting-only hunks. Keep only the narrow semantic changes required by the task.
96
103
- Log every modification in `third_party/AvaloniaEdit/UPSTREAM.md` along with the pinned upstream commit.
97
104
98
105
The fork is **hard** — re-syncs are manual and deliberate, triggered only by upstream fixes we want.
@@ -105,7 +112,7 @@ Adopts Terminal.Gui's house style. Three enforcement layers:
105
112
2.**`Terminal.Gui.Editor.sln.DotSettings` + `dotnet jb cleanupcode`** — ReSharper-driven cleanup ("TG.Editor Full Cleanup" profile). Catches what `dotnet format` misses (XML doc spacing, using sorting, name qualifier removal, expression-bodied conversions). CI runs `dotnet jb cleanupcode` and fails on any diff. The file is named `*.sln.DotSettings` (not `*.slnx.DotSettings`) even though the solution is `.slnx`: ReSharper/Rider/`jb` resolve the team-shared layer using the `.sln.` infix (the IDE writes its companion `.sln.DotSettings.user`). The cleanup profile **must** be stored in the modern single-string serialized-`<Profile>` format — ReSharper/`jb` 2024+ silently ignore the old per-task `…/=Name/CSReformatCode/@EntryIndexedValue` key layout, which makes the profile vanish from the IDE and unresolvable by `jb` (and CI's `|| true` then makes the cleanup gate a silent no-op). Edit the profile only via Rider → Settings | Code Cleanup → "Save to: This Solution Team-Shared".
106
113
3.**A Stop hook in `.claude/settings.json`** that runs both tools on .cs files modified during the session before the agent reports done. Output is suppressed unless the cleanup actually changed something.
107
114
108
-
**Before declaring work complete, an agent must run `dotnet tool restore && dotnet format Terminal.Gui.Editor.slnx --exclude third_party/ && dotnet jb cleanupcode Terminal.Gui.Editor.slnx --profile="TG.Editor Full Cleanup"` (the Stop hook does this automatically). If the cleanup adjusts files, those changes are part of the work — re-stage and continue.**
115
+
**Before declaring work complete, an agent must run `.claude/hooks/cleanup-cs.ps1` (the Stop hook does this automatically). Then inspect the diff. If cleanup adjusted lifted AvaloniaEdit files (files with the `Adapted for Terminal.Gui from AvaloniaEdit` marker), revert those formatting-only changes before reporting done and fix the cleanup exclude list. Cleanup changes in non-lifted files are part of the work — re-stage and continue.**
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
A reusable text-editing `View` for [Terminal.Gui](https://github.com/gui-cs/Terminal.Gui). Drop it into your TUI app and you get the editing experience users already expect (caret movement, selection, clipboard, undo/redo, search & replace, folding, syntax highlighting, word wrap) without writing any of it yourself.
6
6
7
-
Ships as a single NuGet package: **[`Terminal.Gui.Editor`](https://www.nuget.org/packages/Terminal.Gui.Editor)**.
7
+
Ships as a single NuGet package: **[`Terminal.Gui.Editor`](https://www.nuget.org/packages/Terminal.Gui.Editor)**. API documentation is published on the [Terminal.Gui DocFX site](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui.Editor.html).
0 commit comments