@civilization/dsh-git-workbench 0.0.0-stage → 0.4.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,120 @@
1
- # Temporary Holding Version
1
+ # @civilization/dsh-git-workbench
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **IntelliJ IDEA 级别的专业 Git 版本控制工作台插件,专为 DeepSeek Harness (DSH) 打造。**
4
+
5
+ 本插件为 DeepSeek Harness 提供了媲美 IntelliJ IDEA / VS Code 的全套 Git 工程化版本控制能力,包括 **DAG 拓扑提交图谱**、**多分支合并轨道渲染**、**工作区变动检查与暂存提交**、**底部分支快速切换胶囊**、**全量标签管理与 DAG 视图定位**、**彩色代码差异对比**,以及供 AI Agent 自主调用的 **Git 原生模型工具集**。
6
+
7
+ > **说明**:本插件已实现完全独立化拆分,**严格仅依赖官方公开 API 组件**(`@deepseek-ai/cordis`, `@deepseek-ai/schemastery`, `@deepseek-ai/dsh-tools` 及 React 18),**没有任何私有组件库或单体仓库内部包的依赖**,可在官方纯净版 DeepSeek Harness 环境中直接安装使用。
8
+
9
+ ---
10
+
11
+ ## 🌟 核心特性
12
+
13
+ ### 1. 🌲 IntelliJ IDEA 级 DAG 提交拓扑树与轨道图
14
+ - **多泳道动态压缩算法**:根据提交历史(`git log --parents`)精确计算并排分支泳道,支持主线、特性分支、热修复分支与合并分支。
15
+ - **平滑贝塞尔曲线连线**:基于 SVG 实时渲染分支分叉与合并连接线,采用 IntelliJ 调色板渲染多彩轨道。
16
+ - **提交引用徽章**:直接在提交节点旁渲染带颜色与边框的 `HEAD`、当前分支(高亮绿)、本地分支(蓝)、远程分支(紫)与发布标签(橙)。
17
+ - **Conventional Commits 智能解析**:自动解析 `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore` 等类型前缀,渲染高对比度彩色胶囊。
18
+ - **主线筛选与全文过滤**:支持「全部 / 仅主线」切换,并提供按 Commit Hash、提交信息、作者名字的即时高亮检索。
19
+
20
+ ### 2. 🗂️ 工作区代码改动(Changes)与快捷提交控制台
21
+ - **三态工作区树形/扁平分类**:
22
+ - **已暂存改动 (Staged Changes)**
23
+ - **未暂存改动 (Changes)**
24
+ - **未追踪文件 (Untracked Files)**
25
+ - **快速动作支持**:单文件/批量一键 Stage、Unstage、丢弃更改(Discard)、全选暂存。
26
+ - **快捷提交控制台 (Commit Console)**:
27
+ - 内置提交说明输入框,支持 `Ctrl+Enter` 快速提交;
28
+ - 顶部集成常见 Conventional Commits 前缀快捷插入芯片(`feat:`, `fix:`, `docs:`, `refactor:`, `chore:`)。
29
+ - **实时同步工具栏**:支持一键 `Fetch`、`Pull`、`Push` 与 `Refresh`。
30
+
31
+ ### 3. 🏷️ 全量标签管理器(Tags)与 DAG 拓扑精确定位
32
+ - **完整标签视图**:展示仓库所有 Tag 列表,包含短哈希、提交日期、相对时间、打标作者与附注说明(Annotated Message)。
33
+ - **标签创建与删除**:支持创建轻量标签(Lightweight)或带说明的附注标签(Annotated),支持为指定 Commit 打标。
34
+ - **一键精确定位与视口居中**:在标签列表中点击「在拓扑树中定位」图标,自动切换到提交图谱视图,精确定位至对应 Commit 节点并带有呼吸光晕高亮与平滑滚动居中。
35
+
36
+ ### 4. 🔀 状态栏底部分支切换胶囊(Composer Dock Pill)
37
+ - 注入官方对话框底部的 Composer Dock 状态栏(顺序优先);
38
+ - 实时展示当前所在分支与远程追踪状态(`↑ahead` 本地领先 / `↓behind` 落后远程);
39
+ - 点击弹出类似 VS Code / IDEA 的分支浮层面板,支持分支即时过滤、快捷切换(Checkout)、创建新分支(`git checkout -b`)与快捷 Pull / Push。
40
+
41
+ ### 5. 🔍 彩色代码差异对比查看器(Unified Diff)
42
+ - 点击工作区任意改动文件或 DAG 拓扑图中的任意提交,右侧立即展开对应代码差异;
43
+ - 增删行彩色对比高亮(绿色背景新增、红色背景删除、淡紫色块头范围定位)。
44
+
45
+ ### 6. 🤖 AI Agent 原生感知与控制模型工具集
46
+ 插件自动向模型注入以下标准 Tools:
47
+ - `git_view`:自主查询状态、提交图谱、分支列表、差异内容与标签列表。
48
+ - `git_checkout`:自主切换分支或创建检出新分支。
49
+ - `git_tag`:自主创建版本标签或清理临时标签。
50
+
51
+ ---
52
+
53
+ ## 🏗️ 架构与技术实现
54
+
55
+ - **独立双端输出**:
56
+ - **Host Node 端** (`lib/index.js`):采用标准 Cordis ESM 插件规范,注册 `/git` 安全 RPC 拦截器与 Agent 工具。
57
+ - **Client Browser 端** (`lib/client.js`):打包为自包含的浏览器端模块,遵循 `window.__ModuleLoader__.load({ id: '@civilization/dsh-git-workbench', factory: ... })` 协议。
58
+ - **自包含样式编译**:利用 `lightningcss` 在构建期将 CSS Modules 直接转译并内联在 Client bundle 中,载入时自动注入 `<style data-plugin="@civilization/dsh-git-workbench">`,无需宿主额外加载外部 CSS。
59
+ - **公共依赖**:
60
+ - `@deepseek-ai/cordis`: `^4.0.0`
61
+ - `@deepseek-ai/dsh-tools`: `^0.2.0`
62
+ - `@deepseek-ai/schemastery`: `^3.18.5`
63
+ - `react`: `^18.0.0`
64
+
65
+ ---
66
+
67
+ ## 📥 安装与使用指南
68
+
69
+ ### 1. 安装依赖
70
+
71
+ 在官方 DeepSeek Harness 运行时环境或项目中安装:
72
+
73
+ ```bash
74
+ pnpm add @civilization/dsh-git-workbench
75
+ ```
76
+
77
+ ### 2. 在 `cordis.yml` 中启用插件
78
+
79
+ 编辑运行配置文件 `cordis.yml`(或通过 `cordis.patch.yml`):
80
+
81
+ ```yaml
82
+ plugins:
83
+ - name: "@civilization/dsh-git-workbench"
84
+ ```
85
+
86
+ 启动 DeepSeek Harness 后,右侧栏将出现专属的 **Git** 图标标签页,底部状态栏将展示实时的分支胶囊。
87
+
88
+ ---
89
+
90
+ ## ⌨️ 快捷键
91
+
92
+ - `Ctrl + Shift + G`(Windows / Linux)或 `Cmd + Shift + G`(macOS):一键呼出并聚焦右侧 Git 工作台。
93
+ - `Ctrl + Enter`:在提交信息框中一键触发提交。
94
+
95
+ ---
96
+
97
+ ## 🛠️ 本地开发与测试
98
+
99
+ ```bash
100
+ # 进入插件目录
101
+ cd D:\project\dsh-plugins\dsh-git-workbench
102
+
103
+ # 安装依赖
104
+ pnpm install
105
+
106
+ # 静态类型检查
107
+ pnpm run typecheck
108
+
109
+ # 单元测试(基于 Vitest)
110
+ pnpm run test
111
+
112
+ # 生产环境打包构建
113
+ pnpm run build
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 📄 开源许可证
119
+
120
+ 本项目基于 [Apache-2.0](./LICENSE) 协议开源。
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: '@civilization/dsh-git-workbench'
3
+ name: '@civilization/dsh-git-workbench'
package/icon.svg ADDED
@@ -0,0 +1,26 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <linearGradient id="git-line-grad" x1="10" y1="8" x2="26" y2="28" gradientUnits="userSpaceOnUse">
4
+ <stop stop-color="#F05133" />
5
+ <stop offset="1" stop-color="#E24329" />
6
+ </linearGradient>
7
+ <linearGradient id="git-node-main" x1="8" y1="8" x2="16" y2="16" gradientUnits="userSpaceOnUse">
8
+ <stop stop-color="#FF7A60" />
9
+ <stop offset="1" stop-color="#F05133" />
10
+ </linearGradient>
11
+ <linearGradient id="git-node-branch" x1="20" y1="12" x2="28" y2="20" gradientUnits="userSpaceOnUse">
12
+ <stop stop-color="#4E95FF" />
13
+ <stop offset="1" stop-color="#2D72D9" />
14
+ </linearGradient>
15
+ </defs>
16
+ <!-- Main commit trunk line -->
17
+ <line x1="12" y1="10" x2="12" y2="26" stroke="url(#git-line-grad)" stroke-width="2.5" stroke-linecap="round" />
18
+ <!-- Branch fork curve -->
19
+ <path d="M12 21C12 18 15 15 18 15H22C23.5 15 24 14.5 24 13V12" stroke="url(#git-line-grad)" stroke-width="2.5" stroke-linecap="round" fill="none" />
20
+ <!-- Lower root node -->
21
+ <circle cx="12" cy="25" r="3.5" fill="#FFFFFF" stroke="url(#git-node-main)" stroke-width="2.5" />
22
+ <!-- Upper main node -->
23
+ <circle cx="12" cy="10" r="3.5" fill="#FFFFFF" stroke="url(#git-node-main)" stroke-width="2.5" />
24
+ <!-- Branch node -->
25
+ <circle cx="24" cy="11" r="3.5" fill="#FFFFFF" stroke="url(#git-node-branch)" stroke-width="2.5" />
26
+ </svg>