GitHub 星标
0
月装机量
15
近 7 天 1
综合评分SCORE
20.5
生态多维模型
最近提交
4 个月前
2026-04-11
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @wafonro2/opencode-resurrectopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
README.md
查看原始文件→OpenCode plugin that saves the active session ID in the project folder and restores that session when OpenCode starts.
What it does
- Listens for
session.created,session.updated, andsession.deletedevents. - Writes
<project root>/.opencode-session-<YYYYMMDD-HHMMSSmmm>.txtcontaining only the session ID. - Avoids redundant writes by caching the last value written for each file.
- On startup, restores the most recent saved session in that project.
Install from npm (recommended)
Add the published package to your OpenCode config.
Project config (opencode.json in your repo root):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect"]
}
Global config (~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect"]
}
Then restart opencode. OpenCode installs npm plugins automatically at startup.
Verify it works
- Start
opencodein a project. - Create or update a session.
- Confirm a file like
.opencode-session-20260411-021857123.txtappears in the project root. - Restart
opencodein the same project and confirm the session restores automatically.
Local development install (optional)
For local file-based plugin loading during development:
./install.sh --globalinstalls to~/.config/opencode/plugins/../install.sh --project /path/to/projectinstalls to/path/to/project/.opencode/plugins/.