finch-git-branch 0.3.0 → 0.3.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.
- package/README.md +2 -2
- package/README.zh-CN.md +3 -3
- package/dist/scm-panel.html +7 -7
- package/dist/scm-panel.js +10 -22
- package/i18n/en-US.json +7 -4
- package/i18n/zh-CN.json +7 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## Git
|
|
1
|
+
## Git Source Control for Finch
|
|
2
2
|
|
|
3
|
-
Git
|
|
3
|
+
Git Source Control is a mini tool for [Finch](https://finchwork.app/) — a desktop AI agent you can download at [finchwork.app](https://finchwork.app/).
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## Git
|
|
1
|
+
## Git 源码管理小工具
|
|
2
2
|
|
|
3
|
-
Git
|
|
3
|
+
Git 源码管理小工具是 [Finch](https://finchwork.app/) 的扩展。Finch 是一款桌面 AI Agent,可在 [finchwork.app](https://finchwork.app/) 下载。
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ Git 分支小工具是 [Finch](https://finchwork.app/) 的扩展。Finch 是一
|
|
|
20
20
|
## 用法
|
|
21
21
|
|
|
22
22
|
1. 在 Git 项目目录里打开一个 Finch 对话。
|
|
23
|
-
2. 点击对话顶部工具栏的 Git
|
|
23
|
+
2. 点击对话顶部工具栏的 Git 源码管理按钮。
|
|
24
24
|
3. 选一个分支切换过去。
|
|
25
25
|
4. 如果有没保存的改动,对话框会问你先存档再切,还是取消。
|
|
26
26
|
5. 点「创建并检出分支...」让 Agent 帮你输入新分支名。
|
package/dist/scm-panel.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
overflow: hidden;
|
|
49
49
|
}
|
|
50
50
|
body {
|
|
51
|
-
font:
|
|
51
|
+
font: 12px/1.45 var(--mono);
|
|
52
52
|
color: var(--text);
|
|
53
53
|
background: var(--bg);
|
|
54
54
|
}
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
background: var(--hover);
|
|
143
143
|
border-radius: 9px;
|
|
144
144
|
padding: 0 5px;
|
|
145
|
-
font-size:
|
|
145
|
+
font-size: 12px;
|
|
146
146
|
}
|
|
147
147
|
.body.collapsed {
|
|
148
148
|
display: none;
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
.group {
|
|
299
299
|
padding: 5px 10px 2px;
|
|
300
300
|
color: var(--muted);
|
|
301
|
-
font-size:
|
|
301
|
+
font-size: 12px;
|
|
302
302
|
background: var(--elev);
|
|
303
303
|
position: sticky;
|
|
304
304
|
top: 0;
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
overflow: auto;
|
|
351
351
|
padding: 0;
|
|
352
352
|
color: var(--muted);
|
|
353
|
-
font-size:
|
|
353
|
+
font-size: 12px;
|
|
354
354
|
}
|
|
355
355
|
.graph-canvas {
|
|
356
356
|
position: relative;
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
}
|
|
381
381
|
.graph-hash {
|
|
382
382
|
color: var(--subtle);
|
|
383
|
-
font-size:
|
|
383
|
+
font-size: 12px;
|
|
384
384
|
flex: none;
|
|
385
385
|
}
|
|
386
386
|
.graph-subject {
|
|
@@ -489,14 +489,14 @@
|
|
|
489
489
|
}
|
|
490
490
|
.repo,
|
|
491
491
|
.repo * {
|
|
492
|
-
font-size:
|
|
492
|
+
font-size: 12px !important;
|
|
493
493
|
}
|
|
494
494
|
.repo {
|
|
495
495
|
line-height: 18px;
|
|
496
496
|
}
|
|
497
497
|
.file,
|
|
498
498
|
.file * {
|
|
499
|
-
font-size:
|
|
499
|
+
font-size: 12px !important;
|
|
500
500
|
}
|
|
501
501
|
.file {
|
|
502
502
|
gap: 6px;
|
package/dist/scm-panel.js
CHANGED
|
@@ -144,9 +144,6 @@ async function createDiffFile(label, filePath, content) {
|
|
|
144
144
|
async function fileAtRevision(repoPath, revision, filePath) {
|
|
145
145
|
return runGit(repoPath, ['show', `${revision}:${filePath}`], 15_000, false).catch(() => '');
|
|
146
146
|
}
|
|
147
|
-
async function hasStagedChanges(repoPath) {
|
|
148
|
-
return Boolean(await runGit(repoPath, ['diff', '--cached', '--name-only']));
|
|
149
|
-
}
|
|
150
147
|
export function activateScmPanel(ctx) {
|
|
151
148
|
ctx.subscriptions.push(panelUi(ctx).onDidOpenPanel((panel) => {
|
|
152
149
|
let cwd = '';
|
|
@@ -327,25 +324,16 @@ export function activateScmPanel(ctx) {
|
|
|
327
324
|
const text = String(result.values?.message ?? '').trim();
|
|
328
325
|
if (!text)
|
|
329
326
|
return;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!text)
|
|
341
|
-
throw new Error('Commit message is required');
|
|
342
|
-
await runGit(repoPath, ['add', '-A']);
|
|
343
|
-
if (!await hasStagedChanges(repoPath)) {
|
|
344
|
-
await toast(ctx.i18n.t('git.scm.commit.empty'), 'info');
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
await runGit(repoPath, ['commit', '-m', text, '-m', 'Co-authored-by: 帕亚 <noreply@finchwork.app>']);
|
|
348
|
-
await toast(ctx.i18n.t('git.scm.commit.success'));
|
|
327
|
+
// 提交由人类在自己的终端手动执行,扩展只生成命令,不再自动 git commit。
|
|
328
|
+
const escaped = text.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
329
|
+
await ctx.ui.showModalDialog({
|
|
330
|
+
title: ctx.i18n.t('git.scm.commit.manual.title'),
|
|
331
|
+
description: ctx.i18n.t('git.scm.commit.manual.desc'),
|
|
332
|
+
message: `\`git add -A\`\n\`git commit -m "${escaped}"\``,
|
|
333
|
+
actions: [
|
|
334
|
+
{ id: 'ok', label: ctx.i18n.t('git.scm.commit.manual.ok'), variant: 'primary' },
|
|
335
|
+
],
|
|
336
|
+
});
|
|
349
337
|
}
|
|
350
338
|
if (message.type === 'discard') {
|
|
351
339
|
const file = allowedFile(repoPath, message.filePath);
|
package/i18n/en-US.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "Git
|
|
3
|
-
"description": "Manage Git
|
|
2
|
+
"name": "Git Source Control",
|
|
3
|
+
"description": "Manage Git source control from the dialog box.",
|
|
4
4
|
"systemPrompt": "When creating a Git branch, use create_git_branch. Pass branchName to create and check out a known branch without a form; otherwise omit it to collect the name in a form.",
|
|
5
5
|
"toolMeta": {
|
|
6
|
-
"name": "Git
|
|
6
|
+
"name": "Git Source Control"
|
|
7
7
|
},
|
|
8
8
|
"composerActions": {
|
|
9
9
|
"git-branch": {
|
|
10
|
-
"tooltip": "Git
|
|
10
|
+
"tooltip": "Git Source Control"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"appPanel": {
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
"git.scm.commit.cancel": "Cancel",
|
|
60
60
|
"git.scm.commit.success": "Committed changes",
|
|
61
61
|
"git.scm.commit.empty": "No changes to commit",
|
|
62
|
+
"git.scm.commit.manual.title": "Commit Manually",
|
|
63
|
+
"git.scm.commit.manual.desc": "The commit will be made by you in your terminal. Copy and run the commands below:",
|
|
64
|
+
"git.scm.commit.manual.ok": "Done",
|
|
62
65
|
"git.scm.stage.success": "Staged changes",
|
|
63
66
|
"git.scm.unstage.success": "Unstaged changes",
|
|
64
67
|
"git.scm.stageAll.success": "Staged all changes",
|
package/i18n/zh-CN.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "Git
|
|
3
|
-
"description": "在对话框里管理 Git
|
|
2
|
+
"name": "Git 源码管理",
|
|
3
|
+
"description": "在对话框里管理 Git 源码的小工具",
|
|
4
4
|
"systemPrompt": "当需要创建 Git 分支时,使用 create_git_branch 工具。已确定分支名时传入 branchName 参数以静默创建并检出;否则省略该参数以弹出表单收集分支名。",
|
|
5
5
|
"toolMeta": {
|
|
6
|
-
"name": "Git
|
|
6
|
+
"name": "Git 源码管理"
|
|
7
7
|
},
|
|
8
8
|
"composerActions": {
|
|
9
9
|
"git-branch": {
|
|
10
|
-
"tooltip": "Git
|
|
10
|
+
"tooltip": "Git 源码管理"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"appPanel": {
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
"git.scm.commit.cancel": "取消",
|
|
60
60
|
"git.scm.commit.success": "已提交更改",
|
|
61
61
|
"git.scm.commit.empty": "没有需要提交的更改",
|
|
62
|
+
"git.scm.commit.manual.title": "请手动提交",
|
|
63
|
+
"git.scm.commit.manual.desc": "提交将由你在终端手动执行,请复制并运行以下命令:",
|
|
64
|
+
"git.scm.commit.manual.ok": "完成",
|
|
62
65
|
"git.scm.stage.success": "已暂存",
|
|
63
66
|
"git.scm.unstage.success": "已取消暂存",
|
|
64
67
|
"git.scm.stageAll.success": "已暂存全部更改",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "finch-git-branch",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Git
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Git Source Control for Finch Composer toolbar.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Finch Team",
|
|
7
7
|
"url": "https://finchwork.app"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"finch": {
|
|
22
22
|
"manifestVersion": 1,
|
|
23
23
|
"id": "git-branch",
|
|
24
|
-
"name": "Git
|
|
24
|
+
"name": "Git Source Control",
|
|
25
25
|
"description": "Switch Git branches from the Composer toolbar with change previews.",
|
|
26
26
|
"systemPrompt": "When creating a Git branch, use create_git_branch. Pass branchName to create and check out a known branch without a form; otherwise omit it to collect the name in a form.",
|
|
27
27
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
{
|
|
41
41
|
"id": "git-branch",
|
|
42
42
|
"icon": "git-branch",
|
|
43
|
-
"tooltip": "Git
|
|
43
|
+
"tooltip": "Git 源码管理"
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"iconPacks": [
|