Reorganise by feature, rename to Novelly, add Aspire and a pre-push hook
The layered split into Domain/Application/Infrastructure/Api was forcing organisation by layer: adding one capability meant touching four projects and four folders that each held a slice of it. Those four projects are now one feature-organised Novelly.Api, where each folder — Projects, Characters, Chapters, Beats, Scenes, Tags, Agent — holds its entity, DTOs, service and endpoints together. Common/ holds what genuinely crosses features (the patch semantics, the two exception types, DraftStatus) and Data/ holds the DbContext and migrations. Six .NET projects become five: the three layer projects are gone, and Novelly.AppHost and Novelly.ServiceDefaults are new. - Namespaces move from NovelSoftware.* to Novelly.*, including the entity type names recorded in the EF model snapshots. The migration ids are untouched, so an existing novel.db still migrates cleanly — verified against a fresh file. - Aspire orchestration mirrors the mic-check setup: the AppHost starts the API on :5080 and the Vite dev server on :5173, and the API picks up OpenTelemetry, health checks and service discovery from ServiceDefaults. /health and /alive now answer in development. - A Husky pre-push hook runs scripts/ci/prepush.sh: build, test, then a web build. The scripts are plain bash so CI can run the same steps. - The MCP server's env var is now NOVELLY_API_URL. Verified beyond the build: 44 tests pass, the web client builds, the API was exercised over curl (project/chapter/beat/tag round trip, tag cross-reference, 503 on the agent without a key while conversation listing still returns 200), the MCP server was driven over stdio JSON-RPC (26 tools, errors still surface the API's own message rather than being flattened), and the AppHost was run to confirm both resources come up and Vite proxies /api through to the API. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S56bfZMGe1hnhpWP4CjjNw
This commit is contained in:
co-authored by
Claude Opus 5
parent
30e0c6926e
commit
725758ccd9
@@ -4,24 +4,28 @@ Guidance for Claude Code (claude.ai/code) in this repo.
|
||||
|
||||
## Project
|
||||
|
||||
Novel Software: software for planning and writing a novel. ASP.NET Core 10, C#, TypeScript, React. Chapter outlines, character dossiers, prose drafting, an embedded Claude agent, and an MCP server over the same API.
|
||||
Novelly: software for planning and writing a novel. ASP.NET Core 10, C#, TypeScript, React, .NET Aspire. Chapter outlines, character dossiers, prose drafting, an embedded Claude agent, and an MCP server over the same API.
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/NovelSoftware.Domain/` — entities and enums, no dependencies
|
||||
- `src/NovelSoftware.Application/` — services, DTOs, the agent tool-use loop
|
||||
- `src/NovelSoftware.Infrastructure/` — EF Core + SQLite, Anthropic SDK client
|
||||
- `src/NovelSoftware.Api/` — minimal API endpoints
|
||||
- `src/NovelSoftware.Mcp/` — MCP stdio server
|
||||
- `src/NovelSoftware.Web/` — React + Vite client
|
||||
- `src/Novelly.Api/` — the whole back end, organised by feature. One folder per feature holds its
|
||||
entity, DTOs, service and endpoints together: `Projects/`, `Characters/`, `Chapters/`, `Beats/`,
|
||||
`Scenes/`, `Tags/`, `Agent/`. `Common/` holds what genuinely crosses features; `Data/` holds the
|
||||
`DbContext` and EF migrations.
|
||||
- `src/Novelly.AppHost/` — .NET Aspire orchestration; run this to bring up the API and the web client
|
||||
- `src/Novelly.ServiceDefaults/` — shared Aspire wiring: OpenTelemetry, health checks, service discovery
|
||||
- `src/Novelly.Mcp/` — MCP stdio server
|
||||
- `src/Novelly.Web/` — React + Vite client
|
||||
- `tests/` — test suite
|
||||
- `docs/` — documentation
|
||||
- `scripts/ci/` — bash CI steps; `prepush.sh` is what the Husky pre-push hook runs
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use latest .NET + latest supported nuget packages for that version
|
||||
- Set `langVersion` to latest in all csproj files; enable nullable
|
||||
- Organize code by feature/area, not type
|
||||
- Organize code by feature/area, not layer or type. A new capability adds files to one feature folder
|
||||
rather than a row to each of an entity/DTO/service/endpoint folder
|
||||
- New features need unit tests covering logic as much as possible
|
||||
- Modified file: check missing test coverage, all tests pass
|
||||
|
||||
@@ -64,8 +68,10 @@ Novel Software: software for planning and writing a novel. ASP.NET Core 10, C#,
|
||||
|
||||
Build and tests passing is not the same as working. For anything touching an endpoint, the agent loop, or the MCP server, run it:
|
||||
|
||||
- API: `ASPNETCORE_URLS=http://localhost:5080 dotnet run --project src/NovelSoftware.Api`, then exercise the route with curl
|
||||
- Web: `cd src/NovelSoftware.Web && npm run dev` — proxies `/api` to :5080
|
||||
- Everything at once: `dotnet run --project src/Novelly.AppHost` — Aspire starts the API on :5080 and
|
||||
the Vite dev server on :5173, with the dashboard for logs and traces
|
||||
- API alone: `ASPNETCORE_URLS=http://localhost:5080 dotnet run --project src/Novelly.Api`, then exercise the route with curl
|
||||
- Web alone: `cd src/Novelly.Web && npm run dev` — proxies `/api` to :5080
|
||||
- MCP: build it, then drive it over stdio JSON-RPC (`initialize` → `notifications/initialized` → `tools/list` → `tools/call`)
|
||||
|
||||
Several real bugs here — SQLite refusing to ORDER BY a DateTimeOffset, the agent's model client throwing at construction and taking read-only endpoints down with it — passed the build and the test suite and only showed up when the app actually ran.
|
||||
@@ -83,4 +89,6 @@ Several real bugs here — SQLite refusing to ORDER BY a DateTimeOffset, the age
|
||||
|
||||
- Anthropic model id lives in `appsettings.json` under `Agent:Model`. Don't hardcode it.
|
||||
- API key comes from `ANTHROPIC_API_KEY` or `Agent:ApiKey` — never commit one. The app must stay fully usable without a key; only the agent endpoints require it.
|
||||
- EF migrations: `dotnet ef migrations add <Name> -p src/NovelSoftware.Infrastructure -s src/NovelSoftware.Api -o Persistence/Migrations`. The API migrates on boot.
|
||||
- EF migrations: `dotnet ef migrations add <Name> -p src/Novelly.Api -o Data/Migrations`. The API migrates on boot.
|
||||
- `git push` runs `scripts/ci/prepush.sh` through Husky: build, test, then a web build. Run `npm install`
|
||||
once at the repo root to install the hook.
|
||||
|
||||
Reference in New Issue
Block a user