release: bump version to 0.49.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,19 @@ export interface DocsEntry {
|
||||
title: string
|
||||
group: DocsGroup
|
||||
order: number
|
||||
loader: () => Promise<string>
|
||||
access: DocsAccess
|
||||
}
|
||||
|
||||
export type DocsAccess = 'public' | 'docs_user' | 'docs_developer' | 'docs_admin'
|
||||
|
||||
export interface DocsCatalogItem {
|
||||
slug: string
|
||||
filename: string
|
||||
lang: DocsLang
|
||||
title: string
|
||||
group: DocsGroup
|
||||
order: number
|
||||
access: DocsAccess
|
||||
}
|
||||
|
||||
export interface DocsHeading {
|
||||
@@ -16,7 +28,7 @@ export interface DocsHeading {
|
||||
text: string
|
||||
}
|
||||
|
||||
interface DocsMetadataEntry {
|
||||
export interface DocsMetadataEntry {
|
||||
zh: { title: string; group: DocsGroup; order: number }
|
||||
en: { title: string; group: DocsGroup; order: number }
|
||||
}
|
||||
@@ -48,17 +60,7 @@ const DOCS_README_FILENAME = 'README.md'
|
||||
const MAX_HEADING_ID_LENGTH = 80
|
||||
export const defaultDocsSlug = 'overview'
|
||||
|
||||
const zhModules = import.meta.glob('../../../../docs/technical/zh/*.md', {
|
||||
query: '?raw',
|
||||
import: 'default',
|
||||
})
|
||||
|
||||
const enModules = import.meta.glob('../../../../docs/technical/en/*.md', {
|
||||
query: '?raw',
|
||||
import: 'default',
|
||||
})
|
||||
|
||||
const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
export const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
[DOCS_README_FILENAME]: {
|
||||
zh: { title: '技术文档', group: 'Overview', order: 0 },
|
||||
en: { title: 'Technical Docs', group: 'Overview', order: 0 },
|
||||
@@ -71,6 +73,10 @@ const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
zh: { title: 'Planet 使用手册', group: 'Manual', order: 2 },
|
||||
en: { title: 'Planet Manual', group: 'Manual', order: 2 },
|
||||
},
|
||||
'location-pipeline-user.md': {
|
||||
zh: { title: 'Earth 位置候选采集使用手册', group: 'Manual', order: 3 },
|
||||
en: { title: 'Earth Location Candidate Collection User Guide', group: 'Manual', order: 3 },
|
||||
},
|
||||
'earth-frontend-context.md': {
|
||||
zh: { title: 'Earth 前端结构', group: 'Earth', order: 10 },
|
||||
en: { title: 'Earth Frontend Context', group: 'Earth', order: 10 },
|
||||
@@ -99,6 +105,10 @@ const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
zh: { title: 'Earth 可交互图标接入', group: 'Earth', order: 16 },
|
||||
en: { title: 'Earth Interactable Usage', group: 'Earth', order: 16 },
|
||||
},
|
||||
'earth-toolbar-overlay-coordination.md': {
|
||||
zh: { title: 'Earth 工具栏与浮层协同', group: 'Earth', order: 17 },
|
||||
en: { title: 'Earth Toolbar and Overlay Coordination', group: 'Earth', order: 17 },
|
||||
},
|
||||
'frontend-admin-frontend-context.md': {
|
||||
zh: { title: '控制台前端结构', group: 'Frontend', order: 20 },
|
||||
en: { title: 'Admin Frontend Context', group: 'Frontend', order: 20 },
|
||||
@@ -107,6 +117,10 @@ const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
zh: { title: '前端布局指南', group: 'Frontend', order: 21 },
|
||||
en: { title: 'Frontend Layout Guidelines', group: 'Frontend', order: 21 },
|
||||
},
|
||||
'docs-gatekeeper-development.md': {
|
||||
zh: { title: 'Docs Gatekeeper 开发说明', group: 'Frontend', order: 22 },
|
||||
en: { title: 'Docs Gatekeeper Development Guide', group: 'Frontend', order: 22 },
|
||||
},
|
||||
'backend-collectors.md': {
|
||||
zh: { title: '数据采集系统', group: 'Backend', order: 30 },
|
||||
en: { title: 'Data Collectors', group: 'Backend', order: 30 },
|
||||
@@ -119,6 +133,14 @@ const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
zh: { title: '数据源、采集器设置与连接验证', group: 'Backend', order: 32 },
|
||||
en: { title: 'Datasource Collector Settings and Connectivity', group: 'Backend', order: 32 },
|
||||
},
|
||||
'backend-datasources-api-performance.md': {
|
||||
zh: { title: '数据源 API 性能', group: 'Backend', order: 33 },
|
||||
en: { title: 'Datasource API Performance', group: 'Backend', order: 33 },
|
||||
},
|
||||
'location-pipeline-development.md': {
|
||||
zh: { title: '通用位置估算管线开发说明', group: 'Backend', order: 34 },
|
||||
en: { title: 'Shared Location Resolution Pipeline Development Guide', group: 'Backend', order: 34 },
|
||||
},
|
||||
'agents-aiprovider.md': {
|
||||
zh: { title: 'AI Provider 指南', group: 'Agents', order: 40 },
|
||||
en: { title: 'AI Provider Guide', group: 'Agents', order: 40 },
|
||||
@@ -127,47 +149,35 @@ const DOCS_METADATA: Record<string, DocsMetadataEntry> = {
|
||||
zh: { title: 'Docker + Compose + Buildx 升级', group: 'Ops', order: 50 },
|
||||
en: { title: 'Docker + Compose + Buildx Upgrade', group: 'Ops', order: 50 },
|
||||
},
|
||||
'ops-planet-sh-startup.md': {
|
||||
zh: { title: 'planet.sh 启动机制', group: 'Ops', order: 51 },
|
||||
en: { title: 'planet.sh Startup', group: 'Ops', order: 51 },
|
||||
},
|
||||
}
|
||||
|
||||
const GROUP_ORDER: DocsGroup[] = ['Overview', 'Manual', 'Earth', 'Frontend', 'Backend', 'Agents', 'Ops', 'Other']
|
||||
|
||||
const ALL_KNOWN_SLUGS = new Set(
|
||||
Object.keys(DOCS_METADATA).map((filename) =>
|
||||
filename === DOCS_README_FILENAME ? defaultDocsSlug : filename.replace(/\.md$/, '')
|
||||
)
|
||||
)
|
||||
|
||||
function filenameFromPath(path: string): string {
|
||||
return path.split('/').pop() || path
|
||||
}
|
||||
|
||||
export function slugFromFilename(filename: string): string {
|
||||
return filename === DOCS_README_FILENAME ? defaultDocsSlug : filename.replace(/\.md$/, '')
|
||||
}
|
||||
|
||||
export function getDocsEntries(lang: DocsLang): DocsEntry[] {
|
||||
const modules = lang === 'zh' ? zhModules : enModules
|
||||
return Object.entries(modules)
|
||||
.filter(([path]) => DOCS_METADATA[filenameFromPath(path)])
|
||||
.map(([path, loader]) => {
|
||||
const filename = filenameFromPath(path)
|
||||
const meta = DOCS_METADATA[filename]
|
||||
const langMeta = meta[lang]
|
||||
return {
|
||||
slug: slugFromFilename(filename),
|
||||
filename,
|
||||
title: langMeta.title,
|
||||
group: langMeta.group,
|
||||
order: langMeta.order,
|
||||
loader: loader as () => Promise<string>,
|
||||
}
|
||||
})
|
||||
export function getDocsEntries(lang: DocsLang, catalogItems: DocsCatalogItem[]): DocsEntry[] {
|
||||
return catalogItems
|
||||
.filter((item) => item.lang === lang)
|
||||
.map((item) => ({
|
||||
slug: item.slug,
|
||||
filename: item.filename,
|
||||
title: item.title,
|
||||
group: item.group,
|
||||
order: item.order,
|
||||
access: item.access,
|
||||
}))
|
||||
.sort((a, b) => a.order - b.order || a.title.localeCompare(b.title))
|
||||
}
|
||||
|
||||
export function getDocsEntry(slug: string | undefined, lang: DocsLang): DocsEntry | undefined {
|
||||
export function getDocsEntry(slug: string | undefined, entries: DocsEntry[]): DocsEntry | undefined {
|
||||
const normalizedSlug = slug || defaultDocsSlug
|
||||
return getDocsEntries(lang).find((entry) => entry.slug === normalizedSlug)
|
||||
return entries.find((entry) => entry.slug === normalizedSlug)
|
||||
}
|
||||
|
||||
export function groupDocsEntries(entries: DocsEntry[]): Array<{ group: DocsGroup; entries: DocsEntry[] }> {
|
||||
@@ -236,6 +246,5 @@ export function slugFromDocsHref(href: string): string | null {
|
||||
return null
|
||||
}
|
||||
|
||||
const slug = slugFromFilename(filename)
|
||||
return ALL_KNOWN_SLUGS.has(slug) ? slug : null
|
||||
return slugFromFilename(filename)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user