Skip to content

feat(cli): improve sm new project to scaffold a complete working app - #7

Merged
antosubash merged 1 commit into
mainfrom
claude/strange-heyrovsky
Mar 26, 2026
Merged

antosubash merged 1 commit into
mainfrom
claude/strange-heyrovsky

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Rewrites sm new project to generate a fully functional, runnable project from the template — instead of an empty skeleton.

What sm new project TestApp now creates:

  • Host project (Blazor SSR + Inertia.js) with all config files
  • Items starter module with API endpoint (GET /api/items), welcome landing page, and test projects
  • Frontend pipeline (Vite + React) with a built welcome page
  • NuGet package references to framework (local feed at nupkg/)
  • Root configs: slnx, package.json, biome.json, tsconfig, .editorconfig, nuget.config

The generated project works out of the box:

sm new project TestApp
cd TestApp && npm install && npm run build && dotnet build
dotnet run --project src/TestApp.Host

Changes

CLI (cli/SimpleModule.Cli/)

  • New HostTemplates class for Host project file generation
  • Root config templates (package.json, biome.json, tsconfig, etc.)
  • SolutionContext discovers Host/Api csproj dynamically
  • Welcome page (React + IViewEndpoint) with gradient landing design
  • Minimal CSS for Blazor layout without Tailwind compilation
  • New doctor checks: ModuleAttribute, ContractsIsolation, ViewEndpoint, PagesRegistry, ViteConfig, PackageJson, NpmWorkspace
  • sm new module improved with spinner, tree output, dry-run
  • sm new feature improved with React view scaffolding

Framework

  • Source generator dynamically resolves host assembly namespace (no more hardcoded SimpleModule.Host)
  • Framework projects packable as local NuGet packages (0.1.0-local)
  • Generator correctly packages as analyzer in analyzers/dotnet/cs/
  • Build targets gracefully skip when monorepo tools are missing
  • Baseline AddAuthentication/AddAuthorization registered in infrastructure
  • DefaultPublicMenuProvider registered (prevents crash without Dashboard module)
  • EnsureCreated fallback when no migrations exist (with logging)

Test plan

  • dotnet build — full solution (5 projects) compiles with 0 errors
  • dotnet test — 106 CLI tests + 2 module tests pass
  • dotnet run — app starts on HTTPS, SQLite tables auto-created
  • GET / — welcome page renders (gradient + nav bar, light & dark mode)
  • GET /api/items — returns [] (200 OK)
  • GET /swagger — Swagger UI shows Items API
  • GET /health/live — returns "Healthy"
  • npm install && npm run build — frontend builds (Items.pages.js + app.js)
  • Original template/SimpleModule.Host still builds with 0 errors
  • Dark mode toggle works
  • sm new project --dry-run shows planned files without writing

🤖 Generated with Claude Code

Rewrites `sm new project` to generate a fully functional project with:
- Host project (Blazor SSR + Inertia.js) from template
- Items starter module with API endpoint, welcome page, and tests
- All root config files (slnx, package.json, biome.json, tsconfig, etc.)
- NuGet package references to framework (local feed at nupkg/)
- Frontend build pipeline (Vite + React + module pages)

Key changes:
- Add HostTemplates class for Host project file generation
- Add root config templates (package.json, biome.json, tsconfig, etc.)
- Make SolutionContext discover Host/Api csproj dynamically
- Make framework projects packable as local NuGet packages
- Source generator dynamically resolves host assembly namespace
- Build targets gracefully skip when monorepo tools are missing
- Register baseline auth and DefaultPublicMenuProvider in framework
- Use EnsureCreated fallback when no migrations exist
- Add welcome page with gradient landing design and dark mode
- Add minimal CSS for Blazor layout without Tailwind compilation
- Add doctor checks: ModuleAttribute, ContractsIsolation, ViewEndpoint,
  PagesRegistry, ViteConfig, PackageJson, NpmWorkspace
- Improve sm new module with spinner, tree output, and dry-run
- Improve sm new feature with React view scaffolding
@antosubash
antosubash force-pushed the claude/strange-heyrovsky branch from 329368c to 925a7e1 Compare March 26, 2026 20:21
@antosubash
antosubash merged commit c5bcdb3 into main Mar 26, 2026
2 of 4 checks passed
@antosubash
antosubash deleted the claude/strange-heyrovsky branch March 26, 2026 21:40
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