Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion www/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@

# VitePress build artifacts
cache/
dist/
node_modules/
151 changes: 86 additions & 65 deletions www/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
import { defineConfig } from "vitepress";

// --- 环境变量检测逻辑 ---
const isVercel = process.env.VERCEL === "1";
const isCFPages = process.env.CF_PAGES === "1";

const isCFPages = process.env.CF_PAGES === "1";
const isRootDeploy = isVercel || isCFPages;

const repoUrl = "https://github.com/1024XEngineer/neo-code";
const docsBase = `${repoUrl}/blob/main/docs`;

// 核心修改 1:动态基础路径
const base = isRootDeploy ? "/" : "/neo-code/";

// 👇👇👇 新增这段调试日志 👇👇👇
console.log("====== VitePress Build Info ======");
console.log("VERCEL Env:", process.env.VERCEL);
console.log("CF_PAGES Env:", process.env.CF_PAGES);
console.log("Final Base Path:", base);
console.log("==================================");

// 核心修改 2:动态站点 URL
let siteUrl = "https://1024xengineer.github.io/neo-code/";
if (isVercel) {
siteUrl = `https://${process.env.VERCEL_URL || 'neocode-docs.vercel.app'}/`;
siteUrl = `https://${process.env.VERCEL_URL || "neocode-docs.vercel.app"}/`;
} else if (isCFPages) {
siteUrl = "https://neocode-docs.pages.dev/";
siteUrl = "https://neocode-docs.pages.dev/";
}

const brandImageUrl = `${siteUrl}brand/neocode-mark.png`;

export default defineConfig({
title: "NeoCode",
description: "基于 Go + Bubble Tea 的本地 Coding Agent 用户指南",
Expand All @@ -40,23 +25,26 @@ export default defineConfig({
cleanUrls: true,
lastUpdated: true,
head: [
["meta", { name: "theme-color", content: "#090B1A" }],
["meta", { property: "og:title", content: "NeoCode 用户指南" }],
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }],
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }],
[
"meta",
"link",
{
property: "og:description",
content: "围绕真实命令、配置与 Gateway 使用场景整理的 NeoCode 用户指导网站。",
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap",
},
],
["meta", { property: "og:type", content: "website" }],
["meta", { name: "theme-color", content: "#f7f7f4" }],
["meta", { property: "og:title", content: "NeoCode 用户指南" }],
[
"meta",
{
property: "og:image",
content: brandImageUrl,
property: "og:description",
content: "围绕真实命令、配置与 Gateway 使用场景整理的 NeoCode 用户指导网站。",
},
],
["meta", { property: "og:type", content: "website" }],
["meta", { property: "og:image", content: `${base}brand/neocode-mark.png` }],
["meta", { name: "twitter:card", content: "summary" }],
// Favicon 路径随 base 变化
["link", { rel: "icon", href: `${base}brand/neocode-mark.png` }],
Expand All @@ -81,62 +69,63 @@ export default defineConfig({
link: "/",
themeConfig: {
nav: [
{ text: "开始使用", link: "/guide/" },
{ text: "配置", link: "/guide/configuration" },
{ text: "命令与会话", link: "/guide/quick-start" },
{ text: "快速开始", link: "/guide/" },
{ text: "日常使用", link: "/guide/daily-use" },
{ text: "排障", link: "/guide/troubleshooting" },
{ text: "Gateway", link: "/guide/gateway" },
{ text: "深入阅读", link: "/reference/" },
{ text: "进阶与设计", link: "/reference/" },
{ text: "GitHub", link: repoUrl },
],
sidebar: {
"/guide/": [
{
text: "开始使用",
text: "快速开始",
items: [
{ text: "总览", link: "/guide/" },
{ text: "NeoCode 是什么", link: "/guide/getting-started" },
{ text: "安装与运行", link: "/guide/install" },
{ text: "首次上手", link: "/guide/quick-start" },
{ text: "安装与首次运行", link: "/guide/install" },
{ text: "使用示例", link: "/guide/examples" },
],
},
{
text: "日常使用",
items: [
{ text: "配置入口", link: "/guide/configuration" },
{ text: "工作区与会话", link: "/guide/workspace-session" },
{ text: "记忆与 Skills", link: "/guide/memo-skills" },
{ text: "Gateway 与 URL Dispatch", link: "/guide/gateway" },
{ text: "升级与版本检查", link: "/guide/update" },
{ text: "日常使用", link: "/guide/daily-use" },
{ text: "配置指南", link: "/guide/configuration" },
{ text: "工具与权限", link: "/guide/tools-permissions" },
],
},
],
"/reference/": [
{
text: "深入阅读",
text: "扩展能力",
items: [
{ text: "文档导航", link: "/reference/" },
{ text: "旧入口兼容页", link: "/docs/" },
{ text: "MCP 工具接入", link: "/guide/mcp" },
{ text: "Skills 使用", link: "/guide/skills" },
],
},
{
text: "质量与协作",
items: [
{ text: "排障与常见问题", link: "/guide/troubleshooting" },
{ text: "Gateway 使用", link: "/guide/gateway" },
{ text: "升级与版本检查", link: "/guide/update" },
],
},
],
"/docs/": [
"/reference/": [
{
text: "文档入口",
text: "深入阅读",
items: [
{ text: "总览", link: "/docs/" },
{ text: "开始使用", link: "/guide/" },
{ text: "深入阅读", link: "/reference/" },
{ text: "文档导航", link: "/reference/" },
],
},
],
"/": [
{
text: "快速导航",
items: [
{ text: "开始使用", link: "/guide/" },
{ text: "安装与运行", link: "/guide/install" },
{ text: "首次上手", link: "/guide/quick-start" },
{ text: "配置入口", link: "/guide/configuration" },
{ text: "快速开始", link: "/guide/" },
{ text: "安装与首次运行", link: "/guide/install" },
{ text: "日常使用", link: "/guide/daily-use" },
{ text: "排障", link: "/guide/troubleshooting" },
],
},
],
Expand Down Expand Up @@ -169,18 +158,54 @@ export default defineConfig({
"A compact NeoCode docs entrypoint focused on current, verifiable behavior.",
themeConfig: {
nav: [
{ text: "Home", link: "/en/" },
{ text: "Docs", link: "/en/docs/" },
{ text: "Getting Started", link: "/en/guide/" },
{ text: "Daily Use", link: "/en/guide/daily-use" },
{ text: "Troubleshooting", link: "/en/guide/troubleshooting" },
// Gateway 页面仅有中文版,英文站跨语言指向
{ text: "Gateway", link: "/guide/gateway" },
{ text: "Reference", link: "/reference/" },
{ text: "GitHub", link: repoUrl },
],
sidebar: {
"/en/docs/": [
"/en/guide/": [
{
text: "Getting Started",
items: [
{ text: "Getting Started", link: "/en/guide/" },
{ text: "Install & First Run", link: "/en/guide/install" },
{ text: "Usage Examples", link: "/en/guide/examples" },
],
},
{
text: "Daily Use",
items: [
{ text: "Daily Use", link: "/en/guide/daily-use" },
{ text: "Configuration", link: "/en/guide/configuration" },
{ text: "Tools & Permissions", link: "/en/guide/tools-permissions" },
],
},
{
text: "Extensions",
items: [
{ text: "MCP Tools", link: "/en/guide/mcp" },
{ text: "Skills", link: "/en/guide/skills" },
],
},
{
text: "Quality & Ops",
items: [
{ text: "Troubleshooting", link: "/en/guide/troubleshooting" },
// Gateway 页面仅有中文版,英文站跨语言指向
{ text: "Gateway Usage", link: "/guide/gateway" },
{ text: "Update & Version", link: "/en/guide/update" },
],
},
],
"/reference/": [
{
text: "Overview",
text: "Reference",
items: [
{ text: "Docs Index", link: "/en/docs/" },
{ text: "Chinese Guide", link: "/guide/" },
{ text: "Architecture Notes", link: "/reference/" },
{ text: "Documentation Index", link: "/reference/" },
],
},
],
Expand Down Expand Up @@ -210,9 +235,5 @@ export default defineConfig({
sitemap: {
hostname: siteUrl,
},
vite: {
define: {
__NEOCODE_DOCS_BASE__: JSON.stringify(docsBase),
},
},

});
105 changes: 105 additions & 0 deletions www/.vitepress/theme/components/HomeLanding.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<script setup lang="ts">
import { computed } from 'vue'
import { withBase } from 'vitepress'

const props = defineProps<{
locale?: 'zh' | 'en'
}>()

type LinkItem = {
text: string
href: string
external?: boolean
variant?: 'primary' | 'secondary'
}

type ValueItem = {
title: string
description: string
}

type LandingContent = {
eyebrow: string
title: string
description: string
actions: LinkItem[]
values: ValueItem[]
}

const contents: Record<'zh' | 'en', LandingContent> = {
zh: {
eyebrow: 'NeoCode Coding Agent',
title: '终端里的本地 AI 编码助手',
description:
'本地运行,贴合终端工作流。从理解代码、修改文件到运行验证,NeoCode 帮你把一次代码任务完整推进。',
actions: [
{ text: '立即安装', href: '/guide/install', variant: 'primary' },
{ text: '查看示例', href: '/guide/examples', variant: 'secondary' },
{ text: 'GitHub', href: 'https://github.com/1024XEngineer/neo-code', external: true, variant: 'secondary' },
],
values: [
{ title: '本地运行', description: '配置和工作区留在你的机器上。' },
{ title: '终端原生', description: '直接融入 shell 和 TUI 工作流。' },
{ title: '工具可控', description: '写文件、跑命令前保留确认边界。' },
],
},
en: {
eyebrow: 'NeoCode Coding Agent',
title: 'A local AI coding agent for your terminal',
description:
'Run locally, stay in your terminal workflow, and move a code task from understanding to edits and verification.',
actions: [
{ text: 'Install now', href: '/en/guide/install', variant: 'primary' },
{ text: 'See examples', href: '/en/guide/examples', variant: 'secondary' },
{ text: 'GitHub', href: 'https://github.com/1024XEngineer/neo-code', external: true, variant: 'secondary' },
],
values: [
{ title: 'Local first', description: 'Config and workspace stay on your machine.' },
{ title: 'Terminal native', description: 'Designed for shell and TUI workflows.' },
{ title: 'Controlled tools', description: 'File edits and commands keep approval boundaries.' },
],
},
}

const currentLocale = computed<'zh' | 'en'>(() => (props.locale === 'en' ? 'en' : 'zh'))
const content = computed(() => contents[currentLocale.value])

// hrefFor 负责统一处理站内链接的 base 前缀,同时保留外部链接原始地址。
function hrefFor(item: LinkItem) {
if (item.external) {
return item.href
}
return withBase(item.href)
}
</script>

<template>
<div class="home-landing">
<section class="home-hero" aria-labelledby="home-title">
<p class="home-eyebrow">{{ content.eyebrow }}</p>
<h1 id="home-title">{{ content.title }}</h1>
<p class="home-hero__lead">{{ content.description }}</p>

<div class="home-actions">
<a
v-for="action in content.actions"
:key="action.text"
class="home-action"
:class="`home-action--${action.variant || 'secondary'}`"
:href="hrefFor(action)"
:target="action.external ? '_blank' : undefined"
:rel="action.external ? 'noreferrer' : undefined"
>
{{ action.text }}
</a>
</div>

<div class="home-values" aria-label="NeoCode highlights">
<div v-for="value in content.values" :key="value.title" class="home-value">
<strong>{{ value.title }}</strong>
<span>{{ value.description }}</span>
</div>
</div>
</section>
</div>
</template>
Loading
Loading