zjbar-opencode 1.1.3 → 1.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -114,6 +114,18 @@ var ZjbarPlugin = async ({ directory }) => {
114
114
  return {};
115
115
  const sessionId = crypto.randomUUID();
116
116
  const termProgram = process.env.TERM_PROGRAM || null;
117
+ let zellijBin = "zellij";
118
+ try {
119
+ const { execFileSync } = __require("node:child_process");
120
+ zellijBin = execFileSync("which", ["zellij"], { encoding: "utf-8" }).trim() || "zellij";
121
+ } catch {
122
+ for (const p of ["/opt/homebrew/bin/zellij", "/usr/local/bin/zellij", "/usr/bin/zellij"]) {
123
+ if (existsSync(p)) {
124
+ zellijBin = p;
125
+ break;
126
+ }
127
+ }
128
+ }
117
129
  function sendToZjbar(hookEvent, toolName) {
118
130
  const payload = JSON.stringify({
119
131
  source: "opencode",
@@ -125,7 +137,7 @@ var ZjbarPlugin = async ({ directory }) => {
125
137
  zellij_session: zellijSession,
126
138
  term_program: termProgram
127
139
  });
128
- const child = spawn("zellij", [
140
+ const child = spawn(zellijBin, [
129
141
  "-s",
130
142
  zellijSession,
131
143
  "pipe",
@@ -142,7 +154,8 @@ var ZjbarPlugin = async ({ directory }) => {
142
154
  sendToZjbar("SessionStart");
143
155
  return {
144
156
  event: async ({ event }) => {
145
- switch (event.type) {
157
+ const ev = event;
158
+ switch (ev.type) {
146
159
  case "session.created":
147
160
  sendToZjbar("SessionStart");
148
161
  break;
@@ -163,9 +176,6 @@ var ZjbarPlugin = async ({ directory }) => {
163
176
  "tool.execute.before": async (input) => {
164
177
  const toolName = TOOL_MAP[input.tool] || capitalize(input.tool);
165
178
  sendToZjbar("PreToolUse", toolName);
166
- },
167
- "tool.execute.after": async () => {
168
- sendToZjbar("PostToolUse");
169
179
  }
170
180
  };
171
181
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zjbar-opencode",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "zjbar plugin for OpenCode — live AI activity indicators in Zellij status bar",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",