@jeiemgi/cckit 0.3.0 → 0.4.1

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,12 +1,12 @@
1
1
  {
2
2
  "name": "cckit",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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": {
7
7
  "name": "jeiemgi"
8
8
  },
9
- "homepage": "https://cckit.vercel.app",
9
+ "homepage": "https://cckit.dev",
10
10
  "repository": "jeiemgi/cckit",
11
11
  "license": "MIT OR Apache-2.0",
12
12
  "keywords": [
package/AGENTS.md CHANGED
@@ -86,7 +86,7 @@ Every operation an unattended run needs is reachable through the one CLI:
86
86
 
87
87
  cckit shells out to whatever agent invokes it; it does not embed a model. For verbs that synthesize
88
88
  text (digests, ingest), the model endpoint is configurable via environment — see the docs site (
89
- [cckit.vercel.app](https://cckit.vercel.app).
89
+ [cckit.dev](https://cckit.dev).
90
90
 
91
91
  ## Paste-ready agent prompt
92
92
 
package/README.md CHANGED
@@ -1,30 +1,46 @@
1
1
  <p align="center">
2
- <img src=".github/banner.png" alt="cckit — a project operating system for coding agents" width="100%">
2
+ <img src=".github/banner.png" alt="cckit — you're the architect, cckit runs the mechanics" width="100%">
3
3
  </p>
4
4
 
5
5
  # cckit
6
6
 
7
- > A project operating system for coding agents — the full GitHub work lifecycle as a CLI, drivable by Claude Code and any other agent.
7
+ > **You're the architect. cckit runs the mechanics.** The full GitHub work lifecycle — issues,
8
+ > worktrees, PRs, merges, multi-agent waves — as one CLI, drivable by Claude Code and any agent.
8
9
 
9
10
  [![License: MIT OR Apache-2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)](#license)
10
11
  [![Built for Claude Code](https://img.shields.io/badge/built%20for-Claude%20Code-8A63D2.svg)](https://docs.claude.com/claude-code)
11
- [![Docs](https://img.shields.io/badge/docs-cckit.vercel.app-0A7E8C.svg)](https://cckit.vercel.app)
12
+ [![Docs](https://img.shields.io/badge/docs-cckit.dev-0A7E8C.svg)](https://cckit.dev)
12
13
  [![Platforms: macOS · Linux · WSL](https://img.shields.io/badge/platforms-macOS%20%C2%B7%20Linux%20%C2%B7%20WSL-555.svg)](#platforms--requirements)
13
14
 
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
+ **[📖 Documentation](https://cckit.dev)** · [The idea](https://cckit.dev/philosophy/) · [Tutorials](https://cckit.dev/tutorials/) · [Quick start](#quick-start) · [Contributing](CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md)
15
16
 
16
- cckit turns a Git repository into a structured, agent-operable workspace. It ships the entire
17
- GitHub lifecycle — issues, branches, isolated worktrees, PRs, the merge flow, garbage collection,
18
- and a multi-agent orchestrator — as a single bash CLI plus a Claude Code plugin (skills, rules,
19
- agents). It is **agent-agnostic by design**: Claude Code is first-class, but any agent that can run
20
- a shell can drive every operation.
17
+ The whole idea in one line:
18
+
19
+ > **Turn your Git into retrievable, efficient context** — using issues, GitHub Projects, and other
20
+ > people's tools, wired together with a few advanced mechanics.
21
+
22
+ You bring the ideas and the shape of the thing. The mechanics that make it stand up — branches,
23
+ isolated worktrees, PRs, the merge flow, and the trail of issues that says *why* — are what cckit
24
+ takes care of. It ships all of that as a single bash CLI plus a Claude Code plugin (skills, rules,
25
+ agents), and it is **agent-agnostic by design**: Claude Code is first-class, but any agent that can
26
+ run a shell can drive every operation.
21
27
 
22
28
  ## Why
23
29
 
24
30
  - **One lifecycle, one source of truth.** Start an issue, get an isolated worktree and branch, open
25
- a PR, merge, and clean up — each step is one command, correct by construction.
31
+ a PR, merge, and clean up — each step is one command, correct by construction. The board is both
32
+ the plan and the proof.
33
+ - **Sessions that pick up where you left off.** `cckit handoff "<note>"` saves a resume-here note;
34
+ bare `cckit` prints it at the start of the next session — context survives the context window.
35
+ - **Sessions that talk to each other.** `cckit msg send <branch|project:branch|all> [--steer]
36
+ "<text>"` mails any parallel session on the machine — same project or another; the kit's mail
37
+ hook delivers it to a *live* session between tool calls, and a `--steer` message redirects a
38
+ session that is about to stop.
26
39
  - **Agent-operable.** Every verb has a machine-readable mode (`cckit <verb> --llm`) and an
27
40
  [`AGENTS.md`](AGENTS.md) contract, so agents drive the kit without scraping human output.
41
+ - **Scales from one issue to a wave.** The same verbs that take one issue to a merged PR also plan
42
+ and run a whole wave of parallel agents — with a captain that gates and merges behind policy
43
+ floors.
28
44
  - **Zero hard dependencies.** Pure bash with graceful fallbacks; it auto-detects optional tools
29
45
  (`gh`, `jq`, `fzf`, `gum`) and degrades instead of failing.
30
46
  - **Portable.** No company, framework, or repo is baked in — everything is driven from
@@ -70,22 +86,33 @@ Requirements: `bash` 4+, `git`, and `gh` (GitHub CLI) authenticated. `jq` recomm
70
86
  ## Quick start
71
87
 
72
88
  ```bash
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
76
- cckit start 42 # isolated worktree + branch for issue #42
77
- cckit pr 42 "what changed" # commit, push, open the PR
78
- cckit sync # board state, what's unblocked
79
- cckit gc # prune merged branches + worktrees
89
+ cckit doctor # onboarding preflight: deps, gh auth
90
+ cckit init --profile software # scaffold cckit.config.json + .claude/ for this repo
91
+ # profiles: software · content · research · automation · minimal
92
+ cckit plan-next # propose what to build next, grounded in current capabilities
93
+ cckit next # the next unblocked issue + how to start it
94
+ cckit start 42 # isolated worktree + branch for issue #42
95
+ cckit pr 42 "what changed" # commit, push, open the PR
96
+ cckit sync # board state, what's unblocked
97
+ cckit handoff "resume note" # save a handoff — bare `cckit` prints it next session
98
+ cckit gc # prune merged branches + worktrees
80
99
  ```
81
100
 
82
- Run `cckit help` for the full verb list, or `cckit <verb> --help` for any one.
101
+ Adopting cckit in a repo that already has history? `cckit scan` detects the stack, `cckit adopt`
102
+ records kit-shaped files the repo already has, and `cckit status` is the thin dashboard — board,
103
+ worktrees, and the resume handoff in one screen. Run `cckit help` for the full verb list, or
104
+ `cckit <verb> --help` for any one.
83
105
 
84
106
  ## Efforts and slug handles
85
107
 
86
108
  A big piece of work is an **effort** — a parent issue with sub-issues. `cckit effort new "<name>" "sub :: desc" …`
87
109
  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.
110
+ every sub-issue title — the same effort `/kit-effort-new` produces, since both call one shared core. The `--flow`
111
+ vocabulary (the `[Flow]` title tags) reads from `effort.flows` in the project config, so `cckit effort new --flow X`
112
+ works out of the box in any configured repo (an explicit `EFFORT_FLOWS` env var still wins per invocation).
113
+ `cckit effort close` is likewise the **single close implementation** (the `/kit-effort-close` skill is a thin caller
114
+ of the same function): pre-squash work-record snapshot + metrics, squash-merge, close parent + subs, board
115
+ Status=Done, worktree/branch GC, an optional knowledge-ingest hook, and an advisory kit-sync drift check.
89
116
 
90
117
  The GitHub issue **number** stays the canonical key, but every effort also has a memorable **slug** handle (the one
91
118
  already in its `effort/<N>-<slug>` branch). Effort commands take the slug *or* the number interchangeably:
@@ -101,17 +128,19 @@ A pure-digits argument is always a number; anything else is resolved to the cano
101
128
  matching `effort/*` branches, the `slug:<slug>` label, then open effort titles. An unknown or
102
129
  ambiguous slug fails with a clear error rather than guessing. Efforts render as `slug #N`.
103
130
 
104
- ## Wave
131
+ ## Waves — parallel agentic development
105
132
 
106
133
  `cckit wave` reads your open efforts and proposes the incoming waves of work — parallel agent tasks
107
- that gate and merge themselves:
134
+ that gate and merge themselves. This is the part that turns one keyboard into a small team:
108
135
 
109
136
  ```bash
110
137
  cckit plan # the wave plan: deps-ordered, file-disjoint, session-fit
111
138
  cckit wave # a Task-subagent fan-out brief Claude Code enacts (proposes the next wave)
139
+ cckit orchestrate 12 14 17 # run N flows in parallel worktrees (--dry-run / --cap / --agent)
112
140
  cckit watch --merge # the captain: gate open PRs, squash-merge the CLEAN ones, advance
113
141
  # (policy floors hold PRs touching CI, lockfiles, or secrets for review)
114
142
  cckit watch --loop # self-pace gate/merge passes until steady state
143
+ cckit autopilot # unattended multi-flow: drive (or auto-pick) issues under a cap
115
144
  ```
116
145
 
117
146
  ## Driven by agents
@@ -129,9 +158,23 @@ cckit wave --llm # the fan-out (one subagent prompt per issue) as TOON
129
158
  Human output renders as markdown — rich via `glow` in a terminal, native in the Claude Code
130
159
  transcript, pipe-safe everywhere (`cckit render` exposes the seam for any script).
131
160
 
161
+ ## cckit builds cckit
162
+
163
+ None of this is theoretical. cckit is developed *with* cckit — every feature, fix, and tutorial went
164
+ through its own lifecycle: an issue, an isolated worktree, a pull request, a merge. The receipts are
165
+ public: [every issue closed in the repo →](https://github.com/jeiemgi/cckit/issues?q=is%3Aissue%20state%3Aclosed)
166
+ — including [the effort that produced this README](https://github.com/jeiemgi/cckit/issues/160).
167
+ The board is both the plan and the proof.
168
+
132
169
  ## Documentation
133
170
 
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)**.
171
+ Full docs live at **[cckit.dev](https://cckit.dev)** — start with
172
+ [the idea](https://cckit.dev/philosophy/) if you want the why. The
173
+ [tutorials](https://cckit.dev/tutorials/) are step-by-step "How to X with Claude Code"
174
+ guides, each labelled **Beginner / Intermediate / Advanced** and carrying a **"Copy as Markdown"
175
+ prompt** you can paste straight into Claude Code — start exactly where you are. The
176
+ [cookbook](https://cckit.dev/cookbook/) holds lifecycle recipes, and the
177
+ [CLI reference](https://cckit.dev/cli-reference/) covers every verb.
135
178
 
136
179
  ## Project layout
137
180
 
@@ -142,7 +185,8 @@ cckit/
142
185
  .claude-plugin/ # the Claude Code plugin manifest
143
186
  skills/ commands/ # Claude Code skills + slash commands
144
187
  profiles/ templates/ # init profiles + scaffold templates
145
- docs-site/ # documentation source — Astro/Starlight (deployed to cckit.vercel.app)
188
+ routines/ modules/ # scheduled routines + optional modules
189
+ docs-site/ # documentation source — Astro/Starlight (deployed to cckit.dev)
146
190
  cckit.config.json # project configuration (no hardcoded org/repo)
147
191
  ```
148
192
 
@@ -161,7 +205,8 @@ More variants (HTML, flat-square): [docs/badge.md](docs/badge.md).
161
205
  ## Contributing
162
206
 
163
207
  Issues and PRs welcome — see [`CONTRIBUTING.md`](CONTRIBUTING.md). cckit develops itself with its
164
- own lifecycle (`cckit start` / `cckit pr`).
208
+ own lifecycle (`cckit start` / `cckit pr`), and `cckit contribute "<summary>"` opens a contribution
209
+ PR gated on the repo checks. Be curious, and be kind — that's how the open-source community works.
165
210
 
166
211
  ## Support
167
212
 
package/bin/cckit CHANGED
@@ -24,6 +24,7 @@
24
24
  # cckit watch [--merge] [--loop] captain: gate open PRs, squash-merge CLEAN, advance the wave
25
25
  # cckit next [--effort N] everyday helper: the unblocked set + how to start the top issue
26
26
  # cckit wave [--effort N] read open efforts, propose incoming waves: fan-out + captain drive
27
+ # cckit msg <send|read|list> session mail across projects: steer a live session (--steer)
27
28
  # cckit gc [--prune [--yes]] report (default) or prune merged branches + worktrees
28
29
  # cckit status thin dashboard: board + worktrees + resume handoff
29
30
  # cckit scan [--llm] detect this repo's stack + kit state (JSON)
@@ -102,6 +103,11 @@ case "$cmd" in
102
103
  if cckit_is_json; then cckit_json version "$v"; else echo "cckit $(ui_paint '1;36' "$v")"; fi
103
104
  ;;
104
105
  effort)
106
+ # Load the project config FIRST (like every sibling verb): KIT_REPO / KIT_BASE_BRANCH /
107
+ # KIT_PROJECTS_V2 drive repo resolution, the worktree base, and the board guard below —
108
+ # without this, effort start silently branches from origin/main on a non-main-based repo (#151).
109
+ # shellcheck source=/dev/null
110
+ source "$LIB/kit-config.sh" && load_kit_config
105
111
  # shellcheck source=/dev/null
106
112
  source "$LIB/effort.sh"
107
113
  # shellcheck source=/dev/null
@@ -261,6 +267,18 @@ case "$cmd" in
261
267
  status|ui) exec "$ROOT/scripts/status.sh" "$@" ;;
262
268
  resume) source "$LIB/handoff.sh"; handoff_read ;;
263
269
  handoff) source "$LIB/handoff.sh"; handoff_write "$@" ;;
270
+ msg)
271
+ # Session mail (#175) — pure git-local state (.cckit/mail at the root worktree), no config.
272
+ source "$LIB/kit-msg.sh"
273
+ sub="${1:-}"; shift || true
274
+ case "$sub" in
275
+ send) msg_send "$@" ;;
276
+ read) msg_read "$@" ;;
277
+ list) msg_list ;;
278
+ hook-check) msg_hook_check "$@" ;;
279
+ *) echo 'cckit msg <send|read|list|hook-check>' >&2; exit 2 ;;
280
+ esac
281
+ ;;
264
282
  install) exec "$ROOT/scripts/install.sh" "$@" ;;
265
283
  init) exec "$ROOT/scripts/init.sh" "$@" ;;
266
284
  commands)
package/cckit.config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./kit.config.schema.json",
3
- "kitVersion": "0.3.0",
3
+ "kitVersion": "0.4.1",
4
4
  "project": {
5
5
  "name": "cckit",
6
6
  "slug": "cckit",
@@ -44,7 +44,7 @@ Run the kit-doctor script to check all dependencies and authentication required
44
44
 
45
45
  4. If all Tier 1 checks pass:
46
46
  - Report success
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.
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.dev`. Do not hardcode `localhost:3001` — nothing serves it by default.
48
48
 
49
49
  ## Rules
50
50
 
@@ -105,8 +105,10 @@ _plug="$(jq -r '.version // "0.0.0"' "/Users/josegutierrezdelgado/.claude/plugin
105
105
  "${CLAUDE_PLUGIN_ROOT}/scripts/init.sh" --upgrade --target "$PWD" --dry-run
106
106
  ```
107
107
  Then run it for real to see the precise added/preserved report (step 4). Make clear: upgrade only
108
- **adds** missing files and **merges** new config keys — your existing `.claude/` files and
109
- `kit.config.json` values are never overwritten.
108
+ **adds** missing files and **merges** new required config keys — your existing `.claude/` files
109
+ (including a customized `.claude/statusline.sh` shim) and `kit.config.json` values are never
110
+ overwritten, and feature blocks your config deliberately lacks (`plans`, `specKit`, `prePush`,
111
+ `local`, `memory`) are never injected from profile defaults.
110
112
 
111
113
  4. **Confirm, then apply.** Ask with `AskUserQuestion`: **Apply update** · **Preview only** · **Skip**.
112
114
  Per the CLI-style preference, when the delta is purely additive (only new files, nothing preserved
@@ -122,8 +124,11 @@ _plug="$(jq -r '.version // "0.0.0"' "/Users/josegutierrezdelgado/.claude/plugin
122
124
 
123
125
  ## Rules
124
126
 
125
- - **Never clobber.** Upgrade only ADDS missing files and MERGES new `kit.config.json` keys; existing
126
- files and config values are preserved. Always show the `--dry-run` preview before applying.
127
+ - **Never clobber.** Upgrade only ADDS missing files and MERGES new required `kit.config.json` keys;
128
+ existing files and config values are preserved. A file the kit cannot prove it owns intact — edited
129
+ by the project or absent from the manifest (e.g. a repointed `.claude/statusline.sh`) — is kept, and
130
+ feature blocks the config deliberately lacks are never injected from profile defaults. Always show
131
+ the `--dry-run` preview before applying.
127
132
  - When reporting effective configuration, honor per-folder `.claudekit/config.json` overrides
128
133
  (nearest-wins) — see `scripts/lib/kit-config.sh`.
129
134
  - Don't fabricate changelog content — read `CHANGELOG.md`. If the project predates version tracking
@@ -68,6 +68,7 @@
68
68
  "type": "object",
69
69
  "additionalProperties": true,
70
70
  "properties": {
71
+ "flows": { "type": "array", "items": { "type": "string" }, "description": "Controlled flow vocabulary for effort titles — the values accepted by the leading [Flow] title tag and `--flow` (also the flow:<flow> labels). Replaces the built-in default (Core UI API Docs Infra Auth Data Web App); an explicit EFFORT_FLOWS env var still wins per invocation." },
71
72
  "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
  }
73
74
  },
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@jeiemgi/cckit",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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).",
7
- "homepage": "https://cckit.vercel.app",
7
+ "homepage": "https://cckit.dev",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/jeiemgi/cckit.git"
@@ -94,6 +94,40 @@ t "diff is only the kitVersion line" "$only_kitver" "yes"
94
94
  t "kitVersion bumped to plugin version" "$(jq -r '.kitVersion' .claude/kit.config.json)" "$PLUGIN_VERSION"
95
95
  t "upgrade block preserved through merge" "$(jq -r '.upgrade.removed | length' .claude/kit.config.json)" "2"
96
96
 
97
+ # --- #149: upgrade preserves existing project files -------------------------------------
98
+ # 4. feature keys deliberately absent from the config are NOT injected by the merge
99
+ # (the seed config never had plans/specKit/prePush/local/memory — profile defaults must
100
+ # not resurrect them), while REQUIRED structural keys still merge in.
101
+ for k in plans specKit prePush local memory; do
102
+ t "feature key '$k' not injected" "$(jq --arg k "$k" 'has($k)' .claude/kit.config.json)" "false"
103
+ done
104
+ t "required key 'knowledge' still added" "$(jq -r '.knowledge.dir // "absent"' .claude/kit.config.json)" "knowledge"
105
+
106
+ # 5. a CUSTOMIZED statusline shim survives the next upgrade (the v0.3.0 clobber: kit-wire
107
+ # replaced a repointed shim with the template on every upgrade).
108
+ git add -A && git commit -q -m "settle upgrade under test"
109
+ t "statusline shim exists after wire" "$([ -f .claude/statusline.sh ] && echo yes || echo no)" "yes"
110
+ SL_MARKER="# LOCAL-STATUSLINE-EDIT-#149 (must survive upgrade)"
111
+ printf '\n%s\n' "$SL_MARKER" >> .claude/statusline.sh
112
+ jq '.kitVersion = "0.0.2"' .claude/kit.config.json > .claude/kit.config.json.tmp \
113
+ && mv .claude/kit.config.json.tmp .claude/kit.config.json
114
+ git add -A && git commit -q -m "customize statusline + reset version"
115
+
116
+ CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$proj" >/dev/null 2>&1 \
117
+ || { echo "FAIL: statusline upgrade run exited non-zero"; exit 1; }
118
+ t "customized statusline preserved (tracked: modified)" "$(grep -cF "$SL_MARKER" .claude/statusline.sh)" "1"
119
+
120
+ # ...and also when the manifest is absent (fresh clone: shim exists but is UNTRACKED).
121
+ git add -A && git commit -q -m "settle statusline upgrade"
122
+ rm -f .claude/kit.manifest.json
123
+ jq '.kitVersion = "0.0.3"' .claude/kit.config.json > .claude/kit.config.json.tmp \
124
+ && mv .claude/kit.config.json.tmp .claude/kit.config.json
125
+ git add -A && git commit -q -m "reset version (manifest absent)"
126
+ CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$proj" >/dev/null 2>&1 \
127
+ || { echo "FAIL: manifest-absent upgrade run exited non-zero"; exit 1; }
128
+ t "customized statusline preserved (untracked)" "$(grep -cF "$SL_MARKER" .claude/statusline.sh)" "1"
129
+ t "feature keys still absent after repeat upgrades" "$(jq 'has("plans")' .claude/kit.config.json)" "false"
130
+
97
131
  echo ""
98
- [ "$fail" -eq 0 ] && echo "PASS: init.sh --upgrade honors the preserve/exclude contract (#334)" || echo "FAILED"
132
+ [ "$fail" -eq 0 ] && echo "PASS: init.sh --upgrade honors the preserve/exclude contract (#334, #149)" || echo "FAILED"
99
133
  exit "$fail"
package/scripts/init.sh CHANGED
@@ -308,7 +308,9 @@ if [[ $UPGRADE -eq 1 ]]; then
308
308
  [[ -z "$MEMORY" ]] && MEMORY="$(jq -r 'if .memory.enabled then "on" else "off" end' "$UP_CFG")"
309
309
  [[ -z "$SPECKIT" ]] && SPECKIT="$(jq -r 'if (.specKit.enabled // false) then "on" else "off" end' "$UP_CFG")"
310
310
  [[ -z "$LOCAL_LAYER" ]] && LOCAL_LAYER="$(jq -r 'if (.local.enabled // false) then "on" else "off" end' "$UP_CFG")"
311
- [[ -z "$PLANS_FORMAT" ]] && PLANS_FORMAT="$(jq -r '.plans.format // ""' "$UP_CFG")"
311
+ # A config with NO plans key at all deliberately runs without plan files — upgrade must not
312
+ # resurrect the profile default (and with it the plans rule + config block) (#149).
313
+ [[ -z "$PLANS_FORMAT" ]] && PLANS_FORMAT="$(jq -r 'if has("plans") then (.plans.format // "") else "none" end' "$UP_CFG")"
312
314
  [[ "$LANG_PREF" == "English" ]] && LANG_PREF="$(jq -r '.project.language // "English"' "$UP_CFG")"
313
315
  # Skill-name prefix: projects that namespace their kit skills (e.g. "kit-task-close") set
314
316
  # `skillPrefix` so upgrade scaffolds namespaced templates to the matching name instead of
@@ -621,8 +623,16 @@ jq -n \
621
623
  memory:{enabled:$mem,provider:"mempalace",wing:$wing,claudeProjectSlug:$cps}}' \
622
624
  > "$KITCFG.kit-new"
623
625
  if [[ $UPGRADE -eq 1 && -f "$KITCFG" ]]; then
624
- # deep-merge: existing values win (preserve user choices), new keys added, version bumped.
625
- jq -s --arg kitver "$PLUGIN_VERSION" '.[0] * .[1] | .kitVersion = $kitver' "$KITCFG.kit-new" "$KITCFG" \
626
+ # deep-merge: existing values win (preserve user choices), new REQUIRED keys added, version
627
+ # bumped. FEATURE blocks (plans/specKit/prePush/local/memory) are additive only when the
628
+ # project's config ALREADY has them — a missing feature key is a deliberate absence, and an
629
+ # upgrade must never inject profile defaults over it (#149).
630
+ jq -s --arg kitver "$PLUGIN_VERSION" '
631
+ .[1] as $have
632
+ | (.[0] | with_entries(.key as $k | select(
633
+ (["plans","specKit","prePush","local","memory"] | index($k)) == null
634
+ or ($have | has($k))))) as $tmpl
635
+ | $tmpl * $have | .kitVersion = $kitver' "$KITCFG.kit-new" "$KITCFG" \
626
636
  > "$KITCFG.merged" && mv "$KITCFG.merged" "$KITCFG"
627
637
  rm -f "$KITCFG.kit-new"
628
638
  # Existing values win in the merge — but an EXPLICIT --local flag is a user decision now,
@@ -815,9 +825,17 @@ echo " + .claude/settings.local.json${HOOK_NOTE:+ (}${HOOK_NOTE# + }${HOOK_NOTE
815
825
  # Runs on BOTH scaffold and --upgrade so every update re-wires (fixes the class of bug where
816
826
  # /kit-update refreshed files but never re-ran the wiring → statusline/settings drifted). #369
817
827
  if [[ -f "$KIT_ROOT/scripts/kit-wire.sh" ]]; then
828
+ # On --upgrade an EXISTING .claude/statusline.sh follows the same contract as safe_write: the
829
+ # conffiles guard in kit-operate keeps a customized (or untracked) shim; only a shim the kit
830
+ # provably owns intact is refreshed (#149).
831
+ _SHIM="$TARGET/.claude/statusline.sh"
832
+ _shim_before=""; [[ -f "$_SHIM" ]] && _shim_before="$(cat "$_SHIM" 2>/dev/null)"
818
833
  if ( cd "$TARGET" && CLAUDE_PLUGIN_ROOT="$KIT_ROOT" KIT_ASSUME_YES=1 bash "$KIT_ROOT/scripts/kit-wire.sh" >/dev/null 2>&1 ); then
819
834
  echo " + wired: statusline shim + settings.statusLine (kit-wire)"
820
835
  fi
836
+ if [[ $UPGRADE -eq 1 && -n "$_shim_before" && "$_shim_before" == "$(cat "$_SHIM" 2>/dev/null)" ]]; then
837
+ UPGRADE_PRESERVED+=(".claude/statusline.sh")
838
+ fi
821
839
  fi
822
840
 
823
841
  # ---- summary -------------------------------------------------------------
@@ -833,7 +833,7 @@ _admin_url="${CCKIT_ADMIN_URL:-http://localhost:3001}"
833
833
  if has_cmd curl && curl -fsS --max-time 1 "$_admin_url/onboarding" >/dev/null 2>&1; then
834
834
  printf ' %sOnboarding guide (web): %s/onboarding%s\n' "$C_DIM" "$_admin_url" "$C_RESET"
835
835
  else
836
- printf ' %sDocs & quick start: %shttps://cckit.vercel.app%s\n' "$C_DIM" "" "$C_RESET"
836
+ printf ' %sDocs & quick start: %shttps://cckit.dev%s\n' "$C_DIM" "" "$C_RESET"
837
837
  fi
838
838
  printf '\n'
839
839
 
@@ -92,7 +92,10 @@ kit_wire() {
92
92
  _kit_op_say "kit-wire: plugin root = $proot"
93
93
  mkdir -p .claude
94
94
  # 1. statusline shim (tier B — CLI only). kit_op_write_content runs the conffiles machine.
95
- _kit_shim_content | kit_op_write_content "$shim" B wire || return 1
95
+ # rc 10 = kept: a customized/untracked existing shim is PRESERVED (#149) — wiring continues;
96
+ # only a real error aborts. A project that repointed its shim keeps it across updates.
97
+ _kit_shim_content | kit_op_write_content "$shim" B wire
98
+ case $? in 0|10) ;; *) return 1;; esac
96
99
  [ -f "$shim" ] && [ -z "${KIT_DRY_RUN:-}" ] && chmod +x "$shim"
97
100
  # 2. settings statusLine -> shim
98
101
  _kit_wire_settings || true
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # effort-dispatch-test.sh — #151: the `effort)` dispatcher branch in bin/cckit must load the project
4
+ # config BEFORE sourcing/dispatching the effort libs. It shipped without it, so KIT_BASE_BRANCH was
5
+ # unset, `_eff_base` fell back to main, and `cckit effort start` silently created worktrees from
6
+ # origin/main on a non-main-based repo (and the KIT_PROJECTS_V2 board guard never fired via the CLI).
7
+ # Static contract test over bin/cckit: extract the branch block, assert load_kit_config comes first.
8
+ # Run: bash scripts/lib/effort-dispatch-test.sh
9
+ set -u
10
+ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
11
+ BIN="$ROOT/bin/cckit"
12
+ fail=0
13
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
14
+
15
+ # The effort) branch: from its case label to its terminating `;;` at branch indentation.
16
+ blk="$(awk '/^ effort\)/{f=1} f{print} f && /^ ;;$/{exit}' "$BIN")"
17
+ t "effort) branch found" "$([ -n "$blk" ] && echo yes)" "yes"
18
+
19
+ cfg_ln="$(printf '%s\n' "$blk" | grep -n 'load_kit_config' | head -1 | cut -d: -f1)"
20
+ lib_ln="$(printf '%s\n' "$blk" | grep -n 'source "\$LIB/effort\.sh"' | head -1 | cut -d: -f1)"
21
+ t "effort) loads the project config" "$([ -n "$cfg_ln" ] && echo yes)" "yes"
22
+ t "config load precedes the effort libs" "$([ -n "$cfg_ln" ] && [ -n "$lib_ln" ] && [ "$cfg_ln" -lt "$lib_ln" ] && echo yes)" "yes"
23
+
24
+ [ "$fail" -eq 0 ] && echo "ALL OK"
25
+ exit "$fail"
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # effort-flows-test.sh — #150: the flow vocabulary resolves from the project config, so
4
+ # `cckit effort new --flow X` works out of the box in any configured repo. Resolution order:
5
+ # explicit EFFORT_FLOWS env var (wins) -> effort.flows[] in the project config -> built-in default.
6
+ # Hermetic: throwaway configs pointed at via KIT_CONFIG (no network, no gh).
7
+ # Run: bash scripts/lib/effort-flows-test.sh
8
+ set -u
9
+ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
10
+ LIB="$ROOT/scripts/lib"
11
+ fail=0
12
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
13
+ command -v jq >/dev/null 2>&1 || { echo "effort-flows-test: jq required — skipping"; exit 0; }
14
+
15
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
16
+ printf '%s' '{"github":{"repo":"o/r"},"effort":{"flows":["Growth","Checkout","Platform"]}}' > "$tmp/flows.json"
17
+ printf '%s' '{"github":{"repo":"o/r"}}' > "$tmp/noflows.json"
18
+
19
+ # flows_for <cfg> [VAR=val …] — source effort.sh under a given config + env; print resolved EFFORT_FLOWS.
20
+ # KIT_REPO is pre-set so effort.sh's own config bootstrap is skipped — this isolates the #150 resolver.
21
+ flows_for() {
22
+ local cfg="$1"; shift
23
+ env -i PATH="$PATH" HOME="${HOME:-/tmp}" KIT_CONFIG="$cfg" KIT_REPO="o/r" "$@" \
24
+ bash -c "source '$LIB/effort.sh' 2>/dev/null; printf '%s' \"\$EFFORT_FLOWS\""
25
+ }
26
+
27
+ # 1. effort.flows[] in the config replaces the built-in default.
28
+ t "effort.flows[] resolves from the project config" \
29
+ "$(flows_for "$tmp/flows.json")" "Growth Checkout Platform"
30
+ # 2. an explicit EFFORT_FLOWS env var still wins over the config.
31
+ t "EFFORT_FLOWS env var wins over the config" \
32
+ "$(flows_for "$tmp/flows.json" EFFORT_FLOWS="Alpha Beta")" "Alpha Beta"
33
+ # 3. no effort.flows in the config -> the built-in default.
34
+ t "no effort.flows -> built-in default" \
35
+ "$(flows_for "$tmp/noflows.json")" "Core UI API Docs Infra Auth Data Web App"
36
+ # 4. an already-exported KIT_EFFORT_FLOWS (load_kit_config) is honored without re-reading the file.
37
+ t "exported KIT_EFFORT_FLOWS is honored" \
38
+ "$(flows_for "$tmp/noflows.json" KIT_EFFORT_FLOWS="Ops Sales")" "Ops Sales"
39
+
40
+ # 5. the title lint enforces the CONFIGURED vocabulary.
41
+ lint_rc() {
42
+ env -i PATH="$PATH" HOME="${HOME:-/tmp}" KIT_CONFIG="$tmp/flows.json" KIT_REPO="o/r" \
43
+ bash -c "source '$LIB/effort.sh' 2>/dev/null; effort_title_lint \"\$1\" >/dev/null 2>&1" _ "$1"
44
+ }
45
+ lint_rc "[Effort] 9 · [Growth] faster onboarding"; t "lint accepts a config flow" "$?" "0"
46
+ lint_rc "[Effort] 9 · [Core] faster onboarding"; t "lint rejects a flow outside the config vocabulary" "$?" "1"
47
+
48
+ # 6. load_kit_config exports KIT_EFFORT_FLOWS (space-joined) for every downstream consumer.
49
+ t "load_kit_config exports KIT_EFFORT_FLOWS" \
50
+ "$(env -i PATH="$PATH" HOME="${HOME:-/tmp}" KIT_CONFIG="$tmp/flows.json" \
51
+ bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; printf '%s' \"\$KIT_EFFORT_FLOWS\"")" \
52
+ "Growth Checkout Platform"
53
+
54
+ [ "$fail" -eq 0 ] && echo "ALL OK (effort-flows)" || echo "effort-flows: FAILURES"
55
+ exit "$fail"