Skip to the content

Capsid menu

app/routes/book.authorship.ts

17 lines and 1 functions in DrDustinEdwards/carrel, at commit d5d5e82 on 2026-10-24. This file on GitHub.

Functions

The functions of book.authorship.ts
FunctionLinesComplexityCoveredCRAPMutation
loader9 to 201100%OkCRAP 1No data: mutation testing has not run on this repo yet

Imports

It imports app/lib/books.server.ts, app/lib/context.ts. No module of this repo imports it.

Source

// The authorship record as a readable report (design decision 11): who changed what, person or AI
// client, with the words each change added and removed. Anyone who can read the book can read it.

import { authorshipRecord, authorshipReport, requireBookProject } from "~/lib/books.server";
import { getEnv, getViewer } from "~/lib/context";

import type { Route } from "./+types/book.authorship";

export async function loader({ params, context }: Route.LoaderArgs) {
  const env = getEnv(context);
  const project = await requireBookProject(env.DB, getViewer(context), params.project, "read");
  const report = authorshipReport(project, await authorshipRecord(env.DB, project));
  return new Response(report, {
    headers: {
      "Content-Type": "text/markdown; charset=utf-8",
      "Content-Disposition": `attachment; filename="${project.book}-authorship.md"`,
      "Cache-Control": "no-store",
    },
  });
}