@nxxxsooo/opencode-annotate 0.10.4 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 — what? notes and explicit copy
4
+
5
+ - Add **what?** (`w`) to the text-selection toolbar to mark a passage you don't
6
+ understand in one step. Sent feedback adds one instruction for all `what?` notes,
7
+ configurable under `[prompts] what` in `tui.toml`, and attaches the `what` skill when
8
+ OpenCode has one (`whatSkill` chooses another skill or `false`).
9
+ - Selecting text no longer overwrites the clipboard. Press `y` or click **copy** to copy
10
+ the selected source; the selection stays for annotating.
11
+ - Toolbar options wrap in narrow panes and remain clickable.
12
+
3
13
  ## 0.10.4 — interrupted replies
4
14
 
5
15
  - Let `/annotate`, `/annotate-pick` and `/ref` use the text of an interrupted reply, such
package/README.md CHANGED
@@ -261,8 +261,12 @@ The manifest version alone cannot identify edits to an unpacked extension.
261
261
 
262
262
  1. Run `/annotate` or `/annotate path/to/file.md` in a session.
263
263
  2. Select text by dragging, or press `v` and use movement keys.
264
- 3. Press `c` to comment, `a` for “looks good,” or `d` to request deletion.
265
- Without a selection, `c` comments on the current block. Enter saves a comment.
264
+ 3. Press `c` to comment, `w` for **what?**, `a` for “looks good,” or `d` to request deletion.
265
+ **what?** marks a passage you don't understand with a short `what?` note
266
+ ([what? notes](#what-notes)). Without a selection, `c` comments on the current block.
267
+ Enter saves a comment.
268
+ Selecting never touches the clipboard; press `y` (or click **copy**) to copy the
269
+ selected source, and the selection stays for annotating.
266
270
  4. Press **`q`** to send your notes and return to OpenCode.
267
271
 
268
272
  **`Ctrl+S`** does the same mid-comment, saving the comment first. The header's **Send N back (q)**
@@ -356,6 +360,30 @@ you switch sessions before it opens, or a new turn starts. Dismissing the review
356
360
  reloading the plugin does not reopen that reply. Sending remains your explicit action.
357
361
  OpenCode reloads saved configuration automatically; use `/reload` if needed.
358
362
 
363
+ ### What? notes
364
+
365
+ A `what?` note stays short in the review. When you send, the feedback adds one
366
+ instruction after all the notes: explain each marked passage in plain language with more
367
+ detail and a concrete example where it helps, relate it to the current task, and hold any
368
+ pending action until you confirm. Change or remove that instruction in
369
+ `~/.config/opencode-annotate/tui.toml`; an empty string sends the notes alone:
370
+
371
+ ```toml
372
+ [prompts]
373
+ what = "Explain each passage marked what? in two sentences, then stop."
374
+ ```
375
+
376
+ If OpenCode has a skill with ID `what`, the plugin attaches it to the sent feedback, the
377
+ same as mentioning `@what`. That skill can then hold pending work and ask whether to
378
+ continue. Choose another skill or turn this off with the `whatSkill` plugin option:
379
+
380
+ ```jsonc
381
+ "options": { "whatSkill": "explain" } // or false
382
+ ```
383
+
384
+ A missing default `what` skill is skipped. A missing skill that you set yourself stops the
385
+ send with an error and keeps the draft and `feedback.md`.
386
+
359
387
  ### Reviewer binary and layout
360
388
 
361
389
  The bundled reviewer is selected automatically. Use `binary` only to override it with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxxxsooo/opencode-annotate",
3
- "version": "0.10.4",
3
+ "version": "0.11.0",
4
4
  "description": "Unofficial OpenCode plugin: annotate replies, documents and webpages, and reference previous conversations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/review.mjs CHANGED
@@ -135,6 +135,24 @@ async function archivedNotes(data) {
135
135
  return count
136
136
  }
137
137
 
138
+ // A "what?" note asks for an explanation. The configured skill (default: what) can hold
139
+ // pending work while the agent explains; without it, the TUI's instruction stands alone.
140
+ const whatNote = /^Comment on: .*\n> what\?$/m
141
+
142
+ async function whatSkills(client, option, feedback, sessionID, signal) {
143
+ if (option === false || !whatNote.test(feedback)) return []
144
+ if (option !== undefined && (typeof option !== "string" || !option.trim())) {
145
+ throw new Error('Set the whatSkill option to a skill ID or false.')
146
+ }
147
+ const id = option?.trim() ?? "what"
148
+ const session = await client.session.get({ sessionID }, { signal })
149
+ const directory = session.location?.directory
150
+ const { data } = await client.skill.list(directory ? { location: { directory } } : {}, { signal })
151
+ if (data.some(skill => skill.id === id)) return [{ id }]
152
+ if (option !== undefined) throw new Error(`Can't find the "${id}" skill set as whatSkill. Install it, or set whatSkill to false.`)
153
+ return []
154
+ }
155
+
138
156
  async function interactive({ binary, file, cwd, env, signal }) {
139
157
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
140
158
  throw new Error("Run /annotate in the full OpenCode terminal interface.")
@@ -270,6 +288,7 @@ export function createReviewCommand(context, options = {}) {
270
288
  const feedbackPath = path.join(directory, "feedback.md")
271
289
  await writeFile(feedbackPath, text, { mode: 0o600 })
272
290
  const count = (feedback.match(/^## Annotation /gm) ?? []).length
291
+ const skills = await whatSkills(context.client, context.options.whatSkill, feedback, sessionID, controller.signal)
273
292
  const intent = await readFile(intentPath, "utf8").catch(error => {
274
293
  if (error.code === "ENOENT") return ""
275
294
  throw error
@@ -291,6 +310,7 @@ export function createReviewCommand(context, options = {}) {
291
310
  const busy = (context.data.session.status?.(sessionID) ?? "running") !== "idle"
292
311
  await context.client.session.prompt({
293
312
  sessionID, id: promptID, text, delivery: busy ? "queue" : "steer", resume: true,
313
+ ...(skills.length ? { skills } : {}),
294
314
  })
295
315
  keepDraft = archived > 0
296
316
  notice(`Sent ${count} ${count === 1 ? "annotation" : "annotations"}.${retainedArchive}`, "success")
package/tui/README.md CHANGED
@@ -38,6 +38,9 @@ max_width = 168
38
38
  doc_width = 120
39
39
  ```
40
40
 
41
+ `[prompts] what` is the instruction feedback adds once when it contains `what?` notes;
42
+ an empty string sends the notes alone. `annotate-tui config` prints the default.
43
+
41
44
  Hosted reviews write their send intent for the adapter: `q` sends notes and returns,
42
45
  `Ctrl+S` also saves an open comment, and `Ctrl+C` returns to the adapter's confirmation.
43
46
  The adapters own session targeting and delivery. Markdown labels such as `**题库:**把`
Binary file
Binary file
Binary file
Binary file
Binary file