Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opcode-kit

Small Unix-style helpers for OpenCode workflows, as a single Go binary.

   ██████╗  ██████╗   ██████╗  ██████╗  ██████╗  ███████╗          ██╗  ██╗ ██╗ ████████╗
  ██╔═══██╗ ██╔══██╗ ██╔════╝ ██╔═══██╗ ██╔══██╗ ██╔════╝          ██║ ██╔╝ ██║ ╚══██╔══╝
  ██║   ██║ ██████╔╝ ██║      ██║   ██║ ██║  ██║ █████╗            █████╔╝  ██║    ██║   
  ██║   ██║ ██╔═══╝  ██║      ██║   ██║ ██║  ██║ ██╔══╝            ██╔═██╗  ██║    ██║   
  ╚██████╔╝ ██║      ╚██████╗ ╚██████╔╝ ██████╔╝ ███████╗          ██║  ██╗ ██║    ██║   
   ╚═════╝  ╚═╝       ╚═════╝  ╚═════╝  ╚═════╝  ╚══════╝          ╚═╝  ╚═╝ ╚═╝    ╚═╝   

Commands

opcode-kit switch   manage local OpenCode accounts
opcode-kit last     find and reopen OpenCode sessions
opcode-kit version  show version
opcode-kit help     show usage

Legacy compatibility wrappers (installed alongside):

  • opcode-switchopcode-kit switch "$@"
  • opcode-lastopcode-kit last "$@"

Install

curl -fsSL https://raw.githubusercontent.com/srmdn/opcode-kit/main/install.sh | bash

This builds the binary from source and installs it plus both wrappers into ~/.local/bin (or $PREFIX/bin).

Selective installs:

curl -fsSL https://raw.githubusercontent.com/srmdn/opcode-kit/main/install.sh | bash -s -- opcode-kit
curl -fsSL https://raw.githubusercontent.com/srmdn/opcode-kit/main/install.sh | bash -s -- opcode-switch
curl -fsSL https://raw.githubusercontent.com/srmdn/opcode-kit/main/install.sh | bash -s -- opcode-last

From a local checkout:

./install.sh

Requires:

Tool-specific notes:

  • opcode-kit last reads the local SQLite history, no network
  • opcode-kit switch --verify needs opencode on PATH

Quick Start

Session recovery:

opcode-kit last
opcode-kit last --show 1
opcode-kit last --open 1
opcode-kit last --recent

Account switching:

opcode-kit switch
opcode-kit switch --save personal
opcode-kit switch work
opcode-kit switch --remove old-account
opcode-kit switch --verify

--remove deletes the saved account and its matching OpenCode Go store entries while preserving other providers.

Example Output

$ opcode-kit last
OpenCode sessions for:
  /path/to/project

[1] Fix installer edge case
     id: ses_abc123
     dir: /path/to/project
     updated: 2026-06-23 19:41:02
     messages: 38
     first user: make install.sh support one-tool installs too
     last user: sanitize repo before first commit
     last assistant: no confidential data found in tracked files...

Next:
  opcode-kit last --show N
  opcode-kit last --open N
$ opcode-kit switch
Available accounts:
  → personal
    work

Usage: opcode-kit switch <name>

Why This Exists

OpenCode keeps local session history, but finding the right session later is not always easy.

Common failure modes:

  • a session still exists, but the user cannot remember which one has the useful context
  • switching API accounts used to mean hand-editing auth files, and older tooling wrote a file OpenCode stopped reading

opcode-kit fixes both with small, inspectable commands.

Development

go build ./...
go vet ./...
go test ./...

The only external dependency is modernc.org/sqlite (pure-Go, no cgo) for reading session history.

Repo Shape

opcode-kit/
  README.md
  LICENSE
  AGENTS.md
  install.sh
  cmd/
    opcode-kit/
      main.go
  internal/
    switchcmd/
    last/
  docs/
    opcode-switch.md
    oc-last.md

Principles

  • keep tools small
  • keep tools readable
  • prefer Go stdlib, one dependency max
  • solve real OpenCode workflow problems

Docs

License

MIT

About

Small Unix-style helpers for OpenCode sessions and account switching

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages