authoring-cli 0.1.32 → 0.1.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authoring-cli",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "CLI for SNOMED CT authoring against authoring-services",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -31,20 +31,31 @@ of truth over anything below; commands and flags get added over time and this fi
31
31
  authoring-cli
32
32
  ```
33
33
 
34
- Every action needs task context, which comes from one of two places:
35
-
36
- - the task recorded in the session file (`<current working directory>/.authoring-cli/session.json`
37
- by default — **not** under the home directory, so it's scoped to whichever directory the CLI is
38
- run from; `$AUTHORING_CLI_HOME` forces a specific location instead) by
39
- `authoring-cli select-task --project <key> --task <key>` — the default target for every
40
- subsequent command, or
41
- - an explicit `--project <key> --task <key>` pair passed on the individual call, which overrides it.
42
-
43
- `authoring-cli current-task` prints the selected task, and — if given `--project`/`--task` — notes
44
- whether they match what's stored. Run it to confirm which task the CLI will actually target before
45
- committing to a sequence of edits. If nothing is selected and no flags are passed, commands fail
46
- rather than guessing. `authoring-cli projects` and `authoring-cli tasks` list what's available to
47
- pick from; a session with no valid cookie needs `authoring-cli login [production|uat|dev]` first.
34
+ Every action needs task context, and the session must name it — there is **no shared "current
35
+ task"**. The login (cookie) in `<current working directory>/.authoring-cli/session.json` is shared
36
+ by everything run from that directory (`$AUTHORING_CLI_HOME` forces another location), so a task
37
+ selection stored there could be changed under a half-finished batch by any other session working
38
+ in the same directory. Selection therefore lives only in one of these:
39
+
40
+ - an explicit `--project <key> --task <key>` pair on the call — targets that task for that call only;
41
+ - a **context** — `--context <name>` on any command (or `AUTHORING_CLI_CONTEXT=<name>`). Run
42
+ `authoring-cli select-task --context 1069 --project <key> --task <key>` once, and every command
43
+ with `--context 1069` targets that task when `--project`/`--task` are omitted. Each context has its
44
+ own file, so `select-task` in one context can never move another's. Name a context after the task;
45
+ `authoring-cli contexts` lists them and flags a task held by two (their writes still contend for
46
+ the branch lock);
47
+ - a **pin** — `AUTHORING_CLI_TASK=<TASK-KEY>` in the process environment (project is derived from
48
+ the key, or set `AUTHORING_CLI_PROJECT`). Nothing on disk, so nothing can move it, and a command
49
+ given a different `--task` is refused, as is `select-task` on another task. Use it for batches.
50
+
51
+ With none of these, task-targeting commands fail and `select-task` refuses, rather than guessing —
52
+ there is **no default task** — an old selection left in `session.json` is discarded, never used. In a batch script, pin the task (or pass
53
+ `--project`/`--task` on every call) and don't rely on `select-task`/`current-task` between calls.
54
+
55
+ `authoring-cli current-task` prints the task and whether it came from a pin or a context. Run it to
56
+ confirm what the CLI will target before committing to a sequence of edits. `authoring-cli projects`
57
+ and `authoring-cli tasks` list what's available to pick from; a session with no valid cookie needs
58
+ `authoring-cli login [production|uat|dev]` first.
48
59
 
49
60
  **Every mutating command (concept/description/relationship/axiom create/update/delete and
50
61
  `classify`) checks that the signed-in user is the task's Author — its assignee — before doing
@@ -89,8 +100,8 @@ rather than trusting the batch run's exit status alone. See `references/batch-au
89
100
  "Driving a batch of mutating calls" for the fuller reasoning, including why a subagent's
90
101
  self-reported summary isn't ground truth either.
91
102
 
92
- The `--project`/`--task` flags are shown on the examples below for explicitness. When a task is
93
- already selected via `select-task`, you can omit them everywhere.
103
+ The `--project`/`--task` flags are shown on the examples below for explicitness. In a context or
104
+ pinned session you can omit them everywhere.
94
105
 
95
106
  ### Starting a new task
96
107
 
@@ -100,8 +111,8 @@ authoring-cli create-task --project <projectKey> --summary "<title>" [--descript
100
111
 
101
112
  The server mints the task key — you don't supply it. It also returns the task's branch path, but
102
113
  does not create that branch; `create-task` and `select-task` do, so a task is workable the moment
103
- either one returns. The new task is selected automatically, so the commands that follow need no
104
- `--project`/`--task`; pass `--no-select` to leave the current selection alone.
114
+ either one returns. The new task is selected into the active context (so pass `--context <name>`, or `--no-select`;
115
+ without either it refuses before creating anything, and a pinned session always needs `--no-select`).
105
116
 
106
117
  It is assigned to you unless you pass `--assignee <username>` or `--unassigned`. That default is
107
118
  deliberate rather than cosmetic: authoring-services doesn't infer an assignee from the session, and
@@ -126,7 +137,8 @@ authoring-cli recover-task --project <projectKey> [--task <taskKey>]
126
137
  ```
127
138
 
128
139
  Puts a deleted task (however it was deleted) back into In Progress, with its branch content
129
- intact, and selects it. Its status before deletion isn't recorded anywhere reachable, so recovery
140
+ intact, and selects it into the active context (so pass `--context <name>`, or `--no-select`; a
141
+ pinned session needs `--no-select`). Its status before deletion isn't recorded anywhere reachable, so recovery
130
142
  always lands on In Progress regardless of where the task was when it was deleted. Deletion never
131
143
  touches the branch — everything that was on it survives untouched, which is what makes recovery
132
144
  possible at all — except for a task that's already been promoted or completed: its content is
@@ -186,7 +198,7 @@ One line per task, carrying **at least the task key and the title**:
186
198
  ANCRJAN22-959 "Laparoscopic procedure model" status=In Progress
187
199
  ```
188
200
 
189
- The key is what `select-task --project <key> --task <key>` and every `--task` flag take, and the
201
+ The key is what `select-task --context <name> --project <key> --task <key>` and every `--task` flag take, and the
190
202
  title is the only thing saying what the task is *for*; drop either and the user has to ask again.
191
203
  The command already prints exactly `<taskKey> "<title>" status=<status>` (plus `[assignee]` when
192
204
  the scope can contain other people's tasks), so relaying those lines verbatim is both correct and
@@ -119,6 +119,14 @@ delegate the batch itself to a subagent — see `SKILL.md`'s "Concurrency: one m
119
119
  task branch, at a time" for why this holds regardless of which command you're batching. The rest
120
120
  of this section is the concrete driving mechanics for a large multi-session batch specifically.
121
121
 
122
+ - **Pin the task for the whole batch.** `export AUTHORING_CLI_TASK=<TASK-KEY>` before the loop (or
123
+ pass `--project`/`--task` on every call). A pinned process can't be retargeted by anything else
124
+ working in the same directory, and a command given a different `--task` is refused — the failure
125
+ this prevents is real: a second session's `select-task` silently moved a half-finished batch's
126
+ edits onto another task's branch, and nothing in the output said so. Don't rely on
127
+ `select-task` or `current-task` between calls, and keep a mutating command's stderr (don't send it
128
+ to `/dev/null`): the edit commands log `<command> <project>/<task>: OK` there, which is the evidence
129
+ of where each call landed.
122
130
  - **Never run mutating calls in parallel against the same task branch.** Even a single sequential
123
131
  caller can surface "branch locked, retrying" from the server's own internal locking — true
124
132
  concurrent callers (multiple background loops, or an `xargs -P`-style fan-out) compound this and