@skathio/somi 2.0.1 → 2.0.2

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.
@@ -13,7 +13,7 @@
13
13
  "url": "https://github.com/skathio/somi.git"
14
14
  },
15
15
  "description": "MAX/ECO economy: discover/design (MAX) → plan / code / review (ECO) workflow system with SOLID, OWASP, and clean-code guardrails.",
16
- "version": "2.0.1",
16
+ "version": "2.0.2",
17
17
  "tags": ["workflow", "agents", "review", "security"],
18
18
  "homepage": "https://github.com/skathio/somi"
19
19
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "somi",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "displayName": "SoMi",
5
5
  "description": "Multi-agent engineering workflow system: plan, code, review — with SOLID/OWASP guardrails, deterministic hooks, and a global ruleset.",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "somi",
3
3
  "displayName": "SoMi",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "description": "Multi-agent engineering workflow system: plan, code, review — with SOLID/OWASP guardrails, deterministic hooks, and a global ruleset.",
6
6
  "keywords": [
7
7
  "workflow",
@@ -11,7 +11,7 @@
11
11
  "name": "somi",
12
12
  "source": "github:skathio/somi",
13
13
  "description": "MAX/ECO economy: discover/design (MAX) → plan / code / review (ECO) workflow system with SOLID, OWASP, and clean-code guardrails.",
14
- "version": "2.0.1",
14
+ "version": "2.0.2",
15
15
  "tags": ["workflow", "agents", "review", "security"],
16
16
  "homepage": "https://github.com/skathio/somi"
17
17
  }
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skathio/somi",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "scripts": {
5
5
  "test": "bash scripts/validate.sh"
6
6
  },
@@ -166,7 +166,16 @@ function main() {
166
166
  case 'record': {
167
167
  ensureLedger(LEDGER_DIR, LEDGER);
168
168
 
169
- const stdinText = fs.readFileSync(0, 'utf8');
169
+ let stdinText;
170
+ try {
171
+ stdinText = fs.readFileSync(0, 'utf8');
172
+ } catch {
173
+ // Any OS-level read failure — e.g. Windows raises EAGAIN for a synchronous read of
174
+ // a TTY console handle (no piped input attached) rather than blocking, the POSIX
175
+ // behavior — should degrade to the same clean die() exit every other bad-input path
176
+ // here uses, not an uncaught exception.
177
+ die('failed to read stdin — findings must be piped in as a JSON array');
178
+ }
170
179
  let input;
171
180
  try {
172
181
  input = JSON.parse(stdinText);
@@ -0,0 +1,18 @@
1
+ // Node --require preload: makes fs.readFileSync(0, …) throw EAGAIN instead of returning
2
+ // data, standing in for a synchronous fd-0 read failure. Used to reproduce, platform-
3
+ // independently, the class of bug Windows hits for real when stdin is a TTY console handle
4
+ // (fs.readFileSync(0) on Windows throws EAGAIN there rather than blocking, the POSIX
5
+ // behavior — see nodejs/node#19831). Mutates the shared node:fs module object, which the
6
+ // ESM target under test observes via `import fs from 'node:fs'` (same underlying object).
7
+ 'use strict';
8
+ const fs = require('fs');
9
+ const realReadFileSync = fs.readFileSync;
10
+ fs.readFileSync = function mockReadFileSync(fd, ...rest) {
11
+ if (fd === 0) {
12
+ const err = new Error('EAGAIN: resource temporarily unavailable, read');
13
+ err.code = 'EAGAIN';
14
+ err.syscall = 'read';
15
+ throw err;
16
+ }
17
+ return realReadFileSync.call(fs, fd, ...rest);
18
+ };
@@ -132,6 +132,18 @@ check "record: resolved locus re-reported becomes a new finding (F-2)" \
132
132
  check "ledger: stored under .somi/reviews/<slug>/findings.json" \
133
133
  "$([[ -f "$REPO/.somi/reviews/demo/findings.json" ]]; echo $?)"
134
134
 
135
+ # --- somi-findings: record surfaces a clean error, not a raw crash, when the stdin
136
+ # read itself fails (fix-stdin-read-crash: fs.readFileSync(0) threw uncaught on any OS
137
+ # error — e.g. Windows' EAGAIN for a TTY stdin — bypassing this script's own die()/exit-64
138
+ # convention). Mocked platform-independently via a --require preload; see the fixture's
139
+ # header comment. -----------------------------------------------------------------------
140
+ STDIN_THROW_MOCK="$ROOT/tests/scripts/fixtures/mock-stdin-read-throw.cjs"
141
+ got=0
142
+ err="$(node --require "$STDIN_THROW_MOCK" "$FINDINGS" record --slug demo --review r6.md --run RUN4 --pass 1 2>&1 >/dev/null)" || got=$?
143
+ check "record: stdin read failure exits via die() (64), not an uncaught crash" "$([[ "$got" == "64" ]]; echo $?)"
144
+ check "record: stdin read failure prints the die() message, not a raw stack trace" \
145
+ "$([[ "$err" == "somi-findings: "* && "$err" != *"at Object."* ]]; echo $?)"
146
+
135
147
  # --- somi-check: portable working-tree guard -------------------------------------
136
148
  CHECK="$ROOT/scripts/somi-check.mjs"
137
149