@anypal/plugin-git 0.0.0-stage → 0.1.1

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,310 @@
1
+ .turn-changes {
2
+ margin: 12px 0 8px;
3
+ border: 1px solid var(--mu-line);
4
+ border-radius: 8px;
5
+ overflow: hidden;
6
+ background: var(--mu-page);
7
+ font-size: 12px;
8
+ color: var(--mu-ink);
9
+ }
10
+ .turn-changes header {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 12px;
14
+ min-height: 62px;
15
+ padding: 10px 12px;
16
+ border-bottom: 1px solid var(--mu-line);
17
+ background: color-mix(in srgb, var(--mu-ink) 4%, var(--mu-page));
18
+ }
19
+ .turn-changes:not(:has(.turn-changes-files)) header {
20
+ border-bottom: 0;
21
+ }
22
+ .turn-changes-icon {
23
+ display: grid;
24
+ place-items: center;
25
+ flex: none;
26
+ width: 36px;
27
+ height: 36px;
28
+ border-radius: 8px;
29
+ background: var(--mu-soft);
30
+ color: var(--mu-muted);
31
+ }
32
+ .turn-changes button {
33
+ border: 0;
34
+ background: transparent;
35
+ color: inherit;
36
+ font: inherit;
37
+ cursor: pointer;
38
+ }
39
+ .turn-changes button:disabled {
40
+ cursor: default;
41
+ opacity: 0.6;
42
+ }
43
+ .turn-changes button:hover:not(:disabled) {
44
+ background: var(--mu-soft);
45
+ }
46
+ .turn-changes button:focus-visible {
47
+ outline: 2px solid var(--mu-accent);
48
+ outline-offset: -2px;
49
+ }
50
+ .turn-changes .turn-changes-open {
51
+ display: flex;
52
+ flex: 1;
53
+ flex-direction: column;
54
+ align-items: flex-start;
55
+ gap: 5px;
56
+ min-width: 0;
57
+ padding: 3px 2px;
58
+ text-align: left;
59
+ border-radius: 6px;
60
+ }
61
+ .turn-changes-open strong {
62
+ max-width: 100%;
63
+ font-size: 13px;
64
+ font-weight: 600;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ white-space: nowrap;
68
+ }
69
+ .turn-changes-subtitle {
70
+ display: grid;
71
+ min-height: 16px;
72
+ font-size: 12px;
73
+ color: var(--mu-muted);
74
+ }
75
+ .turn-changes-subtitle > span {
76
+ grid-area: 1/1;
77
+ }
78
+ .turn-changes-hover {
79
+ visibility: hidden;
80
+ }
81
+ .turn-changes header:hover .turn-changes-subtitle .turn-changes-counts,
82
+ .turn-changes header:focus-within .turn-changes-subtitle .turn-changes-counts {
83
+ visibility: hidden;
84
+ }
85
+ .turn-changes header:hover .turn-changes-hover,
86
+ .turn-changes header:focus-within .turn-changes-hover {
87
+ visibility: visible;
88
+ }
89
+ .turn-changes .turn-changes-review {
90
+ flex: none;
91
+ margin-inline-start: auto;
92
+ border: 1px solid var(--mu-line);
93
+ border-radius: 9px;
94
+ padding: 3px 8px;
95
+ font-size: 12px;
96
+ }
97
+ .turn-changes-counts {
98
+ display: inline-flex;
99
+ gap: 4px;
100
+ font:
101
+ 13px ui-monospace,
102
+ Consolas,
103
+ monospace;
104
+ white-space: nowrap;
105
+ }
106
+ .turn-changes .added {
107
+ color: #248354;
108
+ }
109
+ .turn-changes .removed {
110
+ color: #c34e54;
111
+ }
112
+ .mu-scope[data-theme="dark"] .turn-changes .added {
113
+ color: #6bc798;
114
+ }
115
+ .mu-scope[data-theme="dark"] .turn-changes .removed {
116
+ color: #ec8990;
117
+ }
118
+ .turn-changes-files .turn-changes-file {
119
+ display: flex;
120
+ align-items: center;
121
+ gap: 8px;
122
+ min-width: 0;
123
+ width: 100%;
124
+ min-height: 36px;
125
+ padding: 5px 12px;
126
+ text-align: left;
127
+ }
128
+ .turn-changes-path {
129
+ display: flex;
130
+ flex: 1;
131
+ align-items: baseline;
132
+ gap: 0;
133
+ min-width: 0;
134
+ overflow: hidden;
135
+ white-space: nowrap;
136
+ }
137
+ .turn-changes-filename {
138
+ flex: none;
139
+ max-width: 100%;
140
+ overflow: hidden;
141
+ text-overflow: ellipsis;
142
+ }
143
+ .turn-changes-directory {
144
+ min-width: 0;
145
+ flex: 0 1 auto;
146
+ color: var(--mu-muted);
147
+ overflow: hidden;
148
+ text-overflow: ellipsis;
149
+ font-weight: 400;
150
+ }
151
+ .turn-changes > footer {
152
+ display: flex;
153
+ padding: 6px 12px 10px;
154
+ color: var(--mu-muted);
155
+ }
156
+ .turn-changes > footer button {
157
+ display: flex;
158
+ align-items: center;
159
+ gap: 6px;
160
+ padding: 4px;
161
+ border-radius: 4px;
162
+ }
163
+ .turn-changes-note {
164
+ margin: 0;
165
+ padding: 5px 16px;
166
+ color: var(--mu-muted);
167
+ font-size: 11px;
168
+ }
169
+
170
+ .turn-changes .turn-changes-open:hover:not(:disabled) {
171
+ background: transparent;
172
+ }
173
+
174
+ .turn-changes header:hover,
175
+ .turn-changes header:focus-within {
176
+ border-radius: inherit;
177
+ background: color-mix(in srgb, var(--mu-ink) 6%, var(--mu-page));
178
+ }
179
+
180
+ .turn-changes {
181
+ container: turn-changes / inline-size;
182
+ }
183
+ .turn-changes button {
184
+ min-width: 0;
185
+ min-height: 28px;
186
+ box-shadow: none;
187
+ }
188
+ .turn-changes-files .turn-changes-file {
189
+ width: 100%;
190
+ justify-content: space-between;
191
+ }
192
+ @container turn-changes (max-width: 420px) {
193
+ .turn-changes header {
194
+ flex-wrap: wrap;
195
+ gap: 8px;
196
+ padding: 10px 12px;
197
+ }
198
+ .turn-changes-icon {
199
+ width: 28px;
200
+ height: 28px;
201
+ border-radius: 7px;
202
+ }
203
+ .turn-changes .turn-changes-review {
204
+ margin-inline-start: 36px;
205
+ }
206
+ }
207
+
208
+ .turn-changes .turn-changes-files .turn-changes-file:hover:not(:disabled) {
209
+ background: var(--mu-soft);
210
+ }
211
+
212
+ .turn-changes-preview-trigger {
213
+ display: contents;
214
+ }
215
+ .turn-changes-files .turn-changes-file {
216
+ border-radius: 0;
217
+ font-size: 13px;
218
+ }
219
+ .turn-changes-preview-popover.mu-popover-morph {
220
+ width: min(670px, calc(100vw - 16px));
221
+ min-width: 0;
222
+ border-radius: 8px;
223
+ overflow: hidden;
224
+ }
225
+ .turn-changes-preview-content {
226
+ max-height: min(400px, calc(100vh - 32px));
227
+ min-height: 80px;
228
+ color: var(--mu-ink);
229
+ background: var(--mu-page);
230
+ }
231
+ .turn-changes-preview-content > p {
232
+ padding: 12px;
233
+ font-size: 12px;
234
+ }
235
+ .turn-changes-preview-content:focus-visible {
236
+ outline: 2px solid var(--mu-accent);
237
+ outline-offset: -2px;
238
+ }
239
+
240
+ .turn-changes-preview-content {
241
+ font: 12px/1.5 var(--mu-font, system-ui);
242
+ }
243
+ .turn-change-indicator {
244
+ display: inline-flex;
245
+ align-items: center;
246
+ gap: 5px;
247
+ min-height: 26px;
248
+ padding: 2px 10px;
249
+ border: 1px solid var(--mu-line);
250
+ border-radius: 999px;
251
+ background: var(--mu-page);
252
+ box-shadow: 0 3px 12px #00000014;
253
+ color: var(--mu-muted);
254
+ font-size: 12px;
255
+ white-space: nowrap;
256
+ }
257
+ .turn-change-indicator .added,
258
+ .turn-change-indicator-files .added {
259
+ color: #248354;
260
+ }
261
+ .turn-change-indicator .removed,
262
+ .turn-change-indicator-files .removed {
263
+ color: #c34e54;
264
+ }
265
+ [data-theme="dark"] .turn-change-indicator .added,
266
+ [data-theme="dark"] .turn-change-indicator-files .added {
267
+ color: #6bc798;
268
+ }
269
+ [data-theme="dark"] .turn-change-indicator .removed,
270
+ [data-theme="dark"] .turn-change-indicator-files .removed {
271
+ color: #ec8990;
272
+ }
273
+ .turn-change-indicator-files {
274
+ max-height: min(320px, calc(100vh - 100px));
275
+ overflow-y: auto;
276
+ font-size: 12px;
277
+ }
278
+ .turn-change-indicator-file {
279
+ display: flex;
280
+ justify-content: space-between;
281
+ gap: 12px;
282
+ padding: 5px 0;
283
+ }
284
+ .turn-change-indicator-file > span {
285
+ min-width: 0;
286
+ overflow-wrap: anywhere;
287
+ }
288
+ .turn-change-indicator-file small {
289
+ display: inline-flex;
290
+ flex: none;
291
+ gap: 5px;
292
+ }
293
+ .turn-change-indicator-popover.mu-popover-morph {
294
+ width: min(360px, calc(100vw - 16px));
295
+ padding: 0;
296
+ border: 1px solid var(--mu-line);
297
+ border-radius: 12px;
298
+ background: var(--mu-page);
299
+ color: var(--mu-ink);
300
+ box-shadow: 0 10px 28px #00000020;
301
+ }
302
+ .turn-change-indicator-card {
303
+ padding: 7px 11px;
304
+ }
305
+ .turn-change-indicator-expand {
306
+ width: 100%;
307
+ justify-content: flex-start;
308
+ margin-top: 3px;
309
+ color: var(--mu-muted);
310
+ }
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
- {
2
- "name": "@anypal/plugin-git",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@anypal/plugin-git",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "Review file changes by turn and compare Git diffs.",
6
+ "files": [
7
+ "pal-manifest.json",
8
+ "dist",
9
+ "LICENSE"
10
+ ],
11
+ "scripts": {
12
+ "build": "pal-plugin-build . && node tools/copy-ui-licenses.mjs",
13
+ "pack": "pal-plugin pack .",
14
+ "release": "npm publish",
15
+ "dev": "node ../../tools/workspace.mjs dev --plugin git",
16
+ "test": "node --test tests/*.test.mjs && vitest run tests --exclude **/*.mjs",
17
+ "test:ui": "npm run build && node tests/review-interaction.e2e.mjs && node tests/review-panel.e2e.mjs && node tests/review-host.e2e.mjs"
18
+ },
19
+ "devDependencies": {
20
+ "@anypal/contracts": "0.1.0",
21
+ "@anypal/plugin-build": "0.1.0",
22
+ "@anypal/plugin-sdk": "0.1.0",
23
+ "@anypal/ui": "0.1.0",
24
+ "@phosphor-icons/react": "^2.1.10",
25
+ "@pierre/diffs": "1.5.2",
26
+ "@pierre/theme": "2.0.0",
27
+ "@pierre/theming": "1.0.1",
28
+ "lucide-react": "^1.17.0",
29
+ "react": "^19.1.1",
30
+ "react-dom": "^19.1.1",
31
+ "react-markdown": "^10.1.0",
32
+ "remark-gfm": "^4.0.1",
33
+ "shiki": "4.5.0",
34
+ "vitest": "^3.2.7"
35
+ },
36
+ "dependencies": {
37
+ "diff": "^8.0.2",
38
+ "ignore": "^7.0.5"
39
+ },
40
+ "license": "MIT",
41
+ "palBuild": {
42
+ "frontendAliases": {
43
+ "shiki": "./ui/diff/shiki-runtime.ts",
44
+ "@pierre/theming/themes": "./ui/diff/review-themes.ts"
45
+ }
46
+ },
47
+ "pal": {
48
+ "id": "pal.git",
49
+ "apiVersion": 1,
50
+ "runtime": "node",
51
+ "manifest": "./pal-manifest.json"
52
+ },
53
+ "exports": "./dist/index.cjs",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/ezerror/pal.git",
57
+ "directory": "plugins/git"
58
+ }
59
+ }
@@ -0,0 +1,262 @@
1
+ {
2
+ "title": "Change Review",
3
+ "workspaceTargets": ["local", "ssh"],
4
+ "activationScope": "scoped",
5
+ "extensions": ["pal.ui.panel", "pal.conversation.before-composer"],
6
+ "author": "PAL",
7
+ "category": "development",
8
+ "icon": "git-branch",
9
+ "tools": [],
10
+ "locales": {
11
+ "zh-CN": {
12
+ "name": "变更审查",
13
+ "description": "查看每轮文件变更,支持 Git 差异对比。"
14
+ },
15
+ "zh": {
16
+ "name": "变更审查",
17
+ "description": "查看每轮文件变更,支持 Git 差异对比。"
18
+ }
19
+ },
20
+ "contributions": ["runChanges"],
21
+ "consumes": {
22
+ "fileChanges": {
23
+ "contract": "pal.filesystem.changes",
24
+ "apiVersion": 1,
25
+ "transport": "reference",
26
+ "optional": true,
27
+ "autoBind": true
28
+ }
29
+ },
30
+ "hostRenderers": {
31
+ "review": {
32
+ "root": "dist/ui",
33
+ "entry": "host.js"
34
+ },
35
+ "indicator": {
36
+ "root": "dist/ui",
37
+ "entry": "indicator-host.js"
38
+ }
39
+ },
40
+ "requiresHost": {
41
+ "pal.command.callable": 1,
42
+ "pal.command.dispatch": 1,
43
+ "pal.command.execute": 1,
44
+ "pal.plugin.hostPanel": 1,
45
+ "pal.plugin.hostPanel.workspace": 1,
46
+ "pal.plugin.declarations": 1,
47
+ "pal.extension.ui.panel": 1,
48
+ "pal.plugin.files.commands": 3,
49
+ "pal.plugin.process.commands": 2,
50
+ "pal.plugin.runChanges.commands": 1,
51
+ "pal.frontend.command.isAvailable": 1,
52
+ "pal.host.files.navigation": 1,
53
+ "pal.plugin.hostPanel.message": 2,
54
+ "pal.context.panels": 1,
55
+ "pal.context.services": 1,
56
+ "pal.extension.conversation.before-composer": 1
57
+ },
58
+ "declarations": {
59
+ "provides": {
60
+ "commands": [
61
+ {
62
+ "id": "pal.git.review.load",
63
+ "title": "读取变更审查",
64
+ "visibility": "public",
65
+ "readOnly": false,
66
+ "requiredPermissions": ["pal.fs.read", "pal.process.spawn"],
67
+ "inputSchema": {
68
+ "type": "object",
69
+ "properties": {
70
+ "scope": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "properties": {
74
+ "kind": {
75
+ "enum": [
76
+ "turn",
77
+ "uncommitted",
78
+ "unstaged",
79
+ "staged",
80
+ "commit",
81
+ "branch"
82
+ ]
83
+ },
84
+ "ref": {
85
+ "type": "string",
86
+ "maxLength": 500
87
+ }
88
+ },
89
+ "required": ["kind"]
90
+ },
91
+ "path": {
92
+ "type": "string",
93
+ "maxLength": 2000
94
+ },
95
+ "runId": {
96
+ "type": "string",
97
+ "maxLength": 200
98
+ }
99
+ },
100
+ "additionalProperties": false
101
+ }
102
+ },
103
+ {
104
+ "id": "pal.git.review.patch",
105
+ "title": "生成当前文件补丁",
106
+ "visibility": "public",
107
+ "readOnly": false,
108
+ "requiredPermissions": ["pal.fs.read", "pal.process.spawn"],
109
+ "inputSchema": {
110
+ "type": "object",
111
+ "properties": {
112
+ "scope": {
113
+ "type": "object",
114
+ "additionalProperties": false,
115
+ "properties": {
116
+ "kind": {
117
+ "enum": [
118
+ "turn",
119
+ "uncommitted",
120
+ "unstaged",
121
+ "staged",
122
+ "commit",
123
+ "branch"
124
+ ]
125
+ },
126
+ "ref": {
127
+ "type": "string",
128
+ "maxLength": 500
129
+ }
130
+ },
131
+ "required": ["kind"]
132
+ },
133
+ "path": {
134
+ "type": "string",
135
+ "maxLength": 2000
136
+ },
137
+ "runId": {
138
+ "type": "string",
139
+ "maxLength": 200
140
+ }
141
+ },
142
+ "required": ["path"],
143
+ "additionalProperties": false
144
+ }
145
+ },
146
+ {
147
+ "id": "pal.git.review.preview",
148
+ "title": "预览轮次文件差异",
149
+ "visibility": "private",
150
+ "readOnly": true,
151
+ "requiredPermissions": ["pal.fs.read"],
152
+ "inputSchema": {
153
+ "type": "object",
154
+ "properties": {
155
+ "runId": {
156
+ "type": "string",
157
+ "minLength": 1,
158
+ "maxLength": 200
159
+ },
160
+ "path": {
161
+ "type": "string",
162
+ "minLength": 1,
163
+ "maxLength": 2000
164
+ }
165
+ },
166
+ "required": ["runId", "path"],
167
+ "additionalProperties": false
168
+ }
169
+ },
170
+ {
171
+ "id": "pal.git.review.open",
172
+ "title": "打开轮次变更审查",
173
+ "visibility": "private",
174
+ "readOnly": false,
175
+ "requiredPermissions": ["pal.fs.read"],
176
+ "inputSchema": {
177
+ "type": "object",
178
+ "properties": {
179
+ "runId": {
180
+ "type": "string",
181
+ "minLength": 1,
182
+ "maxLength": 200
183
+ },
184
+ "path": {
185
+ "type": "string",
186
+ "minLength": 1,
187
+ "maxLength": 2000
188
+ }
189
+ },
190
+ "required": ["runId"],
191
+ "additionalProperties": false
192
+ }
193
+ }
194
+ ],
195
+ "ui": [
196
+ {
197
+ "id": "pal.git.panel",
198
+ "slot": "pal.ui.panel",
199
+ "messagePresentation": true,
200
+ "description": "变更审查面板,固定打开时的项目、会话和轮次"
201
+ },
202
+ {
203
+ "id": "pal.git.indicator",
204
+ "slot": "pal.conversation.before-composer",
205
+ "description": "当前轮次的文件改动提示"
206
+ }
207
+ ]
208
+ },
209
+ "consumes": {
210
+ "commands": [
211
+ {
212
+ "id": "pal.fs.read",
213
+ "reason": "读取授权范围内的工作区文件与目录元数据"
214
+ },
215
+ {
216
+ "id": "pal.process.start",
217
+ "reason": "运行有界的 Git 查询"
218
+ },
219
+ {
220
+ "id": "pal.process.read",
221
+ "reason": "读取 Git 输出,包括图片原始字节"
222
+ },
223
+ {
224
+ "id": "pal.process.release",
225
+ "reason": "查询完成或失败后释放 Git 进程与输出缓存"
226
+ },
227
+ {
228
+ "id": "pal.clipboard.write",
229
+ "reason": "按用户点击将当前文件的 git apply 命令复制到剪贴板,不读取剪贴板"
230
+ },
231
+ {
232
+ "id": "pal.files.open",
233
+ "reason": "通过宿主默认文件查看器打开审查文件,不绑定文件管理器插件"
234
+ },
235
+ {
236
+ "id": "pal.toast.show",
237
+ "reason": "提示复制成功或失败,以及刷新、切换范围、打开文件失败"
238
+ },
239
+ {
240
+ "id": "pal.host.interaction.close",
241
+ "reason": "提示复制成功或失败,以及刷新、切换范围、打开文件失败"
242
+ },
243
+ {
244
+ "id": "pal.host.interaction.list",
245
+ "reason": "提示复制成功或失败,以及刷新、切换范围、打开文件失败"
246
+ },
247
+ {
248
+ "id": "pal.host.interaction.respond",
249
+ "reason": "提示复制成功或失败,以及刷新、切换范围、打开文件失败"
250
+ },
251
+ {
252
+ "id": "pal.host.interaction.action",
253
+ "reason": "提示复制成功或失败,以及刷新、切换范围、打开文件失败"
254
+ },
255
+ {
256
+ "id": "pal.frontend.context",
257
+ "reason": "使用已声明前端的宿主能力"
258
+ }
259
+ ]
260
+ }
261
+ }
262
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
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.