pingcode-cli-unofficial 2.1.0 → 2.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pingcode-cli-unofficial",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Command-line client for the PingCode Open API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -180,9 +180,17 @@ from every URL, log line, dry-run plan and error message it emits.
180
180
  or as an empty string (a blank `description`) is simply missing from the JSON. It does **not**
181
181
  distinguish the two, and a missing key is never evidence that the field does not exist. Use
182
182
  `x?.y ?? fallback`, not `'y' in x`.
183
+ - **Some fields change shape between endpoints.** A work item's `type` is a bare slug string
184
+ (`"task"`, `"epic"`), never a reference object, and its `state` is an object on most tenants
185
+ but a bare string on a few — the CLI keeps whichever shape the wire sent, so read both with
186
+ `x?.name ?? x`. A work item's `sprint_id` is filled in from its `sprint` object when the API
187
+ sends `sprint_id: null` beside a full object, so it is safe to filter on. `link` and `relation`
188
+ rows name the far end differently (`origin_work_item` / `target_work_item` vs `target`) — see
189
+ `modules/pjm.md`.
183
190
  - `--dry-run` on a mutating command prints `{"dry_run":true,"request":{…}}` to stdout and exits 0
184
191
  without sending anything. Read requests still run, so ids are really resolved.
185
- - Errors in `--json` mode go to **stderr** as `{"error":{"kind":…,"message":…,"code":…,"exit":…}}`.
192
+ - Errors in `--json` mode go to **stderr** as `{"error":{"kind":…,"message":…,"code":…,"exit":…}}`,
193
+ plus an optional `"hint"` when the error carries one.
186
194
  - **`pingcode api` is the exception to the shapes above**: stdout is the API's raw JSON, so `--json`
187
195
  is a no-op on its five verbs and no key is normalised away. Its own `api list` / `api describe` are
188
196
  local catalog views and do honour `--json`.
@@ -258,6 +258,12 @@ pingcode project work-item link delete SCR-5 <link_id> --yes
258
258
  the id `link list` printed for the item you are on — passing the other end's id answers
259
259
  `工作项或工作项关联不存在` → exit 5.
260
260
  - Links may cross projects, and a work item may be linked to itself.
261
+ - The two families expose **different field names for the far end**:
262
+ - `link list` rows expose `origin_work_item` and `target_work_item` (both are parsed as rich
263
+ refs carrying `identifier`, `title`, `type`, `short_id`).
264
+ - `relation list` rows expose `target` (a parsed ref) and `target_type` (the string kind, e.g.
265
+ `idea`). Generic consumer code that walks either family must read **both** spellings
266
+ (`origin_work_item`/`target_work_item` vs `target` + `target_type`).
261
267
 
262
268
  #### `tag` — and the list that does not exist
263
269
 
@@ -21,6 +21,8 @@ product DELETE at all, and `PATCH` only edits three cosmetic fields.
21
21
 
22
22
  ### `product meta` — mandatory before writing an idea or ticket
23
23
 
24
+ `product meta ticket-states` is listed for completeness, but creating a ticket does **not** need it: `ticket create` has no `--state`, and the server picks the initial state. You only need it for `ticket transition` and `list --state`.
25
+
24
26
  ```bash
25
27
  pingcode product meta idea-states --product SLC --json
26
28
  pingcode product meta idea-priorities --product SLC --json
@@ -119,7 +121,7 @@ pingcode product ticket get SLC-7 --json
119
121
 
120
122
  pingcode product ticket create --product SLC --type 故障 --title "Cannot log in" --dry-run --json
121
123
  pingcode product ticket create --product SLC --type 故障 --title "Cannot log in" \
122
- --assignee zhangsan --priority P1 --channel 邮件 --json
124
+ --assignee zhangsan --priority P1 --channel 邮件 --customer 前阳二厂 --json
123
125
 
124
126
  pingcode product ticket update SLC-7 --title "Cannot log in (iOS)" --json
125
127
  pingcode product ticket transition SLC-7 --state 处理中 --json
@@ -128,6 +130,8 @@ pingcode product ticket transition SLC-7 --state 处理中 --json
128
130
  `--type` is **required** on `product ticket create` — `type_id` is a required body field, which is the one
129
131
  place ship demands a lookup (`pingcode product meta ticket-types --product SLC`) before a write can even be
130
132
  attempted. `--channel` can only be set at create time; there is no way to change it afterwards.
133
+ `--customer` is scoped to the product; `PATCH /v1/ship/tickets/{id}` also accepts `customer_id`, so you
134
+ can change the customer after creation (the `update` command does not expose it yet).
131
135
 
132
136
  ## 4b. Ship rules that will bite you
133
137