refactor: simplify codebase and standardize scripts#83
refactor: simplify codebase and standardize scripts#83
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the test SDK and copy local lock-file assemblies so vstest can inspect AHKFlowApp.TestUtilities.dll without crashing during discovery while keeping the project marked as IsTestProject=false. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Simplify API and Blazor startup wiring, remove the redundant DevEnvironment wrapper, and replace the old environment seam with a single application-owned AppEnvironment type while keeping the useful UI test seams intact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Standardize supported script entrypoints on PowerShell 5.1, extract shared deployment helpers, and simplify fail-fast behavior for the main Azure scripts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the backlog issue creation script into the canonical scripts folder, make the backlog path default to the repo backlog, and update live references to the new entrypoint. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a .NET 10 SDK preflight check to deploy.ps1 and dispatch the deploy-frontend workflow after Azure provisioning finishes and GitHub configuration is in place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Trim the live docs down to the supported local and Azure paths, document the x64-only Docker limitation, and update deployment guidance to match the current deploy.ps1 behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Differentiate TEST and PROD API deployment behavior after provisioning so deploy guidance matches deploy-api.yml trigger rules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop the empty AHKFlowApp.Domain.Tests project from the solution and active guidance so verification no longer produces a no-tests warning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors backend startup/configuration and repository operational tooling to reduce indirection, standardize PowerShell entrypoints, and align documentation + repo layout around a single scripts/ source of truth.
Changes:
- Simplifies API startup by extracting cohesive configuration blocks and replaces
IDevEnvironmentwith a lightweightAppEnvironmentvalue object. - Standardizes PowerShell scripts on Windows PowerShell 5.1, extracts shared helpers into
scripts/Common.ps1, and moves the GitHub backlog issue generator intoscripts/. - Updates docs and repo guidance to reflect the supported local/Azure workflows and removes the empty
AHKFlowApp.Domain.Testsproject.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/AHKFlowApp.TestUtilities/AHKFlowApp.TestUtilities.csproj | Adds test SDK/support properties used by shared test utilities. |
| tests/AHKFlowApp.Domain.Tests/AHKFlowApp.Domain.Tests.csproj | Removes the unused/empty Domain test project. |
| tests/AHKFlowApp.Application.Tests/Hotstrings/SeedHotstringsCommandHandlerTests.cs | Updates tests to use AppEnvironment directly (removes mock seam). |
| src/Frontend/AHKFlowApp.UI.Blazor/Program.cs | Deduplicates HttpClient registration via a shared AddApiClient helper. |
| src/Backend/AHKFlowApp.Application/Commands/Dev/SeedHotstringsCommand.cs | Switches dev-only seeding gate from IDevEnvironment to AppEnvironment. |
| src/Backend/AHKFlowApp.Application/AppEnvironment.cs | Introduces a simple environment value object shared across layers. |
| src/Backend/AHKFlowApp.Application/Abstractions/IDevEnvironment.cs | Removes the thin interface abstraction. |
| src/Backend/AHKFlowApp.API/Program.cs | Extracts observability/service wiring/migrations into local functions; registers AppEnvironment. |
| src/Backend/AHKFlowApp.API/Extensions/ApiExtensions.cs | Adds UseRootRedirect middleware helper for consistent root redirects. |
| src/Backend/AHKFlowApp.API/DevEnvironment.cs | Removes the API-side DevEnvironment record. |
| scripts/update.ps1 | Moves shared helpers (logging/config parsing/login checks) to Common.ps1; enforces PS 5.1. |
| scripts/teardown.ps1 | Moves shared helpers to Common.ps1; enforces PS 5.1. |
| scripts/setup-entra-app.ps1 | Lowers PowerShell requirement to 5.1 while keeping app registration setup behavior. |
| scripts/setup-dev-entra.ps1 | Lowers PowerShell requirement to 5.1 and preserves local Entra wiring workflow. |
| scripts/run-coverage.ps1 | Lowers PowerShell requirement to 5.1 for local coverage script entrypoint. |
| scripts/deploy.ps1 | Enforces PS 5.1, factors shared helpers, adds .NET 10 SDK precheck, and triggers frontend workflow dispatch. |
| scripts/create-github-issues.ps1 | New canonical issue-creation script under scripts/ with dry-run default. |
| scripts/Common.ps1 | New shared helper library for script output, prereq checks, auth checks, and env file parsing. |
| docs/superpowers/specs/2026-04-21-repo-simplification-file-layout-design.md | Adds design spec documenting the canonical repo layout rule for scripts/docs. |
| docs/superpowers/specs/2026-04-21-code-simplification-design.md | Adds design spec motivating targeted code simplification choices. |
| docs/scripts/create-github-issues.ps1 | Removes the old non-canonical script location under docs. |
| docs/environments.md | Rewrites environment documentation to match the supported workflows and entry scripts. |
| docs/development/github-setup.md | Updates references to the canonical script location under scripts/. |
| docs/development/docker-setup.md | Clarifies compose stack scope and x64/amd64 limitation. |
| docs/deployment/getting-started.md | Updates prerequisites and provisioning/deploy workflow descriptions for current scripts. |
| docs/deployment/entra-setup.md | Updates post-provisioning guidance to match deploy.ps1 dispatch behavior. |
| README.md | Updates local run options and clarifies supported DB/architecture constraints. |
| AHKFlowApp.slnx | Removes the deleted AHKFlowApp.Domain.Tests project from the solution. |
| AGENTS.md | Updates repo layout and environment guidance to match new supported workflows. |
| .claude/skills/cck-verify/SKILL.md | Removes references to the deleted Domain tests from verification instructions. |
| .claude/skills/cck-testing/SKILL.md | Removes references to the deleted Domain tests from testing skill documentation. |
| .claude/backlog/001_create-backlog-in-github.md | Updates the backlog note to reference the canonical scripts/ issue-creation script. |
| function Assert-DotNetSdkVersion([string]$RequiredMajorVersion) { | ||
| $installedSdks = dotnet --list-sdks 2>$null | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Fail 'Unable to determine installed .NET SDK versions.' | ||
| exit 1 | ||
| } | ||
|
|
||
| $requiredPrefix = "$RequiredMajorVersion." | ||
| if (-not ($installedSdks | Where-Object { $_.StartsWith($requiredPrefix) })) { | ||
| Write-Fail ".NET SDK $RequiredMajorVersion.x is required." | ||
| Write-Host ' Install from: https://dotnet.microsoft.com/download/dotnet/10.0' -ForegroundColor Yellow | ||
| exit 1 | ||
| } | ||
|
|
||
| Write-Success ".NET SDK $RequiredMajorVersion.x found" | ||
| } |
There was a problem hiding this comment.
Assert-DotNetSdkVersion only checks for any installed SDK that starts with 10.. That will pass for older 10.0 feature bands and for preview SDKs, even though the repo’s global.json pins a specific 10.0 SDK version. To avoid confusing false-positives, consider validating against the global.json SDK version (or at least ensuring the required feature band/patch is present and excluding preview entries).
| 7. Trigger the frontend deploy workflow on GitHub | ||
| 8. Save your configuration to `scripts/.env.{environment}` for future use |
There was a problem hiding this comment.
The step ordering here doesn’t match what scripts/deploy.ps1 does: the script saves scripts/.env.{environment} first and only then triggers deploy-frontend.yml. Please either reorder these bullets or adjust the script so the documentation matches the actual workflow.
| 7. Trigger the frontend deploy workflow on GitHub | |
| 8. Save your configuration to `scripts/.env.{environment}` for future use | |
| 7. Save your configuration to `scripts/.env.{environment}` for future use | |
| 8. Trigger the frontend deploy workflow on GitHub |
| await builder.Build().RunAsync(); | ||
|
|
||
| IHttpClientBuilder AddApiClient<TClient, TImplementation>(Uri baseAddress) | ||
| where TClient : class | ||
| where TImplementation : class, TClient | ||
| { | ||
| return builder.Services.AddHttpClient<TClient, TImplementation>(client => | ||
| { | ||
| client.BaseAddress = baseAddress; | ||
| client.Timeout = TimeSpan.FromSeconds(30); | ||
| }); | ||
| } |
There was a problem hiding this comment.
AddApiClient is declared after await builder.Build().RunAsync();. Since RunAsync blocks until shutdown, this makes the helper easy to miss and can confuse readers/tools that expect all setup helpers before the host is built. Consider moving AddApiClient above the first call site (and before Build().RunAsync()) so the composition flow reads top-to-bottom.
|
Superseded by #98, which ports just the changes that are still relevant given main has re-implemented most of the same plan via a different sequence of PRs. Key items skipped from this PR:
Closing in favour of #98. |
Summary
scripts\and removedocs\scriptsas a live script locationdeploy.ps1to require a real .NET 10 SDK and dispatch the frontend deployment workflow after provisioningAHKFlowApp.Domain.TestsprojectValidation