claudepluginhub 0.10.0 → 0.12.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.
@@ -0,0 +1,84 @@
1
+ export function terminalWidth() {
2
+ const cols = process.stdout.columns;
3
+ if (!cols)
4
+ return 100;
5
+ return Math.max(72, Math.min(120, cols));
6
+ }
7
+ export function wrapText(text, width, indent, firstIndent) {
8
+ const prefix = " ".repeat(indent);
9
+ const firstPrefix = firstIndent != null ? " ".repeat(firstIndent) : "";
10
+ const lines = text.split("\n");
11
+ const result = [];
12
+ for (const line of lines) {
13
+ const words = line.split(" ").filter((w) => w.length > 0);
14
+ if (words.length === 0) {
15
+ result.push("");
16
+ continue;
17
+ }
18
+ let current = "";
19
+ let isFirstLine = true;
20
+ for (const word of words) {
21
+ const pfx = isFirstLine ? firstPrefix : prefix;
22
+ if (current.length === 0) {
23
+ // Hard-wrap tokens longer than available content width
24
+ if (pfx.length + word.length > width) {
25
+ let remaining = word;
26
+ while (remaining.length > 0) {
27
+ const p = current.length === 0 ? pfx : prefix;
28
+ const available = width - p.length;
29
+ if (available <= 0) {
30
+ result.push(p + remaining);
31
+ remaining = "";
32
+ }
33
+ else if (remaining.length <= available) {
34
+ current = p + remaining;
35
+ remaining = "";
36
+ }
37
+ else {
38
+ result.push(p + remaining.slice(0, available));
39
+ remaining = remaining.slice(available);
40
+ isFirstLine = false;
41
+ }
42
+ }
43
+ }
44
+ else {
45
+ current = pfx + word;
46
+ }
47
+ }
48
+ else if (current.length + 1 + word.length <= width) {
49
+ current = current + " " + word;
50
+ }
51
+ else {
52
+ result.push(current);
53
+ isFirstLine = false;
54
+ // The new word might itself be too long for the continuation
55
+ if (prefix.length + word.length > width) {
56
+ let remaining = word;
57
+ current = "";
58
+ while (remaining.length > 0) {
59
+ const available = width - prefix.length;
60
+ if (available <= 0) {
61
+ result.push(prefix + remaining);
62
+ remaining = "";
63
+ }
64
+ else if (remaining.length <= available) {
65
+ current = prefix + remaining;
66
+ remaining = "";
67
+ }
68
+ else {
69
+ result.push(prefix + remaining.slice(0, available));
70
+ remaining = remaining.slice(available);
71
+ }
72
+ }
73
+ }
74
+ else {
75
+ current = prefix + word;
76
+ }
77
+ }
78
+ }
79
+ if (current.length > 0) {
80
+ result.push(current);
81
+ }
82
+ }
83
+ return result.join("\n");
84
+ }
package/dist/index.js CHANGED
@@ -29,6 +29,8 @@ Commands:
29
29
  list List all installed collections
30
30
  remove <identifier> Remove
31
31
  recommend Recommend plugins for the current project
32
+ doctor Diagnose the Claude Code plugin setup (read-only,
33
+ offline; see \`doctor --help\`)
32
34
 
33
35
  Identifiers:
34
36
  owner/repo GitHub plugin or marketplace (via Claude Code)
@@ -71,6 +73,14 @@ Options:
71
73
  }
72
74
  async function main() {
73
75
  const args = process.argv.slice(2);
76
+ // doctor owns its full flag parsing (incl. `--scope all`, which the global
77
+ // parseArgs rejects, and its own --help) — route it before the global help
78
+ // intercept and parseArgs. It also owns its banner and exit codes (0/1/2).
79
+ if (args[0] === 'doctor') {
80
+ const { runDoctor } = await import('./doctor/run.js');
81
+ await runDoctor(args.slice(1));
82
+ return;
83
+ }
74
84
  if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
75
85
  printBanner();
76
86
  printUsage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudepluginhub",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Install Claude Code components from ClaudePluginHub",
5
5
  "bin": {
6
6
  "claudepluginhub": "dist/index.js"