@jeiemgi/cckit 0.5.0 → 0.7.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 (144) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +34 -3
  3. package/README.md +95 -6
  4. package/bin/cckit +90 -3
  5. package/cckit.config.json +7 -2
  6. package/kit.config.schema.json +26 -1
  7. package/package.json +1 -1
  8. package/profiles/automation.json +2 -1
  9. package/profiles/content.json +2 -1
  10. package/profiles/minimal.json +2 -1
  11. package/profiles/research.json +2 -1
  12. package/profiles/software.json +2 -1
  13. package/scripts/benchmark/benchmark-test.sh +83 -0
  14. package/scripts/benchmark/gate.sh +55 -0
  15. package/scripts/benchmark/lib/bench-common.sh +70 -0
  16. package/scripts/benchmark/lib/model.sh +116 -0
  17. package/scripts/benchmark/report.sh +105 -0
  18. package/scripts/benchmark/run-quality.sh +102 -0
  19. package/scripts/benchmark/run.sh +166 -0
  20. package/scripts/benchmark/stop-check.sh +83 -0
  21. package/scripts/commitlint-test.sh +58 -0
  22. package/scripts/init.sh +57 -1
  23. package/scripts/kit-self-update.sh +55 -0
  24. package/scripts/lib/board-view-test.sh +1 -0
  25. package/scripts/lib/board-view.sh +1 -0
  26. package/scripts/lib/captain-test.sh +62 -0
  27. package/scripts/lib/captain.sh +105 -17
  28. package/scripts/lib/cckit-output.sh +1 -0
  29. package/scripts/lib/commitlint.sh +54 -0
  30. package/scripts/lib/config-path-test.sh +1 -0
  31. package/scripts/lib/config-path.sh +1 -0
  32. package/scripts/lib/copilot-test.sh +1 -0
  33. package/scripts/lib/copilot.sh +1 -0
  34. package/scripts/lib/effort-dispatch-test.sh +10 -0
  35. package/scripts/lib/effort-flows-test.sh +1 -0
  36. package/scripts/lib/effort-metrics-test.sh +1 -0
  37. package/scripts/lib/effort-metrics.sh +1 -0
  38. package/scripts/lib/effort-ops-test.sh +360 -0
  39. package/scripts/lib/effort-ops.sh +372 -16
  40. package/scripts/lib/effort-parity-test.sh +1 -0
  41. package/scripts/lib/effort-plan.sh +1 -0
  42. package/scripts/lib/effort-slug-test.sh +32 -0
  43. package/scripts/lib/effort-slug.sh +72 -8
  44. package/scripts/lib/effort.sh +1 -0
  45. package/scripts/lib/engine-adapter.sh +1 -0
  46. package/scripts/lib/errors-header-test.sh +86 -0
  47. package/scripts/lib/gh-log.sh +1 -0
  48. package/scripts/lib/gh-project-test.sh +1 -0
  49. package/scripts/lib/gh-project.sh +1 -0
  50. package/scripts/lib/git-remote-test.sh +1 -0
  51. package/scripts/lib/git-remote.sh +1 -0
  52. package/scripts/lib/handoff.sh +23 -2
  53. package/scripts/lib/kit-brief-test.sh +292 -0
  54. package/scripts/lib/kit-brief.sh +376 -0
  55. package/scripts/lib/kit-cli-test.sh +1 -0
  56. package/scripts/lib/kit-cli.sh +1 -0
  57. package/scripts/lib/kit-config-resolve.sh +1 -0
  58. package/scripts/lib/kit-config-test.sh +14 -0
  59. package/scripts/lib/kit-config.sh +7 -0
  60. package/scripts/lib/kit-engine-test.sh +1 -0
  61. package/scripts/lib/kit-events.sh +1 -0
  62. package/scripts/lib/kit-gc-test.sh +125 -0
  63. package/scripts/lib/kit-gc.sh +193 -5
  64. package/scripts/lib/kit-interview-test.sh +1 -0
  65. package/scripts/lib/kit-interview.sh +1 -0
  66. package/scripts/lib/kit-lib-test.sh +226 -0
  67. package/scripts/lib/kit-lib.sh +308 -0
  68. package/scripts/lib/kit-local.sh +1 -0
  69. package/scripts/lib/kit-manifest.sh +1 -0
  70. package/scripts/lib/kit-mode-test.sh +1 -0
  71. package/scripts/lib/kit-mode.sh +1 -0
  72. package/scripts/lib/kit-msg-test.sh +1 -0
  73. package/scripts/lib/kit-msg.sh +1 -0
  74. package/scripts/lib/kit-operate.sh +1 -0
  75. package/scripts/lib/kit-profile-test.sh +1 -0
  76. package/scripts/lib/kit-profile.sh +1 -0
  77. package/scripts/lib/kit-state-test.sh +89 -0
  78. package/scripts/lib/kit-state.sh +61 -0
  79. package/scripts/lib/kit-status-test.sh +233 -0
  80. package/scripts/lib/kit-status.sh +415 -0
  81. package/scripts/lib/kit-task-ops-test.sh +22 -0
  82. package/scripts/lib/kit-task-ops.sh +51 -2
  83. package/scripts/lib/next.sh +1 -0
  84. package/scripts/lib/plan-machine-test.sh +54 -0
  85. package/scripts/lib/plan-machine.sh +86 -25
  86. package/scripts/lib/plan-next-test.sh +1 -0
  87. package/scripts/lib/plan-next.sh +1 -0
  88. package/scripts/lib/pr-evidence-test.sh +259 -0
  89. package/scripts/lib/pr-evidence.sh +220 -35
  90. package/scripts/lib/project-scan.sh +1 -0
  91. package/scripts/lib/react-detect.sh +1 -0
  92. package/scripts/lib/render-test.sh +1 -0
  93. package/scripts/lib/render.sh +1 -0
  94. package/scripts/lib/role-identity.sh +1 -0
  95. package/scripts/lib/secret-guard.sh +21 -1
  96. package/scripts/lib/toon.sh +1 -0
  97. package/scripts/lib/ui.sh +1 -0
  98. package/scripts/lib/version-bump-test.sh +1 -0
  99. package/scripts/lib/version-bump.sh +1 -0
  100. package/scripts/lib/worktree-bootstrap-test.sh +220 -0
  101. package/scripts/lib/worktree-issue-test.sh +15 -1
  102. package/scripts/lib/worktree-issue.sh +23 -8
  103. package/scripts/lib/worktree-start.sh +191 -7
  104. package/scripts/lib/zsh-safety-test.sh +10 -0
  105. package/scripts/orchestrate.sh +8 -1
  106. package/scripts/portable-test.sh +13 -2
  107. package/scripts/self-install-test.sh +282 -0
  108. package/scripts/setup-labels.sh +1 -0
  109. package/scripts/status.sh +68 -40
  110. package/scripts/task-sync.sh +13 -0
  111. package/scripts/ux-a11y-scan.sh +96 -0
  112. package/scripts/ux-ds-audit.sh +146 -0
  113. package/scripts/ux-graph-scan.sh +188 -0
  114. package/skills/kit-autopilot/SKILL.md +6 -1
  115. package/skills/kit-cleanup/SKILL.md +83 -0
  116. package/skills/kit-effort-close/SKILL.md +3 -0
  117. package/skills/kit-effort-new/SKILL.md +7 -0
  118. package/skills/kit-effort-start/SKILL.md +39 -4
  119. package/skills/kit-gc/SKILL.md +19 -0
  120. package/skills/kit-next/SKILL.md +5 -0
  121. package/skills/kit-status/SKILL.md +92 -0
  122. package/skills/kit-task-start/SKILL.md +7 -1
  123. package/skills/kit-ux-audit/SKILL.md +241 -0
  124. package/skills/kit-ux-audit/references/a11y.md +79 -0
  125. package/skills/kit-ux-audit/references/consistency.md +106 -0
  126. package/skills/kit-ux-audit/references/graph-model.md +92 -0
  127. package/skills/kit-ux-audit/references/heuristics.md +157 -0
  128. package/skills/kit-ux-audit/references/report.md +172 -0
  129. package/templates/agents/ux.md +89 -0
  130. package/templates/benchmarks/SCHEMA.md +75 -0
  131. package/templates/benchmarks/abstain.jsonl +8 -0
  132. package/templates/benchmarks/adversarial.jsonl +8 -0
  133. package/templates/benchmarks/benchmark.config.json +14 -0
  134. package/templates/benchmarks/quality.jsonl +8 -0
  135. package/templates/benchmarks/retrieval.jsonl +7 -0
  136. package/templates/rules/branch-naming.md +20 -1
  137. package/templates/rules/communication-style.md +8 -0
  138. package/templates/rules/delegation-brief.md +38 -4
  139. package/templates/rules/effort-model.md +47 -4
  140. package/templates/rules/naming-and-ids.md +199 -0
  141. package/templates/rules/task-management.md +1 -1
  142. package/templates/settings/settings.json.tmpl +9 -0
  143. package/templates/skills/concrete/SKILL.md +117 -0
  144. package/templates/skills/karpathy-guidelines/SKILL.md +1 -0
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env bash
2
+ # ux-ds-audit.sh — deterministic half of /kit-ux-audit's `consistency` lane.
3
+ #
4
+ # Nothing project-specific: the shared-UI barrel, the custom-class prefix and the theme css are all
5
+ # parameters (--primitives / --css-prefix / --css), so it runs against any design system.
6
+ #
7
+ # Emits RAW occurrence lists the `kit-ux-audit` skill classifies (LAYOUT / VISUAL / BEHAVIOR,
8
+ # variant proposals, sibling-screen comparison). Pure grep/perl ($0, no model call, no grep -P),
9
+ # scoped to a path, macOS-safe. This script never decides — it only finds.
10
+ #
11
+ # usage: scripts/ux-ds-audit.sh <path> [--exclude <regex>] [--primitives <index.ts>]
12
+ # [--css-prefix <prefix>] [--css <file.css>]
13
+ # <path> file or directory to audit (e.g. apps/web/src, apps/web/src/app/sign-in)
14
+ # --exclude regex of paths to skip (node_modules/.next/dist always skipped)
15
+ # --primitives the shared UI barrel to read primitive names from (default packages/ui/src/index.ts)
16
+ # --css-prefix custom-class prefix to hunt in TSX/JSX (no default; section 8's TSX hunt is
17
+ # skipped when omitted — the data-* and dead-CSS probes still run)
18
+ # --css theme css file(s) to cross-check custom classes against (repeatable)
19
+ set -eu # no pipefail: many probes end in a grep that legitimately finds nothing
20
+
21
+ USAGE="usage: ux-ds-audit.sh <path> [--exclude re] [--primitives index.ts] [--css-prefix p] [--css file]"
22
+ TARGET=""; EXCLUDE='__never__'; PRIMS="packages/ui/src/index.ts"; CSS_PREFIX=""; CSS_FILES=()
23
+ while [[ $# -gt 0 ]]; do
24
+ case "$1" in
25
+ --exclude|--primitives|--css-prefix|--css)
26
+ if [[ $# -lt 2 || -z "$2" ]]; then echo "ux-ds-audit: $1 needs a value" >&2; echo "$USAGE" >&2; exit 2; fi
27
+ case "$1" in
28
+ --exclude) EXCLUDE="$2" ;;
29
+ --primitives) PRIMS="$2" ;;
30
+ --css-prefix) CSS_PREFIX="$2" ;;
31
+ --css) CSS_FILES+=("$2") ;;
32
+ esac
33
+ shift 2 ;;
34
+ -h|--help) sed -n 2,20p "$0"; exit 0 ;;
35
+ *) TARGET="$1"; shift ;;
36
+ esac
37
+ done
38
+ [[ -n "$TARGET" ]] || { echo "$USAGE" >&2; exit 2; }
39
+ [[ -e "$TARGET" ]] || { echo "ux-ds-audit: no such path: $TARGET" >&2; exit 2; }
40
+
41
+ # The file set — TSX/JSX only, minus build output and the exclude regex.
42
+ files() {
43
+ find "$TARGET" \( -name node_modules -o -name .next -o -name dist -o -name build \) -prune -o \
44
+ -type f \( -name '*.tsx' -o -name '*.jsx' \) -print \
45
+ | grep -Ev "$EXCLUDE" | sort
46
+ }
47
+ FILES=$(files)
48
+ COUNT=$(printf '%s\n' "$FILES" | grep -c . || true)
49
+ g() { printf '%s\n' "$FILES" | xargs grep -nE "$1" 2>/dev/null || true; }
50
+
51
+ section() { printf '\n## %s\n' "$1"; }
52
+ tally() { local n; n=$(printf '%s' "$1" | grep -c . || true); printf '(%s hits)\n' "$n"; }
53
+
54
+ echo "# ux-ds-audit · $TARGET · $COUNT files · $(date +%F)"
55
+ [[ "$EXCLUDE" != "__never__" ]] && echo "excluding: $EXCLUDE"
56
+ echo "primitives barrel: $PRIMS · custom-class prefix: ${CSS_PREFIX:-(none — pass --css-prefix)}"
57
+
58
+ # 1. Shared-UI primitives rendered WITH a className — the variant-candidate pool.
59
+ section "1 PRIMITIVE_CLASSNAME — shared primitives carrying a className (classify LAYOUT / VISUAL / BEHAVIOR)"
60
+ if [[ -f "$PRIMS" ]]; then
61
+ NAMES=$(perl -0ne 'while(/export\s*\{([^}]*)\}/g){for(split /,/,$1){s/^\s+|\s+$//g; next if /^type\s/; next unless /^[A-Z]/; print "$_\n"}}' "$PRIMS" | sort -u | paste -sd'|' -)
62
+ export NAMES
63
+ OUT=$(printf '%s\n' "$FILES" | while IFS= read -r f; do perl -0ne '
64
+ my $names = $ENV{NAMES};
65
+ while (/<($names)\b((?:(?!(?<!=)>)[\s\S])*?)className=\s*(\{[^}]*\}|"[^"]*")/g) {
66
+ my ($c,$cls)=($1,$3); my $ln = (substr($_,0,$-[0]) =~ tr/\n//)+1;
67
+ $cls =~ s/\s+/ /g; print "$ARGV:$ln\t$c\t$cls\n";
68
+ }' "$f"; done)
69
+ tally "$OUT"; printf '%s\n' "$OUT"
70
+ printf '\nper component:\n'; printf '%s\n' "$OUT" | awk -F'\t' 'NF{c[$2]++} END{for(k in c) printf " %3d %s\n", c[k], k}' | sort -rn
71
+ else
72
+ echo "(primitives barrel not found: $PRIMS — pass --primitives; section skipped)"
73
+ fi
74
+
75
+ # 2. Hand-rolled page headers: a heading carrying a type-* / display role.
76
+ section "2 HEADINGS — <h1-3> with a type-*/display role outside a PageHeader primitive (align? eyebrow? actions? → PageHeader variant)"
77
+ OUT=$(g '<h[1-3][^>]*className="[^"]*(type-(hero|section|h1|h2|display|title)|text-(3xl|4xl|5xl))'); tally "$OUT"; printf '%s\n' "$OUT"
78
+
79
+ # 3. Hand-rolled card surfaces: card chrome typed by hand on a non-Card element.
80
+ section "3 CARD_SURFACES — rounded + border + surface/elevated bg typed by hand (→ Card / Card asChild)"
81
+ OUT=$(g 'className="[^"]*rounded-(md|lg|xl|2xl)' | grep -E 'className="[^"]*border(-border)?-(default|subtle|muted)?' | grep -E 'className="[^"]*bg-(surface|elevated|card|background)' | grep -v '<Card' || true)
82
+ tally "$OUT"; printf '%s\n' "$OUT"
83
+
84
+ # 4. Hand-rolled skeletons.
85
+ section "4 SKELETONS — animate-pulse outside the UI package (→ Skeleton); per file + fill-token drift"
86
+ OUT=$(g 'animate-pulse'); tally "$OUT"
87
+ printf '%s\n' "$OUT" | cut -d: -f1 | sort | uniq -c | sort -rn | awk '{printf " %3d %s\n", $1, $2}'
88
+ printf 'fill tokens used: '; printf '%s\n' "$OUT" | grep -oE 'bg-[a-z-]+' | sort | uniq -c | sort -rn | awk '{printf "%s×%s ", $2, $1}'; echo
89
+
90
+ # 5. Status / live-region lines.
91
+ section "5 STATUS_LINES — role=status|alert / aria-live typed by hand (tone drift? → StatusText / Alert)"
92
+ OUT=$(g 'role="(status|alert)"|aria-live='); tally "$OUT"; printf '%s\n' "$OUT"
93
+
94
+ # 6. Raw controls + link-as-text recipes.
95
+ section "6 RAW_CONTROLS — raw <button|input|select|textarea> (→ Button/Input/…) and underline link recipes (→ TextLink)"
96
+ OUT=$(g '<(button|input|select|textarea)\b' | grep -v 'type="hidden"' || true); tally "$OUT"; printf '%s\n' "$OUT"
97
+ printf -- '-- underline links:\n'; OUT=$(g 'className="[^"]*\bunderline\b'); tally "$OUT"; printf '%s\n' "$OUT"
98
+
99
+ # 7. Card grids — distinct recipes, so page ↔ loading drift shows up.
100
+ section "7 CARD_GRIDS — grid grid-cols-* recipes (→ CardGrid variants; page vs loading.tsx must match)"
101
+ OUT=$(g 'className="[^"]*\bgrid\b[^"]*grid-cols-'); tally "$OUT"
102
+ printf '%s\n' "$OUT" | grep -oE 'className="[^"]*"' | perl -pe 's/\b(m[tbxy]?|p[tbxy]?)-[0-9.]+ ?//g; s/[ \t]+/ /g; s/ "/"/g' | sort | uniq -c | sort -rn | awk '{c=$1; $1=""; printf " %3d %s\n", c, $0}'
103
+ printf -- '-- occurrences:\n%s\n' "$OUT"
104
+
105
+ # 8. Custom theme classes + data-* styling hooks in TSX (variants in disguise vs page layout).
106
+ section "8 CUSTOM_CSS — custom classes and data-* styling hooks in TSX (restyling a primitive from outside = variant in disguise)"
107
+ if [[ -n "$CSS_PREFIX" ]]; then
108
+ OUT=$(g "\b${CSS_PREFIX}[a-z0-9-]+"); tally "$OUT"
109
+ printf '%s\n' "$OUT" | grep -oE "\b${CSS_PREFIX}[a-z0-9-]+" | sort | uniq -c | sort -rn | awk '{printf " %3d %s\n", $1, $2}'
110
+ printf -- '-- occurrences:\n%s\n' "$OUT"
111
+ else
112
+ echo "(no --css-prefix — skipping the TSX custom-class hunt; pass one to enable)"
113
+ fi
114
+ printf -- '-- data-* hooks (styling attributes, not Radix state):\n'; g '\bdata-[a-z-]+=(""|\{)' | grep -vE 'data-(slot|state|side|variant|size|orientation|disabled|testid)=' || true
115
+ if [[ -n "$CSS_PREFIX" && ${#CSS_FILES[@]} -gt 0 ]]; then
116
+ printf -- '-- defined in css but ZERO tsx references (dead):\n'
117
+ for css in "${CSS_FILES[@]}"; do
118
+ [[ -f "$css" ]] || { echo " (css not found: $css)"; continue; }
119
+ grep -oE "\.${CSS_PREFIX}[a-z0-9-]+" "$css" | sort -u | tr -d . | while read -r cls; do
120
+ n=$(printf '%s\n' "$FILES" | xargs grep -l "\b$cls\b" 2>/dev/null | wc -l | tr -d ' ')
121
+ if [[ "$n" == "0" ]]; then echo " $cls ($css)"; fi
122
+ done
123
+ done
124
+ printf -- '-- css rules that reach INTO a primitive (descendant selector on a data-slot / role):\n'
125
+ grep -nE "\.${CSS_PREFIX}[a-z0-9-]+[^{]*\[data-slot=|\.${CSS_PREFIX}[a-z0-9-]+[^{]*\[role=" "${CSS_FILES[@]}" 2>/dev/null || echo " (none)"
126
+ fi
127
+
128
+ # 9. Icon size/stroke props — metadata that should live in the primitive.
129
+ section "9 ICON_PROPS — <XxxIcon size={N} strokeWidth={S}> repeated tuples (→ the primitive owns icon sizing)"
130
+ OUT=$(g '<[A-Z][A-Za-z]*Icon\b'); tally "$OUT"
131
+ printf -- '-- occurrences (file:line):\n%s\n' "$OUT"
132
+ printf -- '-- size/stroke tuples:\n'
133
+ printf '%s\n' "$FILES" | xargs perl -0ne 'while(/<[A-Za-z]*Icon\b((?:(?!\/>)[\s\S])*?)\/>/g){my $a=$1; my ($s)=$a=~/size=\{(\d+)\}/; my ($w)=$a=~/strokeWidth=\{([\d.]+)\}/; printf "size=%s stroke=%s\n", $s//"-", $w//"-"}' 2>/dev/null | sort | uniq -c | sort -rn | awk '{printf " %3d %s %s\n", $1, $2, $3}'
134
+
135
+ # 10. Repeated className literals (3+ times, multi-word) — component candidates, with their locations.
136
+ section "10 REPEATED_CLASSNAMES — identical multi-utility className literals appearing 3+ times (→ component or variant)"
137
+ REPEATED=$(printf '%s\n' "$FILES" | xargs grep -ohE 'className="[^"]{24,}"' 2>/dev/null | sort | uniq -c | sort -rn | awk '$1>=3{c=$1; $1=""; sub(/^ /,""); printf "%d\t%s\n", c, $0}' | head -30)
138
+ printf '%s\n' "$REPEATED" | awk -F'\t' 'NF{printf " %3d %s\n", $1, $2}'
139
+ printf -- '-- occurrences (file:line) per repeated literal:\n'
140
+ printf '%s\n' "$REPEATED" | cut -f2 | while IFS= read -r lit; do
141
+ [[ -n "$lit" ]] || continue
142
+ printf ' %s\n' "$lit"
143
+ printf '%s\n' "$FILES" | xargs grep -nF -- "$lit" 2>/dev/null | cut -d: -f1,2 | sed 's|^| |'
144
+ done
145
+
146
+ echo; echo "# end — classify with skills/kit-ux-audit/references/consistency.md"
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env bash
2
+ # ux-graph-scan.sh — deterministic, dependency-free half of /kit-ux-audit (flows lane).
3
+ #
4
+ # Two modes, no model call, no API key:
5
+ # --apps <root> enumerate app-like packages (react/next/vue + a dev script) -> JSON array
6
+ # --scan <dir> build an APPROXIMATE flows graph of one app -> graphify-out/.ux_graph.json
7
+ #
8
+ # The scan is regex over TS/TSX/JSX/Vue, not an AST. It is the fallback for when no
9
+ # graphify-out/graph.json exists; the skill marks the report "graph source: deterministic scan".
10
+ # macOS-safe (no grep -P). Requires: jq, perl. Sources scripts/lib/react-detect.sh for --apps.
11
+ set -eu # no pipefail: many probes end in a grep that legitimately finds nothing
12
+
13
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
14
+ USAGE="usage: ux-graph-scan.sh --apps <root> | --scan <dir> [--exclude <regex>]"
15
+
16
+ MODE=""; ARG=""; EXCLUDE='__never__'
17
+ while [[ $# -gt 0 ]]; do
18
+ case "$1" in
19
+ --apps) MODE="apps"; ARG="${2:-}"; shift 2 ;;
20
+ --scan) MODE="scan"; ARG="${2:-}"; shift 2 ;;
21
+ --exclude)
22
+ [[ $# -ge 2 && -n "${2:-}" ]] || { echo "ux-graph-scan: --exclude needs a value" >&2; exit 2; }
23
+ EXCLUDE="$2"; shift 2 ;;
24
+ -h|--help) echo "$USAGE"; exit 0 ;;
25
+ *) echo "ux-graph-scan: unknown arg: $1" >&2; echo "$USAGE" >&2; exit 2 ;;
26
+ esac
27
+ done
28
+ [[ -n "$MODE" && -n "$ARG" ]] || { echo "$USAGE" >&2; exit 2; }
29
+ command -v jq >/dev/null 2>&1 || { echo "ux-graph-scan: jq required" >&2; exit 3; }
30
+ command -v perl >/dev/null 2>&1 || { echo "ux-graph-scan: perl required" >&2; exit 3; }
31
+
32
+ # ----------------------------------------------------------------------------- apps
33
+ if [[ "$MODE" == "apps" ]]; then
34
+ [[ -d "$ARG" ]] || { echo "ux-graph-scan: no such dir: $ARG" >&2; exit 2; }
35
+ # shellcheck source=/dev/null
36
+ [[ -f "$HERE/lib/react-detect.sh" ]] && . "$HERE/lib/react-detect.sh"
37
+ printf '['
38
+ first=1
39
+ while IFS= read -r pkg; do
40
+ dir="$(dirname "$pkg")"
41
+ case "$dir" in *node_modules*|*/.next/*|*/dist/*) continue ;; esac
42
+ has_dev="$(jq -r '(.scripts.dev // .scripts.start // "") | if . == "" then "0" else "1" end' "$pkg" 2>/dev/null || echo 0)"
43
+ deps="$(jq -r '((.dependencies // {}) + (.devDependencies // {})) | keys[]?' "$pkg" 2>/dev/null || true)"
44
+ fw=""
45
+ printf '%s\n' "$deps" | grep -qx next && fw="next"
46
+ [[ -z "$fw" ]] && printf '%s\n' "$deps" | grep -qx '@react-router/dev' && fw="react-router"
47
+ [[ -z "$fw" ]] && printf '%s\n' "$deps" | grep -qx nuxt && fw="nuxt"
48
+ [[ -z "$fw" ]] && printf '%s\n' "$deps" | grep -qx astro && fw="astro"
49
+ [[ -z "$fw" ]] && printf '%s\n' "$deps" | grep -qx vue && fw="vue"
50
+ [[ -z "$fw" ]] && printf '%s\n' "$deps" | grep -qx react && fw="react"
51
+ [[ -n "$fw" && "$has_dev" == "1" ]] || continue
52
+ router="unknown"
53
+ if declare -f react_detect >/dev/null 2>&1; then
54
+ react_detect "$dir" || true
55
+ [[ "$fw" == "next" && -d "$dir/app" ]] && router="app-router"
56
+ [[ "$fw" == "next" && -d "$dir/pages" ]] && router="pages-router"
57
+ [[ "$REACT_ROUTER_LIB" == "true" ]] && router="react-router-lib"
58
+ fi
59
+ [[ "$fw" == "astro" && -d "$dir/src/pages" ]] && router="file-routes"
60
+ [[ ( "$fw" == "vue" || "$fw" == "nuxt" ) && -d "$dir/pages" ]] && router="file-routes"
61
+ name="$(jq -r '.name // ""' "$pkg" 2>/dev/null)"; [[ -n "$name" ]] || name="$(basename "$dir")"
62
+ [[ $first == 1 ]] || printf ','
63
+ first=0
64
+ jq -n --arg n "$name" --arg d "$dir" --arg f "$fw" --arg r "$router" \
65
+ '{name:$n, dir:$d, framework:$f, router:$r}'
66
+ done < <(find "$ARG" -name node_modules -prune -o -name package.json -type f -print 2>/dev/null | sort)
67
+ printf ']\n'
68
+ exit 0
69
+ fi
70
+
71
+ # ----------------------------------------------------------------------------- scan
72
+ [[ -d "$ARG" ]] || { echo "ux-graph-scan: no such dir: $ARG" >&2; exit 2; }
73
+ TARGET="$ARG"
74
+ OUTDIR="$TARGET/graphify-out"
75
+ mkdir -p "$OUTDIR"
76
+ OUT="$OUTDIR/.ux_graph.json"
77
+
78
+ FILES="$(find "$TARGET" \( -name node_modules -o -name .next -o -name dist -o -name build \) -prune -o \
79
+ -type f \( -name '*.tsx' -o -name '*.jsx' -o -name '*.ts' -o -name '*.vue' \) -print 2>/dev/null \
80
+ | grep -Ev "$EXCLUDE" | sort || true)"
81
+ NFILES="$(printf '%s\n' "$FILES" | grep -c . || true)"
82
+
83
+ # One perl pass over every file emits TSV rows the jq step below folds into nodes/edges.
84
+ # row kinds: N<TAB>id<TAB>kind<TAB>label<TAB>file<TAB>metaJson
85
+ # E<TAB>from<TAB>to<TAB>type<TAB>viaJson
86
+ # -0777 -n => one iteration per @ARGV file, $_ = whole file, $ARGV = that file.
87
+ perl -0777 -ne '
88
+ my $rel = $ARGV;
89
+ $rel =~ s{^\./}{};
90
+ # ---- node kind from path -------------------------------------------------
91
+ my $kind = "component";
92
+ my $isRoute = 0;
93
+ if ($rel =~ m{(?:^|/)(?:src/)?app/(?:.*/)?page\.(?:tsx|jsx|ts)$}) { $kind="screen"; $isRoute=1 }
94
+ elsif ($rel =~ m{(?:^|/)(?:src/)?pages/(?!_)[^.].*\.(?:tsx|jsx)$}) { $kind="screen"; $isRoute=1 }
95
+ elsif ($rel =~ m{(?:^|/)(?:src/)?routes/.*\.(?:tsx|jsx)$}) { $kind="screen"; $isRoute=1 }
96
+ elsif ($rel =~ m{\.route\.(?:tsx|jsx|ts)$}) { $kind="screen"; $isRoute=1 }
97
+ elsif ($rel =~ m{(?:^|/)(?:src/)?app/(?:.*/)?layout\.(?:tsx|jsx|ts)$}) { $kind="container" }
98
+ elsif ($rel =~ m{[Ll]ayout\.(?:tsx|jsx)$}) { $kind="container" }
99
+ my $id = "$kind:$rel";
100
+ # ---- route path -------------------------------------------------------
101
+ my $route = "";
102
+ if ($isRoute) {
103
+ ($route = $rel) =~ s{^.*?(?:^|/)(?:src/app|src/pages|src/routes|app|pages|routes)/}{};
104
+ $route =~ s{/?(?:page|index|route)\.(?:tsx|jsx|ts)$}{};
105
+ $route =~ s{\.(?:tsx|jsx)$}{};
106
+ $route =~ s{\((\w+)\)/?}{}g; # route groups
107
+ $route =~ s{\[\.\.\.(\w+)\]}{*}g;
108
+ $route =~ s{\[(\w+)\]}{:$1}g;
109
+ $route = "/$route"; $route =~ s{//+}{/}g; $route =~ s{/$}{} ;
110
+ $route = "/" if $route eq "";
111
+ }
112
+ my $entry = ($route =~ m{^/(|dashboard|home|inicio|overview|app)$}) ? "true" : "false";
113
+ my $meta = sprintf(q({"route":"%s","entry":%s}), $route, $entry);
114
+ print "N\t$id\t$kind\t$route\t$rel\t$meta\n";
115
+
116
+ # ---- imports / renders ---------------------------------------------------
117
+ while (/import\s+(?:\*\s+as\s+\w+|\{[^}]*\}|\w+)\s+from\s+["'\''](\.[^"'\'']+|\@\/[^"'\'']+)["'\'']/g) {
118
+ my $spec = $1;
119
+ print "E\t$id\timport:$spec\timports\t{}\n";
120
+ }
121
+ # ---- navigation -------------------------------------------------------
122
+ while (/(?:href|to)=\s*["'\''](\/[A-Za-z0-9_\-\/:*]*)["'\'']/g) { print "E\t$id\troute:$1\tnavigates-to\t{}\n"; }
123
+ while (/(?:router\.push|router\.replace|redirect|navigate)\(\s*["'\''](\/[A-Za-z0-9_\-\/:*]*)["'\'']/g) { print "E\t$id\troute:$1\tnavigates-to\t{}\n"; }
124
+ my $navcnt = () = /<Link\b|useNavigate\(|router\.(push|replace)/g;
125
+ print "N\t$id.navmeta\t_navmeta\t\t$rel\t{\"nav\":$navcnt}\n" if $navcnt;
126
+
127
+ # ---- data reads / writes / mutations ----------------------------------
128
+ # prisma.<model>.<op>
129
+ while (/\bprisma\.(\w+)\.(\w+)/g) {
130
+ my ($m,$op)=($1,$2); my $ent = ucfirst($m); $ent =~ s/s$//;
131
+ my $t = ($op=~/delete|deleteMany|remove/i) ? "mutates" : ($op=~/create|update|upsert|insert|createMany|updateMany/i ? "writes" : "reads");
132
+ print "E\t$id\tdata-entity:$ent\t$t\t{\"op\":\"$op\"}\n";
133
+ }
134
+ # supabase .from("table")
135
+ while (/\.from\(\s*["'\''](\w+)["'\'']\s*\)/g) { my $ent=ucfirst($1); $ent=~s/s$//; print "E\t$id\tdata-entity:$ent\treads\t{}\n"; }
136
+ # react-query / swr hooks: useXxxQuery / useXxxMutation
137
+ while (/\buse(\w+?)(Query|Mutation|SuspenseQuery)\b/g) {
138
+ my ($ent,$hook)=($1,$2); next if $ent eq "";
139
+ my $t = ($hook eq "Mutation") ? "writes" : "reads";
140
+ $t = "mutates" if $ent =~ /Delete|Remove|Archive/;
141
+ $ent =~ s/(Delete|Remove|Archive|Create|Update|List|Get)//g; next if $ent eq "";
142
+ print "E\t$id\tdata-entity:$ent\t$t\t{\"via\":\"hook\"}\n";
143
+ }
144
+ # server actions / loaders
145
+ print "E\t$id\tdata-entity:_loader\treads\t{}\n" if /useLoaderData\(|createServerFn\(|export\s+async\s+function\s+loader/;
146
+
147
+ # ---- forms -----------------------------------------------------------
148
+ if (/useForm\s*\(|<Formik\b|<form\b|zodResolver\(/) {
149
+ my $fields = () = /<(input|select|textarea|Controller)\b|\bregister\(\s*["'\'']/g;
150
+ my $req = () = /\brequired\b|\.min\(1|nonempty\(/g;
151
+ my $multi = ($rel =~ /step|wizard|stepper/i) ? "true" : "false";
152
+ my $stepper= (/<Stepper\b|<Steps\b|currentStep|activeStep/) ? "true" : "false";
153
+ my $draft = (/autosave|useAutoSave|draft|localStorage\.setItem/) ? "true" : "false";
154
+ my $fid = "form:$rel";
155
+ printf("N\t%s\tform\t%s\t%s\t{\"fields\":%d,\"required\":%d,\"multi\":%s,\"stepper\":%s,\"draft\":%s}\n",
156
+ $fid, "form in $rel", $rel, $fields, $req, $multi, $stepper, $draft);
157
+ print "E\t$id\t$fid\trenders\t{}\n";
158
+ }
159
+ ' -- $FILES > "$OUTDIR/.ux_scan_rows.tsv" 2>/dev/null || true
160
+
161
+ # Fold rows -> {meta,nodes,edges}. Import edges are resolved to file ids by suffix match in the
162
+ # skill's normalize step (graph-model.md); here we keep them raw but deduplicated.
163
+ jq -Rn --arg target "$TARGET" --arg n "$NFILES" '
164
+ [ inputs | select(length>0) | split("\t") ] as $rows
165
+ | ( [ $rows[] | select(.[0]=="N" and .[2]!="_navmeta") ]
166
+ | map({id:.[1], kind:.[2], label:(.[3]//""), file:.[4], meta:(try (.[5]|fromjson) catch {})})
167
+ | unique_by(.id) ) as $nodes
168
+ | ( [ $rows[] | select(.[0]=="E") ]
169
+ | map({from:.[1], to:.[2], type:.[3], meta:(try (.[4]|fromjson) catch {})})
170
+ | unique_by("\(.from)|\(.to)|\(.type)") ) as $edges
171
+ | { meta: {
172
+ target: $target, files_scanned: ($n|tonumber),
173
+ generated_at: (now | todateiso8601),
174
+ note: "approximate: regex scan, not an AST"
175
+ },
176
+ nodes: $nodes, edges: $edges,
177
+ stats: {
178
+ nodes: ($nodes|length), edges: ($edges|length),
179
+ screens: ([$nodes[]|select(.kind=="screen")]|length),
180
+ containers: ([$nodes[]|select(.kind=="container")]|length),
181
+ forms: ([$nodes[]|select(.kind=="form")]|length),
182
+ entities: ([$edges[]|select(.to|startswith("data-entity:"))|.to]|unique|length)
183
+ } }
184
+ ' "$OUTDIR/.ux_scan_rows.tsv" > "$OUT"
185
+
186
+ rm -f "$OUTDIR/.ux_scan_rows.tsv"
187
+ SCREENS="$(jq -r '.stats.screens' "$OUT")"; EDGES="$(jq -r '.stats.edges' "$OUT")"
188
+ echo "ux-graph-scan: $NFILES files -> $OUT ($SCREENS screens, $EDGES edges) [approximate]"
@@ -26,12 +26,17 @@ scripts; it never reimplements looping or orchestration.
26
26
  back to the human to confirm a planned step.** "Do these efforts with the new flow", an approved
27
27
  `kit effort plan`, or a green wave are an **established plan**: execute it end to end —
28
28
  build a wave → merge its PRs → close subs+parent → gc → launch the next wave — **without asking
29
- "merge or review?"**. A planned merge is _execution_, not a new decision. (José, "Error 1", 2026-06-28.)
29
+ "merge or review?"**. A planned merge is _execution_, not a new decision (the canonical "Error 1" incident: stalling an approved plan to ask for a routine merge).
30
30
 
31
31
  - The human steers the **plan**, not each merge. Asking to confirm a routine planned merge is the error.
32
32
  - A `risk:med` change the plan already approved (a product feature in the agreed scope) is **not** a
33
33
  reason to stop — the plan blessed it. The risk-tiered review tiers
34
34
  (`risk-tiered-review.md`) govern **ad-hoc** PRs, **not** execution of an approved plan.
35
+ - **The permission is shipped, not improvised.** `cckit init` scaffolds a **versioned**
36
+ `.claude/settings.json` (from `templates/settings/settings.json.tmpl`) whose explicit
37
+ `Bash(gh pr merge:*)` allow pre-authorizes the wave-merge — checked in, so it travels to every
38
+ worktree and collaborator (the gitignored `settings.local.json` does not). A captain merge that
39
+ still prompts means the project predates the template: re-run `cckit init --upgrade`.
35
40
 
36
41
  ### Ping the human ONLY on a genuine blocker
37
42
 
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: kit-cleanup
3
+ description: Run the ONE guided destructive sweep over the repo — present the gc plan (SAFE / ZOMBIE / ORPHAN / PROTECTED / stashes), then delete only the SAFE rows and prune the listed ZOMBIE metadata after the user confirms. Orphan branches, open-issue branches, and stashes are surfaced and left alone.
4
+ when_to_use: When `cckit gc` (or the SessionStart hygiene hook) reports merged branches and worktrees piling up and you want them gone in one pass. Use this instead of hand-rolling `git branch -D` + `git push origin --delete` loops. For the read-only report alone, use `/kit-gc`.
5
+ ---
6
+
7
+ # kit-cleanup — the guided destructive sweep
8
+
9
+ Plugin-direct skill — helpers resolve from `${CLAUDE_PLUGIN_ROOT}`.
10
+
11
+ `/kit-gc` classifies; **this skill acts on that classification.** It is the only place in the kit
12
+ that deletes a branch the user did not name, so the whole design is plan-first.
13
+
14
+ **Safety contract:** the plan names **everything** `--yes` can touch — branches, worktrees *and*
15
+ ZOMBIE admin metadata, so no deletion escapes the user's veto. A zombie's staged work is committed
16
+ to its branch **before** its metadata is pruned (recover-before-prune), and the plan says so per
17
+ row. `--yes` is the only thing that deletes a **cleanup target** (a
18
+ branch, a worktree, a remote ref, a listed zombie's metadata), and three buckets are not deletable
19
+ at all. A plan-only run still
20
+ prunes stale *remote-tracking metadata*, because it refreshes them to classify — see step 3. Table
21
+ below. It reuses
22
+ `kit_gc_analyze` as the single classifier rather than re-deriving verdicts, so `gc` and `cleanup`
23
+ can never disagree about what is safe to delete.
24
+
25
+ ## Execution
26
+
27
+ ### 1. Show the plan (read-only)
28
+
29
+ ```bash
30
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
31
+ KIT_GC_REPO="$KIT_REPO" source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-gc.sh"
32
+ kit_gc_cleanup # plan only — deletes no branch, worktree, remote ref or stash
33
+ ```
34
+
35
+ Or through the CLI: `cckit cleanup` (add `--llm` for JSON counts).
36
+
37
+ ### 2. Present it and ask
38
+
39
+ Show the user the bucket table and **ask for confirmation before running with `--yes`**. Let them
40
+ veto per-bucket — if they want the orphans looked at first, do that before deleting anything.
41
+
42
+ | Bucket | Rule | `--yes` does |
43
+ | --- | --- | --- |
44
+ | **SAFE** | PR `MERGED`, issue closed/absent, unprotected | **deletes** the worktree, the local branch, and the remote ref *if* the branch was level with it |
45
+ | **PROTECTED** | associated issue **still OPEN** | **keeps** — close the issue first |
46
+ | **ORPHAN** | local commits not on the base branch's remote, no merged PR | **keeps** — offer to recover into a PR (step 4) |
47
+ | **ZOMBIE** | worktree dir gone, admin metadata lingers | **recovers** any staged delta to a commit on its branch, **then prunes** the metadata |
48
+ | **stashes** | any stash entry | **keeps** — irreversible; drop only after showing each diff |
49
+
50
+ ### 3. Execute
51
+
52
+ ```bash
53
+ kit_gc_cleanup --yes # or: cckit cleanup --yes
54
+ ```
55
+
56
+ Level-ness is recorded **before** the local prune — once the local ref is gone there is nothing left
57
+ to compare. It requires **exact equality in both directions**: `origin/<b>..<b>` alone only proves
58
+ local ⊆ remote, so a remote-ahead branch would otherwise lose remote-only history. A local delete is
59
+ likewise skipped when the branch is ahead of its remote (`git branch -D` is a force delete). A remote
60
+ delete that fails (protected ref, already gone) is reported, counted on the `remote deletes failed`
61
+ line (`remote_failed` in `--llm`), and makes the verb exit non-zero — a partial sweep is never
62
+ reported as a complete one. It is never retried blindly.
63
+
64
+ The plan-only path does perform one write: `kit_gc_analyze` refreshes remote-tracking refs
65
+ (`git fetch --prune`) so the classification is not made against a stale remote. It touches no branch,
66
+ worktree, stash, or commit.
67
+
68
+ ### 4. Orphan handling
69
+
70
+ For each orphan with unique unpushed work: **do not delete.** Recover it into a clean PR off the base
71
+ branch (branch from `$BASE`, `git checkout <orphan> -- <paths>`, commit, push, open a PR) so the user
72
+ decides merge vs close. Same contract as `/kit-gc` step 4.
73
+
74
+ ## Rules
75
+
76
+ - **Plan first, always.** Never run `--yes` before the user has seen the plan and said go.
77
+ - **Never** delete an ORPHAN branch, a PROTECTED branch, or a stash — those are irreversible or hold
78
+ the only copy of work. `cleanup` cannot do it; do not work around it with raw git.
79
+ - **Never** delete the base branch (`main`/`develop`) or an open-PR branch — the classifier keeps
80
+ both, and that is load-bearing, not incidental.
81
+ - A **dirty worktree is skipped with a warning**, not destroyed (recover-before-prune).
82
+ - If the protection helper cannot load, the sweep **aborts** rather than classify anything — a wrong
83
+ "safe" is far worse than a refusal. Same contract as `/kit-gc`.
@@ -102,3 +102,6 @@ effort_close "$NUM"
102
102
  - Never force-push to trunk; never delete the default branch.
103
103
  - **Heed the kit-sync warning:** a kit-managed change that isn't contributed upstream is a latent
104
104
  regression the next `/kit-update` can revert. Treat the warning as a to-do.
105
+ - Closing frees a **WIP slot**: the core's GC deletes the `effort/<N>-<slug>` branch, which is what
106
+ `cckit effort start`'s WIP limit counts (`effort.wipLimit`, default 2). If a start was just
107
+ refused, this is the op that unblocks it — not `--force`.
@@ -92,6 +92,13 @@ echo "✓ effort #$PARENT_NUM created — next: /kit-effort-start $PARENT_NUM"
92
92
  - **Carry the flow + the chain** — set `Flow` so the title shows `[Flow]` and the `flow:<flow>` label
93
93
  is applied; pass `Depends on #N` so the native GitHub `blocked_by` edge + a `## Relations` line make
94
94
  the chain visible on the board. `ctx:*` (session weight) is applied automatically.
95
+ - **Order EXISTING issues with `cckit effort chain <a> <b> …`**, not by hand — it sets each
96
+ successor's `blocked_by` edge and writes the same `- Depends on #<predecessor>` line through the
97
+ same formatter `--depends-on` uses. It is idempotent and additive (a pre-existing blocker is
98
+ kept), and it refuses the whole chain — writing nothing — on fewer than two numbers, a
99
+ non-numeric argument, an issue that does not exist, a repeated number, or an edge that would
100
+ close a cycle. Use it when the sub-issues already exist and only their ORDER is missing;
101
+ `--depends-on` covers the dependencies known at creation time.
95
102
  - The parent body MUST carry all four template sections (Goal / Scope / For agents / Verification) —
96
103
  a missing section is a review blocker.
97
104
  - Sub-issues are **native** GitHub sub-issues (`POST …/issues/{parent}/sub_issues` with the child's
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kit-effort-start
3
- description: Start an effort — thin caller of `cckit effort start <N>`. Creates the `effort/<N>-<slug>` integration branch + isolated bootstrapped worktree from the base branch, then marks the parent issue In Progress on the board. Sub-issues later branch from this effort branch or commit directly on it.
3
+ description: Start an effort — thin caller of `cckit effort start <N>`. Creates the `effort/<N>-<slug>` integration branch + isolated bootstrapped worktree from the base branch, then marks the parent issue In Progress on the board. Enforces the effort WIP limit (`effort.wipLimit`, default 2) — a new effort is refused, before anything is written, while that many are already in progress; `--force` starts anyway. Sub-issues later branch from this effort branch or commit directly on it.
4
4
  when_to_use: After `/kit-effort-new`, to begin building an effort. The effort branch is the single integration branch for the whole effort — its sub-issues merge into it, and exactly one PR opens from it (`/kit-effort-pr`). See rules/effort-model.md.
5
5
  ---
6
6
 
@@ -14,12 +14,19 @@ title composer, #121). The dispatcher loads the project config first (#151), so
14
14
  owns ALL of the mechanics:
15
15
 
16
16
  - resolving `<N|slug>` to the parent effort issue (slug handles work too)
17
+ - the **WIP limit**: refusing a NEW effort once `effort.wipLimit` (default 2) are already in
18
+ progress — see below
17
19
  - fresh fetch of the base branch + branch `effort/<N>-<slug>` — always `effort/`, regardless of
18
20
  the parent's `kind:` label (branch-naming.md)
19
21
  - the isolated worktree at `.claude/worktrees/effort+<N>-<slug>` (reused if the branch already
20
22
  exists; the dir name encodes #N so `kit-gc` won't wipe it while the issue is open)
21
23
  - **bootstrap** (`wt_bootstrap`): copies gitignored `.env.local*` + project ids, assigns a
22
- per-worktree dev PORT, installs deps (`KIT_WT_INSTALL=0` opts out)
24
+ per-worktree dev PORT, installs deps **at the selected targets**, in this
25
+ precedence: `worktree.installPaths` if set (those dirs only, installed whether or not each one
26
+ declares dependencies; `[]` = nothing), else the root *only when* its manifest declares
27
+ dependencies or it is a workspace root *with at least one member*, else
28
+ nothing — a dependency-free root never gets a stray empty `pnpm-lock.yaml`, and an `installPaths`
29
+ entry that escapes the worktree is refused. `KIT_WT_INSTALL=0` opts out entirely
23
30
  - the live-session **collision guard**: refuses to disturb a worktree a live session is sitting in
24
31
 
25
32
  ## Inputs
@@ -28,6 +35,28 @@ owns ALL of the mechanics:
28
35
  | ------------ | -------- | -------------------------------------------------------------- |
29
36
  | Issue number | ✓ | The **parent** effort issue `N` (or its slug handle) |
30
37
  | Slug | optional | Short kebab-case suffix; defaults to a slug of the issue title |
38
+ | `--force` | optional | Start past the WIP limit (`KIT_FORCE=1` does the same) |
39
+
40
+ ## The WIP limit
41
+
42
+ The verb refuses to start a **new** effort once `effort.wipLimit` (default **2**) are already in
43
+ progress. **In progress** = an `effort/<N>-<slug>` branch exists, as a local head **or** on origin —
44
+ read with `git ls-remote`, not the cached `refs/remotes`, so a branch pushed since your last fetch
45
+ counts and one deleted on origin does not. `EFFORT_WIP_REMOTE=0` skips that query and counts the
46
+ cached refs instead; an unreachable origin falls back to them with a warning, never a failure. The
47
+ verb creates that branch and `effort close` deletes it. The board Status is NOT the signal
48
+ (the board step below is additive and skipped when Projects v2 is off).
49
+
50
+ - **At** the limit refuses; only strictly under it starts. `0` freezes new efforts **unless forced**.
51
+ - Re-running the verb on an effort already in progress is never gated — it adds no WIP.
52
+ - The check runs before the fetch/branch/worktree/bootstrap, so a refusal makes **no branch, no
53
+ worktree and no board change**. It is not read-free: the gate queries origin, and a `<slug>`
54
+ argument is resolved first, which can run `gh issue list`.
55
+ - Do not paper over a refusal. Report it and let the human decide: close an effort
56
+ (`/kit-effort-close`), or re-run with `--force`. Only pass `--force` when the human asked for it.
57
+ - `EFFORT_WIP_LIMIT` overrides the configured limit for one invocation; a configured value that is
58
+ not a non-negative integer is ignored with a warning and the default `2` is used.
59
+ - `cckit start <issue>` (a plain task worktree, `/kit-task-start`) has **no** WIP limit.
31
60
 
32
61
  > **One effort = one branch = one worktree** (effort-model.md). Sub-issues either commit directly
33
62
  > on this branch (sequential — one commit per sub-issue, that commit's diff IS the sub's work
@@ -38,9 +67,13 @@ owns ALL of the mechanics:
38
67
 
39
68
  ```bash
40
69
  cckit effort start <N> # or: cckit effort start <N> <slug-override>
70
+ cckit effort start --force <N> # only when the human asked to start past the WIP limit
41
71
  # cckit not on PATH? "${CLAUDE_PLUGIN_ROOT}/bin/cckit" effort start <N>
42
72
  ```
43
73
 
74
+ A WIP-limit refusal exits **1** and prints what is in progress. Nothing was created — surface the
75
+ message, do not retry with `--force` on your own.
76
+
44
77
  The last stdout line is machine-readable — `<worktree-path>|<branch>|<parent-issue>` — then ALL
45
78
  effort work continues **inside the worktree**:
46
79
 
@@ -79,5 +112,7 @@ fi
79
112
  - **Worktree always** — one branch per worktree, never share a checkout.
80
113
  - Sub-issue branches are `sub/<N><letter>-<slug>` off THIS branch and **never open their own PR to
81
114
  the base branch** — they merge into `effort/<N>`.
82
- - Safe to re-run for the parent: the verb reuses an existing branch/worktree and refuses to
83
- disturb one a live session owns.
115
+ - Safe to re-run for the parent: the verb reuses an existing branch/worktree, refuses to
116
+ disturb one a live session owns, and never applies the WIP limit to an effort already in progress.
117
+ - **One effort at a time (within the limit)** — the WIP limit exists so efforts finish. When it
118
+ fires, close something rather than forcing past it.
@@ -11,6 +11,10 @@ Plugin-direct skill — helpers resolve from `${CLAUDE_PLUGIN_ROOT}`.
11
11
  Cleans what accumulates: merged-but-undeleted branches (local + remote), orphan
12
12
  worktrees, stale stashes, orphan unpushed commits, and stale-open issues.
13
13
 
14
+ > This skill is the **read-only classifier**. To act on its verdicts in one guided pass, use
15
+ > **`/kit-cleanup`** (`cckit cleanup`) — it consumes this same `kit_gc_analyze` output, so the two
16
+ > can never disagree about what is safe to delete.
17
+
14
18
  **Safety contract:** read-only **analysis first** → present a plan → only delete
15
19
  after the user confirms. Never touch: the base branch (`main`/`develop`), branches
16
20
  with an **open PR**, worktrees of an open-PR branch, **a branch/worktree whose
@@ -19,9 +23,24 @@ branch's remote** (orphan work is surfaced, never auto-deleted).
19
23
 
20
24
  > **Worktree↔issue association.** A branch `<kind>/<N>-<slug>` (or worktree dir
21
25
  > `<kind>+<N>-<slug>`) belongs to issue **#N** — derived from the name, not registered.
26
+ > The effort **sub** form counts too: `sub/<N><letter>-<slug>` / `sub+<N><letter>-<slug>`
27
+ > (`rules/effort-model.md`) resolves to the parent effort **#N**, so live subs of an open
28
+ > effort are protected. Exactly ONE trailing lowercase letter is a suffix — anything else
29
+ > (`16a04`, `1604a4`, `1604A`) is not an issue number and yields no association at all.
30
+ > The suffix is honored for **any** lowercase kind, not only `sub` (`feat/1604a-x` → #1604).
31
+ > That is deliberate: a spurious association can only ever *add* protection — an unrelated
32
+ > #N is either open (keep) or closed/absent (no claim asserted) — while narrowing it to `sub`
33
+ > would let gc delete a misnamed live branch.
22
34
  > `gc` resolves #N and **refuses to remove anything whose issue is still open, even
23
35
  > with no PR yet** — this protects in-progress worktrees that haven't opened a PR.
24
36
  > Helper: `${CLAUDE_PLUGIN_ROOT}/scripts/lib/worktree-issue.sh` (`wt_issue_number`, `wt_protected_reason`).
37
+ >
38
+ > **The protection helper is mandatory.** `kit_gc_analyze` / `kit_gc_prune` load it via
39
+ > `_kit_gc_require_deps` and **abort with a FATAL (rc=1) if it cannot be sourced** — without it
40
+ > every issue-open check returns empty and the whole repo classifies as SAFE. A refusal is the
41
+ > correct outcome; never present a degraded analysis as a deletion plan. The dir resolution
42
+ > works under bash **and zsh** (`BASH_SOURCE` is bash-only, so zsh silently switched the
43
+ > protection off before #219).
25
44
 
26
45
  ## Execution
27
46
 
@@ -29,6 +29,11 @@ cckit next
29
29
  Prints the unblocked set (wave 0 of the plan) and the single recommended next issue with its start
30
30
  command. `--effort <N>` scopes it to one effort's sub-issues.
31
31
 
32
+ The unblocked set is ordered by the `priority:pN` label — **p0 → p1 → p2 → p3**, unlabeled last —
33
+ so the recommended issue is the most urgent thing that is actually startable. Ties keep their
34
+ existing order. Priority never jumps a dependency: an issue only reaches wave 0 once every blocker
35
+ is closed, so a low-priority blocker is always offered before the high-priority issue it gates.
36
+
32
37
  Then start the top one in its own worktree + branch:
33
38
 
34
39
  ```