Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
content="CodeXray reads a repository’s written and enforced architecture decisions, measures how well the code keeps them over time, and ranks the exceptions worth fixing, with evidence for every claim."
/>
<meta name="theme-color" content="#f2f3ef" />
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
<title>CodeXray</title>
</head>
<body>
Expand Down
16 changes: 16 additions & 0 deletions web/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/src/assets/fonts/Supreme-Variable.woff2
Binary file not shown.
56 changes: 35 additions & 21 deletions web/src/components/cx/primitives.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
import type { ReactNode } from "react";
import { type ReactNode, useId } from "react";
import { STATUS } from "../../cx/meta";
import type { Status } from "../../cx/types";
import { cn } from "./cn";

/**
* The CodeXray mark: an X whose rising stroke is cut where the falling one crosses it. Drawn in
* the current text colour so it follows the theme.
*/
export function Logo({ className }: { className?: string }) {
// 3×3 dependency grid: upper cells with the grain, one lower cell against it.
const cells = [0, 1, 1, 0, 0, 1, 2, 0, 0];
const id = useId();
return (
<span
aria-hidden
className={cn(
"grid size-5 grid-cols-3 gap-px rounded-[3px] bg-foreground p-[3px]",
className,
)}
>
{cells.map((c, i) => (
<span
key={i}
className={cn(
"rounded-[1px]",
c === 1 && "bg-primary-foreground",
c === 2 && "bg-accent",
c === 0 && "bg-primary-foreground/15",
)}
/>
))}
<svg viewBox="0 0 32 32" aria-hidden className={cn("size-[22px] shrink-0", className)}>
<defs>
<mask id={id} maskUnits="userSpaceOnUse">
<rect width="32" height="32" fill="white" />
<path d="M5 5 27 27" stroke="black" strokeWidth="9.2" />
</mask>
</defs>
<g fill="none" stroke="currentColor" strokeWidth="4.6" strokeLinecap="butt">
<g mask={`url(#${id})`}>
<path d="M26.2 4.6 14.4 16.4" />
<path d="M17.6 15.6 5.8 27.4" />
</g>
<path d="M5.4 5.4 26.6 26.6" />
</g>
</svg>
);
}

/** The mark and the name together, as on the brand image. */
export function Wordmark({ className }: { className?: string }) {
return (
<span className={cn("inline-flex items-center gap-3", className)}>
<Logo />
<span
className="text-[17px] leading-none tracking-[-0.02em]"
style={{ fontFamily: '"Supreme", var(--font-sans)', fontWeight: 650 }}
>
CodeXray
</span>
</span>
);
}
Expand Down
11 changes: 4 additions & 7 deletions web/src/components/cx/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { repoPath } from "../../cx/address";
import type { RepoSummary } from "../../cx/types";
import { loadRepoSummaries } from "../../data/repo";
import { FOCUS, cn } from "./cn";
import { Logo } from "./primitives";
import { Wordmark } from "./primitives";
import { useLoaded } from "./use-page";

const shortName = (name: string) => name.slice(name.lastIndexOf("/") + 1);
Expand All @@ -22,13 +22,10 @@ export function SiteHeader({ current }: { current?: string }) {
<div className="mx-auto flex min-h-12 max-w-[1320px] flex-wrap items-center gap-x-6 gap-y-1 px-4 py-2 md:flex-nowrap md:py-0 md:px-6">
<Link
to="/"
className={cn(
"flex shrink-0 items-center gap-2 rounded-sm font-semibold tracking-tight",
FOCUS,
)}
className={cn("flex shrink-0 items-center rounded-sm", FOCUS)}
aria-label="CodeXray, all reports"
>
<Logo />
CodeXray
<Wordmark />
</Link>
<nav
aria-label="Repositories"
Expand Down
68 changes: 8 additions & 60 deletions web/src/routes/Findings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { ArrowRight, ChevronRight, EyeOff } from "lucide-react";
import { Link, useSearchParams } from "react-router";
import { FOCUS, cn } from "../components/cx/cn";
import { FindingCompactRow, FindingListRow } from "../components/cx/finding-list-row";
import { Eyebrow, SectionHead } from "../components/cx/primitives";
import { SectionHead } from "../components/cx/primitives";
import { useTitle } from "../components/cx/use-page";
import { repoPath } from "../cx/address";
import { BATCH_LOOPS_NOTE, fmt } from "../cx/meta";
import type { Batch, Finding } from "../cx/types";
import { fmt } from "../cx/meta";
import type { Finding } from "../cx/types";
import { useRepo } from "./RepoLayout";

/** Findings below the top 10 shown before "Show all". */
Expand Down Expand Up @@ -46,28 +46,15 @@ export function Findings() {
const restAll = hideLegit ? repo.supporting.filter((f) => !isLegitimate(f)) : repo.supporting;
const rest = showAll ? restAll : restAll.slice(0, SUPPORTING_SHOWN);
const legitCount = [...repo.findings, ...repo.supporting].filter(isLegitimate).length;
const rankedCount = repo.findings.length + repo.supporting.length;

return (
<div className="flex flex-col gap-12">
<div className="flex max-w-3xl flex-col gap-2">
<div className="flex flex-col gap-10">
<section className="flex flex-col gap-4" aria-labelledby="top-ten">
<h2 className="text-3xl font-semibold tracking-tight">Findings</h2>
<p className="leading-relaxed text-muted-foreground">
{rankedCount === 1 ? "1 finding is ranked" : `${fmt(rankedCount)} findings are ranked`},
in an order computed from stored numbers with no AI model.
</p>
</div>

<BatchStrip batch={repo.batch} />

<section className="flex flex-col gap-3" aria-labelledby="top-ten">
<div className="flex flex-col gap-3 md:flex-row md:items-end md:justify-between">
<div className="flex flex-col gap-1">
<Eyebrow>Top {repo.findings.length} · in stored rank order</Eyebrow>
<h2 id="top-ten" className="text-xl font-semibold tracking-tight">
What to fix first
</h2>
</div>
<h3 id="top-ten" className="text-xl font-semibold tracking-tight">
What to fix first
</h3>
<div className="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
<button
type="button"
Expand Down Expand Up @@ -191,42 +178,3 @@ export function Findings() {
</div>
);
}

function BatchStrip({ batch }: { batch: Batch | null }) {
return (
<div className="flex flex-wrap items-center gap-x-8 gap-y-2 rounded-lg bg-ink px-5 py-3 text-ink-foreground">
<p className="font-mono text-[11px] tracking-[0.14em] uppercase opacity-60">
Simulated fix batch
</p>
{batch ? (
<>
<dl className="flex flex-wrap gap-x-6 gap-y-1 font-mono">
{(
[
["loops", `${fmt(batch.loopsBefore)} → ${fmt(batch.loopsAfter)}`, BATCH_LOOPS_NOTE],
["links cut", fmt(batch.linksRemoved), undefined],
["links added", fmt(batch.linksAdded), undefined],
["applied", fmt(batch.fixesApplied), undefined],
["skipped", fmt(batch.fixesSkipped), undefined],
...(batch.newExceptions.length > 0
? ([["new exceptions", fmt(batch.newExceptions.length), undefined]] as const)
: []),
] as const
).map(([k, v, hint]) => (
<div key={k} className="flex items-baseline gap-2 whitespace-nowrap" title={hint}>
<dt className="text-[11px] opacity-60">{k}</dt>
<dd className="text-base font-semibold tabular">{v}</dd>
</div>
))}
</dl>
<p className="text-xs leading-relaxed opacity-70 lg:ml-auto lg:max-w-xs">
Every cheap-loop fix that simulated cleanly, applied together on a copy of the map, not
to the code.
</p>
</>
) : (
<p className="text-sm font-semibold">Not simulated in this run.</p>
)}
</div>
);
}
30 changes: 5 additions & 25 deletions web/src/routes/RepoLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,19 @@ export function RepoLayout() {
}

function RepoBody({ repo, journeys }: { repo: RepoBundle; journeys: JourneyBundle | null }) {
const modules = repo.modules.filter((m) => m.presentAtEnd).length;
// Two names and a count keep the line short; the full list is the line's tooltip.
const langs =
repo.languages.length > 2
? `${repo.languages.slice(0, 2).join(" + ")} +${repo.languages.length - 2}`
: repo.languages.join(" + ");
const facts = [
repo.host ? repo.host.replace(/^[a-z]+:\/\//i, "").replace(/\/+$/, "") : "private repository",
langs || null,
`${fmt(repo.prodLoc)} production lines`,
`${fmt(modules)} ${modules === 1 ? "module" : "modules"}`,
].filter(Boolean);
const context: RepoContext = { repo, journeys };
return (
<>
<div className="border-b">
<div className="mx-auto flex max-w-[1320px] flex-col gap-4 px-4 pt-6 md:px-6">
<div className="flex flex-col gap-3 md:flex-row md:items-end md:justify-between">
<div className="flex min-w-0 flex-col gap-1.5">
<h1 className="text-2xl font-semibold tracking-tight break-words md:text-3xl">
{repo.name}
</h1>
<p
className="flex flex-wrap gap-x-1.5 font-mono text-xs text-muted-foreground"
title={repo.languages.join(", ")}
<h1
className="text-2xl font-semibold tracking-tight break-words md:text-3xl"
title={repo.name}
>
{facts.map((f, i) => (
<span key={i} className="whitespace-nowrap">
{i > 0 && "· "}
{f}
</span>
))}
</p>
{repo.name.slice(repo.name.lastIndexOf("/") + 1)}
</h1>
</div>
<dl className="flex shrink-0 flex-wrap gap-x-5 gap-y-1 font-mono text-[11px] text-muted-foreground">
<div className="flex gap-1.5">
Expand Down
8 changes: 8 additions & 0 deletions web/src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
@import "tailwindcss";

/* The wordmark face, used for the "CodeXray" name next to the mark and nowhere else. */
@font-face {
font-family: "Supreme";
src: url("../assets/fonts/Supreme-Variable.woff2") format("woff2");
font-weight: 100 800;
font-display: swap;
}

@theme inline {
--font-sans: "Instrument Sans Variable", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
--font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, monospace;
Expand Down