jjb-cmd 2.5.4 → 2.5.6

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/bin/command.js CHANGED
@@ -23,7 +23,7 @@ commander.command('help').description('-- 帮助').action(() => {
23
23
  console.log('jjb-cmd publish <version> 发布云组件\n\targ1 <version> 发布版本,可设置为latest');
24
24
  console.log('jjb-cmd auth 登录授权(交互式输入用户名和密码)');
25
25
  console.log('jjb-cmd push java 推送微应用到服务器');
26
- console.log('jjb-cmd ai-pull 拉取 AI 配置文件和规则');
26
+ console.log('jjb-cmd ai-pull [branch] 拉取 AI 配置文件和规则\n\targ1 <branch> 指定分支/标签,默认为 v_1.0.0');
27
27
  });
28
28
 
29
29
  // 命令
@@ -62,8 +62,8 @@ commander.command('rm-rf').description('-- 删除全部').action(async () => {
62
62
  });
63
63
 
64
64
  // ai-pull 命令
65
- commander.command('ai-pull').description('-- 拉取 AI 配置文件和规则').action(() => {
66
- require('../src/ai-pull.js')();
65
+ commander.command('ai-pull [branch]').description('-- 拉取 AI 配置文件和规则').action((branch) => {
66
+ require('../src/ai-pull.js')(branch);
67
67
  });
68
68
 
69
69
  commander.parse(process.argv);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "env": "prod",
5
5
  "httpMethod": "http",
6
6
  "pushMessage": "yes",
7
- "version": "2.5.4",
7
+ "version": "2.5.6",
8
8
  "description": "jjb-cmd命令行工具",
9
9
  "main": "index.js",
10
10
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  "@babel/preset-react": "^7.18.6",
26
26
  "@babel/preset-typescript": "^7.23.2",
27
27
  "@babel/traverse": "^7.25.9",
28
- "@cqsjjb/react-code-optimization": "^0.0.2",
28
+ "@cqsjjb/react-code-optimization": "latest",
29
29
  "axios": "^1.1.3",
30
30
  "better-sqlite3": "^12.6.2",
31
31
  "chalk": "2.4.0",
package/src/ai-pull.js CHANGED
@@ -17,8 +17,8 @@ const CURSOR_DB_PATH = path.join(
17
17
 
18
18
  // Git 仓库地址
19
19
  const AI_REPO_URL = 'http://192.168.1.242:10985/root/jjb-ai.git';
20
- // Git 分支/标签
21
- const AI_REPO_BRANCH = 'v_1.0.0';
20
+ // Git 分支/标签(默认值)
21
+ const DEFAULT_BRANCH = 'v_1.0.0';
22
22
 
23
23
  /**
24
24
  * 删除目录(回调方式,使用递归删除)
@@ -217,25 +217,29 @@ function copyFileWithRetry(srcPath, tarPath, retries, callback) {
217
217
  rs.pipe(ws);
218
218
  }
219
219
 
220
- module.exports = () => {
220
+ module.exports = (branch) => {
221
221
  const root_path = path.resolve('./');
222
222
  const tmpDir = os.tmpdir();
223
223
  const cloneDir = path.join(tmpDir, 'jjb-ai-temp');
224
+
225
+ // 使用传入的分支参数,如果没有则使用默认值
226
+ const targetBranch = branch || DEFAULT_BRANCH;
224
227
 
225
228
  console.log('【jjb-cmd ai-pull】:开始执行...');
229
+ console.log(`【分支】:${targetBranch}`);
226
230
 
227
231
  // 步骤1: 拉取或更新仓库代码
228
- console.log('步骤1: 正在拉取 jjb-ai 仓库代码...');
232
+ console.log(`步骤1: 正在拉取 jjb-ai 仓库代码(分支: ${targetBranch})...`);
229
233
 
230
234
  // 如果临时目录已存在,先删除
231
235
  deleteDir(cloneDir, () => {
232
236
  try {
233
237
  // 克隆仓库指定分支/标签
234
- child_process.execSync(`git clone -b ${AI_REPO_BRANCH} ${AI_REPO_URL} "${cloneDir}"`, {
238
+ child_process.execSync(`git clone -b ${targetBranch} ${AI_REPO_URL} "${cloneDir}"`, {
235
239
  stdio: 'inherit',
236
240
  cwd: tmpDir
237
241
  });
238
- console.log('✓ 仓库代码拉取成功');
242
+ console.log(`✓ 仓库代码拉取成功(分支: ${targetBranch})`);
239
243
 
240
244
  // 步骤2: 复制 .ai 文件夹到当前项目
241
245
  console.log('步骤2: 正在复制 .ai 文件夹...');