@jeiemgi/cckit 0.2.0 → 0.4.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.
Files changed (75) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +21 -8
  3. package/README.md +119 -20
  4. package/bin/cckit +42 -16
  5. package/cckit.config.json +1 -1
  6. package/commands/kit-doctor.md +3 -1
  7. package/commands/kit-update.md +9 -4
  8. package/kit.config.schema.json +25 -0
  9. package/package.json +1 -1
  10. package/scripts/annotate-setup.sh +7 -2
  11. package/scripts/capture-project-ids.sh +23 -10
  12. package/scripts/init-upgrade-test.sh +35 -1
  13. package/scripts/init.sh +43 -7
  14. package/scripts/kit-doctor.sh +185 -7
  15. package/scripts/kit-version-check-test.sh +36 -0
  16. package/scripts/kit-version-check.sh +19 -4
  17. package/scripts/kit-wire.sh +4 -1
  18. package/scripts/knowledge-lint.sh +4 -1
  19. package/scripts/lib/board-view-test.sh +54 -0
  20. package/scripts/lib/board-view.sh +80 -0
  21. package/scripts/lib/captain-test.sh +18 -0
  22. package/scripts/lib/captain.sh +92 -5
  23. package/scripts/lib/config-path-test.sh +47 -0
  24. package/scripts/lib/config-path.sh +29 -0
  25. package/scripts/lib/copilot.sh +9 -9
  26. package/scripts/lib/effort-dispatch-test.sh +25 -0
  27. package/scripts/lib/effort-flows-test.sh +55 -0
  28. package/scripts/lib/effort-metrics-test.sh +57 -0
  29. package/scripts/lib/effort-metrics.sh +19 -5
  30. package/scripts/lib/effort-ops-test.sh +110 -3
  31. package/scripts/lib/effort-ops.sh +480 -50
  32. package/scripts/lib/effort-parity-test.sh +128 -0
  33. package/scripts/lib/effort-slug-test.sh +87 -0
  34. package/scripts/lib/effort-slug.sh +104 -0
  35. package/scripts/lib/effort.sh +91 -1
  36. package/scripts/lib/gh-project-test.sh +95 -0
  37. package/scripts/lib/gh-project.sh +22 -7
  38. package/scripts/lib/git-remote-test.sh +57 -0
  39. package/scripts/lib/git-remote.sh +21 -0
  40. package/scripts/lib/kit-config-test.sh +37 -0
  41. package/scripts/lib/kit-config.sh +38 -13
  42. package/scripts/lib/kit-engine-test.sh +9 -0
  43. package/scripts/lib/kit-events.sh +5 -3
  44. package/scripts/lib/kit-gc-test.sh +88 -0
  45. package/scripts/lib/kit-gc.sh +136 -19
  46. package/scripts/lib/kit-local.sh +8 -1
  47. package/scripts/lib/kit-operate.sh +17 -2
  48. package/scripts/lib/next.sh +3 -3
  49. package/scripts/lib/plan-next-test.sh +87 -0
  50. package/scripts/lib/plan-next.sh +212 -0
  51. package/scripts/lib/project-scan.sh +7 -1
  52. package/scripts/lib/worktree-start.sh +12 -3
  53. package/scripts/lib/zsh-safety-test.sh +73 -0
  54. package/scripts/portable-test.sh +62 -20
  55. package/scripts/setup-labels.sh +13 -2
  56. package/scripts/showcase.sh +13 -4
  57. package/scripts/status-test.sh +63 -0
  58. package/scripts/status.sh +12 -4
  59. package/scripts/task-sync.sh +79 -10
  60. package/skills/kit-autopilot/SKILL.md +5 -0
  61. package/skills/{docs-writer → kit-docs-writer}/SKILL.md +2 -2
  62. package/skills/kit-effort-close/SKILL.md +52 -104
  63. package/skills/kit-effort-new/SKILL.md +40 -112
  64. package/skills/kit-effort-pr/SKILL.md +6 -2
  65. package/skills/kit-effort-start/SKILL.md +44 -46
  66. package/skills/kit-next/SKILL.md +4 -0
  67. package/skills/kit-plan-next/SKILL.md +82 -0
  68. package/skills/kit-task-start/SKILL.md +44 -55
  69. package/templates/CLAUDE.md.tmpl +1 -1
  70. package/templates/agents/auto-dev.md +1 -1
  71. package/templates/hooks/mempal_session_start.sh.tmpl +36 -2
  72. package/templates/rules/effort-model.md +43 -6
  73. package/templates/rules/mempalace.md +1 -0
  74. package/templates/rules/plan-next.md +58 -0
  75. package/templates/rules/task-management.md +1 -1
@@ -0,0 +1,87 @@
1
+ #!/bin/sh
2
+ # plan-next-test.sh — self-test for plan-next.sh (Effort 86 · #91).
3
+ # Network-free, filesystem-only: builds a throwaway fixture project and asserts the inventory
4
+ # scanners, the proposal shape (TOON + JSON + human), empty states, the structured error, and the
5
+ # invariant that EVERY plan carries the mandatory docs + README step. The pure scanners + proposals
6
+ # run under bash AND zsh; the full plan_next verb (which sources render/toon via BASH_SOURCE) runs
7
+ # under bash, matching how the dispatcher invokes it. Run: bash scripts/lib/plan-next-test.sh
8
+
9
+ dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
10
+
11
+ # _pn_fixture <root> — a small capability tree. docs mention alpha-skill + the 'foo' verb but NOT
12
+ # beta-skill or 'bar', so those two become the coverage-gap proposals.
13
+ _pn_fixture() {
14
+ local r="$1"
15
+ mkdir -p "$r/skills/alpha-skill" "$r/skills/beta-skill" "$r/rules" "$r/docs" "$r/commands"
16
+ : > "$r/skills/alpha-skill/SKILL.md"; : > "$r/skills/beta-skill/SKILL.md"
17
+ : > "$r/rules/r1.md"; : > "$r/rules/r2.md"
18
+ : > "$r/commands/foo.md"; : > "$r/commands/bar.md"
19
+ printf 'see the alpha-skill skill and the foo verb.\n' > "$r/docs/intro.md"
20
+ }
21
+
22
+ if [ -n "${PN_TEST_INNER:-}" ]; then
23
+ . "$dir/plan-next.sh"
24
+ fail=0
25
+ eq() { if [ "$2" != "$3" ]; then echo "FAIL($PN_TEST_INNER): $1 -> '[$2]', want '[$3]'"; fail=1; fi; }
26
+ has() { case "$2" in *"$3"*) ;; *) echo "FAIL($PN_TEST_INNER): $1 missing '[$3]'"; fail=1 ;; esac; }
27
+ no() { case "$2" in *"$3"*) echo "FAIL($PN_TEST_INNER): $1 should NOT contain '[$3]'"; fail=1 ;; esac; }
28
+
29
+ fix="$(mktemp -d)"; _pn_fixture "$fix"
30
+ empty="$(mktemp -d)"
31
+
32
+ # --- pure scanners (bash + zsh) ---
33
+ eq "skills scanner" "$(plan_next_skills "$fix" | tr '\n' ',')" "alpha-skill,beta-skill,"
34
+ eq "verbs scanner (commands fallback)" "$(plan_next_verbs "$fix" | tr '\n' ',')" "bar,foo,"
35
+ eq "rules scanner" "$(plan_next_rules "$fix" | tr '\n' ',')" "r1,r2,"
36
+ eq "docs scanner" "$(plan_next_docs "$fix" | tr '\n' ',')" "intro,"
37
+ eq "empty skills -> nothing" "$(plan_next_skills "$empty")" ""
38
+
39
+ # --- proposals shape (bash + zsh) ---
40
+ props="$(_pn_proposals "$fix")"
41
+ first="$(printf '%s\n' "$props" | head -1)"
42
+ has "rank 1 is docs" "$first" "1 docs"
43
+ has "mandatory docs+README" "$first" "README"
44
+ has "undocumented skill gap" "$props" "beta-skill"
45
+ has "undocumented verb gap" "$props" "bar"
46
+ no "documented skill not flagged as gap" "$props" "Document the alpha-skill"
47
+ # EVERY plan carries the docs + README step — also on a bare project.
48
+ has "empty plan still has docs+README" "$(_pn_proposals "$empty")" "README"
49
+
50
+ # --- full verb (bash only — sources render/toon via BASH_SOURCE) ---
51
+ if [ "$PN_TEST_INNER" = "bash" ]; then
52
+ hum="$(PLAN_NEXT_ROOT="$fix" CCKIT_NO_GLOW=1 CCKIT_OUTPUT=human plan_next)"
53
+ has "human shows capabilities" "$hum" "Current capabilities"
54
+ has "human shows docs+README" "$hum" "README"
55
+ has "human states context rule" "$hum" "context-anxiety"
56
+
57
+ # empty/host project: graceful, exits 0, still carries the docs step.
58
+ eout="$(PLAN_NEXT_ROOT="$empty" CCKIT_NO_GLOW=1 CCKIT_OUTPUT=human plan_next)"; erc=$?
59
+ eq "empty exits 0" "$erc" "0"
60
+ has "empty has graceful banner" "$eout" "No kit capabilities found"
61
+ has "empty still has docs+README" "$eout" "README"
62
+
63
+ if command -v jq >/dev/null 2>&1; then
64
+ llm="$(PLAN_NEXT_ROOT="$fix" CCKIT_OUTPUT=json plan_next --llm)"
65
+ has "TOON header" "$llm" "{rank,area,proposal,next}"
66
+ has "TOON has docs row" "$llm" "README"
67
+ has "TOON has next col" "$llm" "/kit-effort-new"
68
+ # structured error on a bad arg.
69
+ err="$(PLAN_NEXT_ROOT="$fix" CCKIT_OUTPUT=json plan_next --llm --bogus)"; brc=$?
70
+ eq "bad arg rc=2" "$brc" "2"
71
+ has "structured error" "$err" '"error"'
72
+ else
73
+ echo " (jq absent — skipping TOON/JSON assertions)"
74
+ fi
75
+ fi
76
+
77
+ rm -rf "$fix" "$empty"
78
+ if [ "$fail" -eq 0 ]; then echo "PASS($PN_TEST_INNER): plan-next inventory + plan shapes"; fi
79
+ exit "$fail"
80
+ fi
81
+
82
+ rc=0
83
+ for sh in bash zsh; do
84
+ command -v "$sh" >/dev/null 2>&1 || continue
85
+ PN_TEST_INNER="$sh" "$sh" "$0" || rc=1
86
+ done
87
+ exit "$rc"
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env bash
2
+ # plan-next.sh — the forward planner (Effort 86 · #87/#88). cckit's "given where we are, here is what
3
+ # to build next" triage, productized. It introspects the CURRENT capability surface — skills,
4
+ # commands/verbs, rules, docs — at runtime and proposes concrete next efforts grounded in what the
5
+ # kit can already do. Run against cckit itself (full inventory) or any project the kit is installed
6
+ # in (degrades to whatever capability dirs exist, never crashes).
7
+ #
8
+ # cckit plan-next current capabilities + a proposed forward plan (markdown)
9
+ # cckit plan-next --llm the proposed plan as TOON rows {rank,area,proposal,next} (JSON fallback)
10
+ # cckit plan-next --root <dir> scan <dir> instead of the resolved project/kit root
11
+ #
12
+ # CRITICAL — context-anxiety rule: this output is HUMAN / orchestrator-facing ONLY. It is NEVER to
13
+ # be injected into a monitored model's prompt or context. The planner pre-grounds planning in the
14
+ # current docs/skills/rules so the EXECUTING agent burns fewer tokens rediscovering context — it is
15
+ # not itself agent-context fuel. The verb and the skill both honor this; see rules/plan-next.md.
16
+ #
17
+ # Filesystem-only — needs jq only for --llm (TOON/JSON). bash 3.2 / zsh compatible.
18
+
19
+ # _pn_first_dir <dir> [dir …] — echo the first directory that exists (graceful host-project fallback).
20
+ _pn_first_dir() {
21
+ local d
22
+ for d in "$@"; do [ -n "$d" ] && [ -d "$d" ] && { printf '%s' "$d"; return 0; }; done
23
+ return 1
24
+ }
25
+
26
+ # plan_next_skills_dir / _rules_dir / _docs_dir <root> — resolve the capability dir for one area,
27
+ # trying cckit's own layout first, then the installed-in-a-project layout. Empty when none exist.
28
+ plan_next_skills_dir() { _pn_first_dir "$1/skills" "$1/.claude/skills" 2>/dev/null; }
29
+ plan_next_rules_dir() { _pn_first_dir "$1/rules" "$1/templates/rules" "$1/.claude/rules" 2>/dev/null; }
30
+ plan_next_docs_dir() { _pn_first_dir "$1/docs-site/src/content/docs" "$1/docs" "$1/.claude/docs" 2>/dev/null; }
31
+
32
+ # All scanners use `find` (not shell globs): an unmatched glob errors under zsh's nomatch and stays
33
+ # literal under bash — `find` handles "no matches" cleanly in both, so the lib is shell-portable.
34
+
35
+ # plan_next_skills <root> — one skill name per line (the SKILL.md parent dir basename), sorted.
36
+ plan_next_skills() {
37
+ local dir; dir="$(plan_next_skills_dir "$1")" || return 0
38
+ find "$dir" -mindepth 2 -maxdepth 2 -name SKILL.md -type f 2>/dev/null \
39
+ | while IFS= read -r f; do basename "$(dirname "$f")"; done | sort -u
40
+ }
41
+
42
+ # plan_next_rules <root> — one rule name per line (the .md basename without extension), sorted.
43
+ plan_next_rules() {
44
+ local dir; dir="$(plan_next_rules_dir "$1")" || return 0
45
+ find "$dir" -maxdepth 1 -name '*.md' -type f 2>/dev/null \
46
+ | while IFS= read -r f; do b="$(basename "$f")"; printf '%s\n' "${b%.md}"; done | sort -u
47
+ }
48
+
49
+ # plan_next_verbs <root> — one verb per line. Prefer the cckit dispatcher's own case labels (the
50
+ # single source of truth, same parse as `cckit commands`); fall back to a commands/ listing when run
51
+ # in a host project that has no bin/cckit.
52
+ plan_next_verbs() {
53
+ local root="$1"
54
+ if [ -f "$root/bin/cckit" ]; then
55
+ grep -oE '^ [a-z][a-z|-]*\)' "$root/bin/cckit" \
56
+ | sed 's/[) ]//g' | tr '|' '\n' | grep -vE '^(-|$)' | sort -u
57
+ return 0
58
+ fi
59
+ local dir; dir="$(_pn_first_dir "$root/commands" "$root/.claude/commands" 2>/dev/null)" || return 0
60
+ find "$dir" -maxdepth 1 -name '*.md' -type f 2>/dev/null \
61
+ | while IFS= read -r f; do b="$(basename "$f")"; printf '%s\n' "${b%.md}"; done | sort -u
62
+ }
63
+
64
+ # plan_next_docs <root> — one doc name per line (the .md/.mdx basename without extension), sorted.
65
+ plan_next_docs() {
66
+ local dir; dir="$(plan_next_docs_dir "$1")" || return 0
67
+ find "$dir" -maxdepth 1 \( -name '*.md' -o -name '*.mdx' \) -type f 2>/dev/null \
68
+ | while IFS= read -r f; do b="$(basename "$f")"; b="${b%.mdx}"; printf '%s\n' "${b%.md}"; done | sort -u
69
+ }
70
+
71
+ # _pn_docs_blob <root> — all doc text concatenated + lowercased, for coverage-gap detection.
72
+ _pn_docs_blob() {
73
+ local dir; dir="$(plan_next_docs_dir "$1")" || return 0
74
+ find "$dir" -maxdepth 1 \( -name '*.md' -o -name '*.mdx' \) -type f -exec cat {} + 2>/dev/null \
75
+ | tr '[:upper:]' '[:lower:]'
76
+ }
77
+
78
+ # _pn_root — the directory to scan. PLAN_NEXT_ROOT wins (tests / explicit), else the project root
79
+ # inferred from KIT_CONFIG (parent of a .claude/ config), else $PWD. In cckit this is the cckit repo;
80
+ # in a host project it is that project — so the inventory is always "this project's capabilities".
81
+ _pn_root() {
82
+ if [ -n "${PLAN_NEXT_ROOT:-}" ]; then printf '%s' "$PLAN_NEXT_ROOT"; return 0; fi
83
+ local cfg="${KIT_CONFIG:-}" d
84
+ if [ -n "$cfg" ] && [ -f "$cfg" ]; then
85
+ d="$(cd "$(dirname "$cfg")" 2>/dev/null && pwd)" || d=""
86
+ case "$d" in */.claude) d="$(dirname "$d")" ;; esac
87
+ [ -n "$d" ] && { printf '%s' "$d"; return 0; }
88
+ fi
89
+ printf '%s' "$PWD"
90
+ }
91
+
92
+ # _pn_proposals <root> — the forward plan as TSV rows: rank<TAB>area<TAB>proposal<TAB>next.
93
+ # Deterministic + grounded in the inventory. ALWAYS emits the mandatory docs + README item first
94
+ # (docs-always rule — never dropped, even for a tiny change). Then up to 3 concrete coverage gaps
95
+ # (skills/verbs not referenced anywhere in the docs), then a thinnest-area suggestion so there is
96
+ # always >=1 concrete next effort beyond docs. Capped so the plan stays scannable.
97
+ _pn_proposals() {
98
+ local root="$1" rank=1
99
+ local handoff="/kit-effort-new"
100
+
101
+ # 1. MANDATORY — docs + README. Non-negotiable, always present (asserted by tests).
102
+ printf '%s\tdocs\t%s\t%s\n' "$rank" \
103
+ "Update the docs site + README + AGENTS for the latest work (mandatory, never skipped)" "$handoff"
104
+ rank=$((rank + 1))
105
+
106
+ # 2. Coverage gaps — capabilities not yet mentioned anywhere in the docs (grounded in current state).
107
+ local blob s v added=0
108
+ blob="$(_pn_docs_blob "$root")"
109
+ for s in $(plan_next_skills "$root"); do
110
+ [ "$added" -ge 3 ] && break
111
+ case "$blob" in *"$s"*) ;; *)
112
+ printf '%s\tskills\t%s\t%s\n' "$rank" "Document the $s skill — it is not referenced in any doc page" "$handoff"
113
+ rank=$((rank + 1)); added=$((added + 1)) ;;
114
+ esac
115
+ done
116
+ for v in $(plan_next_verbs "$root"); do
117
+ [ "$added" -ge 3 ] && break
118
+ case "$blob" in *"$v"*) ;; *)
119
+ printf '%s\tcommands\t%s\t%s\n' "$rank" "Add the '$v' verb to the CLI reference — it ships but is undocumented" "$handoff"
120
+ rank=$((rank + 1)); added=$((added + 1)) ;;
121
+ esac
122
+ done
123
+
124
+ # 3. Thinnest-area suggestion — guarantees a concrete non-docs proposal even when coverage is clean.
125
+ local cs cv cr thin tn
126
+ cs="$(plan_next_skills "$root" | grep -c .)"
127
+ cv="$(plan_next_verbs "$root" | grep -c .)"
128
+ cr="$(plan_next_rules "$root" | grep -c .)"
129
+ thin="skills"; tn="$cs"
130
+ [ "$cv" -lt "$tn" ] && { thin="commands"; tn="$cv"; }
131
+ [ "$cr" -lt "$tn" ] && { thin="rules"; tn="$cr"; }
132
+ printf '%s\t%s\t%s\t%s\n' "$rank" "$thin" \
133
+ "Deepen the thinnest area '$thin' ($tn entries) — propose one new capability there" "$handoff"
134
+ }
135
+
136
+ # plan_next — the verb body. Human markdown by default; TOON/JSON under --llm. Never injects into
137
+ # any agent context (context-anxiety rule).
138
+ plan_next() {
139
+ local out="${CCKIT_OUTPUT:-human}" root=""
140
+ while [ "$#" -gt 0 ]; do
141
+ case "$1" in
142
+ --llm|--output=json) out="json"; shift ;;
143
+ --root) root="$2"; shift 2 ;;
144
+ --root=*) root="${1#*=}"; shift ;;
145
+ -h|--help) sed -n '8,11p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; return 0 ;;
146
+ *) if [ "$out" = "json" ]; then _pn_err "unknown arg '$1'"; else echo "plan-next: unknown arg '$1'" >&2; fi; return 2 ;;
147
+ esac
148
+ done
149
+ [ -n "$root" ] && PLAN_NEXT_ROOT="$root"
150
+ root="$(_pn_root)"
151
+
152
+ # --llm needs jq for valid TOON/JSON — emit a structured error rather than malformed output.
153
+ if [ "$out" = "json" ] && ! command -v jq >/dev/null 2>&1; then
154
+ printf '{"error":"plan-next: jq is required for --llm output"}\n'; return 1
155
+ fi
156
+
157
+ local skills verbs rules docs cs cv cr cd total
158
+ skills="$(plan_next_skills "$root")"; cs="$(printf '%s' "$skills" | grep -c .)"
159
+ verbs="$(plan_next_verbs "$root")"; cv="$(printf '%s' "$verbs" | grep -c .)"
160
+ rules="$(plan_next_rules "$root")"; cr="$(printf '%s' "$rules" | grep -c .)"
161
+ docs="$(plan_next_docs "$root")"; cd="$(printf '%s' "$docs" | grep -c .)"
162
+ total=$((cs + cv + cr + cd))
163
+
164
+ local proposals; proposals="$(_pn_proposals "$root")"
165
+
166
+ if [ "$out" = "json" ]; then
167
+ # TOON rows {rank,area,proposal,next}. Always >=1 row (the mandatory docs item), so the plan is
168
+ # never empty; the explicit empty state is the capability inventory being bare (total==0), which
169
+ # the human view surfaces and the rule documents. The 'next' field carries the next-step handoff.
170
+ local here json; here="$(dirname "${BASH_SOURCE[0]}")"
171
+ json="$(printf '%s\n' "$proposals" \
172
+ | jq -R -s '[ split("\n")[] | select(length>0) | split("\t")
173
+ | {rank:(.[0]|tonumber), area:.[1], proposal:.[2], next:.[3]} ]')"
174
+ # shellcheck source=/dev/null
175
+ . "$here/toon.sh"
176
+ printf '%s' "$json" | toon_encode
177
+ return 0
178
+ fi
179
+
180
+ # human: current capabilities + the proposed plan, through the rendering seam (#82). Leads with
181
+ # human-meaningful names; no `--llm` decoration in the prose (house presentation rule).
182
+ local here; here="$(dirname "${BASH_SOURCE[0]}")"
183
+ # shellcheck source=/dev/null
184
+ . "$here/render.sh" 2>/dev/null || true
185
+ local name; name="$(basename "$root")"
186
+ _pn_human() {
187
+ printf '# Plan next — %s\n\n' "$name"
188
+ if [ "$total" -eq 0 ]; then
189
+ printf '> No kit capabilities found here — this looks like a host project with no skills, verbs,\n'
190
+ printf '> rules, or docs yet. The plan below still carries the mandatory docs + README step; run\n'
191
+ printf '> from the cckit repo (or scaffold with `cckit init`) for a full forward plan.\n\n'
192
+ fi
193
+ printf '## Current capabilities\n\n'
194
+ printf '| area | count | sample |\n| --- | --- | --- |\n'
195
+ printf '| skills | %s | %s |\n' "$cs" "$(printf '%s' "$skills" | head -3 | tr '\n' ' ' | sed 's/ $//')"
196
+ printf '| commands | %s | %s |\n' "$cv" "$(printf '%s' "$verbs" | head -3 | tr '\n' ' ' | sed 's/ $//')"
197
+ printf '| rules | %s | %s |\n' "$cr" "$(printf '%s' "$rules" | head -3 | tr '\n' ' ' | sed 's/ $//')"
198
+ printf '| docs | %s | %s |\n' "$cd" "$(printf '%s' "$docs" | head -3 | tr '\n' ' ' | sed 's/ $//')"
199
+ printf '\n## Proposed next — grounded in the above\n\n'
200
+ printf '| rank | area | proposal |\n| --- | --- | --- |\n'
201
+ printf '%s\n' "$proposals" | awk -F'\t' 'NF>=3 { printf "| %s | %s | %s |\n", $1, $2, $3 }'
202
+ printf '\n## Next step\n\n'
203
+ printf 'Pick an item and scope it into an effort with `/kit-plan-next` (conversational), or directly:\n\n'
204
+ printf '```\n/kit-effort-new\n```\n\n'
205
+ printf '> This plan is human / orchestrator-facing only — never paste it into a monitored agent'\''s\n'
206
+ printf '> context (context-anxiety rule). See rules/plan-next.md.\n'
207
+ }
208
+ if command -v cckit_render >/dev/null 2>&1; then _pn_human | cckit_render; else _pn_human; fi
209
+ }
210
+
211
+ # _pn_err — structured error for --llm mode (mirrors the other verbs' failure shape).
212
+ _pn_err() { printf '{"error":"plan-next: %s"}\n' "$1"; }
@@ -3,12 +3,18 @@
3
3
  # filesystem only (no baked-in project knowledge). Usage: source it && project_scan [dir]
4
4
  project_scan() {
5
5
  local dir="${1:-$PWD}" root stack=() kit="none"
6
+ # ONE shared config discovery (config-path.sh, #69), sourced from this file's own dir when needed.
7
+ if ! command -v kit_config_find >/dev/null 2>&1; then
8
+ local _psd; _psd="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
9
+ # shellcheck source=/dev/null
10
+ [ -f "$_psd/config-path.sh" ] && . "$_psd/config-path.sh"
11
+ fi
6
12
  root="$(git -C "$dir" rev-parse --show-toplevel 2>/dev/null || printf '%s' "$dir")"
7
13
  [ -f "$root/package.json" ] && stack+=("node")
8
14
  [ -f "$root/pyproject.toml" ] && stack+=("python")
9
15
  [ -f "$root/go.mod" ] && stack+=("go")
10
16
  [ -f "$root/Cargo.toml" ] && stack+=("rust")
11
- if [ -f "$root/cckit.config.json" ] || [ -f "$root/.claude/kit.config.json" ]; then kit="configured"
17
+ if kit_config_find "$root" >/dev/null 2>&1; then kit="configured"
12
18
  elif [ -d "$root/.cckit" ]; then kit="partial"
13
19
  elif [ -d "$root/.claude" ]; then kit="claude-only"; fi
14
20
  printf '{"root":"%s","stack":[%s],"kit":"%s"}\n' \
@@ -30,7 +30,9 @@ _wt_set_port() {
30
30
  # worktrees. Config-driven (no hardcoded app paths) so the kit stays portable: a project with no
31
31
  # `.worktree.devPorts` (or no kit.config.json) is a silent no-op. bash 3.2.
32
32
  wt_assign_ports() {
33
- local wt="$1" num="$2" root="$3" cfg ports n offset i path base
33
+ # `apppath`, not `path`: under zsh `path` is tied to PATH (special array); a bare `path` local
34
+ # would clobber the command search path on assignment. A namespaced name is inert.
35
+ local wt="$1" num="$2" root="$3" cfg ports n offset i apppath base
34
36
  cfg="$root/.claude/kit.config.json"
35
37
  # jq is a stated requirement of this file (see header) — don't pre-check `command -v jq` here: the
36
38
  # `command -v … || return` idiom mis-fires under zsh, and the jq read below already no-ops on a
@@ -41,9 +43,9 @@ wt_assign_ports() {
41
43
  n="$(jq 'length' <<<"$ports" 2>/dev/null)"; [[ "$n" =~ ^[0-9]+$ && "$n" -gt 0 ]] || return 0
42
44
  offset=$(( num % 40 )); i=0
43
45
  while [[ "$i" -lt "$n" ]]; do
44
- path="$(jq -r ".[$i].path // empty" <<<"$ports")"
46
+ apppath="$(jq -r ".[$i].path // empty" <<<"$ports")"
45
47
  base="$(jq -r ".[$i].base // empty" <<<"$ports")"
46
- [[ -n "$path" && "$base" =~ ^[0-9]+$ ]] && _wt_set_port "$wt/$path" $(( base + offset * n )) "$num"
48
+ [[ -n "$apppath" && "$base" =~ ^[0-9]+$ ]] && _wt_set_port "$wt/$apppath" $(( base + offset * n )) "$num"
47
49
  i=$(( i + 1 ))
48
50
  done
49
51
  }
@@ -264,6 +266,13 @@ wt_start() {
264
266
  # lookup on the org board, not a full-board scan. Best-effort — a board hiccup never fails the start.
265
267
  if source "$root/scripts/lib/gh-project.sh" 2>/dev/null; then
266
268
  [[ -n "${STATUS_FIELD_ID:-}" ]] || load_project_ids >/dev/null 2>&1 || true
269
+ # Claim precheck (#124): if the issue is ALREADY In Progress on the board, another session may
270
+ # already own it — warn (never block; the start still proceeds) so two agents don't collide.
271
+ if command -v project_issue_status >/dev/null 2>&1; then
272
+ local _prev_status; _prev_status="$(project_issue_status "$num" 2>/dev/null || true)"
273
+ [[ "$_prev_status" == "In Progress" ]] \
274
+ && echo "[#$num] ⚠ already In Progress on the board — another session may own this issue; continuing." >&2
275
+ fi
267
276
  item="$(project_find_item_by_issue "$num" 2>/dev/null)"
268
277
  if [[ -z "$item" ]]; then
269
278
  local content_id
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # zsh-safety-test.sh — the zsh reserved-name acceptance harness (#116). Every lib that a project may
4
+ # source from an INTERACTIVE zsh (the kit's shells alias `g=git`, and zsh ties `path` to $PATH as a
5
+ # special array) must source AND run clean there — no "defining function based on alias" parse error
6
+ # from a bare `g()`, and no clobbered command-search PATH from a bare `path` local.
7
+ #
8
+ # The bar per fixed lib: under `zsh -ic` with `alias g=git` set, sourcing the lib returns 0, invoking
9
+ # its representative function returns 0, and `git` is still resolvable afterward (PATH intact). Also a
10
+ # static regression guard: no bare `local … path …` or `g()` definition creeps back into these files.
11
+ #
12
+ # Skips (rc 0) when zsh is absent, so the gate stays dependency-light (CI installs zsh, so it runs
13
+ # there). bash 3.2 compatible. Run: bash scripts/lib/zsh-safety-test.sh
14
+ set -u
15
+ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
16
+ LIB="$ROOT/scripts/lib"
17
+ fail=0
18
+ ok() { echo "ok: $1"; }
19
+ bad() { echo "FAIL: $1"; fail=1; }
20
+
21
+ if ! command -v zsh >/dev/null 2>&1; then
22
+ echo "zsh-safety-test: zsh absent — skipping (dependency-light gate)"
23
+ exit 0
24
+ fi
25
+
26
+ cd "$ROOT" || exit 1
27
+
28
+ # run_zsh <label> <snippet> — the snippet runs under `zsh -ic` with `alias g=git` already set. Passes
29
+ # only when it exits 0 AND git is still on PATH afterward (proves no `path` clobber leaked out).
30
+ run_zsh() {
31
+ local label="$1" snippet="$2" out rc
32
+ out="$(zsh -ic "alias g=git; { $snippet ; } ; ec=\$? ; command -v git >/dev/null 2>&1 || ec=99 ; exit \$ec" 2>&1)"
33
+ rc=$?
34
+ case "$rc" in
35
+ 0) ok "$label (zsh source+run clean, PATH intact)" ;;
36
+ 99) bad "$label — PATH clobbered under zsh (a reserved-name local leaked): $(printf '%s' "$out" | tail -1)" ;;
37
+ *) bad "$label — rc=$rc under zsh: $(printf '%s' "$out" | tail -1)" ;;
38
+ esac
39
+ }
40
+
41
+ # kit-config.sh — the `g()` alias collision (source-time parse error) + `_kit_cfg_get` run.
42
+ run_zsh "kit-config.sh :: load_kit_config" \
43
+ "cd '$ROOT'; source scripts/lib/kit-config.sh; load_kit_config >/dev/null 2>&1"
44
+
45
+ # kit-gc.sh — the `path` local in kit_gc_analyze's while-read (read-only, safe to run).
46
+ run_zsh "kit-gc.sh :: kit_gc_analyze" \
47
+ "cd '$ROOT'; export KIT_GC_REPO=jeiemgi/cckit; source scripts/lib/kit-config.sh; load_kit_config >/dev/null 2>&1; source scripts/lib/kit-gc.sh; kit_gc_analyze >/dev/null 2>&1"
48
+
49
+ # worktree-start.sh — the `path` local in wt_assign_ports (no-op without .worktree.devPorts).
50
+ run_zsh "worktree-start.sh :: wt_assign_ports" \
51
+ "cd '$ROOT'; source scripts/lib/worktree-start.sh; wt_assign_ports '$ROOT' 1 '$ROOT' >/dev/null 2>&1"
52
+
53
+ # kit-events.sh — the `path` local in emit_event.
54
+ run_zsh "kit-events.sh :: emit_event" \
55
+ "cd '$ROOT'; source scripts/lib/kit-events.sh; emit_event test op '{}' >/dev/null 2>&1"
56
+
57
+ # ── static regression guard: no bare reserved-name local reintroduced ──────────────────────────
58
+ # Match a `local` declaration listing a bare `path` word, or a bare `g()` function definition. The
59
+ # fixed files use namespaced names (wtpath / apppath / logpath / _kit_cfg_get); a plain word here
60
+ # would be the regression. Comments are stripped first so the explanatory notes don't trip it.
61
+ for f in kit-config.sh kit-gc.sh worktree-start.sh kit-events.sh; do
62
+ code="$(sed 's/#.*$//' "$LIB/$f")"
63
+ if printf '%s\n' "$code" | grep -qE '\blocal\b[^=]*\bpath\b'; then
64
+ bad "$f still declares a bare \`local … path …\`"
65
+ elif printf '%s\n' "$code" | grep -qE '(^|[^_[:alnum:]])g\(\)'; then
66
+ bad "$f still defines a bare \`g()\`"
67
+ else
68
+ ok "$f — no bare reserved-name local (static guard)"
69
+ fi
70
+ done
71
+
72
+ [ "$fail" -eq 0 ] && echo "ALL OK (zsh-safety)" || echo "zsh-safety: FAILURES"
73
+ exit "$fail"
@@ -1,52 +1,94 @@
1
1
  #!/usr/bin/env bash
2
- # portable-test.sh — cckit must operate on the project it is INVOKED in, not its install dir (#41).
3
- # Regression test for the bug where `cckit sync` in another repo read cckit's own config and so
4
- # reported an empty board `[]`. Hermetic: stubs `gh` (no network/auth). Run: bash scripts/portable-test.sh
2
+ # portable-test.sh — the foreign-repo acceptance harness (#41 / #74). cckit must operate on the
3
+ # project it is INVOKED in, never its own install dir. The core invariant: run from a FOREIGN repo,
4
+ # no verb may ever resolve cckit's OWN repo (that was the bug where `cckit sync` elsewhere read
5
+ # cckit's config and reported an empty board). This harness enforces that BY CONSTRUCTION: it
6
+ # iterates `cckit commands`, exercises every read-only verb against a foreign fixture with a stubbed
7
+ # gh, and fails if any new verb is left unclassified — so coverage can't silently rot.
8
+ # Hermetic: stubs `gh` (no network/auth). Run: bash scripts/portable-test.sh
5
9
  set -u
6
10
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7
11
  CCKIT="$ROOT/bin/cckit"
8
12
  fail=0
9
- t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
13
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
14
+ no() { case "$2" in *"$3"*) echo "FAIL: $1 -> LEAKED '$3'"; fail=1 ;; *) echo "ok: $1" ;; esac; }
15
+ yes() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> missing '$3' in [$2]"; fail=1 ;; esac; }
10
16
 
11
17
  command -v jq >/dev/null 2>&1 || { echo "portable-test: jq required" >&2; exit 1; }
12
18
 
13
- # Stub gh on PATH: record the --repo it is asked for (to stderr), return an empty JSON array.
19
+ OWN_REPO="$(jq -r '.github.repo' "$ROOT/cckit.config.json")" # cckit's own repo — must NEVER leak
20
+ FIX_REPO="octo/fixture-repo"
21
+
22
+ # Stub gh: log EVERY --repo it is asked about to $GH_REPO_LOG (a file, so it survives a verb that
23
+ # redirects gh's stderr), and return empty results. Also echoes REPO= to stderr for the legacy checks.
14
24
  stub="$(mktemp -d)"
15
25
  cat > "$stub/gh" <<'SH'
16
26
  #!/usr/bin/env bash
17
27
  prev=""
18
28
  for a in "$@"; do
19
- [ "$prev" = "--repo" ] && printf 'REPO=%s\n' "$a" >&2
29
+ if [ "$prev" = "--repo" ]; then
30
+ [ -n "${GH_REPO_LOG:-}" ] && printf '%s\n' "$a" >> "$GH_REPO_LOG"
31
+ printf 'REPO=%s\n' "$a" >&2
32
+ fi
20
33
  prev="$a"
21
34
  done
22
- echo "[]"
35
+ # GraphQL calls read stdin/args; a bare object keeps jq consumers happy. List calls want an array.
36
+ case "$*" in *graphql*) echo '{"data":{}}' ;; *) echo "[]" ;; esac
23
37
  SH
24
38
  chmod +x "$stub/gh"
25
39
 
26
- # A foreign project with its own config pointing at a DISTINCT repo.
40
+ # A foreign project whose config points at a DISTINCT repo, a non-default base branch, and an
41
+ # org-owned board — so we verify repo + base branch + owner type all resolve to the INVOKING project.
27
42
  fix="$(mktemp -d)"
28
- cat > "$fix/cckit.config.json" <<'JSON'
29
- { "kitVersion": "9.9.9", "project": {"name":"fixture"}, "github": {"repo":"octo/fixture-repo","owner":"octo","baseBranch":"main"} }
43
+ cat > "$fix/cckit.config.json" <<JSON
44
+ { "kitVersion": "9.9.9", "project": {"name":"fixture","slug":"fixture"},
45
+ "github": {"repo":"$FIX_REPO","owner":"octo","baseBranch":"develop",
46
+ "projectsV2":true,"projectNumber":5,"projectOwnerType":"organization"} }
30
47
  JSON
31
48
  ( cd "$fix" && git init -q ) 2>/dev/null
32
49
 
33
- # 1) From the fixture, sync resolves the fixture's config → targets the fixture's repo.
34
- got_repo="$(cd "$fix" && PATH="$stub:$PATH" "$CCKIT" sync --llm 2>&1 >/dev/null | sed -n 's/^REPO=//p' | tail -1)"
35
- t "sync targets the invoking project's repo" "$got_repo" "octo/fixture-repo"
50
+ # ── config resolution: the invoking project's repo / base branch / owner type / owner ────────────
51
+ eval "$(cd "$fix" && KIT_CONFIG='' bash -c 'source "'"$ROOT"'/scripts/lib/kit-config.sh"; load_kit_config >/dev/null 2>&1;
52
+ printf "R=%s\nB=%s\nO=%s\nT=%s\n" "$KIT_REPO" "$KIT_BASE_BRANCH" "$KIT_OWNER" "$KIT_PROJECT_OWNER_TYPE"')"
53
+ t "config resolves the invoking repo" "$R" "$FIX_REPO"
54
+ t "config resolves the invoking base branch" "$B" "develop"
55
+ t "config resolves the invoking owner" "$O" "octo"
56
+ t "config resolves the org owner type" "$T" "organization"
36
57
 
37
- # 2) From the fixture, scan reports the fixture as root (no cd to the install dir).
58
+ # ── legacy targeted checks (kept) ────────────────────────────────────────────────────────────────
59
+ export GH_REPO_LOG="$fix/gh.repos"; : > "$GH_REPO_LOG"
60
+ got_repo="$(cd "$fix" && PATH="$stub:$PATH" "$CCKIT" sync --llm 2>&1 >/dev/null | sed -n 's/^REPO=//p' | tail -1)"
61
+ t "sync targets the invoking project's repo" "$got_repo" "$FIX_REPO"
38
62
  got_root="$(cd "$fix" && "$CCKIT" scan --llm 2>/dev/null | jq -r .root)"
39
63
  t "scan root is the invoking dir" "$got_root" "$(cd "$fix" && pwd -P)"
40
-
41
- # 3) Self-hosting: from the cckit repo, sync still targets cckit's own repo.
42
64
  own_repo="$(jq -r '.github.repo' "$ROOT/cckit.config.json")"
43
65
  got_own="$(cd "$ROOT" && PATH="$stub:$PATH" "$CCKIT" sync --llm 2>&1 >/dev/null | sed -n 's/^REPO=//p' | tail -1)"
44
66
  t "self-host sync targets cckit's repo" "$got_own" "$own_repo"
45
-
46
- # 4) `version` is the INSTALLED version regardless of where it is invoked.
47
- inst_ver="$(jq -r '.kitVersion' "$ROOT/cckit.config.json")"
48
67
  got_ver="$(cd "$fix" && "$CCKIT" version | awk '{print $2}')"
49
- t "version is the install version, not the project's" "$got_ver" "$inst_ver"
68
+ t "version is the install version, not the project's" "$got_ver" "$(jq -r '.kitVersion' "$ROOT/cckit.config.json")"
69
+
70
+ # ── BY CONSTRUCTION: exercise every read-only verb; none may resolve cckit's OWN repo ─────────────
71
+ # Read-only board/config verbs that MUST act on the invoking project. Run each from the fixture and
72
+ # assert the gh call log never mentions cckit's own repo (the leak this whole effort guards against).
73
+ EXERCISE="sync status next plan plan-next wave gc scan doctor"
74
+ for v in $EXERCISE; do
75
+ : > "$GH_REPO_LOG"
76
+ ( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" "$v" --llm >/dev/null 2>&1 )
77
+ no "verb '$v' never resolves cckit's own repo from a foreign checkout" "$(cat "$GH_REPO_LOG")" "$OWN_REPO"
78
+ done
79
+ # The board verbs that DO call gh with --repo must have hit the FIXTURE repo (proves real resolution).
80
+ : > "$GH_REPO_LOG"; ( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" gc --llm >/dev/null 2>&1 )
81
+ yes "gc resolves the invoking repo" "$(cat "$GH_REPO_LOG")" "$FIX_REPO"
82
+
83
+ # ── BY CONSTRUCTION: every verb in `cckit commands` is classified (exercised or explicitly skipped) ─
84
+ # A new verb that is neither exercised nor listed here fails the harness — forcing a coverage
85
+ # decision. SKIP holds verbs that mutate, need args, read stdin, are interactive, or act on the
86
+ # install itself (not the invoking project's board) — deliberately not driven here.
87
+ SKIP="adopt autopilot close commands completions contribute copilot debug digest effort encode-context handoff help init install migrate orchestrate pr release render resume start ui update version watch"
88
+ classified() { case " $EXERCISE $SKIP " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
89
+ for v in $("$CCKIT" commands); do
90
+ classified "$v" || { echo "FAIL: verb '$v' is unclassified — add it to EXERCISE (read-only, assert no own-repo leak) or SKIP in portable-test.sh"; fail=1; }
91
+ done
50
92
 
51
93
  rm -rf "$stub" "$fix"
52
94
  [ "$fail" -eq 0 ] && echo "ALL OK (portable)" || echo "portable: FAILURES"
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env bash
2
- # Create the kind:/priority:/role: label families on the repo. Idempotent.
3
- # Reads repo + roles from .claude/kit.config.json. Run from project root.
2
+ # Create the ctx:/flow:/kind:/priority:/role: label families on the repo. Idempotent.
3
+ # Reads repo + roles from .claude/kit.config.json; the flow vocabulary from effort.sh (EFFORT_FLOWS).
4
+ # These are exactly the labels `cckit effort new` / /kit-effort-new apply — provision them here so a
5
+ # fresh repo can create a fully-labeled effort with no manual label creation. Run from project root.
4
6
  set -euo pipefail
5
7
  source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
8
+ # shellcheck source=/dev/null
9
+ source "$(dirname "$0")/lib/effort.sh" 2>/dev/null || true # for EFFORT_FLOWS (the flow:* vocabulary)
6
10
 
7
11
  ensure_label() { # name color description
8
12
  gh label create "$1" --repo "$KIT_REPO" --color "$2" --description "$3" --force >/dev/null 2>&1 \
@@ -16,6 +20,13 @@ echo "priorities:"
16
20
  ensure_label "priority:p1" "b60205" "Now / blocking"
17
21
  ensure_label "priority:p2" "fbca04" "Next"
18
22
  ensure_label "priority:p3" "0e8a16" "Later"
23
+ echo "ctx (session weight):"
24
+ for c in S M L XL; do ensure_label "ctx:$c" "c5def5" "Session weight: $c"; done
25
+ echo "flows:"
26
+ for f in ${EFFORT_FLOWS:-Core UI API Docs Infra Auth Data Web App}; do
27
+ slug=$(echo "$f" | tr '[:upper:]' '[:lower:]')
28
+ ensure_label "flow:$slug" "0e8a16" "Flow: $f"
29
+ done
19
30
  echo "roles:"
20
31
  while IFS= read -r role; do
21
32
  [[ -z "$role" ]] && continue
@@ -23,8 +23,17 @@ command -v freeze >/dev/null || { echo "showcase: freeze required (brew install
23
23
  # CCKIT_FORCE_COLOR is cckit-private (see ui.sh) so it never leaks into the gh/jq subprocesses.
24
24
  export PATH="$ROOT/bin:$PATH"
25
25
  export CCKIT_FORCE_COLOR=1
26
+ # Verbs that render markdown (plan/next/copilot) must show their verbatim markdown in the gallery,
27
+ # not shell out to glow — keeps every screenshot deterministic regardless of the local toolchain.
28
+ export CCKIT_NO_GLOW=1
26
29
  mkdir -p "$IMG_DIR"
27
30
 
31
+ # Normalized capture preset — EVERY screenshot is the SAME fixed size (920×400) with the same wrap,
32
+ # font, and line height, so the gallery is one coherent series that fits the docs column. The
33
+ # showcase is a small VISUAL teaser; the full command list lives on the CLI reference page as
34
+ # copyable text. Only include short, visual commands here so nothing clips at height 400.
35
+ FREEZE_PRESET=(--window --padding 20 --width 920 --height 400 --wrap 90 --font.size 14 --line-height 1.25)
36
+
28
37
  # Gallery header.
29
38
  {
30
39
  echo '---'
@@ -32,9 +41,9 @@ mkdir -p "$IMG_DIR"
32
41
  echo 'description: Every cckit capability at a glance — real command output captured as screenshots.'
33
42
  echo '---'
34
43
  echo
35
- echo 'A live tour of cckit, generated from a dataset (`docs-site/showcase/showcase.json`) by'
36
- echo '`scripts/showcase.sh`: each command is run for real and its output captured as a screenshot.'
37
- echo 'Every command here is read-only or a dry-run — safe to run yourself.'
44
+ echo 'A short visual tour of cckit — each shot is a real command run for real, captured at the same'
45
+ echo 'size. For the **full command list** (copyable), see the [CLI reference](/cli-reference/); to'
46
+ echo 'see how the verbs fit together, start with [the GitHub cycle](/github-cycle/).'
38
47
  echo
39
48
  } > "$GALLERY"
40
49
 
@@ -46,7 +55,7 @@ while IFS=$'\t' read -r name group title cmd show; do
46
55
  out="$IMG_DIR/$name.png"
47
56
  echo "==> $name : $cmd" >&2
48
57
  # </dev/null so freeze never consumes this loop's stdin (the jq dataset stream).
49
- if ! freeze --window --padding 20 --execute "$cmd" --output "$out" </dev/null >/dev/null 2>&1; then
58
+ if ! freeze "${FREEZE_PRESET[@]}" --execute "$cmd" --output "$out" </dev/null >/dev/null 2>&1; then
50
59
  echo " FAILED to render $name" >&2; fail=1; continue
51
60
  fi
52
61
  if [ "$group" != "$prev_group" ]; then