Repository navigation
Refactor NewProjectCommand to support standalone scaffolding - #24
Merged
Merged
Conversation
The `sm new project` command can now create projects that reference published SimpleModule packages from nuget.org and npmjs.org, instead of requiring local package sources. Adds NuGet version auto-detection, fallback templates for all host files, and an integration test that verifies the scaffolded project builds successfully.
Build artifact from dotnet build — trailing newline normalization.
The template/SimpleModule.Host/ files are now embedded as resources in the CLI assembly. HostTemplates reads from embedded resources instead of the filesystem, eliminating both the filesystem dependency and all hardcoded fallback templates. The CLI is now fully self-contained for host project scaffolding.
- Use static HttpClient to avoid socket exhaustion - Remove TOCTOU File.Exists check in NuGetVersionResolver - Use ReadTemplateLines in RoutesRazor/AppCss instead of manual split - Remove dead code in IntegrationTestSkeleton and KeepFirstTestMethod - Add missing wwwroot/css/app.css to PlanFiles - Extract test scaffold helper and version constant - Rename FallbackRootPackageJson to GenerateRootPackageJson
antosubash
force-pushed
the
claude/test-cli-module-creation-NWAH8
branch
2 times, most recently
from
March 28, 2026 19:39
ca34b7d to
b430f86
Compare
Use file-level exclusion instead of per-tool overrides so biome completely skips auto-generated types.ts files.
antosubash
force-pushed
the
claude/test-cli-module-creation-NWAH8
branch
from
March 28, 2026 19:40
b430f86 to
e136483
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the
NewProjectCommandto decouple project scaffolding from the CLI command execution, enabling standalone scaffolding without requiring a SimpleModule framework repository. It also introduces framework version resolution to use published NuGet/npm packages by default instead of local development versions.Key Changes
Execute()into a new public staticScaffoldProject()method, allowing programmatic project generation independent of CLI context.slnxfile check, allowing projects to be created outside the framework repositoryNuGetVersionResolverclass that determines the framework version via:--framework-versionCLI optionversion.jsonfrom framework repository (if available)HostTemplatesto use embedded resources instead of file system paths, enabling distribution without external template filesNugetConfig()andRootPackageJson()to use published packages when no solution context exists, and local packages when scaffolding within the framework repositoryProjectTemplatesnow acceptsframeworkVersionparameterHostTemplatesmethods converted to static, usingEmbeddedResourceReaderModuleTemplatesnow accepts nullableSolutionContextExecute()into three phases: version resolution, dry-run planning, and actual scaffolding with status feedbackNewProjectScaffoldTestsclass validates standalone scaffolding, package version resolution, and successfuldotnet buildof generated projectsNotable Implementation Details
NuGetVersionResolveruses a sharedHttpClientwith 5-second timeout to avoid socket exhaustionTemplates.Host.{path}with dots as path separatorsHostTemplates.RoutesRazor()now stripsAdditionalAssembliesreferences and properly closes the Router tagProgramCs()additionally stripsStorage.LocalandAddLocalStoragelines for standalone projects.editorconfigprovided when solution context unavailable