finch-git-branch 0.3.1 → 0.3.2

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.
@@ -699,7 +699,7 @@
699
699
  changes: "Changes",
700
700
  graph: "Graph",
701
701
  message: "Message (⌘Enter to commit)",
702
- commit: "Commit",
702
+ commit: "Commit Manually",
703
703
  aiCommit: "Ask {finchName} to commit",
704
704
  aiCommitAnnotationTitle: "{finchName} will commit",
705
705
  aiCommitNote: "Commit the current Git changes.",
@@ -734,7 +734,7 @@
734
734
  changes: "更改",
735
735
  graph: "图表",
736
736
  message: "消息(⌘Enter 提交)",
737
- commit: "提交",
737
+ commit: "由人类提交",
738
738
  aiCommit: "让{finchName}提交",
739
739
  aiCommitAnnotationTitle: "{finchName}来提交",
740
740
  aiCommitNote: "提交当前 Git 改动。",
package/dist/scm-panel.js CHANGED
@@ -144,6 +144,9 @@ 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
+ }
147
150
  export function activateScmPanel(ctx) {
148
151
  ctx.subscriptions.push(panelUi(ctx).onDidOpenPanel((panel) => {
149
152
  let cwd = '';
@@ -324,16 +327,13 @@ export function activateScmPanel(ctx) {
324
327
  const text = String(result.values?.message ?? '').trim();
325
328
  if (!text)
326
329
  return;
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
- });
330
+ await runGit(repoPath, ['add', '-A']);
331
+ if (!await hasStagedChanges(repoPath)) {
332
+ await toast(ctx.i18n.t('git.scm.commit.empty'), 'info');
333
+ return;
334
+ }
335
+ await runGit(repoPath, ['commit', '-m', text, '-m', 'Co-authored-by: 帕亚 <noreply@finchwork.app>']);
336
+ await toast(ctx.i18n.t('git.scm.commit.success'));
337
337
  }
338
338
  if (message.type === 'discard') {
339
339
  const file = allowedFile(repoPath, message.filePath);
package/i18n/en-US.json CHANGED
@@ -59,9 +59,6 @@
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",
65
62
  "git.scm.stage.success": "Staged changes",
66
63
  "git.scm.unstage.success": "Unstaged changes",
67
64
  "git.scm.stageAll.success": "Staged all changes",
package/i18n/zh-CN.json CHANGED
@@ -59,9 +59,6 @@
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": "完成",
65
62
  "git.scm.stage.success": "已暂存",
66
63
  "git.scm.unstage.success": "已取消暂存",
67
64
  "git.scm.stageAll.success": "已暂存全部更改",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finch-git-branch",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Git Source Control for Finch Composer toolbar.",
5
5
  "author": {
6
6
  "name": "Finch Team",