@cardinal4/opencode-fold-diffs 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tui.js +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardinal4/opencode-fold-diffs",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenCode V2 TUI plugin: write, edit and apply_patch blocks render folded to their header line, click or ctrl+o to open them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/tui.js CHANGED
@@ -89,14 +89,17 @@ function plain(node) {
89
89
 
90
90
  // Duck-typing, not instanceof: the classes live in the host's bundled
91
91
  // @opentui/core and are minified, so their names are not stable. A diff
92
- // renderable is the only thing in the tree carrying a `diff` string, and a code
93
- // renderable the only thing pairing `content` with `filetype`.
92
+ // renderable is the only thing in the tree carrying a `diff` string. A code
93
+ // renderable is the only thing whose `content` is a string -- text renderables
94
+ // carry a styled-text `content` object and expose `plainText` instead. OpenCode
95
+ // 2.0.16 stopped setting `filetype` on a written file's body, so it must not be
96
+ // required (requiring it silently stopped every write block from folding).
94
97
  function isDiff(node) {
95
98
  return typeof node?.diff === "string";
96
99
  }
97
100
 
98
101
  function isCode(node) {
99
- return typeof node?.content === "string" && typeof node?.filetype === "string";
102
+ return typeof node?.content === "string";
100
103
  }
101
104
 
102
105
  // The command text of a bash block, or nothing. V2 wraps the command and its