@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.
@@ -0,0 +1,125 @@
1
+ # Custom Preset Configuration
2
+
3
+ lux 预设存储在`~/.lux/preset/` (i.e. `os.homedir()/.lux/preset/`). Override with `LUX_HOME` env var。
4
+
5
+ ```
6
+ ~/.lux/preset/
7
+ ├── fmt/ # fmt presets (web-vue, web-react, electron-vue, uniapp, node, nest)
8
+ └── vscode/ # vscode presets (same + go)
9
+ ```
10
+
11
+ > ⚠️ **Always use `lux init --preset` to initialize all built-in presets.**。
12
+
13
+ ## Built-in presets File Reference
14
+
15
+ ### fmt preset
16
+
17
+ | File | Description |
18
+ | :--------------------- | :-------------------------------------------- |
19
+ | `eslint.config.mjs` | ESLint flat config |
20
+ | `.prettierrc` | Prettier JSON config |
21
+ | `.prettierignore` | Prettier ignore rules |
22
+ | `stylelint.config.mjs` | Stylelint config |
23
+ | `.stylelintignore` | Stylelint ignore rules |
24
+ | `cspell.json` | CSpell dictionary config |
25
+ | `.editorconfig` | EditorConfig config |
26
+ | `package.json` | Template with `devDependencies` and `scripts` |
27
+
28
+ ### vscode preset
29
+
30
+ | File | Description |
31
+ | :---------------- | :------------------------------- |
32
+ | `settings.json` | VSCode workspace settings |
33
+ | `extensions.json` | VSCode extension recommendations |
34
+
35
+ ## Customize built-in presets
36
+
37
+ ```bash
38
+ lux init --preset # init all built-in presets
39
+ ```
40
+
41
+ After init, edit files under `~/.lux/preset/<type>/<preset-name>/` to customize,例如`package.json`、`eslint.config.mjs`等等,也可以增加你自己的 lint 文件例如`your-file-lint-config`. Changes take effect on the next `lux fmt` / `lux vscode` run.
42
+
43
+ 如果你自定义内置预设想重置的时候,可以重新执行`lux init --preset`去覆盖,或者使用`lux fmt <name> --reset` 、`lux vscode <name> --reset` (deletes local preset dir only; re-generated from built-in on next run).
44
+
45
+ ## Customize your own presets
46
+
47
+ ### fmt
48
+
49
+ Create a directory under `~/.lux/preset/fmt/<your-fmt-preset-name>/` with config files and a `package.json`:
50
+
51
+ ```bash
52
+ # 1. Create the preset directory
53
+ mkdir -p ~/.lux/preset/fmt/[your-custom-fmt-preset-name]
54
+
55
+ # 2. Add config files (pick what you need)
56
+ # Required: package.json (with devDependencies/dependencies and/or scripts)
57
+ # Optional: eslint.config.mjs, .prettierrc, .prettierignore,
58
+ # stylelint.config.mjs, .stylelintignore,
59
+ # cspell.json, .editorconfig , etc....
60
+ ```
61
+
62
+ Minimum `package.json` example:
63
+
64
+ ```json
65
+ {
66
+ "devDependencies": {
67
+ "eslint": "<latest>",
68
+ "prettier": "<latest>"
69
+ },
70
+ "scripts": {
71
+ "lint": "<pm> eslint .",
72
+ "lint:fix": "<pm> eslint . --fix --cache --cache-location node_modules/.cache/.eslintcache",
73
+ "cspell": "<pm> cspell \"**\""
74
+ }
75
+ }
76
+ ```
77
+
78
+ Then 执行`lux fmt list`检查是否生效——这个`<your-fmt-preset-name>` 是否出现在其中。
79
+
80
+ ```bash
81
+ lux fmt <your-fmt-preset-name> # applies your custom preset
82
+ lux fmt <your-fmt-preset-name> --force # overwrite existing config files
83
+ lux fmt <your-fmt-preset-name> --dry-run # preview without writing
84
+ lux fmt <your-fmt-preset-name> --stylelint # applies your custom preset (includes stylelint config)
85
+ ```
86
+
87
+ Notes:
88
+
89
+ - `lux fmt list` shows custom presets after built-in ones, marked with `(custom)`
90
+ - `lux fmt <name> --reset` warns and aborts for custom presets — there is no built-in source to restore
91
+ - Unknown preset names fuzzy-match against all available presets (builtin + custom combined)
92
+ - `lux fmt` returns exit code **1** when a preset is not found (safe for CI/CD)
93
+ - `lux fmt <name> --stylelint/--editorconfig` warns when the flag has no effect (preset has no matching config or dependencies)
94
+
95
+ ### vscode
96
+
97
+ Custom vscode presets are not yet supported. To customize VSCode settings, use the built-in preset customization flow:
98
+
99
+ ```bash
100
+ lux init --preset # materialize built-in presets
101
+ # Edit files under ~/.lux/preset/vscode/<preset-name>/
102
+ # - settings.json (VSCode workspace settings)
103
+ # - extensions.json (extension recommendations)
104
+ lux vscode web-vue # applies your customized preset
105
+ ```
106
+
107
+ ## Fmt presets · package.json rules
108
+
109
+ `devDependencies` 和 `dependencies` 最新版本占位使用`<latest>`,特定版本除外。还有这个`scripts`如果不确定包管理器就用占位符`<pm>`让 lux 自动检测。
110
+
111
+ ```jsonc
112
+ {
113
+ "devDependencies": {
114
+ // 最新版本
115
+ "prettier": "<latest>",
116
+ // 固定版本
117
+ "cspell": "10.0.0",
118
+ },
119
+ "scripts": {
120
+ "lint": "<pm> eslint .",
121
+ "lint:fix": "<pm> eslint . --fix --cache --cache-location node_modules/.cache/.eslintcache",
122
+ "cspell": "<pm> cspell \"**\"",
123
+ },
124
+ }
125
+ ```
@@ -13,22 +13,31 @@ lux fmt list
13
13
  - `--force` — overwrite existing config files (default: skip)
14
14
  - `--dry-run` — preview what would be generated, write nothing
15
15
  - `--no-install` — write deps to package.json but skip install
16
+ - `--reset` — reset local preset, re-materialize from built-in defaults
16
17
 
17
- Presets: `web-vue` `web-react` `electron-vue` `uniapp` `node` `nest`
18
+ `lux fmt list` Built-in presets first, custom presets last, marked with **custom**.
19
+
20
+ built-in presets: `web-vue` `web-react` `electron-vue` `uniapp` `node` `nest`
18
21
 
19
22
  ## vscode — generate editor settings
20
23
 
21
24
  ```bash
22
- lux vscode <preset> [--dry-run]
25
+ lux vscode <preset> [--dry-run] [--stylelint]
23
26
  lux vscode list
24
27
  ```
25
28
 
26
- Presets: `web-vue` `web-react` `electron-vue` `uniapp` `node` `nest` `go`
29
+ - `--force` overwrite existing settings (default: skip)
30
+ - `--dry-run` — preview what would be generated, write nothing
31
+ - `--stylelint` — Include Stylelint settings and extension
32
+ - `--reset` — reset local preset, re-materialize from built-in defaults
33
+
34
+ built-in presets: `web-vue` `web-react` `electron-vue` `uniapp` `node` `nest` `go`
27
35
 
28
- ## init — lux skill(human interaction)
36
+ ## init — initialize skills or presets
29
37
 
30
38
  ```bash
31
- lux init
39
+ lux init # interactively select AI tool, copy skill files to AI Agent
40
+ lux init --preset # materialize all built-in presets to ~/.lux/preset/ (no cwd writes, no package.json required)
32
41
  ```
33
42
 
34
43
  ## vpn — proxy clipboard helper
@@ -53,3 +62,7 @@ lux show env # show stored proxy env
53
62
  lux update # update to latest
54
63
  lux update --check
55
64
  ```
65
+
66
+ ## Custom presets
67
+
68
+ To customize preset rules, see `references/custom-preset-setting.md`.
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@luxkit/cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "One-click project formatting & VSCode config CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "lux": "dist/index.js"
8
8
  },
9
9
  "files": [
10
- "dist"
10
+ "dist",
11
+ "README_Zh.md"
11
12
  ],
12
13
  "publishConfig": {
13
14
  "access": "public"
@@ -15,20 +16,14 @@
15
16
  "scripts": {
16
17
  "build": "tsup && node scripts/copy-assets.mjs",
17
18
  "dev": "tsup --watch",
18
- "lint": "eslint .",
19
+ "lint": "eslint . --cache --cache-location node_modules/.cache/eslint && cspell --cache --cache-location node_modules/.cache/cspell --gitignore \"src/**/*\" && tsc --noEmit",
20
+ "lint:fix": "eslint . --cache --cache-location node_modules/.cache/eslint --fix",
19
21
  "format": "prettier --write \"src/**/*.{ts,js,json}\"",
20
- "cspell": "cspell --gitignore \"src/**/*\"",
21
- "format:check": "prettier --check \"src/**/*.{ts,js,json}\"",
22
- "type:check": "tsc --noEmit",
23
- "code:check": "bun run lint && bun run format:check",
24
- "code:check:all": "bun run lint && bun run format:check && bun run cspell",
25
- "lint:fix": "eslint \"src/**/*.{js,ts}\" --fix",
26
- "code:fix": "bun run lint:fix && bun run format",
27
- "code:fix:all": "bun run lint:fix && bun run format",
28
22
  "prepublishOnly": "cross-env NODE_ENV=production bun run build",
29
23
  "test": "vitest run",
30
24
  "test:watch": "vitest",
31
- "test:coverage": "vitest run --coverage"
25
+ "test:coverage": "vitest run --coverage",
26
+ "code:check": "bun run lint && bun run format:check"
32
27
  },
33
28
  "keywords": [
34
29
  "cli",