microsoft / microsoft/playwright
[CLI]: find returns the full ancestor chain, and neither find nor snapshot can bound their output
- Dominant language
- TypeScript
- Stars
- 96.3k
- Forks
- 6.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 180
Description
`find` returns the whole ancestor chain of the match, so most of the output is wrapper nodes rather than the thing found. Searching a job board for one heading gave me eight levels of `generic [ref=eN]` to deliver three useful lines:
```
- generic [ref=e2]:
- generic [ref=e8]:
- generic [ref=e12]:
- generic [ref=e26]:
- generic [ref=e72]:
- link [ref=e73] [cursor=pointer]:
- /url: /pangramlabs/64baa007...
- generic [ref=e74]:
- heading "AI Research Scientist (NLP)" [level=3] [ref=e75]
```
For agent use this matters because the output is the context budget. A mode that returns the matched node plus its immediate children, without the path back to root, would cut that several-fold.
Related, there is no way to bound the output when a query is common: no `--max-results` on `find`, and no depth limit on `snapshot`, so a deeply nested SPA produces a large tree when two levels would do. Version 0.1.17.
Contributor guide
Research direction
Start at the CLI entry points for `find` and `snapshot`, then trace how their output and options are assembled. Check existing CLI tests for these commands before defining coverage for matched-node output, `--max-results`, and snapshot depth limits; done means bounded output is exposed consistently and the current behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100