@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.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +21 -8
- package/README.md +119 -20
- package/bin/cckit +42 -16
- package/cckit.config.json +1 -1
- package/commands/kit-doctor.md +3 -1
- package/commands/kit-update.md +9 -4
- package/kit.config.schema.json +25 -0
- package/package.json +1 -1
- package/scripts/annotate-setup.sh +7 -2
- package/scripts/capture-project-ids.sh +23 -10
- package/scripts/init-upgrade-test.sh +35 -1
- package/scripts/init.sh +43 -7
- package/scripts/kit-doctor.sh +185 -7
- package/scripts/kit-version-check-test.sh +36 -0
- package/scripts/kit-version-check.sh +19 -4
- package/scripts/kit-wire.sh +4 -1
- package/scripts/knowledge-lint.sh +4 -1
- package/scripts/lib/board-view-test.sh +54 -0
- package/scripts/lib/board-view.sh +80 -0
- package/scripts/lib/captain-test.sh +18 -0
- package/scripts/lib/captain.sh +92 -5
- package/scripts/lib/config-path-test.sh +47 -0
- package/scripts/lib/config-path.sh +29 -0
- package/scripts/lib/copilot.sh +9 -9
- package/scripts/lib/effort-dispatch-test.sh +25 -0
- package/scripts/lib/effort-flows-test.sh +55 -0
- package/scripts/lib/effort-metrics-test.sh +57 -0
- package/scripts/lib/effort-metrics.sh +19 -5
- package/scripts/lib/effort-ops-test.sh +110 -3
- package/scripts/lib/effort-ops.sh +480 -50
- package/scripts/lib/effort-parity-test.sh +128 -0
- package/scripts/lib/effort-slug-test.sh +87 -0
- package/scripts/lib/effort-slug.sh +104 -0
- package/scripts/lib/effort.sh +91 -1
- package/scripts/lib/gh-project-test.sh +95 -0
- package/scripts/lib/gh-project.sh +22 -7
- package/scripts/lib/git-remote-test.sh +57 -0
- package/scripts/lib/git-remote.sh +21 -0
- package/scripts/lib/kit-config-test.sh +37 -0
- package/scripts/lib/kit-config.sh +38 -13
- package/scripts/lib/kit-engine-test.sh +9 -0
- package/scripts/lib/kit-events.sh +5 -3
- package/scripts/lib/kit-gc-test.sh +88 -0
- package/scripts/lib/kit-gc.sh +136 -19
- package/scripts/lib/kit-local.sh +8 -1
- package/scripts/lib/kit-operate.sh +17 -2
- package/scripts/lib/next.sh +3 -3
- package/scripts/lib/plan-next-test.sh +87 -0
- package/scripts/lib/plan-next.sh +212 -0
- package/scripts/lib/project-scan.sh +7 -1
- package/scripts/lib/worktree-start.sh +12 -3
- package/scripts/lib/zsh-safety-test.sh +73 -0
- package/scripts/portable-test.sh +62 -20
- package/scripts/setup-labels.sh +13 -2
- package/scripts/showcase.sh +13 -4
- package/scripts/status-test.sh +63 -0
- package/scripts/status.sh +12 -4
- package/scripts/task-sync.sh +79 -10
- package/skills/kit-autopilot/SKILL.md +5 -0
- package/skills/{docs-writer → kit-docs-writer}/SKILL.md +2 -2
- package/skills/kit-effort-close/SKILL.md +52 -104
- package/skills/kit-effort-new/SKILL.md +40 -112
- package/skills/kit-effort-pr/SKILL.md +6 -2
- package/skills/kit-effort-start/SKILL.md +44 -46
- package/skills/kit-next/SKILL.md +4 -0
- package/skills/kit-plan-next/SKILL.md +82 -0
- package/skills/kit-task-start/SKILL.md +44 -55
- package/templates/CLAUDE.md.tmpl +1 -1
- package/templates/agents/auto-dev.md +1 -1
- package/templates/hooks/mempal_session_start.sh.tmpl +36 -2
- package/templates/rules/effort-model.md +43 -6
- package/templates/rules/mempalace.md +1 -0
- package/templates/rules/plan-next.md +58 -0
- package/templates/rules/task-management.md +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# git-remote.sh — derive the project's repo identity from its git remote (#73). The local directory
|
|
4
|
+
# is often cloned/renamed to something other than the repo name, so NAME / slug / wing should come
|
|
5
|
+
# from the ACTUAL remote repo name; the directory basename is only the LAST resort. Pure git + sed —
|
|
6
|
+
# no gh, no network, host-agnostic (github.com, GHE, GitLab, ssh/https). bash 3.2 + zsh compatible.
|
|
7
|
+
#
|
|
8
|
+
# git_remote_slug [dir] -> "owner/repo" from origin (rc 1 + empty when no remote)
|
|
9
|
+
# git_remote_repo_name [dir] -> "repo"
|
|
10
|
+
# git_remote_owner [dir] -> "owner"
|
|
11
|
+
|
|
12
|
+
git_remote_slug() {
|
|
13
|
+
local dir="${1:-$PWD}" url
|
|
14
|
+
url="$(git -C "$dir" remote get-url origin 2>/dev/null || true)"
|
|
15
|
+
[ -n "$url" ] || return 1
|
|
16
|
+
# Strip any scheme/host prefix (git@host:, ssh://git@host/, https://host/) and the trailing .git.
|
|
17
|
+
printf '%s' "$url" | sed -E 's#^[a-z]+://[^/]+/##; s#^git@[^:]+:##; s#\.git$##; s#/$##'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
git_remote_repo_name() { local s; s="$(git_remote_slug "${1:-$PWD}")" || return 1; printf '%s' "${s##*/}"; }
|
|
21
|
+
git_remote_owner() { local s; s="$(git_remote_slug "${1:-$PWD}")" || return 1; printf '%s' "${s%%/*}"; }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# kit-config-test.sh — covers load_kit_config resolution that adoption depends on. Today: the
|
|
4
|
+
# integration-branch fallback chain (#117) — a host project that names its integration branch under
|
|
5
|
+
# an alternate key (integrationBranch / flow) must still resolve, not silently fall back to "main".
|
|
6
|
+
# Hermetic: throwaway config files pointed at via KIT_CONFIG. Run: bash scripts/lib/kit-config-test.sh
|
|
7
|
+
set -u
|
|
8
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
9
|
+
LIB="$ROOT/scripts/lib"
|
|
10
|
+
fail=0
|
|
11
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
12
|
+
command -v jq >/dev/null 2>&1 || { echo "kit-config-test: jq required — skipping"; exit 0; }
|
|
13
|
+
|
|
14
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
15
|
+
|
|
16
|
+
# base_branch_for <json> — resolve KIT_BASE_BRANCH for a given github config, hermetically.
|
|
17
|
+
base_branch_for() {
|
|
18
|
+
local json="$1" d; d="$(mktemp -d "$tmp/cfg.XXXXXX")"
|
|
19
|
+
printf '%s' "$json" > "$d/cckit.config.json"
|
|
20
|
+
KIT_CONFIG="$d/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; printf '%s' \"\$KIT_BASE_BRANCH\""
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# baseBranch is canonical and wins over the alternate keys.
|
|
24
|
+
t "baseBranch wins" \
|
|
25
|
+
"$(base_branch_for '{"github":{"baseBranch":"develop","integrationBranch":"x","flow":"y"}}')" "develop"
|
|
26
|
+
# integrationBranch is honored when baseBranch is absent (older/alternate host config).
|
|
27
|
+
t "integrationBranch fallback" \
|
|
28
|
+
"$(base_branch_for '{"github":{"integrationBranch":"integration","flow":"y"}}')" "integration"
|
|
29
|
+
# flow is the last named fallback before the default.
|
|
30
|
+
t "flow fallback" \
|
|
31
|
+
"$(base_branch_for '{"github":{"flow":"trunk"}}')" "trunk"
|
|
32
|
+
# nothing set -> "main", the safe default.
|
|
33
|
+
t "default main when unset" \
|
|
34
|
+
"$(base_branch_for '{"github":{}}')" "main"
|
|
35
|
+
|
|
36
|
+
[ "$fail" -eq 0 ] && echo "ALL OK (kit-config)" || echo "kit-config: FAILURES"
|
|
37
|
+
exit "$fail"
|
|
@@ -6,13 +6,24 @@
|
|
|
6
6
|
# Per-folder overrides: any .claudekit/config.json in an ancestor directory is deep-merged over the
|
|
7
7
|
# project config, nearest-wins (like .editorconfig). Projects with no .claudekit/ behave unchanged.
|
|
8
8
|
|
|
9
|
+
# Source the ONE shared config-path resolver (config-path.sh, #69). Self-locate portably: BASH_SOURCE
|
|
10
|
+
# is bash-only (empty under zsh, where dirname "" -> CWD and the lib is sought in the wrong dir), so
|
|
11
|
+
# use zsh's %x prompt escape there. eval keeps bash from parsing the zsh-only syntax.
|
|
12
|
+
if ! command -v kit_config_path >/dev/null 2>&1; then
|
|
13
|
+
if [ -n "${BASH_SOURCE:-}" ]; then _kc_self="${BASH_SOURCE[0]}"
|
|
14
|
+
elif [ -n "${ZSH_VERSION:-}" ]; then eval '_kc_self="${(%):-%x}"'
|
|
15
|
+
else _kc_self="$0"; fi
|
|
16
|
+
_kc_dir="$(cd "$(dirname "$_kc_self")" && pwd)"
|
|
17
|
+
# shellcheck source=/dev/null
|
|
18
|
+
[ -f "$_kc_dir/config-path.sh" ] && . "$_kc_dir/config-path.sh"
|
|
19
|
+
unset _kc_self _kc_dir
|
|
20
|
+
fi
|
|
21
|
+
|
|
9
22
|
load_kit_config() {
|
|
10
|
-
# Resolve the project config
|
|
11
|
-
#
|
|
12
|
-
local cfg="$
|
|
13
|
-
|
|
14
|
-
if [[ -f cckit.config.json ]]; then cfg="cckit.config.json"; else cfg=".claude/kit.config.json"; fi
|
|
15
|
-
fi
|
|
23
|
+
# Resolve the project config through the ONE shared resolver: an explicit KIT_CONFIG wins, else
|
|
24
|
+
# walk up for a root cckit.config.json or a .claude/kit.config.json.
|
|
25
|
+
local cfg; cfg="$(kit_config_path 2>/dev/null || true)"
|
|
26
|
+
[[ -n "$cfg" ]] || cfg=".claude/kit.config.json"
|
|
16
27
|
if [[ ! -f "$cfg" ]]; then
|
|
17
28
|
echo "✗ $cfg not found. Run /kit-init (or scripts/init.sh) first." >&2
|
|
18
29
|
return 1
|
|
@@ -30,10 +41,16 @@ load_kit_config() {
|
|
|
30
41
|
|
|
31
42
|
export KIT_REPO="$(jq -r '.github.repo' "$cfg")"
|
|
32
43
|
export KIT_OWNER="$(jq -r '.github.owner' "$cfg")"
|
|
33
|
-
|
|
44
|
+
# Integration branch, resolved through a fallback chain so a host project that names its
|
|
45
|
+
# integration branch under an older/alternate key still works on adoption: baseBranch (canonical)
|
|
46
|
+
# -> integrationBranch -> flow -> "main". First non-null wins (#117).
|
|
47
|
+
export KIT_BASE_BRANCH="$(jq -r '.github.baseBranch // .github.integrationBranch // .github.flow // "main"' "$cfg")"
|
|
34
48
|
export KIT_PROJECTS_V2="$(jq -r '.github.projectsV2' "$cfg")"
|
|
35
49
|
export KIT_PROJECT_NUMBER="$(jq -r '.github.projectNumber' "$cfg")"
|
|
36
50
|
export KIT_PROJECT_TITLE="$(jq -r '.github.projectTitle' "$cfg")"
|
|
51
|
+
# Board owner type — "user" or "organization". A board can live under a user OR an org login, and
|
|
52
|
+
# every projectV2-by-number GraphQL query must select the matching root, so capture this once (#118).
|
|
53
|
+
export KIT_PROJECT_OWNER_TYPE="$(jq -r '.github.projectOwnerType // "user"' "$cfg")"
|
|
37
54
|
|
|
38
55
|
export KIT_PLANS_FORMAT="$(jq -r '.plans.format' "$cfg")"
|
|
39
56
|
export KIT_PLANS_DIR="$(jq -r '.plans.dir' "$cfg")"
|
|
@@ -59,6 +76,10 @@ load_kit_config() {
|
|
|
59
76
|
KIT_MILESTONES="$(jq -r '.milestones[]? // empty' "$cfg")"
|
|
60
77
|
export KIT_ROLES KIT_MILESTONES
|
|
61
78
|
|
|
79
|
+
# Effort flow vocabulary (effort.flows[]) — space-joined so effort.sh can resolve EFFORT_FLOWS
|
|
80
|
+
# from the project config (#150). Empty when unconfigured (effort.sh keeps its built-in default).
|
|
81
|
+
export KIT_EFFORT_FLOWS="$(jq -r '[.effort.flows[]? | tostring] | join(" ")' "$cfg")"
|
|
82
|
+
|
|
62
83
|
# Apply per-folder .claudekit/ overrides (no-op when none exist).
|
|
63
84
|
_kit_apply_claudekit_overlays "$cfg"
|
|
64
85
|
}
|
|
@@ -83,11 +104,15 @@ _kit_apply_claudekit_overlays() {
|
|
|
83
104
|
merged="$(jq -s '.[0] * .[1]' <(printf '%s' "$merged") "$o" 2>/dev/null || printf '%s' "$merged")"
|
|
84
105
|
done
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
export
|
|
91
|
-
export
|
|
107
|
+
# Named `_kit_cfg_get`, not `g`: a one-letter `g` collides with a universal `alias g=git` when
|
|
108
|
+
# this file is sourced under zsh (interactive shells) -> "defining function based on alias" parse
|
|
109
|
+
# error. A namespaced name can never be an alias.
|
|
110
|
+
_kit_cfg_get() { printf '%s' "$merged" | jq -r "$1" 2>/dev/null; }
|
|
111
|
+
export KIT_LANG="$(_kit_cfg_get '.project.language // env.KIT_LANG')"
|
|
112
|
+
export KIT_PLANS_FORMAT="$(_kit_cfg_get '.plans.format // env.KIT_PLANS_FORMAT')"
|
|
113
|
+
export KIT_ANNOTATE_ENABLED="$(_kit_cfg_get '.annotate.enabled // false')"
|
|
114
|
+
export KIT_ANNOTATE_BACKEND="$(_kit_cfg_get '.annotate.backend // ""')"
|
|
115
|
+
export KIT_ANNOTATE_FRAMEWORK="$(_kit_cfg_get '.annotate.framework // ""')"
|
|
116
|
+
export KIT_EFFORT_FLOWS="$(_kit_cfg_get '[.effort.flows[]? | tostring] | join(" ")')"
|
|
92
117
|
export KIT_EFFECTIVE_CONFIG="$merged"
|
|
93
118
|
}
|
|
@@ -80,6 +80,15 @@ if [ -n "${KIT_ENGINE_TEST_INNER:-}" ]; then
|
|
|
80
80
|
printf 'USER EDIT\n' > dst.txt
|
|
81
81
|
KIT_ASSUME_YES= kit_op_write src.txt dst.txt A wire </dev/null >/dev/null 2>&1
|
|
82
82
|
t "conffiles keeps edit" "$(cat dst.txt)" "USER EDIT"
|
|
83
|
+
# conffiles hard rule (#149): KIT_ASSUME_YES never consents to clobbering an edited file
|
|
84
|
+
KIT_ASSUME_YES=1 kit_op_write src.txt dst.txt A wire >/dev/null 2>&1
|
|
85
|
+
t "assume-yes keeps edit (rc)" "$?" "10"
|
|
86
|
+
t "assume-yes keeps edit" "$(cat dst.txt)" "USER EDIT"
|
|
87
|
+
# ...nor an UNTRACKED pre-existing file with different content (never touch what we don't own)
|
|
88
|
+
printf 'PRE-EXISTING\n' > pre.txt
|
|
89
|
+
KIT_ASSUME_YES=1 kit_op_write src.txt pre.txt A wire >/dev/null 2>&1
|
|
90
|
+
t "untracked existing kept (rc)" "$?" "10"
|
|
91
|
+
t "untracked existing kept" "$(cat pre.txt)" "PRE-EXISTING"
|
|
83
92
|
# remove untracked refuses
|
|
84
93
|
printf 'z\n' > untracked2.txt
|
|
85
94
|
KIT_ASSUME_YES=1 kit_op_remove untracked2.txt >/dev/null 2>&1
|
|
@@ -43,8 +43,10 @@ emit_event() {
|
|
|
43
43
|
[[ -n "$payload" ]] || payload='{}'
|
|
44
44
|
command -v jq >/dev/null 2>&1 || return 0
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
path
|
|
46
|
+
# `logpath`, not `path`: under zsh `path` is tied to PATH (special array); assigning to a bare
|
|
47
|
+
# `path` local would clobber the command search path. A namespaced name is inert.
|
|
48
|
+
local logpath ts line
|
|
49
|
+
logpath="$(kit_events_path)" || return 0
|
|
48
50
|
ts="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
49
51
|
|
|
50
52
|
# Build the line with jq so payload is validated + the record is well-formed.
|
|
@@ -58,5 +60,5 @@ emit_event() {
|
|
|
58
60
|
'{ts:$ts, type:$type, op:$op, payload:{note:$raw}}' 2>/dev/null)" || return 0
|
|
59
61
|
|
|
60
62
|
# Single-writer append; >> is atomic for short lines on local fs.
|
|
61
|
-
printf '%s\n' "$line" >> "$
|
|
63
|
+
printf '%s\n' "$line" >> "$logpath" 2>/dev/null || return 0
|
|
62
64
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# kit-gc-test.sh — covers the recover-before-prune contract (#111). A ZOMBIE worktree (working dir
|
|
4
|
+
# gone, admin metadata lingers) can hold staged-but-uncommitted work in its admin index — the sole
|
|
5
|
+
# blob->path map. `git worktree prune` deletes that index, orphaning the blobs (real data loss). gc
|
|
6
|
+
# must (a) detect zombies + staged deltas as their own analysis bucket, (b) recover any staged delta
|
|
7
|
+
# to its branch as a commit BEFORE pruning, and (c) never prune in a dry-run.
|
|
8
|
+
# Hermetic: a throwaway git repo, no network/gh. Run: bash scripts/lib/kit-gc-test.sh
|
|
9
|
+
set -u
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
11
|
+
LIB="$ROOT/scripts/lib"
|
|
12
|
+
fail=0
|
|
13
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
14
|
+
has(){ case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> '$2' lacks '$3'"; fail=1 ;; esac; }
|
|
15
|
+
command -v git >/dev/null 2>&1 || { echo "kit-gc-test: git required" >&2; exit 1; }
|
|
16
|
+
|
|
17
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
18
|
+
export KIT_GC_REPO="o/r"
|
|
19
|
+
|
|
20
|
+
# ── fabricate a zombie worktree with a staged delta ─────────────────────────────────────────────
|
|
21
|
+
cd "$tmp"
|
|
22
|
+
git init -q main
|
|
23
|
+
cd main
|
|
24
|
+
git config user.email t@t; git config user.name t
|
|
25
|
+
echo "base" > base.txt; git add base.txt; git commit -q -m "init"
|
|
26
|
+
git worktree add -q ../wt -b feat/5-recover >/dev/null 2>&1
|
|
27
|
+
# Stage a NEW file inside the worktree (writes the worktree's admin index; the blob lands in the
|
|
28
|
+
# shared object store and so survives the worktree dir's death).
|
|
29
|
+
echo "precious staged work" > ../wt/keep.txt
|
|
30
|
+
git -C ../wt add keep.txt
|
|
31
|
+
TIP_BEFORE="$(git rev-parse --verify refs/heads/feat/5-recover)"
|
|
32
|
+
# Kill the worktree dir — the crash/ephemeral-mount death that leaves a zombie.
|
|
33
|
+
rm -rf ../wt
|
|
34
|
+
|
|
35
|
+
# shellcheck source=/dev/null
|
|
36
|
+
source "$LIB/kit-gc.sh"
|
|
37
|
+
|
|
38
|
+
# ── (a) detection: the zombie + its staged delta show up as their own bucket ─────────────────────
|
|
39
|
+
z="$(_kit_gc_zombies)"
|
|
40
|
+
has "zombie detected with its branch" "$z" "feat/5-recover"
|
|
41
|
+
case "$z" in *" yes"*) echo "ok: zombie flagged as STAGED" ;; *) echo "FAIL: zombie not flagged staged: $z"; fail=1 ;; esac
|
|
42
|
+
analysis="$(kit_gc_analyze 2>/dev/null)"
|
|
43
|
+
has "analyze lists a zombies bucket" "$analysis" "# zombies"
|
|
44
|
+
has "analyze flags STAGED work in the zombie" "$analysis" "ZOMBIE with STAGED work"
|
|
45
|
+
|
|
46
|
+
# ── (c) dry-run recovers NOTHING (no new commit, admin dir intact) ──────────────────────────────
|
|
47
|
+
kit_gc_recover_zombies 0 >/dev/null 2>&1
|
|
48
|
+
t "dry-run leaves the branch tip unchanged" "$(git rev-parse --verify refs/heads/feat/5-recover)" "$TIP_BEFORE"
|
|
49
|
+
[ -d "$(git rev-parse --git-common-dir)/worktrees/wt" ] && echo "ok: dry-run leaves the admin dir intact" || { echo "FAIL: dry-run removed the admin dir"; fail=1; }
|
|
50
|
+
|
|
51
|
+
# ── (b) recover-before-prune: the staged delta lands as a commit on the branch ──────────────────
|
|
52
|
+
kit_gc_recover_zombies 1 >/dev/null 2>&1
|
|
53
|
+
TIP_AFTER="$(git rev-parse --verify refs/heads/feat/5-recover)"
|
|
54
|
+
[ "$TIP_AFTER" != "$TIP_BEFORE" ] && echo "ok: recovery advanced the branch to a new commit" || { echo "FAIL: branch tip did not advance"; fail=1; }
|
|
55
|
+
t "the recovered commit's parent is the old tip" "$(git rev-parse --verify "${TIP_AFTER}^")" "$TIP_BEFORE"
|
|
56
|
+
# The staged file is present in the recovered commit's tree with its exact content.
|
|
57
|
+
has "recovered commit carries the staged file" "$(git ls-tree -r --name-only "$TIP_AFTER")" "keep.txt"
|
|
58
|
+
t "recovered file content is intact" "$(git show "$TIP_AFTER:keep.txt")" "precious staged work"
|
|
59
|
+
|
|
60
|
+
# ── prune gating: `git worktree prune` only removes the admin dir after recovery ─────────────────
|
|
61
|
+
git worktree prune 2>/dev/null || true
|
|
62
|
+
[ -d "$(git rev-parse --git-common-dir)/worktrees/wt" ] && { echo "FAIL: admin dir survived prune"; fail=1; } || echo "ok: admin dir pruned after the work was recovered"
|
|
63
|
+
|
|
64
|
+
# ── #124: single-call PR index + local lookup ───────────────────────────────────────────────────
|
|
65
|
+
IDX="$(printf 'feat/1-a\tPR#11 MERGED\nfeat/2-b\tPR#22 OPEN')"
|
|
66
|
+
t "pr index lookup finds a branch" "$(_kit_gc_pr_for "$IDX" feat/1-a)" "PR#11 MERGED"
|
|
67
|
+
t "pr index lookup finds another branch" "$(_kit_gc_pr_for "$IDX" feat/2-b)" "PR#22 OPEN"
|
|
68
|
+
t "pr index lookup misses an absent branch" "$(_kit_gc_pr_for "$IDX" feat/9-z)" ""
|
|
69
|
+
|
|
70
|
+
# kit_gc_analyze must issue exactly ONE `gh pr list` regardless of branch count (no per-branch N+1).
|
|
71
|
+
git branch feat/30-x >/dev/null 2>&1; git branch feat/31-y >/dev/null 2>&1; git branch feat/32-z >/dev/null 2>&1
|
|
72
|
+
stub="$tmp/ghbin"; mkdir -p "$stub"
|
|
73
|
+
cat > "$stub/gh" <<'SH'
|
|
74
|
+
#!/usr/bin/env bash
|
|
75
|
+
echo "$*" >> "$GH_CALLS"
|
|
76
|
+
case "$1 $2" in
|
|
77
|
+
"pr list") printf 'feat/30-x\tPR#30 MERGED\n' ;;
|
|
78
|
+
"issue view") echo "open" ;;
|
|
79
|
+
*) : ;;
|
|
80
|
+
esac
|
|
81
|
+
SH
|
|
82
|
+
chmod +x "$stub/gh"
|
|
83
|
+
export GH_CALLS="$tmp/ghcalls"; : > "$GH_CALLS"
|
|
84
|
+
PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze >/dev/null 2>&1
|
|
85
|
+
t "kit_gc_analyze makes exactly ONE gh pr list call" "$(grep -c '^pr list' "$GH_CALLS")" "1"
|
|
86
|
+
|
|
87
|
+
[ "$fail" -eq 0 ] && echo "ALL OK (kit-gc)" || echo "kit-gc: FAILURES"
|
|
88
|
+
exit "$fail"
|
package/scripts/lib/kit-gc.sh
CHANGED
|
@@ -29,27 +29,47 @@ _kit_gc_load_deps() {
|
|
|
29
29
|
[ -f "$d/worktree-issue.sh" ] && . "$d/worktree-issue.sh"
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
# _kit_gc_pr_index [repo] — echo one "<headRefName>\tPR#<num> <STATE>" line per PR in ONE gh call, so
|
|
33
|
+
# branch classification is a local lookup instead of a per-branch `gh pr list --head` — an N+1 that
|
|
34
|
+
# scaled badly exactly when gc matters most (many stale branches). #124.
|
|
35
|
+
_kit_gc_pr_index() {
|
|
36
|
+
local repo="${1:-$KIT_GC_REPO}"
|
|
37
|
+
gh pr list --repo "$repo" --state all --limit 200 --json number,state,headRefName \
|
|
38
|
+
--jq '.[] | "\(.headRefName)\tPR#\(.number) \(.state)"' 2>/dev/null || true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# _kit_gc_pr_for <index> <branch> — first PR line matching <branch> as head (mirrors the old `.[0]`).
|
|
42
|
+
_kit_gc_pr_for() {
|
|
43
|
+
printf '%s\n' "$1" | awk -F'\t' -v want="$2" '$1==want{print $2; exit}'
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
# kit_gc_analyze — read-only classification of worktrees, branches, and stashes. Writes NOTHING.
|
|
33
47
|
# Each row is tagged PROTECTED / SAFE / ACTIVE / ORPHAN so a human or UI can decide what to prune.
|
|
34
48
|
kit_gc_analyze() {
|
|
35
49
|
_kit_gc_load_deps
|
|
36
|
-
|
|
50
|
+
# `wtpath`, not `path`: under zsh `path` is tied to PATH (special array), so a bare `path` local
|
|
51
|
+
# here would clobber the command search path on assignment. A namespaced name is inert.
|
|
52
|
+
local repo="$KIT_GC_REPO" b ref wtpath reason pr prot
|
|
37
53
|
git fetch origin --prune --quiet 2>/dev/null || true
|
|
38
54
|
|
|
39
55
|
echo "# worktrees"
|
|
40
56
|
git worktree list --porcelain 2>/dev/null \
|
|
41
57
|
| awk '/^worktree /{w=$2} /^branch /{print w" "$2}' \
|
|
42
|
-
| while read -r
|
|
58
|
+
| while read -r wtpath ref; do
|
|
43
59
|
b="${ref#refs/heads/}"
|
|
44
60
|
reason="$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)"
|
|
45
|
-
if [ -n "$reason" ]; then echo " $
|
|
46
|
-
else echo " $
|
|
61
|
+
if [ -n "$reason" ]; then echo " $wtpath [$b] -> PROTECTED: $reason"
|
|
62
|
+
else echo " $wtpath [$b] -> prunable if PR merged"; fi
|
|
47
63
|
done
|
|
48
64
|
|
|
49
65
|
echo "# branches"
|
|
50
|
-
|
|
66
|
+
# All PRs in ONE call, indexed locally by head branch (#124). while-read (NOT `for b in $(...)`) so
|
|
67
|
+
# branch iteration survives a NUL-polluted IFS.
|
|
68
|
+
local pr_index; pr_index="$(_kit_gc_pr_index "$repo")"
|
|
69
|
+
git branch --format='%(refname:short)' 2>/dev/null | while IFS= read -r b; do
|
|
70
|
+
[ -n "$b" ] || continue
|
|
51
71
|
case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main) echo " $b -> ACTIVE (base branch)"; continue;; esac
|
|
52
|
-
pr="$(
|
|
72
|
+
pr="$(_kit_gc_pr_for "$pr_index" "$b")"
|
|
53
73
|
prot="$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)"
|
|
54
74
|
if [ -n "$prot" ]; then
|
|
55
75
|
echo " $b -> PROTECTED: $prot"
|
|
@@ -64,6 +84,21 @@ kit_gc_analyze() {
|
|
|
64
84
|
|
|
65
85
|
echo "# stashes"
|
|
66
86
|
git stash list 2>/dev/null | sed 's/^/ /' || true
|
|
87
|
+
|
|
88
|
+
echo "# zombies (worktree dir gone, admin metadata lingers)"
|
|
89
|
+
local zname zbranch zstaged found=0
|
|
90
|
+
while IFS="$(printf '\t')" read -r zname zbranch zstaged; do
|
|
91
|
+
[ -n "$zname" ] || continue
|
|
92
|
+
found=1
|
|
93
|
+
if [ "$zstaged" = yes ]; then
|
|
94
|
+
echo " $zname [$zbranch] -> ZOMBIE with STAGED work — recover-before-prune (gc --prune --yes recovers it to a commit)"
|
|
95
|
+
else
|
|
96
|
+
echo " $zname [$zbranch] -> ZOMBIE (no staged delta) — prunable"
|
|
97
|
+
fi
|
|
98
|
+
done <<EOF
|
|
99
|
+
$(_kit_gc_zombies)
|
|
100
|
+
EOF
|
|
101
|
+
[ "$found" -eq 1 ] || echo " (none)"
|
|
67
102
|
}
|
|
68
103
|
|
|
69
104
|
# kit_gc_has_prunable — rc 0 if at least one branch is SAFE to delete (a merged, unprotected branch).
|
|
@@ -71,6 +106,73 @@ kit_gc_has_prunable() {
|
|
|
71
106
|
kit_gc_analyze 2>/dev/null | grep -q '> SAFE '
|
|
72
107
|
}
|
|
73
108
|
|
|
109
|
+
# _kit_gc_zombies — echo "<name>\t<branch>\t<staged:yes|no>" for each ZOMBIE worktree: its working
|
|
110
|
+
# dir is gone but its admin metadata (<git-common-dir>/worktrees/<name>/) lingers. staged=yes when
|
|
111
|
+
# the admin index holds a tree that differs from the branch tip (staged-but-uncommitted work that
|
|
112
|
+
# `git worktree prune` would orphan). Writes NOTHING. bash 3.2.
|
|
113
|
+
_kit_gc_zombies() {
|
|
114
|
+
local common wdir name gitdir wtpath branch tree tip tiptree staged
|
|
115
|
+
common="$(git rev-parse --git-common-dir 2>/dev/null)" || return 0
|
|
116
|
+
case "$common" in /*) : ;; *) common="$(cd "$common" 2>/dev/null && pwd)" || return 0 ;; esac
|
|
117
|
+
[ -d "$common/worktrees" ] || return 0
|
|
118
|
+
for wdir in "$common"/worktrees/*/; do
|
|
119
|
+
[ -d "$wdir" ] || continue
|
|
120
|
+
gitdir="$(cat "$wdir/gitdir" 2>/dev/null)"; wtpath="${gitdir%/.git}"
|
|
121
|
+
# A zombie: the recorded working-tree path is set but no longer exists on disk.
|
|
122
|
+
[ -n "$wtpath" ] && [ ! -e "$wtpath" ] || continue
|
|
123
|
+
name="$(basename "$wdir")"
|
|
124
|
+
branch="$(sed -n 's#^ref: refs/heads/##p' "$wdir/HEAD" 2>/dev/null)"
|
|
125
|
+
tree=""; [ -f "$wdir/index" ] && tree="$(GIT_INDEX_FILE="$wdir/index" git write-tree 2>/dev/null)"
|
|
126
|
+
tip="$(git rev-parse --verify --quiet "refs/heads/${branch}" 2>/dev/null)"
|
|
127
|
+
tiptree=""; [ -n "$tip" ] && tiptree="$(git rev-parse --verify --quiet "${tip}^{tree}" 2>/dev/null)"
|
|
128
|
+
if [ -n "$tree" ] && [ "$tree" != "$tiptree" ]; then staged=yes; else staged=no; fi
|
|
129
|
+
printf '%s\t%s\t%s\n' "$name" "${branch:-?}" "$staged"
|
|
130
|
+
done
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# kit_gc_recover_zombies <yes> — the recover-before-prune mechanic (#111). For each ZOMBIE worktree
|
|
134
|
+
# holding staged-but-uncommitted work, recover that delta to its branch via plumbing BEFORE any
|
|
135
|
+
# prune: GIT_INDEX_FILE=<admin>/index git write-tree -> git commit-tree -p <tip> -> update-ref. With
|
|
136
|
+
# <yes>=1 it performs the recovery + sweeps that zombie's stale locks; otherwise it reports what it
|
|
137
|
+
# WOULD recover (dry-run). Never prunes; that stays with the caller (gated on --yes). bash 3.2.
|
|
138
|
+
kit_gc_recover_zombies() {
|
|
139
|
+
local yes="${1:-0}" common wdir name gitdir wtpath branch tree tip tiptree newc msg
|
|
140
|
+
common="$(git rev-parse --git-common-dir 2>/dev/null)" || return 0
|
|
141
|
+
case "$common" in /*) : ;; *) common="$(cd "$common" 2>/dev/null && pwd)" || return 0 ;; esac
|
|
142
|
+
[ -d "$common/worktrees" ] || return 0
|
|
143
|
+
for wdir in "$common"/worktrees/*/; do
|
|
144
|
+
[ -d "$wdir" ] || continue
|
|
145
|
+
gitdir="$(cat "$wdir/gitdir" 2>/dev/null)"; wtpath="${gitdir%/.git}"
|
|
146
|
+
[ -n "$wtpath" ] && [ ! -e "$wtpath" ] || continue # only dead worktrees
|
|
147
|
+
name="$(basename "$wdir")"
|
|
148
|
+
branch="$(sed -n 's#^ref: refs/heads/##p' "$wdir/HEAD" 2>/dev/null)"
|
|
149
|
+
[ -f "$wdir/index" ] || continue
|
|
150
|
+
tree="$(GIT_INDEX_FILE="$wdir/index" git write-tree 2>/dev/null)" || continue
|
|
151
|
+
[ -n "$tree" ] || continue
|
|
152
|
+
tip="$(git rev-parse --verify --quiet "refs/heads/${branch}" 2>/dev/null)"
|
|
153
|
+
tiptree=""; [ -n "$tip" ] && tiptree="$(git rev-parse --verify --quiet "${tip}^{tree}" 2>/dev/null)"
|
|
154
|
+
# No staged delta beyond the tip → nothing to recover; the zombie is safe to prune as-is.
|
|
155
|
+
[ "$tree" = "$tiptree" ] && continue
|
|
156
|
+
[ -n "$branch" ] || { echo " gc: zombie $name is detached with staged work — leaving it for manual recovery" >&2; continue; }
|
|
157
|
+
if [ "$yes" -ne 1 ]; then
|
|
158
|
+
echo " would RECOVER staged work from zombie worktree $name -> a commit on $branch (staged tree $tree)" >&2
|
|
159
|
+
continue
|
|
160
|
+
fi
|
|
161
|
+
msg="kit gc: recovered staged work from zombie worktree $name (recover-before-prune)"
|
|
162
|
+
newc="$(printf '%s\n' "$msg" | GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-kit-gc}" GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL:-kit-gc@localhost}" GIT_COMMITTER_NAME="${GIT_COMMITTER_NAME:-kit-gc}" GIT_COMMITTER_EMAIL="${GIT_COMMITTER_EMAIL:-kit-gc@localhost}" git commit-tree "$tree" ${tip:+-p "$tip"} 2>/dev/null)"
|
|
163
|
+
if [ -n "$newc" ]; then
|
|
164
|
+
# Compare-and-swap on the tip so a concurrent update is never clobbered.
|
|
165
|
+
if git update-ref "refs/heads/$branch" "$newc" ${tip:+"$tip"} 2>/dev/null; then
|
|
166
|
+
echo " RECOVERED staged work from zombie $name -> commit ${newc%% *} on $branch" >&2
|
|
167
|
+
else
|
|
168
|
+
echo " gc: could not update refs/heads/$branch (moved concurrently?) — zombie $name left intact" >&2
|
|
169
|
+
fi
|
|
170
|
+
fi
|
|
171
|
+
# Stale-lock sweep — safe only because this worktree is provably dead.
|
|
172
|
+
rm -f "$wdir/index.lock" "$wdir/HEAD.lock" 2>/dev/null || true
|
|
173
|
+
done
|
|
174
|
+
}
|
|
175
|
+
|
|
74
176
|
# kit_gc_prune [--yes] - remove worktrees + local branches whose PR is MERGED (the SAFE rows).
|
|
75
177
|
# DRY-RUN by default (lists what it WOULD remove); --yes performs the deletions. Never touches a
|
|
76
178
|
# PROTECTED/ACTIVE/ORPHAN branch, and never a DIRTY worktree (recover-before-prune): a worktree with
|
|
@@ -78,35 +180,50 @@ kit_gc_has_prunable() {
|
|
|
78
180
|
# already deleted at merge time (gh pr merge --delete-branch); this cleans up the local side.
|
|
79
181
|
kit_gc_prune() {
|
|
80
182
|
_kit_gc_load_deps
|
|
81
|
-
|
|
183
|
+
# `wtpath`, not `path`: under zsh `path` is tied to PATH (special array), so assigning to a bare
|
|
184
|
+
# `path` local would clobber the command search path. A namespaced name is inert.
|
|
185
|
+
local repo="$KIT_GC_REPO" yes=0 a wtpath ref b pr pr_index
|
|
82
186
|
for a in "$@"; do case "$a" in --yes|-y) yes=1 ;; esac; done
|
|
83
187
|
|
|
188
|
+
# All PRs in ONE call, indexed by head branch (#124) — shared by both loops below instead of a
|
|
189
|
+
# per-branch `gh pr list --head` (the N+1 that scaled badly with many stale branches).
|
|
190
|
+
pr_index="$(_kit_gc_pr_index "$repo")"
|
|
191
|
+
|
|
84
192
|
# Worktrees first - a branch's worktree must be removed before the branch can be deleted.
|
|
85
193
|
git worktree list --porcelain 2>/dev/null \
|
|
86
194
|
| awk '/^worktree /{w=$2} /^branch /{print w" "$2}' \
|
|
87
|
-
| while read -r
|
|
195
|
+
| while read -r wtpath ref; do
|
|
88
196
|
b="${ref#refs/heads/}"
|
|
89
197
|
case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main|"") continue ;; esac
|
|
90
198
|
[ -n "$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)" ] && continue
|
|
91
|
-
pr="$(
|
|
92
|
-
|
|
93
|
-
if [ -n "$(git -C "$
|
|
94
|
-
echo " SKIP dirty worktree $
|
|
199
|
+
pr="$(_kit_gc_pr_for "$pr_index" "$b")"
|
|
200
|
+
printf '%s' "$pr" | grep -q 'MERGED' || continue
|
|
201
|
+
if [ -n "$(git -C "$wtpath" status --porcelain 2>/dev/null)" ]; then
|
|
202
|
+
echo " SKIP dirty worktree $wtpath [$b] - commit/recover before pruning" >&2; continue
|
|
95
203
|
fi
|
|
96
204
|
if [ "$yes" -eq 1 ]; then
|
|
97
|
-
git worktree remove --force "$
|
|
205
|
+
git worktree remove --force "$wtpath" 2>/dev/null && echo " removed worktree $wtpath [$b]"
|
|
98
206
|
else
|
|
99
|
-
echo " would remove worktree $
|
|
207
|
+
echo " would remove worktree $wtpath [$b] (PR MERGED)"
|
|
100
208
|
fi
|
|
101
209
|
done
|
|
102
|
-
git worktree prune 2>/dev/null || true
|
|
103
210
|
|
|
104
|
-
#
|
|
105
|
-
|
|
211
|
+
# recover-before-prune (#111): a zombie worktree (working dir gone, admin metadata lingers) may
|
|
212
|
+
# hold staged-but-uncommitted work in its admin index — the ONLY blob->path map. `git worktree
|
|
213
|
+
# prune` deletes that index, orphaning the blobs for a later `git gc` to reap — real data loss in a
|
|
214
|
+
# documented incident. Recover any staged delta to its branch FIRST, and gate the prune sweep
|
|
215
|
+
# behind --yes so it NEVER runs in a dry-run (the previous unconditional prune was the hazard).
|
|
216
|
+
kit_gc_recover_zombies "$yes"
|
|
217
|
+
[ "$yes" -eq 1 ] && { git worktree prune 2>/dev/null || true; }
|
|
218
|
+
|
|
219
|
+
# Then local branches whose PR merged (worktree now gone). while-read (NOT `for b in $(...)`) so
|
|
220
|
+
# branch iteration survives a NUL-polluted IFS (#124).
|
|
221
|
+
git branch --format='%(refname:short)' 2>/dev/null | while IFS= read -r b; do
|
|
222
|
+
[ -n "$b" ] || continue
|
|
106
223
|
case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main) continue ;; esac
|
|
107
224
|
[ -n "$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)" ] && continue
|
|
108
|
-
pr="$(
|
|
109
|
-
|
|
225
|
+
pr="$(_kit_gc_pr_for "$pr_index" "$b")"
|
|
226
|
+
printf '%s' "$pr" | grep -q 'MERGED' || continue
|
|
110
227
|
if [ "$yes" -eq 1 ]; then
|
|
111
228
|
git branch -D "$b" >/dev/null 2>&1 && echo " deleted local branch $b (PR MERGED)"
|
|
112
229
|
else
|
package/scripts/lib/kit-local.sh
CHANGED
|
@@ -16,7 +16,14 @@
|
|
|
16
16
|
# KIT_LOCAL_TIMEOUT (default 90s; hooks should pass lower via env when latency matters).
|
|
17
17
|
# Config: .claude/kit.config.json -> .local {enabled, port, model} (KIT_LOCAL_* env wins).
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Resolve config through the ONE shared resolver (config-path.sh, #69): KIT_CONFIG wins, else a root
|
|
20
|
+
# cckit.config.json or a .claude/kit.config.json (walk up). Falls back to the scaffolded path.
|
|
21
|
+
if ! command -v kit_config_path >/dev/null 2>&1; then
|
|
22
|
+
_kl_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
23
|
+
# shellcheck source=/dev/null
|
|
24
|
+
[ -f "$_kl_dir/config-path.sh" ] && . "$_kl_dir/config-path.sh"; unset _kl_dir
|
|
25
|
+
fi
|
|
26
|
+
KIT_LOCAL_CONFIG="$(kit_config_path 2>/dev/null || true)"; [ -n "$KIT_LOCAL_CONFIG" ] || KIT_LOCAL_CONFIG=".claude/kit.config.json"
|
|
20
27
|
|
|
21
28
|
_kit_local_cfg() { # _kit_local_cfg <jq-path> <default>
|
|
22
29
|
local v=""
|
|
@@ -48,6 +48,21 @@ kit_op_write() {
|
|
|
48
48
|
|
|
49
49
|
# conffiles guard: tracked + user-modified => never silent overwrite
|
|
50
50
|
local verdict; verdict="$(kit_manifest_verify "$dest" 2>/dev/null || true)"
|
|
51
|
+
|
|
52
|
+
# conffiles hard rule (#149): an EXISTING file with DIFFERENT content that the kit cannot
|
|
53
|
+
# prove it owns intact — user-edited (modified) or never recorded (untracked) — is only
|
|
54
|
+
# overwritten on an explicit interactive yes. KIT_ASSUME_YES does not consent on the user's
|
|
55
|
+
# behalf (mirrors kit_op_remove): non-interactive runs (init --upgrade, kit-update, CI)
|
|
56
|
+
# keep the user's version. Fixes the statusline-shim clobber on every /kit-update.
|
|
57
|
+
local guarded=0
|
|
58
|
+
if [ -f "$dest" ] && ! cmp -s "$src" "$dest" 2>/dev/null; then
|
|
59
|
+
case "$verdict" in modified|untracked) guarded=1;; esac
|
|
60
|
+
fi
|
|
61
|
+
if [ "$guarded" -eq 1 ] && { [ -n "${KIT_ASSUME_YES:-}" ] || _kit_op_dry; }; then
|
|
62
|
+
_kit_op_say "= kept your version ($verdict — never auto-overwritten): $dest"
|
|
63
|
+
return 10
|
|
64
|
+
fi
|
|
65
|
+
|
|
51
66
|
_kit_op_say "propose: $dest (tier $tier, $op, current=$verdict)"
|
|
52
67
|
_kit_op_diff "$src" "$dest"
|
|
53
68
|
|
|
@@ -57,8 +72,8 @@ kit_op_write() {
|
|
|
57
72
|
return 0
|
|
58
73
|
fi
|
|
59
74
|
|
|
60
|
-
if [ "$
|
|
61
|
-
if ! _kit_op_confirm " $dest was edited by you — overwrite?"; then
|
|
75
|
+
if [ "$guarded" -eq 1 ]; then
|
|
76
|
+
if ! _kit_op_confirm " $dest was edited by you (or is not kit-tracked) — overwrite?"; then
|
|
62
77
|
_kit_op_say " skip (kept your version): $dest"; return 10
|
|
63
78
|
fi
|
|
64
79
|
elif ! _kit_op_confirm " apply?"; then
|
package/scripts/lib/next.sh
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# next.sh — "what can I pick up right now?" The everyday-dev helper (Effort 75 · #79).
|
|
3
3
|
#
|
|
4
4
|
# Surfaces the unblocked set (wave 0 of the plan machine) and the single recommended next issue with
|
|
5
|
-
# the one command to start it. This is the daily-loop counterpart to
|
|
6
|
-
#
|
|
5
|
+
# the one command to start it. This is the daily-loop counterpart to `cckit wave`: wave fans a whole
|
|
6
|
+
# wave out to subagents; `cckit next` is for a human (or agent) picking up one issue by hand.
|
|
7
7
|
#
|
|
8
8
|
# cckit next the unblocked issues + the top one's start command
|
|
9
9
|
# cckit next --effort <N> scope to effort #N's sub-issues
|
|
@@ -70,6 +70,6 @@ next_issue() {
|
|
|
70
70
|
printf '\n## Pick up #%s — %s\n\n' "$topnum" "$toptitle"
|
|
71
71
|
printf 'Start it in an isolated worktree + branch:\n\n'
|
|
72
72
|
printf '```\ncckit start %s\n```\n\n' "$topnum"
|
|
73
|
-
printf 'Or fan the whole unblocked wave out to subagents with `cckit
|
|
73
|
+
printf 'Or fan the whole unblocked wave out to subagents with `cckit wave%s`.\n' "$([ -n "$effort" ] && echo " --effort $effort")"
|
|
74
74
|
} | cckit_render
|
|
75
75
|
}
|