@luxkit/cli 1.1.1 → 1.1.3

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
@@ -16,67 +16,86 @@
16
16
 
17
17
  ---
18
18
 
19
- ### What is lux?
19
+ ### 📌 What is lux?
20
20
 
21
- `lux` is a CLI tool that initializes project formatting configs and VSCode workspace settings with a single command. It generates ESLint, Prettier, CSpell, EditorConfig files and VSCode settings from battle-tested presets — with smart merge and conflict resolution.
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.
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.
22
28
 
23
29
  <div align="center">
24
30
  <img src="https://github.com/TTT1231/lux/blob/main/demo.gif?raw=true" alt="lux demo" width="640" />
25
31
  </div>
26
32
 
27
- ### Key Highlights
28
-
29
- | Feature | Description |
30
- | :------------------------- | :--------------------------------------------------------------------------------------------------- |
31
- | 🎯 **One Command Setup** | `lux fmt web-vue` generates all linting & formatting configs instantly |
32
- | 🔧 **6 Fmt Presets** | `web-vue` · `web-react` · `electron-vue` · `uniapp` · `node` · `nest` — each with curated rules |
33
- | 🖥️ **7 VSCode Presets** | `web-vue` · `web-react` · `electron-vue` · `uniapp` · `node` · `nest` · `go` — settings + extensions |
34
- | 🔀 **Smart Merge** | Preset wins for linting keys; user wins for personal preferences |
35
- | 🛡️ **Conflict Resolution** | `neverOverwrite` / `forceOverwrite` lists + `--force` flag |
36
- | 📦 **Auto Install** | Detects bun / pnpm / yarn / npm and installs devDependencies |
37
- | 🔍 **Fuzzy Matching** | Typo a preset name? Levenshtein distance finds the closest match |
38
- | 🧪 **Dry Run** | Preview all changes with `--dry-run` before writing anything |
39
- | 🔗 **Script Injection** | Auto-injects `<pm> lint` / `<pm> format` scripts into package.json |
40
- | 🌐 **Proxy Management** | Persistent proxy config with `set` / `unset` — copy to CMD / PowerShell / Bash |
41
- | 🔄 **Self-Update** | `lux update` checks and installs the latest version automatically |
42
-
43
- <br />
44
-
45
- ### Quick Start
33
+ ### ⚡Quick Start
46
34
 
47
35
  ```bash
48
36
  # Install globally (pick your package manager)
49
37
  npm install -g @luxkit/cli
50
- # or
51
- bun add -g @luxkit/cli
52
38
 
53
- # Initialize formatting configs
54
- lux fmt web-vue # Generate ESLint, Prettier, CSpell
39
+ # Initialize skill and preset
40
+ lux init && lux init --preset
41
+
42
+ # Lint usage
43
+ lux fmt web-vue # Configure web-vue lint — ESLint, Prettier, CSpell
55
44
  lux fmt web-vue --stylelint # Also include Stylelint
56
45
  lux fmt web-vue --editorconfig # Also include EditorConfig
57
46
 
58
- # Initialize VSCode settings
59
- lux vscode web-vue # Generate .vscode/settings.json + extensions.json
60
-
61
- # Initialize AI coding tool skills
62
- lux init # Select tool interactively, copy skills to project
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)
63
50
 
64
51
  # List available presets
65
52
  lux fmt list
66
53
  lux vscode list
54
+
55
+ # Next: customize your own lint preset (optional)
67
56
  ```
68
57
 
69
58
  <br />
70
59
 
71
- ### CLI Commands
60
+ ### 🎨Customize Built-in Presets
61
+
62
+ ```bash
63
+ # Check if skill and presets are initialized (skip if already done)
64
+ lux init && lux init --preset
65
+
66
+ # Use an AI agent to customize a built-in preset (recommended)
67
+ # In an AI agent like Claude, just run:
68
+ /lux configure built-in preset web-react template to fit my development project style
69
+
70
+ # Or manually edit files under ~/.lux/preset/
71
+ # e.g. add a cspell script to web-react:
72
+ # "cspell":"cspell \"src/**/*\"" to ~/.lux/preset/fmt/web-react/package.json
73
+ ```
74
+
75
+ ### 🧩Fully Custom Presets
76
+
77
+ ```bash
78
+ # Check if skill and presets are initialized (skip if already done)
79
+ lux init && lux init --preset
80
+
81
+ # Use an AI agent to create a fully custom preset (recommended)
82
+ # In an AI agent like Claude, just run:
83
+ /lux configure my formatting template <your-custom-fmt-preset-name> to fit my development project style
84
+
85
+ # Verify the preset is registered
86
+ lux fmt list
87
+ ```
88
+
89
+ ### 📖CLI Commands
72
90
 
73
91
  | Command | Description |
74
92
  | :-------------------------- | :---------------------------------------------------------------- |
75
- | `lux fmt <preset>` | Initialize formatting config files |
76
- | `lux fmt list` | List available fmt presets |
77
- | `lux vscode <preset>` | Initialize VSCode workspace settings |
93
+ | `lux fmt <preset>` | Initialize lint configs |
94
+ | `lux fmt list` | List available lint presets |
95
+ | `lux vscode <preset>` | Configure VSCode settings (per-project) |
78
96
  | `lux vscode list` | List available VSCode presets |
79
- | `lux init` | Initialize AI coding tool skills in current project |
97
+ | `lux init` | Initialize skills |
98
+ | `lux init --preset` | Initialize all presets |
80
99
  | `lux set <key=value> [...]` | Persist proxy env vars (e.g. `https_proxy=http://127.0.0.1:7890`) |
81
100
  | `lux unset` | Clear all stored proxy configuration |
82
101
  | `lux show env` | Display stored proxy environment variables |
@@ -88,20 +107,7 @@ lux vscode list
88
107
 
89
108
  <br />
90
109
 
91
- ### Available Presets
92
-
93
- | Preset | Fmt | VSCode | Stack |
94
- | :------------- | :-: | :----: | :------------------------- |
95
- | `web-vue` | ✅ | ✅ | Vue 3 / Vite / TS / CSS |
96
- | `web-react` | ✅ | ✅ | React / Vite / TS / CSS |
97
- | `electron-vue` | ✅ | ✅ | Electron + Vue / Web stack |
98
- | `node` | ✅ | ✅ | Node.js backend |
99
- | `nest` | ✅ | ✅ | NestJS backend |
100
- | `go` | — | ✅ | Go backend |
101
-
102
- <br />
103
-
104
- ### Options
110
+ ### ⚙️Options
105
111
 
106
112
  ```bash
107
113
  lux fmt <preset> [options]
@@ -112,34 +118,49 @@ lux fmt <preset> [options]
112
118
  --stylelint Include Stylelint config generation (opt-in)
113
119
  --editorconfig Include EditorConfig config generation (opt-in)
114
120
  --reset Reset local preset and re-create from built-in defaults
121
+
122
+ lux vscode <preset> [options]
123
+
124
+ --force Force overwrite existing files
125
+ --dry-run Preview without writing files
126
+ --stylelint Include Stylelint settings and extension (opt-in)
127
+ --reset Reset local preset and re-create from built-in defaults
115
128
  ```
116
129
 
117
130
  <br />
118
131
 
119
- ### How It Works
132
+ ###🔧 How It Works
120
133
 
121
134
  ```
122
- lux fmt web-vue
135
+ lux fmt <preset> [options]
123
136
 
124
137
 
125
- Parse CLI args ──► Resolve preset (fuzzy match on typo)
138
+ Parse CLI args, validate project package.json
126
139
 
127
140
 
128
- Local preset exists in ~/.lux/preset/?
141
+ Resolve preset type
129
142
 
130
- ├── Yes ──► Copy files from local preset (editable, survives updates)
131
- └── No ──► Generate from built-in ──► Save to ~/.lux/preset/ for reuse
143
+ ├── Built-in preset ──► --reset? ──► Reset local copy
144
+ │ │
145
+ │ ├── Local copy exists (~/.lux/preset/)? ──► Apply from local
146
+ │ └── Not found ──► Generate from built-in ──► Save to ~/.lux/preset/ ──► Apply
147
+
148
+ ├── Custom preset (~/.lux/preset/fmt/<name>/) ──► Apply from local directory
149
+
150
+ └── Not found ──► Fuzzy match against all presets (built-in + custom), show error
151
+
152
+
153
+ --stylelint / --editorconfig filtering (warns if custom preset lacks matching config)
132
154
 
133
155
 
134
156
  For each config file:
135
157
 
136
158
  ├── File not found? ──► Create
137
- ├── In neverOverwrite? ──► Skip
138
- ├── In forceOverwrite? ──► Overwrite
139
- └── Exists + --force? ──► Overwrite / Skip
159
+ ├── Exists + --force? ──► Overwrite
160
+ └── Exists? ──► Skip
140
161
 
141
162
 
142
- Inject scripts into package.json (<pm> bun run / pnpm run / ...)
163
+ Inject scripts into package.json (auto-detect bun / pnpm / npm / yarn)
143
164
 
144
165
 
145
166
  Auto-install devDependencies (detects lockfile)
@@ -147,40 +168,13 @@ lux fmt web-vue
147
168
 
148
169
  <br />
149
170
 
150
- ### Tech Stack
151
-
152
- | Category | Technology |
153
- | :------- | :----------------------------------------- |
154
- | Language | TypeScript 6.0 (ESM-only) |
155
- | Runtime | Node.js 18+ |
156
- | Build | tsup |
157
- | Test | Vitest (unit + acceptance) |
158
- | CLI | Commander.js |
159
- | Output | Chalk |
160
- | Bundle | Minimal runtime deps (chalk + commander + @clack/prompts) |
161
-
162
- <br />
163
-
164
- ### Development
165
-
166
- ```bash
167
- git clone git@github.com:TTT1231/lux.git
168
- cd lux
169
- bun install
170
-
171
- bun link # Register `lux` globally for testing
172
- lux fmt web-vue # Test it on any project
173
-
174
- bun test # Run tests
175
- bun build # Build to dist/
176
- bun code:check:all # lint + format + spell check
177
- ```
178
-
179
- <br />
180
-
181
171
  ### 🤝 Support
182
172
 
183
- If you have any questions or run into issues, feel free to [open an issue](https://github.com/TTT1231/lux/issues) on GitHub.
173
+ Found a bug, have a feature idea, or want to improve the code? Contributions are welcome!
174
+
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)!
184
178
 
185
179
  <br />
186
180
 
package/README_Zh.md ADDED
@@ -0,0 +1,189 @@
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 时代** 打造的工程化配置工具,只需一条命令即可为您搭好绝佳的开发 lint 基建。
22
+
23
+ - 🚀 **一键极速配置**:告别繁琐的手动依赖安装,一套命令自动为你搭好 ESLint、Prettier、CSpell、Stylelint、EditorConfig 以及完美的 VSCode 工作区体验。
24
+ - 🤖 **AI Agent 最佳拍档**:专为 Claude、Opencode 打造生态!技能(Skill)体系,你可以直接用自然语言(如*"/lux 帮我配一套适合团队的 react 代码规范"*),让 AI 帮你全自动构建和调整自定义预设。
25
+ - 📦 **框架开箱即用**:内置场景预设:`web-vue`, `web-react`, `node`等。
26
+ - 🎨 **高度自由的专属定制**:厌倦了死板的“一刀切”封装配置?`lux` 支持提取和微调内置预设,更支持**完全自定义私有预设**,完美兼顾开箱即用体验与团队强定制化刚需。
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
+ # lint 使用
43
+ lux fmt web-vue # 配置web-vue lint,配置 ESLint、Prettier、CSpell
44
+ lux fmt web-vue --stylelint # 同时包含 Stylelint
45
+ lux fmt web-vue --editorconfig # 同时包含 EditorConfig
46
+
47
+ # vscode配置使用(option)
48
+ # 如果你全局自定义配置了,可忽视
49
+ lux vscode web-vue #(项目内) 生成 .vscode/settings.json + extensions.json
50
+
51
+ # 查看可用预设
52
+ lux fmt list
53
+ lux vscode list
54
+
55
+ # 下一步:自定义你自己的lint预设(可选)
56
+ ```
57
+
58
+ <br />
59
+
60
+ ## 🎨 自定义内置预设
61
+
62
+ ```bash
63
+ # 检查skill和预设是否初始化(已初始化,请忽视)
64
+ lux init && lux init --preset
65
+
66
+ # 使用 ai agent 进行自定义内置预设(推荐)
67
+ # 在ai agent例如claude,直接执行以下即可
68
+ /lux 配置内置预设 web-react 模板,符合我的开发项目风格
69
+
70
+ # 如果你不想使用 ai agent 可直接编辑 `~/.lux/preset/`下的内置预设文件
71
+ # 例如修改 web-react 增加cspell script
72
+ # "cspell":"cspell \"src/**/*\"" 到 `~/.lux/preset/fmt/web-react/package.json` 即可
73
+ ```
74
+
75
+ ## 🧩 完全自定义预设
76
+
77
+ 如果你想完全自定义自己的 lint,按照以下方法进行即可:
78
+
79
+ ```bash
80
+ # 检查skill和预设是否初始化(已初始化,请忽视)
81
+ lux init && lux init --preset
82
+
83
+ # 使用 ai agent 进行完全自定义预设(推荐)
84
+ # 在ai agent例如claude,直接执行以下即可
85
+ /lux 配置我的格式化模板<your-custom-fmt-preset-name>,符合我的开发项目风格
86
+
87
+ # 检查是否配置成功
88
+ lux fmt list
89
+ ```
90
+
91
+ ## 📖命令参考
92
+
93
+ | 命令 | 说明 |
94
+ | :-------------------------- | :----------------------------------------------------------- |
95
+ | `lux fmt <preset>` | lint 配置 |
96
+ | `lux fmt list` | 列出 lint 可用的预设 |
97
+ | `lux vscode <preset>` | 配置 VSCode 设置 (项目内) |
98
+ | `lux vscode list` | 列出可用的 VSCode 预设 |
99
+ | `lux init` | 初始化 skill |
100
+ | `lux init --preset` | 初始化所有预设 |
101
+ | `lux set <key=value> [...]` | 设置代理环境变量(如 `https_proxy="http://127.0.0.1:7890"`) |
102
+ | `lux unset` | 清除全部的代理配置 |
103
+ | `lux show env` | 显示已配置的代理环境变量 |
104
+ | `lux vpn cmd` | 复制 CMD 代理命令到剪贴板 |
105
+ | `lux vpn pw` | 复制 PowerShell 代理命令到剪贴板 |
106
+ | `lux vpn bash` | 复制 Bash 代理命令到剪贴板 |
107
+ | `lux update` | 更新 `@luxkit/cli` 到最新版本 |
108
+ | `lux update --check` | 仅检查是否有可用更新,不执行安装 |
109
+
110
+ <br />
111
+
112
+ ### ⚙️命令选项
113
+
114
+ ```bash
115
+ lux fmt <preset> [options]
116
+
117
+ --force 强制覆盖已有文件
118
+ --no-install 跳过依赖安装
119
+ --dry-run 预览模式,不写入文件
120
+ --stylelint 包含 Stylelint 配置(按需启用)
121
+ --editorconfig 包含 EditorConfig 的配置(按需启用)
122
+ --reset 重置本地预设,从内置默认值重新创建
123
+
124
+ lux vscode <preset> [options]
125
+
126
+ --force 强制覆盖已有文件
127
+ --dry-run 预览模式,不写入文件
128
+ --stylelint 包含 Stylelint 设置和扩展(按需启用)
129
+ --reset 重置本地预设,从内置默认值重新创建
130
+ ```
131
+
132
+ <br />
133
+
134
+ ## 🔧工作原理
135
+
136
+ ```
137
+ lux fmt <preset> [options]
138
+
139
+
140
+ 解析 CLI 参数,校验项目 package.json
141
+
142
+
143
+ 预设类型判断
144
+
145
+ ├── 内置预设 ──► --reset? ──► 重置本地副本
146
+ │ │
147
+ │ ├── 本地副本存在 (~/.lux/preset/)? ──► 从本地副本应用
148
+ │ └── 不存在 ──► 从内置生成 ──► 保存到 ~/.lux/preset/ ──► 应用
149
+
150
+ ├── 自定义预设 (~/.lux/preset/fmt/<name>/) ──► 直接从本地目录应用
151
+
152
+ └── 未找到 ──► 模糊匹配所有可用预设(内置 + 自定义)并报错
153
+
154
+
155
+ --stylelint / --editorconfig 过滤(自定义预设无对应配置时 warning)
156
+
157
+
158
+ 遍历每个配置文件:
159
+
160
+ ├── 文件不存在? ──► 创建
161
+ ├── 已存在 + --force? ──► 覆盖
162
+ └── 已存在? ──► 跳过
163
+
164
+
165
+ 注入脚本到 package.json(自动检测 bun / pnpm / npm / yarn)
166
+
167
+
168
+ 自动安装 devDependencies(检测 lockfile 判断包管理器)
169
+ ```
170
+
171
+ <br />
172
+
173
+ ## 🤝 参与贡献与支持
174
+
175
+ 发现 Bug、有绝妙的新功能想法,或者想亲自下场优化代码?我们极其欢迎你的加入!
176
+
177
+ - 🐛 **提交 Bug 或需求**:任何疑问或改进建议,欢迎随时在 GitHub [提交 Issue](https://github.com/TTT1231/lux/issues)。
178
+ - 🛠 **提交代码 (PR)**:非常欢迎并且期待你提交 [PR](https://github.com/TTT1231/lux/pulls) 来一起完善这个项目!
179
+ - ⭐️ **点赞支持**:如果这个工具帮你节省了哪怕 5 分钟的配置时间,请在 GitHub 上点亮一个 [⭐️Star](https://github.com/TTT1231/lux)!
180
+
181
+ <br />
182
+
183
+ ## 📄 许可证
184
+
185
+ [ISC](https://opensource.org/licenses/ISC) — 可自由使用、修改和分发。
186
+
187
+ <br />
188
+
189
+ <p align="right"><a href="./README.md">← Switch to English</a></p>