@johngaynor/ocnus 2.0.1-next.20 → 2.0.1-next.22
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 +7 -0
- package/cli/lib/linear.sh +199 -33
- package/cli/lib/task.sh +8 -4
- package/cli/ocnus +9 -1
- package/herdr/README.md +22 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -379,6 +379,13 @@ ocnus space team my-space ABC # once: the team whose cards are ABC-122
|
|
|
379
379
|
ocnus task ls my-space
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
+
With `--json`, for programs, the list also says which cards are held and
|
|
383
|
+
which cards each of them waits on: a card is held while it is in a
|
|
384
|
+
not-started status, such as Todo, and a card that blocks it, or its parent,
|
|
385
|
+
is not done, which is when `task start` holds it. Each card names its parent
|
|
386
|
+
there too, with its place among the parent's sub-issues and how many of them
|
|
387
|
+
are done.
|
|
388
|
+
|
|
382
389
|
It asks Linear itself, with no agent running. `ocnus status` checks the
|
|
383
390
|
saved key with Linear each time it runs: it says whose the key is when it
|
|
384
391
|
works, notes when no key is saved or when the key could not be checked, and
|
package/cli/lib/linear.sh
CHANGED
|
@@ -233,13 +233,27 @@ OPEN_TYPES='["triage","backlog","unstarted","started"]'
|
|
|
233
233
|
# deciding that Linear will never say it has no more.
|
|
234
234
|
LINEAR_PAGE=100
|
|
235
235
|
LINEAR_PAGES=50
|
|
236
|
+
# For `task ls --json`: how many cards one question about blockers asks
|
|
237
|
+
# about, and how many of each card's relations it reads. Linear caps what one
|
|
238
|
+
# question may cost, and a list inside a list counts once for each card it is
|
|
239
|
+
# asked of, however few it holds (SLICE_RELATIONS), so both are kept small. A
|
|
240
|
+
# card with more relations than are read may have blockers that were not
|
|
241
|
+
# read, which the list says of it.
|
|
242
|
+
LIST_BLOCKED=50
|
|
243
|
+
LIST_RELATIONS=20
|
|
236
244
|
|
|
237
245
|
# The teams Linear knows of those asked for, their open statuses, and one page
|
|
238
246
|
# of their open cards, with when each was last changed. Linear pages through
|
|
239
247
|
# the cards in the order it is asked for, each page starting where the last
|
|
240
248
|
# ended. That order is when each card was made, which nothing changes: in the
|
|
241
249
|
# order they were last changed, a card edited while the pages are fetched
|
|
242
|
-
# would move onto a page already fetched, and never be listed.
|
|
250
|
+
# would move onto a page already fetched, and never be listed. Each card
|
|
251
|
+
# comes with Linear's own id for it, its parent, and the first of the
|
|
252
|
+
# relations that name it as the related card. That one tells whether any
|
|
253
|
+
# card is related to it at all, and so whether one may block it: the
|
|
254
|
+
# blockers themselves are asked for afterwards, of those cards alone
|
|
255
|
+
# (LIST_BLOCKERS_QUERY), since reading them here would cost every card on the
|
|
256
|
+
# page a list of them.
|
|
243
257
|
LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: String) {
|
|
244
258
|
teams(filter: {key: {in: $teams}}) { nodes { key } }
|
|
245
259
|
workflowStates(first: 250, filter: {team: {key: {in: $teams}}, type: {in: $types}}) {
|
|
@@ -247,15 +261,58 @@ LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: Str
|
|
|
247
261
|
}
|
|
248
262
|
issues(first: $first, after: $after, orderBy: createdAt,
|
|
249
263
|
filter: {team: {key: {in: $teams}}, state: {type: {in: $types}}}) {
|
|
250
|
-
nodes { identifier title url updatedAt state { name type position }
|
|
264
|
+
nodes { id identifier title url updatedAt state { name type position }
|
|
265
|
+
parent { id identifier title }
|
|
266
|
+
inverseRelations(first: 1) { nodes { id } } }
|
|
251
267
|
pageInfo { hasNextPage endCursor }
|
|
252
268
|
}
|
|
253
269
|
}'
|
|
254
270
|
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
#
|
|
258
|
-
#
|
|
271
|
+
# One page of the sub-issues of some cards, the parents the open cards name,
|
|
272
|
+
# by Linear's own ids for them: every sub-issue, whatever its status and its
|
|
273
|
+
# team, with when it was made, the kind of status it is in and which of the
|
|
274
|
+
# cards it is a sub-issue of. All the parents are asked about in one
|
|
275
|
+
# question, which is paged through as the list is, in the order the
|
|
276
|
+
# sub-issues were made, so that no parent's count stops short.
|
|
277
|
+
LIST_SUBS_QUERY='query($parents: [ID!], $first: Int, $after: String) {
|
|
278
|
+
issues(first: $first, after: $after, orderBy: createdAt, filter: {parent: {id: {in: $parents}}}) {
|
|
279
|
+
nodes { identifier createdAt state { type } parent { id } }
|
|
280
|
+
pageInfo { hasNextPage endCursor }
|
|
281
|
+
}
|
|
282
|
+
}'
|
|
283
|
+
|
|
284
|
+
# The relations of some cards, by Linear's own ids for them, that name each
|
|
285
|
+
# as the related card, as CARD_BLOCKERS_READ reads them for one card, with
|
|
286
|
+
# the other card's title too. Those of the kind "blocks" name a card that
|
|
287
|
+
# blocks it. Whether a card has more of them than were read comes with them.
|
|
288
|
+
LIST_BLOCKERS_QUERY='query($ids: [ID!], $first: Int) {
|
|
289
|
+
issues(first: $first, filter: {id: {in: $ids}}) {
|
|
290
|
+
nodes { id
|
|
291
|
+
inverseRelations(first: '$LIST_RELATIONS') { nodes { type issue { identifier title state { name type } } } pageInfo { hasNextPage } } }
|
|
292
|
+
}
|
|
293
|
+
}'
|
|
294
|
+
|
|
295
|
+
# From the pages of the list (as for LIST_SHAPE, on stdin), what `task ls
|
|
296
|
+
# --json` asks Linear next, by Linear's own ids: parents, the cards whose
|
|
297
|
+
# sub-issues to read, which are the parents the cards name; and ids, the
|
|
298
|
+
# cards whose blockers to read, which are the cards that some card is related
|
|
299
|
+
# to and the parents of the cards in a not-started status, since a card that
|
|
300
|
+
# blocks its parent holds such a card too. Each id is there once.
|
|
301
|
+
LIST_ASK='
|
|
302
|
+
[.[].list.issues.nodes[]?] as $cards
|
|
303
|
+
| {parents: ([$cards[] | .parent.id? | strings] | unique),
|
|
304
|
+
ids: ([$cards[]
|
|
305
|
+
| (select((.inverseRelations.nodes? // []) | length > 0) | .id?),
|
|
306
|
+
(select(.state.type? == "unstarted") | .parent.id?)
|
|
307
|
+
| strings] | unique)}'
|
|
308
|
+
|
|
309
|
+
# Turn what Linear answered (on stdin, a line of JSON for each answer, under
|
|
310
|
+
# a name that says which question it answers: list for a page of the list,
|
|
311
|
+
# subs for a page of sub-issues and blockers for an answer about blockers)
|
|
312
|
+
# into the list: every open status, in Linear's order, with its cards. Teams
|
|
313
|
+
# often share a status name; a status of one name and kind is one group,
|
|
314
|
+
# whichever teams have it. $space, $teams, $types and $detail are given by
|
|
315
|
+
# the caller.
|
|
259
316
|
# - Under each status the card changed last comes first. Cards changed at
|
|
260
317
|
# the same moment keep the order Linear gave them in.
|
|
261
318
|
# - Should a card come on two pages, the first copy is kept.
|
|
@@ -263,12 +320,76 @@ LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: Str
|
|
|
263
320
|
# that it did not, such as one made while the pages were fetched, so that
|
|
264
321
|
# no card is dropped for want of a group.
|
|
265
322
|
# - A closed status is never listed, should Linear send one.
|
|
323
|
+
# A card is its id, title and url. When $detail is true, it also says where
|
|
324
|
+
# it stands, from the other two questions' answers:
|
|
325
|
+
# - parent is the card it is a sub-issue of, with how many sub-issues that
|
|
326
|
+
# card has and how many of them are done, which is in a completed status.
|
|
327
|
+
# Every sub-issue counts, whatever its status. place is where the card
|
|
328
|
+
# comes among them, from 1, in the order they were made, the order
|
|
329
|
+
# READ_SHAPE gives subIssues in; it is null should the card not be among
|
|
330
|
+
# them, as when its parent changed between the questions. Both are null
|
|
331
|
+
# for a card with no parent.
|
|
332
|
+
# - blockedBy is the cards that block it, done or not, as READ_SHAPE gives
|
|
333
|
+
# them, and none for a card no card is related to.
|
|
334
|
+
# - held is whether `task start` would hold it, by the test card_branch
|
|
335
|
+
# applies (task.sh): it is in a not-started status, and a card that
|
|
336
|
+
# blocks it or its parent is not done. waitsOn is those cards, its own
|
|
337
|
+
# blockers and then its parent's, each once, and none when it is not held.
|
|
338
|
+
# - blockersCut is true when blockers may be missing from that: the card
|
|
339
|
+
# has more relations than were read, or its parent has, when the parent's
|
|
340
|
+
# can hold it, or Linear's answer left one of the two out.
|
|
341
|
+
# A sub-issue or a blocker that is not in the form Linear gives it in did not
|
|
342
|
+
# come from Linear, so nothing is listed. The list's own pages are read as
|
|
343
|
+
# they always were: a card with no parent or relations in the answer has
|
|
344
|
+
# neither.
|
|
266
345
|
LIST_SHAPE='
|
|
346
|
+
def text: if type == "string" then . else error("unreadable") end;
|
|
347
|
+
def nodes: if (.issues.nodes | type) == "array" then .issues.nodes[] else error("unreadable") end;
|
|
348
|
+
def status: if type == "object" then {name: (.name | text), type: (.type | text)} else error("unreadable") end;
|
|
267
349
|
($types | to_entries | map({key: .value, value: .key}) | from_entries) as $rank
|
|
268
|
-
| .[
|
|
269
|
-
|
|
|
350
|
+
| [.[] | .list | values] as $pages
|
|
351
|
+
| $pages[0] as $first
|
|
352
|
+
| ([$pages[].issues.nodes[]] | to_entries | unique_by(.value.identifier)
|
|
270
353
|
| sort_by([.value.updatedAt, -.key]) | reverse | map(.value)) as $cards
|
|
271
|
-
|
|
|
354
|
+
| ([.[] | .subs | values | nodes
|
|
355
|
+
| {id: (.identifier | text), at: (.createdAt | text), done: ((.state.type | text) == "completed"),
|
|
356
|
+
of: (.parent.id | text)}]
|
|
357
|
+
| to_entries | unique_by(.value.id) | sort_by([.value.at, .key]) | map(.value)
|
|
358
|
+
| group_by(.of) | map({key: .[0].of, value: .}) | from_entries) as $subs
|
|
359
|
+
| ([.[] | .blockers | values | nodes
|
|
360
|
+
| {key: (.id | text),
|
|
361
|
+
value: (.inverseRelations
|
|
362
|
+
| if type == "object" and (.nodes | type) == "array" and (.pageInfo.hasNextPage | type) == "boolean"
|
|
363
|
+
then {cut: .pageInfo.hasNextPage,
|
|
364
|
+
by: [.nodes[] | select((.type | text) == "blocks") | .issue
|
|
365
|
+
| if type == "object"
|
|
366
|
+
then {id: (.identifier | text), title: (.title | text), status: (.state | status)}
|
|
367
|
+
else error("unreadable") end]}
|
|
368
|
+
else error("unreadable") end)}]
|
|
369
|
+
| from_entries) as $read
|
|
370
|
+
| def none: {by: [], cut: false};
|
|
371
|
+
def read($id): if ($id | type) == "string" and ($read | has($id)) then $read[$id] else {by: [], cut: true} end;
|
|
372
|
+
def detail:
|
|
373
|
+
. as $card
|
|
374
|
+
| (if .parent == null then null
|
|
375
|
+
elif (.parent | type) == "object"
|
|
376
|
+
then .parent | {key: (.id | text), id: (.identifier | text), title: (.title | text)}
|
|
377
|
+
else error("unreadable") end) as $parent
|
|
378
|
+
| (if $parent == null then [] else $subs[$parent.key] // [] end) as $among
|
|
379
|
+
| (if ((.inverseRelations.nodes? // []) | length) > 0 then read(.id) else none end) as $own
|
|
380
|
+
| (if $parent != null and .state.type == "unstarted" then read($parent.key) else none end) as $above
|
|
381
|
+
| (reduce ($own.by[], $above.by[] | select(.status.type != "completed")) as $by ([];
|
|
382
|
+
if any(.[]; .id == $by.id) then . else . + [$by] end)) as $open
|
|
383
|
+
| (.state.type == "unstarted" and ($open | length) > 0) as $held
|
|
384
|
+
| {parent: (if $parent == null then null
|
|
385
|
+
else {id: $parent.id, title: $parent.title, subIssues: ($among | length),
|
|
386
|
+
done: ([$among[] | select(.done)] | length)} end),
|
|
387
|
+
place: (($among | map(.id) | index($card.identifier)) as $at | if $at == null then null else $at + 1 end),
|
|
388
|
+
blockedBy: $own.by,
|
|
389
|
+
blockersCut: ($own.cut or $above.cut),
|
|
390
|
+
held: $held,
|
|
391
|
+
waitsOn: (if $held then $open else [] end)};
|
|
392
|
+
{
|
|
272
393
|
missing: ($teams - [$first.teams.nodes[].key]),
|
|
273
394
|
space: $space,
|
|
274
395
|
teams: $teams,
|
|
@@ -286,45 +407,90 @@ LIST_SHAPE='
|
|
|
286
407
|
cards: [
|
|
287
408
|
$cards[]
|
|
288
409
|
| select(.state.name == $status.name and .state.type == $status.type)
|
|
289
|
-
| {id: .identifier, title: .title, url: .url}
|
|
410
|
+
| {id: .identifier, title: .title, url: .url} + (if $detail then detail else {} end)
|
|
290
411
|
]
|
|
291
412
|
}
|
|
292
413
|
]
|
|
293
414
|
}'
|
|
294
415
|
|
|
295
|
-
#
|
|
296
|
-
#
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
key=$(linear_saved_key) || exit 1
|
|
306
|
-
teams=$(printf '%s\n' "$@" | jq -Rcn '[inputs]')
|
|
416
|
+
# Ask Linear a question that pages through cards, up to the last page, and
|
|
417
|
+
# print each page's answer as a line of JSON under a name, like
|
|
418
|
+
# {"list": <the answer>}, for LIST_SHAPE to tell the questions' answers
|
|
419
|
+
# apart by. The query takes $first and $after with the variables given, and
|
|
420
|
+
# answers with issues { nodes pageInfo { hasNextPage endCursor } }. When the
|
|
421
|
+
# pages cannot be read to the last one, it stops, as die does: what came so
|
|
422
|
+
# far would pass a part for the whole.
|
|
423
|
+
# linear_pages <key> <name> <what the pages hold, for a message> <query> <its other variables, as JSON>
|
|
424
|
+
linear_pages() {
|
|
425
|
+
local key=$1 name=$2 what=$3 query=$4 base=$5 vars data after='' more asked=0
|
|
307
426
|
while :; do
|
|
308
427
|
asked=$((asked + 1))
|
|
309
428
|
[ "$asked" -le "$LINEAR_PAGES" ] ||
|
|
310
|
-
die "Linear still had more
|
|
311
|
-
vars=$(jq -cn --argjson
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
data=$(linear_ask "$key" "$
|
|
315
|
-
|
|
429
|
+
die "Linear still had more $what after $LINEAR_PAGES pages of $LINEAR_PAGE, which is more than ocnus lists."
|
|
430
|
+
vars=$(jq -cn --argjson base "$base" --argjson first "$LINEAR_PAGE" --arg after "$after" \
|
|
431
|
+
'$base + {first: $first, after: (if $after == "" then null else $after end)}') ||
|
|
432
|
+
die "could not put a question to Linear together."
|
|
433
|
+
data=$(linear_ask "$key" "$query" "$vars") || exit 1
|
|
434
|
+
printf '{"%s":%s}\n' "$name" "$data"
|
|
316
435
|
more=$(printf '%s' "$data" | jq -r '.issues.pageInfo.hasNextPage == true' 2>/dev/null) ||
|
|
317
436
|
die "Linear's answer was not one ocnus can read."
|
|
318
437
|
[ "$more" = true ] || break
|
|
319
438
|
# Listing what came so far would pass a part of the list for the whole.
|
|
320
439
|
after=$(printf '%s' "$data" | jq -r '.issues.pageInfo.endCursor | strings' 2>/dev/null) || after=
|
|
321
440
|
[ -n "$after" ] ||
|
|
322
|
-
die "Linear said it had more
|
|
441
|
+
die "Linear said it had more $what but not where the next ones start, so the list would be cut short."
|
|
323
442
|
done
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
# Print the open cards of some Linear teams as one line of JSON, grouped by
|
|
446
|
+
# status:
|
|
447
|
+
# {"space":"demo","teams":["ABC"],"statuses":[
|
|
448
|
+
# {"name":"Backlog","type":"backlog","cards":[{"id":"ABC-1","title":"…","url":"…"}]}]}
|
|
449
|
+
# Every open status of the teams is there, with no cards when it has none.
|
|
450
|
+
# With the detail, which `task ls --json` asks for, each card also says
|
|
451
|
+
# where it stands (LIST_SHAPE):
|
|
452
|
+
# {"id":"ABC-123","title":"…","url":"…",
|
|
453
|
+
# "parent":{"id":"ABC-100","title":"…","subIssues":3,"done":1},"place":2,
|
|
454
|
+
# "blockedBy":[{"id":"ABC-122","title":"…","status":{"name":"In Progress","type":"started"}}],
|
|
455
|
+
# "blockersCut":false,"held":true,
|
|
456
|
+
# "waitsOn":[{"id":"ABC-122","title":"…","status":{"name":"In Progress","type":"started"}}]}
|
|
457
|
+
# That takes up to two more questions, each asked only when the list holds
|
|
458
|
+
# something to ask about: the sub-issues of the parents the cards name, all
|
|
459
|
+
# in one question, paged to its end, and then the blockers of the cards
|
|
460
|
+
# that some card is related to and of the parents of not-started cards,
|
|
461
|
+
# LIST_BLOCKED cards at a time. When one of them fails, or cannot be read to
|
|
462
|
+
# its end, nothing is printed, as for the list itself.
|
|
463
|
+
# linear_open_cards <space> <true, for the detail, or false> <team key>...
|
|
464
|
+
linear_open_cards() {
|
|
465
|
+
local space=$1 detail=$2 key teams pages ask count at=0 vars data list missing
|
|
466
|
+
shift 2
|
|
467
|
+
linear_tools
|
|
468
|
+
key=$(linear_saved_key) || exit 1
|
|
469
|
+
teams=$(printf '%s\n' "$@" | jq -Rcn '[inputs]')
|
|
470
|
+
pages=$(linear_pages "$key" list cards "$LIST_QUERY" \
|
|
471
|
+
"$(jq -cn --argjson teams "$teams" --argjson types "$OPEN_TYPES" '{teams: $teams, types: $types}')") || exit 1
|
|
472
|
+
if [ "$detail" = true ]; then
|
|
473
|
+
# The pages go to jq on stdin, here and below, not as an argument: a
|
|
474
|
+
# long list of cards is more than a command's arguments may hold.
|
|
475
|
+
ask=$(printf '%s\n' "$pages" | jq -cs "$LIST_ASK" 2>/dev/null) ||
|
|
476
|
+
die "Linear's answer was not one ocnus can read."
|
|
477
|
+
if [ "$(printf '%s' "$ask" | jq -r '.parents | length')" != 0 ]; then
|
|
478
|
+
data=$(linear_pages "$key" subs sub-issues "$LIST_SUBS_QUERY" "$(printf '%s' "$ask" | jq -c '{parents}')") || exit 1
|
|
479
|
+
pages+=$'\n'$data
|
|
480
|
+
fi
|
|
481
|
+
count=$(printf '%s' "$ask" | jq -r '.ids | length')
|
|
482
|
+
while [ "$at" -lt "$count" ]; do
|
|
483
|
+
# As many cards are asked for as are named, and no more.
|
|
484
|
+
vars=$(printf '%s' "$ask" |
|
|
485
|
+
jq -c --argjson at "$at" --argjson n "$LIST_BLOCKED" '.ids[$at:($at + $n)] | {ids: ., first: length}')
|
|
486
|
+
data=$(linear_ask "$key" "$LIST_BLOCKERS_QUERY" "$vars") || exit 1
|
|
487
|
+
pages+=$'\n'"{\"blockers\":$data}"
|
|
488
|
+
at=$((at + LIST_BLOCKED))
|
|
489
|
+
done
|
|
490
|
+
fi
|
|
491
|
+
list=$(printf '%s\n' "$pages" |
|
|
492
|
+
jq -cs --arg space "$space" --argjson teams "$teams" --argjson types "$OPEN_TYPES" --argjson detail "$detail" \
|
|
493
|
+
"$LIST_SHAPE" 2>/dev/null) ||
|
|
328
494
|
die "Linear's answer was not one ocnus can read."
|
|
329
495
|
missing=$(printf '%s' "$list" | jq -r '.missing | join(", ")')
|
|
330
496
|
[ -z "$missing" ] ||
|
package/cli/lib/task.sh
CHANGED
|
@@ -849,13 +849,17 @@ task_build() {
|
|
|
849
849
|
|
|
850
850
|
# List the open cards of a space's Linear teams, grouped by status: the
|
|
851
851
|
# cards `task new` can be given. Linear itself is asked in linear.sh. --json
|
|
852
|
-
# prints the list as one line for programs; the cards mod reads it.
|
|
852
|
+
# prints the list as one line for programs; the cards mod reads it. Only
|
|
853
|
+
# --json asks for the detail, where each card stands: its parent and its
|
|
854
|
+
# place among the parent's sub-issues, the cards that block it, and whether
|
|
855
|
+
# it is held. That costs up to two more questions to Linear, and the plain
|
|
856
|
+
# list shows none of it, so the plain list asks for the list alone.
|
|
853
857
|
task_ls() {
|
|
854
|
-
local name=${1:-} json=0 dir team keys list
|
|
858
|
+
local name=${1:-} json=0 detail=false dir team keys list
|
|
855
859
|
local -a teams=()
|
|
856
860
|
dir=$(space_dir "$name")
|
|
857
861
|
case ${2:-} in
|
|
858
|
-
--json) json=1 ;;
|
|
862
|
+
--json) json=1 detail=true ;;
|
|
859
863
|
'') ;;
|
|
860
864
|
*) die "unknown option for task ls: $2" ;;
|
|
861
865
|
esac
|
|
@@ -866,7 +870,7 @@ task_ls() {
|
|
|
866
870
|
while IFS= read -r team; do [ -z "$team" ] || teams+=("$team"); done <<< "$keys"
|
|
867
871
|
[ "${#teams[@]}" -gt 0 ] ||
|
|
868
872
|
die "space '$name' has no Linear team, so there are no cards to list. Set it with: ocnus space team $name <team key>, like: ocnus space team $name ABC"
|
|
869
|
-
list=$(linear_open_cards "$name" "${teams[@]}") || exit 1
|
|
873
|
+
list=$(linear_open_cards "$name" "$detail" "${teams[@]}") || exit 1
|
|
870
874
|
if [ "$json" = 1 ]; then
|
|
871
875
|
printf '%s\n' "$list"
|
|
872
876
|
return
|
package/cli/ocnus
CHANGED
|
@@ -112,7 +112,15 @@ by the trust question. It needs jq; without it Claude Code asks once.
|
|
|
112
112
|
A task is one piece of work in a space, usually a Linear card.
|
|
113
113
|
`task ls` lists the cards `task new` can be given: every card of the
|
|
114
114
|
space's Linear teams that is not done, cancelled or a duplicate, under its
|
|
115
|
-
status.
|
|
115
|
+
status. With --json, for programs, each card also says where it stands: its
|
|
116
|
+
parent card, with how many sub-issues the parent has and how many of them
|
|
117
|
+
are done, its place among them in the order they were made, the cards that
|
|
118
|
+
block it, and whether it is held, with the cards it waits on. A card is held
|
|
119
|
+
when it is in a not-started status and a card that blocks it, or its parent,
|
|
120
|
+
is not done, which is when `task start` holds it. That asks Linear up to two
|
|
121
|
+
more questions, for the sub-issues and for the blockers; the plain list asks
|
|
122
|
+
for neither.
|
|
123
|
+
`task ls` needs two things set once. `linear key` asks for a Linear API key
|
|
116
124
|
and saves it (make one in Linear, under Settings, Account, Security & access,
|
|
117
125
|
Personal API keys; Read permission is enough to list cards and for
|
|
118
126
|
`linear read`, which the card skills read a card with, and the card skills'
|
package/herdr/README.md
CHANGED
|
@@ -325,8 +325,28 @@ ocnus task ls <space> [--json]
|
|
|
325
325
|
`HTTPS_PROXY`, is still used.
|
|
326
326
|
- **`--json` prints the list as one line for programs**: the space, under the
|
|
327
327
|
key `space`, its teams, and each status with its `name`, its `type`
|
|
328
|
-
(`triage`, `backlog`, `unstarted` or `started`) and its `cards
|
|
329
|
-
`id`, a `title` and a `url
|
|
328
|
+
(`triage`, `backlog`, `unstarted` or `started`) and its `cards`. Each card
|
|
329
|
+
has an `id`, a `title` and a `url`, and then where it stands, which the
|
|
330
|
+
plain list does not show:
|
|
331
|
+
|
|
332
|
+
| Key | What it is |
|
|
333
|
+
|---|---|
|
|
334
|
+
| `parent` | The card it is a sub-issue of, as `{"id", "title", "subIssues", "done"}`, or `null` for a card with none. The parent is named whatever its status and its team: one that is done or canceled, or in a team the space does not list, is not in the list itself, and is still named here. `subIssues` is how many sub-issues the parent has, and `done` is how many of them are done. Every sub-issue counts towards `subIssues`, whatever its status and its team, a canceled one too. Only one in a completed status counts towards `done`, which is where a card is once its pull requests have merged. |
|
|
335
|
+
| `place` | Where the card comes among its parent's sub-issues, from 1, in the order they were made. That is the order `ocnus linear read` lists a card's sub-issues in, so the place agrees with the `slice N of M` a brief gives. It is `null` for a card with no parent, and for one that Linear's answer about the sub-issues no longer has, as when its parent changed while the list was read. With the parent's counts, a card can be shown as `place`/`subIssues`, and its parent as `done`/`subIssues` merged. |
|
|
336
|
+
| `blockedBy` | The cards that block it, each with its `id`, its `title` and its `status`, which is the `name` and the `type` of the status it is in: `[{"id", "title", "status": {"name", "type"}}]`, the form `linear read --json` gives them in. A blocker is listed done or not, and whatever team it is in. A card that is only related to it is not a blocker. A card nothing blocks has an empty list. |
|
|
337
|
+
| `held` | `true` when the card is in a not-started status, such as Todo, and a card that blocks it, or that blocks its parent, is not done. That is when `task start` holds a card (see [Starting the work](#starting-the-work)): a blocker that is canceled holds it, and one that is done does not. A card in any other status is never held, whatever blocks it. |
|
|
338
|
+
| `waitsOn` | For a card that is held, the blockers that are not done, its own and then its parent's, each once, in the form of `blockedBy`. Empty for a card that is not held. |
|
|
339
|
+
| `blockersCut` | `true` when the card may have blockers that were not read, so that `blockedBy` and `waitsOn` may not be all of them and `held` goes by the ones that were read. That is so when Linear has more than 20 relations from other cards to the card, or to the parent of a card in a not-started status, or when Linear's answer left the card or that parent out. |
|
|
340
|
+
|
|
341
|
+
To say this, `--json` asks Linear up to two more questions after the
|
|
342
|
+
list, each only when the list has something to ask about. The first is for
|
|
343
|
+
the sub-issues of every parent the cards name, all in one question. It is
|
|
344
|
+
read page by page to the last sub-issue, so a place or a count never stops
|
|
345
|
+
short. The second is for the blockers of the cards that another card is
|
|
346
|
+
related to, and of the parents of the cards in a not-started status, 50
|
|
347
|
+
cards at a time. When either fails, or cannot be read to its end, the
|
|
348
|
+
command fails rather than print a list without it. When it fails it prints
|
|
349
|
+
nothing on stdout.
|
|
330
350
|
- **Two teams' cards share a group when their statuses have the same name and
|
|
331
351
|
the same type**, such as a Backlog of type `backlog` in each. A status only
|
|
332
352
|
one team has is a group of its own, and so is one whose name another team
|