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