Skip to content

Fix build, add CI workflows, global tool packaging, and cross-platform improvements - #11

Merged
dend merged 15 commits into
mainfrom
den/fix-commandhandler
Apr 7, 2026
Merged

Fix build, add CI workflows, global tool packaging, and cross-platform improvements#11
dend merged 15 commits into
mainfrom
den/fix-commandhandler

Conversation

@dend

@dend dend commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix build by adding System.CommandLine.NamingConventionBinder package (CommandHandler.Create moved there in beta4)
  • Add CI workflows matching decksurf-sdk patterns: PR validation, main branch build, and tag-based NuGet publishing
  • Package DeckSurf as a .NET global tool (dotnet tool install -g DeckSurf) with Barn plugin included
  • Make LaunchApplication command cross-platform (Windows icon extraction behind platform guard, fallback for other OSes)
  • Make all Barn commands compatible with all 9 supported Stream Deck models
  • Update project motivation and add Barn plugin documentation with usage examples to README
  • Fix SnakeGame divide-by-zero when columns/rows uninitialized, PerformanceCounter resource leak, and other cleanup

Test plan

  • Verify PR validation workflow passes on ubuntu-latest
  • Verify dotnet pack produces a valid .nupkg with Barn plugin included
  • Verify dotnet tool install from local nupkg makes deck available globally
  • Verify LaunchApplication works on Windows (with icon extraction) and Linux/macOS (fallback)
  • Verify SnakeGame initializes correctly on all device models

🤖 Generated with Claude Code

dend and others added 7 commits April 6, 2026 17:41
CommandHandler.Create moved from System.CommandLine.Invocation to
System.CommandLine.NamingConventionBinder in beta4. Add the package
reference and update the using statement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document the three built-in Barn plugin commands (LaunchApplication,
ShowCPUUsage, SnakeGame) with descriptions and usage examples. Add a
table of contents for easier navigation. Update CLI commands table
with the new profile, info, and brightness commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The commands already use device-aware properties (ButtonResolution,
ButtonColumns, ButtonRows) instead of hardcoded XL values, so they
work on any model. Add CompatibleWith attributes for all nine
supported devices.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Configure the project as a .NET global tool (PackAsTool, ToolCommandName)
so users can install with 'dotnet tool install -g DeckSurf'. Add a
ProjectReference to Barn so it ships with the tool. Update the Loader
to scan both plugins/ subdirectory and the executable's own directory,
supporting both local dev and global tool flat layouts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI: Add pr-validation.yml for PR builds, publish-package.yml for
tag-based NuGet publishing, and simplify build.yaml for main branch.
All workflows now run on ubuntu-latest with concurrency controls.

LaunchApplication: Extract Windows-specific icon loading behind
OperatingSystem.IsWindows() guard with [SupportedOSPlatform] attribute.
On non-Windows platforms, falls back to using an image file if the
command argument is an image, or sets a colored key. Process.Start
with UseShellExecute already works cross-platform.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- SnakeGame: initialize _columns=8 and _rows=4 as defaults to prevent
  divide-by-zero if ExecuteOnAction is called before ExecuteOnActivation
- ShowCPUUsage: dispose PerformanceCounter with using statement
- Directory.Build.props: disable nullable since codebase isn't annotated
- Standardize workflow working-directory paths (remove leading ./)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dend dend changed the title Fix build: add NamingConventionBinder package Fix build, add CI workflows, global tool packaging, and cross-platform improvements Apr 7, 2026
dend and others added 8 commits April 6, 2026 17:56
Move snake initialization from constructor to ExecuteOnActivation
where the real device dimensions are known. Cap initial snake length
to fit within the device's first row (min 3 segments or column count,
whichever is smaller). Fixes incorrect behavior on Mini (3x2) and
other non-XL devices.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Metadata: Fix copyright year in DeckSurf.csproj (2021 -> 2021-2026),
update Barn plugin version to 0.0.2 and website URL to decksurf repo.

Security: Disable UseShellExecute in LaunchApplication to prevent
shell injection. Add path traversal guard in profile delete command.

CI: Switch all workflows to windows-latest (System.Drawing requires
Windows). Add explicit restore steps. Fix publish tag regex (remove
trailing wildcard). Use PowerShell-compatible env vars in publish.

Code quality: Enable .NET analyzers with latest analysis level.
Expand .editorconfig with naming, formatting, and indentation rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The entire class uses System.Drawing and PerformanceCounter which are
Windows-only. Apply [SupportedOSPlatform("windows")] at the class
level instead of suppressing CA1416 on individual methods, so the
analyzer correctly understands all call sites are Windows-guarded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use consistent sentence structure: verb phrase describing what the
command does, mention Stream Deck context, note platform limitations
where applicable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add CpuMonitor helper with platform-specific system-wide CPU
measurement: PerformanceCounter on Windows, /proc/stat parsing on
Linux, and top command output parsing on macOS. No new package
dependencies.

ShowCPUUsage now works on all platforms. On Windows, renders text
percentage on the button. On macOS/Linux, uses a green-to-red color
gradient to indicate CPU load. Remove [SupportedOSPlatform("windows")]
class-level restriction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CLI structure: Reorganize flat commands into consistent nested groups:
  - deck devices {list, info, brightness}
  - deck plugins {list}
  - deck profiles {list, show, delete}
  - deck write, deck listen (top-level actions)

Add root command description so 'deck --help' is informative. Add
empty-state messages with next-step guidance throughout (no devices,
no plugins, no profiles). Add success confirmation to write command
with 'run deck listen' suggestion. Fix option aliases (-g -> -a for
action-args, -l -> -n for plugin, -b -> -l for brightness level).

LaunchApplication: Use platform-specific launchers — 'open' on macOS
for .app bundles, 'xdg-open' on Linux for desktop files, direct
Process.Start on Windows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update Barn plugin usage examples from -l/-g to -n/-a, and refresh
option descriptions in the usage block to match Program.cs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dend
dend merged commit 8d02583 into main Apr 7, 2026
1 check passed
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.

1 participant