@mayurdluffy/ccwf 0.6.0 → 0.8.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/README.md +4 -2
- package/lib/index.js +4 -1
- package/lib/installer.js +2 -2
- package/lib/merge.js +7 -2
- package/lib/modules.js +26 -2
- package/lib/stats.js +49 -4
- package/lib/transcripts.js +192 -0
- package/package.json +1 -1
- package/templates/blocks/browser.md +5 -9
- package/templates/blocks/cbm.md +4 -6
- package/templates/blocks/core.md +1 -0
- package/templates/docs/agents/workflow.md +1 -1
- package/templates/skills/agent-browser/SKILL.md +1 -1
- package/templates/skills/orchestrate-workers/ISOLATION.md +24 -0
- package/templates/skills/orchestrate-workers/OPTIONS.md +13 -0
- package/templates/skills/orchestrate-workers/SKILL.md +37 -44
- package/templates/skills/orchestrate-workers/TAB.md +9 -0
- package/templates/skills/orchestrate-workers/context.conf +18 -0
- package/templates/skills/orchestrate-workers/context.js +337 -0
- package/templates/skills/orchestrate-workers/tickets.sh +101 -3
- package/templates/skills/verify-ui/SKILL.md +1 -1
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
# Usage: tickets.sh ready <feature-dir> tickets that can start now, lowest number first, one path a line
|
|
4
4
|
# tickets.sh set <ticket-file> <status> write the status line; in-progress is refused while a blocker is open
|
|
5
5
|
# tickets.sh counts [feature-dir] how many tickets have each status, per feature
|
|
6
|
+
# tickets.sh check <feature-dir> is progress.md in step with the tickets? one problem a line, exit 1 if any
|
|
6
7
|
# feature-dir: .scratch/<feature>
|
|
8
|
+
# set also writes the status into the ticket's row of <feature-dir>/progress.md, so the table cannot lag behind the
|
|
9
|
+
# tickets, and reminds you to rewrite its "## Resume": herdr-workstation's Board shows both live.
|
|
7
10
|
# A ticket is <feature-dir>/issues/<NN>-<slug>.md. Only the part above its first "## " heading is read:
|
|
8
11
|
# **Status:** ready-for-agent
|
|
9
12
|
# **Blocked by:** 01, 03 numbers, "01: Title", a list of those below it, or None
|
|
@@ -54,6 +57,93 @@ blocked() {
|
|
|
54
57
|
return 0
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
# Writes status $2 into the row of ticket file $1 in <feature-dir>/progress.md (its Status column), and says what it did.
|
|
61
|
+
sync_row() {
|
|
62
|
+
local progress=${1:A:h:h}/progress.md num out
|
|
63
|
+
[[ -f $progress ]] || { echo "no progress.md next to the tickets: no table row to update"; return 0; }
|
|
64
|
+
[[ ${1:t} =~ '^0*([0-9]+)' ]] || return 0
|
|
65
|
+
num=$match[1]
|
|
66
|
+
out=$(mktemp "${progress:h}/.tickets.XXXXXX") || { echo "cannot write beside $progress: the row was not updated; edit it by hand"; return 1; }
|
|
67
|
+
if awk -v n="$num" -v s="$2" '
|
|
68
|
+
BEGIN { FS = OFS = "|" }
|
|
69
|
+
{ cr = ""; line = $0
|
|
70
|
+
if (line ~ /\r$/) { cr = "\r"; sub(/\r$/, "", line) }
|
|
71
|
+
$0 = line
|
|
72
|
+
if (line ~ /^[ \t]*\|/) {
|
|
73
|
+
if (!col) {
|
|
74
|
+
hs = 0; ht = 0
|
|
75
|
+
for (i = 2; i < NF; i++) { c = tolower($i); gsub(/^[ \t]+|[ \t]+$/, "", c); if (c ~ /^status/) hs = i; if (c ~ /^ticket/) ht = i }
|
|
76
|
+
if (hs && ht) { col = hs; tk = ht }
|
|
77
|
+
} else {
|
|
78
|
+
c = $tk; gsub(/^[ \t]+/, "", c)
|
|
79
|
+
if (match(c, /^0*[0-9]+/)) { d = substr(c, RSTART, RLENGTH); sub(/^0+/, "", d); if (d == "") d = "0"; if (d == n) { $col = " " s " "; found = 1 } }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
print $0 cr }
|
|
83
|
+
END { exit !found }' "$progress" > "$out"; then
|
|
84
|
+
cat "$out" > "$progress" && echo "progress.md row $num: $2"
|
|
85
|
+
else
|
|
86
|
+
echo "progress.md has no row for ticket $num: add one (| $num title | wave | worker | $2 | |)"
|
|
87
|
+
fi
|
|
88
|
+
rm -f "$out"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Prints what is out of step in <feature-dir>/progress.md compared with the tickets: a row that says another status,
|
|
92
|
+
# a missing row, a done ticket with no commit, a Resume without its four lines, and Resume text the table has moved past
|
|
93
|
+
# (it still says to commit a ticket whose commit is recorded, or to start one that has started).
|
|
94
|
+
check_progress() {
|
|
95
|
+
local dir=$1 f list="" rc
|
|
96
|
+
for f in $dir/issues/[0-9]##-*.md(n); do read_ticket "$f"; list+="${f:t}|${st:-no-status}"$'\n'; done
|
|
97
|
+
awk '
|
|
98
|
+
function norm(x) { x = tolower(x); gsub(/^[ \t]+|[ \t]+$/, "", x); sub(/[ \t(].*$/, "", x); return x }
|
|
99
|
+
function num(x, d) { if (!match(x, /^[ \t]*0*[0-9]+/)) return ""; d = substr(x, RSTART, RLENGTH); gsub(/[ \t]/, "", d); sub(/^0+/, "", d); return d == "" ? "0" : d }
|
|
100
|
+
function says(re) { return text ~ re }
|
|
101
|
+
FNR == NR { split($0, a, "|"); n = num(a[1]); if (n != "") { tstatus[n] = a[2]; tid[n] = substr(a[1], 1, index(a[1], "-") - 1) } next }
|
|
102
|
+
{ cr = $0; sub(/\r$/, "", cr) }
|
|
103
|
+
cr ~ /^##[ \t]+[Rr]esume/ { inres = 1; next }
|
|
104
|
+
cr ~ /^##[ \t]/ { inres = 0 }
|
|
105
|
+
inres {
|
|
106
|
+
low = tolower(cr)
|
|
107
|
+
if (match(low, /^[ \t]*[-*][ \t]+\**(state|next action|waiting on (the )?user|workers)/)) {
|
|
108
|
+
k = substr(low, RSTART, RLENGTH); sub(/^[ \t]*[-*][ \t]+\**/, "", k); sub(/^waiting.*/, "waiting", k); sub(/^next.*/, "next", k)
|
|
109
|
+
have[k] = 1
|
|
110
|
+
if (k != "workers") text = text " . " low
|
|
111
|
+
if (k == "waiting") { w = low; sub(/^[^:]*:[ \t*]*/, "", w); waiting = w }
|
|
112
|
+
}
|
|
113
|
+
next
|
|
114
|
+
}
|
|
115
|
+
cr ~ /^[ \t]*\|/ {
|
|
116
|
+
m = split(cr, c, "|")
|
|
117
|
+
if (!col) {
|
|
118
|
+
for (i = 2; i < m; i++) { h = norm(c[i]); if (h == "status") hs = i; if (h == "ticket") ht = i; if (h == "commit") hc = i }
|
|
119
|
+
if (hs && ht) col = hs
|
|
120
|
+
} else {
|
|
121
|
+
n = num(c[ht]); if (n == "") next
|
|
122
|
+
rstatus[n] = norm(c[hs]); rcommit[n] = c[hc]; gsub(/^[ \t]+|[ \t]+$/, "", rcommit[n])
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
END {
|
|
126
|
+
for (n in tstatus) {
|
|
127
|
+
id = tid[n]; ts = tstatus[n]
|
|
128
|
+
if (!(n in rstatus)) { print id ": no row in progress.md"; continue }
|
|
129
|
+
if (rstatus[n] != ts) print id ": the ticket says " ts ", progress.md says " rstatus[n]
|
|
130
|
+
if (ts == "done" && hc && rcommit[n] == "") print id ": done, but progress.md has no commit for it"
|
|
131
|
+
hash = (ts == "done" && match(rcommit[n], /[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]+/)) ? substr(rcommit[n], RSTART, 7) : ""
|
|
132
|
+
pre = "(^|[^0-9a-z])(tickets? ?)?0*" n "([^0-9a-z]|$)"
|
|
133
|
+
if (hash != "" && (text ~ ("commit(ting)?[ ]+(the )?(tickets? ?)?0*" n "([^0-9a-z]|$)") || text ~ (pre "[^.;:]*(not committed|uncommitted|awaiting commit)")))
|
|
134
|
+
print id ": committed (" hash "), but ## Resume still says to commit it"
|
|
135
|
+
if (ts != "ready-for-agent" && ts != "ready-for-human" && ts !~ /^needs-/ && text ~ ("start(ing)?[ ]+(the )?(tickets? ?)?0*" n "([^0-9a-z]|$)"))
|
|
136
|
+
print id ": " ts ", but ## Resume still says to start it"
|
|
137
|
+
if ((ts == "awaiting-user" || ts == "ready-for-human") && waiting ~ /^(none|nothing)/)
|
|
138
|
+
print id ": " ts ", but ## Resume says nothing waits on the user"
|
|
139
|
+
}
|
|
140
|
+
split("state|next action|waiting on user|workers", want, "|"); key["state"] = "state"; key["next action"] = "next"; key["waiting on user"] = "waiting"; key["workers"] = "workers"
|
|
141
|
+
for (i = 1; i <= 4; i++) if (!have[key[want[i]]]) print "## Resume has no \"" want[i] "\" line"
|
|
142
|
+
}' <(print -rn -- "$list") $dir/progress.md | sort # a pipe, not a temporary file: a read-only check needs to write nothing
|
|
143
|
+
rc=$pipestatus[1] # awk's: a check that could not run must not look like a check that found nothing
|
|
144
|
+
return $rc
|
|
145
|
+
}
|
|
146
|
+
|
|
57
147
|
case $1 in
|
|
58
148
|
ready)
|
|
59
149
|
[[ -d $2/issues ]] || die "no tickets folder: $2/issues"
|
|
@@ -72,7 +162,7 @@ case $1 in
|
|
|
72
162
|
if [[ $3 == in-progress ]]; then
|
|
73
163
|
why=$(blocked "$2") && [[ -z $why ]] || die "$2 cannot start: $why"
|
|
74
164
|
fi
|
|
75
|
-
tmp=$(mktemp) ||
|
|
165
|
+
tmp=$(mktemp "${2:A:h}/.tickets.XXXXXX") || die "cannot write beside $2"
|
|
76
166
|
trap 'rm -f "$tmp"' EXIT
|
|
77
167
|
awk -v s="$3" '
|
|
78
168
|
/^## / { body = 1 }
|
|
@@ -81,7 +171,15 @@ case $1 in
|
|
|
81
171
|
END { exit !n }' "$2" > "$tmp" || die "$2 has no status line above its first ## heading"
|
|
82
172
|
cat "$tmp" > "$2" || exit 1
|
|
83
173
|
runlog status ticket=".scratch/${${2:A}##*/.scratch/}" status="$3" # the same path as in the worker's prompt
|
|
84
|
-
echo "$2: $3"
|
|
174
|
+
echo "$2: $3"
|
|
175
|
+
sync_row "$2" "$3"
|
|
176
|
+
echo "Now rewrite progress.md > ## Resume (State, Next action, Waiting on user, Workers) so it matches; herdr-workstation's Board shows it live." ;;
|
|
177
|
+
check)
|
|
178
|
+
[[ -d $2/issues ]] || die "no tickets folder: $2/issues"
|
|
179
|
+
[[ -f $2/progress.md ]] || die "no progress.md in $2"
|
|
180
|
+
out=$(check_progress "$2") || die "cannot check $2: the check itself failed"
|
|
181
|
+
[[ -z $out ]] && { echo "$2: progress.md is in step with the tickets"; exit 0; }
|
|
182
|
+
print -r -- "$out"; exit 1 ;;
|
|
85
183
|
counts)
|
|
86
184
|
for d in ${2:-.scratch/*(/)}; do
|
|
87
185
|
[[ -d $d/issues ]] || continue
|
|
@@ -90,5 +188,5 @@ case $1 in
|
|
|
90
188
|
parts=(); for k in ${(ok)n}; do parts+=("$n[$k] $k"); done
|
|
91
189
|
echo "$d: ${(j:, :)parts:-no tickets}"
|
|
92
190
|
done ;;
|
|
93
|
-
*) die "usage: tickets.sh ready <feature-dir> | set <ticket-file> <status> | counts [feature-dir]" ;;
|
|
191
|
+
*) die "usage: tickets.sh ready <feature-dir> | set <ticket-file> <status> | counts [feature-dir] | check <feature-dir>" ;;
|
|
94
192
|
esac
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verify-ui
|
|
3
|
-
description: Verify and debug this project's web app in a real browser — a page health report (console, network, errors, vitals, accessibility), ticket scenarios kept as a regression suite
|
|
3
|
+
description: Verify and debug this project's web app in a real browser — a page health report (console, network, errors, vitals, accessibility), ticket scenarios kept as a regression suite, and a debugging playbook. Use it whenever a feature or bug fix can be seen in a browser, in the UI or the API behind it: building, finishing or reviewing a ticket, "verify", "browser check", "smoke test", and any bug seen in the browser. Use it instead of looking at screenshots.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# verify-ui
|