@codewizard-dt/bootstrap 2.15.0 → 2.18.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 +192 -184
- package/lib/hooks/absolute-path-guard.js +5 -0
- package/lib/hooks/claude-settings-guard.js +43 -73
- 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 +319 -16
- package/lib/scripts/bootstrap-prefs.js +734 -0
- package/lib/scripts/install-global.sh +182 -25
- package/lib/scripts/install-mcps.sh +102 -14
- package/lib/scripts/lib.sh +595 -20
- package/lib/scripts/merge-gitignore.sh +254 -16
- package/lib/scripts/merge-settings-hooks.js +374 -0
- 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/templates/settings-hooks.json +151 -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 +54 -1
- 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 +30 -3
- package/lib/skills/uat-walk/UAT-CORE.md +41 -6
- package/lib/skills/wiki-query/SKILL.md +48 -8
- package/package.json +1 -1
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Merge the canonical hook wiring (templates/settings-hooks.json) into the
|
|
3
|
+
// user's ~/.claude/settings.json "hooks" key.
|
|
4
|
+
//
|
|
5
|
+
// This is a sibling of merge-settings-deny.js, not a new mode of it: the deny
|
|
6
|
+
// script does simple additive set-union over a flat array and has a frozen
|
|
7
|
+
// test suite that must not be disturbed. This script implements a structured,
|
|
8
|
+
// block-and-entry-aware "template owns its blocks" merge with materially
|
|
9
|
+
// different semantics (ownership, drift adoption, mixed-block handling).
|
|
10
|
+
//
|
|
11
|
+
// Ownership model:
|
|
12
|
+
// - An "owned" hook entry is one whose `command` references
|
|
13
|
+
// ~/.claude/hooks/<name>.js (or an equivalent absolute-path expansion of
|
|
14
|
+
// the same) where <name> (basename, extension stripped) also appears
|
|
15
|
+
// somewhere in the template. Anything else is "foreign" (user-added) and
|
|
16
|
+
// is never modified, reordered, or removed by this algorithm.
|
|
17
|
+
// - Foreign blocks, and any hooks event not present in the template (e.g.
|
|
18
|
+
// UserPromptSubmit), are completely untouched.
|
|
19
|
+
// - A block containing at least one foreign entry is "mixed": its matcher
|
|
20
|
+
// is never rewritten, and a repo hook found relocated inside it is left
|
|
21
|
+
// in place (with a warning) rather than duplicated into the template's
|
|
22
|
+
// expected block.
|
|
23
|
+
// - A block whose every entry is owned is "pure-owned" and is eligible for
|
|
24
|
+
// drift adoption: if its matcher doesn't match any template matcher for
|
|
25
|
+
// the event, but it shares an owned basename with a template block, its
|
|
26
|
+
// matcher is rewritten to the template's — this propagates a matcher
|
|
27
|
+
// rename shipped in the template without creating a duplicate block.
|
|
28
|
+
//
|
|
29
|
+
// Always exits 0 — the caller (install-global.sh) runs under `set -euo
|
|
30
|
+
// pipefail` and a settings merge must never abort an install. Any state we
|
|
31
|
+
// don't understand (unparseable JSON, unexpected shapes) warns and skips,
|
|
32
|
+
// leaving the target file untouched.
|
|
33
|
+
//
|
|
34
|
+
// Usage: merge-settings-hooks.js [--target <path>] [--source <path>]
|
|
35
|
+
// --target/--source exist as test seams; the install flow passes no args.
|
|
36
|
+
// No --set-key/--set-value mode here — that belongs to merge-settings-deny.js.
|
|
37
|
+
|
|
38
|
+
'use strict';
|
|
39
|
+
|
|
40
|
+
const fs = require('fs');
|
|
41
|
+
const os = require('os');
|
|
42
|
+
const path = require('path');
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Helpers below are copied from merge-settings-deny.js (~lines 31-111) rather
|
|
46
|
+
// than shared, because that script's additive set-union semantics and frozen
|
|
47
|
+
// test suite must not be coupled to this script's block-ownership algorithm.
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
function parseArgs(argv) {
|
|
51
|
+
const opts = {
|
|
52
|
+
target: path.join(os.homedir(), '.claude', 'settings.json'),
|
|
53
|
+
source: path.join(__dirname, 'templates', 'settings-hooks.json'),
|
|
54
|
+
};
|
|
55
|
+
for (let i = 0; i < argv.length; i++) {
|
|
56
|
+
if (argv[i] === '--target' && argv[i + 1]) opts.target = argv[++i];
|
|
57
|
+
else if (argv[i] === '--source' && argv[i + 1]) opts.source = argv[++i];
|
|
58
|
+
}
|
|
59
|
+
return opts;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function warnSkip(message) {
|
|
63
|
+
console.error(`Warning: ${message} — skipping ${operation}`);
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isPlainObject(value) {
|
|
68
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Structural comparison, not JSON.stringify equality: differing key order in an
|
|
72
|
+
// equivalent object must still count as a no-op, not a clobber warning.
|
|
73
|
+
function deepEqual(a, b) {
|
|
74
|
+
if (a === b) return true;
|
|
75
|
+
if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') return false;
|
|
76
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
77
|
+
if (Array.isArray(a)) {
|
|
78
|
+
return a.length === b.length && a.every((v, i) => deepEqual(v, b[i]));
|
|
79
|
+
}
|
|
80
|
+
const keys = Object.keys(a);
|
|
81
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
82
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && deepEqual(a[k], b[k]));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function readTarget(file) {
|
|
86
|
+
if (!fs.existsSync(file)) return null;
|
|
87
|
+
try {
|
|
88
|
+
return fs.readFileSync(file, 'utf8');
|
|
89
|
+
} catch (err) {
|
|
90
|
+
warnSkip(`could not read ${file}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function parseSettings(text, file) {
|
|
95
|
+
if (text === null) return {};
|
|
96
|
+
let parsed;
|
|
97
|
+
try {
|
|
98
|
+
parsed = JSON.parse(text);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
warnSkip(`could not parse ${file} (file untouched)`);
|
|
101
|
+
}
|
|
102
|
+
if (!isPlainObject(parsed)) {
|
|
103
|
+
warnSkip(`${file} is not a JSON object (file untouched)`);
|
|
104
|
+
}
|
|
105
|
+
return parsed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Reuse the file's existing indentation (tabs or N spaces); default 2 spaces.
|
|
109
|
+
function detectIndent(text) {
|
|
110
|
+
if (text === null) return ' ';
|
|
111
|
+
if (text.match(/\n(\t+)"/)) return '\t';
|
|
112
|
+
const spaceMatch = text.match(/\n( +)"/);
|
|
113
|
+
return spaceMatch ? spaceMatch[1] : ' ';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function writeSettings(file, value, indent) {
|
|
117
|
+
const tmp = `${file}.tmp-${process.pid}`;
|
|
118
|
+
try {
|
|
119
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
120
|
+
fs.writeFileSync(tmp, JSON.stringify(value, null, indent) + '\n');
|
|
121
|
+
fs.renameSync(tmp, file);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
try { fs.unlinkSync(tmp); } catch (_) {}
|
|
124
|
+
warnSkip(`could not write ${file} (${err.message})`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// Block-ownership merge algorithm.
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
function clone(value) {
|
|
133
|
+
return JSON.parse(JSON.stringify(value));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Extract the "<name>" out of a command referencing .claude/hooks/<name>.js,
|
|
137
|
+
// regardless of whether the path is the literal "~/.claude/hooks/..." form
|
|
138
|
+
// or an absolute-path expansion of it (e.g. "/Users/xxx/.claude/hooks/...").
|
|
139
|
+
// Matching keys off the trailing ".claude/hooks/<name>.js" segment — not a
|
|
140
|
+
// bare "hooks/<name>.js" — so a foreign command that happens to reference
|
|
141
|
+
// some unrelated .../hooks/ directory (e.g. a project-local lib/hooks/foo.js)
|
|
142
|
+
// is never misclassified as an owned ~/.claude hook, even if its basename
|
|
143
|
+
// collides with a shipped hook name.
|
|
144
|
+
function extractBasename(command) {
|
|
145
|
+
if (typeof command !== 'string') return null;
|
|
146
|
+
const re = /(?:^|[\\/])\.claude[\\/]hooks[\\/]([^\\/\s"']+)\.js\b/g;
|
|
147
|
+
let match;
|
|
148
|
+
let last = null;
|
|
149
|
+
while ((match = re.exec(command)) !== null) last = match[1];
|
|
150
|
+
return last;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Collect every basename referenced anywhere in the template. This is the
|
|
154
|
+
// membership test for "owned": a target entry is owned only if its basename
|
|
155
|
+
// is one the template ships (and it's shaped like a hooks/<name>.js command).
|
|
156
|
+
function collectTemplateBasenames(template) {
|
|
157
|
+
const names = new Set();
|
|
158
|
+
for (const eventName of Object.keys(template)) {
|
|
159
|
+
const blocks = template[eventName];
|
|
160
|
+
if (!Array.isArray(blocks)) continue;
|
|
161
|
+
for (const block of blocks) {
|
|
162
|
+
if (!isPlainObject(block) || !Array.isArray(block.hooks)) continue;
|
|
163
|
+
for (const entry of block.hooks) {
|
|
164
|
+
if (!isPlainObject(entry)) continue;
|
|
165
|
+
const name = extractBasename(entry.command);
|
|
166
|
+
if (name) names.add(name);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return names;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isOwnedEntry(entry, basenames) {
|
|
174
|
+
if (!isPlainObject(entry)) return false;
|
|
175
|
+
const name = extractBasename(entry.command);
|
|
176
|
+
return name !== null && basenames.has(name);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function hasOwnedEntry(block, basenames) {
|
|
180
|
+
return isPlainObject(block) && Array.isArray(block.hooks) && block.hooks.some((h) => isOwnedEntry(h, basenames));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function hasForeignEntry(block, basenames) {
|
|
184
|
+
return isPlainObject(block) && Array.isArray(block.hooks) && block.hooks.some((h) => !isOwnedEntry(h, basenames));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Pure-owned: every entry in the block is owned, and there's at least one.
|
|
188
|
+
function isPureOwned(block, basenames) {
|
|
189
|
+
return (
|
|
190
|
+
isPlainObject(block) &&
|
|
191
|
+
Array.isArray(block.hooks) &&
|
|
192
|
+
block.hooks.length > 0 &&
|
|
193
|
+
block.hooks.every((h) => isOwnedEntry(h, basenames))
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function sharesBasename(block, templateBlock) {
|
|
198
|
+
if (!isPlainObject(block) || !Array.isArray(block.hooks)) return false;
|
|
199
|
+
const names = new Set(block.hooks.map((h) => (isPlainObject(h) ? extractBasename(h.command) : null)).filter(Boolean));
|
|
200
|
+
return (templateBlock.hooks || []).some((e) => {
|
|
201
|
+
const name = isPlainObject(e) ? extractBasename(e.command) : null;
|
|
202
|
+
return name && names.has(name);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Validate the template's shape strictly — a malformed template must never
|
|
207
|
+
// be partially trusted. Returns void; throws on any structural violation.
|
|
208
|
+
function validateTemplate(template) {
|
|
209
|
+
if (!isPlainObject(template)) throw new Error('not a JSON object');
|
|
210
|
+
for (const eventName of Object.keys(template)) {
|
|
211
|
+
const blocks = template[eventName];
|
|
212
|
+
if (!Array.isArray(blocks)) throw new Error(`"${eventName}" is not an array`);
|
|
213
|
+
for (const block of blocks) {
|
|
214
|
+
if (!isPlainObject(block) || !Array.isArray(block.hooks)) {
|
|
215
|
+
throw new Error(`"${eventName}" contains a block without a "hooks" array`);
|
|
216
|
+
}
|
|
217
|
+
for (const entry of block.hooks) {
|
|
218
|
+
if (!isPlainObject(entry) || typeof entry.command !== 'string') {
|
|
219
|
+
throw new Error(`"${eventName}" contains a hook entry without a "command" string`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function findMatchingBlock(targetEvent, matcher, basenames) {
|
|
227
|
+
const candidates = targetEvent.filter((b) => isPlainObject(b) && b.matcher === matcher);
|
|
228
|
+
if (!candidates.length) return null;
|
|
229
|
+
return candidates.find((b) => hasOwnedEntry(b, basenames)) || candidates[0];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function findDriftCandidate(targetEvent, templateMatchers, templateBlock, basenames) {
|
|
233
|
+
return (
|
|
234
|
+
targetEvent.find(
|
|
235
|
+
(b) =>
|
|
236
|
+
isPureOwned(b, basenames) &&
|
|
237
|
+
!templateMatchers.has(b.matcher) &&
|
|
238
|
+
sharesBasename(b, templateBlock)
|
|
239
|
+
) || null
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const { target, source } = parseArgs(process.argv.slice(2));
|
|
244
|
+
const operation = 'hooks wiring merge';
|
|
245
|
+
|
|
246
|
+
let template;
|
|
247
|
+
try {
|
|
248
|
+
template = JSON.parse(fs.readFileSync(source, 'utf8'));
|
|
249
|
+
validateTemplate(template);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
warnSkip(`hooks template missing or invalid (${source}: ${err.message})`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const templateBasenames = collectTemplateBasenames(template);
|
|
255
|
+
|
|
256
|
+
const raw = readTarget(target);
|
|
257
|
+
const settings = parseSettings(raw, target);
|
|
258
|
+
|
|
259
|
+
if ('hooks' in settings && !isPlainObject(settings.hooks)) {
|
|
260
|
+
warnSkip(`${target}: "hooks" is not an object (file untouched)`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Top-level case: no file, or file with no "hooks" key at all — the template
|
|
264
|
+
// wins outright; no per-event/per-block logic runs.
|
|
265
|
+
if (raw === null || !('hooks' in settings)) {
|
|
266
|
+
settings.hooks = clone(template);
|
|
267
|
+
writeSettings(target, settings, detectIndent(raw));
|
|
268
|
+
console.log('hooks wiring: created');
|
|
269
|
+
process.exit(0);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const targetHooks = settings.hooks;
|
|
273
|
+
const changes = [];
|
|
274
|
+
|
|
275
|
+
// Only the events the template ships are ever visited — anything else already
|
|
276
|
+
// present in the target's hooks object (e.g. UserPromptSubmit) is untouched.
|
|
277
|
+
for (const eventName of Object.keys(template)) {
|
|
278
|
+
const templateEvent = template[eventName];
|
|
279
|
+
|
|
280
|
+
let targetEvent;
|
|
281
|
+
if (eventName in targetHooks) {
|
|
282
|
+
targetEvent = targetHooks[eventName];
|
|
283
|
+
if (!Array.isArray(targetEvent)) {
|
|
284
|
+
warnSkip(`${target}: "hooks.${eventName}" is not an array (file untouched)`);
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
287
|
+
targetEvent = [];
|
|
288
|
+
targetHooks[eventName] = targetEvent;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const templateMatchers = new Set(templateEvent.map((b) => b.matcher));
|
|
292
|
+
|
|
293
|
+
for (const templateBlock of templateEvent) {
|
|
294
|
+
let block = findMatchingBlock(targetEvent, templateBlock.matcher, templateBasenames);
|
|
295
|
+
|
|
296
|
+
if (!block) {
|
|
297
|
+
const drifted = findDriftCandidate(targetEvent, templateMatchers, templateBlock, templateBasenames);
|
|
298
|
+
if (drifted) {
|
|
299
|
+
const oldMatcher = drifted.matcher;
|
|
300
|
+
if ('matcher' in templateBlock) drifted.matcher = templateBlock.matcher;
|
|
301
|
+
else delete drifted.matcher;
|
|
302
|
+
changes.push(` ~ ${eventName} matcher adopted: ${oldMatcher} -> ${templateBlock.matcher}`);
|
|
303
|
+
block = drifted;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// A fresh placeholder block is NOT pushed into the target event yet: if
|
|
308
|
+
// every template entry turns out to be relocated into a mixed block
|
|
309
|
+
// elsewhere (warn, don't insert), pushing eagerly would persist an empty
|
|
310
|
+
// {matcher, hooks: []} block whenever another block causes a write in the
|
|
311
|
+
// same run. The push is deferred until at least one entry actually lands.
|
|
312
|
+
// Pre-existing blocks (matched or drift-adopted) are never touched by this
|
|
313
|
+
// guard — only a block this run itself created can be withheld.
|
|
314
|
+
let isNewBlock = false;
|
|
315
|
+
if (!block) {
|
|
316
|
+
block = {};
|
|
317
|
+
if ('matcher' in templateBlock) block.matcher = templateBlock.matcher;
|
|
318
|
+
block.hooks = [];
|
|
319
|
+
isNewBlock = true;
|
|
320
|
+
}
|
|
321
|
+
if (!Array.isArray(block.hooks)) block.hooks = [];
|
|
322
|
+
|
|
323
|
+
for (const templateEntry of templateBlock.hooks) {
|
|
324
|
+
const basename = extractBasename(templateEntry.command);
|
|
325
|
+
const ownedIdx = block.hooks.findIndex(
|
|
326
|
+
(h) => isOwnedEntry(h, templateBasenames) && extractBasename(h.command) === basename
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
if (ownedIdx !== -1) {
|
|
330
|
+
if (!deepEqual(block.hooks[ownedIdx], templateEntry)) {
|
|
331
|
+
block.hooks[ownedIdx] = clone(templateEntry);
|
|
332
|
+
changes.push(` ~ ${eventName}/${basename} replaced`);
|
|
333
|
+
}
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Not found in this block — check whether it's been relocated into a
|
|
338
|
+
// different, mixed (user-touched) block elsewhere in the same event.
|
|
339
|
+
// Never-remove/duplicate wins: leave it there, warn, don't duplicate.
|
|
340
|
+
let relocated = false;
|
|
341
|
+
for (const other of targetEvent) {
|
|
342
|
+
if (other === block || !isPlainObject(other) || !Array.isArray(other.hooks)) continue;
|
|
343
|
+
const foundHere = other.hooks.some(
|
|
344
|
+
(h) => isPlainObject(h) && extractBasename(h.command) === basename
|
|
345
|
+
);
|
|
346
|
+
if (foundHere && hasForeignEntry(other, templateBasenames)) {
|
|
347
|
+
console.error(
|
|
348
|
+
`Warning: ${eventName}/${basename} appears relocated into a user-modified block — leaving it in place, not duplicating`
|
|
349
|
+
);
|
|
350
|
+
relocated = true;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!relocated) {
|
|
356
|
+
block.hooks.push(clone(templateEntry));
|
|
357
|
+
changes.push(` + ${eventName}/${basename} appended`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Deferred push (see above): only a freshly-created block that actually
|
|
362
|
+
// received entries joins the target event array.
|
|
363
|
+
if (isNewBlock && block.hooks.length > 0) targetEvent.push(block);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (changes.length === 0) {
|
|
368
|
+
console.log('hooks wiring already up to date');
|
|
369
|
+
process.exit(0);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
writeSettings(target, settings, detectIndent(raw));
|
|
373
|
+
for (const line of changes) console.log(line);
|
|
374
|
+
console.log(`hooks wiring: ${changes.length} change${changes.length === 1 ? '' : 's'} applied`);
|
|
@@ -97,11 +97,40 @@ for guide in $OPTIONAL_GUIDES; do
|
|
|
97
97
|
if [ -e "$GUIDES_DST/$guide" ] || [ -e "$LEGACY_GUIDES/$guide" ]; then
|
|
98
98
|
deliver_guide "$guide"
|
|
99
99
|
echo " $guide: refreshed (already present — previously opted in)."
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
# Presence on disk deliberately wins over any stored answer: the file being
|
|
101
|
+
# there is the stronger signal (the user can opt out by deleting it), so we
|
|
102
|
+
# never even consult the preference store on this branch.
|
|
103
|
+
continue
|
|
104
104
|
fi
|
|
105
|
+
# The store is read HERE, ahead of the `INTERACTIVE` guard below — not behind
|
|
106
|
+
# it. The schema for guides.* says a stored `true` delivers the guide into
|
|
107
|
+
# wiki/guides/ on EVERY run, including headless ones. If this lookup lived
|
|
108
|
+
# inside the interactive branch, a stored `true` would be silently ignored on
|
|
109
|
+
# every non-interactive run (CI, `bootstrap update` piped from a script), and
|
|
110
|
+
# the answer the user recorded once would only take effect when they were
|
|
111
|
+
# sitting at a tty — exactly the case where they would have been asked anyway.
|
|
112
|
+
# Only the unanswered/`ask` case needs a tty, and that is what the guard below
|
|
113
|
+
# covers. prefs_get always exits 0 and echoes `unset` when it has no value, so
|
|
114
|
+
# this command substitution is safe under `set -euo pipefail`.
|
|
115
|
+
case "$(prefs_get "guides.$guide" "$PROJECT_DIR")" in
|
|
116
|
+
true)
|
|
117
|
+
deliver_guide "$guide"
|
|
118
|
+
echo " $guide: delivered (remembered answer guides.$guide=true — change with /bootstrap-config)."
|
|
119
|
+
;;
|
|
120
|
+
false)
|
|
121
|
+
# No "Opt in any time" nudge here: the question has been answered, and
|
|
122
|
+
# telling the user to re-run and answer yes would be misleading.
|
|
123
|
+
echo " $guide: skipped (remembered answer guides.$guide=false — change with /bootstrap-config)."
|
|
124
|
+
;;
|
|
125
|
+
*)
|
|
126
|
+
# `ask`, `unset`, or an unrecognized value — today's behavior.
|
|
127
|
+
if [ "$INTERACTIVE" = true ] && prompt_yn_sticky "guides.$guide" "$PROJECT_DIR" " Install optional guide '$guide'? [y/N]: "; then
|
|
128
|
+
deliver_guide "$guide"
|
|
129
|
+
else
|
|
130
|
+
echo " $guide: skipped. Opt in any time: re-run 'npx @codewizard-dt/bootstrap update' and answer yes."
|
|
131
|
+
fi
|
|
132
|
+
;;
|
|
133
|
+
esac
|
|
105
134
|
done
|
|
106
135
|
|
|
107
136
|
# 4b. LEGACY MIGRATION: guides used to live in .docs/guides/. Every
|
|
@@ -46,7 +46,7 @@ Keep the two from duplicating or contradicting each other: project-specific stat
|
|
|
46
46
|
| Command | Purpose |
|
|
47
47
|
|---------|---------|
|
|
48
48
|
| `/wiki-ingest <raw-file>` | Process a source from `raw/` into the wiki — summary page, entity/concept updates, index + log entries |
|
|
49
|
-
| `/wiki-query <question>` | Answer from the wiki with citations; offer to file valuable synthesis back as a new page |
|
|
49
|
+
| `/wiki-query <question>` | Answer from the wiki with citations; auto-ingest relevant un-ingested `raw/` sources when coverage is missing; offer to file valuable synthesis back as a new page |
|
|
50
50
|
| `/wiki-lint` | Health-check — contradictions, orphan pages, stale claims, index drift, never-ingested raw sources |
|
|
51
51
|
| `/wiki-archive [family]` | Batch-move terminal work items into `<family>/archive/`; update `archive/index.md` and log the operation |
|
|
52
52
|
| `/wiki-rotate-log` | Rotate `wiki/log.md` to a timestamped archive file when it exceeds ~500 lines; create a fresh `log.md` with an archive pointer |
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcp.serenaMigrate": {
|
|
3
|
+
"scope": "project",
|
|
4
|
+
"consumer": "installer",
|
|
5
|
+
"summary": "Move a project-scope Serena registration out of this repo's .mcp.json",
|
|
6
|
+
"detail": "Asked by install-mcps.sh:328 when this project's .mcp.json already registers 'serena' (written by an earlier bootstrap, carrying a machine-specific absolute --project path). true runs 'claude mcp remove serena -s project' so the entry can be re-added at local scope in ~/.claude.json; false leaves the existing .mcp.json entry in place and working, and the prompt returns on the next run. .mcp.json may be committed team config, which is why the removal is offered rather than forced.",
|
|
7
|
+
"values": "true | false",
|
|
8
|
+
"default": null,
|
|
9
|
+
"askedBy": "install-mcps.sh"
|
|
10
|
+
},
|
|
11
|
+
"mcp.serena": {
|
|
12
|
+
"scope": "project",
|
|
13
|
+
"consumer": "installer",
|
|
14
|
+
"summary": "Register Serena at local scope for this project",
|
|
15
|
+
"detail": "Asked by install-mcps.sh:341 when no Serena registration exists for this project. true runs 'claude mcp add --scope local serena ...' with this project's absolute path, storing the entry in ~/.claude.json under this project's key — per-project, machine-local, never written to the repo's shareable .mcp.json. false leaves the project without Serena; code navigation falls back to Grep/Glob.",
|
|
16
|
+
"values": "true | false",
|
|
17
|
+
"default": null,
|
|
18
|
+
"askedBy": "install-mcps.sh"
|
|
19
|
+
},
|
|
20
|
+
"mcp.playwrightConflict": {
|
|
21
|
+
"scope": "project",
|
|
22
|
+
"consumer": "installer",
|
|
23
|
+
"summary": "How to resolve a committed .mcp.json that already registers its own playwright server",
|
|
24
|
+
"detail": "The three-way conflict menu at install-mcps.sh:501, reached only when this project's git-tracked .mcp.json registers 'playwright' (team-owned, so bootstrap never modifies it). 'shared' registers the bootstrap server as 'playwright-shared' and disables the project entry on this machine only via disabledMcpjsonServers in .claude/settings.local.json. 'alongside' registers 'playwright-shared' and leaves the project entry active, so browser tools appear twice. 'skip' changes nothing. This is the prompt that re-asks on every run even after being answered: 'shared' and 'alongside' both leave a registered 'playwright-shared' plus a live project 'playwright', and the gating condition cannot tell those two end states apart — remembering the answer is what fixes it. Values are stored by name, never as the raw menu digits 1/2/3, so the meaning survives a menu reorder.",
|
|
25
|
+
"values": "shared | alongside | skip",
|
|
26
|
+
"default": null,
|
|
27
|
+
"askedBy": "install-mcps.sh"
|
|
28
|
+
},
|
|
29
|
+
"mcp.playwrightReplace": {
|
|
30
|
+
"scope": "project",
|
|
31
|
+
"consumer": "installer",
|
|
32
|
+
"summary": "Replace an existing machine-local Playwright registration with the bootstrap shared server",
|
|
33
|
+
"detail": "Asked by install-mcps.sh:522 when a 'playwright' registration exists at local scope, or at project scope in an untracked .mcp.json — machine-local either way, so it is safe to modify with consent. true removes that entry and registers the bootstrap shared server under the canonical name 'playwright'. false keeps the existing entry and registers the bootstrap server alongside it as 'playwright-shared'.",
|
|
34
|
+
"values": "true | false",
|
|
35
|
+
"default": null,
|
|
36
|
+
"askedBy": "install-mcps.sh"
|
|
37
|
+
},
|
|
38
|
+
"update.legacyDocsAck": {
|
|
39
|
+
"scope": "project",
|
|
40
|
+
"consumer": "installer",
|
|
41
|
+
"summary": "Continue 'update' even though a legacy .docs/ directory was detected",
|
|
42
|
+
"detail": "Asked by update-project.sh:76 when the project still holds .docs/ artifact content from the pre-wiki layout. true continues the update, which scaffolds wiki/ but never touches the .docs/ files. false aborts with exit 0 so the user can run 'npx @codewizard-dt/bootstrap migrate' first. Answering true does not migrate anything — it only stops the warning from blocking every subsequent update.",
|
|
43
|
+
"values": "true | false",
|
|
44
|
+
"default": null,
|
|
45
|
+
"askedBy": "update-project.sh"
|
|
46
|
+
},
|
|
47
|
+
"gitignore.infoExclude": {
|
|
48
|
+
"scope": "project",
|
|
49
|
+
"consumer": "installer",
|
|
50
|
+
"summary": "Keep .serena/, raw/, and wiki/ out of git on this machine via .git/info/exclude",
|
|
51
|
+
"detail": "Asked by merge-gitignore.sh:376 when one or more of .serena/, raw/, wiki/ are not yet excluded. true writes them under the bootstrap sentinel in .git/info/exclude — machine-local, never committed, and unlike .gitignore it does not blind Serena or ripgrep-class walkers; the installed fileSuggestion script restores @-autocomplete for those paths. false leaves git tracking them here; teammates opt in separately by running update themselves. This is INDEPENDENT of the .gitignore section pass governed by gitignore.offerSectionUpdates: declining or disabling sections never disables the info/exclude mechanism, and a pure sentinel repair (all three already excluded elsewhere in the file) runs with no prompt at all regardless of this key. See also prefs.gitTracking, which decides how git treats the preferences file itself — a different question from these three directories.",
|
|
52
|
+
"values": "true | false",
|
|
53
|
+
"default": null,
|
|
54
|
+
"askedBy": "merge-gitignore.sh"
|
|
55
|
+
},
|
|
56
|
+
"prefs.gitTracking": {
|
|
57
|
+
"scope": "project",
|
|
58
|
+
"consumer": "installer",
|
|
59
|
+
"summary": "How git should treat .claude/bootstrap-prefs.json and bootstrap-prefs.README.md",
|
|
60
|
+
"detail": "New prompt owned by merge-gitignore.sh. Covers both files together: the values file .claude/bootstrap-prefs.json and its generated companion .claude/bootstrap-prefs.README.md. 'gitignore' adds both to the project's .gitignore so the whole team shares that decision. 'exclude' adds both to .git/info/exclude, keeping them untracked on this machine only. 'neither' leaves them visible to git so they can be committed and shared. Unlike the add/skip gates elsewhere in this schema, the declines-only rule does NOT apply here: this is a choice among three outcomes, not a yes/no on adding lines, so the answer is recorded in all three directions and the prompt is genuinely asked once. Related but separate: gitignore.infoExclude covers .serena/, raw/, and wiki/, not these two files.",
|
|
61
|
+
"values": "gitignore | exclude | neither",
|
|
62
|
+
"default": null,
|
|
63
|
+
"askedBy": "merge-gitignore.sh"
|
|
64
|
+
},
|
|
65
|
+
"guides.*": {
|
|
66
|
+
"scope": "project",
|
|
67
|
+
"consumer": "installer",
|
|
68
|
+
"summary": "Install a specific optional guide into wiki/guides/",
|
|
69
|
+
"detail": "One key per entry in sync-wiki-scaffold.sh's OPTIONAL_GUIDES list (sync-wiki-scaffold.sh:81), keyed by the exact entry text including any extension — today that is guides.evals-framework.md and guides.type-checking-templates. true delivers the guide into wiki/guides/ on every run; false keeps it out and suppresses the per-run prompt. A guide already present in wiki/guides/ (or in the legacy .docs/guides/) is refreshed regardless of this key — existing opt-in wins, because the file on disk is the stronger signal than a stored answer. The required guide tier is never gated by these keys.",
|
|
70
|
+
"values": "true | false",
|
|
71
|
+
"default": null,
|
|
72
|
+
"askedBy": "sync-wiki-scaffold.sh",
|
|
73
|
+
"dynamic": true
|
|
74
|
+
},
|
|
75
|
+
"gitignore.section.*": {
|
|
76
|
+
"scope": "project",
|
|
77
|
+
"consumer": "installer",
|
|
78
|
+
"summary": "Permanently decline one titled .gitignore template section",
|
|
79
|
+
"detail": "One key per titled section of lib/scripts/templates/gitignore, slugified from the section's banner title: lowercase it, replace every run of non-alphanumeric characters with a single '-', then strip leading and trailing '-' (so 'Node / TypeScript / JavaScript' becomes gitignore.section.node-typescript-javascript). The grammar is deliberately false-only: false remembers a decline and stops that section being offered again. There is intentionally no 'true' value, because a remembered yes would silently append lines to a project's .gitignore on a later run and break merge-gitignore.sh's stated invariant, 'NOTHING is ever added to a project's .gitignore without asking' (merge-gitignore.sh:11). An accepted section is therefore never recorded, so a section that gains new lines in a later template version is still offered by title on the next run rather than appended silently. The one-value grammar is the design, not a typo — do not widen it.",
|
|
80
|
+
"values": "false",
|
|
81
|
+
"default": null,
|
|
82
|
+
"askedBy": "merge-gitignore.sh",
|
|
83
|
+
"dynamic": true
|
|
84
|
+
},
|
|
85
|
+
"mcp.braveSearch": {
|
|
86
|
+
"scope": "global",
|
|
87
|
+
"consumer": "installer",
|
|
88
|
+
"summary": "Install the Brave Search MCP globally for web research",
|
|
89
|
+
"detail": "Prerequisites: a Brave Search API key and a working Docker daemon — the server runs as a shared local container serving HTTP, registered at user scope. true installs and keeps it updated on every run. false means the installer stops offering it: the prompt is never shown again on this machine until the key is changed or removed. The API key itself is never stored in this file or anywhere in the preferences schema.",
|
|
90
|
+
"values": "true | false",
|
|
91
|
+
"default": null,
|
|
92
|
+
"askedBy": "install-mcps.sh"
|
|
93
|
+
},
|
|
94
|
+
"mcp.context7": {
|
|
95
|
+
"scope": "global",
|
|
96
|
+
"consumer": "installer",
|
|
97
|
+
"summary": "Install the Context7 MCP for library documentation lookups",
|
|
98
|
+
"detail": "No prerequisites — no API key and no Docker required. true installs it at the scope chosen by mcp.context7Scope. false means the installer stops offering it: the prompt is never shown again on this machine until the key is changed or removed. Any optional API key prompt is handled outside this schema and is never stored here.",
|
|
99
|
+
"values": "true | false",
|
|
100
|
+
"default": null,
|
|
101
|
+
"askedBy": "install-mcps.sh"
|
|
102
|
+
},
|
|
103
|
+
"mcp.context7Scope": {
|
|
104
|
+
"scope": "global",
|
|
105
|
+
"consumer": "installer",
|
|
106
|
+
"summary": "Registration scope for the Context7 MCP",
|
|
107
|
+
"detail": "Asked by prompt_scope in lib.sh:387 ('Scope for context7 — [u]ser (default) or [p]roject?'). prompt_scope emits exactly two answers, 'user' and 'project' — it has no local-scope branch, and any reply that does not begin with p or P falls through to user. 'user' registers Context7 once for every project on this machine; 'project' writes the registration into the current project's shareable .mcp.json.",
|
|
108
|
+
"values": "user | project",
|
|
109
|
+
"default": null,
|
|
110
|
+
"askedBy": "lib.sh"
|
|
111
|
+
},
|
|
112
|
+
"mcp.playwright": {
|
|
113
|
+
"scope": "global",
|
|
114
|
+
"consumer": "installer",
|
|
115
|
+
"summary": "Install the Playwright MCP for browser automation and UI testing",
|
|
116
|
+
"detail": "Prerequisite on macOS: a launchd LaunchAgent (com.bootstrap-claude.playwright-mcp) runs the shared HTTP server in the GUI session so headed browsers work; other platforms get a per-session stdio server via npx. true installs it at user scope under the canonical name 'playwright'. false means the installer stops offering it: the fresh-install prompt is never shown again on this machine until the key is changed or removed. This key covers the fresh-install path only — the conflict paths are mcp.playwrightConflict and mcp.playwrightReplace.",
|
|
117
|
+
"values": "true | false",
|
|
118
|
+
"default": null,
|
|
119
|
+
"askedBy": "install-mcps.sh"
|
|
120
|
+
},
|
|
121
|
+
"skills.pruneOrphans": {
|
|
122
|
+
"scope": "global",
|
|
123
|
+
"consumer": "installer",
|
|
124
|
+
"summary": "Delete stale skill folders in ~/.claude/skills/ left by the wiki rename",
|
|
125
|
+
"detail": "Asked by install-global.sh:70 when any renamed-away skill folder (the adr-* and prd-* families) is still present in ~/.claude/skills/. true removes those folders with rm -rf; false keeps them, and they continue to appear as duplicate slash commands alongside their renamed replacements. The list of orphan names is fixed in the script — this key does not decide which folders qualify, only whether the deletion runs.",
|
|
126
|
+
"values": "true | false",
|
|
127
|
+
"default": null,
|
|
128
|
+
"askedBy": "install-global.sh"
|
|
129
|
+
},
|
|
130
|
+
"gitCommit.versionBump": {
|
|
131
|
+
"scope": "either",
|
|
132
|
+
"consumer": "skill",
|
|
133
|
+
"summary": "How /git-commit handles the version bump before committing",
|
|
134
|
+
"detail": "'auto' is today's behavior: the skill picks a bump level and applies it to every version manifest it finds, without confirmation. 'confirm' prints the suggested bump and asks before editing any manifest — 'confirm' IS this key's ask state, so there is deliberately no separate 'ask' value in the grammar. 'never' touches no version file at all but STILL prefixes the commit subject with [patch], [minor], or [major], because downstream release tooling reads that prefix. This is a choice among three behaviors, not an add/skip gate, so the declines-only rule does not apply — the answer is recorded in all three directions.",
|
|
135
|
+
"values": "auto | confirm | never",
|
|
136
|
+
"default": "auto",
|
|
137
|
+
"askedBy": "install-global.sh"
|
|
138
|
+
},
|
|
139
|
+
"gitCommit.autoPush": {
|
|
140
|
+
"scope": "either",
|
|
141
|
+
"consumer": "skill",
|
|
142
|
+
"summary": "Whether /git-commit pushes after a successful commit",
|
|
143
|
+
"detail": "true pushes the current branch after committing; false commits only; 'ask' prompts each time. The default is false because today's behavior is to never push, and defaulting an unanswered key to an outward-facing action that publishes code would break the compatibility guarantee that an absent preferences file changes nothing. The separate rule that /git-commit never creates a branch is unaffected by this key: pushing an existing branch is all that is on offer.",
|
|
144
|
+
"values": "true | false | ask",
|
|
145
|
+
"default": false,
|
|
146
|
+
"askedBy": "install-global.sh"
|
|
147
|
+
},
|
|
148
|
+
"research.persistToRaw": {
|
|
149
|
+
"scope": "either",
|
|
150
|
+
"consumer": "skill",
|
|
151
|
+
"summary": "Whether /research writes its report and sources to raw/research/",
|
|
152
|
+
"detail": "Governs the Phase 5 file write only. Findings are always synthesized into the response no matter what this key says — false suppresses the on-disk report under raw/research/<slug>/, it does not suppress the research. 'ask' prompts before writing. Note that a per-run override exists even when this is true, so a single invocation can still decline the write; the stored preference and the per-run override are different mechanisms and both must keep working.",
|
|
153
|
+
"values": "true | false | ask",
|
|
154
|
+
"default": true,
|
|
155
|
+
"askedBy": "install-global.sh"
|
|
156
|
+
},
|
|
157
|
+
"uatGenerate.promoteTests": {
|
|
158
|
+
"scope": "either",
|
|
159
|
+
"consumer": "skill",
|
|
160
|
+
"summary": "Whether /uat-generate promotes UAT checks into repeatable tests under test/",
|
|
161
|
+
"detail": "true is today's behavior: alongside the UAT file in wiki/work/uat/, the skill writes repeatable assertions into the project's test/ directory so the checks survive as regression coverage. false generates the UAT file only and adds nothing to test/. 'ask' prompts per invocation. This affects what lands on disk, not how the UAT itself is judged.",
|
|
162
|
+
"values": "true | false | ask",
|
|
163
|
+
"default": true,
|
|
164
|
+
"askedBy": "install-global.sh"
|
|
165
|
+
},
|
|
166
|
+
"gitignore.offerSectionUpdates": {
|
|
167
|
+
"scope": "either",
|
|
168
|
+
"consumer": "skill",
|
|
169
|
+
"summary": "Master gate for the .gitignore template section review pass",
|
|
170
|
+
"detail": "Controls the single opening gate at merge-gitignore.sh:171 ('Review .gitignore updates? (N line(s) across M section(s))'). This is a full three-state key: 'ask' is today's behavior, true runs the section pass without the opening question (each individual section is still offered by title, so nothing is appended silently), and false skips the whole pass with no prompt at all. The key itself never appends a line to any .gitignore — it only decides whether the pass runs. The .git/info/exclude block is OUTSIDE this gate entirely and keeps its own consent prompt: see gitignore.infoExclude. Individual section declines are remembered separately under gitignore.section.*.",
|
|
171
|
+
"values": "true | false | ask",
|
|
172
|
+
"default": true,
|
|
173
|
+
"askedBy": "install-global.sh"
|
|
174
|
+
}
|
|
175
|
+
}
|