opencode-swarm-plugin 0.12.17 → 0.12.18

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/dist/index.js CHANGED
@@ -22132,15 +22132,35 @@ var beads_sync = tool({
22132
22132
  }
22133
22133
  }
22134
22134
  };
22135
+ const flushResult = await withTimeout(runBdCommand(["sync", "--flush-only"]), TIMEOUT_MS, "bd sync --flush-only");
22136
+ if (flushResult.exitCode !== 0) {
22137
+ throw new BeadError(`Failed to flush beads: ${flushResult.stderr}`, "bd sync --flush-only", flushResult.exitCode);
22138
+ }
22139
+ const beadsStatusResult = await runGitCommand([
22140
+ "status",
22141
+ "--porcelain",
22142
+ ".beads/"
22143
+ ]);
22144
+ const hasChanges = beadsStatusResult.stdout.trim() !== "";
22145
+ if (hasChanges) {
22146
+ const addResult = await runGitCommand(["add", ".beads/"]);
22147
+ if (addResult.exitCode !== 0) {
22148
+ throw new BeadError(`Failed to stage beads: ${addResult.stderr}`, "git add .beads/", addResult.exitCode);
22149
+ }
22150
+ const commitResult = await withTimeout(runGitCommand(["commit", "-m", "chore: sync beads"]), TIMEOUT_MS, "git commit");
22151
+ if (commitResult.exitCode !== 0 && !commitResult.stdout.includes("nothing to commit")) {
22152
+ throw new BeadError(`Failed to commit beads: ${commitResult.stderr}`, "git commit", commitResult.exitCode);
22153
+ }
22154
+ }
22135
22155
  if (autoPull) {
22136
22156
  const pullResult = await withTimeout(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
22137
22157
  if (pullResult.exitCode !== 0) {
22138
22158
  throw new BeadError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
22139
22159
  }
22140
- }
22141
- const syncResult = await withTimeout(runBdCommand(["sync"]), TIMEOUT_MS, "bd sync");
22142
- if (syncResult.exitCode !== 0) {
22143
- throw new BeadError(`Failed to sync beads: ${syncResult.stderr}`, "bd sync", syncResult.exitCode);
22160
+ const importResult = await withTimeout(runBdCommand(["sync", "--import-only"]), TIMEOUT_MS, "bd sync --import-only");
22161
+ if (importResult.exitCode !== 0) {
22162
+ console.warn(`[beads] Import warning: ${importResult.stderr}`);
22163
+ }
22144
22164
  }
22145
22165
  const pushResult = await withTimeout(runGitCommand(["push"]), TIMEOUT_MS, "git push");
22146
22166
  if (pushResult.exitCode !== 0) {
package/dist/plugin.js CHANGED
@@ -22132,15 +22132,35 @@ var beads_sync = tool({
22132
22132
  }
22133
22133
  }
22134
22134
  };
22135
+ const flushResult = await withTimeout(runBdCommand(["sync", "--flush-only"]), TIMEOUT_MS, "bd sync --flush-only");
22136
+ if (flushResult.exitCode !== 0) {
22137
+ throw new BeadError(`Failed to flush beads: ${flushResult.stderr}`, "bd sync --flush-only", flushResult.exitCode);
22138
+ }
22139
+ const beadsStatusResult = await runGitCommand([
22140
+ "status",
22141
+ "--porcelain",
22142
+ ".beads/"
22143
+ ]);
22144
+ const hasChanges = beadsStatusResult.stdout.trim() !== "";
22145
+ if (hasChanges) {
22146
+ const addResult = await runGitCommand(["add", ".beads/"]);
22147
+ if (addResult.exitCode !== 0) {
22148
+ throw new BeadError(`Failed to stage beads: ${addResult.stderr}`, "git add .beads/", addResult.exitCode);
22149
+ }
22150
+ const commitResult = await withTimeout(runGitCommand(["commit", "-m", "chore: sync beads"]), TIMEOUT_MS, "git commit");
22151
+ if (commitResult.exitCode !== 0 && !commitResult.stdout.includes("nothing to commit")) {
22152
+ throw new BeadError(`Failed to commit beads: ${commitResult.stderr}`, "git commit", commitResult.exitCode);
22153
+ }
22154
+ }
22135
22155
  if (autoPull) {
22136
22156
  const pullResult = await withTimeout(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
22137
22157
  if (pullResult.exitCode !== 0) {
22138
22158
  throw new BeadError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
22139
22159
  }
22140
- }
22141
- const syncResult = await withTimeout(runBdCommand(["sync"]), TIMEOUT_MS, "bd sync");
22142
- if (syncResult.exitCode !== 0) {
22143
- throw new BeadError(`Failed to sync beads: ${syncResult.stderr}`, "bd sync", syncResult.exitCode);
22160
+ const importResult = await withTimeout(runBdCommand(["sync", "--import-only"]), TIMEOUT_MS, "bd sync --import-only");
22161
+ if (importResult.exitCode !== 0) {
22162
+ console.warn(`[beads] Import warning: ${importResult.stderr}`);
22163
+ }
22144
22164
  }
22145
22165
  const pushResult = await withTimeout(runGitCommand(["push"]), TIMEOUT_MS, "git push");
22146
22166
  if (pushResult.exitCode !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.12.17",
3
+ "version": "0.12.18",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/beads.ts CHANGED
@@ -664,7 +664,58 @@ export const beads_sync = tool({
664
664
  }
665
665
  };
666
666
 
667
- // 1. Pull if requested
667
+ // 1. Flush beads to JSONL (doesn't use worktrees)
668
+ const flushResult = await withTimeout(
669
+ runBdCommand(["sync", "--flush-only"]),
670
+ TIMEOUT_MS,
671
+ "bd sync --flush-only",
672
+ );
673
+ if (flushResult.exitCode !== 0) {
674
+ throw new BeadError(
675
+ `Failed to flush beads: ${flushResult.stderr}`,
676
+ "bd sync --flush-only",
677
+ flushResult.exitCode,
678
+ );
679
+ }
680
+
681
+ // 2. Check if there are changes to commit
682
+ const beadsStatusResult = await runGitCommand([
683
+ "status",
684
+ "--porcelain",
685
+ ".beads/",
686
+ ]);
687
+ const hasChanges = beadsStatusResult.stdout.trim() !== "";
688
+
689
+ if (hasChanges) {
690
+ // 3. Stage .beads changes
691
+ const addResult = await runGitCommand(["add", ".beads/"]);
692
+ if (addResult.exitCode !== 0) {
693
+ throw new BeadError(
694
+ `Failed to stage beads: ${addResult.stderr}`,
695
+ "git add .beads/",
696
+ addResult.exitCode,
697
+ );
698
+ }
699
+
700
+ // 4. Commit
701
+ const commitResult = await withTimeout(
702
+ runGitCommand(["commit", "-m", "chore: sync beads"]),
703
+ TIMEOUT_MS,
704
+ "git commit",
705
+ );
706
+ if (
707
+ commitResult.exitCode !== 0 &&
708
+ !commitResult.stdout.includes("nothing to commit")
709
+ ) {
710
+ throw new BeadError(
711
+ `Failed to commit beads: ${commitResult.stderr}`,
712
+ "git commit",
713
+ commitResult.exitCode,
714
+ );
715
+ }
716
+ }
717
+
718
+ // 5. Pull if requested (with rebase to avoid merge commits)
668
719
  if (autoPull) {
669
720
  const pullResult = await withTimeout(
670
721
  runGitCommand(["pull", "--rebase"]),
@@ -678,23 +729,20 @@ export const beads_sync = tool({
678
729
  pullResult.exitCode,
679
730
  );
680
731
  }
681
- }
682
732
 
683
- // 2. Sync beads
684
- const syncResult = await withTimeout(
685
- runBdCommand(["sync"]),
686
- TIMEOUT_MS,
687
- "bd sync",
688
- );
689
- if (syncResult.exitCode !== 0) {
690
- throw new BeadError(
691
- `Failed to sync beads: ${syncResult.stderr}`,
692
- "bd sync",
693
- syncResult.exitCode,
733
+ // 6. Import any changes from remote
734
+ const importResult = await withTimeout(
735
+ runBdCommand(["sync", "--import-only"]),
736
+ TIMEOUT_MS,
737
+ "bd sync --import-only",
694
738
  );
739
+ if (importResult.exitCode !== 0) {
740
+ // Non-fatal - just log warning
741
+ console.warn(`[beads] Import warning: ${importResult.stderr}`);
742
+ }
695
743
  }
696
744
 
697
- // 3. Push
745
+ // 7. Push
698
746
  const pushResult = await withTimeout(
699
747
  runGitCommand(["push"]),
700
748
  TIMEOUT_MS,