@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.
- package/README.md +19 -9
- package/dist/client/assets/api-aCc2x-IO.js +1 -0
- package/dist/client/assets/arrow-right-tp4VknZo.js +1 -0
- package/dist/client/assets/document-DIh3ZPXr.js +56 -0
- package/dist/client/assets/documents-CjBZYbQ4.js +1 -0
- package/dist/client/assets/file-code-corner-Fzc5liO9.js +1 -0
- package/dist/client/assets/file-text-B8O46COn.js +1 -0
- package/dist/client/assets/index-Cd04OFZT.js +11 -0
- package/dist/client/assets/page-BMU8eIrR.js +1 -0
- package/dist/client/assets/routes-WndCJoku.js +1 -0
- package/dist/client/assets/search-BnUPH8AI.js +1 -0
- package/dist/client/assets/styles-hAsz_paS.css +2 -0
- package/dist/client/assets/target-BMSXP2fU.js +1 -0
- package/dist/client/assets/templates-IJid1Zwh.js +1 -0
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/assets/_tanstack-start-manifest_v-WfZ3uz_l.js +69 -0
- package/dist/server/assets/api-CHfynRIj.js +342 -0
- package/dist/server/assets/{document-DSV89Ser.js → document-BjPXZ9gS.js} +2529 -1317
- package/dist/server/assets/{routes-FGdym0e5.js → documents-jT4KnSkA.js} +63 -112
- package/dist/server/assets/empty-plugin-adapters-Ctp1ZmyT.js +4 -0
- package/dist/server/assets/page--xw7NmtK.js +388 -0
- package/dist/server/assets/router-xI8HUWRI.js +125 -0
- package/dist/server/assets/routes-CfwU-Ww2.js +372 -0
- package/dist/server/assets/start-Dk-BJfGT.js +3 -0
- package/dist/server/assets/templates--9wK-MK9.js +123 -0
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +6104 -110
- package/dist/server/scan.d.ts +1 -2
- package/dist/server/scan.d.ts.map +1 -1
- package/dist/server/server.js +3150 -1878
- package/dist/server/site.d.ts +38 -0
- package/dist/server/site.d.ts.map +1 -0
- package/dist/server/types.d.ts +33 -31
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +26 -15
- package/src/components/studio.test.ts +10 -0
- package/src/components/studio.tsx +209 -0
- package/src/lib/api.test.ts +80 -0
- package/src/lib/api.ts +68 -7
- package/src/routeTree.gen.ts +57 -3
- package/src/routes/document.tsx +34 -88
- package/src/routes/documents.tsx +433 -0
- package/src/routes/index.tsx +295 -414
- package/src/routes/page.tsx +401 -0
- package/src/routes/templates.tsx +104 -0
- package/src/server/api.ts +19 -3
- package/src/server/index.ts +31 -12
- package/src/server/scan.test.ts +31 -44
- package/src/server/scan.ts +56 -82
- package/src/server/site.test.ts +355 -0
- package/src/server/site.ts +164 -0
- package/src/server/types.ts +28 -30
- package/tsconfig.json +1 -1
- package/dist/client/assets/api-BX-WUPtV.js +0 -1
- package/dist/client/assets/document-BOMp4_F5.js +0 -65
- package/dist/client/assets/index-C0ybJ4zQ.js +0 -12
- package/dist/client/assets/routes-ACKdIhYm.js +0 -1
- package/dist/client/assets/styles-DogO4Wcf.css +0 -2
- package/dist/server/assets/_tanstack-start-manifest_v-BC1PNuB0.js +0 -25
- package/dist/server/assets/api-Bqt_atjc.js +0 -72
- package/dist/server/assets/document-BB_UYqNL.js +0 -9
- package/dist/server/assets/empty-plugin-adapters-De7E1vAI.js +0 -5
- package/dist/server/assets/router-BJiN6b7L.js +0 -63
- package/dist/server/assets/routes-p0tk6PAr.js +0 -20
- package/dist/server/assets/start-m8EQRpUf.js +0 -4
package/src/routeTree.gen.ts
CHANGED
|
@@ -9,9 +9,27 @@
|
|
|
9
9
|
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
10
10
|
|
|
11
11
|
import { Route as rootRouteImport } from './routes/__root'
|
|
12
|
+
import { Route as TemplatesRouteImport } from './routes/templates'
|
|
13
|
+
import { Route as PageRouteImport } from './routes/page'
|
|
14
|
+
import { Route as DocumentsRouteImport } from './routes/documents'
|
|
12
15
|
import { Route as DocumentRouteImport } from './routes/document'
|
|
13
16
|
import { Route as IndexRouteImport } from './routes/index'
|
|
14
17
|
|
|
18
|
+
const TemplatesRoute = TemplatesRouteImport.update({
|
|
19
|
+
id: '/templates',
|
|
20
|
+
path: '/templates',
|
|
21
|
+
getParentRoute: () => rootRouteImport,
|
|
22
|
+
} as any)
|
|
23
|
+
const PageRoute = PageRouteImport.update({
|
|
24
|
+
id: '/page',
|
|
25
|
+
path: '/page',
|
|
26
|
+
getParentRoute: () => rootRouteImport,
|
|
27
|
+
} as any)
|
|
28
|
+
const DocumentsRoute = DocumentsRouteImport.update({
|
|
29
|
+
id: '/documents',
|
|
30
|
+
path: '/documents',
|
|
31
|
+
getParentRoute: () => rootRouteImport,
|
|
32
|
+
} as any)
|
|
15
33
|
const DocumentRoute = DocumentRouteImport.update({
|
|
16
34
|
id: '/document',
|
|
17
35
|
path: '/document',
|
|
@@ -26,31 +44,64 @@ const IndexRoute = IndexRouteImport.update({
|
|
|
26
44
|
export interface FileRoutesByFullPath {
|
|
27
45
|
'/': typeof IndexRoute
|
|
28
46
|
'/document': typeof DocumentRoute
|
|
47
|
+
'/documents': typeof DocumentsRoute
|
|
48
|
+
'/page': typeof PageRoute
|
|
49
|
+
'/templates': typeof TemplatesRoute
|
|
29
50
|
}
|
|
30
51
|
export interface FileRoutesByTo {
|
|
31
52
|
'/': typeof IndexRoute
|
|
32
53
|
'/document': typeof DocumentRoute
|
|
54
|
+
'/documents': typeof DocumentsRoute
|
|
55
|
+
'/page': typeof PageRoute
|
|
56
|
+
'/templates': typeof TemplatesRoute
|
|
33
57
|
}
|
|
34
58
|
export interface FileRoutesById {
|
|
35
59
|
__root__: typeof rootRouteImport
|
|
36
60
|
'/': typeof IndexRoute
|
|
37
61
|
'/document': typeof DocumentRoute
|
|
62
|
+
'/documents': typeof DocumentsRoute
|
|
63
|
+
'/page': typeof PageRoute
|
|
64
|
+
'/templates': typeof TemplatesRoute
|
|
38
65
|
}
|
|
39
66
|
export interface FileRouteTypes {
|
|
40
67
|
fileRoutesByFullPath: FileRoutesByFullPath
|
|
41
|
-
fullPaths: '/' | '/document'
|
|
68
|
+
fullPaths: '/' | '/document' | '/documents' | '/page' | '/templates'
|
|
42
69
|
fileRoutesByTo: FileRoutesByTo
|
|
43
|
-
to: '/' | '/document'
|
|
44
|
-
id: '__root__' | '/' | '/document'
|
|
70
|
+
to: '/' | '/document' | '/documents' | '/page' | '/templates'
|
|
71
|
+
id: '__root__' | '/' | '/document' | '/documents' | '/page' | '/templates'
|
|
45
72
|
fileRoutesById: FileRoutesById
|
|
46
73
|
}
|
|
47
74
|
export interface RootRouteChildren {
|
|
48
75
|
IndexRoute: typeof IndexRoute
|
|
49
76
|
DocumentRoute: typeof DocumentRoute
|
|
77
|
+
DocumentsRoute: typeof DocumentsRoute
|
|
78
|
+
PageRoute: typeof PageRoute
|
|
79
|
+
TemplatesRoute: typeof TemplatesRoute
|
|
50
80
|
}
|
|
51
81
|
|
|
52
82
|
declare module '@tanstack/react-router' {
|
|
53
83
|
interface FileRoutesByPath {
|
|
84
|
+
'/templates': {
|
|
85
|
+
id: '/templates'
|
|
86
|
+
path: '/templates'
|
|
87
|
+
fullPath: '/templates'
|
|
88
|
+
preLoaderRoute: typeof TemplatesRouteImport
|
|
89
|
+
parentRoute: typeof rootRouteImport
|
|
90
|
+
}
|
|
91
|
+
'/page': {
|
|
92
|
+
id: '/page'
|
|
93
|
+
path: '/page'
|
|
94
|
+
fullPath: '/page'
|
|
95
|
+
preLoaderRoute: typeof PageRouteImport
|
|
96
|
+
parentRoute: typeof rootRouteImport
|
|
97
|
+
}
|
|
98
|
+
'/documents': {
|
|
99
|
+
id: '/documents'
|
|
100
|
+
path: '/documents'
|
|
101
|
+
fullPath: '/documents'
|
|
102
|
+
preLoaderRoute: typeof DocumentsRouteImport
|
|
103
|
+
parentRoute: typeof rootRouteImport
|
|
104
|
+
}
|
|
54
105
|
'/document': {
|
|
55
106
|
id: '/document'
|
|
56
107
|
path: '/document'
|
|
@@ -71,6 +122,9 @@ declare module '@tanstack/react-router' {
|
|
|
71
122
|
const rootRouteChildren: RootRouteChildren = {
|
|
72
123
|
IndexRoute: IndexRoute,
|
|
73
124
|
DocumentRoute: DocumentRoute,
|
|
125
|
+
DocumentsRoute: DocumentsRoute,
|
|
126
|
+
PageRoute: PageRoute,
|
|
127
|
+
TemplatesRoute: TemplatesRoute,
|
|
74
128
|
}
|
|
75
129
|
export const routeTree = rootRouteImport
|
|
76
130
|
._addFileChildren(rootRouteChildren)
|
package/src/routes/document.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatSeoBriefMarkdown, type SeoBrief, type
|
|
1
|
+
import { formatSeoBriefMarkdown, type SeoBrief, type SeoBriefPage } from '@contentbit/core'
|
|
2
2
|
import { createFileRoute, Link } from '@tanstack/react-router'
|
|
3
3
|
import {
|
|
4
4
|
AlertTriangle,
|
|
@@ -12,17 +12,17 @@ import {
|
|
|
12
12
|
FileJson,
|
|
13
13
|
FileText,
|
|
14
14
|
ListChecks,
|
|
15
|
-
Link2,
|
|
16
15
|
RefreshCw,
|
|
17
16
|
Search,
|
|
18
17
|
Target,
|
|
19
18
|
} from 'lucide-react'
|
|
20
19
|
import type { ReactNode } from 'react'
|
|
21
|
-
import {
|
|
20
|
+
import { Fragment, useMemo, useState } from 'react'
|
|
22
21
|
|
|
22
|
+
import { StudioNav } from '../components/studio'
|
|
23
23
|
import { Button } from '../components/ui/button'
|
|
24
|
-
import {
|
|
25
|
-
import type {
|
|
24
|
+
import { useDocument } from '../lib/api'
|
|
25
|
+
import type { StudioFinding } from '../server/types'
|
|
26
26
|
|
|
27
27
|
interface DocumentSearch {
|
|
28
28
|
path: string
|
|
@@ -37,39 +37,19 @@ export const Route = createFileRoute('/document')({
|
|
|
37
37
|
|
|
38
38
|
function DocumentDetail() {
|
|
39
39
|
const search = Route.useSearch()
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const [refreshing, setRefreshing] = useState(false)
|
|
43
|
-
|
|
44
|
-
async function refresh() {
|
|
45
|
-
if (!search.path) {
|
|
46
|
-
setError('Missing document path.')
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
setRefreshing(true)
|
|
50
|
-
setError(null)
|
|
51
|
-
try {
|
|
52
|
-
setDocument(await fetchDocument(search.path))
|
|
53
|
-
} catch (err) {
|
|
54
|
-
setError(err instanceof Error ? err.message : String(err))
|
|
55
|
-
} finally {
|
|
56
|
-
setRefreshing(false)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
void refresh()
|
|
62
|
-
}, [search.path])
|
|
40
|
+
const { data: document, error: loadError, refreshing, refresh } = useDocument(search.path)
|
|
41
|
+
const error = search.path ? loadError : 'Missing document path.'
|
|
63
42
|
|
|
64
43
|
return (
|
|
65
44
|
<main className="min-h-svh bg-background text-foreground">
|
|
66
45
|
<header className="border-b bg-muted/30">
|
|
67
46
|
<div className="mx-auto flex max-w-7xl flex-col gap-5 px-5 py-5">
|
|
47
|
+
<StudioNav />
|
|
68
48
|
<div className="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
|
|
69
49
|
<Button asChild variant="outline" className="w-fit gap-2">
|
|
70
|
-
<Link to="/" search={{ q: '', status: 'all', sort: 'status', dir: 'asc' }}>
|
|
50
|
+
<Link to="/documents" search={{ q: '', status: 'all', sort: 'status', dir: 'asc' }}>
|
|
71
51
|
<ArrowLeft className="size-4" />
|
|
72
|
-
|
|
52
|
+
Documents
|
|
73
53
|
</Link>
|
|
74
54
|
</Button>
|
|
75
55
|
<Button onClick={refresh} disabled={refreshing} className="w-fit gap-2">
|
|
@@ -86,6 +66,25 @@ function DocumentDetail() {
|
|
|
86
66
|
<h1 className="mt-1 break-words text-3xl font-semibold tracking-tight">
|
|
87
67
|
{document.file.title}
|
|
88
68
|
</h1>
|
|
69
|
+
<p className="mt-1 text-sm">
|
|
70
|
+
{document.pages.length > 1 ? 'Built pages' : 'Built page'}:{' '}
|
|
71
|
+
{document.pages.length === 0 ? (
|
|
72
|
+
<span className="text-muted-foreground">none</span>
|
|
73
|
+
) : (
|
|
74
|
+
document.pages.map((page, index) => (
|
|
75
|
+
<Fragment key={page}>
|
|
76
|
+
{index > 0 && ', '}
|
|
77
|
+
<Link
|
|
78
|
+
to="/page"
|
|
79
|
+
search={{ path: page }}
|
|
80
|
+
className="font-mono underline underline-offset-4"
|
|
81
|
+
>
|
|
82
|
+
{page}
|
|
83
|
+
</Link>
|
|
84
|
+
</Fragment>
|
|
85
|
+
))
|
|
86
|
+
)}
|
|
87
|
+
</p>
|
|
89
88
|
<div className="mt-3 flex flex-wrap gap-2 text-xs">
|
|
90
89
|
<Badge>{document.file.status}</Badge>
|
|
91
90
|
<Badge>{document.file.words} words</Badge>
|
|
@@ -125,7 +124,7 @@ function DocumentDetail() {
|
|
|
125
124
|
|
|
126
125
|
{document.seoBrief && (
|
|
127
126
|
<Panel title="Brief" icon={<Target className="size-4" />}>
|
|
128
|
-
<SeoBriefView brief={document.seoBrief} />
|
|
127
|
+
<SeoBriefView brief={document.seoBrief} intent={document.file.seo?.intent} />
|
|
129
128
|
</Panel>
|
|
130
129
|
)}
|
|
131
130
|
|
|
@@ -153,11 +152,6 @@ function DocumentDetail() {
|
|
|
153
152
|
/>
|
|
154
153
|
</Panel>
|
|
155
154
|
|
|
156
|
-
<Panel title="Links" icon={<Link2 className="size-4" />}>
|
|
157
|
-
<LinkList title="Outgoing" items={document.linksTo} />
|
|
158
|
-
<LinkList title="Backlinks" items={document.linkedFrom} />
|
|
159
|
-
</Panel>
|
|
160
|
-
|
|
161
155
|
<Panel title="Keywords" icon={<Braces className="size-4" />}>
|
|
162
156
|
{document.file.keywords ? (
|
|
163
157
|
<div className="space-y-3 text-sm">
|
|
@@ -245,7 +239,7 @@ function MetricGrid({ items }: { items: Array<[string, number | string]> }) {
|
|
|
245
239
|
|
|
246
240
|
type BriefFormat = 'markdown' | 'json'
|
|
247
241
|
|
|
248
|
-
function SeoBriefView({ brief }: { brief: SeoBrief }) {
|
|
242
|
+
function SeoBriefView({ brief, intent }: { brief: SeoBrief; intent?: string }) {
|
|
249
243
|
const [rawFormat, setRawFormat] = useState<BriefFormat>('markdown')
|
|
250
244
|
const [copiedFormat, setCopiedFormat] = useState<BriefFormat | null>(null)
|
|
251
245
|
const markdown = useMemo(() => formatSeoBriefMarkdown(brief), [brief])
|
|
@@ -276,7 +270,7 @@ function SeoBriefView({ brief }: { brief: SeoBrief }) {
|
|
|
276
270
|
<div className="flex flex-wrap gap-1">
|
|
277
271
|
<Badge>{brief.target.source}</Badge>
|
|
278
272
|
{brief.target.type && <Badge>{brief.target.type}</Badge>}
|
|
279
|
-
{
|
|
273
|
+
{intent && <Badge>{intent}</Badge>}
|
|
280
274
|
</div>
|
|
281
275
|
<h3 className="mt-2 break-words text-xl font-semibold">
|
|
282
276
|
{brief.target.title ?? brief.target.key ?? brief.target.slug ?? brief.target.id}
|
|
@@ -285,7 +279,6 @@ function SeoBriefView({ brief }: { brief: SeoBrief }) {
|
|
|
285
279
|
<BriefMeta label="id" value={brief.target.id} />
|
|
286
280
|
<BriefMeta label="key" value={brief.target.key} />
|
|
287
281
|
<BriefMeta label="slug" value={brief.target.slug} />
|
|
288
|
-
<BriefMeta label="primary" value={brief.target.keywords?.primary} />
|
|
289
282
|
</div>
|
|
290
283
|
</div>
|
|
291
284
|
<div className="flex flex-wrap gap-2">
|
|
@@ -338,8 +331,6 @@ function SeoBriefView({ brief }: { brief: SeoBrief }) {
|
|
|
338
331
|
|
|
339
332
|
<div className="grid gap-5 lg:grid-cols-2">
|
|
340
333
|
<div className="space-y-4">
|
|
341
|
-
<KeywordList title="Secondary Keywords" items={brief.target.keywords?.secondary} />
|
|
342
|
-
<KeywordList title="LSI Keywords" items={brief.target.keywords?.lsi} />
|
|
343
334
|
<BriefList
|
|
344
335
|
title="Required Sections"
|
|
345
336
|
items={brief.requiredSections.map((section) => section.headings.join(' / '))}
|
|
@@ -349,10 +340,6 @@ function SeoBriefView({ brief }: { brief: SeoBrief }) {
|
|
|
349
340
|
</div>
|
|
350
341
|
<div className="space-y-4">
|
|
351
342
|
<BriefList title="Required Links" items={brief.requiredLinksTo} />
|
|
352
|
-
<BriefList
|
|
353
|
-
title="Current Findings"
|
|
354
|
-
items={brief.findings.map((finding) => `${finding.code}: ${finding.message}`)}
|
|
355
|
-
/>
|
|
356
343
|
<RelatedPages pages={brief.relatedPages} />
|
|
357
344
|
<BriefList
|
|
358
345
|
title="Acceptance"
|
|
@@ -407,20 +394,6 @@ function BriefMeta({ label, value }: { label: string; value?: string }) {
|
|
|
407
394
|
)
|
|
408
395
|
}
|
|
409
396
|
|
|
410
|
-
function KeywordList({ title, items }: { title: string; items?: string[] }) {
|
|
411
|
-
if (!items?.length) return null
|
|
412
|
-
return (
|
|
413
|
-
<div>
|
|
414
|
-
<p className="mb-2 text-xs uppercase text-muted-foreground">{title}</p>
|
|
415
|
-
<div className="flex flex-wrap gap-1">
|
|
416
|
-
{items.map((item) => (
|
|
417
|
-
<Badge key={item}>{item}</Badge>
|
|
418
|
-
))}
|
|
419
|
-
</div>
|
|
420
|
-
</div>
|
|
421
|
-
)
|
|
422
|
-
}
|
|
423
|
-
|
|
424
397
|
function BriefList({ title, items, icon }: { title: string; items: string[]; icon?: ReactNode }) {
|
|
425
398
|
if (items.length === 0) return null
|
|
426
399
|
return (
|
|
@@ -440,7 +413,7 @@ function BriefList({ title, items, icon }: { title: string; items: string[]; ico
|
|
|
440
413
|
)
|
|
441
414
|
}
|
|
442
415
|
|
|
443
|
-
function RelatedPages({ pages }: { pages:
|
|
416
|
+
function RelatedPages({ pages }: { pages: SeoBriefPage[] }) {
|
|
444
417
|
if (pages.length === 0) return null
|
|
445
418
|
return (
|
|
446
419
|
<div>
|
|
@@ -461,28 +434,6 @@ function RelatedPages({ pages }: { pages: SeoPage[] }) {
|
|
|
461
434
|
)
|
|
462
435
|
}
|
|
463
436
|
|
|
464
|
-
function LinkList({ title, items }: { title: string; items: StudioDocument['linksTo'] }) {
|
|
465
|
-
return (
|
|
466
|
-
<div className="mb-4 last:mb-0">
|
|
467
|
-
<p className="mb-2 text-xs uppercase text-muted-foreground">{title}</p>
|
|
468
|
-
{items.length > 0 ? (
|
|
469
|
-
<ul className="space-y-1 text-sm">
|
|
470
|
-
{items.map((item, index) => (
|
|
471
|
-
<li
|
|
472
|
-
key={`${linkLabel(item)}-${index}`}
|
|
473
|
-
className="truncate border bg-muted/40 px-2 py-1"
|
|
474
|
-
>
|
|
475
|
-
{linkLabel(item)}
|
|
476
|
-
</li>
|
|
477
|
-
))}
|
|
478
|
-
</ul>
|
|
479
|
-
) : (
|
|
480
|
-
<p className="text-sm text-muted-foreground">None</p>
|
|
481
|
-
)}
|
|
482
|
-
</div>
|
|
483
|
-
)
|
|
484
|
-
}
|
|
485
|
-
|
|
486
437
|
function FindingItem({ finding }: { finding: StudioFinding }) {
|
|
487
438
|
const tone =
|
|
488
439
|
finding.severity === 'error'
|
|
@@ -504,12 +455,7 @@ function FindingItem({ finding }: { finding: StudioFinding }) {
|
|
|
504
455
|
)
|
|
505
456
|
}
|
|
506
457
|
|
|
507
|
-
function
|
|
508
|
-
if (typeof item === 'string') return item
|
|
509
|
-
return item.target ?? item.key ?? item.slug
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
function pageLabel(page: SeoPage): string {
|
|
458
|
+
function pageLabel(page: SeoBriefPage): string {
|
|
513
459
|
return page.title ?? page.key ?? page.slug ?? page.id
|
|
514
460
|
}
|
|
515
461
|
|