Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: export run() to avoid Windows spawnSync issues (#431)

yang1002378395-cmyk9fcbe9751cd6
diff --git a/scripts/hooks/session-end-marker.js b/scripts/hooks/session-end-marker.js
index 549184104..c635a93d0 100755
--- a/scripts/hooks/session-end-marker.js
+++ b/scripts/hooks/session-end-marker.js
@@ -1,15 +1,29 @@
#!/usr/bin/env node
'use strict';
-const MAX_STDIN = 1024 * 1024;
-let raw = '';
-process.stdin.setEncoding('utf8');
-process.stdin.on('data', chunk => {
- if (raw.length < MAX_STDIN) {
- const remaining = MAX_STDIN - raw.length;
- raw += chunk.substring(0, remaining);
- }
-});
-process.stdin.on('end', () => {
- process.stdout.write(raw);
-});
+/**
+ * Session end marker hook - outputs stdin to stdout unchanged.
+ * Exports run() for in-process execution (avoids spawnSync issues on Windows).
+ */
+
+function run(rawInput) {
+ return rawInput || '';
+}
+
+// Legacy CLI execution (when run directly)
+if (require.main === module) {
+ const MAX_STDIN = 1024 * 1024;
+ let raw = '';
+ process.stdin.setEncoding('utf8');
+ process.stdin.on('data', chunk => {
+ if (raw.length < MAX_STDIN) {
+ const remaining = MAX_STDIN - raw.length;
+ raw += chunk.substring(0, remaining);
+ }
+ });
+ process.stdin.on('end', () => {
+ process.stdout.write(raw);
+ });
+}
+
+module.exports = { run };