Skip to content

Commit 9efa69f

Browse files
committed
fix(caffeinate): use exec instead of bun shell
1 parent 4defd23 commit 9efa69f

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

lerna.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
},
1111
"version": {
1212
"allowBranch": ["main"],
13-
"conventionalCommits": true
13+
"conventionalCommits": true,
14+
"ignoreChanges": [],
15+
"message": "chore: publish packages to npm registry [skip ci]"
1416
}
1517
}
16-
}
18+
}

plugins/caffeinate/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
| windows | :x: |
99

1010
Prevent your system from sleeping during agentic workflows.
11+
12+
## Installation
13+
14+
Copy the [content](https://unpkg.com/@opencode-plugins/caffeinate@1.0.0/dist/plugin.js) to `~/.config/opencode/plugin/caffeinate.js`

plugins/caffeinate/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "module",
33
"name": "@opencode-plugins/caffeinate",
4-
"version": "1.0.1",
4+
"version": "1.0.0",
55
"author": "Jan Biasi (https://github.com/janbiasi)",
66
"description": "Prevent your system from sleeping during agentic workflows.",
77
"publishConfig": {
@@ -16,5 +16,6 @@
1616
"devDependencies": {
1717
"@opencode-ai/plugin": "^1",
1818
"@types/bun": "latest"
19-
}
19+
},
20+
"gitHead": "b043cf62150fc9ad17e87bf54d9f2ab33240fe65"
2021
}

plugins/caffeinate/plugin.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import { promisify } from "node:util"
2+
import { exec } from "node:child_process"
13
import type { Plugin } from "@opencode-ai/plugin";
24

5+
const execAsync = promisify(exec);
36

47
const commands = {
58
caffeinate: {
@@ -13,13 +16,14 @@ const commands = {
1316
export const CaffeinatePlugin: Plugin = async ({ project, client, $, directory, worktree }) => {
1417
const kernelInfo = (await $`uname -a`).text.toString().toLowerCase();
1518
if (!kernelInfo.startsWith("darwin")) {
16-
client.tui.showToast({
19+
await client.tui.showToast({
1720
body: {
1821
title: "Caffeinate not supported",
1922
message: "Caffeinate currently only works on macOS",
2023
variant: "warning"
2124
}
2225
})
26+
return {};
2327
}
2428

2529
const caffeinateCmds = commands.caffeinate.darwin;
@@ -36,11 +40,10 @@ export const CaffeinatePlugin: Plugin = async ({ project, client, $, directory,
3640
case "todo.updated":
3741
case "session.updated":
3842
case "message.part.updated":
39-
case "lsp.updated":
40-
await Promise.all(caffeinateCmds.map(cmd => $`${cmd}`))
43+
await Promise.all(caffeinateCmds.map(cmd => execAsync(`${cmd}`)));
4144
break;
4245
case "session.idle":
43-
await Promise.all(uncaffeinateCmds.map(cmd => $`${cmd}`))
46+
await Promise.all(uncaffeinateCmds.map(cmd => execAsync(`${cmd}`)));
4447
break;
4548
default:
4649
break;

plugins/env-protection/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "module",
33
"name": "@opencode-plugins/env-protection",
4-
"version": "1.0.1",
4+
"version": "1.0.0",
55
"author": "Jan Biasi (https://github.com/janbiasi)",
66
"description": "Prevent opencode to read any .env file",
77
"publishConfig": {
@@ -16,5 +16,6 @@
1616
"devDependencies": {
1717
"@opencode-ai/plugin": "^1",
1818
"@types/bun": "latest"
19-
}
19+
},
20+
"gitHead": "b043cf62150fc9ad17e87bf54d9f2ab33240fe65"
2021
}

0 commit comments

Comments
 (0)