opencode-summary 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 frostehhh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,158 @@
1
- # Temporary Holding Version
1
+ # opencode-summary
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/frostehhh/opencode-summary/actions/workflows/ci.yml/badge.svg)](https://github.com/frostehhh/opencode-summary/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/opencode-summary.svg)](https://www.npmjs.com/package/opencode-summary)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ TUI plugin for [opencode](https://opencode.ai) V2. `/summary` opens a modal that generates and shows a summary of the
8
+ current session using `session.generate` (the session's current model; the conversation history is not changed). The
9
+ summary is stored in session metadata (`metadata["opencode-summary"]`), and a footer indicator shows how many turns ago
10
+ it was made.
11
+
12
+ ## Install
13
+
14
+ ### From npm (recommended)
15
+
16
+ ```sh
17
+ opencode plugin add opencode-summary
18
+ ```
19
+
20
+ Or add it to your TUI config (`cli.json`) yourself, since it is a TUI-only plugin:
21
+
22
+ ```json
23
+ { "plugins": ["opencode-summary"] }
24
+ ```
25
+
26
+ Pin a version with `opencode-summary@0.1.0`. Without a version, opencode checks for updates; run
27
+ `opencode plugin update opencode-summary` to update.
28
+
29
+ ### From GitHub
30
+
31
+ ```sh
32
+ opencode plugin add github:frostehhh/opencode-summary#v0.1.0
33
+ ```
34
+
35
+ Replace `v0.1.0` with the [release](https://github.com/frostehhh/opencode-summary/releases) you want. Omit the `#tag`
36
+ to follow the default branch.
37
+
38
+ Restart opencode after installing.
39
+
40
+ ### Local development
41
+
42
+ Clone the repo and symlink it into the global plugin directory, where the TUI discovers it:
43
+
44
+ ```sh
45
+ git clone https://github.com/frostehhh/opencode-summary
46
+ ln -s "$PWD/opencode-summary" ~/.config/opencode/plugins/opencode-summary
47
+ ```
48
+
49
+ Edits hot-reload in a running TUI.
50
+
51
+ ## Usage
52
+
53
+ Run `/summary` (or "Open summary modal" in the command palette) inside a session.
54
+
55
+ | Key | Action |
56
+ |---|---|
57
+ | `g` | generate a summary |
58
+ | `v` | toggle prompt view |
59
+ | `c` | copy the summary (summary view) |
60
+ | `e` | edit the prompt (prompt view) |
61
+ | `r` | reset the prompt (prompt view) |
62
+ | `j`/`k`, `↑`/`↓` | scroll |
63
+ | `esc` | close |
64
+
65
+ Bind a global key in `cli.json` with `keybinds`: `{"summary.open": "<key>"}`.
66
+
67
+ ### Commands
68
+
69
+ Palette group "Summary". Only the first has a slash command.
70
+
71
+ | Command | Id | Does |
72
+ |---|---|---|
73
+ | Open summary modal | `summary.open` (`/summary`) | opens the modal |
74
+ | Generate summary | `summary.generate` | generates without the modal |
75
+ | Copy summary | `summary.copy` | copies the stored summary |
76
+ | Delete summary | `summary.delete` | removes the stored summary, after confirm |
77
+ | View summary prompt | `summary.prompt.view` | modal in prompt view |
78
+ | Edit summary prompt | `summary.prompt.edit` | `$VISUAL`/`$EDITOR`, else modal editor |
79
+ | Reset summary prompt | `summary.prompt.reset` | deletes the override, after confirm |
80
+ | Toggle summary footer indicator | `summary.indicator.toggle` | hides or shows `summary N turns ago` (the spinner stays) |
81
+
82
+ The indicator setting is persisted, so it survives restarts.
83
+
84
+ ## Prompt
85
+
86
+ The default prompt is in [`src/prompt.ts`](src/prompt.ts). Your own prompt is stored at:
87
+
88
+ ```
89
+ $XDG_CONFIG_HOME/opencode/opencode-summary/summary.md # default: ~/.config/opencode/opencode-summary/summary.md
90
+ ```
91
+
92
+ This lives outside the plugin, so it survives plugin updates. A fixed line forbidding tool calls is always prepended
93
+ and cannot be edited. `e` opens `$VISUAL`/`$EDITOR` on the file; if neither is set, a multi-line editor opens in the
94
+ modal (`ctrl+s` save, `esc` cancel). `r` deletes the override.
95
+
96
+ ## Development
97
+
98
+ ```sh
99
+ bun install
100
+ bun test
101
+ bun run build # compiles src/tui.tsx -> dist/tui.js
102
+ ```
103
+
104
+ opencode does not compile `.tsx` files inside `node_modules`, so the package ships the compiled `dist/tui.js`
105
+ (`exports["./tui"]`). `dist/` is committed so `github:` installs work, and CI fails if it is out of date: run
106
+ `bun run build` (Bun 1.3.11, the version CI pins, so output is identical) and commit `dist/` together with your `src/` change. For local development, the symlink points at the
107
+ repo, so use `dist/tui.js` via `bun run build`, or point your plugin config at `src/tui.tsx` directly.
108
+
109
+ `src/lib.ts` is pure and must not import opencode packages; `test/lib.test.ts` covers it. `src/tui.tsx` is checked
110
+ manually with the checklist below.
111
+
112
+ ### Manual checklist
113
+
114
+ - [ ] `/summary` in slash completion and palette; on home shows "Open a session first"
115
+ - [ ] `g` shows the summary and "Generated …"; it persists after a TUI restart; `c` copies the markdown
116
+ - [ ] Footer: `summary up to date` after `g`, then `summary N turns ago` as messages are sent
117
+ - [ ] `g` then `esc`: footer spinner, then toast "Summary ready"; `g` mid-run shows "Already generating"
118
+ - [ ] Revert and fork behave as described in the design docs
119
+ - [ ] `e`/`r` only in prompt view, `c` only in summary view
120
+ - [ ] Prompt edit with `$EDITOR` set and unset; saved file appears at the override path above; `r` removes it
121
+ - [ ] Palette "Summary" lists all eight commands; only "Open summary modal" has `/summary`
122
+ - [ ] Toggle footer indicator hides/shows the label and persists after restart
123
+
124
+ ## Contributing
125
+
126
+ Commits and PR titles follow [Conventional Commits](https://www.conventionalcommits.org/), enforced by
127
+ [commitlint](https://commitlint.js.org/) (a `commit-msg` hook locally, and CI on pull requests).
128
+
129
+ ```
130
+ <type>(<optional scope>): <description>
131
+
132
+ feat: add a new capability -> minor bump
133
+ fix: correct a bug -> patch bump
134
+ feat!: change behavior incompatibly -> breaking (minor while < 1.0)
135
+ docs | refactor | test | chore | ci | build | perf | style
136
+ ```
137
+
138
+ ## Releasing
139
+
140
+ Versions follow [SemVer](https://semver.org/) and are derived from commit messages by
141
+ [release-please](https://github.com/googleapis/release-please). While the version is `0.x`, `feat` bumps the minor
142
+ version and `fix` bumps the patch.
143
+
144
+ 1. Merge changes to `main` using conventional commits.
145
+ 2. release-please opens or updates a "chore(main): release x.y.z" PR with the version bump and `CHANGELOG.md`.
146
+ 3. Merge that PR: it creates the `vX.Y.Z` tag and a GitHub Release.
147
+
148
+ Repository setting required once: **Settings → Actions → General → "Allow GitHub Actions to create and approve pull
149
+ requests"**.
150
+
151
+ ## Design docs
152
+
153
+ The design, plan and research for this plugin live in the
154
+ [`ai-tools`](https://github.com/frostehhh/ai-tools/tree/main/openspec/changes/create-opencode-summary-plugin) repo.
155
+
156
+ ## License
157
+
158
+ [MIT](LICENSE)