From 189bce5e1be1266ad2e33a6b8cccb3bb6b304fb7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 23:55:22 +0000 Subject: [PATCH] Add repo setup: CLAUDE.md, editor config, templates, Dependabot, cloud session hook - .editorconfig and .gitattributes for consistent formatting and line endings - CLAUDE.md with layout, commands and project rules - PR template and issue forms written for on-site problem reports - Dependabot for NuGet and GitHub Actions (monthly, grouped) - SessionStart hook that installs the .NET 10 SDK and restores packages in cloud sessions Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_015b2AspKNFwd3rzcGepsPMh --- .claude/hooks/session-start.sh | 31 +++++++++++++++++ .claude/settings.json | 14 ++++++++ .editorconfig | 35 +++++++++++++++++++ .gitattributes | 13 +++++++ .github/ISSUE_TEMPLATE/bug_report.yml | 40 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 15 ++++++++ .github/dependabot.yml | 17 +++++++++ .github/pull_request_template.md | 13 +++++++ CLAUDE.md | 31 +++++++++++++++++ 10 files changed, 210 insertions(+) create mode 100755 .claude/hooks/session-start.sh create mode 100644 .claude/settings.json create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/pull_request_template.md create mode 100644 CLAUDE.md diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh new file mode 100755 index 0000000..60fa3aa --- /dev/null +++ b/.claude/hooks/session-start.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Prepares a Claude Code cloud session so it can build and run the Core tests. +# Local machines are left alone: there you install the .NET 10 SDK yourself. +set -euo pipefail + +if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then + exit 0 +fi + +# The dot.net install script is blocked in cloud sessions; the Ubuntu feed works. +if ! command -v dotnet >/dev/null 2>&1 || ! dotnet --list-sdks | grep -q '^10\.'; then + SUDO="" + if [ "$(id -u)" -ne 0 ]; then SUDO="sudo"; fi + $SUDO apt-get update -qq + $SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq dotnet-sdk-10.0 >/dev/null +fi + +{ + echo 'export DOTNET_CLI_TELEMETRY_OPTOUT=1' + echo 'export DOTNET_NOLOGO=1' + echo 'export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1' +} >> "${CLAUDE_ENV_FILE:-/dev/null}" +export DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1 + +cd "${CLAUDE_PROJECT_DIR:-$(dirname "$0")/../..}" + +# Restore NuGet packages so the first build/test in the session is quick. +# WPF and Windows projects restore fine on Linux thanks to EnableWindowsTargeting. +if [ -f ProDHCPServer.sln ]; then + dotnet restore ProDHCPServer.sln --verbosity quiet +fi diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..e06b033 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,14 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh" + } + ] + } + ] + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..70e2f63 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,35 @@ +# Formatting preferences shared by Visual Studio, Rider, VS Code and `dotnet format`. +# Style rules are suggestions only: the build treats warnings as errors. +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{csproj,props,targets,xml,xaml,manifest,json,yml,yaml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.{sh,py}] +end_of_line = lf + +[*.cs] +csharp_style_namespace_declarations = file_scoped:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_new_line_before_open_brace = all +csharp_prefer_braces = when_multiline:suggestion +dotnet_sort_system_directives_first = true + +dotnet_naming_rule.private_fields_underscore.symbols = private_fields +dotnet_naming_rule.private_fields_underscore.style = underscore_camel +dotnet_naming_rule.private_fields_underscore.severity = suggestion +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private +dotnet_naming_style.underscore_camel.required_prefix = _ +dotnet_naming_style.underscore_camel.capitalization = camel_case diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6731dea --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# Normalise line endings in the repo; Windows checkouts get CRLF where tools expect it. +* text=auto + +*.sln text eol=crlf +*.ps1 text eol=crlf +*.sh text eol=lf +*.py text eol=lf + +*.ico binary +*.png binary +*.gz binary +*.exe binary +*.dll binary diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..508b045 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,40 @@ +name: Problem on site +description: Something went wrong while using ProDHCPServer with real equipment. +labels: [bug] +body: + - type: textarea + id: what-happened + attributes: + label: What happened + description: What you expected, and what you saw instead. Screenshots of the status panel help. + validations: + required: true + - type: input + id: device + attributes: + label: Device(s) connected + placeholder: e.g. Q-SYS Core 110f direct, or 3 cameras behind a Netgear GS108 + - type: input + id: version + attributes: + label: App version + description: Shown in the title bar or Settings. The CI run number also works. + - type: input + id: windows + attributes: + label: Windows version and adapter + placeholder: e.g. Windows 11 24H2, USB-C Realtek adapter + - type: dropdown + id: adapter-restored + attributes: + label: Were your adapter settings put back afterwards? + options: + - "Yes" + - "No, I had to fix them by hand" + - "Not sure" + - type: textarea + id: log + attributes: + label: Session log + description: Paste or attach the exported session log if you have one. + render: text diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..2ca6cd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,15 @@ +name: Feature idea +description: Something that would make field work quicker or easier. +labels: [enhancement] +body: + - type: textarea + id: situation + attributes: + label: The situation on site + description: What were you trying to do, and with what equipment? + validations: + required: true + - type: textarea + id: idea + attributes: + label: What would help diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c9b4e64 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + - package-ecosystem: nuget + directory: / + schedule: + interval: monthly + groups: + nuget-minor-and-patch: + update-types: [minor, patch] + + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + actions: + patterns: ["*"] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..eccb735 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ +## What changes for the user + +Before: + +After: + +## How + +## Testing + +- [ ] Core tests pass +- [ ] Windows CI run is green (integration tests, publish, smoke-test screenshots) +- [ ] Hardware checklist updated if behaviour on real devices changed diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..84384a7 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,31 @@ +# ProDHCPServer: notes for Claude + +Windows 10/11 DHCP server tool for AV field technicians. C# on .NET 10, WPF with the Fluent theme, shipped as one self-contained single-file exe (win-x64). The user is an AV tech, not a developer: anything shown in the UI must be plain English with a suggested next step. + +## Layout + +- `src/ProDHCPServer.Core`: platform-independent logic (DHCP codec and engine, adapter backup/restore lifecycle, status chain, OUI lookup). No Windows APIs here. +- `src/ProDHCPServer.Windows`: everything that touches the OS (adapters, sockets, ARP, firewall, ping), behind interfaces so Core stays testable with fakes. +- `src/ProDHCPServer.App`: WPF UI (MVVM with CommunityToolkit.Mvvm), elevation manifest, crash handling. +- `tests/ProDHCPServer.Core.Tests`: unit tests, run anywhere. `tests/ProDHCPServer.Windows.Tests`: integration tests, Windows only, must never change adapter settings. +- `docs/hardware-test-phaseN.md`: the manual checklist Simon runs on real hardware at the end of each phase. + +## Commands + +``` +dotnet test tests/ProDHCPServer.Core.Tests # works on Linux +dotnet build ProDHCPServer.sln # builds everything, WPF included, on Linux +dotnet format whitespace ProDHCPServer.sln --verify-no-changes # formatting check +dotnet publish src/ProDHCPServer.App -c Release -r win-x64 -o publish # Windows only in practice +``` + +In cloud sessions the SessionStart hook (`.claude/hooks/session-start.sh`) installs the .NET 10 SDK from the Ubuntu feed (the dot.net install script is blocked) and restores packages. + +## Rules + +- `TreatWarningsAsErrors` is on for every project. Fix warnings; don't suppress them without a comment saying why. +- Keep Windows calls out of Core. New OS behaviour goes in the Windows project behind an interface, with a fake in the tests. +- Any change to adapter settings must go through the backup/restore session so Stop, exit and a crash all put the adapter back. +- The Windows integration tests and the UI (smoke-test screenshots) only run on the Windows CI runner. Check the CI run, not just local Linux tests, before calling a change done. +- Work is phased (1: core DHCP loop, 2: ping/logging/profiles, 3: discovery). Each phase ends with Simon's hardware test pass before the next one starts. Don't pull later-phase features forward unasked. +- Builds are downloaded from GitHub Actions artifacts. The exe is not code-signed yet.