feat: initialize opencode project with Astro and Starlight
- Add package.json for project configuration and dependencies - Create content configuration for Starlight documentation - Add example guide and reference markdown files - Create index page for documentation with navigation and next steps - Set up TypeScript configuration for the project
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
dist
|
||||||
|
.astro
|
||||||
|
node_modules
|
||||||
|
.env
|
||||||
|
.env.production
|
||||||
|
.DS_Store
|
||||||
|
cache
|
||||||
12
README.md
12
README.md
@@ -10,13 +10,21 @@
|
|||||||
|
|
||||||
核心是快速启动和快速停止一个系统,每一个动作和行为都是一个真实的系统,能帮助我们快速的运行程序,快速的尝试各种程序。是一个云原生的一个执行空间,而这个空间是能想做什么就做什么的。
|
核心是快速启动和快速停止一个系统,每一个动作和行为都是一个真实的系统,能帮助我们快速的运行程序,快速的尝试各种程序。是一个云原生的一个执行空间,而这个空间是能想做什么就做什么的。
|
||||||
|
|
||||||
例子:我们需要一个python的环境,我们可以直接在这个空间里安装python,安装好之后就能直接使用了。我们需要一个node的环境,我们也可以直接在这个空间里安装node,安装好之后就能直接使用了。而这些环境都是独立的,不会互相干扰的,同时都具备模板化的能力,能让我们快速的创建和销毁这些环境。
|
例子1:我们需要一个python的环境,我们可以直接在这个空间里安装python,安装好之后就能直接使用了。
|
||||||
|
我们需要一个node的环境,我们也可以直接在这个空间里安装node,安装好之后就能直接使用了。
|
||||||
|
而这些环境都是独立的,不会互相干扰的,同时都具备模板化的能力,能让我们快速的创建和销毁这些环境。
|
||||||
|
|
||||||
例子2:我们需要执行一些工具软件,比如openclaw,opencode,comfyui我们也可以在这个空间力快速的运行和启动。
|
例子2:我们需要执行一些工具软件,比如openclaw,opencode,comfyui我们也可以在这个空间力快速的运行和启动。
|
||||||
|
|
||||||
空间的使用准则(越灵活越伟大):
|
**空间的使用准则(越灵活越伟大):**
|
||||||
|
|
||||||
1. 只展示自己期望看到的界面
|
1. 只展示自己期望看到的界面
|
||||||
2. 只获取需求的数据
|
2. 只获取需求的数据
|
||||||
3. 只执行自己期望的行为
|
3. 只执行自己期望的行为
|
||||||
|
|
||||||
## CNB的使用方法
|
## CNB的使用方法
|
||||||
|
|
||||||
|
1. openclaw助手类:通用辅助助手,提供一些通用的功能和工具,个性化私人定制服务,并运行。
|
||||||
|
2. opencode开发类:提供一个快速的开发环境,来帮助我们快速的开发和测试我们的代码。
|
||||||
|
3. comfyui工具类:提供一个快速的AIGC运行环境。
|
||||||
|
4. 其他工具类:提供一些其他的工具和服务,来帮助我们快速的完成一些任务。
|
||||||
24
openclaw/sggqrpledl.md
Normal file
24
openclaw/sggqrpledl.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# openclaw 在cnb中如何使用
|
||||||
|
|
||||||
|
> cnb属于运行的盒子,但是实际运行的内容需要自己搭建
|
||||||
|
|
||||||
|
## 使用场景
|
||||||
|
|
||||||
|
### 通用模式[mode=hot]
|
||||||
|
|
||||||
|
1. 新闻摘要
|
||||||
|
2. 日程管理,备忘记录
|
||||||
|
3. 自媒体运营
|
||||||
|
4. 开发辅助
|
||||||
|
5. 个性化支持
|
||||||
|
|
||||||
|
## 安装篇
|
||||||
|
|
||||||
|
> 正常运行 openclaw 的搭建在本地环境安装是一个很麻烦的事情,而云服务器提供便捷的环境搭建和维护,但生态很限定性,而 cnb 提供了一个基础的快速运行的环境,同时也提供了一个开放的交流环境,用户可以在其中分享和获取使用 openclaw 的经验和技巧。
|
||||||
|
|
||||||
|
### 对于在 cnb 一键启动条件
|
||||||
|
|
||||||
|
1. 有一个 cnb 账号
|
||||||
|
2. 实名认证
|
||||||
|
|
||||||
|
### 一键启动方案
|
||||||
14
package.json
Normal file
14
package.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "how-to-use-cnb",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"init": "npm create astro@latest -- --template starlight"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||||
|
"license": "MIT",
|
||||||
|
"packageManager": "pnpm@10.32.1",
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
1
web/openclaw/.gitignore
vendored
Normal file
1
web/openclaw/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
28
web/openclaw/docs/.vitepress/config.ts
Normal file
28
web/openclaw/docs/.vitepress/config.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { defineConfig } from 'vitepress'
|
||||||
|
|
||||||
|
// https://vitepress.dev/reference/site-config
|
||||||
|
export default defineConfig({
|
||||||
|
title: "Openclaw In CNB",
|
||||||
|
description: "CNB怎么使用openclaw",
|
||||||
|
themeConfig: {
|
||||||
|
// https://vitepress.dev/reference/default-theme-config
|
||||||
|
nav: [
|
||||||
|
{ text: 'Home', link: '/' },
|
||||||
|
{ text: 'Examples', link: '/markdown-examples' }
|
||||||
|
],
|
||||||
|
|
||||||
|
sidebar: [
|
||||||
|
{
|
||||||
|
text: 'Examples',
|
||||||
|
items: [
|
||||||
|
{ text: 'Markdown Examples', link: '/markdown-examples' },
|
||||||
|
{ text: 'Runtime API Examples', link: '/api-examples' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
socialLinks: [
|
||||||
|
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
49
web/openclaw/docs/api-examples.md
Normal file
49
web/openclaw/docs/api-examples.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
outline: deep
|
||||||
|
---
|
||||||
|
|
||||||
|
# Runtime API Examples
|
||||||
|
|
||||||
|
This page demonstrates usage of some of the runtime APIs provided by VitePress.
|
||||||
|
|
||||||
|
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
|
||||||
|
|
||||||
|
```md
|
||||||
|
<script setup>
|
||||||
|
import { useData } from 'vitepress'
|
||||||
|
|
||||||
|
const { theme, page, frontmatter } = useData()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
### Theme Data
|
||||||
|
<pre>{{ theme }}</pre>
|
||||||
|
|
||||||
|
### Page Data
|
||||||
|
<pre>{{ page }}</pre>
|
||||||
|
|
||||||
|
### Page Frontmatter
|
||||||
|
<pre>{{ frontmatter }}</pre>
|
||||||
|
```
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { useData } from 'vitepress'
|
||||||
|
|
||||||
|
const { site, theme, page, frontmatter } = useData()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
### Theme Data
|
||||||
|
<pre>{{ theme }}</pre>
|
||||||
|
|
||||||
|
### Page Data
|
||||||
|
<pre>{{ page }}</pre>
|
||||||
|
|
||||||
|
### Page Frontmatter
|
||||||
|
<pre>{{ frontmatter }}</pre>
|
||||||
|
|
||||||
|
## More
|
||||||
|
|
||||||
|
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
|
||||||
25
web/openclaw/docs/index.md
Normal file
25
web/openclaw/docs/index.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# https://vitepress.dev/reference/default-theme-home-page
|
||||||
|
layout: home
|
||||||
|
|
||||||
|
hero:
|
||||||
|
name: "Openclaw In CNB"
|
||||||
|
text: "CNB怎么使用openclaw"
|
||||||
|
tagline: My great project tagline
|
||||||
|
actions:
|
||||||
|
- theme: brand
|
||||||
|
text: Markdown Examples
|
||||||
|
link: /markdown-examples
|
||||||
|
- theme: alt
|
||||||
|
text: API Examples
|
||||||
|
link: /api-examples
|
||||||
|
|
||||||
|
features:
|
||||||
|
- title: Feature A
|
||||||
|
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||||
|
- title: Feature B
|
||||||
|
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||||
|
- title: Feature C
|
||||||
|
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||||
|
---
|
||||||
|
|
||||||
85
web/openclaw/docs/markdown-examples.md
Normal file
85
web/openclaw/docs/markdown-examples.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Markdown Extension Examples
|
||||||
|
|
||||||
|
This page demonstrates some of the built-in markdown extensions provided by VitePress.
|
||||||
|
|
||||||
|
## Syntax Highlighting
|
||||||
|
|
||||||
|
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
|
||||||
|
|
||||||
|
**Input**
|
||||||
|
|
||||||
|
````md
|
||||||
|
```js{4}
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
msg: 'Highlighted!'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
````
|
||||||
|
|
||||||
|
**Output**
|
||||||
|
|
||||||
|
```js{4}
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
msg: 'Highlighted!'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom Containers
|
||||||
|
|
||||||
|
**Input**
|
||||||
|
|
||||||
|
```md
|
||||||
|
::: info
|
||||||
|
This is an info box.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: tip
|
||||||
|
This is a tip.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: warning
|
||||||
|
This is a warning.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: danger
|
||||||
|
This is a dangerous warning.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: details
|
||||||
|
This is a details block.
|
||||||
|
:::
|
||||||
|
```
|
||||||
|
|
||||||
|
**Output**
|
||||||
|
|
||||||
|
::: info
|
||||||
|
This is an info box.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: tip
|
||||||
|
This is a tip.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: warning
|
||||||
|
This is a warning.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: danger
|
||||||
|
This is a dangerous warning.
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: details
|
||||||
|
This is a details block.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## More
|
||||||
|
|
||||||
|
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
|
||||||
20
web/openclaw/package.json
Normal file
20
web/openclaw/package.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "openclaw",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"docs:dev": "vitepress dev docs",
|
||||||
|
"docs:build": "vitepress build docs",
|
||||||
|
"docs:preview": "vitepress preview docs"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||||
|
"license": "MIT",
|
||||||
|
"packageManager": "pnpm@10.32.1",
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"vitepress": "^1.6.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
web/opencode/.gitignore
vendored
Normal file
6
web/opencode/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
dist
|
||||||
|
.astro
|
||||||
|
node_modules
|
||||||
|
.env
|
||||||
|
.env.production
|
||||||
|
.DS_Store
|
||||||
49
web/opencode/README.md
Normal file
49
web/opencode/README.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Starlight Starter Kit: Basics
|
||||||
|
|
||||||
|
[](https://starlight.astro.build)
|
||||||
|
|
||||||
|
```
|
||||||
|
npm create astro@latest -- --template starlight
|
||||||
|
```
|
||||||
|
|
||||||
|
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||||
|
|
||||||
|
## 🚀 Project Structure
|
||||||
|
|
||||||
|
Inside of your Astro + Starlight project, you'll see the following folders and files:
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── public/
|
||||||
|
├── src/
|
||||||
|
│ ├── assets/
|
||||||
|
│ ├── content/
|
||||||
|
│ │ └── docs/
|
||||||
|
│ └── content.config.ts
|
||||||
|
├── astro.config.mjs
|
||||||
|
├── package.json
|
||||||
|
└── tsconfig.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.
|
||||||
|
|
||||||
|
Images can be added to `src/assets/` and embedded in Markdown with a relative link.
|
||||||
|
|
||||||
|
Static assets, like favicons, can be placed in the `public/` directory.
|
||||||
|
|
||||||
|
## 🧞 Commands
|
||||||
|
|
||||||
|
All commands are run from the root of the project, from a terminal:
|
||||||
|
|
||||||
|
| Command | Action |
|
||||||
|
| :------------------------ | :----------------------------------------------- |
|
||||||
|
| `npm install` | Installs dependencies |
|
||||||
|
| `npm run dev` | Starts local dev server at `localhost:4321` |
|
||||||
|
| `npm run build` | Build your production site to `./dist/` |
|
||||||
|
| `npm run preview` | Preview your build locally, before deploying |
|
||||||
|
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
||||||
|
| `npm run astro -- --help` | Get help using the Astro CLI |
|
||||||
|
|
||||||
|
## 👀 Want to learn more?
|
||||||
|
|
||||||
|
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
|
||||||
26
web/opencode/astro.config.mjs
Normal file
26
web/opencode/astro.config.mjs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// @ts-check
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
import starlight from '@astrojs/starlight';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
integrations: [
|
||||||
|
starlight({
|
||||||
|
title: 'My Docs',
|
||||||
|
social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/withastro/starlight' }],
|
||||||
|
sidebar: [
|
||||||
|
{
|
||||||
|
label: 'Guides',
|
||||||
|
items: [
|
||||||
|
// Each item here is one entry in the navigation menu.
|
||||||
|
{ label: 'Example Guide', slug: 'guides/example' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Reference',
|
||||||
|
autogenerate: { directory: 'reference' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
6279
web/opencode/package-lock.json
generated
Normal file
6279
web/opencode/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
web/opencode/package.json
Normal file
17
web/opencode/package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "opencode",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "astro dev",
|
||||||
|
"start": "astro dev",
|
||||||
|
"build": "astro build",
|
||||||
|
"preview": "astro preview",
|
||||||
|
"astro": "astro"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@astrojs/starlight": "^0.38.1",
|
||||||
|
"astro": "^6.0.1",
|
||||||
|
"sharp": "^0.34.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
7
web/opencode/src/content.config.ts
Normal file
7
web/opencode/src/content.config.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { defineCollection } from 'astro:content';
|
||||||
|
import { docsLoader } from '@astrojs/starlight/loaders';
|
||||||
|
import { docsSchema } from '@astrojs/starlight/schema';
|
||||||
|
|
||||||
|
export const collections = {
|
||||||
|
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
|
||||||
|
};
|
||||||
11
web/opencode/src/content/docs/guides/example.md
Normal file
11
web/opencode/src/content/docs/guides/example.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: Example Guide
|
||||||
|
description: A guide in my new Starlight docs site.
|
||||||
|
---
|
||||||
|
|
||||||
|
Guides lead a user through a specific task they want to accomplish, often with a sequence of steps.
|
||||||
|
Writing a good guide requires thinking about what your users are trying to do.
|
||||||
|
|
||||||
|
## Further reading
|
||||||
|
|
||||||
|
- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the Diátaxis framework
|
||||||
38
web/opencode/src/content/docs/index.mdx
Normal file
38
web/opencode/src/content/docs/index.mdx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
title: Welcome to Starlight
|
||||||
|
description: Get started building your docs site with Starlight.
|
||||||
|
template: splash # Remove or comment out this line to display the site sidebar on this page.
|
||||||
|
hero:
|
||||||
|
tagline: Congrats on setting up a new Starlight project!
|
||||||
|
actions:
|
||||||
|
- text: Example Guide
|
||||||
|
link: /guides/example/
|
||||||
|
icon: right-arrow
|
||||||
|
- text: Read the Starlight docs
|
||||||
|
link: https://starlight.astro.build
|
||||||
|
icon: external
|
||||||
|
variant: minimal
|
||||||
|
---
|
||||||
|
|
||||||
|
import { Card, CardGrid } from '@astrojs/starlight/components';
|
||||||
|
|
||||||
|
## Next steps
|
||||||
|
|
||||||
|
<CardGrid stagger>
|
||||||
|
<Card title="Update content" icon="pencil">
|
||||||
|
Edit `src/content/docs/index.mdx` to see this page change.
|
||||||
|
</Card>
|
||||||
|
<Card title="Change page layout" icon="document">
|
||||||
|
Delete `template: splash` in `src/content/docs/index.mdx` to display a
|
||||||
|
sidebar on this page.
|
||||||
|
</Card>
|
||||||
|
<Card title="Add new content" icon="add-document">
|
||||||
|
Add Markdown or MDX files to `src/content/docs` to create new pages.
|
||||||
|
</Card>
|
||||||
|
<Card title="Configure your site" icon="setting">
|
||||||
|
Edit your `sidebar` and other config in `astro.config.mjs`.
|
||||||
|
</Card>
|
||||||
|
<Card title="Read the docs" icon="open-book">
|
||||||
|
Learn more in [the Starlight Docs](https://starlight.astro.build/).
|
||||||
|
</Card>
|
||||||
|
</CardGrid>
|
||||||
11
web/opencode/src/content/docs/reference/example.md
Normal file
11
web/opencode/src/content/docs/reference/example.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: Example Reference
|
||||||
|
description: A reference page in my new Starlight docs site.
|
||||||
|
---
|
||||||
|
|
||||||
|
Reference pages are ideal for outlining how things work in terse and clear terms.
|
||||||
|
Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what you're documenting.
|
||||||
|
|
||||||
|
## Further reading
|
||||||
|
|
||||||
|
- Read [about reference](https://diataxis.fr/reference/) in the Diátaxis framework
|
||||||
5
web/opencode/tsconfig.json
Normal file
5
web/opencode/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": "astro/tsconfigs/strict",
|
||||||
|
"include": [".astro/types.d.ts", "**/*"],
|
||||||
|
"exclude": ["dist"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user