jjb-cmd 2.6.0 → 3.0.0
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 +47 -46
- package/bin/command.js +92 -33
- package/package.json +2 -3
- package/src/auth.js +1 -1
- package/src/config.js +1 -1
- package/src/crypto-utils.js +1 -1
- package/src/logout.js +1 -0
- package/src/password-input.js +1 -1
- package/src/publish.js +1 -1
- package/src/push.js +1 -1
- package/src/utils.js +1 -1
- package/src/ai-pull.js +0 -1
- package/src/code-optimization.js +0 -1
- package/src/rm-rf.js +0 -1
package/README.md
CHANGED
|
@@ -37,35 +37,23 @@ jjb-cmd help
|
|
|
37
37
|
| `v` | 查看当前版本 | `jjb-cmd v` |
|
|
38
38
|
| `help` | 显示帮助信息 | `jjb-cmd help` |
|
|
39
39
|
|
|
40
|
-
###
|
|
40
|
+
### 组件管理
|
|
41
41
|
|
|
42
|
-
####
|
|
42
|
+
#### 用户登录
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
jjb-cmd
|
|
45
|
+
jjb-cmd login
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- 代码格式化和美化
|
|
50
|
-
- 依赖分析和优化建议
|
|
51
|
-
- 性能优化建议
|
|
52
|
-
|
|
53
|
-
### 组件管理
|
|
48
|
+
交互式输入用户名和密码完成登录,登录信息会安全加密存储在本地 `.auth` 文件中。
|
|
54
49
|
|
|
55
|
-
####
|
|
50
|
+
#### 退出登录
|
|
56
51
|
|
|
57
52
|
```bash
|
|
58
|
-
jjb-cmd
|
|
53
|
+
jjb-cmd logout
|
|
59
54
|
```
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
- `username`: 用户名
|
|
63
|
-
- `password`: 密码
|
|
64
|
-
|
|
65
|
-
**示例:**
|
|
66
|
-
```bash
|
|
67
|
-
jjb-cmd auth admin 123456
|
|
68
|
-
```
|
|
56
|
+
删除本地登录信息(`.auth` 文件),退出登录。
|
|
69
57
|
|
|
70
58
|
#### 发布组件
|
|
71
59
|
|
|
@@ -74,7 +62,11 @@ jjb-cmd publish <version>
|
|
|
74
62
|
```
|
|
75
63
|
|
|
76
64
|
**参数说明:**
|
|
77
|
-
- `version`:
|
|
65
|
+
- `version`: 发布版本号,仅支持以下格式:
|
|
66
|
+
- `dev` / `test` / `latest`
|
|
67
|
+
- 数字版本号,最多 5 位(如 `1.0.0`、`1.0.0.0`、`1.2.3.4.5`)
|
|
68
|
+
- ⚠️ 不能以 `v` 开头(后台会自动补 `v` 前缀,输入 `v1.0.0` 会生成 `vv1.0.0` 目录)
|
|
69
|
+
- `-f, --force`: 跳过所有二次确认(包括危险操作确认倒计时、风险确认提问、发布信息输入,发布信息使用默认值 `no message`)
|
|
78
70
|
|
|
79
71
|
**示例:**
|
|
80
72
|
```bash
|
|
@@ -83,42 +75,47 @@ jjb-cmd publish 1.0.0
|
|
|
83
75
|
|
|
84
76
|
# 发布最新版本
|
|
85
77
|
jjb-cmd publish latest
|
|
86
|
-
```
|
|
87
78
|
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
79
|
+
# 跳过所有二次确认,直接发布
|
|
80
|
+
jjb-cmd publish latest --force
|
|
81
|
+
```
|
|
91
82
|
|
|
92
83
|
### 部署管理
|
|
93
84
|
|
|
94
85
|
#### 推送微应用
|
|
95
86
|
|
|
87
|
+
**交互式:**
|
|
88
|
+
|
|
96
89
|
```bash
|
|
97
|
-
jjb-cmd push java
|
|
90
|
+
jjb-cmd push java
|
|
98
91
|
```
|
|
99
92
|
|
|
100
|
-
|
|
101
|
-
- `env`: 部署环境(test/prod)
|
|
93
|
+
执行后会实时查询后端仓库的所有远程分支,请仔细核对并选择要推送的分支;选择后会二次确认,防止推错分支发错版本。
|
|
102
94
|
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
# 部署到测试环境
|
|
106
|
-
jjb-cmd push java test
|
|
95
|
+
**非交互式一键推送(适合 AI/脚本):**
|
|
107
96
|
|
|
108
|
-
|
|
109
|
-
jjb-cmd push java
|
|
97
|
+
```bash
|
|
98
|
+
jjb-cmd push java --build <打包命令> --target <后端分支> [--message <提交信息>] [--force] [--index]
|
|
110
99
|
```
|
|
111
100
|
|
|
112
|
-
|
|
101
|
+
**参数说明:**
|
|
102
|
+
- `-b, --build <script>`: 指定打包命令(如 `build:prod`),跳过选择
|
|
103
|
+
- `-t, --target <branch>`: 指定后端分支(如 `1.0.0`),跳过列表与二次确认(仍会实时校验分支在远程是否存在)
|
|
104
|
+
- `-m, --message <msg>`: 指定提交信息,默认 `no message`
|
|
105
|
+
- `--force`: 克隆前强制清理残留临时仓库
|
|
106
|
+
- `--index`: 产物命名为 `index.html` 而非 `<appIdentifier>.html`
|
|
113
107
|
|
|
108
|
+
**示例:**
|
|
114
109
|
```bash
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
清理临时文件和缓存。
|
|
110
|
+
# 执行 build:prod 并推送到后端 1.0.0 分支
|
|
111
|
+
jjb-cmd push java --build build:prod --target 1.0.0
|
|
119
112
|
|
|
113
|
+
# 带提交信息
|
|
114
|
+
jjb-cmd push java -b build:prod -t 1.0.0 -m "feat: 更新xx"
|
|
120
115
|
```
|
|
121
116
|
|
|
117
|
+
> 只要带任一参数即进入非交互模式:`--build` 和 `--target` 缺一不可,缺失会直接报错退出,不会等待任何输入。
|
|
118
|
+
|
|
122
119
|
## 开发
|
|
123
120
|
|
|
124
121
|
### 项目结构
|
|
@@ -129,11 +126,12 @@ jjb-cmd/
|
|
|
129
126
|
│ └── command.js
|
|
130
127
|
├── src/ # 源代码
|
|
131
128
|
│ ├── auth.js # 认证模块
|
|
132
|
-
│ ├── code-optimization.js # 代码优化
|
|
133
129
|
│ ├── config.js # 配置管理
|
|
134
|
-
│ ├──
|
|
135
|
-
│ ├──
|
|
136
|
-
│ ├──
|
|
130
|
+
│ ├── crypto-utils.js # 认证信息加密存储
|
|
131
|
+
│ ├── logout.js # 退出登录
|
|
132
|
+
│ ├── password-input.js # 密码安全输入
|
|
133
|
+
│ ├── publish.js # 组件发布模块
|
|
134
|
+
│ ├── push.js # 微应用推送模块
|
|
137
135
|
│ └── utils.js # 工具函数
|
|
138
136
|
├── publish/ # 发布目录
|
|
139
137
|
├── build.js # 构建脚本
|
|
@@ -154,10 +152,13 @@ node build.js
|
|
|
154
152
|
|
|
155
153
|
## 更新日志
|
|
156
154
|
|
|
157
|
-
###
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
155
|
+
### v3.0.0
|
|
156
|
+
- push: 实时查询后端远程分支并二次确认,防止推错分支发错版本
|
|
157
|
+
- push: 支持 `--build` / `--target` / `--message` 非交互一键推送(适合 AI/脚本)
|
|
158
|
+
- publish: 版本号白名单校验(最多 5 位数字版本),禁止 `v` 开头
|
|
159
|
+
- `auth` 更名 `login`,新增 `logout` 退出登录;未认证提示显示具体登录命令
|
|
160
|
+
- 裸命令 `jjb-cmd` 无参数时输出帮助,帮助文案按显示宽度对齐
|
|
161
|
+
- 移除无用命令(`rm-rf` / `ai-pull` / `opti`)及相关源码
|
|
161
162
|
|
|
162
163
|
## 许可证
|
|
163
164
|
|
package/bin/command.js
CHANGED
|
@@ -12,58 +12,117 @@ commander.command('v').description('-- 查看版本').action(() => {
|
|
|
12
12
|
console.log(`当前版本: v${version}`);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// 计算字符串的终端显示宽度(全角/中文按 2 列计,半角按 1 列计)
|
|
16
|
+
function displayWidth(str) {
|
|
17
|
+
let width = 0;
|
|
18
|
+
for (const ch of str) {
|
|
19
|
+
width += ch.codePointAt(0) > 0x2e7f ? 2 : 1;
|
|
20
|
+
}
|
|
21
|
+
return width;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 将左侧内容补齐到指定显示宽度,用于右侧说明列对齐
|
|
25
|
+
function padTo(text, width) {
|
|
26
|
+
return text + ' '.repeat(Math.max(0, width - displayWidth(text)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 帮助信息
|
|
30
|
+
function showHelp() {
|
|
31
|
+
// [左侧命令, 右侧说明]
|
|
32
|
+
const rows = [
|
|
33
|
+
['jjb-cmd help', '帮助'],
|
|
34
|
+
['jjb-cmd v', '查看版本'],
|
|
35
|
+
['jjb-cmd publish <version>', '发布云组件'],
|
|
36
|
+
[' arg1 <version>', '发布版本,仅支持 dev/test/latest 或数字版本(最多 5 位,如 1.0.0.0),不能以 v 开头'],
|
|
37
|
+
[' -f, --force', '跳过所有二次确认'],
|
|
38
|
+
['jjb-cmd login', '登录授权(交互式输入用户名和密码)'],
|
|
39
|
+
['jjb-cmd logout', '退出登录(删除本地登录信息)'],
|
|
40
|
+
['jjb-cmd push java', '推送微应用到服务器'],
|
|
41
|
+
[' -b, --build <script>', '指定打包命令(如 build:prod),跳过选择'],
|
|
42
|
+
[' -t, --target <branch>', '指定后端分支(如 1.0.0),跳过选择与二次确认'],
|
|
43
|
+
[' -m, --message <msg>', '指定提交信息(默认 no message)'],
|
|
44
|
+
[' --force', '克隆前强制清理残留临时仓库'],
|
|
45
|
+
[' --index', '产物命名为 index.html']
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
// 以最长左侧命令为基准,统一补齐说明列
|
|
49
|
+
const maxLeft = Math.max(...rows.map(row => displayWidth(row[0])));
|
|
50
|
+
|
|
16
51
|
console.log('jjb-cmd <command>');
|
|
17
52
|
console.log('');
|
|
18
53
|
console.log('使用:');
|
|
19
54
|
console.log('');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
console.log('
|
|
24
|
-
console.log('jjb-cmd
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
rows.forEach(([left, right]) => {
|
|
56
|
+
console.log(padTo(left, maxLeft + 2) + right);
|
|
57
|
+
});
|
|
58
|
+
console.log('');
|
|
59
|
+
console.log('非交互示例: jjb-cmd push java --build build:prod --target 1.0.0');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
commander.command('help').description('-- 帮助').action(() => {
|
|
63
|
+
showHelp();
|
|
27
64
|
});
|
|
28
65
|
|
|
29
|
-
//
|
|
30
|
-
commander.command('
|
|
66
|
+
// 登录(原 auth 更名,保留 auth 作为兼容别名)
|
|
67
|
+
commander.command('login').description('-- 登录授权').action(async () => {
|
|
68
|
+
await require('../src/auth.js')([]);
|
|
69
|
+
});
|
|
70
|
+
commander.command('auth').description('-- 登录授权(已更名,建议使用 jjb-cmd login)').action(async () => {
|
|
31
71
|
await require('../src/auth.js')([]);
|
|
32
72
|
});
|
|
33
73
|
|
|
34
|
-
//
|
|
35
|
-
commander.command('
|
|
36
|
-
await require('../src/
|
|
74
|
+
// 退出登录(删除本地登录信息)
|
|
75
|
+
commander.command('logout').description('-- 退出登录').action(async () => {
|
|
76
|
+
await require('../src/logout.js')();
|
|
37
77
|
});
|
|
38
78
|
|
|
39
79
|
// 发包
|
|
40
|
-
commander.command('publish [args]').description('-- 发布包').action(args => {
|
|
41
|
-
require('../src/publish.js')(args);
|
|
80
|
+
commander.command('publish [args]').description('-- 发布包').option('-f, --force', '跳过所有二次确认').action((args, cmd) => {
|
|
81
|
+
require('../src/publish.js')(args, { force: !!(cmd && cmd.force) });
|
|
42
82
|
});
|
|
43
83
|
|
|
44
|
-
//
|
|
45
|
-
commander.command('push [args]')
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
// push 命令(支持非交互一键推送,适合 AI/脚本)
|
|
85
|
+
const pushCmd = commander.command('push [args]');
|
|
86
|
+
pushCmd
|
|
87
|
+
.option('-b, --build <script>', '指定打包命令,跳过选择(如 build:prod)')
|
|
88
|
+
.option('-t, --target <branch>', '指定后端分支,跳过选择与二次确认')
|
|
89
|
+
.option('-m, --message <msg>', '指定提交信息(默认 no message)')
|
|
90
|
+
.option('--force', '克隆前强制清理残留临时仓库')
|
|
91
|
+
.option('--index', '产物命名为 index.html');
|
|
92
|
+
pushCmd.description('-- 发布包');
|
|
93
|
+
pushCmd.action((args, cmd) => {
|
|
94
|
+
// commander 1.x 的 action 第一个参数是命令后的第一个参数(字符串)
|
|
95
|
+
const type = args;
|
|
96
|
+
if (!type) {
|
|
54
97
|
console.log(`缺少必要参数,请使用 'jjb-cmd push java'`);
|
|
55
98
|
process.exit(0);
|
|
56
99
|
}
|
|
100
|
+
if (type !== 'java') {
|
|
101
|
+
console.log(`无效的选项: ${type}`);
|
|
102
|
+
process.exit(0);
|
|
103
|
+
}
|
|
104
|
+
require('../src/push.js')({
|
|
105
|
+
buildScript: cmd && cmd.build,
|
|
106
|
+
targetBranch: cmd && cmd.target,
|
|
107
|
+
message: cmd && cmd.message,
|
|
108
|
+
force: !!(cmd && cmd.force),
|
|
109
|
+
index: !!(cmd && cmd.index)
|
|
110
|
+
});
|
|
57
111
|
});
|
|
58
112
|
|
|
59
|
-
//
|
|
60
|
-
commander.command('
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
commander.command('ai-pull [branch]').description('-- 拉取 AI 配置文件和规则').action((branch) => {
|
|
66
|
-
require('../src/ai-pull.js')(branch);
|
|
113
|
+
// 未知命令提示
|
|
114
|
+
commander.command('*').action(args => {
|
|
115
|
+
const unknownCmd = Array.isArray(args) ? args[0] : args;
|
|
116
|
+
console.log(`未知命令: ${unknownCmd || ''}`);
|
|
117
|
+
console.log('');
|
|
118
|
+
showHelp();
|
|
67
119
|
});
|
|
68
120
|
|
|
69
121
|
commander.parse(process.argv);
|
|
122
|
+
|
|
123
|
+
// 未输入任何命令时输出帮助信息
|
|
124
|
+
if (process.argv.length <= 2) {
|
|
125
|
+
console.log('未输入命令,jjb-cmd 可用命令如下:');
|
|
126
|
+
console.log('');
|
|
127
|
+
showHelp();
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
"env": "prod",
|
|
5
5
|
"httpMethod": "http",
|
|
6
6
|
"pushMessage": "yes",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "3.0.0",
|
|
8
8
|
"description": "jjb-cmd命令行工具",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "node bin/command.js help",
|
|
12
|
-
"install:package": "npm i"
|
|
13
|
-
"test:ai-pull": "node bin/command.js ai-pull"
|
|
12
|
+
"install:package": "npm i"
|
|
14
13
|
},
|
|
15
14
|
"bin": {
|
|
16
15
|
"jjb-cmd": "bin/command.js"
|
package/src/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a0_0x4fc2(){const _0x4a8438=['1917774EsrjmO','认证失败:\x20','3590peRVWT','已清理无效的认证信息','保存认证信息失败:\x20','用户取消输入','exit','71830RwpNsz','path','):\x20','正在验证用户凭证...','217RuqPTC','659068fjEsvH','password','post','用户认证成功','未知错误','message','5DuEXKb','2108256MIRhhO','./utils','9406602yuoNFI','status','exports','username','网络连接失败:\x20无法连接到服务器','认证失败\x20(','data','includes','):\x20用户名或密码错误','1424340QockiI','启动交互式登录流程','2sRVxpa','response','request','join','./password-input','193456dOpqQO','./crypto-utils','../.auth'];a0_0x4fc2=function(){return _0x4a8438;};return a0_0x4fc2();}function a0_0x3837(_0x58b5b3,_0x1250fb){_0x58b5b3=_0x58b5b3-0xc4;const _0x4fc2d9=a0_0x4fc2();let _0x3837fe=_0x4fc2d9[_0x58b5b3];return _0x3837fe;}const a0_0xc95f3c=a0_0x3837;(function(_0x2f795a,_0x4edff6){const _0x176fc7=a0_0x3837,_0x7f50b6=_0x2f795a();while(!![]){try{const _0x11fa95=parseInt(_0x176fc7(0xc8))/0x1*(parseInt(_0x176fc7(0xdc))/0x2)+-parseInt(_0x176fc7(0xc6))/0x3+-parseInt(_0x176fc7(0xe3))/0x4+-parseInt(_0x176fc7(0xe2))/0x5*(-parseInt(_0x176fc7(0xd0))/0x6)+parseInt(_0x176fc7(0xdb))/0x7*(-parseInt(_0x176fc7(0xcd))/0x8)+-parseInt(_0x176fc7(0xe5))/0x9+parseInt(_0x176fc7(0xd2))/0xa*(parseInt(_0x176fc7(0xd7))/0xb);if(_0x11fa95===_0x4edff6)break;else _0x7f50b6['push'](_0x7f50b6['shift']());}catch(_0x206e2d){_0x7f50b6['push'](_0x7f50b6['shift']());}}}(a0_0x4fc2,0x807df));const axios=require('axios'),path=require(a0_0xc95f3c(0xd8)),{getApiHost}=require('./config'),{logInfo,logSuccess,logError,fileExists,deleteFile}=require(a0_0xc95f3c(0xe4)),{saveAuth,deleteAuth}=require(a0_0xc95f3c(0xce)),{getCredentials,interactiveAuth}=require(a0_0xc95f3c(0xcc));module[a0_0xc95f3c(0xe7)]=async _0x5089d4=>{const _0xbc8bd3=a0_0xc95f3c,_0x598750=path[_0xbc8bd3(0xcb)](__dirname,_0xbc8bd3(0xcf));try{logInfo(_0xbc8bd3(0xc7));const _0x52d2d3=await interactiveAuth(),_0xe53ef7=_0x52d2d3[_0xbc8bd3(0xe8)],_0x3ab603=_0x52d2d3[_0xbc8bd3(0xdd)];logInfo(_0xbc8bd3(0xda));const _0x5e0902=await axios[_0xbc8bd3(0xde)](getApiHost()+'/api/auth',{'username':_0xe53ef7,'password':_0x3ab603});if(_0x5e0902[_0xbc8bd3(0xeb)][_0xbc8bd3(0xe6)]){logSuccess(_0xbc8bd3(0xdf));try{saveAuth(_0xe53ef7,_0x3ab603,_0x598750),logSuccess('认证信息已安全加密存储');}catch(_0x39a392){logError(_0xbc8bd3(0xd4)+_0x39a392['message']),process[_0xbc8bd3(0xd6)](0x1);}}else logError(_0xbc8bd3(0xd1)+(_0x5e0902[_0xbc8bd3(0xeb)][_0xbc8bd3(0xe1)]||_0xbc8bd3(0xe0))),fileExists(_0x598750)&&(deleteAuth(_0x598750),logInfo(_0xbc8bd3(0xd3))),process[_0xbc8bd3(0xd6)](0x1);}catch(_0x2602a7){if(_0x2602a7[_0xbc8bd3(0xe1)][_0xbc8bd3(0xc4)](_0xbc8bd3(0xd5)))logError('用户取消登录操作');else{if(_0x2602a7[_0xbc8bd3(0xc9)]){const _0xca2035=_0x2602a7[_0xbc8bd3(0xc9)][_0xbc8bd3(0xe6)],_0x462091=_0x2602a7[_0xbc8bd3(0xc9)][_0xbc8bd3(0xeb)]?.[_0xbc8bd3(0xe1)]||_0x2602a7[_0xbc8bd3(0xe1)];_0xca2035===0x191||_0xca2035===0x193?logError(_0xbc8bd3(0xea)+_0xca2035+_0xbc8bd3(0xc5)):logError('请求失败\x20('+_0xca2035+_0xbc8bd3(0xd9)+_0x462091);}else _0x2602a7[_0xbc8bd3(0xca)]?logError(_0xbc8bd3(0xe9)):logError('登录失败:\x20'+_0x2602a7['message']);}process[_0xbc8bd3(0xd6)](0x1);}};
|
package/src/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x222bd9=a1_0x2ba6;(function(_0x3733c9,_0x5d5857){const _0x351ef2=a1_0x2ba6,_0x4c1056=_0x3733c9();while(!![]){try{const _0x33f638=parseInt(_0x351ef2(0xe4))/0x1+-parseInt(_0x351ef2(0xe2))/0x2*(-parseInt(_0x351ef2(0xf3))/0x3)+-parseInt(_0x351ef2(0xe5))/0x4*(-parseInt(_0x351ef2(0xe8))/0x5)+-parseInt(_0x351ef2(0xef))/0x6+parseInt(_0x351ef2(0x104))/0x7*(parseInt(_0x351ef2(0xfa))/0x8)+parseInt(_0x351ef2(0xf4))/0x9*(-parseInt(_0x351ef2(0xfb))/0xa)+parseInt(_0x351ef2(0xe9))/0xb;if(_0x33f638===_0x5d5857)break;else _0x4c1056['push'](_0x4c1056['shift']());}catch(_0x5006e9){_0x4c1056['push'](_0x4c1056['shift']());}}}(a1_0x2a23,0x46cbc));function a1_0x2ba6(_0x3ec9af,_0x448ac3){_0x3ec9af=_0x3ec9af-0xdf;const _0x2a234c=a1_0x2a23();let _0x2ba6c9=_0x2a234c[_0x3ec9af];return _0x2ba6c9;}function a1_0x2a23(){const _0xd54781=['../package.json','G4HJRsHr9D7Ssmixegw2','7PJwELM','jjb-assembly-','http://120.26.210.58:8089','CLOUD_PROJECT','http','getApiHost','API_HOST','parse','4YhxUjb','gPSit8aJsLVmNzuQ5Cy4','516355vmpbQP','8yYOtwb','readFileSync','join','437215IuVUXJ','1329273ODVNZG','GIT_TEMP_DIR','http://192.168.1.242:10985','GIT_TEMP_JAVA','jjb-assembly-java','CONFIG_FILE_HOST','2016312FdAyNP','d4wQ7dzEjYPsgVbKnYei','API_HOST_TEST','test','256515lnTpkz','4332492VimDLn','ywPtT3xCG6b_vAxp6sTj','httpMethod','now','toString','https://jcloud.cqjjb.cn','994608fxCTNA','10HUpQyK','e9njpBd1nS_LREN8GFpR','env','snBxJ2i5kYarGGcsojhY','hLqARY89CN6fUD3yg4NL','https://cdn.cqjjb.cn/jjb-cloud-config','7V-YUxhmh51Mdhgx4rq4'];a1_0x2a23=function(){return _0xd54781;};return a1_0x2a23();}const os=require('os'),path=require('path'),fs=require('fs'),API_HOST='http://120.26.210.58:8088',API_HOST_HTTPS=a1_0x222bd9(0xf9),API_HOST_TEST=a1_0x222bd9(0x106);exports[a1_0x222bd9(0xee)]=a1_0x222bd9(0x100),exports[a1_0x222bd9(0xe0)]=API_HOST,exports[a1_0x222bd9(0xf1)]=API_HOST_TEST,exports['GIT_HOST']=a1_0x222bd9(0xeb),exports[a1_0x222bd9(0xea)]=a1_0x222bd9(0x105)+Date[a1_0x222bd9(0xf7)](),exports[a1_0x222bd9(0xec)]=a1_0x222bd9(0xed),exports[a1_0x222bd9(0x107)]={'common':{'token':a1_0x222bd9(0x103),'projectId':0x117},'react-admin-component':{'token':'FT3pKzxpRynFkmddJ9Bs','projectId':0x154},'jjb-dva-runtime':{'token':a1_0x222bd9(0xff),'projectId':0x23b},'jjb-common-lib':{'token':a1_0x222bd9(0xfc),'projectId':0x23c},'jjb-common-decorator':{'token':a1_0x222bd9(0xe3),'projectId':0x23e},'vue-unisass-component':{'token':a1_0x222bd9(0xf0),'projectId':0x153},'react-component':{'token':a1_0x222bd9(0xfe),'projectId':0x33f},'micro-app-ts':{'token':a1_0x222bd9(0x101),'projectId':0x33e},'micro-app':{'token':'FqNrmFAgrxasMrbbjvq9','projectId':0x33d},'lib':{'token':a1_0x222bd9(0xf5),'projectId':0x33c}},exports['TEMPLATE_FOLDER']=path[a1_0x222bd9(0xe7)](os['tmpdir'](),exports['GIT_TEMP_DIR']),exports[a1_0x222bd9(0xdf)]=()=>{const _0x4bf069=a1_0x222bd9;try{const _0x281409=JSON[_0x4bf069(0xe1)](fs[_0x4bf069(0xe6)](path[_0x4bf069(0xe7)](__dirname,_0x4bf069(0x102)))[_0x4bf069(0xf8)]());return _0x281409[_0x4bf069(0xfd)]===_0x4bf069(0xf2)?API_HOST_TEST:_0x281409[_0x4bf069(0xf6)]===_0x4bf069(0x108)?API_HOST:API_HOST_HTTPS;}catch(_0x4be03a){return API_HOST_HTTPS;}};
|
package/src/crypto-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a2_0x1e7996=a2_0x549b;(function(_0xde3a96,_0x55ecc3){const _0x57246b=a2_0x549b,_0x1f3e19=_0xde3a96();while(!![]){try{const _0x4abfb3=parseInt(_0x57246b(0x126))/0x1*(parseInt(_0x57246b(0x12c))/0x2)+-parseInt(_0x57246b(0x112))/0x3*(-parseInt(_0x57246b(0x121))/0x4)+-parseInt(_0x57246b(0x11d))/0x5+parseInt(_0x57246b(0x136))/0x6*(-parseInt(_0x57246b(0x138))/0x7)+-parseInt(_0x57246b(0x11f))/0x8*(-parseInt(_0x57246b(0x124))/0x9)+-parseInt(_0x57246b(0x12a))/0xa*(parseInt(_0x57246b(0x130))/0xb)+parseInt(_0x57246b(0x119))/0xc;if(_0x4abfb3===_0x55ecc3)break;else _0x1f3e19['push'](_0x1f3e19['shift']());}catch(_0x844e02){_0x1f3e19['push'](_0x1f3e19['shift']());}}}(a2_0xc679,0xb6894));const crypto=require('crypto'),fs=require('fs'),path=require('path'),CRYPTO_CONFIG={'algorithm':a2_0x1e7996(0x111),'keyLength':0x20,'ivLength':0x10,'saltLength':0x20};function deriveKey(_0x24522f,_0x3c8bc9){const _0xb402c1=a2_0x1e7996;return crypto[_0xb402c1(0x132)](_0x24522f,_0x3c8bc9,0x186a0,CRYPTO_CONFIG[_0xb402c1(0x11e)],_0xb402c1(0x116));}function generateSalt(){const _0x5738d1=a2_0x1e7996;return crypto[_0x5738d1(0x12d)](CRYPTO_CONFIG['saltLength']);}function generateIV(){const _0x135693=a2_0x1e7996;return crypto[_0x135693(0x12d)](CRYPTO_CONFIG['ivLength']);}function a2_0xc679(){const _0x9c7ad6=['22682844jUPjKz','hex','exports','saltLength','1582155qcSyUc','keyLength','301208CkQtaT','保存认证信息失败:\x20','54024huRqWa','删除认证文件失败:\x20','unknown','126vRYehs','utf8','308769pesEjn','platform','setAutoPadding','ivLength','10nCVpVX','userInfo','2XJVoyy','randomBytes','加密失败:\x20','split','5781160oPHfky','createHash','pbkdf2Sync','update','from','sha256','10074CnXDzC','读取认证信息失败:\x20','4907uhpgOH','concat','toString','existsSync','base64','hostname','final','aes-256-cbc','9umMtOW','slice','解密失败:\x20','createCipheriv','sha512','message','writeFileSync'];a2_0xc679=function(){return _0x9c7ad6;};return a2_0xc679();}function a2_0x549b(_0x179d8e,_0x52b3c8){_0x179d8e=_0x179d8e-0x10e;const _0xc6792b=a2_0xc679();let _0x549b6f=_0xc6792b[_0x179d8e];return _0x549b6f;}function encrypt(_0x1f1ebb,_0x209e99){const _0x697497=a2_0x1e7996;try{const _0x19f9f0=generateSalt(),_0x53aa91=generateIV(),_0x1f7a6c=deriveKey(_0x209e99,_0x19f9f0),_0xce55d8=crypto[_0x697497(0x115)](CRYPTO_CONFIG['algorithm'],_0x1f7a6c,_0x53aa91);_0xce55d8[_0x697497(0x128)](!![]);let _0x436ad2=_0xce55d8['update'](_0x1f1ebb,_0x697497(0x125),_0x697497(0x11a));_0x436ad2+=_0xce55d8[_0x697497(0x110)](_0x697497(0x11a));const _0x33a575=Buffer[_0x697497(0x139)]([_0x19f9f0,_0x53aa91,Buffer[_0x697497(0x134)](_0x436ad2,_0x697497(0x11a))]);return _0x33a575[_0x697497(0x13a)](_0x697497(0x10e));}catch(_0x1fc384){throw new Error(_0x697497(0x12e)+_0x1fc384[_0x697497(0x117)]);}}function decrypt(_0x14ebc9,_0x1c77a8){const _0x2e745e=a2_0x1e7996;try{const _0x140276=Buffer[_0x2e745e(0x134)](_0x14ebc9,_0x2e745e(0x10e)),_0x4f6d5d=_0x140276['slice'](0x0,CRYPTO_CONFIG[_0x2e745e(0x11c)]),_0x50ebd4=_0x140276[_0x2e745e(0x113)](CRYPTO_CONFIG[_0x2e745e(0x11c)],CRYPTO_CONFIG[_0x2e745e(0x11c)]+CRYPTO_CONFIG[_0x2e745e(0x129)]),_0x4418d8=_0x140276['slice'](CRYPTO_CONFIG[_0x2e745e(0x11c)]+CRYPTO_CONFIG['ivLength']),_0x34825e=deriveKey(_0x1c77a8,_0x4f6d5d),_0x545263=crypto['createDecipheriv'](CRYPTO_CONFIG['algorithm'],_0x34825e,_0x50ebd4);_0x545263[_0x2e745e(0x128)](!![]);let _0x3d6849=_0x545263[_0x2e745e(0x133)](_0x4418d8,null,_0x2e745e(0x125));return _0x3d6849+=_0x545263[_0x2e745e(0x110)](_0x2e745e(0x125)),_0x3d6849;}catch(_0xb57ae1){throw new Error(_0x2e745e(0x114)+_0xb57ae1[_0x2e745e(0x117)]);}}function generateDeviceKey(){const _0x4db20a=a2_0x1e7996,_0x7134e3=require('os');let _0x2427be=_0x4db20a(0x123);try{_0x2427be=_0x7134e3[_0x4db20a(0x12b)]()['username']||_0x4db20a(0x123);}catch(_0x2e8a45){_0x2427be=process.env.USER||process.env.LOGNAME||process.env.USERNAME||'unknown';}const _0xb41f1f=[_0x7134e3[_0x4db20a(0x127)](),_0x7134e3['arch'](),_0x7134e3[_0x4db20a(0x10f)](),_0x2427be]['join']('|');return crypto[_0x4db20a(0x131)](_0x4db20a(0x135))['update'](_0xb41f1f)['digest'](_0x4db20a(0x11a));}function saveAuth(_0xf6a4bc,_0x360e14,_0x4898e6){const _0x1d7c68=a2_0x1e7996;try{const _0x147cd0=generateDeviceKey(),_0x4a12da=_0xf6a4bc+'/'+_0x360e14,_0x5e34ae=encrypt(_0x4a12da,_0x147cd0);return fs[_0x1d7c68(0x118)](_0x4898e6,_0x5e34ae,{'mode':0x180}),!![];}catch(_0x1e0abf){throw new Error(_0x1d7c68(0x120)+_0x1e0abf[_0x1d7c68(0x117)]);}}function loadAuth(_0x260898){const _0x5d8912=a2_0x1e7996;try{if(!fs[_0x5d8912(0x13b)](_0x260898))throw new Error('认证文件不存在');const _0x12c2ac=generateDeviceKey(),_0x341dd2=fs['readFileSync'](_0x260898,_0x5d8912(0x125)),_0x460f91=decrypt(_0x341dd2,_0x12c2ac),[_0x54fb7c,_0x1657a9]=_0x460f91[_0x5d8912(0x12f)]('/');if(!_0x54fb7c||!_0x1657a9)throw new Error('认证数据格式错误');return{'username':_0x54fb7c,'password':_0x1657a9};}catch(_0x3da154){throw new Error(_0x5d8912(0x137)+_0x3da154[_0x5d8912(0x117)]);}}function deleteAuth(_0x3930f1){const _0x54806c=a2_0x1e7996;try{fs['existsSync'](_0x3930f1)&&fs['unlinkSync'](_0x3930f1);}catch(_0x4cf051){throw new Error(_0x54806c(0x122)+_0x4cf051[_0x54806c(0x117)]);}}module[a2_0x1e7996(0x11b)]={'encrypt':encrypt,'decrypt':decrypt,'saveAuth':saveAuth,'loadAuth':loadAuth,'deleteAuth':deleteAuth,'generateDeviceKey':generateDeviceKey};
|
package/src/logout.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a3_0x3cf876=a3_0x121f;(function(_0x38b401,_0x2e911b){const _0x3ad9f5=a3_0x121f,_0x260fab=_0x38b401();while(!![]){try{const _0x3614ed=parseInt(_0x3ad9f5(0x168))/0x1+-parseInt(_0x3ad9f5(0x15f))/0x2+parseInt(_0x3ad9f5(0x169))/0x3+-parseInt(_0x3ad9f5(0x16c))/0x4+-parseInt(_0x3ad9f5(0x163))/0x5*(parseInt(_0x3ad9f5(0x166))/0x6)+parseInt(_0x3ad9f5(0x161))/0x7+parseInt(_0x3ad9f5(0x164))/0x8;if(_0x3614ed===_0x2e911b)break;else _0x260fab['push'](_0x260fab['shift']());}catch(_0x2fc13f){_0x260fab['push'](_0x260fab['shift']());}}}(a3_0x4e2d,0xf3dbe));function a3_0x121f(_0x26566b,_0x12f0a7){_0x26566b=_0x26566b-0x15f;const _0x4e2de8=a3_0x4e2d();let _0x121ff2=_0x4e2de8[_0x26566b];return _0x121ff2;}const path=require(a3_0x3cf876(0x16d)),{logInfo,logSuccess,logWarning,logError,fileExists}=require(a3_0x3cf876(0x170)),{deleteAuth}=require(a3_0x3cf876(0x165));function a3_0x4e2d(){const _0x577547=['./utils','3402378kBVPgM','退出登录失败:\x20','6940416EatOgU','exports','8850065ozVpkt','16242640ZqiqVl','./crypto-utils','6RgYxma','join','1491952RGuwNd','870783itDkDM','message','../.auth','1335932EeLOgm','path','正在退出登录...','exit'];a3_0x4e2d=function(){return _0x577547;};return a3_0x4e2d();}module[a3_0x3cf876(0x162)]=async function(){const _0xdb3ff1=a3_0x3cf876,_0x1ae351=path[_0xdb3ff1(0x167)](__dirname,_0xdb3ff1(0x16b));!fileExists(_0x1ae351)&&(logWarning('当前未登录,无需退出'),process[_0xdb3ff1(0x16f)](0x0));try{logInfo(_0xdb3ff1(0x16e)),deleteAuth(_0x1ae351),logSuccess('已退出登录,本地登录信息已删除'),process[_0xdb3ff1(0x16f)](0x0);}catch(_0x3e62a7){logError(_0xdb3ff1(0x160)+_0x3e62a7[_0xdb3ff1(0x16a)]),process[_0xdb3ff1(0x16f)](0x1);}};
|
package/src/password-input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a4_0x1083c5=a4_0x15f5;function a4_0x15f5(_0x766247,_0x277dd6){_0x766247=_0x766247-0x1d3;const _0xf07506=a4_0xf075();let _0x15f57d=_0xf07506[_0x766247];return _0x15f57d;}(function(_0x506ef4,_0x510b34){const _0x233057=a4_0x15f5,_0x3f28a3=_0x506ef4();while(!![]){try{const _0x80d817=parseInt(_0x233057(0x1da))/0x1*(-parseInt(_0x233057(0x1e8))/0x2)+parseInt(_0x233057(0x1e3))/0x3+parseInt(_0x233057(0x1d4))/0x4*(parseInt(_0x233057(0x1d3))/0x5)+parseInt(_0x233057(0x1e9))/0x6+-parseInt(_0x233057(0x1db))/0x7+parseInt(_0x233057(0x1e0))/0x8+-parseInt(_0x233057(0x1e6))/0x9;if(_0x80d817===_0x510b34)break;else _0x3f28a3['push'](_0x3f28a3['shift']());}catch(_0x51eab8){_0x3f28a3['push'](_0x3f28a3['shift']());}}}(a4_0xf075,0xbe575));const inquirer=require('inquirer'),{logError}=require(a4_0x1083c5(0x1d5));async function getCredentials(_0x54577b=null){const _0x1dc088=a4_0x1083c5;try{let _0x2e08cf=_0x54577b;const _0x5d64fd=[];!_0x2e08cf&&_0x5d64fd[_0x1dc088(0x1d6)]({'type':_0x1dc088(0x1df),'name':'username','message':_0x1dc088(0x1d9),'validate':_0x181c5a=>{const _0x343d94=_0x1dc088;if(!_0x181c5a||!_0x181c5a[_0x343d94(0x1e2)]())return'账号不能为空';return!![];}});_0x5d64fd[_0x1dc088(0x1d6)]({'type':_0x1dc088(0x1e4),'name':_0x1dc088(0x1e4),'message':_0x1dc088(0x1e7),'mask':'*','validate':_0x36ea2c=>{const _0x4f3d1c=_0x1dc088;if(!_0x36ea2c||!_0x36ea2c[_0x4f3d1c(0x1e2)]())return _0x4f3d1c(0x1dc);return!![];}});const _0x577053=await inquirer[_0x1dc088(0x1d8)](_0x5d64fd);_0x2e08cf=_0x2e08cf||_0x577053[_0x1dc088(0x1dd)][_0x1dc088(0x1e2)]();const _0x6ab075=_0x577053[_0x1dc088(0x1e4)];return{'username':_0x2e08cf,'password':_0x6ab075};}catch(_0x17fb7c){_0x17fb7c[_0x1dc088(0x1d7)]?logError(_0x1dc088(0x1de)):logError(_0x1dc088(0x1e5)+_0x17fb7c[_0x1dc088(0x1e1)]);throw _0x17fb7c;}}async function interactiveAuth(){return await getCredentials();}function a4_0xf075(){const _0x4e87a2=['请输入密码:','17888GsxXaN','3146928NqQBoy','45ytASzS','562508fzoIug','./utils','push','isTtyError','prompt','请输入账号:','61BIVUaP','1753500hPOKxt','密码不能为空','username','获取认证信息失败:\x20当前环境不支持交互式输入','input','9547888WELHwB','message','trim','4227513KsdSKZ','password','获取认证信息失败:\x20','25353603CjVGgz'];a4_0xf075=function(){return _0x4e87a2;};return a4_0xf075();}module['exports']={'getCredentials':getCredentials,'interactiveAuth':interactiveAuth};
|
package/src/publish.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a6_0xd6ef64=a6_0x48fa;(function(_0x3243c5,_0x1a9be9){const _0x588d7f=a6_0x48fa,_0x5bc8bf=_0x3243c5();while(!![]){try{const _0x21781e=parseInt(_0x588d7f(0x142))/0x1*(-parseInt(_0x588d7f(0x155))/0x2)+parseInt(_0x588d7f(0x192))/0x3*(-parseInt(_0x588d7f(0x19b))/0x4)+parseInt(_0x588d7f(0x15e))/0x5*(parseInt(_0x588d7f(0x154))/0x6)+parseInt(_0x588d7f(0x181))/0x7*(parseInt(_0x588d7f(0x17e))/0x8)+-parseInt(_0x588d7f(0x182))/0x9+parseInt(_0x588d7f(0x16c))/0xa+parseInt(_0x588d7f(0x16e))/0xb;if(_0x21781e===_0x1a9be9)break;else _0x5bc8bf['push'](_0x5bc8bf['shift']());}catch(_0x2bc42b){_0x5bc8bf['push'](_0x5bc8bf['shift']());}}}(a6_0x1ac7,0x83b4f));const path=require('path'),os=require('os'),child_process=require('child_process'),axios=require(a6_0xd6ef64(0x14b)),inquirer=require(a6_0xd6ef64(0x144)),{getApiHost}=require(a6_0xd6ef64(0x174)),{CONSTANTS,logInfo,logSuccess,logWarning,logError,executeCommand,fileExists,readFile,writeFile}=require(a6_0xd6ef64(0x16f)),{loadAuth}=require(a6_0xd6ef64(0x17d));function getGitInfo(){const _0x2eb3c1=a6_0xd6ef64;let _0x34185e=_0x2eb3c1(0x198),_0x14a338=_0x2eb3c1(0x198);try{_0x34185e=child_process['execSync']('git\x20rev-parse\x20--abbrev-ref\x20HEAD',{'cwd':process['cwd'](),'stdio':_0x2eb3c1(0x161)})['toString']()[_0x2eb3c1(0x150)]();}catch(_0x5e26d2){}try{_0x14a338=child_process[_0x2eb3c1(0x13b)]('git\x20config\x20user.name',{'cwd':process[_0x2eb3c1(0x12d)](),'stdio':_0x2eb3c1(0x161)})[_0x2eb3c1(0x176)]()[_0x2eb3c1(0x150)]();}catch(_0x49da89){}return{'branch':_0x34185e,'gitUser':_0x14a338};}function generateMetadataComment(_0x668dd5){const _0x4a20c2=a6_0xd6ef64,{branch:_0x77871f,gitUser:_0xabb62,hostname:_0x361f24,platform:_0x1836b1,publishTime:_0x20790b,version:_0x372385,cmdVersion:_0x55b3a5}=_0x668dd5;return _0x4a20c2(0x18e)+_0x77871f+_0x4a20c2(0x134)+_0x361f24+'\x20('+_0x1836b1+_0x4a20c2(0x133)+_0x20790b+_0x4a20c2(0x141)+_0xabb62+_0x4a20c2(0x12c)+_0x372385+_0x4a20c2(0x13e)+_0x55b3a5+'\x20**/\x0a';}function parseComponentConfig(_0x51a1ba){const _0x51f93d=a6_0xd6ef64,_0x406999=_0x51a1ba[_0x51f93d(0x14a)](/(window\[).+?(\.componentKey|.+]={)/img);if(!_0x406999||!_0x406999[_0x51f93d(0x13c)])throw new Error(_0x51f93d(0x147));const _0x157ae1={},_0x1ff5d9=_0x51a1ba[_0x51f93d(0x14a)](/componentKey.+([{,]info:\s{0,}{)/img);if(!_0x1ff5d9||!_0x1ff5d9['length'])throw new Error('暴露的配置信息中缺少\x22info\x22!');let _0x3dc047='{';const _0x12159d=_0x51a1ba[_0x51f93d(0x170)](_0x1ff5d9[0x0])[0x1];for(let _0x4670f3=0x0;_0x4670f3<_0x12159d[_0x51f93d(0x13c)];_0x4670f3++){_0x3dc047+=_0x12159d[_0x4670f3];if(_0x12159d[_0x4670f3]==='}'){try{const _0x35c2c2=new Function(_0x51f93d(0x124)+_0x3dc047)();Object[_0x51f93d(0x189)](_0x157ae1,_0x35c2c2),_0x157ae1['defaultSetting']={};}catch(_0x25dc15){}break;}}const _0xd1d744=_0x51a1ba[_0x51f93d(0x14a)](/componentKey.+([{,]settings:\s{0,}{)/img);if(!_0xd1d744||!_0xd1d744[_0x51f93d(0x13c)])throw new Error(_0x51f93d(0x15f));let _0x220186='{';const _0x44a40e=_0x51a1ba[_0x51f93d(0x170)](_0xd1d744[0x0])[0x1];for(let _0x3746a6=0x0;_0x3746a6<_0x44a40e['length'];_0x3746a6++){_0x220186+=_0x44a40e[_0x3746a6];if(_0x44a40e[_0x3746a6]==='}'){try{_0x157ae1[_0x51f93d(0x125)]=new Function(_0x51f93d(0x124)+_0x220186)();}catch(_0x39cb8d){}break;}}return JSON['stringify'](_0x157ae1);}function getNodeEnv(_0x55c786){const _0x4c44bc=a6_0xd6ef64;if(_0x55c786===_0x4c44bc(0x172))return'test';if(_0x55c786===_0x4c44bc(0x157))return _0x4c44bc(0x13f);return _0x4c44bc(0x162);}function executeBuild(_0x3d96bc,_0x439ecb){const _0x500dbc=a6_0xd6ef64,_0x573598=getNodeEnv(_0x439ecb);process.env.NODE_ENV=_0x573598,logInfo(_0x500dbc(0x185)+_0x573598);const _0x32ab08=path[_0x500dbc(0x186)](_0x3d96bc,'yarn.lock');fileExists(_0x32ab08)?executeCommand(_0x500dbc(0x13a)+_0x573598,_0x3d96bc):executeCommand('npm\x20run\x20build:'+_0x573598,_0x3d96bc);}function validateRequiredFiles(_0x31c097){const _0x16dfbf=a6_0xd6ef64,_0x4fdc52=path[_0x16dfbf(0x186)](_0x31c097,_0x16dfbf(0x135)),_0xc3677f=path[_0x16dfbf(0x186)](_0x31c097,'dist',_0x16dfbf(0x167)),_0x33dc75=path['join'](_0x31c097,_0x16dfbf(0x166)),_0x11b540=path[_0x16dfbf(0x186)](_0x31c097,_0x16dfbf(0x15c));if(!fileExists(_0x33dc75))throw new Error(_0x16dfbf(0x190));if(!fileExists(_0xc3677f))throw new Error(_0x16dfbf(0x177));if(!fileExists(_0x4fdc52))throw new Error(_0x16dfbf(0x158));if(!fileExists(_0x11b540))throw new Error(_0x16dfbf(0x165));return{'readmePath':_0x4fdc52,'distPath':_0xc3677f,'packageJsonPath':_0x33dc75,'thumbnailPath':_0x11b540};}function a6_0x1ac7(){const _0x36e5e7=['prompt','resolve','组件发布成功','platform','/**\x20git-branch:\x20','正在提交发布请求...','组件发布失败!根目录缺少\x27package.json\x27文件!','未检测到认证信息,请先执行登录操作','9rNmnRK','缩略图处理完成','追溯信息注入完成','gitUser','password','binary','unknown','请输入此次组件发布的信息:','parse','989724HkKmKj','return\x20','defaultSetting','thumbnail_base64','正在验证发布所需文件...','then','distPath','no\x20message','request','\x20|\x20publish-version:\x20','cwd','status','input','../.auth','):\x20','confirmed',')\x20|\x20publish-time:\x20','\x20|\x20device:\x20','README.md','component_config_content','toISOString','message','正在加载认证信息...','yarn\x20build:','execSync','length','/api/file/publish','\x20|\x20cmd-version:\x20','development','发布失败\x20(','\x20|\x20git-user:\x20','52GeRseS','发布错误可能导致线上应用产生严重生产故障,请务必确保:','inquirer','操作失败:\x20','data','请在组件入口文件中添加\x22window[props.componentKey]\x22以暴露组件的配置信息!','文件验证通过','exports','match','axios','\x20\x201.\x20已充分测试组件各项功能','我已充分了解以上可能存在的严重风险,确认继续发布操作?','读取认证信息失败:\x20','response','trim','from','username','exit','59442odqVAs','39362HgptOY','\x20\x202.\x20已检查构建产物完整性','dev','请在组件根目录添加一个README.md说明文件!','发布失败:\x20','../package.json','\x0d倒计时\x20','thumbnail.png','stdout','490lsMCva','暴露的配置信息中缺少\x22settings\x22!','confirm','pipe','production','项目构建完成','组件配置解析完成','请在组件根目录为组件添加一个缩略图\x22thumbnail.png\x22文件!','package.json','index.js','post','\x20秒...\x20\x20','catch','hostname','5548230JKwSOc','网络连接失败:\x20无法连接到服务器或服务器无响应','7564095vrzDmS','./utils','split','服务器授权成功','test','write','./config','正在请求服务器授权...','toString','组件发布失败!根目录缺少\x27dist/index.js\x27文件!','警告:您即将进行组件发布操作,此操作不可逆,请谨慎操作','\x20\x203.\x20已确认版本号和发布信息正确','正在读取包信息...','msg','正在处理缩略图...','./crypto-utils','8216wLdcUG','0.0.0','\x20\x204.\x20已了解发布后的影响范围','3171dKnOcZ','3360681bPbolC','正在注入组件追溯信息...','未知错误','NODE_ENV\x20设置为:\x20','join','正在准备发布数据...','网络连接失败:\x20无法连接到服务器','assign'];a6_0x1ac7=function(){return _0x36e5e7;};return a6_0x1ac7();}function a6_0x48fa(_0x3755be,_0x542b87){_0x3755be=_0x3755be-0x124;const _0x1ac7e3=a6_0x1ac7();let _0x48fabb=_0x1ac7e3[_0x3755be];return _0x48fabb;}const submitFun=function(_0x79c781,_0x453551){const _0x2e6cfe=a6_0xd6ef64;_0x453551[_0x2e6cfe(0x138)]=_0x79c781||_0x2e6cfe(0x12a),axios[_0x2e6cfe(0x168)](getApiHost()+_0x2e6cfe(0x13d),_0x453551)[_0x2e6cfe(0x128)](_0x24cf1c=>{const _0x4cc99c=_0x2e6cfe;logSuccess(_0x24cf1c['data'][_0x4cc99c(0x138)]||_0x4cc99c(0x18c)),process['exit'](0x0);})[_0x2e6cfe(0x16a)](_0x26fa34=>{const _0x1705da=_0x2e6cfe;if(_0x26fa34&&_0x26fa34[_0x1705da(0x14f)]){const _0x535a02=_0x26fa34['response'][_0x1705da(0x12e)],_0x1e6b01=_0x26fa34['response'][_0x1705da(0x146)]&&(_0x26fa34['response'][_0x1705da(0x146)][_0x1705da(0x138)]||_0x26fa34[_0x1705da(0x14f)][_0x1705da(0x146)][_0x1705da(0x17b)])||'';logError(_0x1705da(0x140)+_0x535a02+_0x1705da(0x131)+(_0x1e6b01||_0x26fa34[_0x1705da(0x138)]));}else _0x26fa34&&_0x26fa34['request']?logError(_0x1705da(0x188)):logError(_0x1705da(0x159)+(_0x26fa34['message']||'未知错误'));process[_0x1705da(0x153)](0x1);});};module[a6_0xd6ef64(0x149)]=_0x22aa5e=>{const _0x241a6b=a6_0xd6ef64,_0x39ac94=path[_0x241a6b(0x186)](__dirname,_0x241a6b(0x130));!fileExists(_0x39ac94)&&(logError(_0x241a6b(0x191)),process[_0x241a6b(0x153)](0x1));let _0x2eb4a4,_0x2d8eb9;try{logInfo(_0x241a6b(0x139));const _0x2092e2=loadAuth(_0x39ac94);_0x2eb4a4=_0x2092e2[_0x241a6b(0x152)],_0x2d8eb9=_0x2092e2[_0x241a6b(0x196)],logSuccess('认证信息加载成功');}catch(_0x288a74){logError(_0x241a6b(0x14e)+_0x288a74['message']),process['exit'](0x1);}logInfo(_0x241a6b(0x175)),axios['post'](getApiHost()+'/api/auth',{'username':_0x2eb4a4,'password':_0x2d8eb9})[_0x241a6b(0x128)](async _0x504f2b=>{const _0x512f21=_0x241a6b;if(_0x504f2b['data'][_0x512f21(0x12e)]){logSuccess(_0x512f21(0x171));const _0x21e783=path[_0x512f21(0x18b)]('./');logInfo('正在执行项目构建...');try{executeBuild(_0x21e783,_0x22aa5e),logSuccess(_0x512f21(0x163));}catch(_0xe2daed){logError('项目构建失败:\x20'+_0xe2daed[_0x512f21(0x138)]),process['exit'](0x1);}logInfo(_0x512f21(0x127));let _0x25831d;try{_0x25831d=validateRequiredFiles(_0x21e783),logSuccess(_0x512f21(0x148));}catch(_0x3c3622){logError(_0x3c3622['message']),process[_0x512f21(0x153)](0x1);}logInfo(_0x512f21(0x17a));const _0x5eddea=JSON[_0x512f21(0x19a)](readFile(path[_0x512f21(0x186)](__dirname,_0x512f21(0x15a)))),{version:_0x368cb3}=_0x5eddea;logInfo(_0x512f21(0x183));const _0xe851a6=getGitInfo(),_0x50b292=new Date()[_0x512f21(0x137)](),_0x56fbdf=readFile(_0x25831d[_0x512f21(0x129)]),_0xb9f81e=generateMetadataComment({'branch':_0xe851a6['branch'],'gitUser':_0xe851a6[_0x512f21(0x195)],'hostname':os[_0x512f21(0x16b)](),'platform':os[_0x512f21(0x18d)](),'publishTime':_0x50b292,'version':_0x22aa5e||_0x512f21(0x17f),'cmdVersion':_0x368cb3})+_0x56fbdf;logSuccess(_0x512f21(0x194)),logInfo(_0x512f21(0x187));const _0x1ca2bd={'username':_0x2eb4a4,'cmd_version':_0x368cb3,'hostname':os[_0x512f21(0x16b)](),'platform':os[_0x512f21(0x18d)](),'package_version':_0x22aa5e||0x0,'package_content':_0xb9f81e,'readme_content':readFile(_0x25831d['readmePath'])};try{logInfo('正在解析组件配置信息...'),_0x1ca2bd[_0x512f21(0x136)]=parseComponentConfig(_0xb9f81e),logSuccess(_0x512f21(0x164));}catch(_0x5509b6){logError(_0x5509b6['message']),process['exit'](0x1);}logInfo(_0x512f21(0x17c));const _0x5620b2=readFile(_0x25831d['thumbnailPath'],_0x512f21(0x197));_0x1ca2bd[_0x512f21(0x126)]=Buffer[_0x512f21(0x151)](_0x5620b2,_0x512f21(0x197))[_0x512f21(0x176)]('base64'),logSuccess(_0x512f21(0x193)),logWarning(_0x512f21(0x178)),logWarning(_0x512f21(0x143)),logWarning(_0x512f21(0x14c)),logWarning(_0x512f21(0x156)),logWarning(_0x512f21(0x179)),logWarning(_0x512f21(0x180)),logWarning('\x20\x205.\x20发布成功后请立即通知相关人员进行测试和验证'),await new Promise(_0x120f67=>{let _0xf2ebda=0xa;const _0x58382a=setInterval(()=>{const _0x540c61=a6_0x48fa;process[_0x540c61(0x15d)][_0x540c61(0x173)](_0x540c61(0x15b)+_0xf2ebda+_0x540c61(0x169)),_0xf2ebda--,_0xf2ebda<0x0&&(clearInterval(_0x58382a),process[_0x540c61(0x15d)][_0x540c61(0x173)]('\x0d\x0a'),_0x120f67());},0x3e8);});const {confirmed:_0x4b91e7}=await inquirer[_0x512f21(0x18a)]([{'type':_0x512f21(0x160),'name':_0x512f21(0x132),'message':_0x512f21(0x14d),'default':![]}]);!_0x4b91e7&&(logInfo('发布操作已取消'),process[_0x512f21(0x153)](0x0));const {message:_0x3b8f7f}=await inquirer[_0x512f21(0x18a)]([{'type':_0x512f21(0x12f),'name':_0x512f21(0x138),'message':_0x512f21(0x199),'default':_0x512f21(0x12a)}]);logInfo(_0x512f21(0x18f)),submitFun(_0x3b8f7f||_0x512f21(0x12a),_0x1ca2bd);}else logError('授权失败:\x20'+(_0x504f2b[_0x512f21(0x146)]['message']||_0x512f21(0x184))),process[_0x512f21(0x153)](0x1);})[_0x241a6b(0x16a)](_0x2b9352=>{const _0x5b8f54=_0x241a6b;if(_0x2b9352&&_0x2b9352[_0x5b8f54(0x14f)]){const _0x22225e=_0x2b9352['response']['status'];if(_0x22225e===0x191||_0x22225e===0x193)logError('授权失败\x20('+_0x22225e+'):\x20认证信息无效或无权限');else{const _0xa9b131=_0x2b9352[_0x5b8f54(0x14f)]['data']&&(_0x2b9352['response'][_0x5b8f54(0x146)][_0x5b8f54(0x138)]||_0x2b9352[_0x5b8f54(0x14f)]['data'][_0x5b8f54(0x17b)])||'';logError('请求失败\x20('+_0x22225e+_0x5b8f54(0x131)+(_0xa9b131||_0x2b9352[_0x5b8f54(0x138)]));}}else _0x2b9352&&_0x2b9352[_0x5b8f54(0x12b)]?logError(_0x5b8f54(0x16d)):logError(_0x5b8f54(0x145)+(_0x2b9352?_0x2b9352[_0x5b8f54(0x138)]:'未知错误'));process[_0x5b8f54(0x153)](0x1);});};
|
|
1
|
+
const a5_0x88b0e1=a5_0x7e79;(function(_0x2e3007,_0x1a769e){const _0x17582a=a5_0x7e79,_0x265134=_0x2e3007();while(!![]){try{const _0x5c737f=parseInt(_0x17582a(0x1c8))/0x1*(-parseInt(_0x17582a(0x1c3))/0x2)+-parseInt(_0x17582a(0x160))/0x3+parseInt(_0x17582a(0x17a))/0x4+parseInt(_0x17582a(0x16e))/0x5*(-parseInt(_0x17582a(0x1e3))/0x6)+parseInt(_0x17582a(0x15f))/0x7+parseInt(_0x17582a(0x1d6))/0x8*(-parseInt(_0x17582a(0x161))/0x9)+-parseInt(_0x17582a(0x1e4))/0xa*(-parseInt(_0x17582a(0x1de))/0xb);if(_0x5c737f===_0x1a769e)break;else _0x265134['push'](_0x265134['shift']());}catch(_0x35ec59){_0x265134['push'](_0x265134['shift']());}}}(a5_0x2cef,0xd9f62));function a5_0x7e79(_0x17d69d,_0x435456){_0x17d69d=_0x17d69d-0x15d;const _0x2cef2e=a5_0x2cef();let _0x7e79de=_0x2cef2e[_0x17d69d];return _0x7e79de;}const path=require('path'),os=require('os'),child_process=require(a5_0x88b0e1(0x165)),axios=require('axios'),inquirer=require(a5_0x88b0e1(0x1a7)),{getApiHost}=require(a5_0x88b0e1(0x164)),{CONSTANTS,logInfo,logSuccess,logWarning,logError,executeCommand,fileExists,readFile,writeFile}=require('./utils'),{loadAuth}=require(a5_0x88b0e1(0x166));function getGitInfo(){const _0x2b8cfb=a5_0x88b0e1;let _0x8ffae8=_0x2b8cfb(0x18b),_0x2204e1='unknown';try{_0x8ffae8=child_process[_0x2b8cfb(0x171)](_0x2b8cfb(0x17e),{'cwd':process[_0x2b8cfb(0x179)](),'stdio':_0x2b8cfb(0x1da)})[_0x2b8cfb(0x18d)]()['trim']();}catch(_0x3e17b7){}try{_0x2204e1=child_process['execSync'](_0x2b8cfb(0x15d),{'cwd':process['cwd'](),'stdio':'pipe'})[_0x2b8cfb(0x18d)]()[_0x2b8cfb(0x1d4)]();}catch(_0x24eba6){}return{'branch':_0x8ffae8,'gitUser':_0x2204e1};}function generateMetadataComment(_0x36a9cc){const _0x25801d=a5_0x88b0e1,{branch:_0x5a9093,gitUser:_0x129a6b,hostname:_0xef009f,platform:_0x131f37,publishTime:_0x18b382,version:_0x417d13,cmdVersion:_0x9fe871}=_0x36a9cc;return _0x25801d(0x18e)+_0x5a9093+_0x25801d(0x1ac)+_0xef009f+'\x20('+_0x131f37+_0x25801d(0x194)+_0x18b382+_0x25801d(0x17c)+_0x129a6b+_0x25801d(0x162)+_0x417d13+_0x25801d(0x190)+_0x9fe871+_0x25801d(0x1d3);}function parseComponentConfig(_0x4e89d3){const _0x4cfe19=a5_0x88b0e1,_0x40028a=_0x4e89d3['match'](/(window\[).+?(\.componentKey|.+]={)/img);if(!_0x40028a||!_0x40028a[_0x4cfe19(0x1bc)])throw new Error(_0x4cfe19(0x17b));const _0x18da07={},_0x1281c7=_0x4e89d3['match'](/componentKey.+([{,]info:\s{0,}{)/img);if(!_0x1281c7||!_0x1281c7[_0x4cfe19(0x1bc)])throw new Error(_0x4cfe19(0x1a8));let _0x2e7b70='{';const _0xbdb9e6=_0x4e89d3['split'](_0x1281c7[0x0])[0x1];for(let _0x4d896e=0x0;_0x4d896e<_0xbdb9e6[_0x4cfe19(0x1bc)];_0x4d896e++){_0x2e7b70+=_0xbdb9e6[_0x4d896e];if(_0xbdb9e6[_0x4d896e]==='}'){try{const _0x41f3f9=new Function('return\x20'+_0x2e7b70)();Object[_0x4cfe19(0x1d7)](_0x18da07,_0x41f3f9),_0x18da07[_0x4cfe19(0x1d8)]={};}catch(_0x3bf603){}break;}}const _0x535c2e=_0x4e89d3[_0x4cfe19(0x174)](/componentKey.+([{,]settings:\s{0,}{)/img);if(!_0x535c2e||!_0x535c2e[_0x4cfe19(0x1bc)])throw new Error(_0x4cfe19(0x19d));let _0x2b254c='{';const _0x5ce1df=_0x4e89d3[_0x4cfe19(0x1c5)](_0x535c2e[0x0])[0x1];for(let _0x98c964=0x0;_0x98c964<_0x5ce1df['length'];_0x98c964++){_0x2b254c+=_0x5ce1df[_0x98c964];if(_0x5ce1df[_0x98c964]==='}'){try{_0x18da07[_0x4cfe19(0x1d8)]=new Function(_0x4cfe19(0x180)+_0x2b254c)();}catch(_0x15bae6){}break;}}return JSON['stringify'](_0x18da07);}function getNodeEnv(_0x1f87f8){const _0x4a1e77=a5_0x88b0e1;if(_0x1f87f8===_0x4a1e77(0x19a))return _0x4a1e77(0x19a);if(_0x1f87f8===_0x4a1e77(0x1c2))return'development';return _0x4a1e77(0x1cb);}function a5_0x2cef(){const _0x402070=['\x20\x20-\x20危险操作确认倒计时','readmePath','114PulThx','2681790ZzNJJs','未提供版本号,用法:\x20jjb-cmd\x20publish\x20<version>(如\x20jjb-cmd\x20publish\x201.0.0)','git\x20config\x20user.name','../.auth','2065945rhPxFp','1471725JuVPJD','8657757qGbAuf','\x20|\x20publish-version:\x20','NODE_ENV\x20设置为:\x20','./config','child_process','./crypto-utils','npm\x20run\x20build:','post','valid','confirm','thumbnail.png','exports','正在读取包信息...','469835YepDxi','\x20\x204.\x20已了解发布后的影响范围','response','execSync','追溯信息注入完成','latest','match','缩略图处理完成','版本号不能以\x20v\x20开头(后台会自动补\x20v\x20前缀,输入\x20v1.0.0\x20会生成\x20vv1.0.0\x20目录),请去掉\x20v\x20后重试,例如:\x20','thumbnail_base64','警告:您即将进行组件发布操作,此操作不可逆,请谨慎操作','cwd','6616164aHXgMj','请在组件入口文件中添加\x22window[props.componentKey]\x22以暴露组件的配置信息!','\x20|\x20git-user:\x20','package.json','git\x20rev-parse\x20--abbrev-ref\x20HEAD','/api/file/publish','return\x20','\x20\x205.\x20发布成功后请立即通知相关人员进行测试和验证','force','项目构建完成','\x20\x202.\x20已检查构建产物完整性','message','请在组件根目录为组件添加一个缩略图\x22thumbnail.png\x22文件!','includes','0.0.0','binary','授权失败:\x20','unknown','dist','toString','/**\x20git-branch:\x20','正在处理缩略图...','\x20|\x20cmd-version:\x20','hostname','thumbnailPath','branch',')\x20|\x20publish-time:\x20','组件发布失败!根目录缺少\x27dist/index.js\x27文件!','已启用\x20--force,跳过以下二次确认:','组件发布成功','then','data','test','password','认证信息加载成功','暴露的配置信息中缺少\x22settings\x22!','请输入此次组件发布的信息:','\x20秒...\x20\x20','index.js','confirmed','yarn.lock','组件发布失败!根目录缺少\x27package.json\x27文件!','no\x20message','write','toISOString','inquirer','暴露的配置信息中缺少\x22info\x22!','request','未知错误','replace','\x20|\x20device:\x20','正在提交发布请求...','网络连接失败:\x20无法连接到服务器','\x20\x20-\x20发布信息输入(使用默认值\x20\x22no\x20message\x22)','服务器授权成功','input','gitUser','\x20\x203.\x20已确认版本号和发布信息正确','正在执行项目构建...','exit','操作失败:\x20','resolve','catch','parse','项目构建失败:\x20','prompt','length','\x20\x201.\x20已充分测试组件各项功能','文件验证通过','status','):\x20认证信息无效或无权限','未检测到认证信息,请先执行登录操作:\x20jjb-cmd\x20login','dev','449426kHfSqM','请在组件根目录添加一个README.md说明文件!','split','请求失败\x20(','授权失败\x20(','7qtIzOL','README.md','distPath','production','msg','发布失败:\x20','发布操作已取消','正在解析组件配置信息...','../package.json','/api/auth','发布错误可能导致线上应用产生严重生产故障,请务必确保:','\x20**/\x0a','trim','stdout','8SNfWaO','assign','defaultSetting','base64','pipe','platform','join','正在验证发布所需文件...','154XlpyIH','from','component_config_content'];a5_0x2cef=function(){return _0x402070;};return a5_0x2cef();}function validateVersion(_0x31183e){const _0x178156=a5_0x88b0e1;if(!_0x31183e||typeof _0x31183e!=='string')return{'valid':![],'message':_0x178156(0x1e5)};const _0x3b1fc8=_0x31183e[_0x178156(0x1d4)]();if([_0x178156(0x1c2),_0x178156(0x19a),_0x178156(0x173)][_0x178156(0x187)](_0x3b1fc8))return{'valid':!![],'version':_0x3b1fc8};if(/^\d+(\.\d+){0,4}$/['test'](_0x3b1fc8))return{'valid':!![],'version':_0x3b1fc8};if(/^v\d/[_0x178156(0x19a)](_0x3b1fc8))return{'valid':![],'message':_0x178156(0x176)+_0x3b1fc8[_0x178156(0x1ab)](/^v/,'')};return{'valid':![],'message':'版本号格式不正确:\x20\x22'+_0x3b1fc8+'\x22,只允许\x20dev、test、latest\x20或数字版本(最多\x205\x20位,如\x201.0.0.0)'};}function executeBuild(_0x126fb6,_0x4b937e){const _0x1eb313=a5_0x88b0e1,_0x3071ef=getNodeEnv(_0x4b937e);process.env.NODE_ENV=_0x3071ef,logInfo(_0x1eb313(0x163)+_0x3071ef);const _0x37a0fc=path[_0x1eb313(0x1dc)](_0x126fb6,_0x1eb313(0x1a2));fileExists(_0x37a0fc)?executeCommand('yarn\x20build:'+_0x3071ef,_0x126fb6):executeCommand(_0x1eb313(0x167)+_0x3071ef,_0x126fb6);}function validateRequiredFiles(_0x180ed0){const _0x1e821f=a5_0x88b0e1,_0x30ac19=path[_0x1e821f(0x1dc)](_0x180ed0,_0x1e821f(0x1c9)),_0x41503f=path[_0x1e821f(0x1dc)](_0x180ed0,_0x1e821f(0x18c),_0x1e821f(0x1a0)),_0x14f84b=path[_0x1e821f(0x1dc)](_0x180ed0,_0x1e821f(0x17d)),_0x2f4f4c=path[_0x1e821f(0x1dc)](_0x180ed0,_0x1e821f(0x16b));if(!fileExists(_0x14f84b))throw new Error(_0x1e821f(0x1a3));if(!fileExists(_0x41503f))throw new Error(_0x1e821f(0x195));if(!fileExists(_0x30ac19))throw new Error(_0x1e821f(0x1c4));if(!fileExists(_0x2f4f4c))throw new Error(_0x1e821f(0x186));return{'readmePath':_0x30ac19,'distPath':_0x41503f,'packageJsonPath':_0x14f84b,'thumbnailPath':_0x2f4f4c};}const submitFun=function(_0x26401b,_0x2da561){const _0x5e06f0=a5_0x88b0e1;_0x2da561['message']=_0x26401b||'no\x20message',axios[_0x5e06f0(0x168)](getApiHost()+_0x5e06f0(0x17f),_0x2da561)[_0x5e06f0(0x198)](_0x53b992=>{const _0x43f180=_0x5e06f0;logSuccess(_0x53b992[_0x43f180(0x199)][_0x43f180(0x185)]||_0x43f180(0x197)),process[_0x43f180(0x1b5)](0x0);})[_0x5e06f0(0x1b8)](_0x2a1e3f=>{const _0x364de8=_0x5e06f0;if(_0x2a1e3f&&_0x2a1e3f[_0x364de8(0x170)]){const _0x2441f4=_0x2a1e3f[_0x364de8(0x170)][_0x364de8(0x1bf)],_0x12dfb7=_0x2a1e3f[_0x364de8(0x170)][_0x364de8(0x199)]&&(_0x2a1e3f[_0x364de8(0x170)][_0x364de8(0x199)][_0x364de8(0x185)]||_0x2a1e3f[_0x364de8(0x170)][_0x364de8(0x199)]['msg'])||'';logError('发布失败\x20('+_0x2441f4+'):\x20'+(_0x12dfb7||_0x2a1e3f[_0x364de8(0x185)]));}else _0x2a1e3f&&_0x2a1e3f[_0x364de8(0x1a9)]?logError(_0x364de8(0x1ae)):logError(_0x364de8(0x1cd)+(_0x2a1e3f['message']||_0x364de8(0x1aa)));process['exit'](0x1);});};module[a5_0x88b0e1(0x16c)]=(_0x351a00,_0x40885c={})=>{const _0x23df43=a5_0x88b0e1,_0x39c827=validateVersion(_0x351a00);!_0x39c827[_0x23df43(0x169)]&&(logError(_0x39c827[_0x23df43(0x185)]),process[_0x23df43(0x1b5)](0x1));_0x351a00=_0x39c827['version'];const _0xf31142=!!(_0x40885c&&_0x40885c[_0x23df43(0x182)]),_0x1b5366=path['join'](__dirname,_0x23df43(0x15e));!fileExists(_0x1b5366)&&(logError(_0x23df43(0x1c1)),process['exit'](0x1));let _0x2783dc,_0x3b3247;try{logInfo('正在加载认证信息...');const _0xda796c=loadAuth(_0x1b5366);_0x2783dc=_0xda796c['username'],_0x3b3247=_0xda796c[_0x23df43(0x19b)],logSuccess(_0x23df43(0x19c));}catch(_0x2addd5){logError('读取认证信息失败:\x20'+_0x2addd5[_0x23df43(0x185)]),process[_0x23df43(0x1b5)](0x1);}logInfo('正在请求服务器授权...'),axios[_0x23df43(0x168)](getApiHost()+_0x23df43(0x1d1),{'username':_0x2783dc,'password':_0x3b3247})[_0x23df43(0x198)](async _0x22368b=>{const _0x3fc86c=_0x23df43;if(_0x22368b[_0x3fc86c(0x199)][_0x3fc86c(0x1bf)]){logSuccess(_0x3fc86c(0x1b0));const _0x2fd334=path[_0x3fc86c(0x1b7)]('./');logInfo(_0x3fc86c(0x1b4));try{executeBuild(_0x2fd334,_0x351a00),logSuccess(_0x3fc86c(0x183));}catch(_0x2cbfc3){logError(_0x3fc86c(0x1ba)+_0x2cbfc3[_0x3fc86c(0x185)]),process[_0x3fc86c(0x1b5)](0x1);}logInfo(_0x3fc86c(0x1dd));let _0x1c23d8;try{_0x1c23d8=validateRequiredFiles(_0x2fd334),logSuccess(_0x3fc86c(0x1be));}catch(_0x42e038){logError(_0x42e038[_0x3fc86c(0x185)]),process[_0x3fc86c(0x1b5)](0x1);}logInfo(_0x3fc86c(0x16d));const _0x3529f8=JSON[_0x3fc86c(0x1b9)](readFile(path[_0x3fc86c(0x1dc)](__dirname,_0x3fc86c(0x1d0)))),{version:_0xaa2966}=_0x3529f8;logInfo('正在注入组件追溯信息...');const _0x5e4063=getGitInfo(),_0x162e6d=new Date()[_0x3fc86c(0x1a6)](),_0xe61f1a=readFile(_0x1c23d8[_0x3fc86c(0x1ca)]),_0x1a94bf=generateMetadataComment({'branch':_0x5e4063[_0x3fc86c(0x193)],'gitUser':_0x5e4063[_0x3fc86c(0x1b2)],'hostname':os[_0x3fc86c(0x191)](),'platform':os[_0x3fc86c(0x1db)](),'publishTime':_0x162e6d,'version':_0x351a00||_0x3fc86c(0x188),'cmdVersion':_0xaa2966})+_0xe61f1a;logSuccess(_0x3fc86c(0x172)),logInfo('正在准备发布数据...');const _0x19146c={'username':_0x2783dc,'cmd_version':_0xaa2966,'hostname':os[_0x3fc86c(0x191)](),'platform':os[_0x3fc86c(0x1db)](),'package_version':_0x351a00||0x0,'package_content':_0x1a94bf,'readme_content':readFile(_0x1c23d8[_0x3fc86c(0x1e2)])};try{logInfo(_0x3fc86c(0x1cf)),_0x19146c[_0x3fc86c(0x1e0)]=parseComponentConfig(_0x1a94bf),logSuccess('组件配置解析完成');}catch(_0x3204c2){logError(_0x3204c2[_0x3fc86c(0x185)]),process[_0x3fc86c(0x1b5)](0x1);}logInfo(_0x3fc86c(0x18f));const _0x1b46ef=readFile(_0x1c23d8[_0x3fc86c(0x192)],_0x3fc86c(0x189));_0x19146c[_0x3fc86c(0x177)]=Buffer[_0x3fc86c(0x1df)](_0x1b46ef,_0x3fc86c(0x189))[_0x3fc86c(0x18d)](_0x3fc86c(0x1d9)),logSuccess(_0x3fc86c(0x175)),logWarning(_0x3fc86c(0x178)),logWarning(_0x3fc86c(0x1d2)),logWarning(_0x3fc86c(0x1bd)),logWarning(_0x3fc86c(0x184)),logWarning(_0x3fc86c(0x1b3)),logWarning(_0x3fc86c(0x16f)),logWarning(_0x3fc86c(0x181));let _0x7c2050=_0x3fc86c(0x1a4);if(!_0xf31142){await new Promise(_0x2e2cc8=>{let _0x46392e=0xa;const _0xba9d1d=setInterval(()=>{const _0x26f7be=a5_0x7e79;process[_0x26f7be(0x1d5)][_0x26f7be(0x1a5)]('\x0d倒计时\x20'+_0x46392e+_0x26f7be(0x19f)),_0x46392e--,_0x46392e<0x0&&(clearInterval(_0xba9d1d),process[_0x26f7be(0x1d5)][_0x26f7be(0x1a5)]('\x0d\x0a'),_0x2e2cc8());},0x3e8);});const {confirmed:_0x55224b}=await inquirer['prompt']([{'type':_0x3fc86c(0x16a),'name':_0x3fc86c(0x1a1),'message':'我已充分了解以上可能存在的严重风险,确认继续发布操作?','default':![]}]);!_0x55224b&&(logInfo(_0x3fc86c(0x1ce)),process[_0x3fc86c(0x1b5)](0x0));const {message:_0x51fd77}=await inquirer[_0x3fc86c(0x1bb)]([{'type':_0x3fc86c(0x1b1),'name':_0x3fc86c(0x185),'message':_0x3fc86c(0x19e),'default':'no\x20message'}]);_0x7c2050=_0x51fd77||_0x3fc86c(0x1a4);}else logWarning(_0x3fc86c(0x196)),logWarning(_0x3fc86c(0x1e1)),logWarning('\x20\x20-\x20风险确认提问'),logWarning(_0x3fc86c(0x1af));logInfo(_0x3fc86c(0x1ad)),submitFun(_0x7c2050,_0x19146c);}else logError(_0x3fc86c(0x18a)+(_0x22368b[_0x3fc86c(0x199)][_0x3fc86c(0x185)]||_0x3fc86c(0x1aa))),process[_0x3fc86c(0x1b5)](0x1);})[_0x23df43(0x1b8)](_0x979e58=>{const _0x990f57=_0x23df43;if(_0x979e58&&_0x979e58[_0x990f57(0x170)]){const _0x511a50=_0x979e58[_0x990f57(0x170)][_0x990f57(0x1bf)];if(_0x511a50===0x191||_0x511a50===0x193)logError(_0x990f57(0x1c7)+_0x511a50+_0x990f57(0x1c0));else{const _0xbefaef=_0x979e58[_0x990f57(0x170)][_0x990f57(0x199)]&&(_0x979e58[_0x990f57(0x170)][_0x990f57(0x199)]['message']||_0x979e58['response'][_0x990f57(0x199)][_0x990f57(0x1cc)])||'';logError(_0x990f57(0x1c6)+_0x511a50+'):\x20'+(_0xbefaef||_0x979e58[_0x990f57(0x185)]));}}else _0x979e58&&_0x979e58['request']?logError('网络连接失败:\x20无法连接到服务器或服务器无响应'):logError(_0x990f57(0x1b6)+(_0x979e58?_0x979e58[_0x990f57(0x185)]:'未知错误'));process[_0x990f57(0x1b5)](0x1);});};
|
package/src/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a7_0x10b04b=a7_0x3525;(function(_0x3369e8,_0x233974){const _0x34bb2f=a7_0x3525,_0x4e3d29=_0x3369e8();while(!![]){try{const _0x44b420=-parseInt(_0x34bb2f(0x157))/0x1+parseInt(_0x34bb2f(0x120))/0x2*(parseInt(_0x34bb2f(0x140))/0x3)+-parseInt(_0x34bb2f(0x12e))/0x4*(parseInt(_0x34bb2f(0xf5))/0x5)+parseInt(_0x34bb2f(0x113))/0x6*(parseInt(_0x34bb2f(0x148))/0x7)+-parseInt(_0x34bb2f(0x11e))/0x8+parseInt(_0x34bb2f(0x159))/0x9*(-parseInt(_0x34bb2f(0xed))/0xa)+parseInt(_0x34bb2f(0x152))/0xb;if(_0x44b420===_0x233974)break;else _0x4e3d29['push'](_0x4e3d29['shift']());}catch(_0x52f298){_0x4e3d29['push'](_0x4e3d29['shift']());}}}(a7_0x4d38,0x7cf8a));function a7_0x4d38(){const _0x1af951=['4hbGHzI','response','请求失败\x20(','代码提交成功','username','未找到\x20jjb.config.json\x20文件','map','配置文件中缺少必要字段:\x20','BUILD_OUTPUT_DIR','正在克隆\x20Git\x20仓库...','Git\x20仓库克隆完成','scripts','代码提交跳过:\x20没有需要提交的变更','yarn','404gAeyeT','javaGit','已选择环境:\x20','已生成\x20index.html\x20文件','.html\x20文件','node_modules','trim','正在复制构建产物到目标目录...','正在处理构建产物...','已选择打包命令:\x20','正在提交代码变更...','some','正在同步远程仓库...','解析\x20jjb.config.json\x20失败:\x20','javaGitName','git\x20add\x20.','正在推送代码到远程仓库...','index.html','1091319nWeVKc','appIdentifier','临时工作目录已清理:\x20','git\x20commit\x20-m\x20\x22','./utils','已生成\x20','prompt','uncaughtException','212485ccBkaW','package.json\x20读取成功','keys','list','分支切换完成','git\x20pull','未找到\x20environment\x20配置,将使用默认分支','git\x20checkout\x20','项目构建失败:\x20','正在添加文件变更...','18034027PGxfiz','操作失败:\x20','正在执行构建命令:\x20','读取认证信息失败:\x20','then','336828tSkAsP','index','811494LrDSWI','jjb.config.json\x20读取成功','length','axios','now','认证信息加载成功','toString','npm\x20run\x20','检测到未安装项目依赖','environment\x20配置为空,将使用默认分支','构建产物复制完成','TEMPLATES_PATH','utf8','未知错误','tmpdir','object','yarn\x20run\x20','未检测到认证信息,请先执行登录操作','110bnHjGx','git\x20push','readFileSync','force','path','npm','未找到\x20package.json\x20文件','请选择要执行的打包命令:','20185zDNgJn','yarn.lock','临时工作目录已创建','正在加载认证信息...','npm\x20install','授权失败\x20(','git\x20clone\x20','正在清理临时工作目录...','授权失败:\x20','default','项目依赖检查通过','正在准备临时工作目录...','正在请求服务器授权...','__esModule','exit','./crypto-utils','CONFIG_FILE_NAME','SYNC_DELAY','未找到打包相关的命令,请检查\x20package.json\x20中的\x20scripts\x20配置','input','inquirer','项目构建完成','正在创建模板目录...','项目依赖安装完成','):\x20','environment','password','join','正在切换到目标分支:\x20','commitMessage','150koLzxw','package.json','includes','request','message','构建产物目录不存在,请检查构建输出配置','./config','javaGitBranch','exports','status','清理临时目录失败:\x20','7020840NycAWA','正在安装项目依赖\x20('];a7_0x4d38=function(){return _0x1af951;};return a7_0x4d38();}const os=require('os'),path=require(a7_0x10b04b(0xf1)),fs=require('fs'),inquirer=require(a7_0x10b04b(0x109)),{CopyFolder,DeleteDirAllFile}=require(a7_0x10b04b(0x144)),{GIT_TEMP_JAVA,getApiHost}=require(a7_0x10b04b(0x119)),axios=require(a7_0x10b04b(0x15c)),{CONSTANTS,logInfo,logSuccess,logWarning,logError,executeCommand,deleteFolderRecursive,fileExists,readFile,writeFile,createDir,isViteProject,validateConfig}=require(a7_0x10b04b(0x144)),{loadAuth}=require(a7_0x10b04b(0x104));function a7_0x3525(_0x3dcc4f,_0x4f78c7){_0x3dcc4f=_0x3dcc4f-0xe3;const _0x4d3816=a7_0x4d38();let _0x3525dc=_0x4d3816[_0x3dcc4f];return _0x3525dc;}module[a7_0x10b04b(0x11b)]=async arguments=>{const _0x277fdc=a7_0x10b04b;let _0x53173e=null;const _0x2972d7=path[_0x277fdc(0x110)](__dirname,'../.auth');!fileExists(_0x2972d7)&&(logError(_0x277fdc(0xec)),process[_0x277fdc(0x103)](0x1));let _0x249d64,_0xe6c596;try{logInfo(_0x277fdc(0xf8));const _0x2d71a4=loadAuth(_0x2972d7);_0x249d64=_0x2d71a4[_0x277fdc(0x124)],_0xe6c596=_0x2d71a4[_0x277fdc(0x10f)],logSuccess(_0x277fdc(0x15e));}catch(_0x30d6a3){logError(_0x277fdc(0x155)+_0x30d6a3[_0x277fdc(0x117)]),process[_0x277fdc(0x103)](0x1);}const _0x2fd323=arguments[0x1]?arguments[0x1]['split']('-'):[],_0x4a938a=path['resolve']('./'),_0x2d672a=path[_0x277fdc(0x110)](_0x4a938a,_0x277fdc(0x114)),_0x460dc1=path[_0x277fdc(0x110)](_0x4a938a,CONSTANTS[_0x277fdc(0x105)]),_0x55f19c=path['join'](_0x4a938a,CONSTANTS[_0x277fdc(0x128)]),_0x4d1c12=os['tmpdir'](),_0x59c33d=fileExists(path['join'](_0x4a938a,_0x277fdc(0xf6)))?_0x277fdc(0x12d):_0x277fdc(0xf2),_0x13ffa4=_0x59c33d==='yarn'?_0x277fdc(0x12d):_0x277fdc(0xf9),_0x4f7efa=_0x711e42=>_0x59c33d==='yarn'?_0x277fdc(0xeb)+_0x711e42:_0x277fdc(0x160)+_0x711e42;logInfo('正在检查项目配置文件...');!fileExists(_0x2d672a)&&(logError(_0x277fdc(0xf3)),process['exit'](0x1));let _0x5390d4;try{_0x5390d4=JSON['parse'](fs[_0x277fdc(0xef)](_0x2d672a,_0x277fdc(0xe7))),logSuccess(_0x277fdc(0x149));}catch(_0x1b30c9){logError('解析\x20package.json\x20失败:\x20'+_0x1b30c9[_0x277fdc(0x117)]),process[_0x277fdc(0x103)](0x1);}const _0x343c4e=_0x5390d4[_0x277fdc(0x12b)]||{},_0x4df598=['build'],_0x33d0f9=Object[_0x277fdc(0x14a)](_0x343c4e)['filter'](_0x1070ef=>{const _0x3e9eb5=_0x277fdc;return _0x4df598[_0x3e9eb5(0x139)](_0x201596=>_0x1070ef['toLowerCase']()['includes'](_0x201596));});_0x33d0f9[_0x277fdc(0x15b)]===0x0&&(logError(_0x277fdc(0x107)),process[_0x277fdc(0x103)](0x1));const {selectedScript:_0x23fc1f}=await inquirer[_0x277fdc(0x146)]([{'type':'list','name':'selectedScript','message':_0x277fdc(0xf4),'choices':_0x33d0f9[_0x277fdc(0x126)](_0x34cc7e=>({'name':_0x34cc7e+'\x20('+_0x343c4e[_0x34cc7e]+')','value':_0x34cc7e}))}]);logInfo(_0x277fdc(0x137)+_0x23fc1f),logInfo('正在检查项目配置文件...');!fileExists(_0x460dc1)&&(logError(_0x277fdc(0x125)),process[_0x277fdc(0x103)](0x1));let _0x582cf4;try{_0x582cf4=require(_0x460dc1),_0x582cf4=_0x582cf4[_0x277fdc(0x102)]?_0x582cf4[_0x277fdc(0xfe)]:_0x582cf4,logSuccess(_0x277fdc(0x15a));}catch(_0x253e29){logError(_0x277fdc(0x13b)+_0x253e29[_0x277fdc(0x117)]),process[_0x277fdc(0x103)](0x1);}const _0x87d45d=[_0x277fdc(0x12f),_0x277fdc(0x13c),_0x277fdc(0x141)],_0x1c5484=validateConfig(_0x582cf4,_0x87d45d);!_0x1c5484['isValid']&&(logError(_0x277fdc(0x127)+_0x1c5484['missingFields'][_0x277fdc(0x110)](',\x20')),process[_0x277fdc(0x103)](0x1));let _0x342687=null;if(_0x582cf4[_0x277fdc(0x10e)]&&typeof _0x582cf4[_0x277fdc(0x10e)]===_0x277fdc(0xea)){const _0x3e9b49=Object[_0x277fdc(0x14a)](_0x582cf4[_0x277fdc(0x10e)]);if(_0x3e9b49[_0x277fdc(0x15b)]>0x0){const {envType:_0x36d54b}=await inquirer['prompt']([{'type':_0x277fdc(0x14b),'name':'envType','message':'请选择环境:','choices':_0x3e9b49[_0x277fdc(0x126)](_0x237426=>({'name':_0x237426,'value':_0x237426}))}]);_0x342687=_0x36d54b,logInfo(_0x277fdc(0x130)+_0x342687);}else logWarning(_0x277fdc(0xe4));}else logWarning(_0x277fdc(0x14e));logInfo(_0x277fdc(0x101)),axios['post'](getApiHost()+'/api/auth',{'username':_0x249d64,'password':_0xe6c596})[_0x277fdc(0x156)](async _0x5383e3=>{const _0x29549d=_0x277fdc;if(_0x5383e3['data']['status']){logSuccess('服务器授权成功');const _0x381efc=GIT_TEMP_JAVA+'-'+Date[_0x29549d(0x15d)]()+'-'+Math['random']()[_0x29549d(0x15f)](0x24)['substr'](0x2,0x9);_0x53173e=_0x381efc;const _0x3578d3=path[_0x29549d(0x110)](_0x4d1c12,_0x381efc);logInfo(_0x29549d(0x100));fileExists(_0x3578d3)&&deleteFolderRecursive(_0x3578d3);createDir(_0x3578d3),logSuccess(_0x29549d(0xf7));const _0x35f882=path[_0x29549d(0x110)](_0x3578d3,_0x582cf4['javaGitName']);logInfo(_0x29549d(0x129)),fileExists(_0x35f882)?_0x2fd323[_0x29549d(0x115)](_0x29549d(0xf0))?(logInfo('检测到已存在的仓库,正在强制清理...'),DeleteDirAllFile(_0x35f882,()=>{const _0x316260=_0x29549d;executeCommand(_0x316260(0xfb)+_0x582cf4[_0x316260(0x12f)],_0x3578d3),logSuccess(_0x316260(0x12a));})):(executeCommand('git\x20clone\x20'+_0x582cf4[_0x29549d(0x12f)],_0x3578d3),logSuccess(_0x29549d(0x12a))):(executeCommand(_0x29549d(0xfb)+_0x582cf4['javaGit'],_0x3578d3),logSuccess(_0x29549d(0x12a))),_0x59c3ee(_0x3578d3,_0x582cf4,_0x381efc,_0x23fc1f,_0x342687);}else logError(_0x29549d(0xfd)+(_0x5383e3['data']['message']||_0x29549d(0xe8))),process['exit'](0x1);})['catch'](_0x4a0369=>{const _0x591b39=_0x277fdc;if(_0x4a0369&&_0x4a0369[_0x591b39(0x121)]){const _0x19400f=_0x4a0369[_0x591b39(0x121)][_0x591b39(0x11c)];_0x19400f===0x191||_0x19400f===0x193?logError(_0x591b39(0xfa)+_0x19400f+'):\x20认证信息无效或无权限'):logError(_0x591b39(0x122)+_0x19400f+_0x591b39(0x10d)+(_0x4a0369[_0x591b39(0x121)]['data']?.[_0x591b39(0x117)]||_0x4a0369[_0x591b39(0x117)]));}else _0x4a0369&&_0x4a0369[_0x591b39(0x116)]?logError('网络连接失败:\x20无法连接到服务器'):logError(_0x591b39(0x153)+(_0x4a0369[_0x591b39(0x117)]||_0x591b39(0xe8)));process[_0x591b39(0x103)](0x1);}),process['on'](_0x277fdc(0x103),()=>{const _0x365ccc=_0x277fdc;if(_0x53173e){const _0x37b180=path[_0x365ccc(0x110)](os[_0x365ccc(0xe9)](),_0x53173e);if(fileExists(_0x37b180))try{deleteFolderRecursive(_0x37b180);}catch(_0x5975c0){}}}),process['on'](_0x277fdc(0x147),_0x9300ae=>{const _0xa0265d=_0x277fdc;if(_0x53173e){const _0x22bd54=path['join'](os[_0xa0265d(0xe9)](),_0x53173e);if(fileExists(_0x22bd54))try{deleteFolderRecursive(_0x22bd54);}catch(_0x1fc74b){}}throw _0x9300ae;});function _0x59c3ee(_0x5ef4bf,_0xec6722,_0xe0e5d6,_0x12d018,_0xc5235d){const _0x35e15f=_0x277fdc,_0x580776=path[_0x35e15f(0x110)](_0x5ef4bf,_0xec6722['javaGitName']);logInfo('正在同步\x20Git\x20仓库最新代码...'),executeCommand(_0x35e15f(0x14d),_0x580776),logSuccess('代码同步完成');!fileExists(path[_0x35e15f(0x110)](_0x4a938a,_0x35e15f(0x133)))?(logWarning(_0x35e15f(0xe3)),logInfo(_0x35e15f(0x11f)+_0x59c33d+'),请稍候...'),executeCommand(_0x13ffa4,_0x4a938a),logSuccess(_0x35e15f(0x10c))):logInfo(_0x35e15f(0xff));try{logInfo(_0x35e15f(0x154)+_0x4f7efa(_0x12d018)),executeCommand(_0x4f7efa(_0x12d018),_0x4a938a,{'maxBuffer':CONSTANTS['MAX_BUFFER_SIZE']}),logSuccess(_0x35e15f(0x10a));}catch(_0x43e7bc){logError(_0x35e15f(0x150)+_0x43e7bc[_0x35e15f(0x117)]);const _0x2b31a3=path[_0x35e15f(0x110)](os[_0x35e15f(0xe9)](),_0xe0e5d6);if(fileExists(_0x2b31a3))try{deleteFolderRecursive(_0x2b31a3),logInfo(_0x35e15f(0x142)+_0xe0e5d6);}catch(_0x4c9980){logWarning(_0x35e15f(0x11d)+_0x4c9980['message']);}process[_0x35e15f(0x103)](0x1);}if(fileExists(_0x55f19c)){logInfo(_0x35e15f(0x136));const _0x133a0a=_0xec6722[_0x35e15f(0x141)],_0x1695cd=readFile(path[_0x35e15f(0x110)](_0x55f19c,_0x35e15f(0x13f)));_0x2fd323['includes'](_0x35e15f(0x158))?(writeFile(path['join'](_0x55f19c,_0x35e15f(0x13f)),_0x1695cd),logInfo(_0x35e15f(0x131))):(writeFile(path[_0x35e15f(0x110)](_0x55f19c,_0x133a0a+'.html'),_0x1695cd),logInfo(_0x35e15f(0x145)+_0x133a0a+_0x35e15f(0x132)));const _0x31fd30=path[_0x35e15f(0x110)](_0x580776,CONSTANTS[_0x35e15f(0xe6)]);logInfo(_0x35e15f(0x10b)),createDir(_0x31fd30);const _0xb0ca0a=_0xc5235d&&_0xec6722['environment']&&_0xec6722['environment'][_0xc5235d]&&_0xec6722[_0x35e15f(0x10e)][_0xc5235d][_0x35e15f(0x11a)]?_0xec6722['environment'][_0xc5235d][_0x35e15f(0x11a)]:CONSTANTS['DEFAULT_BRANCH'];logInfo(_0x35e15f(0x111)+_0xb0ca0a),executeCommand(_0x35e15f(0x14f)+_0xb0ca0a,_0x580776),logSuccess(_0x35e15f(0x14c));const _0x2768e6=path['join'](_0x31fd30,_0xec6722[_0x35e15f(0x141)]);logInfo('正在清理目标目录...'),DeleteDirAllFile(_0x2768e6,()=>{const _0x284d2c=_0x35e15f;createDir(_0x2768e6),logInfo(_0x284d2c(0x135)),writeFile(path[_0x284d2c(0x110)](_0x31fd30,_0x133a0a+'.html'),_0x1695cd),CopyFolder(path[_0x284d2c(0x110)](_0x55f19c,_0xec6722['appIdentifier']),_0x2768e6,async()=>{const _0x2a6185=_0x284d2c;logSuccess(_0x2a6185(0xe5)),setTimeout(async()=>{const _0x235e4d=_0x2a6185;logInfo(_0x235e4d(0x13a)),executeCommand(_0x235e4d(0x14d),_0x580776),logInfo(_0x235e4d(0x151)),executeCommand(_0x235e4d(0x13d),_0x580776);const {commitMessage:_0x2e2988}=await inquirer['prompt']([{'type':_0x235e4d(0x108),'name':_0x235e4d(0x112),'message':'请输入提交信息:','default':'no\x20message'}]),_0x34a36d=_0x2e2988[_0x235e4d(0x134)]()||'no\x20message';try{logInfo(_0x235e4d(0x138)),executeCommand(_0x235e4d(0x143)+_0x34a36d+'\x22\x20--no-verify',_0x580776),logSuccess(_0x235e4d(0x123));}catch(_0xea4fb5){logWarning(_0x235e4d(0x12c));}logInfo(_0x235e4d(0x13e)),executeCommand(_0x235e4d(0xee),_0x580776),logSuccess('代码推送完成'),setTimeout(()=>{const _0x1d9b94=_0x235e4d;logInfo(_0x1d9b94(0xfc));const _0x4865d6=path[_0x1d9b94(0x110)](os[_0x1d9b94(0xe9)](),_0xe0e5d6);if(fileExists(_0x4865d6))try{deleteFolderRecursive(_0x4865d6),logSuccess(_0x1d9b94(0x142)+_0xe0e5d6);}catch(_0x60feb){logWarning('清理临时目录失败:\x20'+_0x60feb[_0x1d9b94(0x117)]);}},CONSTANTS['SYNC_DELAY']*0x2);},CONSTANTS[_0x2a6185(0x106)]);});});}else{logError(_0x35e15f(0x118));const _0x3f984e=path[_0x35e15f(0x110)](os[_0x35e15f(0xe9)](),_0xe0e5d6);if(fileExists(_0x3f984e))try{deleteFolderRecursive(_0x3f984e),logInfo(_0x35e15f(0x142)+_0xe0e5d6);}catch(_0x48346a){logWarning(_0x35e15f(0x11d)+_0x48346a[_0x35e15f(0x117)]);}process[_0x35e15f(0x103)](0x1);}}};
|
|
1
|
+
const a6_0x1e58ea=a6_0x245f;function a6_0x2c20(){const _0x5ebdd9=['missingFields','child_process','指定的后端分支不存在:\x20','MAX_BUFFER_SIZE','DEFAULT_BRANCH','3113350FiRfQx','exit','授权失败:\x20','正在提交代码变更...','toLowerCase','未知错误','no\x20message','):\x20','includes','请选择要执行的打包命令:','CONFIG_FILE_NAME','sort','jjb.config.json\x20读取成功','正在推送代码到远程仓库...','yarn.lock','master','test','12sRCooF','request','正在清理目标目录...','replace','now','force','正在同步\x20Git\x20仓库最新代码...','检测到已存在的仓库,正在强制清理...','构建产物目录不存在,请检查构建输出配置','2LNRhBV','BUILD_OUTPUT_DIR','解析\x20jjb.config.json\x20失败:\x20','some','8BzlXzV','confirmed','正在执行构建命令:\x20','yarn','push','javaGitName','username','utf8','substr','password','__esModule','临时工作目录已创建','目标分支\x20','join','正在切换到目标分支:\x20','/api/auth','授权失败\x20(','message','resolve','请输入提交信息:','npm\x20run\x20','项目构建失败:\x20','release','操作失败:\x20','SYNC_DELAY','查询远程分支失败:\x20','正在清理临时工作目录...','164541rzdBjV','map','代码同步完成','),请稍候...','git\x20add\x20.','项目构建完成','正在安装项目依赖\x20(','已选择打包命令:\x20','HEAD','.html','正在请求服务器授权...','confirm','临时工作目录已清理:\x20','build','704PKFyMn','catch','javaGit','yarn\x20run\x20','git\x20checkout\x20','targetBranch','split','分支名不能为空','2422914uvIAmT','isValid','list','\x20个远程分支','代码推送完成','29924719SqqruZ','解析\x20package.json\x20失败:\x20','未找到\x20jjb.config.json\x20文件','keys','无法查询远程分支(','7ubgRPc','):\x20认证信息无效或无权限','未检测到认证信息,请先执行登录操作:\x20jjb-cmd\x20login','prompt','正在查询后端仓库远程分支,校验目标分支...','可用的打包命令:\x20','正在处理构建产物...','正在加载认证信息...','response','非交互模式必须指定后端分支,用法:\x20jjb-cmd\x20push\x20java\x20--build\x20<打包命令>\x20--target\x20<后端分支>','正在同步远程仓库...','代码提交成功','已选择后端分支:\x20','random','length','项目依赖安装完成','git\x20pull','../.auth','main','\x20存在,校验通过','非交互模式必须指定打包命令,用法:\x20jjb-cmd\x20push\x20java\x20--build\x20<打包命令>\x20--target\x20<后端分支>','5769340dqUaaH','使用指定的提交信息:\x20','trim','status','filter','请求失败\x20(','post','TEMPLATES_PATH','已取消选择,请重新选择后端分支','selectedScript','./crypto-utils','网络连接失败:\x20无法连接到服务器','分支切换完成','package.json\x20读取成功','commitMessage','正在创建模板目录...',',确认推送到该分支吗?','\x22\x20--no-verify','tmpdir','branch','input','prod','localeCompare','data','清理临时目录失败:\x20','已生成\x20','代码提交跳过:\x20没有需要提交的变更','isArray','正在准备临时工作目录...','appIdentifier','未找到\x20package.json\x20文件','服务器授权成功','Git\x20仓库克隆完成','default','index.html','39663RTPRiB','526822cHnWOE','readFileSync','npm\x20install','git\x20clone\x20','您选择的后端分支是:\x20','scripts','正在复制构建产物到目标目录...','正在添加文件变更...','index','正在检查项目配置文件...','认证信息加载成功','未查询到远程分支,请手动输入分支名','./utils'];a6_0x2c20=function(){return _0x5ebdd9;};return a6_0x2c20();}(function(_0x459b81,_0x4fdb04){const _0x4870ea=a6_0x245f,_0x24fb90=_0x459b81();while(!![]){try{const _0x459945=parseInt(_0x4870ea(0x1cf))/0x1*(-parseInt(_0x4870ea(0x1a3))/0x2)+-parseInt(_0x4870ea(0x1ee))/0x3*(-parseInt(_0x4870ea(0x1d3))/0x4)+-parseInt(_0x4870ea(0x223))/0x5+parseInt(_0x4870ea(0x204))/0x6*(-parseInt(_0x4870ea(0x20e))/0x7)+-parseInt(_0x4870ea(0x1fc))/0x8*(parseInt(_0x4870ea(0x1a2))/0x9)+parseInt(_0x4870ea(0x1b5))/0xa+-parseInt(_0x4870ea(0x209))/0xb*(-parseInt(_0x4870ea(0x1c6))/0xc);if(_0x459945===_0x4fdb04)break;else _0x24fb90['push'](_0x24fb90['shift']());}catch(_0xa22c46){_0x24fb90['push'](_0x24fb90['shift']());}}}(a6_0x2c20,0xa35cd));function a6_0x245f(_0xaabe4e,_0x19462b){_0xaabe4e=_0xaabe4e-0x19f;const _0x2c20da=a6_0x2c20();let _0x245f9e=_0x2c20da[_0xaabe4e];return _0x245f9e;}const os=require('os'),path=require('path'),fs=require('fs'),child_process=require(a6_0x1e58ea(0x1b1)),inquirer=require('inquirer'),{CopyFolder,DeleteDirAllFile}=require(a6_0x1e58ea(0x1af)),{GIT_TEMP_JAVA,getApiHost}=require('./config'),axios=require('axios'),{CONSTANTS,logInfo,logSuccess,logWarning,logError,executeCommand,deleteFolderRecursive,fileExists,readFile,writeFile,createDir,isViteProject,validateConfig}=require(a6_0x1e58ea(0x1af)),{loadAuth}=require(a6_0x1e58ea(0x22d));function getRemoteBranches(_0x46f6d8){const _0x728f52=a6_0x1e58ea,_0x131efd=child_process['execSync']('git\x20ls-remote\x20--heads\x20'+_0x46f6d8,{'encoding':_0x728f52(0x1da)}),_0x1229ad=[_0x728f52(0x1c4),_0x728f52(0x220),'dev','develop',_0x728f52(0x1c5),_0x728f52(0x238),'production',_0x728f52(0x1e9)];return _0x131efd[_0x728f52(0x202)]('\x0a')[_0x728f52(0x1ef)](_0xfa6769=>{const _0x15f70f=_0x728f52,_0x30c92a=_0xfa6769[_0x15f70f(0x202)]('\x09')[0x1]||'';return _0x30c92a[_0x15f70f(0x1c9)](/^refs\/heads\//,'')[_0x15f70f(0x225)]();})['filter'](_0x26539a=>_0x26539a&&_0x26539a!==_0x728f52(0x1f6))[_0x728f52(0x1c0)]((_0x15fe17,_0x2fd454)=>{const _0x5536b9=_0x728f52,_0x3abb47=_0x1229ad['indexOf'](_0x15fe17),_0x321ef6=_0x1229ad['indexOf'](_0x2fd454);if(_0x3abb47!==-0x1&&_0x321ef6!==-0x1)return _0x3abb47-_0x321ef6;if(_0x3abb47!==-0x1)return-0x1;if(_0x321ef6!==-0x1)return 0x1;return _0x15fe17[_0x5536b9(0x239)](_0x2fd454);});}async function promptBranchInput(){const _0x391e82=a6_0x1e58ea,{branch:_0x40b408}=await inquirer[_0x391e82(0x211)]([{'type':_0x391e82(0x237),'name':_0x391e82(0x236),'message':'请输入要推送的后端分支名:','default':CONSTANTS[_0x391e82(0x1b4)],'validate':_0x42d3ca=>_0x42d3ca&&_0x42d3ca[_0x391e82(0x225)]()?!![]:_0x391e82(0x203)}]);return(_0x40b408||'')['trim']()||CONSTANTS[_0x391e82(0x1b4)];}module['exports']=async _0x3d89e7=>{const _0x5aec63=a6_0x1e58ea;(_0x3d89e7==null||Array[_0x5aec63(0x23e)](_0x3d89e7))&&(_0x3d89e7={});const _0x3c167e=_0x3d89e7['buildScript'],_0x582ec4=_0x3d89e7[_0x5aec63(0x201)],_0x57980c=_0x3d89e7[_0x5aec63(0x1e4)],_0x5b0d66=!!(_0x3c167e||_0x582ec4||_0x57980c);let _0x282631=null;const _0x141a8c=path[_0x5aec63(0x1e0)](__dirname,_0x5aec63(0x21f));!fileExists(_0x141a8c)&&(logError(_0x5aec63(0x210)),process[_0x5aec63(0x1b6)](0x1));let _0x1439e6,_0x2c31f7;try{logInfo(_0x5aec63(0x215));const _0x2334d6=loadAuth(_0x141a8c);_0x1439e6=_0x2334d6[_0x5aec63(0x1d9)],_0x2c31f7=_0x2334d6[_0x5aec63(0x1dc)],logSuccess(_0x5aec63(0x1ad));}catch(_0x14e3bb){logError('读取认证信息失败:\x20'+_0x14e3bb['message']),process[_0x5aec63(0x1b6)](0x1);}const _0x439b9f=[];if(_0x3d89e7[_0x5aec63(0x1cb)])_0x439b9f[_0x5aec63(0x1d7)](_0x5aec63(0x1cb));if(_0x3d89e7[_0x5aec63(0x1ab)])_0x439b9f['push'](_0x5aec63(0x1ab));const _0x58ccae=path[_0x5aec63(0x1e5)]('./'),_0x3781e4=path[_0x5aec63(0x1e0)](_0x58ccae,'package.json'),_0x496361=path[_0x5aec63(0x1e0)](_0x58ccae,CONSTANTS[_0x5aec63(0x1bf)]),_0x3cc892=path['join'](_0x58ccae,CONSTANTS[_0x5aec63(0x1d0)]),_0x1421e9=os[_0x5aec63(0x235)](),_0x14c029=fileExists(path[_0x5aec63(0x1e0)](_0x58ccae,_0x5aec63(0x1c3)))?_0x5aec63(0x1d6):'npm',_0x5d2618=_0x14c029===_0x5aec63(0x1d6)?_0x5aec63(0x1d6):_0x5aec63(0x1a5),_0x2d15c0=_0x4119bd=>_0x14c029===_0x5aec63(0x1d6)?_0x5aec63(0x1ff)+_0x4119bd:_0x5aec63(0x1e7)+_0x4119bd;logInfo(_0x5aec63(0x1ac));!fileExists(_0x3781e4)&&(logError(_0x5aec63(0x241)),process['exit'](0x1));let _0x4da918;try{_0x4da918=JSON['parse'](fs[_0x5aec63(0x1a4)](_0x3781e4,_0x5aec63(0x1da))),logSuccess(_0x5aec63(0x230));}catch(_0xa26060){logError(_0x5aec63(0x20a)+_0xa26060[_0x5aec63(0x1e4)]),process[_0x5aec63(0x1b6)](0x1);}const _0x31300d=_0x4da918[_0x5aec63(0x1a8)]||{},_0x194fb9=[_0x5aec63(0x1fb)],_0x7bf782=Object[_0x5aec63(0x20c)](_0x31300d)[_0x5aec63(0x227)](_0x4d8ce2=>{const _0x16288e=_0x5aec63;return _0x194fb9[_0x16288e(0x1d2)](_0x263c8b=>_0x4d8ce2[_0x16288e(0x1b9)]()[_0x16288e(0x1bd)](_0x263c8b));});_0x7bf782[_0x5aec63(0x21c)]===0x0&&(logError('未找到打包相关的命令,请检查\x20package.json\x20中的\x20scripts\x20配置'),process[_0x5aec63(0x1b6)](0x1));let _0x9e4c66;if(_0x3c167e)_0x31300d[_0x3c167e]?_0x9e4c66=_0x3c167e:(logError('指定的打包命令不存在:\x20'+_0x3c167e),logError(_0x5aec63(0x213)+_0x7bf782['join'](',\x20')),process[_0x5aec63(0x1b6)](0x1));else{if(_0x5b0d66)logError(_0x5aec63(0x222)),process[_0x5aec63(0x1b6)](0x1);else{const _0x3b38c1=await inquirer[_0x5aec63(0x211)]([{'type':_0x5aec63(0x206),'name':'selectedScript','message':_0x5aec63(0x1be),'choices':_0x7bf782[_0x5aec63(0x1ef)](_0x315828=>({'name':_0x315828+'\x20('+_0x31300d[_0x315828]+')','value':_0x315828}))}]);_0x9e4c66=_0x3b38c1[_0x5aec63(0x22c)];}}logInfo(_0x5aec63(0x1f5)+_0x9e4c66),logInfo(_0x5aec63(0x1ac));!fileExists(_0x496361)&&(logError(_0x5aec63(0x20b)),process['exit'](0x1));let _0x496d64;try{_0x496d64=require(_0x496361),_0x496d64=_0x496d64[_0x5aec63(0x1dd)]?_0x496d64[_0x5aec63(0x1a0)]:_0x496d64,logSuccess(_0x5aec63(0x1c1));}catch(_0x1ab400){logError(_0x5aec63(0x1d1)+_0x1ab400[_0x5aec63(0x1e4)]),process[_0x5aec63(0x1b6)](0x1);}const _0x25c3f0=[_0x5aec63(0x1fe),_0x5aec63(0x1d8),_0x5aec63(0x240)],_0xd775c2=validateConfig(_0x496d64,_0x25c3f0);!_0xd775c2[_0x5aec63(0x205)]&&(logError('配置文件中缺少必要字段:\x20'+_0xd775c2[_0x5aec63(0x1b0)][_0x5aec63(0x1e0)](',\x20')),process[_0x5aec63(0x1b6)](0x1));let _0x1ce3df=null;if(_0x582ec4){logInfo(_0x5aec63(0x212));try{const _0xeacda2=getRemoteBranches(_0x496d64[_0x5aec63(0x1fe)]);_0xeacda2[_0x5aec63(0x21c)]>0x0&&!_0xeacda2[_0x5aec63(0x1bd)](_0x582ec4)&&(logError(_0x5aec63(0x1b2)+_0x582ec4),logError('当前远程分支:\x20'+_0xeacda2['join'](',\x20')),process['exit'](0x1)),logSuccess(_0x5aec63(0x1df)+_0x582ec4+_0x5aec63(0x221));}catch(_0x311376){logWarning(_0x5aec63(0x20d)+_0x311376['message']+'),将直接尝试切换到\x20'+_0x582ec4);}_0x1ce3df=_0x582ec4;}else{if(_0x5b0d66)logError(_0x5aec63(0x217)),process['exit'](0x1);else{logWarning('⚠\x20请仔细核对所选后端分支,选错分支将导致发错版本,直接影响线上环境!');let _0x3ccd08=[];try{logInfo('正在查询后端仓库远程分支...'),_0x3ccd08=getRemoteBranches(_0x496d64['javaGit']),_0x3ccd08['length']>0x0?logSuccess('查询到\x20'+_0x3ccd08[_0x5aec63(0x21c)]+_0x5aec63(0x207)):logWarning(_0x5aec63(0x1ae));}catch(_0x32ab3f){logWarning(_0x5aec63(0x1ec)+_0x32ab3f['message']);}while(!_0x1ce3df){let _0x4d30e5;if(_0x3ccd08[_0x5aec63(0x21c)]>0x0){const {targetBranch:_0x137d80}=await inquirer[_0x5aec63(0x211)]([{'type':_0x5aec63(0x206),'name':'targetBranch','message':'请选择要推送的后端分支(务必核对,选错将发错版本):','pageSize':0xf,'choices':_0x3ccd08}]);_0x4d30e5=_0x137d80;}else _0x4d30e5=await promptBranchInput();const {confirmed:_0x571b61}=await inquirer[_0x5aec63(0x211)]([{'type':_0x5aec63(0x1f9),'name':_0x5aec63(0x1d4),'message':_0x5aec63(0x1a7)+_0x4d30e5+_0x5aec63(0x233),'default':![]}]);_0x571b61?_0x1ce3df=_0x4d30e5:logWarning(_0x5aec63(0x22b));}}}logInfo(_0x5aec63(0x21a)+_0x1ce3df),logInfo(_0x5aec63(0x1f8)),axios[_0x5aec63(0x229)](getApiHost()+_0x5aec63(0x1e2),{'username':_0x1439e6,'password':_0x2c31f7})['then'](async _0x1ad473=>{const _0x23698b=_0x5aec63;if(_0x1ad473['data'][_0x23698b(0x226)]){logSuccess(_0x23698b(0x242));const _0x33d3e1=GIT_TEMP_JAVA+'-'+Date[_0x23698b(0x1ca)]()+'-'+Math[_0x23698b(0x21b)]()['toString'](0x24)[_0x23698b(0x1db)](0x2,0x9);_0x282631=_0x33d3e1;const _0x5eb3bf=path[_0x23698b(0x1e0)](_0x1421e9,_0x33d3e1);logInfo(_0x23698b(0x23f));fileExists(_0x5eb3bf)&&deleteFolderRecursive(_0x5eb3bf);createDir(_0x5eb3bf),logSuccess(_0x23698b(0x1de));const _0x41159e=path[_0x23698b(0x1e0)](_0x5eb3bf,_0x496d64['javaGitName']);logInfo('正在克隆\x20Git\x20仓库...'),fileExists(_0x41159e)?_0x439b9f[_0x23698b(0x1bd)]('force')?(logInfo(_0x23698b(0x1cd)),DeleteDirAllFile(_0x41159e,()=>{const _0xb93a37=_0x23698b;executeCommand(_0xb93a37(0x1a6)+_0x496d64[_0xb93a37(0x1fe)],_0x5eb3bf),logSuccess(_0xb93a37(0x19f));})):(executeCommand(_0x23698b(0x1a6)+_0x496d64[_0x23698b(0x1fe)],_0x5eb3bf),logSuccess(_0x23698b(0x19f))):(executeCommand(_0x23698b(0x1a6)+_0x496d64[_0x23698b(0x1fe)],_0x5eb3bf),logSuccess('Git\x20仓库克隆完成')),_0x7131cb(_0x5eb3bf,_0x496d64,_0x33d3e1,_0x9e4c66,_0x1ce3df);}else logError(_0x23698b(0x1b7)+(_0x1ad473[_0x23698b(0x23a)]['message']||_0x23698b(0x1ba))),process['exit'](0x1);})[_0x5aec63(0x1fd)](_0x33fdb4=>{const _0x46d726=_0x5aec63;if(_0x33fdb4&&_0x33fdb4[_0x46d726(0x216)]){const _0x2cf2fe=_0x33fdb4[_0x46d726(0x216)][_0x46d726(0x226)];_0x2cf2fe===0x191||_0x2cf2fe===0x193?logError(_0x46d726(0x1e3)+_0x2cf2fe+_0x46d726(0x20f)):logError(_0x46d726(0x228)+_0x2cf2fe+_0x46d726(0x1bc)+(_0x33fdb4['response']['data']?.[_0x46d726(0x1e4)]||_0x33fdb4[_0x46d726(0x1e4)]));}else _0x33fdb4&&_0x33fdb4[_0x46d726(0x1c7)]?logError(_0x46d726(0x22e)):logError(_0x46d726(0x1ea)+(_0x33fdb4[_0x46d726(0x1e4)]||_0x46d726(0x1ba)));process['exit'](0x1);}),process['on'](_0x5aec63(0x1b6),()=>{const _0x3eb5a3=_0x5aec63;if(_0x282631){const _0x215196=path[_0x3eb5a3(0x1e0)](os[_0x3eb5a3(0x235)](),_0x282631);if(fileExists(_0x215196))try{deleteFolderRecursive(_0x215196);}catch(_0xf4bce8){}}}),process['on']('uncaughtException',_0x26c74b=>{const _0x32d09e=_0x5aec63;if(_0x282631){const _0x34e1f6=path['join'](os[_0x32d09e(0x235)](),_0x282631);if(fileExists(_0x34e1f6))try{deleteFolderRecursive(_0x34e1f6);}catch(_0x2bd17e){}}throw _0x26c74b;});function _0x7131cb(_0x1005d7,_0x50142c,_0x4e01f1,_0x534ec2,_0x1be73a){const _0x511170=_0x5aec63,_0x502b80=path[_0x511170(0x1e0)](_0x1005d7,_0x50142c[_0x511170(0x1d8)]);logInfo(_0x511170(0x1e1)+_0x1be73a),executeCommand(_0x511170(0x200)+_0x1be73a,_0x502b80),logSuccess(_0x511170(0x22f)),logInfo(_0x511170(0x1cc)),executeCommand(_0x511170(0x21e),_0x502b80),logSuccess(_0x511170(0x1f0));!fileExists(path[_0x511170(0x1e0)](_0x58ccae,'node_modules'))?(logWarning('检测到未安装项目依赖'),logInfo(_0x511170(0x1f4)+_0x14c029+_0x511170(0x1f1)),executeCommand(_0x5d2618,_0x58ccae),logSuccess(_0x511170(0x21d))):logInfo('项目依赖检查通过');try{logInfo(_0x511170(0x1d5)+_0x2d15c0(_0x534ec2)),executeCommand(_0x2d15c0(_0x534ec2),_0x58ccae,{'maxBuffer':CONSTANTS[_0x511170(0x1b3)]}),logSuccess(_0x511170(0x1f3));}catch(_0x25280d){logError(_0x511170(0x1e8)+_0x25280d[_0x511170(0x1e4)]);const _0x26d33f=path[_0x511170(0x1e0)](os[_0x511170(0x235)](),_0x4e01f1);if(fileExists(_0x26d33f))try{deleteFolderRecursive(_0x26d33f),logInfo(_0x511170(0x1fa)+_0x4e01f1);}catch(_0x11903d){logWarning(_0x511170(0x23b)+_0x11903d[_0x511170(0x1e4)]);}process['exit'](0x1);}if(fileExists(_0x3cc892)){logInfo(_0x511170(0x214));const _0xd9a686=_0x50142c[_0x511170(0x240)],_0x13330e=readFile(path['join'](_0x3cc892,_0x511170(0x1a1)));_0x439b9f[_0x511170(0x1bd)](_0x511170(0x1ab))?(writeFile(path[_0x511170(0x1e0)](_0x3cc892,'index.html'),_0x13330e),logInfo('已生成\x20index.html\x20文件')):(writeFile(path['join'](_0x3cc892,_0xd9a686+'.html'),_0x13330e),logInfo(_0x511170(0x23c)+_0xd9a686+'.html\x20文件'));const _0x34d7d8=path[_0x511170(0x1e0)](_0x502b80,CONSTANTS[_0x511170(0x22a)]);logInfo(_0x511170(0x232)),createDir(_0x34d7d8);const _0x429572=path[_0x511170(0x1e0)](_0x34d7d8,_0x50142c[_0x511170(0x240)]);logInfo(_0x511170(0x1c8)),DeleteDirAllFile(_0x429572,()=>{const _0x2df282=_0x511170;createDir(_0x429572),logInfo(_0x2df282(0x1a9)),writeFile(path[_0x2df282(0x1e0)](_0x34d7d8,_0xd9a686+_0x2df282(0x1f7)),_0x13330e),CopyFolder(path[_0x2df282(0x1e0)](_0x3cc892,_0x50142c[_0x2df282(0x240)]),_0x429572,async()=>{const _0x5dbde3=_0x2df282;logSuccess('构建产物复制完成'),setTimeout(async()=>{const _0x2b4d8f=a6_0x245f;logInfo(_0x2b4d8f(0x218)),executeCommand('git\x20pull',_0x502b80),logInfo(_0x2b4d8f(0x1aa)),executeCommand(_0x2b4d8f(0x1f2),_0x502b80);let _0x290160;if(_0x57980c&&_0x57980c[_0x2b4d8f(0x225)]())_0x290160=_0x57980c[_0x2b4d8f(0x225)](),logInfo(_0x2b4d8f(0x224)+_0x290160);else{if(_0x5b0d66)_0x290160=_0x2b4d8f(0x1bb);else{const {commitMessage:_0x146de8}=await inquirer[_0x2b4d8f(0x211)]([{'type':_0x2b4d8f(0x237),'name':_0x2b4d8f(0x231),'message':_0x2b4d8f(0x1e6),'default':_0x2b4d8f(0x1bb)}]);_0x290160=_0x146de8['trim']()||_0x2b4d8f(0x1bb);}}try{logInfo(_0x2b4d8f(0x1b8)),executeCommand('git\x20commit\x20-m\x20\x22'+_0x290160+_0x2b4d8f(0x234),_0x502b80),logSuccess(_0x2b4d8f(0x219));}catch(_0x557cce){logWarning(_0x2b4d8f(0x23d));}logInfo(_0x2b4d8f(0x1c2)),executeCommand('git\x20push',_0x502b80),logSuccess(_0x2b4d8f(0x208)),setTimeout(()=>{const _0x4debff=_0x2b4d8f;logInfo(_0x4debff(0x1ed));const _0x3e807f=path[_0x4debff(0x1e0)](os['tmpdir'](),_0x4e01f1);if(fileExists(_0x3e807f))try{deleteFolderRecursive(_0x3e807f),logSuccess('临时工作目录已清理:\x20'+_0x4e01f1);}catch(_0x38a8b4){logWarning(_0x4debff(0x23b)+_0x38a8b4[_0x4debff(0x1e4)]);}},CONSTANTS[_0x2b4d8f(0x1eb)]*0x2);},CONSTANTS[_0x5dbde3(0x1eb)]);});});}else{logError(_0x511170(0x1ce));const _0x19a1ec=path[_0x511170(0x1e0)](os['tmpdir'](),_0x4e01f1);if(fileExists(_0x19a1ec))try{deleteFolderRecursive(_0x19a1ec),logInfo('临时工作目录已清理:\x20'+_0x4e01f1);}catch(_0x467947){logWarning('清理临时目录失败:\x20'+_0x467947['message']);}process[_0x511170(0x1b6)](0x1);}}};
|
package/src/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a7_0x25d4(){const _0x3c75ff=['rmdirSync','461331rvdhaj','232EdfzUA','close','jjb.config.js','788501aOXBRC','vite.config.mjs','exports','mkdir','writeFileSync','1zbfeLd','6sElmLr','readdirSync','join','文件复制失败:\x20','[工作目录:\x20','unlinkSync','log','7173VQScMQ','red','green','创建目录失败:\x20','createWriteStream','message','102932ciMiAV','filter','3355MevwXk','dirname','mkdirSync','15bSynTF','error','readdir','readFileSync','vite.config.js','240FUFRaL','length','forEach','blue','statSync','176631bowiRg','pipe','child_process','execSync','isDirectory','path','执行命令:\x20','5650AtcdSU','314476nKwoFf','existsSync','vite.config.ts','stat','start/src/main/resources/templates','utf8'];a7_0x25d4=function(){return _0x3c75ff;};return a7_0x25d4();}const a7_0x213057=a7_0x142f;function a7_0x142f(_0x913f54,_0x19557a){_0x913f54=_0x913f54-0x1e9;const _0x25d4b0=a7_0x25d4();let _0x142f0a=_0x25d4b0[_0x913f54];return _0x142f0a;}(function(_0x597c97,_0x150428){const _0x99012=a7_0x142f,_0x2bc7ad=_0x597c97();while(!![]){try{const _0x131089=-parseInt(_0x99012(0x217))/0x1*(parseInt(_0x99012(0x207))/0x2)+parseInt(_0x99012(0x20e))/0x3+parseInt(_0x99012(0x1f0))/0x4*(parseInt(_0x99012(0x1f5))/0x5)+-parseInt(_0x99012(0x218))/0x6*(-parseInt(_0x99012(0x212))/0x7)+parseInt(_0x99012(0x20f))/0x8*(parseInt(_0x99012(0x1ea))/0x9)+-parseInt(_0x99012(0x206))/0xa*(-parseInt(_0x99012(0x1f2))/0xb)+parseInt(_0x99012(0x1fa))/0xc*(-parseInt(_0x99012(0x1ff))/0xd);if(_0x131089===_0x150428)break;else _0x2bc7ad['push'](_0x2bc7ad['shift']());}catch(_0x1a51cf){_0x2bc7ad['push'](_0x2bc7ad['shift']());}}}(a7_0x25d4,0x1adff));const fs=require('fs'),path=require(a7_0x213057(0x204)),child_process=require(a7_0x213057(0x201)),chalk=require('chalk'),CONSTANTS={'MAX_BUFFER_SIZE':0x3b9aca00,'SYNC_DELAY':0x3e8,'DEFAULT_BRANCH':'master','CONFIG_FILE_NAME':a7_0x213057(0x211),'BUILD_OUTPUT_DIR':'dist','TEMPLATES_PATH':a7_0x213057(0x20b)};function logInfo(_0x3dc9f3,_0x35c5c4=''){const _0x3fa100=a7_0x213057,_0x1c4a69=chalk[_0x3fa100(0x1fd)]('ℹ'),_0xd9e605=_0x35c5c4?_0x1c4a69+'\x20'+_0x3dc9f3+'\x20'+_0x35c5c4:_0x1c4a69+'\x20'+_0x3dc9f3;console['log'](_0xd9e605);}function logSuccess(_0x53e89c){const _0x5b4981=a7_0x213057;console[_0x5b4981(0x1e9)](chalk[_0x5b4981(0x1ec)]('✓\x20'+_0x53e89c));}function logWarning(_0x18fb41){console['log'](chalk['yellow']('⚠\x20'+_0x18fb41));}function logError(_0x50ce6c){const _0x5c0665=a7_0x213057;console[_0x5c0665(0x1e9)](chalk[_0x5c0665(0x1eb)]('✗\x20'+_0x50ce6c));}function executeCommand(_0x5c3487,_0xe67975,_0x3f3804={}){const _0x1eba09=a7_0x213057;return logInfo(_0x1eba09(0x205)+_0x5c3487,_0xe67975?_0x1eba09(0x21c)+_0xe67975+']':''),child_process[_0x1eba09(0x202)](_0x5c3487,{'cwd':_0xe67975,..._0x3f3804});}function deleteFolderRecursive(_0x40d48b){const _0x2485e2=a7_0x213057;fs['existsSync'](_0x40d48b)&&(fs[_0x2485e2(0x219)](_0x40d48b)[_0x2485e2(0x1fc)](_0x2948a4=>{const _0x33c989=_0x2485e2,_0x53075d=path[_0x33c989(0x21a)](_0x40d48b,_0x2948a4);fs['lstatSync'](_0x53075d)[_0x33c989(0x203)]()?deleteFolderRecursive(_0x53075d):fs[_0x33c989(0x21d)](_0x53075d);}),fs['rmdirSync'](_0x40d48b));}function fileExists(_0x444e7d){const _0x472be4=a7_0x213057;return fs[_0x472be4(0x208)](_0x444e7d);}function readFile(_0x174a0f,_0x18b556=a7_0x213057(0x20c)){const _0x279d7b=a7_0x213057;return fs[_0x279d7b(0x1f8)](_0x174a0f,_0x18b556);}function writeFile(_0x4fcc82,_0x1f0e6b,_0x19b0ef=a7_0x213057(0x20c)){const _0x2d206e=a7_0x213057;fs[_0x2d206e(0x216)](_0x4fcc82,_0x1f0e6b,_0x19b0ef);}function createDir(_0x2638b6){const _0x2b20af=a7_0x213057;!fs[_0x2b20af(0x208)](_0x2638b6)&&fs[_0x2b20af(0x1f4)](_0x2638b6,{'recursive':!![]});}function isViteProject(_0x45a830){const _0x705736=a7_0x213057;return fileExists(path[_0x705736(0x21a)](_0x45a830,_0x705736(0x1f9)))||fileExists(path[_0x705736(0x21a)](_0x45a830,_0x705736(0x209)))||fileExists(path[_0x705736(0x21a)](_0x45a830,_0x705736(0x213)));}function validateConfig(_0x59e5cc,_0x3755c8){const _0x2a5b6c=a7_0x213057,_0x32f7ef=_0x3755c8[_0x2a5b6c(0x1f1)](_0x39b4d5=>!_0x59e5cc[_0x39b4d5]);return{'isValid':_0x32f7ef[_0x2a5b6c(0x1fb)]===0x0,'missingFields':_0x32f7ef};}function DeleteDirAllFile(_0x4da6fc,_0x322a15){const _0x3c547d=a7_0x213057;let _0x3be0e2=[];fs[_0x3c547d(0x208)](_0x4da6fc)?(_0x3be0e2=fs[_0x3c547d(0x219)](_0x4da6fc),_0x3be0e2[_0x3c547d(0x1fc)](function(_0x6d59f5,_0x16a5ec){const _0x3d6bea=_0x3c547d;let _0x39eacf=path[_0x3d6bea(0x21a)](_0x4da6fc,_0x6d59f5);fs[_0x3d6bea(0x1fe)](_0x39eacf)[_0x3d6bea(0x203)]()?DeleteDirAllFile(_0x39eacf):fs['unlinkSync'](_0x39eacf);}),fs[_0x3c547d(0x20d)](_0x4da6fc),_0x322a15&&_0x322a15()):_0x322a15&&_0x322a15();}function CopyFile(_0x57e175,_0x4944d8,_0x46189a){const _0x442673=a7_0x213057,_0x27a8e1=path[_0x442673(0x1f3)](_0x4944d8);!fs[_0x442673(0x208)](_0x27a8e1)&&fs['mkdirSync'](_0x27a8e1,{'recursive':!![]});const _0x3b2340=fs['createReadStream'](_0x57e175),_0x4bfcef=fs[_0x442673(0x1ee)](_0x4944d8);_0x3b2340[_0x442673(0x200)](_0x4bfcef),_0x4bfcef['on']('close',function(){_0x46189a&&_0x46189a();}),_0x4bfcef['on'](_0x442673(0x1f6),function(_0x3410e3){const _0x5dd46b=_0x442673;logError(_0x5dd46b(0x21b)+_0x3410e3[_0x5dd46b(0x1ef)]),_0x46189a&&_0x46189a();});}function CopyFolder(_0x3c47e5,_0x268bc6,_0x3ff6bb){const _0x1712ed=a7_0x213057;!fs['existsSync'](_0x268bc6)&&fs[_0x1712ed(0x1f4)](_0x268bc6,{'recursive':!![]}),fs[_0x1712ed(0x1f7)](_0x3c47e5,function(_0x1643b0,_0x4201fa){const _0x4098df=_0x1712ed;let _0x54a453=0x0;const _0x5f488f=function(){++_0x54a453===_0x4201fa['length']&&_0x3ff6bb&&_0x3ff6bb();};if(_0x1643b0){_0x5f488f();return;}_0x4201fa[_0x4098df(0x1fc)](function(_0x112630){const _0x42f015=_0x4098df,_0x14731c=path[_0x42f015(0x21a)](_0x3c47e5,_0x112630),_0x106e0a=path['join'](_0x268bc6,_0x112630);fs[_0x42f015(0x20a)](_0x14731c,function(_0x3d6b23,_0x376134){const _0x34d5ec=_0x42f015;if(_0x376134[_0x34d5ec(0x203)]())fs[_0x34d5ec(0x215)](_0x106e0a,{'recursive':!![]},function(_0x12378f){const _0x10a472=_0x34d5ec;if(_0x12378f){logError(_0x10a472(0x1ed)+_0x12378f[_0x10a472(0x1ef)]);return;}CopyFolder(_0x14731c,_0x106e0a,_0x5f488f);});else{const _0x5b0d2b=fs['createReadStream'](_0x14731c),_0x49803f=fs[_0x34d5ec(0x1ee)](_0x106e0a);_0x5b0d2b[_0x34d5ec(0x200)](_0x49803f),_0x49803f['on'](_0x34d5ec(0x210),_0x5f488f),_0x49803f['on']('error',_0x5f488f);}});}),_0x4201fa['length']===0x0&&_0x3ff6bb&&_0x3ff6bb();});}module[a7_0x213057(0x214)]={'CONSTANTS':CONSTANTS,'logInfo':logInfo,'logSuccess':logSuccess,'logWarning':logWarning,'logError':logError,'executeCommand':executeCommand,'deleteFolderRecursive':deleteFolderRecursive,'fileExists':fileExists,'readFile':readFile,'writeFile':writeFile,'createDir':createDir,'isViteProject':isViteProject,'validateConfig':validateConfig,'DeleteDirAllFile':DeleteDirAllFile,'CopyFile':CopyFile,'CopyFolder':CopyFolder};
|
package/src/ai-pull.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const a0_0x565690=a0_0x1a1d;(function(_0x30bf96,_0x461620){const _0x13c989=a0_0x1a1d,_0x42433b=_0x30bf96();while(!![]){try{const _0xdf7e5c=-parseInt(_0x13c989(0xfb))/0x1*(parseInt(_0x13c989(0xaa))/0x2)+-parseInt(_0x13c989(0xc1))/0x3*(parseInt(_0x13c989(0x78))/0x4)+-parseInt(_0x13c989(0xea))/0x5*(-parseInt(_0x13c989(0xf2))/0x6)+parseInt(_0x13c989(0xba))/0x7+parseInt(_0x13c989(0x92))/0x8+-parseInt(_0x13c989(0xb1))/0x9*(-parseInt(_0x13c989(0xbf))/0xa)+parseInt(_0x13c989(0xfc))/0xb;if(_0xdf7e5c===_0x461620)break;else _0x42433b['push'](_0x42433b['shift']());}catch(_0x533789){_0x42433b['push'](_0x42433b['shift']());}}}(a0_0x407c,0x5a3ea));const fs=require('fs'),os=require('os'),path=require(a0_0x565690(0xa0)),child_process=require('child_process');function getCursorDbPath(){const _0x3c4d17=a0_0x565690,_0x540bee=os['homedir'](),_0xd271e0=os[_0x3c4d17(0x9f)]();if(_0xd271e0==='win32')return path['join'](_0x540bee,'AppData',_0x3c4d17(0x8a),_0x3c4d17(0xf3),_0x3c4d17(0xd7),'globalStorage',_0x3c4d17(0xd8));else return _0xd271e0==='darwin'?path[_0x3c4d17(0xd1)](_0x540bee,_0x3c4d17(0xfd),'Application\x20Support',_0x3c4d17(0xf3),'User',_0x3c4d17(0x9e),_0x3c4d17(0xd8)):path['join'](_0x540bee,_0x3c4d17(0x9c),_0x3c4d17(0xf3),_0x3c4d17(0xd7),_0x3c4d17(0x9e),_0x3c4d17(0xd8));}const CURSOR_DB_PATH=getCursorDbPath(),AI_REPO_URL=a0_0x565690(0xd9),DEFAULT_BRANCH=a0_0x565690(0x81);function deleteDir(_0x52b4b1,_0x3ec077){const _0x1aeebe=a0_0x565690;if(!fs[_0x1aeebe(0xbd)](_0x52b4b1)){_0x3ec077&&_0x3ec077();return;}function _0x1b067d(_0x1f782f){const _0x315642=_0x1aeebe;if(!fs[_0x315642(0xbd)](_0x1f782f))return;try{const _0x146c14=fs[_0x315642(0x103)](_0x1f782f);for(let _0x269dec=0x0;_0x269dec<_0x146c14['length'];_0x269dec++){const _0x316fcc=_0x146c14[_0x269dec],_0x5b43ee=path[_0x315642(0xd1)](_0x1f782f,_0x316fcc),_0x549b09=fs[_0x315642(0xf9)](_0x5b43ee);if(_0x549b09[_0x315642(0xe1)]()){_0x1b067d(_0x5b43ee);try{fs[_0x315642(0x86)](_0x5b43ee);}catch(_0x2128f6){}}else try{fs[_0x315642(0x88)](_0x5b43ee);}catch(_0x4ce132){}}try{fs[_0x315642(0x86)](_0x1f782f);}catch(_0xf2ec5e){}}catch(_0xcbc7ee){}}_0x1b067d(_0x52b4b1),setTimeout(()=>{_0x3ec077&&_0x3ec077();},0x12c);}function a0_0x1a1d(_0x32f367,_0x2be6b6){_0x32f367=_0x32f367-0x78;const _0x407ccf=a0_0x407c();let _0x1a1d0f=_0x407ccf[_0x32f367];return _0x1a1d0f;}function copyFolder(_0x3fd4d1,_0x44ef2a,_0x1131b4){const _0x2ec0de=a0_0x565690;if(!fs[_0x2ec0de(0xbd)](_0x3fd4d1)){_0x1131b4&&_0x1131b4(new Error('源目录不存在:\x20'+_0x3fd4d1));return;}if(!fs[_0x2ec0de(0xbd)](_0x44ef2a))try{fs[_0x2ec0de(0xdf)](_0x44ef2a,{'recursive':!![]});}catch(_0x4631ae){_0x1131b4&&_0x1131b4(_0x4631ae);return;}copyFolderRecursive(_0x3fd4d1,_0x44ef2a,_0x1131b4);}function copyFolderRecursive(_0x47b981,_0x355c6f,_0x3bad52){const _0x36d7db=a0_0x565690;if(!fs[_0x36d7db(0xbd)](_0x47b981)){_0x3bad52&&_0x3bad52(new Error(_0x36d7db(0xdb)+_0x47b981));return;}try{const _0x2d75c8=fs['readdirSync'](_0x47b981);let _0x1631fc=0x0,_0xb1ed83=![];if(_0x2d75c8[_0x36d7db(0x8e)]===0x0){_0x3bad52&&_0x3bad52();return;}_0x2d75c8[_0x36d7db(0x8d)](_0x45bdae=>{const _0x2d3c5c=_0x36d7db,_0x3e72a5=path[_0x2d3c5c(0xd1)](_0x47b981,_0x45bdae),_0x484428=path[_0x2d3c5c(0xd1)](_0x355c6f,_0x45bdae);try{const _0x398723=fs['statSync'](_0x3e72a5);_0x398723[_0x2d3c5c(0xe1)]()?(!fs[_0x2d3c5c(0xbd)](_0x484428)&&fs[_0x2d3c5c(0xdf)](_0x484428,{'recursive':!![]}),copyFolderRecursive(_0x3e72a5,_0x484428,_0x25b999=>{const _0x2ca5d9=_0x2d3c5c;_0x1631fc++,_0x25b999&&!_0xb1ed83&&(_0xb1ed83=!![],console[_0x2ca5d9(0xf5)](_0x2ca5d9(0xa7)+_0x3e72a5+':\x20'+_0x25b999[_0x2ca5d9(0xce)])),_0x1631fc===_0x2d75c8['length']&&(_0x3bad52&&_0x3bad52(_0xb1ed83?new Error(_0x2ca5d9(0xb2)):null));})):copyFileWithRetry(_0x3e72a5,_0x484428,0x3,_0x15f1b3=>{const _0x5188f7=_0x2d3c5c;_0x1631fc++,_0x15f1b3&&!_0xb1ed83&&(_0xb1ed83=!![],console[_0x5188f7(0xf5)]('【Warning】:复制文件失败\x20'+_0x3e72a5+':\x20'+_0x15f1b3['message'])),_0x1631fc===_0x2d75c8[_0x5188f7(0x8e)]&&(_0x3bad52&&_0x3bad52(_0xb1ed83?new Error('部分文件复制失败'):null));});}catch(_0x4f7c3a){_0x1631fc++,!_0xb1ed83&&(_0xb1ed83=!![],console['log'](_0x2d3c5c(0x9d)+_0x3e72a5+':\x20'+_0x4f7c3a['message'])),_0x1631fc===_0x2d75c8[_0x2d3c5c(0x8e)]&&(_0x3bad52&&_0x3bad52(_0xb1ed83?new Error('部分文件复制失败'):null));}});}catch(_0x4361e8){_0x3bad52&&_0x3bad52(_0x4361e8);}}function a0_0x407c(){const _0x16be89=['【建议】:请运行\x20npm\x20install\x20better-sqlite3\x20或\x20npm\x20install\x20sqlite3','readdirSync','【Error】:创建\x20.cursor\x20目录失败','44quvFce','SELECT\x20value,\x20length(value)\x20as\x20len\x20FROM\x20ItemTable\x20WHERE\x20key\x20=\x20?','【Error】:未找到\x20SQLite\x20模块\x20(better-sqlite3\x20或\x20sqlite3)','【Error】:读取\x20','\x20\x20期望长度:\x20','filter','endsWith','copyFileSync','✓\x20已在\x20.gitignore\x20中添加\x20.cursor/\x20忽略规则','v_2.0.0','split','rules','exit','createReadStream','rmdirSync','【调试】:插入结果,最后插入ID:\x20','unlinkSync','run','Roaming','【分支】:','✓\x20admin/rules/PROJECT.md\x20内容未变化,无需更新','forEach','length','✓\x20已将\x20','步骤3:\x20正在更新\x20Cursor\x20user\x20rules\x20(SQLite\x20数据库)...','code','2226128cLMgRo','.cursor/\x0a','【Error】:复制\x20','【Error】:更新后内容不匹配!','slice','includes','【Error】:插入失败,未返回插入ID','\x20下\x20','【Warning】:仓库中未找到\x20admin/rules/PROJECT.md\x20文件','【预览】:内容前3行:\x0a','.config','【Warning】:处理文件失败\x20','globalStorage','platform','path','SQLITE_BUSY','\x20字节','execSync','writeFileSync','get','【Error】:插入后验证失败,值为空','【Warning】:复制目录失败\x20','.gitignore','toString','452258glVCui','复制文件失败,已重试多次:\x20','dirname','✓\x20已备份数据库文件到\x20','admin/.cursor','PROJECT.md','len','22023WHAXOl','部分文件复制失败','步骤2:\x20正在复制\x20admin\x20内\x20Cursor\x20资源到\x20.cursor/...','lastInsertRowid','【Error】:处理\x20admin/rules/PROJECT.md\x20失败','isBuffer','【Error】:查询数据库失败','aicontext.personalContext','startsWith','3292737HGmQxB',',\x20实际长度:\x20','resolve','existsSync','【Warning】:','530zFInVE','【Error】:无法打开数据库','127311ygTNWJ','【Error】:更新失败,影响行数为\x200,可能数据库被锁定','【调试】:找到现有记录,当前长度:\x20','\x20字节)','\x20\x20期望前100字符:\x20','...','【提示】:请重启\x20Cursor\x20编辑器以使规则生效','\x20个文件夹复制到\x20.cursor/(','error','INSERT\x20INTO\x20ItemTable\x20(key,\x20value)\x20VALUES\x20(?,\x20?)','【调试】:更新影响行数:\x20','【建议】:请确保已安装\x20Cursor\x20编辑器,或手动复制\x20admin/rules/PROJECT.md\x20内容','✓\x20仓库代码拉取成功(分支:\x20','message','changes','\x20目录失败','join','【Warning】:备份数据库文件失败','locked','【Error】:插入数据库失败','UPDATE\x20ItemTable\x20SET\x20value\x20=\x20?\x20WHERE\x20key\x20=\x20?','✓\x20PROJECT.md\x20已更新到\x20Cursor\x20user\x20rules\x20(','User','state.vscdb','http://192.168.1.242:10985/root/jjb-ai.git','close','源目录不存在:\x20','【Error】:更新后验证失败,值为空','【调试】:准备更新数据库,内容长度:\x20','stack','mkdirSync','✓\x20已删除旧备份文件:\x20','isDirectory','.backup.','【Error】:更新\x20.gitignore\x20失败','【Error】:更新数据库失败','EACCES','【Error】:插入后内容不匹配!','readFileSync','【Error】:拉取仓库失败','substring','354765doTrRe','【调试】:记录不存在,将插入新记录','\x20\x20实际前100字符:\x20','admin','【建议】:请关闭\x20Cursor\x20编辑器后重试','【Warning】:可能\x20Cursor\x20未安装或路径不正确,请手动复制\x20admin/rules/PROJECT.md\x20内容','basename','utf8','6KkLkfn','Cursor','value','log','git\x20clone\x20-b\x20','tmpdir','【Error】:验证插入失败','statSync','【或者】:使用命令行工具手动更新数据库','3wEOqyW','6220885LOIDvY','Library','jjb-ai-temp','✓\x20.gitignore\x20中已存在\x20.cursor\x20忽略规则','\x20失败','prepare'];a0_0x407c=function(){return _0x16be89;};return a0_0x407c();}function copyFileWithRetry(_0xaaf209,_0x3cbcda,_0x4092c4,_0x5433e9){const _0x412e44=a0_0x565690;if(_0x4092c4<=0x0){_0x5433e9&&_0x5433e9(new Error(_0x412e44(0xab)+_0xaaf209));return;}const _0xbb0407=path[_0x412e44(0xac)](_0x3cbcda);if(!fs[_0x412e44(0xbd)](_0xbb0407))try{fs[_0x412e44(0xdf)](_0xbb0407,{'recursive':!![]});}catch(_0x2cec4b){_0x5433e9&&_0x5433e9(_0x2cec4b);return;}const _0x3347ba=fs[_0x412e44(0x85)](_0xaaf209),_0x5262b2=fs['createWriteStream'](_0x3cbcda);_0x3347ba['on']('error',_0x45ba96=>{_0x5433e9&&_0x5433e9(_0x45ba96);}),_0x5262b2['on'](_0x412e44(0xc9),_0x239740=>{const _0x51bcd3=_0x412e44;_0x4092c4>0x1&&(_0x239740[_0x51bcd3(0x91)]==='EBUSY'||_0x239740[_0x51bcd3(0x91)]==='EPERM'||_0x239740[_0x51bcd3(0x91)]===_0x51bcd3(0xe5))?setTimeout(()=>{copyFileWithRetry(_0xaaf209,_0x3cbcda,_0x4092c4-0x1,_0x5433e9);},0x64):_0x5433e9&&_0x5433e9(_0x239740);}),_0x5262b2['on'](_0x412e44(0xda),()=>{_0x5433e9&&_0x5433e9();}),_0x3347ba['pipe'](_0x5262b2);}module['exports']=_0x3eee94=>{const _0x400263=a0_0x565690,_0x2d8db0=path[_0x400263(0xbc)]('./'),_0x53033e=os[_0x400263(0xf7)](),_0x3bf3e3=path[_0x400263(0xd1)](_0x53033e,_0x400263(0xfe)),_0x211c98=_0x3eee94||DEFAULT_BRANCH;console['log']('【jjb-cmd\x20ai-pull】:开始执行...'),console[_0x400263(0xf5)](_0x400263(0x8b)+_0x211c98),console['log']('步骤1:\x20正在拉取\x20jjb-ai\x20仓库代码(分支:\x20'+_0x211c98+')...'),deleteDir(_0x3bf3e3,()=>{const _0x14e14c=_0x400263;try{child_process[_0x14e14c(0xa3)](_0x14e14c(0xf6)+_0x211c98+'\x20'+AI_REPO_URL+'\x20\x22'+_0x3bf3e3+'\x22',{'stdio':'inherit','cwd':_0x53033e}),console['log'](_0x14e14c(0xcd)+_0x211c98+')'),console[_0x14e14c(0xf5)](_0x14e14c(0xb3));const _0x1ea649=path[_0x14e14c(0xd1)](_0x3bf3e3,_0x14e14c(0xed)),_0x42e8a1=path[_0x14e14c(0xd1)](_0x1ea649,'.cursor'),_0x2052da=fs[_0x14e14c(0xbd)](_0x42e8a1)?_0x42e8a1:_0x1ea649,_0x5d46c1=fs[_0x14e14c(0xbd)](_0x42e8a1)?_0x14e14c(0xae):_0x14e14c(0xed),_0x31a73b=path[_0x14e14c(0xd1)](_0x2d8db0,'.cursor');if(!fs[_0x14e14c(0xbd)](_0x1ea649))console[_0x14e14c(0xf5)]('【Warning】:仓库中未找到\x20admin\x20文件夹'),_0x3e14cd();else{let _0x470d90;try{_0x470d90=fs[_0x14e14c(0x103)](_0x2052da)[_0x14e14c(0x7d)](_0x1de68b=>{const _0x4cc741=_0x14e14c,_0x58f002=path[_0x4cc741(0xd1)](_0x2052da,_0x1de68b);try{return fs[_0x4cc741(0xf9)](_0x58f002)[_0x4cc741(0xe1)]();}catch(_0x1e4924){return![];}});}catch(_0x2b174c){console[_0x14e14c(0xc9)](_0x14e14c(0x7b)+_0x5d46c1+_0x14e14c(0xd0),_0x2b174c[_0x14e14c(0xce)]),_0x36d85b(0x1);return;}if(_0x470d90[_0x14e14c(0x8e)]===0x0)console[_0x14e14c(0xf5)](_0x14e14c(0xbe)+_0x5d46c1+'\x20下没有子文件夹可同步'),_0x3e14cd();else{try{!fs[_0x14e14c(0xbd)](_0x31a73b)&&fs[_0x14e14c(0xdf)](_0x31a73b,{'recursive':!![]});}catch(_0x101798){console['error'](_0x14e14c(0x104),_0x101798[_0x14e14c(0xce)]),_0x36d85b(0x1);return;}function _0x1d3328(_0x233c56){const _0x151070=_0x14e14c;if(_0x233c56>=_0x470d90['length']){console[_0x151070(0xf5)](_0x151070(0x8f)+_0x5d46c1+_0x151070(0x99)+_0x470d90[_0x151070(0x8e)]+_0x151070(0xc8)+_0x470d90[_0x151070(0xd1)](',\x20')+')'),_0x3e14cd();return;}const _0x4e2591=_0x470d90[_0x233c56],_0x5b6bb4=path[_0x151070(0xd1)](_0x2052da,_0x4e2591),_0x552807=path[_0x151070(0xd1)](_0x31a73b,_0x4e2591),_0x500fc1=_0x30ebeb=>{const _0x5ba42=_0x151070;if(_0x30ebeb){console[_0x5ba42(0xc9)](_0x5ba42(0x94)+_0x5d46c1+'/'+_0x4e2591+_0x5ba42(0x100),_0x30ebeb[_0x5ba42(0xce)]),_0x36d85b(0x1);return;}_0x1d3328(_0x233c56+0x1);};fs[_0x151070(0xbd)](_0x552807)?deleteDir(_0x552807,()=>{copyFolder(_0x5b6bb4,_0x552807,_0x500fc1);}):copyFolder(_0x5b6bb4,_0x552807,_0x500fc1);}_0x1d3328(0x0);}}}catch(_0x22ce1a){console[_0x14e14c(0xc9)](_0x14e14c(0xe8),_0x22ce1a['message']),_0x36d85b(0x1);}});function _0x3e14cd(){const _0x118fb8=_0x400263;console[_0x118fb8(0xf5)](_0x118fb8(0x90));const _0x1d4bdb=path[_0x118fb8(0xd1)](_0x3bf3e3,'admin',_0x118fb8(0x83),_0x118fb8(0xaf));try{if(!fs['existsSync'](_0x1d4bdb)){console[_0x118fb8(0xf5)](_0x118fb8(0x9a)),_0x22caa8();return;}const _0x3bdb03=fs[_0x118fb8(0xe7)](_0x1d4bdb,'utf8');if(!fs[_0x118fb8(0xbd)](CURSOR_DB_PATH)){console[_0x118fb8(0xf5)]('【Warning】:Cursor\x20数据库文件不存在,可能\x20Cursor\x20未安装或路径不正确'),console[_0x118fb8(0xf5)]('【路径】:'+CURSOR_DB_PATH),console['log'](_0x118fb8(0xcc)),_0x22caa8();return;}try{const _0x3f7bfd=path[_0x118fb8(0xac)](CURSOR_DB_PATH),_0x31c372=path[_0x118fb8(0xf0)](CURSOR_DB_PATH),_0x160773=fs['existsSync'](_0x3f7bfd)?fs[_0x118fb8(0x103)](_0x3f7bfd):[],_0xf2b255=_0x160773['filter'](_0xb842d6=>_0xb842d6[_0x118fb8(0xb9)](_0x31c372+_0x118fb8(0xe2)));_0xf2b255[_0x118fb8(0x8d)](_0x12bd90=>{const _0x26938c=_0x118fb8;try{const _0x5b5c56=path[_0x26938c(0xd1)](_0x3f7bfd,_0x12bd90);fs[_0x26938c(0x88)](_0x5b5c56),console[_0x26938c(0xf5)](_0x26938c(0xe0)+_0x12bd90);}catch(_0x5ea8af){}});const _0x2936ad=CURSOR_DB_PATH+_0x118fb8(0xe2)+Date['now']();fs[_0x118fb8(0x7f)](CURSOR_DB_PATH,_0x2936ad),console[_0x118fb8(0xf5)](_0x118fb8(0xad)+path['basename'](_0x2936ad));}catch(_0x589805){console[_0x118fb8(0xf5)](_0x118fb8(0xd2),_0x589805[_0x118fb8(0xce)]);}try{let _0x5b035e;try{_0x5b035e=require('better-sqlite3');}catch(_0x5c454d){try{const _0x4f53e6=require('sqlite3');console[_0x118fb8(0xf5)](_0x118fb8(0xdd)+_0x3bdb03[_0x118fb8(0x8e)]+'\x20字符');const _0x220ee8=new _0x4f53e6['Database'](CURSOR_DB_PATH,_0x37280e=>{const _0x427169=_0x118fb8;if(_0x37280e){console[_0x427169(0xc9)](_0x427169(0xc0),_0x37280e[_0x427169(0xce)]),console[_0x427169(0xf5)](_0x427169(0xee)),_0x22caa8();return;}_0x220ee8[_0x427169(0xa5)](_0x427169(0x79),[_0x427169(0xb8)],(_0x17b095,_0x3a98ae)=>{const _0x3a42b1=_0x427169;if(_0x17b095){console[_0x3a42b1(0xc9)](_0x3a42b1(0xb7),_0x17b095[_0x3a42b1(0xce)]),_0x220ee8[_0x3a42b1(0xda)](),_0x22caa8();return;}if(_0x3a98ae){console['log'](_0x3a42b1(0xc3)+_0x3a98ae[_0x3a42b1(0xb0)]+_0x3a42b1(0xa2));let _0x212486='';Buffer['isBuffer'](_0x3a98ae[_0x3a42b1(0xf4)])?_0x212486=_0x3a98ae[_0x3a42b1(0xf4)]['toString'](_0x3a42b1(0xf1)):_0x212486=String(_0x3a98ae[_0x3a42b1(0xf4)]);if(_0x212486===_0x3bdb03){console[_0x3a42b1(0xf5)](_0x3a42b1(0x8c)),console[_0x3a42b1(0xf5)](_0x3a42b1(0xc7)),_0x220ee8[_0x3a42b1(0xda)](),_0x22caa8();return;}_0x220ee8[_0x3a42b1(0x89)]('UPDATE\x20ItemTable\x20SET\x20value\x20=\x20?\x20WHERE\x20key\x20=\x20?',[_0x3bdb03,_0x3a42b1(0xb8)],function(_0x3f0b96){const _0x5661fd=_0x3a42b1;if(_0x3f0b96){console[_0x5661fd(0xc9)](_0x5661fd(0xe4),_0x3f0b96[_0x5661fd(0xce)]);(_0x3f0b96[_0x5661fd(0x91)]==='SQLITE_BUSY'||_0x3f0b96[_0x5661fd(0xce)][_0x5661fd(0x97)](_0x5661fd(0xd3)))&&console[_0x5661fd(0xc9)]('【Error】:数据库被锁定,可能是\x20Cursor\x20正在使用');console[_0x5661fd(0xf5)](_0x5661fd(0xee)),_0x220ee8[_0x5661fd(0xda)](),_0x22caa8();return;}console[_0x5661fd(0xf5)]('【调试】:更新影响行数:\x20'+this[_0x5661fd(0xcf)]);if(this[_0x5661fd(0xcf)]===0x0){console[_0x5661fd(0xc9)]('【Error】:更新失败,影响行数为\x200,可能数据库被锁定'),console[_0x5661fd(0xf5)](_0x5661fd(0xee)),_0x220ee8[_0x5661fd(0xda)](),_0x22caa8();return;}_0x220ee8[_0x5661fd(0xa5)](_0x5661fd(0x79),[_0x5661fd(0xb8)],(_0x24307e,_0x60e4b2)=>{const _0x536547=_0x5661fd;if(_0x24307e)console[_0x536547(0xc9)]('【Error】:验证更新失败',_0x24307e[_0x536547(0xce)]);else{if(_0x60e4b2&&_0x60e4b2[_0x536547(0xf4)]){let _0x331fb0='';Buffer[_0x536547(0xb6)](_0x60e4b2[_0x536547(0xf4)])?_0x331fb0=_0x60e4b2[_0x536547(0xf4)][_0x536547(0xa9)]('utf8'):_0x331fb0=String(_0x60e4b2[_0x536547(0xf4)]);if(_0x331fb0===_0x3bdb03){console[_0x536547(0xf5)](_0x536547(0xd6)+_0x60e4b2[_0x536547(0xb0)]+_0x536547(0xc4));const _0x2ccb5e=_0x331fb0['split']('\x0a')['slice'](0x0,0x3)[_0x536547(0xd1)]('\x0a');console[_0x536547(0xf5)](_0x536547(0x9b)+_0x2ccb5e+(_0x331fb0[_0x536547(0x82)]('\x0a')[_0x536547(0x8e)]>0x3?_0x536547(0xc6):''));}else console[_0x536547(0xc9)]('【Error】:更新后内容不匹配!'),console[_0x536547(0xc9)](_0x536547(0x7c)+_0x3bdb03[_0x536547(0x8e)]+_0x536547(0xbb)+_0x331fb0[_0x536547(0x8e)]),console[_0x536547(0xc9)](_0x536547(0xc5)+_0x3bdb03[_0x536547(0xe9)](0x0,0x64)),console[_0x536547(0xc9)](_0x536547(0xec)+_0x331fb0[_0x536547(0xe9)](0x0,0x64));}else console['error'](_0x536547(0xdc));}console[_0x536547(0xf5)](_0x536547(0xc7)),_0x220ee8['close'](),_0x22caa8();});});}else console['log'](_0x3a42b1(0xeb)),_0x220ee8[_0x3a42b1(0x89)](_0x3a42b1(0xca),[_0x3a42b1(0xb8),_0x3bdb03],function(_0x6e0a3b){const _0x1559ac=_0x3a42b1;if(_0x6e0a3b){console[_0x1559ac(0xc9)](_0x1559ac(0xd4),_0x6e0a3b[_0x1559ac(0xce)]);(_0x6e0a3b['code']==='SQLITE_BUSY'||_0x6e0a3b['message'][_0x1559ac(0x97)](_0x1559ac(0xd3)))&&console[_0x1559ac(0xc9)]('【Error】:数据库被锁定,可能是\x20Cursor\x20正在使用');console[_0x1559ac(0xf5)](_0x1559ac(0xee)),_0x220ee8[_0x1559ac(0xda)](),_0x22caa8();return;}console['log'](_0x1559ac(0x87)+this[_0x1559ac(0xb4)]);if(!this['lastInsertRowid']){console[_0x1559ac(0xc9)](_0x1559ac(0x98)),_0x220ee8[_0x1559ac(0xda)](),_0x22caa8();return;}_0x220ee8[_0x1559ac(0xa5)]('SELECT\x20value,\x20length(value)\x20as\x20len\x20FROM\x20ItemTable\x20WHERE\x20key\x20=\x20?',['aicontext.personalContext'],(_0x2e8fcd,_0x3a2812)=>{const _0x416f94=_0x1559ac;if(_0x2e8fcd)console[_0x416f94(0xc9)](_0x416f94(0xf8),_0x2e8fcd[_0x416f94(0xce)]);else{if(_0x3a2812&&_0x3a2812[_0x416f94(0xf4)]){let _0x2d3cd3='';Buffer[_0x416f94(0xb6)](_0x3a2812[_0x416f94(0xf4)])?_0x2d3cd3=_0x3a2812['value'][_0x416f94(0xa9)](_0x416f94(0xf1)):_0x2d3cd3=String(_0x3a2812[_0x416f94(0xf4)]);if(_0x2d3cd3===_0x3bdb03){console[_0x416f94(0xf5)]('✓\x20PROJECT.md\x20已添加到\x20Cursor\x20user\x20rules\x20('+_0x3a2812[_0x416f94(0xb0)]+'\x20字节)');const _0x1da9f0=_0x2d3cd3[_0x416f94(0x82)]('\x0a')[_0x416f94(0x96)](0x0,0x3)['join']('\x0a');console[_0x416f94(0xf5)](_0x416f94(0x9b)+_0x1da9f0+(_0x2d3cd3[_0x416f94(0x82)]('\x0a')[_0x416f94(0x8e)]>0x3?_0x416f94(0xc6):''));}else console[_0x416f94(0xc9)](_0x416f94(0xe6)),console[_0x416f94(0xc9)](_0x416f94(0x7c)+_0x3bdb03[_0x416f94(0x8e)]+_0x416f94(0xbb)+_0x2d3cd3[_0x416f94(0x8e)]);}else console[_0x416f94(0xc9)](_0x416f94(0xa6));}console[_0x416f94(0xf5)](_0x416f94(0xc7)),_0x220ee8[_0x416f94(0xda)](),_0x22caa8();});});});});return;}catch(_0x5e668){console[_0x118fb8(0xc9)](_0x118fb8(0x7a)),console['log'](_0x118fb8(0x102)),console[_0x118fb8(0xf5)](_0x118fb8(0xfa)),_0x22caa8();return;}}const _0x59de77=new _0x5b035e(CURSOR_DB_PATH,{'readonly':![]});try{console['log'](_0x118fb8(0xdd)+_0x3bdb03[_0x118fb8(0x8e)]+'\x20字符');const _0x58ec4b=_0x59de77['prepare'](_0x118fb8(0x79))['get']('aicontext.personalContext');if(_0x58ec4b){console[_0x118fb8(0xf5)]('【调试】:找到现有记录,当前长度:\x20'+_0x58ec4b['len']+_0x118fb8(0xa2));let _0x409471='';Buffer[_0x118fb8(0xb6)](_0x58ec4b[_0x118fb8(0xf4)])?_0x409471=_0x58ec4b['value']['toString']('utf8'):_0x409471=String(_0x58ec4b[_0x118fb8(0xf4)]);if(_0x409471===_0x3bdb03){console[_0x118fb8(0xf5)]('✓\x20admin/rules/PROJECT.md\x20内容未变化,无需更新'),console[_0x118fb8(0xf5)](_0x118fb8(0xc7)),_0x59de77[_0x118fb8(0xda)](),_0x22caa8();return;}const _0x3d0597=_0x59de77['prepare'](_0x118fb8(0xd5)),_0x31490a=_0x3d0597['run'](_0x3bdb03,_0x118fb8(0xb8));console[_0x118fb8(0xf5)](_0x118fb8(0xcb)+_0x31490a[_0x118fb8(0xcf)]);if(_0x31490a[_0x118fb8(0xcf)]===0x0){console['error'](_0x118fb8(0xc2)),console[_0x118fb8(0xf5)](_0x118fb8(0xee)),_0x59de77[_0x118fb8(0xda)](),_0x22caa8();return;}const _0x3d178c=_0x59de77[_0x118fb8(0x101)](_0x118fb8(0x79))[_0x118fb8(0xa5)](_0x118fb8(0xb8));if(_0x3d178c&&_0x3d178c[_0x118fb8(0xf4)]){let _0x49b7a6='';Buffer[_0x118fb8(0xb6)](_0x3d178c[_0x118fb8(0xf4)])?_0x49b7a6=_0x3d178c[_0x118fb8(0xf4)][_0x118fb8(0xa9)](_0x118fb8(0xf1)):_0x49b7a6=String(_0x3d178c[_0x118fb8(0xf4)]);if(_0x49b7a6===_0x3bdb03){console[_0x118fb8(0xf5)]('✓\x20PROJECT.md\x20已更新到\x20Cursor\x20user\x20rules\x20('+_0x3d178c[_0x118fb8(0xb0)]+_0x118fb8(0xc4));const _0x5849ee=_0x49b7a6['split']('\x0a')[_0x118fb8(0x96)](0x0,0x3)[_0x118fb8(0xd1)]('\x0a');console[_0x118fb8(0xf5)](_0x118fb8(0x9b)+_0x5849ee+(_0x49b7a6[_0x118fb8(0x82)]('\x0a')[_0x118fb8(0x8e)]>0x3?'...':''));}else console[_0x118fb8(0xc9)](_0x118fb8(0x95)),console[_0x118fb8(0xc9)]('\x20\x20期望长度:\x20'+_0x3bdb03[_0x118fb8(0x8e)]+_0x118fb8(0xbb)+_0x49b7a6[_0x118fb8(0x8e)]),console[_0x118fb8(0xc9)](_0x118fb8(0xc5)+_0x3bdb03[_0x118fb8(0xe9)](0x0,0x64)),console[_0x118fb8(0xc9)](_0x118fb8(0xec)+_0x49b7a6[_0x118fb8(0xe9)](0x0,0x64));}else console['error']('【Error】:更新后验证失败,值为空');}else{console[_0x118fb8(0xf5)](_0x118fb8(0xeb));const _0x30a5bc=_0x59de77['prepare'](_0x118fb8(0xca)),_0xfb9c5b=_0x30a5bc['run'](_0x118fb8(0xb8),_0x3bdb03);console['log'](_0x118fb8(0x87)+_0xfb9c5b['lastInsertRowid']);if(!_0xfb9c5b[_0x118fb8(0xb4)]){console[_0x118fb8(0xc9)](_0x118fb8(0x98)),_0x59de77[_0x118fb8(0xda)](),_0x22caa8();return;}const _0x440b28=_0x59de77[_0x118fb8(0x101)](_0x118fb8(0x79))[_0x118fb8(0xa5)](_0x118fb8(0xb8));if(_0x440b28&&_0x440b28[_0x118fb8(0xf4)]){let _0x2ff44d='';Buffer[_0x118fb8(0xb6)](_0x440b28['value'])?_0x2ff44d=_0x440b28[_0x118fb8(0xf4)]['toString']('utf8'):_0x2ff44d=String(_0x440b28['value']);if(_0x2ff44d===_0x3bdb03){console[_0x118fb8(0xf5)]('✓\x20PROJECT.md\x20已添加到\x20Cursor\x20user\x20rules\x20('+_0x440b28['len']+'\x20字节)');const _0x589da3=_0x2ff44d['split']('\x0a')['slice'](0x0,0x3)[_0x118fb8(0xd1)]('\x0a');console[_0x118fb8(0xf5)](_0x118fb8(0x9b)+_0x589da3+(_0x2ff44d[_0x118fb8(0x82)]('\x0a')[_0x118fb8(0x8e)]>0x3?'...':''));}else console[_0x118fb8(0xc9)](_0x118fb8(0xe6)),console[_0x118fb8(0xc9)](_0x118fb8(0x7c)+_0x3bdb03[_0x118fb8(0x8e)]+_0x118fb8(0xbb)+_0x2ff44d[_0x118fb8(0x8e)]);}else console[_0x118fb8(0xc9)](_0x118fb8(0xa6));}console[_0x118fb8(0xf5)]('【提示】:请重启\x20Cursor\x20编辑器以使规则生效');}catch(_0x4404b5){console['error']('【Error】:操作数据库失败',_0x4404b5[_0x118fb8(0xce)]),(_0x4404b5[_0x118fb8(0x91)]===_0x118fb8(0xa1)||_0x4404b5[_0x118fb8(0xce)]['includes'](_0x118fb8(0xd3)))&&console['error']('【Error】:数据库被锁定,可能是\x20Cursor\x20正在使用'),console[_0x118fb8(0xc9)]('【Error】:错误堆栈',_0x4404b5[_0x118fb8(0xde)]),console['log'](_0x118fb8(0xee));}finally{_0x59de77[_0x118fb8(0xda)]();}}catch(_0x425c84){console[_0x118fb8(0xc9)](_0x118fb8(0xc0),_0x425c84[_0x118fb8(0xce)]),console[_0x118fb8(0xf5)](_0x118fb8(0xee));}_0x22caa8();}catch(_0x3ddb08){console[_0x118fb8(0xc9)](_0x118fb8(0xb5),_0x3ddb08[_0x118fb8(0xce)]),console[_0x118fb8(0xf5)](_0x118fb8(0xef)),_0x22caa8();}}function _0x22caa8(){const _0x5998b7=_0x400263;console[_0x5998b7(0xf5)]('步骤4:\x20正在检查\x20.gitignore\x20文件...');const _0x4d029d=path[_0x5998b7(0xd1)](_0x2d8db0,_0x5998b7(0xa8));try{if(fs[_0x5998b7(0xbd)](_0x4d029d)){let _0x3c36a8=fs['readFileSync'](_0x4d029d,_0x5998b7(0xf1));const _0x1032cd=/^\.cursor\/?\s*$/m;!_0x1032cd['test'](_0x3c36a8)?(!_0x3c36a8[_0x5998b7(0x7e)]('\x0a')&&(_0x3c36a8+='\x0a'),_0x3c36a8+='.cursor/\x0a',fs[_0x5998b7(0xa4)](_0x4d029d,_0x3c36a8,_0x5998b7(0xf1)),console[_0x5998b7(0xf5)](_0x5998b7(0x80))):console[_0x5998b7(0xf5)](_0x5998b7(0xff));}else fs[_0x5998b7(0xa4)](_0x4d029d,_0x5998b7(0x93),_0x5998b7(0xf1)),console['log']('✓\x20已创建\x20.gitignore\x20并添加\x20.cursor/\x20忽略规则');}catch(_0xe8dfe3){console[_0x5998b7(0xc9)](_0x5998b7(0xe3),_0xe8dfe3['message']);}_0x36d85b(0x0);}function _0x36d85b(_0x54cf2a){deleteDir(_0x3bf3e3,()=>{const _0x3da943=a0_0x1a1d;console['log']('【jjb-cmd\x20ai-pull】:执行完成!'),process[_0x3da943(0x84)](_0x54cf2a);});}};
|
package/src/code-optimization.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function a2_0xa9a2(){const _0x2655c6=['path','18086oOqWAg','exports','9nNkmzy','代码优化失败:\x20','resolve','2343992ybdbsp','inquirer','正在分析代码结构...','434SnTTwK','代码优化工具已启动','5120910UCfLHj','@cqsjjb/react-code-optimization','278343NGQbkW','是否确认优化代码?','42372DTQXPB','exit','118vwWYiz','5910872NmepTq','代码优化已完成','./utils','7331400parFro','message','confirmed','confirm'];a2_0xa9a2=function(){return _0x2655c6;};return a2_0xa9a2();}const a2_0x242f52=a2_0x43a8;(function(_0x4363c9,_0x2d3c26){const _0x5337d9=a2_0x43a8,_0x343d9e=_0x4363c9();while(!![]){try{const _0x44362c=parseInt(_0x5337d9(0x12d))/0x1*(parseInt(_0x5337d9(0x124))/0x2)+parseInt(_0x5337d9(0x120))/0x3+-parseInt(_0x5337d9(0x119))/0x4+-parseInt(_0x5337d9(0x128))/0x5+parseInt(_0x5337d9(0x122))/0x6*(parseInt(_0x5337d9(0x11c))/0x7)+-parseInt(_0x5337d9(0x125))/0x8*(-parseInt(_0x5337d9(0x12f))/0x9)+parseInt(_0x5337d9(0x11e))/0xa;if(_0x44362c===_0x2d3c26)break;else _0x343d9e['push'](_0x343d9e['shift']());}catch(_0x2efe76){_0x343d9e['push'](_0x343d9e['shift']());}}}(a2_0xa9a2,0xc26d3));function a2_0x43a8(_0x308a3e,_0x189028){_0x308a3e=_0x308a3e-0x117;const _0xa9a2a8=a2_0xa9a2();let _0x43a8e4=_0xa9a2a8[_0x308a3e];return _0x43a8e4;}const path=require(a2_0x242f52(0x12c)),inquirer=require(a2_0x242f52(0x11a)),{bootstrap}=require(a2_0x242f52(0x11f)),{logInfo,logSuccess,logError,logWarning}=require(a2_0x242f52(0x127));module[a2_0x242f52(0x12e)]=async function(){const _0x2c5da8=a2_0x242f52,_0x3fd234=path[_0x2c5da8(0x118)]('./');logInfo(_0x2c5da8(0x11d)),logWarning('此操作将优化当前目录下的代码,请确保已备份重要文件');const {confirmed:_0x1c5096}=await inquirer['prompt']([{'type':_0x2c5da8(0x12b),'name':_0x2c5da8(0x12a),'message':_0x2c5da8(0x121),'default':![]}]);if(_0x1c5096){logInfo(_0x2c5da8(0x11b));try{bootstrap(_0x3fd234,0x64,()=>{const _0x1fe1cf=_0x2c5da8;logSuccess(_0x1fe1cf(0x126)),process[_0x1fe1cf(0x123)](0x0);});}catch(_0x235bbd){logError(_0x2c5da8(0x117)+_0x235bbd[_0x2c5da8(0x129)]),process['exit'](0x1);}}else logInfo('操作已取消'),process[_0x2c5da8(0x123)](0x0);};
|
package/src/rm-rf.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function a8_0x1c56(_0x4f6147,_0x2a4c1c){_0x4f6147=_0x4f6147-0x68;const _0x319bac=a8_0x319b();let _0x1c56f1=_0x319bac[_0x4f6147];return _0x1c56f1;}function a8_0x319b(){const _0x1d7261=['146391hwugya','1673520eWCIHT','exit','exports','resolve','./utils','54gQUNEz','操作已取消','confirm','1076724SMeXCo','13238505yrQifn','删除操作失败:\x20','message','prompt','inquirer','开始执行删除操作...','32785znhDTB','是否确认删除?删除后不可恢复!','3598689YdNluj','2148662vllnLD','所有文件已成功删除','496xObJht'];a8_0x319b=function(){return _0x1d7261;};return a8_0x319b();}const a8_0x4a152f=a8_0x1c56;(function(_0x35ca3a,_0x14545f){const _0x6dd45b=a8_0x1c56,_0x2be6a0=_0x35ca3a();while(!![]){try{const _0xc9494f=-parseInt(_0x6dd45b(0x7b))/0x1+-parseInt(_0x6dd45b(0x77))/0x2+parseInt(_0x6dd45b(0x76))/0x3+-parseInt(_0x6dd45b(0x6d))/0x4+parseInt(_0x6dd45b(0x74))/0x5*(-parseInt(_0x6dd45b(0x6a))/0x6)+parseInt(_0x6dd45b(0x7a))/0x7*(parseInt(_0x6dd45b(0x79))/0x8)+parseInt(_0x6dd45b(0x6e))/0x9;if(_0xc9494f===_0x14545f)break;else _0x2be6a0['push'](_0x2be6a0['shift']());}catch(_0x5d9fa4){_0x2be6a0['push'](_0x2be6a0['shift']());}}}(a8_0x319b,0xd98bd));const path=require('path'),inquirer=require(a8_0x4a152f(0x72)),{logInfo,logSuccess,logError,logWarning,deleteFolderRecursive}=require(a8_0x4a152f(0x69));module[a8_0x4a152f(0x7d)]=async function(){const _0x3ddfde=a8_0x4a152f,_0x49e86d=path[_0x3ddfde(0x68)]('./');logWarning('危险操作:此命令将删除当前目录下的所有文件和文件夹'),logWarning('删除后不可恢复,请谨慎操作');const {confirm:_0x105a0b}=await inquirer[_0x3ddfde(0x71)]([{'type':_0x3ddfde(0x6c),'name':'confirm','message':_0x3ddfde(0x75),'default':![]}]);_0x105a0b?(logInfo('正在扫描目录结构...'),setTimeout(()=>{const _0x367037=_0x3ddfde;try{logInfo(_0x367037(0x73)),deleteFolderRecursive(_0x49e86d),logSuccess(_0x367037(0x78)),process[_0x367037(0x7c)](0x0);}catch(_0x8407b7){logError(_0x367037(0x6f)+_0x8407b7[_0x367037(0x70)]),process[_0x367037(0x7c)](0x1);}},0x3e8)):(logInfo(_0x3ddfde(0x6b)),process[_0x3ddfde(0x7c)](0x0));};
|