Skip to content

Commit 4e8ed58

Browse files
tigCopilot
andcommitted
Fix build: restore line endings, resolve dependencies, run dotnet format
- Re-extracted files with broken line endings (CommunityToolkit, Reactive, WideCharRepro, FSharp) - Enable CentralPackageFloatingVersionsEnabled, use Terminal.Gui 2.4.2-develop.* - Remove UICatalog reference from InlineCLI, add local Logo.cs - Add #nullable disable to ReactiveExample for interface compat - Fix null dereference in ShortcutTest (use null-forgiving operator) - Remove Terminal.Gui PackageReference from WideCharRepro (standalone console app) - Exclude FSharpExample from solution (needs v2 port) - Run dotnet format on all projects Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f38dfed commit 4e8ed58

31 files changed

Lines changed: 1125 additions & 111 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Post-Generation Validation
2+
3+
After modifying any C# file, verify:
4+
5+
1. **Space before `()`** — scan for `\w(` (missing space)
6+
2. **Space before `[]`** — scan for `\w[` (missing space)
7+
3. **Allman braces** — scan for `) {` or `= {` (same-line brace)
8+
4. **No `var`** for non-built-in types
9+
5. **Target-typed `new ()`** not `new TypeName()`
10+
6. **Collection expressions** `[...]` not `new () { ... }`
11+
7. **Lambda discards** `(_, _)` for unused params
12+
13+
## Quick Fix Commands
14+
15+
```bash
16+
# Check formatting
17+
dotnet format Examples.sln --verify-no-changes
18+
19+
# Auto-fix formatting
20+
dotnet format Examples.sln
21+
22+
# ReSharper full cleanup
23+
dotnet tool restore
24+
dotnet jb cleanupcode Examples.sln --profile="Built-in: Full Cleanup" --no-build
25+
```

‎.claude/agents/cleanup-agent.md‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Code Cleanup Agent
2+
3+
## Purpose
4+
5+
Automated code cleanup and formatting enforcement for Terminal.Gui Examples.
6+
7+
## Usage
8+
9+
Invoke by telling your AI agent "cleanup these files" or "run code cleanup".
10+
11+
## Steps
12+
13+
1. **Build** the solution to ensure a clean starting state:
14+
```bash
15+
dotnet build Examples.sln
16+
```
17+
18+
2. **Run dotnet format** to fix .editorconfig violations:
19+
```bash
20+
dotnet format Examples.sln
21+
```
22+
23+
3. **Run ReSharper cleanupcode** for deeper style fixes:
24+
```bash
25+
dotnet tool restore
26+
dotnet jb cleanupcode Examples.sln --profile="Built-in: Full Cleanup" --no-build
27+
```
28+
29+
4. **Verify** no new build warnings:
30+
```bash
31+
dotnet build Examples.sln --no-restore
32+
```
33+
34+
5. **Run smoke tests** to confirm nothing broke:
35+
```bash
36+
dotnet run --project tests/Examples.SmokeTests
37+
```
38+
39+
## Acceptance Criteria
40+
41+
Successfully cleaned files meet:
42+
- ✓ No build warnings (TreatWarningsAsErrors is enabled)
43+
- ✓ `dotnet format --verify-no-changes` passes
44+
- ✓ `jb cleanupcode` produces no diff
45+
- ✓ All smoke tests pass
46+
47+
## Style Quick Reference
48+
49+
| Rule | Correct | Wrong |
50+
|------|---------|-------|
51+
| Space before `()` | `Method ()` | `Method()` |
52+
| Space before `[]` | `array [i]` | `array[i]` |
53+
| Allman braces | `)\n{` | `) {` |
54+
| No var (non-built-in) | `Label lbl = new ();` | `var lbl = new Label ();` |
55+
| Target-typed new | `Button btn = new ();` | `Button btn = new Button ();` |
56+
| Collection expressions | `[1, 2, 3]` | `new () { 1, 2, 3 }` |
57+
| Lambda discards | `(_, _) => { }` | `(sender, e) => { }` |
58+
59+
## ReSharper Command Line Usage
60+
61+
```bash
62+
# Apply cleanup to all files
63+
dotnet jb cleanupcode Examples.sln --profile="Built-in: Full Cleanup" --no-build
64+
65+
# Apply cleanup to a single file
66+
dotnet jb cleanupcode Examples.sln --profile="Built-in: Full Cleanup" --include="Example/Example.cs" --no-build
67+
68+
# Inspect for code issues
69+
dotnet jb inspectcode Examples.sln --output=report.xml --severity=WARNING --no-build
70+
```

‎CLAUDE.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CLAUDE.md
2+
3+
See [AGENTS.md](AGENTS.md) for AI agent instructions.
4+
5+
## Before Every File Edit
6+
7+
Read `.claude/POST-GENERATION-VALIDATION.md` to prevent common style violations.
8+
9+
## After Writing/Modifying Code
10+
11+
Use `.claude/agents/cleanup-agent.md` to validate and clean all code.
12+
13+
## Quick Rules
14+
15+
1. **Space before `()` and `[]`** — `Method ()`, `array [i]`
16+
2. **Braces on next line** (Allman style)
17+
3. **No `var`** except built-in types
18+
4. **Use `new ()`** not `new TypeName()`
19+
5. **Use `[...]`** collection expressions
20+
6. **SubView/SuperView** terminology
21+
7. **Early return / guard clauses**
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
namespace CommunityToolkitExample;internal enum LoginActions{ Clear, Validation, LoginProgress}
1+
namespace CommunityToolkitExample;
2+
3+
internal enum LoginActions
4+
{
5+
Clear,
6+
Validation,
7+
LoginProgress
8+
}

‎CommunityToolkitExample/LoginView.Designer.cs‎

Lines changed: 64 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,77 @@
1-
using CommunityToolkit.Mvvm.Messaging;using Terminal.Gui.App;using Terminal.Gui.ViewBase;using Terminal.Gui.Input;namespace CommunityToolkitExample;internal partial class LoginView : IRecipient<Message<LoginActions>>{ public LoginView (LoginViewModel viewModel) { WeakReferenceMessenger.Default.Register (this); Title = $"Community Toolkit MVVM Example - {Application.GetDefaultKey (Command.Quit)} to Exit"; ViewModel = viewModel; InitializeComponent (); usernameInput.TextChanged += (_, _) => { ViewModel.Username = usernameInput.Text; }; passwordInput.TextChanged += (_, _) => { ViewModel.Password = passwordInput.Text; }; loginButton.Accepting += (_, e) => { if (!ViewModel.CanLogin) { return; } ViewModel.LoginCommand.Execute (null); // When Accepting is handled, set e.Handled to true to prevent further processing. e.Handled = true; }; clearButton.Accepting += (_, e) => { ViewModel.ClearCommand.Execute (null); // When Accepting is handled, set e.Handled to true to prevent further processing. e.Handled = true; }; Initialized += (_, _) => { ViewModel.Initialized (); }; } public LoginViewModel ViewModel { get; set; } public void Receive (Message<LoginActions> message) { switch (message.Value) { case LoginActions.Clear: { loginProgressLabel.Text = ViewModel.LoginProgressMessage; validationLabel.Text = ViewModel.ValidationMessage; validationLabel.SetScheme (ViewModel.ValidationScheme); break; } case LoginActions.LoginProgress: { loginProgressLabel.Text = ViewModel.LoginProgressMessage; break; } case LoginActions.Validation: { validationLabel.Text = ViewModel.ValidationMessage; validationLabel.SetScheme (ViewModel.ValidationScheme); break; } } SetText (); } private void SetText () { usernameInput.Text = ViewModel.Username; usernameLengthLabel.Text = ViewModel.UsernameLengthMessage; passwordInput.Text = ViewModel.Password; passwordLengthLabel.Text = ViewModel.PasswordLengthMessage; }}
1+
using CommunityToolkit.Mvvm.Messaging;
2+
using Terminal.Gui.App;
3+
using Terminal.Gui.ViewBase;
4+
using Terminal.Gui.Input;
5+
6+
namespace CommunityToolkitExample;
7+
8+
internal partial class LoginView : IRecipient<Message<LoginActions>>
9+
{
10+
public LoginView (LoginViewModel viewModel)
11+
{
12+
WeakReferenceMessenger.Default.Register (this);
13+
Title = $"Community Toolkit MVVM Example - {Application.GetDefaultKey (Command.Quit)} to Exit";
14+
ViewModel = viewModel;
15+
InitializeComponent ();
16+
usernameInput.TextChanged += (_, _) =>
17+
{
18+
ViewModel.Username = usernameInput.Text;
19+
};
20+
passwordInput.TextChanged += (_, _) =>
21+
{
22+
ViewModel.Password = passwordInput.Text;
23+
};
24+
loginButton.Accepting += (_, e) =>
25+
{
26+
if (!ViewModel.CanLogin) { return; }
27+
ViewModel.LoginCommand.Execute (null);
28+
// When Accepting is handled, set e.Handled to true to prevent further processing.
29+
e.Handled = true;
30+
};
31+
32+
clearButton.Accepting += (_, e) =>
33+
{
34+
ViewModel.ClearCommand.Execute (null);
35+
// When Accepting is handled, set e.Handled to true to prevent further processing.
36+
e.Handled = true;
37+
};
38+
39+
Initialized += (_, _) => { ViewModel.Initialized (); };
40+
}
41+
42+
public LoginViewModel ViewModel { get; set; }
43+
44+
public void Receive (Message<LoginActions> message)
45+
{
46+
switch (message.Value)
47+
{
48+
case LoginActions.Clear:
49+
{
50+
loginProgressLabel.Text = ViewModel.LoginProgressMessage;
51+
validationLabel.Text = ViewModel.ValidationMessage;
52+
validationLabel.SetScheme (ViewModel.ValidationScheme);
53+
break;
54+
}
55+
case LoginActions.LoginProgress:
56+
{
57+
loginProgressLabel.Text = ViewModel.LoginProgressMessage;
58+
break;
59+
}
60+
case LoginActions.Validation:
61+
{
62+
validationLabel.Text = ViewModel.ValidationMessage;
63+
validationLabel.SetScheme (ViewModel.ValidationScheme);
64+
break;
65+
}
66+
}
67+
SetText ();
68+
}
69+
70+
private void SetText ()
71+
{
72+
usernameInput.Text = ViewModel.Username;
73+
usernameLengthLabel.Text = ViewModel.UsernameLengthMessage;
74+
passwordInput.Text = ViewModel.Password;
75+
passwordLengthLabel.Text = ViewModel.PasswordLengthMessage;
76+
}
77+
}

0 commit comments

Comments
 (0)