@infinitedusky/indusk-mcp 1.7.3 → 1.7.4

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.
@@ -3,19 +3,23 @@
3
3
  * PreToolUse hook: blocks Edit/Write on project files until /catchup is complete.
4
4
  *
5
5
  * Reads .claude/handoff.md and checks that all Catchup Status boxes are checked.
6
- * Allows edits TO the handoff file itself (so catchup can check off boxes).
6
+ * Allows edits TO the handoff file itself BUT if the edit is checking off
7
+ * "mcp-ready", the hook verifies MCP servers are actually reachable first.
7
8
  * Allows edits if no handoff file exists (first session, no enforcement).
8
9
  *
9
10
  * Exit 0 = allow
10
11
  * Exit 2 = block (stderr sent to agent)
11
12
  */
12
13
 
14
+ import { execSync } from "node:child_process";
15
+ import { createConnection } from "node:net";
13
16
  import { existsSync, readFileSync } from "node:fs";
14
17
  import { join, resolve } from "node:path";
15
18
 
16
19
  const input = JSON.parse(readFileSync("/dev/stdin", "utf-8"));
17
20
  const toolInput = input.tool_input ?? {};
18
21
  const filePath = toolInput.file_path ?? "";
22
+ const newString = toolInput.new_string ?? "";
19
23
 
20
24
  // Find project root by looking for .claude/ directory
21
25
  function findProjectRoot() {
@@ -29,6 +33,17 @@ function findProjectRoot() {
29
33
  return process.cwd();
30
34
  }
31
35
 
36
+ /** TCP check: can we connect to host:port? */
37
+ function checkTcp(host, port, timeoutMs = 3000) {
38
+ return new Promise((resolve) => {
39
+ const sock = createConnection({ host, port });
40
+ sock.setTimeout(timeoutMs);
41
+ sock.on("connect", () => { sock.end(); resolve(true); });
42
+ sock.on("error", () => resolve(false));
43
+ sock.on("timeout", () => { sock.destroy(); resolve(false); });
44
+ });
45
+ }
46
+
32
47
  const projectRoot = findProjectRoot();
33
48
  const handoffPath = join(projectRoot, ".claude", "handoff.md");
34
49
 
@@ -37,8 +52,41 @@ if (!existsSync(handoffPath)) {
37
52
  process.exit(0);
38
53
  }
39
54
 
40
- // Always allow edits to the handoff file itself (catchup needs to check boxes)
55
+ // Edits to handoff.md allowed, but with MCP verification gate
41
56
  if (filePath.endsWith("handoff.md")) {
57
+ // If the edit is checking off mcp-ready, verify MCP servers are actually up
58
+ if (newString.includes("[x] mcp-ready")) {
59
+ const errors = [];
60
+
61
+ // Check FalkorDB (indusk-infra container) on localhost:6379
62
+ const falkorUp = await checkTcp("localhost", 6379);
63
+ if (!falkorUp) {
64
+ errors.push("FalkorDB not reachable on localhost:6379 — is indusk-infra running? Try: docker start indusk-infra");
65
+ }
66
+
67
+ // Check Graphiti on localhost:8100
68
+ try {
69
+ const health = execSync("curl -sf http://localhost:8100/health", {
70
+ encoding: "utf-8",
71
+ timeout: 5000,
72
+ stdio: ["ignore", "pipe", "pipe"],
73
+ }).trim();
74
+ if (!health.includes("healthy")) {
75
+ errors.push("Graphiti responded but not healthy on localhost:8100");
76
+ }
77
+ } catch {
78
+ errors.push("Graphiti MCP server not reachable on localhost:8100 — may still be starting (~90s after container restart)");
79
+ }
80
+
81
+ if (errors.length > 0) {
82
+ process.stderr.write(
83
+ `Cannot check off mcp-ready — infrastructure verification failed:\n` +
84
+ errors.map((e) => ` - ${e}`).join("\n") + "\n" +
85
+ `Fix the issues above before proceeding with catchup.`,
86
+ );
87
+ process.exit(2);
88
+ }
89
+ }
42
90
  process.exit(0);
43
91
  }
44
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinitedusky/indusk-mcp",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "InDusk development system — skills, MCP tools, and CLI for structured AI-assisted development",
5
5
  "type": "module",
6
6
  "files": [
package/skills/catchup.md CHANGED
@@ -5,6 +5,28 @@ description: Get caught up on the project. Reads the handoff from the last sessi
5
5
 
6
6
  You are starting a new session on this project. Before doing anything else, get caught up.
7
7
 
8
+ ## Step 0. Wait for MCP Servers (BLOCKING)
9
+
10
+ Before running any catchup steps, verify that ALL required MCP servers are available. Catchup depends on these tools and **cannot proceed without them**.
11
+
12
+ **Required MCP servers:**
13
+ - **indusk** — `get_system_version` (provides lessons, health, context, plans, extensions, graph tools)
14
+ - **codegraphcontext** — `mcp__codegraphcontext__list_indexed_repositories` (provides code graph queries)
15
+
16
+ **How to check:** Call `get_system_version` and `mcp__codegraphcontext__list_indexed_repositories`. If either tool is not available or errors, wait 5 seconds and retry. Retry up to 6 times (30 seconds total).
17
+
18
+ - If all servers become available: check off `- [x] mcp-ready` in the handoff, then proceed with catchup.
19
+ - If any server is still unavailable after 30 seconds: **STOP. Do not proceed.** Tell the user exactly which MCP server(s) failed and how to fix them:
20
+ - indusk: "InDusk MCP server not available — check `.mcp.json` config or restart Claude Code."
21
+ - codegraphcontext: "CGC MCP server not available — check `.mcp.json` config or restart Claude Code."
22
+ - Then say: "Catchup cannot continue with missing servers. Fix the issue and run `/catchup` again."
23
+
24
+ **This step is enforced by a hook.** The `check-catchup.js` hook verifies that FalkorDB (port 6379) and Graphiti (port 8100) are reachable before allowing `mcp-ready` to be checked off. The agent cannot bypass this.
25
+
26
+ **Do NOT skip steps. Do NOT fall back to shell commands. Do NOT proceed with partial functionality.** A half-completed catchup is worse than no catchup — it creates the illusion that the system is ready when it isn't.
27
+
28
+ **CRITICAL: Never run bare `cgc` commands via Bash.** The `cgc` CLI does not have the correct database configuration without env vars that only the MCP tools provide. Running bare `cgc` will connect to FalkorDB Lite (an embedded database) instead of the shared FalkorDB in the indusk-infra container. Always use the indusk MCP tools (`graph_ensure`, `graph_stats`, `index_project`) for all code graph operations.
29
+
8
30
  ## Steps (execute in order)
9
31
 
10
32
  ### 1. Read Handoff
package/skills/handoff.md CHANGED
@@ -34,6 +34,7 @@ Create or overwrite `.claude/handoff.md` with:
34
34
  {Gotchas the next agent should know. "The FalkorDB graph needs reindexing." "The hooks aren't published yet — version 1.0.3 has them." "Don't touch init.ts until the extension system PR is merged."}
35
35
 
36
36
  ## Catchup Status
37
+ - [ ] mcp-ready
37
38
  - [ ] handoff
38
39
  - [ ] lessons
39
40
  - [ ] skills