Skip to content

Commit d35276f

Browse files
committed
feat(tools): pypi + producthunt tools (T-0018, T-0019)
1 parent 2cbd25a commit d35276f

6 files changed

Lines changed: 97 additions & 0 deletions

File tree

docs/stories/052-tool-pypi.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 052 - Tool: pypi
2+
3+
**Persona:** [CLI User](../personas/cli-user.md),
4+
[AI Coding Assistant](../personas/ai-coding-assistant.md)
5+
6+
## Goal
7+
8+
Fetch Python package metadata and latest changelog entry from PyPI for a given
9+
package name, returning structured data ready for scripting or display.
10+
11+
## Stories
12+
13+
- As a CLI user, I run `ibr tool pypi --param package=requests` to retrieve
14+
name, latest version, description, license, homepage, requires-python, author,
15+
and last release date.
16+
- As a CLI user, I also get the latest changelog/release notes entry when the
17+
project description includes one.
18+
- As a CLI user, omitting `package` produces a non-zero exit with a clear error.
19+
20+
## Acceptance Criteria
21+
22+
- Navigates to `https://pypi.org/project/<package>/`.
23+
- Extracts: `name`, `version`, `description`, `license`, `homepage`,
24+
`requires_python`, `author`, `last_release_date`.
25+
- Extracts latest changelog entry when present in project description.
26+
- Missing required param `package` → non-zero exit with "Missing required param: package".
27+
- Exit code 0 on successful extraction; stdout contains "Task execution completed".
28+
29+
## E2E Coverage
30+
31+
- `test/e2e/cli-tool-vcr.test.js` — VCR: exits 0, no config errors; required
32+
param validation.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# 053 - Tool: producthunt
2+
3+
**Persona:** [CLI User](../personas/cli-user.md),
4+
[AI Coding Assistant](../personas/ai-coding-assistant.md)
5+
6+
## Goal
7+
8+
Search Product Hunt for products matching a query and extract structured data
9+
(name, tagline, upvote count, URL, maker) for each result.
10+
11+
## Stories
12+
13+
- As a CLI user, I run `ibr tool producthunt --param query=notion` to retrieve
14+
a list of products with names, taglines, upvote counts, URLs, and makers.
15+
- As a CLI user, I pass `--param max_results=10` to control how many products
16+
are returned (default 5).
17+
- As a CLI user, omitting `query` produces a non-zero exit with a clear error.
18+
19+
## Acceptance Criteria
20+
21+
- Navigates to `https://www.producthunt.com/search?q=<query>`.
22+
- Extracts up to `max_results` (default 5) products per run.
23+
- Each extracted item contains: `name`, `tagline`, `upvotes`, `url`, `maker`.
24+
- Missing required param `query` → non-zero exit with "Missing required param: query".
25+
- Exit code 0 on successful extraction; stdout contains "Task execution completed".
26+
27+
## E2E Coverage
28+
29+
- `test/e2e/cli-tool-vcr.test.js` — VCR: exits 0, no config errors; required
30+
param validation.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
"{\"url\":\"{SERVER_URL}/tool-results.html\",\"instructions\":[{\"name\":\"extract\",\"prompt\":\"extract product search results with name, tagline, upvotes, url, and maker\"}]}",
3+
"[{\"name\":\"Notion\",\"tagline\":\"The all-in-one workspace\",\"upvotes\":4821,\"url\":\"https://www.producthunt.com/posts/notion-2\",\"maker\":\"Ivan Zhao\"},{\"name\":\"Notion AI\",\"tagline\":\"AI built right into your workspace\",\"upvotes\":3102,\"url\":\"https://www.producthunt.com/posts/notion-ai\",\"maker\":\"Ivan Zhao\"}]"
4+
]

test/e2e/cassettes/tool-pypi.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
"{\"url\":\"{SERVER_URL}/tool-results.html\",\"instructions\":[{\"name\":\"extract\",\"prompt\":\"extract package info: name, version, description, license, homepage, requires_python, author, last_release_date\"}]}",
3+
"[{\"name\":\"requests\",\"version\":\"2.31.0\",\"description\":\"Python HTTP for Humans.\",\"license\":\"Apache 2.0\",\"homepage\":\"https://requests.readthedocs.io\",\"requires_python\":\">=3.7\",\"author\":\"Kenneth Reitz\",\"last_release_date\":\"2023-05-22\"}]"
4+
]

tools/producthunt.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: producthunt
2+
description: Search Product Hunt for products and extract name, tagline, upvotes, URL, and maker
3+
params:
4+
- name: query
5+
description: Product name or keyword to search for
6+
required: true
7+
- name: max_results
8+
description: Maximum number of products to extract
9+
default: "5"
10+
url: "https://www.producthunt.com/search?q={{query}}"
11+
instructions:
12+
- wait for the search results to load
13+
- extract up to {{max_results}} products from the results list
14+
- for each product extract name, tagline, upvote count, product URL, and maker name

tools/pypi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: pypi
2+
description: Fetch Python package metadata and latest changelog from PyPI
3+
params:
4+
- name: package
5+
description: PyPI package name (e.g. requests, flask)
6+
required: true
7+
url: "https://pypi.org/project/{{package}}/"
8+
instructions:
9+
- wait for the page to load
10+
- extract the package name, latest version, short description, license,
11+
homepage URL, requires-python version, author, and last release date
12+
- if a changelog or release notes section exists in the project description,
13+
extract the latest entry

0 commit comments

Comments
 (0)