authoring-cli 0.1.2 → 0.1.4

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/HELP.md ADDED
@@ -0,0 +1,314 @@
1
+ # authoring-cli Help
2
+
3
+ A comprehensive guide to using authoring-cli for SNOMED CT authoring.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Install
8
+ ```bash
9
+ npm install -g authoring-cli
10
+ ```
11
+
12
+ ### 2. Sign In
13
+ ```bash
14
+ authoring-cli login
15
+ ```
16
+ This opens Chrome to your organization's login page. Once you sign in, your session is captured automatically.
17
+
18
+ ### 3. Select a Task
19
+ ```bash
20
+ authoring-cli tasks --mine
21
+ authoring-cli select-task --project PROJ --task PROJ-123
22
+ ```
23
+
24
+ ### 4. Start Authoring
25
+ ```bash
26
+ authoring-cli create-concept --fsn "Hepatic structure" --parent 64572001
27
+ authoring-cli add-description --id <concept-id> --term "Liver structure" --type SYNONYM
28
+ authoring-cli classify --wait
29
+ authoring-cli validate-review-concepts
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Common Workflows
35
+
36
+ ### Create a New Concept
37
+
38
+ ```bash
39
+ authoring-cli create-concept \
40
+ --fsn "Hepatic inflammation" \
41
+ --parent 128139003 \
42
+ --tag "[disease]"
43
+ ```
44
+
45
+ ### Add a Synonym
46
+
47
+ ```bash
48
+ authoring-cli add-description \
49
+ --id 64572001 \
50
+ --term "Liver disease" \
51
+ --type SYNONYM \
52
+ --acceptability PREFERRED
53
+ ```
54
+
55
+ ### Set US/GB Acceptability
56
+
57
+ ```bash
58
+ # Set one description at a time
59
+ authoring-cli set-acceptability \
60
+ --id 64572001 \
61
+ --description-id <desc-id> \
62
+ --us PREFERRED \
63
+ --gb ACCEPTABLE
64
+
65
+ # Or set multiple descriptions atomically
66
+ authoring-cli set-acceptability \
67
+ --id 64572001 \
68
+ --entries '[
69
+ {"descriptionId":"<id1>","us":"PREFERRED"},
70
+ {"descriptionId":"<id2>","gb":"ACCEPTABLE"}
71
+ ]'
72
+ ```
73
+
74
+ ### Update an Axiom
75
+
76
+ ```bash
77
+ authoring-cli update-axiom \
78
+ --id 64572001 \
79
+ --axiom-id <axiom-id> \
80
+ --relationships '[
81
+ {"active":true,"groupId":0,"type":{"conceptId":"116680003"},"target":{"conceptId":"310305003"}},
82
+ {"active":true,"groupId":1,"type":{"conceptId":"405813007"},"target":{"conceptId":"280115004"}}
83
+ ]'
84
+ ```
85
+
86
+ ### Validate and Classify
87
+
88
+ ```bash
89
+ # Validate the current concept
90
+ authoring-cli validate-concept --id 64572001
91
+
92
+ # Validate all concepts with pending changes
93
+ authoring-cli validate-review-concepts
94
+
95
+ # Run classification
96
+ authoring-cli classify --wait
97
+
98
+ # Check classification status
99
+ authoring-cli classification-status
100
+ ```
101
+
102
+ ### Review Concepts Before Save
103
+
104
+ ```bash
105
+ # List concepts with pending changes
106
+ authoring-cli get-concepts-for-review
107
+
108
+ # Get full details for review
109
+ authoring-cli review-concepts
110
+
111
+ # Validate all at once
112
+ authoring-cli validate-review-concepts
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Command Reference
118
+
119
+ ### Authentication
120
+ - `authoring-cli login [environment]` — Sign in (environment: production, uat, dev)
121
+ - `authoring-cli logout` — Sign out and remove stored session
122
+
123
+ ### Task Management
124
+ - `authoring-cli projects` — List available projects
125
+ - `authoring-cli tasks [--project PROJECT] [--mine] [--status STATUS] [--summary]` — List tasks
126
+ - `authoring-cli select-task --project PROJECT --task TASK` — Select a task
127
+ - `authoring-cli current-task` — Show currently selected task
128
+ - `authoring-cli create-task --project PROJECT --summary "TITLE"` — Create a task
129
+ - `authoring-cli delete-task [--project PROJECT --task TASK]` — Delete a task
130
+ - `authoring-cli recover-task --project PROJECT [--task TASK]` — Recover deleted tasks
131
+
132
+ ### Concept Management
133
+ - `authoring-cli create-concept --fsn "FSN" --parent SCTID [--tag TAG] [--pt PT]` — Create concept
134
+ - `authoring-cli get-concept --id SCTID [--attribute-type TYPEID] [--gci]` — Fetch a concept, or just its relationships of one attribute type (add --gci to check gciAxioms instead of classAxioms)
135
+ - `authoring-cli search-concepts [--term TEXT] [--ecl EXPRESSION]` — Search concepts
136
+ - `authoring-cli find-references --id SCTID [--stated]` — List everything that references a concept (Is-a children and attribute values)
137
+ - `authoring-cli delete-concept --id SCTID` — Delete unversioned concept (only if never published)
138
+
139
+ ### Descriptions
140
+ - `authoring-cli add-description --id SCTID --term "TERM" --type FSN|SYNONYM` — Add description
141
+ - `authoring-cli update-description --id SCTID --description-id ID [--term "TERM"]` — Update unversioned description
142
+ - `authoring-cli delete-description --id SCTID --description-id ID` — Delete unversioned description
143
+ - `authoring-cli set-case-significance --id SCTID --description-id ID --case-significance VALUE` — Set case significance
144
+ - `authoring-cli set-acceptability --id SCTID --description-id ID [--us VALUE] [--gb VALUE]` — Set acceptability
145
+ - `authoring-cli set-acceptability --id SCTID --entries '[...]'` — Set multiple acceptabilities atomically
146
+
147
+ ### Relationships & Axioms
148
+ - `authoring-cli add-relationship --id SCTID --type SCTID --target SCTID [--group N]` — Add relationship
149
+ - `authoring-cli remove-relationship --id SCTID --axiom-id ID --relationship-id ID` — Remove relationship
150
+ - `authoring-cli remove-role-group --id SCTID --axiom-id ID --attributes '[...]'` — Remove role group
151
+ - `authoring-cli add-axiom --id SCTID --relationships '[...]'` — Add class axiom
152
+ - `authoring-cli update-axiom --id SCTID --axiom-id ID --relationships '[...]'` — Update axiom
153
+ - `authoring-cli delete-axiom --id SCTID --axiom-id ID` — Delete axiom
154
+ - `authoring-cli inactivate-axiom --id SCTID --axiom-id ID` — Inactivate published axiom
155
+
156
+ ### GCI Axioms
157
+ - `authoring-cli add-gci-axiom --id SCTID --relationships '[...]'` — Add GCI axiom
158
+ - `authoring-cli update-gci-axiom --id SCTID --axiom-id ID --relationships '[...]'` — Update GCI axiom
159
+ - `authoring-cli delete-gci-axiom --id SCTID --axiom-id ID` — Delete unversioned GCI axiom
160
+
161
+ ### Concept Status
162
+ - `authoring-cli set-definition-status --id SCTID --status PRIMITIVE|FULLY_DEFINED` — Set definition status
163
+ - `authoring-cli inactivate-concept --id SCTID --indicator VALUE [--association-refset ID --association-target SCTID]` — Inactivate concept
164
+ - `authoring-cli transform-axiom --id SCTID [--axiom-id ID]` — Rewrite axiom to standard form
165
+ - `authoring-cli check-authoring-form --id SCTID [--axiom-id ID]` — Check if axiom is in standard form
166
+
167
+ ### Validation & Classification
168
+ - `authoring-cli validate-concept --id SCTID` — Validate a single concept (read-only)
169
+ - `authoring-cli get-concepts-for-review [--check-authoring-form]` — List concepts awaiting review
170
+ - `authoring-cli validate-review-concepts` — Validate all concepts with pending changes
171
+ - `authoring-cli review-concepts` — Get full details of all concepts with pending changes
172
+ - `authoring-cli classify [--wait] [--timeout SECONDS]` — Classify task (self-healing)
173
+ - `authoring-cli classification-status` — Check classification job status
174
+ - `authoring-cli validate-task [--enable-mrcm] [--wait] [--timeout SECONDS]` — Validate entire task
175
+ - `authoring-cli validation-status` — Check validation job status
176
+
177
+ ### Real-time Notifications
178
+ - `authoring-cli watch-notification [--entity-type TYPE] [--timeout SECONDS]` — Wait for next notification
179
+
180
+ ### Skill Management
181
+ - `authoring-cli install-skill [--agent claude|codex|all] [--force]` — Register authoring guidance with your AI agent
182
+ - `authoring-cli uninstall-skill [--agent claude|codex|all]` — Unregister the skill (run before uninstalling the package)
183
+
184
+ ---
185
+
186
+ ## Tips & Troubleshooting
187
+
188
+ ### Session Management
189
+ - Your session is stored in `~/.authoring-cli/session.json`
190
+ - If you have multiple Chrome profiles, specify which one: `authoring-cli login --chrome-profile "Work Profile"`
191
+ - If your session expires during use, you'll get a `401 Unauthorized` error — run `authoring-cli login` again
192
+
193
+ ### Task Selection
194
+ - If you don't pass `--project` and `--task` to a command, it uses your last selected task
195
+ - Use `authoring-cli current-task` to see what's currently selected
196
+ - Selecting a task creates its branch if it doesn't exist yet
197
+
198
+ ### Validation & Classification
199
+ - `validate-concept` is a **read-only** check — it doesn't save anything
200
+ - `classify --wait` will poll until classification finishes, or timeout after 180 seconds (configurable)
201
+ - If classification is already running, `classify` will attach to that job instead of starting a new one
202
+ - Always run `validate-review-concepts` before classifying to catch obvious issues early
203
+
204
+ ### Relationships & Axioms
205
+ - Relationships must be specified as JSON: `--relationships '[{"active":true,"groupId":0,"type":{"conceptId":"..."},"target":{"conceptId":"..."}}]'`
206
+ - `add-relationship --group N` automatically groups relationships (group 0 = ungrouped, group 1+ = attributes)
207
+ - You cannot edit published axioms directly — you must inactivate the old one and add a new one
208
+ - `remove-relationship` only works on unversioned (never-published) relationships
209
+
210
+ ### Descriptions & Acceptability
211
+ - The `set-acceptability --entries` form lets you set multiple descriptions in one atomic save, working around the exactly-one-PREFERRED-per-dialect constraint
212
+ - When setting different acceptabilities for US and GB, understand that both default to PREFERRED if a language refset is used
213
+ - Use `--acceptability PREFERRED` when creating a description to mark it as preferred immediately
214
+
215
+ ### Error Messages
216
+ - `effectiveTime is not null` — the concept or property is published and cannot be directly edited
217
+ - `Not the only PREFERRED description in the {lang} refset` — you're trying to make two descriptions PREFERRED in the same dialect
218
+ - `module-mismatched` — you're editing with the wrong module for this extension branch
219
+ - `not found (404)` — the concept, description, or relationship ID doesn't exist
220
+
221
+ ### Performance
222
+ - For large searches, add `--limit N` to avoid huge result sets
223
+ - Use `--json` flag to get machine-readable output suitable for scripting
224
+ - Classification can take 2-20+ minutes depending on the branch size; use `--timeout` to wait longer if needed
225
+
226
+ ---
227
+
228
+ ## Best Practices
229
+
230
+ ### Before Starting
231
+ 1. Run `authoring-cli login` and select your task
232
+ 2. Check the task status and any existing concepts: `authoring-cli get-concepts-for-review`
233
+ 3. Review project-specific metadata: `authoring-cli projects --json`
234
+
235
+ ### During Authoring
236
+ 1. Create or update concepts one at a time
237
+ 2. Use `validate-concept` frequently to catch issues early
238
+ 3. Use `get-concepts-for-review` to track what you've changed
239
+ 4. Run `classify --wait` to see inferred relationships before final validation
240
+
241
+ ### Before Saving
242
+ 1. Run `validate-review-concepts` on all changed concepts
243
+ 2. Review any warnings about dialect acceptability
244
+ 3. Check `classification-status` if you classified earlier
245
+ 4. Ensure no axioms are in non-standard form (use `check-authoring-form` if needed)
246
+
247
+ ### Large Batches
248
+ - Use the authoring guidance skill: `authoring-cli install-skill`, then `/authoring-cli` in your agent
249
+ - The skill documents batch authoring methodology: `authoring-cli/references/batch-authoring.md`
250
+ - For tracking across sessions, the skill explains the resumable-tracker pattern
251
+
252
+ ---
253
+
254
+ ## Get More Help
255
+
256
+ ### Command Details
257
+ ```bash
258
+ # See all available commands and flags
259
+ authoring-cli
260
+
261
+ # Get help on a specific command (usage text)
262
+ authoring-cli <command> --help
263
+ ```
264
+
265
+ ### Authoring Guidance
266
+ The package includes detailed guidance on SNOMED CT authoring best practices, Snowstorm constraints, and batch methodologies. Register it with your AI agent:
267
+
268
+ ```bash
269
+ authoring-cli install-skill
270
+ ```
271
+
272
+ Then use `/authoring-cli` in Claude Code or your agent to get guidance while you work.
273
+
274
+ ### Server-side Constraints
275
+ If you encounter a server error (4xx/5xx), check the error message carefully — it often tells you exactly what's wrong. Common issues:
276
+
277
+ - **Save validation errors** — described in the error response; fix the concept and try again
278
+ - **Publication gating** — some operations are forbidden on published concepts
279
+ - **Module requirements** — extension branches require the correct module ID
280
+ - **Dialect constraints** — exactly one PREFERRED description per language refset
281
+
282
+ ### Reporting Issues
283
+ If you find a bug or have a feature request, check the GitHub repository:
284
+ ```
285
+ https://github.com/snomed/authoring-cli
286
+ ```
287
+
288
+ ---
289
+
290
+ ## FAQ
291
+
292
+ **Q: Can I use this on Windows or Linux?**
293
+ A: The CLI runs on any Node.js 24+ environment, but automatic session capture during login only works on macOS with Chrome. On other platforms, `login` will fail with a clear message. You can manually pass endpoints and a session cookie using flags, but that's not yet implemented.
294
+
295
+ **Q: How do I use this with an AI agent?**
296
+ A: Install the bundled authoring skill (`authoring-cli install-skill`), then invoke `/authoring-cli` in Claude Code or Codex. The skill teaches the agent about Snowstorm constraints and SNOMED CT modeling rules.
297
+
298
+ **Q: Can I undo a change?**
299
+ A: There's no built-in undo. However:
300
+ - Unversioned changes can be deleted or reverted with a new command
301
+ - Published concepts cannot be edited directly — you must inactivate and create new ones
302
+ - Use `--wait` with classify/validate to review changes before they're locked in
303
+
304
+ **Q: What if I accidentally delete a task?**
305
+ A: Use `recover-task` — it brings the task back out of the Deleted status with all its content intact.
306
+
307
+ **Q: How do I batch large changes?**
308
+ A: Run commands in sequence, using `--json` output to parse results. The authoring guidance skill documents patterns for resumable batch operations: see `/authoring-cli` after running `install-skill`.
309
+
310
+ **Q: My session expired. What do I do?**
311
+ A: Run `authoring-cli login` again to get a fresh session.
312
+
313
+ **Q: Can I target multiple projects at once?**
314
+ A: No, you work on one selected task at a time. Switching between tasks is instant: `select-task --project PROJ2 --task PROJ2-456`.