@jwilger/pi-development-system 0.10.3 → 0.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilger/pi-development-system",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "A pi extension package representing a seasoned approach to software development using a full AI SDLC.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -68,15 +68,20 @@ const isRecord = (v: unknown): v is Record<string, unknown> =>
68
68
 
69
69
  /** Exit code of a bash tool result: structured `exit_code`, else pi's status line, else error/not. */
70
70
  export function exitCodeOf(result: ResultLike): number {
71
+ const reported = reportedExit(result);
72
+ if (reported !== 0) return reported;
73
+ // `npm test | tail` exits 0 whatever the tests did, even in the structured status; trust the output.
74
+ const masked = result.command !== undefined && MASKS_STATUS.test(result.command);
75
+ return masked && FAILURE_MARKERS.test(result.text) ? 1 : 0;
76
+ }
77
+
78
+ function reportedExit(result: ResultLike): number {
71
79
  if (isRecord(result.structured) && typeof result.structured.exit_code === "number") {
72
80
  return result.structured.exit_code;
73
81
  }
74
82
  const line = /Command exited with code (\d+)\s*$/.exec(result.text);
75
83
  if (line?.[1] !== undefined) return Number(line[1]);
76
- if (result.isError) return 1;
77
- // `npm test | tail` exits 0 whatever the tests did; trust the output over the masked status.
78
- const masked = result.command !== undefined && MASKS_STATUS.test(result.command);
79
- return masked && FAILURE_MARKERS.test(result.text) ? 1 : 0;
84
+ return result.isError ? 1 : 0;
80
85
  }
81
86
 
82
87
  /** The last few non-empty output lines, redacted and bounded: what the runner said at the end. */