Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(docs): ui changes

Sidwebworks5e85861076f6
diff --git a/.claude/skills/carbon-docs/SKILL.md b/.claude/skills/carbon-docs/SKILL.md
index 410767c431..30925de6ac 100644
--- a/.claude/skills/carbon-docs/SKILL.md
+++ b/.claude/skills/carbon-docs/SKILL.md
@@ -136,7 +136,22 @@ Each `##` heading becomes a sidebar rail entry — so structure chapters as 3–
(`info/note`→NOTE/blue, `warn/warning/error`→HEADS UP/amber, `success/tip`→GOOD TO KNOW/green). Note this
is a **different Callout API** than the Guides one (type vs tone+badge).
- `<Cards><Card title href icon?>…</Card></Cards>` — link-card grid (cross-surface navigation).
- - `<EnvVars><EnvVar name type? default? required?>…</EnvVar></EnvVars>` — field/parameter rows.
+ - `<EnvVars><EnvVar name type? default? required?>…</EnvVar></EnvVars>` — field/parameter rows. The env-var
+ page uses these; for an entity's **field reference** prefer `<FieldTable>` (below).
+ - `<FieldTable><Field name type? required?>desc</Field></FieldTable>`
+ (`components/editorial/field-table.tsx`) — the accordion field/parameter reference, the warm-paper take on
+ Fumadocs' TypeTable. Use it for a `| Field | Type | Description |`-shaped table (item/job/line fields,
+ routing, work-center, reorder/shelf-life policy fields, integration settings). `type` = the type token
+ (omit when the table has no type column); `required` only when the source marks it so; the child is the
+ description as **MDX** (so inline `` `code` ``, *italics*, `<Term>` render — that's why it's children, not a
+ `type={{}}` prop). Registered in **both** `mdx.tsx` and `editorial/mdx.tsx`.
+ - `<StatusFlow><Status name accent? branch? terminal?>meaning</Status></StatusFlow>`
+ (`components/editorial/status-flow.tsx`) — an **interactive** lifecycle widget (selectable pills → a detail
+ `Callout` showing the meaning) that replaces a linear `| Status | Meaning |` table. Children in source
+ (lifecycle) order; meanings are MDX. Flags: `accent` = the single pivotal milestone (≤1, optional);
+ `branch` = a temporary returnable hold (Paused, On Hold, Needs Approval); `terminal` = an off-path exit
+ (Cancelled, Voided, Lost, Expired). Use it ONLY for a **linear** lifecycle — a 2-axis comparison matrix
+ (e.g. invoices sales-vs-purchase) or a small enum list stays a markdown table.
- `<PlanBadge plan="Business" />` — flags a paid-tier feature. Whole-page gate → set `plan: Business` in
frontmatter (renders inline with the page title); section gate → drop `<PlanBadge>` in-body. Gated
features = `packages/ee/src/plan.ts` (Business/Partner). **Don't** badge free ones (email, exchange-rates).
diff --git a/docs/app/docs/[[...slug]]/page.tsx b/docs/app/docs/[[...slug]]/page.tsx
index d65dccce6d..5e854a7b96 100644
--- a/docs/app/docs/[[...slug]]/page.tsx
+++ b/docs/app/docs/[[...slug]]/page.tsx
@@ -67,7 +67,7 @@ export default async function Page(props: Params) {
})}
/>
</div>
- <DocsFooter url={page.url} />
+ <DocsFooter url={page.url} editPath={`docs/content/docs/${page.path}`} />
</article>
);
}
diff --git a/docs/app/guides/[chapter]/page.tsx b/docs/app/guides/[chapter]/page.tsx
index cbea90ce2f..85d552d130 100644
--- a/docs/app/guides/[chapter]/page.tsx
+++ b/docs/app/guides/[chapter]/page.tsx
@@ -93,6 +93,7 @@ export default async function GuidePage(props: Params) {
flowName: p.data.flowName,
flowIndex: p.data.flowIndex,
readingTime: readingMinutes(p.data.structuredData),
+ editPath: `docs/content/guides/${p.path}`,
items: p.data.toc
.filter((t) => t.depth === 2)
.map((t) => ({
diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx
index e52c65d030..16347d3d65 100644
--- a/docs/app/layout.tsx
+++ b/docs/app/layout.tsx
@@ -4,6 +4,7 @@ import { RootProvider } from "fumadocs-ui/provider/next";
import type { Metadata, Viewport } from "next";
import { DM_Sans, Fira_Code } from "next/font/google";
import type { ReactNode } from "react";
+import { ScrollToTop } from "@/components/scroll-to-top";
import { SiteFooter } from "@/components/site-footer";
import { ogImage, SEO, SITE } from "@/lib/seo";
@@ -160,6 +161,7 @@ export default function Layout({ children }: { children: ReactNode }) {
/>
</head>
<body className="flex min-h-screen flex-col antialiased">
+ <ScrollToTop />
{/* Light-only — the editorial design is a warm paper theme, no dark mode */}
<RootProvider theme={{ enabled: false }}>{children}</RootProvider>
<SiteFooter />
diff --git a/docs/app/og/route.tsx b/docs/app/og/route.tsx
index 3c850c526a..e5bbfc3dab 100644
--- a/docs/app/og/route.tsx
+++ b/docs/app/og/route.tsx
@@ -37,7 +37,7 @@ export async function GET(request: Request) {
loadDmSans(400, glyphs)
]);
- const titleSize = title.length > 70 ? 48 : title.length > 44 ? 56 : 66;
+ const titleSize = title.length > 70 ? 54 : title.length > 44 ? 62 : 74;
return new ImageResponse(
<div
@@ -49,7 +49,7 @@ export async function GET(request: Request) {
width: "100%",
height: "100%",
padding: "76px 80px",
- background: "#FBFBF9",
+ background: "#FFFFFF",
fontFamily: "DM Sans"
}}
>
@@ -84,7 +84,7 @@ export async function GET(request: Request) {
{/* Brand lockup */}
<div style={{ display: "flex", alignItems: "center" }}>
- <svg width={28} height={32} viewBox="0 0 424 480" fill="none">
+ <svg width={44} height={50} viewBox="0 0 424 480" fill="none">
<path
fillRule="evenodd"
clipRule="evenodd"
@@ -94,8 +94,8 @@ export async function GET(request: Request) {
</svg>
<div
style={{
- marginLeft: 14,
- fontSize: 28,
+ marginLeft: 18,
+ fontSize: 40,
fontWeight: 600,
color: "#262323"
}}
@@ -108,7 +108,7 @@ export async function GET(request: Request) {
<div style={{ display: "flex", flexDirection: "column" }}>
<div
style={{
- fontSize: 21,
+ fontSize: 24,
fontWeight: 600,
letterSpacing: 4,
color: "#1E84B0"
@@ -139,7 +139,7 @@ export async function GET(request: Request) {
}}
>
<div
- style={{ fontSize: 22, fontWeight: 400, color: "rgba(38,35,35,0.5)" }}
+ style={{ fontSize: 25, fontWeight: 400, color: "rgba(38,35,35,0.5)" }}
>
carbon.ms
</div>
diff --git a/docs/app/reference.css b/docs/app/reference.css
index de27e9ee84..1260e49a00 100644
--- a/docs/app/reference.css
+++ b/docs/app/reference.css
@@ -119,6 +119,26 @@
color: var(--shiki-light);
}
+/* Fenced code → Fumadocs CodeBlock (`pre` override in components/mdx.tsx), restyled to
+ * the warm-paper dark panel. Shiki tokens are tuned for a dark bg, so we use a warm
+ * near-black (matching the old API panel) and tint the header + copy chrome through the
+ * fd-* tokens the component already reads. */
+figure.ed-codeblock {
+ margin-block: 18px;
+ background-color: #1b1b1a;
+ border-color: #2a2a28;
+ border-radius: 12px;
+ --color-fd-muted-foreground: #9a9a96;
+ --color-fd-border: #2a2a28;
+ --color-fd-accent-foreground: #ffffff;
+}
+/* The header's language label → a quiet mono tag. */
+figure.ed-codeblock figcaption {
+ font-family: var(--font-mono);
+ font-size: 11.5px;
+ letter-spacing: 0.03em;
+}
+
/* ── Tables → rounded warm frame, cream header, hairline rows ───────────────── */
.prose :where(table):not(:where([class~="not-prose"] *)) {
border: 1px solid #e7e7e3;
diff --git a/docs/components/api/page-footer.tsx b/docs/components/api/page-footer.tsx
index c03494103f..d4269fd90a 100644
--- a/docs/components/api/page-footer.tsx
+++ b/docs/components/api/page-footer.tsx
@@ -1,6 +1,7 @@
import { findNeighbour } from "fumadocs-core/page-tree";
import Link from "next/link";
import type { ReactNode } from "react";
+import { EditOnGitHub } from "@/components/edit-on-github";
import { source } from "@/lib/source";
import { PageFeedback } from "./page-feedback";
@@ -53,11 +54,22 @@ function Card({ dir, link }: { dir: "prev" | "next"; link: NavLink }) {
);
}
-/** Page footer: feedback prompt, then optional prev / next cards. */
-export function ContentFooter({ prev, next }: { prev?: NavLink; next?: NavLink }) {
+/** Page footer: feedback prompt + edit link, then optional prev / next cards. */
+export function ContentFooter({
+ prev,
+ next,
+ editPath,
+}: {
+ prev?: NavLink;
+ next?: NavLink;
+ editPath?: string;
+}) {
return (
<footer className="mt-[56px] border-t border-[#E7E7E3] pt-[24px]">
- <PageFeedback />
+ <div className="flex flex-wrap items-center justify-between gap-x-[24px] gap-y-[12px]">
+ <PageFeedback />
+ {editPath && <EditOnGitHub path={editPath} />}
+ </div>
{(prev || next) && (
<nav className="mt-[22px] grid grid-cols-1 gap-[12px] sm:grid-cols-2">
<div>{prev && <Card dir="prev" link={prev} />}</div>
@@ -69,12 +81,13 @@ export function ContentFooter({ prev, next }: { prev?: NavLink; next?: NavLink }
}
/** ContentFooter with prev/next derived from the Fumadocs page tree (Reference pages). */
-export function DocsFooter({ url }: { url: string }) {
+export function DocsFooter({ url, editPath }: { url: string; editPath?: string }) {
const { previous, next } = findNeighbour(source.getPageTree(), url);
return (
<ContentFooter
prev={previous ? { label: text(previous.name), url: previous.url } : undefined}
next={next ? { label: text(next.name), url: next.url } : undefined}
+ editPath={editPath}
/>
);
}
diff --git a/docs/components/edit-on-github.tsx b/docs/components/edit-on-github.tsx
new file mode 100644
index 0000000000..565bd24d73
--- /dev/null
+++ b/docs/components/edit-on-github.tsx
@@ -0,0 +1,44 @@
+/* "Edit on GitHub" footer link. `path` is the file's path relative to the repo root
+ * (e.g. "docs/content/docs/reference/items.mdx"); the repo + branch live here so the
+ * source of the link is in one place. Plain (no hooks) so it renders in both the
+ * server Reference footer and the client Guide footer. */
+
+const REPO = "https://github.com/crbnos/carbon";
+const BRANCH = "main";
+
+/** GitHub edit URL for a repo-relative file path. */
+export function githubEditUrl(repoRelativePath: string): string {
+ return `${REPO}/edit/${BRANCH}/${repoRelativePath}`;
+}
+
+function GitHubMark() {
+ return (
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" className="shrink-0">
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z" />
+ </svg>
+ );
+}
+
+export function EditOnGitHub({
+ path,
+ variant = "docs",
+}: {
+ path: string;
+ variant?: "docs" | "editorial";
+}) {
+ return (
+ <a
+ href={githubEditUrl(path)}
+ target="_blank"
+ rel="noreferrer"
+ className={`inline-flex items-center gap-[7px] text-[13.5px] font-[500] no-underline transition-colors ${
+ variant === "editorial"
+ ? "text-ink-faint hover:text-[#262323]"
+ : "text-[rgba(38,35,35,0.6)] hover:text-[#1E84B0]"
+ }`}
+ >
+ <GitHubMark />
+ Edit on GitHub
+ </a>
+ );
+}
diff --git a/docs/components/editorial/glossary.tsx b/docs/components/editorial/glossary.tsx
new file mode 100644
index 0000000000..067f308068
--- /dev/null
+++ b/docs/components/editorial/glossary.tsx
@@ -0,0 +1,60 @@
+import Link from "next/link";
+import { glossaryEntries, termSlug } from "@/lib/glossary";
+
+/**
+ * Glossary — the whole `lib/glossary.ts` rendered as one reference page, in the
+ * same hairline "environment list" language as <EnvVars>. Sourced directly from the
+ * glossary object so the inline <Term> popovers, this page, and the search index can
+ * never drift: add a term once in lib/glossary.ts and it shows up everywhere.
+ *
+ * Entries are deduped (aliases share one term) and grouped by first letter for
+ * scannability; "8D" and any other digit-leading term fall under "#". Each row carries
+ * an anchor id (termSlug) so a search hit can deep-link straight to the term.
+ */
+export function Glossary() {
+ const entries = glossaryEntries();
+
+ // Group into alphabetical sections (digits → "#").
+ const groups = new Map<string, typeof entries>();
+ for (const entry of entries) {
+ const first = entry.term[0].toUpperCase();
+ const letter = /[A-Z]/.test(first) ? first : "#";
+ if (!groups.has(letter)) groups.set(letter, []);
+ groups.get(letter)!.push(entry);
+ }
+
+ return (
+ <div className="my-[28px]">
+ {[...groups.entries()].map(([letter, items]) => (
+ <section key={letter} className="mb-[28px]">
+ <h2
+ id={`letter-${letter.toLowerCase()}`}
+ className="!mt-0 !mb-[6px] scroll-mt-[88px] !border-0 font-[family-name:var(--font-mono)] !text-[12px] !font-[600] uppercase tracking-[0.08em] !text-[rgba(38,35,35,0.4)]"
+ >
+ {letter}
+ </h2>
+ <div className="divide-y divide-[#E7E7E3] border-y border-[#E7E7E3]">
+ {items.map((entry) => (
+ <div key={entry.term} id={termSlug(entry.term)} className="scroll-mt-[88px] py-[15px]">
+ <div className="flex flex-wrap items-baseline justify-between gap-x-[12px] gap-y-[3px]">
+ <span className="text-[15px] font-[560] text-[#262323]">{entry.term}</span>
+ {entry.href && (
+ <Link
+ href={entry.href}
+ className="shrink-0 text-[12.5px] font-[500] text-[#1E84B0] no-underline hover:text-[#0C6E96]"
+ >
+ Learn more <span aria-hidden>→</span>
+ </Link>
+ )}
+ </div>
+ <p className="m-0 mt-[5px] text-[14px] leading-[155%] text-[rgba(38,35,35,0.66)]">
+ {entry.definition}
+ </p>
+ </div>
+ ))}
+ </div>
+ </section>
+ ))}
+ </div>
+ );
+}
diff --git a/docs/components/editorial/guide-context.tsx b/docs/components/editorial/guide-context.tsx
index c831ba9c78..dda5bc7f50 100644
--- a/docs/components/editorial/guide-context.tsx
+++ b/docs/components/editorial/guide-context.tsx
@@ -37,6 +37,8 @@ export type GuideChapter = {
flowName: string;
flowIndex: number;
readingTime: number;
+ /** Repo-relative path to the chapter's source MDX, for the "Edit on GitHub" link. */
+ editPath: string;
items: GuideItem[];
};
diff --git a/docs/components/editorial/how-to-layout.tsx b/docs/components/editorial/how-to-layout.tsx
index ff59e149ec..6838c14fc6 100644
--- a/docs/components/editorial/how-to-layout.tsx
+++ b/docs/components/editorial/how-to-layout.tsx
@@ -2,6 +2,7 @@
import type { ReactNode } from "react";
import { PageFeedback } from "@/components/api/page-feedback";
+import { EditOnGitHub } from "@/components/edit-on-github";
import { NavScrollChevron } from "@/components/nav-scroll-chevron";
import { ReadingProgress } from "@/components/reading-progress";
import { chaptersInFlow, useGuide } from "./guide-context";
@@ -161,9 +162,12 @@ export function HowToLayout({ bodies }: { bodies: ReactNode[] }) {
{/* MDX body for the active chapter */}
{bodies[active.chapter]}
- {/* Footer — feedback + within-flow prev/next, matching the docs pages. */}
+ {/* Footer — feedback + edit link, then within-flow prev/next, matching the docs pages. */}
<footer className="mt-[64px] border-t border-[rgba(38,35,35,0.12)] pt-[26px]">
- <PageFeedback key={active.chapter} variant="editorial" />
+ <div className="flex flex-wrap items-center justify-between gap-x-[24px] gap-y-[12px]">
+ <PageFeedback key={active.chapter} variant="editorial" />
+ <EditOnGitHub path={currentChapter.editPath} variant="editorial" />
+ </div>
{(prevInFlow || nextInFlow) && (
<nav className="mt-[22px] grid grid-cols-1 gap-[12px] sm:grid-cols-2">
<div>
diff --git a/docs/components/editorial/term.tsx b/docs/components/editorial/term.tsx
index faa6ba6d70..af6ba39fe2 100644
--- a/docs/components/editorial/term.tsx
+++ b/docs/components/editorial/term.tsx
@@ -14,7 +14,6 @@
*/
import * as Popover from "@radix-ui/react-popover";
import Link from "next/link";
-import { usePathname } from "next/navigation";
import type { ReactNode } from "react";
import { glossary } from "@/lib/glossary";
@@ -27,17 +26,11 @@ function slugify(text: string) {
}
export function Term({ id, children }: { id?: string; children: ReactNode }) {
- const pathname = usePathname();
const key = id ?? (typeof children === "string" ? slugify(children) : "");
const entry = glossary[key];
if (!entry) return <>{children}</>;
- // Hide "Learn more" when it points at the page you're already on — a link back to
- // here is noise. Compare path only (ignore hash + trailing slash).
- const hrefPath = entry.href?.split("#")[0].replace(/\/$/, "");
- const showLearnMore = !!hrefPath && hrefPath !== (pathname ?? "").replace(/\/$/, "");
-
return (
<Popover.Root>
<Popover.Trigger asChild>
@@ -60,15 +53,17 @@ export function Term({ id, children }: { id?: string; children: ReactNode }) {
<div className="mt-[5px] text-[13px] leading-[1.55] text-[rgba(38,35,35,0.72)]">
{entry.definition}
</div>
- {showLearnMore && (
+ {entry.href && (
<div className="mt-[11px] border-t border-[#EFEFEB] pt-[10px]">
- <Link
- href={entry.href}
- className="inline-flex items-center gap-[4px] text-[13px] font-[500] text-[#1E84B0] no-underline hover:text-[#0C6E96]"
- >
- Learn more
- <span aria-hidden>→</span>
- </Link>
+ <Popover.Close asChild>
+ <Link
+ href={entry.href}
+ className="inline-flex items-center gap-[4px] text-[13px] font-[500] text-[#1E84B0] no-underline hover:text-[#0C6E96]"
+ >
+ Learn more
+ <span aria-hidden>→</span>
+ </Link>
+ </Popover.Close>
</div>
)}
<Popover.Arrow width={12} height={6} className="fill-white" />
diff --git a/docs/components/scroll-to-top.tsx b/docs/components/scroll-to-top.tsx
new file mode 100644
index 0000000000..51bb170cc3
--- /dev/null
+++ b/docs/components/scroll-to-top.tsx
@@ -0,0 +1,42 @@
+"use client";
+
+import { usePathname } from "next/navigation";
+import { useEffect, useRef } from "react";
+
+/**
+ * Reset window scroll to the top on every forward route change.
+ *
+ * Next's App Router scroll-to-top is suppressed by the global
+ * `html { scroll-behavior: smooth }` (app/global.css) — the Guide relies on that
+ * rule for its anchor glides, so we restore the cross-page reset here instead of
+ * dropping it. Pointer-driven sidebar/nav clicks now land at the top of the new
+ * page.
+ *
+ * - Hash links (`/docs/x#section`) are left alone so anchors land on their target.
+ * - Back/forward keeps the browser's restored position (popstate guard), so
+ * returning to a page doesn't yank you back to the top.
+ * - In-page TOC clicks only change the hash, not the pathname, so they never fire.
+ */
+export function ScrollToTop() {
+ const pathname = usePathname();
+ const poppedRef = useRef(false);
+
+ useEffect(() => {
+ const onPopState = () => {
+ poppedRef.current = true;
+ };
+ window.addEventListener("popstate", onPopState);
+ return () => window.removeEventListener("popstate", onPopState);
+ }, []);
+
+ useEffect(() => {
+ if (poppedRef.current) {
+ poppedRef.current = false;
+ return;
+ }
+ if (window.location.hash) return;
+ window.scrollTo({ top: 0, left: 0, behavior: "auto" });
+ }, [pathname]);
+
+ return null;
+}
diff --git a/docs/content/docs/glossary.mdx b/docs/content/docs/glossary.mdx
new file mode 100644
index 0000000000..8196da69f6
--- /dev/null
+++ b/docs/content/docs/glossary.mdx
@@ -0,0 +1,8 @@
+---
+title: Glossary
+description: Every Carbon term, defined and linked — the manufacturing and accounting vocabulary the rest of the docs lean on.
+---
+
+Carbon names things precisely, and a few names are counterintuitive: a <Term>method</Term> is a bill of materials, <Term id="wip">work in process</Term> is a ledger balance rather than a table, and payment on an <Term>invoice</Term> is a field, not its own record. This page lists every term used across Carbon, each with the same one-line definition that powers the inline popovers — follow **Learn more** for the full story.
+
+<Glossary />
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index 5352b2e3f5..b18b7e2101 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -1,3 +1,10 @@
{
- "pages": ["index", "platform", "reference", "integrations", "building"]
+ "pages": [
+ "index",
+ "glossary",
+ "platform",
+ "reference",
+ "building",
+ "integrations"
+ ]
}
diff --git a/docs/lib/glossary.ts b/docs/lib/glossary.ts
index 06c039e7bb..0d9aae8706 100644
--- a/docs/lib/glossary.ts
+++ b/docs/lib/glossary.ts
@@ -5,10 +5,12 @@
* <Term>purchase to order</Term> — slugifies the text to find the entry
* <Term id="purchase-to-order">bought</Term> — explicit key when display text differs
*
- * Every definition is grounded in real Carbon source/migrations, not ERP-generic
- * prose. `href` (optional) points the "Learn more" link at the page that tells the
- * fuller story; omit it for terms with no dedicated page yet (popover still shows the
- * definition). Enum values verified:
+ * Definitions are deliberately short: one crisp, grounded sentence to identify the
+ * term — the full story lives behind the "Learn more" link. `href` (optional) points
+ * that link at the exact section that explains the term, not just the page top; omit
+ * it for terms with no home yet (popover still shows the definition). Anchors are
+ * grounded against real headings in docs/content — fix them if a heading is renamed.
+ * Enum values verified:
* methodType → "Make to Order" | "Purchase to Order" | "Pull from Inventory"
* (packages/database/.../20260321143847_method-type-migration.sql)
* itemReplenishmentSystem → "Buy" | "Make" | "Buy and Make"
@@ -17,94 +19,117 @@
export type GlossaryEntry = {
/** Canonical name shown as the popover heading. */
term: string;
- /** One or two grounded sentences. */
+ /** One crisp, grounded sentence. */
definition: string;
- /** Optional internal route for the "Learn more" link. */
+ /** Optional internal route + section anchor for the "Learn more" link. */
href?: string;
};
+/** Slugify a term name into a stable anchor id (used for glossary row ids + search
+ * deep-links). Mirrors the slug rule the <Term> component uses. */
+export function termSlug(term: string): string {
+ return term
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, "-")
+ .replace(/^-+|-+$/g, "");
+}
+
+/** The glossary as a deduped, alphabetically-sorted list. Several slugs are aliases
+ * of one term (cogs / cost-of-goods-sold), so dedupe by display name. One source for
+ * both the on-page <Glossary> render and the search index. */
+export function glossaryEntries(): GlossaryEntry[] {
+ const byTerm = new Map<string, GlossaryEntry>();
+ for (const entry of Object.values(glossary)) {
+ if (!byTerm.has(entry.term)) byTerm.set(entry.term, entry);
+ }
+ return [...byTerm.values()].sort((a, b) =>
+ a.term.toLowerCase().localeCompare(b.term.toLowerCase()),
+ );
+}
+
export const glossary: Record<string, GlossaryEntry> = {
"method-type": {
term: "Method type",
definition:
- "How a part gets into its parent — set per line on a method. One of Make to Order, Purchase to Order, or Pull from Inventory. Separate from the item's replenishment system.",
- href: "/docs/reference/methods",
+ "How a part gets into its parent, set per line: Make to Order, Purchase to Order, or Pull from Inventory.",
+ href: "/docs/reference/methods#method-type",
},
"make-to-order": {
term: "Make to Order",
definition:
- "The part is manufactured as its own job, with its own routing, when the parent that needs it is built.",
- href: "/docs/reference/methods",
+ "The part is manufactured as its own job when the parent that needs it is built.",
+ href: "/docs/reference/methods#method-type",
},
"purchase-to-order": {
term: "Purchase to Order",
definition:
- "The material for that specific customer order is purchased from a supplier instead of being made or pulled from inventory.",
- href: "/docs/reference/methods",
+ "The material is purchased from a supplier for that specific order, rather than made or pulled from stock.",
+ href: "/docs/reference/methods#method-type",
},
"pull-from-inventory": {
term: "Pull from Inventory",
definition:
- "The part is taken from existing stock when its parent is built — no new job or purchase order is created for it.",
- href: "/docs/reference/methods",
+ "The part is taken from existing stock when its parent is built — no new job or purchase order.",
+ href: "/docs/reference/methods#method-type",
},
"replenishment-system": {
term: "Replenishment system",
definition:
- "How an item is replenished overall, and which planning queue its shortfalls land in: Buy, Make, or Buy and Make. Set per item — unlike the per-line method type.",
- href: "/docs/reference/items",
+ "How an item is replenished overall — Buy, Make, or Buy and Make — set per item, unlike the per-line method type.",
+ href: "/docs/reference/methods#method-type-vs-replenishment-system",
},
method: {
term: "Method",
definition:
- "Carbon's name for a bill of materials: the materials (the components) plus the operations (the routing) that make a part.",
+ "Carbon's name for a bill of materials: the components plus the operations that make a part.",
href: "/docs/reference/methods",
},
bom: {
term: "Bill of materials",
definition:
- "In Carbon a bill of materials is called a method — the components plus the operations that produce a part.",
+ "Called a method in Carbon — the components plus operations that produce a part.",
href: "/docs/reference/methods",
},
wip: {
term: "Work in process (WIP)",
definition:
- "Not a table — a general-ledger balance. Costs accumulate in the WIP account as job materials are issued, and clear out when the job is received to stock.",
+ "Not a table but a general-ledger balance: cost accumulates as job materials are issued and clears when the job is received to stock.",
+ href: "/guides/job-costing#wip-isnt-a-table",
},
"outside-operation": {
term: "Outside operation",
definition:
- "An operation performed by an outside supplier rather than an in-house work center. Carbon raises a subcontracting purchase order to cover it.",
+ "An operation done by an outside supplier rather than an in-house work center, covered by a subcontracting purchase order.",
},
subassembly: {
term: "Subassembly",
definition:
"A Make to Order component that gets its own job and routing inside the parent's build.",
- href: "/docs/reference/methods",
+ href: "/docs/reference/methods#kit-or-subassembly",
},
kit: {
term: "Kit",
definition:
- "A Make to Order component whose parts are issued together into the parent job — no separate build of its own.",
- href: "/docs/reference/methods",
+ "A Make to Order component whose parts are issued together into the parent job — no separate build.",
+ href: "/docs/reference/methods#kit-or-subassembly",
},
"lead-time": {
term: "Lead time",
definition:
- "Days from ordering a part to having it available. Planning offsets demand backward by this much so supply arrives in time.",
- href: "/docs/reference/reordering",
+ "Days from ordering a part to having it available; planning offsets demand backward by this much.",
+ href: "/docs/reference/reordering#fields",
},
"reorder-point": {
term: "Reorder point",
definition:
- "The on-hand level that triggers a new replenishment order under the Fixed Reorder Quantity and Maximum Quantity policies.",
- href: "/docs/reference/reordering",
+ "The on-hand level that triggers a new replenishment order under the quantity-based policies.",
+ href: "/docs/reference/reordering#policies",
},
"reordering-policy": {
term: "Reordering policy",
definition:
"How an item is replenished: Manual Reorder, Demand-Based Reorder, Fixed Reorder Quantity, or Maximum Quantity.",
- href: "/docs/reference/reordering",
+ href: "/docs/reference/reordering#policies",
},
// ── Production & the floor ──────────────────────────────────────────────
@@ -114,54 +139,54 @@ export const glossary: Record<string, GlossaryEntry> = {
job: {
term: "Job",
definition:
- "Carbon's production order — one job builds a quantity of one item from its own copied method and routing. Status runs Draft → Ready → In Progress → Completed → Closed.",
+ "Carbon's production order — one job builds a quantity of one item from its own copied method and routing.",
href: "/docs/reference/jobs",
},
routing: {
term: "Routing",
definition:
- "The ordered sequence of operations a job runs through. Not a separate record: it's the job's operations sorted by order, copied from the method's bill of process.",
+ "The ordered sequence of operations a job runs through, copied from the method's bill of process.",
href: "/docs/reference/routings",
},
operation: {
term: "Operation",
definition:
- "One step in a job's routing. Each operation names a process and a work center and carries its own setup, labor, and machine times and rates — so cost accumulates per operation, not just per job.",
+ "One step in a job's routing, naming a process and a work center and carrying its own setup, labor, and machine times and rates.",
href: "/docs/reference/routings",
},
"work-center": {
term: "Work center",
definition:
- "Where an operation runs. It carries labor and quoting rates — overhead is the difference between them — and links to the processes it can perform.",
+ "Where an operation runs; carries labor and quoting rates, with overhead the difference between them.",
href: "/docs/reference/work-centers",
},
backflush: {
term: "Backflush",
definition:
- "Automatic, prorated consumption of a job's untracked materials when output is reported — no manual issue needed. Batch- or serial-tracked materials are skipped and must be issued explicitly.",
- href: "/guides/job-costing",
+ "Automatic, prorated consumption of a job's untracked materials when output is reported — tracked materials are issued manually.",
+ href: "/guides/job-costing#issued-or-backflushed",
},
"material-issue": {
term: "Issue (material)",
definition:
- "Consuming material from inventory into a job, which writes a Consumption entry to the item ledger. Distinct from a quality issue, which is a nonconformance.",
+ "Consuming material from inventory into a job, which writes a Consumption entry to the item ledger.",
href: "/docs/reference/jobs",
},
"get-method": {
term: "Get Method",
definition:
- "The action that copies a saved method — its materials, operations, and work instructions — onto a job or quote line. You pick which parts to pull.",
- href: "/docs/reference/methods",
+ "The action that copies a saved method — its materials, operations, and work instructions — onto a job or quote line.",
+ href: "/docs/reference/methods#get-method",
},
scrap: {
term: "Scrap",
definition:
- "Units reported as unrecoverable at an operation, with a reason — recorded as a production quantity of type Scrap. The alternative to routing them for rework.",
+ "Units reported as unrecoverable at an operation, with a reason — the alternative to rework.",
},
rework: {
term: "Rework",
definition:
- "Sending defective units back to an earlier operation to be corrected instead of scrapping them. Carbon creates a rework path of operations targeting that step.",
+ "Sending defective units back to an earlier operation to be corrected instead of scrapping them.",
},
// ── Sales & purchasing ──────────────────────────────────────────────────
@@ -171,49 +196,49 @@ export const glossary: Record<string, GlossaryEntry> = {
"sales-order": {
term: "Sales order",
definition:
- 'A firm customer commitment to deliver. Fulfillment status splits across "To Ship and Invoice", "To Ship", and "To Invoice" before reaching "Completed".',
+ "A firm customer commitment to deliver; fulfillment status splits across ship and invoice before reaching Completed.",
href: "/docs/reference/sales-orders",
},
"purchase-order": {
term: "Purchase order",
definition:
- 'A firm order to a supplier. As goods and bills arrive, status moves through "To Receive and Invoice", "To Receive", and "To Invoice" before "Completed".',
+ "A firm order to a supplier; status moves through receive and invoice before Completed as goods and bills arrive.",
href: "/docs/reference/purchase-orders",
},
quote: {
term: "Quote",
definition:
- "A priced sales quotation, often with quantity breaks. Status runs Draft → Sent → Ordered, or ends Lost, Expired, or Cancelled; an accepted quote converts to a sales order.",
+ "A priced sales quotation; Draft → Sent → Ordered, or ends Lost, Expired, or Cancelled.",
href: "/docs/reference/quotes",
},
rfq: {
term: "RFQ (request for quote)",
definition:
- "Carbon has two kinds: a sales RFQ, where a customer asks you to quote, and a purchasing RFQ, where you ask suppliers to quote. Both feed the opportunity thread.",
- href: "/guides/quote-to-cash",
+ "A sales RFQ (a customer asks you to quote) or a purchasing RFQ (you ask suppliers); both feed the opportunity thread.",
+ href: "/guides/quote-to-cash#one-opportunity-many-documents",
},
opportunity: {
term: "Opportunity",
definition:
- "The thread linking a sales RFQ, its quote, and the resulting sales order. Not a document with its own status — a join that lets the three be read as one deal.",
- href: "/guides/quote-to-cash",
+ "The thread linking a sales RFQ, its quote, and the resulting sales order — a join, not a document with its own status.",
+ href: "/guides/quote-to-cash#one-opportunity-many-documents",
},
"drop-ship": {
term: "Drop-ship",
definition:
- "A shipment line sent straight from supplier to customer, bypassing your warehouse — so no inventory receipt posts. Set per shipment line, not on the order header.",
- href: "/docs/reference/sales-orders",
+ "A shipment line sent straight from supplier to customer, bypassing your warehouse — set per line, not on the header.",
+ href: "/docs/reference/sales-orders#line-fields",
},
"three-way-match": {
term: "Three-way match",
definition:
- "Reconciling a purchase order against what was received and what was invoiced. In Carbon it's implicit — the PO line's received-vs-invoiced quantities and the GR/IR balance are the match, with no separate matching step.",
- href: "/guides/receive-and-bill",
+ "Reconciling a purchase order against what was received and invoiced — implicit in Carbon, via the line quantities and GR/IR balance.",
+ href: "/guides/receive-and-bill#match-and-post",
},
"gr-ir": {
term: "GR/IR (goods received, not invoiced)",
definition:
- "A clearing account holding the value of goods received but not yet billed. A receipt credits it; the supplier invoice clears it.",
+ "A clearing account holding the value of goods received but not yet billed; the supplier invoice clears it.",
href: "/docs/reference/accounting",
},
@@ -224,74 +249,74 @@ export const glossary: Record<string, GlossaryEntry> = {
"tracked-entity": {
term: "Tracked entity",
definition:
- 'One serial unit or one batch of inventory that Carbon follows individually. It carries a status — "Available", "Reserved", "On Hold", or "Consumed" — and its own attributes, such as an expiry date.',
- href: "/docs/reference/traceability",
+ "One serial unit or one batch that Carbon follows individually, carrying its own status and attributes such as an expiry date.",
+ href: "/docs/reference/traceability#tracked-entities",
},
serial: {
term: "Serial tracking",
definition:
- "Each physical unit gets its own tracked entity and unique number — one entity, one unit. Used where you need 1:1 history.",
- href: "/docs/reference/traceability",
+ "Each physical unit gets its own tracked entity and unique number — one entity, one unit.",
+ href: "/docs/reference/traceability#tracked-entities",
},
batch: {
term: "Batch tracking",
definition:
- "A quantity of identical units shares one tracked entity and batch number — one entity, many units. Used for lots with shared attributes like an expiry date.",
- href: "/docs/reference/traceability",
+ "A quantity of identical units shares one tracked entity and batch number — one entity, many units.",
+ href: "/docs/reference/traceability#tracked-entities",
},
traceability: {
term: "Traceability",
definition:
- "The recorded genealogy of tracked entities: which inputs were consumed to produce which outputs, activity by activity, from receipt through build to shipment.",
+ "The recorded genealogy of tracked entities — which inputs were consumed to produce which outputs, receipt through shipment.",
href: "/docs/reference/traceability",
},
genealogy: {
term: "Genealogy",
definition:
- "The parent-child chain of tracked entities — what a unit was built from and what it became. Carbon assembles it from tracked-activity inputs and outputs.",
- href: "/docs/reference/traceability",
+ "The parent-child chain of tracked entities — what a unit was built from and what it became.",
+ href: "/docs/reference/traceability#genealogy",
},
"costing-method": {
term: "Costing method",
definition:
- "How an item's unit cost is valued: Standard, Average, FIFO, or LIFO. Set per item, it drives the cost that posts when stock moves.",
- href: "/docs/reference/items",
+ "How an item's unit cost is valued: Standard, Average, FIFO, or LIFO. Set per item.",
+ href: "/docs/reference/items#fields",
},
cogs: {
term: "Cost of goods sold (COGS)",
definition:
- "The inventory cost recognized when a shipment posts: Carbon debits the COGS account and credits inventory, valued by the item's costing method.",
+ "The inventory cost recognized when a shipment posts, valued by the item's costing method.",
href: "/docs/reference/accounting",
},
// Alias of "cogs" so the spelled-out term also resolves — keep the definition in sync with it.
"cost-of-goods-sold": {
term: "Cost of goods sold (COGS)",
definition:
- "The inventory cost recognized when a shipment posts: Carbon debits the COGS account and credits inventory, valued by the item's costing method.",
+ "The inventory cost recognized when a shipment posts, valued by the item's costing method.",
href: "/docs/reference/accounting",
},
"conversion-factor": {
term: "Conversion factor",
definition:
- "Converts a supplier's purchase unit to your inventory unit on a PO, receipt, or bill line. Buy in cartons of 12, stock in eaches: a factor of 12 turns 5 cartons into 60.",
- href: "/guides/receive-and-bill",
+ "Converts a supplier's purchase unit to your inventory unit on a PO, receipt, or bill line — buy in cartons of 12, stock in eaches.",
+ href: "/guides/receive-and-bill#buy-by-the-box-stock-by-the-each",
},
posting: {
term: "Posting",
definition:
- 'Committing a receipt, shipment, or invoice: inventory quantities move, journal entries hit the ledger, and the document\'s status becomes "Posted". The irreversible step.',
+ "Committing a receipt, shipment, or invoice: quantities move, journal entries hit the ledger, and status becomes Posted.",
href: "/docs/reference/accounting",
},
receipt: {
term: "Receipt",
definition:
- 'The inbound posting document that takes goods into stock — from a purchase order, transfer, or job output — and creates any tracked entities. Status Draft → Pending → "Posted".',
+ "The inbound posting document that takes goods into stock — from a PO, transfer, or job output — and creates any tracked entities.",
href: "/docs/reference/receipts",
},
shipment: {
term: "Shipment",
definition:
- 'The outbound posting document that takes goods out of stock to a customer, posting COGS as it goes. Status Draft → Pending → "Posted".',
+ "The outbound posting document that takes goods out of stock to a customer, posting COGS as it goes.",
href: "/docs/reference/shipments",
},
@@ -302,62 +327,62 @@ export const glossary: Record<string, GlossaryEntry> = {
"demand-forecast": {
term: "Demand forecast",
definition:
- "Expected future demand for an item, bucketed by period. The planning run populates it alongside actual demand from orders and jobs.",
- href: "/docs/reference/planning",
+ "Expected future demand for an item, bucketed by period, populated by the planning run alongside actual demand.",
+ href: "/docs/reference/planning#what-feeds-it",
},
mrp: {
term: "MRP (planning)",
definition:
- "Carbon's planning run nets supply against demand and explodes methods — but it does not create orders. It surfaces shortfalls for you to turn into planned jobs and purchase orders.",
+ "Carbon's planning run nets supply against demand and explodes methods, surfacing shortfalls — but it creates no orders itself.",
href: "/docs/reference/planning",
},
nonconformance: {
term: "Nonconformance (issue)",
definition:
- 'Carbon\'s quality issue — a logged deviation or defect. Status runs "Registered" → "In Progress" → "Closed", with a configurable workflow of investigation and action tasks.',
- href: "/docs/reference/quality",
+ "Carbon's quality issue — a logged deviation or defect with a configurable workflow of investigation and action tasks.",
+ href: "/docs/reference/quality#issues",
},
"8d": {
term: "8D",
definition:
- "The eight-disciplines quality method. Carbon doesn't hard-code its steps — you model it with the nonconformance workflow's investigation, action, and approval tasks.",
- href: "/docs/reference/quality",
+ "The eight-disciplines quality method, modeled with the nonconformance workflow's tasks rather than hard-coded.",
+ href: "/docs/reference/quality#workflows-and-actions",
},
"corrective-action": {
term: "Corrective action",
definition:
- "A nonconformance task that fixes a confirmed root cause — as opposed to a preventive action or an immediate containment action. Tracked Pending → In Progress → Completed.",
- href: "/docs/reference/quality",
+ "A nonconformance task that fixes a confirmed root cause — as opposed to a preventive or immediate containment action.",
+ href: "/docs/reference/quality#workflows-and-actions",
},
"preventive-action": {
term: "Preventive action",
definition:
- "A nonconformance task that stops the problem recurring elsewhere — distinct from the corrective fix and the immediate containment.",
- href: "/docs/reference/quality",
+ "A nonconformance task that stops the problem recurring elsewhere — distinct from the corrective fix and containment.",
+ href: "/docs/reference/quality#workflows-and-actions",
},
"containment-action": {
term: "Containment action",
definition:
"The immediate nonconformance task that quarantines affected stock or work before the root cause is known.",
- href: "/docs/reference/quality",
+ href: "/docs/reference/quality#workflows-and-actions",
},
journal: {
term: "Journal",
definition:
- "A posted accounting entry: a header plus balanced debit and credit journal lines against GL accounts. Every posting writes one.",
- href: "/docs/reference/accounting",
+ "A posted accounting entry: a header plus balanced debit and credit lines against GL accounts.",
+ href: "/docs/reference/accounting#the-journal",
},
"general-ledger": {
term: "General ledger",
definition:
- "The book of all posted journal lines, summed by account. Carbon only posts when the company has accounting enabled.",
+ "The book of all posted journal lines, summed by account — written only when the company has accounting enabled.",
href: "/docs/reference/accounting",
},
"accounting-period": {
term: "Accounting period",
definition:
- 'A dated window that postings fall into. A period is "Inactive" or "Active" — not open or closed — and a posting needs an active one, which Carbon opens automatically when needed.',
- href: "/docs/reference/accounting",
+ "A dated window postings fall into — Active or Inactive, not open or closed — opened automatically when needed.",
+ href: "/docs/reference/accounting#periods",
},
// ── Documents & variances (batch 2) ─────────────────────────────────────
@@ -367,32 +392,32 @@ export const glossary: Record<string, GlossaryEntry> = {
"supplier-quote": {
term: "Supplier quote",
definition:
- "A supplier's priced response to a purchasing RFQ — one per supplier, created when you finalize the request. Status runs Draft → Active when they submit, or Declined.",
- href: "/guides/rfq-to-po",
+ "A supplier's priced response to a purchasing RFQ — one per supplier; Draft → Active when they submit, or Declined.",
+ href: "/guides/rfq-to-po#suppliers-quote-back",
},
invoice: {
term: "Invoice",
definition:
- "A sales invoice (you bill a customer) or a purchase invoice (a supplier bills you). Posting writes the ledger but never marks it Paid — payment is a field on the invoice, not a separate record.",
+ "A sales invoice (you bill a customer) or purchase invoice (a supplier bills you); payment is a field, not a separate record.",
href: "/docs/reference/invoices",
},
"finished-goods": {
term: "Finished goods",
definition:
- "A completed job's output, received into inventory at the job's actual accumulated WIP cost. A make-to-order job stocks here first, then the sales order ships from stock.",
- href: "/docs/reference/jobs",
+ "A completed job's output, received into inventory at the job's actual accumulated WIP cost.",
+ href: "/guides/job-finish-close#finish-into-inventory",
},
"production-variance": {
term: "Production variance",
definition:
- "The residual WIP a job has left at close — rounding, late material, a late event — swept to a Production Variance account. The only variance Carbon books for a job; finish is at actual cost, not standard.",
- href: "/guides/job-finish-close",
+ "The residual WIP a job has left at close, swept to a Production Variance account — the only variance Carbon books for a job.",
+ href: "/guides/job-finish-close#close-the-job",
},
"purchase-price-variance": {
term: "Purchase price variance",
definition:
- "The gap between a purchase order's price and the supplier's bill, posted to a variance account when the invoice posts and reconciled against the receipt cost.",
- href: "/guides/receive-and-bill",
+ "The gap between a purchase order's price and the supplier's bill, posted to a variance account when the invoice posts.",
+ href: "/guides/receive-and-bill#match-and-post",
},
// ── Fixed assets ────────────────────────────────────────────────────────
@@ -402,64 +427,64 @@ export const glossary: Record<string, GlossaryEntry> = {
"fixed-asset": {
term: "Fixed asset",
definition:
- "An accounting record for a capitalized item — a machine, vehicle, or tool you depreciate rather than expense. Independent of the work center you schedule production on. Status runs Draft → Active → Fully Depreciated → Disposed.",
+ "An accounting record for a capitalized item you depreciate rather than expense; Draft → Active → Fully Depreciated → Disposed.",
href: "/docs/reference/fixed-assets",
},
"asset-class": {
term: "Asset class",
definition:
- "The category a fixed asset belongs to. It carries the GL accounts every asset of that kind posts to: the asset account, accumulated depreciation, depreciation expense, and the write-off account.",
+ "The category a fixed asset belongs to, carrying the GL accounts every asset of that kind posts to.",
href: "/docs/reference/fixed-assets",
},
depreciation: {
term: "Depreciation",
definition:
- "Writing an asset's value down over its life. Carbon runs it as a monthly batch you create, review as a draft, then post — debit depreciation expense, credit accumulated depreciation. Methods: Straight Line, Declining Balance, Units of Production.",
- href: "/docs/reference/fixed-assets",
+ "Writing an asset's value down over its life — a monthly batch you create, review as a draft, then post.",
+ href: "/docs/reference/fixed-assets#depreciating",
},
"net-book-value": {
term: "Net book value",
definition:
- "What an asset is still worth on the books: its acquisition cost minus accumulated depreciation. The figure an asset is sold or disposed at.",
- href: "/docs/reference/fixed-assets",
+ "An asset's acquisition cost minus accumulated depreciation — what it's still worth on the books, and the figure it's disposed at.",
+ href: "/docs/reference/fixed-assets#selling-vs-disposing",
},
"straight-line": {
term: "Straight line",
definition:
"A depreciation method that charges an equal amount each period across the asset's useful life.",
- href: "/docs/reference/fixed-assets",
+ href: "/docs/reference/fixed-assets#depreciating",
},
"declining-balance": {
term: "Declining balance",
definition:
- "A depreciation method that charges a fixed percentage of the remaining book value each period — heavier early, lighter later.",
- href: "/docs/reference/fixed-assets",
+ "A depreciation method that charges a fixed percentage of remaining book value each period — heavier early, lighter later.",
+ href: "/docs/reference/fixed-assets#depreciating",
},
"residual-value": {
term: "Residual value",
definition:
- 'The floor an asset depreciates down to. When net book value reaches it, posting flips the asset to "Fully Depreciated" and it stops accruing.',
- href: "/docs/reference/fixed-assets",
+ "The floor an asset depreciates down to; when net book value reaches it, the asset flips to Fully Depreciated.",
+ href: "/docs/reference/fixed-assets#depreciating",
},
macrs: {
term: "MACRS",
definition:
- "The US tax depreciation system, with the IRS property-class tables. Carbon can run a separate tax schedule on MACRS alongside the book schedule.",
- href: "/docs/reference/fixed-assets",
+ "The US tax depreciation system with IRS property-class tables, run as a separate tax schedule alongside the book schedule.",
+ href: "/docs/reference/fixed-assets#depreciating",
},
disposal: {
term: "Disposal",
definition:
- 'Retiring an asset by write-off instead of sale: clear accumulated depreciation, remove the asset at cost, and book the remaining net book value as a loss. Status becomes "Disposed".',
- href: "/docs/reference/fixed-assets",
+ "Retiring an asset by write-off instead of sale, booking the remaining net book value as a loss — status becomes Disposed.",
+ href: "/docs/reference/fixed-assets#selling-vs-disposing",
},
// ── Inventory ledger ────────────────────────────────────────────────────
"item-ledger": {
term: "Item ledger",
definition:
- "The append-only record of every stock movement. On-hand is the sum of its signed entries — receipts and outputs add, sales and consumption subtract — and it's status-aware, so it, not the cached quantity, is the source of truth.",
- href: "/docs/reference/inventory",
+ "The append-only record of every stock movement; on-hand is the sum of its signed entries and the source of truth.",
+ href: "/docs/reference/inventory#on-hand-is-a-ledger",
},
// ── Shelf life ──────────────────────────────────────────────────────────
@@ -468,13 +493,13 @@ export const glossary: Record<string, GlossaryEntry> = {
"shelf-life": {
term: "Shelf life",
definition:
- 'When a serial or batch expires, and what happens if you use it after. The date lives on the tracked entity; a company policy can Warn, Block, or BlockWithOverride on consuming expired stock — Block is the default, rejecting it outright.',
+ "When a serial or batch expires, and what happens if used after — a company policy can Warn, Block, or BlockWithOverride.",
href: "/docs/reference/shelf-life",
},
fefo: {
term: "FEFO (first-expiry-first-out)",
definition:
- "Picking offers available tracked entities earliest-expiry-first, so the soonest-to-expire stock leaves first by default.",
+ "Picking offers tracked entities earliest-expiry-first, so the soonest-to-expire stock leaves first by default.",
href: "/docs/reference/shelf-life",
},
};
diff --git a/docs/lib/search-index.ts b/docs/lib/search-index.ts
index 2cf3588b4f..dc5fb5baf3 100644
--- a/docs/lib/search-index.ts
+++ b/docs/lib/search-index.ts
@@ -1,9 +1,12 @@
import "server-only";
import type { AdvancedIndex } from "fumadocs-core/search/server";
import { apiModules } from "@/lib/api-data";
+import { glossaryEntries, termSlug } from "@/lib/glossary";
import { guideSource, source } from "@/lib/source";
import { toolModules } from "@/lib/tools-data";
+const GLOSSARY_URL = "/docs/glossary";
+
/* One Orama index over all four doc surfaces. Each entry is `tag`ged so the single
* /api/search endpoint can be filtered per surface (the header's All/Guide/Reference/
* API/MCP pills map to these tags). MDX pages reuse the `structuredData` the
@@ -104,9 +107,34 @@ function resourceIndexes(): AdvancedIndex[] {
);
}
+/* The Glossary page renders its terms through the <Glossary> React component, so the
+ * MDX pipeline's structuredData captures only the page intro. Build the term index by
+ * hand from lib/glossary.ts: every term becomes a heading (id = its row anchor, so a hit
+ * deep-links to the term) and its definition the content. */
+function glossaryIndex(page: IndexablePage): AdvancedIndex {
+ const entries = glossaryEntries();
+ return {
+ id: page.url,
+ url: page.url,
+ title: page.data.title ?? "Glossary",
+ description: page.data.description,
+ tag: "docs",
+ breadcrumbs: ["Glossary"],
+ structuredData: {
+ headings: entries.map((e) => ({ id: termSlug(e.term), content: e.term })),
+ contents: entries.map((e) => ({ heading: termSlug(e.term), content: e.definition })),
+ },
+ };
+}
+
export function buildSearchIndexes(): AdvancedIndex[] {
+ const docsPages = source.getPages() as IndexablePage[];
+ const glossaryPage = docsPages.find((p) => p.url === GLOSSARY_URL);
+ const otherDocs = docsPages.filter((p) => p.url !== GLOSSARY_URL);
+
return [
- ...mdxIndexes(source.getPages(), "docs", "Reference"),
+ ...mdxIndexes(otherDocs, "docs", "Reference"),
+ ...(glossaryPage ? [glossaryIndex(glossaryPage)] : []),
...mdxIndexes(guideSource.getPages(), "guide", "Guide"),
...resourceIndexes(),
...toolIndexes(),
diff --git a/docs/source.config.ts b/docs/source.config.ts
index 98ec6fbb8d..bf49b9e781 100644
--- a/docs/source.config.ts
+++ b/docs/source.config.ts
@@ -40,6 +40,20 @@ export default defineConfig({
// vars, which the editorial code panel resolves to a color in reference.css.
rehypeCodeOptions: {
themes: { light: "github-dark-default", dark: "github-dark-default" },
+ // Stamp the language onto the <pre> so the CodeBlock can show it as the header
+ // label (Shiki strips the language otherwise). Fumadocs prepends our transformers
+ // to its own (icon/meta), so this composes — it doesn't replace them.
+ transformers: [
+ {
+ name: "carbon:data-language",
+ pre(node) {
+ const lang = this.options.lang;
+ if (lang && lang !== "text" && lang !== "plaintext") {
+ node.properties["data-language"] = lang;
+ }
+ },
+ },
+ ],
},
},
});