Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8069af1
feat(search): client side fts
larbish Aug 13, 2026
2f703a0
feat: add agent skills discovery via `/.well-known/skills` (#19)
atinux Aug 13, 2026
44c8e0e
fix(responsive): remove playground in hero on mobile
larbish Aug 14, 2026
8ea6404
run on worker
larbish Aug 14, 2026
c9a22f7
Merge branch 'main' into feat/client-side-fts-search
larbish Aug 18, 2026
d26bc6f
use comark-cms latest
larbish Aug 19, 2026
06e5eec
app search nav groups
larbish Aug 19, 2026
a783a63
debug system
larbish Aug 19, 2026
74dfd6e
Merge branch 'main' into feat/client-side-fts-search
larbish Aug 19, 2026
d1b2cbc
pnpm lock file
larbish Aug 19, 2026
060607b
up
larbish Aug 19, 2026
4017871
up
larbish Aug 20, 2026
6b95a04
use resolveContentSha
larbish Aug 20, 2026
0c602ab
Merge branch 'main' into feat/client-side-fts-search
larbish Aug 27, 2026
fccb570
up tests
larbish Aug 27, 2026
ba0354a
fix lock
larbish Aug 27, 2026
4ac9598
Merge branch 'main' into feat/client-side-fts-search
larbish Aug 28, 2026
d7f91e9
use nuxt-workers
larbish Aug 28, 2026
8658fc4
fix lockfile
larbish Aug 28, 2026
c04e129
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 2, 2026
321bb5e
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 3, 2026
a593fbd
improvements
larbish Sep 3, 2026
1f52fe8
Apply comark 4.0 changes
larbish Sep 3, 2026
b5bc5ca
try warm with function invocation
larbish Sep 4, 2026
8e65942
feat: built time snapshot
larbish Sep 4, 2026
1b49f44
Merge branch 'main' into feat/client-side-fts-search
atinux Sep 4, 2026
aa28e59
snapshot improvements
larbish Sep 7, 2026
8ed1944
add metrics
larbish Sep 7, 2026
83fb86f
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 7, 2026
2378af0
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 8, 2026
d6a2ca8
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 8, 2026
01457f6
improve icon bundle
larbish Sep 8, 2026
1b4a029
feat(content): pin instances per commit with withRef() (#42)
atinux Sep 8, 2026
e462783
small cache / driver refactor
larbish Sep 8, 2026
8a9b20f
refactor: move preview in a new util
larbish Sep 9, 2026
31e7e7b
simplify icon collections
larbish Sep 9, 2026
291fc31
nitro icon aliases
larbish Sep 9, 2026
b5ad6da
chore: update comark-content
atinux Sep 9, 2026
14a6ff0
chore: fix import snapshot + add manifest.json
atinux Sep 9, 2026
fd85d3e
always use sha to pin instance in production (no ref)
larbish Sep 9, 2026
972f26e
chore: add renovate config
benjamincanac Sep 9, 2026
d543244
chore: pin pnpm version
benjamincanac Sep 9, 2026
6423017
chore: add node engines
benjamincanac Sep 9, 2026
fd587bc
chore(pnpm): scope minimum release age excludes to comark packages
benjamincanac Sep 9, 2026
8472957
chore(deps): use `@nuxt/ui` 4.11.1 release
benjamincanac Sep 9, 2026
937adb6
Update pnpm-lock.yaml
atinux Sep 9, 2026
fdd81de
feat(cache): persist production content ref
atinux Sep 9, 2026
a31954e
fix(cache): bound production ref staleness
atinux Sep 9, 2026
bdbc1fa
chore: follow coderabbit advice
atinux Sep 9, 2026
00eb564
Merge branch 'main' into feat/client-side-fts-search
atinux Sep 9, 2026
ab69ef6
fix(cache): rotate bounded ref namespace
atinux Sep 9, 2026
09a4f13
chore(pnpm): scope comark release-age exemptions
atinux Sep 9, 2026
400ec0a
fix: build
atinux Sep 9, 2026
6559d78
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 10, 2026
3a9bdd2
use agent-discovery utils
larbish Sep 10, 2026
5056ac4
no prerendering skills
larbish Sep 10, 2026
eb9dede
Merge branch 'main' into feat/client-side-fts-search
atinux Sep 10, 2026
a12be8e
fix(config): keep an explicit `schemaOrg: false` disabled
benjamincanac Sep 10, 2026
2424b27
refactor(config): assign seeded options through the typed view
benjamincanac Sep 10, 2026
37e6d5a
fix(prose): keep default link styles for inline code
benjamincanac Sep 10, 2026
e8200ff
Merge branch 'main' into feat/client-side-fts-search
larbish Sep 10, 2026
1d75c41
chore(search): import comark-content from runtime package
larbish Sep 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default defineAppConfig({
// info: 'i-tabler-info-square-rounded-filled',
},
},
// `seo.siteName`, `header.title` and `github.*` are deliberately NOT defaulted here: modules/config.ts seeds
// `seo.siteName`, `header.title` and `github.*` are deliberately NOT defaulted here: modules/config/ seeds
// them into `nuxt.options.appConfig`, and app.config values — even empty strings — would win over those.
header: {
to: '/',
Expand Down
27 changes: 2 additions & 25 deletions app/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { NavigationItem } from 'comark-content'
import type { SearchSection } from './utils/search-sections'
import { useRoute } from 'vue-router'

const { seo, docs } = useAppConfig()
Expand All @@ -11,17 +10,6 @@ const route = useRoute()
const { data: navigation } = await useAsyncData('navigation', () => content.value.client.navigation(), {
watch: [() => content.value.base],
})
const {
data: files,
status,
execute: loadSearchSections,
} = useLazyAsyncData('search-sections', () => content.value.client.searchSections(), {
server: false,
watch: [() => content.value.base],
immediate: false,
})

onNuxtReady(() => loadSearchSections())

const nuxtApp = useNuxtApp()
const navTree = computed<NavigationItem[]>(() => prefixNavigation(navigation.value ?? [], content.value.base))
Expand All @@ -38,12 +26,6 @@ onNuxtReady(() => {
navigationLayout.value = resolveNavigationLayout()
})
})
const searchFiles = computed<SearchSection[]>(() =>
(files.value ?? []).map((section) => {
const [path, hash] = section.id.split('#')
return { ...section, id: prefixLink(path!, content.value.base) + (hash ? `#${hash}` : '') }
})
)

useHead({
meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1' }],
Expand Down Expand Up @@ -112,14 +94,9 @@ defineShortcuts({

<AppFooter />

<AppSearch :navigation="navTree" />

<ClientOnly>
<LazyUContentSearch
:files="searchFiles"
:navigation="navTree"
:transition="false"
:loading="status !== 'success'"
:placeholder="status !== 'success' ? 'Loading...' : undefined"
/>
<LazyVersionHistory />
<LazyAssistantChat v-if="assistant?.enabled && assistantMounted" />
</ClientOnly>
Expand Down
67 changes: 67 additions & 0 deletions app/components/AppSearch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script setup lang="ts">
import type { NavigationItem } from 'comark-content'

const props = defineProps<{
navigation: NavigationItem[]
}>()

const { search, status } = useSearch()

const appConfig = useAppConfig()

interface PageItem {
label: string
prefix?: string
suffix?: string
to: string
icon: string
}

/** Leaf pages, flattened; ancestor titles become the `Section > Page` prefix the palette renders. */
function pageItems(items: NavigationItem[], ancestors: string[] = []): PageItem[] {
return items.flatMap((item) => {
if (item.children?.length) return pageItems(item.children, [...ancestors, item.title])
if (!item.path || item.page === false) return []
return [{
label: item.title,
prefix: ancestors.length ? `${ancestors.join(' > ')} >` : undefined,
suffix: item.description,
to: item.path,
icon: (item.icon as string | undefined) || appConfig.ui.icons.file,
}]
})
}

function browseOnly(query: string, items?: PageItem[]): PageItem[] {
return query ? [] : (items ?? [])
}

// One group per top-level section, mirroring how `UContentSearch` groups navigation when it can.
const groups = computed(() => {
if (props.navigation.some((item) => item.children?.length)) {
return props.navigation
.filter((section) => section.children?.length)
.map((section) => ({
id: section.path,
label: section.title,
items: pageItems(section.children ?? []),
postFilter: browseOnly,
}))
.filter((group) => group.items.length > 0)
}
return [{ id: 'docs', items: pageItems(props.navigation), postFilter: browseOnly }]
})
</script>

<template>
<ClientOnly>
<LazyUContentSearch
:search="search"
:search-status="status"
:navigation="navigation"
:groups="groups"
:transition="false"
:loading="status === 'loading'"
/>
</ClientOnly>
</template>
2 changes: 1 addition & 1 deletion app/components/AssistantChat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DefaultChatTransport, isReasoningUIPart, isTextUIPart, isToolUIPart, ge
import { useChat } from '@ai-sdk/vue'
import { isPartStreaming, isToolStreaming } from '@nuxt/ui/utils/ai'
import rangi from 'comark/plugins/rangi'
import { geistTheme } from '../../utils/geist-theme'
import { geistTheme } from '../../utils/geist'

const MAX_INPUT = 1000

Expand Down
2 changes: 1 addition & 1 deletion app/components/landing/LandingHeroDemo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import rangi from 'comark/plugins/rangi'
import { geistTheme } from '../../../utils/geist-theme'
import { geistTheme } from '../../../utils/geist'

const props = defineProps<{
/** Markdown source: shown highlighted in the source tab, rendered live in the output tab. */
Expand Down
3 changes: 0 additions & 3 deletions app/composables/useDocsContent.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { createContentClient } from 'comark-content/client'
import { searchSectionsClient } from '../utils/search-sections'
import type { ContentMode } from '../types/content'
import { withLeadingSlash } from 'ufo'

export const prodContent = createContentClient({
basePath: '/api/content',
fetch: $fetch,
plugins: [searchSectionsClient()],
})

const clients = new Map<string, typeof prodContent>()
Expand All @@ -17,7 +15,6 @@ function getClient(basePath: string) {
client = createContentClient({
basePath,
fetch: $fetch,
plugins: [searchSectionsClient()],
})
clients.set(basePath, client)
}
Expand Down
61 changes: 61 additions & 0 deletions app/composables/useSearch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type { SearchOptions, SearchResult } from 'comark-content'

type SearchStatus = 'idle' | 'loading' | 'ready' | 'error'

const status = ref<SearchStatus>('idle')

/**
* Hydration logging switch: `?debug=search`
*/
function searchDebug(): boolean {
if (!import.meta.client) return false
return new URLSearchParams(location.search).get('debug') === 'search'
}

/**
* Client-side full-text search over production content (sqlite-wasm FTS5) hydrated from the
* per-commit snapshot artifacts.
*/
export function useSearch() {
const { data: headSha } = useAsyncData(
'content-head-sha',
() => $fetch<{ sha: string | null }>('/api/content/head').then(({ sha }) => sha),
{ default: () => null }
)

/**
* Load the database.
* No-op once loading or ready; retries after a failure.
*/
async function warmup(): Promise<void> {
if (status.value === 'loading' || status.value === 'ready') return
status.value = 'loading'
try {
if (!headSha.value && !import.meta.dev) {
throw new Error('[search] /api/content/head returned no commit pin')
}

// Immutable per-commit artifacts, CDN-cached forever. Only unpinned in dev, per the guard above.
const apiBase = headSha.value ? `/api/content/blob/${headSha.value}` : '/api/content'

const debug = searchDebug()
if (debug) console.info(`[search] warmup from ${apiBase} (head ${headSha.value ?? 'unpinned'})`)

await warmupSearch(apiBase, location.origin, debug)
status.value = 'ready'
} catch (error) {
status.value = 'error'
console.error('[search] could not load the search database', error)
}
}

if (import.meta.client) {
onNuxtReady(warmup)
}

async function search(query: string, opts?: SearchOptions): Promise<SearchResult[]> {
return searchContent(query, opts)
}

return { search, status: readonly(status), warmup }
}
10 changes: 1 addition & 9 deletions app/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ useSeoMeta({
})

const { data: navigation } = await useAsyncData('navigation', () => prodContent.navigation())
const { data: files } = useLazyAsyncData('search-sections', () => prodContent.searchSections(), {
server: false,
})

provide('navigation', navigation)
</script>
Expand All @@ -32,11 +29,6 @@ provide('navigation', navigation)

<AppFooter />

<ClientOnly>
<LazyUContentSearch
:files="files ?? []"
:navigation="navigation ?? []"
/>
</ClientOnly>
<AppSearch :navigation="navigation ?? []" />
Comment thread
atinux marked this conversation as resolved.
</UApp>
</template>
2 changes: 1 addition & 1 deletion app/utils/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function walk(items: NavigationItem[], path: string): boolean {
return false
}

export { findFirstLeaf } from '../../utils/first-leaf'
export { findFirstLeaf } from '../../utils/navigation'

export interface BreadcrumbItem {
title: string
Expand Down
23 changes: 0 additions & 23 deletions app/utils/search-sections.ts

This file was deleted.

69 changes: 69 additions & 0 deletions app/workers/internal/search-logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Logging for the search worker.
*
* Triggered by `?debug=search` param.
*/
import type { ContentFile, Logger, RelationalDatabase } from 'comark-content/runtime'

const PREFIX = '[search:worker]'

let debug = false

/** Called on every `warmup`; once on, it stays on for the life of the worker. */
export function setDebug(value: boolean): void {
debug = debug || value
}

export function isDebug(): boolean {
return debug
}

export function log(...args: unknown[]): void {
if (debug) console.info(PREFIX, ...args)
}

/** Milliseconds since `from`, for log lines. */
export function since(from: number): string {
return `${(performance.now() - from).toFixed(1)}ms`
}

/**
* Warn and error are deliberately ungated: the FTS plugin reports a missing snapshot through this
* channel, and that failure is otherwise indistinguishable from "the query matched nothing".
*/
export const logger: Logger = {
debug: (tag, ...args) => log(`${tag}:`, ...args),
info: (tag, ...args) => log(`${tag}:`, ...args),
warn: (tag, ...args) => console.warn(`${PREFIX} ${tag}:`, ...args),
error: (tag, ...args) => console.error(`${PREFIX} ${tag}:`, ...args),
}

/**
* What a decoded artifact holds: a snapshot decodes to the source's items, the manifest to an object
* keyed by path. `with nodes` is the number that matters — the FTS plugin indexes
* `kind === 'document' && nodes?.length`, so a bodies-less (partial) snapshot builds an empty index.
*/
export function describeArtifact(decoded: unknown): string {
if (Array.isArray(decoded)) {
const items = decoded as ContentFile[]
const documents = items.filter((item) => item.meta.kind === 'document')
const withNodes = documents.filter((item) => item.nodes?.length)
return `${items.length} item(s), ${documents.length} document(s), ${withNodes.length} with nodes`
}
const items = (decoded as { items?: Record<string, unknown> } | null)?.items
return `${items ? Object.keys(items).length : 0} manifest item(s)`
}

/**
* Rows in the FTS plugin's index — the one number that separates "nothing was indexed" from "the
* query found nothing", since `search()` catches SQL errors and returns `[]` either way. Reads the
* plugin's private table, so it is a diagnostic, not something to build on.
*/
export async function indexedRows(database: RelationalDatabase, source: string): Promise<number | string> {
try {
const rows = await database.all<{ n: number }>('SELECT count(*) as n FROM __fts_search WHERE source = ?', [source])
return rows?.[0]?.n ?? 'unknown'
} catch (error) {
return `unknown (${error instanceof Error ? error.message : String(error)})`
}
}
Loading
Loading