open-plan-annotator 0.2.11 → 0.2.13

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.
@@ -12,7 +12,7 @@
12
12
  "name": "open-plan-annotator",
13
13
  "source": "./",
14
14
  "description": "Interactive plan annotation UI: review, strikethrough, and comment on Claude's plans before approving. Fully local, no external services.",
15
- "version": "0.2.11",
15
+ "version": "0.2.13",
16
16
  "author": {
17
17
  "name": "ndom91"
18
18
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "open-plan-annotator",
3
3
  "description": "Interactive plan annotation UI: review, strikethrough, and comment on Claude's plans before approving. Fully local, no external services.",
4
- "version": "0.2.11",
4
+ "version": "0.2.13",
5
5
  "author": {
6
6
  "name": "ndom91"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execFileSync } = require("child_process");
3
+ const { execFileSync, spawn } = require("child_process");
4
4
  const path = require("path");
5
5
  const fs = require("fs");
6
6
 
@@ -39,11 +39,54 @@ if (!fs.existsSync(binaryPath)) {
39
39
  }
40
40
  }
41
41
 
42
- try {
43
- execFileSync(binaryPath, process.argv.slice(2), {
44
- stdio: ["pipe", "inherit", "inherit"],
45
- input: stdinBuffer,
46
- });
47
- } catch (e) {
48
- process.exit(e.status || 1);
49
- }
42
+ // Spawn the binary with detached so it can outlive this wrapper.
43
+ // We pipe stdout to detect the JSON hook output, then forward it and exit
44
+ // immediately the binary keeps its server alive in the background.
45
+ const child = spawn(binaryPath, process.argv.slice(2), {
46
+ stdio: ["pipe", "pipe", "inherit"],
47
+ detached: true,
48
+ });
49
+
50
+ child.stdin.write(stdinBuffer);
51
+ child.stdin.end();
52
+
53
+ let stdout = "";
54
+ let forwarded = false;
55
+
56
+ child.stdout.on("data", (chunk) => {
57
+ stdout += chunk;
58
+
59
+ if (forwarded) return;
60
+
61
+ // Look for a complete JSON line (the hook output)
62
+ const lines = stdout.split("\n");
63
+ for (const line of lines) {
64
+ const trimmed = line.trim();
65
+ if (!trimmed) continue;
66
+ try {
67
+ JSON.parse(trimmed);
68
+ // Valid JSON — forward it and exit, letting the binary run in the background
69
+ forwarded = true;
70
+ process.stdout.write(trimmed + "\n", () => {
71
+ child.unref();
72
+ process.exit(0);
73
+ });
74
+ return;
75
+ } catch {
76
+ // Not JSON yet, keep buffering
77
+ }
78
+ }
79
+ });
80
+
81
+ child.on("close", (code) => {
82
+ if (!forwarded) {
83
+ // Binary exited without producing valid JSON — forward whatever we have
84
+ if (stdout.trim()) process.stdout.write(stdout);
85
+ process.exit(code || 1);
86
+ }
87
+ });
88
+
89
+ child.on("error", (err) => {
90
+ console.error("open-plan-annotator: failed to spawn binary:", err.message);
91
+ process.exit(1);
92
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-plan-annotator",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "type": "module",
5
5
  "description": "Fully local plugin for interactive plan annotation from your Agentic assistants",
6
6
  "author": "ndom91",