@jeiemgi/cckit 0.11.0 → 0.12.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 (121) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +45 -41
  3. package/README.md +39 -29
  4. package/bin/cckit +111 -70
  5. package/cckit.config.json +1 -1
  6. package/package.json +1 -1
  7. package/scripts/advisor-test.sh +55 -0
  8. package/scripts/autopilot.sh +4 -4
  9. package/scripts/capture-project-ids.sh +16 -0
  10. package/scripts/check.sh +6 -0
  11. package/scripts/content-skills-test.sh +1 -1
  12. package/scripts/copilot-loop-test.sh +8 -8
  13. package/scripts/force-push-fence-test.sh +44 -0
  14. package/scripts/force-push-fence.baseline +1 -0
  15. package/scripts/force-push-fence.sh +51 -0
  16. package/scripts/init.sh +2 -2
  17. package/scripts/instruction-budget-baseline.txt +1 -1
  18. package/scripts/kit-doctor-test.sh +5 -0
  19. package/scripts/kit-doctor.sh +96 -2
  20. package/scripts/lib/agent-resolve-test.sh +2 -0
  21. package/scripts/lib/agent-resolve.sh +3 -2
  22. package/scripts/lib/board-view.sh +3 -3
  23. package/scripts/lib/captain.sh +1 -1
  24. package/scripts/lib/copilot-test.sh +4 -4
  25. package/scripts/lib/copilot.sh +13 -13
  26. package/scripts/lib/effort-close-subs-test.sh +96 -0
  27. package/scripts/lib/effort-dispatch-test.sh +2 -2
  28. package/scripts/lib/effort-ops-test.sh +98 -9
  29. package/scripts/lib/effort-ops.sh +390 -63
  30. package/scripts/lib/effort-parity-test.sh +37 -31
  31. package/scripts/lib/effort-plan.sh +3 -3
  32. package/scripts/lib/effort-review-test.sh +107 -0
  33. package/scripts/lib/effort-review.sh +93 -0
  34. package/scripts/lib/effort-slug-test.sh +4 -0
  35. package/scripts/lib/effort-slug.sh +5 -4
  36. package/scripts/lib/effort.sh +47 -74
  37. package/scripts/lib/forge-github.sh +18 -7
  38. package/scripts/lib/gh-board-add-test.sh +118 -0
  39. package/scripts/lib/gh-project-test.sh +115 -0
  40. package/scripts/lib/gh-project.sh +128 -6
  41. package/scripts/lib/gh-rest-test.sh +12 -8
  42. package/scripts/lib/gh-rest.sh +189 -15
  43. package/scripts/lib/git-core-test.sh +2 -2
  44. package/scripts/lib/grill-record-test.sh +49 -0
  45. package/scripts/lib/grill-record.sh +88 -0
  46. package/scripts/lib/handoff.sh +1 -1
  47. package/scripts/lib/kit-brief-test.sh +29 -0
  48. package/scripts/lib/kit-brief.sh +91 -6
  49. package/scripts/lib/kit-lib-test.sh +1 -1
  50. package/scripts/lib/kit-lib.sh +7 -7
  51. package/scripts/lib/kit-msg.sh +3 -3
  52. package/scripts/lib/kit-status.sh +1 -1
  53. package/scripts/lib/kit-task-ops-test.sh +17 -0
  54. package/scripts/lib/kit-task-ops.sh +73 -22
  55. package/scripts/lib/kto-task-new-test.sh +18 -0
  56. package/scripts/lib/kto-task-pr-merge-test.sh +44 -0
  57. package/scripts/lib/kto-task-pr-test.sh +3 -3
  58. package/scripts/lib/light-task.sh +16 -1
  59. package/scripts/lib/loose-issues.sh +65 -0
  60. package/scripts/lib/naming-test.sh +112 -0
  61. package/scripts/lib/naming-verbs-test.sh +126 -0
  62. package/scripts/lib/naming.sh +172 -0
  63. package/scripts/lib/next-test.sh +1 -1
  64. package/scripts/lib/next.sh +6 -6
  65. package/scripts/lib/plan-machine.sh +9 -9
  66. package/scripts/lib/plan-next.sh +4 -4
  67. package/scripts/lib/qa-lane.sh +1 -1
  68. package/scripts/lib/spec-lint-test.sh +63 -0
  69. package/scripts/lib/spec-lint.sh +95 -0
  70. package/scripts/lib/sprint-test.sh +96 -0
  71. package/scripts/lib/sprint.sh +216 -0
  72. package/scripts/lib/stage-receipt-test.sh +132 -0
  73. package/scripts/lib/stage-receipt.sh +184 -5
  74. package/scripts/lib/test-forge-shim.sh +2 -1
  75. package/scripts/lib/verbs.sh +1 -1
  76. package/scripts/lib/verbs.tsv +17 -15
  77. package/scripts/lib/worker-brief-test.sh +1 -1
  78. package/scripts/lib/worker-brief.sh +1 -1
  79. package/scripts/lib/worktree-start.sh +42 -1
  80. package/scripts/loose-issues-test.sh +102 -0
  81. package/scripts/loose-issues.baseline +5 -0
  82. package/scripts/night-grant.sh +1 -1
  83. package/scripts/portable-test.sh +1 -1
  84. package/scripts/status-test.sh +1 -1
  85. package/scripts/status.sh +4 -4
  86. package/scripts/task-sync-test.sh +34 -0
  87. package/scripts/task-sync.sh +81 -1
  88. package/scripts/terms-check.sh +1 -1
  89. package/scripts/verbs-ratchet-test.sh +6 -1
  90. package/scripts/verbs-test.sh +4 -4
  91. package/scripts/verbs.baseline +1 -1
  92. package/skills/kit-add/SKILL.md +1 -1
  93. package/skills/kit-advisor/SKILL.md +75 -0
  94. package/skills/kit-advisor/references/close.md +53 -0
  95. package/skills/kit-advisor/references/grill.md +69 -0
  96. package/skills/kit-advisor/references/orchestrate.md +56 -0
  97. package/skills/kit-advisor/references/plan.md +64 -0
  98. package/skills/kit-advisor/references/review.md +47 -0
  99. package/skills/kit-advisor/references/step-report.md +61 -0
  100. package/skills/kit-autopilot/SKILL.md +1 -1
  101. package/skills/kit-cleanup/SKILL.md +2 -2
  102. package/skills/kit-effort-close/SKILL.md +16 -8
  103. package/skills/kit-effort-new/SKILL.md +11 -8
  104. package/skills/kit-effort-pr/SKILL.md +7 -7
  105. package/skills/kit-next/SKILL.md +7 -7
  106. package/skills/kit-plan-next/SKILL.md +10 -11
  107. package/skills/kit-status/SKILL.md +5 -5
  108. package/skills/kit-task-pr-auto/SKILL.md +1 -1
  109. package/skills/kit-task-pr-merge/SKILL.md +3 -3
  110. package/skills/kit-task-sync/SKILL.md +2 -0
  111. package/skills/routing.yaml +5 -0
  112. package/templates/hooks/kit-mail-check.sh.tmpl +1 -1
  113. package/templates/instructions.md.tmpl +3 -3
  114. package/templates/rules/authoring.md +7 -3
  115. package/templates/rules/delegation-brief.md +4 -0
  116. package/templates/rules/effort-model.md +34 -31
  117. package/templates/rules/gate-and-review.md +1 -1
  118. package/templates/rules/merge-safety.md +9 -7
  119. package/templates/rules/naming-and-ids.md +20 -24
  120. package/templates/rules/plan-next.md +5 -5
  121. package/templates/skills/campaign/SKILL.md +2 -2
@@ -151,5 +151,49 @@ t "KIT_FORCE=1 warns about the lost trace" "$(grep -c 'KIT_FORCE=1' "$tmp/
151
151
  t "KIT_FORCE=1 reaches the merge" "$(merged 14)" "1"
152
152
  t "no gh subcommand ran" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
153
153
 
154
+ # ── #592: a CONFLICTING PR is brought onto its base by merge and pushed plain, never rebased ─────
155
+ git checkout -q develop
156
+ GH_BASE="develop"; GH_MERGEABLE="false"; GH_HEAD="fix/30-x"
157
+ cwt="$tmp/work/.claude/worktrees/fix+30-x"
158
+ git worktree add -q -b fix/30-x "$cwt" develop
159
+ git -C "$cwt" commit -q --allow-empty -m "branch work"
160
+ git -C "$cwt" push -q origin fix/30-x
161
+ own="$(git -C "$cwt" rev-parse HEAD)"
162
+ git clone -q "$tmp/remote.git" "$tmp/gh-side2" 2>/dev/null
163
+ git -C "$tmp/gh-side2" checkout -q develop
164
+ git -C "$tmp/gh-side2" -c user.email=t@t -c user.name=t commit -q --allow-empty -m "base moved"
165
+ git -C "$tmp/gh-side2" push -q origin develop
166
+ basetip="$(git -C "$tmp/gh-side2" rev-parse HEAD)"
167
+ # a fake git on PATH records every push so the test can assert none carries --force*
168
+ mkdir -p "$tmp/gitwrap"; real_git="$(command -v git)"
169
+ printf '#!/usr/bin/env bash\ncase "$*" in *push*--delete*) ;; *push*) echo "$*" >> "%s/git-pushes.log"; "%s" rev-parse HEAD > "%s/pushed-head" ;; esac\nexec "%s" "$@"\n' "$tmp" "$real_git" "$tmp" "$real_git" > "$tmp/gitwrap/git"
170
+ chmod +x "$tmp/gitwrap/git"; : > "$tmp/git-pushes.log"
171
+ : > "$GH_LOG"
172
+ ( cd "$cwt" && PATH="$tmp/gitwrap:$PATH" kto_task_pr_merge 30 ) >/dev/null 2>"$tmp/err30"; rc=$?
173
+ t "a conflicting PR from its own worktree merges (rc 0)" "$rc" "0"
174
+ t "the PR was merged" "$(merged 30)" "1"
175
+ t "origin/develop was merged into the branch, then pushed" "$(git -C "$tmp/remote.git" merge-base --is-ancestor "$basetip" "$(cat "$tmp/pushed-head")" 2>/dev/null && echo yes || echo no)" "yes"
176
+ t "the branch's own commit was kept, not rewritten" "$(git -C "$tmp/remote.git" merge-base --is-ancestor "$own" "$(cat "$tmp/pushed-head")" 2>/dev/null && echo yes || echo no)" "yes"
177
+ t "the push was plain" "$(grep -c 'push origin fix/30-x$' "$tmp/git-pushes.log")" "1"
178
+ t "no push carried --force or --force-with-lease" "$(grep -cE -- '--force|[[:space:]]-f([[:space:]]|$)' "$tmp/git-pushes.log")" "0"
179
+
180
+ # a merge that conflicts is aborted and the user is told to resolve it with a merge
181
+ git checkout -q develop
182
+ git pull -q origin develop 2>/dev/null
183
+ cwt2="$tmp/work/.claude/worktrees/fix+31-x"
184
+ git worktree add -q -b fix/31-x "$cwt2" develop
185
+ echo mine > "$cwt2/clash.txt"; git -C "$cwt2" add clash.txt; git -C "$cwt2" commit -q -m "mine"
186
+ git -C "$cwt2" push -q origin fix/31-x
187
+ echo theirs > "$tmp/gh-side2/clash.txt"; git -C "$tmp/gh-side2" pull -q origin develop 2>/dev/null
188
+ git -C "$tmp/gh-side2" add clash.txt; git -C "$tmp/gh-side2" -c user.email=t@t -c user.name=t commit -q -m "theirs"
189
+ git -C "$tmp/gh-side2" push -q origin develop
190
+ : > "$GH_LOG"; GH_HEAD="fix/31-x"
191
+ ( cd "$cwt2" && kto_task_pr_merge 31 ) >/dev/null 2>"$tmp/err31"; rc=$?
192
+ t "a textual conflict is refused (rc 1)" "$rc" "1"
193
+ t "nothing was merged" "$(merged "")" "0"
194
+ t "the merge was aborted (no MERGE_HEAD)" "$(git -C "$cwt2" rev-parse -q --verify MERGE_HEAD >/dev/null && echo present || echo gone)" "gone"
195
+ t "the user is told to merge the base in" "$(grep -c 'git merge origin/develop' "$tmp/err31")" "1"
196
+ t "the branch on origin was not rewritten" "$(git ls-remote origin fix/31-x | cut -f1)" "$(git -C "$cwt2" rev-parse HEAD)"
197
+
154
198
  [ "$fail" -eq 0 ] && echo "kto-task-pr-merge: all passed" || echo "kto-task-pr-merge: FAILURES"
155
199
  exit "$fail"
@@ -48,7 +48,7 @@ t "no gh subcommand ran" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG
48
48
 
49
49
  : > "$GH_LOG"; git checkout -q -b fix/43-other
50
50
  KIT_PR_TITLE_STYLE=conventional kto_task_pr 43 "Other." >/dev/null 2>&1
51
- tc "$GH_LOG" "${PR_POST}\"title\":\"fix: Fix the thing\"," "conventional (default): a Conventional Commits title"
51
+ tc "$GH_LOG" "${PR_POST}\"title\":\"fix: Fix the thing \\[#43\\]\"," "conventional (default): a Conventional Commits title + the [#N] token"
52
52
  grep -q 'For the orchestrator' "$GH_LOG" && { echo "FAIL: section present with the switch off"; fail=1; } || echo "ok: no section with the switch off"
53
53
 
54
54
  # --base (#391): an explicit base wins over the configured one; the flag is never a positional.
@@ -57,7 +57,7 @@ echo three > tracked.txt
57
57
  kto_task_pr 44 "Release." --base release >/dev/null 2>&1
58
58
  t "--base: rc 0" "$?" "0"
59
59
  tc "$GH_LOG" "${PR_POST}.*\"head\":\"task/44-release\",\"base\":\"release\"," "--base: the PR targets the given base"
60
- t "--base is not taken as the commit message" "$(git log -1 --format=%s)" "fix: Fix the thing"
60
+ t "--base is not taken as the commit message" "$(git log -1 --format=%s)" "fix: Fix the thing [#44]"
61
61
  : > "$GH_LOG"
62
62
  kto_task_pr 44 "Release." >/dev/null 2>&1
63
63
  tc "$GH_LOG" "${PR_POST}.*\"head\":\"task/44-release\",\"base\":\"main\"," "no --base: the PR targets the configured base"
@@ -102,7 +102,7 @@ kto_task_pr 44 "Hot." --base main >/dev/null 2>&1
102
102
  t "--base: kto_task_pr succeeds" "$?" "0"
103
103
  tc "$GH_LOG" "${PR_POST}.*\"base\":\"main\"," "--base main: the PR targets main, not the configured develop"
104
104
  t "--base main: the pre-push hook sees it" "$(cat "$tmp/prepush.log")" "KIT_PR_BASE=main"
105
- t "--base is not taken as the commit msg" "$(git log -1 --format=%s)" "fix: Fix the thing"
105
+ t "--base is not taken as the commit msg" "$(git log -1 --format=%s)" "fix: Fix the thing [#44]"
106
106
 
107
107
  : > "$GH_LOG"; : > "$tmp/prepush.log"; git checkout -q -b fix/45-eq
108
108
  echo four > tracked.txt
@@ -54,6 +54,10 @@ if ! type cckit_gh_rest >/dev/null 2>&1; then
54
54
  [ -f "$_LT_LIB_DIR/gh-rest.sh" ] && . "$_LT_LIB_DIR/gh-rest.sh"
55
55
  fi
56
56
  type cckit_gh_rest >/dev/null 2>&1 || cckit_gh_rest() { return 1; }
57
+ if ! type naming_title_lint >/dev/null 2>&1; then
58
+ # shellcheck source=naming.sh
59
+ [ -f "$_LT_LIB_DIR/naming.sh" ] && . "$_LT_LIB_DIR/naming.sh"
60
+ fi
57
61
  type cckit_is_json >/dev/null 2>&1 || cckit_is_json() { [ "${CCKIT_OUTPUT:-human}" = "json" ]; }
58
62
 
59
63
  _LT_TAB="$(printf '\t')"
@@ -605,6 +609,11 @@ _lt_share_body() {
605
609
  "$(printf '%s\n' "$1" | sed 's/^/- `/; s/$/`/')" "$2"
606
610
  }
607
611
 
612
+ # _lt_share_title <count> <stamp> — the share pull request's title.
613
+ _lt_share_title() {
614
+ printf 'chore(tasks): add %s task%s [share-%s]' "$1" "$([ "$1" -eq 1 ] || echo s)" "$2"
615
+ }
616
+
608
617
  lt_share() {
609
618
  local summary="" a root from base base_ref stamp branch wt ids n pr_title body rows
610
619
  for a in "$@"; do
@@ -642,6 +651,12 @@ lt_share() {
642
651
  if git -C "$root" show-ref --verify --quiet "refs/remotes/origin/$base"; then base_ref="origin/$base"
643
652
  else echo "✗ task share: origin has no branch '$base'" >&2; return 1; fi
644
653
  stamp="$(date +%Y%m%d%H%M%S)"
654
+ # The naming rule (E546.1), before the worktree, the commit and the PR: the share title is the one
655
+ # documented exception to the token rule, `[share-<stamp>]` in place of an issue's token.
656
+ pr_title="$(_lt_share_title "$n" "$stamp")"
657
+ if type naming_title_lint >/dev/null 2>&1; then
658
+ naming_title_lint pr "$pr_title" || { echo "✗ task share: the title '$pr_title' breaks the naming rule — nothing was written" >&2; return 1; }
659
+ fi
645
660
  branch="light/share-$stamp"
646
661
  wt="$root/.claude/worktrees/light+share-$stamp"
647
662
  git -C "$root" worktree add --no-track -b "$branch" "$wt" "$base_ref" >/dev/null 2>&1 \
@@ -653,7 +668,7 @@ lt_share() {
653
668
  git -C "$root" branch -D "$branch" >/dev/null 2>&1 || true
654
669
  echo "(no drafts to share: the task files here are already tracked by git)"; return 0
655
670
  fi
656
- pr_title="chore(tasks): add $n task$([ "$n" -eq 1 ] || echo s) [share-$stamp]"
671
+ pr_title="$(_lt_share_title "$n" "$stamp")"
657
672
  git -C "$wt" commit -q -m "$pr_title" >&2 || { echo "✗ task share: the commit failed in $wt" >&2; return 1; }
658
673
  body="$(_lt_share_body "$ids" "${summary:-Adds $n task(s) to the list.}")"
659
674
  echo "[task] moved $n draft(s) onto $branch — 'cckit task list' shows them as shared until the pull request merges" >&2
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # loose-issues.sh — count the open issues that belong to no unit of work (E546.2). A loose issue is
4
+ # an open issue (not a pull request) that is not an effort (`effort` label), not a sub-issue (the
5
+ # REST field `parent_issue_url` is set), and not on the board with Status = Backlog. The Backlog
6
+ # marker is the board's Status column; with the board off (`github.projectsV2: false`) no issue can
7
+ # carry it, so every standalone issue counts.
8
+ #
9
+ # loose_board_on [cfg] rc 0 iff the config turns the board on (projectsV2 true + a number)
10
+ # loose_repo [cfg] owner/name: .github.repo, else the origin remote; rc 1 when neither
11
+ # loose_issues_list <repo> [cfg] `N<TAB>title` per loose issue, ascending; rc 1 when the read failed
12
+ # loose_baseline_read <file> the first number in the baseline file (lines starting # are notes)
13
+ #
14
+ # Every GitHub read goes through the forge (forge_rest). Reads only; nothing is moved or relabelled.
15
+ # bash 3.2 + zsh compatible. Requires jq.
16
+ # errors: strict — a failed forge read is rc 1 and is never reported as zero loose issues
17
+ _loose_self="${BASH_SOURCE[0]:-$0}"
18
+ LOOSE_LIB="$(cd "$(dirname "$_loose_self")" && pwd)"
19
+ unset _loose_self
20
+ command -v forge_rest >/dev/null 2>&1 || . "$LOOSE_LIB/forge.sh"
21
+ command -v kit_config_path >/dev/null 2>&1 || . "$LOOSE_LIB/config-path.sh"
22
+
23
+ _loose_cfg() { [ -n "${1:-}" ] && { printf '%s' "$1"; return 0; }; kit_config_path 2>/dev/null; }
24
+
25
+ loose_board_on() {
26
+ local cfg; cfg="$(_loose_cfg "${1:-}")" || return 1
27
+ [ -f "$cfg" ] || return 1
28
+ [ "$(jq -r '(.github.projectsV2 // false) and (.github.projectNumber != null)' "$cfg" 2>/dev/null)" = true ]
29
+ }
30
+
31
+ loose_repo() {
32
+ local cfg r=""
33
+ cfg="$(_loose_cfg "${1:-}")" || cfg=""
34
+ [ -n "$cfg" ] && [ -f "$cfg" ] && r="$(jq -r '.github.repo // empty' "$cfg" 2>/dev/null)"
35
+ [ -n "$r" ] || r="$(forge_repo_from_git "$(dirname "${cfg:-.}")" 2>/dev/null)" || r=""
36
+ [ -n "$r" ] || return 1
37
+ printf '%s' "$r"
38
+ }
39
+
40
+ loose_issues_list() {
41
+ local repo="$1" cfg="${2:-}" raw n title st pnum=""
42
+ raw="$(forge_rest "repos/$repo/issues?state=open&per_page=100" --paginate \
43
+ --jq '.[] | select(.pull_request == null)
44
+ | select(([.labels[]?.name] | index("effort")) | not)
45
+ | select((.parent_issue_url // "") == "")
46
+ | "\(.number)\t\(.title)"')" || return 1
47
+ [ -n "$raw" ] || return 0
48
+ if loose_board_on "$cfg"; then
49
+ # The board holds the Backlog marker: one cheap issue.projectItems read per standalone issue.
50
+ command -v project_issue_status >/dev/null 2>&1 || . "$LOOSE_LIB/gh-project.sh"
51
+ pnum="$(jq -r '.github.projectNumber' "$(_loose_cfg "$cfg")")"
52
+ printf '%s\n' "$raw" | while IFS="$(printf '\t')" read -r n title; do
53
+ [ -n "$n" ] || continue
54
+ st="$(KIT_REPO="$repo" project_issue_status "$n" "$pnum" 2>/dev/null)" || st=""
55
+ [ "$st" = "Backlog" ] || printf '%s\t%s\n' "$n" "$title"
56
+ done | sort -n
57
+ else
58
+ printf '%s\n' "$raw" | sort -n
59
+ fi
60
+ }
61
+
62
+ loose_baseline_read() {
63
+ [ -f "$1" ] || return 1
64
+ grep -v '^#' "$1" | grep -E '^[0-9]+$' | sed -n 1p
65
+ }
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env bash
2
+ # naming-test.sh — the one title convention (scripts/lib/naming.sh, E546.1): accept/reject tables
3
+ # per kind, the token parser, the prefix strip over new and legacy titles, and the wrappers
4
+ # effort_title_lint / effort_pr_title_check that keep legacy titles valid. Hermetic, no network.
5
+ # errors: strict — a test runner: rc 1 on any failed assertion
6
+ set -u
7
+ LIB="$(cd "$(dirname "$0")" && pwd)"
8
+ fail=0
9
+ # shellcheck source=/dev/null
10
+ . "$LIB/naming.sh"
11
+
12
+ t() { if [ "$2" = "$3" ]; then echo "ok $1"; else echo "FAIL $1"; echo " got: [$2]"; echo " want: [$3]"; fail=1; fi; }
13
+ acc() { if naming_title_lint "$1" "$2" >/dev/null 2>&1; then echo "ok $1 accepts: $2"; else echo "FAIL $1 should accept: $2"; naming_title_lint "$1" "$2"; fail=1; fi; }
14
+ rej() { if naming_title_lint "$1" "$2" >/dev/null 2>&1; then echo "FAIL $1 should reject: $2"; fail=1; else echo "ok $1 rejects: $2"; fi; }
15
+
16
+ # --- effort ---
17
+ acc effort "[E545] Every verb answers a question"
18
+ acc effort "[E12] [UI] operator navigation" # a [Flow] tag is tolerated
19
+ acc effort "[Effort] 12 · effort planning conventions" # legacy
20
+ acc effort "[Effort] 12 · [Core] operator navigation" # legacy with a flow tag
21
+ rej effort "Every verb answers a question" # no prefix
22
+ rej effort "[E545.1] a sub title is not an effort"
23
+ rej effort "[E545] operator chrome — Settings ▾ dropdown"
24
+ rej effort "[E545] refactor the thing" # jargon
25
+ rej effort "[E545] one two three four five six seven" # 7 words
26
+ rej effort "[E545] fix effort_new (the parser)" # snake_case + parens
27
+ rej effort "[E545] [Growth] faster onboarding" # flow outside the vocabulary
28
+ rej effort "[E545] " # empty name
29
+
30
+ # --- sub ---
31
+ acc sub "[E545.1] One naming convention for titles"
32
+ acc sub "[Effort 12] 4 · module tables" # legacy
33
+ rej sub "[E545] not a sub"
34
+ rej sub "[Effort 12] 4 · Section tables — columns + joins (contract B)"
35
+ rej sub "module tables"
36
+
37
+ # --- standalone issue ---
38
+ acc issue "Start accepts the effort token"
39
+ rej issue "[E545] an effort title is not an issue"
40
+ rej issue "[Core] a tag is a prefix"
41
+ rej issue "one two three four five six seven"
42
+ rej issue "update scripts/lib/naming.sh"
43
+
44
+ # --- pull request ---
45
+ acc pr "feat(core): one naming convention [E546]"
46
+ acc pr "feat(core): one naming convention for titles [E546.1]"
47
+ acc pr "fix(start): plant no empty lockfile [#255]"
48
+ acc pr "chore(tasks): add 3 tasks [share-20261124101500]" # the task share exception
49
+ rej pr "feat(core): no token at all"
50
+ rej pr "feat(core): token in the middle [#12] then words"
51
+ rej pr "One naming convention [E546]" # not conventional
52
+ rej pr "feat: parenthesis is the PR slot (E546)"
53
+ rej pr "chore(tasks): add 3 tasks [share-abc]"
54
+ if KIT_PR_TITLE_STYLE=issue-title naming_title_lint pr "[Tech Lead] [#115] adoption hardening" 2>/dev/null; then
55
+ echo "ok pr under issue-title style is not held to the conventional form"
56
+ else echo "FAIL pr under issue-title style"; fail=1; fi
57
+ naming_title_lint bogus "x" 2>/dev/null; t "an unknown kind is a usage error" "$?" "2"
58
+ naming_title_lint pr "" 2>/dev/null; t "an empty title is a usage error" "$?" "2"
59
+ _err="$(naming_title_lint effort "[E1] refactor one two three four five six" 2>&1 >/dev/null)"
60
+ case "$_err" in *"jargon word 'refactor'"*"7 words"*) echo "ok every failed rule is named on stderr" ;;
61
+ *) echo "FAIL reasons on stderr: $_err"; fail=1 ;; esac
62
+
63
+ # --- composers ---
64
+ t "effort title" "$(naming_effort_title 545 'Every verb answers a question')" "[E545] Every verb answers a question"
65
+ t "sub title" "$(naming_sub_title 545 2 'Start takes a token')" "[E545.2] Start takes a token"
66
+ t "a #-prefixed number" "$(naming_effort_title '#7' x)" "[E7] x"
67
+
68
+ # --- token parse ---
69
+ t "parse E545" "$(naming_token_parse E545)" "545"
70
+ t "parse E545.1" "$(naming_token_parse E545.1)" "545 1"
71
+ t "parse [e12.3]" "$(naming_token_parse '[e12.3]')" "12 3"
72
+ naming_token_parse 545 >/dev/null; t "a bare number is not a token" "$?" "1"
73
+ naming_token_parse E545.x >/dev/null; t "E545.x is not a token" "$?" "1"
74
+
75
+ # --- token read from a title ---
76
+ t "token of a new effort" "$(naming_title_token '[E545] name')" "E545"
77
+ t "token of a new sub" "$(naming_title_token '[E545.3] name')" "E545.3"
78
+ t "token of a legacy effort" "$(naming_title_token '[Effort] 545 · [Core] name')" "E545"
79
+ t "token of a legacy sub" "$(naming_title_token '[Effort 545] 3 · name')" "E545.3"
80
+ naming_title_token 'plain issue' >/dev/null; t "a plain title has no token" "$?" "1"
81
+ t "parent of a new sub" "$(naming_title_parent '[E318.3] resolve profiles')" "318"
82
+ t "parent of a legacy sub" "$(naming_title_parent '[Effort 318] 3 · resolve')" "318"
83
+ naming_title_parent '[E318] umbrella' >/dev/null; t "an effort title has no parent" "$?" "1"
84
+
85
+ # --- prefix strip, new and legacy ---
86
+ t "strip new effort" "$(naming_strip_prefix '[E545] Every verb answers')" "Every verb answers"
87
+ t "strip new sub" "$(naming_strip_prefix '[E545.1] One naming convention')" "One naming convention"
88
+ t "strip new + flow tag" "$(naming_strip_prefix '[E545] [Core] tagged name')" "tagged name"
89
+ t "strip legacy effort" "$(naming_strip_prefix '[Effort] 86 · [Core] Plan future work')" "Plan future work"
90
+ t "strip legacy sub" "$(naming_strip_prefix '[Effort 182] 1 · Enforce it')" "Enforce it"
91
+ t "strip the placeholder" "$(naming_strip_prefix '[Effort] · demo effort')" "demo effort"
92
+ t "a plain title is kept" "$(naming_strip_prefix 'plain issue title')" "plain issue title"
93
+
94
+ # --- the wrappers in effort.sh keep legacy titles valid ---
95
+ (
96
+ # shellcheck source=/dev/null
97
+ . "$LIB/effort.sh" >/dev/null 2>&1
98
+ r=0
99
+ effort_title_lint "[Effort] 12 · [UI] operator navigation" 2>/dev/null || { echo "FAIL legacy parent via effort_title_lint"; r=1; }
100
+ effort_title_lint "[Effort 12] 4 · module tables" 2>/dev/null || { echo "FAIL legacy sub via effort_title_lint"; r=1; }
101
+ effort_title_lint "[E12] operator navigation" 2>/dev/null || { echo "FAIL new parent via effort_title_lint"; r=1; }
102
+ effort_title_lint "[E12.4] module tables" 2>/dev/null || { echo "FAIL new sub via effort_title_lint"; r=1; }
103
+ effort_title_lint "[E12] refactor the wiring" 2>/dev/null && { echo "FAIL jargon passed effort_title_lint"; r=1; }
104
+ effort_pr_title_check "feat(core): x [E546]" 546 2>/dev/null || { echo "FAIL check refuses [E546]"; r=1; }
105
+ effort_pr_title_check "feat(core): x [#546]" 546 2>/dev/null || { echo "FAIL check refuses [#546]"; r=1; }
106
+ effort_pr_title_check "feat(core): x [E5]" 546 2>/dev/null && { echo "FAIL check accepts the wrong effort"; r=1; }
107
+ effort_pr_title_check "feat(core): x [E5]" 2>/dev/null || { echo "FAIL check without a number refuses [E5]"; r=1; }
108
+ [ "$r" = 0 ] && echo "ok effort_title_lint + effort_pr_title_check accept both forms"
109
+ exit "$r"
110
+ ) || fail=1
111
+
112
+ exit "$fail"
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # naming-verbs-test.sh — the naming rule at the verbs (E546.1), over the forge shim: each creating
4
+ # verb refuses a bad title before any forge write; `effort sub` titles [E<n>.<step>]; `effort retitle`
5
+ # is a dry run until --apply; `start E<n>.<step>` resolves the token. Hermetic, no network.
6
+ # Run: bash scripts/lib/naming-verbs-test.sh
7
+ # errors: strict — a test runner: rc 1 on any failed assertion
8
+ set -u
9
+ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
10
+ # shellcheck source=/dev/null
11
+ . "$ROOT/scripts/lib/test-env.sh" && test_env_seal
12
+ LIB="$ROOT/scripts/lib"
13
+ fail=0
14
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
15
+ tc() { if grep -qE -- "$2" "$1"; then echo "ok: $3"; else echo "FAIL: $3 (no /$2/ in $1)"; fail=1; fi; }
16
+ command -v jq >/dev/null 2>&1 || { echo "naming-verbs-test: jq required" >&2; exit 1; }
17
+
18
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
19
+ export GH_LOG="$tmp/gh.log" GH_N="$tmp/n"; : > "$GH_LOG"; echo 49 > "$GH_N"
20
+ # shellcheck source=/dev/null
21
+ . "$LIB/test-forge-shim.sh"; forge_shim_install "$tmp/bin"
22
+ export PATH="$tmp/bin:$PATH" GH_TOKEN=test-token CCKIT_FORGE=github
23
+ export KIT_REPO="o/r" EFFORT_REPO="o/r" KIT_BASE_BRANCH="main" KIT_PROJECTS_V2="false"
24
+ unset KIT_CONFIG CLAUDE_CODE_REMOTE CCKIT_GH_TRANSPORT GH_FAIL_EP KIT_PR_TITLE_STYLE
25
+ # Effort 30 has two subs: #301 a legacy title, #302 already new. Effort 40 has two untitled-by-step subs.
26
+ export GH_FIXTURE="$tmp/fixture.sh"
27
+ cat > "$GH_FIXTURE" <<'SH'
28
+ case "$method $ep" in
29
+ "GET repos/o/r/issues/30/sub_issues") out='[{"number":301,"state":"open","title":"[Effort 30] 1 · first step"},{"number":302,"state":"open","title":"[E30.2] second step"}]' ;;
30
+ "GET repos/o/r/issues/40/sub_issues") out='[{"number":401,"state":"open","title":"plain one"},{"number":402,"state":"open","title":"plain two"}]' ;;
31
+ esac
32
+ SH
33
+ writes() { grep -cE '^(POST|PATCH|PUT|DELETE) ' "$GH_LOG" | tr -d ' '; }
34
+ fresh() { : > "$GH_LOG"; echo 49 > "$GH_N"; }
35
+
36
+ # shellcheck source=/dev/null
37
+ source "$LIB/effort.sh" 2>/dev/null
38
+ # shellcheck source=/dev/null
39
+ source "$LIB/effort-ops.sh"
40
+
41
+ # ── effort new: a bad parent or sub name is refused before any write ─────────────────────────────
42
+ fresh
43
+ effort_new "refactor the wiring" "first sub" >/dev/null 2>"$tmp/err"; rc=$?
44
+ t "effort new: a jargon name is refused (rc 1)" "$rc" "1"
45
+ t "effort new: a refused name writes nothing" "$(writes)" "0"
46
+ tc "$tmp/err" "jargon word 'refactor'" "effort new: the reason is on stderr"
47
+ fresh
48
+ effort_new "demo effort" "a sub (with parens)" >/dev/null 2>"$tmp/err"; rc=$?
49
+ t "effort new: a bad sub name is refused (rc 1)" "$rc" "1"
50
+ t "effort new: a refused sub writes nothing" "$(writes)" "0"
51
+
52
+ # ── effort sub ────────────────────────────────────────────────────────────────────────────────────
53
+ export GH_TITLE="[E30] demo effort" GH_LABELS='[{"name":"effort"},{"name":"role:backend"},{"name":"kind:task"},{"name":"priority:p2"}]'
54
+ fresh
55
+ child="$(effort_sub 30 "third step" 2>"$tmp/err")"; rc=$?
56
+ t "effort sub: rc 0" "$rc" "0"
57
+ t "effort sub: echoes the child number" "$child" "50"
58
+ tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E30\.3\] third step"' "effort sub: titles [E<n>.<count+1>] <name>"
59
+ tc "$GH_LOG" '^POST repos/o/r/issues .*"labels":\["kind:task","priority:p2","role:backend"\]' "effort sub: inherits kind, priority and role"
60
+ tc "$GH_LOG" '^POST repos/o/r/issues/30/sub_issues ' "effort sub: links the child as a native sub-issue"
61
+ fresh
62
+ effort_sub 30 "one two three four five six seven" >/dev/null 2>"$tmp/err"; rc=$?
63
+ t "effort sub: a long name is refused (rc 1)" "$rc" "1"
64
+ t "effort sub: a refused name writes nothing" "$(writes)" "0"
65
+ export GH_LABELS='[{"name":"kind:task"}]'
66
+ fresh
67
+ effort_sub 30 "third step" >/dev/null 2>"$tmp/err"; rc=$?
68
+ t "effort sub: a non-effort parent is refused" "$rc" "1"
69
+ t "effort sub: nothing written for a non-effort" "$(writes)" "0"
70
+
71
+ # ── effort retitle ────────────────────────────────────────────────────────────────────────────────
72
+ export GH_TITLE="[Effort] 30 · [Core] demo effort"
73
+ fresh
74
+ out="$(effort_retitle 30 2>&1)"; rc=$?
75
+ t "retitle dry run: rc 0" "$rc" "0"
76
+ t "retitle dry run: writes nothing" "$(writes)" "0"
77
+ case "$out" in *"-> [E30] demo effort"*"-> [E30.1] first step"*"dry run: 2 title(s)"*) echo "ok: retitle dry run lists the parent and the legacy sub" ;;
78
+ *) echo "FAIL: retitle dry run output: $out"; fail=1 ;; esac
79
+ case "$out" in *"#302"*) echo "FAIL: retitle lists a title already in the new form"; fail=1 ;; *) echo "ok: retitle skips a title already in the new form" ;; esac
80
+ fresh
81
+ effort_retitle 30 --apply >/dev/null 2>&1; rc=$?
82
+ t "retitle --apply: rc 0" "$rc" "0"
83
+ tc "$GH_LOG" '^PATCH repos/o/r/issues/30 \{"title":"\[E30\] demo effort"\}$' "retitle --apply renames the parent"
84
+ tc "$GH_LOG" '^PATCH repos/o/r/issues/301 \{"title":"\[E30\.1\] first step"\}$' "retitle --apply renames the legacy sub"
85
+ t "retitle --apply: two writes" "$(writes)" "2"
86
+
87
+ # ── start: the token resolves ─────────────────────────────────────────────────────────────────────
88
+ (
89
+ # shellcheck source=/dev/null
90
+ . "$LIB/worktree-start.sh" >/dev/null 2>&1
91
+ export WT_START_REPO="o/r"
92
+ r=0
93
+ [ "$(_wt_resolve_token E545 2>/dev/null)" = 545 ] || { echo "FAIL: E545 -> 545"; r=1; }
94
+ [ "$(_wt_resolve_token E30.2 2>/dev/null)" = 302 ] || { echo "FAIL: E30.2 by title -> 302"; r=1; }
95
+ [ "$(_wt_resolve_token E30.1 2>/dev/null)" = 301 ] || { echo "FAIL: E30.1 by legacy title -> 301"; r=1; }
96
+ [ "$(_wt_resolve_token E40.2 2>/dev/null)" = 402 ] || { echo "FAIL: E40.2 by position -> 402"; r=1; }
97
+ _wt_resolve_token E40.5 >/dev/null 2>&1 && { echo "FAIL: E40.5 should not resolve"; r=1; }
98
+ _wt_resolve_token E4x >/dev/null 2>&1 && { echo "FAIL: E4x is not a token"; r=1; }
99
+ [ "$r" = 0 ] && echo "ok: start resolves E<n>, E<n>.<step> by title, legacy title and position"
100
+ exit "$r"
101
+ ) || fail=1
102
+
103
+ # ── cckit new: a bad standalone title is refused before any write ─────────────────────────────────
104
+ (
105
+ cd "$tmp" || exit 1
106
+ # shellcheck source=/dev/null
107
+ . "$LIB/kit-task-ops.sh"
108
+ r=0
109
+ fresh
110
+ kto_task_new "[E12] an effort title" backend task p2 "" "" "" x >/dev/null 2>&1 && { echo "FAIL: new accepted a prefixed title"; r=1; }
111
+ [ "$(writes)" = 0 ] || { echo "FAIL: new wrote to the forge on a bad title"; r=1; }
112
+ fresh
113
+ kto_task_new "one two three four five six seven" backend task p2 "" "" "" x >/dev/null 2>&1 && { echo "FAIL: new accepted 7 words"; r=1; }
114
+ [ "$(writes)" = 0 ] || { echo "FAIL: new wrote on a long title"; r=1; }
115
+ [ "$r" = 0 ] && echo "ok: cckit new refuses a bad title and writes nothing"
116
+ # The PR title carries the trailing token.
117
+ [ "$(kto_pr_title "[E30.2] second step" "fix the thing" "kind:fix" 302)" = "fix: second step [E30.2]" ] \
118
+ || { echo "FAIL: kto_pr_title sub token: $(kto_pr_title "[E30.2] second step" "fix the thing" "kind:fix" 302)"; r=1; }
119
+ [ "$(kto_pr_title "Fix the thing" "fix the thing" "kind:fix" 42)" = "fix: Fix the thing [#42]" ] \
120
+ || { echo "FAIL: kto_pr_title standalone token: $(kto_pr_title "Fix the thing" "fix the thing" "kind:fix" 42)"; r=1; }
121
+ [ "$r" = 0 ] && echo "ok: cckit pr titles end in the work's token"
122
+ exit "$r"
123
+ ) || fail=1
124
+
125
+ [ "$fail" -eq 0 ] && echo "ALL OK"
126
+ exit "$fail"
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # naming.sh — the ONE title convention (rules/naming-and-ids.md, E546.1). Every verb that creates or
4
+ # titles an issue or a pull request calls naming_title_lint before it writes to the forge, and every
5
+ # verb that reads a title back strips its prefix here, so the generator, the validator and the rule
6
+ # say the same thing.
7
+ #
8
+ # effort [E<n>] <name> e.g. [E545] Every verb answers a question
9
+ # sub [E<n>.<step>] <name> step = the sub's 1-based position in the effort
10
+ # issue <name> a standalone issue: plain outcome, no prefix
11
+ # pr type(scope): subject [E<n>] effort · [E<n>.<step>] sub · [#<n>] standalone
12
+ #
13
+ # The legacy forms `[Effort] N · <name>` and `[Effort N] M · <name>`, with an optional `[Flow] ` tag
14
+ # after the prefix, still parse and still lint, so issues opened before the change stay valid until
15
+ # `cckit effort retitle --apply` renames them. The flow lives in the `flow:` label; no generator
16
+ # writes a `[Flow]` tag any more.
17
+ #
18
+ # Functions:
19
+ # naming_title_lint <effort|sub|issue|pr> <title> rc 0 clean · 1 + reasons on stderr · 2 usage
20
+ # naming_effort_title <n> <name> echo "[E<n>] <name>"
21
+ # naming_sub_title <n> <step> <name> echo "[E<n>.<step>] <name>"
22
+ # naming_strip_prefix <title> echo the name: new or legacy prefix + [Flow] peeled
23
+ # naming_strip_structural <title> the same, with a [Flow] tag kept
24
+ # naming_title_token <title> echo E<n> / E<n>.<step> read from the prefix, or rc 1
25
+ # naming_title_parent <title> echo <n> when the title is a sub of effort n, or rc 1
26
+ # naming_token_parse <token> E545 -> "545" · E545.1 -> "545 1" · else rc 1
27
+ #
28
+ # bash 3.2 compatible; sourceable under zsh (no BASH_REMATCH, no arrays in the pure helpers).
29
+ # errors: strict — a validator: rc 1 on a title that breaks the rule
30
+
31
+ if ! command -v commitlint_check >/dev/null 2>&1; then
32
+ if [ -n "${BASH_SOURCE:-}" ]; then _nm_dir="${BASH_SOURCE[0]}"
33
+ elif [ -n "${ZSH_VERSION:-}" ]; then eval '_nm_dir="${(%):-%x}"'
34
+ else _nm_dir="$0"; fi
35
+ _nm_dir="$(cd "$(dirname "$_nm_dir")" 2>/dev/null && pwd)"
36
+ # shellcheck source=/dev/null
37
+ [ -n "$_nm_dir" ] && [ -f "$_nm_dir/commitlint.sh" ] && . "$_nm_dir/commitlint.sh"
38
+ unset _nm_dir
39
+ fi
40
+
41
+ # The PR token: the work a PR carries, trailing, in square brackets. `[share-<digits>]` is the one
42
+ # documented exception, the title `cckit task share` writes (no issue exists for a share).
43
+ NAMING_PR_TOKEN_RE='\[(E[0-9]+(\.[0-9]+)?|#[0-9]+|share-[0-9]+)\][[:space:]]*$'
44
+
45
+ naming_effort_title() { printf '[E%s] %s' "${1#\#}" "${2:-}"; }
46
+ naming_sub_title() { printf '[E%s.%s] %s' "${1#\#}" "${2:-}" "${3:-}"; }
47
+
48
+ # naming_token_parse <token> — "E545" -> "545", "E545.1" -> "545 1"; brackets and a lowercase e are
49
+ # accepted. rc 1 for anything else.
50
+ naming_token_parse() {
51
+ local t="${1:-}" out
52
+ t="${t#\[}"; t="${t%\]}"
53
+ out="$(printf '%s' "$t" | sed -nE -e 's/^[Ee]([0-9]+)\.([0-9]+)$/\1 \2/p' -e 's/^[Ee]([0-9]+)$/\1/p')"
54
+ [ -n "$out" ] || return 1
55
+ printf '%s\n' "$out"
56
+ }
57
+
58
+ # naming_title_token <title> — the token a title's prefix names: [E545.1] and [Effort 545] 1 · give
59
+ # E545.1; [E545] and [Effort] 545 · give E545. rc 1 for a title with neither prefix.
60
+ naming_title_token() {
61
+ local out
62
+ out="$(printf '%s' "${1:-}" | sed -nE \
63
+ -e 's/^\[E([0-9]+)\.([0-9]+)\] .*/E\1.\2/p' \
64
+ -e 's/^\[E([0-9]+)\] .*/E\1/p' \
65
+ -e 's/^\[Effort ([0-9]+)\] ([0-9]+) ·.*/E\1.\2/p' \
66
+ -e 's/^\[Effort\] ([0-9]+) ·.*/E\1/p' | sed -n 1p)"
67
+ [ -n "$out" ] || return 1
68
+ printf '%s\n' "$out"
69
+ }
70
+
71
+ # naming_title_parent <title> — the effort number of a SUB title, new or legacy. rc 1 otherwise.
72
+ naming_title_parent() {
73
+ local tok; tok="$(naming_title_token "${1:-}")" || return 1
74
+ case "$tok" in *.*) tok="${tok%%.*}"; printf '%s\n' "${tok#E}" ;; *) return 1 ;; esac
75
+ }
76
+
77
+ # naming_strip_structural <title> — peel only the structural prefix, new or legacy (including the
78
+ # number-less `[Effort] · ` placeholder); a `[Flow] ` tag after it is kept.
79
+ naming_strip_structural() {
80
+ printf '%s' "${1:-}" | sed -E \
81
+ -e 's/^\[E[0-9]+(\.[0-9]+)?\] +//' \
82
+ -e 's/^\[Effort( [0-9]+)?\] ([0-9]+ )?· ?//'
83
+ }
84
+
85
+ # naming_strip_prefix <title> — the human name: the structural prefix and then one leading `[Flow] `
86
+ # tag are peeled.
87
+ naming_strip_prefix() {
88
+ naming_strip_structural "${1:-}" | sed -E 's/^\[[A-Za-z]+\] +//'
89
+ }
90
+
91
+ # _naming_name_reasons <name> — the name rules, one failed rule per line on stdout (none = clean).
92
+ # The body of the former effort_title_lint: a short plain-language outcome, ≤ 6 words, no
93
+ # parentheses, sub-clauses, glyphs, code identifiers or words from the jargon list.
94
+ _naming_name_reasons() {
95
+ local name="$1" w wc
96
+ local jargon="${EFFORT_TITLE_JARGON:-chrome seam contract claim rescue stash teardown scaffolding shim boilerplate refactor wiring}"
97
+ [ -n "$(printf '%s' "$name" | tr -d '[:space:]')" ] || { echo "the name is empty — say the outcome"; return 0; }
98
+ case "$name" in *"("*|*")"*) echo "no parentheses — detail goes in the body" ;; esac
99
+ case "$name" in *" — "*|*" · "*|*" / "*) echo "no ' — ' / ' · ' / ' / ' sub-clauses — one clear phrase" ;; esac
100
+ case "$name" in *—*|*▾*|*▸*|*→*|*✓*|*✗*|*…*|*•*) echo "no glyphs (— ▾ ▸ → ✓ ✗ … •) in the title" ;; esac
101
+ if grep -qE '\.(sh|ts|tsx|js|mjs|json|css|md|ya?ml)([^A-Za-z0-9]|$)|[a-z0-9]+_[a-z0-9]+|(^|[^A-Za-z])(scripts|apps|packages|src)/' <<<"$name"; then
102
+ echo "no code identifiers (file names, paths, snake_case) — name the outcome"
103
+ fi
104
+ # One word per line, read back: zsh does not word-split an unquoted expansion.
105
+ printf '%s\n' "$jargon" | tr ' ' '\n' | while IFS= read -r w; do
106
+ [ -n "$w" ] || continue
107
+ grep -qiwE "$w" <<<"$name" && echo "jargon word '$w' — use plain language"
108
+ done
109
+ wc=$(printf '%s\n' "$name" | wc -w | tr -d ' ')
110
+ [ "$wc" -gt 6 ] && echo "name is $wc words — keep it ≤ 6 (detail goes in the body)"
111
+ return 0
112
+ }
113
+
114
+ # naming_title_lint <effort|sub|issue|pr> <title> — rc 0 when <title> follows the rule for <kind>;
115
+ # rc 1 with every failed rule on stderr; rc 2 on a usage error.
116
+ naming_title_lint() {
117
+ local kind="${1:-}" title="${2:-}" name="" reasons="" flow flows
118
+ [ -n "$title" ] || { echo "naming_title_lint: a title is required" >&2; return 2; }
119
+ case "$kind" in
120
+ effort)
121
+ name="$(printf '%s' "$title" | sed -E -e 's/^\[E[0-9]+\] +//' -e 's/^\[Effort\] [0-9]+ · ?//')"
122
+ [ "$name" = "$title" ] && reasons="missing the '[E<n>] ' prefix" ;;
123
+ sub)
124
+ name="$(printf '%s' "$title" | sed -E -e 's/^\[E[0-9]+\.[0-9]+\] +//' -e 's/^\[Effort [0-9]+\] [0-9]+ · ?//')"
125
+ [ "$name" = "$title" ] && reasons="missing the '[E<n>.<step>] ' prefix" ;;
126
+ issue)
127
+ name="$title"
128
+ case "$title" in "["*) reasons="no prefix — a standalone issue title is a plain outcome (an effort is '[E<n>] <name>')" ;; esac ;;
129
+ pr)
130
+ # pr.titleStyle = issue-title: the PR title IS the issue title, and the repo runs no
131
+ # Conventional Commit gate, so only an empty title is refused here.
132
+ [ "${KIT_PR_TITLE_STYLE:-conventional}" = "issue-title" ] && return 0
133
+ if command -v commitlint_check >/dev/null 2>&1; then
134
+ commitlint_check "$title" >/dev/null 2>&1 || reasons="not a Conventional Commit subject — type(scope): subject"
135
+ else
136
+ grep -qE '^[a-z]+(\([a-z0-9][a-z0-9._/-]*\))?!?: [^[:space:]]' <<<"$title" \
137
+ || reasons="not a Conventional Commit subject — type(scope): subject"
138
+ fi
139
+ if ! grep -qE "$NAMING_PR_TOKEN_RE" <<<"$title"; then
140
+ reasons="${reasons:+$reasons
141
+ }no trailing token — end with [E<n>] (effort), [E<n>.<step>] (sub) or [#<n>] (standalone issue)"
142
+ fi ;;
143
+ *) echo "naming_title_lint: kind must be effort, sub, issue or pr (got '$kind')" >&2; return 2 ;;
144
+ esac
145
+
146
+ if [ "$kind" != pr ]; then
147
+ # One optional [Flow] tag is tolerated after an effort or sub prefix (legacy titles carry one);
148
+ # it must come from the flow vocabulary.
149
+ if [ "$kind" != issue ]; then
150
+ flow="$(printf '%s' "$name" | sed -nE 's/^\[([A-Za-z]+)\] +.*/\1/p')"
151
+ if [ -n "$flow" ]; then
152
+ name="$(printf '%s' "$name" | sed -E 's/^\[[A-Za-z]+\] +//')"
153
+ flows="${EFFORT_FLOWS:-Core UI API Docs Infra Auth Data Web App}"
154
+ case " $flows " in
155
+ *" $flow "*) : ;;
156
+ *) reasons="${reasons:+$reasons
157
+ }flow tag [$flow] is not in the vocabulary ($flows)" ;;
158
+ esac
159
+ fi
160
+ fi
161
+ local more; more="$(_naming_name_reasons "$name")"
162
+ [ -n "$more" ] && reasons="${reasons:+$reasons
163
+ }$more"
164
+ fi
165
+
166
+ [ -n "$reasons" ] || return 0
167
+ {
168
+ echo "✗ $kind title breaks the naming rule (rules/naming-and-ids.md): $title"
169
+ printf '%s\n' "$reasons" | sed 's/^/ - /'
170
+ } >&2
171
+ return 1
172
+ }
@@ -63,7 +63,7 @@ has "human: lists the unblocked p2 issue" "$human" "| #5 | S | tidy the par
63
63
  no "human: the blocked issue is not offered" "$human" "ship the report"
64
64
  has "human: recommends the most urgent" "$human" "cckit start 6"
65
65
  has "human: names the cadence" "$human" "Weekly cadence"
66
- has "human: plan on Monday" "$human" 'Monday: `cckit plan`'
66
+ has "human: plan on Monday" "$human" 'Monday: `cckit effort plan --issues`'
67
67
  has "human: next daily" "$human" 'daily: `cckit next`'
68
68
  has "human: gc on Friday" "$human" 'Friday: `cckit gc`'
69
69
  no "human: digest is not in the cadence" "$human" "digest"