@popoverai/dotrequirements 0.20.1 → 0.20.3

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.
@@ -3,6 +3,23 @@ import { promisify } from 'util';
3
3
  import { getProjectInfo, readProjectSettings, } from '../utils/project-settings.js';
4
4
  import { loadAllRequirements, getRequirementTree, formatRequirement, } from '../mcp/requirements.js';
5
5
  const execFileAsync = promisify(execFile);
6
+ function extractResults(parsed) {
7
+ if (Array.isArray(parsed))
8
+ return parsed;
9
+ if (parsed && typeof parsed === 'object') {
10
+ const obj = parsed;
11
+ // { results: [...] } format
12
+ if (Array.isArray(obj.results))
13
+ return obj.results;
14
+ // { structured_output: { results: [...] } } format
15
+ if (obj.structured_output && typeof obj.structured_output === 'object') {
16
+ const so = obj.structured_output;
17
+ if (Array.isArray(so.results))
18
+ return so.results;
19
+ }
20
+ }
21
+ throw new Error('Unexpected browser-automation output format');
22
+ }
6
23
  export async function browserTestCommand(requirementKey, url, options) {
7
24
  // 1. Find project and load settings
8
25
  const projectInfo = getProjectInfo();
@@ -69,10 +86,12 @@ export async function browserTestCommand(requirementKey, url, options) {
69
86
  // 9. Parse results
70
87
  let results;
71
88
  try {
72
- results = JSON.parse(stdout.trim());
89
+ const parsed = JSON.parse(stdout.trim());
90
+ results = extractResults(parsed);
73
91
  }
74
- catch {
92
+ catch (parseErr) {
75
93
  console.error('Error: Could not parse browser-automation output');
94
+ console.error(parseErr.message);
76
95
  console.error(stdout);
77
96
  process.exit(1);
78
97
  }
@@ -94,7 +113,8 @@ export async function browserTestCommand(requirementKey, url, options) {
94
113
  // browser-automation returns exit code 1 on failure, but still outputs JSON
95
114
  if (error.stdout) {
96
115
  try {
97
- const results = JSON.parse(error.stdout.trim());
116
+ const parsed = JSON.parse(error.stdout.trim());
117
+ const results = extractResults(parsed);
98
118
  if (options.json) {
99
119
  outputJson(requirementTree, results);
100
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popoverai/dotrequirements",
3
- "version": "0.20.1",
3
+ "version": "0.20.3",
4
4
  "description": "Requirements tracking CLI, test harness, and MCP server",
5
5
  "type": "module",
6
6
  "bin": {