@xinleibird/bridge-opencode 0.1.1 → 0.1.3

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.
Binary file
Binary file
Binary file
package/bridge.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  import type { Plugin } from "@opencode-ai/plugin";
2
2
  import { isAbsolute, join } from "node:path";
3
- import {
4
- checkBuffer,
5
- refreshBuffer,
6
- getVisualSelections,
7
- } from "./index.cjs";
3
+ import { checkBuffer, refreshBuffer, getVisualSelections } from "./index.cjs";
8
4
 
9
5
  type ToolName = "Edit" | "Write";
10
6
 
@@ -23,9 +19,7 @@ const PATCH_FILE_MARKERS = [
23
19
  function pickFilePath(args: unknown): string | null {
24
20
  if (!args || typeof args !== "object") return null;
25
21
  const candidate = (args as Record<string, unknown>).filePath;
26
- return typeof candidate === "string" && candidate.length > 0
27
- ? candidate
28
- : null;
22
+ return typeof candidate === "string" && candidate.length > 0 ? candidate : null;
29
23
  }
30
24
 
31
25
  function pickPatchPaths(args: unknown): string[] {
@@ -47,11 +41,7 @@ function pickPatchPaths(args: unknown): string[] {
47
41
  return paths;
48
42
  }
49
43
 
50
- function resolveCall(
51
- tool: string,
52
- args: unknown,
53
- cwd: string,
54
- ): { filePaths: string[] } | null {
44
+ function resolveCall(tool: string, args: unknown, cwd: string): { filePaths: string[] } | null {
55
45
  const abs = (p: string) => (isAbsolute(p) ? p : join(cwd, p));
56
46
 
57
47
  if (tool === "apply_patch") {
@@ -77,9 +67,7 @@ export const BridgePlugin: Plugin = async ({ directory }) => {
77
67
  for (const filePath of call.filePaths) {
78
68
  const status = await checkBuffer(filePath);
79
69
  if (status.hasUnsavedChanges && status.isCurrent) {
80
- throw new Error(
81
- "bridge: file has unsaved changes in Neovim",
82
- );
70
+ throw new Error("bridge: file has unsaved changes in Neovim");
83
71
  }
84
72
  }
85
73
 
@@ -105,9 +93,7 @@ export const BridgePlugin: Plugin = async ({ directory }) => {
105
93
  }
106
94
  if (!selections || selections.length === 0) return;
107
95
 
108
- const filteredSelections = selections.filter(
109
- (s) => !s.cwd || s.cwd === cwd,
110
- );
96
+ const filteredSelections = selections.filter((s) => !s.cwd || s.cwd === cwd);
111
97
  if (filteredSelections.length === 0) return;
112
98
 
113
99
  const textPart = output.parts.find((p: any) => p.type === "text") as any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xinleibird/bridge-opencode",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "bridge.ts",
6
6
  "repository": {