From e12a80b24e2e6fcc2fb50425e40b8c6cdeac5c86 Mon Sep 17 00:00:00 2001 From: pomelo-nwu Date: Tue, 9 Dec 2025 20:16:03 +0800 Subject: [PATCH] feat: update docs --- .gitignore | 5 ++ docs-site/README.md | 54 ++++++++++++ docs-site/mdx-components.js | 12 +++ docs-site/next-env.d.ts | 6 ++ docs-site/next.config.mjs | 5 ++ docs-site/package.json | 21 +++++ docs-site/src/app/[[...mdxPath]]/page.jsx | 27 ++++++ docs-site/src/app/layout.jsx | 51 +++++++++++ docs/developers/development/npm.md | 2 +- docs/developers/mermaid/context.mmd | 103 ---------------------- docs/developers/mermaid/render-path.mmd | 64 -------------- docs/users/_meta.ts | 2 +- docs/users/features/_meta.ts | 2 +- eslint.config.js | 21 +++++ 14 files changed, 205 insertions(+), 170 deletions(-) create mode 100644 docs-site/README.md create mode 100644 docs-site/mdx-components.js create mode 100644 docs-site/next-env.d.ts create mode 100644 docs-site/next.config.mjs create mode 100644 docs-site/package.json create mode 100644 docs-site/src/app/[[...mdxPath]]/page.jsx create mode 100644 docs-site/src/app/layout.jsx delete mode 100644 docs/developers/mermaid/context.mmd delete mode 100644 docs/developers/mermaid/render-path.mmd diff --git a/.gitignore b/.gitignore index 2c3156b9..fac00d41 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,8 @@ gha-creds-*.json # Log files patch_output.log + +# docs build +docs-site/.next +# content is a symlink to ../docs +docs-site/content diff --git a/docs-site/README.md b/docs-site/README.md new file mode 100644 index 00000000..ad6272c3 --- /dev/null +++ b/docs-site/README.md @@ -0,0 +1,54 @@ +# Qwen Code Docs Site + +A documentation website for Qwen Code built with [Next.js](https://nextjs.org/) and [Nextra](https://nextra.site/). + +## Getting Started + +### Prerequisites + +- Node.js 18+ +- npm or yarn + +### Installation + +```bash +npm install +``` + +### Setup Content + +Link the documentation content from the parent `docs` directory: + +```bash +npm run link +``` + +This creates a symbolic link from `../docs` to `content` in the project. + +### Development + +Start the development server: + +```bash +npm run dev +``` + +Open [http://localhost:3000](http://localhost:3000) in your browser to see the documentation site. + +## Project Structure + +``` +docs-site/ +├── src/ +│ └── app/ +│ ├── [[...mdxPath]]/ # Dynamic routing for MDX pages +│ │ └── page.jsx +│ └── layout.jsx # Root layout with navbar and footer +├── mdx-components.js # MDX component configuration +├── next.config.mjs # Next.js configuration +└── package.json +``` + +## License + +MIT © Qwen Team diff --git a/docs-site/mdx-components.js b/docs-site/mdx-components.js new file mode 100644 index 00000000..ad856fe4 --- /dev/null +++ b/docs-site/mdx-components.js @@ -0,0 +1,12 @@ +import { useMDXComponents as getThemeComponents } from 'nextra-theme-docs'; // nextra-theme-blog or your custom theme + +// Get the default MDX components +const themeComponents = getThemeComponents(); + +// Merge components +export function useMDXComponents(components) { + return { + ...themeComponents, + ...components, + }; +} diff --git a/docs-site/next-env.d.ts b/docs-site/next-env.d.ts new file mode 100644 index 00000000..20e7bcfb --- /dev/null +++ b/docs-site/next-env.d.ts @@ -0,0 +1,6 @@ +/// +/// +import './.next/dev/types/routes.d.ts'; + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/docs-site/next.config.mjs b/docs-site/next.config.mjs new file mode 100644 index 00000000..88adb868 --- /dev/null +++ b/docs-site/next.config.mjs @@ -0,0 +1,5 @@ +import nextra from 'nextra'; + +const withNextra = nextra({}); + +export default withNextra({}); diff --git a/docs-site/package.json b/docs-site/package.json new file mode 100644 index 00000000..92a81256 --- /dev/null +++ b/docs-site/package.json @@ -0,0 +1,21 @@ +{ + "name": "docs-site", + "version": "1.0.0", + "description": "", + "license": "ISC", + "author": "", + "type": "module", + "main": "index.js", + "scripts": { + "link": "ln -s ../docs content", + "dev": "next --turbopack", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "next": "^16.0.8", + "nextra": "^4.6.1", + "nextra-theme-docs": "^4.6.1", + "react": "^19.2.1", + "react-dom": "^19.2.1" + } +} diff --git a/docs-site/src/app/[[...mdxPath]]/page.jsx b/docs-site/src/app/[[...mdxPath]]/page.jsx new file mode 100644 index 00000000..c980e9f6 --- /dev/null +++ b/docs-site/src/app/[[...mdxPath]]/page.jsx @@ -0,0 +1,27 @@ +import { generateStaticParamsFor, importPage } from 'nextra/pages'; +import { useMDXComponents as getMDXComponents } from '../../../mdx-components'; + +export const generateStaticParams = generateStaticParamsFor('mdxPath'); + +export async function generateMetadata(props) { + const params = await props.params; + const { metadata } = await importPage(params.mdxPath); + return metadata; +} + +const Wrapper = getMDXComponents().wrapper; + +export default async function Page(props) { + const params = await props.params; + const { + default: MDXContent, + toc, + metadata, + sourceCode, + } = await importPage(params.mdxPath); + return ( + + + + ); +} diff --git a/docs-site/src/app/layout.jsx b/docs-site/src/app/layout.jsx new file mode 100644 index 00000000..b5ca076a --- /dev/null +++ b/docs-site/src/app/layout.jsx @@ -0,0 +1,51 @@ +import { Footer, Layout, Navbar } from 'nextra-theme-docs'; +import { Banner, Head } from 'nextra/components'; +import { getPageMap } from 'nextra/page-map'; +import 'nextra-theme-docs/style.css'; + +export const metadata = { + // Define your metadata here + // For more information on metadata API, see: https://nextjs.org/docs/app/building-your-application/optimizing/metadata +}; + +const banner = ( + Qwen Code 0.5.0 is released 🎉 +); +const navbar = ( + Qwen Code} + // ... Your additional navbar options + /> +); +const footer =
MIT {new Date().getFullYear()} © Qwen Team.
; + +export default async function RootLayout({ children }) { + return ( + + + {/* Your additional tags should be passed as `children` of `` element */} + + + + {children} + + + + ); +} diff --git a/docs/developers/development/npm.md b/docs/developers/development/npm.md index 0a3c0af2..f6dd1145 100644 --- a/docs/developers/development/npm.md +++ b/docs/developers/development/npm.md @@ -220,7 +220,7 @@ Stage 4: Publishing to NPM Summary of File Flow -```mermaid +```bash graph TD subgraph "Source Files" A["packages/core/src/*.ts
packages/cli/src/*.ts"] diff --git a/docs/developers/mermaid/context.mmd b/docs/developers/mermaid/context.mmd deleted file mode 100644 index ebe4fbee..00000000 --- a/docs/developers/mermaid/context.mmd +++ /dev/null @@ -1,103 +0,0 @@ -graph LR - %% --- Style Definitions --- - classDef new fill:#98fb98,color:#000 - classDef changed fill:#add8e6,color:#000 - classDef unchanged fill:#f0f0f0,color:#000 - - %% --- Subgraphs --- - subgraph "Context Providers" - direction TB - A["gemini.tsx"] - B["AppContainer.tsx"] - end - - subgraph "Contexts" - direction TB - CtxSession["SessionContext"] - CtxVim["VimModeContext"] - CtxSettings["SettingsContext"] - CtxApp["AppContext"] - CtxConfig["ConfigContext"] - CtxUIState["UIStateContext"] - CtxUIActions["UIActionsContext"] - end - - subgraph "Component Consumers" - direction TB - ConsumerApp["App"] - ConsumerAppContainer["AppContainer"] - ConsumerAppHeader["AppHeader"] - ConsumerDialogManager["DialogManager"] - ConsumerHistoryItem["HistoryItemDisplay"] - ConsumerComposer["Composer"] - ConsumerMainContent["MainContent"] - ConsumerNotifications["Notifications"] - end - - %% --- Provider -> Context Connections --- - A -.-> CtxSession - A -.-> CtxVim - A -.-> CtxSettings - - B -.-> CtxApp - B -.-> CtxConfig - B -.-> CtxUIState - B -.-> CtxUIActions - B -.-> CtxSettings - - %% --- Context -> Consumer Connections --- - CtxSession -.-> ConsumerAppContainer - CtxSession -.-> ConsumerApp - - CtxVim -.-> ConsumerAppContainer - CtxVim -.-> ConsumerComposer - CtxVim -.-> ConsumerApp - - CtxSettings -.-> ConsumerAppContainer - CtxSettings -.-> ConsumerAppHeader - CtxSettings -.-> ConsumerDialogManager - CtxSettings -.-> ConsumerApp - - CtxApp -.-> ConsumerAppHeader - CtxApp -.-> ConsumerNotifications - - CtxConfig -.-> ConsumerAppHeader - CtxConfig -.-> ConsumerHistoryItem - CtxConfig -.-> ConsumerComposer - CtxConfig -.-> ConsumerDialogManager - - - - CtxUIState -.-> ConsumerApp - CtxUIState -.-> ConsumerMainContent - CtxUIState -.-> ConsumerComposer - CtxUIState -.-> ConsumerDialogManager - - CtxUIActions -.-> ConsumerComposer - CtxUIActions -.-> ConsumerDialogManager - - %% --- Apply Styles --- - %% New Elements (Green) - class B,CtxApp,CtxConfig,CtxUIState,CtxUIActions,ConsumerAppHeader,ConsumerDialogManager,ConsumerComposer,ConsumerMainContent,ConsumerNotifications new - - %% Heavily Changed Elements (Blue) - class A,ConsumerApp,ConsumerAppContainer,ConsumerHistoryItem changed - - %% Mostly Unchanged Elements (Gray) - class CtxSession,CtxVim,CtxSettings unchanged - - %% --- Link Styles --- - %% CtxSession (Red) - linkStyle 0,8,9 stroke:#e57373,stroke-width:2px - %% CtxVim (Orange) - linkStyle 1,10,11,12 stroke:#ffb74d,stroke-width:2px - %% CtxSettings (Yellow) - linkStyle 2,7,13,14,15,16 stroke:#fff176,stroke-width:2px - %% CtxApp (Green) - linkStyle 3,17,18 stroke:#81c784,stroke-width:2px - %% CtxConfig (Blue) - linkStyle 4,19,20,21,22 stroke:#64b5f6,stroke-width:2px - %% CtxUIState (Indigo) - linkStyle 5,23,24,25,26 stroke:#7986cb,stroke-width:2px - %% CtxUIActions (Violet) - linkStyle 6,27,28 stroke:#ba68c8,stroke-width:2px diff --git a/docs/developers/mermaid/render-path.mmd b/docs/developers/mermaid/render-path.mmd deleted file mode 100644 index 5f4c6204..00000000 --- a/docs/developers/mermaid/render-path.mmd +++ /dev/null @@ -1,64 +0,0 @@ -graph TD - %% --- Style Definitions --- - classDef new fill:#98fb98,color:#000 - classDef changed fill:#add8e6,color:#000 - classDef unchanged fill:#f0f0f0,color:#000 - classDef dispatcher fill:#f9e79f,color:#000,stroke:#333,stroke-width:1px - classDef container fill:#f5f5f5,color:#000,stroke:#ccc - - %% --- Component Tree --- - subgraph "Entry Point" - A["gemini.tsx"] - end - - subgraph "State & Logic Wrapper" - B["AppContainer.tsx"] - end - - subgraph "Primary Layout" - C["App.tsx"] - end - - A -.-> B - B -.-> C - - subgraph "UI Containers" - direction LR - C -.-> D["MainContent"] - C -.-> G["Composer"] - C -.-> F["DialogManager"] - C -.-> E["Notifications"] - end - - subgraph "MainContent" - direction TB - D -.-> H["AppHeader"] - D -.-> I["HistoryItemDisplay"]:::dispatcher - D -.-> L["ShowMoreLines"] - end - - subgraph "Composer" - direction TB - G -.-> K_Prompt["InputPrompt"] - G -.-> K_Footer["Footer"] - end - - subgraph "DialogManager" - F -.-> J["Various Dialogs
(Auth, Theme, Settings, etc.)"] - end - - %% --- Apply Styles --- - class B,D,E,F,G,H,J,K_Prompt,L new - class A,C,I changed - class K_Footer unchanged - - %% --- Link Styles --- - %% MainContent Branch (Blue) - linkStyle 2,6,7,8 stroke:#64b5f6,stroke-width:2px - %% Composer Branch (Green) - linkStyle 3,9,10 stroke:#81c784,stroke-width:2px - %% DialogManager Branch (Orange) - linkStyle 4,11 stroke:#ffb74d,stroke-width:2px - %% Notifications Branch (Violet) - linkStyle 5 stroke:#ba68c8,stroke-width:2px - diff --git a/docs/users/_meta.ts b/docs/users/_meta.ts index d932d41c..c8304b17 100644 --- a/docs/users/_meta.ts +++ b/docs/users/_meta.ts @@ -4,7 +4,7 @@ export default { title: 'Getting started', // Title is optional }, overview: 'Overview', - 'quick-start': 'QuickStart', + quickstart: 'QuickStart', 'common-workflow': 'Command Workflows', 'Outside of the terminal': { type: 'separator', diff --git a/docs/users/features/_meta.ts b/docs/users/features/_meta.ts index 39736dfc..bfcb6417 100644 --- a/docs/users/features/_meta.ts +++ b/docs/users/features/_meta.ts @@ -1,5 +1,5 @@ export default { - subagents: 'Subagents', + 'sub-agents': 'Sub Agents', 'sub-commands': 'Sub Commands', checkpointing: { display: 'hidden', diff --git a/eslint.config.js b/eslint.config.js index 7b4f502f..63c13d48 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -248,4 +248,25 @@ export default tseslint.config( ], }, }, + // Settings for docs-site directory + { + files: ['docs-site/**/*.{js,jsx}'], + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + rules: { + // Allow relaxed rules for documentation site + '@typescript-eslint/no-unused-vars': 'off', + 'react/prop-types': 'off', + 'react/react-in-jsx-scope': 'off', + }, + }, );