@contentbit/studio 1.0.0-rc.2 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +19 -9
  2. package/dist/client/assets/api-aCc2x-IO.js +1 -0
  3. package/dist/client/assets/arrow-right-tp4VknZo.js +1 -0
  4. package/dist/client/assets/document-DIh3ZPXr.js +56 -0
  5. package/dist/client/assets/documents-CjBZYbQ4.js +1 -0
  6. package/dist/client/assets/file-code-corner-Fzc5liO9.js +1 -0
  7. package/dist/client/assets/file-text-B8O46COn.js +1 -0
  8. package/dist/client/assets/index-Cd04OFZT.js +11 -0
  9. package/dist/client/assets/page-BMU8eIrR.js +1 -0
  10. package/dist/client/assets/routes-WndCJoku.js +1 -0
  11. package/dist/client/assets/search-BnUPH8AI.js +1 -0
  12. package/dist/client/assets/styles-hAsz_paS.css +2 -0
  13. package/dist/client/assets/target-BMSXP2fU.js +1 -0
  14. package/dist/client/assets/templates-IJid1Zwh.js +1 -0
  15. package/dist/server/api.d.ts.map +1 -1
  16. package/dist/server/assets/_tanstack-start-manifest_v-WfZ3uz_l.js +69 -0
  17. package/dist/server/assets/api-CHfynRIj.js +342 -0
  18. package/dist/server/assets/{document-DSV89Ser.js → document-BjPXZ9gS.js} +2529 -1317
  19. package/dist/server/assets/{routes-FGdym0e5.js → documents-jT4KnSkA.js} +63 -112
  20. package/dist/server/assets/empty-plugin-adapters-Ctp1ZmyT.js +4 -0
  21. package/dist/server/assets/page--xw7NmtK.js +388 -0
  22. package/dist/server/assets/router-xI8HUWRI.js +125 -0
  23. package/dist/server/assets/routes-CfwU-Ww2.js +372 -0
  24. package/dist/server/assets/start-Dk-BJfGT.js +3 -0
  25. package/dist/server/assets/templates--9wK-MK9.js +123 -0
  26. package/dist/server/index.d.ts +2 -2
  27. package/dist/server/index.d.ts.map +1 -1
  28. package/dist/server/index.js +6104 -110
  29. package/dist/server/scan.d.ts +1 -2
  30. package/dist/server/scan.d.ts.map +1 -1
  31. package/dist/server/server.js +3150 -1878
  32. package/dist/server/site.d.ts +38 -0
  33. package/dist/server/site.d.ts.map +1 -0
  34. package/dist/server/types.d.ts +33 -31
  35. package/dist/server/types.d.ts.map +1 -1
  36. package/package.json +26 -15
  37. package/src/components/studio.test.ts +10 -0
  38. package/src/components/studio.tsx +209 -0
  39. package/src/lib/api.test.ts +80 -0
  40. package/src/lib/api.ts +68 -7
  41. package/src/routeTree.gen.ts +57 -3
  42. package/src/routes/document.tsx +34 -88
  43. package/src/routes/documents.tsx +433 -0
  44. package/src/routes/index.tsx +295 -414
  45. package/src/routes/page.tsx +401 -0
  46. package/src/routes/templates.tsx +104 -0
  47. package/src/server/api.ts +19 -3
  48. package/src/server/index.ts +31 -12
  49. package/src/server/scan.test.ts +31 -44
  50. package/src/server/scan.ts +56 -82
  51. package/src/server/site.test.ts +355 -0
  52. package/src/server/site.ts +164 -0
  53. package/src/server/types.ts +28 -30
  54. package/tsconfig.json +1 -1
  55. package/dist/client/assets/api-BX-WUPtV.js +0 -1
  56. package/dist/client/assets/document-BOMp4_F5.js +0 -65
  57. package/dist/client/assets/index-C0ybJ4zQ.js +0 -12
  58. package/dist/client/assets/routes-ACKdIhYm.js +0 -1
  59. package/dist/client/assets/styles-DogO4Wcf.css +0 -2
  60. package/dist/server/assets/_tanstack-start-manifest_v-BC1PNuB0.js +0 -25
  61. package/dist/server/assets/api-Bqt_atjc.js +0 -72
  62. package/dist/server/assets/document-BB_UYqNL.js +0 -9
  63. package/dist/server/assets/empty-plugin-adapters-De7E1vAI.js +0 -5
  64. package/dist/server/assets/router-BJiN6b7L.js +0 -63
  65. package/dist/server/assets/routes-p0tk6PAr.js +0 -20
  66. package/dist/server/assets/start-m8EQRpUf.js +0 -4
@@ -0,0 +1,125 @@
1
+ import { HeadContent, Scripts, createFileRoute, createRootRoute, createRouter, lazyRouteComponent } from "@tanstack/react-router";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // \0rolldown/runtime.js
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, flags) => {
6
+ let target = Object.setPrototypeOf({}, null);
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return flags & 2 ? target : Object.preventExtensions(target);
13
+ };
14
+ // src/styles.css?url
15
+ var styles_default = "/assets/styles-hAsz_paS.css";
16
+ // src/routes/__root.tsx
17
+ var Route$5 = createRootRoute({
18
+ head: () => ({
19
+ meta: [
20
+ { charSet: "utf-8" },
21
+ {
22
+ name: "viewport",
23
+ content: "width=device-width, initial-scale=1"
24
+ },
25
+ { title: "contentbit Studio" }
26
+ ],
27
+ links: [{
28
+ rel: "stylesheet",
29
+ href: styles_default
30
+ }]
31
+ }),
32
+ notFoundComponent: () => /* @__PURE__ */ jsxs("main", {
33
+ className: "container mx-auto p-4 pt-16",
34
+ children: [/* @__PURE__ */ jsx("h1", { children: "404" }), /* @__PURE__ */ jsx("p", { children: "The requested page could not be found." })]
35
+ }),
36
+ shellComponent: RootDocument
37
+ });
38
+ function RootDocument({ children }) {
39
+ return /* @__PURE__ */ jsxs("html", {
40
+ lang: "en",
41
+ children: [/* @__PURE__ */ jsx("head", { children: /* @__PURE__ */ jsx(HeadContent, {}) }), /* @__PURE__ */ jsxs("body", { children: [children, /* @__PURE__ */ jsx(Scripts, {})] })]
42
+ });
43
+ }
44
+ // src/routes/templates.tsx
45
+ var $$splitComponentImporter$4 = () => import("./templates--9wK-MK9.js");
46
+ var Route$4 = createFileRoute("/templates")({ component: lazyRouteComponent($$splitComponentImporter$4, "component") });
47
+ // src/routes/page.tsx
48
+ var $$splitComponentImporter$3 = () => import("./page--xw7NmtK.js");
49
+ var Route$3 = createFileRoute("/page")({
50
+ validateSearch: (search) => ({ path: typeof search.path === "string" ? search.path : "" }),
51
+ component: lazyRouteComponent($$splitComponentImporter$3, "component")
52
+ });
53
+ // src/routes/documents.tsx
54
+ var $$splitComponentImporter$2 = () => import("./documents-jT4KnSkA.js");
55
+ var Route$2 = createFileRoute("/documents")({
56
+ validateSearch: (search) => ({
57
+ q: typeof search.q === "string" ? search.q : "",
58
+ status: isStatus(search.status) ? search.status : "all",
59
+ sort: isSortKey(search.sort) ? search.sort : "status",
60
+ dir: search.dir === "asc" || search.dir === "desc" ? search.dir : "asc"
61
+ }),
62
+ component: lazyRouteComponent($$splitComponentImporter$2, "component")
63
+ });
64
+ function isStatus(value) {
65
+ return value === "all" || value === "error" || value === "warning" || value === "suggestion" || value === "healthy";
66
+ }
67
+ function isSortKey(value) {
68
+ return value === "document" || value === "status" || value === "blocks" || value === "keywords" || value === "findings";
69
+ }
70
+ // src/routes/document.tsx
71
+ var $$splitComponentImporter$1 = () => import("./document-BjPXZ9gS.js");
72
+ var Route$1 = createFileRoute("/document")({
73
+ validateSearch: (search) => ({ path: typeof search.path === "string" ? search.path : "" }),
74
+ component: lazyRouteComponent($$splitComponentImporter$1, "component")
75
+ });
76
+ // src/routes/index.tsx
77
+ var $$splitComponentImporter = () => import("./routes-CfwU-Ww2.js");
78
+ var Route = createFileRoute("/")({
79
+ validateSearch: (search) => ({ q: typeof search.q === "string" ? search.q : "" }),
80
+ component: lazyRouteComponent($$splitComponentImporter, "component")
81
+ });
82
+ // src/routeTree.gen.ts
83
+ var TemplatesRoute = Route$4.update({
84
+ id: "/templates",
85
+ path: "/templates",
86
+ getParentRoute: () => Route$5
87
+ });
88
+ var PageRoute = Route$3.update({
89
+ id: "/page",
90
+ path: "/page",
91
+ getParentRoute: () => Route$5
92
+ });
93
+ var DocumentsRoute = Route$2.update({
94
+ id: "/documents",
95
+ path: "/documents",
96
+ getParentRoute: () => Route$5
97
+ });
98
+ var DocumentRoute = Route$1.update({
99
+ id: "/document",
100
+ path: "/document",
101
+ getParentRoute: () => Route$5
102
+ });
103
+ var rootRouteChildren = {
104
+ IndexRoute: Route.update({
105
+ id: "/",
106
+ path: "/",
107
+ getParentRoute: () => Route$5
108
+ }),
109
+ DocumentRoute,
110
+ DocumentsRoute,
111
+ PageRoute,
112
+ TemplatesRoute
113
+ };
114
+ var routeTree = Route$5._addFileChildren(rootRouteChildren)._addFileTypes();
115
+ // src/router.tsx
116
+ var router_exports = /* @__PURE__ */ __exportAll({ getRouter: () => getRouter });
117
+ function getRouter() {
118
+ return createRouter({
119
+ routeTree,
120
+ scrollRestoration: true,
121
+ defaultPreload: "intent",
122
+ defaultPreloadStaleTime: 0
123
+ });
124
+ }
125
+ export { Route$3 as a, getRouter, Route$2 as i, Route as n, Route$1 as r, router_exports as t };
@@ -0,0 +1,372 @@
1
+ import { Link, useNavigate } from "@tanstack/react-router";
2
+ import { AlertTriangle, ArrowRight, Bot, KeyRound, Link2Off, RefreshCw, Search, SlidersHorizontal } from "lucide-react";
3
+ import { useMemo } from "react";
4
+ import { a as Button, c as FileFindings, d as Panel, f as SiteFindingItem, g as severityTone, h as relativeTo, i as useSite, l as Metric, m as plural, p as StudioNav, u as NoBuild } from "./api-CHfynRIj.js";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { n as Route } from "./router-xI8HUWRI.js";
7
+ // src/routes/index.tsx?tsr-split=component
8
+ var ORIGIN_SOURCES = {
9
+ flag: "from --origin",
10
+ config: "from site.origin",
11
+ canonicals: "inferred from canonicals"
12
+ };
13
+ function SiteView() {
14
+ const search = Route.useSearch();
15
+ const navigate = useNavigate({ from: "/" });
16
+ const { data: site, error, refreshing, refresh } = useSite();
17
+ const pages = useMemo(() => {
18
+ if (site?.kind !== "built") return [];
19
+ const query = search.q.toLowerCase().trim();
20
+ return site.context.pages.filter((page) => [
21
+ page.path,
22
+ page.title,
23
+ page.source && relativeTo(site.root, page.source),
24
+ page.type
25
+ ].concat(page.primaryKeyword).filter(Boolean).join(" ").toLowerCase().includes(query));
26
+ }, [site, search.q]);
27
+ const built = site?.kind === "built" ? site : void 0;
28
+ const attached = built?.context.pages.filter(({ source }) => source !== void 0).length ?? 0;
29
+ return /* @__PURE__ */ jsxs("main", {
30
+ className: "min-h-svh bg-background text-foreground",
31
+ children: [/* @__PURE__ */ jsx("section", {
32
+ className: "border-b bg-muted/30",
33
+ children: /* @__PURE__ */ jsxs("div", {
34
+ className: "mx-auto flex max-w-7xl flex-col gap-6 px-5 py-6",
35
+ children: [
36
+ /* @__PURE__ */ jsx(StudioNav, {}),
37
+ /* @__PURE__ */ jsxs("div", {
38
+ className: "flex flex-col gap-4 md:flex-row md:items-end md:justify-between",
39
+ children: [/* @__PURE__ */ jsxs("div", { children: [
40
+ /* @__PURE__ */ jsx("p", {
41
+ className: "font-mono text-xs uppercase text-muted-foreground",
42
+ children: "contentbit studio"
43
+ }),
44
+ /* @__PURE__ */ jsx("h1", {
45
+ className: "mt-1 text-3xl font-semibold tracking-tight",
46
+ children: "Built pages"
47
+ }),
48
+ /* @__PURE__ */ jsx("p", {
49
+ className: "mt-2 max-w-2xl text-sm text-muted-foreground",
50
+ children: "The pages the build serves, as contentbit check and contentbit context read them."
51
+ })
52
+ ] }), /* @__PURE__ */ jsxs(Button, {
53
+ onClick: refresh,
54
+ disabled: refreshing,
55
+ className: "w-fit gap-2",
56
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: refreshing ? "size-4 animate-spin" : "size-4" }), "Refresh"]
57
+ })]
58
+ }),
59
+ built && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("dl", {
60
+ className: "grid gap-x-6 gap-y-1 text-sm md:grid-cols-[auto_1fr]",
61
+ children: [
62
+ /* @__PURE__ */ jsx("dt", {
63
+ className: "text-muted-foreground",
64
+ children: "Build"
65
+ }),
66
+ /* @__PURE__ */ jsxs("dd", {
67
+ className: "font-mono",
68
+ children: [
69
+ relativeTo(built.root, built.context.build),
70
+ ",",
71
+ " ",
72
+ plural(built.context.pages.length, "page")
73
+ ]
74
+ }),
75
+ /* @__PURE__ */ jsx("dt", {
76
+ className: "text-muted-foreground",
77
+ children: "Origin"
78
+ }),
79
+ /* @__PURE__ */ jsx("dd", {
80
+ className: "font-mono",
81
+ children: built.context.origin ? `${built.context.origin.url} (${ORIGIN_SOURCES[built.context.origin.source]})` : "unknown"
82
+ }),
83
+ /* @__PURE__ */ jsx("dt", {
84
+ className: "text-muted-foreground",
85
+ children: "Markdown"
86
+ }),
87
+ /* @__PURE__ */ jsx("dd", { children: built.markdownFiles === 0 ? "none" : `${plural(built.markdownFiles, "file")}, ${attached} with a built page` }),
88
+ built.summary.ignored > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("dt", {
89
+ className: "text-muted-foreground",
90
+ children: "Ignored"
91
+ }), /* @__PURE__ */ jsx("dd", { children: `${plural(built.summary.ignored, "finding")}, by check.severity and check.ignore` })] })
92
+ ]
93
+ }), /* @__PURE__ */ jsxs("div", {
94
+ className: "grid gap-px overflow-hidden rounded-sm border bg-border md:grid-cols-4",
95
+ children: [
96
+ /* @__PURE__ */ jsx(Metric, {
97
+ label: "pages",
98
+ value: built.summary.pages
99
+ }),
100
+ /* @__PURE__ */ jsx(Metric, {
101
+ label: "errors",
102
+ value: built.summary.errors,
103
+ tone: built.summary.errors > 0 ? "bad" : "ok"
104
+ }),
105
+ /* @__PURE__ */ jsx(Metric, {
106
+ label: "warnings",
107
+ value: built.summary.warnings,
108
+ tone: built.summary.warnings > 0 ? "warn" : "ok"
109
+ }),
110
+ /* @__PURE__ */ jsx(Metric, {
111
+ label: "template findings",
112
+ value: built.context.templateFindings.length
113
+ })
114
+ ]
115
+ })] })
116
+ ]
117
+ })
118
+ }), /* @__PURE__ */ jsxs("section", {
119
+ className: "mx-auto grid max-w-7xl gap-5 px-5 py-5 lg:grid-cols-[minmax(0,1fr)_320px]",
120
+ children: [/* @__PURE__ */ jsxs("div", {
121
+ className: "min-w-0 space-y-4",
122
+ children: [
123
+ error && /* @__PURE__ */ jsx(Panel, {
124
+ title: "Error",
125
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
126
+ children: /* @__PURE__ */ jsx("p", {
127
+ className: "text-sm text-destructive",
128
+ children: error
129
+ })
130
+ }),
131
+ !site && !error && /* @__PURE__ */ jsx("div", {
132
+ className: "border p-4 text-sm text-muted-foreground",
133
+ children: "Reading the site..."
134
+ }),
135
+ site?.kind === "unbuilt" && /* @__PURE__ */ jsx(NoBuild, { ...site }),
136
+ built && built.staleSources.length > 0 && /* @__PURE__ */ jsx(Panel, {
137
+ title: "Stale build",
138
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
139
+ children: /* @__PURE__ */ jsxs("p", {
140
+ className: "text-sm",
141
+ children: [plural(built.staleSources.length, "Markdown file"), " changed after the build, so its pages may not show them yet. Rebuild the site and press Refresh."]
142
+ })
143
+ }),
144
+ built && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("label", {
145
+ className: "relative flex min-w-0 items-center",
146
+ children: [/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-3 size-4 text-muted-foreground" }), /* @__PURE__ */ jsx("input", {
147
+ value: search.q,
148
+ onChange: (event) => void navigate({
149
+ to: "/",
150
+ search: { q: event.target.value }
151
+ }),
152
+ placeholder: "Search path, title, source, type, keyword...",
153
+ className: "h-10 w-full border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-foreground"
154
+ })]
155
+ }), /* @__PURE__ */ jsxs("div", {
156
+ className: "overflow-hidden border",
157
+ children: [/* @__PURE__ */ jsx("div", {
158
+ className: "grid grid-cols-[1.4fr_1fr_0.4fr_0.6fr_0.7fr_2rem] gap-px border-b bg-border text-xs font-medium uppercase text-muted-foreground",
159
+ children: [
160
+ "Page",
161
+ "Source",
162
+ "Words",
163
+ "Links in",
164
+ "Findings",
165
+ ""
166
+ ].map((label) => /* @__PURE__ */ jsx("div", {
167
+ className: "bg-muted/50 px-3 py-2",
168
+ children: label
169
+ }, label))
170
+ }), /* @__PURE__ */ jsxs("div", {
171
+ className: "divide-y",
172
+ children: [pages.map((page) => /* @__PURE__ */ jsxs(Link, {
173
+ to: "/page",
174
+ search: { path: page.path },
175
+ className: "grid grid-cols-[1.4fr_1fr_0.4fr_0.6fr_0.7fr_2rem] gap-px bg-border text-sm transition-colors hover:bg-foreground/20",
176
+ children: [
177
+ /* @__PURE__ */ jsxs("div", {
178
+ className: "min-w-0 bg-background px-3 py-3",
179
+ children: [/* @__PURE__ */ jsx("p", {
180
+ className: "truncate font-mono text-xs",
181
+ children: page.path
182
+ }), /* @__PURE__ */ jsx("p", {
183
+ className: "truncate text-muted-foreground",
184
+ children: page.title ?? "No title"
185
+ })]
186
+ }),
187
+ /* @__PURE__ */ jsxs("div", {
188
+ className: "min-w-0 bg-background px-3 py-3 font-mono text-xs text-muted-foreground",
189
+ children: [/* @__PURE__ */ jsx("p", {
190
+ className: "truncate",
191
+ children: page.source ? relativeTo(built.root, page.source) : "none"
192
+ }), page.type && /* @__PURE__ */ jsx("p", {
193
+ className: "truncate",
194
+ children: page.type
195
+ })]
196
+ }),
197
+ /* @__PURE__ */ jsx("div", {
198
+ className: "bg-background px-3 py-3 font-mono text-xs",
199
+ children: page.words
200
+ }),
201
+ /* @__PURE__ */ jsxs("div", {
202
+ className: "bg-background px-3 py-3 text-xs",
203
+ children: [
204
+ page.linksIn.content,
205
+ " content",
206
+ /* @__PURE__ */ jsxs("span", {
207
+ className: "block text-muted-foreground",
208
+ children: [page.linksIn.layout, " layout"]
209
+ })
210
+ ]
211
+ }),
212
+ /* @__PURE__ */ jsx("div", {
213
+ className: "bg-background px-3 py-3 text-xs",
214
+ children: /* @__PURE__ */ jsx(FindingCount, { counts: built.findingCountsByPage[page.path] })
215
+ }),
216
+ /* @__PURE__ */ jsx("div", {
217
+ className: "flex items-center justify-center bg-background px-2 py-3",
218
+ children: /* @__PURE__ */ jsx(ArrowRight, { className: "size-4 text-muted-foreground" })
219
+ })
220
+ ]
221
+ }, page.path)), pages.length === 0 && /* @__PURE__ */ jsx("div", {
222
+ className: "p-4 text-sm text-muted-foreground",
223
+ children: "No built page matches the search."
224
+ })]
225
+ })]
226
+ })] })
227
+ ]
228
+ }), built && /* @__PURE__ */ jsxs("aside", {
229
+ className: "flex flex-col gap-4",
230
+ children: [
231
+ /* @__PURE__ */ jsxs(Panel, {
232
+ title: "Template findings",
233
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
234
+ children: [built.context.templateFindings.length === 0 ? /* @__PURE__ */ jsx("p", {
235
+ className: "text-sm text-muted-foreground",
236
+ children: "None."
237
+ }) : /* @__PURE__ */ jsx("ul", {
238
+ className: "space-y-2 text-sm",
239
+ children: built.context.templateFindings.slice(0, 5).map((finding, index) => /* @__PURE__ */ jsxs("li", {
240
+ className: "border bg-muted/30 px-2 py-1.5",
241
+ children: [/* @__PURE__ */ jsx("span", {
242
+ className: `font-medium ${severityTone(finding.severity)}`,
243
+ children: finding.code
244
+ }), /* @__PURE__ */ jsx("span", {
245
+ className: "block text-xs text-muted-foreground",
246
+ children: finding.origin.kind === "template" && `on ${plural(finding.origin.pages.length, "page")}`
247
+ })]
248
+ }, `${finding.code}-${index}`))
249
+ }), /* @__PURE__ */ jsx(Link, {
250
+ to: "/templates",
251
+ className: "mt-3 inline-block text-sm font-medium underline underline-offset-4",
252
+ children: "All template findings"
253
+ })]
254
+ }),
255
+ built.unbuiltFindings.length > 0 && /* @__PURE__ */ jsxs(Panel, {
256
+ title: "Not on a built page",
257
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
258
+ children: [/* @__PURE__ */ jsx("p", {
259
+ className: "mb-2 text-xs text-muted-foreground",
260
+ children: "Findings about a URL the build has no page for."
261
+ }), /* @__PURE__ */ jsx("ul", {
262
+ className: "space-y-2",
263
+ children: built.unbuiltFindings.map((finding, index) => /* @__PURE__ */ jsx(SiteFindingItem, {
264
+ finding,
265
+ root: built.root,
266
+ showPage: true
267
+ }, `${finding.code}-${index}`))
268
+ })]
269
+ }),
270
+ built.configFindings.length > 0 && /* @__PURE__ */ jsx(Panel, {
271
+ title: "Check settings",
272
+ icon: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "size-4" }),
273
+ children: /* @__PURE__ */ jsx(FileFindings, {
274
+ root: built.root,
275
+ findings: built.configFindings
276
+ })
277
+ }),
278
+ built.agentGuidanceFindings.length > 0 && /* @__PURE__ */ jsx(Panel, {
279
+ title: "Agent guidance",
280
+ icon: /* @__PURE__ */ jsx(Bot, { className: "size-4" }),
281
+ children: /* @__PURE__ */ jsx(FileFindings, {
282
+ root: built.root,
283
+ findings: built.agentGuidanceFindings
284
+ })
285
+ }),
286
+ /* @__PURE__ */ jsxs(Panel, {
287
+ title: "Unlinked pages",
288
+ icon: /* @__PURE__ */ jsx(Link2Off, { className: "size-4" }),
289
+ children: [/* @__PURE__ */ jsx("p", {
290
+ className: "mb-2 text-xs text-muted-foreground",
291
+ children: "Indexable pages, other than the home page, that no content link on another page points to."
292
+ }), built.context.unlinked.length === 0 ? /* @__PURE__ */ jsx("p", {
293
+ className: "text-sm text-muted-foreground",
294
+ children: "None."
295
+ }) : /* @__PURE__ */ jsx("ul", {
296
+ className: "max-h-64 space-y-1 overflow-auto text-sm",
297
+ children: built.context.unlinked.map((path) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
298
+ to: "/page",
299
+ search: { path },
300
+ className: "break-all font-mono text-xs hover:underline",
301
+ children: path
302
+ }) }, path))
303
+ })]
304
+ }),
305
+ /* @__PURE__ */ jsx(Panel, {
306
+ title: "Primary keywords",
307
+ icon: /* @__PURE__ */ jsx(KeyRound, { className: "size-4" }),
308
+ children: /* @__PURE__ */ jsx(CompetingKeywords, { keywords: built.context.keywords })
309
+ })
310
+ ]
311
+ })]
312
+ })]
313
+ });
314
+ }
315
+ function FindingCount({ counts }) {
316
+ if (!counts) return /* @__PURE__ */ jsx("span", {
317
+ className: "text-emerald-700",
318
+ children: "none"
319
+ });
320
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [counts.errors > 0 && /* @__PURE__ */ jsx("span", {
321
+ className: "block text-destructive",
322
+ children: plural(counts.errors, "error")
323
+ }), counts.warnings > 0 && /* @__PURE__ */ jsx("span", {
324
+ className: "block text-amber-700",
325
+ children: plural(counts.warnings, "warning")
326
+ })] });
327
+ }
328
+ function CompetingKeywords({ keywords }) {
329
+ const competing = keywords.filter(({ pages }) => pages.length > 1);
330
+ if (keywords.length === 0) return /* @__PURE__ */ jsx("p", {
331
+ className: "text-sm text-muted-foreground",
332
+ children: "No page declares a primary keyword."
333
+ });
334
+ if (competing.length === 0) return /* @__PURE__ */ jsxs("p", {
335
+ className: "text-sm text-muted-foreground",
336
+ children: [plural(keywords.length, "primary keyword"), ", each declared by one page."]
337
+ });
338
+ return /* @__PURE__ */ jsxs("div", {
339
+ className: "space-y-2 text-sm",
340
+ children: [/* @__PURE__ */ jsxs("p", {
341
+ className: "text-xs text-muted-foreground",
342
+ children: [
343
+ plural(keywords.length, "primary keyword"),
344
+ ", ",
345
+ competing.length,
346
+ " declared by more than one page:"
347
+ ]
348
+ }), /* @__PURE__ */ jsx("ul", {
349
+ className: "max-h-64 space-y-2 overflow-auto",
350
+ children: competing.map(({ keyword, locale, pages }) => /* @__PURE__ */ jsxs("li", {
351
+ className: "border bg-muted/30 px-2 py-1.5",
352
+ children: [/* @__PURE__ */ jsxs("p", {
353
+ className: "font-medium",
354
+ children: [keyword, locale && /* @__PURE__ */ jsxs("span", {
355
+ className: "ml-1 text-xs text-muted-foreground",
356
+ children: [
357
+ "(",
358
+ locale,
359
+ ")"
360
+ ]
361
+ })]
362
+ }), pages.map((path) => /* @__PURE__ */ jsx(Link, {
363
+ to: "/page",
364
+ search: { path },
365
+ className: "block break-all font-mono text-xs text-muted-foreground hover:underline",
366
+ children: path
367
+ }, path))]
368
+ }, `${locale ?? ""}-${keyword}`))
369
+ })]
370
+ });
371
+ }
372
+ export { SiteView as component };
@@ -0,0 +1,3 @@
1
+ // ../../node_modules/.pnpm/@tanstack+react-start@1.168.27_@rspack+core@2.3.0_@swc+helpers@0.5.23__esbuild@0.28.2_r_48926bb130be8286646afd87cbf76f34/node_modules/@tanstack/react-start/dist/plugin/default-entry/start.ts
2
+ var startInstance = void 0;
3
+ export { startInstance };
@@ -0,0 +1,123 @@
1
+ import { Link } from "@tanstack/react-router";
2
+ import { AlertTriangle, RefreshCw } from "lucide-react";
3
+ import { a as Button, d as Panel, g as severityTone, i as useSite, m as plural, p as StudioNav, u as NoBuild } from "./api-CHfynRIj.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/routes/templates.tsx?tsr-split=component
6
+ function TemplateFindings() {
7
+ const { data: site, error, refreshing, refresh } = useSite();
8
+ const findings = site?.kind === "built" ? site.context.templateFindings : [];
9
+ return /* @__PURE__ */ jsxs("main", {
10
+ className: "min-h-svh bg-background text-foreground",
11
+ children: [/* @__PURE__ */ jsx("section", {
12
+ className: "border-b bg-muted/30",
13
+ children: /* @__PURE__ */ jsxs("div", {
14
+ className: "mx-auto flex max-w-7xl flex-col gap-6 px-5 py-6",
15
+ children: [/* @__PURE__ */ jsx(StudioNav, {}), /* @__PURE__ */ jsxs("div", {
16
+ className: "flex flex-col gap-4 md:flex-row md:items-end md:justify-between",
17
+ children: [/* @__PURE__ */ jsxs("div", { children: [
18
+ /* @__PURE__ */ jsx("p", {
19
+ className: "font-mono text-xs uppercase text-muted-foreground",
20
+ children: "contentbit studio"
21
+ }),
22
+ /* @__PURE__ */ jsx("h1", {
23
+ className: "mt-1 text-3xl font-semibold tracking-tight",
24
+ children: "Template findings"
25
+ }),
26
+ /* @__PURE__ */ jsx("p", {
27
+ className: "mt-2 max-w-2xl text-sm text-muted-foreground",
28
+ children: "Findings the layout or a shared component renders rather than one page's content, each reported once with every built page it affects."
29
+ })
30
+ ] }), /* @__PURE__ */ jsxs(Button, {
31
+ onClick: refresh,
32
+ disabled: refreshing,
33
+ className: "w-fit gap-2",
34
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: refreshing ? "size-4 animate-spin" : "size-4" }), "Refresh"]
35
+ })]
36
+ })]
37
+ })
38
+ }), /* @__PURE__ */ jsxs("section", {
39
+ className: "mx-auto flex max-w-7xl flex-col gap-4 px-5 py-5",
40
+ children: [
41
+ error && /* @__PURE__ */ jsx(Panel, {
42
+ title: "Error",
43
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
44
+ children: /* @__PURE__ */ jsx("p", {
45
+ className: "text-sm text-destructive",
46
+ children: error
47
+ })
48
+ }),
49
+ !site && !error && /* @__PURE__ */ jsx("div", {
50
+ className: "border p-4 text-sm text-muted-foreground",
51
+ children: "Reading the site..."
52
+ }),
53
+ site?.kind === "unbuilt" && /* @__PURE__ */ jsx(NoBuild, { ...site }),
54
+ site?.kind === "built" && findings.length === 0 && /* @__PURE__ */ jsx("div", {
55
+ className: "border p-4 text-sm text-muted-foreground",
56
+ children: "No template findings: no finding repeats across pages from the layout."
57
+ }),
58
+ findings.map((finding, index) => /* @__PURE__ */ jsx(TemplateFinding, { finding }, `${finding.code}-${index}`))
59
+ ]
60
+ })]
61
+ });
62
+ }
63
+ function TemplateFinding({ finding }) {
64
+ if (finding.origin.kind !== "template") return null;
65
+ const { element, pages } = finding.origin;
66
+ const targets = /* @__PURE__ */ new Map();
67
+ for (const { page, target } of finding.occurrences ?? []) if (target !== void 0) targets.set(page, [...targets.get(page) ?? [], target]);
68
+ return /* @__PURE__ */ jsxs("section", {
69
+ className: "border bg-background",
70
+ children: [/* @__PURE__ */ jsxs("div", {
71
+ className: "flex flex-col gap-1 border-b bg-muted/40 px-4 py-3 md:flex-row md:items-center md:justify-between",
72
+ children: [/* @__PURE__ */ jsxs("h2", {
73
+ className: "text-sm font-semibold",
74
+ children: [
75
+ /* @__PURE__ */ jsx("span", {
76
+ className: severityTone(finding.severity),
77
+ children: finding.severity
78
+ }),
79
+ " ",
80
+ finding.code
81
+ ]
82
+ }), /* @__PURE__ */ jsxs("span", {
83
+ className: "text-xs text-muted-foreground",
84
+ children: [
85
+ /* @__PURE__ */ jsx("span", {
86
+ className: "mr-2 font-mono",
87
+ children: element
88
+ }),
89
+ "on ",
90
+ plural(pages.length, "page")
91
+ ]
92
+ })]
93
+ }), /* @__PURE__ */ jsxs("div", {
94
+ className: "space-y-3 p-4 text-sm",
95
+ children: [
96
+ /* @__PURE__ */ jsx("p", {
97
+ className: "break-words",
98
+ children: finding.message
99
+ }),
100
+ finding.hint && /* @__PURE__ */ jsx("p", {
101
+ className: "text-xs text-muted-foreground",
102
+ children: finding.hint
103
+ }),
104
+ /* @__PURE__ */ jsx("ul", {
105
+ className: "grid max-h-72 gap-1 overflow-auto md:grid-cols-2",
106
+ children: pages.map((path) => /* @__PURE__ */ jsxs("li", {
107
+ className: "min-w-0",
108
+ children: [/* @__PURE__ */ jsx(Link, {
109
+ to: "/page",
110
+ search: { path },
111
+ className: "break-all font-mono text-xs hover:underline",
112
+ children: path
113
+ }), targets.has(path) && /* @__PURE__ */ jsx("span", {
114
+ className: "ml-2 break-all font-mono text-xs text-muted-foreground",
115
+ children: targets.get(path)?.join(", ")
116
+ })]
117
+ }, path))
118
+ })
119
+ ]
120
+ })]
121
+ });
122
+ }
123
+ export { TemplateFindings as component };
@@ -1,7 +1,7 @@
1
1
  import { type ViteDevServer } from 'vite';
2
2
  import type { StartStudioOptions } from './types.js';
3
- export type { StartStudioOptions, StudioDocument, StudioFileSummary, StudioFinding, StudioGraph, StudioProject, } from './types.js';
4
- export { scanDocument, scanGraph, scanProject } from './scan.js';
3
+ export type { StartStudioOptions, StudioDocument, StudioFileSummary, StudioFinding, StudioProject, } from './types.js';
4
+ export { scanDocument, scanProject } from './scan.js';
5
5
  export interface StudioServer {
6
6
  url: string;
7
7
  close(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,MAAM,CAAA;AAIpE,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAA;AAEnE,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyDpF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,MAAM,CAAA;AAIlF,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAA;AAEnE,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6DpF"}