@zjex/git-workflow 0.4.7 → 0.5.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +44 -6
  3. package/dist/index.js +614 -11
  4. package/docs/.vitepress/cache/deps/_metadata.json +10 -10
  5. package/docs/.vitepress/config.ts +2 -0
  6. package/docs/commands/index.md +4 -0
  7. package/docs/commands/review.md +142 -0
  8. package/docs/guide/ai-review.md +159 -0
  9. package/docs/guide/index.md +2 -0
  10. package/docs/index.md +26 -3
  11. package/package.json +1 -1
  12. package/src/commands/review.ts +759 -0
  13. package/src/index.ts +29 -1
  14. package/tests/review.test.ts +1058 -0
  15. package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-2CLQ7TTZ.js +0 -9719
  16. package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-2CLQ7TTZ.js.map +0 -7
  17. package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-LE5NDSFD.js +0 -12824
  18. package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-LE5NDSFD.js.map +0 -7
  19. package/docs/.vitepress/cache/deps_temp_44e2fb0f/package.json +0 -3
  20. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vue_devtools-api.js +0 -4505
  21. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vue_devtools-api.js.map +0 -7
  22. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_core.js +0 -583
  23. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_core.js.map +0 -7
  24. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_integrations_useFocusTrap.js +0 -1352
  25. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_integrations_useFocusTrap.js.map +0 -7
  26. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___mark__js_src_vanilla__js.js +0 -1665
  27. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___mark__js_src_vanilla__js.js.map +0 -7
  28. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___minisearch.js +0 -1813
  29. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___minisearch.js.map +0 -7
  30. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vue.js +0 -347
  31. package/docs/.vitepress/cache/deps_temp_44e2fb0f/vue.js.map +0 -7
package/src/index.ts CHANGED
@@ -31,6 +31,7 @@ import { update } from "./commands/update.js";
31
31
  import { log, quickLog } from "./commands/log.js";
32
32
  import { amendDate } from "./commands/amend-date.js";
33
33
  import { amend } from "./commands/amend.js";
34
+ import { review } from "./commands/review.js";
34
35
 
35
36
  // ========== 全局错误处理 ==========
36
37
 
@@ -171,7 +172,11 @@ async function mainMenu(): Promise<void> {
171
172
  value: "amend",
172
173
  },
173
174
  {
174
- name: `[e] ⚙️ 初始化配置 ${colors.dim("gw init")}`,
175
+ name: `[e] 🔍 AI 代码审查 ${colors.dim("gw review")}`,
176
+ value: "review",
177
+ },
178
+ {
179
+ name: `[f] ⚙️ 初始化配置 ${colors.dim("gw init")}`,
175
180
  value: "init",
176
181
  },
177
182
  { name: "[0] ❓ 帮助", value: "help" },
@@ -233,6 +238,10 @@ async function mainMenu(): Promise<void> {
233
238
  checkGitRepo();
234
239
  await amend();
235
240
  break;
241
+ case "review":
242
+ checkGitRepo();
243
+ await review();
244
+ break;
236
245
  case "init":
237
246
  await init();
238
247
  break;
@@ -413,6 +422,25 @@ cli
413
422
  return amend(hash);
414
423
  });
415
424
 
425
+ cli
426
+ .command("review [...hashes]", "AI 代码审查")
427
+ .alias("rw")
428
+ .option("-n, --last <number>", "审查最近 N 个 commits")
429
+ .option("-s, --staged", "审查暂存区的更改")
430
+ .option("-o, --output <path>", "指定输出文件路径")
431
+ .action(async (hashes: string[], options: any) => {
432
+ await checkForUpdates(version, "@zjex/git-workflow");
433
+ checkGitRepo();
434
+ return review(
435
+ hashes.length > 0 ? hashes : undefined,
436
+ {
437
+ last: options.last ? parseInt(options.last) : undefined,
438
+ staged: options.staged,
439
+ output: options.output,
440
+ }
441
+ );
442
+ });
443
+
416
444
  cli
417
445
  .command("clean", "清理缓存和临时文件")
418
446
  .alias("cc")