Skip to content

Commit c437898

Browse files
committed
Initialize OpenXlings website
0 parents  commit c437898

26 files changed

Lines changed: 21828 additions & 0 deletions

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# OpenXlings Website
2+
3+
OpenXlings organization website and xlings documentation, built with Docusaurus.
4+
5+
## Development
6+
7+
```bash
8+
npm install
9+
npm run start
10+
```
11+
12+
## Validate
13+
14+
```bash
15+
npm run typecheck
16+
npm run build
17+
```
18+
19+
## Content Sources
20+
21+
- xlings usage and install commands: `openxlings/xlings`
22+
- Package index: `openxlings/xim-pkgindex`
23+
- xpkg and libxpkg references: `openxlings/xim-pkgindex` and `openxlings/libxpkg`
24+
25+
Keep command examples aligned with current xlings code before publishing.

docs/faq.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
sidebar_position: 100
3+
title: 常见问题
4+
---
5+
6+
# 常见问题
7+
8+
## 安装相关
9+
10+
### 安装命令执行后没有反应?
11+
12+
请确保网络可以正常访问 GitHub。如果访问受限,可以通过 `XLINGS_GITHUB_MIRROR` 指定镜像:
13+
14+
```bash
15+
XLINGS_GITHUB_MIRROR=https://mirror.example.com \
16+
curl -fsSL https://mirror.example.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
17+
```
18+
19+
Windows PowerShell:
20+
21+
```powershell
22+
$env:XLINGS_GITHUB_MIRROR = "https://mirror.example.com"
23+
powershell -ExecutionPolicy Bypass -c "irm https://mirror.example.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex"
24+
```
25+
26+
### 安装后命令找不到?
27+
28+
安装完成后需要重新打开终端,或手动加载 shell 配置:
29+
30+
```bash
31+
source ~/.bashrc # bash
32+
source ~/.zshrc # zsh
33+
```
34+
35+
### 如何更新 xlings 本身?
36+
37+
```bash
38+
# 重新运行安装命令即可更新到最新版本
39+
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/refs/heads/main/tools/other/quick_install.sh | bash
40+
```
41+
42+
## 包管理
43+
44+
### 搜索不到想要的包?
45+
46+
先更新包索引:
47+
48+
```bash
49+
xlings update
50+
```
51+
52+
如果仍然找不到,说明该软件尚未收录到 xim-pkgindex。欢迎通过 [Pull Request](https://github.com/openxlings/xim-pkgindex) 添加新包。
53+
54+
### 安装包时下载太慢?
55+
56+
可以配置镜像源。在 `.xlings.json` 中设置:
57+
58+
```json
59+
{
60+
"mirror": "CN"
61+
}
62+
```
63+
64+
### 如何同时安装多个版本?
65+
66+
直接安装不同版本即可,xlings 支持多版本共存:
67+
68+
```bash
69+
xlings install gcc@15
70+
xlings install gcc@13
71+
```
72+
73+
然后用 `xlings use` 切换:
74+
75+
```bash
76+
xlings use gcc 15
77+
xlings use gcc 13
78+
```
79+
80+
## SubOS
81+
82+
### subos 之间的包会重复下载吗?
83+
84+
不会。所有 subos 共享同一份包 payload,通过引用计数管理生命周期。只有最后一个引用被移除时才会清理 payload。
85+
86+
### 删除 subos 后磁盘空间没有释放?
87+
88+
删除 subos 只移除该 subos 的版本视图和配置。如果其他 subos 仍在使用相同的包,payload 不会被删除。可以用以下命令清理无引用的 payload:
89+
90+
```bash
91+
xlings self clean
92+
```
93+
94+
### shell-level 和 global 模式有什么区别?
95+
96+
- **shell-level**(默认):启动一个子 shell,退出后回到原环境
97+
- **global**`--global`):修改全局指针,影响所有新打开的终端
98+
99+
推荐日常使用 shell-level 模式,避免意外影响全局环境。
100+
101+
## Sandbox
102+
103+
### Sandbox 和普通 subos 有什么区别?
104+
105+
普通 subos 只隔离 PATH 和环境变量,共享宿主的 `$HOME` 和 dotfile。Sandbox 通过 proot/bwrap 实现文件系统级隔离,拥有独立的 `$HOME`、dotfile 和 `/etc`
106+
107+
### 为什么 Sandbox 只支持 Linux?
108+
109+
Sandbox 依赖 Linux 特有的 proot 或 bubblewrap (bwrap) 工具来实现文件系统视图重定向。macOS 和 Windows 没有等效机制。
110+
111+
## 其他
112+
113+
### xlings 和 Homebrew / apt / pacman 有什么不同?
114+
115+
xlings 的核心区别在于:
116+
117+
1. **多版本管理**:原生支持同一工具的多版本共存和切换
118+
2. **跨平台**:同一套命令在 Linux、macOS、Windows 上通用
119+
3. **环境隔离**:SubOS 机制提供工作空间级别的隔离
120+
4. **万物皆可包**:不仅安装软件,还能安装配置、教程等
121+
122+
### 如何参与贡献?
123+
124+
- [添加新包](https://github.com/openxlings/xim-pkgindex)
125+
- [报告问题](https://github.com/openxlings/xlings/issues)
126+
- [社区论坛](https://forum.d2learn.org/category/9/xlings)

docs/guide/package-management.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
sidebar_position: 1
3+
title: 包管理
4+
---
5+
6+
# 包管理
7+
8+
xlings 内置包管理器 xim(Xlings Installation Manager),支持软件安装、环境配置、教程安装等多种包类型。
9+
10+
## 安装软件
11+
12+
```bash
13+
# 安装最新版本
14+
xlings install gcc
15+
xlings install node
16+
17+
# 安装指定版本
18+
xlings install gcc@15
19+
xlings install node@24
20+
21+
# 一次安装多个包
22+
xlings install gcc@15 node@24 pnpm
23+
24+
# 跳过确认提示
25+
xlings install gcc@15 -y
26+
```
27+
28+
## 安装环境配置
29+
30+
xlings 不仅能安装软件,还能一键配置开发环境:
31+
32+
```bash
33+
# 配置 Rust crates 镜像
34+
xlings install config:rust-crates-mirror
35+
```
36+
37+
## 安装教程
38+
39+
```bash
40+
# 安装交互式 C++ 教程
41+
xlings install d2x:mcpp-standard
42+
```
43+
44+
## 卸载软件
45+
46+
```bash
47+
xlings remove gcc
48+
xlings remove node
49+
```
50+
51+
## 搜索软件
52+
53+
```bash
54+
xlings search gcc
55+
xlings search node
56+
```
57+
58+
搜索结果会显示包名、描述、可用版本等信息。
59+
60+
## 列出已安装的包
61+
62+
```bash
63+
# 列出所有已安装的包
64+
xlings list
65+
66+
# 过滤显示
67+
xlings list gcc
68+
```
69+
70+
## 查看包信息
71+
72+
```bash
73+
xlings info gcc
74+
```
75+
76+
显示包的详细信息,包括描述、可用版本、依赖关系、支持平台等。
77+
78+
## 更新包索引
79+
80+
```bash
81+
xlings update
82+
```
83+
84+
从远程同步最新的包索引数据。建议在搜索或安装之前先更新索引。
85+
86+
## 项目级依赖管理
87+
88+
在项目根目录创建 `.xlings.json` 文件,声明项目所需的工具和版本:
89+
90+
```json
91+
{
92+
"workspace": {
93+
"xmake": "3.0.7",
94+
"cmake": "4.0.2",
95+
"ninja": "1.12.1",
96+
"gcc": { "linux": "15.1.0" },
97+
"llvm": { "macos": "20" }
98+
}
99+
}
100+
```
101+
102+
然后一条命令安装所有依赖:
103+
104+
```bash
105+
xlings install
106+
```
107+
108+
`workspace` 中的值可以是版本字符串,也可以是按平台区分的对象(`linux``macos``windows`),实现跨平台项目配置。
109+
110+
## 包索引
111+
112+
xlings 的包来自 [xim-pkgindex](https://github.com/openxlings/xim-pkgindex) 索引仓库。你也可以添加自定义索引仓库来扩展可用包集合。

docs/guide/sandbox.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
sidebar_position: 4
3+
title: Sandbox 沙箱
4+
---
5+
6+
# Sandbox 沙箱模式
7+
8+
Sandbox 是 SubOS 的文件系统隔离进入方式。与普通 subos 的 PATH/env 隔离不同,sandbox 通过 bwrap 或 proot 提供隔离的 `$HOME`、dotfile、`/tmp` 和最小 `/etc` 视图。
9+
10+
:::info 平台限制
11+
Sandbox 模式仅支持 Linux。macOS 和 Windows 上不可用。
12+
:::
13+
14+
## 创建并进入 Sandbox
15+
16+
Sandbox 不是创建时的独立类型,而是进入 subos 时的模式:
17+
18+
```bash
19+
xlings subos new mybox
20+
xlings subos use mybox --sandbox
21+
```
22+
23+
xlings 会复用当前 shell,并为该 subos 懒初始化 sandbox 私有目录和最小系统文件。
24+
25+
如果需要指定后端,可以显式传入:
26+
27+
```bash
28+
xlings subos use mybox --sandbox bwrap
29+
xlings subos use mybox --sandbox proot
30+
```
31+
32+
进入后你会发现:
33+
- `$HOME` 指向 sandbox 私有的 `/home/<user>` 目录
34+
- 所有 dotfile(`.gitconfig``.npm/``.cache/` 等)完全独立
35+
- 优先使用 bwrap,受限环境下回退到 proot
36+
- xlings 是 sandbox 内唯一的包管理器
37+
38+
## 在 Sandbox 中安装工具
39+
40+
```bash
41+
# 进入 sandbox
42+
xlings subos use mybox --sandbox
43+
44+
# 安装 gcc
45+
xlings install gcc@15 -y
46+
gcc --version
47+
48+
# 安装 node
49+
xlings install node@24 -y
50+
node --version
51+
```
52+
53+
安装的工具仅在此 sandbox 内可见,不影响宿主环境或其他 subos。
54+
55+
## 三种 SubOS 模式对比
56+
57+
| | global | shell-level | sandbox |
58+
|---|---|---|---|
59+
| **创建** | `subos new foo` | `subos new foo` | `subos new foo` |
60+
| **进入** | `subos use foo --global` | `subos use foo` | `subos use foo --sandbox` |
61+
| **隔离级别** | PATH 优先级 | 子 shell + env | 文件系统视图 |
62+
| **$HOME** | 宿主主目录 | 宿主主目录 | sandbox 私有 |
63+
| **dotfile** | 共享宿主 | 共享宿主 | 完全独立 |
64+
| **后端** | env | env spawn shell | bwrap / proot |
65+
| **平台** | 全平台 | 全平台 | 仅 Linux |
66+
67+
## 使用场景
68+
69+
- **隔离构建环境**:编译项目时不污染宿主 dotfile 和缓存
70+
- **跨发行版测试**:在不同 sandbox 中测试不同的工具链组合
71+
- **清理实验**:尝试新工具后直接删除 sandbox,宿主一尘不染
72+
- **AI Agent 操场**:给 LLM agent 一个干净的沙箱环境
73+
74+
## 后端
75+
76+
xlings sandbox 支持双后端,自动检测可用后端:
77+
78+
| 后端 | 说明 |
79+
|------|------|
80+
| **proot** | 无需特权,用户态文件系统重定向,零 sudo |
81+
| **bwrap** (bubblewrap) | 基于 Linux namespace,更强的隔离性 |
82+
83+
xlings 会优先使用 bwrap(如果可用),否则自动回退到 proot。
84+
85+
## 删除 Sandbox
86+
87+
```bash
88+
xlings subos remove mybox
89+
```
90+
91+
删除 sandbox 会清除其私有的根目录,包括所有 dotfile。共享的包 payload 不受影响。

0 commit comments

Comments
 (0)