@codewizard-dt/bootstrap 2.17.0 → 2.19.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/lib/hooks/README.md +94 -3
- package/lib/hooks/absolute-path-guard.js +5 -0
- package/lib/hooks/claude-settings-guard.js +5 -0
- package/lib/hooks/env-content-read-guard.js +13 -3
- package/lib/hooks/env-file-guard.js +42 -0
- package/lib/hooks/interpreter-indirection-guard.js +7 -0
- package/lib/hooks/lib/command-parse.js +8 -0
- package/lib/hooks/lib/serena-languages.js +94 -1
- package/lib/hooks/lib/serena.js +228 -0
- package/lib/hooks/mv-absolute-path-block.js +84 -3
- package/lib/hooks/package-install-consent.js +11 -0
- package/lib/hooks/protected-write-guard.js +7 -0
- package/lib/hooks/serena-bash-grep-block.js +507 -44
- package/lib/hooks/serena-first-glob-guard.js +65 -20
- package/lib/hooks/serena-first-guard.js +98 -2
- package/lib/hooks/serena-first-read-guard.js +92 -2
- package/lib/hooks/serena-pre-delegation.js +123 -0
- package/lib/hooks/serena-write-guard.js +56 -3
- package/lib/scripts/README.md +306 -1
- package/lib/scripts/bootstrap-prefs.js +734 -0
- package/lib/scripts/install-global.sh +188 -18
- package/lib/scripts/install-mcps.sh +102 -14
- package/lib/scripts/lib.sh +581 -11
- package/lib/scripts/merge-gitignore.sh +201 -15
- package/lib/scripts/sync-wiki-scaffold.sh +33 -4
- package/lib/scripts/templates/CLAUDE-wiki.md +1 -1
- package/lib/scripts/templates/bootstrap-prefs-schema.json +175 -0
- package/lib/scripts/update-project.sh +42 -9
- package/lib/skills/README.md +2 -1
- package/lib/skills/bootstrap-config/SKILL.md +154 -0
- package/lib/skills/git-commit/SKILL.md +89 -6
- package/lib/skills/research/SKILL.md +34 -3
- package/lib/skills/simplify/SKILL.md +1 -1
- package/lib/skills/uat-auto/SKILL.md +9 -4
- package/lib/skills/uat-auto-plus/SKILL.md +6 -6
- package/lib/skills/uat-generate/SKILL.md +47 -7
- package/lib/skills/uat-walk/UAT-CORE.md +41 -6
- package/lib/skills/wiki-query/SKILL.md +48 -8
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ set -euo pipefail
|
|
|
3
3
|
|
|
4
4
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
5
|
TEMPLATE_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
6
|
+
# shellcheck source=lib.sh
|
|
7
|
+
. "$SCRIPT_DIR/lib.sh"
|
|
6
8
|
GLOBAL_SKILLS_DIR="$HOME/.claude/skills"
|
|
7
9
|
|
|
8
10
|
# Stale global skill folders from the wiki rename (adr -> decision, prd -> req)
|
|
@@ -16,8 +18,8 @@ for arg in "$@"; do
|
|
|
16
18
|
[ "$arg" = "--skip-mcps" ] && SKIP_MCPS=true
|
|
17
19
|
done
|
|
18
20
|
|
|
19
|
-
# Local/offline-safe steps (1-
|
|
20
|
-
# always land; the network-dependent MCP install runs last (step
|
|
21
|
+
# Local/offline-safe steps (1-7) run first so hooks, skills, and settings
|
|
22
|
+
# always land; the network-dependent MCP install runs last (step 8), guarded
|
|
21
23
|
# so a failure cannot abort the script under `set -euo pipefail`.
|
|
22
24
|
|
|
23
25
|
# 1. Install hooks globally
|
|
@@ -55,21 +57,23 @@ if [ ${#ORPHAN_FOUND[@]} -gt 0 ]; then
|
|
|
55
57
|
echo " $p"
|
|
56
58
|
done
|
|
57
59
|
echo ""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
# Sticky: asked once, then remembered (skills.pruneOrphans, global scope —
|
|
61
|
+
# this script has no project dir). The key decides only WHETHER the removal
|
|
62
|
+
# runs; which folders qualify is fixed by ORPHAN_SKILLS above.
|
|
63
|
+
#
|
|
64
|
+
# prompt_yn_sticky answers no in a non-interactive terminal, prints its own
|
|
65
|
+
# "skipping prompt, answering no" note, and records NOTHING — so one CI run
|
|
66
|
+
# cannot bake a permanent decline into the user's store. That path falls into
|
|
67
|
+
# the else branch below, which is therefore the single "nothing was deleted"
|
|
68
|
+
# message for both the declined and the non-interactive case, and carries the
|
|
69
|
+
# manual-removal escape route with it.
|
|
70
|
+
if prompt_yn_sticky skills.pruneOrphans --global "Delete these ${#ORPHAN_FOUND[@]} folder(s)? [y/N]: "; then
|
|
71
|
+
for p in "${ORPHAN_FOUND[@]}"; do
|
|
72
|
+
rm -rf "$p"
|
|
73
|
+
done
|
|
74
|
+
echo "Removed."
|
|
71
75
|
else
|
|
72
|
-
echo "
|
|
76
|
+
echo "Skipped. To remove manually: rm -rf ~/.claude/skills/{adr-create,adr-finalize,adr-next,adr-walkthrough,prd-create,prd-finalize,prd-extract-decisions,prd-update,prd-trash,prd-compile}"
|
|
73
77
|
fi
|
|
74
78
|
fi
|
|
75
79
|
|
|
@@ -120,7 +124,173 @@ case "$FILE_SUGGESTION_OUT" in
|
|
|
120
124
|
esac
|
|
121
125
|
echo ""
|
|
122
126
|
|
|
123
|
-
# 6.
|
|
127
|
+
# 6. Install the preference helper into ~/.claude/ so the skills installed in
|
|
128
|
+
# step 2 can actually read the store.
|
|
129
|
+
#
|
|
130
|
+
# Skills are copied to ~/.claude/skills/ and then run inside ARBITRARY
|
|
131
|
+
# projects, which may not be a bootstrap checkout and usually are not. A skill
|
|
132
|
+
# that reads a preference therefore cannot reach lib/scripts/bootstrap-prefs.js
|
|
133
|
+
# the way the installer scripts do (lib.sh resolves it from its own directory
|
|
134
|
+
# at source time). Giving the helper a fixed, project-independent home is what
|
|
135
|
+
# makes `consumer: skill` keys readable at all — same precedent, and the same
|
|
136
|
+
# directory, as the file-suggestion picker installed in step 5.
|
|
137
|
+
#
|
|
138
|
+
# The schema goes to ~/.claude/templates/ rather than beside the helper
|
|
139
|
+
# because bootstrap-prefs.js resolves it as <its own dir>/templates/
|
|
140
|
+
# (bootstrap-prefs.js:111). Preserving that layout means a skill invokes the
|
|
141
|
+
# helper with NO --schema flag and still gets validation and defaults; a
|
|
142
|
+
# flattened copy would silently drop both, and a dropped default turns an
|
|
143
|
+
# unanswered key from "the documented default" into "unset" at every call
|
|
144
|
+
# site that forgot the flag.
|
|
145
|
+
echo "Installing preference helper (~/.claude/bootstrap-prefs.js)..."
|
|
146
|
+
if [ -f "$SCRIPT_DIR/bootstrap-prefs.js" ] && [ -f "$SCRIPT_DIR/templates/bootstrap-prefs-schema.json" ]; then
|
|
147
|
+
mkdir -p "$HOME/.claude/templates"
|
|
148
|
+
cp "$SCRIPT_DIR/bootstrap-prefs.js" "$HOME/.claude/bootstrap-prefs.js"
|
|
149
|
+
cp "$SCRIPT_DIR/templates/bootstrap-prefs-schema.json" "$HOME/.claude/templates/bootstrap-prefs-schema.json"
|
|
150
|
+
echo " Installed. Skills read preferences with: node ~/.claude/bootstrap-prefs.js --get <key> --project ."
|
|
151
|
+
else
|
|
152
|
+
echo "Warning: bootstrap-prefs.js or its schema not found — skills will read every preference as unset (today's behavior)." >&2
|
|
153
|
+
fi
|
|
154
|
+
echo ""
|
|
155
|
+
|
|
156
|
+
# 7. Settle the skill-consent preferences that have never been answered.
|
|
157
|
+
#
|
|
158
|
+
# These are the schema's `consumer: skill` keys: the ones that change what a
|
|
159
|
+
# SLASH COMMAND does, not what the installer installs. They are asked here,
|
|
160
|
+
# once, in a batch, rather than mid-task by each skill — a user answers a
|
|
161
|
+
# short list during a sync they already chose to run instead of being
|
|
162
|
+
# interrupted while committing.
|
|
163
|
+
#
|
|
164
|
+
# ONLY GENUINELY UNANSWERED KEYS ARE ASKED, and "unanswered" is measured with
|
|
165
|
+
# prefs_stored_global, not prefs_get. See that function's banner in lib.sh:
|
|
166
|
+
# every one of these keys except gitCommit.versionBump's siblings carries a
|
|
167
|
+
# non-null schema default, so a prefs_get-based check reports them all as
|
|
168
|
+
# settled and this pass would ask nothing, forever, while looking like it
|
|
169
|
+
# worked. A key already stored as `false` or `ask` is a SETTLED answer and is
|
|
170
|
+
# never re-asked — re-prompting a decline is the exact annoyance this
|
|
171
|
+
# mechanism exists to remove.
|
|
172
|
+
#
|
|
173
|
+
# GLOBAL SCOPE. install-global.sh takes no project path, so it cannot know
|
|
174
|
+
# which checkout the user means. All five keys are `scope: either`, so the
|
|
175
|
+
# answer recorded here is the machine-wide default and a project file can
|
|
176
|
+
# still override it per checkout later.
|
|
177
|
+
#
|
|
178
|
+
# TTY-GUARDED AS A WHOLE, not per key. A non-interactive run prints one note
|
|
179
|
+
# and writes NOTHING — no answers, and no preferences file either, because
|
|
180
|
+
# prefs_stored_global's --list probe is read-only and is not even reached.
|
|
181
|
+
# One CI run must never bake a permanent answer into a user's store.
|
|
182
|
+
PREFS_ASKED=0
|
|
183
|
+
|
|
184
|
+
# <key> <question> — the yes/no/ask shape shared by four of the five keys.
|
|
185
|
+
# `skip` is the resolved value for a bare Enter or EOF and records nothing, so
|
|
186
|
+
# an accidental keystroke leaves the question open instead of settling it.
|
|
187
|
+
settle_skill_pref() {
|
|
188
|
+
local key question answer
|
|
189
|
+
key="$1"
|
|
190
|
+
question="$2"
|
|
191
|
+
if prefs_stored_global "$key"; then
|
|
192
|
+
return 0
|
|
193
|
+
fi
|
|
194
|
+
echo ""
|
|
195
|
+
echo " $question"
|
|
196
|
+
answer="$(prompt_letter_choice skip " [y]es / [n]o / [a]sk me every time / [s]kip for now: " yes no ask skip)"
|
|
197
|
+
case "$answer" in
|
|
198
|
+
yes) prefs_set "$key" --global true ; echo " $key = true" ;;
|
|
199
|
+
no) prefs_set "$key" --global false ; echo " $key = false" ;;
|
|
200
|
+
ask) prefs_set "$key" --global ask ; echo " $key = ask (you will be prompted every run; the answer is never stored)" ;;
|
|
201
|
+
*) echo " $key left unanswered — today's behavior is unchanged, and you will be asked again next sync." ;;
|
|
202
|
+
esac
|
|
203
|
+
PREFS_ASKED=$(( PREFS_ASKED + 1 ))
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
echo "Checking skill preferences (~/.claude/bootstrap-prefs.json)..."
|
|
207
|
+
if ! has_tty; then
|
|
208
|
+
echo " Non-interactive terminal: skipping the preference questions. Every unanswered key keeps today's behavior."
|
|
209
|
+
else
|
|
210
|
+
# gitCommit.versionBump is the odd one out: its grammar is auto/confirm/never
|
|
211
|
+
# and `confirm` IS its ask state, so it deliberately has no `ask` value and
|
|
212
|
+
# cannot go through settle_skill_pref.
|
|
213
|
+
if ! prefs_stored_global gitCommit.versionBump; then
|
|
214
|
+
echo ""
|
|
215
|
+
echo " Should /git-commit bump the version in package.json (and every other manifest) before committing?"
|
|
216
|
+
echo " Say 'never' for apps and private repos; 'auto' for published packages. The [patch]/[minor]/[major]"
|
|
217
|
+
echo " subject prefix follows the bump — written when one happens, omitted when it doesn't."
|
|
218
|
+
VERSION_BUMP_ANSWER="$(prompt_letter_choice skip " [a]uto / [c]onfirm each time / [n]ever / [s]kip for now: " auto confirm never skip)"
|
|
219
|
+
case "$VERSION_BUMP_ANSWER" in
|
|
220
|
+
auto|confirm|never)
|
|
221
|
+
prefs_set gitCommit.versionBump --global "$VERSION_BUMP_ANSWER"
|
|
222
|
+
echo " gitCommit.versionBump = $VERSION_BUMP_ANSWER"
|
|
223
|
+
;;
|
|
224
|
+
*)
|
|
225
|
+
echo " gitCommit.versionBump left unanswered — today's behavior (auto) is unchanged, and you will be asked again next sync."
|
|
226
|
+
;;
|
|
227
|
+
esac
|
|
228
|
+
PREFS_ASKED=$(( PREFS_ASKED + 1 ))
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
settle_skill_pref gitCommit.autoPush \
|
|
232
|
+
"Should /git-commit push the current branch after committing? (Default no — this turns a local action into a published one. It never creates a branch either way.)"
|
|
233
|
+
settle_skill_pref research.persistToRaw \
|
|
234
|
+
"Should /research save its report and sources to raw/research/ by default? (Findings always appear in the reply; this governs the file write only, and you can still decline any single report.)"
|
|
235
|
+
# uatGenerate.promoteTests is the second key that cannot go through
|
|
236
|
+
# settle_skill_pref: its grammar is sibling|never|dedicated (plus the
|
|
237
|
+
# parameterized dedicated:<path>), not true|false|ask.
|
|
238
|
+
#
|
|
239
|
+
# THE OPTION NAMED HERE IS `beside`, THE VALUE STORED IS `sibling`.
|
|
240
|
+
# prompt_letter_choice matches on FIRST LETTER and takes the first listed name
|
|
241
|
+
# that matches, so offering `sibling` alongside `skip` would silently make one
|
|
242
|
+
# of the two unreachable — whichever came second could never be typed. `beside`
|
|
243
|
+
# collides with nothing and reads better in the prompt; the case below maps it
|
|
244
|
+
# back to the schema's value.
|
|
245
|
+
if ! prefs_stored_global uatGenerate.promoteTests; then
|
|
246
|
+
echo ""
|
|
247
|
+
echo " Where should /uat-generate write the unit tests it promotes out of UAT cases?"
|
|
248
|
+
echo " A dedicated folder keeps the suite in one place; beside puts src/parse.ts's test at"
|
|
249
|
+
echo " src/parse.test.ts. A project's existing layout always wins over this answer."
|
|
250
|
+
TEST_LOCATION_ANSWER="$(prompt_letter_choice skip \
|
|
251
|
+
" [d]edicated folder / [b]eside each file / [n]ever write tests / [s]kip for now: " \
|
|
252
|
+
dedicated beside never skip)"
|
|
253
|
+
case "$TEST_LOCATION_ANSWER" in
|
|
254
|
+
dedicated)
|
|
255
|
+
# No follow-up asking WHICH folder. `values` is a closed enumeration of
|
|
256
|
+
# literal tokens, and that closedness is what guarantees no preference key
|
|
257
|
+
# can hold an arbitrary string (see the schema's own no-secrets rule) — a
|
|
258
|
+
# stored path would be exactly that. The skill resolves the directory from
|
|
259
|
+
# the repo instead: an existing test directory, else the language default.
|
|
260
|
+
prefs_set uatGenerate.promoteTests --global dedicated
|
|
261
|
+
echo " uatGenerate.promoteTests = dedicated"
|
|
262
|
+
;;
|
|
263
|
+
beside)
|
|
264
|
+
prefs_set uatGenerate.promoteTests --global sibling
|
|
265
|
+
echo " uatGenerate.promoteTests = sibling"
|
|
266
|
+
;;
|
|
267
|
+
never)
|
|
268
|
+
prefs_set uatGenerate.promoteTests --global never
|
|
269
|
+
echo " uatGenerate.promoteTests = never"
|
|
270
|
+
;;
|
|
271
|
+
*)
|
|
272
|
+
echo " uatGenerate.promoteTests left unanswered — today's behavior (a dedicated test folder) is unchanged, and you will be asked again next sync."
|
|
273
|
+
;;
|
|
274
|
+
esac
|
|
275
|
+
PREFS_ASKED=$(( PREFS_ASKED + 1 ))
|
|
276
|
+
fi
|
|
277
|
+
|
|
278
|
+
settle_skill_pref gitignore.offerSectionUpdates \
|
|
279
|
+
"Should setup/update offer .gitignore template section updates? (No stops the opening question entirely. The .git/info/exclude block is separate and is unaffected.)"
|
|
280
|
+
|
|
281
|
+
if [ "$PREFS_ASKED" -eq 0 ]; then
|
|
282
|
+
echo " All skill preferences already answered — nothing to ask."
|
|
283
|
+
else
|
|
284
|
+
echo ""
|
|
285
|
+
echo " Stored in $HOME/.claude/bootstrap-prefs.json (see bootstrap-prefs.README.md beside it for what each key does)."
|
|
286
|
+
echo " Change an answer: node ~/.claude/bootstrap-prefs.js --set <key> --value <value> --global"
|
|
287
|
+
echo " Re-open a question: node ~/.claude/bootstrap-prefs.js --unset <key> --global"
|
|
288
|
+
echo " Or run /bootstrap-config."
|
|
289
|
+
fi
|
|
290
|
+
fi
|
|
291
|
+
echo ""
|
|
292
|
+
|
|
293
|
+
# 8. Ensure global MCP servers are installed (user scope, non-interactive) —
|
|
124
294
|
# LAST because it is the only network-dependent step, and guarded so a
|
|
125
295
|
# failure warns instead of aborting the local installs above.
|
|
126
296
|
# Pass --skip-mcps when MCPs were already handled interactively by the caller.
|
|
@@ -132,4 +302,4 @@ if [ "$SKIP_MCPS" = false ]; then
|
|
|
132
302
|
echo ""
|
|
133
303
|
fi
|
|
134
304
|
|
|
135
|
-
echo "Global setup complete (hooks + skills + deny list + hooks wiring + file suggestion + MCPs)."
|
|
305
|
+
echo "Global setup complete (hooks + skills + deny list + hooks wiring + file suggestion + preferences + MCPs)."
|
|
@@ -56,7 +56,7 @@ mcp_add_scoped() {
|
|
|
56
56
|
fi
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
# register_optional_mcp <name> <interactive-prompt> <adder-fn> [expected] [fixed_scope]
|
|
59
|
+
# register_optional_mcp <name> <interactive-prompt> <adder-fn> [expected] [fixed_scope] [pref_key] [scope_pref_key]
|
|
60
60
|
# Common wrapper for the optional MCPs (brave-search / context7 / playwright):
|
|
61
61
|
# skip if already installed; in interactive mode gate on a y/n prompt and ask
|
|
62
62
|
# for scope; otherwise install non-interactively at user scope. <adder-fn>
|
|
@@ -69,8 +69,24 @@ mcp_add_scoped() {
|
|
|
69
69
|
# it is repository/machine config we don't own; we skip and say so.
|
|
70
70
|
# Optional [fixed_scope]: skip the scope prompt and use this scope (for MCPs
|
|
71
71
|
# that only support one scope — asking and ignoring the answer is worse).
|
|
72
|
+
#
|
|
73
|
+
# Optional [pref_key] / [scope_pref_key]: bootstrap-prefs keys for the install
|
|
74
|
+
# question and for the scope question respectively. Both default to empty, and
|
|
75
|
+
# empty means "no preference — behave exactly as before", so any caller that has
|
|
76
|
+
# not opted in is unaffected. bash 3.2, so these are positional only: pass "" for
|
|
77
|
+
# an unused slot in between. Both MCPs wired here are machine-wide, so both keys
|
|
78
|
+
# are read and written at --global, matching their `scope` in
|
|
79
|
+
# bootstrap-prefs-schema.json (the schema is the authority on the selector, not
|
|
80
|
+
# the call site's convenience). [scope_pref_key] is moot when [fixed_scope] is
|
|
81
|
+
# set — no scope question is asked at all in that case.
|
|
72
82
|
register_optional_mcp() {
|
|
73
|
-
local name="$1" prompt="$2" adder="$3" expected="${4:-}" fixed_scope="${5:-}"
|
|
83
|
+
local name="$1" prompt="$2" adder="$3" expected="${4:-}" fixed_scope="${5:-}"
|
|
84
|
+
local pref_key="${6:-}" scope_pref_key="${7:-}" scope cur_scope answered
|
|
85
|
+
# The mcp_installed short-circuit stays FIRST, ahead of every preference read.
|
|
86
|
+
# Side-effect stickiness is the cheapest and most accurate "already installed"
|
|
87
|
+
# signal there is; preferences only decide what happens when it is NOT
|
|
88
|
+
# installed. A prefs lookup ahead of this check would cost a node process on
|
|
89
|
+
# the common no-op path and buy nothing.
|
|
74
90
|
if mcp_installed "$name"; then
|
|
75
91
|
if [ -z "$expected" ] || mcp_matches "$name" "$expected"; then
|
|
76
92
|
echo " $name: already installed, skipping."
|
|
@@ -88,9 +104,18 @@ register_optional_mcp() {
|
|
|
88
104
|
return 0
|
|
89
105
|
fi
|
|
90
106
|
if [ "$INTERACTIVE" = true ]; then
|
|
91
|
-
if
|
|
107
|
+
# Captured with if/else rather than called bare: "no" is a valid answer, and
|
|
108
|
+
# a bare failing call would abort this script under `set -euo pipefail`.
|
|
109
|
+
if [ -n "$pref_key" ]; then
|
|
110
|
+
if prompt_yn_sticky "$pref_key" --global "$prompt"; then answered=true; else answered=false; fi
|
|
111
|
+
else
|
|
112
|
+
if prompt_yn "$prompt"; then answered=true; else answered=false; fi
|
|
113
|
+
fi
|
|
114
|
+
if [ "$answered" = true ]; then
|
|
92
115
|
if [ -n "$fixed_scope" ]; then
|
|
93
116
|
scope="$fixed_scope"
|
|
117
|
+
elif [ -n "$scope_pref_key" ]; then
|
|
118
|
+
scope="$(prompt_scope "$name" "$scope_pref_key" --global)"
|
|
94
119
|
else
|
|
95
120
|
scope="$(prompt_scope "$name")"
|
|
96
121
|
fi
|
|
@@ -98,6 +123,19 @@ register_optional_mcp() {
|
|
|
98
123
|
echo " $name MCP installed."
|
|
99
124
|
fi
|
|
100
125
|
else
|
|
126
|
+
# Non-interactive: honour a stored decline, ask nothing, and WRITE NOTHING.
|
|
127
|
+
# install-global.sh runs this script WITHOUT --interactive, so without this
|
|
128
|
+
# check a user who declined Brave Search during an interactive `setup` would
|
|
129
|
+
# have it silently installed by the very next `bootstrap install`. Read with
|
|
130
|
+
# prefs_get directly and never through a prompt helper — a prompt helper on
|
|
131
|
+
# this path could record an answer nobody was asked for, and one CI run would
|
|
132
|
+
# then bake in a permanent decision with no prompt left to change it with.
|
|
133
|
+
# Only a stored `false` changes behaviour; `true`, `ask` and `unset` all keep
|
|
134
|
+
# today's unconditional install exactly as it was.
|
|
135
|
+
if [ -n "$pref_key" ] && [ "$(prefs_get "$pref_key" --global)" = "false" ]; then
|
|
136
|
+
echo " $name: skipped (remembered decline — change with /bootstrap-config)"
|
|
137
|
+
return 0
|
|
138
|
+
fi
|
|
101
139
|
echo " Installing $name MCP..."
|
|
102
140
|
"$adder" user
|
|
103
141
|
echo " $name MCP installed."
|
|
@@ -283,7 +321,11 @@ if [ -n "$PROJECT_DIR" ]; then
|
|
|
283
321
|
# Consent-gated: .mcp.json may be committed team config, so the removal is
|
|
284
322
|
# offered, never forced; declining keeps the existing entry working.
|
|
285
323
|
if [ -f "$PROJECT_DIR/.mcp.json" ] && grep -q '"serena"' "$PROJECT_DIR/.mcp.json" 2>/dev/null; then
|
|
286
|
-
|
|
324
|
+
# Sticky: asked once per project, then remembered. The selector is safe to
|
|
325
|
+
# pass unguarded because the enclosing `[ -n "$PROJECT_DIR" ]` above already
|
|
326
|
+
# guarantees it is non-empty — an empty selector would write the prefs file
|
|
327
|
+
# into whatever directory the installer happened to be run from.
|
|
328
|
+
if [ "$INTERACTIVE" = true ] && prompt_yn_sticky mcp.serenaMigrate "$PROJECT_DIR" " serena: found in this project's .mcp.json (added by an earlier bootstrap; carries a machine-specific path). Move it to local scope in ~/.claude.json? [y/N]: "; then
|
|
287
329
|
( cd "$PROJECT_DIR" && claude mcp remove serena -s project ) || true
|
|
288
330
|
else
|
|
289
331
|
echo " serena: leaving the existing .mcp.json entry in place (migrate later by re-running 'npx @codewizard-dt/bootstrap update')."
|
|
@@ -292,7 +334,11 @@ if [ -n "$PROJECT_DIR" ]; then
|
|
|
292
334
|
if serena_installed "$PROJECT_DIR"; then
|
|
293
335
|
echo " serena: already registered for this project, skipping."
|
|
294
336
|
elif [ "$INTERACTIVE" = true ]; then
|
|
295
|
-
|
|
337
|
+
# The serena_installed check above still wins: an already-registered Serena
|
|
338
|
+
# short-circuits here before any preference is consulted, exactly like the
|
|
339
|
+
# mcp_installed short-circuit in register_optional_mcp. Selector is
|
|
340
|
+
# non-empty for the same reason as the migrate prompt above.
|
|
341
|
+
if prompt_yn_sticky mcp.serena "$PROJECT_DIR" "Install Serena MCP (code exploration & editing, always local scope)? [Y/n]: "; then
|
|
296
342
|
( cd "$PROJECT_DIR" && \
|
|
297
343
|
claude mcp add --scope local serena -- \
|
|
298
344
|
uvx --from git+https://github.com/oraios/serena \
|
|
@@ -307,11 +353,18 @@ fi
|
|
|
307
353
|
# ---------------------------------------------------------------------------
|
|
308
354
|
# Optional MCPs (near-identical wrappers — see register_optional_mcp above)
|
|
309
355
|
# ---------------------------------------------------------------------------
|
|
356
|
+
# brave-search pins fixed_scope=user, so it asks no scope question and needs no
|
|
357
|
+
# scope key — only $6. The API-key prompt inside _add_brave is deliberately NOT
|
|
358
|
+
# sticky and never reaches the store: no preference key holds a secret.
|
|
310
359
|
register_optional_mcp brave-search \
|
|
311
|
-
"Install Brave Search MCP globally (web research, requires API key + Docker)? [y/N]: " _add_brave "$BRAVE_MCP_URL" user
|
|
360
|
+
"Install Brave Search MCP globally (web research, requires API key + Docker)? [y/N]: " _add_brave "$BRAVE_MCP_URL" user \
|
|
361
|
+
mcp.braveSearch
|
|
312
362
|
|
|
363
|
+
# context7 takes neither [expected] nor [fixed_scope], so both slots are passed
|
|
364
|
+
# empty to reach the two preference keys — positional args, bash 3.2.
|
|
313
365
|
register_optional_mcp context7 \
|
|
314
|
-
"Install Context7 MCP (library documentation lookups)? [y/N]: " _add_context7
|
|
366
|
+
"Install Context7 MCP (library documentation lookups)? [y/N]: " _add_context7 \
|
|
367
|
+
"" "" mcp.context7 mcp.context7Scope
|
|
315
368
|
|
|
316
369
|
# _disable_project_playwright_locally
|
|
317
370
|
# Rejects the project's .mcp.json `playwright` on THIS machine only, via
|
|
@@ -368,11 +421,20 @@ _install_playwright_flow() {
|
|
|
368
421
|
if ! mcp_installed playwright; then
|
|
369
422
|
# Fresh install (same gating as register_optional_mcp).
|
|
370
423
|
if [ "$INTERACTIVE" = true ]; then
|
|
371
|
-
|
|
424
|
+
# mcp.playwright is global scope per the schema, and covers this
|
|
425
|
+
# fresh-install path ONLY — the conflict paths have their own keys.
|
|
426
|
+
if prompt_yn_sticky mcp.playwright --global "Install Playwright MCP (browser automation & UI testing)? [y/N]: "; then
|
|
372
427
|
_add_playwright user "$PLAYWRIGHT_MCP_NAME"
|
|
373
428
|
echo " playwright MCP installed."
|
|
374
429
|
fi
|
|
375
430
|
else
|
|
431
|
+
# Non-interactive: honour a stored decline, ask nothing, write nothing —
|
|
432
|
+
# same reasoning as register_optional_mcp's non-interactive branch. Only
|
|
433
|
+
# `false` diverts; true/ask/unset keep the unconditional install.
|
|
434
|
+
if [ "$(prefs_get mcp.playwright --global)" = "false" ]; then
|
|
435
|
+
echo " playwright: skipped (remembered decline — change with /bootstrap-config)"
|
|
436
|
+
return 0
|
|
437
|
+
fi
|
|
376
438
|
echo " Installing playwright MCP..."
|
|
377
439
|
_add_playwright user "$PLAYWRIGHT_MCP_NAME"
|
|
378
440
|
echo " playwright MCP installed."
|
|
@@ -399,7 +461,10 @@ _install_playwright_flow() {
|
|
|
399
461
|
fi
|
|
400
462
|
|
|
401
463
|
# Conflict: playwright registered at project/local scope (or undetectable).
|
|
402
|
-
|
|
464
|
+
# `! has_tty` rather than a bare `[ ! -t 0 ]`: the helper honours the
|
|
465
|
+
# BOOTSTRAP_ASSUME_TTY test seam, which is the only way a test harness (whose
|
|
466
|
+
# child always gets a pipe for stdin) can reach the conflict flow at all.
|
|
467
|
+
if [ "$INTERACTIVE" != true ] || ! has_tty || [ -z "$PROJECT_DIR" ] || [ "$pw_scope" = "unknown" ]; then
|
|
403
468
|
echo " playwright: an existing ${pw_scope}-scope registration was found — leaving everything untouched."
|
|
404
469
|
echo " Resolve interactively: run 'npx @codewizard-dt/bootstrap update' in a terminal to choose how to proceed."
|
|
405
470
|
return 0
|
|
@@ -412,16 +477,37 @@ _install_playwright_flow() {
|
|
|
412
477
|
echo " [1] Register the bootstrap shared server as '$PLAYWRIGHT_MCP_ALT_NAME' and disable the project one on this machine only"
|
|
413
478
|
echo " [2] Register '$PLAYWRIGHT_MCP_ALT_NAME' alongside it (both active — browser tools will appear twice)"
|
|
414
479
|
echo " [3] Don't touch anything (default)"
|
|
415
|
-
|
|
480
|
+
# THIS is the prompt that re-asked on every single run even after being
|
|
481
|
+
# answered: options [1] and [2] BOTH end with a registered
|
|
482
|
+
# `playwright-shared` plus a live project `playwright`, and the gating
|
|
483
|
+
# condition above ("is `playwright` installed, and at what scope?") cannot
|
|
484
|
+
# tell those two end states apart — so it fell straight back into this menu
|
|
485
|
+
# next time. Remembering the answer is the entire fix; do not try to make
|
|
486
|
+
# the gating condition smarter.
|
|
487
|
+
#
|
|
488
|
+
# NAMES, NOT DIGITS, cross the store boundary. prompt_choice_sticky does the
|
|
489
|
+
# digit -> name resolution at input time (the trailing name list below is
|
|
490
|
+
# positional and MUST stay in the printed menu order above, or two answers
|
|
491
|
+
# silently swap), and the `case` branches on names. This is deliberate and
|
|
492
|
+
# load-bearing: the store holds `shared|alongside|skip` while the old `case`
|
|
493
|
+
# matched `1`/`2`/`*`, so a remembered name fed into the digit comparison
|
|
494
|
+
# would miss every branch, fall through to `*`, and silently behave like
|
|
495
|
+
# `skip` — the user's answer discarded with no error and no visible
|
|
496
|
+
# difference from a correct run. `skip` is also the default, so it and any
|
|
497
|
+
# unrecognized value share the one `*` branch.
|
|
498
|
+
#
|
|
499
|
+
# PROJECT_DIR is guaranteed non-empty by the guard above, which returns
|
|
500
|
+
# early when it is empty — never pass an empty selector.
|
|
501
|
+
choice="$(prompt_choice_sticky mcp.playwrightConflict "$PROJECT_DIR" skip " How should we proceed? [1/2/3]: " shared alongside skip)"
|
|
416
502
|
case "$choice" in
|
|
417
|
-
|
|
503
|
+
shared)
|
|
418
504
|
_add_playwright user "$PLAYWRIGHT_MCP_ALT_NAME"
|
|
419
505
|
_disable_project_playwright_locally
|
|
420
506
|
;;
|
|
421
|
-
|
|
507
|
+
alongside)
|
|
422
508
|
_add_playwright user "$PLAYWRIGHT_MCP_ALT_NAME"
|
|
423
509
|
;;
|
|
424
|
-
|
|
510
|
+
skip|*)
|
|
425
511
|
echo " playwright: left untouched."
|
|
426
512
|
;;
|
|
427
513
|
esac
|
|
@@ -431,7 +517,9 @@ _install_playwright_flow() {
|
|
|
431
517
|
# Machine-local registration: untracked .mcp.json (project scope) or the
|
|
432
518
|
# ~/.claude.json project entry (local scope). Safe to modify with consent.
|
|
433
519
|
echo " playwright: an existing ${pw_scope}-scope registration was found (machine-local, not checked in)."
|
|
434
|
-
|
|
520
|
+
# Project-scope key: this question is about THIS project's registration.
|
|
521
|
+
# PROJECT_DIR is non-empty here for the same reason as the conflict menu.
|
|
522
|
+
if prompt_yn_sticky mcp.playwrightReplace "$PROJECT_DIR" " Replace it with the bootstrap shared server (removes the ${pw_scope}-scope entry)? [y/N] (no = keep it and register ours as '$PLAYWRIGHT_MCP_ALT_NAME'): "; then
|
|
435
523
|
( cd "$PROJECT_DIR" && claude mcp remove playwright -s "$pw_scope" ) || true
|
|
436
524
|
_add_playwright user "$PLAYWRIGHT_MCP_NAME"
|
|
437
525
|
else
|