opencode-handoff 0.3.2 → 0.5.0
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/README.md +10 -12
- package/package.json +3 -3
- package/src/tools.ts +5 -9
package/README.md
CHANGED
|
@@ -13,32 +13,30 @@ Inspired by Amp's handoff command - see their [post](https://ampcode.com/news/ha
|
|
|
13
13
|
|
|
14
14
|
## Requirements
|
|
15
15
|
|
|
16
|
-
- [OpenCode](https://opencode.ai/) v1.
|
|
16
|
+
- [OpenCode](https://opencode.ai/) v1.2.15 or later
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
|
-
Add to your OpenCode config (`~/.config/opencode/
|
|
20
|
+
Add to your OpenCode config (`~/.config/opencode/opencode.json`):
|
|
21
21
|
|
|
22
22
|
```json
|
|
23
23
|
{
|
|
24
|
-
"plugin": ["opencode-handoff
|
|
24
|
+
"plugin": ["opencode-handoff"]
|
|
25
25
|
}
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Restart OpenCode and you're ready to go.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Optionally, pin to a specific version for stability:
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
git clone https://github.com/joshuadavidthomas/opencode-handoff ~/.config/opencode/opencode-handoff
|
|
38
|
-
mkdir -p ~/.config/opencode/plugin
|
|
39
|
-
ln -sf ~/.config/opencode/opencode-handoff/src/plugin.ts ~/.config/opencode/plugin/handoff.ts
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"plugin": ["opencode-handoff@0.5.0"]
|
|
35
|
+
}
|
|
40
36
|
```
|
|
41
37
|
|
|
38
|
+
OpenCode fetches unpinned plugins from npm on each startup; pinned versions are cached and require a manual version bump to update.
|
|
39
|
+
|
|
42
40
|
## Usage
|
|
43
41
|
|
|
44
42
|
1. Have a conversation in OpenCode with some context
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-handoff",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Create focused handoff prompts for continuing work in new OpenCode sessions",
|
|
6
6
|
"author": "Josh Thomas <josh@joshthomas.dev>",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"typecheck": "tsc --noEmit"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@opencode-ai/plugin": "^1.
|
|
25
|
-
"@opencode-ai/sdk": "^1.
|
|
24
|
+
"@opencode-ai/plugin": "^1.2.15",
|
|
25
|
+
"@opencode-ai/sdk": "^1.2.15",
|
|
26
26
|
"zod": "^4.1.13"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
package/src/tools.ts
CHANGED
|
@@ -32,16 +32,12 @@ export const HandoffSession = (client: OpencodeClient) => {
|
|
|
32
32
|
? `${sessionReference}\n\n${fileRefs}\n\n${args.prompt}`
|
|
33
33
|
: `${sessionReference}\n\n${args.prompt}`
|
|
34
34
|
|
|
35
|
-
// Double-append workaround for textarea resize bug:
|
|
36
|
-
// appendPrompt uses insertText() which bypasses onContentChange, so resize never triggers.
|
|
37
|
-
// First append sets height in old session, session_new preserves textarea element,
|
|
38
|
-
// second append populates new session with already-expanded textarea.
|
|
39
|
-
await client.tui.clearPrompt()
|
|
40
|
-
await new Promise(r => setTimeout(r, 50))
|
|
41
|
-
await client.tui.appendPrompt({ body: { text: fullPrompt } })
|
|
42
35
|
await client.tui.executeCommand({ body: { command: "session_new" } })
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
// session_new is fire-and-forget (publishes a bus event, returns immediately).
|
|
37
|
+
// The TUI needs time to navigate to the home screen and mount the new prompt
|
|
38
|
+
// input before appendPrompt can insert text — otherwise the event is silently
|
|
39
|
+
// dropped because the input component doesn't exist yet.
|
|
40
|
+
await new Promise(r => setTimeout(r, 150))
|
|
45
41
|
await client.tui.appendPrompt({ body: { text: fullPrompt } })
|
|
46
42
|
|
|
47
43
|
await client.tui.showToast({
|