跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    wafonro2

    Resurrect

    v0.1.1其他
    @wafonro2/opencode-resurrect

    OpenCode plugin that saves and restores the latest session per project

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    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, and session.deleted events.
    • Writes <project root>/.opencode-session-<YYYYMMDD-HHMMSSmmm>.txt containing 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

    1. Start opencode in a project.
    2. Create or update a session.
    3. Confirm a file like .opencode-session-20260411-021857123.txt appears in the project root.
    4. Restart opencode in the same project and confirm the session restores automatically.

    Local development install (optional)

    For local file-based plugin loading during development:

    • ./install.sh --global installs to ~/.config/opencode/plugins/.
    • ./install.sh --project /path/to/project installs to /path/to/project/.opencode/plugins/.