@react-spot/plugin-comments 0.0.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/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # @react-spot/plugin-comments
2
+
3
+ `@react-spot/plugin-comments` adds lightweight review comments to the Trace widget. It plugs into the current `TracePlugin` API and contributes both a toolbar control and an inspector action-panel entry.
4
+
5
+ ## What it does
6
+
7
+ - Adds a **Comments** button to the Trace toolbar.
8
+ - Shows a badge with the current number of collected comments.
9
+ - Adds an **Add comment** action to the inspector action panel for the currently selected element.
10
+ - Opens an inline comment editor anchored to the selected element.
11
+ - Lets users review, edit, remove, clear comments.
12
+
13
+ Comments are collected in the plugin's in-memory widget state while Trace is mounted.
14
+
15
+ Once you're done, you can copy the comments to the clipboard to send to your best AI agent or you can send it directly to an existing session on your Opencode.
16
+
17
+ ## Installation
18
+
19
+ Install the plugin alongside its peer dependencies:
20
+
21
+ ```bash
22
+ pnpm add --dev @react-spot/core @react-spot/ui-components @react-spot/plugin-comments
23
+ ```
24
+
25
+ If you are already using `@react-spot/kit`, this plugin is included there by default.
26
+
27
+ ## Usage
28
+
29
+ Register the plugin by calling `CommentsPlugin()` and passing the result to the `plugins` prop on `Trace`.
30
+
31
+ ```tsx
32
+ import { Trace } from '@react-spot/core'
33
+ import { CommentsPlugin } from '@react-spot/plugin-comments'
34
+
35
+ import App from './App'
36
+
37
+ export function AppWithTrace() {
38
+ return (
39
+ <>
40
+ <App />
41
+ <Trace root={import.meta.env.VITE_ROOT} plugins={[CommentsPlugin()]} />
42
+ </>
43
+ )
44
+ }
45
+ ```
46
+
47
+ `root` should be the absolute project root passed to Trace so the plugin can resolve relative file paths for comments.
48
+
49
+ ## User-visible behavior
50
+
51
+ ### Toolbar
52
+
53
+ The plugin adds a **Comments** toolbar button with a live count badge. Opening it shows a menu of collected comments.
54
+
55
+ From this menu, users can:
56
+
57
+ - review comments grouped as `file:line` entries,
58
+ - click a comment to edit its text,
59
+ - remove individual comments,
60
+ - copy all comments to the clipboard,
61
+ - clear the full comment list,
62
+ - open the **Send to OpenCode** flow.
63
+
64
+ If there are no comments yet, the menu prompts the user to inspect an element and choose **Add comment**.
65
+
66
+ ### Action panel
67
+
68
+ When the inspector has an active selection with source information, the plugin adds an **Add comment** action to the Trace action panel.
69
+
70
+ Choosing that action:
71
+
72
+ 1. resolves the selected source location,
73
+ 2. opens a small editor anchored to the selected element,
74
+ 3. records the comment against the resolved relative file path and line number.
75
+
76
+ The inline editor supports save/cancel actions and keyboard shortcuts such as `Enter` to submit and `Escape` to cancel.
77
+
78
+ ### OpenCode integration
79
+
80
+ The toolbar menu includes a **Send to OpenCode** flow for the currently collected comments. Users can choose an existing session or create a new one, optionally add a general message, and send the comments plus related file references to a locally running OpenCode instance.
81
+
82
+ If OpenCode is not available, the send form shows a connection error instead of sending.
83
+
84
+ ## API
85
+
86
+ This package currently exports:
87
+
88
+ - `CommentsPlugin(): TracePlugin`
89
+ - `CommentEntry` (type)
90
+
91
+ Use the returned plugin object with the current `plugins` array on `Trace`.