claudepluginhub 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/dist/doctor/args.d.ts +1 -1
- package/dist/doctor/args.js +18 -8
- package/dist/doctor/color.d.ts +11 -0
- package/dist/doctor/color.js +23 -0
- package/dist/doctor/equivalence.d.ts +9 -0
- package/dist/doctor/equivalence.js +265 -0
- package/dist/doctor/estimate.d.ts +5 -19
- package/dist/doctor/estimate.js +84 -16
- package/dist/doctor/html-report.d.ts +9 -0
- package/dist/doctor/html-report.js +385 -0
- package/dist/doctor/inventory.d.ts +6 -5
- package/dist/doctor/inventory.js +225 -19
- package/dist/doctor/open-browser.d.ts +11 -0
- package/dist/doctor/open-browser.js +38 -0
- package/dist/doctor/render.d.ts +2 -8
- package/dist/doctor/render.js +323 -117
- package/dist/doctor/report.d.ts +50 -5
- package/dist/doctor/report.js +2 -0
- package/dist/doctor/rules.d.ts +39 -2
- package/dist/doctor/rules.js +0 -0
- package/dist/doctor/run.d.ts +12 -17
- package/dist/doctor/run.js +96 -16
- package/dist/doctor/select.js +0 -0
- package/dist/doctor/wrap.d.ts +2 -0
- package/dist/doctor/wrap.js +84 -0
- package/package.json +1 -1
package/dist/doctor/render.js
CHANGED
|
@@ -1,147 +1,353 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { makeTheme, shouldColorize } from './color.js';
|
|
2
|
+
import { formatApproxTokens } from './estimate.js';
|
|
3
|
+
import { wrapText, terminalWidth } from './wrap.js';
|
|
4
|
+
/** Strip ANSI escape sequences to measure visible character width. */
|
|
5
|
+
function stripAnsi(s) {
|
|
6
|
+
return s.replace(/\x1b\[[0-9;]*m/g, '');
|
|
7
|
+
}
|
|
2
8
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* list stays reserved for actionable conditions.
|
|
9
|
+
* Wrap plain text then apply `t.dim()` to each resulting line independently.
|
|
10
|
+
* Prevents ANSI dim codes from leaking across physical lines when wrapText
|
|
11
|
+
* splits a long styled string.
|
|
7
12
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
function wrapDim(text, t, width, indent, firstIndent) {
|
|
14
|
+
const wrapped = wrapText(text, width, indent, firstIndent);
|
|
15
|
+
return wrapped.split('\n').map((line) => t.dim(line)).join('\n');
|
|
10
16
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
17
|
+
function wrapBoldHeading(text, t, width) {
|
|
18
|
+
const wrapped = wrapText(text, width, 2, 0);
|
|
19
|
+
return wrapped.split('\n').map((line) => t.bold(line)).join('\n');
|
|
13
20
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
warning: `${YELLOW}WARN ${RESET}`,
|
|
17
|
-
info: `${DIM}INFO ${RESET}`,
|
|
18
|
-
};
|
|
19
|
-
function pluginChips(entry) {
|
|
20
|
-
const chips = [];
|
|
21
|
-
if (entry.components) {
|
|
22
|
-
for (const [type, summary] of Object.entries(entry.components)) {
|
|
23
|
-
if (summary.count > 0)
|
|
24
|
-
chips.push(`${type} ${summary.count}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (entry.capabilities) {
|
|
28
|
-
const caps = entry.capabilities;
|
|
29
|
-
if (caps.hooks.total > 0)
|
|
30
|
-
chips.push(`hooks ${caps.hooks.total}`);
|
|
31
|
-
if (caps.mcp.total > 0)
|
|
32
|
-
chips.push(`mcp ${caps.mcp.total}`);
|
|
33
|
-
if (caps.lsp.total > 0)
|
|
34
|
-
chips.push(`lsp ${caps.lsp.total}`);
|
|
35
|
-
if (caps.monitors.total > 0)
|
|
36
|
-
chips.push(`monitors ${caps.monitors.total}`);
|
|
37
|
-
if (caps.binCount > 0)
|
|
38
|
-
chips.push(`bin ${caps.binCount}`);
|
|
39
|
-
}
|
|
40
|
-
return chips.length > 0 ? ` ${DIM}[${chips.join(' · ')}]${RESET}` : '';
|
|
21
|
+
export function renderJson(report) {
|
|
22
|
+
return `${JSON.stringify(report, null, 2)}\n`;
|
|
41
23
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
? `${DIM}disabled${RESET}`
|
|
45
|
-
: entry.selection === 'ambiguous'
|
|
46
|
-
? `${YELLOW}ambiguous${RESET}`
|
|
47
|
-
: 'active';
|
|
48
|
-
const tokens = entry.estAlwaysOnTokens !== null ? ` ${DIM}~${formatTokens(entry.estAlwaysOnTokens)} tok${RESET}` : '';
|
|
49
|
-
const native = entry.nativeErrors.length > 0 ? ` ${RED}load-error${RESET}` : '';
|
|
50
|
-
return ` ${BOLD}${entry.id}${RESET} ${DIM}v${entry.version} (${entry.scope})${RESET} ${state}${native}${tokens}${pluginChips(entry)}`;
|
|
24
|
+
function findingsByCategory(findings, ...categories) {
|
|
25
|
+
return findings.filter((f) => categories.includes(f.category));
|
|
51
26
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
27
|
+
export function renderHuman(report, flags) {
|
|
28
|
+
const color = shouldColorize();
|
|
29
|
+
const t = makeTheme(color);
|
|
30
|
+
const width = terminalWidth();
|
|
31
|
+
const lines = [];
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push(`${t.cyan(t.bold('ClaudePluginHub Doctor'))}`);
|
|
34
|
+
lines.push('');
|
|
35
|
+
const { confirmedProblems, reviewItems, coverageGaps } = report.summary;
|
|
36
|
+
const actionableCount = confirmedProblems + reviewItems;
|
|
37
|
+
if (actionableCount > 0) {
|
|
38
|
+
lines.push(t.red(t.bold(`${actionableCount} issue${actionableCount === 1 ? '' : 's'} need${actionableCount === 1 ? 's' : ''} attention.`)));
|
|
61
39
|
}
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
function contextSummaryLine(context) {
|
|
65
|
-
const incomplete = context.summary.estimateComplete ? '' : ' (incomplete — lower bound)';
|
|
66
|
-
const est = context.summary.estimatedAlwaysOnTokens !== null
|
|
67
|
-
? ` · est. always-on ${CYAN}~${formatTokens(context.summary.estimatedAlwaysOnTokens)} tokens${RESET}${incomplete}`
|
|
68
|
-
: '';
|
|
69
|
-
return `${DIM}Active: ${context.summary.activePlugins} · Disabled: ${context.summary.disabledRecords} · Ambiguous: ${context.summary.ambiguousPlugins}${est}${RESET}`;
|
|
70
|
-
}
|
|
71
|
-
function pluginLines(context) {
|
|
72
|
-
const lines = context.plugins.items.map(pluginLine);
|
|
73
|
-
if (context.plugins.omitted > 0) {
|
|
74
|
-
lines.push(` ${DIM}… +${context.plugins.omitted} more plugin record(s) not shown${RESET}`);
|
|
40
|
+
else if (coverageGaps > 0) {
|
|
41
|
+
lines.push(t.yellow(`Doctor could not fully verify ${coverageGaps} item${coverageGaps === 1 ? '' : 's'}.`));
|
|
75
42
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
function findingLines(findings) {
|
|
79
|
-
const lines = findings.items.flatMap(findingBlock);
|
|
80
|
-
if (findings.omitted > 0) {
|
|
81
|
-
lines.push(`${DIM}… +${findings.omitted} more finding(s) not shown${RESET}`);
|
|
43
|
+
else {
|
|
44
|
+
lines.push(t.green('No broken plugins found.'));
|
|
82
45
|
}
|
|
83
|
-
return lines;
|
|
84
|
-
}
|
|
85
|
-
export function renderHuman(report) {
|
|
86
|
-
const lines = [];
|
|
87
|
-
lines.push('');
|
|
88
|
-
lines.push(`${CYAN}${BOLD}ClaudePluginHub Doctor${RESET}`);
|
|
89
46
|
lines.push('');
|
|
90
|
-
lines.push(`Claude Code ${report.claude.version ?? '(version unknown)'}`);
|
|
91
47
|
const current = report.contexts.find((c) => c.isCurrent) ?? report.contexts[0];
|
|
92
48
|
const multiContext = report.contexts.length > 1;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
lines.push(contextSummaryLine(current));
|
|
96
|
-
}
|
|
97
|
-
const { errors, warnings, notes } = report.summary;
|
|
98
|
-
lines.push('');
|
|
99
|
-
lines.push(`${errors > 0 ? RED : ''}${errors} error${errors === 1 ? '' : 's'}${errors > 0 ? RESET : ''} · ` +
|
|
100
|
-
`${warnings > 0 ? YELLOW : ''}${warnings} warning${warnings === 1 ? '' : 's'}${warnings > 0 ? RESET : ''} · ` +
|
|
101
|
-
`${notes} note${notes === 1 ? '' : 's'}`);
|
|
49
|
+
const globalActionable = findingsByCategory(report.findings.items, 'confirmed_problem', 'review');
|
|
50
|
+
const globalCoverage = findingsByCategory(report.findings.items, 'coverage');
|
|
102
51
|
if (multiContext) {
|
|
103
|
-
//
|
|
104
|
-
if (
|
|
105
|
-
lines.push('');
|
|
106
|
-
lines
|
|
52
|
+
// Show global findings under an "Installation-wide" heading
|
|
53
|
+
if (globalActionable.length > 0) {
|
|
54
|
+
lines.push(t.bold('Installation-wide'));
|
|
55
|
+
renderFindingsList(globalActionable, t, width, lines);
|
|
107
56
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
57
|
+
// Show each context's actionable findings under its own heading
|
|
58
|
+
for (const ctx of report.contexts) {
|
|
59
|
+
const ctxActionable = findingsByCategory(ctx.findings.items, 'confirmed_problem', 'review');
|
|
60
|
+
if (ctxActionable.length > 0) {
|
|
61
|
+
lines.push(wrapBoldHeading(`— ${ctx.key} · ${ctx.label}${ctx.isCurrent ? ' (current)' : ''}`, t, width));
|
|
62
|
+
renderFindingsList(ctxActionable, t, width, lines);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const allActionable = [
|
|
68
|
+
...globalActionable,
|
|
69
|
+
...report.contexts.flatMap((c) => findingsByCategory(c.findings.items, 'confirmed_problem', 'review')),
|
|
70
|
+
];
|
|
71
|
+
renderFindingsList(allActionable, t, width, lines);
|
|
72
|
+
}
|
|
73
|
+
if (multiContext) {
|
|
74
|
+
for (const ctx of report.contexts) {
|
|
75
|
+
const headingPlain = `— ${ctx.key} · ${ctx.label}${ctx.isCurrent ? ' (current)' : ''}`;
|
|
76
|
+
const headingWrapped = wrapText(headingPlain, width, 0, 0);
|
|
77
|
+
lines.push(headingWrapped.split('\n').map((l) => t.bold(l)).join('\n'));
|
|
78
|
+
renderContextFootprint(ctx, t, width, lines);
|
|
114
79
|
}
|
|
115
80
|
}
|
|
116
81
|
else if (current) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
renderContextFootprint(current, t, width, lines);
|
|
83
|
+
}
|
|
84
|
+
if (multiContext) {
|
|
85
|
+
if (globalCoverage.length > 0) {
|
|
86
|
+
lines.push(t.bold('Installation-wide'));
|
|
87
|
+
renderCoverageList(globalCoverage, t, width, lines);
|
|
120
88
|
}
|
|
121
|
-
|
|
89
|
+
for (const ctx of report.contexts) {
|
|
90
|
+
const ctxCoverage = findingsByCategory(ctx.findings.items, 'coverage');
|
|
91
|
+
if (ctxCoverage.length > 0) {
|
|
92
|
+
lines.push(wrapBoldHeading(`— ${ctx.key} · ${ctx.label}${ctx.isCurrent ? ' (current)' : ''}`, t, width));
|
|
93
|
+
renderCoverageList(ctxCoverage, t, width, lines);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const allCoverage = [
|
|
99
|
+
...globalCoverage,
|
|
100
|
+
...report.contexts.flatMap((c) => findingsByCategory(c.findings.items, 'coverage')),
|
|
101
|
+
];
|
|
102
|
+
renderCoverageList(allCoverage, t, width, lines);
|
|
103
|
+
}
|
|
104
|
+
if (flags.strict) {
|
|
105
|
+
const allMaintenance = [
|
|
106
|
+
...findingsByCategory(report.findings.items, 'maintenance'),
|
|
107
|
+
...report.contexts.flatMap((c) => findingsByCategory(c.findings.items, 'maintenance')),
|
|
108
|
+
];
|
|
109
|
+
const hiddenStrictWarnings = allMaintenance.filter((f) => f.severity === 'warning');
|
|
110
|
+
if (hiddenStrictWarnings.length > 0 && !flags.verbose) {
|
|
111
|
+
lines.push(t.yellow(`${hiddenStrictWarnings.length} maintenance warning${hiddenStrictWarnings.length === 1 ? '' : 's'} (would pass without --strict).`));
|
|
112
|
+
for (const finding of hiddenStrictWarnings) {
|
|
113
|
+
lines.push(` ${t.dim(finding.title)}: ${wrapText(finding.message, width - 2, 2)}`);
|
|
114
|
+
}
|
|
122
115
|
lines.push('');
|
|
123
|
-
lines.push(...findingLines(report.findings));
|
|
124
|
-
lines.push(...findingLines(current.findings));
|
|
125
116
|
}
|
|
126
117
|
}
|
|
127
|
-
if (
|
|
128
|
-
lines
|
|
129
|
-
|
|
118
|
+
if (flags.verbose) {
|
|
119
|
+
renderVerbose(report, [], t, width, lines);
|
|
120
|
+
}
|
|
121
|
+
const totalFindingsOmitted = report.findings.omitted +
|
|
122
|
+
report.contexts.reduce((sum, c) => sum + c.findings.omitted, 0);
|
|
123
|
+
if (totalFindingsOmitted > 0) {
|
|
124
|
+
lines.push(wrapDim(`${totalFindingsOmitted} additional finding(s) not shown (report capped).`, t, width, 0, 0));
|
|
130
125
|
}
|
|
131
126
|
if (report.contextsOmitted > 0) {
|
|
127
|
+
lines.push(wrapDim(`${report.contextsOmitted} additional project context(s) beyond the limit were not analyzed.`, t, width, 0, 0));
|
|
128
|
+
}
|
|
129
|
+
if (report.summary.otherProjectRecordsIgnored > 0) {
|
|
130
|
+
lines.push(wrapDim(report.options.allProjects
|
|
131
|
+
? `${report.summary.otherProjectRecordsIgnored} record(s) could not be attributed to an analyzable project.`
|
|
132
|
+
: `${report.summary.otherProjectRecordsIgnored} record(s) belonging to other projects were ignored — use --all-projects to analyze them.`, t, width, 0, 0));
|
|
133
|
+
}
|
|
134
|
+
lines.push(wrapDim('~ values are heuristic estimates; `claude plugin details` is authoritative.', t, width, 0, 0));
|
|
135
|
+
lines.push('');
|
|
136
|
+
return lines.join('\n');
|
|
137
|
+
}
|
|
138
|
+
function renderFindingsList(findings, t, width, lines) {
|
|
139
|
+
for (const finding of findings) {
|
|
140
|
+
lines.push(` ${t.bold(finding.title)}`);
|
|
141
|
+
lines.push(wrapText(finding.message, width, 4, 2));
|
|
142
|
+
if (finding.remediation) {
|
|
143
|
+
lines.push(wrapText(`${t.dim('fix:')} ${finding.remediation}`, width, 8, 2));
|
|
144
|
+
}
|
|
145
|
+
lines.push('');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function renderCoverageList(findings, t, width, lines) {
|
|
149
|
+
for (const finding of findings) {
|
|
150
|
+
lines.push(` ${t.yellow(finding.title)}`);
|
|
151
|
+
lines.push(wrapText(finding.message, width, 4, 2));
|
|
152
|
+
if (finding.remediation) {
|
|
153
|
+
lines.push(wrapText(`${t.dim('fix:')} ${finding.remediation}`, width, 8, 2));
|
|
154
|
+
}
|
|
132
155
|
lines.push('');
|
|
133
|
-
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function renderContextFootprint(context, t, width, lines) {
|
|
159
|
+
const { summary, contributors } = context;
|
|
160
|
+
if (summary.estimatedAlwaysOnTokens === null && summary.activePlugins === 0)
|
|
161
|
+
return;
|
|
162
|
+
const tokenStr = summary.estimatedAlwaysOnTokens !== null
|
|
163
|
+
? formatApproxTokens(summary.estimatedAlwaysOnTokens)
|
|
164
|
+
: '—';
|
|
165
|
+
const pluginWord = summary.activePlugins === 1 ? 'plugin' : 'plugins';
|
|
166
|
+
const footprintPlain = `Always-on context: ${tokenStr} tokens across ${summary.activePlugins} ${pluginWord}${!summary.estimateComplete ? ' (incomplete — lower bound)' : ''}`;
|
|
167
|
+
const footprintWrapped = wrapText(footprintPlain, width, 2, 0);
|
|
168
|
+
lines.push(footprintWrapped.split('\n').map((line) => {
|
|
169
|
+
// Style token count and incomplete note within each physical line
|
|
170
|
+
return line
|
|
171
|
+
.replace(new RegExp(`${tokenStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} tokens`), t.cyan(`${tokenStr} tokens`))
|
|
172
|
+
.replace('(incomplete — lower bound)', t.dim('(incomplete — lower bound)'));
|
|
173
|
+
}).join('\n'));
|
|
174
|
+
if (contributors && contributors.top.length > 0) {
|
|
175
|
+
for (const c of contributors.top) {
|
|
176
|
+
const contribPlain = `${c.id} ${formatApproxTokens(c.tokens)} tok`;
|
|
177
|
+
const contribWrapped = wrapText(contribPlain, width, 4, 2);
|
|
178
|
+
lines.push(contribWrapped.split('\n').map((line) => {
|
|
179
|
+
const tokSuffix = `${formatApproxTokens(c.tokens)} tok`;
|
|
180
|
+
const idx = line.indexOf(tokSuffix);
|
|
181
|
+
if (idx >= 0) {
|
|
182
|
+
return line.slice(0, idx) + t.dim(tokSuffix) + line.slice(idx + tokSuffix.length);
|
|
183
|
+
}
|
|
184
|
+
return line;
|
|
185
|
+
}).join('\n'));
|
|
186
|
+
}
|
|
187
|
+
if (contributors.remainingCount > 0) {
|
|
188
|
+
lines.push(` ${t.dim(`+${contributors.remainingCount} more with ${formatApproxTokens(contributors.remainingTokens)} tok combined`)}`);
|
|
189
|
+
}
|
|
190
|
+
else if (contributors.top.every((c) => c.tokens === 0) && summary.activePlugins > 0) {
|
|
191
|
+
lines.push(` ${t.dim('(No plugins contribute measurable always-on context.)')}`);
|
|
192
|
+
}
|
|
134
193
|
}
|
|
135
194
|
lines.push('');
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
195
|
+
}
|
|
196
|
+
function renderVerbose(report, _allFindings, t, width, lines) {
|
|
197
|
+
const multiContext = report.contexts.length > 1;
|
|
198
|
+
const globalMaintenance = findingsByCategory(report.findings.items, 'maintenance');
|
|
199
|
+
const hasAnyMaintenance = globalMaintenance.length > 0 ||
|
|
200
|
+
report.contexts.some((c) => findingsByCategory(c.findings.items, 'maintenance').length > 0);
|
|
201
|
+
if (hasAnyMaintenance) {
|
|
202
|
+
lines.push(t.bold('Maintenance'));
|
|
203
|
+
if (multiContext) {
|
|
204
|
+
if (globalMaintenance.length > 0) {
|
|
205
|
+
lines.push(` ${t.dim('Installation-wide')}`);
|
|
206
|
+
for (const finding of globalMaintenance) {
|
|
207
|
+
lines.push(` ${finding.title}`);
|
|
208
|
+
lines.push(wrapText(finding.message, width, 6, 4));
|
|
209
|
+
lines.push('');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
for (const ctx of report.contexts) {
|
|
213
|
+
const ctxMaintenance = findingsByCategory(ctx.findings.items, 'maintenance');
|
|
214
|
+
if (ctxMaintenance.length > 0) {
|
|
215
|
+
lines.push(wrapDim(`— ${ctx.key} · ${ctx.label}${ctx.isCurrent ? ' (current)' : ''}`, t, width, 4, 2));
|
|
216
|
+
for (const finding of ctxMaintenance) {
|
|
217
|
+
lines.push(` ${finding.title}`);
|
|
218
|
+
lines.push(wrapText(finding.message, width, 6, 4));
|
|
219
|
+
lines.push('');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const allMaintenance = [
|
|
226
|
+
...globalMaintenance,
|
|
227
|
+
...report.contexts.flatMap((c) => findingsByCategory(c.findings.items, 'maintenance')),
|
|
228
|
+
];
|
|
229
|
+
for (const finding of allMaintenance) {
|
|
230
|
+
lines.push(` ${finding.title}`);
|
|
231
|
+
lines.push(wrapText(finding.message, width, 4, 2));
|
|
232
|
+
lines.push('');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
141
235
|
}
|
|
142
|
-
|
|
143
|
-
|
|
236
|
+
lines.push(t.bold('Plugins'));
|
|
237
|
+
for (const context of report.contexts) {
|
|
238
|
+
if (report.contexts.length > 1) {
|
|
239
|
+
lines.push(wrapDim(`— ${context.key} · ${context.label}${context.isCurrent ? ' (current)' : ''}`, t, width, 4, 2));
|
|
240
|
+
}
|
|
241
|
+
for (const ep of context.effectivePlugins.items) {
|
|
242
|
+
for (const line of effectivePluginLines(ep, t, width)) {
|
|
243
|
+
lines.push(line);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (context.effectivePlugins.omitted > 0) {
|
|
247
|
+
lines.push(` ${t.dim(`… +${context.effectivePlugins.omitted} more`)}`);
|
|
248
|
+
}
|
|
249
|
+
if (context.plugins.omitted > 0) {
|
|
250
|
+
lines.push(` ${t.dim(`… +${context.plugins.omitted} more inventory record(s)`)}`);
|
|
251
|
+
}
|
|
252
|
+
const disabled = context.plugins.items.filter((p) => p.selection === 'disabled');
|
|
253
|
+
if (disabled.length > 0) {
|
|
254
|
+
lines.push(` ${t.dim('Disabled:')}`);
|
|
255
|
+
for (const d of disabled) {
|
|
256
|
+
lines.push(wrapDim(`${d.id} v${d.version} (${d.scope})`, t, width, 6, 4));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
144
259
|
}
|
|
145
260
|
lines.push('');
|
|
146
|
-
|
|
261
|
+
const claudeVer = report.claude.version ?? '(version unknown)';
|
|
262
|
+
const optionParts = [`scope ${report.options.scope}`];
|
|
263
|
+
if (report.options.allProjects)
|
|
264
|
+
optionParts.push('all projects');
|
|
265
|
+
if (report.options.strict)
|
|
266
|
+
optionParts.push('strict');
|
|
267
|
+
lines.push(wrapDim(`Claude Code ${claudeVer} · ${optionParts.join(' · ')}`, t, width, 0, 0));
|
|
268
|
+
lines.push('');
|
|
269
|
+
}
|
|
270
|
+
const COMPONENT_DISPLAY_ORDER = ['commands', 'skills', 'agents', 'outputStyles', 'themes'];
|
|
271
|
+
function packChips(chips, indent, width) {
|
|
272
|
+
if (chips.length === 0)
|
|
273
|
+
return [];
|
|
274
|
+
const pfx = ' '.repeat(indent);
|
|
275
|
+
const lines = [];
|
|
276
|
+
let current = pfx + '[';
|
|
277
|
+
for (let i = 0; i < chips.length; i++) {
|
|
278
|
+
const sep = i === 0 ? '' : ' · ';
|
|
279
|
+
const suffix = i === chips.length - 1 ? ']' : '';
|
|
280
|
+
const addition = sep + chips[i] + suffix;
|
|
281
|
+
if (current.length + addition.length <= width) {
|
|
282
|
+
current += addition;
|
|
283
|
+
}
|
|
284
|
+
else if (current === pfx + '[' || current === pfx) {
|
|
285
|
+
current += addition;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
lines.push(current);
|
|
289
|
+
current = pfx + chips[i] + suffix;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (current.length > 0)
|
|
293
|
+
lines.push(current);
|
|
294
|
+
return lines;
|
|
295
|
+
}
|
|
296
|
+
function effectivePluginLines(ep, t, width) {
|
|
297
|
+
let state;
|
|
298
|
+
if (ep.selection === 'ambiguous') {
|
|
299
|
+
state = t.yellow('ambiguous');
|
|
300
|
+
}
|
|
301
|
+
else if (ep.reason === 'scan_equivalent') {
|
|
302
|
+
state = `active ${t.dim('(equivalent records)')}`;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
state = 'active';
|
|
306
|
+
}
|
|
307
|
+
const tokens = ep.estAlwaysOnTokens !== null ? ` ${t.dim(formatApproxTokens(ep.estAlwaysOnTokens) + ' tok')}` : '';
|
|
308
|
+
const chips = [];
|
|
309
|
+
if (ep.components) {
|
|
310
|
+
for (const type of COMPONENT_DISPLAY_ORDER) {
|
|
311
|
+
const summary = ep.components[type];
|
|
312
|
+
if (summary && summary.count > 0)
|
|
313
|
+
chips.push(`${type} ${summary.count}`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const chipStr = chips.length > 0 ? ` ${t.dim(`[${chips.join(' · ')}]`)}` : '';
|
|
317
|
+
const ver = ep.versions.items.length === 1 ? ep.versions.items[0] : ep.versions.items.join('/');
|
|
318
|
+
const scope = ep.scopes.items.length === 1 ? ep.scopes.items[0] : ep.scopes.items.join('/');
|
|
319
|
+
// Try single line
|
|
320
|
+
const full = ` ${t.bold(ep.id)} ${t.dim(`v${ver} (${scope})`)} ${state}${tokens}${chipStr}`;
|
|
321
|
+
if (stripAnsi(full).length <= width)
|
|
322
|
+
return [full];
|
|
323
|
+
// Two-line layout: ID + state + tokens on first line, version/chips on second
|
|
324
|
+
const line1 = ` ${t.bold(ep.id)} ${state}${tokens}`;
|
|
325
|
+
const line2 = ` ${t.dim(`v${ver} (${scope})`)}${chipStr}`;
|
|
326
|
+
const result = [];
|
|
327
|
+
if (stripAnsi(line1).length > width) {
|
|
328
|
+
const idWrapped = wrapText(ep.id, width, 4, 2);
|
|
329
|
+
for (const idLine of idWrapped.split('\n')) {
|
|
330
|
+
result.push(t.bold(idLine));
|
|
331
|
+
}
|
|
332
|
+
result.push(` ${state}${tokens}`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
result.push(line1);
|
|
336
|
+
}
|
|
337
|
+
if (stripAnsi(line2).length > width) {
|
|
338
|
+
const verPlain = `v${ver} (${scope})`;
|
|
339
|
+
const verWrapped = wrapText(verPlain, width, 6, 4);
|
|
340
|
+
for (const vLine of verWrapped.split('\n')) {
|
|
341
|
+
result.push(t.dim(vLine));
|
|
342
|
+
}
|
|
343
|
+
if (chips.length > 0) {
|
|
344
|
+
for (const chipLine of packChips(chips, 4, width)) {
|
|
345
|
+
result.push(t.dim(chipLine));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
result.push(line2);
|
|
351
|
+
}
|
|
352
|
+
return result;
|
|
147
353
|
}
|
package/dist/doctor/report.d.ts
CHANGED
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const DOCTOR_SCHEMA_VERSION = 1;
|
|
12
12
|
export type Severity = 'error' | 'warning' | 'info';
|
|
13
|
+
export type FindingCategory = 'confirmed_problem' | 'review' | 'coverage' | 'maintenance';
|
|
13
14
|
export type ScopeFilter = 'user' | 'project' | 'local' | 'all';
|
|
14
15
|
export type KnownScope = 'user' | 'project' | 'local' | 'managed';
|
|
15
16
|
export type RecordScope = KnownScope | 'unknown';
|
|
17
|
+
export type SelectionReason = 'single' | 'shared_install' | 'scan_equivalent' | 'unresolved';
|
|
16
18
|
export interface DoctorFlags {
|
|
17
19
|
json: boolean;
|
|
18
20
|
strict: boolean;
|
|
21
|
+
verbose: boolean;
|
|
22
|
+
open: boolean;
|
|
19
23
|
scope: ScopeFilter;
|
|
20
24
|
allProjects: boolean;
|
|
21
25
|
}
|
|
@@ -62,6 +66,7 @@ export interface EffectiveInstance {
|
|
|
62
66
|
contextKey: string;
|
|
63
67
|
id: string;
|
|
64
68
|
selection: Selection;
|
|
69
|
+
reason: SelectionReason;
|
|
65
70
|
/** The selected record; null when ambiguous. */
|
|
66
71
|
record: InstallationRecord | null;
|
|
67
72
|
contenders: InstallationRecord[];
|
|
@@ -74,7 +79,13 @@ export interface ComponentInfo {
|
|
|
74
79
|
description: string | null;
|
|
75
80
|
/** False when the bounded frontmatter reader could not understand the file. */
|
|
76
81
|
estimable: boolean;
|
|
77
|
-
|
|
82
|
+
/** True only for unquoted YAML boolean `true` in frontmatter. */
|
|
83
|
+
disableModelInvocation: boolean;
|
|
84
|
+
/** Characters contributing to the session listing: name + description + whenToUse (skills). */
|
|
85
|
+
listingChars: number;
|
|
86
|
+
/** False when the bounded parser could not determine all listing text (e.g. skill
|
|
87
|
+
* with no description may use a first-body-paragraph fallback we cannot safely parse). */
|
|
88
|
+
listingComplete: boolean;
|
|
78
89
|
bodyChars: number;
|
|
79
90
|
/** Normalized content hash — only for skill/command/agent. */
|
|
80
91
|
hash: string | null;
|
|
@@ -177,6 +188,7 @@ export interface CappedList<T> {
|
|
|
177
188
|
export interface Finding {
|
|
178
189
|
code: string;
|
|
179
190
|
severity: Severity;
|
|
191
|
+
category: FindingCategory;
|
|
180
192
|
title: string;
|
|
181
193
|
message: string;
|
|
182
194
|
pluginIds: CappedList<string>;
|
|
@@ -235,22 +247,49 @@ export interface PluginEntry {
|
|
|
235
247
|
}[];
|
|
236
248
|
inventoryIncomplete: boolean;
|
|
237
249
|
}
|
|
250
|
+
export interface EffectivePluginEntry {
|
|
251
|
+
id: string;
|
|
252
|
+
selection: Selection;
|
|
253
|
+
reason: SelectionReason;
|
|
254
|
+
recordCount: number;
|
|
255
|
+
scopes: CappedList<string>;
|
|
256
|
+
versions: CappedList<string>;
|
|
257
|
+
estAlwaysOnTokens: number | null;
|
|
258
|
+
estimated: boolean;
|
|
259
|
+
inventoryIncomplete: boolean;
|
|
260
|
+
components: Record<string, ComponentTypeSummary> | null;
|
|
261
|
+
capabilities: PluginCapabilities | null;
|
|
262
|
+
largestOnInvoke: {
|
|
263
|
+
path: string;
|
|
264
|
+
tokens: number;
|
|
265
|
+
}[];
|
|
266
|
+
}
|
|
267
|
+
export interface ContextContributors {
|
|
268
|
+
top: {
|
|
269
|
+
id: string;
|
|
270
|
+
tokens: number;
|
|
271
|
+
}[];
|
|
272
|
+
remainingCount: number;
|
|
273
|
+
remainingTokens: number;
|
|
274
|
+
}
|
|
238
275
|
export interface ContextReport {
|
|
239
276
|
key: string;
|
|
240
277
|
label: string;
|
|
241
278
|
isCurrent: boolean;
|
|
242
279
|
plugins: CappedList<PluginEntry>;
|
|
280
|
+
effectivePlugins: CappedList<EffectivePluginEntry>;
|
|
281
|
+
contributors: ContextContributors | null;
|
|
243
282
|
findings: CappedList<Finding>;
|
|
244
283
|
summary: {
|
|
245
|
-
/** Unambiguous ('sole') effective instances only — ambiguous plugins are
|
|
246
|
-
* excluded from context totals and counted separately. */
|
|
247
284
|
activePlugins: number;
|
|
248
285
|
ambiguousPlugins: number;
|
|
249
286
|
disabledRecords: number;
|
|
250
287
|
estimatedAlwaysOnTokens: number | null;
|
|
251
|
-
/** False when any counted plugin's scan was incomplete, unestimable, or
|
|
252
|
-
* unreachable — the token total is then a lower bound, not a full sum. */
|
|
253
288
|
estimateComplete: boolean;
|
|
289
|
+
confirmedProblems: number;
|
|
290
|
+
reviewItems: number;
|
|
291
|
+
coverageGaps: number;
|
|
292
|
+
maintenanceNotes: number;
|
|
254
293
|
};
|
|
255
294
|
}
|
|
256
295
|
export interface DoctorReport {
|
|
@@ -276,6 +315,10 @@ export interface DoctorReport {
|
|
|
276
315
|
errors: number;
|
|
277
316
|
warnings: number;
|
|
278
317
|
notes: number;
|
|
318
|
+
confirmedProblems: number;
|
|
319
|
+
reviewItems: number;
|
|
320
|
+
coverageGaps: number;
|
|
321
|
+
maintenanceNotes: number;
|
|
279
322
|
otherProjectRecordsIgnored: number;
|
|
280
323
|
};
|
|
281
324
|
scan: {
|
|
@@ -293,6 +336,8 @@ export declare const MAX_EVIDENCE_STRING = 200;
|
|
|
293
336
|
export declare const MAX_MESSAGE_CHARS = 500;
|
|
294
337
|
export declare const MAX_CONTEXTS = 50;
|
|
295
338
|
export declare const MAX_PLUGINS_PER_CONTEXT = 200;
|
|
339
|
+
export declare const MAX_EFFECTIVE_PLUGINS_PER_CONTEXT = 200;
|
|
340
|
+
export declare const MAX_TOP_CONTRIBUTORS = 3;
|
|
296
341
|
export declare const MAX_UNKNOWN_SCOPE_RECORDS = 50;
|
|
297
342
|
export declare const MAX_CAPABILITY_ITEMS = 25;
|
|
298
343
|
export declare function cappedList<T>(items: T[], cap: number): CappedList<T>;
|
package/dist/doctor/report.js
CHANGED
|
@@ -20,6 +20,8 @@ export const MAX_EVIDENCE_STRING = 200;
|
|
|
20
20
|
export const MAX_MESSAGE_CHARS = 500;
|
|
21
21
|
export const MAX_CONTEXTS = 50;
|
|
22
22
|
export const MAX_PLUGINS_PER_CONTEXT = 200;
|
|
23
|
+
export const MAX_EFFECTIVE_PLUGINS_PER_CONTEXT = 200;
|
|
24
|
+
export const MAX_TOP_CONTRIBUTORS = 3;
|
|
23
25
|
export const MAX_UNKNOWN_SCOPE_RECORDS = 50;
|
|
24
26
|
export const MAX_CAPABILITY_ITEMS = 25;
|
|
25
27
|
export function cappedList(items, cap) {
|