@jeiemgi/cckit 0.2.0 → 0.3.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 (62) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +21 -8
  3. package/README.md +63 -5
  4. package/bin/cckit +37 -16
  5. package/cckit.config.json +1 -1
  6. package/commands/kit-doctor.md +3 -1
  7. package/kit.config.schema.json +24 -0
  8. package/package.json +1 -1
  9. package/scripts/annotate-setup.sh +7 -2
  10. package/scripts/capture-project-ids.sh +23 -10
  11. package/scripts/init.sh +22 -4
  12. package/scripts/kit-doctor.sh +185 -7
  13. package/scripts/kit-version-check-test.sh +36 -0
  14. package/scripts/kit-version-check.sh +19 -4
  15. package/scripts/knowledge-lint.sh +4 -1
  16. package/scripts/lib/board-view-test.sh +54 -0
  17. package/scripts/lib/board-view.sh +80 -0
  18. package/scripts/lib/captain-test.sh +18 -0
  19. package/scripts/lib/captain.sh +92 -5
  20. package/scripts/lib/config-path-test.sh +47 -0
  21. package/scripts/lib/config-path.sh +29 -0
  22. package/scripts/lib/copilot.sh +9 -9
  23. package/scripts/lib/effort-metrics-test.sh +57 -0
  24. package/scripts/lib/effort-metrics.sh +19 -5
  25. package/scripts/lib/effort-ops-test.sh +51 -2
  26. package/scripts/lib/effort-ops.sh +314 -49
  27. package/scripts/lib/effort-parity-test.sh +128 -0
  28. package/scripts/lib/effort-slug-test.sh +87 -0
  29. package/scripts/lib/effort-slug.sh +104 -0
  30. package/scripts/lib/effort.sh +34 -0
  31. package/scripts/lib/gh-project-test.sh +95 -0
  32. package/scripts/lib/gh-project.sh +22 -7
  33. package/scripts/lib/git-remote-test.sh +57 -0
  34. package/scripts/lib/git-remote.sh +21 -0
  35. package/scripts/lib/kit-config-test.sh +37 -0
  36. package/scripts/lib/kit-config.sh +33 -13
  37. package/scripts/lib/kit-events.sh +5 -3
  38. package/scripts/lib/kit-gc-test.sh +88 -0
  39. package/scripts/lib/kit-gc.sh +136 -19
  40. package/scripts/lib/kit-local.sh +8 -1
  41. package/scripts/lib/next.sh +3 -3
  42. package/scripts/lib/plan-next-test.sh +87 -0
  43. package/scripts/lib/plan-next.sh +212 -0
  44. package/scripts/lib/project-scan.sh +7 -1
  45. package/scripts/lib/worktree-start.sh +12 -3
  46. package/scripts/lib/zsh-safety-test.sh +73 -0
  47. package/scripts/portable-test.sh +62 -20
  48. package/scripts/setup-labels.sh +13 -2
  49. package/scripts/showcase.sh +13 -4
  50. package/scripts/status-test.sh +63 -0
  51. package/scripts/status.sh +12 -4
  52. package/scripts/task-sync.sh +79 -10
  53. package/skills/kit-autopilot/SKILL.md +5 -0
  54. package/skills/{docs-writer → kit-docs-writer}/SKILL.md +2 -2
  55. package/skills/kit-effort-new/SKILL.md +39 -111
  56. package/skills/kit-effort-pr/SKILL.md +6 -2
  57. package/skills/kit-next/SKILL.md +4 -0
  58. package/skills/kit-plan-next/SKILL.md +82 -0
  59. package/templates/hooks/mempal_session_start.sh.tmpl +36 -2
  60. package/templates/rules/effort-model.md +26 -6
  61. package/templates/rules/mempalace.md +1 -0
  62. package/templates/rules/plan-next.md +58 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cckit",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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/AGENTS.md CHANGED
@@ -8,11 +8,12 @@ adapter one) — is described in [the Adapters page](docs-site/src/content/docs/
8
8
 
9
9
  ## Ground rules
10
10
 
11
- - **Read state before acting.** `cckit sync --llm` returns the board as JSON. Decide from data.
11
+ - **Read state before acting.** `cckit sync --llm` returns the board as TOON. Decide from data.
12
12
  - **One issue = one branch = one worktree = one PR.** `cckit start <issue>` creates the isolated
13
13
  worktree; do all work there; `cckit pr <issue>` opens the PR. Never commit to the base branch.
14
- - **Structured output.** Append `--llm` to any verb for machine-readable (JSON) output. Human
15
- (pretty) output is the default; agents should prefer `--llm`.
14
+ - **Structured output, TOON-first.** Append `--llm` to any verb for machine-readable output. List
15
+ reads (sync, next, plan, wave) come back as **TOON** (token-cheap); single-result action verbs
16
+ (start, pr, close) return one JSON object. Human (pretty) output is the default; agents prefer `--llm`.
16
17
  - **Idempotent + safe.** Re-running a verb on an already-done step is a no-op, not an error.
17
18
  - **Never invent paths or config.** Everything resolves from `cckit.config.json`.
18
19
  - **Hand off when you stop with unfinished work.** `cckit handoff "<what's pending, next step, refs>"`
@@ -24,20 +25,32 @@ adapter one) — is described in [the Adapters page](docs-site/src/content/docs/
24
25
  | Verb | Purpose | LLM mode |
25
26
  | --- | --- | --- |
26
27
  | `cckit init` | scaffold config + `.claude/` | — |
27
- | `cckit sync` | board state / what's unblocked | `--llm` → JSON |
28
+ | `cckit sync` | board state / what's unblocked | `--llm` → TOON |
29
+ | `cckit next` | the next unblocked issue + how to start it | `--llm` → TOON |
30
+ | `cckit plan` | wave plan: deps-ordered, file-disjoint, session-fit | `--llm` → TOON |
31
+ | `cckit plan-next` | forward plan: inventory current skills/verbs/rules/docs → propose what to build next | `--llm` → TOON |
32
+ | `cckit wave` | read open efforts, propose incoming waves: fan-out brief + captain drive | `--llm` → TOON |
33
+ | `cckit watch [--merge] [--loop]` | captain: gate open PRs, squash-merge CLEAN, advance the wave | — |
28
34
  | `cckit start <issue> [slug]` | isolated worktree + branch | `--llm` |
29
35
  | `cckit pr <issue> <summary>` | commit + push + open PR | `--llm` |
30
36
  | `cckit close <issue> <summary>` | close issue + mark done | `--llm` |
31
- | `cckit effort plan` | session-fit work plan | `--llm` → JSON |
37
+ | `cckit effort new "<name>" ["sub :: desc" …]` | parent (4-section body + ctx/kind/priority/role/flow labels) + linted native sub-issues — identical to `/kit-effort-new` (one shared core); `start`/`pr`/`close` take `<slug\|N>` | flags: `--flow/--role/--priority/--goal/--scope/--for-agents/--verification/--depends-on/--milestone`, `--slug` |
38
+ | `cckit effort plan` | session-fit effort plan | `--llm` → JSON |
32
39
  | `cckit orchestrate <a> <b> …` | run N flows in parallel worktrees | — (use `--dry-run`) |
33
40
  | `cckit autopilot [<a> …]` | unattended multi-flow: drive (or auto-pick) issues under a cap | — (use `--dry-run`) |
34
41
  | `cckit gc` | report prunable branches + worktrees | `--llm` → JSON counts |
42
+ | `cckit render` | stdin markdown → rich (glow on a TTY; verbatim when piped) | — |
35
43
  | `cckit version` | the installed cckit version | `--llm` |
36
44
 
37
45
  Every verb accepts a global `--llm` (alias `--output=json`); verbs that produce a result emit a
38
46
  single JSON object/array on stdout, with human text on stderr. Interactive/launch verbs
39
47
  (`init`, `orchestrate`, `autopilot`) have no JSON result — use `--dry-run` to inspect their plan.
40
48
 
49
+ > **`cckit plan-next` is the one exception to "feed verb output back to the model."** Its forward
50
+ > plan is for the human/orchestrator's decision only — never inject it into a monitored model's
51
+ > prompt or context (context-anxiety rule). Run it, decide, and hand only the chosen, scoped effort
52
+ > to an agent. `cckit plan` / `cckit next` (ordering existing work) remain safe to reason over.
53
+
41
54
  ### Lifecycle ops (so autopilot runs unattended)
42
55
 
43
56
  Every operation an unattended run needs is reachable through the one CLI:
@@ -45,7 +58,7 @@ Every operation an unattended run needs is reachable through the one CLI:
45
58
  | Verb | Purpose |
46
59
  | --- | --- |
47
60
  | `cckit scan` | detect the repo's stack + kit state (emits JSON) |
48
- | `cckit doctor` | onboarding preflight (deps, gh auth) |
61
+ | `cckit doctor [--fix]` | onboarding preflight (deps, gh auth); asks before installing on a TTY, `--fix` skips the prompt |
49
62
  | `cckit update` | report whether the project is behind the installed cckit |
50
63
  | `cckit migrate` | reshuffle an old kit layout to the current one |
51
64
  | `cckit digest` | summarize recent activity |
@@ -84,8 +97,8 @@ operate the repo through cckit. It is self-contained.
84
97
  You operate this repository through cckit, a CLI that runs the full GitHub work lifecycle.
85
98
 
86
99
  Operating rules:
87
- 1. Read state before acting. Run `cckit sync --llm` and decide from the JSON it returns. Never
88
- guess the board.
100
+ 1. Read state before acting. Run `cckit sync --llm` and decide from the TOON board it returns
101
+ (TOON is a compact table format — parse it, don't guess the board).
89
102
  2. One issue = one branch = one worktree = one PR. Begin every task with `cckit start <issue>`,
90
103
  then cd into the worktree path it prints. Never commit on main or develop.
91
104
  3. Append `--llm` to any verb for machine-readable JSON output.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![Docs](https://img.shields.io/badge/docs-cckit.vercel.app-0A7E8C.svg)](https://cckit.vercel.app)
12
12
  [![Platforms: macOS · Linux · WSL](https://img.shields.io/badge/platforms-macOS%20%C2%B7%20Linux%20%C2%B7%20WSL-555.svg)](#platforms--requirements)
13
13
 
14
- **[📖 Documentation](https://cckit.vercel.app)** · [Quick start](#quick-start) · [Contributing](CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md)
14
+ **[📖 Documentation](https://cckit.vercel.app)** · [Tutorials](https://cckit.vercel.app/tutorials/) · [Quick start](#quick-start) · [Contributing](CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md)
15
15
 
16
16
  cckit turns a Git repository into a structured, agent-operable workspace. It ships the entire
17
17
  GitHub lifecycle — issues, branches, isolated worktrees, PRs, the merge flow, garbage collection,
@@ -71,6 +71,8 @@ Requirements: `bash` 4+, `git`, and `gh` (GitHub CLI) authenticated. `jq` recomm
71
71
 
72
72
  ```bash
73
73
  cckit init # scaffold cckit.config.json + .claude/ for this repo
74
+ cckit plan-next # propose what to build next, grounded in current capabilities
75
+ cckit next # the next unblocked issue + how to start it
74
76
  cckit start 42 # isolated worktree + branch for issue #42
75
77
  cckit pr 42 "what changed" # commit, push, open the PR
76
78
  cckit sync # board state, what's unblocked
@@ -79,19 +81,57 @@ cckit gc # prune merged branches + worktrees
79
81
 
80
82
  Run `cckit help` for the full verb list, or `cckit <verb> --help` for any one.
81
83
 
84
+ ## Efforts and slug handles
85
+
86
+ A big piece of work is an **effort** — a parent issue with sub-issues. `cckit effort new "<name>" "sub :: desc" …`
87
+ creates the parent issue (the four-section plan body), applies the `ctx/kind/priority/role/flow` labels, and lints
88
+ every sub-issue title — the same effort `/kit-effort-new` produces, since both call one shared core.
89
+
90
+ The GitHub issue **number** stays the canonical key, but every effort also has a memorable **slug** handle (the one
91
+ already in its `effort/<N>-<slug>` branch). Effort commands take the slug *or* the number interchangeably:
92
+
93
+ ```bash
94
+ cckit effort new "Slug handles for efforts" --slug slug-handles # optional explicit handle
95
+ cckit effort start slug-handles # same as: cckit effort start 93
96
+ cckit effort pr slug-handles
97
+ cckit effort close slug-handles
98
+ ```
99
+
100
+ A pure-digits argument is always a number; anything else is resolved to the canonical number by
101
+ matching `effort/*` branches, the `slug:<slug>` label, then open effort titles. An unknown or
102
+ ambiguous slug fails with a clear error rather than guessing. Efforts render as `slug #N`.
103
+
104
+ ## Wave
105
+
106
+ `cckit wave` reads your open efforts and proposes the incoming waves of work — parallel agent tasks
107
+ that gate and merge themselves:
108
+
109
+ ```bash
110
+ cckit plan # the wave plan: deps-ordered, file-disjoint, session-fit
111
+ cckit wave # a Task-subagent fan-out brief Claude Code enacts (proposes the next wave)
112
+ cckit watch --merge # the captain: gate open PRs, squash-merge the CLEAN ones, advance
113
+ # (policy floors hold PRs touching CI, lockfiles, or secrets for review)
114
+ cckit watch --loop # self-pace gate/merge passes until steady state
115
+ ```
116
+
82
117
  ## Driven by agents
83
118
 
84
119
  cckit is meant to be operated by an agent loop, not only a human. See [`AGENTS.md`](AGENTS.md) for
85
- the contract. Every verb accepts `--llm` for structured, parseable output:
120
+ the contract. Every verb accepts `--llm` for structured output — uniform payloads come back as
121
+ **TOON** (token-efficient), so the plan, board, and fan-out cost the model far fewer tokens:
86
122
 
87
123
  ```bash
88
- cckit sync --llm # JSON board state for an agent to reason over
89
- cckit effort plan --llm # the session-fit work plan as data
124
+ cckit sync --llm # board state for an agent to reason over
125
+ cckit plan --llm # the wave plan as TOON rows
126
+ cckit wave --llm # the fan-out (one subagent prompt per issue) as TOON
90
127
  ```
91
128
 
129
+ Human output renders as markdown — rich via `glow` in a terminal, native in the Claude Code
130
+ transcript, pipe-safe everywhere (`cckit render` exposes the seam for any script).
131
+
92
132
  ## Documentation
93
133
 
94
- Full docs, the [cookbook](https://cckit.vercel.app/cookbook/) of lifecycle recipes, and the [CLI reference](https://cckit.vercel.app/cli-reference/) live at **[cckit.vercel.app](https://cckit.vercel.app)**.
134
+ Full docs, the [tutorials](https://cckit.vercel.app/tutorials/) (step-by-step "How to X with Claude Code" guides), the [cookbook](https://cckit.vercel.app/cookbook/) of lifecycle recipes, and the [CLI reference](https://cckit.vercel.app/cli-reference/) live at **[cckit.vercel.app](https://cckit.vercel.app)**.
95
135
 
96
136
  ## Project layout
97
137
 
@@ -139,3 +179,21 @@ Licensed under either of
139
179
  at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for
140
180
  inclusion in cckit by you, as defined in the Apache-2.0 license, shall be dual licensed as above,
141
181
  without any additional terms or conditions.
182
+
183
+ ## Disclaimer & trademarks
184
+
185
+ cckit is an **independent, community-built project for educational purposes**. It is **not an
186
+ official Anthropic product** and is **not affiliated with, endorsed, sponsored, or supported by
187
+ Anthropic PBC** in any way.
188
+
189
+ "Anthropic", "Claude", and "Claude Code", along with related names, logos, and marks, are
190
+ trademarks of **Anthropic PBC**. All rights to Anthropic's products, services, names, and
191
+ intellectual property belong to Anthropic. cckit uses these names only **nominatively** — to
192
+ describe interoperability with Claude Code — and claims no ownership of or rights to them.
193
+
194
+ cckit is provided **"as is", without warranty of any kind**, for learning and experimentation.
195
+ Nothing here is legal advice. You are responsible for your own use of cckit and for complying with
196
+ the terms of any third-party service it integrates with, including
197
+ [Anthropic's Usage Policies and Terms](https://www.anthropic.com/legal). The cckit source code
198
+ itself is licensed as stated above; this disclaimer does not extend cckit's license to any
199
+ third-party trademark or product.
package/bin/cckit CHANGED
@@ -14,12 +14,16 @@
14
14
  # cckit contribute "<summary>" open a contribution PR to cckit, gated on scripts/check.sh
15
15
  # cckit sync [--llm] board state / what's unblocked
16
16
  # cckit plan [--llm] [--effort N] wave plan: deps-ordered, file-disjoint, session-fit (TOON --llm)
17
+ # cckit plan-next [--llm] forward plan: current skills/verbs/rules/docs -> what to build next
17
18
  # cckit effort <new|start|pr|close|plan> the effort lifecycle
19
+ # effort new [--flow F --role R --priority p1 --goal G --scope S --for-agents A
20
+ # --verification V --depends-on "#1,#2" --milestone M] "<name>" ["sub :: desc" …]
21
+ # parent (4-section body + ctx/kind/priority/role/flow labels) + linted native sub-issues
18
22
  # cckit orchestrate <a> <b> … run N flows in parallel worktrees (--dry-run/--cap/--agent)
19
23
  # cckit autopilot [<a> …] unattended multi-flow: drive (or auto-pick) issues under a cap
20
24
  # cckit watch [--merge] [--loop] captain: gate open PRs, squash-merge CLEAN, advance the wave
21
25
  # cckit next [--effort N] everyday helper: the unblocked set + how to start the top issue
22
- # cckit copilot [--effort N] prompt machine: emit the wave-0 subagent fan-out + captain drive
26
+ # cckit wave [--effort N] read open efforts, propose incoming waves: fan-out + captain drive
23
27
  # cckit gc [--prune [--yes]] report (default) or prune merged branches + worktrees
24
28
  # cckit status thin dashboard: board + worktrees + resume handoff
25
29
  # cckit scan [--llm] detect this repo's stack + kit state (JSON)
@@ -54,18 +58,12 @@ LIB="$ROOT/scripts/lib"
54
58
  # cckit.config.json, or .claude/kit.config.json), so board/lifecycle verbs act on the project you
55
59
  # ran cckit in — NOT cckit's own install dir. Running inside the cckit repo resolves to its own
56
60
  # cckit.config.json naturally (self-hosting); outside any project we fall back to cckit's config.
57
- # An explicit KIT_CONFIG in the environment always wins.
58
- _cckit_find_config() {
59
- local d="$1"
60
- while [ -n "$d" ] && [ "$d" != "/" ]; do
61
- [ -f "$d/cckit.config.json" ] && { printf '%s\n' "$d/cckit.config.json"; return 0; }
62
- [ -f "$d/.claude/kit.config.json" ] && { printf '%s\n' "$d/.claude/kit.config.json"; return 0; }
63
- d="$(dirname "$d")"
64
- done
65
- return 1
66
- }
61
+ # An explicit KIT_CONFIG in the environment always wins. The walk lives in the ONE shared resolver
62
+ # (config-path.sh, #69) that every kit entrypoint uses.
63
+ # shellcheck source=/dev/null
64
+ source "$LIB/config-path.sh"
67
65
  if [ -z "${KIT_CONFIG:-}" ]; then
68
- KIT_CONFIG="$(_cckit_find_config "$PWD" || true)"
66
+ KIT_CONFIG="$(kit_config_find "$PWD" || true)"
69
67
  [ -n "$KIT_CONFIG" ] || KIT_CONFIG="$ROOT/cckit.config.json"
70
68
  fi
71
69
  export KIT_CONFIG
@@ -108,9 +106,21 @@ case "$cmd" in
108
106
  source "$LIB/effort.sh"
109
107
  # shellcheck source=/dev/null
110
108
  source "$LIB/effort-ops.sh" # the new|start|pr|close lifecycle ops (compose effort.sh helpers)
109
+ # shellcheck source=/dev/null
110
+ source "$LIB/effort-metrics.sh" # effort_ctx_bucket — sizes the ctx:* label on `effort new`
111
111
  sub="${1:-}"; shift || true
112
112
  case "$sub" in
113
- new) effort_new "$@" ;;
113
+ new)
114
+ # Full parity with /kit-effort-new: load the board + role helpers so an effort created via
115
+ # the verb lands on the board exactly as the skill does. Board ops are guarded inside
116
+ # effort_new, so this is a safe no-op when Projects v2 is off or the IDs aren't captured.
117
+ if [ "${KIT_PROJECTS_V2:-}" = "true" ]; then
118
+ # shellcheck source=/dev/null
119
+ source "$LIB/gh-project.sh"; load_project_ids >/dev/null 2>&1 || true
120
+ # shellcheck source=/dev/null
121
+ source "$LIB/role-identity.sh" 2>/dev/null || true
122
+ fi
123
+ effort_new "$@" ;;
114
124
  start) effort_start "$@" ;;
115
125
  pr) effort_pr "$@" ;;
116
126
  close) effort_close "$@" ;;
@@ -162,6 +172,16 @@ case "$cmd" in
162
172
  # shellcheck source=/dev/null
163
173
  source "$LIB/plan-machine.sh"; plan_machine "$@"
164
174
  ;;
175
+ plan-next)
176
+ # Forward planner: introspect the CURRENT capability surface (skills/verbs/rules/docs) and
177
+ # propose what to build next, grounded in what the kit can already do. Filesystem-only — config
178
+ # is loaded for the project-root inference (KIT_CONFIG), then plan-next scans that root. Output
179
+ # is HUMAN / orchestrator-facing only — never wired into a monitored model's context (#86).
180
+ # shellcheck source=/dev/null
181
+ source "$LIB/kit-config.sh" && load_kit_config 2>/dev/null || true
182
+ # shellcheck source=/dev/null
183
+ source "$LIB/plan-next.sh"; plan_next "$@"
184
+ ;;
165
185
  gc)
166
186
  # shellcheck source=/dev/null
167
187
  source "$LIB/kit-config.sh" && load_kit_config
@@ -194,9 +214,10 @@ case "$cmd" in
194
214
  # shellcheck source=/dev/null
195
215
  source "$LIB/next.sh"; next_issue "$@"
196
216
  ;;
197
- copilot)
198
- # The prompt machine: emit the wave-0 Task-subagent fan-out + the between-waves captain drive.
199
- # Runs in the invoking project; needs config so KIT_REPO is set before copilot reads it.
217
+ wave|copilot)
218
+ # Read the open efforts and propose the incoming waves of work: emit the wave-0 Task-subagent
219
+ # fan-out + the between-waves captain drive. (`copilot` is a hidden back-compat alias for `wave`.)
220
+ # Runs in the invoking project; needs config so KIT_REPO is set before it reads it.
200
221
  # shellcheck source=/dev/null
201
222
  source "$LIB/kit-config.sh" && load_kit_config
202
223
  # shellcheck source=/dev/null
package/cckit.config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./kit.config.schema.json",
3
- "kitVersion": "0.2.0",
3
+ "kitVersion": "0.3.0",
4
4
  "project": {
5
5
  "name": "cckit",
6
6
  "slug": "cckit",
@@ -16,7 +16,9 @@ Run the kit-doctor script to check all dependencies and authentication required
16
16
  | Tier 1 | `git`, `gh` (≥2.29 for Projects v2), `jq`, `perl` — auto-installs via brew |
17
17
  | Tier 2 | `node`, `pnpm`, `vercel` (if .vercel/ exists), `turbo`/`playwright` (dev deps only) |
18
18
  | Local | Only when `.local.enabled` — installs `mlx-lm` via `uv tool install` (fallback `pipx`, never plain `pip`) + starts `mlx_lm.server` in background with a port health check (first run downloads ~4.5 GB) |
19
+ | Memory | Only when `.memory.enabled` — installs the [MemPalace](https://github.com/MemPalace/mempalace) CLI if missing (pipx, fallback uv), seeds the per-wing wake-up header (`.claude/mempal-identity.<wing>.txt`), and refreshes a stale session-start hook. Install + seed + refresh obey the consent guard: `--fix` applies them, `--dry-run`/`--no-install` only report |
19
20
  | Auth | `gh auth status`, scope `project`, `git config user.name/email` |
21
+ | Repo | `github.baseBranch` vs the repo's GitHub default branch — a mismatch means `Closes #N` won't auto-close issues on GitHub-UI merges (report-only; `cckit pr-merge` already closes them explicitly) |
20
22
  | SSH | Optional: detect existing key; `KIT_DOCTOR_SSH=1` triggers guided ed25519 setup |
21
23
 
22
24
  ## Flags
@@ -42,7 +44,7 @@ Run the kit-doctor script to check all dependencies and authentication required
42
44
 
43
45
  4. If all Tier 1 checks pass:
44
46
  - Report success
45
- - Remind the user the onboarding guide is at `http://localhost:3001/onboarding` (or `$CCKIT_ADMIN_URL/onboarding`)
47
+ - Point the user at the pointer the doctor prints on its last line: the local onboarding app at `$CCKIT_ADMIN_URL/onboarding` **only when it is actually reachable**, otherwise the public docs at `https://cckit.vercel.app`. Do not hardcode `localhost:3001` — nothing serves it by default.
46
48
 
47
49
  ## Rules
48
50
 
@@ -55,12 +55,36 @@
55
55
  "repo": { "type": "string" },
56
56
  "owner": { "type": "string" },
57
57
  "baseBranch": { "type": "string", "description": "Integration branch the lifecycle skills branch from and merge into (default: main; e.g. develop)." },
58
+ "integrationBranch": { "type": "string", "description": "Alias for baseBranch, honored when baseBranch is unset (adoption fallback)." },
59
+ "flow": { "type": "string", "description": "Last-resort alias for the integration branch, honored when baseBranch and integrationBranch are unset." },
58
60
  "projectsV2": { "type": "boolean" },
61
+ "projectOwnerType": { "type": "string", "enum": ["user", "organization"], "description": "Whether the Projects v2 board is owned by a user or an organization login (default: user). Selects the GraphQL root for board queries." },
59
62
  "projectNumber": { "type": ["integer", "null"] },
60
63
  "projectTitle": { "type": ["string", "null"] }
61
64
  }
62
65
  },
63
66
  "milestones": { "type": "array", "items": { "type": "string" } },
67
+ "effort": {
68
+ "type": "object",
69
+ "additionalProperties": true,
70
+ "properties": {
71
+ "knowledgeIngestHook": { "type": "string", "description": "Optional path to an executable run after `cckit effort close`, invoked as `<hook> <effort-number> <trace-dir>` to fold the closed effort's work record into a knowledge base. No-op when unset or not executable; the kit ships no default." }
72
+ }
73
+ },
74
+ "captain": {
75
+ "type": "object",
76
+ "additionalProperties": true,
77
+ "properties": {
78
+ "mergePolicy": {
79
+ "type": "object",
80
+ "additionalProperties": true,
81
+ "properties": {
82
+ "floors": { "type": "boolean", "description": "Auto-merge policy floors (default true). When on, `cckit watch --merge` never auto-merges a PR touching .github/workflows/**, lockfile/graph files, or security-sensitive paths, and always honors a `hold` label + draft state. Set false to disable (or KIT_CAPTAIN_FLOORS=0)." },
83
+ "protectedGlobs": { "type": "array", "items": { "type": "string" }, "description": "Extra path globs the captain must not auto-merge (added to the built-in floors). Also settable via KIT_CAPTAIN_EXTRA_GLOBS." }
84
+ }
85
+ }
86
+ }
87
+ },
64
88
  "plans": {
65
89
  "type": "object",
66
90
  "additionalProperties": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeiemgi/cckit",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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).",
@@ -39,14 +39,19 @@ if [[ "$REACT_DETECTED" != "true" ]]; then
39
39
  fi
40
40
 
41
41
  CFG="$TARGET/.claude/kit.config.json"
42
- WING=""; MEMORY_BOOL="false"; PROJECT_NAME="$(basename "$TARGET")"; HTTP_PORT=4747
42
+ # Repo name from the git remote is the identity fallback; the directory basename is the last resort (#73).
43
+ # shellcheck source=/dev/null
44
+ . "$KIT_ROOT/scripts/lib/git-remote.sh"
45
+ REMOTE_NAME="$(git_remote_repo_name "$TARGET" 2>/dev/null || true)"; REMOTE_NAME="${REMOTE_NAME:-$(basename "$TARGET")}"
46
+ WING=""; MEMORY_BOOL="false"; PROJECT_NAME="$REMOTE_NAME"; HTTP_PORT=4747
43
47
  if [[ -f "$CFG" ]]; then
44
48
  WING="$(jq -r '.memory.wing // .project.slug // ""' "$CFG" 2>/dev/null || echo "")"
45
49
  MEMORY_BOOL="$(jq -r '.memory.enabled // false' "$CFG" 2>/dev/null || echo false)"
46
50
  PROJECT_NAME="$(jq -r '.project.name // ""' "$CFG" 2>/dev/null || echo "$PROJECT_NAME")"
51
+ [[ -z "$PROJECT_NAME" || "$PROJECT_NAME" == "null" ]] && PROJECT_NAME="$REMOTE_NAME"
47
52
  HTTP_PORT="$(jq -r '.annotate.mcp.httpPort // 4747' "$CFG" 2>/dev/null || echo 4747)"
48
53
  fi
49
- [[ -z "$WING" || "$WING" == "null" ]] && WING="$(basename "$TARGET" | tr '[:upper:]' '[:lower:]')"
54
+ [[ -z "$WING" || "$WING" == "null" ]] && WING="$(printf '%s' "$REMOTE_NAME" | tr '[:upper:]' '[:lower:]')"
50
55
  [[ -z "$HTTP_PORT" || "$HTTP_PORT" == "null" ]] && HTTP_PORT=4747
51
56
 
52
57
  case "$REACT_PKG_MANAGER" in
@@ -1,7 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
  # Capture Projects v2 field + option IDs into scripts/.project-ids.env.
3
- # Reads owner + project number from .claude/kit.config.json. Run from project root.
3
+ # Reads owner + project number + owner type from the kit config. Run from project root.
4
4
  # Handles "Status", "Role", and "Plan Link" fields by name (case-insensitive).
5
+ #
6
+ # The board can live under a USER login or an ORGANIZATION login. GraphQL selects a different root
7
+ # for each (user(login:) vs organization(login:)), so this branches on github.projectOwnerType
8
+ # ("user" | "organization", default "user") — a user-only query silently returned null for an
9
+ # org-owned board (#118).
5
10
  set -euo pipefail
6
11
  source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
7
12
 
@@ -9,10 +14,18 @@ source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
9
14
 
10
15
  OUT="$(dirname "$0")/.project-ids.env"
11
16
 
12
- DATA=$(gh api graphql -f query='
13
- query($login:String!, $number:Int!){
14
- user(login:$login){
15
- projectV2(number:$number){
17
+ # Resolve the GraphQL root selector from the owner type (kit-config exports KIT_PROJECT_OWNER_TYPE).
18
+ case "${KIT_PROJECT_OWNER_TYPE:-user}" in
19
+ org|organization) OWNER_ROOT="organization" ;;
20
+ *) OWNER_ROOT="user" ;;
21
+ esac
22
+
23
+ # Build the query with the resolved root; the response is read under the SAME root below so the
24
+ # selector and the jq path stay in lockstep regardless of user- vs org-owned board.
25
+ DATA=$(gh api graphql -f query="
26
+ query(\$login:String!, \$number:Int!){
27
+ $OWNER_ROOT(login:\$login){
28
+ projectV2(number:\$number){
16
29
  id
17
30
  fields(first:50){ nodes{
18
31
  __typename
@@ -21,10 +34,10 @@ DATA=$(gh api graphql -f query='
21
34
  }}
22
35
  }
23
36
  }
24
- }' -f login="$KIT_OWNER" -F number="$KIT_PROJECT_NUMBER")
37
+ }" -f login="$KIT_OWNER" -F number="$KIT_PROJECT_NUMBER")
25
38
 
26
- PROJECT_ID=$(echo "$DATA" | jq -r '.data.user.projectV2.id')
27
- [[ -z "$PROJECT_ID" || "$PROJECT_ID" == "null" ]] && { echo "✗ Could not resolve project #$KIT_PROJECT_NUMBER for $KIT_OWNER"; exit 1; }
39
+ PROJECT_ID=$(echo "$DATA" | jq -r ".data.${OWNER_ROOT}.projectV2.id")
40
+ [[ -z "$PROJECT_ID" || "$PROJECT_ID" == "null" ]] && { echo "✗ Could not resolve project #$KIT_PROJECT_NUMBER for $OWNER_ROOT '$KIT_OWNER' (check github.projectOwnerType)"; exit 1; }
28
41
 
29
42
  # jq filter: normalize an option/field label -> UPPER_SNAKE
30
43
  norm='def n: ascii_upcase | gsub("[ -]";"_");'
@@ -35,7 +48,7 @@ norm='def n: ascii_upcase | gsub("[ -]";"_");'
35
48
 
36
49
  # Single-select fields -> <FIELD>_FIELD_ID + <FIELD>_OPT_<OPTION>
37
50
  echo "$DATA" | jq -r "$norm"'
38
- .data.user.projectV2.fields.nodes[]
51
+ .data.'"$OWNER_ROOT"'.projectV2.fields.nodes[]
39
52
  | select(.options != null)
40
53
  | (.name | n) as $f
41
54
  | ([ "\($f)_FIELD_ID=\(.id)" ]
@@ -43,7 +56,7 @@ norm='def n: ascii_upcase | gsub("[ -]";"_");'
43
56
 
44
57
  # Text/other fields -> <FIELD>_FIELD_ID
45
58
  echo "$DATA" | jq -r "$norm"'
46
- .data.user.projectV2.fields.nodes[]
59
+ .data.'"$OWNER_ROOT"'.projectV2.fields.nodes[]
47
60
  | select(.options == null) | select(.name != null)
48
61
  | "\(.name | n)_FIELD_ID=\(.id)"'
49
62
  } > "$OUT"
package/scripts/init.sh CHANGED
@@ -230,8 +230,9 @@ _INIT_SKIP_PREFLIGHT=0
230
230
  for _ia in "$@"; do [[ "$_ia" == "--upgrade" || "$_ia" == "--dry-run" ]] && _INIT_SKIP_PREFLIGHT=1; done
231
231
 
232
232
  if [[ $_INIT_SKIP_PREFLIGHT -eq 0 && -x "$_DOCTOR" ]]; then
233
- # Pass --no-install if init itself was called with --no-install equivalent
234
- bash "$_DOCTOR" || {
233
+ # --yes: init's preflight installs Tier-1 deps non-interactively (no approval prompt here; the
234
+ # user already opted into setup by running init). A human running `cckit doctor` directly is asked.
235
+ bash "$_DOCTOR" --yes || {
235
236
  echo "" >&2
236
237
  echo "x kit-doctor reported unresolved issues — fix them and re-run /kit-init." >&2
237
238
  exit 1
@@ -349,8 +350,13 @@ PROFILE_FILE="$KIT_ROOT/profiles/$PROFILE.json"
349
350
  mkdir -p "$TARGET"
350
351
  TARGET="$(cd "$TARGET" && pwd)"
351
352
  BASENAME="$(basename "$TARGET")"
352
- [[ -z "$NAME" ]] && NAME="$BASENAME"
353
- [[ -z "$SLUG" ]] && SLUG="$(echo "$BASENAME" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed -E 's/^-|-$//g')"
353
+ # Prefer the ACTUAL repo name from the git remote — the local directory is often cloned/renamed to a
354
+ # different name — and only fall back to the directory basename (#73).
355
+ # shellcheck source=/dev/null
356
+ . "$KIT_ROOT/scripts/lib/git-remote.sh"
357
+ NAME_SRC="$(git_remote_repo_name "$TARGET" 2>/dev/null || true)"; NAME_SRC="${NAME_SRC:-$BASENAME}"
358
+ [[ -z "$NAME" ]] && NAME="$NAME_SRC"
359
+ [[ -z "$SLUG" ]] && SLUG="$(echo "$NAME_SRC" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed -E 's/^-|-$//g')"
354
360
  if [[ -z "$GH_OWNER" ]]; then GH_OWNER="$(gh api user --jq .login 2>/dev/null || echo "")"; fi
355
361
  [[ -z "$OWNER_NAME" ]] && OWNER_NAME="${GH_OWNER:-owner}"
356
362
  # Prefer the project's ACTUAL GitHub remote over an <owner>/<dir-basename> guess — the local
@@ -561,6 +567,7 @@ if [[ $DRY_RUN -eq 1 ]]; then
561
567
  echo " knowledge/INDEX.md (knowledge-base manifest — rules/knowledge-base.md)"
562
568
  echo " .claude/lib/kit-sigil.sh (claude-kit attribution sigil helper, sourced by task-* footers)"
563
569
  [[ "$MEMORY_BOOL" == "true" ]] && echo " .claude/hooks/mempal_session_start.sh + mempal_save.sh + mempal_precompact.sh + mempal_followup.sh (SessionStart / Stop / PreCompact / SessionEnd)"
570
+ [[ "$MEMORY_BOOL" == "true" ]] && echo " .claude/mempal-identity.$SLUG.txt (per-wing wake-up header — edit the Stack line)"
564
571
  [[ "$PREPUSH_ENABLED" == "true" ]] && echo " .claude/hooks/prepush_gate.sh (PreToolUse Bash gate: $PREPUSH_CMD)"
565
572
  [[ "$LOCAL_ON" == "true" ]] && echo " .claude/hooks/kit-local-status.sh (SessionStart: announce local model layer when alive)"
566
573
  echo ""
@@ -732,6 +739,17 @@ if [[ "$MEMORY_BOOL" == "true" && $UPGRADE -eq 0 ]]; then
732
739
  emit "$KIT_ROOT/templates/hooks/mempal_precompact.sh.tmpl" "$TARGET/.claude/hooks/mempal_precompact.sh"
733
740
  emit "$KIT_ROOT/templates/hooks/mempal_followup.sh.tmpl" "$TARGET/.claude/hooks/mempal_followup.sh"
734
741
  chmod +x "$TARGET/.claude/hooks/mempal_session_start.sh" "$TARGET/.claude/hooks/mempal_save.sh" "$TARGET/.claude/hooks/mempal_precompact.sh" "$TARGET/.claude/hooks/mempal_followup.sh"
742
+ # Per-wing wake-up header — without it, `mempalace wake-up` shows the single global
743
+ # ~/.mempalace/identity.txt for every wing (the session-start hook swaps this in). See
744
+ # templates/rules/mempalace.md; `cckit doctor` re-seeds it if it goes missing.
745
+ _mpid="$TARGET/.claude/mempal-identity.$SLUG.txt"
746
+ if [[ ! -e "$_mpid" ]]; then
747
+ {
748
+ printf 'Project: %s (wing: %s)\n' "$NAME" "$SLUG"
749
+ [[ -n "$OWNER_NAME" ]] && printf 'Owner: %s\n' "$OWNER_NAME"
750
+ printf 'Stack: (describe this project — this header shows on every session wake-up)\n'
751
+ } > "$_mpid"
752
+ fi
735
753
  merge_settings --arg start "$TARGET/.claude/hooks/mempal_session_start.sh" --arg save "$TARGET/.claude/hooks/mempal_save.sh" --arg pre "$TARGET/.claude/hooks/mempal_precompact.sh" --arg fup "$TARGET/.claude/hooks/mempal_followup.sh" \
736
754
  '.hooks.SessionStart = [{matcher:"",hooks:[{type:"command",command:$start,timeout:30}]}]
737
755
  | .hooks.Stop = [{matcher:"",hooks:[{type:"command",command:$save,timeout:30}]}]