@luxkit/cli 1.1.3 → 1.1.4

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 CHANGED
@@ -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** that sets up project lint configs and VSCode workspace settings with a single command.
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
- - 🚀**One-click setup**: ESLint, Prettier, CSpell, Stylelint, EditorConfig, and VSCode workspace — all in one command.
24
- - 🤖**AI Agent companion**: Built 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 custom presets for you.
25
- - 📦**Framework presets**: Built-in presets for `web-vue`, `web-react`, `node`, and more.
26
- - 🎨**Ultimate Freedom for Customization**: Tired of rigid one-size-fits-all encapsulated configurations? lux allows you to extract and fine-tune built-in presets, and also supports **fully custom private presets**. It perfectly balances out-of-the-box usability with the strong customization demands of team collaboration.
27
- - 🧠**Safe project integration**: Smart conflict resolution and merge, auto-detects `bun`, `pnpm`, `npm`, `yarn` dependency trees.
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,50 @@ npm install -g @luxkit/cli
39
39
  # Initialize skill and preset
40
40
  lux init && lux init --preset
41
41
 
42
- # Lint usage
43
- lux fmt web-vue # Configure web-vue lint — ESLint, Prettier, CSpell
44
- lux fmt web-vue --stylelint # Also include Stylelint
45
- lux fmt web-vue --editorconfig # Also include EditorConfig
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
- # VSCode config (optional)
48
- # If you've already configured globally, you can skip this
49
- lux vscode web-vue # Generate .vscode/settings.json + extensions.json (per-project)
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
-
55
- # Next: customize your own lint preset (optional)
56
61
  ```
57
62
 
58
63
  <br />
59
64
 
60
65
  ### 🎨Customize Built-in Presets
61
66
 
62
- ```bash
63
- # Check if skill and presets are initialized (skip if already done)
64
- lux init && lux init --preset
67
+ > Prerequisite: `lux init && lux init --preset` completed (see Quick Start)
65
68
 
66
- # Use an AI agent to customize a built-in preset (recommended)
67
- # In an AI agent like Claude, just run:
69
+ ```bash
70
+ # Use an AI agent to customize (recommended)
71
+ # In Claude or other AI agents, just run:
68
72
  /lux configure built-in preset web-react template to fit my development project style
69
73
 
70
74
  # Or manually edit files under ~/.lux/preset/
71
75
  # e.g. add a cspell script to web-react:
72
- # "cspell":"cspell \"src/**/*\"" to ~/.lux/preset/fmt/web-react/package.json
76
+ # add "cspell":"cspell \"src/**/*\"" to ~/.lux/preset/fmt/web-react/package.json scripts
73
77
  ```
74
78
 
75
79
  ### 🧩Fully Custom Presets
76
80
 
77
- ```bash
78
- # Check if skill and presets are initialized (skip if already done)
79
- lux init && lux init --preset
81
+ > Prerequisite: `lux init && lux init --preset` completed (see Quick Start)
80
82
 
81
- # Use an AI agent to create a fully custom preset (recommended)
82
- # In an AI agent like Claude, just run:
83
+ ```bash
84
+ # Use an AI agent to create a custom preset (recommended)
85
+ # In Claude or other AI agents, just run:
83
86
  /lux configure my formatting template <your-custom-fmt-preset-name> to fit my development project style
84
87
 
85
88
  # Verify the preset is registered
@@ -90,12 +93,12 @@ lux fmt list
90
93
 
91
94
  | Command | Description |
92
95
  | :-------------------------- | :---------------------------------------------------------------- |
93
- | `lux fmt <preset>` | Initialize lint configs |
96
+ | `lux fmt <preset>` | Generate lint configs |
94
97
  | `lux fmt list` | List available lint presets |
95
- | `lux vscode <preset>` | Configure VSCode settings (per-project) |
98
+ | `lux vscode <preset>` | Generate VSCode config (per-project) |
96
99
  | `lux vscode list` | List available VSCode presets |
97
- | `lux init` | Initialize skills |
98
- | `lux init --preset` | Initialize all presets |
100
+ | `lux init` | Initialize Skill files to AI Agent |
101
+ | `lux init --preset` | Initialize all built-in presets to `~/.lux/preset/` |
99
102
  | `lux set <key=value> [...]` | Persist proxy env vars (e.g. `https_proxy=http://127.0.0.1:7890`) |
100
103
  | `lux unset` | Clear all stored proxy configuration |
101
104
  | `lux show env` | Display stored proxy environment variables |
@@ -112,24 +115,27 @@ lux fmt list
112
115
  ```bash
113
116
  lux fmt <preset> [options]
114
117
 
115
- --force Force overwrite existing files
116
- --no-install Skip dependency installation
117
- --dry-run Preview without writing files
118
- --stylelint Include Stylelint config generation (opt-in)
119
- --editorconfig Include EditorConfig config generation (opt-in)
118
+ --force Overwrite existing files and scripts
119
+ --no-install Write deps to package.json but skip install
120
+ --dry-run Preview mode, write nothing
121
+ --stylelint Include Stylelint config (opt-in)
122
+ --editorconfig Include EditorConfig config (opt-in)
123
+ --husky Initialize husky for Git hooks (opt-in)
124
+ --lint-staged Set up lint-staged (implies --husky, opt-in)
125
+ --cspell Include CSpell config (opt-in)
120
126
  --reset Reset local preset and re-create from built-in defaults
121
127
 
122
128
  lux vscode <preset> [options]
123
129
 
124
- --force Force overwrite existing files
125
- --dry-run Preview without writing files
130
+ --force Overwrite existing VSCode config files
131
+ --dry-run Preview mode, write nothing
126
132
  --stylelint Include Stylelint settings and extension (opt-in)
127
133
  --reset Reset local preset and re-create from built-in defaults
128
134
  ```
129
135
 
130
136
  <br />
131
137
 
132
- ###🔧 How It Works
138
+ ### 🔧How It Works
133
139
 
134
140
  ```
135
141
  lux fmt <preset> [options]
@@ -150,7 +156,7 @@ lux fmt <preset> [options]
150
156
  └── Not found ──► Fuzzy match against all presets (built-in + custom), show error
151
157
 
152
158
 
153
- --stylelint / --editorconfig filtering (warns if custom preset lacks matching config)
159
+ --stylelint / --editorconfig / --cspell / --husky / --lint-staged filtering (warns if custom preset lacks matching config)
154
160
 
155
161
 
156
162
  For each config file:
@@ -163,22 +169,67 @@ lux fmt <preset> [options]
163
169
  Inject scripts into package.json (auto-detect bun / pnpm / npm / yarn)
164
170
 
165
171
 
166
- Auto-install devDependencies (detects lockfile)
172
+ Install devDependencies (detects lockfile for package manager)
173
+ ```
174
+
175
+ <br />
176
+
177
+ ### 🔄Reset & Uninstall
178
+
179
+ #### Reset presets
180
+
181
+ ```bash
182
+ # Reset built-in presets (delete local copy and re-generate from built-in template)
183
+ lux fmt web-vue --reset
184
+ lux vscode web-vue --reset
185
+
186
+ # Re-initialize all built-in presets (overwrite existing local copies)
187
+ lux init --preset
188
+
189
+ # Reset custom presets: manually delete the directory
190
+ # rm -rf ~/.lux/preset/fmt/<your-custom-preset-name>
167
191
  ```
168
192
 
193
+ > Using `--reset` on a custom preset will warn and abort — there is no built-in source to restore.
194
+
195
+ #### Uninstall
196
+
197
+ ```bash
198
+ # Uninstall CLI
199
+ npm uninstall -g @luxkit/cli
200
+
201
+ # Clean config directory (optional)
202
+ # rm -rf ~/.lux
203
+
204
+ # Clean skill files, claude/opencode
205
+ # rm -rf ~/.claude/skill/lux
206
+ # rm -rf ~/.opencode/skill/lux
207
+ ```
208
+
209
+ ### 🔍Troubleshooting
210
+
211
+ | Issue | Solution |
212
+ | :---- | :------- |
213
+ | `package.json` errors | Ensure a valid `package.json` exists in the project root |
214
+ | Preset not found | Run `lux fmt list` to see all available presets — lux auto-suggests via fuzzy matching |
215
+ | Wrong package manager detected | Ensure the lockfile exists (`bun.lock` / `package-lock.json` / `pnpm-lock.yaml`) |
216
+ | Skip dependency install | Use `--no-install` to only write to `package.json`, install manually |
217
+ | Preview before applying | Use `--dry-run` to see all operations without writing |
218
+ | Flags have no effect | Custom presets must include the corresponding config files and deps for `--stylelint`/`--cspell`/`--editorconfig`/`--husky`/`--lint-staged` to work |
219
+
169
220
  <br />
170
221
 
171
- ### 🤝 Support
222
+ ### 🤝Contributing
172
223
 
173
- Found a bug, have a feature idea, or want to improve the code? Contributions are welcome!
224
+ Bug reports, feature suggestions, and code contributions are welcome!
174
225
 
175
- - **Report bugs or request features**: [Open an issue](https://github.com/TTT1231/lux/issues) on GitHub.
176
- - **Submit code**: [Pull Requests](https://github.com/TTT1231/lux/pulls) are very welcome!
177
- - **Star us**: If this tool saved you even 5 minutes of config time, please give us a [⭐️Star](https://github.com/TTT1231/lux)!
226
+ - 🐛 **Issues**: [GitHub Issues](https://github.com/TTT1231/lux/issues)
227
+ - 🛠 **Pull Requests**: [GitHub Pull Requests](https://github.com/TTT1231/lux/pulls)
228
+ - ⭐️ **Star**: If lux helped you, please give us a [Star](https://github.com/TTT1231/lux)!
178
229
 
179
230
  <br />
180
231
 
181
- ### 📄 License
232
+ ### 📄License
182
233
 
183
234
  [ISC](https://opensource.org/licenses/ISC) — Free to use, modify, and distribute.
184
235
 
package/README_zh.md ADDED
@@ -0,0 +1,238 @@
1
+ <div align="center">
2
+
3
+ # lux
4
+
5
+ **一键项目格式化 & VSCode 配置 CLI**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@luxkit/cli.svg)](https://www.npmjs.com/package/@luxkit/cli)
8
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-green.svg)](https://nodejs.org/)
9
+ [![License: ISC](https://img.shields.io/badge/license-ISC-purple.svg)](https://opensource.org/licenses/ISC)
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-6.0-3178C6.svg)](https://www.typescriptlang.org/)
11
+ [![ESM Only](https://img.shields.io/badge/ESM-only-F7DF1E.svg)](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
+ <br />
64
+
65
+ ## 🎨 自定义内置预设
66
+
67
+ > 前置条件:已完成 `lux init && lux init --preset`(见快速开始)
68
+
69
+ ```bash
70
+ # 使用 AI Agent 自定义(推荐)
71
+ # 在 Claude 等 AI Agent 中直接执行:
72
+ /lux 配置内置预设 web-react 模板,符合我的开发项目风格
73
+
74
+ # 也可手动编辑 ~/.lux/preset/ 下的预设文件
75
+ # 例如给 web-react 添加 cspell 脚本:
76
+ # 在 ~/.lux/preset/fmt/web-react/package.json 的 scripts 中添加 "cspell":"cspell \"src/**/*\""
77
+ ```
78
+
79
+ ## 🧩 完全自定义预设
80
+
81
+ > 前置条件:已完成 `lux init && lux init --preset`(见快速开始)
82
+
83
+ ```bash
84
+ # 使用 AI Agent 创建自定义预设(推荐)
85
+ # 在 Claude 等 AI Agent 中直接执行:
86
+ /lux 配置我的格式化模板 <your-custom-fmt-preset-name>,符合我的开发项目风格
87
+
88
+ # 验证预设是否注册成功
89
+ lux fmt list
90
+ ```
91
+
92
+ ## 📖命令参考
93
+
94
+ | 命令 | 说明 |
95
+ | :-------------------------- | :----------------------------------------------------------- |
96
+ | `lux fmt <preset>` | 生成 Lint 配置 |
97
+ | `lux fmt list` | 列出可用的 Lint 预设 |
98
+ | `lux vscode <preset>` | 生成 VSCode 配置(项目内) |
99
+ | `lux vscode list` | 列出可用的 VSCode 预设 |
100
+ | `lux init` | 初始化 Skill 文件到 AI Agent |
101
+ | `lux init --preset` | 初始化所有内置预设到 `~/.lux/preset/` |
102
+ | `lux set <key=value> [...]` | 设置代理环境变量(如 `https_proxy="http://127.0.0.1:7890"`) |
103
+ | `lux unset` | 清除所有代理配置 |
104
+ | `lux show env` | 显示已配置的代理环境变量 |
105
+ | `lux vpn cmd` | 复制 CMD 代理命令到剪贴板 |
106
+ | `lux vpn pw` | 复制 PowerShell 代理命令到剪贴板 |
107
+ | `lux vpn bash` | 复制 Bash 代理命令到剪贴板 |
108
+ | `lux update` | 更新 `@luxkit/cli` 到最新版本 |
109
+ | `lux update --check` | 检查可用更新,不执行安装 |
110
+
111
+ <br />
112
+
113
+ ### ⚙️命令选项
114
+
115
+ ```bash
116
+ lux fmt <preset> [options]
117
+
118
+ --force 覆盖已有文件和脚本
119
+ --no-install 写入依赖到 package.json 但跳过安装
120
+ --dry-run 预览模式,不写入任何文件
121
+ --stylelint 包含 Stylelint 配置(按需启用)
122
+ --editorconfig 包含 EditorConfig 配置(按需启用)
123
+ --husky 初始化 husky Git hooks(按需启用)
124
+ --lint-staged 配置 lint-staged(自动启用 --husky,按需启用)
125
+ --cspell 包含 CSpell 配置(按需启用)
126
+ --reset 重置本地预设,从内置默认值重新创建
127
+
128
+ lux vscode <preset> [options]
129
+
130
+ --force 覆盖已有的 VSCode 配置文件
131
+ --dry-run 预览模式,不写入任何文件
132
+ --stylelint 包含 Stylelint 设置和扩展(按需启用)
133
+ --reset 重置本地预设,从内置默认值重新创建
134
+ ```
135
+
136
+ <br />
137
+
138
+ ## 🔧工作原理
139
+
140
+ ```
141
+ lux fmt <preset> [options]
142
+
143
+
144
+ 解析 CLI 参数,校验项目 package.json
145
+
146
+
147
+ 预设类型判断
148
+
149
+ ├── 内置预设 ──► --reset? ──► 重置本地副本
150
+ │ │
151
+ │ ├── 本地副本存在 (~/.lux/preset/)? ──► 从本地副本应用
152
+ │ └── 不存在 ──► 从内置生成 ──► 保存到 ~/.lux/preset/ ──► 应用
153
+
154
+ ├── 自定义预设 (~/.lux/preset/fmt/<name>/) ──► 直接从本地目录应用
155
+
156
+ └── 未找到 ──► 模糊匹配所有可用预设(内置 + 自定义)并报错
157
+
158
+
159
+ --stylelint / --editorconfig / --cspell / --husky / --lint-staged 过滤(自定义预设无对应配置时 warning)
160
+
161
+
162
+ 遍历每个配置文件:
163
+
164
+ ├── 文件不存在? ──► 创建
165
+ ├── 已存在 + --force? ──► 覆盖
166
+ └── 已存在? ──► 跳过
167
+
168
+
169
+ 注入脚本到 package.json(自动检测 bun / pnpm / npm / yarn)
170
+
171
+
172
+ 安装 devDependencies(检测 lockfile 判断包管理器)
173
+ ```
174
+
175
+ <br />
176
+
177
+ ## 🔄重置与卸载
178
+
179
+ ### 重置预设
180
+
181
+ ```bash
182
+ # 重置内置预设(删除本地副本并从内置模板重新生成)
183
+ lux fmt web-vue --reset
184
+ lux vscode web-vue --reset
185
+
186
+ # 重新初始化所有内置预设(覆盖已有本地副本)
187
+ lux init --preset
188
+
189
+ # 重置自定义预设:手动删除对应目录
190
+ # rm -rf ~/.lux/preset/fmt/<your-custom-preset-name>
191
+ ```
192
+
193
+ > 自定义预设使用 `--reset` 会提示警告并中止,因为不存在内置源可供恢复。
194
+
195
+ ### 卸载
196
+
197
+ ```bash
198
+ # 卸载 CLI
199
+ npm uninstall -g @luxkit/cli
200
+
201
+ # 清理配置目录(可选)
202
+ # rm -rf ~/.lux
203
+
204
+ # 清理skill,claude/opencode
205
+ # rm rum ~/.claude/skill/lux
206
+ # rm rum ~/.opencode/skill/lux
207
+ ```
208
+
209
+ ## 🔍故障排查
210
+
211
+ | 问题 | 解决方案 |
212
+ | :---------------------- | :--------------------------------------------------------------------------------------- |
213
+ | `package.json` 相关错误 | 确保项目根目录存在合法的 `package.json` |
214
+ | 预设未找到 | 运行 `lux fmt list` 查看所有可用预设,lux 会自动模糊匹配建议 |
215
+ | 包管理器检测不正确 | 确保 lockfile 存在(`bun.lock` / `package-lock.json` / `pnpm-lock.yaml`) |
216
+ | 跳过依赖安装 | 使用 `--no-install` 仅写入 `package.json`,手动安装 |
217
+ | 预览操作结果 | 使用 `--dry-run` 查看将执行的所有操作 |
218
+ | flag 无效果 | 自定义预设需包含对应的配置文件和依赖,`--stylelint`/`--cspell`/`--editorconfig`/`--husky`/`--lint-staged` 才能生效 |
219
+
220
+ <br />
221
+
222
+ ## 🤝 参与贡献
223
+
224
+ 欢迎提交 Bug、功能建议或代码贡献!
225
+
226
+ - 🐛 **提交 Issue**:[GitHub Issues](https://github.com/TTT1231/lux/issues)
227
+ - 🛠 **提交 PR**:[GitHub Pull Requests](https://github.com/TTT1231/lux/pulls)
228
+ - ⭐️ **Star 支持**:如果 lux 对你有帮助,欢迎 [Star](https://github.com/TTT1231/lux)!
229
+
230
+ <br />
231
+
232
+ ## 📄 许可证
233
+
234
+ [ISC](https://opensource.org/licenses/ISC) — 可自由使用、修改和分发。
235
+
236
+ <br />
237
+
238
+ <p align="right"><a href="./README.md">← Switch to English</a></p>