diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index d295e4c..46f6fe2 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -5,7 +5,7 @@ "url": "https://github.com/reqstool" }, "metadata": { - "version": "0.5.0", + "version": "0.5.1", "description": "AI-assisted reqstool requirements traceability — skills and commands for managing requirements, SVCs, and filters, with optional OpenSpec integration." }, "plugins": [ diff --git a/plugins/reqstool-openspec/.claude-plugin/plugin.json b/plugins/reqstool-openspec/.claude-plugin/plugin.json index 3e9c4b6..f6ef03a 100644 --- a/plugins/reqstool-openspec/.claude-plugin/plugin.json +++ b/plugins/reqstool-openspec/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "reqstool-openspec", "description": "OpenSpec integration for reqstool — conventions for referencing reqstool IDs in OpenSpec files, plus an openspecui hook that enriches all OpenSpec documents with reqstool requirement/SVC titles and descriptions at read time.", - "version": "0.2.1", + "version": "0.2.2", "author": { "name": "reqstool", "url": "https://github.com/reqstool" diff --git a/plugins/reqstool-openspec/skills/reqstool-openspec-init/references/openspecui.hooks.ts b/plugins/reqstool-openspec/skills/reqstool-openspec-init/references/openspecui.hooks.ts index 49a96ee..4c6b92b 100644 --- a/plugins/reqstool-openspec/skills/reqstool-openspec-init/references/openspecui.hooks.ts +++ b/plugins/reqstool-openspec/skills/reqstool-openspec-init/references/openspecui.hooks.ts @@ -1,4 +1,4 @@ -// @reqstool-openspec-hooks: 0.1.1 +// @reqstool-openspec-hooks: 0.1.2 import { spawn, ChildProcess } from "child_process"; import type { OnReadDocumentHookV1 } from "openspecui/hooks"; @@ -28,9 +28,18 @@ class McpStdioClient { if (line) this.handle(line); } }); + this.proc.on("error", (err) => this.failPending(err)); + this.proc.on("exit", (code, signal) => + this.failPending(new Error(`reqstool mcp exited (code=${code}, signal=${signal})`)), + ); this.ready = this.init(); } + private failPending(err: Error) { + for (const { reject } of this.pending.values()) reject(err); + this.pending.clear(); + } + private handle(line: string) { try { const msg = JSON.parse(line) as { id?: number; result?: unknown; error?: { message: string } }; @@ -72,8 +81,12 @@ class McpStdioClient { const result = (await this.send("tools/call", { name: "enrich_document", arguments: { content, preset }, - })) as { content: { text: string }[] }; - return result.content[0].text; + })) as { content?: { text: string }[] }; + const text = result.content?.[0]?.text; + if (text === undefined) { + throw new Error(`reqstool mcp returned an unexpected enrich_document response: ${JSON.stringify(result)}`); + } + return text; } close() {