@virling/ccdoctor 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project are documented here. The format follows [Kee
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.3.0] - 2026-11-27
8
+
9
+ ### Added
10
+
11
+ - Claude Code plugin: `/plugin install ccdoctor@virling` runs the checks at every session start and warns only when something is broken.
12
+ - `ccdoctor hook`: the SessionStart hook mode behind the plugin.
13
+
7
14
  ## [0.2.0] - 2026-11-27
8
15
 
9
16
  ### Added
@@ -20,6 +27,7 @@ All notable changes to this project are documented here. The format follows [Kee
20
27
  - Warns when an MCP server is registered but the hooks it ships are missing.
21
28
  - `--json` output; exit code 1 when any check fails.
22
29
 
23
- [Unreleased]: https://github.com/virling/ccdoctor/compare/v0.2.0...HEAD
30
+ [Unreleased]: https://github.com/virling/ccdoctor/compare/v0.3.0...HEAD
31
+ [0.3.0]: https://github.com/virling/ccdoctor/compare/v0.2.0...v0.3.0
24
32
  [0.2.0]: https://github.com/virling/ccdoctor/compare/v0.1.0...v0.2.0
25
33
  [0.1.0]: https://github.com/virling/ccdoctor/releases/tag/v0.1.0
package/README.md CHANGED
@@ -16,6 +16,17 @@ Run it from your project, or any folder inside it. ccdoctor walks up to the proj
16
16
  npx @virling/ccdoctor
17
17
  ```
18
18
 
19
+ ### Check every session automatically
20
+
21
+ Install it as a Claude Code plugin and it runs at the start of every session. It stays silent when everything is fine, and when something is broken you see a one-line warning and Claude is told the details:
22
+
23
+ ```
24
+ /plugin marketplace add virling/agentmem
25
+ /plugin install ccdoctor@virling
26
+ ```
27
+
28
+ The session-start check skips `--probe`, so it only reads files and finishes in well under a second.
29
+
19
30
  ## Example
20
31
 
21
32
  ```
package/bin/ccdoctor.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { doctor, format, summary } from "../src/checks.js";
2
+ import { doctor, format, hookOutput, summary } from "../src/checks.js";
3
3
  import { paths } from "../src/config.js";
4
4
 
5
5
  const HELP = `ccdoctor: check a Claude Code setup for broken or unwired pieces
@@ -8,6 +8,7 @@ const HELP = `ccdoctor: check a Claude Code setup for broken or unwired pieces
8
8
  ccdoctor --probe also start each stdio MCP server and list its tools
9
9
  ccdoctor --timeout <s> probe timeout in seconds (default 10)
10
10
  ccdoctor --json print results as JSON
11
+ ccdoctor hook SessionStart hook mode: prints a warning only when something is wrong
11
12
  ccdoctor --help
12
13
 
13
14
  Reads ~/.claude (or CLAUDE_CONFIG_DIR), ~/.claude.json and the current folder's
@@ -19,6 +20,14 @@ if (flags.has("--help") || flags.has("-h")) {
19
20
  console.log(HELP);
20
21
  process.exit(0);
21
22
  }
23
+ if (args[0] === "hook") {
24
+ let raw = "";
25
+ for await (const chunk of process.stdin) raw += chunk;
26
+ const cwd = (raw.trim() && JSON.parse(raw).cwd) || process.cwd();
27
+ const out = hookOutput(await doctor(paths({ cwd })));
28
+ if (out) process.stdout.write(JSON.stringify(out));
29
+ process.exit(0);
30
+ }
22
31
  const ti = args.indexOf("--timeout");
23
32
  const timeout = ti >= 0 ? Number(args[ti + 1]) * 1000 : 10000;
24
33
  const unknown = args.filter((a, i) => !["--probe", "--json", "--timeout"].includes(a) && !(ti >= 0 && i === ti + 1));
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@virling/ccdoctor",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Check a Claude Code setup for broken hooks, MCP servers and plugins",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ccdoctor": "bin/ccdoctor.js"
8
8
  },
9
9
  "scripts": {
10
- "test": "node --test"
10
+ "test": "node --test",
11
+ "version": "node scripts/sync-version.js && git add .claude-plugin"
11
12
  },
12
13
  "engines": {
13
14
  "node": ">=20"
@@ -21,11 +22,11 @@
21
22
  "diagnostics"
22
23
  ],
23
24
  "files": [
24
- "bin",
25
- "src",
26
- "README.md",
25
+ "CHANGELOG.md",
27
26
  "LICENSE",
28
- "CHANGELOG.md"
27
+ "README.md",
28
+ "bin",
29
+ "src"
29
30
  ],
30
31
  "publishConfig": {
31
32
  "access": "public"
package/src/checks.js CHANGED
@@ -117,6 +117,19 @@ export function summary(results) {
117
117
  return { ok: count("ok"), warn: count("warn"), fail: count("fail") };
118
118
  }
119
119
 
120
+ export function hookOutput(results) {
121
+ const problems = results.filter((r) => r.level !== "ok" && r.level !== "info");
122
+ if (!problems.length) return null;
123
+ const list = problems.map((r) => `${r.level} ${r.section}: ${r.name}${r.detail ? `: ${r.detail}` : ""}`);
124
+ return {
125
+ systemMessage: `ccdoctor: ${problems.length} problem${problems.length === 1 ? "" : "s"} in your Claude Code setup. ${list[0]}${problems.length > 1 ? ` (and ${problems.length - 1} more)` : ""}. Run npx @virling/ccdoctor for details.`,
126
+ hookSpecificOutput: {
127
+ hookEventName: "SessionStart",
128
+ additionalContext: `ccdoctor found problems in this Claude Code setup. Tell the user about them before starting other work:\n${list.join("\n")}`,
129
+ },
130
+ };
131
+ }
132
+
120
133
  export function format(results) {
121
134
  const lines = [];
122
135
  for (const section of new Set(results.map((r) => r.section))) {