dsh-easygit-plugin 0.2.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.
@@ -0,0 +1,282 @@
1
+ /** Shared Client-to-Host contracts. */
2
+ export type ProposalStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'verified' | 'dismissed';
3
+ export type ActionErrorCode = 'NOT_GIT_REPOSITORY' | 'SESSION_NOT_FOUND' | 'INVALID_ARGUMENT' | 'STATE_CONFLICT' | 'OPERATION_DUPLICATE' | 'GIT_FAILED' | 'TIMEOUT' | 'PERMISSION_DENIED' | 'INTERNAL_ERROR';
4
+ export type ActionFailureReason = 'CURRENT_BRANCH' | 'BRANCH_NOT_FOUND' | 'UNMERGED_BRANCH';
5
+ export type ActionResult<T> = {
6
+ ok: true;
7
+ data: T;
8
+ operationId?: string;
9
+ } | {
10
+ ok: false;
11
+ code: ActionErrorCode;
12
+ message: string;
13
+ diagnostics?: string;
14
+ reason?: ActionFailureReason;
15
+ };
16
+ export interface RepositoryFile {
17
+ indexStatus: string;
18
+ workTreeStatus: string;
19
+ path: string;
20
+ originalPath?: string;
21
+ }
22
+ export interface RepositorySummary {
23
+ topLevel: string;
24
+ branch: string;
25
+ head: string;
26
+ status: string;
27
+ files: RepositoryFile[];
28
+ stagedCount: number;
29
+ }
30
+ export interface BranchSummary {
31
+ name: string;
32
+ current: boolean;
33
+ upstream: string;
34
+ }
35
+ export interface ReferenceSummary {
36
+ name: string;
37
+ hash: string;
38
+ subject: string;
39
+ }
40
+ export interface RepositoryReferences {
41
+ branches: BranchSummary[];
42
+ remotes: ReferenceSummary[];
43
+ tags: ReferenceSummary[];
44
+ }
45
+ export interface CommitRefSummary {
46
+ name: string;
47
+ type: 'branch' | 'remote' | 'tag';
48
+ current: boolean;
49
+ }
50
+ export interface CommitSummary {
51
+ hash: string;
52
+ parents: string[];
53
+ subject: string;
54
+ author: string;
55
+ date: string;
56
+ refs: CommitRefSummary[];
57
+ }
58
+ export interface CommitFileChange {
59
+ status: string;
60
+ path: string;
61
+ previousPath?: string;
62
+ additions: number | null;
63
+ deletions: number | null;
64
+ }
65
+ export interface CommitDetail {
66
+ hash: string;
67
+ parents: string[];
68
+ subject: string;
69
+ body: string;
70
+ authorName: string;
71
+ authorEmail: string;
72
+ authoredAt: string;
73
+ committerName: string;
74
+ committerEmail: string;
75
+ committedAt: string;
76
+ comparisonBase: string | null;
77
+ files: CommitFileChange[];
78
+ filesTruncated: boolean;
79
+ totals: {
80
+ files: number;
81
+ additions: number;
82
+ deletions: number;
83
+ binary: number;
84
+ };
85
+ }
86
+ export interface CommitDiffResult {
87
+ hash: string;
88
+ comparisonBase: string | null;
89
+ diff: string;
90
+ truncated: boolean;
91
+ }
92
+ export interface StashSummary {
93
+ selector: string;
94
+ hash: string;
95
+ subject: string;
96
+ author: string;
97
+ date: string;
98
+ }
99
+ export interface DiffResult {
100
+ path: string | null;
101
+ staged: boolean;
102
+ diff: string;
103
+ truncated: boolean;
104
+ }
105
+ export interface ProposalStepView {
106
+ command: string;
107
+ result: Record<string, unknown> | null;
108
+ }
109
+ export interface ProposalView {
110
+ proposalId: string;
111
+ status: ProposalStatus;
112
+ risk: 'safe' | 'normal' | 'hard';
113
+ command: string;
114
+ intent: string;
115
+ steps: ProposalStepView[];
116
+ explanation: string;
117
+ reasons: string[];
118
+ confirmed: boolean;
119
+ workdir: string;
120
+ result: Record<string, unknown> | null;
121
+ closed: boolean;
122
+ copied: boolean;
123
+ }
124
+ export type ProposalStateResponse = {
125
+ ok: true;
126
+ proposal: ProposalView | null;
127
+ changed: boolean;
128
+ verified: boolean;
129
+ partial: boolean;
130
+ message: string;
131
+ changedState: string;
132
+ } | {
133
+ ok: false;
134
+ error: string;
135
+ };
136
+ export interface ProposalCommandResponse {
137
+ ok: boolean;
138
+ error?: string;
139
+ changed?: boolean;
140
+ verified?: boolean;
141
+ partial?: boolean;
142
+ message?: string;
143
+ changedState?: string;
144
+ }
145
+ export interface ProposalExecutionResponse extends ProposalCommandResponse {
146
+ proposalId?: string;
147
+ command?: string;
148
+ steps?: Array<{
149
+ command: string;
150
+ ok: boolean;
151
+ exitCode?: number;
152
+ }>;
153
+ exitCode?: number;
154
+ signal?: string;
155
+ timedOut?: boolean;
156
+ stdout?: string;
157
+ stderr?: string;
158
+ diagnostics?: string;
159
+ recovery?: {
160
+ suggestion: string;
161
+ command: string;
162
+ proposalId: string | null;
163
+ } | null;
164
+ }
165
+ export interface GitGuideRequestMap {
166
+ 'get-summary': {
167
+ sessionId: string;
168
+ };
169
+ 'get-diff': {
170
+ sessionId: string;
171
+ path: string;
172
+ staged: boolean;
173
+ };
174
+ 'get-branches': {
175
+ sessionId: string;
176
+ };
177
+ 'get-commits': {
178
+ sessionId: string;
179
+ limit?: number;
180
+ };
181
+ 'get-commit-detail': {
182
+ sessionId: string;
183
+ hash: string;
184
+ };
185
+ 'get-commit-diff': {
186
+ sessionId: string;
187
+ hash: string;
188
+ };
189
+ 'get-stashes': {
190
+ sessionId: string;
191
+ };
192
+ 'stage-paths': {
193
+ sessionId: string;
194
+ operationId: string;
195
+ paths: string[];
196
+ };
197
+ 'unstage-paths': {
198
+ sessionId: string;
199
+ operationId: string;
200
+ paths: string[];
201
+ };
202
+ 'stage-all': {
203
+ sessionId: string;
204
+ operationId: string;
205
+ };
206
+ 'unstage-all': {
207
+ sessionId: string;
208
+ operationId: string;
209
+ };
210
+ commit: {
211
+ sessionId: string;
212
+ operationId: string;
213
+ message: string;
214
+ };
215
+ 'create-branch': {
216
+ sessionId: string;
217
+ operationId: string;
218
+ name: string;
219
+ base?: string;
220
+ };
221
+ 'switch-branch': {
222
+ sessionId: string;
223
+ operationId: string;
224
+ name: string;
225
+ };
226
+ 'delete-branch': {
227
+ sessionId: string;
228
+ operationId: string;
229
+ name: string;
230
+ force?: boolean;
231
+ confirmRisk?: boolean;
232
+ };
233
+ state: {
234
+ sessionId: string;
235
+ };
236
+ dismiss: {
237
+ sessionId: string;
238
+ proposalId: string;
239
+ manual?: boolean;
240
+ };
241
+ 'mark-copied': {
242
+ sessionId: string;
243
+ proposalId: string;
244
+ confirm?: boolean;
245
+ };
246
+ verify: {
247
+ sessionId: string;
248
+ proposalId: string;
249
+ };
250
+ execute: {
251
+ sessionId: string;
252
+ proposalId: string;
253
+ confirm?: boolean;
254
+ };
255
+ }
256
+ export interface GitGuideResponseMap {
257
+ 'get-summary': ActionResult<RepositorySummary>;
258
+ 'get-diff': ActionResult<DiffResult>;
259
+ 'get-branches': ActionResult<RepositoryReferences>;
260
+ 'get-commits': ActionResult<CommitSummary[]>;
261
+ 'get-commit-detail': ActionResult<CommitDetail>;
262
+ 'get-commit-diff': ActionResult<CommitDiffResult>;
263
+ 'get-stashes': ActionResult<StashSummary[]>;
264
+ 'stage-paths': ActionResult<RepositorySummary>;
265
+ 'unstage-paths': ActionResult<RepositorySummary>;
266
+ 'stage-all': ActionResult<RepositorySummary>;
267
+ 'unstage-all': ActionResult<RepositorySummary>;
268
+ commit: ActionResult<RepositorySummary>;
269
+ 'create-branch': ActionResult<RepositorySummary>;
270
+ 'switch-branch': ActionResult<RepositorySummary>;
271
+ 'delete-branch': ActionResult<RepositorySummary>;
272
+ state: ProposalStateResponse;
273
+ dismiss: ProposalCommandResponse;
274
+ 'mark-copied': ProposalCommandResponse;
275
+ verify: ProposalCommandResponse;
276
+ execute: ProposalExecutionResponse;
277
+ }
278
+ export type GitGuideAction = keyof GitGuideRequestMap;
279
+ export type GitGuideRequest<A extends GitGuideAction = GitGuideAction> = {
280
+ action: A;
281
+ } & GitGuideRequestMap[A];
282
+ export type GitGuideResponse<A extends GitGuideAction> = GitGuideResponseMap[A];
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "dsh-easygit-plugin",
3
+ "version": "0.2.0",
4
+ "description": "面向 DeepSeek Harness Web 的可视化 Git 工作台,支持查看仓库状态与提交记录、快捷执行常用 Git 操作,以及安全运行自然语言生成的分步骤命令提议。",
5
+ "license": "MIT",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/host/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/host/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./lib/types/client/index.d.ts",
15
+ "default": "./lib/client.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./git-guide.cordis.yml"
22
+ },
23
+ "client": {
24
+ "platform": "web",
25
+ "inject": [
26
+ "@deepseek-ai/dsh-client-runtime",
27
+ "@deepseek-ai/dsh-client-ui-conversation",
28
+ "@deepseek-ai/dsh-client-ui-layout"
29
+ ]
30
+ }
31
+ },
32
+ "keywords": [
33
+ "deepseek",
34
+ "dsh",
35
+ "deepseek-harness",
36
+ "cordis",
37
+ "plugin",
38
+ "git",
39
+ "git-assistant",
40
+ "ai"
41
+ ],
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/IT-coder-Yy/dsh-git-plugin.git"
45
+ },
46
+ "homepage": "https://github.com/IT-coder-Yy/dsh-git-plugin#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/IT-coder-Yy/dsh-git-plugin/issues"
49
+ },
50
+ "files": [
51
+ "assets/preview.png",
52
+ "lib/*.js",
53
+ "lib/types/**/*.d.ts",
54
+ "git-guide.cordis.yml",
55
+ "README.md",
56
+ "README.zh-CN.md",
57
+ "SECURITY.md",
58
+ "LICENSE"
59
+ ],
60
+ "engines": {
61
+ "node": "^22.19.0 || >=24.0.0"
62
+ },
63
+ "scripts": {
64
+ "typecheck": "tsc --project tsconfig.json",
65
+ "build:js": "node scripts/build.mjs",
66
+ "build": "npm run typecheck && npm run build:js",
67
+ "lint": "npm run typecheck && node --check lib/index.js && node --check lib/client.js",
68
+ "test": "npm run build && node --test \"test/*.test.js\"",
69
+ "verify:build": "node scripts/verify-build.mjs",
70
+ "check": "npm run lint && npm test && npm run verify:build",
71
+ "prepublishOnly": "npm run lint && npm test && npm run verify:build && npm pack --dry-run"
72
+ },
73
+ "devDependencies": {
74
+ "@types/node": "^22.20.0",
75
+ "@types/react": "^18.3.1",
76
+ "esbuild": "^0.27.0",
77
+ "typescript": "^6.0.3"
78
+ }
79
+ }