mossbear 0.1.0-alpha.31 → 0.1.0-alpha.32
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/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +4 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +253 -59
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +69 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +141 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/hooks-settings.d.ts +53 -4
- package/dist/hooks-settings.d.ts.map +1 -1
- package/dist/hooks-settings.js +66 -4
- package/dist/hooks-settings.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/login/pairing.d.ts +54 -0
- package/dist/login/pairing.d.ts.map +1 -0
- package/dist/login/pairing.js +140 -0
- package/dist/login/pairing.js.map +1 -0
- package/dist/terminal.d.ts +12 -0
- package/dist/terminal.d.ts.map +1 -1
- package/dist/terminal.js +29 -0
- package/dist/terminal.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,aAAa;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,aAAa;;;;;;;;;;;EAyRxB,CAAA"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -62,9 +62,10 @@ export const doctorCommand = defineCommand({
|
|
|
62
62
|
// whatever it last pulled would be false.
|
|
63
63
|
const sessionStartPulls = sessionStartHookAlreadyPulls(projectHooks?.['SessionStart']);
|
|
64
64
|
// The `mossbear update --yes` conditional the cloud recipe told users to
|
|
65
|
-
// paste, which nothing migrates
|
|
66
|
-
//
|
|
67
|
-
//
|
|
65
|
+
// paste, which nothing migrates. Without it the report tells those repos
|
|
66
|
+
// the CLI is never updated for them, while that hook updates it on every
|
|
67
|
+
// cloud session. (This repo was one of them until 2026-08-27; its own
|
|
68
|
+
// settings file now runs `mossbear session-start`.)
|
|
68
69
|
const sessionStartUpdates = sessionStartHookUpdatesCli(projectHooks?.['SessionStart']);
|
|
69
70
|
const hookBinPath = resolveOnPath(MOSSBEAR_HOOK_COMMAND);
|
|
70
71
|
// The Stop hooks invoke `mossbear`, which ships as a separate bin from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,YAAY,GACb,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBA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oBAAoB,MAAM,CAAC,MAAM,wBAAwB,MAAM,CAAC,OAAO,EAAE,CAC1E,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiNA,eAAO,MAAM,kBAAkB,+JAM9B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyoCtB,CAAA"}
|
package/dist/commands/init.js
CHANGED
|
@@ -10,7 +10,7 @@ import { readRepoDocsConfig, readRepoProjectId } from '../docs/repo-config.js';
|
|
|
10
10
|
import { resolveInitSubscriptionSelection, subscribeBundleSelections, } from '../docs/subscribe.js';
|
|
11
11
|
import { formatDocsSyncLine, syncSubscribedDocs } from '../docs/sync-docs.js';
|
|
12
12
|
import { errText } from '../err-text.js';
|
|
13
|
-
import { MOSSBEAR_HOOK_COMMAND, MOSSBEAR_SESSION_END_COMMAND, MOSSBEAR_SESSION_START_COMMAND, MOSSBEAR_SYNC_COMMAND, hookGroupsHaveCommand, mergeMossbearHookEntry, mergeMossbearLoggerHook, missingHookPathWarning, pruneStaleHooks, sessionStartHookAlreadyPulls, staleHookWarning, supersededSessionStartWarning, SUPERSEDED_SESSION_START_COMMANDS, stopHookUploadsActions, } from '../hooks-settings.js';
|
|
13
|
+
import { MOSSBEAR_HOOK_COMMAND, MOSSBEAR_SESSION_END_COMMAND, MOSSBEAR_SESSION_START_COMMAND, MOSSBEAR_SYNC_COMMAND, hookGroupsHaveCommand, mergeMossbearHookEntry, mergeMossbearLoggerHook, missingHookPathWarning, pruneStaleHooks, sessionStartHookAlreadyPulls, staleHookWarning, legacyFreshnessHookNote, supersededSessionStartWarning, SUPERSEDED_SESSION_START_COMMANDS, stopHookUploadsActions, } from '../hooks-settings.js';
|
|
14
14
|
import { createContextClient } from '../mcp/client.js';
|
|
15
15
|
import { MOSSBEAR_CONFIG, MOSSBEAR_HOME, MOSSBEAR_RUNS_DIR } from '../mossbear-paths.js';
|
|
16
16
|
import { resolveOnPath } from '../path-resolve.js';
|
|
@@ -21,7 +21,75 @@ import { discoverGuideFiles } from '../rules/discover.js';
|
|
|
21
21
|
import { adoptable, managed as managedCandidates, managedRefusal, resolveImportCandidates, } from '../rules/import-candidates.js';
|
|
22
22
|
import { formatImportSummary, importDiscoveredGuides } from '../rules/init-import.js';
|
|
23
23
|
import { BUNDLED_SKILLS } from '../skill-template.js';
|
|
24
|
+
import { cyan, dim, displayWidth, green, terminalWidth, wrapText } from '../terminal.js';
|
|
24
25
|
import { verifyDashboardToken } from '../token-verify.js';
|
|
26
|
+
/**
|
|
27
|
+
* The two line shapes `init` reports in, and the reason there are only two.
|
|
28
|
+
*
|
|
29
|
+
* This command performs twenty-odd separate writes, and every one of them used
|
|
30
|
+
* to print a full sentence at the same weight: what it did, plus the caveat
|
|
31
|
+
* explaining it, run together on one line that wrapped to three on a phone-sized
|
|
32
|
+
* terminal. Nothing was wrong with any individual sentence — the problem was
|
|
33
|
+
* that a reader scanning for "what do I do now" had no way to tell an action
|
|
34
|
+
* from a footnote, so the whole block read as one paragraph to skip.
|
|
35
|
+
*
|
|
36
|
+
* `did()` is the fact: a verb the reader can scan for, in green because it
|
|
37
|
+
* happened, and the path it happened to. `note()` is the sentence underneath,
|
|
38
|
+
* indented and dim, which is where every caveat, cause and remedy now lives.
|
|
39
|
+
* The colours are decoration; the split is not, and it survives `NO_COLOR`
|
|
40
|
+
* because the indent carries it on its own.
|
|
41
|
+
*
|
|
42
|
+
* A line that reports no action — "dashboardUrl unset" — takes neither helper
|
|
43
|
+
* and carries its qualifier inline, dimmed. Same rule (dim is the explaining
|
|
44
|
+
* half), one line instead of two, because there is no verb above it for a
|
|
45
|
+
* second line to hang from.
|
|
46
|
+
*/
|
|
47
|
+
function did(verb, subject) {
|
|
48
|
+
return ` ${green(verb)} ${subject}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The explanatory half of a `did()` line, or a standalone aside.
|
|
52
|
+
*
|
|
53
|
+
* Wrapped to the real terminal rather than to a column somebody guessed at.
|
|
54
|
+
* Every long sentence in this command used to carry its own hand-placed
|
|
55
|
+
* newlines, which is a wrap for one width — they overhung an 80-column terminal
|
|
56
|
+
* and left a ragged half-width block on a wide one, and a note that reflows
|
|
57
|
+
* badly is a note that reads as noise. `wrapText` and `terminalWidth` already
|
|
58
|
+
* exist for this; `dim` goes on each line rather than around the block, because
|
|
59
|
+
* some terminals drop attributes at a newline.
|
|
60
|
+
*
|
|
61
|
+
* **A deep indent is dropped before the text is squeezed.** The next-steps
|
|
62
|
+
* hints indent to the description column, which on a narrow terminal can leave
|
|
63
|
+
* less room than a sentence can use — and there is no arrangement that both
|
|
64
|
+
* holds the column and fits the screen, so one of them has to go. It is the
|
|
65
|
+
* column: a note pulled back to `NOTE_INDENT` has lost its alignment, while one
|
|
66
|
+
* that keeps the column has run off the right edge and re-wrapped where the
|
|
67
|
+
* terminal chose, which is the exact defect this helper exists to remove.
|
|
68
|
+
* Caught in review of #973, where the token hint rendered at 55 columns on a
|
|
69
|
+
* 53-column terminal — `MIN_NOTE_WIDTH` was being applied as a floor on the
|
|
70
|
+
* wrap width, and the indent was then added on top of it.
|
|
71
|
+
*/
|
|
72
|
+
function note(text, indent = NOTE_INDENT) {
|
|
73
|
+
const width = terminalWidth();
|
|
74
|
+
const fits = width - indent >= MIN_NOTE_WIDTH;
|
|
75
|
+
const effectiveIndent = fits ? indent : NOTE_INDENT;
|
|
76
|
+
const pad = ' '.repeat(effectiveIndent);
|
|
77
|
+
// Cannot go non-positive: `terminalWidth` floors at 40 and `NOTE_INDENT` is 4,
|
|
78
|
+
// so the fallback branch always leaves 36 columns to wrap into.
|
|
79
|
+
return wrapText(text, width - effectiveIndent)
|
|
80
|
+
.map((line) => dim(pad + line))
|
|
81
|
+
.join('\n');
|
|
82
|
+
}
|
|
83
|
+
/** The standard depth of a note under the line it explains. */
|
|
84
|
+
const NOTE_INDENT = 4;
|
|
85
|
+
/**
|
|
86
|
+
* The least text width that justifies keeping a caller's deeper indent.
|
|
87
|
+
*
|
|
88
|
+
* Not a floor on the wrap width — that was the bug. A note narrower than this
|
|
89
|
+
* is a vertical column of single words, so below it the indent is given up
|
|
90
|
+
* rather than the text.
|
|
91
|
+
*/
|
|
92
|
+
const MIN_NOTE_WIDTH = 24;
|
|
25
93
|
/**
|
|
26
94
|
* Write the bundled Claude Code skills into `<cwd>/.claude/skills/`.
|
|
27
95
|
*
|
|
@@ -30,6 +98,14 @@ import { verifyDashboardToken } from '../token-verify.js';
|
|
|
30
98
|
* alone (it may carry the user's edits).
|
|
31
99
|
*/
|
|
32
100
|
async function writeBundledSkills(cwd, overwrite) {
|
|
101
|
+
// Reported per outcome rather than per skill. Three bundled skills meant three
|
|
102
|
+
// near-identical lines saying the same thing about three sibling paths, which
|
|
103
|
+
// is three lines spent on one fact; the names are what a reader wants, and
|
|
104
|
+
// they fit on one. Grouped by outcome because a mixed run — two written, one
|
|
105
|
+
// left alone — is precisely where a single blanket line would lie.
|
|
106
|
+
const created = [];
|
|
107
|
+
const overwritten = [];
|
|
108
|
+
const skipped = [];
|
|
33
109
|
for (const skill of BUNDLED_SKILLS) {
|
|
34
110
|
const rel = `.claude/skills/${skill.name}/SKILL.md`;
|
|
35
111
|
const skillDir = join(cwd, '.claude', 'skills', skill.name);
|
|
@@ -39,15 +115,15 @@ async function writeBundledSkills(cwd, overwrite) {
|
|
|
39
115
|
.then(() => true)
|
|
40
116
|
.catch(() => false);
|
|
41
117
|
if (skillExists && !overwrite) {
|
|
42
|
-
|
|
118
|
+
skipped.push(skill.name);
|
|
43
119
|
}
|
|
44
120
|
else {
|
|
45
121
|
await mkdir(skillDir, { recursive: true });
|
|
46
122
|
await writeFile(skillPath, skill.content);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
123
|
+
if (skillExists)
|
|
124
|
+
overwritten.push(skill.name);
|
|
125
|
+
else
|
|
126
|
+
created.push(skill.name);
|
|
51
127
|
}
|
|
52
128
|
}
|
|
53
129
|
catch (err) {
|
|
@@ -55,6 +131,20 @@ async function writeBundledSkills(cwd, overwrite) {
|
|
|
55
131
|
console.warn(` warning: could not write ${rel} — ${message}`);
|
|
56
132
|
}
|
|
57
133
|
}
|
|
134
|
+
if (created.length > 0) {
|
|
135
|
+
console.log(did('created', `.claude/skills/ — ${created.join(', ')}`));
|
|
136
|
+
}
|
|
137
|
+
if (overwritten.length > 0) {
|
|
138
|
+
// Say what actually happened: this is an unprompted, unrecoverable
|
|
139
|
+
// overwrite, and "updated" reads as a merge. `AGENTS.md` below already
|
|
140
|
+
// says "overwrote" for the same operation.
|
|
141
|
+
console.log(did('overwrote', `.claude/skills/ — ${overwritten.join(', ')}`));
|
|
142
|
+
console.log(note('any local edits to those files are gone'));
|
|
143
|
+
}
|
|
144
|
+
if (skipped.length > 0) {
|
|
145
|
+
console.log(` kept ${skipped.join(', ')} under .claude/skills/`);
|
|
146
|
+
console.log(note('already present — `mossbear init --force` overwrites them'));
|
|
147
|
+
}
|
|
58
148
|
}
|
|
59
149
|
/**
|
|
60
150
|
* The adoption verb, as it is spelled for users.
|
|
@@ -193,7 +283,8 @@ export const initCommand = defineCommand({
|
|
|
193
283
|
.then(() => true)
|
|
194
284
|
.catch(() => false);
|
|
195
285
|
if (configExists && !args.force) {
|
|
196
|
-
console.log(' ~/.mossbear/config.json
|
|
286
|
+
console.log(' kept ~/.mossbear/config.json');
|
|
287
|
+
console.log(note('already present — `mossbear init --force` rewrites it from defaults'));
|
|
197
288
|
await chmod(MOSSBEAR_CONFIG, MOSSBEAR_CONFIG_MODE).catch(() => { });
|
|
198
289
|
// Reuse preserves the file, which would preserve an `eval.apiKey` an
|
|
199
290
|
// older version asked the user to store — a live third-party LLM
|
|
@@ -202,8 +293,9 @@ export const initCommand = defineCommand({
|
|
|
202
293
|
// just of the code. Said out loud: a key vanishing from the user's own
|
|
203
294
|
// file must not be silent, and they may want to revoke it upstream.
|
|
204
295
|
if (await removeConfigEvalSection()) {
|
|
205
|
-
console.log('
|
|
206
|
-
|
|
296
|
+
console.log(did('removed', 'the obsolete `eval` block from ~/.mossbear/config.json'));
|
|
297
|
+
console.log(note('grading moved to the dashboard; if that block held an API key, revoke it ' +
|
|
298
|
+
'with your provider — nothing here reads it now'));
|
|
207
299
|
}
|
|
208
300
|
}
|
|
209
301
|
else {
|
|
@@ -211,9 +303,7 @@ export const initCommand = defineCommand({
|
|
|
211
303
|
mode: MOSSBEAR_CONFIG_MODE,
|
|
212
304
|
});
|
|
213
305
|
await chmod(MOSSBEAR_CONFIG, MOSSBEAR_CONFIG_MODE).catch(() => { });
|
|
214
|
-
console.log(configExists
|
|
215
|
-
? ' updated ~/.mossbear/config.json'
|
|
216
|
-
: ' created ~/.mossbear/config.json');
|
|
306
|
+
console.log(did(configExists ? 'updated' : 'created', '~/.mossbear/config.json'));
|
|
217
307
|
}
|
|
218
308
|
// 1b. Dashboard URL. Persisted into the same config so subsequent
|
|
219
309
|
// commands resolve flag → config → baked default in a single helper.
|
|
@@ -245,19 +335,19 @@ export const initCommand = defineCommand({
|
|
|
245
335
|
const existingDashboardUrl = await readConfigDashboardUrl().catch(() => '');
|
|
246
336
|
if (flagDashboardUrl) {
|
|
247
337
|
await writeConfigDashboardUrl(flagDashboardUrl);
|
|
248
|
-
console.log(`
|
|
338
|
+
console.log(did('set', `dashboardUrl = ${flagDashboardUrl}`));
|
|
249
339
|
}
|
|
250
340
|
else if (existingDashboardUrl) {
|
|
251
|
-
console.log(`
|
|
341
|
+
console.log(` dashboardUrl = ${existingDashboardUrl} ${dim('— pass --dashboard-url to change')}`);
|
|
252
342
|
}
|
|
253
343
|
else if (envDashboardUrl) {
|
|
254
344
|
// The env var outranks the config file (`config.ts` → resolveDashboardUrl),
|
|
255
345
|
// so reporting the config's fallback here named a dashboard the runtime
|
|
256
346
|
// would not actually use. `doctor` already names $MOSSBEAR_TOKEN the same way.
|
|
257
|
-
console.log(`
|
|
347
|
+
console.log(` dashboardUrl = ${envDashboardUrl} ${dim(`— from $${MOSSBEAR_DASHBOARD_URL_ENV}, which outranks ~/.mossbear/config.json`)}`);
|
|
258
348
|
}
|
|
259
349
|
else if (!args.prompt || !process.stdin.isTTY) {
|
|
260
|
-
console.log(`
|
|
350
|
+
console.log(` dashboardUrl unset ${dim(`— falling back to ${DEFAULT_DASHBOARD_URL}`)}`);
|
|
261
351
|
}
|
|
262
352
|
else {
|
|
263
353
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -276,7 +366,7 @@ export const initCommand = defineCommand({
|
|
|
276
366
|
chosen = normalized;
|
|
277
367
|
}
|
|
278
368
|
await writeConfigDashboardUrl(chosen);
|
|
279
|
-
console.log(`
|
|
369
|
+
console.log(did('set', `dashboardUrl = ${chosen}`));
|
|
280
370
|
}
|
|
281
371
|
finally {
|
|
282
372
|
rl.close();
|
|
@@ -303,12 +393,22 @@ export const initCommand = defineCommand({
|
|
|
303
393
|
// is stored unverified either way — but they have different causes and
|
|
304
394
|
// different fixes, so don't report a policy denial as a network error.
|
|
305
395
|
await writeConfigToken(args.token);
|
|
396
|
+
// The `did()` line above already says it was stored, so this says only
|
|
397
|
+
// what the storing does *not* prove. 'ok' has nothing to add and says
|
|
398
|
+
// nothing — a note under every branch trains the reader past all of them.
|
|
306
399
|
const storedNote = verification === 'ok'
|
|
307
|
-
? '
|
|
400
|
+
? ''
|
|
308
401
|
: verification === 'blocked'
|
|
309
|
-
? `
|
|
310
|
-
: `
|
|
311
|
-
|
|
402
|
+
? `not verified — ${verifyUrl} answered 403 through an intermediary (likely an egress allowlist), which says nothing about the token itself`
|
|
403
|
+
: `not verified — could not reach ${verifyUrl}`;
|
|
404
|
+
// "(verified)" is said rather than left to be inferred from the absence
|
|
405
|
+
// of a note below: silence is not a claim, and "the dashboard accepted
|
|
406
|
+
// this token" is exactly the one a reader wants stated.
|
|
407
|
+
console.log(did('stored', verification === 'ok'
|
|
408
|
+
? 'your dashboard token (verified)'
|
|
409
|
+
: 'your dashboard token'));
|
|
410
|
+
if (storedNote)
|
|
411
|
+
console.log(note(storedNote));
|
|
312
412
|
}
|
|
313
413
|
}
|
|
314
414
|
// 1b. Portable project identity in the committed <repo>/.mossbear/config.json.
|
|
@@ -332,18 +432,22 @@ export const initCommand = defineCommand({
|
|
|
332
432
|
console.warn(' warning: stripped a `token` key from .mossbear/config.json — rotate it if that file ' +
|
|
333
433
|
'was ever committed (~/.mossbear/config.json is the only place a token belongs).');
|
|
334
434
|
}
|
|
435
|
+
// Empty for the declared case: the `did()` line already says "read", and
|
|
436
|
+
// "already declared" only restated it.
|
|
335
437
|
const detail = project.source === 'declared'
|
|
336
|
-
? '
|
|
438
|
+
? ''
|
|
337
439
|
: project.source === 'git-root-commit'
|
|
338
440
|
? "derived from this repo's root commit — commit the file so every clone agrees"
|
|
339
441
|
: project.generatedReason === 'shallow-clone'
|
|
340
|
-
? 'generated:
|
|
442
|
+
? 'generated: a shallow clone has no derivable root commit — ' +
|
|
341
443
|
'commit the file so your full checkouts agree'
|
|
342
444
|
: project.generatedReason === 'multiple-roots'
|
|
343
445
|
? 'generated: this history has several root commits, so which one is "the" root ' +
|
|
344
446
|
'depends on the branch — commit the file so every clone agrees'
|
|
345
447
|
: 'generated: no git history to derive from — commit the file so other checkouts agree';
|
|
346
|
-
console.log(
|
|
448
|
+
console.log(did(project.source === 'declared' ? 'read' : 'wrote', `.mossbear/config.json — project ${project.projectId}`));
|
|
449
|
+
if (detail)
|
|
450
|
+
console.log(note(detail));
|
|
347
451
|
}
|
|
348
452
|
// 2. Claude Code hooks in .claude/settings.json
|
|
349
453
|
// One writer for the run log: the `mossbear-hook` bin (hook-logger.ts).
|
|
@@ -388,13 +492,32 @@ export const initCommand = defineCommand({
|
|
|
388
492
|
settings['hooks'] = {};
|
|
389
493
|
const hooks = settings['hooks'];
|
|
390
494
|
let settingsChanged = false;
|
|
495
|
+
/*
|
|
496
|
+
* Five hooks, reported as one line.
|
|
497
|
+
*
|
|
498
|
+
* Each merge below used to print its own `updated .claude/settings.json
|
|
499
|
+
* with <Event> hook` — five lines naming the same file, in a block whose
|
|
500
|
+
* other twenty lines also name files, which is where a reader stops
|
|
501
|
+
* reading. The events are the information and they fit on one line; the
|
|
502
|
+
* file is said once. Repairs, prunes and warnings keep their own lines
|
|
503
|
+
* on purpose: those are the exceptional outcomes, and folding them into
|
|
504
|
+
* a count is how a destructive edit goes unnoticed.
|
|
505
|
+
*
|
|
506
|
+
* `settingsFileExisted` is captured before any merge because the summary
|
|
507
|
+
* is written after all of them — the per-hook lines could flip a running
|
|
508
|
+
* `settingsExisted` flag from created to updated as they went, and a
|
|
509
|
+
* single line has to pick the state the run actually started in.
|
|
510
|
+
*/
|
|
511
|
+
const settingsFileExisted = settingsExisted;
|
|
512
|
+
const installedHooks = [];
|
|
513
|
+
const presentHooks = [];
|
|
514
|
+
const hookNotes = [];
|
|
391
515
|
// PostToolUse: action logger.
|
|
392
516
|
const loggerMerge = mergeMossbearLoggerHook(hooks['PostToolUse'], mossbearHookEntry);
|
|
393
517
|
hooks['PostToolUse'] = loggerMerge.postToolUse;
|
|
394
518
|
if (loggerMerge.action === 'installed') {
|
|
395
519
|
settingsChanged = true;
|
|
396
|
-
|
|
397
|
-
settingsExisted = true;
|
|
520
|
+
installedHooks.push('PostToolUse');
|
|
398
521
|
}
|
|
399
522
|
else if (loggerMerge.action === 'repaired') {
|
|
400
523
|
settingsChanged = true;
|
|
@@ -406,7 +529,7 @@ export const initCommand = defineCommand({
|
|
|
406
529
|
}
|
|
407
530
|
}
|
|
408
531
|
else {
|
|
409
|
-
|
|
532
|
+
presentHooks.push('PostToolUse');
|
|
410
533
|
}
|
|
411
534
|
// PostToolUseFailure: the other half of the logger. PostToolUse fires
|
|
412
535
|
// only after a tool call *succeeds* — a failing Bash exit, a denied
|
|
@@ -419,8 +542,7 @@ export const initCommand = defineCommand({
|
|
|
419
542
|
hooks['PostToolUseFailure'] = failureMerge.postToolUse;
|
|
420
543
|
if (failureMerge.action === 'installed') {
|
|
421
544
|
settingsChanged = true;
|
|
422
|
-
|
|
423
|
-
settingsExisted = true;
|
|
545
|
+
installedHooks.push('PostToolUseFailure');
|
|
424
546
|
}
|
|
425
547
|
else if (failureMerge.action === 'repaired') {
|
|
426
548
|
settingsChanged = true;
|
|
@@ -432,7 +554,7 @@ export const initCommand = defineCommand({
|
|
|
432
554
|
}
|
|
433
555
|
}
|
|
434
556
|
else {
|
|
435
|
-
|
|
557
|
+
presentHooks.push('PostToolUseFailure');
|
|
436
558
|
}
|
|
437
559
|
// Hooks written by an earlier CLI invoke commands this one no longer
|
|
438
560
|
// has — `auden eval` from the local-grading era, and the
|
|
@@ -600,31 +722,65 @@ export const initCommand = defineCommand({
|
|
|
600
722
|
// entry. Naming a remedy the branch cannot deliver is the same
|
|
601
723
|
// error as naming a cause it cannot distinguish
|
|
602
724
|
// (`docs/design/error-messaging.md`).
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
725
|
+
//
|
|
726
|
+
// One sentence run, wrapped by `note()` to the reader's terminal
|
|
727
|
+
// rather than to six hand-placed newlines that overhung an
|
|
728
|
+
// 80-column window. Every clause is load-bearing and
|
|
729
|
+
// `init-session-start-hook.test.ts` asserts on each: what it does,
|
|
730
|
+
// that it never touches this machine, how to stop the update, and
|
|
731
|
+
// how to not have the hook. The only thing dropped is the list of
|
|
732
|
+
// example environments, which "rebuilt between sessions" carries.
|
|
733
|
+
note: note('In environments rebuilt between sessions this hook also installs the current ' +
|
|
734
|
+
'mossbear release before the first turn; it never updates this machine. ' +
|
|
735
|
+
'MOSSBEAR_NO_UPDATE_CHECK=1 stops that and still pulls context; remove the ' +
|
|
736
|
+
'SessionStart entry from .claude/settings.json to drop the hook, or ' +
|
|
737
|
+
'`mossbear init --no-session-start-hook` to skip it next time.'),
|
|
610
738
|
},
|
|
611
739
|
];
|
|
612
|
-
for (const { event, enabled, entry, isPresent, matcher, note } of hookEntries) {
|
|
740
|
+
for (const { event, enabled, entry, isPresent, matcher, note: consentNote, } of hookEntries) {
|
|
613
741
|
if (!enabled)
|
|
614
742
|
continue;
|
|
615
743
|
const merge = mergeMossbearHookEntry(hooks[event], entry, isPresent, matcher);
|
|
616
744
|
hooks[event] = merge.groups;
|
|
617
745
|
if (merge.action === 'installed') {
|
|
618
746
|
settingsChanged = true;
|
|
619
|
-
|
|
620
|
-
if (
|
|
621
|
-
|
|
622
|
-
settingsExisted = true;
|
|
747
|
+
installedHooks.push(event);
|
|
748
|
+
if (consentNote)
|
|
749
|
+
hookNotes.push(consentNote);
|
|
623
750
|
}
|
|
624
751
|
else {
|
|
625
|
-
|
|
752
|
+
presentHooks.push(event);
|
|
626
753
|
}
|
|
627
754
|
}
|
|
755
|
+
if (installedHooks.length > 0) {
|
|
756
|
+
// The event names go on the note line rather than beside the path:
|
|
757
|
+
// five of them plus the filename runs to ~97 columns, and a fact that
|
|
758
|
+
// wraps mid-list is the one shape this block was rewritten to avoid.
|
|
759
|
+
console.log(did(settingsFileExisted ? 'updated' : 'created', '.claude/settings.json'));
|
|
760
|
+
console.log(note(`${installedHooks.length} hook${installedHooks.length === 1 ? '' : 's'}: ${installedHooks.join(', ')}`));
|
|
761
|
+
}
|
|
762
|
+
if (presentHooks.length > 0) {
|
|
763
|
+
console.log(` kept ${presentHooks.join(', ')} in .claude/settings.json`);
|
|
764
|
+
console.log(note('already installed'));
|
|
765
|
+
}
|
|
766
|
+
// After the summary, never folded into it: this is the consent notice
|
|
767
|
+
// for an entry that updates the CLI in rebuilt environments, and it is
|
|
768
|
+
// printed exactly on the run that writes that entry.
|
|
769
|
+
for (const consentNote of hookNotes)
|
|
770
|
+
console.log(consentNote);
|
|
771
|
+
// …and then the one thing the consent notice cannot say, because it is
|
|
772
|
+
// about a hook this command did not write. A repo carrying the older
|
|
773
|
+
// `mossbear update` conditional now runs a freshness check through that
|
|
774
|
+
// *and* through the bootstrap. `pruneStaleHooks` will not remove it —
|
|
775
|
+
// compound shell `init` did not author — and `sessionStartHookAlreadyPulls`
|
|
776
|
+
// does not count it, so the bootstrap goes in beside it either way. The
|
|
777
|
+
// reader learns that here, on the run that made it so, rather than from
|
|
778
|
+
// `doctor` at some later point (`docs/plans/onboarding-magic-plan.md`
|
|
779
|
+
// §2.6). Read off the merged groups, so it is what the file will say
|
|
780
|
+
// rather than what this run intended.
|
|
781
|
+
const legacyFreshnessNote = legacyFreshnessHookNote(hooks['SessionStart']);
|
|
782
|
+
if (legacyFreshnessNote)
|
|
783
|
+
console.log(legacyFreshnessNote);
|
|
628
784
|
if (settingsChanged) {
|
|
629
785
|
await writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
630
786
|
}
|
|
@@ -833,13 +989,14 @@ export const initCommand = defineCommand({
|
|
|
833
989
|
console.log(' AGENTS.md materialized from your subscription — template not written');
|
|
834
990
|
}
|
|
835
991
|
else if (agentsMdExists && !args.force) {
|
|
836
|
-
console.log(' AGENTS.md
|
|
992
|
+
console.log(' kept AGENTS.md');
|
|
993
|
+
console.log(note('already present — `mossbear init --force` overwrites it'));
|
|
837
994
|
}
|
|
838
995
|
else {
|
|
839
996
|
await writeFile(agentsMdPath, AGENTS_MD_TEMPLATE);
|
|
840
997
|
if (agentsMdExists)
|
|
841
998
|
clobberedGuidePaths.add('AGENTS.md');
|
|
842
|
-
console.log(agentsMdExists ? '
|
|
999
|
+
console.log(did(agentsMdExists ? 'overwrote' : 'created', 'AGENTS.md'));
|
|
843
1000
|
}
|
|
844
1001
|
// 5. .agents/
|
|
845
1002
|
const agentsDirPath = join(cwd, '.agents');
|
|
@@ -847,7 +1004,8 @@ export const initCommand = defineCommand({
|
|
|
847
1004
|
.then(() => true)
|
|
848
1005
|
.catch(() => false);
|
|
849
1006
|
if (agentsDirExists && !args.force) {
|
|
850
|
-
console.log(' .agents/
|
|
1007
|
+
console.log(' kept .agents/');
|
|
1008
|
+
console.log(note('already present — `mossbear init --force` overwrites it'));
|
|
851
1009
|
}
|
|
852
1010
|
else {
|
|
853
1011
|
await mkdir(agentsDirPath, { recursive: true });
|
|
@@ -856,7 +1014,7 @@ export const initCommand = defineCommand({
|
|
|
856
1014
|
// basename (`packages/projections/src/detect-format.ts:67`), so the
|
|
857
1015
|
// placeholder is never imported as an empty phantom guide.
|
|
858
1016
|
await writeFile(join(agentsDirPath, '.gitkeep'), '');
|
|
859
|
-
console.log('
|
|
1017
|
+
console.log(did('created', '.agents/'));
|
|
860
1018
|
}
|
|
861
1019
|
// 6. Claude Code skills (mossbear + context-layer round-trip skills)
|
|
862
1020
|
//
|
|
@@ -987,21 +1145,57 @@ export const initCommand = defineCommand({
|
|
|
987
1145
|
}
|
|
988
1146
|
}
|
|
989
1147
|
}
|
|
1148
|
+
/*
|
|
1149
|
+
* The one block a reader is guaranteed to want, so it is the one block that
|
|
1150
|
+
* has to survive being skimmed.
|
|
1151
|
+
*
|
|
1152
|
+
* Two changes over the run-on sentences this replaces. The commands are
|
|
1153
|
+
* cyan and their descriptions dim, so the typeable half separates from the
|
|
1154
|
+
* explaining half at a glance. And the gutter is measured rather than
|
|
1155
|
+
* typed: every one of these lines used to carry hand-counted padding, which
|
|
1156
|
+
* the last rename left one column out — `displayWidth` is already here for
|
|
1157
|
+
* exactly this, and a column computed from the strings themselves cannot
|
|
1158
|
+
* drift from them.
|
|
1159
|
+
*
|
|
1160
|
+
* Descriptions stay short enough that no line wraps at 80 columns. A step
|
|
1161
|
+
* that needs more than that gets its own dim line underneath, which is what
|
|
1162
|
+
* the token hint does; a wrapped step reads as two steps.
|
|
1163
|
+
*/
|
|
1164
|
+
const nextSteps = [
|
|
1165
|
+
hasToken
|
|
1166
|
+
? {
|
|
1167
|
+
command: 'mossbear sync',
|
|
1168
|
+
description: 'pull your guides, upload this session',
|
|
1169
|
+
note: 'the hooks already run this for you',
|
|
1170
|
+
}
|
|
1171
|
+
: {
|
|
1172
|
+
command: 'mossbear sync --token <token>',
|
|
1173
|
+
description: 'connect your dashboard',
|
|
1174
|
+
note: 'token: Settings → Developer → CLI Token; remembered after the first run',
|
|
1175
|
+
},
|
|
1176
|
+
// Always listed, not just when this run found files: someone who adds an
|
|
1177
|
+
// AGENTS.md tomorrow needs to know the command exists today.
|
|
1178
|
+
{
|
|
1179
|
+
command: ADOPT_VERB,
|
|
1180
|
+
description: importableGuideFiles.length > 0
|
|
1181
|
+
? `adopt this repo's ${importableGuideFiles.length} existing guide files`
|
|
1182
|
+
: "adopt this repo's existing guide files",
|
|
1183
|
+
},
|
|
1184
|
+
{ command: 'mossbear guides active', description: 'list cached guides' },
|
|
1185
|
+
{ command: 'mossbear doctor', description: 'verify your environment' },
|
|
1186
|
+
];
|
|
1187
|
+
const gutter = Math.max(...nextSteps.map((step) => displayWidth(step.command))) + 2;
|
|
990
1188
|
console.log('\nDone. Next steps:');
|
|
991
1189
|
console.log(' Edit AGENTS.md to add your rules');
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1190
|
+
for (const step of nextSteps) {
|
|
1191
|
+
// Padded before colouring, never after: escape codes count toward
|
|
1192
|
+
// `String.length` and occupy no columns, so padding a coloured string pads
|
|
1193
|
+
// by the wrong amount (`terminal.ts` → `dim`).
|
|
1194
|
+
const padding = ' '.repeat(gutter - displayWidth(step.command));
|
|
1195
|
+
console.log(` ${cyan(step.command)}${padding}${dim(step.description)}`);
|
|
1196
|
+
if (step.note)
|
|
1197
|
+
console.log(note(step.note, gutter + 2));
|
|
997
1198
|
}
|
|
998
|
-
// Always listed, not just when this run found files: someone who adds an
|
|
999
|
-
// AGENTS.md tomorrow needs to know the command exists today.
|
|
1000
|
-
console.log(importableGuideFiles.length > 0
|
|
1001
|
-
? ` ${ADOPT_VERB} — adopt this repo's existing guide files (${importableGuideFiles.length} found) into your dashboard`
|
|
1002
|
-
: ` ${ADOPT_VERB} — adopt this repo's existing guide files into your dashboard`);
|
|
1003
|
-
console.log(' mossbear guides active — list cached guides');
|
|
1004
|
-
console.log(' mossbear doctor — verify your environment');
|
|
1005
1199
|
},
|
|
1006
1200
|
});
|
|
1007
1201
|
//# sourceMappingURL=init.js.map
|