@commentary-dev/cli 0.1.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Commentary
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.
22
+
package/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # Commentary CLI
2
+
3
+ `@commentary-dev/cli` creates and manages Commentary Draft Review Sessions from local Markdown, MDX, HTML, and plain text files. It is a thin terminal companion for the hosted Commentary review UI.
4
+
5
+ The executable name is `commentary`.
6
+
7
+ ```bash
8
+ npx @commentary-dev/cli review ./docs/spec.md
9
+ npm install -g @commentary-dev/cli
10
+ commentary review ./docs/spec.md
11
+ ```
12
+
13
+ ## What It Does
14
+
15
+ - Creates private Commentary draft reviews from local files or folders.
16
+ - Uploads new revisions after local edits.
17
+ - Watches tracked files and syncs changes.
18
+ - Lists comments in text, Markdown, or JSON.
19
+ - Waits for the next live draft-review comment event for local agent loops.
20
+ - Replies to and resolves comments.
21
+ - Pulls latest reviewed content back to disk with overwrite safeguards.
22
+ - Opens the review URL in the browser when available.
23
+
24
+ It does not create GitHub branches, commits, pull requests, provider comments, or GitHub tokens.
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ npm install -g @commentary-dev/cli
30
+ commentary --help
31
+ ```
32
+
33
+ For one-off use:
34
+
35
+ ```bash
36
+ npx @commentary-dev/cli --help
37
+ ```
38
+
39
+ ## Authentication
40
+
41
+ Browser/device login:
42
+
43
+ ```bash
44
+ commentary login
45
+ ```
46
+
47
+ Manual token login:
48
+
49
+ ```bash
50
+ commentary login --token <commentary-api-token>
51
+ ```
52
+
53
+ Environment token for automation:
54
+
55
+ ```bash
56
+ COMMENTARY_TOKEN=<token> commentary review ./docs/spec.md
57
+ ```
58
+
59
+ Tokens are stored outside the project config. Project metadata in `.commentary/session.json` never stores secrets.
60
+
61
+ ## Common Workflow
62
+
63
+ Create a review:
64
+
65
+ ```bash
66
+ commentary review ./docs/spec.md --title "Product spec"
67
+ ```
68
+
69
+ Create one review from a folder or multiple files:
70
+
71
+ ```bash
72
+ commentary review ./docs
73
+ commentary review ./docs/spec.md ./docs/architecture.md
74
+ ```
75
+
76
+ Upload a new revision:
77
+
78
+ ```bash
79
+ commentary sync --message "Address review comments"
80
+ ```
81
+
82
+ Watch tracked files:
83
+
84
+ ```bash
85
+ commentary review ./docs/spec.md --watch
86
+ commentary watch
87
+ ```
88
+
89
+ List open comments for an agent:
90
+
91
+ ```bash
92
+ commentary comments --format markdown --open
93
+ ```
94
+
95
+ Wait for the next new review comment:
96
+
97
+ ```bash
98
+ commentary wait-comment --json
99
+ commentary wait-comment --file docs/spec.md --timeout 15m
100
+ ```
101
+
102
+ Reply and resolve:
103
+
104
+ ```bash
105
+ commentary reply <thread-id> "Updated this in revision 3."
106
+ commentary resolve <thread-id> --message "Addressed in revision 3."
107
+ ```
108
+
109
+ Pull latest reviewed content safely:
110
+
111
+ ```bash
112
+ commentary pull --dry-run
113
+ commentary pull --backup --yes
114
+ commentary pull --output reviewed
115
+ ```
116
+
117
+ Open the review:
118
+
119
+ ```bash
120
+ commentary open
121
+ ```
122
+
123
+ ## Commands
124
+
125
+ ```text
126
+ commentary login
127
+ commentary logout
128
+ commentary whoami
129
+ commentary review <paths...>
130
+ commentary sync
131
+ commentary revision
132
+ commentary watch
133
+ commentary comments
134
+ commentary wait-comment
135
+ commentary reply <comment-id> <message>
136
+ commentary resolve <comment-id>
137
+ commentary pull
138
+ commentary open
139
+ commentary status
140
+ commentary sessions
141
+ commentary revisions
142
+ ```
143
+
144
+ Global options:
145
+
146
+ ```text
147
+ --base-url <url>
148
+ --token <token>
149
+ --json
150
+ --verbose
151
+ --quiet
152
+ --no-color
153
+ --session-file <path>
154
+ ```
155
+
156
+ Environment variables:
157
+
158
+ ```text
159
+ COMMENTARY_BASE_URL
160
+ COMMENTARY_TOKEN
161
+ COMMENTARY_SESSION
162
+ COMMENTARY_NO_COLOR
163
+ COMMENTARY_CONFIG_DIR
164
+ ```
165
+
166
+ ## Base URLs
167
+
168
+ Production is the default:
169
+
170
+ ```bash
171
+ commentary review ./docs/spec.md
172
+ ```
173
+
174
+ Use another environment or localhost:
175
+
176
+ ```bash
177
+ COMMENTARY_BASE_URL=https://commentary.example.com commentary review ./docs/spec.md
178
+ commentary --base-url http://localhost:3000 review ./docs/spec.md
179
+ ```
180
+
181
+ ## Supported Files
182
+
183
+ Included by default:
184
+
185
+ ```text
186
+ .md
187
+ .markdown
188
+ .mdx
189
+ .html
190
+ .htm
191
+ .txt
192
+ ```
193
+
194
+ Ignored by default:
195
+
196
+ ```text
197
+ .git
198
+ node_modules
199
+ dist
200
+ build
201
+ .next
202
+ .nuxt
203
+ coverage
204
+ .commentary
205
+ .DS_Store
206
+ ```
207
+
208
+ App-side draft review limits are enforced before upload:
209
+
210
+ - 20 files per revision
211
+ - 512 KiB per file
212
+ - 2 MiB total per revision
213
+
214
+ ## Agent Workflow
215
+
216
+ 1. Ask your agent to create or update a Markdown, MDX, HTML, or text file.
217
+ 2. Run:
218
+
219
+ ```bash
220
+ commentary review ./docs/spec.md
221
+ ```
222
+
223
+ 3. Review the rendered document in Commentary and leave comments.
224
+ 4. Ask the agent to run:
225
+
226
+ ```bash
227
+ commentary comments --format markdown --open
228
+ ```
229
+
230
+ 5. For interactive review loops, the agent can wait for the next comment instead of polling:
231
+
232
+ ```bash
233
+ commentary wait-comment --json
234
+ ```
235
+
236
+ 6. The agent updates the local file.
237
+ 7. Upload the revision:
238
+
239
+ ```bash
240
+ commentary sync --message "Address review comments"
241
+ ```
242
+
243
+ 8. Repeat until ready to commit locally with your own git tools.
244
+
245
+ ## JSON Output
246
+
247
+ Use `--json` for automation:
248
+
249
+ ```bash
250
+ commentary review ./docs/spec.md --json
251
+ commentary status --json
252
+ commentary comments --json --open
253
+ commentary wait-comment --json
254
+ ```
255
+
256
+ JSON output is intended to be stable across patch releases. Additive fields may appear in minor releases.
257
+
258
+ ## Live Comment Waiting
259
+
260
+ `commentary wait-comment` uses Commentary draft-review live updates and requires a server that exposes `GET /api/v1/draft-reviews/{sessionId}/events`. Tokens need the `commentary.comments.read` scope.
261
+
262
+ By default the command starts from `cursor=latest`, waits for a future `comment.created` event, prints the first match, and exits. Use `--include-replies` to also return `reply.created`, `--cursor <id>` to resume after a known live-event cursor, `--from beginning` to read historical events, and `--timeout 0` to wait indefinitely.
263
+
264
+ ## Local Metadata
265
+
266
+ The CLI writes `.commentary/session.json` in the project. It includes:
267
+
268
+ - draft review session id
269
+ - review URL
270
+ - base URL
271
+ - root path
272
+ - tracked files and file ids
273
+ - file hashes and sizes
274
+ - last known revision
275
+ - sync timestamps
276
+
277
+ It does not include auth tokens.
278
+
279
+ ## Development
280
+
281
+ ```bash
282
+ npm install
283
+ npm run dev -- --help
284
+ npm run typecheck
285
+ npm run lint
286
+ npm run test
287
+ npm run build
288
+ npm run verify
289
+ ```
290
+
291
+ Live production validation is opt-in:
292
+
293
+ ```bash
294
+ COMMENTARY_LIVE_TOKEN=<token> npm run test:live
295
+ ```
296
+
297
+ The live suite creates a review, waits for reviewer comments, syncs agent revisions, and verifies a two-turn comment/revision loop. The release workflow requires production live validation on `main`, then publishes to npm with provenance when the package version has not already been published.
298
+
299
+ ## Security Model
300
+
301
+ Commentary stores review sessions and comments. The CLI syncs local text files to Commentary and can download reviewed files back to disk. Users and local agents remain responsible for local edits, commits, branches, and pushes.
302
+
303
+ Use `--dry-run`, `--output`, `--backup`, and `--yes` with `commentary pull` to control local file writes.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node