@jeiemgi/cckit 0.1.6 โ†’ 0.1.8

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cckit",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "installationPreference": "beta",
5
5
  "description": "cckit โ€” a project operating system for coding agents. The full GitHub work lifecycle (start/pr/close/sync, efforts, worktrees, orchestrate, gc) as agents + skills + rules, drivable by Claude Code and any other agent. Driven from cckit.config.json; no org or repo hardcoded.",
6
6
  "author": {
package/README.md CHANGED
@@ -13,8 +13,6 @@
13
13
 
14
14
  **[๐Ÿ“– Documentation](https://cckit.vercel.app)** ยท [Quick start](#quick-start) ยท [Contributing](CONTRIBUTING.md) ยท [Code of Conduct](CODE_OF_CONDUCT.md)
15
15
 
16
- [![Deploy the docs with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/jeiemgi/cckit&project-name=cckit-docs&root-directory=docs-site)
17
-
18
16
  cckit turns a Git repository into a structured, agent-operable workspace. It ships the entire
19
17
  GitHub lifecycle โ€” issues, branches, isolated worktrees, PRs, the merge flow, garbage collection,
20
18
  and a multi-agent orchestrator โ€” as a single bash CLI plus a Claude Code plugin (skills, rules,
@@ -40,7 +38,7 @@ a shell can drive every operation.
40
38
  curl -fsSL https://raw.githubusercontent.com/jeiemgi/cckit/main/scripts/web-install.sh | bash
41
39
  ```
42
40
 
43
- **Homebrew** (once the tap is published):
41
+ **Homebrew:**
44
42
 
45
43
  ```bash
46
44
  brew tap jeiemgi/cckit && brew install cckit
package/cckit.config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./kit.config.schema.json",
3
- "kitVersion": "0.1.6",
3
+ "kitVersion": "0.1.8",
4
4
  "project": {
5
5
  "name": "cckit",
6
6
  "slug": "cckit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeiemgi/cckit",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "description": "cckit โ€” a project operating system for coding agents (CLI + Claude Code plugin).",
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ # config-path-test.sh โ€” scan/config recognize BOTH a root cckit.config.json AND a
3
+ # .claude/kit.config.json as a configured project (#65, #69). Hermetic, no network.
4
+ set -u
5
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6
+ fail=0
7
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
8
+ command -v jq >/dev/null 2>&1 || { echo "config-path-test: jq required" >&2; exit 1; }
9
+ # shellcheck source=/dev/null
10
+ . "$ROOT/scripts/lib/project-scan.sh"
11
+
12
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
13
+ mk() { mkdir -p "$1"; ( cd "$1" && git init -q ); }
14
+
15
+ # A) root cckit.config.json (cckit self-host layout) -> configured
16
+ mk "$tmp/a"; echo '{}' > "$tmp/a/cckit.config.json"
17
+ t "root cckit.config.json -> configured" "$(project_scan "$tmp/a" | jq -r .kit)" "configured"
18
+
19
+ # B) .claude/kit.config.json (consuming-project layout) -> configured (was the #65 bug)
20
+ mk "$tmp/b"; mkdir -p "$tmp/b/.claude"; echo '{}' > "$tmp/b/.claude/kit.config.json"
21
+ t ".claude/kit.config.json -> configured" "$(project_scan "$tmp/b" | jq -r .kit)" "configured"
22
+
23
+ # C) bare .claude/ with no kit config -> claude-only (not falsely "configured")
24
+ mk "$tmp/c"; mkdir -p "$tmp/c/.claude"
25
+ t "bare .claude/ -> claude-only" "$(project_scan "$tmp/c" | jq -r .kit)" "claude-only"
26
+
27
+ # D) nothing -> none
28
+ mk "$tmp/d"
29
+ t "greenfield -> none" "$(project_scan "$tmp/d" | jq -r .kit)" "none"
30
+
31
+ [ "$fail" -eq 0 ] && echo "ALL OK (config-path)" || echo "config-path: FAILURES"
32
+ exit "$fail"
package/scripts/init.sh CHANGED
@@ -353,6 +353,9 @@ BASENAME="$(basename "$TARGET")"
353
353
  [[ -z "$SLUG" ]] && SLUG="$(echo "$BASENAME" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed -E 's/^-|-$//g')"
354
354
  if [[ -z "$GH_OWNER" ]]; then GH_OWNER="$(gh api user --jq .login 2>/dev/null || echo "")"; fi
355
355
  [[ -z "$OWNER_NAME" ]] && OWNER_NAME="${GH_OWNER:-owner}"
356
+ # Prefer the project's ACTUAL GitHub remote over an <owner>/<dir-basename> guess โ€” the local
357
+ # directory name often differs from the repo name (would target a non-existent repo otherwise).
358
+ [[ -z "$REPO" ]] && REPO="$(cd "$TARGET" 2>/dev/null && gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || true)"
356
359
  [[ -z "$REPO" && -n "$GH_OWNER" ]] && REPO="$GH_OWNER/$SLUG"
357
360
  [[ -z "$REPO" ]] && REPO="$SLUG"
358
361
 
@@ -17,7 +17,7 @@ while [[ $# -gt 0 ]]; do
17
17
  done
18
18
 
19
19
  command -v jq >/dev/null 2>&1 || exit 0
20
- cfg="$TARGET/.claude/kit.config.json"
20
+ cfg="$TARGET/cckit.config.json"; [[ -f "$cfg" ]] || cfg="$TARGET/.claude/kit.config.json"
21
21
  [[ -f "$cfg" ]] || exit 0
22
22
 
23
23
  # Locate the installed plugin's plugin.json: explicit root โ†’ env โ†’ best-effort glob.
@@ -15,7 +15,7 @@ ok() { echo "ok $1"; }
15
15
 
16
16
  # ---- config (tolerant: defaults if config/lib absent) ----------------------
17
17
  KNOWLEDGE_DIR="knowledge"; PLANS_DIR=""; PLANS_FORMAT=""
18
- if [[ -f scripts/lib/kit-config.sh && -f .claude/kit.config.json ]]; then
18
+ if [[ -f scripts/lib/kit-config.sh && ( -f .claude/kit.config.json || -f cckit.config.json ) ]]; then
19
19
  source scripts/lib/kit-config.sh
20
20
  load_kit_config >/dev/null 2>&1 || true
21
21
  KNOWLEDGE_DIR="${KIT_KNOWLEDGE_DIR:-knowledge}"
@@ -41,7 +41,7 @@ estimate_effort() {
41
41
  est="$d/estimator.json"; [[ -f "$est" ]] || return 0
42
42
  command -v jq >/dev/null 2>&1 || return 0
43
43
 
44
- repo="${EFFORT_REPO:-jeiemgi/cckit}"
44
+ repo="${EFFORT_REPO:-${KIT_REPO:-}}"
45
45
  subs="$(gh api graphql -f query='query($o:String!,$r:String!,$n:Int!){repository(owner:$o,name:$r){issue(number:$n){subIssues(first:50){totalCount}}}}' \
46
46
  -F o="${repo%/*}" -F r="${repo#*/}" -F n="$num" --jq '.data.repository.issue.subIssues.totalCount' 2>/dev/null)"
47
47
  [[ "$subs" =~ ^[0-9]+$ ]] || subs=1; [[ "$subs" -lt 1 ]] && subs=1
@@ -126,7 +126,7 @@ _em_token_sum() {
126
126
  }
127
127
 
128
128
  capture_effort_metrics() {
129
- local num="$1" base="${2:-origin/develop}" d start now build_s shortstat files added removed commits churn diff_auto branch
129
+ local num="$1" base="${2:-origin/${KIT_BASE_BRANCH:-main}}" d start now build_s shortstat files added removed commits churn diff_auto branch
130
130
  local toks tin tout tcr tcw tokens_real cost_real cost_source tokens_est cost_est rec
131
131
  local IFS=' ' # force space-split for `set --` below (ambient IFS may carry a NUL)
132
132
  [[ -n "$num" ]] || return 0
@@ -213,7 +213,7 @@ _EM_JUDGE_MAX_CHARS="${EM_JUDGE_MAX_CHARS:-12000}"
213
213
  # (<git-common-dir>/traces/effort-<N>/*.diff, written pre-squash by effort_snapshot_subs) and falls
214
214
  # back to `git diff <base>...HEAD`. Echoes the (untruncated) diff; truncation happens in the caller.
215
215
  _em_judge_diff() {
216
- local num="$1" base="${2:-origin/develop}" common tdir
216
+ local num="$1" base="${2:-origin/${KIT_BASE_BRANCH:-main}}" common tdir
217
217
  common="$(git rev-parse --git-common-dir 2>/dev/null)" || true
218
218
  if [[ -n "$common" ]]; then
219
219
  case "$common" in /*) : ;; *) common="$PWD/$common" ;; esac
@@ -231,7 +231,7 @@ _em_judge_diff() {
231
231
  _em_judge_goal() {
232
232
  local num="$1" repo body
233
233
  command -v gh >/dev/null 2>&1 || { printf ''; return 0; }
234
- repo="${EFFORT_REPO:-jeiemgi/cckit}"
234
+ repo="${EFFORT_REPO:-${KIT_REPO:-}}"
235
235
  body="$(gh issue view "$num" --repo "$repo" --json body --jq '.body' 2>/dev/null)" || { printf ''; return 0; }
236
236
  [[ -n "$body" ]] || { printf ''; return 0; }
237
237
  # Extract the lines after "## Goal" up to the next "## " heading.
@@ -282,7 +282,7 @@ _em_judge_call() {
282
282
  }
283
283
 
284
284
  judge_effort_metrics() {
285
- local num="$1" base="${2:-origin/develop}" d f goal diff truncated_note system user out model reply json dj sj
285
+ local num="$1" base="${2:-origin/${KIT_BASE_BRANCH:-main}}" d f goal diff truncated_note system user out model reply json dj sj
286
286
  [[ -n "$num" ]] || return 0
287
287
  command -v jq >/dev/null 2>&1 || return 0
288
288
  d="$(_em_dir)" || return 0; f="$d/records.jsonl"
@@ -7,7 +7,12 @@
7
7
  # project config, nearest-wins (like .editorconfig). Projects with no .claudekit/ behave unchanged.
8
8
 
9
9
  load_kit_config() {
10
- local cfg="${KIT_CONFIG:-.claude/kit.config.json}"
10
+ # Resolve the project config like the dispatcher (bin/cckit _cckit_find_config): an explicit
11
+ # KIT_CONFIG wins, else a root cckit.config.json, else .claude/kit.config.json.
12
+ local cfg="${KIT_CONFIG:-}"
13
+ if [[ -z "$cfg" ]]; then
14
+ if [[ -f cckit.config.json ]]; then cfg="cckit.config.json"; else cfg=".claude/kit.config.json"; fi
15
+ fi
11
16
  if [[ ! -f "$cfg" ]]; then
12
17
  echo "โœ— $cfg not found. Run /kit-init (or scripts/init.sh) first." >&2
13
18
  return 1
@@ -48,7 +48,7 @@ kit_gc_analyze() {
48
48
 
49
49
  echo "# branches"
50
50
  for b in $(git branch --format='%(refname:short)' 2>/dev/null); do
51
- case "$b" in develop|main) echo " $b -> ACTIVE (base branch)"; continue;; esac
51
+ case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main) echo " $b -> ACTIVE (base branch)"; continue;; esac
52
52
  pr="$(gh pr list --repo "$repo" --head "$b" --state all --json number,state --jq '.[0]|"PR#\(.number) \(.state)"' 2>/dev/null || true)"
53
53
  prot="$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)"
54
54
  if [ -n "$prot" ]; then
@@ -86,7 +86,7 @@ kit_gc_prune() {
86
86
  | awk '/^worktree /{w=$2} /^branch /{print w" "$2}' \
87
87
  | while read -r path ref; do
88
88
  b="${ref#refs/heads/}"
89
- case "$b" in develop|main|"") continue ;; esac
89
+ case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main|"") continue ;; esac
90
90
  [ -n "$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)" ] && continue
91
91
  pr="$(gh pr list --repo "$repo" --head "$b" --state all --json state --jq '.[0].state' 2>/dev/null || true)"
92
92
  [ "$pr" = "MERGED" ] || continue
@@ -103,7 +103,7 @@ kit_gc_prune() {
103
103
 
104
104
  # Then local branches whose PR merged (worktree now gone).
105
105
  for b in $(git branch --format='%(refname:short)' 2>/dev/null); do
106
- case "$b" in develop|main) continue ;; esac
106
+ case "$b" in "${KIT_BASE_BRANCH:-main}"|develop|main) continue ;; esac
107
107
  [ -n "$(wt_protected_reason "$b" "$repo" 2>/dev/null || true)" ] && continue
108
108
  pr="$(gh pr list --repo "$repo" --head "$b" --state all --json state --jq '.[0].state' 2>/dev/null || true)"
109
109
  [ "$pr" = "MERGED" ] || continue
@@ -26,9 +26,9 @@ if [ -n "${KTO_TEST_INNER:-}" ]; then
26
26
  eq "branch effort/851-z" "$(kto_branch_issue_number 'effort/851-tail')" "851"
27
27
 
28
28
  # kto_base_branch / kto_board_enabled (portability toggles)
29
- eq "base default" "$(kto_base_branch)" "develop"
29
+ eq "base default" "$(unset KIT_BASE_BRANCH; kto_base_branch)" "main"
30
30
  eq "base override" "$(KIT_BASE_BRANCH=main; kto_base_branch)" "main"
31
- if kto_board_enabled; then eq "board default on" "on" "on"; else eq "board default on" "off" "on"; fi
31
+ if ( unset KIT_PROJECTS_V2; kto_board_enabled ); then eq "board default on" "on" "on"; else eq "board default on" "off" "on"; fi
32
32
  ( KIT_PROJECTS_V2=false; if kto_board_enabled; then exit 0; else exit 1; fi ) \
33
33
  && eq "board off" "on" "off" || eq "board off" "off" "off"
34
34
 
@@ -37,12 +37,12 @@ if [[ -z "${KIT_REPO:-}" ]]; then
37
37
  fi
38
38
 
39
39
  kto_repo() {
40
- printf '%s' "${KIT_TASK_REPO:-${KIT_REPO:-jeiemgi/cckit}}"
40
+ printf '%s' "${KIT_TASK_REPO:-${KIT_REPO:-}}"
41
41
  }
42
42
 
43
43
  # The base branch a PR targets / pr-merge returns to (portable: KIT_BASE_BRANCH, default develop).
44
44
  kto_base_branch() {
45
- printf '%s' "${KIT_BASE_BRANCH:-develop}"
45
+ printf '%s' "${KIT_BASE_BRANCH:-main}"
46
46
  }
47
47
 
48
48
  # True (rc 0) iff board updates should run. Off when KIT_PROJECTS_V2 is explicitly "false" โ€” keeps
@@ -8,7 +8,7 @@ project_scan() {
8
8
  [ -f "$root/pyproject.toml" ] && stack+=("python")
9
9
  [ -f "$root/go.mod" ] && stack+=("go")
10
10
  [ -f "$root/Cargo.toml" ] && stack+=("rust")
11
- if [ -f "$root/cckit.config.json" ]; then kit="configured"
11
+ if [ -f "$root/cckit.config.json" ] || [ -f "$root/.claude/kit.config.json" ]; then kit="configured"
12
12
  elif [ -d "$root/.cckit" ]; then kit="partial"
13
13
  elif [ -d "$root/.claude" ]; then kit="claude-only"; fi
14
14
  printf '{"root":"%s","stack":[%s],"kit":"%s"}\n' \
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # Requires: gh, jq, git, scripts/lib/gh-project.sh (board update). bash 3.2 compatible.
13
13
 
14
- WT_START_REPO="${WT_START_REPO:-jeiemgi/cckit}"
14
+ WT_START_REPO="${WT_START_REPO:-${KIT_REPO:-}}"
15
15
 
16
16
  # _wt_set_port <app-env-file> <port> <issue-num> โ€” append a per-worktree dev PORT to an app's
17
17
  # .env.local, but only where one exists (i.e. the app is locally runnable). Idempotent: an existing
@@ -60,8 +60,10 @@ case "$CAP" in ''|*[!0-9]*) echo "orchestrate: --cap needs a number (got '$CAP')
60
60
 
61
61
  # Resolve the main worktree root + load config (repo + base branch drive everything).
62
62
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
63
- ROOT="$(git -C "$SCRIPT_DIR" worktree list --porcelain | awk '/^worktree /{print $2; exit}')"
64
- [ -n "$ROOT" ] || { echo "orchestrate: not in a git repo" >&2; exit 1; }
63
+ ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" # cckit INSTALL root โ€” for sourcing libs (works on brew/npm installs)
64
+ # The git-repo guard validates the INVOKING project ($PWD), not cckit's install dir; wt_start and
65
+ # load_kit_config below resolve the project + its config from the invoking directory.
66
+ git -C "$PWD" rev-parse --show-toplevel >/dev/null 2>&1 || { echo "orchestrate: not in a git repo" >&2; exit 1; }
65
67
  # shellcheck source=/dev/null
66
68
  source "$ROOT/scripts/lib/kit-config.sh" && load_kit_config
67
69
  REPO="$KIT_REPO"