@luxkit/cli 1.1.3 → 1.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -46
- package/README_ZH.md +242 -0
- package/dist/index.js +249 -32
- package/dist/skills/lux/references/custom-preset-setting.md +136 -13
- package/dist/skills/lux/skill.md +34 -13
- package/package.json +12 -3
- package/README_Zh.md +0 -189
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://www.typescriptlang.org/)
|
|
11
11
|
[](https://nodejs.org/api/esm.html)
|
|
12
12
|
|
|
13
|
-
**English** | [中文](./
|
|
13
|
+
**English** | [中文](./README_ZH.md)
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
### 📌 What is lux?
|
|
20
20
|
|
|
21
|
-
`lux` is a CLI tool for modern development & the **AI era**
|
|
21
|
+
`lux` is a CLI tool built for modern development & the **AI era** — set up project lint configs and VSCode workspace settings with a single command.
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
23
|
+
- 🚀 **One-click setup**: ESLint, Prettier, CSpell, Stylelint, EditorConfig, and VSCode workspace — all in one command.
|
|
24
|
+
- 🤖 **AI Agent companion**: Skill support for Claude, Opencode and more. Use natural language (e.g. _"/lux configure a react lint template for my team"_) to let AI build and adjust presets for you.
|
|
25
|
+
- 📦 **Framework presets**: Built-in presets for `web-vue`, `web-react`, `node`, and more.
|
|
26
|
+
- 🎨 **Highly customizable**: Extract and fine-tune built-in presets, or create **fully custom private presets** — balancing out-of-the-box usability with team customization needs.
|
|
27
|
+
- 🧠 **Safe project integration**: Smart conflict resolution and merge, auto-detects `bun`, `pnpm`, `npm`, `yarn` dependency trees.
|
|
28
28
|
|
|
29
29
|
<div align="center">
|
|
30
30
|
<img src="https://github.com/TTT1231/lux/blob/main/demo.gif?raw=true" alt="lux demo" width="640" />
|
|
@@ -39,47 +39,54 @@ npm install -g @luxkit/cli
|
|
|
39
39
|
# Initialize skill and preset
|
|
40
40
|
lux init && lux init --preset
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
lux
|
|
45
|
-
|
|
42
|
+
# Initialize your project — lux requires a package.json to inject deps and scripts
|
|
43
|
+
# Use pnpm create vite, claude, or any method to create your project
|
|
44
|
+
# lux detects the package manager via lockfile (bun.lock / package-lock.json / pnpm-lock.yaml)
|
|
45
|
+
# Or use --no-install to skip dependency installation
|
|
46
46
|
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
lux
|
|
47
|
+
# Lint config
|
|
48
|
+
lux fmt web-vue # ESLint + Prettier
|
|
49
|
+
lux fmt web-vue --stylelint # + Stylelint
|
|
50
|
+
lux fmt web-vue --editorconfig # + EditorConfig
|
|
51
|
+
lux fmt web-vue --cspell # + CSpell
|
|
52
|
+
lux fmt web-vue --lint-staged # + lint-staged (implies --husky)
|
|
53
|
+
lux fmt web-vue --husky # + husky only (no lint-staged)
|
|
54
|
+
|
|
55
|
+
# VSCode config (optional, skip if already configured globally)
|
|
56
|
+
lux vscode web-vue # Generate .vscode/settings.json + extensions.json
|
|
50
57
|
|
|
51
58
|
# List available presets
|
|
52
59
|
lux fmt list
|
|
53
60
|
lux vscode list
|
|
54
61
|
|
|
55
|
-
# Next:
|
|
62
|
+
# Next Steps:
|
|
63
|
+
# 🎨 Customize built-in fmt lint presets, e.g. web-vue (Optional)
|
|
64
|
+
# 🧩 Create your own custom presets, e.g. fmt <your-lint-preset-name> (Optional)
|
|
56
65
|
```
|
|
57
66
|
|
|
58
67
|
<br />
|
|
59
68
|
|
|
60
69
|
### 🎨Customize Built-in Presets
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
# Check if skill and presets are initialized (skip if already done)
|
|
64
|
-
lux init && lux init --preset
|
|
71
|
+
> Prerequisite: `lux init && lux init --preset` completed (see Quick Start)
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
#
|
|
73
|
+
```bash
|
|
74
|
+
# Use an AI agent to customize (recommended)
|
|
75
|
+
# In Claude or other AI agents, just run:
|
|
68
76
|
/lux configure built-in preset web-react template to fit my development project style
|
|
69
77
|
|
|
70
78
|
# Or manually edit files under ~/.lux/preset/
|
|
71
79
|
# e.g. add a cspell script to web-react:
|
|
72
|
-
# "cspell":"cspell \"src/**/*\"" to ~/.lux/preset/fmt/web-react/package.json
|
|
80
|
+
# add "cspell":"cspell \"src/**/*\"" to ~/.lux/preset/fmt/web-react/package.json scripts
|
|
73
81
|
```
|
|
74
82
|
|
|
75
83
|
### 🧩Fully Custom Presets
|
|
76
84
|
|
|
77
|
-
|
|
78
|
-
# Check if skill and presets are initialized (skip if already done)
|
|
79
|
-
lux init && lux init --preset
|
|
85
|
+
> Prerequisite: `lux init && lux init --preset` completed (see Quick Start)
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
#
|
|
87
|
+
```bash
|
|
88
|
+
# Use an AI agent to create a custom preset (recommended)
|
|
89
|
+
# In Claude or other AI agents, just run:
|
|
83
90
|
/lux configure my formatting template <your-custom-fmt-preset-name> to fit my development project style
|
|
84
91
|
|
|
85
92
|
# Verify the preset is registered
|
|
@@ -90,12 +97,12 @@ lux fmt list
|
|
|
90
97
|
|
|
91
98
|
| Command | Description |
|
|
92
99
|
| :-------------------------- | :---------------------------------------------------------------- |
|
|
93
|
-
| `lux fmt <preset>` |
|
|
100
|
+
| `lux fmt <preset>` | Generate lint configs |
|
|
94
101
|
| `lux fmt list` | List available lint presets |
|
|
95
|
-
| `lux vscode <preset>` |
|
|
102
|
+
| `lux vscode <preset>` | Generate VSCode config (per-project) |
|
|
96
103
|
| `lux vscode list` | List available VSCode presets |
|
|
97
|
-
| `lux init` | Initialize
|
|
98
|
-
| `lux init --preset` | Initialize all presets
|
|
104
|
+
| `lux init` | Initialize Skill files to AI Agent |
|
|
105
|
+
| `lux init --preset` | Initialize all built-in presets to `~/.lux/preset/` |
|
|
99
106
|
| `lux set <key=value> [...]` | Persist proxy env vars (e.g. `https_proxy=http://127.0.0.1:7890`) |
|
|
100
107
|
| `lux unset` | Clear all stored proxy configuration |
|
|
101
108
|
| `lux show env` | Display stored proxy environment variables |
|
|
@@ -112,24 +119,27 @@ lux fmt list
|
|
|
112
119
|
```bash
|
|
113
120
|
lux fmt <preset> [options]
|
|
114
121
|
|
|
115
|
-
--force
|
|
116
|
-
--no-install
|
|
117
|
-
--dry-run Preview
|
|
118
|
-
--stylelint Include Stylelint config
|
|
119
|
-
--editorconfig Include EditorConfig config
|
|
122
|
+
--force Overwrite existing files and scripts
|
|
123
|
+
--no-install Write deps to package.json but skip install
|
|
124
|
+
--dry-run Preview mode, write nothing
|
|
125
|
+
--stylelint Include Stylelint config (opt-in)
|
|
126
|
+
--editorconfig Include EditorConfig config (opt-in)
|
|
127
|
+
--husky Initialize husky for Git hooks (opt-in)
|
|
128
|
+
--lint-staged Set up lint-staged (implies --husky, opt-in)
|
|
129
|
+
--cspell Include CSpell config (opt-in)
|
|
120
130
|
--reset Reset local preset and re-create from built-in defaults
|
|
121
131
|
|
|
122
132
|
lux vscode <preset> [options]
|
|
123
133
|
|
|
124
|
-
--force
|
|
125
|
-
--dry-run Preview
|
|
134
|
+
--force Overwrite existing VSCode config files
|
|
135
|
+
--dry-run Preview mode, write nothing
|
|
126
136
|
--stylelint Include Stylelint settings and extension (opt-in)
|
|
127
137
|
--reset Reset local preset and re-create from built-in defaults
|
|
128
138
|
```
|
|
129
139
|
|
|
130
140
|
<br />
|
|
131
141
|
|
|
132
|
-
|
|
142
|
+
### 🔧How It Works
|
|
133
143
|
|
|
134
144
|
```
|
|
135
145
|
lux fmt <preset> [options]
|
|
@@ -150,7 +160,7 @@ lux fmt <preset> [options]
|
|
|
150
160
|
└── Not found ──► Fuzzy match against all presets (built-in + custom), show error
|
|
151
161
|
│
|
|
152
162
|
▼
|
|
153
|
-
--stylelint / --editorconfig filtering (warns if custom preset lacks matching config)
|
|
163
|
+
--stylelint / --editorconfig / --cspell / --husky / --lint-staged filtering (warns if custom preset lacks matching config)
|
|
154
164
|
│
|
|
155
165
|
▼
|
|
156
166
|
For each config file:
|
|
@@ -163,22 +173,67 @@ lux fmt <preset> [options]
|
|
|
163
173
|
Inject scripts into package.json (auto-detect bun / pnpm / npm / yarn)
|
|
164
174
|
│
|
|
165
175
|
▼
|
|
166
|
-
|
|
176
|
+
Install devDependencies (detects lockfile for package manager)
|
|
167
177
|
```
|
|
168
178
|
|
|
169
179
|
<br />
|
|
170
180
|
|
|
171
|
-
###
|
|
181
|
+
### 🔄Reset & Uninstall
|
|
182
|
+
|
|
183
|
+
#### Reset presets
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Reset built-in presets (delete local copy and re-generate from built-in template)
|
|
187
|
+
lux fmt web-vue --reset
|
|
188
|
+
lux vscode web-vue --reset
|
|
189
|
+
|
|
190
|
+
# Re-initialize all built-in presets (overwrite existing local copies)
|
|
191
|
+
lux init --preset
|
|
192
|
+
|
|
193
|
+
# Reset custom presets: manually delete the directory
|
|
194
|
+
# rm -rf ~/.lux/preset/fmt/<your-custom-preset-name>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
> Using `--reset` on a custom preset will warn and abort — there is no built-in source to restore.
|
|
198
|
+
|
|
199
|
+
#### Uninstall
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Uninstall CLI
|
|
203
|
+
npm uninstall -g @luxkit/cli
|
|
204
|
+
|
|
205
|
+
# Clean config directory (optional)
|
|
206
|
+
# rm -rf ~/.lux
|
|
207
|
+
|
|
208
|
+
# Clean skill files, claude/opencode
|
|
209
|
+
# rm -rf ~/.claude/skill/lux
|
|
210
|
+
# rm -rf ~/.opencode/skill/lux
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 🔍Troubleshooting
|
|
214
|
+
|
|
215
|
+
| Issue | Solution |
|
|
216
|
+
| :----------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
217
|
+
| `package.json` errors | Ensure a valid `package.json` exists in the project root |
|
|
218
|
+
| Preset not found | Run `lux fmt list` to see all available presets — lux auto-suggests via fuzzy matching |
|
|
219
|
+
| Wrong package manager detected | Ensure the lockfile exists (`bun.lock` / `package-lock.json` / `pnpm-lock.yaml`) |
|
|
220
|
+
| Skip dependency install | Use `--no-install` to only write to `package.json`, install manually |
|
|
221
|
+
| Preview before applying | Use `--dry-run` to see all operations without writing |
|
|
222
|
+
| Flags have no effect | Custom presets must include the corresponding config files and deps for `--stylelint`/`--cspell`/`--editorconfig`/`--husky`/`--lint-staged` to work |
|
|
223
|
+
|
|
224
|
+
<br />
|
|
225
|
+
|
|
226
|
+
### 🤝Contributing
|
|
172
227
|
|
|
173
|
-
|
|
228
|
+
Bug reports, feature suggestions, and code contributions are welcome!
|
|
174
229
|
|
|
175
|
-
- **
|
|
176
|
-
- **
|
|
177
|
-
- **Star
|
|
230
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/TTT1231/lux/issues)
|
|
231
|
+
- 🛠 **Pull Requests**: [GitHub Pull Requests](https://github.com/TTT1231/lux/pulls)
|
|
232
|
+
- ⭐️ **Star**: If lux helped you, please give us a [Star](https://github.com/TTT1231/lux)!
|
|
178
233
|
|
|
179
234
|
<br />
|
|
180
235
|
|
|
181
|
-
### 📄
|
|
236
|
+
### 📄License
|
|
182
237
|
|
|
183
238
|
[ISC](https://opensource.org/licenses/ISC) — Free to use, modify, and distribute.
|
|
184
239
|
|
package/README_ZH.md
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# lux
|
|
4
|
+
|
|
5
|
+
**一键项目格式化 & VSCode 配置 CLI**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@luxkit/cli)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
[](https://opensource.org/licenses/ISC)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
[](https://nodejs.org/api/esm.html)
|
|
12
|
+
|
|
13
|
+
[English](./README.md) | **中文**
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### 📌 为什么选择 lux?
|
|
20
|
+
|
|
21
|
+
`lux` 是一款专为现代化开发与 **AI 时代** 打造的工程化配置 CLI 工具,一条命令完成项目代码规范配置。
|
|
22
|
+
|
|
23
|
+
- 🚀 **一键配置**:ESLint、Prettier、CSpell、Stylelint、EditorConfig 及 VSCode 工作区配置,一条命令搞定。
|
|
24
|
+
- 🤖 **AI Agent 拍档**:为 Claude、Opencode 等提供技能(Skill)支持,可直接用自然语言(如*"/lux 帮我配一套适合团队的 react 代码规范"*)让 AI 自动构建和调整预设。
|
|
25
|
+
- 📦 **框架预设开箱即用**:内置 `web-vue`、`web-react`、`node` 等场景预设。
|
|
26
|
+
- 🎨 **高度可定制**:支持提取和微调内置预设,也支持**完全自定义私有预设**,兼顾开箱即用与团队定制化需求。
|
|
27
|
+
- 🧠 **安全接入已有项目**:智能冲突解决与合并机制,自动检测 `bun`、`pnpm`、`npm`、`yarn` 依赖树。
|
|
28
|
+
|
|
29
|
+
<div align="center">
|
|
30
|
+
<img src="https://github.com/TTT1231/lux/blob/main/demo.gif?raw=true" alt="lux 演示" width="640" />
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
## ⚡快速开始
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# 全局安装(选择你的包管理器)
|
|
37
|
+
npm install -g @luxkit/cli
|
|
38
|
+
|
|
39
|
+
# 初始化 skill 和 preset
|
|
40
|
+
lux init && lux init --preset
|
|
41
|
+
|
|
42
|
+
# 初始化你的项目 — lux 需要项目中有 package.json 来注入依赖和脚本
|
|
43
|
+
# 可使用 pnpm create vite、claude 等方式创建项目
|
|
44
|
+
# lux 通过锁文件检测包管理器(bun.lock / package-lock.json / pnpm-lock.yaml)
|
|
45
|
+
# 也可使用 --no-install 跳过依赖安装
|
|
46
|
+
|
|
47
|
+
# Lint 配置
|
|
48
|
+
lux fmt web-vue # 配置 ESLint + Prettier
|
|
49
|
+
lux fmt web-vue --stylelint # + Stylelint
|
|
50
|
+
lux fmt web-vue --editorconfig # + EditorConfig
|
|
51
|
+
lux fmt web-vue --cspell # + CSpell
|
|
52
|
+
lux fmt web-vue --lint-staged # + lint-staged(自动启用 --husky)
|
|
53
|
+
lux fmt web-vue --husky # + 仅 husky(不包含 lint-staged)
|
|
54
|
+
|
|
55
|
+
# VSCode 配置(可选,全局已配置可跳过)
|
|
56
|
+
lux vscode web-vue # 生成 .vscode/settings.json + extensions.json
|
|
57
|
+
|
|
58
|
+
# 查看可用预设
|
|
59
|
+
lux fmt list
|
|
60
|
+
lux vscode list
|
|
61
|
+
|
|
62
|
+
# 下一步:
|
|
63
|
+
# 🎨 自定义内置fmt lint预设,例如web-vue(可选)
|
|
64
|
+
# 🧩 自定义你自己的预设,例如fmt <your-lint-preset-name>(可选)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<br />
|
|
68
|
+
|
|
69
|
+
## 🎨 自定义内置预设
|
|
70
|
+
|
|
71
|
+
> 前置条件:已完成 `lux init && lux init --preset`(见快速开始)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 使用 AI Agent 自定义(推荐)
|
|
75
|
+
# 在 Claude 等 AI Agent 中直接执行:
|
|
76
|
+
/lux 配置内置预设 web-react 模板,符合我的开发项目风格
|
|
77
|
+
|
|
78
|
+
# 也可手动编辑 ~/.lux/preset/ 下的预设文件
|
|
79
|
+
# 例如给 web-react 添加 cspell 脚本:
|
|
80
|
+
# 在 ~/.lux/preset/fmt/web-react/package.json 的 scripts 中添加 "cspell":"cspell \"src/**/*\""
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 🧩 完全自定义预设
|
|
84
|
+
|
|
85
|
+
> 前置条件:已完成 `lux init && lux init --preset`(见快速开始)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 使用 AI Agent 创建自定义预设(推荐)
|
|
89
|
+
# 在 Claude 等 AI Agent 中直接执行:
|
|
90
|
+
/lux 配置我的格式化模板 <your-custom-fmt-preset-name>,符合我的开发项目风格
|
|
91
|
+
|
|
92
|
+
# 验证预设是否注册成功
|
|
93
|
+
lux fmt list
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📖命令参考
|
|
97
|
+
|
|
98
|
+
| 命令 | 说明 |
|
|
99
|
+
| :-------------------------- | :----------------------------------------------------------- |
|
|
100
|
+
| `lux fmt <preset>` | 生成 Lint 配置 |
|
|
101
|
+
| `lux fmt list` | 列出可用的 Lint 预设 |
|
|
102
|
+
| `lux vscode <preset>` | 生成 VSCode 配置(项目内) |
|
|
103
|
+
| `lux vscode list` | 列出可用的 VSCode 预设 |
|
|
104
|
+
| `lux init` | 初始化 Skill 文件到 AI Agent |
|
|
105
|
+
| `lux init --preset` | 初始化所有内置预设到 `~/.lux/preset/` |
|
|
106
|
+
| `lux set <key=value> [...]` | 设置代理环境变量(如 `https_proxy="http://127.0.0.1:7890"`) |
|
|
107
|
+
| `lux unset` | 清除所有代理配置 |
|
|
108
|
+
| `lux show env` | 显示已配置的代理环境变量 |
|
|
109
|
+
| `lux vpn cmd` | 复制 CMD 代理命令到剪贴板 |
|
|
110
|
+
| `lux vpn pw` | 复制 PowerShell 代理命令到剪贴板 |
|
|
111
|
+
| `lux vpn bash` | 复制 Bash 代理命令到剪贴板 |
|
|
112
|
+
| `lux update` | 更新 `@luxkit/cli` 到最新版本 |
|
|
113
|
+
| `lux update --check` | 检查可用更新,不执行安装 |
|
|
114
|
+
|
|
115
|
+
<br />
|
|
116
|
+
|
|
117
|
+
### ⚙️命令选项
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
lux fmt <preset> [options]
|
|
121
|
+
|
|
122
|
+
--force 覆盖已有文件和脚本
|
|
123
|
+
--no-install 写入依赖到 package.json 但跳过安装
|
|
124
|
+
--dry-run 预览模式,不写入任何文件
|
|
125
|
+
--stylelint 包含 Stylelint 配置(按需启用)
|
|
126
|
+
--editorconfig 包含 EditorConfig 配置(按需启用)
|
|
127
|
+
--husky 初始化 husky Git hooks(按需启用)
|
|
128
|
+
--lint-staged 配置 lint-staged(自动启用 --husky,按需启用)
|
|
129
|
+
--cspell 包含 CSpell 配置(按需启用)
|
|
130
|
+
--reset 重置本地预设,从内置默认值重新创建
|
|
131
|
+
|
|
132
|
+
lux vscode <preset> [options]
|
|
133
|
+
|
|
134
|
+
--force 覆盖已有的 VSCode 配置文件
|
|
135
|
+
--dry-run 预览模式,不写入任何文件
|
|
136
|
+
--stylelint 包含 Stylelint 设置和扩展(按需启用)
|
|
137
|
+
--reset 重置本地预设,从内置默认值重新创建
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<br />
|
|
141
|
+
|
|
142
|
+
## 🔧工作原理
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
lux fmt <preset> [options]
|
|
146
|
+
│
|
|
147
|
+
▼
|
|
148
|
+
解析 CLI 参数,校验项目 package.json
|
|
149
|
+
│
|
|
150
|
+
▼
|
|
151
|
+
预设类型判断
|
|
152
|
+
│
|
|
153
|
+
├── 内置预设 ──► --reset? ──► 重置本地副本
|
|
154
|
+
│ │
|
|
155
|
+
│ ├── 本地副本存在 (~/.lux/preset/)? ──► 从本地副本应用
|
|
156
|
+
│ └── 不存在 ──► 从内置生成 ──► 保存到 ~/.lux/preset/ ──► 应用
|
|
157
|
+
│
|
|
158
|
+
├── 自定义预设 (~/.lux/preset/fmt/<name>/) ──► 直接从本地目录应用
|
|
159
|
+
│
|
|
160
|
+
└── 未找到 ──► 模糊匹配所有可用预设(内置 + 自定义)并报错
|
|
161
|
+
│
|
|
162
|
+
▼
|
|
163
|
+
--stylelint / --editorconfig / --cspell / --husky / --lint-staged 过滤(自定义预设无对应配置时 warning)
|
|
164
|
+
│
|
|
165
|
+
▼
|
|
166
|
+
遍历每个配置文件:
|
|
167
|
+
│
|
|
168
|
+
├── 文件不存在? ──► 创建
|
|
169
|
+
├── 已存在 + --force? ──► 覆盖
|
|
170
|
+
└── 已存在? ──► 跳过
|
|
171
|
+
│
|
|
172
|
+
▼
|
|
173
|
+
注入脚本到 package.json(自动检测 bun / pnpm / npm / yarn)
|
|
174
|
+
│
|
|
175
|
+
▼
|
|
176
|
+
安装 devDependencies(检测 lockfile 判断包管理器)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
<br />
|
|
180
|
+
|
|
181
|
+
## 🔄重置与卸载
|
|
182
|
+
|
|
183
|
+
### 重置预设
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# 重置内置预设(删除本地副本并从内置模板重新生成)
|
|
187
|
+
lux fmt web-vue --reset
|
|
188
|
+
lux vscode web-vue --reset
|
|
189
|
+
|
|
190
|
+
# 重新初始化所有内置预设(覆盖已有本地副本)
|
|
191
|
+
lux init --preset
|
|
192
|
+
|
|
193
|
+
# 重置自定义预设:手动删除对应目录
|
|
194
|
+
# rm -rf ~/.lux/preset/fmt/<your-custom-preset-name>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
> 自定义预设使用 `--reset` 会提示警告并中止,因为不存在内置源可供恢复。
|
|
198
|
+
|
|
199
|
+
### 卸载
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# 卸载 CLI
|
|
203
|
+
npm uninstall -g @luxkit/cli
|
|
204
|
+
|
|
205
|
+
# 清理配置目录(可选)
|
|
206
|
+
# rm -rf ~/.lux
|
|
207
|
+
|
|
208
|
+
# 清理skill,claude/opencode
|
|
209
|
+
# rm rum ~/.claude/skill/lux
|
|
210
|
+
# rm rum ~/.opencode/skill/lux
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 🔍故障排查
|
|
214
|
+
|
|
215
|
+
| 问题 | 解决方案 |
|
|
216
|
+
| :---------------------- | :----------------------------------------------------------------------------------------------------------------- |
|
|
217
|
+
| `package.json` 相关错误 | 确保项目根目录存在合法的 `package.json` |
|
|
218
|
+
| 预设未找到 | 运行 `lux fmt list` 查看所有可用预设,lux 会自动模糊匹配建议 |
|
|
219
|
+
| 包管理器检测不正确 | 确保 lockfile 存在(`bun.lock` / `package-lock.json` / `pnpm-lock.yaml`) |
|
|
220
|
+
| 跳过依赖安装 | 使用 `--no-install` 仅写入 `package.json`,手动安装 |
|
|
221
|
+
| 预览操作结果 | 使用 `--dry-run` 查看将执行的所有操作 |
|
|
222
|
+
| flag 无效果 | 自定义预设需包含对应的配置文件和依赖,`--stylelint`/`--cspell`/`--editorconfig`/`--husky`/`--lint-staged` 才能生效 |
|
|
223
|
+
|
|
224
|
+
<br />
|
|
225
|
+
|
|
226
|
+
## 🤝 参与贡献
|
|
227
|
+
|
|
228
|
+
欢迎提交 Bug、功能建议或代码贡献!
|
|
229
|
+
|
|
230
|
+
- 🐛 **提交 Issue**:[GitHub Issues](https://github.com/TTT1231/lux/issues)
|
|
231
|
+
- 🛠 **提交 PR**:[GitHub Pull Requests](https://github.com/TTT1231/lux/pulls)
|
|
232
|
+
- ⭐️ **Star 支持**:如果 lux 对你有帮助,欢迎 [Star](https://github.com/TTT1231/lux)!
|
|
233
|
+
|
|
234
|
+
<br />
|
|
235
|
+
|
|
236
|
+
## 📄 许可证
|
|
237
|
+
|
|
238
|
+
[ISC](https://opensource.org/licenses/ISC) — 可自由使用、修改和分发。
|
|
239
|
+
|
|
240
|
+
<br />
|
|
241
|
+
|
|
242
|
+
<p align="right"><a href="./README.md">← Switch to English</a></p>
|