simple-skills 1.6.1 → 1.6.3

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 (88) hide show
  1. package/README.md +0 -3
  2. package/package.json +1 -1
  3. package/skills/engineering/README.md +0 -3
  4. package/skills/engineering/ask-route/SKILL.md +1 -1
  5. package/skills/{engineering/canvas-design → taste/taste-canvas-design}/SKILL.md +2 -4
  6. package/skills/engineering/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +0 -93
  7. package/skills/engineering/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  8. package/skills/engineering/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  9. package/skills/engineering/canvas-design/canvas-fonts/BigShoulders-OFL.txt +0 -93
  10. package/skills/engineering/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  11. package/skills/engineering/canvas-design/canvas-fonts/Boldonse-OFL.txt +0 -93
  12. package/skills/engineering/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  13. package/skills/engineering/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  14. package/skills/engineering/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +0 -93
  15. package/skills/engineering/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  16. package/skills/engineering/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  17. package/skills/engineering/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  18. package/skills/engineering/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +0 -93
  19. package/skills/engineering/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  20. package/skills/engineering/canvas-design/canvas-fonts/DMMono-OFL.txt +0 -93
  21. package/skills/engineering/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  22. package/skills/engineering/canvas-design/canvas-fonts/EricaOne-OFL.txt +0 -94
  23. package/skills/engineering/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  24. package/skills/engineering/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  25. package/skills/engineering/canvas-design/canvas-fonts/GeistMono-OFL.txt +0 -93
  26. package/skills/engineering/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  27. package/skills/engineering/canvas-design/canvas-fonts/Gloock-OFL.txt +0 -93
  28. package/skills/engineering/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  29. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  30. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +0 -93
  31. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  32. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  33. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  34. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  35. package/skills/engineering/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  36. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  37. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  38. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  39. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +0 -93
  40. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  41. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  42. package/skills/engineering/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  43. package/skills/engineering/canvas-design/canvas-fonts/Italiana-OFL.txt +0 -93
  44. package/skills/engineering/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  45. package/skills/engineering/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  46. package/skills/engineering/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +0 -93
  47. package/skills/engineering/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  48. package/skills/engineering/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  49. package/skills/engineering/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  50. package/skills/engineering/canvas-design/canvas-fonts/Jura-OFL.txt +0 -93
  51. package/skills/engineering/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +0 -93
  52. package/skills/engineering/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  53. package/skills/engineering/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  54. package/skills/engineering/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  55. package/skills/engineering/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  56. package/skills/engineering/canvas-design/canvas-fonts/Lora-OFL.txt +0 -93
  57. package/skills/engineering/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  58. package/skills/engineering/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  59. package/skills/engineering/canvas-design/canvas-fonts/NationalPark-OFL.txt +0 -93
  60. package/skills/engineering/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  61. package/skills/engineering/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +0 -93
  62. package/skills/engineering/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  63. package/skills/engineering/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  64. package/skills/engineering/canvas-design/canvas-fonts/Outfit-OFL.txt +0 -93
  65. package/skills/engineering/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  66. package/skills/engineering/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  67. package/skills/engineering/canvas-design/canvas-fonts/PixelifySans-OFL.txt +0 -93
  68. package/skills/engineering/canvas-design/canvas-fonts/PoiretOne-OFL.txt +0 -93
  69. package/skills/engineering/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  70. package/skills/engineering/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  71. package/skills/engineering/canvas-design/canvas-fonts/RedHatMono-OFL.txt +0 -93
  72. package/skills/engineering/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  73. package/skills/engineering/canvas-design/canvas-fonts/Silkscreen-OFL.txt +0 -93
  74. package/skills/engineering/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  75. package/skills/engineering/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  76. package/skills/engineering/canvas-design/canvas-fonts/SmoochSans-OFL.txt +0 -93
  77. package/skills/engineering/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  78. package/skills/engineering/canvas-design/canvas-fonts/Tektur-OFL.txt +0 -93
  79. package/skills/engineering/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  80. package/skills/engineering/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  81. package/skills/engineering/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  82. package/skills/engineering/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  83. package/skills/engineering/canvas-design/canvas-fonts/WorkSans-OFL.txt +0 -93
  84. package/skills/engineering/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  85. package/skills/engineering/canvas-design/canvas-fonts/YoungSerif-OFL.txt +0 -93
  86. package/skills/engineering/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  87. package/skills/engineering/chart-generator/SKILL.md +0 -64
  88. package/skills/engineering/finishing-a-development-branch/SKILL.md +0 -180
@@ -1,93 +0,0 @@
1
- Copyright 2019 The Work Sans Project Authors (https://github.com/weiweihuanghuang/Work-Sans)
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- https://openfontlicense.org
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,93 +0,0 @@
1
- Copyright 2023 The Young Serif Project Authors (https://github.com/noirblancrouge/YoungSerif)
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- https://openfontlicense.org
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,64 +0,0 @@
1
- ---
2
- name: chart-generator
3
- description: 按照用户自定义的matplotlib规范和antv MCP工具生成各类可视化图表。使用当用户提到生成图表、柱状图、折线图、饼图、散点图、雷达图、可视化数据时触发。
4
- ---
5
-
6
-
7
- # 图表生成Skill
8
-
9
- ## 适用场景
10
-
11
- 用户需要生成数据可视化图表时自动触发,支持两种生成方式:
12
-
13
- 1. 轻量快速图表:调用antv MCP工具直接生成
14
- 2. 定制化PNG图表:严格按照用户指定的matplotlib规范生成,输出到Downloads目录
15
-
16
- ## 执行流程
17
-
18
- ### Step 1: 确认需求
19
-
20
- 自动收集必要参数,缺失时询问用户:
21
-
22
- - 图表类型(柱状图/折线图/饼图/散点图/雷达图/面积图等)
23
- - 具体数据(包含维度和数值)
24
- - 可选参数:标题、x轴标签、y轴标签、是否堆叠、颜色主题等
25
-
26
- ### Step 2: 选择生成方式
27
-
28
- - 优先用antv MCP工具:适合快速生成、不需要本地文件的场景
29
- - 自动切换matplotlib:用户要求导出PNG、需要定制化样式、antv不支持的图表类型时使用
30
-
31
- ### Step 3: 按规范生成
32
-
33
- #### Matplotlib生成规范(严格执行用户配置)
34
-
35
- 1. 必须使用Agg后端,无GUI模式
36
- 2. 全局字体设置:
37
-
38
- ```python
39
- plt.rcParams['font.sans-serif'] = ['Noto Sans CJK JP']
40
- plt.rcParams['axes.unicode_minus'] = False
41
- ```
42
-
43
- 3. 输出路径固定为`/home/LinXuan/Downloads/图表名.png`,dpi=150
44
- 4. 自动添加紧凑布局:`plt.tight_layout()`
45
-
46
- #### Antv MCP生成规范
47
-
48
- 1. 优先选择对应类型的antv工具调用
49
- 2. 自动补全用户未指定的默认参数(宽高默认600x400,主题默认default)
50
- 3. 生成后直接返回结果给用户
51
-
52
- ### Step 4: 结果反馈
53
-
54
- - Matplotlib生成:告知用户文件保存路径,确认生成成功
55
- - Antv生成:直接展示生成的图表结果
56
-
57
- ## 触发关键词
58
-
59
- 生成图表、画个图、柱状图、折线图、饼图、散点图、雷达图、面积图、数据可视化、matplotlib画图、antv图表
60
-
61
- ## 禁止场景
62
-
63
- - 非图表生成类请求
64
- - 要求生成Excel/Word等非可视化格式的请求
@@ -1,180 +0,0 @@
1
- ---
2
- name: finishing-a-development-branch
3
- description: 当实现完成、所有测试通过、需要决定如何集成这份工作时使用
4
- ---
5
-
6
- # 收尾一个开发分支
7
-
8
- ## 概述
9
-
10
- **核心原则:** 验证测试 → 检测环境 → 展示选项 → 执行选择 → 清理。
11
-
12
- **开始时宣告:** "我正在使用 finishing-a-development-branch 技能来收尾这份工作。"
13
-
14
- ## 步骤 1:验证测试
15
-
16
- 运行项目的完整测试套件(`npm test` / `cargo test` / `pytest` / `go test ./...`)。
17
-
18
- **如果测试失败**,报告失败并停下——菜单是在测试全绿之后才出现的:
19
-
20
- ```
21
- 测试失败(<N> 个)。完成之前必须先修:
22
-
23
- [展示失败详情]
24
- ```
25
-
26
- **如果测试通过:** 继续步骤 2。
27
-
28
- ## 步骤 2:检测环境
29
-
30
- ```bash
31
- GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
32
- GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
33
- # 现在就捕获 —— 此刻还在工作区里面。步骤 5 会切换目录,
34
- # 而清理(步骤 6)需要这个值
35
- WORKTREE_PATH=$(git rev-parse --show-toplevel)
36
- ```
37
-
38
- 这决定了展示哪种菜单、以及清理方式:
39
-
40
- | 状态 | 菜单 | 清理 |
41
- |------|------|------|
42
- | `GIT_DIR == GIT_COMMON`(普通仓库) | 标准 3 个选项 | 无 worktree 可清理 |
43
- | `GIT_DIR != GIT_COMMON`,命名分支 | 标准 3 个选项 | 按来源判断(见步骤 6) |
44
- | `GIT_DIR != GIT_COMMON`,分离 HEAD | 收敛为 2 个选项(不含合并) | 由外部管理——原地别动 |
45
-
46
- ## 步骤 3:确定基础分支
47
-
48
- 基础分支就是这份工作从哪儿分出来的那个——通常在计划里、对话里,或者分支的 upstream 里已经写明了。如果还不知道,就问:"这个分支是从 <你的最佳猜测> 分出来的,对吗?"**合并之前先确认:合并到错误的基础分支,代价很高。**
49
-
50
- ## 步骤 4:展示选项
51
-
52
- **普通仓库和命名分支 worktree——精确展示这 3 个选项:**
53
-
54
- ```
55
- 实现已完成。你想怎么做?
56
-
57
- 1. 本地合并回 <base-branch>
58
- 2. 推送并创建 Pull Request
59
- 3. 保留分支不动(我稍后自己处理)
60
-
61
- 选哪个?
62
- ```
63
-
64
- **分离 HEAD——精确展示这 2 个选项:**
65
-
66
- ```
67
- 实现已完成。你当前处于分离 HEAD(由外部管理的工作区)。
68
-
69
- 1. 作为新分支推送并创建 Pull Request
70
- 2. 保持原样(我稍后自己处理)
71
-
72
- 选哪个?
73
- ```
74
-
75
- **照原文展示菜单**——简洁,每个选项都来自上面的列表。丢弃仅在明确要求时发生(见下)。等他们回答;集成与否是他们的决定。
76
-
77
- ## 步骤 5:执行选择
78
-
79
- **选项 1 和丢弃路径都先切到主仓库根目录:**
80
-
81
- ```bash
82
- # 切到主仓库根目录,保证 CWD 安全
83
- MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
84
- cd "$MAIN_ROOT"
85
- ```
86
-
87
- ### 选项 1:本地合并
88
-
89
- ```bash
90
- # 先合并 —— 在删除任何东西之前先验证合并成功
91
- git checkout <base-branch>
92
- git pull
93
- git merge <feature-branch>
94
-
95
- # 在合并结果上验证测试
96
- <测试命令>
97
- ```
98
-
99
- 如果测试在**合并结果**上失败:停下,把 worktree 和分支原地留着,去排查——什么都还没推送,所以这次合并是本地的、可恢复的。
100
-
101
- 一旦合并结果全绿:清理 worktree(步骤 6),然后删除分支:
102
-
103
- ```bash
104
- git branch -d <feature-branch>
105
- ```
106
-
107
- ### 选项 2:推送并创建 PR
108
-
109
- ```bash
110
- git push -u origin <feature-branch>
111
- # 从分离 HEAD 出发时,在远端指定新分支名:
112
- # git push origin HEAD:refs/heads/<new-branch>
113
- ```
114
-
115
- 然后用**代码托管平台**(forge)的工具针对 <base-branch> 创建 pull/merge request——有 CLI 就用它,没有就用推送时大多数平台会打印出来的创建 URL——遵循仓库里已有的 PR 模板与约定(如果有),并把 URL 报告给你的人类伙伴。
116
-
117
- **保留 worktree**——你的人类伙伴要在那里根据 PR 反馈继续迭代。
118
-
119
- ### 选项 3:保持原样
120
-
121
- 报告:"保留分支 <name>。工作树保留在 <path>。"
122
-
123
- ### 如果你的人类伙伴要求丢弃这份工作
124
-
125
- 先确认:
126
-
127
- ```
128
- 这将永久删除:
129
- - 分支 <name>
130
- - 所有 commit:<commit 列表>
131
- - 位于 <path> 的工作树
132
-
133
- 输入 'discard' 以确认。
134
- ```
135
-
136
- 等待**这个精确的**确认词。收到之后,切到主仓库根目录(步骤 5 开头那段),然后清理 worktree(步骤 6),再强制删除分支:
137
-
138
- ```bash
139
- git branch -D <feature-branch>
140
- ```
141
-
142
- ## 步骤 6:清理工作区
143
-
144
- **只对选项 1 和已确认的丢弃执行。** 选项 2 和 3 始终保留 worktree。两个调用方都已经切到主仓库根目录了——移除 worktree 必须从 worktree 外面执行——因此这里使用**步骤 2 里捕获的** `GIT_DIR` / `GIT_COMMON` / `WORKTREE_PATH`,也就是那次目录切换之前的值。
145
-
146
- > ⚠️ **不要在这里重新计算这些值。** 此刻 `git rev-parse --show-toplevel` 返回的是主仓库根目录,不是 worktree 路径 —— 溯源判断会永远匹配不上,清理会静默空转,随后分支删除还会因为 worktree 仍挂着而失败。
147
-
148
- **如果 `GIT_DIR == GIT_COMMON`:** 普通仓库,无 worktree 可清理。结束。
149
-
150
- **如果 `WORKTREE_PATH` 在 `.worktrees/` 或 `worktrees/` 之下:** 这是 AI Agent 创建的 worktree——我们负责清理:
151
-
152
- ```bash
153
- git worktree remove "$WORKTREE_PATH"
154
- git worktree prune # 自愈:清理任何过期的注册记录
155
- ```
156
-
157
- **否则:** 这个工作区归宿主环境所有——原地别动。如果你的平台提供了工作区退出工具,用它。
158
-
159
- ## 快速参考
160
-
161
- | 选项 | 合并 | 推送 | 保留工作树 | 清理分支 |
162
- |------|------|------|-----------|---------|
163
- | 1. 本地合并 | 是 | - | - | 是 |
164
- | 2. 创建 PR | - | 是 | 是 | - |
165
- | 3. 保持原样 | - | - | 是 | - |
166
- | 丢弃(仅在明确要求时) | - | - | - | 是(强制) |
167
-
168
- ## 常见的合理化借口
169
-
170
- | 借口 | 现实 |
171
- |------|------|
172
- | "测试这个会话早先通过过" | 在**你即将集成的那棵树上**跑测试套件。一次绿色运行只能证明它当时跑的那棵树。 |
173
- | "他们显然是想合并的" | 集成是你人类伙伴的决定。把菜单摆出来,然后等。 |
174
- | "他们看起来对这个功能收工了——我提议丢弃吧" | 菜单照原文,不多不少。丢弃仅在明确要求时发生。 |
175
- | "'嗯,删掉吧'算确认了" | 只有输入 `discard` 才授权删除。 |
176
- | "PR 已经开了,worktree 现在是碍事的垃圾" | PR 反馈要在那个 worktree 里修。它得留到工作落地为止。 |
177
- | "另外那个 worktree 看着像过期的——我顺手也清了" | 只清理 `.worktrees/` / `worktrees/` 下的 worktree,其余属宿主环境。 |
178
- | "合并结果的失败大概是偶发的" | 合并结果失败即停下;排查期间分支与 worktree 原地不动。 |
179
- | "基础分支明显就是 main" | 确认分叉点,或者直接问。合并到错误的基础分支,代价很高。 |
180
- | "推送被拒了——force-push 一下就好" | 推送被拒意味着远端动过了。去排查;只有在你人类伙伴明确要求时才 force-push。 |