harbor run -t openthoughts/tasktrove-exp-rpt-stack-dockerfile-gpt5mini-v3-stack-dockerfile-gpt4o-8218harbor download openthoughts/tasktrove-exp-rpt-stack-dockerfile-gpt5mini-v3-stack-dockerfile-gpt4o-8218Create a command-line Ruby tool (placed in /app) that uses Nokogiri to extract structured data from an HTML document and outputs JSON. The tool, configuration file format, sample HTML and a simple test harness must all live in /app.
Requirements
Expected behavior example
Given samples/sample.html:
And samples/config.json: { "items_selector": ".articles > article.item", "fields": { "title": "h2.title a", "url": "h2.title a@href", "author": "p.meta .author", "date": "p.meta time@datetime", "image": "img.thumb@src" } }
Running: bundle exec ruby html_extractor.rb -i samples/sample.html -c samples/config.json -b "https://example.com"
Expected stdout (samples/expected.json): [ { "title": "First Post", "url": "https://example.com/post/1", "author": "Alice", "date": "2021-01-01", "image": "https://example.com/images/1.png" }, { "title": "Second Post", "url": "https://cdn.example.com/images/2.png", "author": "Bob", "date": "2021-02-02", "image": "https://cdn.example.com/images/2.png" } ]
Additional constraints and hints
Deliverables (placed under /app)
The task is complete when running test_runner.sh prints PASS and exits with status 0 (after bundling).