@johngaynor/ocnus 2.0.1-next.7 → 2.0.1-next.73
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 +518 -98
- package/cli/lib/agents.sh +32 -16
- package/cli/lib/asks.sh +762 -0
- package/cli/lib/banner.sh +181 -0
- package/cli/lib/brief.sh +375 -0
- package/cli/lib/chain.sh +363 -0
- package/cli/lib/close.sh +5 -3
- package/cli/lib/cost.sh +500 -0
- package/cli/lib/finish.sh +30 -4
- package/cli/lib/github.sh +106 -26
- package/cli/lib/guard.sh +39 -10
- package/cli/lib/handoff.sh +196 -31
- package/cli/lib/host.sh +340 -384
- package/cli/lib/linear.sh +552 -56
- package/cli/lib/links.sh +6 -3
- package/cli/lib/merges.sh +126 -27
- package/cli/lib/sessions.sh +132 -0
- package/cli/lib/settings.sh +31 -15
- package/cli/lib/task.sh +169 -54
- package/cli/lib/tests.sh +302 -7
- package/cli/lib/usage.sh +204 -0
- package/cli/ocnus +274 -76
- package/herdr/README.md +930 -232
- package/herdr/layouts/default.json +30 -11
- package/herdr/layouts/showcase.json +291 -0
- package/herdr/layouts/vibe.json +162 -0
- package/herdr/layouts/vibe.svg +41 -0
- package/herdr/mods/agent-settings/main.js +19 -7
- package/herdr/mods/memory/main.js +128 -0
- package/herdr/mods/memory/mod.json +1 -0
- package/herdr/mods/memory/reading.js +88 -0
- package/herdr/mods/names/main.js +22 -4
- package/herdr/mods/step-counts/main.js +281 -0
- package/herdr/mods/step-counts/mod.json +1 -0
- package/herdr/mods/usage/main.js +149 -0
- package/herdr/mods/usage/mod.json +1 -0
- package/package.json +1 -1
- package/prompts/task-new.md +1 -1
- package/skills/brief/SKILL.md +8 -0
- package/skills/sdlc-breakdown/SKILL.md +66 -18
- package/skills/sdlc-build/SKILL.md +6 -2
- package/skills/sdlc-pr/SKILL.md +2 -2
- package/skills/sdlc-review/SKILL.md +5 -5
package/cli/lib/task.sh
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
# own, which runs `task build` to start the agent that builds
|
|
9
9
|
# the card. The write-up agent runs it as soon as the card is
|
|
10
10
|
# approved. It makes nothing for a card that a card not done
|
|
11
|
-
# yet blocks, and
|
|
11
|
+
# yet blocks, and puts its write-up session away: the chain
|
|
12
|
+
# starts it once that is done (chain.sh).
|
|
13
|
+
# task ready `task start` for every card of the space's Linear teams that
|
|
14
|
+
# waits and is ready, which the watch runs each half hour
|
|
12
15
|
# The agent runs `task handoff` as each step ends, and `task log` shows what
|
|
13
16
|
# it recorded. Both are in handoff.sh. While the pull requests wait on the
|
|
14
17
|
# human, `task merges`, ocnus's watch on the merges, watches them on
|
|
@@ -48,10 +51,25 @@ PROFILE_MCP=$REPO/agents/linear-mcp.json
|
|
|
48
51
|
# not read. Each flag holds its value after an =, because --mcp-config takes
|
|
49
52
|
# several values and would take the first message as one of them. --model=
|
|
50
53
|
# and --effort= beat the profile's own model and the human's own Claude Code
|
|
51
|
-
# settings; only CLAUDE_CODE_EFFORT_LEVEL beats --effort=.
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
# the agent
|
|
54
|
+
# settings; only CLAUDE_CODE_EFFORT_LEVEL beats --effort=.
|
|
55
|
+
#
|
|
56
|
+
# One --settings= holds everything else claude is given, as one object. It
|
|
57
|
+
# always has the hook behind the agent's permission prompts (ask_hooks, in
|
|
58
|
+
# asks.sh), which lets the human see a prompt with `task asks` and answer it
|
|
59
|
+
# with `task answer`. While recording is on, it has the hooks that mark the
|
|
60
|
+
# time of the agent of that card's phase too (host_hooks, in host.sh), the
|
|
61
|
+
# permission hook beside theirs; when they cannot be given, the agent starts
|
|
62
|
+
# without them. They are put together with jq, which those hooks need
|
|
63
|
+
# anyway; the rest needs no jq, so an agent starts on a machine that has
|
|
64
|
+
# none.
|
|
65
|
+
#
|
|
66
|
+
# On either account, the object also gives claude a statusLine: the command
|
|
67
|
+
# Claude Code hands a JSON to each time it updates the status line, `ocnus
|
|
68
|
+
# usage record` with the agent's space, card, phase and account after it
|
|
69
|
+
# (usage_status_line, in usage.sh). It saves the subscription's usage limits
|
|
70
|
+
# for the Usage section, adds what the session has used to the cost file, as
|
|
71
|
+
# that card's (cost.sh), and prints nothing. It overrides a statusLine of the
|
|
72
|
+
# human's own, for ocnus's agents alone.
|
|
55
73
|
#
|
|
56
74
|
# It also leaves in AGENT_ENV the words claude is started after, which run it
|
|
57
75
|
# without ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN, so that the agent runs
|
|
@@ -65,17 +83,19 @@ PROFILE_MCP=$REPO/agents/linear-mcp.json
|
|
|
65
83
|
# Another harness gets no words, and starts as it always has.
|
|
66
84
|
#
|
|
67
85
|
# With billing on api (billing.sh), the agent runs on the Anthropic API key
|
|
68
|
-
# the human saved instead:
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
86
|
+
# the human saved instead: the object also holds an apiKeyHelper, the
|
|
87
|
+
# command claude runs to get the key, which comes before the /login sign-in
|
|
88
|
+
# in Claude Code's order. The key itself is in no argument and in no
|
|
89
|
+
# environment, and env's words still drop the exported variables, which
|
|
90
|
+
# would come before the helper. With no key saved it stops, before an agent
|
|
91
|
+
# is started. An agent on the API has no usage limits to read, and its
|
|
92
|
+
# statusLine records what its session used all the same, as spend. The
|
|
93
|
+
# profile's model and effort hold either way.
|
|
74
94
|
# $1 the profile $2 its name in the settings file
|
|
75
95
|
# $3 the space $4 the card $5 the phase, write-up or build
|
|
76
96
|
PROFILE_ARGS=() AGENT_ENV=()
|
|
77
97
|
profile_args() {
|
|
78
|
-
local profile=$1 settings=$2 hooks
|
|
98
|
+
local profile=$1 settings=$2 hooks ask more both
|
|
79
99
|
PROFILE_ARGS=() AGENT_ENV=()
|
|
80
100
|
[ "${HARNESS##*/}" = claude ] || return 0
|
|
81
101
|
[ -f "$AGENTS_HOME/$profile.md" ] ||
|
|
@@ -83,14 +103,25 @@ profile_args() {
|
|
|
83
103
|
settings_check
|
|
84
104
|
PROFILE_ARGS=("--agent=$profile" --strict-mcp-config "--mcp-config=$PROFILE_MCP"
|
|
85
105
|
"--model=$(profile_model "$settings")" "--effort=$(profile_effort "$settings")")
|
|
86
|
-
if hooks=$(host_hooks "$3" "$4" "$5") && [ -n "$hooks" ]; then
|
|
87
|
-
PROFILE_ARGS+=("--settings=$hooks")
|
|
88
|
-
fi
|
|
89
106
|
AGENT_ENV=(env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN)
|
|
107
|
+
more="{\"statusLine\":$(usage_status_line "$3" "$4" "$5")}"
|
|
90
108
|
if [ "$SET_BILLING" = api ]; then
|
|
91
109
|
[ -n "$SAVED_ANTHROPIC_KEY" ] || die "$BILLING_NO_KEY"
|
|
92
|
-
|
|
110
|
+
more="{\"apiKeyHelper\":\"$(json_str "$(billing_helper)")\",${more#\{}"
|
|
93
111
|
fi
|
|
112
|
+
ask=$(ask_hooks "$3" "$4") || ask=''
|
|
113
|
+
hooks=$(host_hooks "$3" "$4" "$5") || hooks=''
|
|
114
|
+
if [ -n "$hooks" ] && both=$(jq -c --argjson ask "${ask:-null}" --argjson more "$more" '
|
|
115
|
+
(if $ask == null then . else .hooks.PermissionRequest += $ask.hooks.PermissionRequest end) + $more' \
|
|
116
|
+
<<< "$hooks" 2>/dev/null) && [ -n "$both" ]; then
|
|
117
|
+
hooks=$both
|
|
118
|
+
elif [ -n "$ask" ]; then
|
|
119
|
+
# Each is one object on a line, so the two are joined as one, without jq.
|
|
120
|
+
hooks="${ask%\}},${more#\{}"
|
|
121
|
+
else
|
|
122
|
+
hooks=$more
|
|
123
|
+
fi
|
|
124
|
+
PROFILE_ARGS+=("--settings=$hooks")
|
|
94
125
|
}
|
|
95
126
|
|
|
96
127
|
# Stop if Linear has no such card, before an agent is started on it: a
|
|
@@ -261,6 +292,9 @@ task_new() {
|
|
|
261
292
|
die "the $skill skill is not in $SKILLS_HOME, so the agent could not use it. Run: ocnus update"
|
|
262
293
|
done
|
|
263
294
|
profile_args "$CARD_PROFILE" "$CARD_SETTINGS" "$name" "$card" write-up
|
|
295
|
+
# claude is told the ID of its session, so that ocnus knows which
|
|
296
|
+
# conversation is this card's write-up agent's (sessions.sh).
|
|
297
|
+
session_new
|
|
264
298
|
[ -f "$CARD_PROMPT" ] || die "the agent's first message is missing from $CARD_PROMPT"
|
|
265
299
|
prompt=$(sed -e "s/{card}/$card/g" -e "s/{space}/$name/g" "$CARD_PROMPT")
|
|
266
300
|
check_card "$card"
|
|
@@ -271,12 +305,15 @@ task_new() {
|
|
|
271
305
|
# tab, because the agent meets the trust question the moment it starts.
|
|
272
306
|
trust_space "$name"
|
|
273
307
|
# The tab is named after the card, in the space's folder. The argv is env's
|
|
274
|
-
# words, the harness and its profile's flags,
|
|
308
|
+
# words, the harness and its profile's flags, the session's flag, then the
|
|
309
|
+
# agent's first message.
|
|
275
310
|
open_agent_tab "$name" "$dir" "$dir" "$card" "$card" "$prompt" ${AGENT_ENV[@]+"${AGENT_ENV[@]}"} \
|
|
276
|
-
"$HARNESS" ${PROFILE_ARGS[@]+"${PROFILE_ARGS[@]}"} || die "$AGENT_ERROR"
|
|
311
|
+
"$HARNESS" ${PROFILE_ARGS[@]+"${PROFILE_ARGS[@]}"} ${SESSION_ARGS[@]+"${SESSION_ARGS[@]}"} || die "$AGENT_ERROR"
|
|
277
312
|
record_start "$name" "$card"
|
|
313
|
+
session_record "$name" "$card" write-up "$HARNESS" "$SESSION"
|
|
278
314
|
# An agent is open now, so recording, when it is on, starts (host.sh), and
|
|
279
|
-
# ocnus's watch on the merges, while a card waits on one
|
|
315
|
+
# ocnus's watch on the merges, while a card waits on one or its catch-up
|
|
316
|
+
# is due (merges.sh).
|
|
280
317
|
host_wake
|
|
281
318
|
merges_wake
|
|
282
319
|
if [ "$AGENT_IN_APP" = 1 ]; then
|
|
@@ -563,18 +600,66 @@ parse_targets() {
|
|
|
563
600
|
done
|
|
564
601
|
}
|
|
565
602
|
|
|
603
|
+
# How `task start` starts what it says of a card it holds, after the card's
|
|
604
|
+
# ID. The chain tells a card that was held from a start that stopped by it
|
|
605
|
+
# (chain_start in chain.sh).
|
|
606
|
+
HELD_SAYS='is held: a card that blocks it is not done yet'
|
|
607
|
+
|
|
566
608
|
# What `task start` says when it holds a card, from CARD_OPEN and
|
|
567
609
|
# CARD_STATUS (card_branch): each card that blocks it, or the card it was
|
|
568
|
-
# sliced from, and is not done yet,
|
|
610
|
+
# sliced from, and is not done yet, that the card stays where it is, and what
|
|
611
|
+
# starts it once they are done: ocnus's watch, with the chain on (chain.sh),
|
|
612
|
+
# or the human, with it off or with settings that cannot be read.
|
|
569
613
|
# held_message <card ID>
|
|
570
614
|
held_message() {
|
|
571
|
-
local card=$1 where='where it is in Linear'
|
|
615
|
+
local card=$1 where='where it is in Linear' next='Run this again once the cards that block it are done.'
|
|
572
616
|
[ -z "$CARD_STATUS" ] || where="in $CARD_STATUS"
|
|
573
|
-
|
|
617
|
+
if settings_load 2>/dev/null; then
|
|
618
|
+
if [ "$SET_CHAIN" = true ]; then
|
|
619
|
+
next="ocnus's watch starts it once the cards that block it are done."
|
|
620
|
+
else
|
|
621
|
+
next="The chain is off, so ocnus's watch will not start it: run this again once the cards that block it are done, or turn the chain on with: ocnus chain on"
|
|
622
|
+
fi
|
|
623
|
+
fi
|
|
624
|
+
printf '%s %s, so no task was made for it.\n' "$card" "$HELD_SAYS"
|
|
574
625
|
printf '%s' "$CARD_OPEN" | jq -r --arg card "$card" '.[]
|
|
575
626
|
| " blocker \(.id)\(if .status == "" then "" else ", in \(.status)," end) blocks "
|
|
576
627
|
+ (if .of == $card then $card else "\(.of), the card \($card) was sliced from" end)'
|
|
577
|
-
printf '%s stays %s.
|
|
628
|
+
printf '%s stays %s. %s' "$card" "$where" "$next"
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
# The write-up sessions `task start` puts away for a card (close.sh), into
|
|
632
|
+
# WRITEUPS: the card's own, and for a sub-issue its parent's, whose tab it
|
|
633
|
+
# was written up in (CARD_PARENT, from card_branch). Only one with a tab open
|
|
634
|
+
# in the space: a card started with no write-up session starts as before.
|
|
635
|
+
# writeups_open <space> <the space's folder> <card ID>
|
|
636
|
+
WRITEUPS=()
|
|
637
|
+
writeups_open() {
|
|
638
|
+
local name=$1 dir=$2 card=$3 writeup sep=$'\x1f' name_seen rest
|
|
639
|
+
WRITEUPS=()
|
|
640
|
+
agents_read "$name" "$dir"
|
|
641
|
+
for writeup in "$card" ${CARD_PARENT:+"$CARD_PARENT"}; do
|
|
642
|
+
while IFS=$sep read -r name_seen rest; do
|
|
643
|
+
[ "$name_seen" != "$writeup" ] || { WRITEUPS+=("$writeup"); break; }
|
|
644
|
+
done <<< "$AGENT_TABS"
|
|
645
|
+
done
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
# ocnus task ready <space>: start every card of the space's Linear teams
|
|
649
|
+
# that waits and is ready, and say what became of each card that waits
|
|
650
|
+
# (ready_cards in chain.sh). It is the catch-up for a start the watch missed
|
|
651
|
+
# at a merge, and what the watch itself runs for every space each half hour.
|
|
652
|
+
# It starts them whether the chain is on or off, since the human ran it, and
|
|
653
|
+
# exits non-zero when a card that was ready could not be started.
|
|
654
|
+
task_ready() {
|
|
655
|
+
local name=${1:-} dir
|
|
656
|
+
[ "$#" -le 1 ] || die "usage: ocnus task ready <space>, like: ocnus task ready $name"
|
|
657
|
+
dir=$(space_dir "$name")
|
|
658
|
+
# Each card's agent runs in a herdr-core terminal, so herdr-core has to be
|
|
659
|
+
# running before Linear is asked anything.
|
|
660
|
+
core_ready
|
|
661
|
+
ready_cards "$name" "$dir" named
|
|
662
|
+
[ "$CHAIN_FAILED" = 0 ] || exit 1
|
|
578
663
|
}
|
|
579
664
|
|
|
580
665
|
# What `task start` takes after the card.
|
|
@@ -652,8 +737,17 @@ task_start() {
|
|
|
652
737
|
# once everything here has been checked.
|
|
653
738
|
card_branch "$name" "$card" "$given_type" "$given_title"
|
|
654
739
|
# A card waits until every card that blocks it, or the card it was sliced
|
|
655
|
-
# from, is done, so it is held before anything is fetched or made.
|
|
656
|
-
|
|
740
|
+
# from, is done, so it is held before anything is fetched or made. All
|
|
741
|
+
# there is to know of a held card is in Linear, its status and its
|
|
742
|
+
# blockers, and the watch opens a new build tab when it starts it, so its
|
|
743
|
+
# write-up session is put away now, as it is once a build tab opens.
|
|
744
|
+
local writeup
|
|
745
|
+
if [ -n "$CARD_OPEN" ]; then
|
|
746
|
+
printf 'ocnus: %s\n' "$(held_message "$card")" >&2
|
|
747
|
+
writeups_open "$name" "$dir" "$card"
|
|
748
|
+
for writeup in ${WRITEUPS[@]+"${WRITEUPS[@]}"}; do start_close "$name" "$writeup" "$dir"; done
|
|
749
|
+
exit 1
|
|
750
|
+
fi
|
|
657
751
|
branch=$BRANCH
|
|
658
752
|
task=$(task_name "$branch")
|
|
659
753
|
tdir=$dir/tasks/$task
|
|
@@ -718,18 +812,10 @@ task_start() {
|
|
|
718
812
|
setup_line "$tdir" "${repos[@]}"
|
|
719
813
|
build="ocnus task build $name $card"
|
|
720
814
|
line=${SETUP_LINE:+$SETUP_LINE && }$build
|
|
721
|
-
# The write-up sessions to put away once the build tab is open
|
|
722
|
-
#
|
|
723
|
-
#
|
|
724
|
-
|
|
725
|
-
# tab opens, which is the last thing the app is asked to do.
|
|
726
|
-
local writeups=() writeup sep=$'\x1f' name_seen rest
|
|
727
|
-
agents_read "$name" "$dir"
|
|
728
|
-
for writeup in "$card" ${CARD_PARENT:+"$CARD_PARENT"}; do
|
|
729
|
-
while IFS=$sep read -r name_seen rest; do
|
|
730
|
-
[ "$name_seen" != "$writeup" ] || { writeups+=("$writeup"); break; }
|
|
731
|
-
done <<< "$AGENT_TABS"
|
|
732
|
-
done
|
|
815
|
+
# The write-up sessions to put away once the build tab is open. They are
|
|
816
|
+
# looked for before the build tab opens, which is the last thing the app is
|
|
817
|
+
# asked to do.
|
|
818
|
+
writeups_open "$name" "$dir" "$card"
|
|
733
819
|
# The task exists now. If no tab can be opened for it, keep it, and say
|
|
734
820
|
# where it is and how to start its agent.
|
|
735
821
|
open_agent_tab "$name" "$dir" "$folder" "$task" "$card" '' /bin/sh -c "$line" ||
|
|
@@ -762,7 +848,7 @@ task_start() {
|
|
|
762
848
|
record_start "$name" "$card" start "$notes"
|
|
763
849
|
# The build phase has started, so the write-up sessions found above are put
|
|
764
850
|
# away. This comes last, so that a task start that stops leaves them open.
|
|
765
|
-
for writeup in ${
|
|
851
|
+
for writeup in ${WRITEUPS[@]+"${WRITEUPS[@]}"}; do start_close "$name" "$writeup" "$dir"; done
|
|
766
852
|
say "Opened task '$task' on branch $branch"
|
|
767
853
|
}
|
|
768
854
|
|
|
@@ -772,14 +858,21 @@ task_start() {
|
|
|
772
858
|
# request. Run it again in the tab to start a new agent when the first one
|
|
773
859
|
# has stopped.
|
|
774
860
|
#
|
|
775
|
-
# With --continue and a message, it continues
|
|
776
|
-
#
|
|
861
|
+
# With --continue and a message, it continues the card's build session
|
|
862
|
+
# instead, with that message: ocnus's watch on the merges types
|
|
777
863
|
# it into the tab's shell to wake an agent that has exited (merges.sh). The
|
|
778
864
|
# session comes back with the build profile, model and effort, which a bare
|
|
779
865
|
# `claude --continue` would not give it. Only claude has --continue.
|
|
866
|
+
#
|
|
867
|
+
# A new agent is told the ID of its session, which is recorded as the card's
|
|
868
|
+
# newest build session (sessions.sh). --continue continues that one by its
|
|
869
|
+
# ID, with --resume=<ID>, while Claude Code keeps its transcript. With none
|
|
870
|
+
# recorded, as for an agent started before sessions were, it is claude's
|
|
871
|
+
# last session in this folder, with claude's own --continue. Either way it is
|
|
872
|
+
# the same conversation, so no session is recorded for it.
|
|
780
873
|
TASK_BUILD_USAGE='usage: ocnus task build <space> <card> [--continue <message>]'
|
|
781
874
|
task_build() {
|
|
782
|
-
local name=${1:-} card=${2:-} dir here low skill prompt again=''
|
|
875
|
+
local name=${1:-} card=${2:-} dir here low skill prompt again='' resume=--continue newest
|
|
783
876
|
dir=$(space_dir "$name")
|
|
784
877
|
[ -n "$card" ] ||
|
|
785
878
|
die "which card? Usage: ocnus task build $name <card>, like: ocnus task build $name ABC-122"
|
|
@@ -792,7 +885,7 @@ task_build() {
|
|
|
792
885
|
*) [ "$#" -le 2 ] || die "$TASK_BUILD_USAGE" ;;
|
|
793
886
|
esac
|
|
794
887
|
[ -z "$again" ] || [ "${HARNESS##*/}" = claude ] ||
|
|
795
|
-
die "--continue is Claude Code's: it continues
|
|
888
|
+
die "--continue is Claude Code's: it continues the card's build session in claude, and the harness here is '$HARNESS'. Nothing was started."
|
|
796
889
|
card=$(printf '%s' "$card" | tr '[:lower:]' '[:upper:]')
|
|
797
890
|
low=$(printf '%s' "$card" | tr '[:upper:]' '[:lower:]')
|
|
798
891
|
# The agent works in the folder it starts in, so that has to be this card's
|
|
@@ -813,33 +906,48 @@ task_build() {
|
|
|
813
906
|
if [ -z "$again" ]; then
|
|
814
907
|
[ -f "$BUILD_PROMPT" ] || die "the agent's first message is missing from $BUILD_PROMPT"
|
|
815
908
|
prompt=$(sed -e "s/{card}/$card/g" -e "s/{space}/$name/g" "$BUILD_PROMPT")
|
|
909
|
+
session_new
|
|
910
|
+
else
|
|
911
|
+
# The session ID is the last value of the card's newest build row.
|
|
912
|
+
newest=$(newest_session "$name" "$card" build 2>/dev/null) || newest=''
|
|
913
|
+
newest=${newest##*"$SESSION_SEP"}
|
|
914
|
+
[ -z "$newest" ] || ! session_transcript "$newest" >/dev/null || resume="--resume=$newest"
|
|
816
915
|
fi
|
|
817
916
|
# The agent is about to start in this tab, so recording, when it is on,
|
|
818
917
|
# starts too, as it does when the build agent is started again here, and
|
|
819
|
-
# so does ocnus's watch on the merges, while a card waits on one
|
|
918
|
+
# so does ocnus's watch on the merges, while a card waits on one or its
|
|
919
|
+
# catch-up is due.
|
|
820
920
|
host_wake
|
|
821
921
|
merges_wake
|
|
822
922
|
# Every command the agent runs is named its space and card, so that
|
|
823
923
|
# `ocnus tests run` records its test runs as this card's (tests.sh).
|
|
824
924
|
export OCNUS_SPACE=$name OCNUS_CARD=$card
|
|
825
|
-
# The first message goes last, after the profile's flags
|
|
826
|
-
# message a session continued with, after --continue
|
|
827
|
-
# starts through env's words, without the
|
|
828
|
-
# the API (profile_args).
|
|
925
|
+
# The first message goes last, after the profile's flags and the session's,
|
|
926
|
+
# and so does the message a session continued with, after --continue or
|
|
927
|
+
# --resume=<ID>. Either way claude starts through env's words, without the
|
|
928
|
+
# variables that would put it on the API (profile_args).
|
|
829
929
|
[ -z "$again" ] ||
|
|
830
|
-
exec ${AGENT_ENV[@]+"${AGENT_ENV[@]}"} "$HARNESS" ${PROFILE_ARGS[@]+"${PROFILE_ARGS[@]}"}
|
|
831
|
-
|
|
930
|
+
exec ${AGENT_ENV[@]+"${AGENT_ENV[@]}"} "$HARNESS" ${PROFILE_ARGS[@]+"${PROFILE_ARGS[@]}"} "$resume" "$again"
|
|
931
|
+
# Recorded before the agent takes this command's place, since nothing runs
|
|
932
|
+
# after it.
|
|
933
|
+
session_record "$name" "$card" build "$HARNESS" "$SESSION"
|
|
934
|
+
exec ${AGENT_ENV[@]+"${AGENT_ENV[@]}"} "$HARNESS" ${PROFILE_ARGS[@]+"${PROFILE_ARGS[@]}"} \
|
|
935
|
+
${SESSION_ARGS[@]+"${SESSION_ARGS[@]}"} "$prompt"
|
|
832
936
|
}
|
|
833
937
|
|
|
834
938
|
# List the open cards of a space's Linear teams, grouped by status: the
|
|
835
939
|
# cards `task new` can be given. Linear itself is asked in linear.sh. --json
|
|
836
|
-
# prints the list as one line for programs; the cards mod reads it.
|
|
940
|
+
# prints the list as one line for programs; the cards mod reads it. Only
|
|
941
|
+
# --json asks for the detail, where each card stands: its parent and its
|
|
942
|
+
# place among the parent's sub-issues, the cards that block it, and whether
|
|
943
|
+
# it is held. That costs up to two more questions to Linear, and the plain
|
|
944
|
+
# list shows none of it, so the plain list asks for the list alone.
|
|
837
945
|
task_ls() {
|
|
838
|
-
local name=${1:-} json=0 dir team keys list
|
|
946
|
+
local name=${1:-} json=0 detail=false dir team keys list
|
|
839
947
|
local -a teams=()
|
|
840
948
|
dir=$(space_dir "$name")
|
|
841
949
|
case ${2:-} in
|
|
842
|
-
--json) json=1 ;;
|
|
950
|
+
--json) json=1 detail=true ;;
|
|
843
951
|
'') ;;
|
|
844
952
|
*) die "unknown option for task ls: $2" ;;
|
|
845
953
|
esac
|
|
@@ -850,7 +958,7 @@ task_ls() {
|
|
|
850
958
|
while IFS= read -r team; do [ -z "$team" ] || teams+=("$team"); done <<< "$keys"
|
|
851
959
|
[ "${#teams[@]}" -gt 0 ] ||
|
|
852
960
|
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"
|
|
853
|
-
list=$(linear_open_cards "$name" "${teams[@]}") || exit 1
|
|
961
|
+
list=$(linear_open_cards "$name" "$detail" "${teams[@]}") || exit 1
|
|
854
962
|
if [ "$json" = 1 ]; then
|
|
855
963
|
printf '%s\n' "$list"
|
|
856
964
|
return
|
|
@@ -870,12 +978,19 @@ cmd_task() {
|
|
|
870
978
|
new) shift; task_new "$@" ;;
|
|
871
979
|
ls | list) shift; task_ls "$@" ;;
|
|
872
980
|
start) shift; task_start "$@" ;;
|
|
981
|
+
ready) shift; task_ready "$@" ;;
|
|
873
982
|
build) shift; task_build "$@" ;;
|
|
874
983
|
finish) shift; task_finish "$@" ;;
|
|
875
984
|
close) shift; task_close "$@" ;;
|
|
876
985
|
merges) shift; task_merges "$@" ;;
|
|
877
986
|
handoff) shift; task_handoff "$@" ;;
|
|
878
987
|
log) shift; task_log "$@" ;;
|
|
879
|
-
|
|
988
|
+
asks) shift; task_asks "$@" ;;
|
|
989
|
+
answer) shift; task_answer "$@" ;;
|
|
990
|
+
# The hook behind a permission prompt, which Claude Code runs (asks.sh).
|
|
991
|
+
# It decides nothing when anything goes wrong, so it never fails.
|
|
992
|
+
hold) shift; task_hold "$@" || true ;;
|
|
993
|
+
brief) shift; task_brief "$@" ;;
|
|
994
|
+
*) die "usage: ocnus task ls <space> [--json], or: ocnus task new <space> <card>, or: ocnus task start <space> <card> $START_ARGS, or: ocnus task ready <space>, or: ocnus task build <space> <card> [--continue <message>], or: ocnus task close <space> <card>, or: ocnus task finish <space> <card>, or: ocnus task merges [--once | --wake], or: ocnus task handoff <space> <card>, or: ocnus task log <space> [<card>] [--json], or: ocnus task asks <space> [--json], or: ocnus task answer <space> <card> <question> <answer>, or: ocnus task brief <space> <card> [--json] [--refresh] (see: ocnus help)" ;;
|
|
880
995
|
esac
|
|
881
996
|
}
|