@popoverai/dotrequirements 0.20.2 → 0.20.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/dist/cli.js CHANGED
@@ -75,6 +75,7 @@ program
75
75
  .command('browsertest <requirement-key> [url]')
76
76
  .description('Run browser-based acceptance test for a requirement')
77
77
  .option('--json', 'Output results as JSON')
78
+ .option('--useAgent', 'Encourage Claude to use the Agent tool for multi-step tasks')
78
79
  .action(wrapCommand(browserTestCommand));
79
80
  program
80
81
  .command('mcp')
@@ -1,5 +1,6 @@
1
1
  interface BrowserTestOptions {
2
2
  json?: boolean;
3
+ useAgent?: boolean;
3
4
  }
4
5
  export declare function browserTestCommand(requirementKey: string, url: string | undefined, options: BrowserTestOptions): Promise<void>;
5
6
  export {};
@@ -4,18 +4,20 @@ import { getProjectInfo, readProjectSettings, } from '../utils/project-settings.
4
4
  import { loadAllRequirements, getRequirementTree, formatRequirement, } from '../mcp/requirements.js';
5
5
  const execFileAsync = promisify(execFile);
6
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
7
  if (Array.isArray(parsed))
18
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
+ }
19
21
  throw new Error('Unexpected browser-automation output format');
20
22
  }
21
23
  export async function browserTestCommand(requirementKey, url, options) {
@@ -80,7 +82,7 @@ export async function browserTestCommand(requirementKey, url, options) {
80
82
  console.log(`Testing ${requirementKey} against ${targetURL}...\n`);
81
83
  }
82
84
  try {
83
- const { stdout } = await execFileAsync('npx', ['@popoverai/browser-automation', 'test', targetURL, ...assertions], { env, maxBuffer: 10 * 1024 * 1024 });
85
+ const { stdout } = await execFileAsync('npx', ['@popoverai/browser-automation', 'test', ...(options.useAgent ? ['--useAgent'] : []), targetURL, ...assertions], { env, maxBuffer: 10 * 1024 * 1024 });
84
86
  // 9. Parse results
85
87
  let results;
86
88
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popoverai/dotrequirements",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "Requirements tracking CLI, test harness, and MCP server",
5
5
  "type": "module",
6
6
  "bin": {