Rename Project concept to Novel across the stack

Renames the domain concept from Project to Novel throughout the backend
(entities, DTOs, services, endpoints, ProjectAccessService/Permission,
ProjectId foreign keys), MCP server (tool names and routes), and the
React/Vite frontend (types, hooks, routes, components). Adds a new EF
Core migration (RenameProjectToNovel) using RenameTable/RenameColumn to
preserve existing data instead of dropping/recreating tables. Updates
CLAUDE.md's structure section to reference Novels/ instead of Projects/.
This commit is contained in:
James Wampler
2026-08-17 23:03:09 -07:00
parent 0ab4f568b5
commit 4313c8f206
95 changed files with 3192 additions and 1660 deletions
@@ -2,7 +2,7 @@ using System.Text.Json;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Novelly.Api.Agent;
using Novelly.Api.Projects;
using Novelly.Api.Novels;
namespace Novelly.Api.Tests;
@@ -12,7 +12,7 @@ public class NovelAgentServiceTests : ServiceTestFixture
private NovelAgentToolset _toolset = null!;
protected override void OnSetUp() =>
_toolset = new NovelAgentToolset(Projects, Characters, Arcs, Chapters, Beats, Tags, Questions, NullLogger<NovelAgentToolset>.Instance);
_toolset = new NovelAgentToolset(Novels, Characters, Arcs, Chapters, Beats, Tags, Questions, NullLogger<NovelAgentToolset>.Instance);
private NovelAgentService BuildAgent(ScriptedModelClient model) => new(
Db.Context,
@@ -25,11 +25,11 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task A_plain_reply_is_persisted_as_a_conversation()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([[new AgentTextBlock("Tell me about the ending.")]]);
var agent = BuildAgent(model);
var turn = await agent.SendMessageAsync(projectId, new SendAgentMessageRequest("Where do I start?"));
var turn = await agent.SendMessageAsync(novelId, new SendAgentMessageRequest("Where do I start?"));
Assert.That(turn.Content, Is.EqualTo("Tell me about the ending."));
@@ -44,9 +44,9 @@ public class NovelAgentServiceTests : ServiceTestFixture
}
[Test]
public async Task Tool_calls_are_executed_against_real_project_data()
public async Task Tool_calls_are_executed_against_real_novel_data()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([
[ToolUse("t1", "create_character", new { name = "Ines", role = "Protagonist" })],
@@ -54,9 +54,9 @@ public class NovelAgentServiceTests : ServiceTestFixture
]);
var turn = await BuildAgent(model).SendMessageAsync(
projectId, new SendAgentMessageRequest("Add a protagonist called Ines."));
novelId, new SendAgentMessageRequest("Add a protagonist called Ines."));
var characters = await Characters.ListAsync(projectId);
var characters = await Characters.ListAsync(novelId);
Assert.Multiple(() =>
{
@@ -71,7 +71,7 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task Every_tool_result_comes_back_in_a_single_user_turn()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([
[
@@ -81,10 +81,10 @@ public class NovelAgentServiceTests : ServiceTestFixture
[new AgentTextBlock("Both added.")]
]);
await BuildAgent(model).SendMessageAsync(projectId, new SendAgentMessageRequest("Add two characters."));
await BuildAgent(model).SendMessageAsync(novelId, new SendAgentMessageRequest("Add two characters."));
var resultTurn = model.Transcripts[1][^1];
var listed = await Characters.ListAsync(projectId);
var listed = await Characters.ListAsync(novelId);
Assert.Multiple(() =>
{
@@ -97,7 +97,7 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task A_failing_tool_is_reported_back_rather_than_thrown()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([
[ToolUse("t1", "update_character", new { character_id = Guid.NewGuid().ToString(), name = "Ines" })],
@@ -105,7 +105,7 @@ public class NovelAgentServiceTests : ServiceTestFixture
]);
var turn = await BuildAgent(model).SendMessageAsync(
projectId, new SendAgentMessageRequest("Rename her."));
novelId, new SendAgentMessageRequest("Rename her."));
var errorResult = model.Transcripts[1][^1].Content.OfType<AgentToolResultBlock>().Single();
@@ -120,14 +120,14 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task Unknown_tools_are_reported_without_breaking_the_loop()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([
[ToolUse("t1", "summon_muse", new { })],
[new AgentTextBlock("Sorry — I do not have that tool.")]
]);
await BuildAgent(model).SendMessageAsync(projectId, new SendAgentMessageRequest("Summon the muse."));
await BuildAgent(model).SendMessageAsync(novelId, new SendAgentMessageRequest("Summon the muse."));
var result = model.Transcripts[1][^1].Content.OfType<AgentToolResultBlock>().Single();
@@ -141,14 +141,14 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task The_loop_stops_at_the_iteration_ceiling()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient(
Enumerable.Repeat<IReadOnlyList<AgentContentBlock>>(
[ToolUse("t", "list_characters", new { })], 20).ToList());
var turn = await BuildAgent(model).SendMessageAsync(
projectId, new SendAgentMessageRequest("Keep going forever."));
novelId, new SendAgentMessageRequest("Keep going forever."));
Assert.Multiple(() =>
{
@@ -160,16 +160,16 @@ public class NovelAgentServiceTests : ServiceTestFixture
[Test]
public async Task Follow_up_messages_continue_the_same_conversation()
{
var projectId = (await Projects.CreateAsync(new CreateProjectRequest("The Salt Road"))).Id;
var novelId = (await Novels.CreateAsync(new CreateNovelRequest("The Salt Road"))).Id;
var model = new ScriptedModelClient([
[new AgentTextBlock("First answer.")],
[new AgentTextBlock("Second answer.")]
]);
var agent = BuildAgent(model);
var first = await agent.SendMessageAsync(projectId, new SendAgentMessageRequest("Question one."));
var first = await agent.SendMessageAsync(novelId, new SendAgentMessageRequest("Question one."));
var second = await agent.SendMessageAsync(
projectId, new SendAgentMessageRequest("Question two.", first.ConversationId));
novelId, new SendAgentMessageRequest("Question two.", first.ConversationId));
var conversation = (await agent.GetConversationAsync(first.ConversationId))!;