@wagq/wa-cli 0.6.29 → 0.6.31
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/.cursor/skills/commit-review/SKILL.md +29 -0
- package/.cursor/skills/readme/SKILL.md +17 -0
- package/README.md +136 -53
- package/config/command.js +8 -1
- package/lib/exe/index.js +3 -2
- package/lib/skill/index.js +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit-review
|
|
3
|
+
description: 对commit提交的代码进行code-review
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# commit-review
|
|
7
|
+
|
|
8
|
+
## 何时使用
|
|
9
|
+
|
|
10
|
+
当用户要求对commit进行review时,检查最新一条commit的代码,并进行code review。
|
|
11
|
+
|
|
12
|
+
## 工作流程
|
|
13
|
+
|
|
14
|
+
1. **提取review范围commit**:从git commit历史中取出最新的一条commit
|
|
15
|
+
2. **审阅commit中修改的代码**: 对commit中修改的代码进行审阅,开始code review工作
|
|
16
|
+
3. **输出code review结果**: review结束后,输出review结果到控制台,并且对review结果进行 p0, p1, p2共三级优先级的评估
|
|
17
|
+
|
|
18
|
+
## code review结果输出模板
|
|
19
|
+
|
|
20
|
+
对每条用例使用以下结构(表格或等价 Markdown 列表均可):
|
|
21
|
+
|
|
22
|
+
```markdown
|
|
23
|
+
### {优先等级}-{文件路径}
|
|
24
|
+
|
|
25
|
+
- **类型**: code review中常见的错误类型
|
|
26
|
+
- **优先级**: P0 | P1 | P2
|
|
27
|
+
- **问题描述**: code review中问题的具体描述
|
|
28
|
+
- **修改建议**: code review中对问题的修改建议
|
|
29
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: readme
|
|
3
|
+
description: 对项目README.md文件进行补充描述
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# readme
|
|
7
|
+
|
|
8
|
+
## 何时使用
|
|
9
|
+
|
|
10
|
+
当用户要求对readme进行补充时。
|
|
11
|
+
|
|
12
|
+
## 工作流程
|
|
13
|
+
|
|
14
|
+
1. **提取指令集合**:读取 `config\command.js` 文件的内容,获取脚手架内置的所有命令
|
|
15
|
+
2. **理解指令内容**: 读取指令的配置与描述,下钻到指令执行的node内容
|
|
16
|
+
3. **检查README.md**: 检查当前README.md文件的内容,查阅是否有描述错误与未描述的内容
|
|
17
|
+
4. **完善README.md**: 把错误的描述和未补充的描述修改到README.md文件中,并执行命令 `git commit -m "feat: 完善README.md"`
|
package/README.md
CHANGED
|
@@ -1,53 +1,136 @@
|
|
|
1
|
-
# cli
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
# wa-cli
|
|
2
|
+
|
|
3
|
+
基于 Commander 的本地脚手架(`@wagq/wa-cli`)。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @wagq/wa-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
全局安装后使用 `wa <命令>` 调用。
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
wa --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 命令一览
|
|
18
|
+
|
|
19
|
+
以下命令以 `config/command.js` 为准(含别名/参数)。
|
|
20
|
+
|
|
21
|
+
### init
|
|
22
|
+
|
|
23
|
+
- **作用**:项目初始化工具
|
|
24
|
+
- **用法**:`wa init <name>`
|
|
25
|
+
- **别名**:`wa i <name>`
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
wa init my-app
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### server
|
|
32
|
+
|
|
33
|
+
- **作用**:启动本地静态服务
|
|
34
|
+
- **用法**:`wa server [path]`
|
|
35
|
+
- **别名**:`wa s [path]`
|
|
36
|
+
- **位置参数**
|
|
37
|
+
- `path`:文件路径,默认 `dist`
|
|
38
|
+
- **选项**
|
|
39
|
+
- `-P, --port <port>`:端口
|
|
40
|
+
- `-S, --https <boolean>`:是否开启 https
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
wa server
|
|
44
|
+
wa server dist -P 3000 -S true
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### xlsx2Config
|
|
48
|
+
|
|
49
|
+
- **作用**:xlsx 文件转多语言配置
|
|
50
|
+
- **用法**:`wa xlsx2Config <path> <name> <ext>`
|
|
51
|
+
- **别名**:`wa l <path> <name> <ext>`
|
|
52
|
+
- **位置参数**
|
|
53
|
+
- `path`:文件路径
|
|
54
|
+
- `name`:xlsx 文件名称
|
|
55
|
+
- `ext`:转换文件格式(`ts` 或 `json`)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
wa xlsx2Config ./locale excel.xlsx json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### daml
|
|
62
|
+
|
|
63
|
+
- **作用**:同步低代码逻辑器文件
|
|
64
|
+
- **用法**:`wa daml`
|
|
65
|
+
- **别名**:`wa d`
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
wa daml
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### damls
|
|
72
|
+
|
|
73
|
+
- **作用**:从应用同步所有页面的逻辑器与变量值
|
|
74
|
+
- **用法**:`wa damls`
|
|
75
|
+
- **别名**:`wa da`
|
|
76
|
+
- **配置**:可将 `appId`、`branchid`、`token` 写入 `~/.damlrc`(数组形式)
|
|
77
|
+
|
|
78
|
+
`~/.damlrc` 示例(JSON):
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
[
|
|
82
|
+
{
|
|
83
|
+
"origin": "https://example.com",
|
|
84
|
+
"appId": "xxx",
|
|
85
|
+
"branchid": "yyy",
|
|
86
|
+
"token": "zzz",
|
|
87
|
+
"appName": "my-app"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- **字段说明**
|
|
93
|
+
- `origin`:请求域名(`/api/assembler/page/list` 页面列表接口域名)
|
|
94
|
+
- `appId` / `branchid` / `token`:请求参数
|
|
95
|
+
- `appName`:应用名称(区分不同应用的标识);生成的文件会放在以 `appName` 命名的文件夹下
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
wa damls
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### batchUpdate
|
|
102
|
+
|
|
103
|
+
- **作用**:批量升级依赖包(可指定组织,只更新组织下的依赖)
|
|
104
|
+
- **用法**:`wa batchUpdate`
|
|
105
|
+
- **别名**:`wa bu`
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
wa batchUpdate
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### web2exe
|
|
112
|
+
|
|
113
|
+
- **作用**:将网页打包成 exe(内部调用 `nativefier`)
|
|
114
|
+
- **用法**:`wa web2exe <name> <path> [icon]`
|
|
115
|
+
- **别名**:`wa we <name> <path> [icon]`
|
|
116
|
+
- **参数说明**
|
|
117
|
+
- `name`:应用名称
|
|
118
|
+
- `path`:网页地址或本地 `html` 文件路径(会透传给 `nativefier`)
|
|
119
|
+
- `icon`:图标路径(可选)
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
wa web2exe MyApp https://example.com ./icon.ico
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### skills
|
|
126
|
+
|
|
127
|
+
- **作用**:交互选择并执行与 `openskills` 相关的常用命令(需本机可执行 `npx`)
|
|
128
|
+
- **用法**:`wa skills`
|
|
129
|
+
- **别名**:`wa sk`
|
|
130
|
+
- **交互选项**
|
|
131
|
+
- `getList`:执行 `npx openskills install anthropics/skills`
|
|
132
|
+
- `sync`:执行 `npx openskills sync`
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
wa skills
|
|
136
|
+
```
|
package/config/command.js
CHANGED
|
@@ -5,6 +5,7 @@ const asyncDaml = require("../lib/daml/async");
|
|
|
5
5
|
const asyncDamlByApp = require("../lib/daml/asyncByApp");
|
|
6
6
|
const batchUpdate = require("../lib/batchUpdate");
|
|
7
7
|
const web2exe = require("../lib/exe");
|
|
8
|
+
const skill = require("../lib/skill");
|
|
8
9
|
|
|
9
10
|
const command = [
|
|
10
11
|
{
|
|
@@ -94,7 +95,7 @@ const command = [
|
|
|
94
95
|
action: xlsx2Config,
|
|
95
96
|
},
|
|
96
97
|
{
|
|
97
|
-
name: "web2exe [name] [path]",
|
|
98
|
+
name: "web2exe [name] [path] [icon]",
|
|
98
99
|
alias: 'we',
|
|
99
100
|
description: "将网页打包成exe",
|
|
100
101
|
positional: [
|
|
@@ -115,6 +116,12 @@ const command = [
|
|
|
115
116
|
],
|
|
116
117
|
action: web2exe,
|
|
117
118
|
},
|
|
119
|
+
{
|
|
120
|
+
name: "skills",
|
|
121
|
+
alias: "sk",
|
|
122
|
+
description: "openskills指令快速导航",
|
|
123
|
+
action: skill,
|
|
124
|
+
},
|
|
118
125
|
];
|
|
119
126
|
|
|
120
127
|
module.exports = command;
|
package/lib/exe/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const { spawn } = require("child_process");
|
|
2
2
|
|
|
3
|
-
const web2exe = (name, path) => {
|
|
4
|
-
|
|
3
|
+
const web2exe = (name, path, icon) => {
|
|
4
|
+
const binStr = `npx nativefier --name ${name} ${icon ? ` --icon ${icon}` : ""} ${path}`;
|
|
5
|
+
spawn(binStr, {
|
|
5
6
|
cwd: process.cwd(),
|
|
6
7
|
stdio: "inherit",
|
|
7
8
|
shell: true,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { spawn } = require("child_process");
|
|
2
|
+
const Prompt = require("inquirer");
|
|
3
|
+
|
|
4
|
+
const skill = async () => {
|
|
5
|
+
const initQuestions = () => [
|
|
6
|
+
{
|
|
7
|
+
type: "list",
|
|
8
|
+
name: "mode",
|
|
9
|
+
message: `请选择指令`,
|
|
10
|
+
choices: ["getList", "sync"],
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const commandConfig = {
|
|
15
|
+
getList: "npx openskills install anthropics/skills",
|
|
16
|
+
sync: "npx openskills sync"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { mode } = await Prompt.default.prompt(initQuestions());
|
|
20
|
+
|
|
21
|
+
const command = commandConfig[mode];
|
|
22
|
+
|
|
23
|
+
if(command) {
|
|
24
|
+
spawn(
|
|
25
|
+
`${command}`,
|
|
26
|
+
{
|
|
27
|
+
cwd: process.cwd(),
|
|
28
|
+
stdio: "inherit",
|
|
29
|
+
shell: true,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = skill;
|