opencode-idle-workspace-reaperOpenCode plugin that disposes idle workspaces and reacts to session disposal events.
0
23
近 7 天 3
26.8
生态多维模型
1 个月前
2026-07-14
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-idle-workspace-reaper@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-idle-workspace-reaper@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-idle-workspace-reaperopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode plugin that disposes a workspace after one hour of inactivity, using a five-second confirmation pass and a five-minute retry after SDK failures. It also disposes immediately when the current workspace session is archived or deleted, and stops its timers when OpenCode reports that the current directory's server instance was already disposed. It vetoes idle disposal while a session is busy or a PTY is running, scopes status, PTY, log, and dispose calls to the plugin directory, and only disposes through the explicit hook lifecycle.
Install with npm install opencode-idle-workspace-reaper, then point OpenCode at the installed package entry file under node_modules/opencode-idle-workspace-reaper/index.ts. For local development, configure OpenCode with file:///home/bhyoo/projects/typescript/opencode-idle-workspace-reaper/index.ts. Run bun install, then bun run check.
Limitation: a separate plugin cannot observe an OMO task stuck pending before session creation for over one hour.
Releasing
The first npm publish for 0.1.1 is manual so the package exists on npm. Future publishes use npm Trusted Publishing through GitHub Actions OIDC; do not add an npm token or NODE_AUTH_TOKEN secret for publishing.
After 0.1.1 exists on npm, configure the package on npmjs.com under Settings → Trusted Publisher with these values:
- Publisher: GitHub Actions
- Organization or user:
isac322 - Repository:
opencode-idle-workspace-reaper - Workflow filename:
publish.yml - Environment name: leave blank
- Allowed action:
npm publish
For each later release, bump package.json, commit, tag the same version as vX.Y.Z, push the commit and tag, then publish a GitHub Release for that tag. The .github/workflows/publish.yml workflow checks the package, verifies the release tag matches package.json, and runs npm publish through OIDC. The first CI-published version should be 0.1.2 or newer, because 0.1.1 is reserved for the manual bootstrap publish.
npm provenance is generated automatically for GitHub Actions trusted publishing only when the package and source repository are public. If this GitHub repository stays private, OIDC publishing can still be configured but npm provenance will not be generated.