@openvcs/git-plugin 0.3.2-edge.20260603.129 → 0.3.2-edge.20260612.143

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/bin/git.js CHANGED
@@ -679,8 +679,21 @@ export class GitCommand {
679
679
  this.runChecked(['config', '--local', 'user.name', name], 'git-identity-set-failed');
680
680
  this.runChecked(['config', '--local', 'user.email', email], 'git-identity-set-failed');
681
681
  }
682
- mergeIntoCurrent(branch) {
683
- this.runChecked(['merge', branch], 'git-merge-failed');
682
+ mergeIntoCurrent(branch, strategy, message) {
683
+ switch (strategy) {
684
+ case 'squash': {
685
+ this.runChecked(['merge', '--squash', branch], 'git-merge-failed');
686
+ const commitArgs = ['commit', '-m', message ?? `Merge branch '${branch}'`];
687
+ this.runChecked(commitArgs, 'git-merge-failed');
688
+ break;
689
+ }
690
+ case 'rebase':
691
+ this.runChecked(['merge', '--rebase', branch], 'git-merge-failed');
692
+ break;
693
+ default:
694
+ this.runChecked(['merge', branch], 'git-merge-failed');
695
+ break;
696
+ }
684
697
  }
685
698
  mergeAbort() {
686
699
  this.runChecked(['merge', '--abort'], 'git-merge-abort-failed');
@@ -90,6 +90,7 @@ export class GitVcsDelegates extends VcsDelegateBase {
90
90
  staging: true,
91
91
  push_pull: true,
92
92
  fast_forward: true,
93
+ merge_strategies: ['merge', 'squash', 'rebase'],
93
94
  };
94
95
  }
95
96
  open(params, _context) {
@@ -362,7 +363,12 @@ export class GitVcsDelegates extends VcsDelegateBase {
362
363
  }
363
364
  mergeIntoCurrent(params, _context) {
364
365
  const git = this.requireGit(params.session_id);
365
- git.mergeIntoCurrent(asTrimmedString(params.name));
366
+ const rawStrategy = asTrimmedString(params.strategy);
367
+ const strategy = rawStrategy && !['merge', 'squash', 'rebase'].includes(rawStrategy)
368
+ ? (() => { throw pluginError('vcs-merge-invalid-strategy', `Unknown merge strategy '${rawStrategy}'. Must be 'merge', 'squash', or 'rebase'.`); })()
369
+ : (rawStrategy || undefined);
370
+ const message = asTrimmedString(params.message) || undefined;
371
+ git.mergeIntoCurrent(asTrimmedString(params.name), strategy, message);
366
372
  return null;
367
373
  }
368
374
  mergeAbort(params, _context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openvcs/git-plugin",
3
- "version": "0.3.2-edge.20260603.129",
3
+ "version": "0.3.2-edge.20260612.143",
4
4
  "description": "Git VCS backend plugin for OpenVCS",
5
5
  "author": "OpenVCS Contributors",
6
6
  "license": "GPL-3.0-or-later",
@@ -35,7 +35,7 @@
35
35
  }
36
36
  ]
37
37
  },
38
- "version": "0.3.2-edge.20260603.129"
38
+ "version": "0.3.2-edge.20260612.143"
39
39
  },
40
40
  "scripts": {
41
41
  "lint": "tsc -p tsconfig.json --noEmit",
package/src/git.ts CHANGED
@@ -870,8 +870,21 @@ export class GitCommand {
870
870
  this.runChecked(['config', '--local', 'user.email', email], 'git-identity-set-failed');
871
871
  }
872
872
 
873
- mergeIntoCurrent(branch: string): void {
874
- this.runChecked(['merge', branch], 'git-merge-failed');
873
+ mergeIntoCurrent(branch: string, strategy?: string, message?: string): void {
874
+ switch (strategy) {
875
+ case 'squash': {
876
+ this.runChecked(['merge', '--squash', branch], 'git-merge-failed');
877
+ const commitArgs = ['commit', '-m', message ?? `Merge branch '${branch}'`];
878
+ this.runChecked(commitArgs, 'git-merge-failed');
879
+ break;
880
+ }
881
+ case 'rebase':
882
+ this.runChecked(['merge', '--rebase', branch], 'git-merge-failed');
883
+ break;
884
+ default:
885
+ this.runChecked(['merge', branch], 'git-merge-failed');
886
+ break;
887
+ }
875
888
  }
876
889
 
877
890
  mergeAbort(): void {
@@ -147,6 +147,7 @@ export class GitVcsDelegates extends VcsDelegateBase<GitRuntimeDependencies> {
147
147
  staging: true,
148
148
  push_pull: true,
149
149
  fast_forward: true,
150
+ merge_strategies: ['merge', 'squash', 'rebase'],
150
151
  };
151
152
  }
152
153
 
@@ -592,7 +593,12 @@ export class GitVcsDelegates extends VcsDelegateBase<GitRuntimeDependencies> {
592
593
  _context: PluginRuntimeContext,
593
594
  ): null {
594
595
  const git = this.requireGit(params.session_id);
595
- git.mergeIntoCurrent(asTrimmedString(params.name));
596
+ const rawStrategy = asTrimmedString(params.strategy);
597
+ const strategy = rawStrategy && !['merge', 'squash', 'rebase'].includes(rawStrategy)
598
+ ? (() => { throw pluginError('vcs-merge-invalid-strategy', `Unknown merge strategy '${rawStrategy}'. Must be 'merge', 'squash', or 'rebase'.`); })()
599
+ : (rawStrategy || undefined);
600
+ const message = asTrimmedString(params.message) || undefined;
601
+ git.mergeIntoCurrent(asTrimmedString(params.name), strategy, message);
596
602
  return null;
597
603
  }
598
604