@zjex/git-workflow 0.2.23 → 0.3.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/.github/workflows/deploy-docs.yml +68 -0
- package/.github/workflows/test.yml +53 -0
- package/.husky/pre-commit +19 -0
- package/README.md +74 -1013
- package/TESTING.md +436 -0
- package/dist/index.js +104 -14
- package/docs/.vitepress/cache/deps/_metadata.json +52 -0
- package/docs/.vitepress/cache/deps/chunk-2CLQ7TTZ.js +9719 -0
- package/docs/.vitepress/cache/deps/chunk-2CLQ7TTZ.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-LE5NDSFD.js +12824 -0
- package/docs/.vitepress/cache/deps/chunk-LE5NDSFD.js.map +7 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4505 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1352 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1813 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +347 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-2CLQ7TTZ.js +9719 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-2CLQ7TTZ.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-LE5NDSFD.js +12824 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/chunk-LE5NDSFD.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/package.json +3 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vue_devtools-api.js +4505 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_core.js +583 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_integrations_useFocusTrap.js +1352 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___mark__js_src_vanilla__js.js +1665 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___minisearch.js +1813 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vitepress___minisearch.js.map +7 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vue.js +347 -0
- package/docs/.vitepress/cache/deps_temp_44e2fb0f/vue.js.map +7 -0
- package/docs/.vitepress/config.ts +167 -0
- package/docs/.vitepress/theme/custom.css +39 -0
- package/docs/.vitepress/theme/index.ts +4 -0
- package/docs/README.md +82 -0
- package/docs/commands/branch.md +468 -0
- package/docs/commands/commit.md +554 -0
- package/docs/commands/config.md +346 -0
- package/docs/commands/index.md +312 -0
- package/docs/commands/interactive.md +384 -0
- package/docs/commands/release.md +300 -0
- package/docs/commands/stash.md +309 -0
- package/docs/commands/tag.md +278 -0
- package/docs/commands/update.md +347 -0
- package/docs/config/ai-config.md +160 -0
- package/docs/config/branch-config.md +133 -0
- package/docs/config/commit-config.md +185 -0
- package/docs/config/config-file.md +776 -0
- package/docs/config/examples.md +279 -0
- package/docs/config/index.md +478 -0
- package/docs/guide/ai-commit.md +576 -0
- package/docs/guide/basic-usage.md +522 -0
- package/docs/guide/best-practices.md +426 -0
- package/docs/guide/branch-management.md +712 -0
- package/docs/guide/getting-started.md +294 -0
- package/docs/guide/index.md +168 -0
- package/docs/guide/installation.md +449 -0
- package/docs/guide/release-management.md +744 -0
- package/docs/guide/stash-management.md +608 -0
- package/docs/guide/tag-management.md +614 -0
- package/docs/index.md +205 -0
- package/docs/public/favicon.svg +21 -0
- package/docs/public/hero-logo.svg +43 -0
- package/docs/public/logo.svg +20 -0
- package/package.json +19 -3
- package/scripts/publish.js +55 -8
- package/scripts/publish.sh +20 -2
- package/scripts/release.sh +20 -2
- package/scripts/update-test-count.js +55 -0
- package/src/ai-service.ts +101 -15
- package/src/commands/init.ts +18 -0
- package/src/commands/tag.ts +1 -1
- package/src/config.ts +1 -0
- package/tests/COVERAGE_REPORT.md +222 -0
- package/tests/QUICK_START.md +242 -0
- package/tests/README.md +119 -0
- package/tests/TEST_SUMMARY.md +330 -0
- package/tests/ai-service.test.ts +705 -0
- package/tests/branch.test.ts +255 -0
- package/tests/commit.test.ts +85 -0
- package/tests/config.test.ts +311 -0
- package/tests/help.test.ts +134 -0
- package/tests/init.test.ts +582 -0
- package/tests/release.test.ts +333 -0
- package/tests/setup.ts +21 -0
- package/tests/stash.test.ts +376 -0
- package/tests/tag.test.ts +396 -0
- package/tests/update-notifier.test.ts +384 -0
- package/tests/update.test.ts +402 -0
- package/tests/utils.test.ts +229 -0
- package/vitest.config.ts +22 -0
- package/zjex-logo.svg +22 -0
- package/zjex-optimized.svg +34 -0
- package/zjex.svg +1 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { showHelp } from "../src/commands/help.js";
|
|
3
|
+
import { TODAY } from "../src/utils.js";
|
|
4
|
+
|
|
5
|
+
describe("Help 模块测试", () => {
|
|
6
|
+
describe("showHelp 函数", () => {
|
|
7
|
+
it("应该返回完整的帮助信息", () => {
|
|
8
|
+
const helpText = showHelp();
|
|
9
|
+
|
|
10
|
+
expect(helpText).toContain("分支命令:");
|
|
11
|
+
expect(helpText).toContain("Tag 命令:");
|
|
12
|
+
expect(helpText).toContain("发布命令:");
|
|
13
|
+
expect(helpText).toContain("配置命令:");
|
|
14
|
+
expect(helpText).toContain("更新命令:");
|
|
15
|
+
expect(helpText).toContain("清理命令:");
|
|
16
|
+
expect(helpText).toContain("Stash 命令:");
|
|
17
|
+
expect(helpText).toContain("Commit 命令:");
|
|
18
|
+
expect(helpText).toContain("示例:");
|
|
19
|
+
expect(helpText).toContain("分支命名格式:");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("应该包含所有主要命令", () => {
|
|
23
|
+
const helpText = showHelp();
|
|
24
|
+
|
|
25
|
+
// 分支命令
|
|
26
|
+
expect(helpText).toContain("gw feature");
|
|
27
|
+
expect(helpText).toContain("gw feat");
|
|
28
|
+
expect(helpText).toContain("gw f");
|
|
29
|
+
expect(helpText).toContain("gw hotfix");
|
|
30
|
+
expect(helpText).toContain("gw fix");
|
|
31
|
+
expect(helpText).toContain("gw h");
|
|
32
|
+
expect(helpText).toContain("gw delete");
|
|
33
|
+
expect(helpText).toContain("gw del");
|
|
34
|
+
expect(helpText).toContain("gw d");
|
|
35
|
+
|
|
36
|
+
// Tag 命令
|
|
37
|
+
expect(helpText).toContain("gw tags");
|
|
38
|
+
expect(helpText).toContain("gw ts");
|
|
39
|
+
expect(helpText).toContain("gw tag");
|
|
40
|
+
expect(helpText).toContain("gw t");
|
|
41
|
+
expect(helpText).toContain("gw tag:delete");
|
|
42
|
+
expect(helpText).toContain("gw td");
|
|
43
|
+
expect(helpText).toContain("gw tag:update");
|
|
44
|
+
expect(helpText).toContain("gw tu");
|
|
45
|
+
|
|
46
|
+
// 其他命令
|
|
47
|
+
expect(helpText).toContain("gw release");
|
|
48
|
+
expect(helpText).toContain("gw r");
|
|
49
|
+
expect(helpText).toContain("gw init");
|
|
50
|
+
expect(helpText).toContain("gw update");
|
|
51
|
+
expect(helpText).toContain("gw upt");
|
|
52
|
+
expect(helpText).toContain("gw clean");
|
|
53
|
+
expect(helpText).toContain("gw stash");
|
|
54
|
+
expect(helpText).toContain("gw s");
|
|
55
|
+
expect(helpText).toContain("gw st");
|
|
56
|
+
expect(helpText).toContain("gw commit");
|
|
57
|
+
expect(helpText).toContain("gw c");
|
|
58
|
+
expect(helpText).toContain("gw cm");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("应该包含命令描述", () => {
|
|
62
|
+
const helpText = showHelp();
|
|
63
|
+
|
|
64
|
+
expect(helpText).toContain("创建 feature 分支");
|
|
65
|
+
expect(helpText).toContain("创建 hotfix 分支");
|
|
66
|
+
expect(helpText).toContain("删除本地/远程分支");
|
|
67
|
+
expect(helpText).toContain("列出所有 tag");
|
|
68
|
+
expect(helpText).toContain("交互式选择版本类型并创建 tag");
|
|
69
|
+
expect(helpText).toContain("删除 tag");
|
|
70
|
+
expect(helpText).toContain("重命名 tag");
|
|
71
|
+
expect(helpText).toContain("交互式选择版本号并更新 package.json");
|
|
72
|
+
expect(helpText).toContain("初始化配置文件");
|
|
73
|
+
expect(helpText).toContain("检查并更新到最新版本");
|
|
74
|
+
expect(helpText).toContain("清理缓存文件");
|
|
75
|
+
expect(helpText).toContain("交互式管理 stash");
|
|
76
|
+
expect(helpText).toContain("交互式提交");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("应该包含使用示例", () => {
|
|
80
|
+
const helpText = showHelp();
|
|
81
|
+
|
|
82
|
+
expect(helpText).toContain("gw f --base develop");
|
|
83
|
+
expect(helpText).toContain("gw h --base release");
|
|
84
|
+
expect(helpText).toContain("gw d feature/xxx");
|
|
85
|
+
expect(helpText).toContain("gw ts v");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("应该包含分支命名格式说明", () => {
|
|
89
|
+
const helpText = showHelp();
|
|
90
|
+
|
|
91
|
+
expect(helpText).toContain("feature/20260111-<Story ID>-<描述>");
|
|
92
|
+
expect(helpText).toContain("hotfix/20260111-<Issue ID>-<描述>");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("应该包含配置文件说明", () => {
|
|
96
|
+
const helpText = showHelp();
|
|
97
|
+
|
|
98
|
+
expect(helpText).toContain("全局配置: ~/.gwrc.json");
|
|
99
|
+
expect(helpText).toContain("项目配置: .gwrc.json");
|
|
100
|
+
expect(helpText).toContain("所有项目生效");
|
|
101
|
+
expect(helpText).toContain("仅当前项目");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("应该包含别名说明", () => {
|
|
105
|
+
const helpText = showHelp();
|
|
106
|
+
|
|
107
|
+
expect(helpText).toContain("同上 (别名)");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("应该包含参数说明", () => {
|
|
111
|
+
const helpText = showHelp();
|
|
112
|
+
|
|
113
|
+
expect(helpText).toContain("[--base <branch>]");
|
|
114
|
+
expect(helpText).toContain("[branch]");
|
|
115
|
+
expect(helpText).toContain("[prefix]");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("应该是非空字符串", () => {
|
|
119
|
+
const helpText = showHelp();
|
|
120
|
+
|
|
121
|
+
expect(typeof helpText).toBe("string");
|
|
122
|
+
expect(helpText.length).toBeGreaterThan(0);
|
|
123
|
+
expect(helpText.trim().length).toBeGreaterThan(0);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("应该包含实际的日期格式", () => {
|
|
127
|
+
const helpText = showHelp();
|
|
128
|
+
|
|
129
|
+
// 检查是否包含实际的日期格式(YYYYMMDD)
|
|
130
|
+
expect(helpText).toMatch(/feature\/\d{8}-<Story ID>-<描述>/);
|
|
131
|
+
expect(helpText).toMatch(/hotfix\/\d{8}-<Issue ID>-<描述>/);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|